onslaught_updatelinks();
// captureshield setup
- ons_CaptureShield_Spawn(self, false);
+ ons_CaptureShield_Spawn(this, false);
- CSQCMODEL_AUTOINIT(self);
+ CSQCMODEL_AUTOINIT(this);
}
void ons_ControlPoint_Setup(entity cp)
-{SELFPARAM();
- // declarations
- setself(cp); // for later usage with droptofloor()
-
+{
// main setup
cp.ons_worldcpnext = ons_worldcplist; // link control point into ons_worldcplist
ons_worldcplist = cp;
{
setorigin(cp, cp.origin + '0 0 20');
cp.noalign = false;
- setself(cp);
- droptofloor();
+ WITHSELF(cp, droptofloor());
cp.movetype = MOVETYPE_TOSS;
}
// waypointsprites
- WaypointSprite_SpawnFixed(WP_Null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE);
- WaypointSprite_UpdateRule(self.sprite, self.team, SPRITERULE_TEAMPLAY);
+ WaypointSprite_SpawnFixed(WP_Null, cp.origin + CPGEN_WAYPOINT_OFFSET, cp, sprite, RADARICON_NONE);
+ WaypointSprite_UpdateRule(cp.sprite, cp.team, SPRITERULE_TEAMPLAY);
InitializeEntity(cp, ons_DelayedControlPoint_Setup, INITPRIO_SETLOCATION);
}
}
void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc
-{SELFPARAM();
+{
// declarations
int teamnumber = gen.team;
- setself(gen); // for later usage with droptofloor()
// main setup
gen.ons_worldgeneratornext = ons_worldgeneratorlist; // link generator into ons_worldgeneratorlist
gen.colormap = 1024 + (teamnumber - 1) * 17;
// generator placement
- setself(gen);
- droptofloor();
+ WITHSELF(gen, droptofloor());
// waypointsprites
- WaypointSprite_SpawnFixed(WP_Null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE);
- WaypointSprite_UpdateRule(self.sprite, self.team, SPRITERULE_TEAMPLAY);
- WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
- WaypointSprite_UpdateHealth(self.sprite, self.health);
+ WaypointSprite_SpawnFixed(WP_Null, gen.origin + CPGEN_WAYPOINT_OFFSET, gen, sprite, RADARICON_NONE);
+ WaypointSprite_UpdateRule(gen.sprite, gen.team, SPRITERULE_TEAMPLAY);
+ WaypointSprite_UpdateMaxHealth(gen.sprite, gen.max_health);
+ WaypointSprite_UpdateHealth(gen.sprite, gen.health);
InitializeEntity(gen, ons_DelayedGeneratorSetup, INITPRIO_SETLOCATION);
}
FOREACH_CLIENT(true, LAMBDA(
if(!IS_SPEC(it) && !IS_OBSERVER(it))
continue;
- setself(it);
- if(self.superspec_flags & SSF_ITEMMSG)
- if(superspec_filteritem(self, _item))
+ if(it.superspec_flags & SSF_ITEMMSG)
+ if(superspec_filteritem(it, _item))
{
- if(self.superspec_flags & SSF_VERBOSE)
- superspec_msg("", "", self, sprintf("Player %s^7 just picked up ^3%s\n", other.netname, _item.netname), 1);
+ if(it.superspec_flags & SSF_VERBOSE)
+ superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n", other.netname, _item.netname), 1);
else
- superspec_msg("", "", self, sprintf("Player %s^7 just picked up ^3%s\n^8(%s^8)\n", other.netname, _item.netname, _item.classname), 1);
- if((self.autospec_flags & ASF_SSIM) && self.enemy != other)
+ superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n^8(%s^8)\n", other.netname, _item.netname, _item.classname), 1);
+ if((it.autospec_flags & ASF_SSIM) && it.enemy != other)
{
- superspec_Spectate(other);
-
- setself(this);
+ WITHSELF(it, superspec_Spectate(other));
return MUT_ITEMTOUCH_CONTINUE;
}
}
- if((self.autospec_flags & ASF_SHIELD && _item.invincible_finished) ||
- (self.autospec_flags & ASF_STRENGTH && _item.strength_finished) ||
- (self.autospec_flags & ASF_MEGA_AR && _item.itemdef == ITEM_ArmorMega) ||
- (self.autospec_flags & ASF_MEGA_HP && _item.itemdef == ITEM_HealthMega) ||
- (self.autospec_flags & ASF_FLAG_GRAB && _item.classname == "item_flag_team"))
+ if((it.autospec_flags & ASF_SHIELD && _item.invincible_finished) ||
+ (it.autospec_flags & ASF_STRENGTH && _item.strength_finished) ||
+ (it.autospec_flags & ASF_MEGA_AR && _item.itemdef == ITEM_ArmorMega) ||
+ (it.autospec_flags & ASF_MEGA_HP && _item.itemdef == ITEM_HealthMega) ||
+ (it.autospec_flags & ASF_FLAG_GRAB && _item.classname == "item_flag_team"))
{
- if((self.enemy != other) || IS_OBSERVER(self))
+ if((it.enemy != other) || IS_OBSERVER(it))
{
- if(self.autospec_flags & ASF_OBSERVER_ONLY && !IS_OBSERVER(self))
+ if(it.autospec_flags & ASF_OBSERVER_ONLY && !IS_OBSERVER(it))
{
- if(self.superspec_flags & SSF_VERBOSE)
- superspec_msg("", "", self, sprintf("^8Ignored that ^7%s^8 grabbed %s^8 since the observer_only option is ON\n", other.netname, _item.netname), 2);
+ if(it.superspec_flags & SSF_VERBOSE)
+ superspec_msg("", "", it, sprintf("^8Ignored that ^7%s^8 grabbed %s^8 since the observer_only option is ON\n", other.netname, _item.netname), 2);
}
else
{
- if(self.autospec_flags & ASF_SHOWWHAT)
- superspec_msg("", "", self, sprintf("^7Following %s^7 due to picking up %s\n", other.netname, _item.netname), 2);
+ if(it.autospec_flags & ASF_SHOWWHAT)
+ superspec_msg("", "", it, sprintf("^7Following %s^7 due to picking up %s\n", other.netname, _item.netname), 2);
- superspec_Spectate(other);
+ WITHSELF(it, superspec_Spectate(other));
}
}
}
));
- setself(this);
-
return MUT_ITEMTOUCH_CONTINUE;
}
{
SELFPARAM();
FOREACH_CLIENT(IS_SPEC(it), LAMBDA(
- setself(it);
- if(self.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && self.enemy == frag_target)
+ if(it.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && it.enemy == frag_target)
{
- if(self.autospec_flags & ASF_SHOWWHAT)
- superspec_msg("", "", self, sprintf("^7Following %s^7 due to followkiller\n", frag_attacker.netname), 2);
+ if(it.autospec_flags & ASF_SHOWWHAT)
+ superspec_msg("", "", it, sprintf("^7Following %s^7 due to followkiller\n", frag_attacker.netname), 2);
- superspec_Spectate(frag_attacker);
+ WITHSELF(it, superspec_Spectate(frag_attacker));
}
));
- setself(frag_target);
return false;
}
return;
#endif
- setself(self.enemy);
- if (self.state == 2)
- plat_go_up ();
- else if (self.state == 1)
- self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
+ if (self.enemy.state == 2)
+ WITHSELF(self.enemy, plat_go_up());
+ else if (self.enemy.state == 1)
+ self.enemy.SUB_NEXTTHINK = self.enemy.SUB_LTIME + 1;
}
void plat_outside_touch()
return;
#endif
- setself(self.enemy);
- if (self.state == 1)
- plat_go_down ();
+ if (self.enemy.state == 1)
+ WITHSELF(self.enemy, plat_go_down());
}
void plat_trigger_use(entity this, entity actor, entity trigger)
.float platmovetype_turn;
void SUB_CalcMove_controller_think ()
{SELFPARAM();
- entity oldself;
float traveltime;
float phasepos;
float nexttick;
else
{
// derivative: delta + 2 * delta2 (e.g. for angle positioning)
- oldself = self;
- self.owner.SUB_THINK = self.think1;
- setself(self.owner);
- remove(oldself);
- self.SUB_THINK();
+ entity own = self.owner;
+ own.SUB_THINK = self.think1;
+ remove(self);
+ WITHSELF(own, own.SUB_THINK());
}
}
self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
// invoke controller
- setself(controller);
- self.think();
- setself(self.owner);
+ WITHSELF(controller, controller.think());
}
void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
self.nextthink = time + self.ticrate;
self.owner.attack_finished_single[0] = time + frametime;
- setself(self.owner);
- FireImoBeam ( self.tur_shotorg,
+ FireImoBeam ( self.owner, self.tur_shotorg,
self.tur_shotorg + self.tur_shotdir_updated * self.target_range,
'-1 -1 -1' * self.shot_radius,
'1 1 1' * self.shot_radius,
this.shot_dmg,
0.75,
DEATH_TURRET_PHASER.m_id);
- setself(this);
self.scale = vlen(self.owner.tur_shotorg - trace_endpos) / 256;
}
/*
* Railgun-like beam, but has thickness and suppots slowing of target
*/
-void FireImoBeam (vector start, vector end, vector smin, vector smax,
+void FireImoBeam(entity this, vector start, vector end, vector smin, vector smax,
float bforce, float f_dmg, float f_velfactor, int deathtype)
-{SELFPARAM();
+{
vector hitloc, force, endpoint, dir;
entity ent;
// note down which entities were hit so we can damage them later
while (1)
{
- tracebox(start, smin, smax, end, false, self);
+ tracebox(start, smin, smax, end, false, this);
// if it is world we can't hurt it so stop now
if (trace_ent == world || trace_fraction == 1)
// apply the damage
if (ent.takedamage)
{
- Damage (ent, self, self, f_dmg, deathtype, hitloc, force);
+ Damage (ent, this, this, f_dmg, deathtype, hitloc, force);
ent.velocity = ent.velocity * f_velfactor;
//ent.alpha = 0.25 + random() * 0.75;
}
vector shortangle_vxy(vector ang1, vector ang2);
vector angleofs(entity from, entity to);
vector angleofs3(vector from, vector from_a, entity to);
-void FireImoBeam (vector start, vector end, vector smin, vector smax, float bforce, float f_dmg, float f_velfactor, float deathtype);
+void FireImoBeam(entity this, vector start, vector end, vector smin, vector smax, float bforce, float f_dmg, float f_velfactor, float deathtype);
#endif
void vehicles_showwp()
{SELFPARAM();
- entity oldself = world;
vector rgb;
- if(self.cnt)
+ entity ent = this;
+
+ if(ent.cnt)
{
- self.think = vehicles_return;
- self.nextthink = self.cnt;
+ ent.think = vehicles_return;
+ ent.nextthink = ent.cnt;
}
else
{
- self.think = vehicles_return;
- self.nextthink = time +1;
-
- oldself = self;
- setself(spawn());
- setmodel(self, MDL_Null);
- self.team = oldself.wp00.team;
- self.wp00 = oldself.wp00;
- setorigin(self, oldself.wp00.pos1);
-
- self.nextthink = time + 5;
- self.think = vehicles_showwp_goaway;
+ ent.think = vehicles_return;
+ ent.nextthink = time + 1;
+
+ ent = spawn();
+ setmodel(ent, MDL_Null);
+ ent.team = this.wp00.team;
+ ent.wp00 = this.wp00;
+ setorigin(ent, this.wp00.pos1);
+
+ ent.nextthink = time + 5;
+ ent.think = vehicles_showwp_goaway;
}
- if(teamplay && self.team)
- rgb = Team_ColorRGB(self.team);
+ if(teamplay && ent.team)
+ rgb = Team_ColorRGB(ent.team);
else
rgb = '1 1 1';
- entity wp = WaypointSprite_Spawn(WP_Vehicle, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Vehicle);
+ entity wp = WaypointSprite_Spawn(WP_Vehicle, 0, 0, ent, '0 0 64', world, 0, ent, waypointsprite_attached, true, RADARICON_Vehicle);
wp.colormod = rgb;
- if(self.waypointsprite_attached)
+ if(ent.waypointsprite_attached)
{
- WaypointSprite_UpdateRule(self.waypointsprite_attached, self.wp00.team, SPRITERULE_DEFAULT);
+ WaypointSprite_UpdateRule(ent.waypointsprite_attached, ent.wp00.team, SPRITERULE_DEFAULT);
if(this == NULL)
- WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, self.nextthink);
- WaypointSprite_Ping(self.waypointsprite_attached);
+ WaypointSprite_UpdateBuildFinished(ent.waypointsprite_attached, ent.nextthink);
+ WaypointSprite_Ping(ent.waypointsprite_attached);
}
-
- if(this)
- setself(this);
}
void vehicles_setreturn(entity veh)
if(!self.owner)
{
- entity oldself = self;
if(self.gunner1)
{
entity e = self.gunner1;