]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanse PlayerUseKey and PlayerPreThink
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 09:12:19 +0000 (19:12 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 09:12:19 +0000 (19:12 +1000)
17 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/campcheck/campcheck.qc
qcsrc/common/mutators/mutator/instagib/instagib.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/touchexplode/touchexplode.qc
qcsrc/server/cl_client.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc

index e624428ec2a319135fa35cf6849b8bd87b57914f..d17ff7f1619a60ec227f6d30eafe7986fe17a1a5 100644 (file)
@@ -944,45 +944,47 @@ MUTATOR_HOOKFUNCTION(nb, MakePlayerObserver)
 }
 
 MUTATOR_HOOKFUNCTION(nb, PlayerPreThink)
-{SELFPARAM();
-       makevectors(self.v_angle);
+{
+       entity player = M_ARGV(0, entity);
+
+       makevectors(player.v_angle);
        if(nexball_mode & NBM_BASKETBALL)
        {
-               if(self.ballcarried)
+               if(player.ballcarried)
                {
                        // 'view ball'
-                       self.ballcarried.velocity = self.velocity;
-                       setcefc(self.ballcarried, ball_customize);
+                       player.ballcarried.velocity = player.velocity;
+                       setcefc(player.ballcarried, ball_customize);
 
-                       vector org = self.origin + self.view_ofs +
+                       vector org = player.origin + player.view_ofs +
                                          v_forward * autocvar_g_nexball_viewmodel_offset.x +
                                          v_right * autocvar_g_nexball_viewmodel_offset.y +
                                          v_up * autocvar_g_nexball_viewmodel_offset.z;
-                       setorigin(self.ballcarried, org);
+                       setorigin(player.ballcarried, org);
 
                        // 'safe passing'
                        if(autocvar_g_nexball_safepass_maxdist)
                        {
-                               if(self.ballcarried.wait < time && self.ballcarried.enemy)
+                               if(player.ballcarried.wait < time && player.ballcarried.enemy)
                                {
-                                       //centerprint(self, sprintf("Lost lock on %s", self.ballcarried.enemy.netname));
-                                       self.ballcarried.enemy = world;
+                                       //centerprint(player, sprintf("Lost lock on %s", player.ballcarried.enemy.netname));
+                                       player.ballcarried.enemy = world;
                                }
 
 
-                               //tracebox(self.origin + self.view_ofs, '-2 -2 -2', '2 2 2', self.origin + self.view_ofs + v_forward * autocvar_g_nexball_safepass_maxdist);
-                               crosshair_trace(self);
+                               //tracebox(player.origin + player.view_ofs, '-2 -2 -2', '2 2 2', player.origin + player.view_ofs + v_forward * autocvar_g_nexball_safepass_maxdist);
+                               crosshair_trace(player);
                                if( trace_ent &&
                                        IS_CLIENT(trace_ent) &&
                                        !IS_DEAD(trace_ent) &&
-                                       trace_ent.team == self.team &&
-                                       vlen(trace_ent.origin - self.origin) <= autocvar_g_nexball_safepass_maxdist )
+                                       trace_ent.team == player.team &&
+                                       vdist(trace_ent.origin - player.origin, <=, autocvar_g_nexball_safepass_maxdist) )
                                {
 
-                                       //if(self.ballcarried.enemy != trace_ent)
-                                       //      centerprint(self, sprintf("Locked to %s", trace_ent.netname));
-                                       self.ballcarried.enemy = trace_ent;
-                                       self.ballcarried.wait = time + autocvar_g_nexball_safepass_holdtime;
+                                       //if(player.ballcarried.enemy != trace_ent)
+                                       //      centerprint(player, sprintf("Locked to %s", trace_ent.netname));
+                                       player.ballcarried.enemy = trace_ent;
+                                       player.ballcarried.wait = time + autocvar_g_nexball_safepass_holdtime;
 
 
                                }
@@ -991,23 +993,21 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink)
                else
                {
                        .entity weaponentity = weaponentities[0]; // TODO
-                       if(self.(weaponentity).weapons)
+                       if(player.(weaponentity).weapons)
                        {
-                               self.weapons = self.(weaponentity).weapons;
+                               player.weapons = player.(weaponentity).weapons;
                                Weapon w = WEP_NEXBALL;
-                               w.wr_resetplayer(w, self);
-                               PS(self).m_switchweapon = self.(weaponentity).m_switchweapon;
-                               W_SwitchWeapon(self, PS(self).m_switchweapon);
+                               WITHSELF(player, w.wr_resetplayer(w, player));
+                               PS(player).m_switchweapon = player.(weaponentity).m_switchweapon;
+                               W_SwitchWeapon(player, PS(player).m_switchweapon);
 
-                               self.(weaponentity).weapons = '0 0 0';
+                               player.(weaponentity).weapons = '0 0 0';
                        }
                }
 
        }
 
-       nexball_setstatus(self);
-
-       return false;
+       nexball_setstatus(player);
 }
 
 MUTATOR_HOOKFUNCTION(nb, SpectateCopy)
index 96c3ac719bb71f13dc0a14c89b43834b7d609b9f..005bd09216101761067eb34a042563f3c5365399 100644 (file)
@@ -2104,20 +2104,20 @@ MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand)
 }
 
 MUTATOR_HOOKFUNCTION(ons, PlayerUseKey)
-{SELFPARAM();
+{
        if(MUTATOR_RETURNVALUE || gameover) { return false; }
 
-       if((time > self.teleport_antispam) && (!IS_DEAD(self)) && !self.vehicle)
+       entity player = M_ARGV(0, entity);
+
+       if((time > player.teleport_antispam) && (!IS_DEAD(player)) && !player.vehicle)
        {
-               entity source_point = ons_Nearest_ControlPoint(self, self.origin, autocvar_g_onslaught_teleport_radius);
+               entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius);
                if ( source_point )
                {
-                       stuffcmd(self, "qc_cmd_cl hud clickradar\n");
+                       stuffcmd(player, "qc_cmd_cl hud clickradar\n");
                        return true;
                }
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ons, PlayHitsound)
index 4cbdfcfb7bd04e6864dce472c3cf0b56bd9aac8b..f4678e1db98fba8eb0e742995988dfba9690a8f2 100644 (file)
@@ -4,23 +4,23 @@ REGISTER_MUTATOR(bloodloss, cvar("g_bloodloss"));
 .float bloodloss_timer;
 
 MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
-{SELFPARAM();
-       if(IS_PLAYER(self))
-       if(self.health <= autocvar_g_bloodloss && !IS_DEAD(self))
+{
+       entity player = M_ARGV(0, entity);
+
+       if(IS_PLAYER(player))
+       if(player.health <= autocvar_g_bloodloss && !IS_DEAD(player))
        {
-               PHYS_INPUT_BUTTON_CROUCH(self) = true;
+               PHYS_INPUT_BUTTON_CROUCH(player) = true;
 
-               if(time >= self.bloodloss_timer)
+               if(time >= player.bloodloss_timer)
                {
-                       if(self.vehicle)
+                       if(player.vehicle)
                                vehicles_exit(VHEF_RELEASE);
-                       if(self.event_damage)
-                               self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
-                       self.bloodloss_timer = time + 0.5 + random() * 0.5;
+                       if(player.event_damage)
+                               player.event_damage(player, player, player, 1, DEATH_ROT.m_id, player.origin, '0 0 0');
+                       player.bloodloss_timer = time + 0.5 + random() * 0.5;
                }
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
index 78ced032d827c21df5cd86abf196591de4d9d2b5..776d36b3f7e5065b85d02d6831ac1e740cc30d5e 100644 (file)
@@ -701,19 +701,21 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDies)
 }
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerUseKey, CBC_ORDER_FIRST)
-{SELFPARAM();
-       if(MUTATOR_RETURNVALUE || gameover) { return false; }
-       if(self.buffs)
+{
+       if(MUTATOR_RETURNVALUE || gameover) { return; }
+
+       entity player = M_ARGV(0, entity);
+
+       if(player.buffs)
        {
-               int buffid = buff_FirstFromFlags(self.buffs).m_id;
-               Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_BUFF_DROP, buffid);
-               Send_Notification(NOTIF_ALL_EXCEPT, self, MSG_INFO, INFO_ITEM_BUFF_LOST, self.netname, buffid);
+               int buffid = buff_FirstFromFlags(player.buffs).m_id;
+               Send_Notification(NOTIF_ONE, player, MSG_MULTI, ITEM_BUFF_DROP, buffid);
+               Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
 
-               self.buffs = 0;
-               sound(self, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
+               player.buffs = 0;
+               sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
                return true;
        }
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon)
@@ -860,14 +862,16 @@ MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor)
 }
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
-{SELFPARAM();
-       if(gameover || IS_DEAD(self)) { return false; }
+{
+       entity player = M_ARGV(0, entity);
 
-       if(time < self.buff_disability_time)
-       if(time >= self.buff_disability_effect_time)
+       if(gameover || IS_DEAD(player)) { return false; }
+
+       if(time < player.buff_disability_time)
+       if(time >= player.buff_disability_effect_time)
        {
-               Send_Effect(EFFECT_SMOKING, self.origin + ((self.mins + self.maxs) * 0.5), '0 0 0', 1);
-               self.buff_disability_effect_time = time + 0.5;
+               Send_Effect(EFFECT_SMOKING, player.origin + ((player.mins + player.maxs) * 0.5), '0 0 0', 1);
+               player.buff_disability_effect_time = time + 0.5;
        }
 
        // handle buff lost status
@@ -875,28 +879,28 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
        // 2: notify carrier as well
        int buff_lost = 0;
 
-       if(self.buff_time)
-       if(time >= self.buff_time)
+       if(player.buff_time)
+       if(time >= player.buff_time)
                buff_lost = 2;
 
-       if(STAT(FROZEN, self)) { buff_lost = 1; }
+       if(STAT(FROZEN, player)) { buff_lost = 1; }
 
        if(buff_lost)
        {
-               if(self.buffs)
+               if(player.buffs)
                {
-                       int buffid = buff_FirstFromFlags(self.buffs).m_id;
-                       Send_Notification(NOTIF_ALL_EXCEPT, self, MSG_INFO, INFO_ITEM_BUFF_LOST, self.netname, buffid);
+                       int buffid = buff_FirstFromFlags(player.buffs).m_id;
+                       Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
                        if(buff_lost >= 2)
                        {
-                               Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_BUFF_DROP, buffid); // TODO: special timeout message?
-                               sound(self, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
+                               Send_Notification(NOTIF_ONE, player, MSG_MULTI, ITEM_BUFF_DROP, buffid); // TODO: special timeout message?
+                               sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
                        }
-                       self.buffs = 0;
+                       player.buffs = 0;
                }
        }
 
-       if(self.buffs & BUFF_MAGNET.m_itemid)
+       if(player.buffs & BUFF_MAGNET.m_itemid)
        {
                vector pickup_size;
                FOREACH_ENTITY_FLAGS(flags, FL_ITEM,
@@ -906,12 +910,12 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
                        else
                                pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_item;
 
-                       if(boxesoverlap(self.absmin - pickup_size, self.absmax + pickup_size, it.absmin, it.absmax))
+                       if(boxesoverlap(player.absmin - pickup_size, player.absmax + pickup_size, it.absmin, it.absmax))
                        {
                                if(gettouch(it))
                                {
                                        entity oldother = other;
-                                       other = self;
+                                       other = player;
                                        WITHSELF(it, gettouch(it)(it));
                                        other = oldother;
                                }
@@ -919,96 +923,95 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
                });
        }
 
-       if(self.buffs & BUFF_AMMO.m_itemid)
-       if(self.clip_size)
-               self.clip_load = self.(weapon_load[PS(self).m_switchweapon.m_id]) = self.clip_size;
+       if(player.buffs & BUFF_AMMO.m_itemid)
+       if(player.clip_size)
+               player.clip_load = player.(weapon_load[PS(player).m_switchweapon.m_id]) = player.clip_size;
 
-       if((self.buffs & BUFF_INVISIBLE.m_itemid) && (self.oldbuffs & BUFF_INVISIBLE.m_itemid))
-       if(self.alpha != autocvar_g_buffs_invisible_alpha)
-               self.alpha = autocvar_g_buffs_invisible_alpha; // powerups reset alpha, so we must enforce this (TODO)
+       if((player.buffs & BUFF_INVISIBLE.m_itemid) && (player.oldbuffs & BUFF_INVISIBLE.m_itemid))
+       if(player.alpha != autocvar_g_buffs_invisible_alpha)
+               player.alpha = autocvar_g_buffs_invisible_alpha; // powerups reset alpha, so we must enforce this (TODO)
 
-       if(self.buffs & BUFF_MEDIC.m_itemid)
-       if(time >= self.buff_medic_healtime)
+       if(player.buffs & BUFF_MEDIC.m_itemid)
+       if(time >= player.buff_medic_healtime)
        {
-               buff_Medic_Heal(self);
-               self.buff_medic_healtime = time + autocvar_g_buffs_medic_heal_delay;
+               buff_Medic_Heal(player);
+               player.buff_medic_healtime = time + autocvar_g_buffs_medic_heal_delay;
        }
 
-#define BUFF_ONADD(b) if ( (self.buffs & (b).m_itemid) && !(self.oldbuffs & (b).m_itemid))
-#define BUFF_ONREM(b) if (!(self.buffs & (b).m_itemid) &&  (self.oldbuffs & (b).m_itemid))
+#define BUFF_ONADD(b) if ( (player.buffs & (b).m_itemid) && !(player.oldbuffs & (b).m_itemid))
+#define BUFF_ONREM(b) if (!(player.buffs & (b).m_itemid) &&  (player.oldbuffs & (b).m_itemid))
 
-       if(self.buffs != self.oldbuffs)
+       if(player.buffs != player.oldbuffs)
        {
-               entity buff = buff_FirstFromFlags(self.buffs);
+               entity buff = buff_FirstFromFlags(player.buffs);
                float bufftime = buff != BUFF_Null ? buff.m_time(buff) : 0;
-               self.buff_time = (bufftime) ? time + bufftime : 0;
+               player.buff_time = (bufftime) ? time + bufftime : 0;
 
                BUFF_ONADD(BUFF_AMMO)
                {
-                       self.buff_ammo_prev_infitems = (self.items & IT_UNLIMITED_WEAPON_AMMO);
-                       self.items |= IT_UNLIMITED_WEAPON_AMMO;
+                       player.buff_ammo_prev_infitems = (player.items & IT_UNLIMITED_WEAPON_AMMO);
+                       player.items |= IT_UNLIMITED_WEAPON_AMMO;
 
-                       if(self.clip_load)
-                               self.buff_ammo_prev_clipload = self.clip_load;
-                       self.clip_load = self.(weapon_load[PS(self).m_switchweapon.m_id]) = self.clip_size;
+                       if(player.clip_load)
+                               player.buff_ammo_prev_clipload = player.clip_load;
+                       player.clip_load = player.(weapon_load[PS(player).m_switchweapon.m_id]) = player.clip_size;
                }
 
                BUFF_ONREM(BUFF_AMMO)
                {
-                       if(self.buff_ammo_prev_infitems)
-                               self.items |= IT_UNLIMITED_WEAPON_AMMO;
+                       if(player.buff_ammo_prev_infitems)
+                               player.items |= IT_UNLIMITED_WEAPON_AMMO;
                        else
-                               self.items &= ~IT_UNLIMITED_WEAPON_AMMO;
+                               player.items &= ~IT_UNLIMITED_WEAPON_AMMO;
 
-                       if(self.buff_ammo_prev_clipload)
-                               self.clip_load = self.buff_ammo_prev_clipload;
+                       if(player.buff_ammo_prev_clipload)
+                               player.clip_load = player.buff_ammo_prev_clipload;
                }
 
                BUFF_ONADD(BUFF_INVISIBLE)
                {
-                       if(time < self.strength_finished && g_instagib)
-                               self.alpha = autocvar_g_instagib_invis_alpha;
+                       if(time < player.strength_finished && g_instagib)
+                               player.alpha = autocvar_g_instagib_invis_alpha;
                        else
-                               self.alpha = self.buff_invisible_prev_alpha;
-                       self.alpha = autocvar_g_buffs_invisible_alpha;
+                               player.alpha = player.buff_invisible_prev_alpha;
+                       player.alpha = autocvar_g_buffs_invisible_alpha;
                }
 
                BUFF_ONREM(BUFF_INVISIBLE)
-                       self.alpha = self.buff_invisible_prev_alpha;
+                       player.alpha = player.buff_invisible_prev_alpha;
 
-               self.oldbuffs = self.buffs;
-               if(self.buffs)
+               player.oldbuffs = player.buffs;
+               if(player.buffs)
                {
-                       if(!self.buff_model)
-                               buffs_BuffModel_Spawn(self);
+                       if(!player.buff_model)
+                               buffs_BuffModel_Spawn(player);
 
-                       self.buff_model.color = buff.m_color;
-                       self.buff_model.glowmod = buff_GlowColor(self.buff_model);
-                       self.buff_model.skin = buff.m_skin;
+                       player.buff_model.color = buff.m_color;
+                       player.buff_model.glowmod = buff_GlowColor(player.buff_model);
+                       player.buff_model.skin = buff.m_skin;
 
-                       self.effects |= EF_NOSHADOW;
+                       player.effects |= EF_NOSHADOW;
                }
                else
                {
-                       remove(self.buff_model);
-                       self.buff_model = world;
+                       remove(player.buff_model);
+                       player.buff_model = world;
 
-                       self.effects &= ~(EF_NOSHADOW);
+                       player.effects &= ~(EF_NOSHADOW);
                }
        }
 
-       if(self.buff_model)
+       if(player.buff_model)
        {
-               self.buff_model.effects = self.effects;
-               self.buff_model.effects |= EF_LOWPRECISION;
-               self.buff_model.effects = self.buff_model.effects & EFMASK_CHEAP; // eat performance
+               player.buff_model.effects = player.effects;
+               player.buff_model.effects |= EF_LOWPRECISION;
+               player.buff_model.effects = player.buff_model.effects & EFMASK_CHEAP; // eat performance
 
-               self.buff_model.alpha = self.alpha;
+               player.buff_model.alpha = player.alpha;
        }
 
 #undef BUFF_ONADD
 #undef BUFF_ONREM
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, SpectateCopy)
index daf4e107ca612b06a857211dec9cca7ce2a8f4d8..38a1ab835231780e93fba8031fc6b58572e729d0 100644 (file)
@@ -33,49 +33,50 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerDamage_Calculate)
 }
 
 MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(!gameover)
        if(!warmup_stage) // don't consider it camping during warmup?
        if(time >= game_starttime)
-       if(IS_PLAYER(self))
-       if(IS_REAL_CLIENT(self)) // bots may camp, but that's no reason to constantly kill them
-       if(!IS_DEAD(self))
-       if(!STAT(FROZEN, self))
-       if(!PHYS_INPUT_BUTTON_CHAT(self))
+       if(IS_PLAYER(player))
+       if(IS_REAL_CLIENT(player)) // bots may camp, but that's no reason to constantly kill them
+       if(!IS_DEAD(player))
+       if(!STAT(FROZEN, player))
+       if(!PHYS_INPUT_BUTTON_CHAT(player))
        if(autocvar_g_campcheck_interval)
        {
                vector dist;
 
                // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
-               dist = self.prevorigin - self.origin;
+               dist = player.prevorigin - player.origin;
                dist.z = 0;
-               self.campcheck_traveled_distance += fabs(vlen(dist));
+               player.campcheck_traveled_distance += fabs(vlen(dist));
 
                if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime) || (round_handler_IsActive() && !round_handler_IsRoundStarted()))
                {
-                       self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
-                       self.campcheck_traveled_distance = 0;
+                       player.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
+                       player.campcheck_traveled_distance = 0;
                }
 
-               if(time > self.campcheck_nextcheck)
+               if(time > player.campcheck_nextcheck)
                {
-                       if(self.campcheck_traveled_distance < autocvar_g_campcheck_distance)
+                       if(player.campcheck_traveled_distance < autocvar_g_campcheck_distance)
                        {
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_CAMPCHECK);
-                               if(self.vehicle)
-                                       Damage(self.vehicle, world, world, autocvar_g_campcheck_damage * 2, DEATH_CAMP.m_id, self.vehicle.origin, '0 0 0');
+                               Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CAMPCHECK);
+                               if(player.vehicle)
+                                       Damage(player.vehicle, world, world, autocvar_g_campcheck_damage * 2, DEATH_CAMP.m_id, player.vehicle.origin, '0 0 0');
                                else
-                                       Damage(self, world, world, bound(0, autocvar_g_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP.m_id, self.origin, '0 0 0');
+                                       Damage(player, world, world, bound(0, autocvar_g_campcheck_damage, player.health + player.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP.m_id, player.origin, '0 0 0');
                        }
-                       self.campcheck_nextcheck = time + autocvar_g_campcheck_interval;
-                       self.campcheck_traveled_distance = 0;
+                       player.campcheck_nextcheck = time + autocvar_g_campcheck_interval;
+                       player.campcheck_traveled_distance = 0;
                }
 
-               return false;
+               return;
        }
 
-       self.campcheck_nextcheck = time + autocvar_g_campcheck_interval; // one of the above checks failed, so keep the timer up to date
-       return false;
+       player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; // one of the above checks failed, so keep the timer up to date
 }
 
 MUTATOR_HOOKFUNCTION(campcheck, PlayerSpawn)
index ef1856d688dd3f17487017e9ac171d1bee8e5513..0be98ba06fb2657b2a255b02ce7bef8d6bf38c4d 100644 (file)
@@ -188,9 +188,10 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPreThink)
-{SELFPARAM();
-       instagib_ammocheck(self);
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       instagib_ammocheck(player);
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerRegen)
index 45c1560714c3f5540b833fb267e30f0940c062d7..3e5c495d5f2d26488168b1cc5f96da6d700c4e24 100644 (file)
@@ -1149,21 +1149,23 @@ MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST)
 }
 
 MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
-{SELFPARAM();
-       if (!IS_PLAYER(self)) { return false; }
+{
+       entity player = M_ARGV(0, entity);
 
-       if (self.nade && (self.offhand != OFFHAND_NADE || (self.weapons & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, self, self.nade_altbutton);
+       if (!IS_PLAYER(player)) { return false; }
 
-       if(IS_PLAYER(self))
+       if (player.nade && (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton);
+
+       if(IS_PLAYER(player))
        {
                if ( autocvar_g_nades_bonus && autocvar_g_nades )
                {
                        entity key;
                        float key_count = 0;
-                       FOR_EACH_KH_KEY(key) if(key.owner == self) { ++key_count; }
+                       FOR_EACH_KH_KEY(key) if(key.owner == player) { ++key_count; }
 
                        float time_score;
-                       if(self.flagcarried || self.ballcarried) // this player is important
+                       if(player.flagcarried || player.ballcarried) // this player is important
                                time_score = autocvar_g_nades_bonus_score_time_flagcarrier;
                        else
                                time_score = autocvar_g_nades_bonus_score_time;
@@ -1173,69 +1175,67 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
 
                        if(autocvar_g_nades_bonus_client_select)
                        {
-                               self.nade_type = self.cvar_cl_nade_type;
-                               self.pokenade_type = self.cvar_cl_pokenade_type;
+                               player.nade_type = player.cvar_cl_nade_type;
+                               player.pokenade_type = player.cvar_cl_pokenade_type;
                        }
                        else
                        {
-                               self.nade_type = autocvar_g_nades_bonus_type;
-                               self.pokenade_type = autocvar_g_nades_pokenade_monster_type;
+                               player.nade_type = autocvar_g_nades_bonus_type;
+                               player.pokenade_type = autocvar_g_nades_pokenade_monster_type;
                        }
 
-                       self.nade_type = bound(1, self.nade_type, Nades_COUNT);
+                       player.nade_type = bound(1, player.nade_type, Nades_COUNT);
 
-                       if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
-                               nades_GiveBonus(self, time_score / autocvar_g_nades_bonus_score_max);
+                       if(player.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
+                               nades_GiveBonus(player, time_score / autocvar_g_nades_bonus_score_max);
                }
                else
                {
-                       self.bonus_nades = self.bonus_nade_score = 0;
+                       player.bonus_nades = player.bonus_nade_score = 0;
                }
        }
 
        float n = 0;
        entity o = world;
-       if(self.freezetag_frozen_timeout > 0 && time >= self.freezetag_frozen_timeout)
+       if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
                n = -1;
        else
        {
                vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
                n = 0;
-               FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
                        if(!IS_DEAD(it))
                        if(STAT(FROZEN, it) == 0)
-                       if(SAME_TEAM(it, self))
-                       if(boxesoverlap(self.absmin - revive_extra_size, self.absmax + revive_extra_size, it.absmin, it.absmax))
+                       if(SAME_TEAM(it, player))
+                       if(boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax))
                        {
                                if(!o)
                                        o = it;
-                               if(STAT(FROZEN, self) == 1)
+                               if(STAT(FROZEN, player) == 1)
                                        it.reviving = true;
                                ++n;
                        }
                ));
        }
 
-       if(n && STAT(FROZEN, self) == 3) // OK, there is at least one teammate reviving us
+       if(n && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
        {
-               self.revive_progress = bound(0, self.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
-               self.health = max(1, self.revive_progress * start_health);
+               player.revive_progress = bound(0, player.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
+               player.health = max(1, player.revive_progress * start_health);
 
-               if(self.revive_progress >= 1)
+               if(player.revive_progress >= 1)
                {
-                       Unfreeze(self);
+                       Unfreeze(player);
 
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
-                       Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, self.netname);
+                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
+                       Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
                }
 
                FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
-                       other.revive_progress = self.revive_progress;
-                       other.reviving = false;
+                       it.revive_progress = player.revive_progress;
+                       it.reviving = false;
                ));
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
index 238e7fbacdcd8648fb85b6b2ba4d9e0e840af1f2..19faf090f8ef87f1cbb43928ed0d940ac533e25a 100644 (file)
@@ -265,12 +265,13 @@ MUTATOR_HOOKFUNCTION(nix, OnEntityPreSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(nix, PlayerPreThink)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(!intermission_running)
-       if(!IS_DEAD(self))
-       if(IS_PLAYER(self))
-               NIX_GiveCurrentWeapon(this);
-       return false;
+       if(!IS_DEAD(player))
+       if(IS_PLAYER(player))
+               NIX_GiveCurrentWeapon(player);
 }
 
 MUTATOR_HOOKFUNCTION(nix, PlayerSpawn)
index 04817f4934e702d23201c626b032ac46b9f2c437..a9989be2f7d6540e5000ad80c9b516b656e0724f 100644 (file)
@@ -198,37 +198,39 @@ MUTATOR_HOOKFUNCTION(ok, ForbidThrowCurrentWeapon)
 }
 
 MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
-{SELFPARAM();
+{
        if(intermission_running || gameover)
                return false;
 
-       if(IS_DEAD(self) || !IS_PLAYER(self) || STAT(FROZEN, self))
+       entity player = M_ARGV(0, entity);
+
+       if(IS_DEAD(player) || !IS_PLAYER(player) || STAT(FROZEN, player))
                return false;
 
-       if(self.ok_lastwep)
+       if(player.ok_lastwep)
        {
-               Weapon newwep = Weapons_from(self.ok_lastwep);
-               if(self.ok_lastwep == WEP_HMG.m_id)
+               Weapon newwep = Weapons_from(player.ok_lastwep);
+               if(player.ok_lastwep == WEP_HMG.m_id)
                        newwep = WEP_MACHINEGUN;
-               if(self.ok_lastwep == WEP_RPC.m_id)
+               if(player.ok_lastwep == WEP_RPC.m_id)
                        newwep = WEP_VORTEX;
-               PS(self).m_switchweapon = newwep;
-               self.ok_lastwep = 0;
+               PS(player).m_switchweapon = newwep;
+               player.ok_lastwep = 0;
        }
 
-       ok_IncreaseCharge(self, PS(self).m_weapon.m_id);
+       ok_IncreaseCharge(player, PS(player).m_weapon.m_id);
 
-       if(PHYS_INPUT_BUTTON_ATCK2(self))
-       if(!forbidWeaponUse(self) || self.weapon_blocked) // allow if weapon is blocked
-       if(time >= self.jump_interval)
+       if(PHYS_INPUT_BUTTON_ATCK2(player))
+       if(!forbidWeaponUse(player) || player.weapon_blocked) // allow if weapon is blocked
+       if(time >= player.jump_interval)
        {
-               self.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor(this);
-               makevectors(self.v_angle);
+               player.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor(player);
+               makevectors(player.v_angle);
 
-               Weapon oldwep = PS(self).m_weapon;
-               PS(self).m_weapon = WEP_BLASTER;
+               Weapon oldwep = PS(player).m_weapon;
+               PS(player).m_weapon = WEP_BLASTER;
                W_Blaster_Attack(
-                       self,
+                       player,
                        WEP_BLASTER.m_id | HITTYPE_SECONDARY,
                        WEP_CVAR_SEC(vaporizer, shotangle),
                        WEP_CVAR_SEC(vaporizer, damage),
@@ -240,33 +242,31 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
                        WEP_CVAR_SEC(vaporizer, delay),
                        WEP_CVAR_SEC(vaporizer, lifetime)
                );
-               PS(self).m_weapon = oldwep;
+               PS(player).m_weapon = oldwep;
        }
 
-       self.weapon_blocked = false;
+       player.weapon_blocked = false;
 
-       self.ok_ammo_charge = self.ammo_charge[PS(self).m_weapon.m_id];
+       player.ok_ammo_charge = player.ammo_charge[PS(player).m_weapon.m_id];
 
-       if(self.ok_use_ammocharge)
-       if(!ok_CheckWeaponCharge(self, PS(self).m_weapon.m_id))
+       if(player.ok_use_ammocharge)
+       if(!ok_CheckWeaponCharge(player, PS(player).m_weapon.m_id))
        {
-               if(autocvar_g_overkill_ammo_charge_notice && time > self.ok_notice_time && PHYS_INPUT_BUTTON_ATCK(self) && IS_REAL_CLIENT(self) && PS(self).m_weapon == PS(self).m_switchweapon)
+               if(autocvar_g_overkill_ammo_charge_notice && time > player.ok_notice_time && PHYS_INPUT_BUTTON_ATCK(player) && IS_REAL_CLIENT(player) && PS(player).m_weapon == PS(player).m_switchweapon)
                {
-                       //Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_OVERKILL_CHARGE);
-                       self.ok_notice_time = time + 2;
-                       play2(self, SND(DRYFIRE));
+                       //Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERKILL_CHARGE);
+                       player.ok_notice_time = time + 2;
+                       play2(player, SND(DRYFIRE));
                }
-               Weapon wpn = PS(self).m_weapon;
+               Weapon wpn = PS(player).m_weapon;
                .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-               if(self.(weaponentity).state != WS_CLEAR)
-                       w_ready(wpn, self, weaponentity, PHYS_INPUT_BUTTON_ATCK(self) | (PHYS_INPUT_BUTTON_ATCK2(self) << 1));
+               if(player.(weaponentity).state != WS_CLEAR)
+                       w_ready(wpn, player, weaponentity, PHYS_INPUT_BUTTON_ATCK(player) | (PHYS_INPUT_BUTTON_ATCK2(player) << 1));
 
-               self.weapon_blocked = true;
+               player.weapon_blocked = true;
        }
 
-       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-
-       return false;
+       PHYS_INPUT_BUTTON_ATCK2(player) = false;
 }
 
 MUTATOR_HOOKFUNCTION(ok, PlayerSpawn)
index 56fc4573673eeac551f5b49d4cca1ed5e467b824..1698b3a64bd7c1d658cd3d6e05a9bb1a8a376fc2 100644 (file)
@@ -9,11 +9,11 @@ REGISTER_MUTATOR(touchexplode, cvar("g_touchexplode"));
 .float touchexplode_time;
 
 void PlayerTouchExplode(entity p1, entity p2)
-{SELFPARAM();
+{
        vector org = (p1.origin + p2.origin) * 0.5;
        org.z += (p1.mins.z + p2.mins.z) * 0.5;
 
-       sound(self, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
+       sound(p1, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
        Send_Effect(EFFECT_EXPLOSION_SMALL, org, '0 0 0', 1);
 
        entity e = spawn();
@@ -23,22 +23,24 @@ void PlayerTouchExplode(entity p1, entity p2)
 }
 
 MUTATOR_HOOKFUNCTION(touchexplode, PlayerPreThink)
-{SELFPARAM();
-       if(time > self.touchexplode_time)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(time > player.touchexplode_time)
        if(!gameover)
-       if(!STAT(FROZEN, self))
-       if(IS_PLAYER(self))
-       if(!IS_DEAD(self))
-       if(!IS_INDEPENDENT_PLAYER(self))
-               FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(
+       if(!STAT(FROZEN, player))
+       if(IS_PLAYER(player))
+       if(!IS_DEAD(player))
+       if(!IS_INDEPENDENT_PLAYER(player))
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
                        if(time > it.touchexplode_time)
                        if(!STAT(FROZEN, it))
                        if(!IS_DEAD(it))
                        if (!IS_INDEPENDENT_PLAYER(it))
-                       if(boxesoverlap(self.absmin, self.absmax, it.absmin, it.absmax))
+                       if(boxesoverlap(player.absmin, player.absmax, it.absmin, it.absmax))
                        {
-                               PlayerTouchExplode(self, it);
-                               self.touchexplode_time = it.touchexplode_time = time + 0.2;
+                               PlayerTouchExplode(player, it);
+                               player.touchexplode_time = it.touchexplode_time = time + 0.2;
                        }
                ));
 
index 43298c026e57ee5ae2723c67dae80e42ba9fd0d3..ffda2a4713701e02e978e264b92165bf5cc36eb7 100644 (file)
@@ -2052,7 +2052,7 @@ void PlayerUseKey()
        }
 
        // a use key was pressed; call handlers
-       MUTATOR_CALLHOOK(PlayerUseKey);
+       MUTATOR_CALLHOOK(PlayerUseKey, this);
 }
 
 
@@ -2153,7 +2153,7 @@ void PlayerPreThink ()
                        Unfreeze(this);
        }
 
-       MUTATOR_CALLHOOK(PlayerPreThink);
+       MUTATOR_CALLHOOK(PlayerPreThink, this);
 
        if(autocvar_g_vehicles_enter)
        if(time > this.last_vehiclecheck)
index f7782504b9efa79fc51a68feacd62cb0f9510344..f5bc6c379ca02895491dab56400e5bd145209019 100644 (file)
@@ -191,7 +191,10 @@ MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
 
 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
-MUTATOR_HOOKABLE(PlayerPreThink, EV_NO_ARGS);
+#define EV_PlayerPreThink(i, o) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+    /**/
+MUTATOR_HOOKABLE(PlayerPreThink, EV_PlayerPreThink);
 
 /** TODO change this into a general PlayerPostThink hook? */
 MUTATOR_HOOKABLE(GetPressedKeys, EV_NO_ARGS);
@@ -372,7 +375,10 @@ MUTATOR_HOOKABLE(PlayerRegen, EV_NO_ARGS);
  * if MUTATOR_RETURNVALUE is 1, don't do anything
  * return 1 if the use key actually did something
  */
-MUTATOR_HOOKABLE(PlayerUseKey, EV_NO_ARGS);
+ #define EV_PlayerUseKey(i, o) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+    /**/
+MUTATOR_HOOKABLE(PlayerUseKey, EV_PlayerUseKey);
 
 /**
  * called when a client command is parsed
index 84065045c564d253be9ba0be188aa1df257ced51..7b687776b4713c7d1ad2906adcc40dbd0398112c 100644 (file)
@@ -1976,12 +1976,13 @@ void havocbot_role_ctf_setrole(entity bot, int role)
 // ==============
 
 MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink)
-{SELFPARAM();
-       entity flag;
+{
+       entity player = M_ARGV(0, entity);
+
        int t = 0, t2 = 0, t3 = 0;
 
        // initially clear items so they can be set as necessary later.
-       self.ctf_flagstatus &= ~(CTF_RED_FLAG_CARRYING          | CTF_RED_FLAG_TAKEN            | CTF_RED_FLAG_LOST
+       player.ctf_flagstatus &= ~(CTF_RED_FLAG_CARRYING                | CTF_RED_FLAG_TAKEN            | CTF_RED_FLAG_LOST
                                                   | CTF_BLUE_FLAG_CARRYING             | CTF_BLUE_FLAG_TAKEN           | CTF_BLUE_FLAG_LOST
                                                   | CTF_YELLOW_FLAG_CARRYING   | CTF_YELLOW_FLAG_TAKEN         | CTF_YELLOW_FLAG_LOST
                                                   | CTF_PINK_FLAG_CARRYING     | CTF_PINK_FLAG_TAKEN           | CTF_PINK_FLAG_LOST
@@ -1989,42 +1990,40 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink)
                                                   | CTF_FLAG_NEUTRAL | CTF_SHIELDED);
 
        // scan through all the flags and notify the client about them
-       for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
+       for(entity flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
        {
                if(flag.team == NUM_TEAM_1) { t = CTF_RED_FLAG_CARRYING;                t2 = CTF_RED_FLAG_TAKEN;                t3 = CTF_RED_FLAG_LOST; }
                if(flag.team == NUM_TEAM_2) { t = CTF_BLUE_FLAG_CARRYING;               t2 = CTF_BLUE_FLAG_TAKEN;               t3 = CTF_BLUE_FLAG_LOST; }
                if(flag.team == NUM_TEAM_3) { t = CTF_YELLOW_FLAG_CARRYING;     t2 = CTF_YELLOW_FLAG_TAKEN;             t3 = CTF_YELLOW_FLAG_LOST; }
                if(flag.team == NUM_TEAM_4) { t = CTF_PINK_FLAG_CARRYING;               t2 = CTF_PINK_FLAG_TAKEN;               t3 = CTF_PINK_FLAG_LOST; }
-               if(flag.team == 0)                      { t = CTF_NEUTRAL_FLAG_CARRYING;        t2 = CTF_NEUTRAL_FLAG_TAKEN;    t3 = CTF_NEUTRAL_FLAG_LOST; self.ctf_flagstatus |= CTF_FLAG_NEUTRAL; }
+               if(flag.team == 0)                      { t = CTF_NEUTRAL_FLAG_CARRYING;        t2 = CTF_NEUTRAL_FLAG_TAKEN;    t3 = CTF_NEUTRAL_FLAG_LOST; player.ctf_flagstatus |= CTF_FLAG_NEUTRAL; }
 
                switch(flag.ctf_status)
                {
                        case FLAG_PASSING:
                        case FLAG_CARRY:
                        {
-                               if((flag.owner == self) || (flag.pass_sender == self))
-                                       self.ctf_flagstatus |= t; // carrying: self is currently carrying the flag
+                               if((flag.owner == player) || (flag.pass_sender == player))
+                                       player.ctf_flagstatus |= t; // carrying: player is currently carrying the flag
                                else
-                                       self.ctf_flagstatus |= t2; // taken: someone else is carrying the flag
+                                       player.ctf_flagstatus |= t2; // taken: someone else is carrying the flag
                                break;
                        }
                        case FLAG_DROPPED:
                        {
-                               self.ctf_flagstatus |= t3; // lost: the flag is dropped somewhere on the map
+                               player.ctf_flagstatus |= t3; // lost: the flag is dropped somewhere on the map
                                break;
                        }
                }
        }
 
        // item for stopping players from capturing the flag too often
-       if(self.ctf_captureshielded)
-               self.ctf_flagstatus |= CTF_SHIELDED;
+       if(player.ctf_captureshielded)
+               player.ctf_flagstatus |= CTF_SHIELDED;
 
        // update the health of the flag carrier waypointsprite
-       if(self.wps_flagcarrier)
-               WaypointSprite_UpdateHealth(self.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
-
-       return false;
+       if(player.wps_flagcarrier)
+               WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
 }
 
 MUTATOR_HOOKFUNCTION(ctf, PlayerDamage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
@@ -2128,10 +2127,10 @@ MUTATOR_HOOKFUNCTION(ctf, PortalTeleport)
 }
 
 MUTATOR_HOOKFUNCTION(ctf, PlayerUseKey)
-{SELFPARAM();
+{
        if(MUTATOR_RETURNVALUE || gameover) { return false; }
 
-       entity player = self;
+       entity player = M_ARGV(0, entity);
 
        if((time > player.throw_antispam) && !IS_DEAD(player) && !player.speedrunning && (!player.vehicle || autocvar_g_ctf_allow_vehicle_touch))
        {
@@ -2216,8 +2215,6 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerUseKey)
                        }
                }
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf, HelpMePing)
index 52e2fe3c64359198b5dfd079303f9eeb76236872..d8d25091126ab58f50b3dd9c512cb9fdc09ee061 100644 (file)
@@ -479,43 +479,45 @@ MUTATOR_HOOKFUNCTION(ft, GiveFragsForKill, CBC_ORDER_FIRST)
 }
 
 MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
-{SELFPARAM();
+{
        if(gameover)
-               return 1;
+               return true;
+
+       entity player = M_ARGV(0, entity);
 
-       if(STAT(FROZEN, self) == 1)
+       if(STAT(FROZEN, player) == 1)
        {
                // keep health = 1
-               self.pauseregen_finished = time + autocvar_g_balance_pause_health_regen;
+               player.pauseregen_finished = time + autocvar_g_balance_pause_health_regen;
        }
 
        if(round_handler_IsActive())
        if(!round_handler_IsRoundStarted())
-               return 1;
+               return true;
 
        int n;
 
        entity o;
        o = world;
-       //if(STAT(FROZEN, self))
-       //if(self.freezetag_frozen_timeout > 0 && time < self.freezetag_frozen_timeout)
-               //self.iceblock.alpha = ICE_MIN_ALPHA + (ICE_MAX_ALPHA - ICE_MIN_ALPHA) * (self.freezetag_frozen_timeout - time) / (self.freezetag_frozen_timeout - self.freezetag_frozen_time);
+       //if(STAT(FROZEN, player))
+       //if(player.freezetag_frozen_timeout > 0 && time < player.freezetag_frozen_timeout)
+               //player.iceblock.alpha = ICE_MIN_ALPHA + (ICE_MAX_ALPHA - ICE_MIN_ALPHA) * (player.freezetag_frozen_timeout - time) / (player.freezetag_frozen_timeout - player.freezetag_frozen_time);
 
-       if(self.freezetag_frozen_timeout > 0 && time >= self.freezetag_frozen_timeout)
+       if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
                n = -1;
        else
        {
                vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
                n = 0;
-               FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
                        if(STAT(FROZEN, it) == 0)
                        if(!IS_DEAD(it))
-                       if(SAME_TEAM(it, self))
-                       if(boxesoverlap(self.absmin - revive_extra_size, self.absmax + revive_extra_size, it.absmin, it.absmax))
+                       if(SAME_TEAM(it, player))
+                       if(boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax))
                        {
                                if(!o)
                                        o = it;
-                               if(STAT(FROZEN, self) == 1)
+                               if(STAT(FROZEN, player) == 1)
                                        it.reviving = true;
                                ++n;
                        }
@@ -523,21 +525,21 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
 
        }
 
-       if(n && STAT(FROZEN, self) == 1) // OK, there is at least one teammate reviving us
+       if(n && STAT(FROZEN, player) == 1) // OK, there is at least one teammate reviving us
        {
-               self.revive_progress = bound(0, self.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
-               self.health = max(1, self.revive_progress * ((warmup_stage) ? warmup_start_health : start_health));
+               player.revive_progress = bound(0, player.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
+               player.health = max(1, player.revive_progress * ((warmup_stage) ? warmup_start_health : start_health));
 
-               if(self.revive_progress >= 1)
+               if(player.revive_progress >= 1)
                {
-                       freezetag_Unfreeze(self);
+                       freezetag_Unfreeze(player);
                        freezetag_count_alive_players();
 
                        if(n == -1)
                        {
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_AUTO_REVIVED, autocvar_g_freezetag_frozen_maxtime);
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_AUTO_REVIVED, self.netname, autocvar_g_freezetag_frozen_maxtime);
-                               return 1;
+                               Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_AUTO_REVIVED, autocvar_g_freezetag_frozen_maxtime);
+                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_AUTO_REVIVED, player.netname, autocvar_g_freezetag_frozen_maxtime);
+                               return true;
                        }
 
                        // EVERY team mate nearby gets a point (even if multiple!)
@@ -547,27 +549,27 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
                                nades_GiveBonus(it,autocvar_g_nades_bonus_score_low);
                        ));
 
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
-                       Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, self.netname);
-                       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED, self.netname, o.netname);
+                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
+                       Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
+                       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED, player.netname, o.netname);
                }
 
                FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
-                       it.revive_progress = self.revive_progress;
+                       it.revive_progress = player.revive_progress;
                        it.reviving = false;
                ));
        }
-       else if(!n && STAT(FROZEN, self) == 1) // only if no teammate is nearby will we reset
+       else if(!n && STAT(FROZEN, player) == 1) // only if no teammate is nearby will we reset
        {
-               self.revive_progress = bound(0, self.revive_progress - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
-               self.health = max(1, self.revive_progress * ((warmup_stage) ? warmup_start_health : start_health));
+               player.revive_progress = bound(0, player.revive_progress - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
+               player.health = max(1, player.revive_progress * ((warmup_stage) ? warmup_start_health : start_health));
        }
-       else if(!n && !STAT(FROZEN, self))
+       else if(!n && !STAT(FROZEN, player))
        {
-               self.revive_progress = 0; // thawing nobody
+               player.revive_progress = 0; // thawing nobody
        }
 
-       return 1;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(ft, SetStartItems)
index 7af44fcc1517f9a4535908d303a30836e322f8e9..53d770611f0290ce1ab4d2ffe59141850d741e13 100644 (file)
@@ -345,26 +345,27 @@ MUTATOR_HOOKFUNCTION(ka, GiveFragsForKill)
 }
 
 MUTATOR_HOOKFUNCTION(ka, PlayerPreThink)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        // clear the item used for the ball in keepaway
-       self.items &= ~IT_KEY1;
+       player.items &= ~IT_KEY1;
 
        // if the player has the ball, make sure they have the item for it (Used for HUD primarily)
-       if(self.ballcarried)
-               self.items |= IT_KEY1;
-
-       return false;
+       if(player.ballcarried)
+               player.items |= IT_KEY1;
 }
 
 MUTATOR_HOOKFUNCTION(ka, PlayerUseKey)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(MUTATOR_RETURNVALUE == 0)
-       if(self.ballcarried)
+       if(player.ballcarried)
        {
-               ka_DropEvent(self);
-               return 1;
+               ka_DropEvent(player);
+               return true;
        }
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ka, PlayerDamage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
index 9b4c7586c5148312b5d06e5522fb07c224a965e3..5f4c2e76d84b66469bfa683bd9a06c6d0881f8f8 100644 (file)
@@ -1346,18 +1346,19 @@ MUTATOR_HOOKFUNCTION(kh, SpectateCopy)
 }
 
 MUTATOR_HOOKFUNCTION(kh, PlayerUseKey)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(MUTATOR_RETURNVALUE == 0)
        {
-               entity k;
-               k = self.kh_next;
+               entity k = player.kh_next;
                if(k)
                {
                        kh_Key_DropOne(k);
-                       return 1;
+                       return true;
                }
        }
-       return 0;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(kh, HavocBot_ChooseRole)
index 05ff73f3d9c892666f9f814a11e6f7465b3c5377..dada01677bc944d1b10f92c9aa58cd1f9aa6a930 100644 (file)
@@ -233,11 +233,11 @@ MUTATOR_HOOKFUNCTION(lms, ClientConnect)
 }
 
 MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
-{SELFPARAM();
-       if(this.deadflag == DEAD_DYING)
-               this.deadflag = DEAD_RESPAWNING;
+{
+       entity player = M_ARGV(0, entity);
 
-       return false;
+       if(player.deadflag == DEAD_DYING)
+               player.deadflag = DEAD_RESPAWNING;
 }
 
 MUTATOR_HOOKFUNCTION(lms, PlayerRegen)