]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Purify PutClientInServer and PlayerSpawn mutator hooks
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 02:30:42 +0000 (12:30 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 02:30:42 +0000 (12:30 +1000)
24 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/campcheck/campcheck.qc
qcsrc/common/mutators/mutator/hook/hook.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/common/mutators/mutator/midair/midair.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/nix/nix.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc
qcsrc/common/mutators/mutator/weaponarena_random/weaponarena_random.qc
qcsrc/server/cl_client.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/mutators/mutator/gamemode_race.qc

index 6c6bcac9e2553002097769b9fb7ea116d1e6b012..57539be68fe834f80c528f61d6083bb6077996bd 100644 (file)
@@ -1014,15 +1014,16 @@ MUTATOR_HOOKFUNCTION(nb, SpectateCopy)
 
 MUTATOR_HOOKFUNCTION(nb, PlayerSpawn)
 {
-       SELFPARAM();
-       this.metertime = 0;
+       entity player = M_ARGV(0, entity);
+
+       player.metertime = 0;
        .entity weaponentity = weaponentities[0];
-       this.(weaponentity).weapons = '0 0 0';
+       player.(weaponentity).weapons = '0 0 0';
 
        if (nexball_mode & NBM_BASKETBALL)
-               this.weapons |= WEPSET(NEXBALL);
+               player.weapons |= WEPSET(NEXBALL);
        else
-               this.weapons = '0 0 0';
+               player.weapons = '0 0 0';
 
        return false;
 }
index 08d0183e35223b486a493f5a4a7fcf859fc761cc..617af7c76d7bbcaa36394d51ae9fb2bde37dbc7d 100644 (file)
@@ -1777,10 +1777,12 @@ MUTATOR_HOOKFUNCTION(ons, MakePlayerObserver)
 }
 
 MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(!round_handler_IsRoundStarted())
        {
-               self.player_blocked = true;
+               player.player_blocked = true;
                return false;
        }
 
@@ -1794,13 +1796,13 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
                l.sprite.SendFlags |= 16;
        }
 
-       if(ons_stalemate) { Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); }
+       if(ons_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); }
 
        if ( autocvar_g_onslaught_spawn_choose )
-       if ( self.ons_spawn_by )
-       if ( ons_Teleport(self,self.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) )
+       if ( player.ons_spawn_by )
+       if ( ons_Teleport(player,player.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) )
        {
-               self.ons_spawn_by = world;
+               player.ons_spawn_by = world;
                return false;
        }
 
@@ -1809,7 +1811,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
        {
                float random_target = autocvar_g_onslaught_spawn_at_controlpoints_random;
                entity tmp_entity, closest_target = world;
-               vector spawn_loc = self.ons_deathloc;
+               vector spawn_loc = player.ons_deathloc;
 
                // new joining player or round reset, don't bother checking
                if(spawn_loc == '0 0 0') { return false; }
@@ -1818,7 +1820,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
 
                for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext)
                {
-                       if(SAME_TEAM(tmp_entity, self))
+                       if(SAME_TEAM(tmp_entity, player))
                        if(random_target)
                                RandomSelection_Add(tmp_entity, 0, string_null, 1, 1);
                        else if(vlen(tmp_entity.origin - spawn_loc) <= vlen(closest_target.origin - spawn_loc) || closest_target == world)
@@ -1837,14 +1839,14 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
                                iteration_scale -= i / 10;
                                loc = closest_target.origin + '0 0 96' * iteration_scale;
                                loc += ('0 1 0' * random()) * 128 * iteration_scale;
-                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, self);
+                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
                                if(trace_fraction == 1.0 && !trace_startsolid)
                                {
                                        traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the world
                                        if(trace_fraction == 1.0 && !trace_startsolid)
                                        {
-                                               setorigin(self, loc);
-                                               self.angles = normalize(loc - closest_target.origin) * RAD2DEG;
+                                               setorigin(player, loc);
+                                               player.angles = normalize(loc - closest_target.origin) * RAD2DEG;
                                                return false;
                                        }
                                }
@@ -1857,7 +1859,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
        {
                float random_target = autocvar_g_onslaught_spawn_at_generator_random;
                entity tmp_entity, closest_target = world;
-               vector spawn_loc = self.ons_deathloc;
+               vector spawn_loc = player.ons_deathloc;
 
                // new joining player or round reset, don't bother checking
                if(spawn_loc == '0 0 0') { return false; }
@@ -1870,7 +1872,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
                                RandomSelection_Add(tmp_entity, 0, string_null, 1, 1);
                        else
                        {
-                               if(SAME_TEAM(tmp_entity, self))
+                               if(SAME_TEAM(tmp_entity, player))
                                if(vlen(tmp_entity.origin - spawn_loc) <= vlen(closest_target.origin - spawn_loc) || closest_target == world)
                                        closest_target = tmp_entity;
                        }
@@ -1888,14 +1890,14 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
                                iteration_scale -= i / 10;
                                loc = closest_target.origin + '0 0 128' * iteration_scale;
                                loc += ('0 1 0' * random()) * 256 * iteration_scale;
-                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, self);
+                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
                                if(trace_fraction == 1.0 && !trace_startsolid)
                                {
                                        traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the world
                                        if(trace_fraction == 1.0 && !trace_startsolid)
                                        {
-                                               setorigin(self, loc);
-                                               self.angles = normalize(loc - closest_target.origin) * RAD2DEG;
+                                               setorigin(player, loc);
+                                               player.angles = normalize(loc - closest_target.origin) * RAD2DEG;
                                                return false;
                                        }
                                }
index b9f9bfc21c2992807c513abaf5cd0c7649720138..a3651812b3102bc9b7d68e332f9f13835eaf2216 100644 (file)
@@ -79,8 +79,9 @@ MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
 
 MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn)
 {
-    SELFPARAM();
-       self.spider_slowness = 0;
+       entity player = M_ARGV(0, entity);
+
+       player.spider_slowness = 0;
        return false;
 }
 
index d15f18febcc72f288c9cec998d49f974b8a2d0ae..869dbcb62d5a116d8174040a4022e18acdbb327e 100644 (file)
@@ -620,12 +620,14 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate)
        return false;
 }
 
-MUTATOR_HOOKFUNCTION(buffs,PlayerSpawn)
-{SELFPARAM();
-       self.buffs = 0;
+MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn)
+{
+       entity player = M_ARGV(0, entity);
+
+       player.buffs = 0;
        // reset timers here to prevent them continuing after re-spawn
-       self.buff_disability_time = 0;
-       self.buff_disability_effect_time = 0;
+       player.buff_disability_time = 0;
+       player.buff_disability_effect_time = 0;
        return false;
 }
 
index 067fa1895c92147d758376dddd275b14c447856f..b6d17a3ee84b8c48b1d5e6930b51e83dd58156f6 100644 (file)
@@ -77,11 +77,11 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
 }
 
 MUTATOR_HOOKFUNCTION(campcheck, PlayerSpawn)
-{SELFPARAM();
-       self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
-       self.campcheck_traveled_distance = 0;
+{
+       entity player = M_ARGV(0, entity);
 
-       return false;
+       player.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
+       player.campcheck_traveled_distance = 0;
 }
 
 MUTATOR_HOOKFUNCTION(campcheck, BuildMutatorsString)
index 388ee81a042b22f3519eb47e0f3cffa5459b5c88..3dbce74f24de35fa4ee7744cdd8a946dd3c00cf6 100644 (file)
@@ -29,8 +29,9 @@ MUTATOR_HOOKFUNCTION(hook, BuildGameplayTipsString)
 
 MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
 {
-    SELFPARAM();
-    self.offhand = OFFHAND_HOOK;
+    entity player = M_ARGV(0, entity);
+
+    player.offhand = OFFHAND_HOOK;
 }
 
 MUTATOR_HOOKFUNCTION(hook, FilterItem)
index 8b1b3bf40aec178eb75312afea195e56d365f899..fa8ce973477430f05415cc5e750a2293fa810232 100644 (file)
@@ -174,9 +174,10 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, MakePlayerObserver)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerSpawn)
-{SELFPARAM();
-       self.effects |= EF_FULLBRIGHT;
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       player.effects |= EF_FULLBRIGHT;
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPreThink)
index 34e6e3275a69b75a904f94bae1fc7f47b3650ac3..089f03abb8c8c7827897c5a1af9914393d365384 100644 (file)
@@ -176,9 +176,11 @@ MUTATOR_HOOKFUNCTION(itemstime, ClientConnect, CBC_ORDER_LAST)
 }
 
 MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn)
-{SELFPARAM();
+{
     if (warmup_stage) return;
-    Item_ItemsTime_ResetTimesForPlayer(self);
+    entity player = M_ARGV(0, entity);
+
+    Item_ItemsTime_ResetTimesForPlayer(player);
 }
 
 #endif
index adf3c3a1f3a9aa8f9f5ba9bbf14da86297eeae63..c9a62f34932c1405abe3ac0d94fe5b949204c5c9 100644 (file)
@@ -32,9 +32,11 @@ MUTATOR_HOOKFUNCTION(midair, PlayerPowerups)
 }
 
 MUTATOR_HOOKFUNCTION(midair, PlayerSpawn)
-{SELFPARAM();
-       if(IS_BOT_CLIENT(self))
-               self.bot_moveskill = 0; // disable bunnyhopping
+{
+       entity player = M_ARGV(0, entity);
+
+       if(IS_BOT_CLIENT(player))
+               player.bot_moveskill = 0; // disable bunnyhopping
 
        return false;
 }
index e1efa8e0680f5b8e098ecb1971dc1b795013716b..6b278228614715f8f5b0def6262800664a9a3c37 100644 (file)
@@ -928,8 +928,9 @@ void nades_RemoveBonus(entity player)
 
 MUTATOR_HOOKFUNCTION(nades, PutClientInServer)
 {
-    SELFPARAM();
-       nades_RemoveBonus(self);
+    entity player = M_ARGV(0, entity);
+
+       nades_RemoveBonus(player);
 }
 
 float nade_customize(entity this)
@@ -1237,28 +1238,30 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
 }
 
 MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(autocvar_g_nades_spawn)
-               self.nade_refire = time + autocvar_g_spawnshieldtime;
+               player.nade_refire = time + autocvar_g_spawnshieldtime;
        else
-               self.nade_refire  = time + autocvar_g_nades_nade_refire;
+               player.nade_refire  = time + autocvar_g_nades_nade_refire;
 
        if(autocvar_g_nades_bonus_client_select)
-               self.nade_type = self.cvar_cl_nade_type;
+               player.nade_type = player.cvar_cl_nade_type;
 
-       self.nade_timer = 0;
+       player.nade_timer = 0;
 
-       if (!self.offhand) self.offhand = OFFHAND_NADE;
+       if (!player.offhand) player.offhand = OFFHAND_NADE;
 
-       if(self.nade_spawnloc)
+       if(player.nade_spawnloc)
        {
-               setorigin(self, self.nade_spawnloc.origin);
-               self.nade_spawnloc.cnt -= 1;
+               setorigin(player, player.nade_spawnloc.origin);
+               player.nade_spawnloc.cnt -= 1;
 
-               if(self.nade_spawnloc.cnt <= 0)
+               if(player.nade_spawnloc.cnt <= 0)
                {
-                       remove(self.nade_spawnloc);
-                       self.nade_spawnloc = world;
+                       remove(player.nade_spawnloc);
+                       player.nade_spawnloc = world;
                }
        }
 
index e51003204c54e0a949dfde20d580fa1fcadf1845..5a4df3ea413b3ab1cfe8d7434bc1367cdae77aaa 100644 (file)
@@ -68,7 +68,7 @@ REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"
                });
        }
 
-       return 0;
+       return false;
 }
 
 bool NIX_CanChooseWeapon(int wpn)
@@ -101,8 +101,8 @@ void NIX_ChooseNextWeapon()
        nix_nextweapon = RandomSelection_chosen_float;
 }
 
-void NIX_GiveCurrentWeapon()
-{SELFPARAM();
+void NIX_GiveCurrentWeapon(entity this)
+{
        float dt;
 
        if(!nix_nextweapon)
@@ -127,107 +127,107 @@ void NIX_GiveCurrentWeapon()
 
        if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round!
        {
-               self.ammo_shells = self.ammo_nails = self.ammo_rockets = self.ammo_cells = self.ammo_plasma = self.ammo_fuel = 0;
+               this.ammo_shells = this.ammo_nails = this.ammo_rockets = this.ammo_cells = this.ammo_plasma = this.ammo_fuel = 0;
 
-               if(self.items & IT_UNLIMITED_WEAPON_AMMO)
+               if(this.items & IT_UNLIMITED_WEAPON_AMMO)
                {
                        switch(e.ammo_field)
                        {
-                               case ammo_shells:  self.ammo_shells  = autocvar_g_pickup_shells_max;  break;
-                               case ammo_nails:   self.ammo_nails   = autocvar_g_pickup_nails_max;   break;
-                               case ammo_rockets: self.ammo_rockets = autocvar_g_pickup_rockets_max; break;
-                               case ammo_cells:   self.ammo_cells   = autocvar_g_pickup_cells_max;   break;
-                               case ammo_plasma:  self.ammo_plasma  = autocvar_g_pickup_plasma_max;   break;
-                               case ammo_fuel:    self.ammo_fuel    = autocvar_g_pickup_fuel_max;    break;
+                               case ammo_shells:  this.ammo_shells  = autocvar_g_pickup_shells_max;  break;
+                               case ammo_nails:   this.ammo_nails   = autocvar_g_pickup_nails_max;   break;
+                               case ammo_rockets: this.ammo_rockets = autocvar_g_pickup_rockets_max; break;
+                               case ammo_cells:   this.ammo_cells   = autocvar_g_pickup_cells_max;   break;
+                               case ammo_plasma:  this.ammo_plasma  = autocvar_g_pickup_plasma_max;   break;
+                               case ammo_fuel:    this.ammo_fuel    = autocvar_g_pickup_fuel_max;    break;
                        }
                }
                else
                {
                        switch(e.ammo_field)
                        {
-                               case ammo_shells:  self.ammo_shells  = autocvar_g_balance_nix_ammo_shells;  break;
-                               case ammo_nails:   self.ammo_nails   = autocvar_g_balance_nix_ammo_nails;   break;
-                               case ammo_rockets: self.ammo_rockets = autocvar_g_balance_nix_ammo_rockets; break;
-                               case ammo_cells:   self.ammo_cells   = autocvar_g_balance_nix_ammo_cells;   break;
-                               case ammo_plasma:  self.ammo_plasma  = autocvar_g_balance_nix_ammo_plasma;   break;
-                               case ammo_fuel:    self.ammo_fuel    = autocvar_g_balance_nix_ammo_fuel;    break;
+                               case ammo_shells:  this.ammo_shells  = autocvar_g_balance_nix_ammo_shells;  break;
+                               case ammo_nails:   this.ammo_nails   = autocvar_g_balance_nix_ammo_nails;   break;
+                               case ammo_rockets: this.ammo_rockets = autocvar_g_balance_nix_ammo_rockets; break;
+                               case ammo_cells:   this.ammo_cells   = autocvar_g_balance_nix_ammo_cells;   break;
+                               case ammo_plasma:  this.ammo_plasma  = autocvar_g_balance_nix_ammo_plasma;   break;
+                               case ammo_fuel:    this.ammo_fuel    = autocvar_g_balance_nix_ammo_fuel;    break;
                        }
                }
 
-               self.nix_nextincr = time + autocvar_g_balance_nix_incrtime;
+               this.nix_nextincr = time + autocvar_g_balance_nix_incrtime;
                if(dt >= 1 && dt <= 5)
-                       self.nix_lastinfotime = -42;
+                       this.nix_lastinfotime = -42;
                else
-                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
 
-               e.wr_resetplayer(e, self);
+               WITHSELF(this, e.wr_resetplayer(e, this));
 
                // all weapons must be fully loaded when we spawn
                if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
-                       self.(weapon_load[nix_weapon]) = e.reloading_ammo;
+                       this.(weapon_load[nix_weapon]) = e.reloading_ammo;
 
                // vortex too
                if(WEP_CVAR(vortex, charge))
                {
                        if(WEP_CVAR_SEC(vortex, chargepool))
-                               self.vortex_chargepool_ammo = 1;
-                       self.vortex_charge = WEP_CVAR(vortex, charge_start);
+                               this.vortex_chargepool_ammo = 1;
+                       this.vortex_charge = WEP_CVAR(vortex, charge_start);
                }
 
                // set last change info
-               self.nix_lastchange_id = nix_nextchange;
+               this.nix_lastchange_id = nix_nextchange;
        }
-       if(self.nix_lastinfotime != dt)
+       if(this.nix_lastinfotime != dt)
        {
-               self.nix_lastinfotime = dt; // initial value 0 should count as "not seen"
+               this.nix_lastinfotime = dt; // initial value 0 should count as "not seen"
                if(dt >= 1 && dt <= 5)
-                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_COUNTDOWN, nix_nextweapon, dt);
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_NIX_COUNTDOWN, nix_nextweapon, dt);
        }
 
-       if(!(self.items & IT_UNLIMITED_WEAPON_AMMO) && time > self.nix_nextincr)
+       if(!(this.items & IT_UNLIMITED_WEAPON_AMMO) && time > this.nix_nextincr)
        {
                switch(e.ammo_field)
                {
-                       case ammo_shells:  self.ammo_shells  += autocvar_g_balance_nix_ammoincr_shells;  break;
-                       case ammo_nails:   self.ammo_nails   += autocvar_g_balance_nix_ammoincr_nails;   break;
-                       case ammo_rockets: self.ammo_rockets += autocvar_g_balance_nix_ammoincr_rockets; break;
-                       case ammo_cells:   self.ammo_cells   += autocvar_g_balance_nix_ammoincr_cells;   break;
-                       case ammo_plasma:  self.ammo_plasma  += autocvar_g_balance_nix_ammoincr_plasma;   break;
-                       case ammo_fuel:    self.ammo_fuel    += autocvar_g_balance_nix_ammoincr_fuel;    break;
+                       case ammo_shells:  this.ammo_shells  += autocvar_g_balance_nix_ammoincr_shells;  break;
+                       case ammo_nails:   this.ammo_nails   += autocvar_g_balance_nix_ammoincr_nails;   break;
+                       case ammo_rockets: this.ammo_rockets += autocvar_g_balance_nix_ammoincr_rockets; break;
+                       case ammo_cells:   this.ammo_cells   += autocvar_g_balance_nix_ammoincr_cells;   break;
+                       case ammo_plasma:  this.ammo_plasma  += autocvar_g_balance_nix_ammoincr_plasma;   break;
+                       case ammo_fuel:    this.ammo_fuel    += autocvar_g_balance_nix_ammoincr_fuel;    break;
                }
 
-               self.nix_nextincr = time + autocvar_g_balance_nix_incrtime;
+               this.nix_nextincr = time + autocvar_g_balance_nix_incrtime;
        }
 
-       self.weapons = '0 0 0';
+       this.weapons = '0 0 0';
        if(g_nix_with_blaster)
-               self.weapons |= WEPSET(BLASTER);
-       self.weapons |= e.m_wepset;
+               this.weapons |= WEPSET(BLASTER);
+       this.weapons |= e.m_wepset;
 
     Weapon w = Weapons_from(nix_weapon);
-       if(PS(self).m_switchweapon != w)
-               if(!client_hasweapon(self, PS(self).m_switchweapon, true, false))
+       if(PS(this).m_switchweapon != w)
+               if(!client_hasweapon(this, PS(this).m_switchweapon, true, false))
                {
-                       if(client_hasweapon(self, w, true, false))
-                               W_SwitchWeapon(self, w);
+                       if(client_hasweapon(this, w, true, false))
+                               W_SwitchWeapon(this, w);
                }
 }
 
 MUTATOR_HOOKFUNCTION(nix, ForbidThrowCurrentWeapon)
 {
-       return 1; // no throwing in NIX
+       return true; // no throwing in NIX
 }
 
 MUTATOR_HOOKFUNCTION(nix, BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":NIX");
-       return 0;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nix, BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", NIX");
-       return 0;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nix, FilterItem)
@@ -243,23 +243,23 @@ MUTATOR_HOOKFUNCTION(nix, FilterItem)
                case ITEM_ArmorLarge.m_itemid:
                case ITEM_ArmorMega.m_itemid:
                        if (autocvar_g_nix_with_healtharmor)
-                               return 0;
+                               return false;
                        break;
                case ITEM_Strength.m_itemid:
                case ITEM_Shield.m_itemid:
                        if (autocvar_g_nix_with_powerups)
-                               return 0;
+                               return false;
                        break;
        }
 
-       return 1; // delete all other items
+       return true; // delete all other items
 }
 
 MUTATOR_HOOKFUNCTION(nix, OnEntityPreSpawn)
 {SELFPARAM();
        if(self.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo)
-               return 1;
-       return 0;
+               return true;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nix, PlayerPreThink)
@@ -267,21 +267,23 @@ MUTATOR_HOOKFUNCTION(nix, PlayerPreThink)
        if(!intermission_running)
        if(!IS_DEAD(self))
        if(IS_PLAYER(self))
-               NIX_GiveCurrentWeapon();
-       return 0;
+               NIX_GiveCurrentWeapon(this);
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nix, PlayerSpawn)
-{SELFPARAM();
-       self.nix_lastchange_id = -1;
-       NIX_GiveCurrentWeapon(); // overrides the weapons you got when spawning
-       self.items |= IT_UNLIMITED_SUPERWEAPONS;
-       return 0;
+{
+       entity player = M_ARGV(0, entity);
+
+       player.nix_lastchange_id = -1;
+       NIX_GiveCurrentWeapon(player); // overrides the weapons you got when spawning
+       player.items |= IT_UNLIMITED_SUPERWEAPONS;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nix, SetModname, CBC_ORDER_LAST)
 {
        modname = "NIX";
-       return 0;
+       return false;
 }
 #endif
index 611dc6e0ac508c1427f4a94860d8f4e83f53b83e..b8a203990af6aaa2797788d24fd1f543e0974843 100644 (file)
@@ -256,22 +256,24 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
 }
 
 MUTATOR_HOOKFUNCTION(ok, PlayerSpawn)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(autocvar_g_overkill_ammo_charge)
        {
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(self.ammo_charge[it.m_id] = autocvar_g_overkill_ammo_charge_limit));
+               FOREACH(Weapons, it != WEP_Null, LAMBDA(player.ammo_charge[it.m_id] = autocvar_g_overkill_ammo_charge_limit));
 
-               self.ok_use_ammocharge = 1;
-               self.ok_notice_time = time;
+               player.ok_use_ammocharge = 1;
+               player.ok_notice_time = time;
        }
        else
-               self.ok_use_ammocharge = 0;
+               player.ok_use_ammocharge = 0;
 
        // if player changed their weapon while dead, don't switch to their death weapon
-       if(self.impulse)
-               self.ok_lastwep = 0;
+       if(player.impulse)
+               player.ok_lastwep = 0;
 
-       self.ok_pauseregen_finished = time + 2;
+       player.ok_pauseregen_finished = time + 2;
 
        return false;
 }
index 23348f39de912359df2e8b5f080310ff1532be7d..3d2c17f33f95d614dc3f3d31e5121c75da0877a5 100644 (file)
@@ -19,12 +19,12 @@ REGISTER_MUTATOR(spawn_near_teammate, cvar("g_spawn_near_teammate"));
 MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
 {SELFPARAM();
        if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && self.cvar_cl_spawn_near_teammate))
-               return 0;
+               return false;
 
        spawn_spot.msnt_lookat = world;
 
        if(!teamplay)
-               return 0;
+               return false;
 
        RandomSelection_Init();
        FOREACH_CLIENT(IS_PLAYER(it) && it != self && SAME_TEAM(it, self) && !IS_DEAD(it), LAMBDA(
@@ -45,12 +45,13 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
        else if(self.team == spawn_spot.team)
                spawn_score.x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate
 
-       return 0;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
-{SELFPARAM();
+{
        if(!teamplay) { return false; }
+       entity player = M_ARGV(0, entity);
 
        int num_red = 0, num_blue = 0, num_yellow = 0, num_pink = 0;
        FOREACH_CLIENT(IS_PLAYER(it),
@@ -68,10 +69,10 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                return false; // at least 1 team has only 1 player, let's not give the bigger team too much of an advantage!
 
        // Note: when entering this, fixangle is already set.
-       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && self.cvar_cl_spawn_near_teammate))
+       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && player.cvar_cl_spawn_near_teammate))
        {
                if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death)
-                       self.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
+                       player.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
 
                entity best_mate = world;
                vector best_spot = '0 0 0';
@@ -80,10 +81,10 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                        if((autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health >= 0 && it.health >= autocvar_g_balance_health_regenstable) || autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health == 0)
                        if(!IS_DEAD(it))
                        if(it.msnt_timer < time)
-                       if(SAME_TEAM(self, it))
+                       if(SAME_TEAM(player, it))
                        if(time > it.spawnshieldtime) // spawn shielding
                        if(STAT(FROZEN, it) == 0)
-                       if(it != self)
+                       if(it != player)
                        {
                                tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - '0 0 100', MOVE_NOMONSTERS, it);
                                if(trace_fraction != 1.0)
@@ -125,7 +126,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                                                                {
                                                                        if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)
                                                                        {
-                                                                               dist = vlen(trace_endpos - self.msnt_deathloc);
+                                                                               dist = vlen(trace_endpos - player.msnt_deathloc);
                                                                                if(dist < best_dist || best_dist == 0)
                                                                                {
                                                                                        best_dist = dist;
@@ -135,11 +136,11 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                                                                        }
                                                                        else
                                                                        {
-                                                                               setorigin(self, trace_endpos);
-                                                                               self.angles = it.angles;
-                                                                               self.angles_z = 0; // never spawn tilted even if the spot says to
+                                                                               setorigin(player, trace_endpos);
+                                                                               player.angles = it.angles;
+                                                                               player.angles_z = 0; // never spawn tilted even if the spot says to
                                                                                it.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
-                                                                               return 0;
+                                                                               return false;
                                                                        }
                                                                }
                                                        }
@@ -152,31 +153,31 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)
                if(best_dist)
                {
-                       setorigin(self, best_spot);
-                       self.angles = best_mate.angles;
-                       self.angles_z = 0; // never spawn tilted even if the spot says to
+                       setorigin(player, best_spot);
+                       player.angles = best_mate.angles;
+                       player.angles_z = 0; // never spawn tilted even if the spot says to
                        best_mate.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
                }
        }
        else if(spawn_spot.msnt_lookat)
        {
-               self.angles = vectoangles(spawn_spot.msnt_lookat.origin - self.origin);
-               self.angles_x = -self.angles.x;
-               self.angles_z = 0; // never spawn tilted even if the spot says to
+               player.angles = vectoangles(spawn_spot.msnt_lookat.origin - player.origin);
+               player.angles_x = -player.angles.x;
+               player.angles_z = 0; // never spawn tilted even if the spot says to
                /*
-               sprint(self, "You should be looking at ", spawn_spot.msnt_lookat.netname, "^7.\n");
-               sprint(self, "distance: ", vtos(spawn_spot.msnt_lookat.origin - self.origin), "\n");
-               sprint(self, "angles: ", vtos(self.angles), "\n");
+               sprint(player, "You should be looking at ", spawn_spot.msnt_lookat.netname, "^7.\n");
+               sprint(player, "distance: ", vtos(spawn_spot.msnt_lookat.origin - player.origin), "\n");
+               sprint(player, "angles: ", vtos(player.angles), "\n");
                */
        }
 
-       return 0;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerDies)
 {
        frag_target.msnt_deathloc = frag_target.origin;
-       return 0;
+       return false;
 }
 
 REPLICATE(cvar_cl_spawn_near_teammate, bool, "cl_spawn_near_teammate");
index 5c821007785c99d1fe66199ebc69f1e4b317d3f1..e4d400db7021e08e5f4384b039254e995b2ac890 100644 (file)
@@ -2,12 +2,14 @@
 // WEAPONTODO: rename the cvars
 REGISTER_MUTATOR(weaponarena_random, true);
 
-MUTATOR_HOOKFUNCTION(weaponarena_random, PlayerSpawn) {
-    SELFPARAM();
+MUTATOR_HOOKFUNCTION(weaponarena_random, PlayerSpawn)
+{
     if (!g_weaponarena_random) return;
-    if (g_weaponarena_random_with_blaster) this.weapons &= ~WEPSET(BLASTER);
-    W_RandomWeapons(this, g_weaponarena_random);
-    if (g_weaponarena_random_with_blaster) this.weapons |= WEPSET(BLASTER);
+    entity player = M_ARGV(0, entity);
+
+    if (g_weaponarena_random_with_blaster) player.weapons &= ~WEPSET(BLASTER);
+    W_RandomWeapons(player, g_weaponarena_random);
+    if (g_weaponarena_random_with_blaster) player.weapons |= WEPSET(BLASTER);
 }
 
 #endif
index fe0c3a547fa776d04e5d13a42fd9ee11a2c69d38..6f0e1d3aecb94e2347fbe1c24ff8cba7af1e091a 100644 (file)
@@ -635,7 +635,7 @@ void PutClientInServer()
 
                Unfreeze(this);
 
-               MUTATOR_CALLHOOK(PlayerSpawn, spot);
+               MUTATOR_CALLHOOK(PlayerSpawn, this, spot);
 
                if (autocvar_spawn_debug)
                {
index 05adcf17314b4466c34bb63b9f5fd37dfac296b4..91b74335dde6a3e263dbf920bbd968083a32b440 100644 (file)
@@ -11,15 +11,15 @@ MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
 
 /** */
 #define EV_PutClientInServer(i, o) \
-    /** client wanting to spawn */ i(entity, __self) \
+       /** client wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
 
 /** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
 #define EV_PlayerSpawn(i, o) \
-    /** spot that was used, or world */ i(entity, spawn_spot) \
+       /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** spot that was used, or world */ i(entity, MUTATOR_ARGV_1_entity) \
     /**/
-entity spawn_spot;
 MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
 
 /** called in reset_map */
@@ -437,6 +437,7 @@ MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
     /** _x is priority, _y is "distance" */ i(vector, spawn_score) \
     /**/ o(vector, spawn_score) \
     /**/
+entity spawn_spot;
 vector spawn_score;
 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
 
index 47544dacde8a9a4365179e9fdf33306c2c4eea1c..c8519a76e1f6dcfbbee4bc2f68336fff7aeb675a 100644 (file)
@@ -613,11 +613,13 @@ void havocbot_ast_reset_role(entity this)
 
 // mutator hooks
 MUTATOR_HOOKFUNCTION(as, PlayerSpawn)
-{SELFPARAM();
-       if(self.team == assault_attacker_team)
-               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING);
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.team == assault_attacker_team)
+               Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_ASSAULT_ATTACKING);
        else
-               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_DEFENDING);
+               Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_ASSAULT_DEFENDING);
 
        return false;
 }
index c49bfa2188ec68b545a86d74d11c334dfc103dda..c7c1c7e8387b2b7cfa446e19cb85c9a895e379a6 100644 (file)
@@ -220,22 +220,24 @@ entity CA_SpectateNext(entity player, entity start)
 
 MUTATOR_HOOKFUNCTION(ca, PlayerSpawn)
 {
-    SELFPARAM();
-       this.caplayer = 1;
+    entity player = M_ARGV(0, entity);
+
+       player.caplayer = 1;
        if (!warmup_stage)
                eliminatedPlayers.SendFlags |= 1;
 }
 
 MUTATOR_HOOKFUNCTION(ca, PutClientInServer)
 {
-    SELFPARAM();
-       if (!allowed_to_spawn && IS_PLAYER(this)) // this is true even when player is trying to join
+       entity player = M_ARGV(0, entity);
+
+       if (!allowed_to_spawn && IS_PLAYER(player)) // this is true even when player is trying to join
        {
-               TRANSMUTE(Observer, this);
-               if (this.jointime != time && !this.caplayer) // not when connecting
+               TRANSMUTE(Observer, player);
+               if (player.jointime != time && !player.caplayer) // not when connecting
                {
-                       this.caplayer = 0.5;
-                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CA_JOIN_LATE);
+                       player.caplayer = 0.5;
+                       Send_Notification(NOTIF_ONE_ONLY, player, MSG_INFO, INFO_CA_JOIN_LATE);
                }
        }
 }
index 88464a9344ce7ad4705863031a965096c9bc0817..777cf1fa097548d19a4a80f0ac7b613951fd8989 100644 (file)
@@ -253,31 +253,36 @@ MUTATOR_HOOKFUNCTION(cts, MakePlayerObserver)
 }
 
 MUTATOR_HOOKFUNCTION(cts, PlayerSpawn)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+       entity spawn_spot = M_ARGV(1, entity);
+
        if(spawn_spot.target == "")
                // Emergency: this wasn't a real spawnpoint. Can this ever happen?
-               race_PreparePlayer(this);
+               race_PreparePlayer(player);
 
        // if we need to respawn, do it right
-       self.race_respawn_checkpoint = self.race_checkpoint;
-       self.race_respawn_spotref = spawn_spot;
+       player.race_respawn_checkpoint = player.race_checkpoint;
+       player.race_respawn_spotref = spawn_spot;
 
-       self.race_place = 0;
+       player.race_place = 0;
 
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts, PutClientInServer)
-{SELFPARAM();
-       if(IS_PLAYER(self))
+{
+       entity player = M_ARGV(0, entity);
+
+       if(IS_PLAYER(player))
        if(!gameover)
        {
-               if(self.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
-                       race_PreparePlayer(this);
+               if(player.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
+                       race_PreparePlayer(player);
                else // respawn
-                       race_RetractPlayer(this);
+                       race_RetractPlayer(player);
 
-               race_AbandonRaceCheck(self);
+               race_AbandonRaceCheck(player);
        }
        return false;
 }
index 84d7200b54967e072434dd055e03b3c4bd9b079f..abee018bee1883f8d6efcd780fda951dd4f29a2c 100644 (file)
@@ -507,12 +507,14 @@ MUTATOR_HOOKFUNCTION(dom, reset_map_players)
 }
 
 MUTATOR_HOOKFUNCTION(dom, PlayerSpawn)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(domination_roundbased)
        if(!round_handler_IsRoundStarted())
-               self.player_blocked = 1;
+               player.player_blocked = 1;
        else
-               self.player_blocked = 0;
+               player.player_blocked = 0;
        return false;
 }
 
index 5e11666b856d5163bcd1f5e6b3a228ab55a2c53d..7700e074a24f36dd453288326207ed518c1787a8 100644 (file)
@@ -428,13 +428,15 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies)
 }
 
 MUTATOR_HOOKFUNCTION(ft, PlayerSpawn)
-{SELFPARAM();
-       if(self.freezetag_frozen_timeout == -1) // if PlayerSpawn is called by reset_map_players
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.freezetag_frozen_timeout == -1) // if PlayerSpawn is called by reset_map_players
                return 1; // do nothing, round is starting right now
 
-       if(self.freezetag_frozen_timeout == -2) // player was dead
+       if(player.freezetag_frozen_timeout == -2) // player was dead
        {
-               freezetag_Freeze(world);
+               WITHSELF(player, freezetag_Freeze(world));
                return 1;
        }
 
@@ -443,8 +445,8 @@ MUTATOR_HOOKFUNCTION(ft, PlayerSpawn)
        if(round_handler_IsActive())
        if(round_handler_IsRoundStarted())
        {
-               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_SPAWN_LATE);
-               freezetag_Freeze(world);
+               Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_SPAWN_LATE);
+               WITHSELF(player, freezetag_Freeze(world));
        }
 
        return 1;
index 6fcfc1913d694acb43a62bf1f10e04939fcd67a8..db4f857318104b6f1211682b4ddc858707c6bed1 100644 (file)
@@ -396,8 +396,10 @@ MUTATOR_HOOKFUNCTION(inv, PlayerRegen)
 }
 
 MUTATOR_HOOKFUNCTION(inv, PlayerSpawn)
-{SELFPARAM();
-       self.bot_attack = false;
+{
+       entity player = M_ARGV(0, entity);
+
+       player.bot_attack = false;
        return false;
 }
 
index 98eb9cdcf301fcc1b64c63578d69fc2a51d9235b..dac0e148a3839c578565a90fd6a182ce5c092a74 100644 (file)
@@ -168,13 +168,15 @@ MUTATOR_HOOKFUNCTION(lms, reset_map_players)
 }
 
 MUTATOR_HOOKFUNCTION(lms, PutClientInServer)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        // player is dead and becomes observer
        // FIXME fix LMS scoring for new system
-       if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
+       if(PlayerScore_Add(player, SP_LMS_RANK, 0) > 0)
        {
-               TRANSMUTE(Observer, self);
-               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_LMS_NOLIVES);
+               TRANSMUTE(Observer, player);
+               Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_LMS_NOLIVES);
        }
 }
 
index fc87ae9793ae29999bde64967800661c8eb6712f..95a97db500b4a5cda6adb3238322882a775ff995 100644 (file)
@@ -286,31 +286,36 @@ MUTATOR_HOOKFUNCTION(rc, MakePlayerObserver)
 }
 
 MUTATOR_HOOKFUNCTION(rc, PlayerSpawn)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+       entity spawn_spot = M_ARGV(1, entity);
+
        if(spawn_spot.target == "")
                // Emergency: this wasn't a real spawnpoint. Can this ever happen?
-               race_PreparePlayer(this);
+               race_PreparePlayer(player);
 
        // if we need to respawn, do it right
-       self.race_respawn_checkpoint = self.race_checkpoint;
-       self.race_respawn_spotref = spawn_spot;
+       player.race_respawn_checkpoint = player.race_checkpoint;
+       player.race_respawn_spotref = spawn_spot;
 
-       self.race_place = 0;
+       player.race_place = 0;
 
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(rc, PutClientInServer)
-{SELFPARAM();
-       if(IS_PLAYER(self))
+{
+       entity player = M_ARGV(0, entity);
+
+       if(IS_PLAYER(player))
        if(!gameover)
        {
-               if(self.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
-                       race_PreparePlayer(this);
+               if(player.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
+                       race_PreparePlayer(player);
                else // respawn
-                       race_RetractPlayer(this);
+                       race_RetractPlayer(player);
 
-               race_AbandonRaceCheck(self);
+               race_AbandonRaceCheck(player);
        }
        return false;
 }