]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix up more mutator hooks
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 06:51:57 +0000 (16:51 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 06:51:57 +0000 (16:51 +1000)
18 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/hook/hook.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/melee_only/melee_only.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/new_toys/new_toys.qc
qcsrc/common/mutators/mutator/nix/nix.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/server/miscfunctions.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_invasion.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc

index 2889b182c43edb3e949d0bcd4f154bce89443b47..a7528d5a1945588d8a1d2eb7873a44f40aecf92c 100644 (file)
@@ -1048,19 +1048,25 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
-{SELFPARAM();
-       return PS(self).m_weapon == WEP_NEXBALL;
+{
+       entity player = M_ARGV(0, entity);
+
+       return PS(player).m_weapon == WEP_NEXBALL;
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
-{SELFPARAM();
-       return PS(self).m_weapon == WEP_MORTAR; // TODO: what is this for?
+{
+       entity player = M_ARGV(0, entity);
+
+       return PS(player).m_weapon == WEP_MORTAR; // TODO: what is this for?
 }
 
 MUTATOR_HOOKFUNCTION(nb, FilterItem)
-{SELFPARAM();
-       if(self.classname == "droppedweapon")
-       if(self.weapon == WEP_NEXBALL.m_id)
+{
+       entity item = M_ARGV(0, entity);
+
+       if(item.classname == "droppedweapon")
+       if(item.weapon == WEP_NEXBALL.m_id)
                return true;
 
        return false;
index d7a615b87a2095554e7805c9455009a069f3666c..fad837f403e27e99abbd740b8961c6f1a2da87c5 100644 (file)
@@ -1972,9 +1972,9 @@ MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
 
 void ons_TurretSpawn_Delayed(entity this)
 {
-       entity own = self.owner;
+       entity own = this.owner;
 
-       if(!own) { remove(self); return; }
+       if(!own) { remove(this); return; }
 
        if(own.targetname)
        {
@@ -1988,13 +1988,15 @@ void ons_TurretSpawn_Delayed(entity this)
                }
        }
 
-       remove(self);
+       remove(this);
 }
 
 MUTATOR_HOOKFUNCTION(ons, TurretSpawn)
-{SELFPARAM();
+{
+       entity turret = M_ARGV(0, entity);
+
        entity e = spawn();
-       e.owner = self;
+       e.owner = turret;
        InitializeEntity(e, ons_TurretSpawn_Delayed, INITPRIO_FINDTARGET);
 
        return false;
index 1349717664d99c534bb749fec079c874d039c5f8..b97124a394abd07466e15279ff701587d208dc13 100644 (file)
@@ -717,18 +717,19 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerUseKey, CBC_ORDER_FIRST)
 }
 
 MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon)
-{SELFPARAM();
+{
        if(MUTATOR_RETURNVALUE || gameover) { return false; }
+       entity player = M_ARGV(0, entity);
 
-       if(self.buffs & BUFF_SWAPPER.m_itemid)
+       if(player.buffs & BUFF_SWAPPER.m_itemid)
        {
                float best_distance = autocvar_g_buffs_swapper_range;
                entity closest = world;
                FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
                        if(!IS_DEAD(it) && !STAT(FROZEN, it) && !it.vehicle)
-                       if(DIFF_TEAM(it, self))
+                       if(DIFF_TEAM(it, player))
                        {
-                               float test = vlen2(self.origin - it.origin);
+                               float test = vlen2(player.origin - it.origin);
                                if(test <= best_distance * best_distance)
                                {
                                        best_distance = sqrt(test);
@@ -741,18 +742,18 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon)
                {
                        vector my_org, my_vel, my_ang, their_org, their_vel, their_ang;
 
-                       my_org = self.origin;
-                       my_vel = self.velocity;
-                       my_ang = self.angles;
+                       my_org = player.origin;
+                       my_vel = player.velocity;
+                       my_ang = player.angles;
                        their_org = closest.origin;
                        their_vel = closest.velocity;
                        their_ang = closest.angles;
 
                        Drop_Special_Items(closest);
 
-                       MUTATOR_CALLHOOK(PortalTeleport, self); // initiate flag dropper
+                       MUTATOR_CALLHOOK(PortalTeleport, player); // initiate flag dropper
 
-                       setorigin(self, their_org);
+                       setorigin(player, their_org);
                        setorigin(closest, my_org);
 
                        closest.velocity = my_vel;
@@ -760,25 +761,25 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon)
                        closest.fixangle = true;
                        closest.oldorigin = my_org;
                        closest.oldvelocity = my_vel;
-                       self.velocity = their_vel;
-                       self.angles = their_ang;
-                       self.fixangle = true;
-                       self.oldorigin = their_org;
-                       self.oldvelocity = their_vel;
-
-                       // set pusher so self gets the kill if they fall into void
-                       closest.pusher = self;
+                       player.velocity = their_vel;
+                       player.angles = their_ang;
+                       player.fixangle = true;
+                       player.oldorigin = their_org;
+                       player.oldvelocity = their_vel;
+
+                       // set pusher so player gets the kill if they fall into void
+                       closest.pusher = player;
                        closest.pushltime = time + autocvar_g_maxpushtime;
                        closest.istypefrag = PHYS_INPUT_BUTTON_CHAT(closest);
 
                        Send_Effect(EFFECT_ELECTRO_COMBO, their_org, '0 0 0', 1);
                        Send_Effect(EFFECT_ELECTRO_COMBO, my_org, '0 0 0', 1);
 
-                       sound(self, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM);
+                       sound(player, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM);
                        sound(closest, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM);
 
                        // TODO: add a counter to handle how many times one can teleport, and a delay to prevent spam
-                       self.buffs = 0;
+                       player.buffs = 0;
                        return true;
                }
        }
@@ -803,28 +804,33 @@ MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { entity player = M_ARGV(0, enti
 MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); }
 
 MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint)
-{SELFPARAM();
-       entity e = WaypointSprite_getviewentity(other);
+{
+       entity wp = M_ARGV(0, entity);
+       entity player = M_ARGV(1, entity);
+
+       entity e = WaypointSprite_getviewentity(player);
 
        // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
        // but only apply this to real players, not to spectators
-       if((self.owner.flags & FL_CLIENT) && (self.owner.buffs & BUFF_INVISIBLE.m_itemid) && (e == other))
-       if(DIFF_TEAM(self.owner, e))
+       if((wp.owner.flags & FL_CLIENT) && (wp.owner.buffs & BUFF_INVISIBLE.m_itemid) && (e == player))
+       if(DIFF_TEAM(wp.owner, e))
                return true;
 
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, OnEntityPreSpawn, CBC_ORDER_LAST)
-{SELFPARAM();
+{
+       entity ent = M_ARGV(0, entity);
+
        if(autocvar_g_buffs_replace_powerups)
-       switch(self.classname)
+       switch(ent.classname)
        {
                case "item_strength":
                case "item_invincible":
                {
                        entity e = spawn();
-                       buff_SpawnReplacement(e, self);
+                       buff_SpawnReplacement(e, ent);
                        return true;
                }
        }
index 3dbce74f24de35fa4ee7744cdd8a946dd3c00cf6..3875f887ff91c9e111c3df7d2ec25ac66c4b6e16 100644 (file)
@@ -36,8 +36,9 @@ MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION(hook, FilterItem)
 {
-    SELFPARAM();
-    return self.weapon == WEP_HOOK.m_id;
+    entity item = M_ARGV(0, entity);
+
+    return item.weapon == WEP_HOOK.m_id;
 }
 
 #endif
index 89f98ade77065dbe55468f1b0d41addd8cabe86d..ec96d462601d92aa2b189307a2fa0d532b2b4a5a 100644 (file)
@@ -375,48 +375,53 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, SetStartItems)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
-{SELFPARAM();
-       if(self.classname == "item_cells")
+{
+       entity item = M_ARGV(0, entity);
+
+       if(item.classname == "item_cells")
                return true; // no normal cells?
 
-       if(self.weapon == WEP_VAPORIZER.m_id && self.classname == "droppedweapon")
+       if(item.weapon == WEP_VAPORIZER.m_id && item.classname == "droppedweapon")
        {
-               self.ammo_cells = autocvar_g_instagib_ammo_drop;
+               item.ammo_cells = autocvar_g_instagib_ammo_drop;
                return false;
        }
 
-       if(self.weapon == WEP_DEVASTATOR.m_id || self.weapon == WEP_VORTEX.m_id)
+       if(item.weapon == WEP_DEVASTATOR.m_id || item.weapon == WEP_VORTEX.m_id)
        {
                entity e = spawn();
-               setorigin(e, self.origin);
-               e.noalign = self.noalign;
-        e.cnt = self.cnt;
-        e.team = self.team;
+               setorigin(e, item.origin);
+               e.noalign = item.noalign;
+        e.cnt = item.cnt;
+        e.team = item.team;
         e.spawnfunc_checked = true;
                WITHSELF(e, spawnfunc_item_minst_cells(e));
                return true;
        }
 
-       if(self.flags & FL_POWERUP)
+       if(item.flags & FL_POWERUP)
                return false;
 
-       if(self.ammo_cells > autocvar_g_instagib_ammo_drop && self.classname != "item_minst_cells")
-               self.ammo_cells = autocvar_g_instagib_ammo_drop;
+       if(item.ammo_cells > autocvar_g_instagib_ammo_drop && item.classname != "item_minst_cells")
+               item.ammo_cells = autocvar_g_instagib_ammo_drop;
 
-       if(self.ammo_cells && !self.weapon)
+       if(item.ammo_cells && !item.weapon)
                return false;
 
        return true;
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, CustomizeWaypoint)
-{SELFPARAM();
-       entity e = WaypointSprite_getviewentity(other);
+{
+       entity wp = M_ARGV(0, entity);
+       entity player = M_ARGV(1, entity);
+
+       entity e = WaypointSprite_getviewentity(player);
 
        // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
        // but only apply this to real players, not to spectators
-       if((self.owner.flags & FL_CLIENT) && (self.owner.items & ITEM_Invisibility.m_itemid) && (e == other))
-       if(DIFF_TEAM(self.owner, e))
+       if((wp.owner.flags & FL_CLIENT) && (wp.owner.items & ITEM_Invisibility.m_itemid) && (e == player))
+       if(DIFF_TEAM(wp.owner, e))
                return true;
 
        return false;
@@ -463,10 +468,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn)
-{SELFPARAM();
+{
        if (!autocvar_g_powerups) { return false; }
+       entity ent = M_ARGV(0, entity);
        // Can't use .itemdef here
-       if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega"))
+       if (!(ent.classname == "item_strength" || ent.classname == "item_invincible" || ent.classname == "item_health_mega"))
                return false;
 
        entity e = spawn();
@@ -480,9 +486,9 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn)
                setthink(e, instagib_speed);
 
        e.nextthink = time + 0.1;
-       e.spawnflags = self.spawnflags;
-       e.noalign = self.noalign;
-       setorigin(e, self.origin);
+       e.spawnflags = ent.spawnflags;
+       e.noalign = ent.noalign;
+       setorigin(e, ent.origin);
 
        return true;
 }
index 5b03f46ec1ecae87a694b8e521c27ad0d849a4d1..ac67ea7ccd228c14feaea1a7175fb35fbff828f9 100644 (file)
@@ -15,8 +15,10 @@ MUTATOR_HOOKFUNCTION(melee_only, ForbidThrowCurrentWeapon)
 }
 
 MUTATOR_HOOKFUNCTION(melee_only, FilterItem)
-{SELFPARAM();
-       switch (self.items)
+{
+       entity item = M_ARGV(0, entity);
+
+       switch (item.items)
        {
                case ITEM_HealthSmall.m_itemid:
                case ITEM_ArmorSmall.m_itemid:
index 112b2ca015f0e827d430cf0ad050208594451629..0c458e379b186fb05070c9f4e27f77fd1271dcaa 100644 (file)
@@ -1139,9 +1139,10 @@ NadeOffhand OFFHAND_NADE; STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOff
 
 MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST)
 {
-    SELFPARAM();
-       if (self.offhand != OFFHAND_NADE || (self.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
-               nades_CheckThrow();
+    entity player = M_ARGV(0, entity);
+
+       if (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
+               WITHSELF(player, nades_CheckThrow());
                return true;
        }
        return false;
index 014c22508649375e17a6251ff9197d8cc4273ed0..236bb136f762c21ff573d940c73928db129d10b9 100644 (file)
@@ -216,11 +216,13 @@ MUTATOR_HOOKFUNCTION(nt, SetWeaponreplace)
 }
 
 MUTATOR_HOOKFUNCTION(nt, FilterItem)
-{SELFPARAM();
-       if(nt_IsNewToy(self.weapon) && autocvar_g_new_toys_use_pickupsound) {
-               self.item_pickupsound = string_null;
-               self.item_pickupsound_ent = SND_WEAPONPICKUP_NEW_TOYS;
+{
+       entity item = M_ARGV(0, entity);
+
+       if(nt_IsNewToy(item.weapon) && autocvar_g_new_toys_use_pickupsound) {
+               item.item_pickupsound = string_null;
+               item.item_pickupsound_ent = SND_WEAPONPICKUP_NEW_TOYS;
        }
-       return 0;
+       return false;
 }
 #endif
index 5a4df3ea413b3ab1cfe8d7434bc1367cdae77aaa..0258519397cb3c3d9fad0bb392b18a010b9158c1 100644 (file)
@@ -231,8 +231,10 @@ MUTATOR_HOOKFUNCTION(nix, BuildMutatorsPrettyString)
 }
 
 MUTATOR_HOOKFUNCTION(nix, FilterItem)
-{SELFPARAM();
-       switch (self.items)
+{
+       entity item = M_ARGV(0, entity);
+
+       switch (item.items)
        {
                case ITEM_HealthSmall.m_itemid:
                case ITEM_HealthMedium.m_itemid:
@@ -256,8 +258,10 @@ MUTATOR_HOOKFUNCTION(nix, FilterItem)
 }
 
 MUTATOR_HOOKFUNCTION(nix, OnEntityPreSpawn)
-{SELFPARAM();
-       if(self.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo)
+{
+       entity ent = M_ARGV(0, entity);
+
+       if(ent.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo)
                return true;
        return false;
 }
index fc41bbc3d9e853c6bcd3405c4d5b56585d8a5b98..1ab051ce2fadccba3e178424174399db64f8af24 100644 (file)
@@ -296,19 +296,21 @@ void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); }
 void self_spawnfunc_weapon_rpc(entity this) { spawnfunc_weapon_rpc(this); }
 
 MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
-{SELFPARAM();
+{
+       entity ent = M_ARGV(0, entity);
+
        if(autocvar_g_powerups)
        if(autocvar_g_overkill_powerups_replace)
        {
-               if(self.classname == "item_strength")
+               if(ent.classname == "item_strength")
                {
                        entity wep = new(weapon_hmg);
-                       setorigin(wep, self.origin);
+                       setorigin(wep, ent.origin);
                        setmodel(wep, MDL_OK_HMG);
                        wep.ok_item = true;
-                       wep.noalign = self.noalign;
-                       wep.cnt = self.cnt;
-                       wep.team = self.team;
+                       wep.noalign = ent.noalign;
+                       wep.cnt = ent.cnt;
+                       wep.team = ent.team;
                        wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
                        wep.pickup_anyway = true;
                        wep.spawnfunc_checked = true;
@@ -317,15 +319,15 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
                        return true;
                }
 
-               if(self.classname == "item_invincible")
+               if(ent.classname == "item_invincible")
                {
                        entity wep = new(weapon_rpc);
-                       setorigin(wep, self.origin);
+                       setorigin(wep, ent.origin);
                        setmodel(wep, MDL_OK_RPC);
                        wep.ok_item = true;
-                       wep.noalign = self.noalign;
-                       wep.cnt = self.cnt;
-                       wep.team = self.team;
+                       wep.noalign = ent.noalign;
+                       wep.cnt = ent.cnt;
+                       wep.team = ent.team;
                        wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
                        wep.pickup_anyway = true;
                        wep.spawnfunc_checked = true;
@@ -339,11 +341,13 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(ok, FilterItem)
-{SELFPARAM();
-       if(self.ok_item)
+{
+       entity item = M_ARGV(0, entity);
+
+       if(item.ok_item)
                return false;
 
-       switch(self.items)
+       switch(item.items)
        {
                case ITEM_HealthMega.m_itemid: return !(autocvar_g_overkill_100h_anyway);
                case ITEM_ArmorMega.m_itemid: return !(autocvar_g_overkill_100a_anyway);
index b2b1d973bf39dfbb41827772e8d120dc407f2b9f..be7dbb8aebaa3bd928ea4123d04dff0d8fc2ba4a 100644 (file)
@@ -971,13 +971,15 @@ float turret_firecheck()
        return 1;
 }
 
-bool turret_checkfire()
-{SELFPARAM();
-       bool ret = false; // dummy
-       if(MUTATOR_CALLHOOK(Turret_CheckFire, ret))
-               return ret_bool;
+bool turret_checkfire(entity this)
+{
+       if(MUTATOR_CALLHOOK(Turret_CheckFire, this))
+               return M_ARGV(1, bool);
+
+       bool ret = false;
+       WITHSELF(this, ret = this.turret_firecheckfunc());
 
-       return self.turret_firecheckfunc();
+       return ret;
 }
 
 void turret_fire()
@@ -1055,7 +1057,7 @@ void turret_think(entity this)
 
                                        turret_do_updates(self);
 
-                                       if (turret_checkfire())
+                                       if (turret_checkfire(self))
                                                turret_fire();
                                }
                        }
@@ -1079,7 +1081,7 @@ void turret_think(entity this)
                turret_do_updates(self);
 
                // Fire?
-               if (turret_checkfire())
+               if (turret_checkfire(self))
                        turret_fire();
        }
        else
@@ -1099,7 +1101,7 @@ void turret_think(entity this)
                                turret_do_updates(self);
 
                                // Fire!
-                               if (turret_checkfire())
+                               if (turret_checkfire(self))
                                        turret_fire();
 
                                Turret tur = get_turretinfo(self.m_id);
@@ -1161,7 +1163,7 @@ void turret_think(entity this)
                turret_do_updates(self);
 
                // Fire?
-               if (turret_checkfire())
+               if (turret_checkfire(self))
                        turret_fire();
        }
 
index 7eaf978a9997535d0d3dd50769efc394b114fe7a..e667812aaac1841706d4c61975242fd6b2346bb7 100644 (file)
@@ -274,8 +274,7 @@ string formatmessage(entity this, string msg)
                        default:
                        {
                                MUTATOR_CALLHOOK(FormatMessage, this, escape, replacement, msg);
-                               escape = format_escape;
-                               replacement = format_replacement;
+                               replacement = M_ARGV(2, string);
                                break;
                        }
                }
index 143627180b1ae6b81e1c264e3cf4394f59df4053..9591efbf21f90b619d707f2840d331136ce0427e 100644 (file)
@@ -107,26 +107,23 @@ MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
 
 /** called when formatting a chat message to replace fancy functions */
 #define EV_FormatMessage(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(string, format_escape) \
-    /**/ i(string, format_replacement) \
-    /**/ o(string, format_replacement) \
-    /**/ i(string, format_message) \
-    /**/
-string format_escape;
-string format_replacement;
-string format_message;
+    /** player        */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** escape        */ i(string, MUTATOR_ARGV_1_string) \
+    /** replacement   */ i(string, MUTATOR_ARGV_2_string) \
+    /**/                 o(string, MUTATOR_ARGV_2_string) \
+    /** message       */ i(string, MUTATOR_ARGV_3_string) \
+    /**/
 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
 
 /** returns true if throwing the current weapon shall not be allowed */
 #define EV_ForbidThrowCurrentWeapon(i, o) \
-    /**/ i(entity, __self) \
+    /** player        */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
 
 /** returns true if dropping the current weapon shall not be allowed at any time including death */
 #define EV_ForbidDropCurrentWeapon(i, o) \
-    /**/ i(entity, __self) \
+    /** player        */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
 
@@ -154,8 +151,8 @@ MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
 
 /** called every frame. customizes the waypoint for spectators */
 #define EV_CustomizeWaypoint(i, o) \
-    /** waypoint */ i(entity, __self) \
-    /** player; other.enemy = spectator */ i(entity, other) \
+    /** waypoint                        */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \
     /**/
 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
 
@@ -164,33 +161,32 @@ MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
  * return error to request removal
  */
 #define EV_FilterItem(i, o) \
-    /** the current item */ i(entity, __self) \
+    /** item        */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
 
 /** return error to request removal */
 #define EV_TurretSpawn(i, o) \
-    /** turret */ i(entity, __self) \
+    /** turret        */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
 
 /** return error to not attack */
 #define EV_TurretFire(i, o) \
-    /** turret */ i(entity, __self) \
+    /** turret        */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
 
 /** return error to not attack */
 #define EV_Turret_CheckFire(i, o) \
-    /**/ i(bool, ret_bool) \
-    /**/ o(bool, ret_bool) \
+    /** turret                      */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** to fire or not to fire      */ o(bool, MUTATOR_ARGV_1_bool) \
     /**/
-bool ret_bool;
 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
 
 /** return error to prevent entity spawn, or modify the entity */
 #define EV_OnEntityPreSpawn(i, o) \
-    /** turret */ i(entity, __self) \
+   /** entity  */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
 
index ca1779486c973097e9de6d2e676fd4e20f22a579..a377d0368d607a6fa5040d6a0366396a335303dc 100644 (file)
@@ -625,9 +625,11 @@ MUTATOR_HOOKFUNCTION(as, PlayerSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(as, TurretSpawn)
-{SELFPARAM();
-       if(!self.team || self.team == MAX_SHOT_DISTANCE)
-               self.team = 5; // this gets reversed when match starts?
+{
+       entity turret = M_ARGV(0, entity);
+
+       if(!turret.team || turret.team == MAX_SHOT_DISTANCE)
+               turret.team = 5; // this gets reversed when match starts?
 
        return false;
 }
@@ -674,8 +676,9 @@ MUTATOR_HOOKFUNCTION(as, ReadLevelCvars)
 
 MUTATOR_HOOKFUNCTION(as, OnEntityPreSpawn)
 {
-    SELFPARAM();
-       switch(self.classname)
+    entity ent = M_ARGV(0, entity);
+
+       switch(ent.classname)
        {
                case "info_player_team1":
                case "info_player_team2":
index ff011b59deac11355d160bb3f10f6260c6f28ab3..ffb231e7bba639356d281d8cf1ac5c38cc6d304a 100644 (file)
@@ -347,7 +347,7 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
 
 MUTATOR_HOOKFUNCTION(ca, ForbidThrowCurrentWeapon)
 {
-       return 1;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(ca, GiveFragsForKill, CBC_ORDER_FIRST)
@@ -394,9 +394,10 @@ MUTATOR_HOOKFUNCTION(ca, PlayerDamage_Calculate)
 
 MUTATOR_HOOKFUNCTION(ca, FilterItem)
 {
-    SELFPARAM();
+    entity item = M_ARGV(0, entity);
+
        if (autocvar_g_powerups <= 0)
-       if (this.flags & FL_POWERUP)
+       if (item.flags & FL_POWERUP)
                return true;
 
        if (autocvar_g_pickup_items <= 0)
index cbe6544c4c994773f6a0d18bfb7ba305fd77cce3..9bc20a3965f96849e917c9324b378fc637971f2d 100644 (file)
@@ -354,8 +354,10 @@ MUTATOR_HOOKFUNCTION(cts, ForbidThrowCurrentWeapon)
 }
 
 MUTATOR_HOOKFUNCTION(cts, FilterItem)
-{SELFPARAM();
-       if(self.classname == "droppedweapon")
+{
+       entity item = M_ARGV(0, entity);
+
+       if(item.classname == "droppedweapon")
                return true;
 
        return false;
index cfd4f96123ae3daff59745fb2a0e9ed0d258e3b0..5bf26c4b8840f5fb3da80d32c0fd815fef1451fb 100644 (file)
@@ -376,9 +376,11 @@ MUTATOR_HOOKFUNCTION(inv, MonsterSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(inv, OnEntityPreSpawn)
-{SELFPARAM();
-       if(startsWith(self.classname, "monster_"))
-       if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
+{
+       entity ent = M_ARGV(0, entity);
+
+       if(startsWith(ent.classname, "monster_"))
+       if(!(ent.spawnflags & MONSTERFLAG_SPAWNED))
                return true;
 
        return false;
index 8ff6c190a0bdbfdacedc2756938947e8ee41269e..0e29e7033056aa944c8d88335c4238c3cd121987 100644 (file)
@@ -298,9 +298,11 @@ MUTATOR_HOOKFUNCTION(lms, ForbidPlayerScore_Clear)
 }
 
 MUTATOR_HOOKFUNCTION(lms, FilterItem)
-{SELFPARAM();
+{
+       entity item = M_ARGV(0, entity);
+
        if(autocvar_g_lms_extra_lives)
-       if(self.itemdef == ITEM_ExtraLife)
+       if(item.itemdef == ITEM_ExtraLife)
                return false;
 
        return true;
@@ -312,20 +314,22 @@ void lms_extralife(entity this)
 }
 
 MUTATOR_HOOKFUNCTION(lms, OnEntityPreSpawn)
-{SELFPARAM();
+{
        if (!autocvar_g_powerups) return false;
        if (!autocvar_g_lms_extra_lives) return false;
 
+       entity ent = M_ARGV(0, entity);
+
        // Can't use .itemdef here
-       if (self.classname != "item_health_mega") return false;
+       if (ent.classname != "item_health_mega") return false;
 
        entity e = spawn();
        setthink(e, lms_extralife);
 
        e.nextthink = time + 0.1;
-       e.spawnflags = self.spawnflags;
-       e.noalign = self.noalign;
-       setorigin(e, self.origin);
+       e.spawnflags = ent.spawnflags;
+       e.noalign = ent.noalign;
+       setorigin(e, ent.origin);
 
        return true;
 }