Clean out self from wr_checkammo1 & wr_checkammo2
authorMario <mario@smbclan.net>
Sun, 22 May 2016 01:36:00 +0000 (11:36 +1000)
committerMario <mario@smbclan.net>
Sun, 22 May 2016 01:36:00 +0000 (11:36 +1000)
44 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.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/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/warpzone/common.qc
qcsrc/lib/warpzone/common.qh
qcsrc/lib/warpzone/server.qc
qcsrc/lib/warpzone/util_server.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/weaponsystem.qc

index 184055d..2acc4fa 100644 (file)
@@ -895,13 +895,13 @@ METHOD(BallStealer, wr_setup, void(BallStealer this))
     //weapon_setup(WEP_PORTO.m_id);
 }
 
-METHOD(BallStealer, wr_checkammo1, bool(BallStealer this))
+METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor))
 {
     TC(BallStealer, this);
     return true;
 }
 
-METHOD(BallStealer, wr_checkammo2, bool(BallStealer this))
+METHOD(BallStealer, wr_checkammo2, bool(BallStealer this, entity actor))
 {
     TC(BallStealer, this);
     return true;
index 3757f79..c52ce3f 100644 (file)
@@ -80,7 +80,7 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity
     }
 }
 
-METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack this)) {
+METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack this, entity actor)) {
     TC(WyvernAttack, this);
        return true;
 }
index ec8061c..ee4c856 100644 (file)
@@ -64,7 +64,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
                return;
        }
 
-       if(!thiswep.wr_checkammo1(thiswep))
+       if(!thiswep.wr_checkammo1(thiswep, actor))
        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
@@ -124,24 +124,22 @@ METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity wea
     }
 }
 
-METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
+METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
+    float ammo_amount = actor.ammo_nails >= WEP_CVAR(hmg, ammo);
 
     if(autocvar_g_balance_hmg_reload_ammo)
-        ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
+        ammo_amount += actor.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
 
     return ammo_amount;
 }
 
-METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
+METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
+    float ammo_amount = actor.ammo_nails >= WEP_CVAR(hmg, ammo);
 
     if(autocvar_g_balance_hmg_reload_ammo)
-        ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
+        ammo_amount += actor.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
 
     return ammo_amount;
 }
index 2d9d423..f16b702 100644 (file)
@@ -178,15 +178,14 @@ METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .en
     }
 }
 
-METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
+METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
-    ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
+    ammo_amount += actor.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
     return ammo_amount;
 }
 
-METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep))
+METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor))
 {
     return false;
 }
index ded599b..7b433a8 100644 (file)
@@ -321,7 +321,7 @@ bool racer_frame(entity this)
        Weapon wep1 = WEP_RACER;
        if (!forbidWeaponUse(this))
        if (PHYS_INPUT_BUTTON_ATCK(this))
-       if (wep1.wr_checkammo1(wep1))
+       if (wep1.wr_checkammo1(wep1, vehic))
        {
                string tagname = (vehic.cnt)
                    ? (vehic.cnt = 0, "tag_fire1")
index 36655fd..33d11c1 100644 (file)
@@ -34,11 +34,10 @@ METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weapone
     }
 }
 
-METHOD(RacerAttack, wr_checkammo1, bool(RacerAttack thiswep))
+METHOD(RacerAttack, wr_checkammo1, bool(RacerAttack thiswep, entity actor))
 {
-    SELFPARAM();
-    bool isPlayer = IS_PLAYER(self);
-    entity player = isPlayer ? self : self.owner;
+    bool isPlayer = IS_PLAYER(actor);
+    entity player = isPlayer ? actor : actor.owner;
     entity veh = player.vehicle;
     return isPlayer || veh.vehicle_energy >= autocvar_g_vehicle_racer_cannon_cost;
 }
index 8b2f9e0..d917540 100644 (file)
@@ -385,13 +385,12 @@ bool raptor_frame(entity this)
        UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
        */
 
-       // TODO: fix wr_checkammo and its use of self!
        setself(vehic);
 
        Weapon wep1 = WEP_RAPTOR;
        if(!forbidWeaponUse(this))
        if(PHYS_INPUT_BUTTON_ATCK(this))
-       if (wep1.wr_checkammo1(wep1))
+       if (wep1.wr_checkammo1(wep1, vehic))
        {
            .entity weaponentity = weaponentities[0];
                wep1.wr_think(wep1, vehic, weaponentity, 1);
index c51fa15..eedb064 100644 (file)
@@ -30,10 +30,9 @@ METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, .entity weapon
         weapon_thinkf(player, weaponentity, WFRAME_FIRE1, 0, w_ready);
     }
 }
-METHOD(RaptorCannon, wr_checkammo1, bool(RacerAttack thiswep)) {
-    SELFPARAM();
-    bool isPlayer = IS_PLAYER(self);
-    entity player = isPlayer ? self : self.owner;
+METHOD(RaptorCannon, wr_checkammo1, bool(RacerAttack thiswep, entity actor)) {
+    bool isPlayer = IS_PLAYER(actor);
+    entity player = isPlayer ? actor : actor.owner;
     entity veh = player.vehicle;
     return isPlayer || veh.vehicle_energy >= autocvar_g_vehicle_raptor_cannon_cost;
 }
index ef115b2..c76a883 100644 (file)
@@ -89,9 +89,9 @@ CLASS(Weapon, Object)
     /** (SERVER) logic to run every frame */
     METHOD(Weapon, wr_think, void(Weapon this, entity actor, .entity weaponentity, int fire)) {}
     /** (SERVER) checks ammo for weapon primary */
-    METHOD(Weapon, wr_checkammo1, bool(Weapon this)) {return false;}
+    METHOD(Weapon, wr_checkammo1, bool(Weapon this, entity actor)) {return false;}
     /** (SERVER) checks ammo for weapon second */
-    METHOD(Weapon, wr_checkammo2, bool(Weapon this)) {return false;}
+    METHOD(Weapon, wr_checkammo2, bool(Weapon this, entity actor)) {return false;}
     /** (SERVER) runs bot aiming code for this weapon */
     METHOD(Weapon, wr_aim, void(Weapon this)) {}
     /** (BOTH)   precaches models/sounds used by this weapon, also sets up weapon properties */
index 19cf8a5..0881da4 100644 (file)
@@ -374,7 +374,7 @@ void W_Arc_Beam_Think()
                if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
                setself(self.owner);
                Weapon w = WEP_ARC;
-               if(!w.wr_checkammo1(w) && !w.wr_checkammo2(w))
+               if(!w.wr_checkammo1(w, self) && !w.wr_checkammo2(w, self))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
@@ -831,23 +831,21 @@ METHOD(Arc, wr_init, void(entity thiswep))
         arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
     }
 }
-METHOD(Arc, wr_checkammo1, bool(entity thiswep))
+METHOD(Arc, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
+    return ((!WEP_CVAR(arc, beam_ammo)) || (actor.(thiswep.ammo_field) > 0));
 }
-METHOD(Arc, wr_checkammo2, bool(entity thiswep))
+METHOD(Arc, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     if(WEP_CVAR(arc, bolt))
     {
-        float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
-        ammo_amount += self.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
+        float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
+        ammo_amount += actor.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
         return ammo_amount;
     }
     else
         return WEP_CVAR(arc, overheat_max) > 0 &&
-            ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
+            ((!WEP_CVAR(arc, burst_ammo)) || (actor.(thiswep.ammo_field) > 0));
 }
 METHOD(Arc, wr_killmessage, Notification(entity thiswep))
 {
index f9f3008..6bb741b 100644 (file)
@@ -229,12 +229,12 @@ METHOD(Blaster, wr_setup, void(entity thiswep))
     self.ammo_field = ammo_none;
 }
 
-METHOD(Blaster, wr_checkammo1, bool(entity thiswep))
+METHOD(Blaster, wr_checkammo1, bool(entity thiswep, entity actor))
 {
     return true; // infinite ammo
 }
 
-METHOD(Blaster, wr_checkammo2, bool(entity thiswep))
+METHOD(Blaster, wr_checkammo2, bool(entity thiswep, entity actor))
 {
     return true; // blaster has infinite ammo
 }
index 9e2bb47..b422992 100644 (file)
@@ -621,7 +621,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit
                 setorigin(linkjoineffect, pos);
             }
             actor.crylink_waitrelease = 0;
-            if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
+            if(!thiswep.wr_checkammo1(thiswep, actor) && !thiswep.wr_checkammo2(thiswep, actor))
             if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
             {
                 // ran out of ammo!
@@ -631,26 +631,24 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit
         }
     }
 }
-METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
+METHOD(Crylink, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     // don't "run out of ammo" and switch weapons while waiting for release
-    if(self.crylink_lastgroup && self.crylink_waitrelease)
+    if(actor.crylink_lastgroup && actor.crylink_waitrelease)
         return true;
 
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
-    ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
+    ammo_amount += actor.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
     return ammo_amount;
 }
-METHOD(Crylink, wr_checkammo2, bool(entity thiswep))
+METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     // don't "run out of ammo" and switch weapons while waiting for release
-    if(self.crylink_lastgroup && self.crylink_waitrelease)
+    if(actor.crylink_lastgroup && actor.crylink_waitrelease)
         return true;
 
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
-    ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
+    ammo_amount += actor.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
     return ammo_amount;
 }
 METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
index 1cde73d..4e7b5cf 100644 (file)
@@ -561,44 +561,43 @@ METHOD(Devastator, wr_setup, void(entity thiswep))
     SELFPARAM();
     self.rl_release = 1;
 }
-METHOD(Devastator, wr_checkammo1, bool(entity thiswep))
+METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     #if 0
     // don't switch while guiding a missile
-    if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
+    if(ATTACK_FINISHED(actor, slot) <= time || PS(actor).m_weapon != WEP_DEVASTATOR)
     {
         ammo_amount = false;
         if(WEP_CVAR(devastator, reload_ammo))
         {
-            if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
+            if(actor.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && actor.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
                 ammo_amount = true;
         }
-        else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
+        else if(actor.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
             ammo_amount = true;
         return !ammo_amount;
     }
     #endif
     #if 0
-    if(self.rl_release == 0)
+    if(actor.rl_release == 0)
     {
-        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
         return true;
     }
     else
     {
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
-        ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
-        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+        ammo_amount += actor.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
         return ammo_amount;
     }
     #else
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
-    ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+    ammo_amount += actor.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
     return ammo_amount;
     #endif
 }
-METHOD(Devastator, wr_checkammo2, bool(entity thiswep))
+METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor))
 {
     return false;
 }
index 315ea5a..b977ddb 100644 (file)
@@ -496,26 +496,24 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit
         }
     }
 }
-METHOD(Electro, wr_checkammo1, bool(entity thiswep))
+METHOD(Electro, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
-    ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
+    ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
     return ammo_amount;
 }
-METHOD(Electro, wr_checkammo2, bool(entity thiswep))
+METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     float ammo_amount;
     if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
     {
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
-        ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+        ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
     }
     else
     {
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
-        ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
+        ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
     }
     return ammo_amount;
 }
index 4bbcdb6..245a05f 100644 (file)
@@ -403,11 +403,11 @@ METHOD(Fireball, wr_setup, void(entity thiswep))
     SELFPARAM();
     self.ammo_field = ammo_none;
 }
-METHOD(Fireball, wr_checkammo1, bool(entity thiswep))
+METHOD(Fireball, wr_checkammo1, bool(entity thiswep, entity actor))
 {
     return true; // infinite ammo
 }
-METHOD(Fireball, wr_checkammo2, bool(entity thiswep))
+METHOD(Fireball, wr_checkammo2, bool(entity thiswep, entity actor))
 {
     return true; // fireball has infinite ammo
 }
index 4b0367f..54539f7 100644 (file)
@@ -397,7 +397,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                self.hagar_warning = false;
 
                // we aren't checking ammo during an attack, so we must do it here
-               if(!(thiswep.wr_checkammo1(thiswep) + thiswep.wr_checkammo2(thiswep)))
+               if(!(thiswep.wr_checkammo1(thiswep, self) + thiswep.wr_checkammo2(thiswep, self)))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
@@ -415,7 +415,7 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int
                return;
        }
 
-       if(!thiswep.wr_checkammo1(thiswep))
+       if(!thiswep.wr_checkammo1(thiswep, actor))
        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
@@ -491,18 +491,16 @@ METHOD(Hagar, wr_setup, void(entity thiswep))
         self.hagar_load = 0;
     }
 }
-METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
+METHOD(Hagar, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
-    ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
+    ammo_amount += actor.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
     return ammo_amount;
 }
-METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
+METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
-    ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
+    ammo_amount += actor.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
     return ammo_amount;
 }
 METHOD(Hagar, wr_resetplayer, void(entity thiswep))
index 4be7882..932f3d1 100644 (file)
@@ -171,7 +171,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int
 
        if(PHYS_INPUT_BUTTON_ATCK(actor))
        {
-               if(!thiswep.wr_checkammo1(thiswep))
+               if(!thiswep.wr_checkammo1(thiswep, actor))
                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
@@ -235,18 +235,16 @@ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
         }
     }
 }
-METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
+METHOD(HLAC, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
-    ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
+    ammo_amount += actor.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
     return ammo_amount;
 }
-METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
+METHOD(HLAC, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
-    ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
+    ammo_amount += actor.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
     return ammo_amount;
 }
 METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
index 9b923bd..468c64b 100644 (file)
@@ -283,19 +283,19 @@ METHOD(Hook, wr_setup, void(entity thiswep))
     SELFPARAM();
     self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
 }
-METHOD(Hook, wr_checkammo1, bool(Hook thiswep))
+METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor))
 {
     SELFPARAM();
     if (!thiswep.ammo_factor) return true;
-    if(self.hook)
-        return self.ammo_fuel > 0;
+    if(actor.hook)
+        return actor.ammo_fuel > 0;
     else
-        return self.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
+        return actor.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
 }
-METHOD(Hook, wr_checkammo2, bool(Hook thiswep))
+METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor))
 {
     // infinite ammo for now
-    return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
+    return true; // actor.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
 }
 METHOD(Hook, wr_resetplayer, void(entity thiswep))
 {
index 4a49933..8b16c27 100644 (file)
@@ -148,7 +148,7 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentit
        }
        if(PHYS_INPUT_BUTTON_ATCK(actor))
        {
-               if(!thiswep.wr_checkammo2(thiswep))
+               if(!thiswep.wr_checkammo2(thiswep, actor))
                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
@@ -174,7 +174,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
                return;
        }
 
-       if(!thiswep.wr_checkammo1(thiswep))
+       if(!thiswep.wr_checkammo1(thiswep, actor))
        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
@@ -267,7 +267,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
         if(fire & 2)
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
         {
-            if(!thiswep.wr_checkammo2(thiswep))
+            if(!thiswep.wr_checkammo2(thiswep, actor))
             if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
             {
                 W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
@@ -301,39 +301,37 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
         }
     }
 }
-METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
+METHOD(MachineGun, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     float ammo_amount;
     if(WEP_CVAR(machinegun, mode) == 1)
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
     else
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
 
     if(WEP_CVAR(machinegun, reload_ammo))
     {
         if(WEP_CVAR(machinegun, mode) == 1)
-            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, sustained_ammo);
+            ammo_amount += actor.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, sustained_ammo);
         else
-            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
+            ammo_amount += actor.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
     }
     return ammo_amount;
 }
-METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
+METHOD(MachineGun, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     float ammo_amount;
     if(WEP_CVAR(machinegun, mode) == 1)
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
     else
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
 
     if(WEP_CVAR(machinegun, reload_ammo))
     {
         if(WEP_CVAR(machinegun, mode) == 1)
-            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, burst_ammo);
+            ammo_amount += actor.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, burst_ammo);
         else
-            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
+            ammo_amount += actor.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
     }
     return ammo_amount;
 }
index 96d7555..9670dbd 100644 (file)
@@ -127,7 +127,7 @@ void W_MineLayer_Explode()
        {
                setself(self.realowner);
                Weapon w = WEP_MINE_LAYER;
-               if(!w.wr_checkammo1(w))
+               if(!w.wr_checkammo1(w, self))
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
                        int slot = 0; // TODO: unhardcode
@@ -154,7 +154,7 @@ void W_MineLayer_DoRemoteExplode()
        {
                setself(self.realowner);
                Weapon w = WEP_MINE_LAYER;
-               if(!w.wr_checkammo1(w))
+               if(!w.wr_checkammo1(w, self))
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
                        int slot = 0; // TODO: unhardcode
@@ -383,12 +383,12 @@ void W_MineLayer_Attack(Weapon thiswep)
        self.minelayer_mines = W_MineLayer_Count(self);
 }
 
-float W_MineLayer_PlacedMines(float detonate)
-{SELFPARAM();
+float W_MineLayer_PlacedMines(entity this, float detonate)
+{
        entity mine;
        float minfound = 0;
 
-       for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.realowner == self)
+       for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.realowner == this)
        {
                if(detonate)
                {
@@ -508,7 +508,7 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent
     if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
     {
         // not if we're holding the minelayer without enough ammo, but can detonate existing mines
-        if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
+        if(!(W_MineLayer_PlacedMines(actor, false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
             thiswep.wr_reload(thiswep, actor, weaponentity);
         }
     }
@@ -523,26 +523,25 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent
 
     if(fire & 2)
     {
-        if(W_MineLayer_PlacedMines(true))
+        if(W_MineLayer_PlacedMines(actor, true))
             sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
     }
 }
-METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
+METHOD(MineLayer, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     //int slot = 0; // TODO: unhardcode
     // actually do // don't switch while placing a mine
-    //if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
+    //if(ATTACK_FINISHED(actor, slot) <= time || PS(actor).m_weapon != WEP_MINE_LAYER)
     //{
-        float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
-        ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
+        float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
+        ammo_amount += actor.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
         return ammo_amount;
     //}
     //return true;
 }
-METHOD(MineLayer, wr_checkammo2, bool(entity thiswep))
+METHOD(MineLayer, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    if(W_MineLayer_PlacedMines(false))
+    if(W_MineLayer_PlacedMines(actor, false))
         return true;
     else
         return false;
index 5fbacc7..1e1c924 100644 (file)
@@ -381,18 +381,16 @@ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity
         }
     }
 }
-METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
+METHOD(Mortar, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
-    ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
+    ammo_amount += actor.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
     return ammo_amount;
 }
-METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
+METHOD(Mortar, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
-    ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
+    ammo_amount += actor.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
     return ammo_amount;
 }
 METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
index b948888..00aa015 100644 (file)
@@ -357,12 +357,12 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone
         }
     }
 }
-METHOD(PortoLaunch, wr_checkammo1, bool(entity this))
+METHOD(PortoLaunch, wr_checkammo1, bool(entity thiswep, entity this))
 {
     // always allow infinite ammo
     return true;
 }
-METHOD(PortoLaunch, wr_checkammo2, bool(entity this))
+METHOD(PortoLaunch, wr_checkammo2, bool(entity thiswep, entity this))
 {
     // always allow infinite ammo
     return true;
index 6067705..e11bdd8 100644 (file)
@@ -197,18 +197,16 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
         }
     }
 }
-METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
+METHOD(Rifle, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
-    ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
+    ammo_amount += actor.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
     return ammo_amount;
 }
-METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
+METHOD(Rifle, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
-    ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
+    ammo_amount += actor.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
     return ammo_amount;
 }
 METHOD(Rifle, wr_resetplayer, void(entity thiswep))
index 6dffec3..ce0aacd 100644 (file)
@@ -423,42 +423,41 @@ void W_Seeker_Vollycontroller_Think() // TODO: Merge this with W_Seeker_Attack
 {SELFPARAM();
        float c;
        entity oldenemy;
-       self.cnt = self.cnt - 1;
+       this.cnt = this.cnt - 1;
 
        Weapon thiswep = WEP_SEEKER;
-       if((!(self.realowner.items & IT_UNLIMITED_AMMO) && self.realowner.(thiswep.ammo_field) < WEP_CVAR(seeker, missile_ammo)) || (self.cnt <= -1) || (IS_DEAD(self.realowner)) || (PS(self.realowner).m_switchweapon != WEP_SEEKER))
+       if((!(this.realowner.items & IT_UNLIMITED_AMMO) && this.realowner.(thiswep.ammo_field) < WEP_CVAR(seeker, missile_ammo)) || (this.cnt <= -1) || (IS_DEAD(this.realowner)) || (PS(this.realowner).m_switchweapon != WEP_SEEKER))
        {
-               remove(self);
+               remove(this);
                return;
        }
 
-       self.nextthink = time + WEP_CVAR(seeker, missile_delay) * W_WeaponRateFactor();
+       this.nextthink = time + WEP_CVAR(seeker, missile_delay) * W_WeaponRateFactor();
 
-       setself(self.realowner);
+       entity own = this.realowner;
 
-       oldenemy = self.enemy;
-       self.enemy = this.enemy;
+       oldenemy = own.enemy;
+       own.enemy = this.enemy;
 
-       c = self.cnt % 4;
+       c = own.cnt % 4;
        switch(c)
        {
                case 0:
-                       W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 -3.75 0', self.enemy);
+                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 -3.75 0', own.enemy));
                        break;
                case 1:
-                       W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 -3.75 0', self.enemy);
+                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 -3.75 0', own.enemy));
                        break;
                case 2:
-                       W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 +3.75 0', self.enemy);
+                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 +3.75 0', own.enemy));
                        break;
                case 3:
                default:
-                       W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 +3.75 0', self.enemy);
+                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 +3.75 0', own.enemy));
                        break;
        }
 
-       self.enemy = oldenemy;
-       setself(this);
+       own.enemy = oldenemy;
 }
 
 void W_Seeker_Tracker_Think()
@@ -658,35 +657,33 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity
         }
     }
 }
-METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
+METHOD(Seeker, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     float ammo_amount;
     if(WEP_CVAR(seeker, type) == 1)
     {
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
-        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
+        ammo_amount += actor.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
     }
     else
     {
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
-        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount += actor.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
     }
     return ammo_amount;
 }
-METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
+METHOD(Seeker, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     float ammo_amount;
     if(WEP_CVAR(seeker, type) == 1)
     {
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
-        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount += actor.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
     }
     else
     {
-        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
-        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
+        ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
+        ammo_amount += actor.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
     }
     return ammo_amount;
 }
index 444f968..64264de 100644 (file)
@@ -704,11 +704,11 @@ METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponent
         }
     }
 }
-METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
+METHOD(Shockwave, wr_checkammo1, bool(entity thiswep, entity actor))
 {
     return true; // infinite ammo
 }
-METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
+METHOD(Shockwave, wr_checkammo2, bool(entity thiswep, entity actor))
 {
     // shockwave has infinite ammo
     return true;
index 1a23189..568b1fe 100644 (file)
@@ -198,7 +198,7 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, .entity weaponentity, int f
 // alternate secondary weapon frames
 void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       if (!thiswep.wr_checkammo2(thiswep))
+       if (!thiswep.wr_checkammo2(thiswep, actor))
        if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
@@ -212,7 +212,7 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, .entity weaponentity
 }
 void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       if (!thiswep.wr_checkammo2(thiswep))
+       if (!thiswep.wr_checkammo2(thiswep, actor))
        if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
@@ -285,26 +285,24 @@ METHOD(Shotgun, wr_setup, void(entity thiswep))
     SELFPARAM();
     self.ammo_field = ammo_none;
 }
-METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
+METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
-    ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
+    ammo_amount += actor.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
     return ammo_amount;
 }
-METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
+METHOD(Shotgun, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    if(IS_BOT_CLIENT(self))
-    if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
+    if(IS_BOT_CLIENT(actor))
+    if(vdist(actor.origin - actor.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
         return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
     switch(WEP_CVAR(shotgun, secondary))
     {
         case 1: return true; // melee does not use ammo
         case 2: // secondary triple shot
         {
-            float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
-            ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
+            float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
+            ammo_amount += actor.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
             return ammo_amount;
         }
         default: return false; // secondary unavailable
index 4cb5ded..abd3870 100644 (file)
@@ -461,8 +461,8 @@ METHOD(Tuba, wr_reload, void(Tuba this, entity actor, .entity weaponentity))
 #ifdef SVQC
 
 // infinite ammo
-METHOD(Tuba, wr_checkammo1, bool(Tuba this)) { return true; }
-METHOD(Tuba, wr_checkammo2, bool(Tuba this)) { return true; }
+METHOD(Tuba, wr_checkammo1, bool(Tuba this, entity actor)) { return true; }
+METHOD(Tuba, wr_checkammo2, bool(Tuba this, entity actor)) { return true; }
 
 METHOD(Tuba, wr_suicidemessage, Notification(Tuba this))
 {
index 08f6638..cd05a86 100644 (file)
@@ -432,21 +432,19 @@ METHOD(Vaporizer, wr_setup, void(entity thiswep))
     self.ammo_field = (thiswep.ammo_field);
     self.vaporizer_lasthit = 0;
 }
-METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
+METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-    float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
-    ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
+    float ammo_amount = actor.(thiswep.ammo_field) >= vaporizer_ammo;
+    ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
     return ammo_amount;
 }
-METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
+METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     if(!WEP_CVAR_SEC(vaporizer, ammo))
         return true;
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
-    ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
+    ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
     return ammo_amount;
 }
 METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
index 210bb14..d0d0025 100644 (file)
@@ -326,21 +326,19 @@ METHOD(Vortex, wr_setup, void(entity thiswep))
     SELFPARAM();
     self.vortex_lasthit = 0;
 }
-METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
+METHOD(Vortex, wr_checkammo1, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
-    ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
+    float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
+    ammo_amount += (autocvar_g_balance_vortex_reload_ammo && actor.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
     return ammo_amount;
 }
-METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
+METHOD(Vortex, wr_checkammo2, bool(entity thiswep, entity actor))
 {
-    SELFPARAM();
     if(WEP_CVAR(vortex, secondary))
     {
         // don't allow charging if we don't have enough ammo
-        float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
-        ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
+        float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
+        ammo_amount += actor.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
         return ammo_amount;
     }
     else
index 130e1b2..832e32e 100644 (file)
@@ -786,9 +786,9 @@ entity WarpZone_RefSys_SpawnSameRefSys(entity me)
        return e;
 }
 
-float WarpZoneLib_ExactTrigger_Touch()
-{SELFPARAM();
-       return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, this, other);
+float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher)
+{
+       return !WarpZoneLib_BoxTouchesBrush(toucher.absmin, toucher.absmax, this, toucher);
 }
 
 
index c827900..2cfa7ef 100644 (file)
@@ -107,10 +107,10 @@ entity WarpZone_RefSys_SpawnSameRefSys(entity me); // spawn().R = me.R
 float WarpZoneLib_MoveOutOfSolid(entity e);
 #define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e)
 
-float WarpZoneLib_ExactTrigger_Touch();
+float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
 void WarpZoneLib_ExactTrigger_Init(entity this);
 
 // WARNING: this kills the trace globals
-#define EXACTTRIGGER_TOUCH if(WarpZoneLib_ExactTrigger_Touch()) return
+#define EXACTTRIGGER_TOUCH if(WarpZoneLib_ExactTrigger_Touch(this, other)) return
 #define EXACTTRIGGER_INIT  WarpZoneLib_ExactTrigger_Init(this)
 #endif
index 6a748ee..8bd5d69 100644 (file)
@@ -206,7 +206,7 @@ void WarpZone_Touch ()
 #endif
                return;
 
-       if(WarpZoneLib_ExactTrigger_Touch())
+       if(WarpZoneLib_ExactTrigger_Touch(self, other))
                return;
 
 #ifdef SVQC
@@ -866,24 +866,23 @@ void WarpZone_StartFrame()
 
                        // warpzones
                        if (warpzone_warpzones_exist) {
-                               setself(WarpZone_Find(it.origin + it.mins, it.origin + it.maxs));
-                               if (self)
-                               if (!WarpZoneLib_ExactTrigger_Touch())
-                               if (WarpZone_PlaneDist(self, it.origin + it.view_ofs) <= 0)
-                                       WarpZone_Teleport(self, it, -1, 0); // NOT triggering targets by this!
+                               entity e = WarpZone_Find(it.origin + it.mins, it.origin + it.maxs);
+                               if (e)
+                               if (!WarpZoneLib_ExactTrigger_Touch(e, other))
+                               if (WarpZone_PlaneDist(e, it.origin + it.view_ofs) <= 0)
+                                       WarpZone_Teleport(e, it, -1, 0); // NOT triggering targets by this!
                        }
 
                        // teleporters
                        if(other.teleportable)
                        {
-                               setself(Teleport_Find(it.origin + it.mins, it.origin + it.maxs));
-                               if (self)
-                               if (!WarpZoneLib_ExactTrigger_Touch())
-                                       Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
+                               entity ent = Teleport_Find(it.origin + it.mins, it.origin + it.maxs);
+                               if (ent)
+                               if (!WarpZoneLib_ExactTrigger_Touch(ent, other))
+                                       Simple_TeleportPlayer(ent, other); // NOT triggering targets by this!
                        }
                }
        });
-       setself(this);
        other = oldother;
 }
 
index 5c94d43..39d1d24 100644 (file)
@@ -2,7 +2,7 @@
 #define LIB_WARPZONE_UTIL_SERVER_H
 
 float WarpZoneLib_MoveOutOfSolid(entity e);
-float WarpZoneLib_ExactTrigger_Touch();
+float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
 #ifdef SVQC
 void WarpZoneLib_ExactTrigger_Init(entity this);
 #endif
index cff3fe2..3163c21 100644 (file)
@@ -993,7 +993,7 @@ float havocbot_chooseweapon_checkreload(entity this, int new_weapon)
        {
                bool other_weapon_available = false;
                FOREACH(Weapons, it != WEP_Null, LAMBDA(
-                       if(it.wr_checkammo1(it) + it.wr_checkammo2(it))
+                       if(it.wr_checkammo1(it, this) + it.wr_checkammo2(it, this))
                                other_weapon_available = true;
                ));
                if(other_weapon_available)
index 63733e1..e601bfc 100644 (file)
@@ -1384,9 +1384,13 @@ void GameCommand_shuffleteams(float request)
                                                {
                                                        if (!(shuffleteams_players[z])) continue;  // not a player, move on to next random slot
 
-                                                       if (VerifyClientNumber(shuffleteams_players[z])) setself(edict_num(shuffleteams_players[z]));
+                                                       entity e = NULL;
+                                                       if(VerifyClientNumber(shuffleteams_players[z]))
+                                                               e = edict_num(shuffleteams_players[z]);
 
-                                                       if (self.team != team_color) MoveToTeam(self, team_color, 6);
+                                                       if(!e) continue; // unverified
+
+                                                       if (e.team != team_color) MoveToTeam(e, team_color, 6);
 
                                                        shuffleteams_players[z] = 0;
                                                        shuffleteams_teams[i] = shuffleteams_teams[i] + 1;
index 252ab2f..e19ef52 100644 (file)
@@ -363,7 +363,6 @@ void reset_map(bool dorespawn)
                if (!MUTATOR_CALLHOOK(reset_map_players))
                {
                        FOREACH_CLIENT(true, LAMBDA(
-                               setself(it);
                                /*
                                only reset players if a restart countdown is active
                                this can either be due to cvar sv_ready_restart_after_countdown having set
@@ -373,20 +372,18 @@ void reset_map(bool dorespawn)
                                if (restart_mapalreadyrestarted || (time < game_starttime))
                                {
                                        // NEW: changed behaviour so that it prevents that previous spectators/observers suddenly spawn as players
-                                       if (IS_PLAYER(self))
+                                       if (IS_PLAYER(it))
                                        {
-                                               // PlayerScore_Clear(self);
-                                               self.killcount = 0;
+                                               // PlayerScore_Clear(it);
+                                               it.killcount = 0;
                                                // stop the player from moving so that he stands still once he gets respawned
-                                               self.velocity = '0 0 0';
-                                               self.avelocity = '0 0 0';
-                                               self.movement = '0 0 0';
-                                               PutClientInServer();
+                                               it.velocity = '0 0 0';
+                                               it.avelocity = '0 0 0';
+                                               it.movement = '0 0 0';
+                                               WITHSELF(it, PutClientInServer());
                                        }
                                }
                        ));
-
-                       setself(this);
                }
        }
 }
index b30f235..0c76214 100644 (file)
@@ -577,7 +577,7 @@ void Unfreeze (entity targ)
 }
 
 void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+{
        float mirrordamage;
        float mirrorforce;
        float complainteamdamage = 0;
@@ -588,11 +588,10 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
        if (gameover || targ.killcount == FRAGS_SPECTATOR)
                return;
 
-       setself(targ);
-        damage_targ = targ;
-        damage_inflictor = inflictor;
-        damage_attacker = attacker;
-               attacker_save = attacker;
+    damage_targ = targ;
+    damage_inflictor = inflictor;
+    damage_attacker = attacker;
+       attacker_save = attacker;
 
        if(IS_PLAYER(targ))
                if(targ.hook)
@@ -603,19 +602,17 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
        // special rule: gravity bomb does not hit team mates (other than for disconnecting the hook)
        if(DEATH_ISWEAPON(deathtype, WEP_HOOK) || DEATH_ISWEAPON(deathtype, WEP_TUBA))
        {
-               if(IS_PLAYER(targ))
-                       if(SAME_TEAM(targ, attacker))
-                       {
-                               setself(this);
-                               return;
-                       }
+               if(IS_PLAYER(targ) && SAME_TEAM(targ, attacker))
+               {
+                       return;
+               }
        }
 
        if(deathtype == DEATH_KILL.m_id || deathtype == DEATH_TEAMCHANGE.m_id || deathtype == DEATH_AUTOTEAMCHANGE.m_id)
        {
                // exit the vehicle before killing (fixes a crash)
                if(IS_PLAYER(targ) && targ.vehicle)
-                       vehicles_exit(VHEF_RELEASE);
+                       WITHSELF(targ, vehicles_exit(VHEF_RELEASE));
 
                // These are ALWAYS lethal
                // No damage modification here
@@ -838,18 +835,18 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
        }
 
        // apply push
-       if (self.damageforcescale)
+       if (targ.damageforcescale)
        if (vlen(force))
-       if (!IS_PLAYER(self) || time >= self.spawnshieldtime || self == attacker)
+       if (!IS_PLAYER(targ) || time >= targ.spawnshieldtime || targ == attacker)
        {
-               vector farce = damage_explosion_calcpush(self.damageforcescale * force, self.velocity, autocvar_g_balance_damagepush_speedfactor);
-               if(self.movetype == MOVETYPE_PHYSICS)
+               vector farce = damage_explosion_calcpush(targ.damageforcescale * force, targ.velocity, autocvar_g_balance_damagepush_speedfactor);
+               if(targ.movetype == MOVETYPE_PHYSICS)
                {
                        entity farcent = new(farce);
-                       farcent.enemy = self;
+                       farcent.enemy = targ;
                        farcent.movedir = farce * 10;
-                       if(self.mass)
-                               farcent.movedir = farcent.movedir * self.mass;
+                       if(targ.mass)
+                               farcent.movedir = farcent.movedir * targ.mass;
                        farcent.origin = hitloc;
                        farcent.forcetype = FORCETYPE_FORCEATPOS;
                        farcent.nextthink = time + 0.1;
@@ -857,18 +854,17 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                }
                else
                {
-                       self.velocity = self.velocity + farce;
-                       self.move_velocity = self.velocity;
+                       targ.velocity = targ.velocity + farce;
+                       targ.move_velocity = targ.velocity;
                }
-               UNSET_ONGROUND(self);
-               self.move_flags &= ~FL_ONGROUND;
-               UpdateCSQCProjectile(self);
+               UNSET_ONGROUND(targ);
+               targ.move_flags &= ~FL_ONGROUND;
+               UpdateCSQCProjectile(targ);
        }
        // apply damage
-       if (damage != 0 || (self.damageforcescale && vlen(force)))
-       if (self.event_damage)
-               self.event_damage (self, inflictor, attacker, damage, deathtype, hitloc, force);
-       setself(this);
+       if (damage != 0 || (targ.damageforcescale && vlen(force)))
+       if (targ.event_damage)
+               targ.event_damage (targ, inflictor, attacker, damage, deathtype, hitloc, force);
 
        // apply mirror damage if any
        if(!autocvar_g_mirrordamage_onlyweapons || DEATH_WEAPONOF(deathtype) != WEP_Null)
index b9d8035..583391d 100644 (file)
@@ -2049,13 +2049,12 @@ float RedirectionThink()
 
        clients_found = 0;
        FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
-               setself(it);
                // TODO add timer
-               LOG_INFO("Redirecting: sending connect command to ", self.netname, "\n");
+               LOG_INFO("Redirecting: sending connect command to ", it.netname, "\n");
                if(redirection_target == "self")
-                       stuffcmd(self, "\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " reconnect\n");
+                       stuffcmd(it, "\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " reconnect\n");
                else
-                       stuffcmd(self, strcat("\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " \"connect ", redirection_target, "\"\n"));
+                       stuffcmd(it, strcat("\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " \"connect ", redirection_target, "\"\n"));
                ++clients_found;
        ));
 
index 072fe90..8835d11 100644 (file)
@@ -242,7 +242,6 @@ MUTATOR_HOOKFUNCTION(ca, PutClientInServer)
 
 MUTATOR_HOOKFUNCTION(ca, reset_map_players)
 {
-    SELFPARAM();
        FOREACH_CLIENT(true, {
                it.killcount = 0;
                if (!it.caplayer && IS_BOT_CLIENT(it))
index 33fb745..cbefd4c 100644 (file)
@@ -943,10 +943,8 @@ void ctf_FlagThink()
                                self.health = 0;
                                ctf_CheckFlagReturn(self, RETURN_SPEEDRUN);
 
-                               setself(self.owner);
-                               self.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
-                               ImpulseCommands(self);
-                               setself(this);
+                               self.owner.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
+                               ImpulseCommands(self.owner);
                        }
                        if(autocvar_g_ctf_stalemate)
                        {
@@ -1188,9 +1186,6 @@ void ctf_DelayedFlagSetup(entity this) // called after a flag is placed on a map
 
 void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
 {
-       // declarations
-       setself(flag); // for later usage with droptofloor()
-
        // main setup
        flag.ctf_worldflagnext = ctf_worldflaglist; // link flag into ctf_worldflaglist
        ctf_worldflaglist = flag;
@@ -1290,8 +1285,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e
        else // drop to floor, automatically find a platform and set that as spawn origin
        {
                flag.noalign = false;
-               setself(flag);
-               droptofloor();
+               WITHSELF(flag, droptofloor());
                flag.movetype = MOVETYPE_TOSS;
        }
 
index 08b0071..8db6de1 100644 (file)
@@ -496,15 +496,14 @@ MUTATOR_HOOKFUNCTION(dom, GetTeamCount)
 }
 
 MUTATOR_HOOKFUNCTION(dom, reset_map_players)
-{SELFPARAM();
+{
        total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
        FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
-               setself(it);
-               PutClientInServer();
+               WITHSELF(it, PutClientInServer());
                if(domination_roundbased)
-                       self.player_blocked = 1;
-               if(IS_REAL_CLIENT(self))
-                       set_dom_state(self);
+                       it.player_blocked = 1;
+               if(IS_REAL_CLIENT(it))
+                       set_dom_state(it);
        ));
        return 1;
 }
@@ -630,41 +629,38 @@ void ScoreRules_dom(float teams)
 
 // code from here on is just to support maps that don't have control point and team entities
 void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, Sound capsound, string capnarration, string capmessage)
-{SELFPARAM();
+{
     TC(Sound, capsound);
-       setself(spawn());
-       self.classname = "dom_team";
-       self.netname = strzone(teamname);
-       self.cnt = teamcolor;
-       self.model = pointmodel;
-       self.skin = pointskin;
-       self.noise = strzone(Sound_fixpath(capsound));
-       self.noise1 = strzone(capnarration);
-       self.message = strzone(capmessage);
+    entity e = new_pure(dom_team);
+       e.netname = strzone(teamname);
+       e.cnt = teamcolor;
+       e.model = pointmodel;
+       e.skin = pointskin;
+       e.noise = strzone(Sound_fixpath(capsound));
+       e.noise1 = strzone(capnarration);
+       e.message = strzone(capmessage);
 
        // this code is identical to spawnfunc_dom_team
-       _setmodel(self, self.model); // precision not needed
-       self.mdl = self.model;
-       self.dmg = self.modelindex;
-       self.model = "";
-       self.modelindex = 0;
+       _setmodel(e, e.model); // precision not needed
+       e.mdl = e.model;
+       e.dmg = e.modelindex;
+       e.model = "";
+       e.modelindex = 0;
        // this would have to be changed if used in quakeworld
-       self.team = self.cnt + 1;
+       e.team = e.cnt + 1;
 
-       //eprint(self);
-       setself(this);
+       //eprint(e);
 }
 
 void self_spawnfunc_dom_controlpoint() { SELFPARAM(); spawnfunc_dom_controlpoint(self); }
 void dom_spawnpoint(vector org)
-{SELFPARAM();
-       setself(spawn());
-       self.classname = "dom_controlpoint";
-       self.think = self_spawnfunc_dom_controlpoint;
-       self.nextthink = time;
-       setorigin(self, org);
-       spawnfunc_dom_controlpoint(this);
-       setself(this);
+{
+       entity e = spawn();
+       e.classname = "dom_controlpoint";
+       e.think = self_spawnfunc_dom_controlpoint;
+       e.nextthink = time;
+       setorigin(e, org);
+       spawnfunc_dom_controlpoint(e);
 }
 
 // spawn some default teams if the map is not set up for domination
index f57661f..9900497 100644 (file)
@@ -456,8 +456,7 @@ MUTATOR_HOOKFUNCTION(ft, reset_map_players)
        FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
                it.killcount = 0;
                it.freezetag_frozen_timeout = -1;
-               setself(it);
-               PutClientInServer();
+               WITHSELF(it, PutClientInServer());
                it.freezetag_frozen_timeout = 0;
        ));
        freezetag_count_alive_players();
index 18dc400..70284a8 100644 (file)
@@ -71,7 +71,7 @@ bool client_hasweapon(entity this, Weapon wpn, float andammo, bool complain)
                        }
                        else
                        {
-                               WITHSELF(this, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
+                               f = wpn.wr_checkammo1(wpn, this) + wpn.wr_checkammo2(wpn, this);
 
                                // always allow selecting the Mine Layer if we placed mines, so that we can detonate them
                                if(wpn == WEP_MINE_LAYER)
index 94805a5..db5f9fe 100644 (file)
@@ -213,8 +213,8 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary
     SELFPARAM();
        if ((actor.items & IT_UNLIMITED_WEAPON_AMMO)) return true;
        bool ammo = false;
-       if (secondary) WITHSELF(actor, ammo = thiswep.wr_checkammo2(thiswep));
-       else WITHSELF(actor, ammo = thiswep.wr_checkammo1(thiswep));
+       if (secondary) ammo = thiswep.wr_checkammo2(thiswep, actor);
+       else ammo = thiswep.wr_checkammo1(thiswep, actor);
        if (ammo) return true;
        // always keep the Mine Layer if we placed mines, so that we can detonate them
        if (thiswep == WEP_MINE_LAYER)
@@ -232,8 +232,8 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary
 
        // check if the other firing mode has enough ammo
        bool ammo_other = false;
-       if (secondary) WITHSELF(actor, ammo_other = thiswep.wr_checkammo1(thiswep));
-       else WITHSELF(actor, ammo_other = thiswep.wr_checkammo2(thiswep));
+       if (secondary) ammo_other = thiswep.wr_checkammo1(thiswep, actor);
+       else ammo_other = thiswep.wr_checkammo2(thiswep, actor);
        if (ammo_other)
        {
                if (time - actor.prevwarntime > 1)
@@ -731,7 +731,7 @@ void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound)
                                }
                                // switch away if the amount of ammo is not enough to keep using this weapon
                                Weapon w = PS(actor).m_weapon;
-                               if (!(w.wr_checkammo1(w) + w.wr_checkammo2(w)))
+                               if (!(w.wr_checkammo1(w, actor) + w.wr_checkammo2(w, actor)))
                                {
                                        actor.clip_load = -1;  // reload later
                                        W_SwitchToOtherWeapon(actor);