]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Propagate this
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 26 Mar 2016 14:12:30 +0000 (01:12 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 26 Mar 2016 15:22:11 +0000 (02:22 +1100)
81 files changed:
qcsrc/client/shownames.qc
qcsrc/client/view.qc
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/ent_cs.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/multijump/multijump.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/mutators/mutator/physical_items/physical_items.qc
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/movetypes/push.qc
qcsrc/common/t_items.qc
qcsrc/common/triggers/func/breakable.qc
qcsrc/common/triggers/func/button.qc
qcsrc/common/triggers/func/conveyor.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door_secret.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/triggers/trigger/impulse.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/secret.qc
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/common/triggers/triggers.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/defer.qh
qcsrc/lib/log.qh
qcsrc/lib/misc.qh
qcsrc/lib/net.qh
qcsrc/lib/self.qh
qcsrc/lib/spawnfunc.qh
qcsrc/server/bot/bot.qc
qcsrc/server/bot/scripting.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_subs.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/mutators/mutator/gamemode_tdm.qc
qcsrc/server/playerdemo.qc
qcsrc/server/race.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/sv_main.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/weaponsystem.qc

index ea1d1f9ca601917dbc44bac107b87c583527d109..5368cb6429177ef4130a10e45610596485cab269 100644 (file)
@@ -178,7 +178,7 @@ void Draw_ShowNames_All()
                }
                make_impure(it);
                assert(entcs.think, eprint(entcs));
-               WITH(entity, self, entcs, entcs.think());
+               WITHSELF(entcs, entcs.think());
                if (!entcs.has_origin) continue;
                if (entcs.m_entcs_private)
                {
index ed675fc6b7cdd34409fabefd05378f44ce0eeec2..f1b7a9be5ede7c8ccd4ca511bfb8cfc9851059b8 100644 (file)
@@ -1468,13 +1468,13 @@ void CSQC_UpdateView(float w, float h)
                        if(!gen)
                                ons_roundlost = false; // don't enforce the 3rd person camera if there is no dead generator to show
                }
-               if(WantEventchase(self) || (!autocvar_cl_orthoview && ons_roundlost))
+               if(WantEventchase(this) || (!autocvar_cl_orthoview && ons_roundlost))
                {
                        eventchase_running = true;
 
                        entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1));
                        if(!local_player)
-                               local_player = self; // fall back!
+                               local_player = this; // fall back!
 
                        // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
                        vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
@@ -1493,7 +1493,7 @@ void CSQC_UpdateView(float w, float h)
 
                        if(view_offset)
                        {
-                               WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, self);
+                               WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, this);
                                if(trace_fraction == 1) { current_view_origin += view_offset; }
                                else { current_view_origin.z += max(0, (trace_endpos.z - current_view_origin.z) - autocvar_cl_eventchase_maxs.z); }
                        }
@@ -1522,14 +1522,14 @@ void CSQC_UpdateView(float w, float h)
                        makevectors(view_angles);
 
                        vector eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
-                       WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, self);
+                       WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, this);
 
                        // If the boxtrace fails, revert back to line tracing.
                        if(!local_player.viewloc)
                        if(trace_startsolid)
                        {
                                eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
-                               WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);
+                               WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, this);
                                setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins.z)));
                        }
                        else { setproperty(VF_ORIGIN, trace_endpos); }
index 024d98277d1b0c338159f7bdc6421665ed4ed735..c894ea15414f294ba8d5b6b1d62192b3558056c1 100644 (file)
@@ -73,33 +73,33 @@ void DamageEffect_Think()
 {SELFPARAM();
        // if particle distribution is enabled, slow ticrate by total number of damages
        if(autocvar_cl_damageeffect_distribute)
-               self.nextthink = time + autocvar_cl_damageeffect_ticrate * self.owner.total_damages;
+               this.nextthink = time + autocvar_cl_damageeffect_ticrate * this.owner.total_damages;
        else
-               self.nextthink = time + autocvar_cl_damageeffect_ticrate;
+               this.nextthink = time + autocvar_cl_damageeffect_ticrate;
 
-       if(time >= self.cnt || !self.owner || !self.owner.modelindex || !self.owner.drawmask)
+       if(time >= this.cnt || !this.owner || !this.owner.modelindex || !this.owner.drawmask)
        {
                // time is up or the player got gibbed / disconnected
-               self.owner.total_damages = max(0, self.owner.total_damages - 1);
-               remove(self);
+               this.owner.total_damages = max(0, this.owner.total_damages - 1);
+               remove(this);
                return;
        }
-       if(self.state && !self.owner.csqcmodel_isdead)
+       if(this.state && !this.owner.csqcmodel_isdead)
        {
                // if the player was dead but is now alive, it means he respawned
                // if so, clear his damage effects, or damages from his dead body will be copied back
-               self.owner.total_damages = max(0, self.owner.total_damages - 1);
-               remove(self);
+               this.owner.total_damages = max(0, this.owner.total_damages - 1);
+               remove(this);
                return;
        }
-       self.state = self.owner.csqcmodel_isdead;
-       if(self.owner.isplayermodel && (self.owner.entnum == player_localentnum) && !autocvar_chase_active)
+       this.state = this.owner.csqcmodel_isdead;
+       if(this.owner.isplayermodel && (this.owner.entnum == player_localentnum) && !autocvar_chase_active)
                return; // if we aren't using a third person camera, hide our own effects
 
        // now generate the particles
        vector org;
-       org = gettaginfo(self, 0); // origin at attached location
-       __pointparticles(self.team, org, '0 0 0', 1);
+       org = gettaginfo(this, 0); // origin at attached location
+       __pointparticles(this.team, org, '0 0 0', 1);
 }
 
 string species_prefix(int specnum)
@@ -117,8 +117,8 @@ string species_prefix(int specnum)
        }
 }
 
-void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
-{SELFPARAM();
+void DamageEffect(entity this, vector hitorg, float thedamage, int type, int specnum)
+{
        // particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
 
        int nearestbone = 0;
@@ -128,13 +128,13 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
 
        if(!autocvar_cl_damageeffect || autocvar_cl_gentle || autocvar_cl_gentle_damage)
                return;
-       if(!self || !self.modelindex || !self.drawmask)
+       if(!this || !this.modelindex || !this.drawmask)
                return;
 
        // if this is a rigged mesh, the effect will show on the bone where damage was dealt
        // we do this by choosing the skeletal bone closest to the impact, and attaching our entity to it
        // if there's no skeleton, object origin will automatically be selected
-       FOR_EACH_TAG(self)
+       FOR_EACH_TAG(this)
        {
                if(!tagnum)
                        continue; // skip empty bones
@@ -144,21 +144,21 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
                        continue; // player model bone blacklist
 
                // now choose the bone closest to impact origin
-               if(nearestbone == 0 || vlen2(hitorg - gettaginfo(self, tagnum)) <= vlen2(hitorg - gettaginfo(self, nearestbone)))
+               if(nearestbone == 0 || vlen2(hitorg - gettaginfo(this, tagnum)) <= vlen2(hitorg - gettaginfo(this, nearestbone)))
                        nearestbone = tagnum;
        }
-       gettaginfo(self, nearestbone); // set gettaginfo_name
+       gettaginfo(this, nearestbone); // set gettaginfo_name
 
        // return if we reached our damage effect limit or damages are disabled
        // TODO: When the limit is reached, it would be better if the oldest damage was removed instead of not adding a new one
        if(nearestbone)
        {
-               if(self.total_damages >= autocvar_cl_damageeffect_bones)
+               if(this.total_damages >= autocvar_cl_damageeffect_bones)
                        return; // allow multiple damages on skeletal models
        }
        else
        {
-               if(autocvar_cl_damageeffect < 2 || self.total_damages)
+               if(autocvar_cl_damageeffect < 2 || this.total_damages)
                        return; // allow a single damage on non-skeletal models
        }
 
@@ -168,7 +168,7 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
 
        if(substring(effectname, strlen(effectname) - 5, 5) == "BLOOD")
        {
-               if(self.isplayermodel)
+               if(this.isplayermodel)
                {
                        specstr = species_prefix(specnum);
                        specstr = substring(specstr, 0, strlen(specstr) - 1);
@@ -179,13 +179,13 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
 
        e = new(damage);
        setmodel(e, MDL_Null); // necessary to attach and read origin
-       setattachment(e, self, gettaginfo_name); // attach to the given bone
-       e.owner = self;
+       setattachment(e, this, gettaginfo_name); // attach to the given bone
+       e.owner = this;
        e.cnt = time + life;
        e.team = _particleeffectnum(effectname);
        e.think = DamageEffect_Think;
        e.nextthink = time;
-       self.total_damages += 1;
+       this.total_damages += 1;
 }
 
 NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
@@ -224,11 +224,10 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                forcemul = 1;
 
     FOREACH_ENTITY_RADIUS(w_org, rad + MAX_DAMAGEEXTRARADIUS, !it.tag_entity, {
-               setself(it);
-               vector nearest = NearestPointOnBox(self, w_org);
+               vector nearest = NearestPointOnBox(it, w_org);
                if (rad)
                {
-                       thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
+                       thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
                        if(thisdmg >= 1)
                                continue;
                        if(thisdmg < 0)
@@ -236,42 +235,41 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                        if(thedamage)
                        {
                                thisdmg = thedamage + (edge - thedamage) * thisdmg;
-                               thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(self.origin - w_org);
+                               thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(it.origin - w_org);
                        }
                        else
                        {
                                thisdmg = 0;
-                               thisforce = forcemul * vlen(force) * normalize(self.origin - w_org);
+                               thisforce = forcemul * vlen(force) * normalize(it.origin - w_org);
                        }
                }
                else
                {
-                       if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
+                       if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
                                continue;
 
                        thisdmg = thedamage;
                        thisforce = forcemul * force;
                }
 
-               if(self.damageforcescale)
+               if(it.damageforcescale)
                        if(vdist(thisforce, !=, 0))
                        {
-                               self.move_velocity = self.move_velocity + damage_explosion_calcpush(self.damageforcescale * thisforce, self.move_velocity, autocvar_g_balance_damagepush_speedfactor);
-                               self.move_flags &= ~FL_ONGROUND;
+                               it.move_velocity = it.move_velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.move_velocity, autocvar_g_balance_damagepush_speedfactor);
+                               it.move_flags &= ~FL_ONGROUND;
                        }
 
                if(w_issilent)
-                       self.silent = 1;
+                       it.silent = 1;
 
-               if(self.event_damage)
-                       self.event_damage(self, thisdmg, w_deathtype, w_org, thisforce);
+               if(it.event_damage)
+                       it.event_damage(it, thisdmg, w_deathtype, w_org, thisforce);
 
-               DamageEffect(w_org, thisdmg, w_deathtype, species);
+               DamageEffect(it, w_org, thisdmg, w_deathtype, species);
 
-               if(self.isplayermodel)
+               if(it.isplayermodel)
                        hitplayer = true; // this impact damaged a player
        });
-       setself(this);
 
        if(DEATH_ISVEHICLE(w_deathtype))
        {
@@ -281,7 +279,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                else
                        w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
 
-               setorigin(self, w_org + w_backoff * 2); // for sound() calls
+               setorigin(this, w_org + w_backoff * 2); // for sound() calls
 
                switch(DEATH_ENT(w_deathtype))
                {
@@ -290,34 +288,34 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
 
                        // spiderbot
                        case DEATH_VH_SPID_MINIGUN:
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_SPID_ROCKET:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_SPID_DEATH:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
-                               pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
                                break;
 
                        case DEATH_VH_WAKI_GUN:
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RACER_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RACER_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_WAKI_ROCKET:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RACER_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RACER_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_WAKI_DEATH:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
-                               pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
                                break;
 
                        case DEATH_VH_RAPT_CANNON:
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_RAPT_FRAGMENT:
                                float i;
@@ -328,20 +326,20 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                                        ang = vectoangles(vel);
                                        RaptorCBShellfragToss(w_org, vel, ang + '0 0 1' * (120 * i));
                                }
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_RAPT_BOMB:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_RAPT_DEATH:
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
-                               pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_BUMB_GUN:
-                               sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_BIGPLASMA_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_BIGPLASMA_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                }
        }
@@ -355,49 +353,49 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                else
                        w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
 
-               setorigin(self, w_org + w_backoff * 2); // for sound() calls
+               setorigin(this, w_org + w_backoff * 2); // for sound() calls
 
                switch(DEATH_ENT(w_deathtype))
                {
                         case DEATH_TURRET_EWHEEL:
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
-                               pointparticles(EFFECT_BLASTER_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_BLASTER_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_FLAC:
                                pointparticles(EFFECT_HAGAR_EXPLODE, w_org, '0 0 0', 1);
-                               sound(self, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
+                               sound(this, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
                                break;
 
                         case DEATH_TURRET_MLRS:
                         case DEATH_TURRET_HK:
                         case DEATH_TURRET_WALK_ROCKET:
                         case DEATH_TURRET_HELLION:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
-                               pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_MACHINEGUN:
                         case DEATH_TURRET_WALK_GUN:
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_MACHINEGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_MACHINEGUN_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_PLASMA:
-                               sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_LOW);
-                               pointparticles(EFFECT_ELECTRO_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_ELECTRO_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_WALK_MELEE:
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_LOW);
-                               pointparticles(EFFECT_TE_SPARK, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_TE_SPARK, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_PHASER:
                                break;
 
                         case DEATH_TURRET_TESLA:
-                               te_smallflash(self.origin);
+                               te_smallflash(this.origin);
                                break;
 
                }
@@ -415,7 +413,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                        w_backoff = trace_plane_normal;
                else
                        w_backoff = -1 * normalize(force);
-               setorigin(self, w_org + w_backoff * 2); // for sound() calls
+               setorigin(this, w_org + w_backoff * 2); // for sound() calls
 
                if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
                {
index 148d3883f031d436fb9acfff64fca5d496c75496..1310ff0343b8d98e0b82c1246d493fb4985162eb 100644 (file)
        #undef X
                this.iflags |= IFLAG_ORIGIN;
                InterpolateOrigin_Note(this);
-               WITH(entity, self, this, this.think());
+               WITHSELF(this, this.think());
                return true;
        }
 
index 93afb72077500dca1fc5c9903a263ee458a2f2a9..4fc4a982cbefefb330b95d5cdafa979d2e769b96 100644 (file)
@@ -548,7 +548,7 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker
                // Use targets now (somebody make sure this is in the right place..)
                setself(this.owner);
                activator = this;
-               WITH(entity, self, this, SUB_UseTargets());
+               WITHSELF(this, SUB_UseTargets());
                setself(this);
 
                this.owner.waslinked = this.owner.islinked;
@@ -1775,7 +1775,7 @@ MUTATOR_HOOKFUNCTION(ons, reset_map_global)
        FOREACH_CLIENT(IS_PLAYER(it), {
                it.ons_roundlost = false;
                it.ons_deathloc = '0 0 0';
-               WITH(entity, self, it, PutClientInServer());
+               WITHSELF(it, PutClientInServer());
        });
        return false;
 }
index dfe918feca56d97da3c6479b54227ac96eafb5c7..ca2a0ed17c9234e306d03b4cabce5910cf9d79f8 100644 (file)
@@ -115,7 +115,7 @@ void HUD_MinigameMenu_Click(entity menuitem)
 {SELFPARAM();
        if ( menuitem )
        {
-               WITH(entity, self, menuitem, menuitem.use());
+               WITHSELF(menuitem, menuitem.use());
        }
 }
 
index 7c19c43dd6f4f2d037ac56dc7c0aa9ee54d601bb..991544189291e227cf6e6876d6cb7c15bfb9fff3 100644 (file)
@@ -146,7 +146,7 @@ int minigame_addplayer(entity minigame_session, entity player)
 
                if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer )
                {
-                       WITH(entity, self, player, PutObserverInServer());
+                       WITHSELF(player, PutObserverInServer());
                }
                if ( autocvar_sv_minigames_observer == 2 )
                        player.team_forced = -1;
index 9f6fb8d1b2017d241bd648a42d3c4c452e762ce0..3cfa18cdf4bc166e3f296cc11274a260acf3e050 100644 (file)
@@ -116,7 +116,7 @@ void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity at
        this.health = this.health - damage;
 
        if (this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
 }
 
 void M_Shambler_Attack_Lightning_Touch()
index 2c0ecdc481599c55564a96a5068b57a2b70c6df3..9b0541c14edb581a2f342337a8511b249c56c961 100644 (file)
@@ -57,12 +57,12 @@ REGISTER_MUTATOR(spiderweb, true);
 MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
 {
     SELFPARAM();
-       if (time >= self.spider_slowness)
+       if (time >= this.spider_slowness)
                return false;
-       PHYS_MAXSPEED(self) *= 0.5; // half speed while slow from spider
-       PHYS_MAXAIRSPEED(self) *= 0.5;
-       PHYS_AIRSPEEDLIMIT_NONQW(self) *= 0.5;
-       PHYS_AIRSTRAFEACCELERATE(self) *= 0.5;
+       PHYS_MAXSPEED(this) *= 0.5; // half speed while slow from spider
+       PHYS_MAXAIRSPEED(this) *= 0.5;
+       PHYS_AIRSPEEDLIMIT_NONQW(this) *= 0.5;
+       PHYS_AIRSTRAFEACCELERATE(this) *= 0.5;
        return false;
 }
 
index bba248b8d4f42de6df35de02b31bd52b9f5def1d..9d1022fa36cd92fcda738a5477699a6f80cd74d4 100644 (file)
@@ -48,7 +48,7 @@ void monster_dropitem(entity this)
        if(e && e.monster_loot)
        {
                e.noalign = true;
-               WITH(entity, self, e, e.monster_loot(e));
+               WITHSELF(e, e.monster_loot(e));
                e.gravity = 1;
                e.movetype = MOVETYPE_TOSS;
                e.reset = SUB_Remove;
@@ -1104,7 +1104,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
                // TODO: fix this?
                activator = attacker;
                other = this.enemy;
-               WITH(entity, self, this, SUB_UseTargets());
+               WITHSELF(this, SUB_UseTargets());
                this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
 
                Monster_Dead(this, attacker, (this.health <= -100 || deathtype == DEATH_KILL.m_id));
index 61d4dc80aab7cff02b48ef15c4ed07e18d0ffc96..7de2a906201ff55964e6971440fc383ee8b7e838 100644 (file)
@@ -892,7 +892,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
                                {
                                        entity oldother = other;
                                        other = self;
-                                       WITH(entity, self, it, it.touch());
+                                       WITHSELF(it, it.touch());
 
                                        other = oldother;
                                }
index 69bc4b7b9931274e697b9824652bec5854be99be..f0cbf6afcd604ee3b0a9698027ac90792cf32776 100644 (file)
@@ -371,7 +371,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
         e.cnt = self.cnt;
         e.team = self.team;
         e.spawnfunc_checked = true;
-               WITH(entity, self, e, spawnfunc_item_minst_cells(e));
+               WITHSELF(e, spawnfunc_item_minst_cells(e));
                return true;
        }
 
index 14c854df9221d70ae455a57503dfdc29f1563bbf..50fd020213ae77ef64af5809798c42eba3593477 100644 (file)
@@ -101,19 +101,19 @@ MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
 {
     SELFPARAM();
 #ifdef CSQC
-       self.multijump_count = PHYS_MULTIJUMP_COUNT(self);
+       this.multijump_count = PHYS_MULTIJUMP_COUNT(this);
 #endif
        if(!PHYS_MULTIJUMP) { return; }
 
-       if(IS_ONGROUND(self))
-               self.multijump_count = 0;
+       if(IS_ONGROUND(this))
+               this.multijump_count = 0;
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
 {
     SELFPARAM();
-       return PM_multijump_checkjump(self);
+       return PM_multijump_checkjump(this);
 }
 
 #ifdef SVQC
index 2e34c6de721f67010221c4414b41dcd3155c058e..8d17edb0b6c164b7114bf24b551b16c396bb7065 100644 (file)
@@ -749,7 +749,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
        {
                this.takedamage = DAMAGE_NO;
-               WITH(entity, self, this, nade_boom());
+               WITHSELF(this, nade_boom());
                return;
        }
 
@@ -804,7 +804,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
                this.realowner = attacker;
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, nade_boom));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, nade_boom));
        else
                nade_burn_spawn(this);
 }
index a5360a20cd4e1852cf2407353207660249d3b5ec..5a06302d9f282fe5cc92a550dee40b90d9eaf21f 100644 (file)
@@ -80,7 +80,7 @@ void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity atta
        this.health = this.health - damage;
 
        if (this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
 }
 
 void W_RocketPropelledChainsaw_Think()
index e8e152a5bbdb1dbbd06e40daea047e07487483f8..aaad9d47be599b59c91a7c879014d0deb8dc6535 100644 (file)
@@ -127,7 +127,7 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn)
                setorigin(wep, wep.origin + '0 0 1');
                entity oldself;
                oldself = self;
-               WITH(entity, self, wep, builtin_droptofloor());
+               WITHSELF(wep, builtin_droptofloor());
        }
 
        wep.spawn_origin = wep.origin;
index 2c9c5894bfecfdbfefe763562e840cf4f05f0233..33c56216a5d71b8ad053f9c3a05236af65ae5509 100644 (file)
@@ -321,7 +321,7 @@ void _Movetype_Impact(entity this, entity oth)  // SV_Impact
        {
                other = oth;
 
-               WITH(entity, self, this, this.move_touch());
+               WITHSELF(this, this.move_touch());
 
                other = oldother;
        }
@@ -330,7 +330,7 @@ void _Movetype_Impact(entity this, entity oth)  // SV_Impact
        {
                other = this;
 
-               WITH(entity, self, oth, oth.move_touch());
+               WITHSELF(oth, oth.move_touch());
 
                other = oldother;
        }
@@ -360,7 +360,7 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this)  // SV_LinkEdict_TouchAreaGr
                        trace_plane_dist = 0;
                        trace_ent = this;
 
-                       WITH(entity, self, it, it.move_touch());
+                       WITHSELF(it, it.move_touch());
                }
     });
 
index dd89a4099dfa6e9c3a38d001a49a618ea204932f..b3cfb875da28a318c6585bd1a91df2f8e1ff64ef 100644 (file)
@@ -149,6 +149,6 @@ void _Movetype_Physics_Pusher(entity this, float dt)  // SV_Physics_Pusher
                this.move_nextthink = 0;
                this.move_time = time;
                other = world;
-               WITH(entity, self, this, this.move_think());
+               WITHSELF(this, this.move_think());
        }
 }
index a381324f8990ea7613132f3086f2c9fbaaf9794f..75fec0103e7ccbe6cb04b804baf5b315c8a664b6 100644 (file)
@@ -1030,7 +1030,7 @@ float commodity_pickupevalfunc(entity player, entity item)
 void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
-               WITH(entity, self, this, RemoveItem());
+               WITHSELF(this, RemoveItem());
 }
 
 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
@@ -1135,7 +1135,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                        this.SendFlags |= ISF_SIZE;
                        // note droptofloor returns false if stuck/or would fall too far
                        if (!this.noalign)
-                               WITH(entity, self, this, droptofloor());
+                               WITHSELF(this, droptofloor());
                        waypoint_spawnforitem(this);
                }
 
index e3c74b35626ba894f03335c432b91b64ecf4a38b..feaf8785093d97b9663d67096ae3c8d22d853394 100644 (file)
@@ -243,7 +243,7 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float
                WaypointSprite_Ping(this.sprite);
                WaypointSprite_UpdateHealth(this.sprite, this.health);
        }
-       WITH(entity, self, this, func_breakable_colormod());
+       WITHSELF(this, func_breakable_colormod());
 
        if(this.health <= 0)
        {
index 41cdb44dafc3237fb9063bd5aafffce77cb1f314..e9ae0a5472042f24cfbada02a1ce52cdbd9fd07d 100644 (file)
@@ -92,7 +92,7 @@ void button_damage(entity this, entity inflictor, entity attacker, float damage,
        if (this.health <= 0)
        {
                this.enemy = damage_attacker;
-               WITH(entity, self, this, button_fire());
+               WITHSELF(this, button_fire());
        }
 }
 
index fb50a6613c14ce5dab6c3ea43d54978fd6e4822b..583c737438ac3fae10131e2497018df65789ca38 100644 (file)
@@ -147,7 +147,7 @@ spawnfunc(func_conveyor)
 
 #elif defined(CSQC)
 
-void conveyor_draw(entity this) { WITH(entity, self, this, conveyor_think()); }
+void conveyor_draw(entity this) { WITHSELF(this, conveyor_think()); }
 
 void conveyor_init()
 {SELFPARAM();
index 1bd36df4bf0957ae6e6e27a0178e6753d8e85eef..0b250ef32e1d1f74fd2f04c5628dce82b8e6bd65 100644 (file)
@@ -268,7 +268,7 @@ void door_use()
 
        if (self.owner)
        {
-               WITH(entity, self, self.owner, door_fire());
+               WITHSELF(self.owner, door_fire());
        }
 }
 
@@ -289,7 +289,7 @@ void door_damage(entity this, entity inflictor, entity attacker, float damage, i
        {
                this.owner.health = this.owner.max_health;
                this.owner.takedamage = DAMAGE_NO;      // wil be reset upon return
-               WITH(entity, self, this.owner, door_use());
+               WITHSELF(this.owner, door_use());
        }
 }
 
index e32ed7e50c308c66627c434bc8eebfaf66bc081a..70b5a0a09e884f3a3aac039b42fb8a55e973ea02 100644 (file)
@@ -65,7 +65,7 @@ void fd_secret_use()
 
 void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
-       WITH(entity, self, this, fd_secret_use());
+       WITHSELF(this, fd_secret_use());
 }
 
 // Wait after first movement...
index 77bb7b87090b4e093180c0b1ec0cf2cb2fa205c1..26ecc81f148411626551012622434f73a024f361 100644 (file)
@@ -5,7 +5,7 @@ void train_use();
 #endif
 void train_wait()
 {SELFPARAM();
-       WITH(entity, self, self.enemy, SUB_UseTargets());
+       WITHSELF(self.enemy, SUB_UseTargets());
        self.enemy = world;
 
        // if turning is enabled, the train will turn toward the next point while waiting
index bcd6f2807675e89db6ea3ebd05e9ae95dd70e449..0f05ce72a82772123100b4a2bb017a3047cdd7f0 100644 (file)
@@ -98,7 +98,7 @@ void misc_laser_think()
                                self.count = 1;
 
                                activator = self.enemy.pusher;
-                               WITH(entity, self, self.enemy, SUB_UseTargets());
+                               WITHSELF(self.enemy, SUB_UseTargets());
                        }
                }
                else
@@ -108,7 +108,7 @@ void misc_laser_think()
                                self.count = 0;
 
                                activator = self.enemy.pusher;
-                               WITH(entity, self, self.enemy, SUB_UseTargets());
+                               WITHSELF(self.enemy, SUB_UseTargets());
                        }
                }
        }
index a0f60bb32f03a2f3cd99da0924d6e02c4cd6db09..87c9c329099641e2c1cab962c2f5b8d55d4f26de 100644 (file)
@@ -47,15 +47,15 @@ void SUB_VanishOrRemove (entity ent)
 
 void SUB_SetFade_Think ()
 {SELFPARAM();
-       if(self.alpha == 0)
-               self.alpha = 1;
-       self.SUB_THINK = SUB_SetFade_Think;
-       self.SUB_NEXTTHINK = time;
-       self.alpha -= frametime * self.fade_rate;
-       if (self.alpha < 0.01)
-               SUB_VanishOrRemove(self);
+       if(this.alpha == 0)
+               this.alpha = 1;
+       this.SUB_THINK = SUB_SetFade_Think;
+       this.SUB_NEXTTHINK = time;
+       this.alpha -= frametime * this.fade_rate;
+       if (this.alpha < 0.01)
+               SUB_VanishOrRemove(this);
        else
-               self.SUB_NEXTTHINK = time;
+               this.SUB_NEXTTHINK = time;
 }
 
 /*
@@ -295,7 +295,7 @@ void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
 
 void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
 {SELFPARAM();
-       WITH(entity, self, ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
+       WITHSELF(ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
 }
 
 /*
@@ -363,5 +363,5 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void()
 
 void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
 {SELFPARAM();
-       WITH(entity, self, ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
+       WITHSELF(ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
 }
index 1873d64a07be516e9e387fe1a52737d6ab80f8b0..7083fcccd1fdd9ede7566056af52d9eee02887f0 100644 (file)
@@ -36,15 +36,15 @@ void target_music_reset(entity this)
 }
 void target_music_kill()
 {
-    SELFPARAM();
-       for(self = world; (self = find(self, classname, "target_music")); )
-       {
-               self.volume = 0;
-               if(self.targetname == "")
-                       target_music_sendto(MSG_ALL, 1);
-               else
-                       target_music_sendto(MSG_ALL, 0);
-       }
+       FOREACH_ENTITY_CLASS("target_music", true, {
+               it.volume = 0;
+               WITHSELF(it, {
+            if (it.targetname == "")
+                target_music_sendto(MSG_ALL, 1);
+            else
+                target_music_sendto(MSG_ALL, 0);
+               });
+       });
 }
 void target_music_use()
 {
index 96c266f6cc57315e2436e3f752321b83405a5ab8..960e818b6d8c69dd8cfbabd8c5481dba7daa62c8 100644 (file)
@@ -221,7 +221,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                        oldactivator = activator;
 
                        activator = act;
-                       WITH(entity, self, e, e.target_spawn_spawnfunc(e));
+                       WITHSELF(e, e.target_spawn_spawnfunc(e));
                        activator = oldactivator;
 
                        // We called an external function, so we have to re-tokenize msg.
index b4b146c7f315292c3e7a44968b280e8e3821e7ac..b7cd57272dce363c57e103f755e6a126c165019a 100644 (file)
@@ -218,24 +218,24 @@ spawnfunc(trigger_impulse)
 #elif defined(CSQC)
 NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew)
 {
-       self.spawnflags = ReadInt24_t();
-       self.radius = ReadCoord();
-       self.strength = ReadCoord();
-       self.falloff = ReadByte();
-       self.active = ReadByte();
+       this.spawnflags = ReadInt24_t();
+       this.radius = ReadCoord();
+       this.strength = ReadCoord();
+       this.falloff = ReadByte();
+       this.active = ReadByte();
 
        trigger_common_read(true);
        return = true;
 
-       self.classname = "trigger_impulse";
-       self.solid = SOLID_TRIGGER;
-       self.entremove = trigger_remove_generic;
-       //self.draw = trigger_draw_generic;
-       self.drawmask = MASK_NORMAL;
-       self.move_time = time;
+       this.classname = "trigger_impulse";
+       this.solid = SOLID_TRIGGER;
+       this.entremove = trigger_remove_generic;
+       //this.draw = trigger_draw_generic;
+       this.drawmask = MASK_NORMAL;
+       this.move_time = time;
 
-       if(self.radius) { self.move_touch = trigger_impulse_touch3; }
-       else if(self.target) { self.move_touch = trigger_impulse_touch1; }
-       else { self.move_touch = trigger_impulse_touch2; }
+       if(this.radius) { this.move_touch = trigger_impulse_touch3; }
+       else if(this.target) { this.move_touch = trigger_impulse_touch1; }
+       else { this.move_touch = trigger_impulse_touch2; }
 }
 #endif
index de8458e9f8bc15abe5c63f034c35164c02f3ff6f..7b82c39590e2bc1e3e192f69161d2894f0d0be49 100644 (file)
@@ -237,7 +237,7 @@ void trigger_push_touch()
        if(this.enemy.target)
        {
                activator = other;
-               WITH(entity, self, this.enemy, SUB_UseTargets());
+               WITHSELF(this.enemy, SUB_UseTargets());
        }
 
        if (other.flags & FL_PROJECTILE)
@@ -282,23 +282,23 @@ void trigger_push_findtarget()
        vector org;
 
        // first calculate a typical start point for the jump
-       org = (self.absmin + self.absmax) * 0.5;
-       org_z = self.absmax.z - STAT(PL_MIN, NULL).z;
+       org = (this.absmin + this.absmax) * 0.5;
+       org_z = this.absmax.z - STAT(PL_MIN, NULL).z;
 
-       if (self.target)
+       if (this.target)
        {
                float n = 0;
-               for(t = world; (t = find(t, targetname, self.target)); )
+               for(t = world; (t = find(t, targetname, this.target)); )
                {
                        ++n;
 #ifdef SVQC
                        entity e = spawn();
                        setorigin(e, org);
                        setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
-                       e.velocity = trigger_push_calculatevelocity(org, t, self.height);
+                       e.velocity = trigger_push_calculatevelocity(org, t, this.height);
                        tracetoss(e, e);
                        if(e.movetype == MOVETYPE_NONE)
-                               waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+                               waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
                        remove(e);
 #endif
                }
@@ -314,12 +314,12 @@ void trigger_push_findtarget()
                else if(n == 1)
                {
                        // exactly one dest - bots love that
-                       self.enemy = find(world, targetname, self.target);
+                       this.enemy = find(world, targetname, this.target);
                }
                else
                {
                        // have to use random selection every single time
-                       self.enemy = world;
+                       this.enemy = world;
                }
        }
 #ifdef SVQC
@@ -328,14 +328,14 @@ void trigger_push_findtarget()
                entity e = spawn();
                setorigin(e, org);
                setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
-               e.velocity = self.movedir;
+               e.velocity = this.movedir;
                tracetoss(e, e);
-               waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+               waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
                remove(e);
        }
 
        trigger_push_link();
-       defer(self, 0.1, trigger_push_updatelink);
+       defer(this, 0.1, trigger_push_updatelink);
 #endif
 }
 
@@ -344,25 +344,25 @@ float trigger_push_send(entity this, entity to, float sf)
 {
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
 
-       WriteByte(MSG_ENTITY, self.team);
-       WriteInt24_t(MSG_ENTITY, self.spawnflags);
-       WriteByte(MSG_ENTITY, self.active);
-       WriteCoord(MSG_ENTITY, self.height);
+       WriteByte(MSG_ENTITY, this.team);
+       WriteInt24_t(MSG_ENTITY, this.spawnflags);
+       WriteByte(MSG_ENTITY, this.active);
+       WriteCoord(MSG_ENTITY, this.height);
 
-       trigger_common_write(self, true);
+       trigger_common_write(this, true);
 
        return true;
 }
 
 void trigger_push_updatelink()
 {SELFPARAM();
-       self.SendFlags |= 1;
+       this.SendFlags |= 1;
 }
 
 void trigger_push_link()
 {
     SELFPARAM();
-       trigger_link(self, trigger_push_send);
+       trigger_link(this, trigger_push_send);
 }
 
 /*
@@ -379,25 +379,25 @@ void trigger_push_link()
  */
 spawnfunc(trigger_push)
 {
-       SetMovedir(self);
+       SetMovedir(this);
 
-       trigger_init(self);
+       trigger_init(this);
 
-       self.active = ACTIVE_ACTIVE;
-       self.use = trigger_push_use;
-       self.touch = trigger_push_touch;
+       this.active = ACTIVE_ACTIVE;
+       this.use = trigger_push_use;
+       this.touch = trigger_push_touch;
 
        // normal push setup
-       if (!self.speed)
-               self.speed = 1000;
-       self.movedir = self.movedir * self.speed * 10;
+       if (!this.speed)
+               this.speed = 1000;
+       this.movedir = this.movedir * this.speed * 10;
 
-       if (!self.noise)
-               self.noise = "misc/jumppad.wav";
-       precache_sound (self.noise);
+       if (!this.noise)
+               this.noise = "misc/jumppad.wav";
+       precache_sound (this.noise);
 
        // this must be called to spawn the teleport waypoints for bots
-       InitializeEntity(self, trigger_push_findtarget, INITPRIO_FINDTARGET);
+       InitializeEntity(this, trigger_push_findtarget, INITPRIO_FINDTARGET);
 }
 
 
@@ -405,15 +405,15 @@ bool target_push_send(entity this, entity to, float sf)
 {
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH);
 
-       WriteByte(MSG_ENTITY, self.cnt);
-       WriteString(MSG_ENTITY, self.targetname);
-       WriteCoord(MSG_ENTITY, self.origin_x);
-       WriteCoord(MSG_ENTITY, self.origin_y);
-       WriteCoord(MSG_ENTITY, self.origin_z);
+       WriteByte(MSG_ENTITY, this.cnt);
+       WriteString(MSG_ENTITY, this.targetname);
+       WriteCoord(MSG_ENTITY, this.origin_x);
+       WriteCoord(MSG_ENTITY, this.origin_y);
+       WriteCoord(MSG_ENTITY, this.origin_z);
 
-       WriteAngle(MSG_ENTITY, self.angles_x);
-       WriteAngle(MSG_ENTITY, self.angles_y);
-       WriteAngle(MSG_ENTITY, self.angles_z);
+       WriteAngle(MSG_ENTITY, this.angles_x);
+       WriteAngle(MSG_ENTITY, this.angles_y);
+       WriteAngle(MSG_ENTITY, this.angles_z);
 
        return true;
 }
@@ -442,21 +442,21 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew)
 {
        make_pure(this);
 
-       self.classname = "jumppad";
-       int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
-       self.spawnflags = ReadInt24_t();
-       self.active = ReadByte();
-       self.height = ReadCoord();
+       this.classname = "jumppad";
+       int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
+       this.spawnflags = ReadInt24_t();
+       this.active = ReadByte();
+       this.height = ReadCoord();
 
        trigger_common_read(true);
 
-       self.entremove = trigger_remove_generic;
-       self.solid = SOLID_TRIGGER;
-       //self.draw = trigger_draw_generic;
-       self.move_touch = trigger_push_touch;
-       self.drawmask = MASK_NORMAL;
-       self.move_time = time;
-       defer(self, 0.25, trigger_push_findtarget);
+       this.entremove = trigger_remove_generic;
+       this.solid = SOLID_TRIGGER;
+       //this.draw = trigger_draw_generic;
+       this.move_touch = trigger_push_touch;
+       this.drawmask = MASK_NORMAL;
+       this.move_time = time;
+       defer(this, 0.25, trigger_push_findtarget);
 
        return true;
 }
@@ -474,22 +474,22 @@ void target_push_remove(entity this)
 
 NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
 {
-       self.classname = "push_target";
-       self.cnt = ReadByte();
-       self.targetname = strzone(ReadString());
-       self.origin_x = ReadCoord();
-       self.origin_y = ReadCoord();
-       self.origin_z = ReadCoord();
+       this.classname = "push_target";
+       this.cnt = ReadByte();
+       this.targetname = strzone(ReadString());
+       this.origin_x = ReadCoord();
+       this.origin_y = ReadCoord();
+       this.origin_z = ReadCoord();
 
-       self.angles_x = ReadAngle();
-       self.angles_y = ReadAngle();
-       self.angles_z = ReadAngle();
+       this.angles_x = ReadAngle();
+       this.angles_y = ReadAngle();
+       this.angles_z = ReadAngle();
 
        return = true;
 
-       setorigin(self, self.origin);
+       setorigin(this, this.origin);
 
-       self.drawmask = MASK_NORMAL;
-       self.entremove = target_push_remove;
+       this.drawmask = MASK_NORMAL;
+       this.entremove = target_push_remove;
 }
 #endif
index b9d3aeb96e9081a7eab274bfb5cc535896c55088..3f0a4b27fef60d5058fba15f2298da394ae14950 100644 (file)
@@ -111,7 +111,7 @@ void multi_eventdamage(entity this, entity inflictor, entity attacker, float dam
        {
                this.enemy = attacker;
                this.goalentity = inflictor;
-               WITH(entity, self, this, multi_trigger());
+               WITHSELF(this, multi_trigger());
        }
 }
 
index 9be241e7f49e2c0b56b8ca50740334abb24b5ed2..f94cd00ad9680e5b61b203c2c2b4e9eeaa10c3eb 100644 (file)
@@ -10,8 +10,8 @@
 
 void secrets_setstatus()
 {SELFPARAM();
-       self.stat_secrets_total = secrets_total;
-       self.stat_secrets_found = secrets_found;
+       this.stat_secrets_total = secrets_total;
+       this.stat_secrets_found = secrets_found;
 }
 
 /**
index be8040079b91f36670492816498228debff65bfa..92ae805b5259641dd9e8cb3bd174b5df9b642a3e 100644 (file)
@@ -54,7 +54,7 @@ void Teleport_Touch ()
        SUB_UseTargets();
        if (!self.target) self.target = s;
 
-       WITH(entity, self, e, SUB_UseTargets());
+       WITHSELF(e, SUB_UseTargets());
 #endif
 }
 
index 29cb70a7dcc935990309119f1acf2e403806ff18..1ca03fd4fefc819113b7b6aaae62ba1c9009d8aa 100644 (file)
@@ -4,9 +4,9 @@ void() SUB_UseTargets;
 
 void DelayThink()
 {SELFPARAM();
-       activator = self.enemy;
+       activator = this.enemy;
        SUB_UseTargets ();
-       remove(self);
+       remove(this);
 }
 
 void FixSize(entity e)
@@ -25,7 +25,7 @@ void FixSize(entity e)
 void trigger_init(entity this)
 {
        string m = this.model;
-       WITH(entity, self, this, WarpZoneLib_ExactTrigger_Init());
+       WITHSELF(this, WarpZoneLib_ExactTrigger_Init());
        if(m != "")
        {
                precache_model(m);
@@ -96,51 +96,51 @@ void trigger_common_write(entity this, bool withtarget)
 void trigger_common_read(bool withtarget)
 {SELFPARAM();
        int f = ReadByte();
-       self.warpzone_isboxy = (f & 1);
+       this.warpzone_isboxy = (f & 1);
 
        if(withtarget)
        {
-               if(self.target) { strunzone(self.target); }
-               self.target = strzone(ReadString());
-               if(self.target2) { strunzone(self.target2); }
-               self.target2 = strzone(ReadString());
-               if(self.target3) { strunzone(self.target3); }
-               self.target3 = strzone(ReadString());
-               if(self.target4) { strunzone(self.target4); }
-               self.target4 = strzone(ReadString());
-               if(self.targetname) { strunzone(self.targetname); }
-               self.targetname = strzone(ReadString());
-               if(self.killtarget) { strunzone(self.killtarget); }
-               self.killtarget = strzone(ReadString());
+               if(this.target) { strunzone(this.target); }
+               this.target = strzone(ReadString());
+               if(this.target2) { strunzone(this.target2); }
+               this.target2 = strzone(ReadString());
+               if(this.target3) { strunzone(this.target3); }
+               this.target3 = strzone(ReadString());
+               if(this.target4) { strunzone(this.target4); }
+               this.target4 = strzone(ReadString());
+               if(this.targetname) { strunzone(this.targetname); }
+               this.targetname = strzone(ReadString());
+               if(this.killtarget) { strunzone(this.killtarget); }
+               this.killtarget = strzone(ReadString());
        }
 
        if(f & 4)
        {
-               self.origin_x = ReadCoord();
-               self.origin_y = ReadCoord();
-               self.origin_z = ReadCoord();
+               this.origin_x = ReadCoord();
+               this.origin_y = ReadCoord();
+               this.origin_z = ReadCoord();
        }
        else
-               self.origin = '0 0 0';
-       setorigin(self, self.origin);
-
-       self.modelindex = ReadShort();
-       self.mins_x = ReadCoord();
-       self.mins_y = ReadCoord();
-       self.mins_z = ReadCoord();
-       self.maxs_x = ReadCoord();
-       self.maxs_y = ReadCoord();
-       self.maxs_z = ReadCoord();
-       self.scale = ReadByte() / 16;
-       setsize(self, self.mins, self.maxs);
-
-       self.movedir_x = ReadCoord();
-       self.movedir_y = ReadCoord();
-       self.movedir_z = ReadCoord();
-
-       self.angles_x = ReadCoord();
-       self.angles_y = ReadCoord();
-       self.angles_z = ReadCoord();
+               this.origin = '0 0 0';
+       setorigin(this, this.origin);
+
+       this.modelindex = ReadShort();
+       this.mins_x = ReadCoord();
+       this.mins_y = ReadCoord();
+       this.mins_z = ReadCoord();
+       this.maxs_x = ReadCoord();
+       this.maxs_y = ReadCoord();
+       this.maxs_z = ReadCoord();
+       this.scale = ReadByte() / 16;
+       setsize(this, this.mins, this.maxs);
+
+       this.movedir_x = ReadCoord();
+       this.movedir_y = ReadCoord();
+       this.movedir_z = ReadCoord();
+
+       this.angles_x = ReadCoord();
+       this.angles_y = ReadCoord();
+       this.angles_z = ReadCoord();
 }
 
 void trigger_remove_generic(entity this)
@@ -193,19 +193,19 @@ void SUB_UseTargets()
 //
 // check for a delay
 //
-       if (self.delay)
+       if (this.delay)
        {
        // create a temp object to fire at a later time
                t = new(DelayedUse);
-               t.nextthink = time + self.delay;
+               t.nextthink = time + this.delay;
                t.think = DelayThink;
                t.enemy = activator;
-               t.message = self.message;
-               t.killtarget = self.killtarget;
-               t.target = self.target;
-               t.target2 = self.target2;
-               t.target3 = self.target3;
-               t.target4 = self.target4;
+               t.message = this.message;
+               t.killtarget = this.killtarget;
+               t.target = this.target;
+               t.target2 = this.target2;
+               t.target3 = this.target3;
+               t.target4 = this.target4;
                return;
        }
 
@@ -214,19 +214,19 @@ void SUB_UseTargets()
 // print the message
 //
 #ifdef SVQC
-       if(self)
-       if(IS_PLAYER(activator) && self.message != "")
+       if(this)
+       if(IS_PLAYER(activator) && this.message != "")
        if(IS_REAL_CLIENT(activator))
        {
-               centerprint(activator, self.message);
-               if (self.noise == "")
+               centerprint(activator, this.message);
+               if (this.noise == "")
                        play2(activator, SND(TALK));
        }
 
 //
 // kill the killtagets
 //
-       s = self.killtarget;
+       s = this.killtarget;
        if (s != "")
        {
                for(t = world; (t = find(t, targetname, s)); )
@@ -257,7 +257,7 @@ void SUB_UseTargets()
                {
                        // Flag to set func_clientwall state
                        // 1 == deactivate, 2 == activate, 0 == do nothing
-                       float aw_flag = self.antiwall_flag;
+                       float aw_flag = this.antiwall_flag;
                        for(t = world; (t = find(t, targetname, s)); )
                        if(t.use)
                        {
@@ -308,7 +308,7 @@ void trigger_touch_generic(entity this, void() touchfunc)
                if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
                {
                        other = e;
-                       WITH(entity, self, this, touchfunc());
+                       WITHSELF(this, touchfunc());
                }
        }
 }
index 853c3cb924af5757b03357d608b0b801fad7f4ca..1502be25114f1ddfb5bf90192c796d9f37d2febb 100644 (file)
@@ -455,7 +455,7 @@ void turret_projectile_damage(entity this, entity inflictor, entity attacker, fl
        this.health     -= damage;
        //this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
 }
 
 entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
index 118e1a4acdf98b026970b200c167153c9b9a9cb1..491b5bbd920065c21d02b2fa61c8b0a27a5be559 100644 (file)
@@ -109,7 +109,7 @@ void walker_rocket_damage(entity this, entity inflictor, entity attacker, float
     this.velocity = this.velocity + vforce;
 
     if (this.health <= 0)
-        WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
+        WITHSELF(this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
 }
 
 #define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
index 0748941eafa823b2582d9f9fc86e0ddc7a02f9d3..f99d7622f5a500dae872c2f8ef283bc3f45c002d 100644 (file)
@@ -706,9 +706,9 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
        {
                if(this.owner)
                        if(this.vehicle_flags & VHF_DEATHEJECT)
-                               WITH(entity, self, this, vehicles_exit(VHEF_EJECT));
+                               WITHSELF(this, vehicles_exit(VHEF_EJECT));
                        else
-                               WITH(entity, self, this, vehicles_exit(VHEF_RELEASE));
+                               WITHSELF(this, vehicles_exit(VHEF_RELEASE));
 
 
                antilag_clear(this, this);
@@ -1164,9 +1164,6 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
        if(!info.vehicleid)
                return false;
 
-       if(!this.tur_head)
-               info.vr_precache(info);
-
        if(this.targetname && this.targetname != "")
        {
                this.vehicle_controller = find(world, target, this.targetname);
index 5bf03fdbe8e8219378fad6546f8d63fbb6f2f4a6..9b9046aa4c668b126bb023f9ff157517f5b3d3c3 100644 (file)
@@ -115,7 +115,7 @@ STATIC_INIT_LATE(W_PROP_reloader)
 {
     SELFPARAM();
     entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
-    WITH(entity, self, e, (e.think = W_PROP_think)());
+    WITHSELF(e, (e.think = W_PROP_think)());
 }
 #endif
 
index d30afff01dc6eeb92223cb7ad979ce3637a0577a..3c23e33e779ffb64c059d6742210d6965514d91b 100644 (file)
@@ -251,7 +251,7 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
 }
 
 void W_Arc_Bolt_Touch()
@@ -687,7 +687,7 @@ void W_Arc_Beam(float burst)
        beam.beam_bursting = burst;
        Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
-       WITH(entity, self, beam, beam.think());
+       WITHSELF(beam, beam.think());
 }
 
 void Arc_Smoke()
index 23c4da6c468bcf92297daaebe1e6c45053b6e588..f9f3008ff834c80ab1cdec6758d5e1f93178c395 100644 (file)
@@ -146,7 +146,7 @@ void W_Blaster_Attack(
 
        if (time >= missile.nextthink)
        {
-               WITH(entity, self, missile, missile.think());
+               WITHSELF(missile, missile.think());
        }
 }
 
index e8697afd1e96fdb47041bcc9b50d7c7869d94314..2d930ad7212a8b83920e659e8b6992b0e81ef7c2 100644 (file)
@@ -344,7 +344,7 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
 }
 
 void W_Devastator_Attack(Weapon thiswep)
index 4dc3bf86753d95cf1478269677eb14acdad44c08..a6db7c9b71ce578845d5058793ed29a1444a340b 100644 (file)
@@ -179,7 +179,7 @@ void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float dam
        if(this.health <= 0)
        {
                this.cnt = 1;
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
        }
 }
 
index 2d5085fb115c82df9083585c3fefd6a4372bf0e1..b764a9e66f679984fd056c539c698cd0bd7feb5e 100644 (file)
@@ -100,7 +100,7 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
 }
 
 void W_Hagar_Touch()
index 13e8ac1129d80feeffec61d507bf799d495475bd..91c2840e6d35e47fefeb0dc3a1a12905949f3c7c 100644 (file)
@@ -129,7 +129,7 @@ void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage,
        this.health = this.health - damage;
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
+               WITHSELF(this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
 }
 
 void W_Hook_Touch2()
@@ -262,7 +262,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
     {
         if (actor.hook)
             RemoveGrapplingHook(actor);
-        WITH(entity, self, actor, FireGrapplingHook());
+        WITHSELF(actor, FireGrapplingHook());
         actor.hook_state &= ~HOOK_FIRING;
         actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
     }
index a40afe5a96d9aec1e83bf331411a1d64719f6f5f..c6e0fb86bce692d211e72ec39a24f89f29886060 100644 (file)
@@ -308,7 +308,7 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
 }
 
 void W_MineLayer_Attack(Weapon thiswep)
index 61ca5132625bbd3f6685f413a7e1d3ed39f4e3fc..7c9b908947e31fd78e40e0613d7aa38147a68906 100644 (file)
@@ -116,7 +116,7 @@ void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, flo
        this.health = this.health - damage;
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
 }
 
 void W_Mortar_Grenade_Think1()
index 1ff725d1f44034859ee417ff819e6600e9b84052..b9488889ddf69c81d639e522905c6906d8685c3f 100644 (file)
@@ -105,7 +105,7 @@ void W_Porto_Remove(entity p)
 {SELFPARAM();
        if(p.porto_current.realowner == p && p.porto_current.classname == "porto")
        {
-               WITH(entity, self, p.porto_current, W_Porto_Fail(1));
+               WITHSELF(p.porto_current, W_Porto_Fail(1));
        }
 }
 
index e151756720f11d444120827dbc86f633f625a58d..34b6e895f3af59977f130f90b9cd8ec3f83fcc90 100644 (file)
@@ -220,7 +220,7 @@ void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, flo
                this.health = this.health - damage;
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
 }
 
 /*
index 0faccbbb73eec00d61f717dd45cb5da2b56851ea..c0c434561736764acd3231140665e0152774b647 100644 (file)
@@ -144,14 +144,14 @@ REGISTER_MUTATOR(vortex_charge, true);
 MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys)
 {SELFPARAM();
        // WEAPONTODO
-       float xyspeed = vlen(vec2(self.velocity));
-       if (PS(self).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
+       float xyspeed = vlen(vec2(this.velocity));
+       if (PS(this).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
        {
                // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed
                xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed));
                float f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed));
                // add the extra charge
-               self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
+               this.vortex_charge = min(1, this.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
        }
 }
 
@@ -382,7 +382,7 @@ METHOD(Vortex, wr_impacteffect, void(entity thiswep))
     vector org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
     if(!w_issilent)
-        sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
+        sound(this, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
 }
 METHOD(Vortex, wr_init, void(entity thiswep))
 {
index b923062bc9a9a35115ea48cbec1aef192d27ccff..56014121f8936bf128492fcb0a4ac5e35c0754eb 100644 (file)
@@ -28,7 +28,7 @@
                SELFPARAM();
                this.think     = SUB_Remove_self;
                this.nextthink = time;
-               WITH(entity, self, this.owner, this.use());
+               WITHSELF(this.owner, this.use());
        }
 
 /*
index 68c974dc31adc66faf5728c455fbaed42f8f1d1b..02a25cdad0d0679d577c00191a9835e4750f5084 100644 (file)
@@ -38,9 +38,11 @@ string(string...) strcat0n = #53;
 string(string...) strcat0n = #115;
 #endif
 
+#define __SOURCELOC__ (sprintf("^9"__FILE__"^7"  ":"  "^9%s^7"  ":"  "^9"STR(__LINE__)"^7", __FUNC__))
+
 #define _LOG(f, level, s) \
        MACRO_BEGIN { \
-               f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [" __FILE__ "^7:^9%s^7:^9" STR(__LINE__) "] \n^7%s\n", __FUNC__, s)); \
+               f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [%s^9]\n^7%s\n", __SOURCELOC__, s)); \
        } MACRO_END
 
 #define  LOG_FATAL(...) _LOG_FATAL(strcat0n(__VA_ARGS__))
index 950000f04756ac028e77b1b2859c0fa63dcad215..dfabebeeb549923efa956428313c9dd898c65abd 100644 (file)
@@ -45,3 +45,5 @@
                LAMBDA(block) \
                name = __with_save; \
        } MACRO_END
+
+#define WITHSELF(value, block) WITH(entity, __self, value, block)
index 47d6af7186144f1dfc41a157ffa7867c3358096a..03e5c9dd8941d6a1143effdf28ce3290638f9333 100644 (file)
@@ -41,7 +41,7 @@ STATIC_INIT(RegisterTempEntities_renumber) { FOREACH(TempEntities, true, it.m_id
        #define REGISTER_NET_LINKED(id) \
                [[accumulate]] NET_HANDLE(id, bool isnew) \
                { \
-                       this = self; \
+                       this = __self; \
                        this.sourceLoc = __FILE__ ":" STR(__LINE__); \
                        if (!this) isnew = true; \
                } \
@@ -145,8 +145,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
 
        void UncustomizeEntitiesRun()
        {
-           SELFPARAM();
-               FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITH(entity, self, it, it.uncustomizeentityforclient()));
+               FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITHSELF(it, it.uncustomizeentityforclient()));
        }
 
        STRING_ITERATOR(g_buf, string_null, 0);
index 99bea5be7cd7ca5b0b8bc02963e4398d9ca0755c..01dd638c8115a067afac8debceb9aecb51daa033 100644 (file)
@@ -6,9 +6,16 @@
 
 // Step 1: auto oldself
 #if 1
+#if NDEBUG
        #define SELFPARAM() noref entity this = __self
        #define setself(s) (__self = s)
        #define self __self
+#else
+    noref string self_str;
+       #define SELFPARAM() self_str = "self"; noref entity this = __self
+       #define setself(s) (self_str = #s, __self = s)
+       #define self (print(__SOURCELOC__, ": ", self_str, "\n"), __self)
+#endif
 #endif
 
 // Step 2: check SELFPARAM() is present for functions that use self
index 9d1090bac1dbe40711a6ed10139894a5fca96ba4..22047bbc9daac0d285478015cbecbcf14ceb6303 100644 (file)
@@ -35,11 +35,11 @@ noref bool require_spawnfunc_prefix;
                void __spawnfunc_##id(entity this); \
                [[accumulate]] void spawnfunc_##id(entity this) \
                { \
-                       if (self == __spawnfunc_expect) \
+                       if (__self == __spawnfunc_expect) \
                        { \
                                /* engine call */ \
                                __spawnfunc_expect = NULL; \
-                               this = self; \
+                               this = __self; \
                        } \
                        else \
                        { \
index 1b69658245781cc202cf826382145e21b6945f13..ef08e308c0223767729e93005e2df70b36d83a55 100644 (file)
@@ -43,8 +43,8 @@ entity bot_spawn()
        {
                currentbots = currentbots + 1;
                bot_setnameandstuff(bot);
-               WITH(entity, self, bot, ClientConnect());
-               WITH(entity, self, bot, PutClientInServer());
+               WITHSELF(bot, ClientConnect());
+               WITHSELF(bot, PutClientInServer());
        }
        return bot;
 }
index bdf57569d5a606f8912901a9160d28f70985147f..77d410653afb6146aee016bd815e79a635cea4bb 100644 (file)
@@ -479,7 +479,7 @@ void bot_list_commands()
 void SV_ParseClientCommand(string s);
 float bot_cmd_cc(entity this)
 {
-       WITH(entity, self, this, SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string));
+       WITHSELF(this, SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string));
        return CMD_STATUS_FINISHED;
 }
 
index 7dab5ade00d9ade8b4fc8cd717fca0a531c85c47..933f4ac63c6cf2cb4452827b33aae1c185ec3f37 100644 (file)
@@ -97,7 +97,7 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
        cheatcount_total += n; \
        e.cheatcount += n
 #define END_CHEAT_FUNCTION() \
-       ADD_CHEATS(self,cheating); \
+       ADD_CHEATS(this, cheating); \
        return attempting
 #define IS_CHEAT(i,argc,fr) \
        if((++attempting, !CheatsAllowed(i,argc,fr))) \
@@ -358,7 +358,7 @@ float CheatCommand(float argc)
                                                e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
                                                e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
                                        }
-                                       WITH(entity, self, e, spawnfunc_func_breakable(e));
+                                       WITHSELF(e, spawnfunc_func_breakable(e));
                                        // now, is it valid?
                                        if(f == 0)
                                        {
@@ -736,10 +736,10 @@ float CheatFrame()
        switch(0)
        {
                default:
-                       if(self.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
+                       if(this.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
                        {
                                // use cheat dragging if cheats are enabled
-                               crosshair_trace_plusvisibletriggers(self);
+                               crosshair_trace_plusvisibletriggers(this);
                                Drag(true, true);
                        }
                        else
@@ -779,43 +779,43 @@ float Drag(float force_allow_pick, float ischeat)
        switch(0)
        {
                default:
-                       if(Drag_IsDragging(self))
+                       if(Drag_IsDragging(this))
                        {
-                               if(PHYS_INPUT_BUTTON_DRAG(self))
+                               if(PHYS_INPUT_BUTTON_DRAG(this))
                                {
-                                       if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18)
+                                       if(this.impulse == 10 || this.impulse == 15 || this.impulse == 18)
                                        {
-                                               Drag_MoveForward(self);
-                                               self.impulse = 0;
+                                               Drag_MoveForward(this);
+                                               this.impulse = 0;
                                        }
-                                       else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19)
+                                       else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19)
                                        {
-                                               Drag_MoveBackward(self);
-                                               self.impulse = 0;
+                                               Drag_MoveBackward(this);
+                                               this.impulse = 0;
                                        }
-                                       else if(self.impulse >= 1 && self.impulse <= 9)
+                                       else if(this.impulse >= 1 && this.impulse <= 9)
                                        {
-                                               Drag_SetSpeed(self, self.impulse - 1);
+                                               Drag_SetSpeed(this, this.impulse - 1);
                                        }
-                                       else if(self.impulse == 14)
+                                       else if(this.impulse == 14)
                                        {
-                                               Drag_SetSpeed(self, 9);
+                                               Drag_SetSpeed(this, 9);
                                        }
 
                                        if(frametime)
-                                               Drag_Update(self);
+                                               Drag_Update(this);
                                }
                                else
                                {
-                                       Drag_Finish(self);
+                                       Drag_Finish(this);
                                }
                        }
                        else
                        {
-                               if(Drag_CanDrag(self))
-                                       if(PHYS_INPUT_BUTTON_DRAG(self))
+                               if(Drag_CanDrag(this))
+                                       if(PHYS_INPUT_BUTTON_DRAG(this))
                                        {
-                                               crosshair_trace_plusvisibletriggers(self);
+                                               crosshair_trace_plusvisibletriggers(this);
                                                entity e = trace_ent;
                                                float pick = force_allow_pick;
                                                if (e && !pick)
@@ -825,18 +825,18 @@ float Drag(float force_allow_pick, float ischeat)
                                                        // This also makes sure that an object can only pe picked up if in range, but does not get dropped if
                                                        // it goes out of range while slinging it around.
 
-                                                       if(vlen(self.origin - e.origin) <= autocvar_g_grab_range)
+                                                       if(vlen(this.origin - e.origin) <= autocvar_g_grab_range)
                                                        {
                                                                switch(e.grab)
                                                                {
                                                                        case 0: // can't grab
                                                                                break;
                                                                        case 1: // owner can grab
-                                                                               if(e.owner == self || e.realowner == self)
+                                                                               if(e.owner == this || e.realowner == this)
                                                                                        pick = true;
                                                                                break;
                                                                        case 2: // owner and team mates can grab
-                                                                               if(SAME_TEAM(e.owner, self) || SAME_TEAM(e.realowner, self) || e.team == self.team)
+                                                                               if(SAME_TEAM(e.owner, this) || SAME_TEAM(e.realowner, this) || e.team == this.team)
                                                                                        pick = true;
                                                                                break;
                                                                        case 3: // anyone can grab
@@ -857,7 +857,7 @@ float Drag(float force_allow_pick, float ischeat)
                                                                        Drag_Finish(e.draggedby);
                                                                if(e.tag_entity)
                                                                        detach_sameorigin(e);
-                                                               Drag_Begin(self, e, trace_endpos);
+                                                               Drag_Begin(this, e, trace_endpos);
                                                                if(ischeat)
                                                                        DID_CHEAT();
                                                                return true;
@@ -1047,38 +1047,38 @@ void Drag_MoveDrag(entity from, entity to)
 
 void DragBox_Think()
 {SELFPARAM();
-       if(self.aiment && self.enemy)
+       if(this.aiment && this.enemy)
        {
-               self.origin_x = (self.aiment.origin.x + self.enemy.origin.x) * 0.5;
-               self.origin_y = (self.aiment.origin.y + self.enemy.origin.y) * 0.5;
-               self.origin_z = (self.aiment.origin.z + self.enemy.origin.z) * 0.5;
-               self.maxs_x = fabs(self.aiment.origin.x - self.enemy.origin.x) * 0.5;
-               self.maxs_y = fabs(self.aiment.origin.y - self.enemy.origin.y) * 0.5;
-               self.maxs_z = fabs(self.aiment.origin.z - self.enemy.origin.z) * 0.5;
-               self.mins = -1 * self.maxs;
-               setorigin(self, self.origin);
-               setsize(self, self.mins, self.maxs); // link edict
+               this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
+               this.origin_y = (this.aiment.origin.y + this.enemy.origin.y) * 0.5;
+               this.origin_z = (this.aiment.origin.z + this.enemy.origin.z) * 0.5;
+               this.maxs_x = fabs(this.aiment.origin.x - this.enemy.origin.x) * 0.5;
+               this.maxs_y = fabs(this.aiment.origin.y - this.enemy.origin.y) * 0.5;
+               this.maxs_z = fabs(this.aiment.origin.z - this.enemy.origin.z) * 0.5;
+               this.mins = -1 * this.maxs;
+               setorigin(this, this.origin);
+               setsize(this, this.mins, this.maxs); // link edict
        }
 
-       if(self.cnt == -1) // actually race_place -1
+       if(this.cnt == -1) // actually race_place -1
        {
                // show "10 10" for qualifying spawns
-               setmodel(self.killindicator, MDL_NUM(10));
-               setmodel(self.killindicator.killindicator, MDL_NUM(10));
+               setmodel(this.killindicator, MDL_NUM(10));
+               setmodel(this.killindicator.killindicator, MDL_NUM(10));
        }
-       else if(self.cnt == -2) // actually race_place 0
+       else if(this.cnt == -2) // actually race_place 0
        {
                // show "10 0" for loser spawns
-               setmodel(self.killindicator, MDL_NUM(10));
-               setmodel(self.killindicator.killindicator, MDL_NUM(0));
+               setmodel(this.killindicator, MDL_NUM(10));
+               setmodel(this.killindicator.killindicator, MDL_NUM(0));
        }
        else
        {
-               setmodel(self.killindicator, MDL_NUM(self.cnt % 10));
-               setmodel(self.killindicator.killindicator, MDL_NUM(floor(self.cnt / 10)));
+               setmodel(this.killindicator, MDL_NUM(this.cnt % 10));
+               setmodel(this.killindicator.killindicator, MDL_NUM(floor(this.cnt / 10)));
        }
 
-       self.nextthink = time;
+       this.nextthink = time;
 }
 
 #endif
index 5d739ac7b99835c2608e32eeeb31667df1f4faff..6b99bc4a5cdb74647bc4104c3e07a57e1e5dbccc 100644 (file)
 
 STATIC_METHOD(Client, Add, void(Client this, int _team))
 {
-    WITH(entity, self, this, ClientConnect());
+    WITHSELF(this, ClientConnect());
     TRANSMUTE(Player, this);
     this.frame = 12; // 7
     this.team = _team;
-    WITH(entity, self, this, PutClientInServer());
+    WITHSELF(this, PutClientInServer());
 }
 
 void PutObserverInServer();
@@ -68,7 +68,7 @@ void ClientDisconnect();
 STATIC_METHOD(Client, Remove, void(Client this))
 {
     TRANSMUTE(Observer, this);
-    WITH(entity, self, this, PutClientInServer(); ClientDisconnect());
+    WITHSELF(this, PutClientInServer(); ClientDisconnect());
 }
 
 void send_CSQC_teamnagger() {
@@ -607,7 +607,7 @@ void PutClientInServer()
                        string s = spot.target;
                        spot.target = string_null;
                        WITH(entity, activator, this, LAMBDA(
-                               WITH(entity, self, spot, SUB_UseTargets())
+                               WITHSELF(spot, SUB_UseTargets())
                        ));
                        spot.target = s;
                }
@@ -671,18 +671,18 @@ void ClientInit_misc()
                WriteString(channel, world.fog);
        else
                WriteString(channel, "");
-       WriteByte(channel, self.count * 255.0); // g_balance_armor_blockpercent
+       WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent
        WriteByte(channel, serverflags); // client has to know if it should zoom or not
        WriteCoord(channel, autocvar_g_trueaim_minrange);
 }
 
 void ClientInit_CheckUpdate()
 {SELFPARAM();
-       self.nextthink = time;
-       if(self.count != autocvar_g_balance_armor_blockpercent)
+       this.nextthink = time;
+       if(this.count != autocvar_g_balance_armor_blockpercent)
        {
-               self.count = autocvar_g_balance_armor_blockpercent;
-               self.SendFlags |= 1;
+               this.count = autocvar_g_balance_armor_blockpercent;
+               this.SendFlags |= 1;
        }
 }
 
@@ -693,7 +693,7 @@ void ClientInit_Spawn()
        e.think = ClientInit_CheckUpdate;
        Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
 
-       WITH(entity, self, e, ClientInit_CheckUpdate());
+       WITHSELF(e, ClientInit_CheckUpdate());
 }
 
 /*
@@ -717,7 +717,7 @@ SetChangeParms
 void SetChangeParms ()
 {SELFPARAM();
        // save parms for level change
-       parm1 = self.parm_idlesince - time;
+       parm1 = this.parm_idlesince - time;
 
        MUTATOR_CALLHOOK(SetChangeParms);
 }
@@ -759,35 +759,35 @@ void ClientKill_Now_TeamChange(entity this)
        {
                if(blockSpectators)
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
-               WITH(entity, self, this, PutObserverInServer());
+               WITHSELF(this, PutObserverInServer());
        }
        else
-               WITH(entity, self, this, SV_ChangeTeam(this.killindicator_teamchange - 1));
+               WITHSELF(this, SV_ChangeTeam(this.killindicator_teamchange - 1));
        this.killindicator_teamchange = 0;
 }
 
 void ClientKill_Now()
 {SELFPARAM();
-       if(self.vehicle)
+       if(this.vehicle)
        {
            vehicles_exit(VHEF_RELEASE);
-           if(!self.killindicator_teamchange)
+           if(!this.killindicator_teamchange)
            {
-            self.vehicle_health = -1;
-            Damage(self, self, self, 1 , DEATH_KILL.m_id, self.origin, '0 0 0');
+            this.vehicle_health = -1;
+            Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0');
            }
        }
 
-       if(self.killindicator && !wasfreed(self.killindicator))
-               remove(self.killindicator);
+       if(this.killindicator && !wasfreed(this.killindicator))
+               remove(this.killindicator);
 
-       self.killindicator = world;
+       this.killindicator = world;
 
-       if(self.killindicator_teamchange)
-               ClientKill_Now_TeamChange(self);
+       if(this.killindicator_teamchange)
+               ClientKill_Now_TeamChange(this);
 
-       if(IS_PLAYER(self))
-               Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
+       if(IS_PLAYER(this))
+               Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0');
 
        // now I am sure the player IS dead
 }
@@ -795,39 +795,39 @@ void KillIndicator_Think()
 {SELFPARAM();
        if (gameover)
        {
-               self.owner.killindicator = world;
-               remove(self);
+               this.owner.killindicator = world;
+               remove(this);
                return;
        }
 
-       if (self.owner.alpha < 0 && !self.owner.vehicle)
+       if (this.owner.alpha < 0 && !this.owner.vehicle)
        {
-               self.owner.killindicator = world;
-               remove(self);
+               this.owner.killindicator = world;
+               remove(this);
                return;
        }
 
-       if(self.cnt <= 0)
+       if(this.cnt <= 0)
        {
-               WITH(entity, self, self.owner, ClientKill_Now());
+               WITHSELF(this.owner, ClientKill_Now());
                return;
        }
-    else if(g_cts && self.health == 1) // health == 1 means that it's silent
+    else if(g_cts && this.health == 1) // health == 1 means that it's silent
     {
-        self.nextthink = time + 1;
-        self.cnt -= 1;
+        this.nextthink = time + 1;
+        this.cnt -= 1;
     }
        else
        {
-               if(self.cnt <= 10)
-                       setmodel(self, MDL_NUM(self.cnt));
-               if(IS_REAL_CLIENT(self.owner))
+               if(this.cnt <= 10)
+                       setmodel(this, MDL_NUM(this.cnt));
+               if(IS_REAL_CLIENT(this.owner))
                {
-                       if(self.cnt <= 10)
-                               { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, self.cnt)); }
+                       if(this.cnt <= 10)
+                               { Send_Notification(NOTIF_ONE, this.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, this.cnt)); }
                }
-               self.nextthink = time + 1;
-               self.cnt -= 1;
+               this.nextthink = time + 1;
+               this.cnt -= 1;
        }
 }
 
@@ -846,20 +846,20 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
        if(g_race_qualifying || g_cts)
                killtime = 0;
 
-    if(MUTATOR_CALLHOOK(ClientKill, self, killtime))
+    if(MUTATOR_CALLHOOK(ClientKill, this, killtime))
        return;
 
-       self.killindicator_teamchange = targetteam;
+       this.killindicator_teamchange = targetteam;
 
-    if(!self.killindicator)
+    if(!this.killindicator)
        {
-               if(!IS_DEAD(self))
+               if(!IS_DEAD(this))
                {
-                       killtime = max(killtime, self.clientkill_nexttime - time);
-                       self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
+                       killtime = max(killtime, this.clientkill_nexttime - time);
+                       this.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
                }
 
-               if(killtime <= 0 || !IS_PLAYER(self) || IS_DEAD(self))
+               if(killtime <= 0 || !IS_PLAYER(this) || IS_DEAD(this))
                {
                        ClientKill_Now();
                }
@@ -867,21 +867,21 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                {
                        starttime = max(time, clientkilltime);
 
-                       self.killindicator = spawn();
-                       self.killindicator.owner = self;
-                       self.killindicator.scale = 0.5;
-                       setattachment(self.killindicator, self, "");
-                       setorigin(self.killindicator, '0 0 52');
-                       self.killindicator.think = KillIndicator_Think;
-                       self.killindicator.nextthink = starttime + (self.lip) * 0.05;
-                       clientkilltime = max(clientkilltime, self.killindicator.nextthink + 0.05);
-                       self.killindicator.cnt = ceil(killtime);
-                       self.killindicator.count = bound(0, ceil(killtime), 10);
-                       //sprint(self, strcat("^1You'll be dead in ", ftos(self.killindicator.cnt), " seconds\n"));
+                       this.killindicator = spawn();
+                       this.killindicator.owner = this;
+                       this.killindicator.scale = 0.5;
+                       setattachment(this.killindicator, this, "");
+                       setorigin(this.killindicator, '0 0 52');
+                       this.killindicator.think = KillIndicator_Think;
+                       this.killindicator.nextthink = starttime + (this.lip) * 0.05;
+                       clientkilltime = max(clientkilltime, this.killindicator.nextthink + 0.05);
+                       this.killindicator.cnt = ceil(killtime);
+                       this.killindicator.count = bound(0, ceil(killtime), 10);
+                       //sprint(this, strcat("^1You'll be dead in ", ftos(this.killindicator.cnt), " seconds\n"));
 
                        for(e = world; (e = find(e, classname, "body")) != world; )
                        {
-                               if(e.enemy != self)
+                               if(e.enemy != this)
                                        continue;
                                e.killindicator = spawn();
                                e.killindicator.owner = e;
@@ -893,38 +893,38 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                                clientkilltime = max(clientkilltime, e.killindicator.nextthink + 0.05);
                                e.killindicator.cnt = ceil(killtime);
                        }
-                       self.lip = 0;
+                       this.lip = 0;
                }
        }
-       if(self.killindicator)
+       if(this.killindicator)
        {
                if(targetteam == 0) // just die
                {
-                       self.killindicator.colormod = '0 0 0';
-                       if(IS_REAL_CLIENT(self))
-                       if(self.killindicator.cnt > 0)
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, self.killindicator.cnt);
+                       this.killindicator.colormod = '0 0 0';
+                       if(IS_REAL_CLIENT(this))
+                       if(this.killindicator.cnt > 0)
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, this.killindicator.cnt);
                }
                else if(targetteam == -1) // auto
                {
-                       self.killindicator.colormod = '0 1 0';
-                       if(IS_REAL_CLIENT(self))
-                       if(self.killindicator.cnt > 0)
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, self.killindicator.cnt);
+                       this.killindicator.colormod = '0 1 0';
+                       if(IS_REAL_CLIENT(this))
+                       if(this.killindicator.cnt > 0)
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, this.killindicator.cnt);
                }
                else if(targetteam == -2) // spectate
                {
-                       self.killindicator.colormod = '0.5 0.5 0.5';
-                       if(IS_REAL_CLIENT(self))
-                       if(self.killindicator.cnt > 0)
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, self.killindicator.cnt);
+                       this.killindicator.colormod = '0.5 0.5 0.5';
+                       if(IS_REAL_CLIENT(this))
+                       if(this.killindicator.cnt > 0)
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, this.killindicator.cnt);
                }
                else
                {
-                       self.killindicator.colormod = Team_ColorRGB(targetteam);
-                       if(IS_REAL_CLIENT(self))
-                       if(self.killindicator.cnt > 0)
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), self.killindicator.cnt);
+                       this.killindicator.colormod = Team_ColorRGB(targetteam);
+                       if(IS_REAL_CLIENT(this))
+                       if(this.killindicator.cnt > 0)
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), this.killindicator.cnt);
                }
        }
 
@@ -933,8 +933,8 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
 void ClientKill ()
 {SELFPARAM();
        if(gameover) return;
-       if(self.player_blocked) return;
-       if(STAT(FROZEN, self)) return;
+       if(this.player_blocked) return;
+       if(STAT(FROZEN, this)) return;
 
        ClientKill_TeamChange(0);
 }
@@ -985,9 +985,9 @@ void ClientPreConnect ()
        if(autocvar_sv_eventlog)
        {
                GameLogEcho(sprintf(":connect:%d:%d:%s",
-                       self.playerid,
-                       etof(self),
-                       ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot")
+                       this.playerid,
+                       etof(this),
+                       ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot")
                ));
        }
 }
@@ -1143,7 +1143,7 @@ void ClientConnect()
                sv_notice_join(this);
 
        FOREACH_ENTITY_FLOAT(init_for_player_needed, true, {
-               WITH(entity, self, it, it.init_for_player(it));
+               WITHSELF(it, it.init_for_player(it));
        });
 
        MUTATOR_CALLHOOK(ClientConnect, this);
@@ -1176,15 +1176,15 @@ void ClientDisconnect()
 
        ClientState_detach(this);
 
-       Portal_ClearAll(self);
+       Portal_ClearAll(this);
 
-       Unfreeze(self);
+       Unfreeze(this);
 
-       RemoveGrapplingHook(self);
+       RemoveGrapplingHook(this);
 
        // Here, everything has been done that requires this player to be a client.
 
-       self.flags &= ~FL_CLIENT;
+       this.flags &= ~FL_CLIENT;
 
        if (this.chatbubbleentity) remove(this.chatbubbleentity);
        if (this.killindicator) remove(this.killindicator);
@@ -1193,10 +1193,10 @@ void ClientDisconnect()
 
        bot_relinkplayerlist();
 
-       if (self.netname_previous) strunzone(self.netname_previous);
-       if (self.clientstatus) strunzone(self.clientstatus);
-       if (self.weaponorder_byimpulse) strunzone(self.weaponorder_byimpulse);
-       if (self.personal) remove(self.personal);
+       if (this.netname_previous) strunzone(this.netname_previous);
+       if (this.clientstatus) strunzone(this.clientstatus);
+       if (this.weaponorder_byimpulse) strunzone(this.weaponorder_byimpulse);
+       if (this.personal) remove(this.personal);
 
        this.playerid = 0;
        ReadyCount();
@@ -1205,49 +1205,49 @@ void ClientDisconnect()
 
 void ChatBubbleThink()
 {SELFPARAM();
-       self.nextthink = time;
-       if ((self.owner.alpha < 0) || self.owner.chatbubbleentity != self)
+       this.nextthink = time;
+       if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this)
        {
-               if(self.owner) // but why can that ever be world?
-                       self.owner.chatbubbleentity = world;
-               remove(self);
+               if(this.owner) // but why can that ever be world?
+                       this.owner.chatbubbleentity = world;
+               remove(this);
                return;
        }
 
-       self.mdl = "";
+       this.mdl = "";
 
-       if ( !IS_DEAD(self.owner) && IS_PLAYER(self.owner) )
+       if ( !IS_DEAD(this.owner) && IS_PLAYER(this.owner) )
        {
-               if ( self.owner.active_minigame )
-                       self.mdl = "models/sprites/minigame_busy.iqm";
-               else if (PHYS_INPUT_BUTTON_CHAT(self.owner))
-                       self.mdl = "models/misc/chatbubble.spr";
+               if ( this.owner.active_minigame )
+                       this.mdl = "models/sprites/minigame_busy.iqm";
+               else if (PHYS_INPUT_BUTTON_CHAT(this.owner))
+                       this.mdl = "models/misc/chatbubble.spr";
        }
 
-       if ( self.model != self.mdl )
-               _setmodel(self, self.mdl);
+       if ( this.model != this.mdl )
+               _setmodel(this, this.mdl);
 
 }
 
 void UpdateChatBubble()
 {SELFPARAM();
-       if (self.alpha < 0)
+       if (this.alpha < 0)
                return;
        // spawn a chatbubble entity if needed
-       if (!self.chatbubbleentity)
-       {
-               self.chatbubbleentity = new(chatbubbleentity);
-               self.chatbubbleentity.owner = self;
-               self.chatbubbleentity.exteriormodeltoclient = self;
-               self.chatbubbleentity.think = ChatBubbleThink;
-               self.chatbubbleentity.nextthink = time;
-               setmodel(self.chatbubbleentity, MDL_CHAT); // precision set below
-               //setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
-               setorigin(self.chatbubbleentity, '0 0 15' + self.maxs_z * '0 0 1');
-               setattachment(self.chatbubbleentity, self, "");  // sticks to moving player better, also conserves bandwidth
-               self.chatbubbleentity.mdl = self.chatbubbleentity.model;
-               //self.chatbubbleentity.model = "";
-               self.chatbubbleentity.effects = EF_LOWPRECISION;
+       if (!this.chatbubbleentity)
+       {
+               this.chatbubbleentity = new(chatbubbleentity);
+               this.chatbubbleentity.owner = this;
+               this.chatbubbleentity.exteriormodeltoclient = this;
+               this.chatbubbleentity.think = ChatBubbleThink;
+               this.chatbubbleentity.nextthink = time;
+               setmodel(this.chatbubbleentity, MDL_CHAT); // precision set below
+               //setorigin(this.chatbubbleentity, this.origin + '0 0 15' + this.maxs_z * '0 0 1');
+               setorigin(this.chatbubbleentity, '0 0 15' + this.maxs_z * '0 0 1');
+               setattachment(this.chatbubbleentity, this, "");  // sticks to moving player better, also conserves bandwidth
+               this.chatbubbleentity.mdl = this.chatbubbleentity.model;
+               //this.chatbubbleentity.model = "";
+               this.chatbubbleentity.effects = EF_LOWPRECISION;
        }
 }
 
@@ -1257,163 +1257,163 @@ void UpdateChatBubble()
 /*void UpdateColorModHack()
 {
        float c;
-       c = self.clientcolors & 15;
+       c = this.clientcolors & 15;
        // LordHavoc: only bothering to support white, green, red, yellow, blue
-            if (!teamplay) self.colormod = '0 0 0';
-       else if (c ==  0) self.colormod = '1.00 1.00 1.00';
-       else if (c ==  3) self.colormod = '0.10 1.73 0.10';
-       else if (c ==  4) self.colormod = '1.73 0.10 0.10';
-       else if (c == 12) self.colormod = '1.22 1.22 0.10';
-       else if (c == 13) self.colormod = '0.10 0.10 1.73';
-       else self.colormod = '1 1 1';
+            if (!teamplay) this.colormod = '0 0 0';
+       else if (c ==  0) this.colormod = '1.00 1.00 1.00';
+       else if (c ==  3) this.colormod = '0.10 1.73 0.10';
+       else if (c ==  4) this.colormod = '1.73 0.10 0.10';
+       else if (c == 12) this.colormod = '1.22 1.22 0.10';
+       else if (c == 13) this.colormod = '0.10 0.10 1.73';
+       else this.colormod = '1 1 1';
 }*/
 
 void respawn()
 {SELFPARAM();
-       if(self.alpha >= 0 && autocvar_g_respawn_ghosts)
-       {
-               self.solid = SOLID_NOT;
-               self.takedamage = DAMAGE_NO;
-               self.movetype = MOVETYPE_FLY;
-               self.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
-               self.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
-               self.effects |= CSQCMODEL_EF_RESPAWNGHOST;
-               Send_Effect(EFFECT_RESPAWN_GHOST, self.origin, '0 0 0', 1);
+       if(this.alpha >= 0 && autocvar_g_respawn_ghosts)
+       {
+               this.solid = SOLID_NOT;
+               this.takedamage = DAMAGE_NO;
+               this.movetype = MOVETYPE_FLY;
+               this.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
+               this.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
+               this.effects |= CSQCMODEL_EF_RESPAWNGHOST;
+               Send_Effect(EFFECT_RESPAWN_GHOST, this.origin, '0 0 0', 1);
                if(autocvar_g_respawn_ghosts_maxtime)
-                       SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
+                       SUB_SetFade (this, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
        }
 
-       CopyBody(self, 1);
+       CopyBody(this, 1);
 
-       self.effects |= EF_NODRAW; // prevent another CopyBody
+       this.effects |= EF_NODRAW; // prevent another CopyBody
        PutClientInServer();
 }
 
 void play_countdown(float finished, Sound samp)
 {SELFPARAM();
     TC(Sound, samp);
-       if(IS_REAL_CLIENT(self))
+       if(IS_REAL_CLIENT(this))
                if(floor(finished - time - frametime) != floor(finished - time))
                        if(finished - time < 6)
-                               sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
+                               sound (this, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
 }
 
 void player_powerups ()
 {SELFPARAM();
        // add a way to see what the items were BEFORE all of these checks for the mutator hook
-       int items_prev = self.items;
+       int items_prev = this.items;
 
-       if((self.items & IT_USING_JETPACK) && !IS_DEAD(self) && !gameover)
-               self.modelflags |= MF_ROCKET;
+       if((this.items & IT_USING_JETPACK) && !IS_DEAD(this) && !gameover)
+               this.modelflags |= MF_ROCKET;
        else
-               self.modelflags &= ~MF_ROCKET;
+               this.modelflags &= ~MF_ROCKET;
 
-       self.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
+       this.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
 
-       if((self.alpha < 0 || IS_DEAD(self)) && !self.vehicle) // don't apply the flags if the player is gibbed
+       if((this.alpha < 0 || IS_DEAD(this)) && !this.vehicle) // don't apply the flags if the player is gibbed
                return;
 
-       Fire_ApplyDamage(self);
-       Fire_ApplyEffect(self);
+       Fire_ApplyDamage(this);
+       Fire_ApplyEffect(this);
 
        if (!g_instagib)
        {
-               if (self.items & ITEM_Strength.m_itemid)
+               if (this.items & ITEM_Strength.m_itemid)
                {
-                       play_countdown(self.strength_finished, SND_POWEROFF);
-                       self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
-                       if (time > self.strength_finished)
+                       play_countdown(this.strength_finished, SND_POWEROFF);
+                       this.effects = this.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
+                       if (time > this.strength_finished)
                        {
-                               self.items = self.items - (self.items & ITEM_Strength.m_itemid);
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
+                               this.items = this.items - (this.items & ITEM_Strength.m_itemid);
+                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
                        }
                }
                else
                {
-                       if (time < self.strength_finished)
+                       if (time < this.strength_finished)
                        {
-                               self.items = self.items | ITEM_Strength.m_itemid;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_STRENGTH);
+                               this.items = this.items | ITEM_Strength.m_itemid;
+                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_STRENGTH);
                        }
                }
-               if (self.items & ITEM_Shield.m_itemid)
+               if (this.items & ITEM_Shield.m_itemid)
                {
-                       play_countdown(self.invincible_finished, SND_POWEROFF);
-                       self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
-                       if (time > self.invincible_finished)
+                       play_countdown(this.invincible_finished, SND_POWEROFF);
+                       this.effects = this.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
+                       if (time > this.invincible_finished)
                        {
-                               self.items = self.items - (self.items & ITEM_Shield.m_itemid);
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
+                               this.items = this.items - (this.items & ITEM_Shield.m_itemid);
+                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
                        }
                }
                else
                {
-                       if (time < self.invincible_finished)
+                       if (time < this.invincible_finished)
                        {
-                               self.items = self.items | ITEM_Shield.m_itemid;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SHIELD);
+                               this.items = this.items | ITEM_Shield.m_itemid;
+                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_SHIELD);
                        }
                }
-               if (self.items & IT_SUPERWEAPON)
+               if (this.items & IT_SUPERWEAPON)
                {
-                       if (!(self.weapons & WEPSET_SUPERWEAPONS))
+                       if (!(this.weapons & WEPSET_SUPERWEAPONS))
                        {
-                               self.superweapons_finished = 0;
-                               self.items = self.items - (self.items & IT_SUPERWEAPON);
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
+                               this.superweapons_finished = 0;
+                               this.items = this.items - (this.items & IT_SUPERWEAPON);
+                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
                        }
-                       else if (self.items & IT_UNLIMITED_SUPERWEAPONS)
+                       else if (this.items & IT_UNLIMITED_SUPERWEAPONS)
                        {
                                // don't let them run out
                        }
                        else
                        {
-                               play_countdown(self.superweapons_finished, SND_POWEROFF);
-                               if (time > self.superweapons_finished)
+                               play_countdown(this.superweapons_finished, SND_POWEROFF);
+                               if (time > this.superweapons_finished)
                                {
-                                       self.items = self.items - (self.items & IT_SUPERWEAPON);
-                                       self.weapons &= ~WEPSET_SUPERWEAPONS;
-                                       //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, self.netname);
-                                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
+                                       this.items = this.items - (this.items & IT_SUPERWEAPON);
+                                       this.weapons &= ~WEPSET_SUPERWEAPONS;
+                                       //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, this.netname);
+                                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
                                }
                        }
                }
-               else if(self.weapons & WEPSET_SUPERWEAPONS)
+               else if(this.weapons & WEPSET_SUPERWEAPONS)
                {
-                       if (time < self.superweapons_finished || (self.items & IT_UNLIMITED_SUPERWEAPONS))
+                       if (time < this.superweapons_finished || (this.items & IT_UNLIMITED_SUPERWEAPONS))
                        {
-                               self.items = self.items | IT_SUPERWEAPON;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
+                               this.items = this.items | IT_SUPERWEAPON;
+                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
                        }
                        else
                        {
-                               self.superweapons_finished = 0;
-                               self.weapons &= ~WEPSET_SUPERWEAPONS;
+                               this.superweapons_finished = 0;
+                               this.weapons &= ~WEPSET_SUPERWEAPONS;
                        }
                }
                else
                {
-                       self.superweapons_finished = 0;
+                       this.superweapons_finished = 0;
                }
        }
 
        if(autocvar_g_nodepthtestplayers)
-               self.effects = self.effects | EF_NODEPTHTEST;
+               this.effects = this.effects | EF_NODEPTHTEST;
 
        if(autocvar_g_fullbrightplayers)
-               self.effects = self.effects | EF_FULLBRIGHT;
+               this.effects = this.effects | EF_FULLBRIGHT;
 
        if (time >= game_starttime)
-       if (time < self.spawnshieldtime)
-               self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
+       if (time < this.spawnshieldtime)
+               this.effects = this.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
 
-       MUTATOR_CALLHOOK(PlayerPowerups, self, items_prev);
+       MUTATOR_CALLHOOK(PlayerPowerups, this, items_prev);
 }
 
 float CalcRegen(float current, float stable, float regenfactor, float regenframetime)
@@ -1477,7 +1477,7 @@ void player_regen ()
        regen_health_stable = autocvar_g_balance_health_regenstable;
        regen_health_rotstable = autocvar_g_balance_health_rotstable;
        if(!MUTATOR_CALLHOOK(PlayerRegen))
-       if(!STAT(FROZEN, self))
+       if(!STAT(FROZEN, this))
        {
                float mina, maxa, limith, limita;
                maxa = autocvar_g_balance_armor_rotstable;
@@ -1495,21 +1495,21 @@ void player_regen ()
                limith = limith * limit_mod;
                limita = limita * limit_mod;
 
-               self.armorvalue = CalcRotRegen(self.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > self.pauserotarmor_finished), limita);
-               self.health = CalcRotRegen(self.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > self.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > self.pauserothealth_finished), limith);
+               this.armorvalue = CalcRotRegen(this.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > this.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > this.pauserotarmor_finished), limita);
+               this.health = CalcRotRegen(this.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > this.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > this.pauserothealth_finished), limith);
        }
 
        // if player rotted to death...  die!
        // check this outside above checks, as player may still be able to rot to death
-       if(self.health < 1)
+       if(this.health < 1)
        {
-               if(self.vehicle)
+               if(this.vehicle)
                        vehicles_exit(VHEF_RELEASE);
-               if(self.event_damage)
-                       self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+               if(this.event_damage)
+                       this.event_damage(this, this, this, 1, DEATH_ROT.m_id, this.origin, '0 0 0');
        }
 
-       if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+       if (!(this.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                float minf, maxf, limitf;
 
@@ -1517,19 +1517,19 @@ void player_regen ()
                minf = autocvar_g_balance_fuel_regenstable;
                limitf = autocvar_g_balance_fuel_limit;
 
-               self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf);
+               this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
        }
 }
 
-float zoomstate_set;
+bool zoomstate_set;
 void SetZoomState(float z)
 {SELFPARAM();
-       if(z != self.zoomstate)
+       if(z != this.zoomstate)
        {
-               self.zoomstate = z;
-               ClientData_Touch(self);
+               this.zoomstate = z;
+               ClientData_Touch(this);
        }
-       zoomstate_set = 1;
+       zoomstate_set = true;
 }
 
 void GetPressedKeys()
@@ -1632,12 +1632,12 @@ void SpectateCopy(entity this, entity spectatee)
 
 bool SpectateUpdate()
 {SELFPARAM();
-       if(!self.enemy)
+       if(!this.enemy)
            return false;
 
-       if(!IS_PLAYER(self.enemy) || self == self.enemy)
+       if(!IS_PLAYER(this.enemy) || this == this.enemy)
        {
-               SetSpectatee(self, NULL);
+               SetSpectatee(this, NULL);
                return false;
        }
 
@@ -1648,14 +1648,14 @@ bool SpectateUpdate()
 
 bool SpectateSet()
 {SELFPARAM();
-       if(!IS_PLAYER(self.enemy))
+       if(!IS_PLAYER(this.enemy))
                return false;
 
-       msg_entity = self;
+       msg_entity = this;
        WriteByte(MSG_ONE, SVC_SETVIEW);
-       WriteEntity(MSG_ONE, self.enemy);
-       self.movetype = MOVETYPE_NONE;
-       accuracy_resend(self);
+       WriteEntity(MSG_ONE, this.enemy);
+       this.movetype = MOVETYPE_NONE;
+       accuracy_resend(this);
 
        if(!SpectateUpdate())
                PutObserverInServer();
@@ -1677,24 +1677,24 @@ void SetSpectatee(entity player, entity spectatee)
 
 bool Spectate(entity pl)
 {SELFPARAM();
-       if(MUTATOR_CALLHOOK(SpectateSet, self, pl))
+       if(MUTATOR_CALLHOOK(SpectateSet, this, pl))
                return false;
        pl = spec_player;
 
-       SetSpectatee(self, pl);
+       SetSpectatee(this, pl);
        return SpectateSet();
 }
 
 bool SpectateNext()
 {SELFPARAM();
-       other = find(self.enemy, classname, STR_PLAYER);
+       other = find(this.enemy, classname, STR_PLAYER);
 
-       if (MUTATOR_CALLHOOK(SpectateNext, self, other))
+       if (MUTATOR_CALLHOOK(SpectateNext, this, other))
                other = spec_player;
        else if (!other)
                other = find(other, classname, STR_PLAYER);
 
-       if(other) { SetSpectatee(self, other); }
+       if(other) { SetSpectatee(this, other); }
 
        return SpectateSet();
 }
@@ -1708,11 +1708,11 @@ bool SpectatePrev()
 
        entity first = other;
        // skip players until current spectated player
-       if(self.enemy)
-       while(other && other != self.enemy)
+       if(this.enemy)
+       while(other && other != this.enemy)
                other = other.chain;
 
-       switch (MUTATOR_CALLHOOK(SpectatePrev, self, other, first))
+       switch (MUTATOR_CALLHOOK(SpectatePrev, this, other, first))
        {
                case MUT_SPECPREV_FOUND:
                    other = spec_player;
@@ -1731,7 +1731,7 @@ bool SpectatePrev()
                }
        }
 
-       SetSpectatee(self, other);
+       SetSpectatee(this, other);
        return SpectateSet();
 }
 
@@ -1745,51 +1745,51 @@ Update a respawn countdown display.
 void ShowRespawnCountdown()
 {SELFPARAM();
        float number;
-       if(!IS_DEAD(self)) // just respawned?
+       if(!IS_DEAD(this)) // just respawned?
                return;
        else
        {
-               number = ceil(self.respawn_time - time);
+               number = ceil(this.respawn_time - time);
                if(number <= 0)
                        return;
-               if(number <= self.respawn_countdown)
+               if(number <= this.respawn_countdown)
                {
-                       self.respawn_countdown = number - 1;
-                       if(ceil(self.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
-                               { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
+                       this.respawn_countdown = number - 1;
+                       if(ceil(this.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
+                               { Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
                }
        }
 }
 
 void LeaveSpectatorMode()
 {SELFPARAM();
-       if(self.caplayer)
+       if(this.caplayer)
                return;
-       if(nJoinAllowed(self, self))
+       if(nJoinAllowed(this, this))
        {
-               if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0)
+               if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
                {
-                       TRANSMUTE(Player, self);
+                       TRANSMUTE(Player, this);
 
                        if(autocvar_g_campaign || autocvar_g_balance_teams)
-                               { JoinBestTeam(self, false, true); }
+                               { JoinBestTeam(this, false, true); }
 
                        if(autocvar_g_campaign)
                                { campaign_bots_may_start = true; }
 
-                       Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
+                       Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
 
                        PutClientInServer();
 
-                       if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname); }
+                       if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); }
                }
                else
-                       stuffcmd(self, "menu_showteamselect\n");
+                       stuffcmd(this, "menu_showteamselect\n");
        }
        else
        {
                // Player may not join because g_maxplayers is set
-               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_PREVENT);
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT);
        }
 }
 
@@ -1840,92 +1840,92 @@ bool nJoinAllowed(entity this, entity ignore)
  */
 void checkSpectatorBlock()
 {SELFPARAM();
-       if(IS_SPEC(self) || IS_OBSERVER(self))
-       if(!self.caplayer)
-       if(IS_REAL_CLIENT(self))
+       if(IS_SPEC(this) || IS_OBSERVER(this))
+       if(!this.caplayer)
+       if(IS_REAL_CLIENT(this))
        {
-               if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
-                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
-                       dropclient(self);
+               if( time > (this.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
+                       dropclient(this);
                }
        }
 }
 
-void PrintWelcomeMessage()
-{SELFPARAM();
-       if(self.motd_actived_time == 0)
+void PrintWelcomeMessage(entity this)
+{
+       if(this.motd_actived_time == 0)
        {
                if (autocvar_g_campaign) {
-                       if ((IS_PLAYER(self) && PHYS_INPUT_BUTTON_INFO(self)) || (!IS_PLAYER(self))) {
-                               self.motd_actived_time = time;
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message);
+                       if ((IS_PLAYER(this) && PHYS_INPUT_BUTTON_INFO(this)) || (!IS_PLAYER(this))) {
+                               this.motd_actived_time = time;
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, campaign_message);
                        }
                } else {
-                       if (PHYS_INPUT_BUTTON_INFO(self)) {
-                               self.motd_actived_time = time;
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
+                       if (PHYS_INPUT_BUTTON_INFO(this)) {
+                               this.motd_actived_time = time;
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
                        }
                }
        }
-       else if(self.motd_actived_time > 0) // showing MOTD or campaign message
+       else if(this.motd_actived_time > 0) // showing MOTD or campaign message
        {
                if (autocvar_g_campaign) {
-                       if (PHYS_INPUT_BUTTON_INFO(self))
-                               self.motd_actived_time = time;
-                       else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
-                               self.motd_actived_time = 0;
-                               Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+                       if (PHYS_INPUT_BUTTON_INFO(this))
+                               this.motd_actived_time = time;
+                       else if ((time - this.motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released
+                               this.motd_actived_time = 0;
+                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                        }
                } else {
-                       if (PHYS_INPUT_BUTTON_INFO(self))
-                               self.motd_actived_time = time;
-                       else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
-                               self.motd_actived_time = 0;
-                               Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+                       if (PHYS_INPUT_BUTTON_INFO(this))
+                               this.motd_actived_time = time;
+                       else if (time - this.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
+                               this.motd_actived_time = 0;
+                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                        }
                }
        }
-       else //if(self.motd_actived_time < 0) // just connected, motd is active
+       else //if(this.motd_actived_time < 0) // just connected, motd is active
        {
-               if(PHYS_INPUT_BUTTON_INFO(self)) // BUTTON_INFO hides initial MOTD
-                       self.motd_actived_time = -2; // wait until BUTTON_INFO gets released
-               else if(self.motd_actived_time == -2 || IS_PLAYER(self) || IS_SPEC(self))
+               if(PHYS_INPUT_BUTTON_INFO(this)) // BUTTON_INFO hides initial MOTD
+                       this.motd_actived_time = -2; // wait until BUTTON_INFO gets released
+               else if(this.motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this))
                {
                        // instanctly hide MOTD
-                       self.motd_actived_time = 0;
-                       Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+                       this.motd_actived_time = 0;
+                       Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                }
        }
 }
 
 void ObserverThink()
 {SELFPARAM();
-       if ( self.impulse )
+       if ( this.impulse )
        {
-               MinigameImpulse(self, self.impulse);
-               self.impulse = 0;
+               MinigameImpulse(this, this.impulse);
+               this.impulse = 0;
        }
        float prefered_movetype;
-       if (self.flags & FL_JUMPRELEASED) {
-               if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
-                       self.flags &= ~FL_JUMPRELEASED;
-                       self.flags |= FL_SPAWNING;
-               } else if(PHYS_INPUT_BUTTON_ATCK(self) && !self.version_mismatch) {
-                       self.flags &= ~FL_JUMPRELEASED;
+       if (this.flags & FL_JUMPRELEASED) {
+               if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+                       this.flags &= ~FL_JUMPRELEASED;
+                       this.flags |= FL_SPAWNING;
+               } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) {
+                       this.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext()) {
-                               TRANSMUTE(Spectator, self);
+                               TRANSMUTE(Spectator, this);
                        }
                } else {
-                       prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(self) ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
-                       if (self.movetype != prefered_movetype)
-                               self.movetype = prefered_movetype;
+                       prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? this.cvar_cl_clippedspectating : !this.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+                       if (this.movetype != prefered_movetype)
+                               this.movetype = prefered_movetype;
                }
        } else {
-               if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self))) {
-                       self.flags |= FL_JUMPRELEASED;
-                       if(self.flags & FL_SPAWNING)
+               if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this))) {
+                       this.flags |= FL_JUMPRELEASED;
+                       if(this.flags & FL_SPAWNING)
                        {
-                               self.flags &= ~FL_SPAWNING;
+                               this.flags &= ~FL_SPAWNING;
                                LeaveSpectatorMode();
                                return;
                        }
@@ -1935,47 +1935,47 @@ void ObserverThink()
 
 void SpectatorThink()
 {SELFPARAM();
-       if ( self.impulse )
+       if ( this.impulse )
        {
-               if(MinigameImpulse(self, self.impulse))
-                       self.impulse = 0;
-       }
-       if (self.flags & FL_JUMPRELEASED) {
-               if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
-                       self.flags &= ~FL_JUMPRELEASED;
-                       self.flags |= FL_SPAWNING;
-               } else if(PHYS_INPUT_BUTTON_ATCK(self) || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209)) {
-                       self.flags &= ~FL_JUMPRELEASED;
+               if(MinigameImpulse(this, this.impulse))
+                       this.impulse = 0;
+       }
+       if (this.flags & FL_JUMPRELEASED) {
+               if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+                       this.flags &= ~FL_JUMPRELEASED;
+                       this.flags |= FL_SPAWNING;
+               } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) {
+                       this.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext()) {
-                               TRANSMUTE(Spectator, self);
+                               TRANSMUTE(Spectator, this);
                        } else {
-                               TRANSMUTE(Observer, self);
+                               TRANSMUTE(Observer, this);
                                PutClientInServer();
                        }
-                       self.impulse = 0;
-               } else if(self.impulse == 12 || self.impulse == 16  || self.impulse == 19 || (self.impulse >= 220 && self.impulse <= 229)) {
-                       self.flags &= ~FL_JUMPRELEASED;
+                       this.impulse = 0;
+               } else if(this.impulse == 12 || this.impulse == 16  || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) {
+                       this.flags &= ~FL_JUMPRELEASED;
                        if(SpectatePrev()) {
-                               TRANSMUTE(Spectator, self);
+                               TRANSMUTE(Spectator, this);
                        } else {
-                               TRANSMUTE(Observer, self);
+                               TRANSMUTE(Observer, this);
                                PutClientInServer();
                        }
-                       self.impulse = 0;
-               } else if (PHYS_INPUT_BUTTON_ATCK2(self)) {
-                       self.flags &= ~FL_JUMPRELEASED;
-                       TRANSMUTE(Observer, self);
+                       this.impulse = 0;
+               } else if (PHYS_INPUT_BUTTON_ATCK2(this)) {
+                       this.flags &= ~FL_JUMPRELEASED;
+                       TRANSMUTE(Observer, this);
                        PutClientInServer();
                } else {
                        if(!SpectateUpdate())
                                PutObserverInServer();
                }
        } else {
-               if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))) {
-                       self.flags |= FL_JUMPRELEASED;
-                       if(self.flags & FL_SPAWNING)
+               if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) {
+                       this.flags |= FL_JUMPRELEASED;
+                       if(this.flags & FL_SPAWNING)
                        {
-                               self.flags &= ~FL_SPAWNING;
+                               this.flags &= ~FL_SPAWNING;
                                LeaveSpectatorMode();
                                return;
                        }
@@ -1984,16 +1984,16 @@ void SpectatorThink()
                        PutObserverInServer();
        }
 
-       self.flags |= FL_CLIENT | FL_NOTARGET;
+       this.flags |= FL_CLIENT | FL_NOTARGET;
 }
 
 void vehicles_enter (entity pl, entity veh);
 void PlayerUseKey()
 {SELFPARAM();
-       if (!IS_PLAYER(self))
+       if (!IS_PLAYER(this))
                return;
 
-       if(self.vehicle)
+       if(this.vehicle)
        {
                if(!gameover)
                {
@@ -2003,23 +2003,23 @@ void PlayerUseKey()
        }
        else if(autocvar_g_vehicles_enter)
        {
-               if(!STAT(FROZEN, self))
-               if(!IS_DEAD(self))
+               if(!STAT(FROZEN, this))
+               if(!IS_DEAD(this))
                if(!gameover)
                {
                        entity head, closest_target = world;
-                       head = WarpZone_FindRadius(self.origin, autocvar_g_vehicles_enter_radius, true);
+                       head = WarpZone_FindRadius(this.origin, autocvar_g_vehicles_enter_radius, true);
 
                        while(head) // find the closest acceptable target to enter
                        {
                                if(head.vehicle_flags & VHF_ISVEHICLE)
                                if(!IS_DEAD(head))
-                               if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, self)))
+                               if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, this)))
                                if(head.takedamage != DAMAGE_NO)
                                {
                                        if(closest_target)
                                        {
-                                               if(vlen(self.origin - head.origin) < vlen(self.origin - closest_target.origin))
+                                               if(vlen(this.origin - head.origin) < vlen(this.origin - closest_target.origin))
                                                { closest_target = head; }
                                        }
                                        else { closest_target = head; }
@@ -2028,7 +2028,7 @@ void PlayerUseKey()
                                head = head.chain;
                        }
 
-                       if(closest_target) { vehicles_enter(self, closest_target); return; }
+                       if(closest_target) { vehicles_enter(this, closest_target); return; }
                }
        }
 
@@ -2049,372 +2049,317 @@ void() nexball_setstatus;
 .float last_vehiclecheck;
 .int items_added;
 void PlayerPreThink ()
-{SELFPARAM();
-       WarpZone_PlayerPhysics_FixVAngle(self);
+{
+    SELFPARAM();
+       WarpZone_PlayerPhysics_FixVAngle(this);
 
-       self.stat_game_starttime = game_starttime;
-       self.stat_round_starttime = round_starttime;
-       self.stat_allow_oldvortexbeam = autocvar_g_allow_oldvortexbeam;
-       self.stat_leadlimit = autocvar_leadlimit;
+    STAT(GAMESTARTTIME, this) = game_starttime;
+       STAT(ROUNDSTARTTIME, this) = round_starttime;
+       STAT(ALLOW_OLDVORTEXBEAM, this) = autocvar_g_allow_oldvortexbeam;
+       STAT(LEADLIMIT, this) = autocvar_leadlimit;
 
-       self.weaponsinmap = weaponsInMap;
+       STAT(WEAPONSINMAP, this) = weaponsInMap;
 
-       if(frametime)
-       {
+       if (frametime) {
                // physics frames: update anticheat stuff
-               anticheat_prethink(self);
+               anticheat_prethink(this);
        }
 
-       if(blockSpectators && frametime)
-               // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+       if (blockSpectators && frametime) {
+               // WORKAROUND: only use dropclient in server frames (frametime set).
+               // Never use it in cl_movement frames (frametime zero).
                checkSpectatorBlock();
+    }
 
-       zoomstate_set = 0;
-
-       // Savage: Check for nameless players
-       if (isInvisibleString(self.netname)) {
-               string new_name = strzone(strcat("Player@", ftos(self.playerid)));
-               if(autocvar_sv_eventlog)
-                       GameLogEcho(strcat(":name:", ftos(self.playerid), ":", new_name));
-               if(self.netname_previous)
-                       strunzone(self.netname_previous);
-               self.netname_previous = strzone(new_name);
-               self.netname = self.netname_previous;
-               // stuffcmd(self, strcat("name ", self.netname, "\n"));
-       } else if(self.netname_previous != self.netname) {
-               if(autocvar_sv_eventlog)
-                       GameLogEcho(strcat(":name:", ftos(self.playerid), ":", self.netname));
-               if(self.netname_previous)
-                       strunzone(self.netname_previous);
-               self.netname_previous = strzone(self.netname);
+       zoomstate_set = false;
+
+       // Check for nameless players
+       if (isInvisibleString(this.netname)) {
+               this.netname = strzone(sprintf("Player#%d", this.playerid));
+               // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
+       }
+       if (this.netname != this.netname_previous) {
+               if (autocvar_sv_eventlog) {
+                       GameLogEcho(strcat(":name:", ftos(this.playerid), ":", this.netname));
+        }
+               if (this.netname_previous) strunzone(this.netname_previous);
+               this.netname_previous = strzone(this.netname);
        }
 
        // version nagging
-       if(self.version_nagtime)
-               if(self.cvar_g_xonoticversion)
-                       if(time > self.version_nagtime)
-                       {
-                               // don't notify git users
-                               if(strstrofs(self.cvar_g_xonoticversion, "git", 0) < 0 && strstrofs(self.cvar_g_xonoticversion, "autobuild", 0) < 0)
-                               {
-                                       if(strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0)
-                                       {
-                                               // notify release users if connecting to git
-                                               LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
-                                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
-                                       }
-                                       else
-                                       {
-                                               float r;
-                                               r = vercmp(self.cvar_g_xonoticversion, autocvar_g_xonoticversion);
-                                               if(r < 0)
-                                               {
-                                                       // give users new version
-                                                       LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - ^3Xonotic ", autocvar_g_xonoticversion, "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.org/^1!\n");
-                                                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
-                                               }
-                                               else if(r > 0)
-                                               {
-                                                       // notify users about old server version
-                                                       LOG_INFO("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
-                                                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
-                                               }
-                                       }
-                               }
-                               self.version_nagtime = 0;
-                       }
+       if (this.version_nagtime && this.cvar_g_xonoticversion && time > this.version_nagtime) {
+        this.version_nagtime = 0;
+        if (strstrofs(this.cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(this.cvar_g_xonoticversion, "autobuild", 0) >= 0) {
+            // git client
+        } else if (strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0) {
+            // git server
+            Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+        } else {
+            int r = vercmp(this.cvar_g_xonoticversion, autocvar_g_xonoticversion);
+            if (r < 0) { // old client
+                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+            } else if (r > 0) { // old server
+                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+            }
+        }
+    }
 
        // GOD MODE info
-       if(!(self.flags & FL_GODMODE)) if(self.max_armorvalue)
+       if (!(this.flags & FL_GODMODE) && this.max_armorvalue)
        {
-               Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_GODMODE_OFF, self.max_armorvalue);
-               self.max_armorvalue = 0;
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_GODMODE_OFF, this.max_armorvalue);
+               this.max_armorvalue = 0;
        }
 
-       if(STAT(FROZEN, self) == 2)
+       if (STAT(FROZEN, this) == 2)
        {
-               self.revive_progress = bound(0, self.revive_progress + frametime * self.revive_speed, 1);
-               self.health = max(1, self.revive_progress * start_health);
-               self.iceblock.alpha = bound(0.2, 1 - self.revive_progress, 1);
+               this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
+               this.health = max(1, this.revive_progress * start_health);
+               this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
 
-               if(self.revive_progress >= 1)
-                       Unfreeze(self);
+               if (this.revive_progress >= 1)
+                       Unfreeze(this);
        }
-       else if(STAT(FROZEN, self) == 3)
+       else if (STAT(FROZEN, this) == 3)
        {
-               self.revive_progress = bound(0, self.revive_progress - frametime * self.revive_speed, 1);
-               self.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * self.revive_progress );
+               this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
+               this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
 
-               if(self.health < 1)
+               if (this.health < 1)
                {
-                       if(self.vehicle)
+                       if (this.vehicle)
                                vehicles_exit(VHEF_RELEASE);
-                       self.event_damage(self, self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
+                       this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
                }
-               else if ( self.revive_progress <= 0 )
-                       Unfreeze(self);
+               else if (this.revive_progress <= 0)
+                       Unfreeze(this);
        }
 
        MUTATOR_CALLHOOK(PlayerPreThink);
 
        if(autocvar_g_vehicles_enter)
-       if(time > self.last_vehiclecheck)
-       if(IS_PLAYER(self))
+       if(time > this.last_vehiclecheck)
+       if(IS_PLAYER(this))
        if(!gameover)
-       if(!STAT(FROZEN, self))
-       if(!self.vehicle)
-       if(!IS_DEAD(self))
+       if(!STAT(FROZEN, this))
+       if(!this.vehicle)
+       if(!IS_DEAD(this))
        {
                entity veh;
                for(veh = world; (veh = findflags(veh, vehicle_flags, VHF_ISVEHICLE)); )
-               if(vlen(veh.origin - self.origin) < autocvar_g_vehicles_enter_radius)
+               if(vlen(veh.origin - this.origin) < autocvar_g_vehicles_enter_radius)
                if(!IS_DEAD(veh))
                if(veh.takedamage != DAMAGE_NO)
-               if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, self))
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
+               if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, this))
+                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
                else if(!veh.owner)
-               if(!veh.team || SAME_TEAM(self, veh))
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER);
+               if(!veh.team || SAME_TEAM(this, veh))
+                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER);
                else if(autocvar_g_vehicles_steal)
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
+                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
 
-               self.last_vehiclecheck = time + 1;
+               this.last_vehiclecheck = time + 1;
        }
 
-       if(!self.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+       if(!this.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
        {
-               if(PHYS_INPUT_BUTTON_USE(self) && !self.usekeypressed)
+               if(PHYS_INPUT_BUTTON_USE(this) && !this.usekeypressed)
                        PlayerUseKey();
-               self.usekeypressed = PHYS_INPUT_BUTTON_USE(self);
+               this.usekeypressed = PHYS_INPUT_BUTTON_USE(this);
        }
 
-       if(IS_REAL_CLIENT(self))
-               PrintWelcomeMessage();
-
-       if(IS_PLAYER(self))
-       {
+       if (IS_REAL_CLIENT(this))
+               PrintWelcomeMessage(this);
 
+       if (IS_PLAYER(this)) {
                CheckRules_Player();
 
-               if (intermission_running)
-               {
-                       IntermissionThink ();   // otherwise a button could be missed between
-                       return;                                 // the think tics
+               if (intermission_running) {
+                       IntermissionThink();
+                       return;
                }
 
-               //don't allow the player to turn around while game is paused!
-               if(timeout_status == TIMEOUT_ACTIVE) {
+               if (timeout_status == TIMEOUT_ACTIVE) {
+            // don't allow the player to turn around while game is paused
                        // FIXME turn this into CSQC stuff
-                       self.v_angle = self.lastV_angle;
-                       self.angles = self.lastV_angle;
-                       self.fixangle = true;
+                       this.v_angle = this.lastV_angle;
+                       this.angles = this.lastV_angle;
+                       this.fixangle = true;
                }
 
-               if(frametime)
-               {
-                       player_powerups();
-               }
+               if (frametime) player_powerups();
 
-               if (IS_DEAD(self))
-               {
-                       if(self.personal && g_race_qualifying)
-                       {
-                               if(time > self.respawn_time)
-                               {
-                                       self.respawn_time = time + 1; // only retry once a second
-                                       self.stat_respawn_time = self.respawn_time;
+               if (IS_DEAD(this)) {
+                       if (this.personal && g_race_qualifying) {
+                               if (time > this.respawn_time) {
+                                       STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second
                                        respawn();
-                                       self.impulse = 141;
-                               }
-                       }
-                       else
-                       {
-                               float button_pressed;
-                               if(frametime)
-                                       player_anim();
-                               button_pressed = (PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self));
-
-                               if (self.deadflag == DEAD_DYING)
-                               {
-                                       if((self.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max)
-                                               self.deadflag = DEAD_RESPAWNING;
-                                       else if(!button_pressed)
-                                               self.deadflag = DEAD_DEAD;
-                               }
-                               else if (self.deadflag == DEAD_DEAD)
-                               {
-                                       if(button_pressed)
-                                               self.deadflag = DEAD_RESPAWNABLE;
-                                       else if(time >= self.respawn_time_max && (self.respawn_flags & RESPAWN_FORCE))
-                                               self.deadflag = DEAD_RESPAWNING;
-                               }
-                               else if (self.deadflag == DEAD_RESPAWNABLE)
-                               {
-                                       if(!button_pressed)
-                                               self.deadflag = DEAD_RESPAWNING;
+                                       this.impulse = CHIMPULSE_SPEEDRUN.impulse;
                                }
-                               else if (self.deadflag == DEAD_RESPAWNING)
-                               {
-                                       if(time > self.respawn_time)
-                                       {
-                                               self.respawn_time = time + 1; // only retry once a second
-                                               self.respawn_time_max = self.respawn_time;
+                       } else {
+                               if (frametime) player_anim();
+                               bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
+
+                               if (this.deadflag == DEAD_DYING) {
+                                       if ((this.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max) {
+                                               this.deadflag = DEAD_RESPAWNING;
+                                       } else if (!button_pressed) {
+                                               this.deadflag = DEAD_DEAD;
+                    }
+                               } else if (this.deadflag == DEAD_DEAD) {
+                                       if (button_pressed) {
+                                               this.deadflag = DEAD_RESPAWNABLE;
+                                       } else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)) {
+                                               this.deadflag = DEAD_RESPAWNING;
+                    }
+                               } else if (this.deadflag == DEAD_RESPAWNABLE) {
+                                       if (!button_pressed) {
+                                               this.deadflag = DEAD_RESPAWNING;
+                    }
+                               } else if (this.deadflag == DEAD_RESPAWNING) {
+                                       if (time > this.respawn_time) {
+                                               this.respawn_time = time + 1; // only retry once a second
+                                               this.respawn_time_max = this.respawn_time;
                                                respawn();
                                        }
                                }
 
                                ShowRespawnCountdown();
 
-                               if(self.respawn_flags & RESPAWN_SILENT)
-                                       self.stat_respawn_time = 0;
-                               else if((self.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
-                                       self.stat_respawn_time = self.respawn_time_max;
+                               if (this.respawn_flags & RESPAWN_SILENT)
+                                       STAT(RESPAWN_TIME, this) = 0;
+                               else if ((this.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
+                                       STAT(RESPAWN_TIME, this) = this.respawn_time_max;
                                else
-                                       self.stat_respawn_time = self.respawn_time;
+                                       STAT(RESPAWN_TIME, this) = this.respawn_time;
                        }
 
                        // if respawning, invert stat_respawn_time to indicate this, the client translates it
-                       if(self.deadflag == DEAD_RESPAWNING && self.stat_respawn_time > 0)
-                               self.stat_respawn_time *= -1;
+                       if (this.deadflag == DEAD_RESPAWNING && STAT(RESPAWN_TIME, this) > 0)
+                               STAT(RESPAWN_TIME, this) *= -1;
 
                        return;
                }
 
-               self.prevorigin = self.origin;
-
-               float do_crouch = PHYS_INPUT_BUTTON_CROUCH(self);
-               if(self.hook.state)
-                       do_crouch = 0;
-               if(self.vehicle)
-                       do_crouch = 0;
-               if(STAT(FROZEN, self))
-                       do_crouch = 0;
+               this.prevorigin = this.origin;
 
-               // WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
-               // It cannot be predicted by the engine!
-               .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-               if((PS(self).m_weapon == WEP_SHOCKWAVE || PS(self).m_weapon == WEP_SHOTGUN) && self.(weaponentity).wframe == WFRAME_FIRE2 && time < self.(weaponentity).weapon_nextthink)
-                       do_crouch = 0;
+               bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+               if (this.hook.state) {
+                       do_crouch = false;
+               } else if (this.vehicle) {
+                       do_crouch = false;
+               } else if (STAT(FROZEN, this)) {
+                       do_crouch = false;
+        } else if ((PS(this).m_weapon == WEP_SHOTGUN || PS(this).m_weapon == WEP_SHOCKWAVE) && this.(weaponentity).wframe == WFRAME_FIRE2 && time < this.(weaponentity).weapon_nextthink) {
+                   // WEAPONTODO: predict
+                       do_crouch = false;
+        }
 
-               if (do_crouch)
-               {
-                       if (!self.crouch)
-                       {
-                               self.crouch = true;
-                               self.view_ofs = STAT(PL_CROUCH_VIEW_OFS, self);
-                               setsize (self, STAT(PL_CROUCH_MIN, self), STAT(PL_CROUCH_MAX, self));
-                               // setanim(self, self.anim_duck, false, true, true); // this anim is BROKEN anyway
-                       }
-               }
-               else
-               {
-                       if (self.crouch)
-                       {
-                               tracebox(self.origin, STAT(PL_MIN, self), STAT(PL_MAX, self), self.origin, false, self);
-                               if (!trace_startsolid)
-                               {
-                                       self.crouch = false;
-                                       self.view_ofs = STAT(PL_VIEW_OFS, self);
-                                       setsize (self, STAT(PL_MIN, self), STAT(PL_MAX, self));
-                               }
+               if (do_crouch) {
+                       if (!this.crouch) {
+                               this.crouch = true;
+                               this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
+                               setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
+                               // setanim(this, this.anim_duck, false, true, true); // this anim is BROKEN anyway
                        }
+               } else if (this.crouch) {
+            tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, false, this);
+            if (!trace_startsolid) {
+                this.crouch = false;
+                this.view_ofs = STAT(PL_VIEW_OFS, this);
+                setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
+            }
                }
 
-               FixPlayermodel(self);
+               FixPlayermodel(this);
 
                // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
                //if(frametime)
                {
-                       self.items &= ~self.items_added;
+                       this.items &= ~this.items_added;
 
-                       W_WeaponFrame(self);
+                       W_WeaponFrame(this);
 
-                       self.items_added = 0;
-                       if(self.items & ITEM_Jetpack.m_itemid)
-                               if(self.items & ITEM_JetpackRegen.m_itemid || self.ammo_fuel >= 0.01)
-                                       self.items_added |= IT_FUEL;
+                       this.items_added = 0;
+                       if (this.items & ITEM_Jetpack.m_itemid && (this.items & ITEM_JetpackRegen.m_itemid || this.ammo_fuel >= 0.01))
+                this.items_added |= IT_FUEL;
 
-                       self.items |= self.items_added;
+                       this.items |= this.items_added;
                }
 
                player_regen();
 
                // WEAPONTODO: Add a weapon request for this
                // rot vortex charge to the charge limit
-               if(WEP_CVAR(vortex, charge_rot_rate) && self.vortex_charge > WEP_CVAR(vortex, charge_limit) && self.vortex_charge_rottime < time)
-                       self.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), self.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+               if (WEP_CVAR(vortex, charge_rot_rate) && this.vortex_charge > WEP_CVAR(vortex, charge_limit) && this.vortex_charge_rottime < time)
+                       this.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
 
-               if(frametime)
-                       player_anim();
+               if (frametime) player_anim();
 
                // secret status
                secrets_setstatus();
 
                // monsters status
-               monsters_setstatus(self);
-
-               self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+               monsters_setstatus(this);
 
-               //self.angles_y=self.v_angle_y + 90;   // temp
-       } else if(gameover) {
-               if (intermission_running)
-                       IntermissionThink ();   // otherwise a button could be missed between
+               this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+       }
+       else if (gameover) {
+               if (intermission_running) IntermissionThink();
                return;
-       } else if(IS_OBSERVER(self)) {
+       }
+       else if (IS_OBSERVER(this)) {
                ObserverThink();
-       } else if(IS_SPEC(self)) {
+       }
+       else if (IS_SPEC(this)) {
                SpectatorThink();
        }
 
        // WEAPONTODO: Add weapon request for this
-       if(!zoomstate_set)
+       if (!zoomstate_set) {
                SetZoomState(
-                       PHYS_INPUT_BUTTON_ZOOM(self)
-                       || PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)
-                       || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_VORTEX)
-                       || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
-               ); // WEAPONTODO
-
-       float oldspectatee_status;
-       oldspectatee_status = self.spectatee_status;
-       if(IS_SPEC(self))
-               self.spectatee_status = etof(self.enemy);
-       else if(IS_OBSERVER(self))
-               self.spectatee_status = etof(self);
-       else
-               self.spectatee_status = 0;
-       if(self.spectatee_status != oldspectatee_status)
-       {
-               ClientData_Touch(self);
-               if(g_race || g_cts)
-                       race_InitSpectator();
+                       PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this)
+                       || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_VORTEX)
+                       || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
+               );
+    }
+
+       int oldspectatee_status = this.spectatee_status;
+       if (IS_SPEC(this)) {
+               this.spectatee_status = etof(this.enemy);
+       } else if (IS_OBSERVER(this)) {
+               this.spectatee_status = etof(this);
+       } else {
+               this.spectatee_status = 0;
+    }
+       if (this.spectatee_status != oldspectatee_status) {
+               ClientData_Touch(this);
+               if (g_race || g_cts) race_InitSpectator();
        }
 
-       if(self.teamkill_soundtime)
-       if(time > self.teamkill_soundtime)
+       if (this.teamkill_soundtime && time > this.teamkill_soundtime)
        {
-               self.teamkill_soundtime = 0;
+               this.teamkill_soundtime = 0;
 
-               entity e = self.teamkill_soundsource;
+               entity e = this.teamkill_soundsource;
                entity oldpusher = e.pusher;
                e.pusher = this;
                PlayerSound(e, playersound_teamshoot, CH_VOICE, VOICETYPE_LASTATTACKER_ONLY);
                e.pusher = oldpusher;
        }
 
-       if(self.taunt_soundtime)
-       if(time > self.taunt_soundtime)
-       {
-               self.taunt_soundtime = 0;
-               PlayerSound(self, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
+       if (this.taunt_soundtime && time > this.taunt_soundtime) {
+               this.taunt_soundtime = 0;
+               PlayerSound(this, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
        }
 
-       target_voicescript_next(self);
+       target_voicescript_next(this);
 
        // WEAPONTODO: Move into weaponsystem somehow
        // if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring
-       if (PS(self).m_weapon == WEP_Null)
-               self.clip_load = self.clip_size = 0;
+       if (PS(this).m_weapon == WEP_Null)
+               this.clip_load = this.clip_size = 0;
 }
 
 void DrownPlayer(entity this)
@@ -2448,39 +2393,38 @@ Called every frame for each client after the physics are run
 */
 .float idlekick_lasttimeleft;
 void PlayerPostThink ()
-{SELFPARAM();
-       if(sv_maxidle > 0 && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
-       if(IS_REAL_CLIENT(self))
-       if(IS_PLAYER(self) || sv_maxidle_spectatorsareidle)
+{
+    SELFPARAM();
+       if (sv_maxidle > 0)
+       if (frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+       if (IS_REAL_CLIENT(this))
+       if (IS_PLAYER(this) || sv_maxidle_spectatorsareidle)
        {
-               if (time - self.parm_idlesince < 1) // instead of (time == self.parm_idlesince) to support sv_maxidle <= 10
+               if (time - this.parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
                {
-                       if(self.idlekick_lasttimeleft)
+                       if (this.idlekick_lasttimeleft)
                        {
-                               self.idlekick_lasttimeleft = 0;
-                               Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_IDLING);
+                               this.idlekick_lasttimeleft = 0;
+                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_IDLING);
                        }
                }
                else
                {
-                       float timeleft;
-                       timeleft = ceil(sv_maxidle - (time - self.parm_idlesince));
-                       if(timeleft == min(10, sv_maxidle - 1)) // - 1 to support sv_maxidle <= 10
-                       {
-                               if(!self.idlekick_lasttimeleft)
-                                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
+                       float timeleft = ceil(sv_maxidle - (time - this.parm_idlesince));
+                       if (timeleft == min(10, sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
+                               if (!this.idlekick_lasttimeleft)
+                                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
                        }
-                       if(timeleft <= 0)
-                       {
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, self.netname);
-                               dropclient(self);
+                       if (timeleft <= 0) {
+                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname);
+                               dropclient(this);
                                return;
                        }
-                       else if(timeleft <= 10)
-                       {
-                               if(timeleft != self.idlekick_lasttimeleft)
-                                       { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft)); }
-                               self.idlekick_lasttimeleft = timeleft;
+                       else if (timeleft <= 10) {
+                               if (timeleft != this.idlekick_lasttimeleft) {
+                                   Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft));
+                }
+                               this.idlekick_lasttimeleft = timeleft;
                        }
                }
        }
@@ -2489,37 +2433,21 @@ void PlayerPostThink ()
 
        //CheckPlayerJump();
 
-       if(IS_PLAYER(self)) {
-               DrownPlayer(self);
+       if (IS_PLAYER(this)) {
+               DrownPlayer(this);
                CheckRules_Player();
                UpdateChatBubble();
-               if (self.impulse)
-                       ImpulseCommands(self);
-               if (intermission_running)
-                       return;         // intermission or finale
+               if (this.impulse) ImpulseCommands(this);
+               if (intermission_running) return; // intermission or finale
                GetPressedKeys();
        }
 
-       /*
-       float i;
-       for(i = 0; i < 1000; ++i)
-       {
-               vector end;
-               end = self.origin + '0 0 1024' + 512 * randomvec();
-               tracebox(self.origin, self.mins, self.maxs, end, MOVE_NORMAL, self);
-               if(trace_fraction < 1)
-               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
-               {
-                       print("I HIT SOLID: ", vtos(self.origin), " -> ", vtos(end), "\n");
-                       break;
-               }
-       }
-       */
-
-       if(self.waypointsprite_attachedforcarrier)
-               WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
+       if (this.waypointsprite_attachedforcarrier) {
+           vector v = healtharmor_maxdamage(this.health, this.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id);
+               WaypointSprite_UpdateHealth(this.waypointsprite_attachedforcarrier, '1 0 0' * v);
+    }
 
        playerdemo_write();
 
-       CSQCMODEL_AUTOUPDATE(self);
+       CSQCMODEL_AUTOUPDATE(this);
 }
index 979e6d860bf3cf1455c12179b2c47e6973b582b9..42904695c693b35e39835bed217e3c78ef2635c8 100644 (file)
@@ -39,17 +39,17 @@ void Drop_Special_Items(entity player)
 
 void CopyBody_Think()
 {SELFPARAM();
-       if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
+       if(this.CopyBody_nextthink && time > this.CopyBody_nextthink)
        {
-               self.CopyBody_think();
-               if(wasfreed(self))
+               this.CopyBody_think();
+               if(wasfreed(this))
                        return;
-               self.CopyBody_nextthink = self.nextthink;
-               self.CopyBody_think = self.think;
-               self.think = CopyBody_Think;
+               this.CopyBody_nextthink = this.nextthink;
+               this.CopyBody_think = this.think;
+               this.think = CopyBody_Think;
        }
-       CSQCMODEL_AUTOUPDATE(self);
-       self.nextthink = time;
+       CSQCMODEL_AUTOUPDATE(this);
+       this.nextthink = time;
 }
 void CopyBody(entity this, float keepvelocity)
 {
@@ -135,8 +135,8 @@ void player_setupanimsformodel()
 
 void player_anim ()
 {SELFPARAM();
-       int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
-       if(IS_DEAD(self)) {
+       int deadbits = (this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
+       if(IS_DEAD(this)) {
                if (!deadbits) {
                        // Decide on which death animation to use.
                        if(random() < 0.5)
@@ -149,14 +149,14 @@ void player_anim ()
                deadbits = 0;
        }
        int animbits = deadbits;
-       if(STAT(FROZEN, self))
+       if(STAT(FROZEN, this))
                animbits |= ANIMSTATE_FROZEN;
-       if(self.movetype == MOVETYPE_FOLLOW)
+       if(this.movetype == MOVETYPE_FOLLOW)
                animbits |= ANIMSTATE_FOLLOW;
-       if(self.crouch)
+       if(this.crouch)
                animbits |= ANIMSTATE_DUCK;
-       animdecide_setstate(self, animbits, false);
-       animdecide_setimplicitstate(self, IS_ONGROUND(self));
+       animdecide_setstate(this, animbits, false);
+       animdecide_setimplicitstate(this, IS_ONGROUND(this));
 }
 
 void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -556,7 +556,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                excess = frag_damage;
 
                Weapon wep = PS(this).m_weapon;
-               WITH(entity, self, this, wep.wr_playerdeath(wep));
+               WITHSELF(this, wep.wr_playerdeath(wep));
 
                RemoveGrapplingHook(this);
 
@@ -637,7 +637,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
                // reset fields the weapons may use just in case
                FOREACH(Weapons, it != WEP_Null, LAMBDA(
-                       WITH(entity, self, this, it.wr_resetplayer(it));
+                       WITHSELF(this, it.wr_resetplayer(it));
                        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                        {
                                ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
index 4533e4f5b21cdb14cfe97aa0d39eeb7d014dc981..e7cc3d4578c8a811d7509db00a23954ef785f50a 100644 (file)
@@ -733,7 +733,7 @@ void SV_ParseClientCommand(string command)
        if (command != command2) return;
 
        // if we're banned, don't even parse the command
-       if (Ban_MaybeEnforceBanOnce(self)) return;
+       if (Ban_MaybeEnforceBanOnce(this)) return;
 
        float argc = tokenize_console(command);
 
@@ -765,17 +765,17 @@ void SV_ParseClientCommand(string command)
        {
                if (argc == 1)
                {
-                       sprint(self, "\nClient networked commands:\n");
+                       sprint(this, "\nClient networked commands:\n");
                        ClientCommand_macro_help();
 
-                       sprint(self, "\nCommon networked commands:\n");
-                       CommonCommand_macro_help(self);
+                       sprint(this, "\nCommon networked commands:\n");
+                       CommonCommand_macro_help(this);
 
-                       sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
-                       sprint(self, "For help about a specific command, type cmd help COMMAND\n");
+                       sprint(this, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
+                       sprint(this, "For help about a specific command, type cmd help COMMAND\n");
                        return;
                }
-               else if (CommonCommand_macro_usage(argc, self))  // Instead of trying to call a command, we're going to see detailed information about it
+               else if (CommonCommand_macro_usage(argc, this))  // Instead of trying to call a command, we're going to see detailed information about it
                {
                        return;
                }
@@ -792,7 +792,7 @@ void SV_ParseClientCommand(string command)
        {
                return;  // handled by server/cheats.qc
        }
-       else if (CommonCommand_macro_command(argc, self, command))
+       else if (CommonCommand_macro_command(argc, this, command))
        {
                return;                                          // handled by server/command/common.qc
        }
@@ -802,6 +802,6 @@ void SV_ParseClientCommand(string command)
        }
        else
        {
-               clientcommand(self, command);
+               clientcommand(this, command);
        }
 }
index e713caf7946714b8bc7c4d631638e09b8104b382..02e984e3c587e5eec84957cf6c628014c64e110c 100644 (file)
@@ -199,7 +199,7 @@ void GameCommand_allspec(float request, float argc)
                        int n = 0;
                        FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
                                if (it.caplayer) it.caplayer = 0;
-                               WITH(entity, self, it, PutObserverInServer());
+                               WITHSELF(it, PutObserverInServer());
                                ++n;
                        ));
                        if (n)   bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
@@ -1028,7 +1028,7 @@ void GameCommand_moveplayer(float request, float argc)
                                                if (!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
                                                        if (client.caplayer) client.caplayer = 0;
-                                                       WITH(entity, self, client, PutObserverInServer());
+                                                       WITHSELF(client, PutObserverInServer());
 
                                                        successful = strcat(successful, (successful ? ", " : ""), client.netname);
                                                }
@@ -1178,7 +1178,7 @@ void GameCommand_playerdemo(float request, float argc)
                                                        return;
                                                }
 
-                                               WITH(entity, self, client, playerdemo_open_read(argv(next_token)));
+                                               WITHSELF(client, playerdemo_open_read(argv(next_token)));
                                                return;
                                        }
 
@@ -1193,7 +1193,7 @@ void GameCommand_playerdemo(float request, float argc)
                                                        return;
                                                }
 
-                                               WITH(entity, self, client, playerdemo_open_write(argv(next_token)));
+                                               WITHSELF(client, playerdemo_open_write(argv(next_token)));
                                                return;
                                        }
 
index afc0fe4601e8f63d39d392ddcfddf49a7a45b4a2..4bd8dee6e5d15d30c953db2971caf57f1b8868b2 100644 (file)
@@ -344,7 +344,7 @@ void reset_map(bool dorespawn)
        FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
                if (it.reset)
                {
-                       WITH(entity, self, it, it.reset(it));
+                       WITHSELF(it, it.reset(it));
                        continue;
                }
                if (it.team_saved) it.team = it.team_saved;
@@ -353,10 +353,10 @@ void reset_map(bool dorespawn)
 
        // Waypoints and assault start come LAST
        FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
-               if (it.reset2) WITH(entity, self, it, it.reset2());
+               if (it.reset2) WITHSELF(it, it.reset2());
        });
 
-       FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITH(entity, self, it, Unfreeze(it))));
+       FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITHSELF(it, Unfreeze(it))));
 
        // Moving the player reset code here since the player-reset depends
        // on spawnpoint entities which have to be reset first --blub
index 65447c7d635bfd0e3472199faed7df509bb2897f..7124e4468f3f6cf82878c23ec71b251cad460760 100644 (file)
@@ -213,7 +213,6 @@ void FixClientCvars(entity e);
 WepSet weaponsInMap;
 
 #define weapons _STAT(WEAPONS)
-#define weaponsinmap _STAT(WEAPONSINMAP)
 
 .float respawn_countdown; // next number to count
 
@@ -285,8 +284,6 @@ float cvar_purechanges_count;
 
 float game_starttime; //point in time when the countdown to game start is over
 float round_starttime; //point in time when the countdown to round start is over
-.float stat_game_starttime = _STAT(GAMESTARTTIME);
-.float stat_round_starttime = _STAT(ROUNDSTARTTIME);
 
 void W_Porto_Remove (entity p);
 
@@ -294,8 +291,6 @@ void W_Porto_Remove (entity p);
 
 .string message2;
 
-.bool stat_allow_oldvortexbeam = _STAT(ALLOW_OLDVORTEXBEAM);
-
 // reset to 0 on weapon switch
 // may be useful to all weapons
 .float bulletcounter;
@@ -342,8 +337,6 @@ string matchid;
 
 .float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
 
-.float stat_leadlimit = _STAT(LEADLIMIT);
-
 bool radar_showennemies;
 
 #ifdef PROFILING
index 2958835830fffab161818758cb3339f4bd3774ab..208ae62e59365a347c18e3477c863bca8f506d06 100644 (file)
@@ -540,7 +540,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
        targ.iceblock = ice;
        targ.revival_time = 0;
 
-       WITH(entity, self, ice, Ice_Think());
+       WITHSELF(ice, Ice_Think());
 
        RemoveGrapplingHook(targ);
 
index 97450cd4ca107333c5255e9e024d26f4bc6f5a13..c6a9d787fe2c6b602c7f7d788ec211ca67fe6804 100644 (file)
@@ -240,89 +240,89 @@ float LOD_customize()
        {
                int d = autocvar_loddebug;
                if(d == 1)
-                       self.modelindex = self.lodmodelindex0;
-               else if(d == 2 || !self.lodmodelindex2)
-                       self.modelindex = self.lodmodelindex1;
+                       this.modelindex = this.lodmodelindex0;
+               else if(d == 2 || !this.lodmodelindex2)
+                       this.modelindex = this.lodmodelindex1;
                else // if(d == 3)
-                       self.modelindex = self.lodmodelindex2;
+                       this.modelindex = this.lodmodelindex2;
                return true;
        }
 
        // TODO csqc network this so it only gets sent once
-       vector near_point = NearestPointOnBox(self, other.origin);
-       if(vdist(near_point - other.origin, <, self.loddistance1))
-               self.modelindex = self.lodmodelindex0;
-       else if(!self.lodmodelindex2 || vdist(near_point - other.origin, <, self.loddistance2))
-               self.modelindex = self.lodmodelindex1;
+       vector near_point = NearestPointOnBox(this, other.origin);
+       if(vdist(near_point - other.origin, <, this.loddistance1))
+               this.modelindex = this.lodmodelindex0;
+       else if(!this.lodmodelindex2 || vdist(near_point - other.origin, <, this.loddistance2))
+               this.modelindex = this.lodmodelindex1;
        else
-               self.modelindex = self.lodmodelindex2;
+               this.modelindex = this.lodmodelindex2;
 
        return true;
 }
 
 void LOD_uncustomize()
 {SELFPARAM();
-       self.modelindex = self.lodmodelindex0;
+       this.modelindex = this.lodmodelindex0;
 }
 
 void LODmodel_attach()
 {SELFPARAM();
        entity e;
 
-       if(!self.loddistance1)
-               self.loddistance1 = 1000;
-       if(!self.loddistance2)
-               self.loddistance2 = 2000;
-       self.lodmodelindex0 = self.modelindex;
+       if(!this.loddistance1)
+               this.loddistance1 = 1000;
+       if(!this.loddistance2)
+               this.loddistance2 = 2000;
+       this.lodmodelindex0 = this.modelindex;
 
-       if(self.lodtarget1 != "")
+       if(this.lodtarget1 != "")
        {
-               e = find(world, targetname, self.lodtarget1);
+               e = find(world, targetname, this.lodtarget1);
                if(e)
                {
-                       self.lodmodel1 = e.model;
+                       this.lodmodel1 = e.model;
                        remove(e);
                }
        }
-       if(self.lodtarget2 != "")
+       if(this.lodtarget2 != "")
        {
-               e = find(world, targetname, self.lodtarget2);
+               e = find(world, targetname, this.lodtarget2);
                if(e)
                {
-                       self.lodmodel2 = e.model;
+                       this.lodmodel2 = e.model;
                        remove(e);
                }
        }
 
        if(autocvar_loddebug < 0)
        {
-               self.lodmodel1 = self.lodmodel2 = ""; // don't even initialize
+               this.lodmodel1 = this.lodmodel2 = ""; // don't even initialize
        }
 
-       if(self.lodmodel1 != "")
+       if(this.lodmodel1 != "")
        {
                vector mi, ma;
-               mi = self.mins;
-               ma = self.maxs;
+               mi = this.mins;
+               ma = this.maxs;
 
-               precache_model(self.lodmodel1);
-               _setmodel(self, self.lodmodel1);
-               self.lodmodelindex1 = self.modelindex;
+               precache_model(this.lodmodel1);
+               _setmodel(this, this.lodmodel1);
+               this.lodmodelindex1 = this.modelindex;
 
-               if(self.lodmodel2 != "")
+               if(this.lodmodel2 != "")
                {
-                       precache_model(self.lodmodel2);
-                       _setmodel(self, self.lodmodel2);
-                       self.lodmodelindex2 = self.modelindex;
+                       precache_model(this.lodmodel2);
+                       _setmodel(this, this.lodmodel2);
+                       this.lodmodelindex2 = this.modelindex;
                }
 
-               self.modelindex = self.lodmodelindex0;
-               setsize(self, mi, ma);
+               this.modelindex = this.lodmodelindex0;
+               setsize(this, mi, ma);
        }
 
-       if(self.lodmodelindex1)
-               if (!self.SendEntity)
-                       SetCustomizer(self, LOD_customize, LOD_uncustomize);
+       if(this.lodmodelindex1)
+               if (!this.SendEntity)
+                       SetCustomizer(this, LOD_customize, LOD_uncustomize);
 }
 
 void ApplyMinMaxScaleAngles(entity e)
index f1154e1b59539c66039e39b3b4373aafd25a2f3f..d4bc83b681d2c63193ce9a71f4b5374fb1380901 100644 (file)
@@ -49,13 +49,13 @@ void PingPLReport_Think()
        delta = 3 / maxclients;
        if(delta < sys_frametime)
                delta = 0;
-       self.nextthink = time + delta;
+       this.nextthink = time + delta;
 
-       e = edict_num(self.cnt + 1);
+       e = edict_num(this.cnt + 1);
        if(IS_REAL_CLIENT(e))
        {
                WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
-               WriteByte(MSG_BROADCAST, self.cnt);
+               WriteByte(MSG_BROADCAST, this.cnt);
                WriteShort(MSG_BROADCAST, max(1, e.ping));
                WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255));
                WriteByte(MSG_BROADCAST, ceil(e.ping_movementloss * 255));
@@ -72,12 +72,12 @@ void PingPLReport_Think()
        else
        {
                WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
-               WriteByte(MSG_BROADCAST, self.cnt);
+               WriteByte(MSG_BROADCAST, this.cnt);
                WriteShort(MSG_BROADCAST, 0);
                WriteByte(MSG_BROADCAST, 0);
                WriteByte(MSG_BROADCAST, 0);
        }
-       self.cnt = (self.cnt + 1) % maxclients;
+       this.cnt = (this.cnt + 1) % maxclients;
 }
 void PingPLReport_Spawn()
 {
@@ -511,15 +511,15 @@ entity randomseed;
 bool RandomSeed_Send(entity this, entity to, int sf)
 {
        WriteHeader(MSG_ENTITY, ENT_CLIENT_RANDOMSEED);
-       WriteShort(MSG_ENTITY, self.cnt);
+       WriteShort(MSG_ENTITY, this.cnt);
        return true;
 }
 void RandomSeed_Think()
 {SELFPARAM();
-       self.cnt = bound(0, floor(random() * 65536), 65535);
-       self.nextthink = time + 5;
+       this.cnt = bound(0, floor(random() * 65536), 65535);
+       this.nextthink = time + 5;
 
-       self.SendFlags |= 1;
+       this.SendFlags |= 1;
 }
 void RandomSeed_Spawn()
 {SELFPARAM();
@@ -527,7 +527,7 @@ void RandomSeed_Spawn()
        randomseed.think = RandomSeed_Think;
        Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
 
-       WITH(entity, self, randomseed, randomseed.think()); // sets random seed and nextthink
+       WITHSELF(randomseed, randomseed.think()); // sets random seed and nextthink
 }
 
 spawnfunc(__init_dedicated_server)
@@ -1545,9 +1545,7 @@ void NextLevel()
                        bprint(it.netname, " ^7wins.\n");
        ));
 
-       entity oldself = self;
-       target_music_kill();
-       self = oldself;
+       WITHSELF(NULL, target_music_kill());
 
        if(autocvar_g_campaign)
                CampaignPreIntermission();
@@ -1569,8 +1567,8 @@ void CheckRules_Player()
        if (gameover)   // someone else quit the game already
                return;
 
-       if(!IS_DEAD(self))
-               self.play_time += frametime;
+       if(!IS_DEAD(this))
+               this.play_time += frametime;
 
        // fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities
        //   (div0: and that in CheckRules_World please)
index 65d38c8aa90ec3bb672e3edab877bf61d5422a4e..bb5f176b6090f48bf7e9d48cde65f446f5f0a730 100644 (file)
@@ -910,7 +910,7 @@ void InitializeEntitiesRun()
         //dprint("Delayed initialization: ", e.classname, "\n");
         if (func)
         {
-               WITH(entity, self, e, func());
+               WITHSELF(e, func());
         }
         else
         {
index ae5166c7c47df6d43a775504f7464faf017c8cd0..e017f8a17f5ca05f11a3d00d8e59b5fd685e32fe 100644 (file)
@@ -80,7 +80,7 @@ void assault_objective_use()
        {
                if (e.classname == "target_objective_decrease")
                {
-                       WITH(entity, self, e, target_objective_decrease_activate());
+                       WITHSELF(e, target_objective_decrease_activate());
                }
        }
 
@@ -239,7 +239,7 @@ void assault_roundstart_use()
                        it.team = NUM_TEAM_1;
 
                // Dubbles as teamchange
-               WITH(entity, self, it, turret_respawn());
+               WITHSELF(it, turret_respawn());
        ));
 }
 
@@ -268,7 +268,7 @@ void assault_new_round()
        //bprint("ASSAULT: new round\n");
 
        // Eject players from vehicles
-    FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, LAMBDA(WITH(entity, self, it, vehicles_exit(VHEF_RELEASE))));
+    FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, WITHSELF(it, vehicles_exit(VHEF_RELEASE)));
 
     FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, LAMBDA(
        setself(it);
@@ -332,7 +332,7 @@ int WinningCondition_Assault()
                        }
                        else
                        {
-                               WITH(entity, self, ent, assault_new_round());
+                               WITHSELF(ent, assault_new_round());
                        }
                }
        }
index c5dedbae705081f573db6757c13c1ed5cc60c61a..7f0eafe868d3a7d517a67966bd0c4d52ccdff2ca 100644 (file)
@@ -254,7 +254,7 @@ MUTATOR_HOOKFUNCTION(ca, reset_map_players)
                {
                        TRANSMUTE(Player, it);
                        it.caplayer = 1;
-                       WITH(entity, self, it, PutClientInServer());
+                       WITHSELF(it, PutClientInServer());
                }
        });
        return true;
index ba1e7a84fbc4a985befefcffb088af17cc91e46e..9cd6e37726230d6ddfe5ff4d49469c888bce3793 100644 (file)
@@ -2551,7 +2551,7 @@ void ctf_SpawnTeam (string teamname, int teamcolor)
        this.netname = teamname;
        this.cnt = teamcolor;
        this.spawnfunc_checked = true;
-       WITH(entity, self, this, spawnfunc_ctf_team(this));
+       WITHSELF(this, spawnfunc_ctf_team(this));
 }
 
 void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
index bee23d10148ca298da4e52bdab45b95bc0b213c3..8482e258e9d0f8fdf2e64579e53246a766e21bdc 100644 (file)
@@ -380,7 +380,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies)
        if(round_handler_CountdownRunning())
        {
                if(STAT(FROZEN, frag_target))
-                       WITH(entity, self, frag_target, freezetag_Unfreeze(world));
+                       WITHSELF(frag_target, freezetag_Unfreeze(world));
                freezetag_count_alive_players();
                return 1; // let the player die so that he can respawn whenever he wants
        }
@@ -398,7 +398,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies)
                        freezetag_LastPlayerForTeam_Notify();
                }
                else
-                       WITH(entity, self, frag_target, freezetag_Unfreeze(world)); // remove ice
+                       WITHSELF(frag_target, freezetag_Unfreeze(world)); // remove ice
                frag_target.health = 0; // Unfreeze resets health
                frag_target.freezetag_frozen_timeout = -2; // freeze on respawn
                return 1;
@@ -407,7 +407,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies)
        if(STAT(FROZEN, frag_target))
                return 1;
 
-       WITH(entity, self, frag_target, freezetag_Freeze(frag_attacker));
+       WITHSELF(frag_target, freezetag_Freeze(frag_attacker));
        freezetag_LastPlayerForTeam_Notify();
 
        if(frag_attacker == frag_target || frag_attacker == world)
index 4f84c5abbcb6c71994884d3a68e13f2ef703c5c8..a2f1f2507ed2bdf4d9da74d58dddc89b5bf2730f 100644 (file)
@@ -228,8 +228,8 @@ MUTATOR_HOOKFUNCTION(lms, ClientConnect)
 
 MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
 {SELFPARAM();
-       if(self.deadflag == DEAD_DYING)
-               self.deadflag = DEAD_RESPAWNING;
+       if(this.deadflag == DEAD_DYING)
+               this.deadflag = DEAD_RESPAWNING;
 
        return false;
 }
index 3167d603bf9798a57e0bc59f31b540da65b97646..2ba975c0da4f25141d569a8eaf1f182d665773db 100644 (file)
@@ -64,7 +64,7 @@ void tdm_SpawnTeam (string teamname, float teamcolor)
        this.netname = teamname;
        this.cnt = teamcolor;
        this.spawnfunc_checked = true;
-       WITH(entity, self, this, spawnfunc_tdm_team(this));
+       WITHSELF(this, spawnfunc_tdm_team(this));
 }
 
 void tdm_DelayedInit()
index 9e335a331f8166fc37b48d2ef10e0160d35c9b05..9f3fd6d28f952db4ffa59fb5983e605825cfb5a7 100644 (file)
@@ -94,9 +94,9 @@ void playerdemo_write_float(.float f, string name)
 }
 void playerdemo_write()
 {SELFPARAM();
-       if(self.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
+       if(this.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
                return;
-       fputs(self.playerdemo_fh, strcat(ftos(time - self.playerdemo_starttime), "\n"));
+       fputs(this.playerdemo_fh, strcat(ftos(time - this.playerdemo_starttime), "\n"));
        PLAYERDEMO_FIELDS(playerdemo_write_)
 }
 void playerdemo_read_originvector(.vector f, string name)
@@ -147,9 +147,9 @@ float playerdemo_read(entity this)
                PLAYERDEMO_FIELDS(playerdemo_read_)
                {
                        time = this.playerdemo_time;
-                       WITH(entity, self, this, PlayerPreThink());
+                       WITHSELF(this, PlayerPreThink());
                        // not running physics though... this is just so we can run weapon stuff
-                       WITH(entity, self, this, PlayerPostThink());
+                       WITHSELF(this, PlayerPostThink());
                }
                this.playerdemo_time = stof(fgets(this.playerdemo_fh));
                if(this.playerdemo_time == 0)
index 273be69d7444c45b37183b01501a93aaa602b722..8b46c210b8450cd1150d30345336007411198131 100644 (file)
@@ -1075,7 +1075,7 @@ void race_ClearRecords()
 
        FOREACH_CLIENT(true, LAMBDA(
                float p = it.race_place;
-               WITH(entity, self, it, race_PreparePlayer());
+               WITHSELF(it, race_PreparePlayer());
                it.race_place = p;
        ));
 }
index 344f05846f742cdb4d59b2c98ac053be715d1b8d..4e7cf0f5d1daa634efdb6ad72140cedb89a6b7a3 100644 (file)
@@ -50,11 +50,11 @@ bool SpawnEvent_Send(entity this, entity to, int sf)
 void spawnpoint_think()
 {
     SELFPARAM();
-       self.nextthink = time + 0.1;
-       if(self.origin != self.spawnpoint_prevorigin)
+       this.nextthink = time + 0.1;
+       if(this.origin != this.spawnpoint_prevorigin)
        {
-               self.spawnpoint_prevorigin = self.origin;
-               self.SendFlags |= 1;
+               this.spawnpoint_prevorigin = this.origin;
+               this.SendFlags |= 1;
        }
 }
 
@@ -261,7 +261,7 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck)
                        ++found;
                        if(ent.spawn_evalfunc)
                        {
-                               WITH(entity, self, ent, {
+                               WITHSELF(ent, {
                                        spawn_score = ent.spawn_evalfunc(this, spot, spawn_score);
                                });
                                if(spawn_score.x < 0)
index df1e1e61217b7b87dc0002c9ce13e37a1e3272bb..e7d6dbfb5b2b9f34cc5eb967930ce4d3d34e5ca7 100644 (file)
@@ -117,12 +117,12 @@ void CreatureFrame_FallDamage(entity this)
 
 void CreatureFrame_All()
 {
-       FOREACH_ENTITY_FLOAT(damagedbycontents, true, LAMBDA(
-               if(it.movetype == MOVETYPE_NOCLIP) continue;
+       FOREACH_ENTITY_FLOAT(damagedbycontents, true, {
+               if (it.movetype == MOVETYPE_NOCLIP) continue;
                CreatureFrame_Liquids(it);
                CreatureFrame_FallDamage(it);
                it.oldvelocity = it.velocity;
-       ));
+       });
 }
 
 void Pause_TryPause(bool ispaused)
@@ -159,7 +159,7 @@ void StartFrame()
 {
     // TODO: if move is more than 50ms, split it into two moves (this matches QWSV behavior and the client prediction)
     FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), PM_Main(it));
-    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITH(entity, self, it, PlayerPreThink()));
+    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPreThink()));
 
        execute_next_frame();
        if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause(true);
@@ -190,10 +190,9 @@ void StartFrame()
        }
 #endif
 
-       FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, LAMBDA(CSQCProjectile_Check(it)));
+       FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, CSQCProjectile_Check(it));
 
-       if(RedirectionThink())
-               return;
+       if (RedirectionThink()) return;
 
        UncustomizeEntitiesRun();
        InitializeEntitiesRun();
@@ -201,8 +200,7 @@ void StartFrame()
        WarpZone_StartFrame();
 
        sys_frametime = autocvar_sys_ticrate * autocvar_slowmo;
-       if(sys_frametime <= 0)
-               sys_frametime = 1.0 / 60.0; // somewhat safe fallback
+       if (sys_frametime <= 0) sys_frametime = 1.0 / 60.0; // somewhat safe fallback
 
        if (timeout_status == TIMEOUT_LEADTIME) // just before the timeout (when timeout_status will be TIMEOUT_ACTIVE)
                orig_slowmo = autocvar_slowmo; // slowmo will be restored after the timeout
@@ -212,7 +210,7 @@ void StartFrame()
        // detect when the pre-game countdown (if any) has ended and the game has started
        game_delay = (time < game_starttime);
 
-       if(autocvar_sv_eventlog && game_delay_last && !game_delay)
+       if (autocvar_sv_eventlog && game_delay_last && !game_delay)
                GameLogEcho(":startdelay_ended");
 
        game_delay_last = game_delay;
@@ -220,8 +218,7 @@ void StartFrame()
        CreatureFrame_All();
        CheckRules_World();
 
-       if(warmup_stage && !gameover && warmup_limit > 0 && time >= warmup_limit)
-       {
+       if (warmup_stage && !gameover && warmup_limit > 0 && time >= warmup_limit) {
                ReadyRestart();
                return;
        }
@@ -230,8 +227,8 @@ void StartFrame()
        anticheat_startframe();
        MUTATOR_CALLHOOK(SV_StartFrame);
 
-    FOREACH_CLIENT(true, LAMBDA(GlobalStats_update(it)));
-    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITH(entity, self, it, PlayerPostThink()));
+    FOREACH_CLIENT(true, GlobalStats_update(it));
+    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPostThink()));
 }
 
 .vector originjitter;
index 1337a1d71b89a097082565df800e6ea2a2e203ba..27d35643de1415f389a6ed61819ce3f22983e69c 100644 (file)
@@ -72,7 +72,7 @@ bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain)
                        }
                        else
                        {
-                               WITH(entity, self, cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
+                               WITHSELF(cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
 
                                // always allow selecting the Mine Layer if we placed mines, so that we can detonate them
                                if(wpn == WEP_MINE_LAYER)
index 21279dae93b6589f9b801f892f7f5f6694272ab9..f44b3929013c2a5929abed8cb8add8679145017e 100644 (file)
@@ -75,7 +75,7 @@ void CL_Weaponentity_Think()
                remove(this);
                return;
        }
-       if (IS_DEAD(self.owner))
+       if (IS_DEAD(this.owner))
        {
                // owner died; disappear
                this.model = "";
@@ -116,7 +116,7 @@ void CL_ExteriorWeaponentity_Think()
                remove(this);
                return;
        }
-       if (IS_DEAD(self.owner))
+       if (IS_DEAD(this.owner))
        {
                this.model = "";
                return;
@@ -213,8 +213,8 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary
     SELFPARAM();
        if ((actor.items & IT_UNLIMITED_WEAPON_AMMO)) return true;
        bool ammo = false;
-       if (secondary) WITH(entity, self, actor, ammo = thiswep.wr_checkammo2(thiswep));
-       else WITH(entity, self, actor, ammo = thiswep.wr_checkammo1(thiswep));
+       if (secondary) WITHSELF(actor, ammo = thiswep.wr_checkammo2(thiswep));
+       else WITHSELF(actor, ammo = thiswep.wr_checkammo1(thiswep));
        if (ammo) return true;
        // always keep the Mine Layer if we placed mines, so that we can detonate them
        if (thiswep == WEP_MINE_LAYER)
@@ -232,8 +232,8 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary
 
        // check if the other firing mode has enough ammo
        bool ammo_other = false;
-       if (secondary) WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo1(thiswep));
-       else WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo2(thiswep));
+       if (secondary) WITHSELF(actor, ammo_other = thiswep.wr_checkammo1(thiswep));
+       else WITHSELF(actor, ammo_other = thiswep.wr_checkammo2(thiswep));
        if (ammo_other)
        {
                if (time - actor.prevwarntime > 1)
@@ -772,5 +772,5 @@ void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity w
     SELFPARAM();
        Weapon w = Weapons_from(weapon_type);
        weapon_dropevent_item = weapon_item;
-       WITH(entity, self, player, w.event(w));
+       WITHSELF(player, w.event(w));
 }