GameLogEcho(s);
}
-void ball_restart()
-{SELFPARAM();
- if(self.owner)
- DropBall(self, self.owner.origin, '0 0 0');
+void ball_restart(entity this)
+{
+ if(this.owner)
+ DropBall(this, this.owner.origin, '0 0 0');
ResetBall();
}
W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
missile.angles = vectoangles(missile.velocity);
missile.touch = W_Nexball_Touch;
- missile.think = SUB_Remove;
+ missile.think = SUB_Remove_self;
missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
}
}
-void ons_CaptureShield_Reset()
-{SELFPARAM();
- self.colormap = self.enemy.colormap;
- self.team = self.enemy.team;
+void ons_CaptureShield_Reset(entity this)
+{
+ this.colormap = this.enemy.colormap;
+ this.team = this.enemy.team;
}
void ons_CaptureShield_Spawn(entity generator, bool is_generator)
CSQCMODEL_AUTOUPDATE(self);
}
-void ons_ControlPoint_Reset()
-{SELFPARAM();
- if(self.goalentity)
- remove(self.goalentity);
-
- self.goalentity = world;
- self.team = 0;
- self.colormap = 1024;
- self.iscaptured = false;
- self.islinked = false;
- self.isshielded = true;
- self.think = ons_ControlPoint_Think;
- self.ons_toucher = world;
- self.nextthink = time + ONS_CP_THINKRATE;
- setmodel_fixsize(self, MDL_ONS_CP_PAD1);
-
- WaypointSprite_UpdateMaxHealth(self.sprite, 0);
- WaypointSprite_UpdateRule(self.sprite,self.team,SPRITERULE_TEAMPLAY);
+void ons_ControlPoint_Reset(entity this)
+{
+ if(this.goalentity)
+ remove(this.goalentity);
+
+ this.goalentity = world;
+ this.team = 0;
+ this.colormap = 1024;
+ this.iscaptured = false;
+ this.islinked = false;
+ this.isshielded = true;
+ this.think = ons_ControlPoint_Think;
+ this.ons_toucher = world;
+ this.nextthink = time + ONS_CP_THINKRATE;
+ setmodel_fixsize(this, MDL_ONS_CP_PAD1);
+
+ WaypointSprite_UpdateMaxHealth(this.sprite, 0);
+ WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY);
onslaught_updatelinks();
- activator = self;
+ activator = this;
SUB_UseTargets(); // to reset the structures, playerspawns etc.
- CSQCMODEL_AUTOUPDATE(self);
+ CSQCMODEL_AUTOUPDATE(this);
}
void ons_DelayedControlPoint_Setup()
}
}
-void ons_GeneratorReset()
-{SELFPARAM();
- self.team = self.team_saved;
- self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health;
- self.takedamage = DAMAGE_AIM;
- self.bot_attack = true;
- self.iscaptured = true;
- self.islinked = true;
- self.isshielded = true;
- self.event_damage = ons_GeneratorDamage;
- self.think = ons_GeneratorThink;
- self.nextthink = time + GEN_THINKRATE;
-
- Net_LinkEntity(self, false, 0, generator_send);
-
- self.SendFlags = GSF_SETUP; // just incase
- self.SendFlags |= GSF_STATUS;
-
- WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
- WaypointSprite_UpdateHealth(self.sprite, self.health);
- WaypointSprite_UpdateRule(self.sprite,self.team,SPRITERULE_TEAMPLAY);
+void ons_GeneratorReset(entity this)
+{
+ this.team = this.team_saved;
+ this.lasthealth = this.max_health = this.health = autocvar_g_onslaught_gen_health;
+ this.takedamage = DAMAGE_AIM;
+ this.bot_attack = true;
+ this.iscaptured = true;
+ this.islinked = true;
+ this.isshielded = true;
+ this.event_damage = ons_GeneratorDamage;
+ this.think = ons_GeneratorThink;
+ this.nextthink = time + GEN_THINKRATE;
+
+ Net_LinkEntity(this, false, 0, generator_send);
+
+ this.SendFlags = GSF_SETUP; // just incase
+ this.SendFlags |= GSF_STATUS;
+
+ WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
+ WaypointSprite_UpdateHealth(this.sprite, this.health);
+ WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY);
onslaught_updatelinks();
}
Damage(head, self, self.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(self), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0');
}
- self.think = SUB_Remove;
+ self.think = SUB_Remove_self;
self.nextthink = time + 0.2;
}
}
else
{
- oldself.think = SUB_Remove;
+ oldself.think = SUB_Remove_self;
oldself.nextthink = time;
}
}
return true;
}
-void Monster_Reset()
-{SELFPARAM();
- setorigin(self, self.pos1);
- self.angles = self.pos2;
+void Monster_Reset(entity this)
+{
+ setorigin(this, this.pos1);
+ this.angles = this.pos2;
- Unfreeze(self); // remove any icy remains
+ Unfreeze(this); // remove any icy remains
- self.health = self.max_health;
- self.velocity = '0 0 0';
- self.enemy = world;
- self.goalentity = world;
- self.attack_finished_single[0] = 0;
- self.moveto = self.origin;
+ this.health = this.max_health;
+ this.velocity = '0 0 0';
+ this.enemy = world;
+ this.goalentity = world;
+ this.attack_finished_single[0] = 0;
+ this.moveto = this.origin;
}
void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
// number of monsters spawned with mobspawn command
totalspawned -= 1;
- self.think = SUB_Remove;
+ self.think = SUB_Remove_self;
self.nextthink = time + 0.1;
self.event_damage = func_null;
}
{
Violence_GibSplash(self, 1, 0.5, attacker);
- self.think = SUB_Remove;
+ self.think = SUB_Remove_self;
self.nextthink = time + 0.1;
}
}
if(self.buff_activetime) { buff_Waypoint_Spawn(self); }
}
-void buff_Reset()
-{SELFPARAM();
+void buff_Reset(entity this)
+{
if(autocvar_g_buffs_randomize)
- buff_NewType(self, self.buffs);
- self.owner = world;
+ buff_NewType(this, this.buffs);
+ this.owner = world;
buff_SetCooldown(autocvar_g_buffs_cooldown_activate);
buff_Waypoint_Reset();
- self.buff_activetime_updated = false;
+ this.buff_activetime_updated = false;
- if(autocvar_g_buffs_random_location || (self.spawnflags & 64))
- buff_Respawn(self);
+ if(autocvar_g_buffs_random_location || (this.spawnflags & 64))
+ buff_Respawn(this);
}
float buff_Customize()
fn.colormod = Nades_from(n.nade_type).m_color;
fn.colormap = self.colormap;
fn.glowmod = self.glowmod;
- fn.think = SUB_Remove;
+ fn.think = SUB_Remove_self;
fn.nextthink = n.wait;
self.nade = n;
return false;
}
-void _spawnfunc_weapon_hmg() { SELFPARAM(); spawnfunc_weapon_hmg(this); }
-void _spawnfunc_weapon_rpc() { SELFPARAM(); spawnfunc_weapon_rpc(this); }
+void self_spawnfunc_weapon_hmg() { SELFPARAM(); spawnfunc_weapon_hmg(this); }
+void self_spawnfunc_weapon_rpc() { SELFPARAM(); spawnfunc_weapon_rpc(this); }
MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
{SELFPARAM();
wep.team = self.team;
wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
wep.pickup_anyway = true;
- wep.think = _spawnfunc_weapon_hmg;
+ wep.think = self_spawnfunc_weapon_hmg;
wep.nextthink = time + 0.1;
return true;
}
wep.team = self.team;
wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
wep.pickup_anyway = true;
- wep.think = _spawnfunc_weapon_rpc;
+ wep.think = self_spawnfunc_weapon_rpc;
wep.nextthink = time + 0.1;
return true;
}
if(_notes.alpha <= time)
{
- _notes.think = SUB_Remove;
+ _notes.think = SUB_Remove_self;
_notes.nextthink = time;
}
}
}
-void func_breakable_reset()
-{SELFPARAM();
- self.team = self.team_saved;
+void func_breakable_reset(entity this)
+{
+ this.team = this.team_saved;
func_breakable_look_restore();
- if(self.spawnflags & 1)
+ if(this.spawnflags & 1)
func_breakable_behave_destroyed();
else
func_breakable_behave_restore();
- CSQCMODEL_AUTOUPDATE(self);
+ CSQCMODEL_AUTOUPDATE(this);
}
// destructible walls that can be used to trigger target_objective_decrease
spawnfunc(func_breakable)
{
float n, i;
- if(!self.health)
- self.health = 100;
- self.max_health = self.health;
+ if(!this.health)
+ this.health = 100;
+ this.max_health = this.health;
// yes, I know, MOVETYPE_NONE is not available here, not that one would want it here anyway
- if(!self.debrismovetype) self.debrismovetype = MOVETYPE_BOUNCE;
- if(!self.debrissolid) self.debrissolid = SOLID_NOT;
- if(self.debrisvelocity == '0 0 0') self.debrisvelocity = '0 0 140';
- if(self.debrisvelocityjitter == '0 0 0') self.debrisvelocityjitter = '70 70 70';
- if(self.debrisavelocityjitter == '0 0 0') self.debrisavelocityjitter = '600 600 600';
- if(!self.debristime) self.debristime = 3.5;
- if(!self.debristimejitter) self.debristime = 2.5;
-
- if(self.mdl != "")
- self.cnt = _particleeffectnum(self.mdl);
- if(self.count == 0)
- self.count = 1;
-
- if(self.message == "")
- self.message = "got too close to an explosion";
- if(self.message2 == "")
- self.message2 = "was pushed into an explosion by";
- if(!self.dmg_radius)
- self.dmg_radius = 150;
- if(!self.dmg_force)
- self.dmg_force = 200;
-
- self.mdl = self.model;
+ if(!this.debrismovetype) this.debrismovetype = MOVETYPE_BOUNCE;
+ if(!this.debrissolid) this.debrissolid = SOLID_NOT;
+ if(this.debrisvelocity == '0 0 0') this.debrisvelocity = '0 0 140';
+ if(this.debrisvelocityjitter == '0 0 0') this.debrisvelocityjitter = '70 70 70';
+ if(this.debrisavelocityjitter == '0 0 0') this.debrisavelocityjitter = '600 600 600';
+ if(!this.debristime) this.debristime = 3.5;
+ if(!this.debristimejitter) this.debristime = 2.5;
+
+ if(this.mdl != "")
+ this.cnt = _particleeffectnum(this.mdl);
+ if(this.count == 0)
+ this.count = 1;
+
+ if(this.message == "")
+ this.message = "got too close to an explosion";
+ if(this.message2 == "")
+ this.message2 = "was pushed into an explosion by";
+ if(!this.dmg_radius)
+ this.dmg_radius = 150;
+ if(!this.dmg_force)
+ this.dmg_force = 200;
+
+ this.mdl = this.model;
SetBrushEntityModel();
- if(self.spawnflags & 4)
- self.use = func_breakable_destroy;
+ if(this.spawnflags & 4)
+ this.use = func_breakable_destroy;
else
- self.use = func_breakable_restore;
+ this.use = func_breakable_restore;
- if(self.spawnflags & 4)
+ if(this.spawnflags & 4)
{
- self.takedamage = DAMAGE_NO;
- self.event_damage = func_null;
- self.bot_attack = false;
+ this.takedamage = DAMAGE_NO;
+ this.event_damage = func_null;
+ this.bot_attack = false;
}
// precache all the models
- if (self.mdl_dead)
- precache_model(self.mdl_dead);
- n = tokenize_console(self.debris);
+ if (this.mdl_dead)
+ precache_model(this.mdl_dead);
+ n = tokenize_console(this.debris);
for(i = 0; i < n; ++i)
precache_model(argv(i));
- if(self.noise)
- precache_sound(self.noise);
- if(self.noise1)
- precache_sound(self.noise1);
+ if(this.noise)
+ precache_sound(this.noise);
+ if(this.noise1)
+ precache_sound(this.noise1);
- self.team_saved = self.team;
- self.dropped_origin = self.origin;
+ this.team_saved = this.team;
+ this.dropped_origin = this.origin;
- self.reset = func_breakable_reset;
- func_breakable_reset();
+ this.reset = func_breakable_reset;
+ this.reset(this);
- self.init_for_player_needed = 1;
- self.init_for_player = func_breakable_init_for_player;
+ this.init_for_player_needed = 1;
+ this.init_for_player = func_breakable_init_for_player;
- CSQCMODEL_AUTOINIT(self);
+ CSQCMODEL_AUTOINIT(this);
}
// for use in maps with a "model" key set
self.SendFlags |= 2;
}
-void conveyor_reset()
-{SELFPARAM();
- self.state = (self.spawnflags & 1);
+void conveyor_reset(entity this)
+{
+ this.state = (this.spawnflags & 1);
- self.SendFlags |= 2;
+ this.SendFlags |= 2;
}
bool conveyor_send(entity this, entity to, int sf)
void conveyor_init()
{SELFPARAM();
- if (!self.speed)
- self.speed = 200;
- self.movedir = self.movedir * self.speed;
- self.think = conveyor_think;
- self.nextthink = time;
+ if (!this.speed) this.speed = 200;
+ this.movedir *= this.speed;
+ this.think = conveyor_think;
+ this.nextthink = time;
IFTARGETED
{
- self.use = conveyor_use;
- self.reset = conveyor_reset;
- conveyor_reset();
+ this.use = conveyor_use;
+ this.reset = conveyor_reset;
+ this.reset(this);
}
else
- self.state = 1;
+ this.state = 1;
- FixSize(self);
+ FixSize(this);
- Net_LinkEntity(self, 0, false, conveyor_send);
+ Net_LinkEntity(this, 0, false, conveyor_send);
- self.SendFlags |= 1;
+ this.SendFlags |= 1;
}
spawnfunc(trigger_conveyor)
#endif
}
-void door_reset()
-{SELFPARAM();
- SUB_SETORIGIN(self, self.pos1);
- self.SUB_VELOCITY = '0 0 0';
- self.state = STATE_BOTTOM;
- self.SUB_THINK = func_null;
- self.SUB_NEXTTHINK = 0;
+void door_reset(entity this)
+{
+ SUB_SETORIGIN(this, this.pos1);
+ this.SUB_VELOCITY = '0 0 0';
+ this.state = STATE_BOTTOM;
+ this.SUB_THINK = func_null;
+ this.SUB_NEXTTHINK = 0;
#ifdef SVQC
- self.SendFlags |= SF_TRIGGER_RESET;
+ this.SendFlags |= SF_TRIGGER_RESET;
#endif
}
if(sf & SF_TRIGGER_INIT)
{
- self.classname = strzone(ReadString());
- self.spawnflags = ReadByte();
+ this.classname = strzone(ReadString());
+ this.spawnflags = ReadByte();
- self.mdl = strzone(ReadString());
- _setmodel(self, self.mdl);
+ this.mdl = strzone(ReadString());
+ _setmodel(this, this.mdl);
trigger_common_read(true);
- self.pos1_x = ReadCoord();
- self.pos1_y = ReadCoord();
- self.pos1_z = ReadCoord();
- self.pos2_x = ReadCoord();
- self.pos2_y = ReadCoord();
- self.pos2_z = ReadCoord();
-
- self.size_x = ReadCoord();
- self.size_y = ReadCoord();
- self.size_z = ReadCoord();
-
- self.wait = ReadShort();
- self.speed = ReadShort();
- self.lip = ReadByte();
- self.state = ReadByte();
- self.SUB_LTIME = ReadCoord();
-
- self.solid = SOLID_BSP;
- self.movetype = MOVETYPE_PUSH;
- self.trigger_touch = door_touch;
- self.draw = door_draw;
- self.drawmask = MASK_NORMAL;
- self.use = door_use;
+ vector v;
+
+ v.x = ReadCoord();
+ v.y = ReadCoord();
+ v.z = ReadCoord();
+ this.pos1 = v;
+
+ v.x = ReadCoord();
+ v.y = ReadCoord();
+ v.z = ReadCoord();
+ this.pos2 = v;
+
+ v.x = ReadCoord();
+ v.y = ReadCoord();
+ v.z = ReadCoord();
+ this.size = v;
+
+ this.wait = ReadShort();
+ this.speed = ReadShort();
+ this.lip = ReadByte();
+ this.state = ReadByte();
+ this.SUB_LTIME = ReadCoord();
+
+ this.solid = SOLID_BSP;
+ this.movetype = MOVETYPE_PUSH;
+ this.trigger_touch = door_touch;
+ this.draw = door_draw;
+ this.drawmask = MASK_NORMAL;
+ this.use = door_use;
LinkDoors();
- if(self.spawnflags & DOOR_START_OPEN)
+ if(this.spawnflags & DOOR_START_OPEN)
door_init_startopen();
- self.move_time = time;
- self.move_origin = self.origin;
- self.move_movetype = MOVETYPE_PUSH;
- self.move_angles = self.angles;
- self.move_blocked = door_blocked;
+ this.move_time = time;
+ this.move_origin = this.origin;
+ this.move_movetype = MOVETYPE_PUSH;
+ this.move_angles = this.angles;
+ this.move_blocked = door_blocked;
}
if(sf & SF_TRIGGER_RESET)
{
- door_reset();
+ door_reset(this);
}
if(sf & SF_TRIGGER_UPDATE)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
- setorigin(self, self.origin);
- self.move_origin = self.origin;
-
- self.pos1_x = ReadCoord();
- self.pos1_y = ReadCoord();
- self.pos1_z = ReadCoord();
- self.pos2_x = ReadCoord();
- self.pos2_y = ReadCoord();
- self.pos2_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
+ setorigin(this, this.origin);
+ this.move_origin = this.origin;
+
+ this.pos1_x = ReadCoord();
+ this.pos1_y = ReadCoord();
+ this.pos1_z = ReadCoord();
+ this.pos2_x = ReadCoord();
+ this.pos2_y = ReadCoord();
+ this.pos2_z = ReadCoord();
}
return true;
}
FIXME: only one sound set available at the time being
*/
-void door_rotating_reset()
-{SELFPARAM();
- self.angles = self.pos1;
- self.avelocity = '0 0 0';
- self.state = STATE_BOTTOM;
- self.think = func_null;
- self.nextthink = 0;
+void door_rotating_reset(entity this)
+{
+ this.angles = this.pos1;
+ this.avelocity = '0 0 0';
+ this.state = STATE_BOTTOM;
+ this.think = func_null;
+ this.nextthink = 0;
}
void door_rotating_init_startopen()
}
}
-void secret_reset()
-{SELFPARAM();
- if (self.spawnflags&SECRET_YES_SHOOT)
+void secret_reset(entity this)
+{
+ if (this.spawnflags & SECRET_YES_SHOOT)
{
- self.health = 10000;
- self.takedamage = DAMAGE_YES;
+ this.health = 10000;
+ this.takedamage = DAMAGE_YES;
}
- setorigin(self, self.oldorigin);
- self.think = func_null;
- self.SUB_NEXTTHINK = 0;
+ setorigin(this, this.oldorigin);
+ this.think = func_null;
+ this.SUB_NEXTTHINK = 0;
}
/*QUAKED spawnfunc_func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot
spawnfunc(func_door_secret)
{
- /*if (!self.deathtype) // map makers can override this
- self.deathtype = " got in the way";*/
+ /*if (!this.deathtype) // map makers can override this
+ this.deathtype = " got in the way";*/
- if (!self.dmg)
- self.dmg = 2;
+ if (!this.dmg) this.dmg = 2;
// Magic formula...
- self.mangle = self.angles;
- self.angles = '0 0 0';
- self.classname = "door";
- if (!InitMovingBrushTrigger())
- return;
- self.effects |= EF_LOWPRECISION;
-
- if(self.noise == "")
- self.noise = "misc/talk.wav";
- precache_sound(self.noise);
-
- self.touch = secret_touch;
- self.blocked = secret_blocked;
- self.speed = 50;
- self.use = fd_secret_use;
+ this.mangle = this.angles;
+ this.angles = '0 0 0';
+ this.classname = "door";
+ if (!InitMovingBrushTrigger()) return;
+ this.effects |= EF_LOWPRECISION;
+
+ if (this.noise == "") this.noise = "misc/talk.wav";
+ precache_sound(this.noise);
+
+ this.touch = secret_touch;
+ this.blocked = secret_blocked;
+ this.speed = 50;
+ this.use = fd_secret_use;
IFTARGETED
{
}
else
- self.spawnflags |= SECRET_YES_SHOOT;
+ this.spawnflags |= SECRET_YES_SHOOT;
- if(self.spawnflags&SECRET_YES_SHOOT)
+ if (this.spawnflags & SECRET_YES_SHOOT)
{
- self.health = 10000;
- self.takedamage = DAMAGE_YES;
- self.event_damage = fd_secret_damage;
+ this.health = 10000;
+ this.takedamage = DAMAGE_YES;
+ this.event_damage = fd_secret_damage;
}
- self.oldorigin = self.origin;
- if (!self.wait)
- self.wait = 5; // 5 seconds before closing
+ this.oldorigin = this.origin;
+ if (!this.wait) this.wait = 5; // seconds before closing
- self.reset = secret_reset;
- secret_reset();
+ this.reset = secret_reset;
+ this.reset(this);
}
#endif
spawnfunc(func_plat)
{
- if (self.sounds == 0)
- self.sounds = 2;
+ if (this.sounds == 0) this.sounds = 2;
- if(self.spawnflags & 4)
- self.dmg = 10000;
+ if (this.spawnflags & 4) this.dmg = 10000;
- if(self.dmg && (self.message == ""))
- self.message = "was squished";
- if(self.dmg && (self.message2 == ""))
- self.message2 = "was squished by";
+ if (this.dmg && (this.message == "")) this.message = "was squished";
+ if (this.dmg && (this.message2 == "")) this.message2 = "was squished by";
- if (self.sounds == 1)
+ if (this.sounds == 1)
{
precache_sound ("plats/plat1.wav");
precache_sound ("plats/plat2.wav");
- self.noise = "plats/plat1.wav";
- self.noise1 = "plats/plat2.wav";
+ this.noise = "plats/plat1.wav";
+ this.noise1 = "plats/plat2.wav";
}
- if (self.sounds == 2)
+ if (this.sounds == 2)
{
precache_sound ("plats/medplat1.wav");
precache_sound ("plats/medplat2.wav");
- self.noise = "plats/medplat1.wav";
- self.noise1 = "plats/medplat2.wav";
+ this.noise = "plats/medplat1.wav";
+ this.noise1 = "plats/medplat2.wav";
}
- if (self.sound1)
+ if (this.sound1)
{
- precache_sound (self.sound1);
- self.noise = self.sound1;
+ precache_sound (this.sound1);
+ this.noise = this.sound1;
}
- if (self.sound2)
+ if (this.sound2)
{
- precache_sound (self.sound2);
- self.noise1 = self.sound2;
+ precache_sound (this.sound2);
+ this.noise1 = this.sound2;
}
- self.mangle = self.angles;
- self.angles = '0 0 0';
+ this.mangle = this.angles;
+ this.angles = '0 0 0';
- self.classname = "plat";
+ this.classname = "plat";
if (!InitMovingBrushTrigger())
return;
- self.effects |= EF_LOWPRECISION;
- setsize (self, self.mins , self.maxs);
+ this.effects |= EF_LOWPRECISION;
+ setsize (this, this.mins , this.maxs);
- self.blocked = plat_crush;
+ this.blocked = plat_crush;
- if (!self.speed)
- self.speed = 150;
- if (!self.lip)
- self.lip = 16;
- if (!self.height)
- self.height = self.size_z - self.lip;
+ if (!this.speed) this.speed = 150;
+ if (!this.lip) this.lip = 16;
+ if (!this.height) this.height = this.size.z - this.lip;
- self.pos1 = self.origin;
- self.pos2 = self.origin;
- self.pos2_z = self.origin_z - self.height;
+ this.pos1 = this.origin;
+ this.pos2 = this.origin;
+ this.pos2_z = this.origin.z - this.height;
- self.reset = plat_reset;
- plat_reset();
+ this.reset = plat_reset;
+ this.reset(this);
- InitializeEntity(self, plat_delayedinit, INITPRIO_FINDTARGET);
+ InitializeEntity(this, plat_delayedinit, INITPRIO_FINDTARGET);
}
#elif defined(CSQC)
void plat_draw(entity this)
if(sf & SF_TRIGGER_INIT)
{
- self.platmovetype_start = ReadByte();
- self.platmovetype_turn = ReadByte();
- self.platmovetype_end = ReadByte();
- self.spawnflags = ReadByte();
+ this.platmovetype_start = ReadByte();
+ this.platmovetype_turn = ReadByte();
+ this.platmovetype_end = ReadByte();
+ this.spawnflags = ReadByte();
- self.model = strzone(ReadString());
- _setmodel(self, self.model);
+ this.model = strzone(ReadString());
+ _setmodel(this, this.model);
trigger_common_read(true);
- self.pos1_x = ReadCoord();
- self.pos1_y = ReadCoord();
- self.pos1_z = ReadCoord();
- self.pos2_x = ReadCoord();
- self.pos2_y = ReadCoord();
- self.pos2_z = ReadCoord();
+ this.pos1_x = ReadCoord();
+ this.pos1_y = ReadCoord();
+ this.pos1_z = ReadCoord();
+ this.pos2_x = ReadCoord();
+ this.pos2_y = ReadCoord();
+ this.pos2_z = ReadCoord();
- self.size_x = ReadCoord();
- self.size_y = ReadCoord();
- self.size_z = ReadCoord();
+ this.size_x = ReadCoord();
+ this.size_y = ReadCoord();
+ this.size_z = ReadCoord();
- self.mangle_x = ReadAngle();
- self.mangle_y = ReadAngle();
- self.mangle_z = ReadAngle();
+ this.mangle_x = ReadAngle();
+ this.mangle_y = ReadAngle();
+ this.mangle_z = ReadAngle();
- self.speed = ReadShort();
- self.height = ReadShort();
- self.lip = ReadByte();
- self.state = ReadByte();
+ this.speed = ReadShort();
+ this.height = ReadShort();
+ this.lip = ReadByte();
+ this.state = ReadByte();
- self.dmg = ReadShort();
+ this.dmg = ReadShort();
- self.classname = "plat";
- self.solid = SOLID_BSP;
- self.movetype = MOVETYPE_PUSH;
- self.drawmask = MASK_NORMAL;
- self.draw = plat_draw;
- self.use = plat_use;
- self.entremove = trigger_remove_generic;
+ this.classname = "plat";
+ this.solid = SOLID_BSP;
+ this.movetype = MOVETYPE_PUSH;
+ this.drawmask = MASK_NORMAL;
+ this.draw = plat_draw;
+ this.use = plat_use;
+ this.entremove = trigger_remove_generic;
- plat_reset(); // also called here
+ plat_reset(this); // also called here
- self.move_movetype = MOVETYPE_PUSH;
- self.move_origin = self.origin;
- self.move_angles = self.angles;
- self.move_time = time;
+ this.move_movetype = MOVETYPE_PUSH;
+ this.move_origin = this.origin;
+ this.move_angles = this.angles;
+ this.move_time = time;
plat_spawn_inside_trigger();
}
if(sf & SF_TRIGGER_RESET)
{
- plat_reset();
+ plat_reset(this);
- self.move_origin = self.origin;
- self.move_angles = self.angles;
- self.move_time = time;
+ this.move_origin = this.origin;
+ this.move_angles = this.angles;
+ this.move_time = time;
}
return true;
}
self.nextthink = time;
}
-void pointparticles_reset()
-{SELFPARAM();
- if(self.spawnflags & 1)
- self.state = 1;
+void pointparticles_reset(entity this)
+{
+ if(this.spawnflags & 1)
+ this.state = 1;
else
- self.state = 0;
+ this.state = 0;
}
spawnfunc(func_pointparticles)
{
- if(self.model != "")
- _setmodel(self, self.model);
- if(self.noise != "")
- precache_sound (self.noise);
+ if(this.model != "") _setmodel(this, this.model);
+ if(this.noise != "") precache_sound(this.noise);
- if(!self.bgmscriptsustain)
- self.bgmscriptsustain = 1;
- else if(self.bgmscriptsustain < 0)
- self.bgmscriptsustain = 0;
+ if(!this.bgmscriptsustain) this.bgmscriptsustain = 1;
+ else if(this.bgmscriptsustain < 0) this.bgmscriptsustain = 0;
- if(!self.atten)
- self.atten = ATTEN_NORM;
- else if(self.atten < 0)
- self.atten = 0;
- if(!self.volume)
- self.volume = 1;
- if(!self.count)
- self.count = 1;
- if(!self.impulse)
- self.impulse = 1;
+ if(!this.atten) this.atten = ATTEN_NORM;
+ else if(this.atten < 0) this.atten = 0;
+ if(!this.volume) this.volume = 1;
+ if(!this.count) this.count = 1;
+ if(!this.impulse) this.impulse = 1;
- if(!self.modelindex)
+ if(!this.modelindex)
{
- setorigin(self, self.origin + self.mins);
- setsize(self, '0 0 0', self.maxs - self.mins);
+ setorigin(this, this.origin + this.mins);
+ setsize(this, '0 0 0', this.maxs - this.mins);
}
- if(!self.cnt)
- self.cnt = _particleeffectnum(self.mdl);
+ if(!this.cnt) this.cnt = _particleeffectnum(this.mdl);
- Net_LinkEntity(self, (self.spawnflags & 4), 0, pointparticles_SendEntity);
+ Net_LinkEntity(this, (this.spawnflags & 4), 0, pointparticles_SendEntity);
IFTARGETED
{
- self.use = pointparticles_use;
- self.reset = pointparticles_reset;
- self.reset();
+ this.use = pointparticles_use;
+ this.reset = pointparticles_reset;
+ this.reset(this);
}
else
- self.state = 1;
- self.think = pointparticles_think;
- self.nextthink = time;
+ this.state = 1;
+ this.think = pointparticles_think;
+ this.nextthink = time;
}
spawnfunc(func_sparks)
misc_laser_aim();
}
-void laser_reset()
-{SELFPARAM();
- if(self.spawnflags & 1)
- self.state = 1;
+void laser_reset(entity this)
+{
+ if(this.spawnflags & 1)
+ this.state = 1;
else
- self.state = 0;
+ this.state = 0;
}
spawnfunc(misc_laser)
{
- if(self.mdl)
+ if(this.mdl)
{
- if(self.mdl == "none")
- self.cnt = -1;
+ if(this.mdl == "none")
+ this.cnt = -1;
else
{
- self.cnt = _particleeffectnum(self.mdl);
- if(self.cnt < 0)
- if(self.dmg)
- self.cnt = particleeffectnum(EFFECT_LASER_DEADLY);
+ this.cnt = _particleeffectnum(this.mdl);
+ if(this.cnt < 0 && this.dmg)
+ this.cnt = particleeffectnum(EFFECT_LASER_DEADLY);
}
}
- else if(!self.cnt)
+ else if(!this.cnt)
{
- if(self.dmg)
- self.cnt = particleeffectnum(EFFECT_LASER_DEADLY);
+ if(this.dmg)
+ this.cnt = particleeffectnum(EFFECT_LASER_DEADLY);
else
- self.cnt = -1;
+ this.cnt = -1;
}
- if(self.cnt < 0)
- self.cnt = -1;
+ if(this.cnt < 0)
+ this.cnt = -1;
- if(self.colormod == '0 0 0')
- if(!self.alpha)
- self.colormod = '1 0 0';
- if(self.message == "")
- self.message = "saw the light";
- if (self.message2 == "")
- self.message2 = "was pushed into a laser by";
- if(!self.scale)
- self.scale = 1;
- if(!self.modelscale)
- self.modelscale = 1;
- else if(self.modelscale < 0)
- self.modelscale = 0;
- self.think = misc_laser_think;
- self.nextthink = time;
- InitializeEntity(self, misc_laser_init, INITPRIO_FINDTARGET);
+ if(this.colormod == '0 0 0')
+ if(!this.alpha)
+ this.colormod = '1 0 0';
+ if(this.message == "") this.message = "saw the light";
+ if (this.message2 == "") this.message2 = "was pushed into a laser by";
+ if(!this.scale) this.scale = 1;
+ if(!this.modelscale) this.modelscale = 1;
+ else if(this.modelscale < 0) this.modelscale = 0;
+ this.think = misc_laser_think;
+ this.nextthink = time;
+ InitializeEntity(this, misc_laser_init, INITPRIO_FINDTARGET);
- self.mangle = self.angles;
+ this.mangle = this.angles;
- Net_LinkEntity(self, false, 0, laser_SendEntity);
+ Net_LinkEntity(this, false, 0, laser_SendEntity);
IFTARGETED
{
- self.reset = laser_reset;
- laser_reset();
- self.use = laser_use;
+ this.reset = laser_reset;
+ this.reset(this);
+ this.use = laser_use;
}
else
- self.state = 1;
+ this.state = 1;
}
#elif defined(CSQC)
.string sound1, sound2;
-void plat_reset()
-{SELFPARAM();
+void plat_reset(entity this)
+{
IFTARGETED
{
- setorigin (self, self.pos1);
- self.state = 4;
- self.use = plat_use;
+ setorigin (this, this.pos1);
+ this.state = 4;
+ this.use = plat_use;
}
else
{
- setorigin (self, self.pos2);
- self.state = 2;
- self.use = plat_trigger_use;
+ setorigin (this, this.pos2);
+ this.state = 2;
+ this.use = plat_trigger_use;
}
#ifdef SVQC
- self.SendFlags |= SF_TRIGGER_RESET;
+ this.SendFlags |= SF_TRIGGER_RESET;
#endif
}
#endif
-void SUB_Remove();
void SUB_SetFade (entity ent, float when, float fading_time);
void SUB_VanishOrRemove (entity ent);
WriteByte(to, self.lifetime);
WriteString(to, self.noise);
}
-void target_music_reset()
-{SELFPARAM();
- if(self.targetname == "")
- target_music_sendto(MSG_ALL, 1);
+void target_music_reset(entity this)
+{
+ if (this.targetname == "") target_music_sendto(MSG_ALL, 1);
}
void target_music_kill()
{
}
return 1;
}
-void trigger_music_reset()
-{SELFPARAM();
- self.cnt = !(self.spawnflags & 1);
- self.SendFlags |= 0x80;
+void trigger_music_reset(entity this)
+{
+ this.cnt = !(this.spawnflags & 1);
+ this.SendFlags |= 0x80;
}
void trigger_music_use()
{SELFPARAM();
}
spawnfunc(trigger_music)
{
- if(self.model != "")
- _setmodel(self, self.model);
- if(!self.volume)
- self.volume = 1;
- if(!self.modelindex)
+ if(this.model != "") _setmodel(this, this.model);
+ if(!this.volume) this.volume = 1;
+ if(!this.modelindex)
{
- setorigin(self, self.origin + self.mins);
- setsize(self, '0 0 0', self.maxs - self.mins);
+ setorigin(this, this.origin + this.mins);
+ setsize(this, '0 0 0', this.maxs - this.mins);
}
- trigger_music_reset();
+ trigger_music_reset(this);
- self.use = trigger_music_use;
- self.reset = trigger_music_reset;
+ this.use = trigger_music_use;
+ this.reset = trigger_music_reset;
- Net_LinkEntity(self, false, 0, trigger_music_SendEntity);
+ Net_LinkEntity(this, false, 0, trigger_music_SendEntity);
}
#elif defined(CSQC)
sound(self, CH_TRIGGER_SINGLE, SND_Null, VOL_BASE * self.volume, self.atten);
self.use = target_speaker_use_on;
}
-void target_speaker_reset()
-{SELFPARAM();
- if(self.spawnflags & 1) // LOOPED_ON
+void target_speaker_reset(entity this)
+{
+ if(this.spawnflags & 1) // LOOPED_ON
{
- if(self.use == target_speaker_use_on)
+ if(this.use == target_speaker_use_on)
target_speaker_use_on();
}
- else if(self.spawnflags & 2)
+ else if(this.spawnflags & 2)
{
- if(self.use == target_speaker_use_off)
+ if(this.use == target_speaker_use_off)
target_speaker_use_off();
}
}
}
}
-void counter_reset()
-{SELFPARAM();
- self.count = self.cnt;
- multi_reset();
+void counter_reset(entity this)
+{
+ this.count = this.cnt;
+ multi_reset(this);
}
/*QUAKED spawnfunc_trigger_counter (.5 .5 .5) ? nomessage
self.nextthink = self.wait;
}
-void delay_reset()
-{SELFPARAM();
- self.think = func_null;
- self.nextthink = 0;
+void delay_reset(entity this)
+{
+ this.think = func_null;
+ this.nextthink = 0;
}
spawnfunc(trigger_delay)
SUB_UseTargets();
}
-void _spawnfunc_trigger_flipflop();
spawnfunc(trigger_flipflop)
{
- if(self.spawnflags & 1)
- self.state = 1;
- self.use = flipflop_use;
- self.reset = _spawnfunc_trigger_flipflop; // perfect resetter
+ if(this.spawnflags & 1)
+ this.state = 1;
+ this.use = flipflop_use;
+ this.reset = spawnfunc_trigger_flipflop; // perfect resetter
}
-void _spawnfunc_trigger_flipflop() { SELFPARAM(); spawnfunc_trigger_flipflop(this); }
#endif
remove(self);
}
-void _spawnfunc_trigger_gamestart();
+void self_spawnfunc_trigger_gamestart();
spawnfunc(trigger_gamestart)
{
- self.use = gamestart_use;
- self.reset2 = _spawnfunc_trigger_gamestart;
+ this.use = gamestart_use;
+ this.reset2 = self_spawnfunc_trigger_gamestart;
- if(self.wait)
+ if(this.wait)
{
- self.think = self.use;
- self.nextthink = game_starttime + self.wait;
+ this.think = this.use;
+ this.nextthink = game_starttime + this.wait;
}
else
- InitializeEntity(self, gamestart_use, INITPRIO_FINDTARGET);
+ InitializeEntity(this, gamestart_use, INITPRIO_FINDTARGET);
}
-void _spawnfunc_trigger_gamestart() { SELFPARAM(); spawnfunc_trigger_gamestart(this); }
+void self_spawnfunc_trigger_gamestart() { SELFPARAM(); spawnfunc_trigger_gamestart(this); }
#endif
void trigger_push_touch()
{SELFPARAM();
- if (self.active == ACTIVE_NOT)
+ if (this.active == ACTIVE_NOT)
return;
#ifdef SVQC
return;
#endif
- if(self.team)
- if(((self.spawnflags & 4) == 0) == (DIFF_TEAM(self, other)))
+ if(this.team)
+ if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, other)))
return;
EXACTTRIGGER_TOUCH;
- if(self.enemy)
+ if(this.enemy)
{
- other.velocity = trigger_push_calculatevelocity(other.origin, self.enemy, self.height);
+ other.velocity = trigger_push_calculatevelocity(other.origin, this.enemy, this.height);
other.move_velocity = other.velocity;
}
- else if(self.target)
+ else if(this.target)
{
entity e;
RandomSelection_Init();
- for(e = world; (e = find(e, targetname, self.target)); )
+ for(e = world; (e = find(e, targetname, this.target)); )
{
if(e.cnt)
RandomSelection_Add(e, 0, string_null, e.cnt, 1);
else
RandomSelection_Add(e, 0, string_null, 1, 1);
}
- other.velocity = trigger_push_calculatevelocity(other.origin, RandomSelection_chosen_ent, self.height);
+ other.velocity = trigger_push_calculatevelocity(other.origin, RandomSelection_chosen_ent, this.height);
other.move_velocity = other.velocity;
}
else
{
- other.velocity = self.movedir;
+ other.velocity = this.movedir;
other.move_velocity = other.velocity;
}
// reset tracking of oldvelocity for impact damage (sudden velocity changes)
other.oldvelocity = other.velocity;
- if(self.pushltime < time) // prevent "snorring" sound when a player hits the jumppad more than once
+ if(this.pushltime < time) // prevent "snorring" sound when a player hits the jumppad more than once
{
// flash when activated
Send_Effect(EFFECT_JUMPPAD, other.origin, other.velocity, 1);
- _sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
- self.pushltime = time + 0.2;
+ _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
+ this.pushltime = time + 0.2;
}
if(IS_REAL_CLIENT(other) || IS_BOT_CLIENT(other))
{
bool found = false;
for(int i = 0; i < other.jumppadcount && i < NUM_JUMPPADSUSED; ++i)
- if(other.(jumppadsused[i]) == self)
+ if(other.(jumppadsused[i]) == this)
found = true;
if(!found)
{
- other.(jumppadsused[other.jumppadcount % NUM_JUMPPADSUSED]) = self;
+ other.(jumppadsused[other.jumppadcount % NUM_JUMPPADSUSED]) = this;
other.jumppadcount = other.jumppadcount + 1;
}
if(IS_REAL_CLIENT(other))
{
- if(self.message)
- centerprint(other, self.message);
+ if(this.message)
+ centerprint(other, this.message);
}
else
other.lastteleporttime = time;
other.istypefrag = 0;
}
- if(self.enemy.target)
+ if(this.enemy.target)
{
activator = other;
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITH(entity, self, this.enemy, SUB_UseTargets());
}
if (other.flags & FL_PROJECTILE)
UpdateCSQCProjectile(other);
}
- if (self.spawnflags & PUSH_ONCE)
+ if (this.spawnflags & PUSH_ONCE)
{
- self.touch = func_null;
- self.think = SUB_Remove;
- self.nextthink = time;
+ this.touch = func_null;
+ this.think = SUB_Remove_self;
+ this.nextthink = time;
}
#endif
}
SUB_UseTargets();
}
-void monoflop_reset()
-{SELFPARAM();
- self.state = 0;
- self.nextthink = 0;
+void monoflop_reset(entity this)
+{
+ this.state = 0;
+ this.nextthink = 0;
}
spawnfunc(trigger_monoflop)
}
}
-void multi_reset()
-{SELFPARAM();
- if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) )
- self.touch = multi_touch;
- if (self.max_health)
+void multi_reset(entity this)
+{
+ if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
+ this.touch = multi_touch;
+ if (this.max_health)
{
- self.health = self.max_health;
- self.takedamage = DAMAGE_YES;
- self.solid = SOLID_BBOX;
+ this.health = this.max_health;
+ this.takedamage = DAMAGE_YES;
+ this.solid = SOLID_BBOX;
}
- self.think = func_null;
- self.nextthink = 0;
- self.team = self.team_saved;
+ this.think = func_null;
+ this.nextthink = 0;
+ this.team = this.team_saved;
}
/*QUAKED spawnfunc_trigger_multiple (.5 .5 .5) ? notouch
#ifdef SVQC
void multi_trigger();
-void multi_reset();
+void multi_reset(entity this);
spawnfunc(trigger_once);
#endif
#ifdef SVQC
-void _spawnfunc_trigger_relay();
/*QUAKED spawnfunc_trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
*/
spawnfunc(trigger_relay)
{
- self.use = SUB_UseTargets;
- self.reset = _spawnfunc_trigger_relay; // this spawnfunc resets fully
+ this.use = SUB_UseTargets;
+ this.reset = spawnfunc_trigger_relay; // this spawnfunc resets fully
}
-void _spawnfunc_trigger_relay() { SELFPARAM(); spawnfunc_trigger_relay(this); }
#endif
}
}
-void trigger_relay_teamcheck_reset()
-{SELFPARAM();
- self.team = self.team_saved;
+void trigger_relay_teamcheck_reset(entity this)
+{
+ this.team = this.team_saved;
}
spawnfunc(trigger_relay_teamcheck)
{
- self.team_saved = self.team;
- self.use = trigger_relay_teamcheck_use;
- self.reset = trigger_relay_teamcheck_reset;
+ this.team_saved = this.team;
+ this.use = trigger_relay_teamcheck_use;
+ this.reset = trigger_relay_teamcheck_reset;
}
#endif
}
#ifdef TURRET_DEBUG
-void SUB_Remove();
void marker_think()
{SELFPARAM();
if(self.cnt)
proj.use = vehicles_projectile_explode;
proj.owner = self;
proj.realowner = _owner;
- proj.think = SUB_Remove;
+ proj.think = SUB_Remove_self;
proj.nextthink = time + 30;
if(_health)
if(ret.wp00 == veh)
{
ret.classname = "";
- ret.think = SUB_Remove;
+ ret.think = SUB_Remove_self;
ret.nextthink = time + 0.1;
if(ret.waypointsprite_attached)
void W_Blaster_Think()
{SELFPARAM();
- self.movetype = MOVETYPE_FLY;
- self.think = SUB_Remove;
- self.nextthink = time + self.blaster_lifetime;
- CSQCProjectile(self, true, PROJECTILE_BLASTER, true);
+ this.movetype = MOVETYPE_FLY;
+ this.think = SUB_Remove_self;
+ this.nextthink = time + this.blaster_lifetime;
+ CSQCProjectile(this, true, PROJECTILE_BLASTER, true);
}
void W_Blaster_Attack(
W_Crylink_Dequeue_Raw(e.realowner, e.queueprev, e, e.queuenext);
}
-void W_Crylink_Reset()
-{SELFPARAM();
- W_Crylink_Dequeue(self);
- remove(self);
+void W_Crylink_Reset(entity this)
+{
+ W_Crylink_Dequeue(this);
+ remove(this);
}
// force projectile to explode
//missile.angles = vectoangles(missile.velocity); // csqc
missile.touch = W_HLAC_Touch;
- missile.think = SUB_Remove;
+ missile.think = SUB_Remove_self;
missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
//missile.angles = vectoangles(missile.velocity); // csqc
missile.touch = W_HLAC_Touch;
- missile.think = SUB_Remove;
+ missile.think = SUB_Remove_self;
missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
void W_MachineGun_MuzzleFlash_Think()
{SELFPARAM();
- self.frame = self.frame + 2;
- self.scale = self.scale * 0.5;
- self.alpha = self.alpha - 0.25;
- self.nextthink = time + 0.05;
+ this.frame += 2;
+ this.scale *= 0.5;
+ this.alpha -= 0.25;
+ this.nextthink = time + 0.05;
- if(self.alpha <= 0)
+ if(this.alpha <= 0)
{
- self.think = SUB_Remove;
- self.nextthink = time;
- self.realowner.muzzle_flash = world;
+ this.think = SUB_Remove_self;
+ this.nextthink = time;
+ this.realowner.muzzle_flash = world;
return;
}
missile.bot_dodge = true;
missile.bot_dodgerating = 50;
missile.touch = W_Seeker_Tag_Touch;
- missile.think = SUB_Remove;
+ missile.think = SUB_Remove_self;
missile.nextthink = time + WEP_CVAR(seeker, tag_lifetime);
missile.movetype = MOVETYPE_FLY;
missile.solid = SOLID_BBOX;
// muzzle flash for 1st person view
flash = spawn();
setmodel(flash, MDL_SHOTGUN_MUZZLEFLASH); // precision set below
- flash.think = SUB_Remove;
+ flash.think = SUB_Remove_self;
flash.nextthink = time + 0.06;
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
W_AttachToShotorg(self, flash, '5 0 0');
NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
{
Net_Accept(vortex_beam);
- this.think = SUB_Remove;
+ this.think = SUB_Remove_self;
this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
this.draw = VaporizerBeam_Draw;
this.drawmask = MASK_NORMAL;
class(Defer).void() think;
class(Defer).float nextthink;
-/*
-==================
-SUB_Remove
+ /** Remove self */
+ void SUB_Remove(entity this)
+ {
+ remove(this);
+ }
-Remove self
-==================
-*/
- void SUB_Remove()
+ /** Remove self */
+ void SUB_Remove_self()
{
SELFPARAM();
- remove(self);
+ remove(this);
}
void defer_think()
{
SELFPARAM();
- self.think = SUB_Remove;
+ self.think = SUB_Remove_self;
self.nextthink = time;
WITH(entity, self, self.owner, self.use());
}
if (dt)
{
e.nextthink = time + dt;
- e.think = SUB_Remove;
+ e.think = SUB_Remove_self;
}
}
#define _spawnfunc_check(fld) \
if (fieldname == #fld) continue;
- #define spawnfunc_1(id, whitelist) spawnfunc_2(id, whitelist)
+ bool __spawnfunc_unreachable_workaround = true;
+
+ #define spawnfunc_1(id) spawnfunc_2(id, FIELDS_UNION)
#define spawnfunc_2(id, whitelist) \
- void spawnfunc_##id(entity this) \
+ void __spawnfunc_##id(entity this); \
+ [[accumulate]] void spawnfunc_##id(entity this) \
{ \
this = self; \
if (!this.sourceLocFile) \
} \
this.spawnfunc_checked = true; \
} \
+ __spawnfunc_##id(this); \
+ if (__spawnfunc_unreachable_workaround) return; \
} \
- [[accumulate]] void spawnfunc_##id(entity this)
+ void __spawnfunc_##id(entity this)
#define FIELD_SCALAR(fld, n) \
fld(n)
FIELD_VEC(fld, velocity) \
/**/
- #define spawnfunc(...) EVAL(OVERLOAD(spawnfunc, __VA_ARGS__, FIELDS_UNION))
+ #define spawnfunc(...) EVAL(OVERLOAD(spawnfunc, __VA_ARGS__))
#endif
ts.SendEntity = WarpZone_Teleported_Send;
ts.SendFlags = 0xFFFFFF;
ts.drawonlytoclient = player;
- ts.think = SUB_Remove;
+ ts.think = SUB_Remove_self;
ts.nextthink = time + 1;
ts.owner = player;
ts.enemy = wz;
{
if (e.reset)
{
- WITH(entity, self, e, e.reset());
+ WITH(entity, self, e, e.reset(e));
continue;
}
if (e.team_saved) e.team = e.team_saved;
void SUB_DontUseTargets();
void SUB_UseTargets();
-.void() reset; // if set, an entity is reset using this
+.void(entity this) reset; // if set, an entity is reset using this
.void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
void ClientData_Touch(entity e);
farcent.origin = hitloc;
farcent.forcetype = FORCETYPE_FORCEATPOS;
farcent.nextthink = time + 0.1;
- farcent.think = SUB_Remove;
+ farcent.think = SUB_Remove_self;
}
else
{
//pl.disableclientprediction = false;
}
-void GrapplingHookReset()
-{SELFPARAM();
- if(self.realowner.hook == self)
- RemoveGrapplingHook(self.owner);
+void GrapplingHookReset(entity this)
+{
+ if(this.realowner.hook == this)
+ RemoveGrapplingHook(this.owner);
else // in any case:
- remove(self);
+ remove(this);
}
void GrapplingHookThink();
void() SUB_CalcMoveDone;
void() SUB_CalcAngleMoveDone;
//void() SUB_UseTargets;
-void() SUB_Remove;
spawnfunc(info_null);
void updateanim(entity e);
-/*
-==================
-SUB_Remove
-Remove self
-==================
-*/
-void SUB_Remove ();
/*
==================
void objerror(string s);
void droptofloor();
-void() SUB_Remove;
void attach_sameorigin(entity e, entity to, string tag);
// reset this objective. Used when spawning an objective
// and when a new round starts
-void assault_objective_reset()
-{SELFPARAM();
- self.health = ASSAULT_VALUE_INACTIVE;
+void assault_objective_reset(entity this)
+{
+ this.health = ASSAULT_VALUE_INACTIVE;
}
// decrease the health of targeted objectives
assault_setenemytoobjective();
}
-void target_assault_roundend_reset()
-{SELFPARAM();
+void target_assault_roundend_reset(entity this)
+{
//print("round end reset\n");
- self.cnt = self.cnt + 1; // up round counter
- self.winning = 0; // up round
+ ++this.cnt; // up round counter
+ this.winning = false; // up round
}
void target_assault_roundend_use()
spawnfunc(target_objective)
{
- if (!g_assault) { remove(self); return; }
+ if (!g_assault) { remove(this); return; }
- self.classname = "target_objective";
- self.use = assault_objective_use;
- assault_objective_reset();
- self.reset = assault_objective_reset;
- self.spawn_evalfunc = target_objective_spawn_evalfunc;
+ this.classname = "target_objective";
+ this.use = assault_objective_use;
+ this.reset = assault_objective_reset;
+ this.reset(this);
+ this.spawn_evalfunc = target_objective_spawn_evalfunc;
}
spawnfunc(target_objective_decrease)
ctf_CheckStalemate();
}
-void ctf_Reset()
-{SELFPARAM();
- if(self.owner)
- if(IS_PLAYER(self.owner))
- ctf_Handle_Throw(self.owner, world, DROP_RESET);
+void ctf_Reset(entity this)
+{
+ if(this.owner && IS_PLAYER(this.owner))
+ ctf_Handle_Throw(this.owner, world, DROP_RESET);
- ctf_RespawnFlag(self);
+ ctf_RespawnFlag(this);
}
void ctf_DelayedFlagSetup() // called after a flag is placed on a map by ctf_FlagSetup()
dompoint_captured();
}
-void dom_controlpoint_setup()
-{SELFPARAM();
+void dom_controlpoint_setup(entity this);
+void dom_controlpoint_setup_self() { SELFPARAM(); dom_controlpoint_setup(this); }
+void dom_controlpoint_setup(entity this)
+{
entity head;
// find the spawnfunc_dom_team representing unclaimed points
head = find(world, classname, "dom_team");
remove(self);
return;
}
- self.think = dom_controlpoint_setup;
+ self.think = dom_controlpoint_setup_self;
self.nextthink = time + 0.1;
self.reset = dom_controlpoint_setup;
setself(this);
}
-void _spawnfunc_dom_controlpoint() { SELFPARAM(); spawnfunc_dom_controlpoint(self); }
+void self_spawnfunc_dom_controlpoint() { SELFPARAM(); spawnfunc_dom_controlpoint(self); }
void dom_spawnpoint(vector org)
{SELFPARAM();
setself(spawn());
self.classname = "dom_controlpoint";
- self.think = _spawnfunc_dom_controlpoint;
+ self.think = self_spawnfunc_dom_controlpoint;
self.nextthink = time;
setorigin(self, org);
spawnfunc_dom_controlpoint(this);
monster = spawnmonster("", mon, world, world, e.origin, false, false, 2);
else return;
- e.think = SUB_Remove;
+ e.think = SUB_Remove_self;
e.nextthink = time + 0.1;
}
else
WaypointSprite_Kill(plyr.waypointsprite_attachedforcarrier);
}
-void ka_Reset() // used to clear the ballcarrier whenever the match switches from warmup to normal
-{SELFPARAM();
- if((self.owner) && (IS_PLAYER(self.owner)))
- ka_DropEvent(self.owner);
+/** used to clear the ballcarrier whenever the match switches from warmup to normal */
+void ka_Reset(entity this)
+{
+ if((this.owner) && (IS_PLAYER(this.owner)))
+ ka_DropEvent(this.owner);
if(time < game_starttime)
{
- self.think = ka_RespawnBall;
- self.touch = func_null;
- self.nextthink = game_starttime;
+ this.think = ka_RespawnBall;
+ this.touch = func_null;
+ this.nextthink = game_starttime;
}
else
ka_RespawnBall();
self.nextthink = time + 0.05;
}
-void key_reset()
-{SELFPARAM();
- kh_Key_AssignTo(self, world);
- kh_Key_Remove(self);
+void key_reset(entity this)
+{
+ kh_Key_AssignTo(this, world);
+ kh_Key_Remove(this);
}
const string STR_ITEM_KH_KEY = "item_kh_key";
}
}
-void SUB_Remove();
-
void pathlib_showsquare(vector where,float goodsquare,float _lifetime)
{
entity s;
s = spawn();
s.alpha = 0.25;
- s.think = SUB_Remove;
+ s.think = SUB_Remove_self;
s.nextthink = _lifetime;
s.scale = pathlib_gridsize / 512.001;
s.solid = SOLID_NOT;
e = spawn();
e.alpha = 0.25;
- e.think = SUB_Remove;
+ e.think = SUB_Remove_self;
e.nextthink = _lifetime;
e.scale = pathlib_gridsize / 512;
e.solid = SOLID_NOT;
e = findchainentity(owner, start);
while(e)
{
- e.think = SUB_Remove;
+ e.think = SUB_Remove_self;
e.nextthink = time;
e = e.chain;
}
void dumpnode(entity n)
{
n.is_path_node = false;
- n.think = SUB_Remove;
+ n.think = SUB_Remove_self;
n.nextthink = time;
}
node = spawn();
- node.think = SUB_Remove;
+ node.think = SUB_Remove_self;
node.nextthink = time + PATHLIB_NODEEXPIRE;
node.is_path_node = true;
node.owner = openlist;
if(this.angles != '0 0 0')
this.SendFlags |= ISF_ANGLES;
- this.reset = Item_Reset_self;
+ this.reset = Item_Reset;
// it's a level item
if(this.spawnflags & 1)
this.noalign = 1;
else if (targ.classname == "item_health_mega")
self.health = 200;
//remove(targ); // removing ents in init functions causes havoc, workaround:
- targ.think = SUB_Remove;
+ targ.think = SUB_Remove_self;
targ.nextthink = time;
}
self.spawnflags = 2;