const int ON_MAPLOAD = BIT(1);
const int NOSPLASH = BIT(8); // generic anti-splashdamage spawnflag
+// triggers
+const int SPAWNFLAG_NOMESSAGE = BIT(0);
+const int SPAWNFLAG_NOTOUCH = BIT(0); // why are these the same?
+
// bobbing
const int BOBBING_XAXIS = BIT(0);
const int BOBBING_YAXIS = BIT(1);
const int TELEPORT_FLAG_TDEATH = BIT(2);
const int TELEPORT_FLAG_FORCE_TDEATH = BIT(3);
-// triggers
-const int SPAWNFLAG_NOMESSAGE = BIT(0);
-const int SPAWNFLAG_NOTOUCH = BIT(0); // why are these the same?
-
// counter
const int COUNTER_FIRE_AT_COUNT = BIT(2);
+// gravity
+const int GRAVITY_STICKY = BIT(0); // keep gravity multiplier even after exiting the trigger_gravity
+const int GRAVITY_START_DISABLED = BIT(1);
+
//----------
// SENDFLAGS
//----------
}
}
+// legacy
void trigger_gravity_use(entity this, entity actor, entity trigger)
{
- this.state = !this.state;
+ this.setactive(this, ACTIVE_TOGGLE);
}
void trigger_gravity_touch(entity this, entity toucher)
{
float g;
- if(this.state != true)
+ if(this.active == ACTIVE_NOT)
return;
EXACTTRIGGER_TOUCH(this, toucher);
g = this.gravity;
- if (!(this.spawnflags & 1))
+ if (!(this.spawnflags & GRAVITY_STICKY))
{
if(toucher.trigger_gravity_check)
{
if(this == toucher.trigger_gravity_check.enemy)
{
// same?
+ // NOTE: see explanation in trigger_gravity_check_think
toucher.trigger_gravity_check.count = 2; // gravity one more frame...
return;
}
if(this.noise != "")
precache_sound(this.noise);
- this.state = true;
+ this.active = ACTIVE_ACTIVE;
+ this.setactive = generic_setactive;
IFTARGETED
{
+ // legacy use
this.use = trigger_gravity_use;
- if(this.spawnflags & 2)
- this.state = false;
+ if(this.spawnflags & GRAVITY_START_DISABLED)
+ this.active = ACTIVE_NOT;
}
}
#endif
else
{
//bprint("Not using setactive\n");
- if(this.cnt == ACTIVE_TOGGLE)
- if(trg.active == ACTIVE_ACTIVE)
- trg.active = ACTIVE_NOT;
- else
- trg.active = ACTIVE_ACTIVE;
- else
- trg.active = this.cnt;
+ generic_setactive(trg, this.cnt);
}
}
}
}
#ifdef SVQC
-void generic_netlinked_setactive(entity this, int act)
+void generic_setactive(entity this, int act)
{
- int old_status = this.active;
if(act == ACTIVE_TOGGLE)
{
if(this.active == ACTIVE_ACTIVE)
{
this.active = act;
}
+}
+
+void generic_netlinked_setactive(entity this, int act)
+{
+ int old_status = this.active;
+ generic_setactive(this, act);
if (this.active != old_status)
{
void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger);
+void generic_setactive(entity this, int act);
// generic methods for netlinked entities
void generic_netlinked_reset(entity this);
void generic_netlinked_setactive(entity this, int act);