]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Purge self from event_damage
authorMario <mario@smbclan.net>
Sun, 3 Jan 2016 13:12:22 +0000 (23:12 +1000)
committerMario <mario@smbclan.net>
Sun, 3 Jan 2016 13:12:22 +0000 (23:12 +1000)
45 files changed:
qcsrc/client/defs.qh
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/effects/qc/gibs.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/bloodloss/bloodloss.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/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh
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/door.qc
qcsrc/common/triggers/func/door_secret.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.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/seeker.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/cl_player.qh
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_hook.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/portals.qc
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/throwing.qh

index 3e959b084ef753251abe18a338253d14f38896c9..d3db0ebfde08cfdd0763fbe46b49b33cf9528ae2 100644 (file)
@@ -95,7 +95,7 @@ float ticrate;
 const float MIN_DAMAGEEXTRARADIUS = 2;
 const float MAX_DAMAGEEXTRARADIUS = 16;
 .float damageextraradius;
-.void(float thisdmg, int hittype, vector org, vector thisforce) event_damage;
+.void(entity this, float thisdmg, int hittype, vector org, vector thisforce) event_damage;
 
 // only for Porto
 float angles_held_status;
index f68bf383df8d71ec88fd6d97a6a969bbf9f87ebd..3e0aa3592a6243fb034bf2e1afdbd853601a54b3 100644 (file)
@@ -113,12 +113,12 @@ void Casing_Touch()
     self.nextthink = time + 0.2;
 }
 
-void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce)
-{SELFPARAM();
+void Casing_Damage(entity this, float thisdmg, int hittype, vector org, vector thisforce)
+{
     if (thisforce.z < 0)
         thisforce.z = 0;
-    self.move_velocity = self.move_velocity + thisforce + '0 0 100';
-    self.move_flags &= ~FL_ONGROUND;
+    this.move_velocity = this.move_velocity + thisforce + '0 0 100';
+    this.move_flags &= ~FL_ONGROUND;
 }
 
 NET_HANDLE(casings, bool isNew)
index 45b532b8a6e15637b22a28e49ece2ab0571f4c04..4d85ab90956c4ffdb390e7968ce5b4c0d9ba985f 100644 (file)
@@ -271,7 +271,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                        self.silent = 1;
 
                if(self.event_damage)
-                       self.event_damage(thisdmg, w_deathtype, w_org, thisforce);
+                       self.event_damage(self, thisdmg, w_deathtype, w_org, thisforce);
 
                DamageEffect(w_org, thisdmg, w_deathtype, species);
 
index 09be41c6af01c637b36c85299a7c37ec612780ff..00aa243edc37c0482778e4d496456897d204ae37 100644 (file)
@@ -20,7 +20,7 @@ bool Violence_GibSplash_SendEntity(entity this, entity to, int sf)
 }
 
 void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker)
-{SELFPARAM();
+{
        if(g_cts) // no gibs in CTS
                return;
 
@@ -29,14 +29,14 @@ void Violence_GibSplash_At(vector org, vector dir, float type, float amount, ent
        e.state = type; // should stay smaller than 15
        if(!sound_allowed(MSG_BROADCAST, gibowner) || !sound_allowed(MSG_BROADCAST, attacker))
                e.state |= 0x40; // "silence" bit
-       e.state |= 8 * self.species; // gib type, ranges from 0 to 15
+       e.state |= 8 * gibowner.species; // gib type, ranges from 0 to 15
 
        // if this is a copied dead body, send the num of its player instead
        // TODO: remove this field, read from model txt files
-       if(self.classname == "body")
-               e.team = etof(self.enemy);
+       if(gibowner.classname == "body")
+               e.team = etof(gibowner.enemy);
        else
-               e.team = etof(self);
+               e.team = etof(gibowner);
 
        setorigin(e, org);
        e.velocity = dir;
index 7cdefd906167b5615cb0eb1320ef61ec30e62c99..acd372c98060af069da8cf542a1dbffe8a92589e 100644 (file)
@@ -487,18 +487,18 @@ int ons_ControlPoint_Attackable(entity cp, int teamnumber)
        return 0;
 }
 
-void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
        if(damage <= 0) { return; }
 
-       if (self.owner.isshielded)
+       if (this.owner.isshielded)
        {
                // this is protected by a shield, so ignore the damage
-               if (time > self.pain_finished)
+               if (time > this.pain_finished)
                        if (IS_PLAYER(attacker))
                        {
                                play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
-                               self.pain_finished = time + 1;
+                               this.pain_finished = time + 1;
                                attacker.typehitsound += 1; // play both sounds (shield is way too quiet)
                        }
 
@@ -506,60 +506,60 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag
        }
 
        if(IS_PLAYER(attacker))
-       if(time - ons_notification_time[self.team] > 10)
+       if(time - ons_notification_time[this.team] > 10)
        {
-               play2team(self.team, SND(ONS_CONTROLPOINT_UNDERATTACK));
-               ons_notification_time[self.team] = time;
+               play2team(this.team, SND(ONS_CONTROLPOINT_UNDERATTACK));
+               ons_notification_time[this.team] = time;
        }
 
-       self.health = self.health - damage;
-       if(self.owner.iscaptured)
-               WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
+       this.health = this.health - damage;
+       if(this.owner.iscaptured)
+               WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
        else
-               WaypointSprite_UpdateBuildFinished(self.owner.sprite, time + (self.max_health - self.health) / (self.count / ONS_CP_THINKRATE));
-       self.pain_finished = time + 1;
+               WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - this.health) / (this.count / ONS_CP_THINKRATE));
+       this.pain_finished = time + 1;
        // particles on every hit
        pointparticles(EFFECT_SPARKS, hitloc, force*-1, 1);
        //sound on every hit
        if (random() < 0.5)
-               sound(self, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM);
+               sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM);
        else
-               sound(self, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM);
+               sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM);
 
-       if (self.health < 0)
+       if (this.health < 0)
        {
-               sound(self, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
-               pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
-               Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_CPDESTROYED_), self.owner.message, attacker.netname);
+               sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
+               pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
+               Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(this.team, INFO_ONSLAUGHT_CPDESTROYED_), this.owner.message, attacker.netname);
 
                PlayerScore_Add(attacker, SP_ONS_TAKES, 1);
                PlayerScore_Add(attacker, SP_SCORE, 10);
 
-               self.owner.goalentity = world;
-               self.owner.islinked = false;
-               self.owner.iscaptured = false;
-               self.owner.team = 0;
-               self.owner.colormap = 1024;
+               this.owner.goalentity = world;
+               this.owner.islinked = false;
+               this.owner.iscaptured = false;
+               this.owner.team = 0;
+               this.owner.colormap = 1024;
 
-               WaypointSprite_UpdateMaxHealth(self.owner.sprite, 0);
+               WaypointSprite_UpdateMaxHealth(this.owner.sprite, 0);
 
                onslaught_updatelinks();
 
                // Use targets now (somebody make sure this is in the right place..)
-               setself(self.owner);
-               activator = self;
-               SUB_UseTargets ();
+               setself(this.owner);
+               activator = this;
+               WITH(entity, self, this, SUB_UseTargets());
                setself(this);
 
-               self.owner.waslinked = self.owner.islinked;
-               if(self.owner.model != "models/onslaught/controlpoint_pad.md3")
-                       setmodel_fixsize(self.owner, MDL_ONS_CP_PAD1);
-               //setsize(self, '-32 -32 0', '32 32 8');
+               this.owner.waslinked = this.owner.islinked;
+               if(this.owner.model != "models/onslaught/controlpoint_pad.md3")
+                       setmodel_fixsize(this.owner, MDL_ONS_CP_PAD1);
+               //setsize(this, '-32 -32 0', '32 32 8');
 
-               remove(self);
+               remove(this);
        }
 
-       self.SendFlags |= CPSF_STATUS;
+       this.SendFlags |= CPSF_STATUS;
 }
 
 void ons_ControlPoint_Icon_Think()
@@ -590,7 +590,7 @@ void ons_ControlPoint_Icon_Think()
                self.SendFlags |= CPSF_STATUS;
                if(self.health <= 0)
                {
-                       ons_ControlPoint_Icon_Damage(self, self, 1, 0, self.origin, '0 0 0');
+                       ons_ControlPoint_Icon_Damage(self, self, self, 1, 0, self.origin, '0 0 0');
                        return;
                }
        }
@@ -955,64 +955,64 @@ void ons_Generator_UpdateSprite(entity e)
        }
 }
 
-void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
        if(damage <= 0) { return; }
        if(warmup_stage || gameover) { return; }
        if(!round_handler_IsRoundStarted()) { return; }
 
-       if (attacker != self)
+       if (attacker != this)
        {
-               if (self.isshielded)
+               if (this.isshielded)
                {
                        // this is protected by a shield, so ignore the damage
-                       if (time > self.pain_finished)
+                       if (time > this.pain_finished)
                                if (IS_PLAYER(attacker))
                                {
                                        play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
                                        attacker.typehitsound += 1;
-                                       self.pain_finished = time + 1;
+                                       this.pain_finished = time + 1;
                                }
                        return;
                }
-               if (time > self.pain_finished)
+               if (time > this.pain_finished)
                {
-                       self.pain_finished = time + 10;
-                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, self), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK)));
-                       play2team(self.team, SND(ONS_GENERATOR_UNDERATTACK));
+                       this.pain_finished = time + 10;
+                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, this), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK)));
+                       play2team(this.team, SND(ONS_GENERATOR_UNDERATTACK));
                }
        }
-       self.health = self.health - damage;
-       WaypointSprite_UpdateHealth(self.sprite, self.health);
+       this.health = this.health - damage;
+       WaypointSprite_UpdateHealth(this.sprite, this.health);
        // choose an animation frame based on health
-       self.frame = 10 * bound(0, (1 - self.health / self.max_health), 1);
+       this.frame = 10 * bound(0, (1 - this.health / this.max_health), 1);
        // see if the generator is still functional, or dying
-       if (self.health > 0)
+       if (this.health > 0)
        {
-               self.lasthealth = self.health;
+               this.lasthealth = this.health;
        }
        else
        {
-               if (attacker == self)
-                       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME_));
+               if (attacker == this)
+                       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME_));
                else
                {
-                       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_GENDESTROYED_));
+                       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(this.team, INFO_ONSLAUGHT_GENDESTROYED_));
                        PlayerScore_Add(attacker, SP_SCORE, 100);
                }
-               self.iscaptured = false;
-               self.islinked = false;
-               self.isshielded = false;
-               self.takedamage = DAMAGE_NO; // can't be hurt anymore
-               self.event_damage = func_null; // won't do anything if hurt
-               self.count = 0; // reset counter
-               self.think = func_null;
-               self.nextthink = 0;
-               //self.think(); // do the first explosion now
-
-               WaypointSprite_UpdateMaxHealth(self.sprite, 0);
-               WaypointSprite_Ping(self.sprite);
-               //WaypointSprite_Kill(self.sprite); // can't do this yet, code too poor
+               this.iscaptured = false;
+               this.islinked = false;
+               this.isshielded = false;
+               this.takedamage = DAMAGE_NO; // can't be hurt anymore
+               this.event_damage = func_null; // won't do anything if hurt
+               this.count = 0; // reset counter
+               this.think = func_null;
+               this.nextthink = 0;
+               //this.think(); // do the first explosion now
+
+               WaypointSprite_UpdateMaxHealth(this.sprite, 0);
+               WaypointSprite_Ping(this.sprite);
+               //WaypointSprite_Kill(this.sprite); // can't do this yet, code too poor
 
                onslaught_updatelinks();
        }
@@ -1020,7 +1020,7 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int de
        // Throw some flaming gibs on damage, more damage = more chance for gib
        if(random() < damage/220)
        {
-               sound(self, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+               sound(this, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
        }
        else
        {
@@ -1029,12 +1029,12 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int de
 
                //sound on every hit
                if (random() < 0.5)
-                       sound(self, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM);
+                       sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM);
                else
-                       sound(self, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM);
+                       sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM);
        }
 
-       self.SendFlags |= GSF_STATUS;
+       this.SendFlags |= GSF_STATUS;
 }
 
 void ons_GeneratorThink()
index e77902be22286376645e577d34e37006c6bb9755..136b24f2f8f302b5e3d64986baa2cdfdd425e3d4 100644 (file)
@@ -105,18 +105,18 @@ void M_Shambler_Attack_Lightning_Explode()
        self.nextthink = time + 0.2;
 }
 
-void M_Shambler_Attack_Lightning_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if (self.health <= 0)
+void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if (this.health <= 0)
                return;
 
-       if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+       if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
+       this.health = this.health - damage;
 
-       if (self.health <= 0)
-               W_PrepareExplosionByDamage(attacker, self.use);
+       if (this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
 }
 
 void M_Shambler_Attack_Lightning_Touch()
index 55e453d5d5dd91373b9089bda41cf8cca808a4f3..f4fc641488b9fbd1ab4beefe979dab9ca4f27082 100644 (file)
@@ -741,7 +741,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
                        Unfreeze(this);
                        this.health = 0;
                        if(this.event_damage)
-                               this.event_damage(this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.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 ( this.revive_progress <= 0 )
@@ -965,22 +965,22 @@ void Monster_Reset(entity this)
        this.moveto = this.origin;
 }
 
-void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       self.health -= damage;
+void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       this.health -= damage;
 
-       Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
+       Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
-       if(self.health <= -50) // 100 health until gone?
+       if(this.health <= -50) // 100 health until gone?
        {
-               Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
+               Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
                // number of monsters spawned with mobspawn command
                totalspawned -= 1;
 
-               self.think = SUB_Remove_self;
-               self.nextthink = time + 0.1;
-               self.event_damage = func_null;
+               this.think = SUB_Remove_self;
+               this.nextthink = time + 0.1;
+               this.event_damage = func_null;
        }
 }
 
@@ -1038,86 +1038,85 @@ void Monster_Dead(entity this, entity attacker, float gibbed)
                W_ThrowNewWeapon(this, this.weapon, 0, this.origin, randomvec() * 150 + '0 0 325');
 }
 
-void Monster_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL.m_id && !ITEM_DAMAGE_NEEDKILL(deathtype))
+void Monster_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if((this.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL.m_id && !ITEM_DAMAGE_NEEDKILL(deathtype))
                return;
 
-       if(STAT(FROZEN, self) && deathtype != DEATH_KILL.m_id && deathtype != DEATH_NADE_ICE_FREEZE.m_id)
+       if(STAT(FROZEN, this) && deathtype != DEATH_KILL.m_id && deathtype != DEATH_NADE_ICE_FREEZE.m_id)
                return;
 
-       //if(time < self.pain_finished && deathtype != DEATH_KILL.m_id)
+       //if(time < this.pain_finished && deathtype != DEATH_KILL.m_id)
                //return;
 
-       if(time < self.spawnshieldtime && deathtype != DEATH_KILL.m_id)
+       if(time < this.spawnshieldtime && deathtype != DEATH_KILL.m_id)
                return;
 
-       if(deathtype == DEATH_FALL.m_id && self.draggedby != world)
+       if(deathtype == DEATH_FALL.m_id && this.draggedby != world)
                return;
 
        vector v;
        float take, save;
 
-       v = healtharmor_applydamage(100, self.armorvalue / 100, deathtype, damage);
+       v = healtharmor_applydamage(100, this.armorvalue / 100, deathtype, damage);
        take = v_x;
        save = v_y;
 
        damage_take = take;
        frag_attacker = attacker;
        frag_deathtype = deathtype;
-       Monster mon = get_monsterinfo(self.monsterid);
-       mon.mr_pain(mon, self);
+       Monster mon = get_monsterinfo(this.monsterid);
+       mon.mr_pain(mon, this);
        take = damage_take;
 
        if(take)
        {
-               self.health -= take;
-               Monster_Sound(self, monstersound_pain, 1.2, true, CH_PAIN);
+               this.health -= take;
+               Monster_Sound(this, monstersound_pain, 1.2, true, CH_PAIN);
        }
 
-       if(self.sprite)
-               WaypointSprite_UpdateHealth(self.sprite, self.health);
+       if(this.sprite)
+               WaypointSprite_UpdateHealth(this.sprite, this.health);
 
-       self.dmg_time = time;
+       this.dmg_time = time;
 
        if(sound_allowed(MSG_BROADCAST, attacker) && deathtype != DEATH_DROWN.m_id)
-               spamsound (self, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
+               spamsound (this, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
 
-       self.velocity += force * self.damageforcescale;
+       this.velocity += force * this.damageforcescale;
 
        if(deathtype != DEATH_DROWN.m_id && take)
        {
-               Violence_GibSplash_At(hitloc, force, 2, bound(0, take, 200) / 16, self, attacker);
+               Violence_GibSplash_At(hitloc, force, 2, bound(0, take, 200) / 16, this, attacker);
                if (take > 50)
-                       Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, self, attacker);
+                       Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, this, attacker);
                if (take > 100)
-                       Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, self, attacker);
+                       Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
        }
 
-       if(self.health <= 0)
+       if(this.health <= 0)
        {
                if(deathtype == DEATH_KILL.m_id)
-                       self.candrop = false; // killed by mobkill command
+                       this.candrop = false; // killed by mobkill command
 
                // TODO: fix this?
                activator = attacker;
-               other = self.enemy;
-               SUB_UseTargets();
-               self.target2 = self.oldtarget2; // reset to original target on death, incase we respawn
+               other = this.enemy;
+               WITH(entity, self, this, SUB_UseTargets());
+               this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
 
-               Monster_Dead(self, attacker, (self.health <= -100 || deathtype == DEATH_KILL.m_id));
+               Monster_Dead(this, attacker, (this.health <= -100 || deathtype == DEATH_KILL.m_id));
 
-               WaypointSprite_Kill(self.sprite);
+               WaypointSprite_Kill(this.sprite);
 
-               frag_target = self;
-               MUTATOR_CALLHOOK(MonsterDies, attacker);
+               MUTATOR_CALLHOOK(MonsterDies, this, attacker);
 
-               if(self.health <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed
+               if(this.health <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed
                {
-                       Violence_GibSplash(self, 1, 0.5, attacker);
+                       Violence_GibSplash(this, 1, 0.5, attacker);
 
-                       self.think = SUB_Remove_self;
-                       self.nextthink = time + 0.1;
+                       this.think = SUB_Remove_self;
+                       this.nextthink = time + 0.1;
                }
        }
 }
index 54e8237ecde7e5022c87f22c7c8401cec6f5afc1..4543ae10e70833c43d7f0160b81b592fbfef8a3f 100644 (file)
@@ -15,7 +15,7 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
                        if(self.vehicle)
                                vehicles_exit(VHEF_RELEASE);
                        if(self.event_damage)
-                               self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+                               self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
                        self.bloodloss_timer = time + 0.5 + random() * 0.5;
                }
        }
index 387a95d89c30cd6a5127809dd2e7a9c22a46da39..fcfce9ab77fb5f686013e9d162b874ec618c10ae 100644 (file)
@@ -701,16 +701,16 @@ void nade_beep()
        self.nextthink = max(self.wait, time);
 }
 
-void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void nade_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
        {
-               self.takedamage = DAMAGE_NO;
-               nade_boom();
+               this.takedamage = DAMAGE_NO;
+               WITH(entity, self, this, nade_boom());
                return;
        }
 
-       if(self.nade_type == NADE_TYPE_TRANSLOCATE.m_id || self.nade_type == NADE_TYPE_SPAWN.m_id)
+       if(this.nade_type == NADE_TYPE_TRANSLOCATE.m_id || this.nade_type == NADE_TYPE_SPAWN.m_id)
                return;
 
        if (MUTATOR_CALLHOOK(Nade_Damage, DEATH_WEAPONOF(deathtype), force, damage)) {}
@@ -727,43 +727,43 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype,
        else if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER))
        {
                force *= 6;
-               damage = self.max_health * 0.55;
+               damage = this.max_health * 0.55;
        }
        else if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN))
-               damage = self.max_health * 0.1;
+               damage = this.max_health * 0.1;
        else if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO
        {
                if(deathtype & HITTYPE_SECONDARY)
                {
-                       damage = self.max_health * 0.1;
+                       damage = this.max_health * 0.1;
                        force *= 10;
                }
                else
-                       damage = self.max_health * 1.15;
+                       damage = this.max_health * 1.15;
        }
 
-       self.velocity += force;
-       UpdateCSQCProjectile(self);
+       this.velocity += force;
+       UpdateCSQCProjectile(this);
 
-       if(damage <= 0 || ((IS_ONGROUND(self)) && IS_PLAYER(attacker)))
+       if(damage <= 0 || ((IS_ONGROUND(this)) && IS_PLAYER(attacker)))
                return;
 
-       if(self.health == self.max_health)
+       if(this.health == this.max_health)
        {
-               sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
-               self.nextthink = max(time + autocvar_g_nades_nade_lifetime, time);
-               self.think = nade_beep;
+               sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
+               this.nextthink = max(time + autocvar_g_nades_nade_lifetime, time);
+               this.think = nade_beep;
        }
 
-       self.health -= damage;
+       this.health -= damage;
 
-       if ( self.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
-               self.realowner = attacker;
+       if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
+               this.realowner = attacker;
 
-       if(self.health <= 0)
-               W_PrepareExplosionByDamage(attacker, nade_boom);
+       if(this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, nade_boom));
        else
-               nade_burn_spawn(self);
+               nade_burn_spawn(this);
 }
 
 void toss_nade(entity e, vector _velocity, float _time)
@@ -1252,10 +1252,10 @@ MUTATOR_HOOKFUNCTION(nades, PlayerDamage_Calculate)
 }
 
 MUTATOR_HOOKFUNCTION(nades, MonsterDies)
-{SELFPARAM();
+{
        if(IS_PLAYER(frag_attacker))
-       if(DIFF_TEAM(frag_attacker, self))
-       if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
+       if(DIFF_TEAM(frag_attacker, frag_target))
+       if(!(frag_target.spawnflags & MONSTERFLAG_SPAWNED))
                nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor);
 
        return false;
index fb7ff8c692102564d84a1421ff4457689f7f76f0..96e54d5a02c92dfb58feecf7a3688a8e3dc34cad 100644 (file)
@@ -69,18 +69,18 @@ void W_RocketPropelledChainsaw_Touch ()
        W_RocketPropelledChainsaw_Explode();
 }
 
-void W_RocketPropelledChainsaw_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if (self.health <= 0)
+void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if (this.health <= 0)
                return;
 
-       if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+       if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
+       this.health = this.health - damage;
 
-       if (self.health <= 0)
-               W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode);
+       if (this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
 }
 
 void W_RocketPropelledChainsaw_Think()
index 6fbe77bce4443ad9f639d2e5ba93f53da5ddf82b..b473e8fc98534509f7153aa1a879ef4e8672accc 100644 (file)
@@ -78,13 +78,13 @@ void physical_item_touch()
        }
 }
 
-void physical_item_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(!self.cnt) // not for dropped items
+void physical_item_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(!this.cnt) // not for dropped items
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
        {
-               setorigin(self, self.spawn_origin);
-               self.angles = self.spawn_angles;
+               setorigin(this, this.spawn_origin);
+               this.angles = this.spawn_angles;
        }
 }
 
index 0710a49d08f69fc635da4442f3a35a6b9c948bbf..f4b82ef12f75fc95a2817e35eef2fa9b49d22615 100644 (file)
@@ -1126,10 +1126,10 @@ void WaypointSprite_ClearOwned()
     WaypointSprite_Kill(self.waypointsprite_attached);
 }
 
-void WaypointSprite_PlayerDead()
-{SELFPARAM();
-    WaypointSprite_Disown(self.waypointsprite_attached, waypointsprite_deadlifetime);
-    WaypointSprite_DetachCarrier(self);
+void WaypointSprite_PlayerDead(entity this)
+{
+    WaypointSprite_Disown(this.waypointsprite_attached, waypointsprite_deadlifetime);
+    WaypointSprite_DetachCarrier(this);
 }
 
 void WaypointSprite_PlayerGone()
index 4e3ceb0e5749d3e14e74d0e99b852a8dbb198e29..b299f7fbedd2217a96312a4eefdaf066a047206e 100644 (file)
@@ -227,7 +227,7 @@ void WaypointSprite_ClearPersonal();
 
 void WaypointSprite_ClearOwned();
 
-void WaypointSprite_PlayerDead();
+void WaypointSprite_PlayerDead(entity this);
 
 void WaypointSprite_PlayerGone();
 #endif
index b832465464ffd7496c273dd3b70214d84d7c8295..dc455944cd86b24cea1f8b9ff5ba33ef267ac270 100644 (file)
@@ -93,16 +93,14 @@ void _Movetype_PushMove(entity this, float dt)  // SV_PushMove
                        if (check.move_movetype == 32)  // MOVETYPE_PHYSICS
                        {
                                check.move_origin = check.move_origin + move;
-                               WITH(entity, this, check, _Movetype_LinkEdict(this, true));
+                               _Movetype_LinkEdict(check, true);
                                continue;
                        }
 
                        // try moving the contacted entity
                        this.solid = SOLID_NOT;
                        bool flag = false;
-                       WITH(entity, this, check, {
-                               flag = _Movetype_PushEntity(this, move, true);
-                       });
+                       flag = _Movetype_PushEntity(check, move, true);
                        if (!flag)
                        {
                                // entity "check" got teleported
index 8cbbbb339d082e11ceb604ad2c08fc5c1603e1e4..4d601d4e1045e4672ff6b0a90afa4ce245eca38d 100644 (file)
@@ -1014,10 +1014,10 @@ float commodity_pickupevalfunc(entity player, entity item)
        return item.bot_pickupbasevalue * c;
 }
 
-void Item_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
-               RemoveItem();
+               WITH(entity, self, this, RemoveItem());
 }
 
 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
index e43e0e4c4137864024b9640e7de0d32cfccc28b3..e3c74b35626ba894f03335c432b91b64ecf4a38b 100644 (file)
@@ -41,7 +41,7 @@
 //   Otherwise mdl_dead will be displayed at the map origin, and nobody would
 //   want that!
 
-void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
+void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 
 //
 // func_breakable
@@ -226,42 +226,42 @@ void func_breakable_destroy()
        self.message = oldmsg;
 }
 
-void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.state == 1)
+void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.state == 1)
                return;
-       if(self.spawnflags & DOOR_NOSPLASH)
+       if(this.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
-       if(self.team)
-               if(attacker.team == self.team)
+       if(this.team)
+               if(attacker.team == this.team)
                        return;
-       self.pain_finished = time;
-       self.health = self.health - damage;
-       if(self.sprite)
+       this.pain_finished = time;
+       this.health = this.health - damage;
+       if(this.sprite)
        {
-               WaypointSprite_Ping(self.sprite);
-               WaypointSprite_UpdateHealth(self.sprite, self.health);
+               WaypointSprite_Ping(this.sprite);
+               WaypointSprite_UpdateHealth(this.sprite, this.health);
        }
-       func_breakable_colormod();
+       WITH(entity, self, this, func_breakable_colormod());
 
-       if(self.health <= 0)
+       if(this.health <= 0)
        {
                debrisforce = force;
 
-               self.takedamage = DAMAGE_NO;
-               self.event_damage = func_null;
+               this.takedamage = DAMAGE_NO;
+               this.event_damage = func_null;
 
-               if(IS_CLIENT(attacker) && self.classname == "func_assault_destructible")
+               if(IS_CLIENT(attacker) && this.classname == "func_assault_destructible")
                {
-                       self.owner = attacker;
-                       self.realowner = attacker;
+                       this.owner = attacker;
+                       this.realowner = attacker;
                }
 
                // do not explode NOW but in the NEXT FRAME!
                // because recursive calls to RadiusDamage are not allowed
-               self.nextthink = time;
-               self.think = func_breakable_destroy;
+               this.nextthink = time;
+               this.think = func_breakable_destroy;
        }
 }
 
index 0e2252130c381701fa2277947166093e7915f065..41cdb44dafc3237fb9063bd5aafffce77cb1f314 100644 (file)
@@ -83,16 +83,16 @@ void button_touch()
        button_fire ();
 }
 
-void button_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.spawnflags & DOOR_NOSPLASH)
+void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
-       self.health = self.health - damage;
-       if (self.health <= 0)
+       this.health = this.health - damage;
+       if (this.health <= 0)
        {
-               self.enemy = damage_attacker;
-               button_fire ();
+               this.enemy = damage_attacker;
+               WITH(entity, self, this, button_fire());
        }
 }
 
index 99ee91f827c0673f4496244eab15704853ab897d..1bd36df4bf0957ae6e6e27a0178e6753d8e85eef 100644 (file)
@@ -272,24 +272,24 @@ void door_use()
        }
 }
 
-void door_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.spawnflags & DOOR_NOSPLASH)
+void door_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
-       self.health = self.health - damage;
+       this.health = this.health - damage;
 
-       if (self.itemkeys)
+       if (this.itemkeys)
        {
                // don't allow opening doors through damage if keys are required
                return;
        }
 
-       if (self.health <= 0)
+       if (this.health <= 0)
        {
-               self.owner.health = self.owner.max_health;
-               self.owner.takedamage = DAMAGE_NO;      // wil be reset upon return
-               WITH(entity, self, self.owner, door_use());
+               this.owner.health = this.owner.max_health;
+               this.owner.takedamage = DAMAGE_NO;      // wil be reset upon return
+               WITH(entity, self, this.owner, door_use());
        }
 }
 
index 3fabc3fb1d0939f3b66786e1f2e389ac3a8f8c7e..e32ed7e50c308c66627c434bc8eebfaf66bc081a 100644 (file)
@@ -63,9 +63,9 @@ void fd_secret_use()
                _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
 }
 
-void fd_secret_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
-       fd_secret_use();
+       WITH(entity, self, this, fd_secret_use());
 }
 
 // Wait after first movement...
index fd3917d33be3fec7fa623f27b18c0066d4dca30a..500f8f32f8f5f251d13bbedccd0f16c45d23ca84 100644 (file)
@@ -99,19 +99,19 @@ void multi_touch()
        multi_trigger ();
 }
 
-void multi_eventdamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if (!self.takedamage)
+void multi_eventdamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(!this.takedamage)
                return;
-       if(self.spawnflags & DOOR_NOSPLASH)
+       if(this.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
-       self.health = self.health - damage;
-       if (self.health <= 0)
+       this.health = this.health - damage;
+       if (this.health <= 0)
        {
-               self.enemy = attacker;
-               self.goalentity = inflictor;
-               multi_trigger();
+               this.enemy = attacker;
+               this.goalentity = inflictor;
+               WITH(entity, self, this, multi_trigger());
        }
 }
 
index 9fac6c79fe70c0ff031e24bd64b899aa3ff6d9c6..bbd9c990a5c2a238cad410da4195319ce7f35882 100644 (file)
@@ -207,17 +207,17 @@ void turret_die()
        }
 }
 
-void turret_damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
-{SELFPARAM();
+void turret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
+{
        // Enough already!
-       if(self.deadflag == DEAD_DEAD)
+       if(this.deadflag == DEAD_DEAD)
                return;
 
        // Inactive turrets take no damage. (hm..)
-       if(!self.active)
+       if(!this.active)
                return;
 
-       if(SAME_TEAM(self, attacker))
+       if(SAME_TEAM(this, attacker))
        {
                if(autocvar_g_friendlyfire)
                        damage = damage * autocvar_g_friendlyfire;
@@ -225,30 +225,30 @@ void turret_damage (entity inflictor, entity attacker, float damage, int deathty
                        return;
        }
 
-       self.health -= damage;
+       this.health -= damage;
 
        // thorw head slightly off aim when hit?
-       if (self.damage_flags & TFL_DMG_HEADSHAKE)
+       if (this.damage_flags & TFL_DMG_HEADSHAKE)
        {
-               self.tur_head.angles_x = self.tur_head.angles_x + (-0.5 + random()) * damage;
-               self.tur_head.angles_y = self.tur_head.angles_y + (-0.5 + random()) * damage;
+               this.tur_head.angles_x = this.tur_head.angles_x + (-0.5 + random()) * damage;
+               this.tur_head.angles_y = this.tur_head.angles_y + (-0.5 + random()) * damage;
 
-               self.SendFlags  |= TNSF_ANG;
+               this.SendFlags  |= TNSF_ANG;
        }
 
-       if (self.turret_flags & TUR_FLAG_MOVE)
-               self.velocity = self.velocity + vforce;
+       if (this.turret_flags & TUR_FLAG_MOVE)
+               this.velocity = this.velocity + vforce;
 
-       if (self.health <= 0)
+       if (this.health <= 0)
        {
-               self.event_damage                 = func_null;
-               self.tur_head.event_damage = func_null;
-               self.takedamage                  = DAMAGE_NO;
-               self.nextthink = time;
-               self.think = turret_die;
+               this.event_damage                 = func_null;
+               this.tur_head.event_damage = func_null;
+               this.takedamage                  = DAMAGE_NO;
+               this.nextthink = time;
+               this.think = turret_die;
        }
 
-       self.SendFlags  |= TNSF_STATUS;
+       this.SendFlags  |= TNSF_STATUS;
 }
 
 void() turret_think;
@@ -449,13 +449,13 @@ void turret_projectile_touch()
        turret_projectile_explode();
 }
 
-void turret_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
-{SELFPARAM();
-       self.velocity  += vforce;
-       self.health     -= damage;
-       //self.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
-       if(self.health <= 0)
-               W_PrepareExplosionByDamage(self.owner, turret_projectile_explode);
+void turret_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
+{
+       this.velocity  += vforce;
+       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));
 }
 
 entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
index 05f2b77ed4a52c576b776275e8f3536916176d51..339e997b7455a1ac96882c686d2c14e6efa02c41 100644 (file)
@@ -105,13 +105,13 @@ void walker_rocket_explode()
     remove (self);
 }
 
-void walker_rocket_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
-{SELFPARAM();
-    self.health = self.health - damage;
-    self.velocity = self.velocity + vforce;
+void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
+{
+    this.health = this.health - damage;
+    this.velocity = this.velocity + vforce;
 
-    if (self.health <= 0)
-        W_PrepareExplosionByDamage(self.owner, walker_rocket_explode);
+    if (this.health <= 0)
+        WITH(entity, self, 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 dc57e259f9b9cf78268ec4448c2bd6c1d45af253..391ce9984758880a31c3b7b41ac07a9e2e308580 100644 (file)
@@ -196,20 +196,20 @@ vector vehicles_force_fromtag_maglev(entity this, string tag_name, float spring_
 }
 
 // projectile handling
-void vehicles_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void vehicles_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
        // Ignore damage from oterh projectiles from my owner (dont mess up volly's)
-       if(inflictor.owner == self.owner)
+       if(inflictor.owner == this.owner)
                return;
 
-       self.health -= damage;
-       self.velocity += force;
-       if(self.health < 1)
+       this.health -= damage;
+       this.velocity += force;
+       if(this.health < 1)
        {
-               self.takedamage = DAMAGE_NO;
-               self.event_damage = func_null;
-               self.think = self.use;
-               self.nextthink = time;
+               this.takedamage = DAMAGE_NO;
+               this.event_damage = func_null;
+               this.think = this.use;
+               this.nextthink = time;
        }
 }
 
@@ -634,9 +634,9 @@ void vehicles_frame(entity this, entity actor)
        vehicles_painframe(this);
 }
 
-void vehicles_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       self.dmg_time = time;
+void vehicles_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       this.dmg_time = time;
 
        // WEAPONTODO
        if(DEATH_ISWEAPON(deathtype, WEP_VORTEX))
@@ -657,74 +657,74 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, int deatht
        if(DEATH_WEAPONOF(deathtype) != WEP_Null)
                damage *= autocvar_g_vehicles_weapon_damagerate;
 
-       self.enemy = attacker;
+       this.enemy = attacker;
 
-       self.pain_finished = time;
+       this.pain_finished = time;
 
-       if((self.vehicle_flags & VHF_HASSHIELD) && (self.vehicle_shield > 0))
+       if((this.vehicle_flags & VHF_HASSHIELD) && (this.vehicle_shield > 0))
        {
-               if (wasfreed(self.vehicle_shieldent) || self.vehicle_shieldent == world)
+               if (wasfreed(this.vehicle_shieldent) || this.vehicle_shieldent == world)
                {
-                       self.vehicle_shieldent = spawn();
-                       self.vehicle_shieldent.effects = EF_LOWPRECISION;
-
-                       setmodel(self.vehicle_shieldent, MDL_VEH_SHIELD);
-                       setattachment(self.vehicle_shieldent, self, "");
-                       setorigin(self.vehicle_shieldent, real_origin(self) - self.origin);
-                       self.vehicle_shieldent.scale       = 256 / vlen(self.maxs - self.mins);
-                       self.vehicle_shieldent.think       = shieldhit_think;
+                       this.vehicle_shieldent = spawn();
+                       this.vehicle_shieldent.effects = EF_LOWPRECISION;
+
+                       setmodel(this.vehicle_shieldent, MDL_VEH_SHIELD);
+                       setattachment(this.vehicle_shieldent, this, "");
+                       setorigin(this.vehicle_shieldent, real_origin(this) - this.origin);
+                       this.vehicle_shieldent.scale       = 256 / vlen(this.maxs - this.mins);
+                       this.vehicle_shieldent.think       = shieldhit_think;
                }
 
-               self.vehicle_shieldent.colormod = '1 1 1';
-               self.vehicle_shieldent.alpha = 0.45;
-               self.vehicle_shieldent.angles = vectoangles(normalize(hitloc - (self.origin + self.vehicle_shieldent.origin))) - self.angles;
-               self.vehicle_shieldent.nextthink = time;
-               self.vehicle_shieldent.effects &= ~EF_NODRAW;
+               this.vehicle_shieldent.colormod = '1 1 1';
+               this.vehicle_shieldent.alpha = 0.45;
+               this.vehicle_shieldent.angles = vectoangles(normalize(hitloc - (this.origin + this.vehicle_shieldent.origin))) - this.angles;
+               this.vehicle_shieldent.nextthink = time;
+               this.vehicle_shieldent.effects &= ~EF_NODRAW;
 
-               self.vehicle_shield -= damage;
+               this.vehicle_shield -= damage;
 
-               if(self.vehicle_shield < 0)
+               if(this.vehicle_shield < 0)
                {
-                       self.vehicle_health -= fabs(self.vehicle_shield);
-                       self.vehicle_shieldent.colormod = '2 0 0';
-                       self.vehicle_shield = 0;
-                       self.vehicle_shieldent.alpha = 0.75;
+                       this.vehicle_health -= fabs(this.vehicle_shield);
+                       this.vehicle_shieldent.colormod = '2 0 0';
+                       this.vehicle_shield = 0;
+                       this.vehicle_shieldent.alpha = 0.75;
 
                        if(sound_allowed(MSG_BROADCAST, attacker))
-                               spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM);   // FIXME: PLACEHOLDER
+                               spamsound (this, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM);   // FIXME: PLACEHOLDER
                }
                else
                        if(sound_allowed(MSG_BROADCAST, attacker))
-                               spamsound (self, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
+                               spamsound (this, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
 
        }
        else
        {
-               self.vehicle_health -= damage;
+               this.vehicle_health -= damage;
 
                if(sound_allowed(MSG_BROADCAST, attacker))
-                       spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
+                       spamsound (this, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
        }
 
-       if(self.damageforcescale < 1 && self.damageforcescale > 0)
-               self.velocity += force * self.damageforcescale;
+       if(this.damageforcescale < 1 && this.damageforcescale > 0)
+               this.velocity += force * this.damageforcescale;
        else
-               self.velocity += force;
+               this.velocity += force;
 
-       if(self.vehicle_health <= 0)
+       if(this.vehicle_health <= 0)
        {
-               if(self.owner)
-                       if(self.vehicle_flags & VHF_DEATHEJECT)
-                               vehicles_exit(VHEF_EJECT);
+               if(this.owner)
+                       if(this.vehicle_flags & VHF_DEATHEJECT)
+                               WITH(entity, self, this, vehicles_exit(VHEF_EJECT));
                        else
-                               vehicles_exit(VHEF_RELEASE);
+                               WITH(entity, self, this, vehicles_exit(VHEF_RELEASE));
 
 
-               antilag_clear(self);
+               antilag_clear(this);
 
-               Vehicle info = Vehicles_from(self.vehicleid);
-               info.vr_death(info, self);
-               vehicles_setreturn(self);
+               Vehicle info = Vehicles_from(this.vehicleid);
+               info.vr_death(info, this);
+               vehicles_setreturn(this);
        }
 }
 
index 9af91bf51f871934aa52cdcaa4aa1b937580902a..202be527fbd1bc8ef5d1646407b637269a9313db 100644 (file)
@@ -106,7 +106,7 @@ float autocvar_g_vehicle_raptor_flare_chase;
 float autocvar_g_vehicle_raptor_flare_range;
 
 void raptor_flare_think();
-void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
+void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 void raptor_flare_touch();
 
 METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
@@ -237,11 +237,11 @@ void raptor_flare_touch()
     remove(self);
 }
 
-void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-    self.health -= damage;
-    if(self.health <= 0)
-        remove(self);
+void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+    this.health -= damage;
+    if(this.health <= 0)
+        remove(this);
 }
 
 void raptor_flare_think()
index f334f2a2b5fb9c1afc5a0f830abc642e42868c02..d714acab485e008263a3dd7b2dd212d0349f26b3 100644 (file)
@@ -332,19 +332,19 @@ void W_Devastator_Touch()
        W_Devastator_Explode();
 }
 
-void W_Devastator_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
-       self.angles = vectoangles(self.velocity);
+       this.health = this.health - damage;
+       this.angles = vectoangles(this.velocity);
 
-       if(self.health <= 0)
-               W_PrepareExplosionByDamage(attacker, W_Devastator_Explode);
+       if(this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
 }
 
 void W_Devastator_Attack(Weapon thiswep)
index fd1f74ecd302458770fa12d68a9d02c4316e544c..d766e6a8741df661e7fc874cd40646fadd4a206a 100644 (file)
@@ -306,34 +306,34 @@ void W_Electro_Orb_Touch()
        }
 }
 
-void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
        // note: combos are usually triggered by W_Electro_TriggerCombo, not damage
        float is_combo = (inflictor.classname == "electro_orb_chain" || inflictor.classname == "electro_bolt");
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_combo ? 1 : -1)))
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_combo ? 1 : -1)))
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
-       if(self.health <= 0)
+       this.health = this.health - damage;
+       if(this.health <= 0)
        {
-               self.takedamage = DAMAGE_NO;
-               self.nextthink = time;
+               this.takedamage = DAMAGE_NO;
+               this.nextthink = time;
                if(is_combo)
                {
                        // change owner to whoever caused the combo explosion
-                       self.realowner = inflictor.realowner;
-                       self.classname = "electro_orb_chain";
-                       self.think = W_Electro_ExplodeCombo;
-                       self.nextthink = time +
+                       this.realowner = inflictor.realowner;
+                       this.classname = "electro_orb_chain";
+                       this.think = W_Electro_ExplodeCombo;
+                       this.nextthink = time +
                                (
                                        // bound the length, inflictor may be in a galaxy far far away (warpzones)
                                        min(
                                                WEP_CVAR(electro, combo_radius),
-                                               vlen(self.origin - inflictor.origin)
+                                               vlen(this.origin - inflictor.origin)
                                        )
                                        /
                                        // delay combo chains, looks cooler
@@ -342,8 +342,8 @@ void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int d
                }
                else
                {
-                       self.use = W_Electro_Explode;
-                       self.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
+                       this.use = W_Electro_Explode;
+                       this.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
                }
        }
 }
index 2beeb69a12dbc75c174a76c307cca254939b0e7e..f39ad474a3820d2946fe20cf978984240f1276b8 100644 (file)
@@ -167,19 +167,19 @@ void W_Fireball_Think()
        self.nextthink = time + 0.1;
 }
 
-void W_Fireball_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
-       if(self.health <= 0)
+       this.health = this.health - damage;
+       if(this.health <= 0)
        {
-               self.cnt = 1;
-               W_PrepareExplosionByDamage(attacker, W_Fireball_Explode);
+               this.cnt = 1;
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
        }
 }
 
index 611097e90d02c8cb712dc781869d69ce6c9c8b70..ff6088f8f35b3d44c7902892b415e27f005dacad 100644 (file)
@@ -79,28 +79,28 @@ void W_Hagar_Explode2()
        remove(self);
 }
 
-void W_Hagar_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == self.owner) : true)
+       float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == this.owner) : true)
                && (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
-               && (self.projectiledeathtype & HITTYPE_SECONDARY));
+               && (this.projectiledeathtype & HITTYPE_SECONDARY));
 
        if(is_linkexplode)
                is_linkexplode = (is_linkexplode && WEP_CVAR_SEC(hagar, load_linkexplode));
        else
                is_linkexplode = -1; // not secondary load, so continue as normal without exception.
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, is_linkexplode))
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, is_linkexplode))
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
-       self.angles = vectoangles(self.velocity);
+       this.health = this.health - damage;
+       this.angles = vectoangles(this.velocity);
 
-       if(self.health <= 0)
-               W_PrepareExplosionByDamage(attacker, self.think);
+       if(this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
 }
 
 void W_Hagar_Touch()
index d059746f136b26bc4cadf2f81d8125e198c4ca0e..8fc13f9e1c40f317cbc861c356f233ced4b2ea56 100644 (file)
@@ -118,18 +118,18 @@ void W_Hook_Explode2()
        self.movetype = MOVETYPE_NONE;
 }
 
-void W_Hook_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
+       this.health = this.health - damage;
 
-       if(self.health <= 0)
-               W_PrepareExplosionByDamage(self.realowner, W_Hook_Explode2);
+       if(this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
 }
 
 void W_Hook_Touch2()
index 029ce460f91b6f765082e23feb462d7c09e0fa87..f9c43f62d77297db54ae87e931520bd18eb3c659 100644 (file)
@@ -294,21 +294,21 @@ void W_MineLayer_Touch()
        }
 }
 
-void W_MineLayer_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       float is_from_enemy = (inflictor.realowner != self.realowner);
+       float is_from_enemy = (inflictor.realowner != this.realowner);
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_from_enemy ? 1 : -1)))
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_from_enemy ? 1 : -1)))
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
-       self.angles = vectoangles(self.velocity);
+       this.health = this.health - damage;
+       this.angles = vectoangles(this.velocity);
 
-       if(self.health <= 0)
-               W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode);
+       if(this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
 }
 
 void W_MineLayer_Attack(Weapon thiswep)
index a19f38dc0ba1dd8e1041e64cc9896e00be0d00d9..b361a505091adad8c4ee0ee2e23b1f470d72bca4 100644 (file)
@@ -105,18 +105,18 @@ void W_Mortar_Grenade_Explode2()
 }
 
 
-void W_Mortar_Grenade_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
+       this.health = this.health - damage;
 
-       if(self.health <= 0)
-               W_PrepareExplosionByDamage(attacker, self.use);
+       if(this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
 }
 
 void W_Mortar_Grenade_Think1()
index c777562e4d99808e01a93923ba19d515469e4138..98fe8c8f7070344628cee4f73d715f11ab984aff 100644 (file)
@@ -206,21 +206,21 @@ void W_Seeker_Missile_Think()
 
 
 
-void W_Seeker_Missile_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       if(self.realowner == attacker)
-               self.health = self.health - (damage * 0.25);
+       if(this.realowner == attacker)
+               this.health = this.health - (damage * 0.25);
        else
-               self.health = self.health - damage;
+               this.health = this.health - damage;
 
-       if(self.health <= 0)
-               W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode);
+       if(this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
 }
 
 /*
@@ -477,22 +477,22 @@ void W_Seeker_Tracker_Think()
 // ============================
 // Begin: Tag projectile
 // ============================
-void W_Seeker_Tag_Explode()
-{SELFPARAM();
-       //if(other==self.realowner)
+void W_Seeker_Tag_Explode(entity this)
+{
+       //if(other==this.realowner)
        //    return;
-       Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, self);
+       Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, this);
 
-       remove(self);
+       remove(this);
 }
 
-void W_Seeker_Tag_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
-       self.health = self.health - damage;
-       if(self.health <= 0)
-               W_Seeker_Tag_Explode();
+       this.health = this.health - damage;
+       if(this.health <= 0)
+               W_Seeker_Tag_Explode(this);
 }
 
 void W_Seeker_Tag_Touch()
index 9230f0c248a2617fd165e06e6c61a012611d9937..d211e0f384347a562839778a2a91e7870820aee5 100644 (file)
@@ -209,7 +209,7 @@ void PutObserverInServer()
        if(self.vehicle)
                vehicles_exit(VHEF_RELEASE);
 
-       WaypointSprite_PlayerDead();
+       WaypointSprite_PlayerDead(self);
 
        if(!mutator_returnvalue)  // mutator prevents resetting teams
                self.team = -1;  // move this as it is needed to log the player spectating in eventlog
@@ -731,21 +731,21 @@ Called when a client types 'kill' in the console
 */
 
 .float clientkill_nexttime;
-void ClientKill_Now_TeamChange()
-{SELFPARAM();
-       if(self.killindicator_teamchange == -1)
+void ClientKill_Now_TeamChange(entity this)
+{
+       if(this.killindicator_teamchange == -1)
        {
-               JoinBestTeam( self, false, true );
+               JoinBestTeam( this, false, true );
        }
-       else if(self.killindicator_teamchange == -2)
+       else if(this.killindicator_teamchange == -2)
        {
                if(blockSpectators)
-                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
-               PutObserverInServer();
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
+               WITH(entity, self, this, PutObserverInServer());
        }
        else
-               SV_ChangeTeam(self.killindicator_teamchange - 1);
-       self.killindicator_teamchange = 0;
+               WITH(entity, self, this, SV_ChangeTeam(this.killindicator_teamchange - 1));
+       this.killindicator_teamchange = 0;
 }
 
 void ClientKill_Now()
@@ -766,7 +766,7 @@ void ClientKill_Now()
        self.killindicator = world;
 
        if(self.killindicator_teamchange)
-               ClientKill_Now_TeamChange();
+               ClientKill_Now_TeamChange(self);
 
        if(IS_PLAYER(self))
                Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
@@ -1552,7 +1552,7 @@ void player_regen ()
                if(self.vehicle)
                        vehicles_exit(VHEF_RELEASE);
                if(self.event_damage)
-                       self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+                       self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
        }
 
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -2195,7 +2195,7 @@ void PlayerPreThink ()
                {
                        if(self.vehicle)
                                vehicles_exit(VHEF_RELEASE);
-                       self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
+                       self.event_damage(self, self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
                }
                else if ( self.revive_progress <= 0 )
                        Unfreeze(self);
index 57204e1d486a9d4c6b3309ebc8ce5d45c97746a0..c6b0359c4ee89bd20f3b05de8df71eae2c251f7f 100644 (file)
@@ -157,55 +157,55 @@ void player_anim ()
        animdecide_setimplicitstate(self, (IS_ONGROUND(self)));
 }
 
-void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
        float take, save;
        vector v;
-       Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
+       Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
        // damage resistance (ignore most of the damage from a bullet or similar)
        damage = max(damage - 5, 1);
 
-       v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
+       v = healtharmor_applydamage(this.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
        take = v.x;
        save = v.y;
 
        if(sound_allowed(MSG_BROADCAST, attacker))
        {
                if (save > 10)
-                       sound (self, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM);
+                       sound (this, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM);
                else if (take > 30)
-                       sound (self, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM);
+                       sound (this, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM);
                else if (take > 10)
-                       sound (self, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM);
+                       sound (this, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM);
        }
 
        if (take > 50)
-               Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, self, attacker);
+               Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, this, attacker);
        if (take > 100)
-               Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, self, attacker);
+               Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
 
-       self.armorvalue = self.armorvalue - save;
-       self.health = self.health - take;
+       this.armorvalue = this.armorvalue - save;
+       this.health = this.health - take;
        // pause regeneration for 5 seconds
-       self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
+       this.pauseregen_finished = max(this.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
 
-       self.dmg_save = self.dmg_save + save;//max(save - 10, 0);
-       self.dmg_take = self.dmg_take + take;//max(take - 10, 0);
-       self.dmg_inflictor = inflictor;
+       this.dmg_save = this.dmg_save + save;//max(save - 10, 0);
+       this.dmg_take = this.dmg_take + take;//max(take - 10, 0);
+       this.dmg_inflictor = inflictor;
 
-       if (self.health <= -autocvar_sv_gibhealth && self.alpha >= 0)
+       if (this.health <= -autocvar_sv_gibhealth && this.alpha >= 0)
        {
                // don't use any animations as a gib
-               self.frame = 0;
+               this.frame = 0;
                // view just above the floor
-               self.view_ofs = '0 0 4';
+               this.view_ofs = '0 0 4';
 
-               Violence_GibSplash(self, 1, 1, attacker);
-               self.alpha = -1;
-               self.solid = SOLID_NOT; // restore later
-               self.takedamage = DAMAGE_NO; // restore later
-               self.damagedbycontents = false;
+               Violence_GibSplash(this, 1, 1, attacker);
+               this.alpha = -1;
+               this.solid = SOLID_NOT; // restore later
+               this.takedamage = DAMAGE_NO; // restore later
+               this.damagedbycontents = false;
        }
 }
 
@@ -295,20 +295,20 @@ void calculate_player_respawn_time(entity this)
                this.respawn_flags = this.respawn_flags | RESPAWN_FORCE;
 }
 
-void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
        float take, save, dh, da;
        vector v;
        float valid_damage_for_weaponstats;
        float excess;
 
-       dh = max(self.health, 0);
-       da = max(self.armorvalue, 0);
+       dh = max(this.health, 0);
+       da = max(this.armorvalue, 0);
 
        if(!DEATH_ISSPECIAL(deathtype))
        {
-               damage *= sqrt(bound(1.0, self.cvar_cl_handicap, 100.0));
-               if(self != attacker)
+               damage *= sqrt(bound(1.0, this.cvar_cl_handicap, 100.0));
+               if(this != attacker)
                        damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0));
        }
 
@@ -318,20 +318,20 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                vector ear1, ear2;
                vector d;
                float f;
-               ear1 = self.origin;
-               ear1_z += 0.125 * self.view_ofs.z + 0.875 * self.maxs.z; // 7/8
+               ear1 = this.origin;
+               ear1_z += 0.125 * this.view_ofs.z + 0.875 * this.maxs.z; // 7/8
                ear2 = ear1;
-               makevectors(self.angles);
+               makevectors(this.angles);
                ear1 += v_right * -10;
                ear2 += v_right * +10;
-               d = inflictor.origin - self.origin;
+               d = inflictor.origin - this.origin;
                if (d)
                        f = (d * v_right) / vlen(d); // this is cos of angle of d and v_right!
                else
                        f = 0;  // Assum ecenter.
                force = v_right * vlen(force);
-               Violence_GibSplash_At(ear1, force * -1, 2, bound(0, damage, 25) / 2 * (0.5 - 0.5 * f), self, attacker);
-               Violence_GibSplash_At(ear2, force,      2, bound(0, damage, 25) / 2 * (0.5 + 0.5 * f), self, attacker);
+               Violence_GibSplash_At(ear1, force * -1, 2, bound(0, damage, 25) / 2 * (0.5 - 0.5 * f), this, attacker);
+               Violence_GibSplash_At(ear2, force,      2, bound(0, damage, 25) / 2 * (0.5 + 0.5 * f), this, attacker);
                if(f > 0)
                {
                        hitloc = ear1;
@@ -344,140 +344,140 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                }
        }
        else
-               Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
+               Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
 
-       v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
+       v = healtharmor_applydamage(this.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
        take = v.x;
        save = v.y;
 
-       if(attacker == self)
+       if(attacker == this)
        {
-               // don't reset pushltime for self damage as it may be an attempt to
+               // don't reset pushltime for this damage as it may be an attempt to
                // escape a lava pit or similar
-               //self.pushltime = 0;
-               self.istypefrag = 0;
+               //this.pushltime = 0;
+               this.istypefrag = 0;
        }
        else if(IS_PLAYER(attacker))
        {
-               self.pusher = attacker;
-               self.pushltime = time + autocvar_g_maxpushtime;
-               self.istypefrag = self.BUTTON_CHAT;
+               this.pusher = attacker;
+               this.pushltime = time + autocvar_g_maxpushtime;
+               this.istypefrag = this.BUTTON_CHAT;
        }
-       else if(time < self.pushltime)
+       else if(time < this.pushltime)
        {
-               attacker = self.pusher;
-               self.pushltime = max(self.pushltime, time + 0.6);
+               attacker = this.pusher;
+               this.pushltime = max(this.pushltime, time + 0.6);
        }
        else
        {
-               self.pushltime = 0;
-               self.istypefrag = 0;
+               this.pushltime = 0;
+               this.istypefrag = 0;
        }
 
        frag_damage = damage;
-       MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, self, force, take, save);
-       take = bound(0, damage_take, self.health);
-       save = bound(0, damage_save, self.armorvalue);
+       MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, this, force, take, save);
+       take = bound(0, damage_take, this.health);
+       save = bound(0, damage_save, this.armorvalue);
        excess = max(0, damage - take - save);
 
        if(sound_allowed(MSG_BROADCAST, attacker))
        {
                if (save > 10)
-                       sound (self, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM);
+                       sound (this, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM);
                else if (take > 30)
-                       sound (self, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM);
+                       sound (this, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM);
                else if (take > 10)
-                       sound (self, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); // FIXME possibly remove them?
+                       sound (this, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); // FIXME possibly remove them?
        }
 
        if (take > 50)
-               Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, self, attacker);
+               Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, this, attacker);
        if (take > 100)
-               Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, self, attacker);
+               Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
 
-       if (time >= self.spawnshieldtime)
+       if (time >= this.spawnshieldtime)
        {
-               if (!(self.flags & FL_GODMODE))
+               if (!(this.flags & FL_GODMODE))
                {
-                       self.armorvalue = self.armorvalue - save;
-                       self.health = self.health - take;
+                       this.armorvalue = this.armorvalue - save;
+                       this.health = this.health - take;
                        // pause regeneration for 5 seconds
                        if(take)
-                               self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
+                               this.pauseregen_finished = max(this.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
 
-                       if (time > self.pain_finished)          //Don't switch pain sequences like crazy
+                       if (time > this.pain_finished)          //Don't switch pain sequences like crazy
                        {
-                               self.pain_finished = time + 0.5;        //Supajoe
+                               this.pain_finished = time + 0.5;        //Supajoe
 
                                if(autocvar_sv_gentle < 1) {
-                                       if(self.classname != "body") // pain anim is BORKED on our ZYMs, FIXME remove this once we have good models
+                                       if(this.classname != "body") // pain anim is BORKED on our ZYMs, FIXME remove this once we have good models
                                        {
-                                               if (!self.animstate_override)
+                                               if (!this.animstate_override)
                                                {
                                                        if (random() > 0.5)
-                                                               animdecide_setaction(self, ANIMACTION_PAIN1, true);
+                                                               animdecide_setaction(this, ANIMACTION_PAIN1, true);
                                                        else
-                                                               animdecide_setaction(self, ANIMACTION_PAIN2, true);
+                                                               animdecide_setaction(this, ANIMACTION_PAIN2, true);
                                                }
                                        }
 
                                        if(sound_allowed(MSG_BROADCAST, attacker))
-                                       if((self.health < 2 * WEP_CVAR_PRI(blaster, damage) * autocvar_g_balance_selfdamagepercent + 1) || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || attacker != self) // WEAPONTODO: create separate limit for pain notification with laser
-                                       if(self.health > 1)
+                                       if((this.health < 2 * WEP_CVAR_PRI(blaster, damage) * autocvar_g_balance_selfdamagepercent + 1) || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || attacker != this) // WEAPONTODO: create separate limit for pain notification with laser
+                                       if(this.health > 1)
                                        // exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two
                                        {
                                                if(deathtype == DEATH_FALL.m_id)
-                                                       PlayerSound(self, playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND);
-                                               else if(self.health > 75) // TODO make a "gentle" version?
-                                                       PlayerSound(self, playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND);
-                                               else if(self.health > 50)
-                                                       PlayerSound(self, playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND);
-                                               else if(self.health > 25)
-                                                       PlayerSound(self, playersound_pain50, CH_PAIN, VOICETYPE_PLAYERSOUND);
+                                                       PlayerSound(this, playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND);
+                                               else if(this.health > 75) // TODO make a "gentle" version?
+                                                       PlayerSound(this, playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND);
+                                               else if(this.health > 50)
+                                                       PlayerSound(this, playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND);
+                                               else if(this.health > 25)
+                                                       PlayerSound(this, playersound_pain50, CH_PAIN, VOICETYPE_PLAYERSOUND);
                                                else
-                                                       PlayerSound(self, playersound_pain25, CH_PAIN, VOICETYPE_PLAYERSOUND);
+                                                       PlayerSound(this, playersound_pain25, CH_PAIN, VOICETYPE_PLAYERSOUND);
                                        }
                                }
                        }
 
                        // throw off bot aim temporarily
                        float shake;
-                       if(IS_BOT_CLIENT(self) && self.health >= 1)
+                       if(IS_BOT_CLIENT(this) && this.health >= 1)
                        {
                                shake = damage * 5 / (bound(0,skill,100) + 1);
-                               self.v_angle_x = self.v_angle.x + (random() * 2 - 1) * shake;
-                               self.v_angle_y = self.v_angle.y + (random() * 2 - 1) * shake;
-                               self.v_angle_x = bound(-90, self.v_angle.x, 90);
+                               this.v_angle_x = this.v_angle.x + (random() * 2 - 1) * shake;
+                               this.v_angle_y = this.v_angle.y + (random() * 2 - 1) * shake;
+                               this.v_angle_x = bound(-90, this.v_angle.x, 90);
                        }
                }
                else
-                       self.max_armorvalue += (save + take);
+                       this.max_armorvalue += (save + take);
        }
-       self.dmg_save = self.dmg_save + save;//max(save - 10, 0);
-       self.dmg_take = self.dmg_take + take;//max(take - 10, 0);
-       self.dmg_inflictor = inflictor;
+       this.dmg_save = this.dmg_save + save;//max(save - 10, 0);
+       this.dmg_take = this.dmg_take + take;//max(take - 10, 0);
+       this.dmg_inflictor = inflictor;
 
-       if (self != attacker) {
+       if (this != attacker) {
                float realdmg = damage - excess;
                if (IS_PLAYER(attacker)) {
                        PlayerScore_Add(attacker, SP_DMG, realdmg);
                }
-               if (IS_PLAYER(self)) {
-                       PlayerScore_Add(self, SP_DMGTAKEN, realdmg);
+               if (IS_PLAYER(this)) {
+                       PlayerScore_Add(this, SP_DMGTAKEN, realdmg);
                }
        }
 
        bool abot = (IS_BOT_CLIENT(attacker));
-       bool vbot = (IS_BOT_CLIENT(self));
+       bool vbot = (IS_BOT_CLIENT(this));
 
        valid_damage_for_weaponstats = 0;
        Weapon awep = WEP_Null;
 
-       if(vbot || IS_REAL_CLIENT(self))
+       if(vbot || IS_REAL_CLIENT(this))
        if(abot || IS_REAL_CLIENT(attacker))
-       if(attacker && self != attacker)
-       if(DIFF_TEAM(self, attacker))
+       if(attacker && this != attacker)
+       if(DIFF_TEAM(this, attacker))
        {
                if(DEATH_ISSPECIAL(deathtype))
                        awep = PS(attacker).m_weapon;
@@ -488,150 +488,150 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
 
        if(valid_damage_for_weaponstats)
        {
-               dh = dh - max(self.health, 0);
-               da = da - max(self.armorvalue, 0);
-               WeaponStats_LogDamage(awep.m_id, abot, PS(self).m_weapon.m_id, vbot, dh + da);
-               MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc, deathtype);
+               dh = dh - max(this.health, 0);
+               da = da - max(this.armorvalue, 0);
+               WeaponStats_LogDamage(awep.m_id, abot, PS(this).m_weapon.m_id, vbot, dh + da);
+               MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype);
        }
 
-       if (self.health < 1)
+       if (this.health < 1)
        {
                float defer_ClientKill_Now_TeamChange;
                defer_ClientKill_Now_TeamChange = false;
 
-               if(self.alivetime)
+               if(this.alivetime)
                {
-                       PS_GR_P_ADDVAL(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
-                       self.alivetime = 0;
+                       PS_GR_P_ADDVAL(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
+                       this.alivetime = 0;
                }
 
                if(valid_damage_for_weaponstats)
-                       WeaponStats_LogKill(awep.m_id, abot, PS(self).m_weapon.m_id, vbot);
+                       WeaponStats_LogKill(awep.m_id, abot, PS(this).m_weapon.m_id, vbot);
 
                if(autocvar_sv_gentle < 1) // TODO make a "gentle" version?
                if(sound_allowed(MSG_BROADCAST, attacker))
                {
                        if(deathtype == DEATH_DROWN.m_id)
-                               PlayerSound(self, playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND);
+                               PlayerSound(this, playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND);
                        else
-                               PlayerSound(self, playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND);
+                               PlayerSound(this, playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND);
                }
 
                // get rid of kill indicator
-               if(self.killindicator)
+               if(this.killindicator)
                {
-                       remove(self.killindicator);
-                       self.killindicator = world;
-                       if(self.killindicator_teamchange)
+                       remove(this.killindicator);
+                       this.killindicator = world;
+                       if(this.killindicator_teamchange)
                                defer_ClientKill_Now_TeamChange = true;
 
-                       if(self.classname == "body")
+                       if(this.classname == "body")
                        if(deathtype == DEATH_KILL.m_id)
                        {
                                // for the lemmings fans, a small harmless explosion
-                               Send_Effect(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
+                               Send_Effect(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
                        }
                }
 
                // print an obituary message
-               if(self.classname != "body")
-                       Obituary (attacker, inflictor, self, deathtype);
+               if(this.classname != "body")
+                       Obituary (attacker, inflictor, this, deathtype);
 
         // increment frag counter for used weapon type
         Weapon w = DEATH_WEAPONOF(deathtype);
         if(w != WEP_Null)
-       if(accuracy_isgooddamage(attacker, self))
+       if(accuracy_isgooddamage(attacker, this))
         attacker.accuracy.(accuracy_frags[w.m_id-1]) += 1;
 
-               MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
+               MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype);
                excess = frag_damage;
 
-               Weapon wep = PS(self).m_weapon;
-               wep.wr_playerdeath(wep);
+               Weapon wep = PS(this).m_weapon;
+               WITH(entity, self, this, wep.wr_playerdeath(wep));
 
-               RemoveGrapplingHook(self);
+               RemoveGrapplingHook(this);
 
-               Portal_ClearAllLater(self);
+               Portal_ClearAllLater(this);
 
-               self.fixangle = true;
+               this.fixangle = true;
 
                if(defer_ClientKill_Now_TeamChange)
-                       ClientKill_Now_TeamChange(); // can turn player into spectator
+                       ClientKill_Now_TeamChange(this); // can turn player into spectator
 
                // player could have been miraculously resuscitated ;)
                // e.g. players in freezetag get frozen, they don't really die
-               if(self.health >= 1 || !(IS_PLAYER(self) || self.classname == "body"))
+               if(this.health >= 1 || !(IS_PLAYER(this) || this.classname == "body"))
                        return;
 
                // when we get here, player actually dies
 
-               Unfreeze(self); // remove any icy remains
-               self.health = 0; // Unfreeze resets health, so we need to set it back
+               Unfreeze(this); // remove any icy remains
+               this.health = 0; // Unfreeze resets health, so we need to set it back
 
                // clear waypoints
-               WaypointSprite_PlayerDead();
+               WaypointSprite_PlayerDead(this);
                // throw a weapon
-               SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, PS(self).m_switchweapon.m_id);
+               SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, PS(this).m_switchweapon.m_id);
 
                // become fully visible
-               self.alpha = default_player_alpha;
+               this.alpha = default_player_alpha;
                // make the corpse upright (not tilted)
-               self.angles_x = 0;
-               self.angles_z = 0;
+               this.angles_x = 0;
+               this.angles_z = 0;
                // don't spin
-               self.avelocity = '0 0 0';
+               this.avelocity = '0 0 0';
                // view from the floor
-               self.view_ofs = '0 0 -8';
+               this.view_ofs = '0 0 -8';
                // toss the corpse
-               self.movetype = MOVETYPE_TOSS;
+               this.movetype = MOVETYPE_TOSS;
                // shootable corpse
-               self.solid = SOLID_CORPSE;
-               self.ballistics_density = autocvar_g_ballistics_density_corpse;
+               this.solid = SOLID_CORPSE;
+               this.ballistics_density = autocvar_g_ballistics_density_corpse;
                // don't stick to the floor
-               UNSET_ONGROUND(self);
+               UNSET_ONGROUND(this);
                // dying animation
-               self.deadflag = DEAD_DYING;
+               this.deadflag = DEAD_DYING;
 
                // when to allow respawn
                calculate_player_respawn_time(this);
 
-               self.death_time = time;
+               this.death_time = time;
                if (random() < 0.5)
-                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD1, true);
+                       animdecide_setstate(this, this.anim_state | ANIMSTATE_DEAD1, true);
                else
-                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD2, true);
-               if (self.maxs.z > 5)
+                       animdecide_setstate(this, this.anim_state | ANIMSTATE_DEAD2, true);
+               if (this.maxs.z > 5)
                {
-                       self.maxs_z = 5;
-                       setsize(self, self.mins, self.maxs);
+                       this.maxs_z = 5;
+                       setsize(this, this.mins, this.maxs);
                }
                // set damage function to corpse damage
-               self.event_damage = PlayerCorpseDamage;
+               this.event_damage = PlayerCorpseDamage;
                // call the corpse damage function just in case it wants to gib
-               self.event_damage(inflictor, attacker, excess, deathtype, hitloc, force);
+               this.event_damage(this, inflictor, attacker, excess, deathtype, hitloc, force);
 
                // set up to fade out later
-               SUB_SetFade (self, time + 6 + random (), 1);
+               SUB_SetFade (this, time + 6 + random (), 1);
                // reset body think wrapper broken by SUB_SetFade
-               if(self.classname == "body" && self.think != CopyBody_Think) {
-                       self.CopyBody_think = self.think;
-                       self.CopyBody_nextthink = self.nextthink;
-                       self.think = CopyBody_Think;
-                       self.nextthink = time;
+               if(this.classname == "body" && this.think != CopyBody_Think) {
+                       this.CopyBody_think = this.think;
+                       this.CopyBody_nextthink = this.nextthink;
+                       this.think = CopyBody_Think;
+                       this.nextthink = time;
                }
 
-               if(autocvar_sv_gentle > 0 || autocvar_ekg || self.classname == "body") {
+               if(autocvar_sv_gentle > 0 || autocvar_ekg || this.classname == "body") {
                        // remove corpse
                        // clones don't run any animation code any more, so we must gib them when they die :(
-                       PlayerCorpseDamage (inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force);
+                       PlayerCorpseDamage(this, inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force);
                }
 
                // reset fields the weapons may use just in case
                FOREACH(Weapons, it != WEP_Null, LAMBDA(
-                       it.wr_resetplayer(it);
+                       WITH(entity, self, this, it.wr_resetplayer(it));
                        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                        {
-                               ATTACK_FINISHED_FOR(self, it.m_id, slot) = 0;
+                               ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
                        }
                ));
        }
index b71a4e2d87641b8e39d3200b22f6f7fcdc5744ff..5ffd93c0b89562f47c66e4e1da1c016ed69b2c9e 100644 (file)
@@ -14,7 +14,7 @@ void player_setupanimsformodel();
 
 void player_anim();
 
-void PlayerCorpseDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
+void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 
 // g_<gametype>_str:
 // If 0, default is used.
@@ -29,11 +29,11 @@ void PlayerCorpseDamage(entity inflictor, entity attacker, float damage, int dea
 
 void calculate_player_respawn_time(entity this);
 
-void ClientKill_Now_TeamChange();
+void ClientKill_Now_TeamChange(entity this);
 
 void MoveToTeam(entity client, float team_colour, float type);
 
-void PlayerDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
+void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 
 /** to be used by `prvm_edictset server playernumber muted 1` */
 .float muted;
index 6fa9b03f6f9be1e0a37e67995c271539971effd5..dd47b86a461e23ad6bf4bc3217164e84e10cbcf7 100644 (file)
@@ -62,7 +62,7 @@ float server_is_dedicated;
 
 // Fields
 
-.void(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
+.void(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
 
 //.string      wad;
 //.string      map;
index 8423032c4c96543660cfa46ec3c04caa1f8e2eac..f064e152b409dc55d0224fd3c6532faea0d102d6 100644 (file)
@@ -862,7 +862,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
        // apply damage
        if (damage != 0 || (self.damageforcescale && vlen(force)))
        if (self.event_damage)
-               self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force);
+               self.event_damage (self, inflictor, attacker, damage, deathtype, hitloc, force);
        setself(this);
 
        // apply mirror damage if any
index e6c583baac580514c54f91bb745d93c7e20c077f..4a32779289d12c54f10da05bb6e357b4c8266a89 100644 (file)
@@ -317,25 +317,25 @@ void GrapplingHookTouch ()
        //self.realowner.disableclientprediction = true;
 }
 
-void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+       if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_balance_projectiledamage says to halt
 
-       self.health = self.health - damage;
+       this.health = this.health - damage;
 
-       if (self.health <= 0)
+       if (this.health <= 0)
        {
-               if(attacker != self.realowner)
+               if(attacker != this.realowner)
                {
-                       self.realowner.pusher = attacker;
-                       self.realowner.pushltime = time + autocvar_g_maxpushtime;
-                       self.realowner.istypefrag = self.realowner.BUTTON_CHAT;
+                       this.realowner.pusher = attacker;
+                       this.realowner.pushltime = time + autocvar_g_maxpushtime;
+                       this.realowner.istypefrag = this.realowner.BUTTON_CHAT;
                }
-               RemoveGrapplingHook(self.realowner);
+               RemoveGrapplingHook(this.realowner);
        }
 }
 
index 93b87ad97952dda59870378e754d990ad55df9f4..00d2716e4b6e287b5bdb2ffd9d2f0555fb203460 100644 (file)
@@ -222,6 +222,7 @@ MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
 
 /** called when a monster dies */
 #define EV_MonsterDies(i, o) \
+    /**/ i(entity, frag_target) \
     /**/ i(entity, frag_attacker) \
     /**/
 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
index 589e172dd7a049b0aa4831c09571dab22c4cde6e..ab7f5760dd398bffcb269de57d1e17d9a3b6dc10 100644 (file)
@@ -998,26 +998,26 @@ void ctf_CheckStalemate()
        }
 }
 
-void ctf_FlagDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
        {
                if(autocvar_g_ctf_flag_return_damage_delay)
                {
-                       self.ctf_flagdamaged = true;
+                       this.ctf_flagdamaged = true;
                }
                else
                {
-                       self.health = 0;
-                       ctf_CheckFlagReturn(self, RETURN_NEEDKILL);
+                       this.health = 0;
+                       ctf_CheckFlagReturn(this, RETURN_NEEDKILL);
                }
                return;
        }
        if(autocvar_g_ctf_flag_return_damage)
        {
                // reduce health and check if it should be returned
-               self.health = self.health - damage;
-               ctf_CheckFlagReturn(self, RETURN_DAMAGE);
+               this.health = this.health - damage;
+               ctf_CheckFlagReturn(this, RETURN_DAMAGE);
                return;
        }
 }
index cd18a51765fd0165b4c2b0c75a460ac768512404..b7730592c03fb680c48cfce3ad123d54405e338c 100644 (file)
@@ -329,15 +329,15 @@ void Invasion_RoundStart()
 }
 
 MUTATOR_HOOKFUNCTION(inv, MonsterDies)
-{SELFPARAM();
-       if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
+{
+       if(!(frag_target.spawnflags & MONSTERFLAG_RESPAWNED))
        {
                inv_numkilled += 1;
                inv_maxcurrent -= 1;
-               if(teamplay) { inv_monsters_perteam[self.team] -= 1; }
+               if(teamplay) { inv_monsters_perteam[frag_target.team] -= 1; }
 
                if(IS_PLAYER(frag_attacker))
-               if(SAME_TEAM(frag_attacker, self)) // in non-teamplay modes, same team = same player, so this works
+               if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works
                        PlayerScore_Add(frag_attacker, SP_KILLS, -1);
                else
                {
index c6b9b4c15d8fc6b580b74e79f1ef112f4d377df7..09a029984c7a2b9fea3f422bdf4fb27d73615a44 100644 (file)
@@ -471,9 +471,9 @@ void kh_Key_AssignTo(entity key, entity player)  // runs every time a key is pic
        }
 }
 
-void kh_Key_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.owner)
+void kh_Key_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.owner)
                return;
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
        {
@@ -484,9 +484,9 @@ void kh_Key_Damage(entity inflictor, entity attacker, float damage, int deathtyp
        }
        if(vlen(force) <= 0)
                return;
-       if(time > self.pushltime)
+       if(time > this.pushltime)
                if(IS_PLAYER(attacker))
-                       self.team = attacker.team;
+                       this.team = attacker.team;
 }
 
 void kh_Key_Collect(entity key, entity player)  //a player picks up a dropped key
index 1b09ac450c7eb80c59946bbe98b6561fa207d4a0..361abcd1128d664c2d2286de40b227aa4fd87fd0 100644 (file)
@@ -428,16 +428,16 @@ void Portal_Remove(entity portal, float killed)
        }
 }
 
-void Portal_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
        if(deathtype == DEATH_TELEFRAG.m_id)
                return;
-       if(attacker != self.aiment)
-               if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(self.aiment))
+       if(attacker != this.aiment)
+               if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(this.aiment))
                        return;
-       self.health -= damage;
-       if(self.health < 0)
-               Portal_Remove(self, 1);
+       this.health -= damage;
+       if(this.health < 0)
+               Portal_Remove(this, 1);
 }
 
 void Portal_Think_TryTeleportPlayer(entity e, vector g)
index 6db0a3d028ba8f92f243c63c24a9c3d53688d015..e36825e4825c5100176e1a241e265bbd7c1339e5 100644 (file)
@@ -190,9 +190,9 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
        Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w.m_id);
 }
 
-void SpawnThrownWeapon(vector org, float w)
-{SELFPARAM();
-       if(self.weapons & WepSet_FromWeapon(PS(self).m_weapon))
-               if(W_IsWeaponThrowable(PS(self).m_weapon.m_id))
-                       W_ThrowNewWeapon(self, PS(self).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
+void SpawnThrownWeapon(entity this, vector org, float w)
+{
+       if(this.weapons & WepSet_FromWeapon(PS(this).m_weapon))
+               if(W_IsWeaponThrowable(PS(this).m_weapon.m_id))
+                       W_ThrowNewWeapon(this, PS(this).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
 }
index 4994d02aed20a467aed1c6e5500648493d5f7c73..1bf50c14a400e0bd7e16ca9ac203471de1970e54 100644 (file)
@@ -12,5 +12,5 @@ float W_IsWeaponThrowable(float w);
 // toss current weapon
 void W_ThrowWeapon(vector velo, vector delta, float doreduce);
 
-void SpawnThrownWeapon(vector org, float w);
+void SpawnThrownWeapon(entity this, vector org, float w);
 #endif