Kill the ret_string global
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 08:14:51 +0000 (18:14 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 08:14:51 +0000 (18:14 +1000)
47 files changed:
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/mutators/events.qh
qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc
qcsrc/common/mutators/mutator/campcheck/campcheck.qc
qcsrc/common/mutators/mutator/cloaked/cloaked.qc
qcsrc/common/mutators/mutator/hook/hook.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/invincibleproj/invincibleproj.qc
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/common/mutators/mutator/melee_only/melee_only.qc
qcsrc/common/mutators/mutator/midair/midair.qc
qcsrc/common/mutators/mutator/multijump/multijump.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/mutators/mutator/physical_items/physical_items.qc
qcsrc/common/mutators/mutator/pinata/pinata.qc
qcsrc/common/mutators/mutator/random_gravity/random_gravity.qc
qcsrc/common/mutators/mutator/rocketflying/rocketflying.qc
qcsrc/common/mutators/mutator/superspec/superspec.qc
qcsrc/common/mutators/mutator/vampire/vampire.qc
qcsrc/common/mutators/mutator/vampirehook/vampirehook.qc
qcsrc/server/cl_client.qc
qcsrc/server/command/common.qc
qcsrc/server/command/getreplies.qc
qcsrc/server/g_hook.qc
qcsrc/server/g_world.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_ctf.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_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/scores.qc
qcsrc/server/teamplay.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/tracing.qc

index 58cfe61..e91958d 100644 (file)
@@ -2003,8 +2003,10 @@ MUTATOR_HOOKFUNCTION(ons, TurretSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(ons, HavocBot_ChooseRole)
-{SELFPARAM();
-       havocbot_ons_reset_role(self);
+{
+       entity bot = M_ARGV(0, entity);
+
+       havocbot_ons_reset_role(bot);
        return true;
 }
 
index cae6b19..69e077e 100644 (file)
@@ -4,7 +4,6 @@
 #define EV_NO_ARGS(i, o)
 
 #pragma noref 1
-string ret_string;
 
 #define MUTATOR_TYPES(_, x) \
     _(x, bool) \
@@ -36,24 +35,24 @@ MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 10)
 
 #pragma noref 0
 
-/** appends ":mutatorname" to ret_string for logging */
+/** appends ":mutatorname" to argument for logging */
 #define EV_BuildMutatorsString(i, o) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
+    /**/                  o(string, MUTATOR_ARGV_0_string) \
     /**/
 MUTATOR_HOOKABLE(BuildMutatorsString, EV_BuildMutatorsString);
 
 /** appends ", Mutator name" to ret_string for display */
 #define EV_BuildMutatorsPrettyString(i, o) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
+    /**/                  o(string, MUTATOR_ARGV_0_string) \
     /**/
 MUTATOR_HOOKABLE(BuildMutatorsPrettyString, EV_BuildMutatorsPrettyString);
 
 /** appends mutator string for displaying extra gameplay tips */
 #define EV_BuildGameplayTipsString(i, o) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** tips string */    i(string, MUTATOR_ARGV_0_string) \
+    /**/                  o(string, MUTATOR_ARGV_0_string) \
     /**/
 MUTATOR_HOOKABLE(BuildGameplayTipsString, EV_BuildGameplayTipsString);
 
index de3d190..cdef3d9 100644 (file)
@@ -33,13 +33,11 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
 
 MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":bloodloss");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bloodloss");
 }
 
 MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Blood loss");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss");
 }
 #endif
index ea9511d..492c657 100644 (file)
@@ -1021,20 +1021,24 @@ MUTATOR_HOOKFUNCTION(buffs, SpectateCopy)
 
 MUTATOR_HOOKFUNCTION(buffs, VehicleEnter)
 {
-       vh_vehicle.buffs = vh_player.buffs;
-       vh_player.buffs = 0;
-       vh_vehicle.buff_time = max(0, vh_player.buff_time - time);
-       vh_player.buff_time = 0;
-       return false;
+       entity player = M_ARGV(0, entity);
+       entity veh = M_ARGV(1, entity);
+
+       veh.buffs = player.buffs;
+       player.buffs = 0;
+       veh.buff_time = max(0, player.buff_time - time);
+       player.buff_time = 0;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, VehicleExit)
 {
-       vh_player.buffs = vh_player.oldbuffs = vh_vehicle.buffs;
-       vh_vehicle.buffs = 0;
-       vh_player.buff_time = time + vh_vehicle.buff_time;
-       vh_vehicle.buff_time = 0;
-       return false;
+       entity player = M_ARGV(0, entity);
+       entity veh = M_ARGV(1, entity);
+
+       player.buffs = player.oldbuffs = veh.buffs;
+       veh.buffs = 0;
+       player.buff_time = time + veh.buff_time;
+       veh.buff_time = 0;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerRegen)
@@ -1056,14 +1060,12 @@ REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace");
 
 MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":Buffs");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Buffs");
 }
 
 MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Buffs");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Buffs");
 }
 
 void buffs_DelayedInit(entity this)
index 0e7d581..7d7ba39 100644 (file)
@@ -298,21 +298,19 @@ MUTATOR_HOOKFUNCTION(bugrigs, PlayerPhysics)
 
 MUTATOR_HOOKFUNCTION(bugrigs, ClientConnect)
 {
-    SELFPARAM();
-       stuffcmd(self, "cl_cmd settemp chase_active 1\n");
-       return false;
+    entity player = M_ARGV(0, entity);
+
+       stuffcmd(player, "cl_cmd settemp chase_active 1\n");
 }
 
 MUTATOR_HOOKFUNCTION(bugrigs, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":bugrigs");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bugrigs");
 }
 
 MUTATOR_HOOKFUNCTION(bugrigs, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Bug rigs");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Bug rigs");
 }
 
 #endif
index 183eac3..daf4e10 100644 (file)
@@ -88,7 +88,6 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION(campcheck, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":CampCheck");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":CampCheck");;
 }
 #endif
index f8231f7..4fca532 100644 (file)
@@ -13,7 +13,7 @@ MUTATOR_HOOKFUNCTION(cloaked, SetDefaultAlpha)
 
 MUTATOR_HOOKFUNCTION(cloaked, BuildMutatorsPrettyString)
 {
-       if (!g_cts) ret_string = strcat(ret_string, ", Cloaked");
+       if (!g_cts) M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Cloaked");
 }
 
 #endif
index 3875f88..21375d3 100644 (file)
@@ -14,17 +14,17 @@ REGISTER_MUTATOR(hook, autocvar_g_grappling_hook) {
 
 MUTATOR_HOOKFUNCTION(hook, BuildMutatorsString)
 {
-    ret_string = strcat(ret_string, ":grappling_hook");
+    M_ARGV(0, string) = strcat(M_ARGV(0, string), ":grappling_hook");
 }
 
 MUTATOR_HOOKFUNCTION(hook, BuildMutatorsPrettyString)
 {
-    ret_string = strcat(ret_string, ", Hook");
+    M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Hook");
 }
 
 MUTATOR_HOOKFUNCTION(hook, BuildGameplayTipsString)
 {
-    ret_string = strcat(ret_string, "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
+    M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
 }
 
 MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
index c913be7..57afc84 100644 (file)
@@ -165,7 +165,9 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterSpawn)
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, BotShouldAttack)
 {
-       if (checkentity.items & ITEM_Invisibility.m_itemid)
+       entity targ = M_ARGV(1, entity);
+
+       if (targ.items & ITEM_Invisibility.m_itemid)
                return true;
 
        return false;
@@ -442,28 +444,31 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDies)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch)
-{SELFPARAM();
-       if(self.ammo_cells)
+{
+       entity item = M_ARGV(0, entity);
+       entity toucher = M_ARGV(1, entity);
+
+       if(item.ammo_cells)
        {
                // play some cool sounds ;)
-               if (IS_CLIENT(other))
+               if (IS_CLIENT(toucher))
                {
-                       if(other.health <= 5)
-                               Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_INSTAGIB_LASTSECOND);
-                       else if(other.health < 50)
-                               Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_INSTAGIB_NARROWLY);
+                       if(toucher.health <= 5)
+                               Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_LASTSECOND);
+                       else if(toucher.health < 50)
+                               Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_NARROWLY);
                }
 
-               if(other.health < 100)
-                       other.health = 100;
+               if(toucher.health < 100)
+                       toucher.health = 100;
 
                return MUT_ITEMTOUCH_CONTINUE;
        }
 
-       if(self.itemdef == ITEM_ExtraLife)
+       if(item.itemdef == ITEM_ExtraLife)
        {
-               other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_instagib_extralives);
-               Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
+               toucher.armorvalue = bound(toucher.armorvalue, 999, toucher.armorvalue + autocvar_g_instagib_extralives);
+               Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES);
                return MUT_ITEMTOUCH_PICKUP;
        }
 
@@ -498,19 +503,17 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn)
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":instagib");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":instagib");
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", instagib");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", instagib");
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, SetModname)
 {
-       modname = "InstaGib";
+       M_ARGV(0, string) = "InstaGib";
        return true;
 }
 
index df8c181..a35a60a 100644 (file)
@@ -15,13 +15,11 @@ MUTATOR_HOOKFUNCTION(invincibleprojectiles, EditProjectile)
 
 MUTATOR_HOOKFUNCTION(invincibleprojectiles, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":InvincibleProjectiles");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":InvincibleProjectiles");
 }
 
 MUTATOR_HOOKFUNCTION(invincibleprojectiles, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Invincible Projectiles");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Invincible Projectiles");
 }
 #endif
index 16e1819..1c4de9a 100644 (file)
@@ -167,13 +167,15 @@ MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver)
 }
 
 MUTATOR_HOOKFUNCTION(itemstime, ClientConnect, CBC_ORDER_LAST)
-{SELFPARAM();
-       if(IS_PLAYER(self))
+{
+    entity player = M_ARGV(0, entity);
+
+       if(IS_PLAYER(player))
        {
                // client became player on connection skipping putObserverInServer step
-               if (IS_REAL_CLIENT(self))
+               if (IS_REAL_CLIENT(player))
                if (warmup_stage)
-                       Item_ItemsTime_SetTimesForPlayer(self);
+                       Item_ItemsTime_SetTimesForPlayer(player);
        }
 }
 
index ac67ea7..ee5de3d 100644 (file)
@@ -30,13 +30,11 @@ MUTATOR_HOOKFUNCTION(melee_only, FilterItem)
 
 MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":MeleeOnly");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":MeleeOnly");
 }
 
 MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Melee Only Arena");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Melee Only Arena");
 }
 #endif
index cc426a3..7379289 100644 (file)
@@ -14,7 +14,7 @@ MUTATOR_HOOKFUNCTION(midair, PlayerDamage_Calculate)
        if(IS_PLAYER(frag_attacker))
        if(IS_PLAYER(frag_target))
        if(time < frag_target.midair_shieldtime)
-               frag_damage = false;
+               M_ARGV(4, float) = 0;
 
        return false;
 }
@@ -45,13 +45,11 @@ MUTATOR_HOOKFUNCTION(midair, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION(midair, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":midair");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":midair");
 }
 
 MUTATOR_HOOKFUNCTION(midair, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Midair");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Midair");
 }
 #endif
index 50fd020..8cd1372 100644 (file)
@@ -122,14 +122,12 @@ REPLICATE(cvar_cl_multijump, bool, "cl_multijump");
 
 MUTATOR_HOOKFUNCTION(multijump, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":multijump");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":multijump");
 }
 
 MUTATOR_HOOKFUNCTION(multijump, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Multi jump");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Multi jump");
 }
 
 #endif
index 0c458e3..45c1560 100644 (file)
@@ -1092,10 +1092,10 @@ void nades_Clear(entity player)
 
 MUTATOR_HOOKFUNCTION(nades, VehicleEnter)
 {
-       if(vh_player.nade)
-               toss_nade(vh_player, true, '0 0 100', max(vh_player.nade.wait, time + 0.05));
+       entity player = M_ARGV(0, entity);
 
-       return false;
+       if(player.nade)
+               toss_nade(player, true, '0 0 100', max(player.nade.wait, time + 0.05));
 }
 
 CLASS(NadeOffhand, OffhandWeapon)
@@ -1387,20 +1387,17 @@ REPLICATE(cvar_cl_pokenade_type, string, "cl_pokenade_type");
 
 MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":Nades");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Nades");
 }
 
 MUTATOR_HOOKFUNCTION(nades, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Nades");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Nades");
 }
 
 MUTATOR_HOOKFUNCTION(nades, BuildGameplayTipsString)
 {
-       ret_string = strcat(ret_string, "\n\n^3nades^8 are enabled, press 'g' to use them\n");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3nades^8 are enabled, press 'g' to use them\n");
 }
 
 #endif
index 236bb13..9816572 100644 (file)
@@ -110,8 +110,8 @@ const float NT_AUTOREPLACE_RANDOM = 2;
 
 MUTATOR_HOOKFUNCTION(nt, SetModname)
 {
-       modname = "NewToys";
-       return 0;
+       M_ARGV(0, string) = "NewToys";
+       return false;
 }
 
 bool nt_IsNewToy(int w)
@@ -196,23 +196,27 @@ MUTATOR_HOOKFUNCTION(nt, SetStartItems)
 }
 
 MUTATOR_HOOKFUNCTION(nt, SetWeaponreplace)
-{SELFPARAM();
+{
+       entity wep = M_ARGV(0, entity);
+       entity wepinfo = M_ARGV(1, entity);
+       string ret_string = M_ARGV(2, string);
+
        // otherwise, we do replace
-       if(self.new_toys)
+       if(wep.new_toys)
        {
                // map defined replacement:
-               ret_string = self.new_toys;
+               ret_string = wep.new_toys;
        }
        else
        {
                // auto replacement:
-               ret_string = nt_GetReplacement(other.netname, autocvar_g_new_toys_autoreplace);
+               ret_string = nt_GetReplacement(wepinfo.netname, autocvar_g_new_toys_autoreplace);
        }
 
        // apply regular weaponreplace
        ret_string = W_Apply_Weaponreplace(ret_string);
 
-       return 0;
+       M_ARGV(2, string) = ret_string;
 }
 
 MUTATOR_HOOKFUNCTION(nt, FilterItem)
index 0258519..238e7fb 100644 (file)
@@ -220,14 +220,12 @@ MUTATOR_HOOKFUNCTION(nix, ForbidThrowCurrentWeapon)
 
 MUTATOR_HOOKFUNCTION(nix, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":NIX");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":NIX");
 }
 
 MUTATOR_HOOKFUNCTION(nix, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", NIX");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", NIX");
 }
 
 MUTATOR_HOOKFUNCTION(nix, FilterItem)
@@ -287,7 +285,7 @@ MUTATOR_HOOKFUNCTION(nix, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION(nix, SetModname, CBC_ORDER_LAST)
 {
-       modname = "NIX";
+       M_ARGV(0, string) = "NIX";
        return false;
 }
 #endif
index 1ab051c..04817f4 100644 (file)
@@ -380,19 +380,17 @@ MUTATOR_HOOKFUNCTION(ok, SetStartItems)
 
 MUTATOR_HOOKFUNCTION(ok, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":OK");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":OK");
 }
 
 MUTATOR_HOOKFUNCTION(ok, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Overkill");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Overkill");
 }
 
 MUTATOR_HOOKFUNCTION(ok, SetModname)
 {
-       modname = "Overkill";
+       M_ARGV(0, string) = "Overkill";
        return true;
 }
 
index 3ef52fe..82d6e6c 100644 (file)
@@ -89,32 +89,34 @@ void physical_item_damage(entity this, entity inflictor, entity attacker, float
 }
 
 MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn)
-{SELFPARAM();
-       if(self.owner == world && autocvar_g_physical_items <= 1)
+{
+       entity item = M_ARGV(0, entity);
+
+       if(item.owner == world && autocvar_g_physical_items <= 1)
                return false;
-       if (self.spawnflags & 1) // floating item
+       if (item.spawnflags & 1) // floating item
                return false;
 
        // The actual item can't be physical and trigger at the same time, so make it invisible and use a second entity for physics.
        // Ugly hack, but unless SOLID_TRIGGER is gotten to work with MOVETYPE_PHYSICS in the engine it can't be fixed.
        entity wep;
        wep = spawn();
-       _setmodel(wep, self.model);
-       setsize(wep, self.mins, self.maxs);
-       setorigin(wep, self.origin);
-       wep.angles = self.angles;
-       wep.velocity = self.velocity;
+       _setmodel(wep, item.model);
+       setsize(wep, item.mins, item.maxs);
+       setorigin(wep, item.origin);
+       wep.angles = item.angles;
+       wep.velocity = item.velocity;
 
-       wep.owner = self;
+       wep.owner = item;
        wep.solid = SOLID_CORPSE;
        wep.movetype = MOVETYPE_PHYSICS;
        wep.takedamage = DAMAGE_AIM;
        wep.effects |= EF_NOMODELFLAGS; // disable the spinning
-       wep.colormap = self.owner.colormap;
-       wep.glowmod = self.owner.glowmod;
+       wep.colormap = item.owner.colormap;
+       wep.glowmod = item.owner.glowmod;
        wep.damageforcescale = autocvar_g_physical_items_damageforcescale;
-       wep.dphitcontentsmask = self.dphitcontentsmask;
-       wep.cnt = (self.owner != world);
+       wep.dphitcontentsmask = item.dphitcontentsmask;
+       wep.cnt = (item.owner != world);
 
        setthink(wep, physical_item_think);
        wep.nextthink = time;
@@ -125,18 +127,16 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn)
        {
                // fix the spawn origin
                setorigin(wep, wep.origin + '0 0 1');
-               entity oldself;
-               oldself = self;
                WITHSELF(wep, builtin_droptofloor());
        }
 
        wep.spawn_origin = wep.origin;
-       wep.spawn_angles = self.angles;
+       wep.spawn_angles = item.angles;
 
-       self.effects |= EF_NODRAW; // hide the original weapon
-       self.movetype = MOVETYPE_FOLLOW;
-       self.aiment = wep; // attach the original weapon
-       self.SendEntity3 = func_null;
+       item.effects |= EF_NODRAW; // hide the original weapon
+       item.movetype = MOVETYPE_FOLLOW;
+       item.aiment = wep; // attach the original weapon
+       item.SendEntity3 = func_null;
 
        return false;
 }
index b9b4b6c..10866a2 100644 (file)
@@ -17,14 +17,12 @@ MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
 
 MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":Pinata");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Pinata");
 }
 
 MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Piñata");
-       return false;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Piñata");
 }
 
 #endif
index 80abfe3..22c3126 100644 (file)
@@ -44,13 +44,11 @@ MUTATOR_HOOKFUNCTION(random_gravity, SV_StartFrame)
 
 MUTATOR_HOOKFUNCTION(random_gravity, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":RandomGravity");
-       return 0;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":RandomGravity");
 }
 
 MUTATOR_HOOKFUNCTION(random_gravity, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Random gravity");
-       return 0;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Random gravity");
 }
 #endif
index ed3e9c6..e45c4fe 100644 (file)
@@ -15,13 +15,11 @@ MUTATOR_HOOKFUNCTION(rocketflying, EditProjectile)
 
 MUTATOR_HOOKFUNCTION(rocketflying, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":RocketFlying");
-       return 0;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":RocketFlying");
 }
 
 MUTATOR_HOOKFUNCTION(rocketflying, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Rocket Flying");
-       return 0;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Rocket Flying");
 }
 #endif
index 9913591..ca8f7b4 100644 (file)
@@ -2,7 +2,7 @@
 REGISTER_MUTATOR(superspec, cvar("g_superspectate"));
 
 #define _SSMAGIX "SUPERSPEC_OPTIONSFILE_V1"
-#define _ISLOCAL ((edict_num(1) == self) ? true : false)
+#define _ISLOCAL(ent) ((edict_num(1) == (ent)) ? true : false)
 
 const float ASF_STRENGTH               = BIT(0);
 const float ASF_SHIELD                         = BIT(1);
@@ -36,7 +36,7 @@ void superspec_save_client_conf()
        string fn = "superspec-local.options";
        float fh;
 
-       if (!_ISLOCAL)
+       if (!_ISLOCAL(self))
        {
                if(self.crypto_idfp == "")
                        return;
@@ -98,46 +98,47 @@ float superspec_filteritem(entity _for, entity _item)
 }
 
 MUTATOR_HOOKFUNCTION(superspec, ItemTouch)
-{SELFPARAM();
-       entity _item = self;
+{
+       entity item = M_ARGV(0, entity);
+       entity toucher = M_ARGV(1, entity);
 
        FOREACH_CLIENT(true, LAMBDA(
                if(!IS_SPEC(it) && !IS_OBSERVER(it))
                        continue;
                if(it.superspec_flags & SSF_ITEMMSG)
-                       if(superspec_filteritem(it, _item))
+                       if(superspec_filteritem(it, item))
                        {
                                if(it.superspec_flags & SSF_VERBOSE)
-                                       superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n", other.netname, _item.netname), 1);
+                                       superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n", toucher.netname, item.netname), 1);
                                else
-                                       superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n^8(%s^8)\n", other.netname, _item.netname, _item.classname), 1);
-                               if((it.autospec_flags & ASF_SSIM) && it.enemy != other)
+                                       superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n^8(%s^8)\n", toucher.netname, item.netname, item.classname), 1);
+                               if((it.autospec_flags & ASF_SSIM) && it.enemy != toucher)
                                {
-                                       WITHSELF(it, superspec_Spectate(other));
+                                       WITHSELF(it, superspec_Spectate(toucher));
                                        return MUT_ITEMTOUCH_CONTINUE;
                                }
                        }
 
-               if((it.autospec_flags & ASF_SHIELD && _item.invincible_finished) ||
-                       (it.autospec_flags & ASF_STRENGTH && _item.strength_finished) ||
-                       (it.autospec_flags & ASF_MEGA_AR && _item.itemdef == ITEM_ArmorMega) ||
-                       (it.autospec_flags & ASF_MEGA_HP && _item.itemdef == ITEM_HealthMega) ||
-                       (it.autospec_flags & ASF_FLAG_GRAB && _item.classname == "item_flag_team"))
+               if((it.autospec_flags & ASF_SHIELD && item.invincible_finished) ||
+                       (it.autospec_flags & ASF_STRENGTH && item.strength_finished) ||
+                       (it.autospec_flags & ASF_MEGA_AR && item.itemdef == ITEM_ArmorMega) ||
+                       (it.autospec_flags & ASF_MEGA_HP && item.itemdef == ITEM_HealthMega) ||
+                       (it.autospec_flags & ASF_FLAG_GRAB && item.classname == "item_flag_team"))
                {
 
-                       if((it.enemy != other) || IS_OBSERVER(it))
+                       if((it.enemy != toucher) || IS_OBSERVER(it))
                        {
                                if(it.autospec_flags & ASF_OBSERVER_ONLY && !IS_OBSERVER(it))
                                {
                                        if(it.superspec_flags & SSF_VERBOSE)
-                                               superspec_msg("", "", it, sprintf("^8Ignored that ^7%s^8 grabbed %s^8 since the observer_only option is ON\n", other.netname, _item.netname), 2);
+                                               superspec_msg("", "", it, sprintf("^8Ignored that ^7%s^8 grabbed %s^8 since the observer_only option is ON\n", toucher.netname, item.netname), 2);
                                }
                                else
                                {
                                        if(it.autospec_flags & ASF_SHOWWHAT)
-                                               superspec_msg("", "", it, sprintf("^7Following %s^7 due to picking up %s\n", other.netname, _item.netname), 2);
+                                               superspec_msg("", "", it, sprintf("^7Following %s^7 due to picking up %s\n", toucher.netname, item.netname), 2);
 
-                                       WITHSELF(it, superspec_Spectate(other));
+                                       WITHSELF(it, superspec_Spectate(toucher));
                                }
                        }
                }
@@ -371,14 +372,12 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand)
 
 MUTATOR_HOOKFUNCTION(superspec, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":SS");
-       return 0;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":SS");
 }
 
 MUTATOR_HOOKFUNCTION(superspec, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Super Spectators");
-       return 0;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Super Spectators");
 }
 
 void superspec_hello(entity this)
@@ -390,27 +389,29 @@ void superspec_hello(entity this)
 }
 
 MUTATOR_HOOKFUNCTION(superspec, ClientConnect)
-{SELFPARAM();
-       if(!IS_REAL_CLIENT(self))
+{
+       entity player = M_ARGV(0, entity);
+
+       if(!IS_REAL_CLIENT(player))
                return false;
 
        string fn = "superspec-local.options";
        float fh;
 
-       self.superspec_flags = SSF_VERBOSE;
-       self.superspec_itemfilter = "";
+       player.superspec_flags = SSF_VERBOSE;
+       player.superspec_itemfilter = "";
 
        entity _hello = spawn();
-       _hello.enemy = self;
+       _hello.enemy = player;
        setthink(_hello, superspec_hello);
        _hello.nextthink = time + 5;
 
-       if (!_ISLOCAL)
+       if (!_ISLOCAL(player))
        {
-               if(self.crypto_idfp == "")
+               if(player.crypto_idfp == "")
                        return false;
 
-               fn = sprintf("superspec-%s.options", uri_escape(self.crypto_idfp));
+               fn = sprintf("superspec-%s.options", uri_escape(player.crypto_idfp));
        }
 
        fh = fopen(fn, FILE_READ);
@@ -427,9 +428,9 @@ MUTATOR_HOOKFUNCTION(superspec, ClientConnect)
                }
                else
                {
-                       self.autospec_flags = stof(fgets(fh));
-                       self.superspec_flags = stof(fgets(fh));
-                       self.superspec_itemfilter = strzone(fgets(fh));
+                       player.autospec_flags = stof(fgets(fh));
+                       player.superspec_flags = stof(fgets(fh));
+                       player.superspec_itemfilter = strzone(fgets(fh));
                }
                fclose(fh);
        }
index 9eb7e00..61b0adc 100644 (file)
@@ -20,13 +20,11 @@ MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor)
 
 MUTATOR_HOOKFUNCTION(vampire, BuildMutatorsString)
 {
-       ret_string = strcat(ret_string, ":Vampire");
-       return 0;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Vampire");
 }
 
 MUTATOR_HOOKFUNCTION(vampire, BuildMutatorsPrettyString)
 {
-       ret_string = strcat(ret_string, ", Vampire");
-       return 0;
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Vampire");
 }
 #endif
index d2ba668..a54dc74 100644 (file)
@@ -9,30 +9,30 @@ float autocvar_g_vampirehook_health_steal;
 .float last_dmg;
 
 MUTATOR_HOOKFUNCTION(vh, GrappleHookThink)
-{SELFPARAM();
-       entity dmgent = ((SAME_TEAM(self.owner, self.aiment) && autocvar_g_vampirehook_teamheal) ? self.owner : self.aiment);
+{
+       entity thehook = M_ARGV(0, entity);
 
-       if(IS_PLAYER(self.aiment))
-       if(self.last_dmg < time)
-       if(!STAT(FROZEN, self.aiment))
+       entity dmgent = ((SAME_TEAM(thehook.owner, thehook.aiment) && autocvar_g_vampirehook_teamheal) ? thehook.owner : thehook.aiment);
+
+       if(IS_PLAYER(thehook.aiment))
+       if(thehook.last_dmg < time)
+       if(!STAT(FROZEN, thehook.aiment))
        if(time >= game_starttime)
-       if(DIFF_TEAM(self.owner, self.aiment) || autocvar_g_vampirehook_teamheal)
-       if(self.aiment.health > 0)
+       if(DIFF_TEAM(thehook.owner, thehook.aiment) || autocvar_g_vampirehook_teamheal)
+       if(thehook.aiment.health > 0)
        if(autocvar_g_vampirehook_damage)
        {
-               self.last_dmg = time + autocvar_g_vampirehook_damagerate;
-               self.owner.damage_dealt += autocvar_g_vampirehook_damage;
-               Damage(dmgent, self, self.owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, self.origin, '0 0 0');
-               if(SAME_TEAM(self.owner, self.aiment))
-                       self.aiment.health = min(self.aiment.health + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
+               thehook.last_dmg = time + autocvar_g_vampirehook_damagerate;
+               thehook.owner.damage_dealt += autocvar_g_vampirehook_damage;
+               Damage(dmgent, thehook, thehook.owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, thehook.origin, '0 0 0');
+               if(SAME_TEAM(thehook.owner, thehook.aiment))
+                       thehook.aiment.health = min(thehook.aiment.health + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
                else
-                       self.owner.health = min(self.owner.health + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
+                       thehook.owner.health = min(thehook.owner.health + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
 
-               if(dmgent == self.owner)
+               if(dmgent == thehook.owner)
                        dmgent.health -= autocvar_g_vampirehook_damage; // FIXME: friendly fire?!
        }
-
-       return false;
 }
 
 #endif
index 9d9d0fe..903d1de 100644 (file)
@@ -385,8 +385,8 @@ void FixPlayermodel(entity player)
        }
 
        MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin);
-       defaultmodel = ret_string;
-       defaultskin = ret_int;
+       defaultmodel = M_ARGV(0, string);
+       defaultskin = M_ARGV(1, int);
 
        bool chmdl = false;
        int oldskin;
index 14f7439..1cc6e1d 100644 (file)
@@ -361,7 +361,6 @@ void CommonCommand_editmob(int request, entity caller, int argc)
                                        int moveflag, tmp_moncount = 0;
                                        string arg_lower = strtolower(argument);
                                        moveflag = (argv(3)) ? stof(argv(3)) : 1;  // follow owner if not defined
-                                       ret_string = "Monster spawning is currently disabled by a mutator";
 
                                        if (arg_lower == "list") { print_to(caller, monsterlist_reply); return; }
 
@@ -373,7 +372,7 @@ void CommonCommand_editmob(int request, entity caller, int argc)
                                        if (!autocvar_g_monsters) { print_to(caller, "Monsters are disabled"); return; }
                                        if (autocvar_g_monsters_max <= 0 || autocvar_g_monsters_max_perplayer <= 0) { print_to(caller, "Monster spawning is disabled"); return; }
                                        if (!IS_PLAYER(caller)) { print_to(caller, "You must be playing to spawn a monster"); return; }
-                                       if (MUTATOR_CALLHOOK(AllowMobSpawning)) { print_to(caller, ret_string); return; }
+                                       if (MUTATOR_CALLHOOK(AllowMobSpawning, caller)) { print_to(caller, M_ARGV(1, string)); return; }
                                        if (caller.vehicle) { print_to(caller, "You can't spawn monsters while driving a vehicle"); return; }
                                        if (STAT(FROZEN, caller)) { print_to(caller, "You can't spawn monsters while frozen"); return; }
                                        if (IS_DEAD(caller)) { print_to(caller, "You can't spawn monsters while dead"); return; }
@@ -433,7 +432,7 @@ void CommonCommand_editmob(int request, entity caller, int argc)
                                case "butcher":
                                {
                                        if (caller) { print_to(caller, "This command is not available to players"); return; }
-                                       if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(ret_string, "\n"); return; }
+                                       if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(M_ARGV(0, string), "\n"); return; }
 
                                        int tmp_remcount = 0;
 
index 83a746b..93ce85a 100644 (file)
@@ -27,7 +27,7 @@ string getrecords(int page)  // 50 records per page
        string s = "";
 
        MUTATOR_CALLHOOK(GetRecords, page, s);
-       s = ret_string;
+       s = M_ARGV(1, string);
 
        MapInfo_ClearTemps();
 
index 1b5e22b..498d602 100644 (file)
@@ -167,9 +167,9 @@ void GrapplingHookThink(entity this)
        entity pull_entity = self.realowner;
        float velocity_multiplier = 1;
        MUTATOR_CALLHOOK(GrappleHookThink, self, tarzan, pull_entity, velocity_multiplier);
-       tarzan = hook_tarzan;
-       pull_entity = hook_pullentity;
-       velocity_multiplier = hook_velmultiplier;
+       tarzan = M_ARGV(1, int);
+       pull_entity = M_ARGV(2, entity);
+       velocity_multiplier = M_ARGV(3, float);
 
        if(self.state == 1)
        {
index 5e242e4..fa798be 100644 (file)
@@ -760,7 +760,7 @@ spawnfunc(worldspawn)
                s = ":gameinfo:mutators:LIST";
 
                MUTATOR_CALLHOOK(BuildMutatorsString, s);
-               s = ret_string;
+               s = M_ARGV(0, string);
 
                // initialiation stuff, not good in the mutator system
                if(!autocvar_g_use_ammunition)
@@ -1432,7 +1432,7 @@ void DumpStats(float final)
        FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), LAMBDA(
                s = strcat(":player:see-labels:", GetPlayerScoreString(it, 0), ":");
                s = strcat(s, ftos(rint(time - it.jointime)), ":");
-               if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
+               if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
                        s = strcat(s, ftos(it.team), ":");
                else
                        s = strcat(s, "spectator:");
index e667812..629f0ae 100644 (file)
@@ -528,7 +528,7 @@ void readplayerstartcvars()
        s = cvar_string("g_weaponarena");
 
        MUTATOR_CALLHOOK(SetWeaponArena, s);
-       s = ret_string;
+       s = M_ARGV(0, string);
 
        if (s == "0" || s == "")
        {
index b66b394..0d692ba 100644 (file)
@@ -274,8 +274,13 @@ MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
 /**
  * called when a player tries to spawn a monster
  * return 1 to prevent spawning
+ * NOTE: requires reason if disallowed
  */
-MUTATOR_HOOKABLE(AllowMobSpawning, EV_NO_ARGS);
+ #define EV_AllowMobSpawning(i, o) \
+    /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** reason */ o(string, MUTATOR_ARGV_1_string) \
+    /**/
+MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
 
 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
@@ -425,7 +430,7 @@ MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
 
 #define EV_SetModname(i, o) \
     /** name of the mutator/mod if it warrants showing as such in the server browser */ \
-    o(string, modname) \
+    /**/ o(string, MUTATOR_ARGV_0_string) \
     /**/
 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
 
@@ -434,36 +439,32 @@ MUTATOR_HOOKABLE(SetModname, EV_SetModname);
  * return 1 to remove an item
  */
 #define EV_Item_Spawn(i, o) \
-    /** the item */ i(entity, __self) \
+    /** item */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
 
 #define EV_SetWeaponreplace(i, o) \
-    /** map entity */ i(entity, __self) \
-    /** weapon info */ i(entity, other) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** map entity */  i(entity, MUTATOR_ARGV_0_entity) \
+    /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
+    /** replacement */ i(string, MUTATOR_ARGV_2_string) \
+    /**/               o(string, MUTATOR_ARGV_2_string) \
     /**/
-//string ret_string;
 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
 
 /** called when an item is about to respawn */
 #define EV_Item_RespawnCountdown(i, o) \
-    /**/ i(string, item_name) \
-    /**/ o(string, item_name) \
-    /**/ i(vector, item_color) \
-    /**/ o(vector, item_color) \
+    /** item name */   i(string, MUTATOR_ARGV_0_string) \
+    /**/               o(string, MUTATOR_ARGV_0_string) \
+    /** item colour */ i(vector, MUTATOR_ARGV_1_vector) \
+    /**/               o(vector, MUTATOR_ARGV_1_vector) \
     /**/
-string item_name;
-vector item_color;
 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
 
 /** called when a bot checks a target to attack */
 #define EV_BotShouldAttack(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(entity, checkentity) \
+    /** bot */    i(entity, MUTATOR_ARGV_0_entity) \
+    /** target */ i(entity, MUTATOR_ARGV_1_entity) \
     /**/
-entity checkentity;
 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
 
 /**
@@ -471,7 +472,7 @@ MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
  * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
  */
 #define EV_PortalTeleport(i, o) \
-    /**/ i(entity, __self) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
 
@@ -482,7 +483,7 @@ MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
  * in a special manner using this hook
  */
 #define EV_HelpMePing(i, o) \
-    /** the player who pressed impulse 33 */ i(entity, __self) \
+    /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
 
@@ -491,7 +492,7 @@ MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
  * return true to remove the vehicle
  */
 #define EV_VehicleSpawn(i, o) \
-    /**/ i(entity, __self) \
+    /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(VehicleSpawn, EV_VehicleSpawn);
 
@@ -500,11 +501,9 @@ MUTATOR_HOOKABLE(VehicleSpawn, EV_VehicleSpawn);
  * allows mutators to set special settings in this event
  */
 #define EV_VehicleEnter(i, o) \
-    /** player */ i(entity, vh_player) \
-    /** vehicle */ i(entity, vh_vehicle) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
     /**/
-entity vh_player;
-entity vh_vehicle;
 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
 
 /**
@@ -512,8 +511,8 @@ MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
  * return true to stop player from entering the vehicle
  */
 #define EV_VehicleTouch(i, o) \
-    /** vehicle */ i(entity, __self) \
-    /** player */ i(entity, other) \
+    /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** player */ i(entity, MUTATOR_ARGV_1_entity) \
     /**/
 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
 
@@ -522,21 +521,21 @@ MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
  * allows mutators to set special settings in this event
  */
 #define EV_VehicleExit(i, o) \
-    /** player */ i(entity, vh_player) \
-    /** vehicle */ i(entity, vh_vehicle) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
     /**/
 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
 
 /** called when a speedrun is aborted and the player is teleported back to start position */
 #define EV_AbortSpeedrun(i, o) \
-    /** player */ i(entity, __self) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
 
 /** called at when a item is touched. Called early, can edit item properties. */
 #define EV_ItemTouch(i, o) \
-    /** item */ i(entity, __self) \
-    /** player */ i(entity, other) \
+    /** item */    i(entity, MUTATOR_ARGV_0_entity) \
+    /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
     /**/
 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
 
@@ -548,12 +547,12 @@ enum {
 
 /** called at when a player connect */
 #define EV_ClientConnect(i, o) \
-    /** player */ i(entity, __self) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
 
 #define EV_HavocBot_ChooseRole(i, o) \
-    /**/ i(entity, __self) \
+    /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
 
@@ -574,65 +573,54 @@ MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
 
 /** Called when getting the global parameters for a model */
 #define EV_GetModelParams(i, o) \
-    /** entity id */ i(string, checkmodel_input) \
-    /** entity id */ i(string, checkmodel_command) \
+    /** input */   i(string, MUTATOR_ARGV_0_string) \
+    /** command */ i(string, MUTATOR_ARGV_1_string) \
     /**/
-string checkmodel_input, checkmodel_command;
 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
 
 /** called when a bullet has hit a target */
 #define EV_FireBullet_Hit(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(entity, bullet_hit) \
-    /**/ i(vector, bullet_startpos) \
-    /**/ i(vector, bullet_endpos) \
-    /**/ i(float, frag_damage) \
-    /**/ o(float, frag_damage) \
-    /**/
-entity bullet_hit;
-//vector bullet_hitloc; // the end pos matches the hit location, apparently
-vector bullet_startpos;
-vector bullet_endpos;
-float frag_damage;
+    /** player */       i(entity, MUTATOR_ARGV_0_entity) \
+    /** targ */         i(entity, MUTATOR_ARGV_1_entity) \
+    /** start pos */    i(vector, MUTATOR_ARGV_2_vector) \
+    /** end pos */      i(vector, MUTATOR_ARGV_3_vector) \
+    /** damage */       i(float, MUTATOR_ARGV_4_float) \
+    /**/                o(float, MUTATOR_ARGV_4_float) \
+    /**/
 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
 
 #define EV_FixPlayermodel(i, o) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
-    /**/ i(int, ret_int) \
-    /**/ o(int, ret_int) \
+    /** model */    i(string, MUTATOR_ARGV_0_string) \
+    /**/            o(string, MUTATOR_ARGV_0_string) \
+    /** skin */     i(int, MUTATOR_ARGV_1_int) \
+    /**/            o(int, MUTATOR_ARGV_1_int) \
     /**/
-int ret_int;
 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
 
 /** Return error to play frag remaining announcements */
 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
 
 #define EV_GrappleHookThink(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(int, hook_tarzan) \
-    /**/ o(int, hook_tarzan) \
-    /**/ i(entity, hook_pullentity) \
-    /**/ o(entity, hook_pullentity) \
-    /**/ i(float, hook_velmultiplier) \
-    /**/ o(float, hook_velmultiplier) \
-    /**/
-int hook_tarzan;
-entity hook_pullentity;
-float hook_velmultiplier;
+    /** hook */                i(entity, MUTATOR_ARGV_0_entity) \
+    /** tarzan */              i(int, MUTATOR_ARGV_1_int) \
+    /**/                       o(int, MUTATOR_ARGV_1_int) \
+    /** pulling entity */      i(entity, MUTATOR_ARGV_2_entity) \
+    /**/                       o(entity, MUTATOR_ARGV_2_entity) \
+    /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
+    /**/                       o(float, MUTATOR_ARGV_3_float) \
+    /**/
 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
 
 #define EV_BuffModel_Customize(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(entity, buff_player) \
+    /** buff */    i(entity, MUTATOR_ARGV_0_entity) \
+    /** player */  i(entity, MUTATOR_ARGV_1_entity) \
     /**/
-entity buff_player;
 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
 
 /** called at when a buff is touched. Called early, can edit buff properties. */
 #define EV_BuffTouch(i, o) \
-    /** item */ i(entity, __self) \
-    /** player */ i(entity, other) \
+    /** buff */    i(entity, MUTATOR_ARGV_0_entity) \
+    /** player */  i(entity, MUTATOR_ARGV_1_entity) \
     /**/
 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
 
@@ -643,17 +631,15 @@ MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
 
 #define EV_GetRecords(i, o) \
-    /**/ i(int, record_page) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** page */           i(int, MUTATOR_ARGV_1_int) \
+    /** record list */    i(string, MUTATOR_ARGV_1_string) \
+    /**/                  o(string, MUTATOR_ARGV_1_string) \
     /**/
-int record_page;
 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
 
 #define EV_Race_FinalCheckpoint(i, o) \
-    /**/ i(entity, race_player) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
-entity race_player;
 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
 
 /** called when player triggered kill (or is changing teams), return error to not do anything */
@@ -749,16 +735,13 @@ MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
 
 #define EV_GetPlayerStatus(i, o) \
-    /**/ i(entity, set_player) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** player */    i(entity, MUTATOR_ARGV_0_entity) \
     /**/
-entity set_player;
 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
 
 #define EV_SetWeaponArena(i, o) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** arena */     i(string, MUTATOR_ARGV_0_string) \
+    /**/             o(string, MUTATOR_ARGV_0_string) \
     /**/
 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
 
@@ -771,7 +754,10 @@ MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
  * called when an admin tries to kill all monsters
  * return 1 to prevent spawning
  */
-MUTATOR_HOOKABLE(AllowMobButcher, EV_NO_ARGS);
+#define EV_AllowMobButcher(i, o) \
+    /** reason */ o(string, MUTATOR_ARGV_0_string) \
+    /**/
+MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
 
 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
 
index a377d03..67e5fcb 100644 (file)
@@ -635,15 +635,17 @@ MUTATOR_HOOKFUNCTION(as, TurretSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(as, VehicleSpawn)
-{SELFPARAM();
-       self.nextthink = time + 0.5;
+{
+       entity veh = M_ARGV(0, entity);
 
-       return false;
+       veh.nextthink = time + 0.5;
 }
 
 MUTATOR_HOOKFUNCTION(as, HavocBot_ChooseRole)
-{SELFPARAM();
-       havocbot_ast_reset_role(self);
+{
+       entity bot = M_ARGV(0, entity);
+
+       havocbot_ast_reset_role(bot);
        return true;
 }
 
index ffb231e..0695f1d 100644 (file)
@@ -262,8 +262,9 @@ MUTATOR_HOOKFUNCTION(ca, reset_map_players)
 
 MUTATOR_HOOKFUNCTION(ca, ClientConnect)
 {
-    SELFPARAM();
-       TRANSMUTE(Observer, this);
+    entity player = M_ARGV(0, entity);
+
+       TRANSMUTE(Observer, player);
        return true;
 }
 
@@ -503,13 +504,15 @@ MUTATOR_HOOKFUNCTION(ca, WantWeapon)
 
 MUTATOR_HOOKFUNCTION(ca, GetPlayerStatus)
 {
-       return set_player.caplayer == 1;
+       entity player = M_ARGV(0, entity);
+
+       return player.caplayer == 1;
 }
 
 MUTATOR_HOOKFUNCTION(ca, SetWeaponArena)
 {
        // most weapons arena
-       if (ret_string == "0" || ret_string == "") ret_string = "most";
+       if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") M_ARGV(0, string) = "most";
 }
 
 #endif
index ab66479..8406504 100644 (file)
@@ -2119,12 +2119,12 @@ MUTATOR_HOOKFUNCTION(ctf, ClientDisconnect)
 }
 
 MUTATOR_HOOKFUNCTION(ctf, PortalTeleport)
-{SELFPARAM();
-       if(self.flagcarried)
-       if(!autocvar_g_ctf_portalteleport)
-               { ctf_Handle_Throw(self, world, DROP_NORMAL); }
+{
+       entity player = M_ARGV(0, entity);
 
-       return false;
+       if(player.flagcarried)
+       if(!autocvar_g_ctf_portalteleport)
+               { ctf_Handle_Throw(player, world, DROP_NORMAL); }
 }
 
 MUTATOR_HOOKFUNCTION(ctf, PlayerUseKey)
@@ -2221,16 +2221,18 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerUseKey)
 }
 
 MUTATOR_HOOKFUNCTION(ctf, HelpMePing)
-{SELFPARAM();
-       if(self.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification
        {
-               self.wps_helpme_time = time;
-               WaypointSprite_HelpMePing(self.wps_flagcarrier);
+               player.wps_helpme_time = time;
+               WaypointSprite_HelpMePing(player.wps_flagcarrier);
        }
        else // create a normal help me waypointsprite
        {
-               WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, false, RADARICON_HELPME);
-               WaypointSprite_Ping(self.wps_helpme);
+               WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_helpme, false, RADARICON_HELPME);
+               WaypointSprite_Ping(player.wps_helpme);
        }
 
        return true;
@@ -2238,20 +2240,23 @@ MUTATOR_HOOKFUNCTION(ctf, HelpMePing)
 
 MUTATOR_HOOKFUNCTION(ctf, VehicleEnter)
 {
-       if(vh_player.flagcarried)
+       entity player = M_ARGV(0, entity);
+       entity veh = M_ARGV(1, entity);
+
+       if(player.flagcarried)
        {
-               vh_player.flagcarried.nodrawtoclient = vh_player; // hide the flag from the driver
+               player.flagcarried.nodrawtoclient = player; // hide the flag from the driver
 
                if(!autocvar_g_ctf_allow_vehicle_carry && !autocvar_g_ctf_allow_vehicle_touch)
                {
-                       ctf_Handle_Throw(vh_player, world, DROP_NORMAL);
+                       ctf_Handle_Throw(player, world, DROP_NORMAL);
                }
                else
                {
-                       setattachment(vh_player.flagcarried, vh_vehicle, "");
-                       setorigin(vh_player.flagcarried, VEHICLE_FLAG_OFFSET);
-                       vh_player.flagcarried.scale = VEHICLE_FLAG_SCALE;
-                       //vh_player.flagcarried.angles = '0 0 0';
+                       setattachment(player.flagcarried, veh, "");
+                       setorigin(player.flagcarried, VEHICLE_FLAG_OFFSET);
+                       player.flagcarried.scale = VEHICLE_FLAG_SCALE;
+                       //player.flagcarried.angles = '0 0 0';
                }
                return true;
        }
@@ -2261,13 +2266,15 @@ MUTATOR_HOOKFUNCTION(ctf, VehicleEnter)
 
 MUTATOR_HOOKFUNCTION(ctf, VehicleExit)
 {
-       if(vh_player.flagcarried)
+       entity player = M_ARGV(0, entity);
+
+       if(player.flagcarried)
        {
-               setattachment(vh_player.flagcarried, vh_player, "");
-               setorigin(vh_player.flagcarried, FLAG_CARRY_OFFSET);
-               vh_player.flagcarried.scale = FLAG_SCALE;
-               vh_player.flagcarried.angles = '0 0 0';
-               vh_player.flagcarried.nodrawtoclient = world;
+               setattachment(player.flagcarried, player, "");
+               setorigin(player.flagcarried, FLAG_CARRY_OFFSET);
+               player.flagcarried.scale = FLAG_SCALE;
+               player.flagcarried.angles = '0 0 0';
+               player.flagcarried.nodrawtoclient = world;
                return true;
        }
 
@@ -2275,11 +2282,13 @@ MUTATOR_HOOKFUNCTION(ctf, VehicleExit)
 }
 
 MUTATOR_HOOKFUNCTION(ctf, AbortSpeedrun)
-{SELFPARAM();
-       if(self.flagcarried)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.flagcarried)
        {
-               Send_Notification(NOTIF_ALL, world, MSG_INFO, ((self.flagcarried.team) ? APP_TEAM_ENT(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
-               ctf_RespawnFlag(self.flagcarried);
+               Send_Notification(NOTIF_ALL, world, MSG_INFO, ((player.flagcarried.team) ? APP_TEAM_ENT(player.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
+               ctf_RespawnFlag(player.flagcarried);
                return true;
        }
 
@@ -2321,8 +2330,10 @@ MUTATOR_HOOKFUNCTION(ctf, MatchEnd)
 }
 
 MUTATOR_HOOKFUNCTION(ctf, HavocBot_ChooseRole)
-{SELFPARAM();
-       havocbot_ctf_reset_role(self);
+{
+       entity bot = M_ARGV(0, entity);
+
+       havocbot_ctf_reset_role(bot);
        return true;
 }
 
@@ -2343,6 +2354,9 @@ MUTATOR_HOOKFUNCTION(ctf, SpectateCopy)
 
 MUTATOR_HOOKFUNCTION(ctf, GetRecords)
 {
+       int record_page = M_ARGV(0, int);
+       string ret_string = M_ARGV(1, string);
+
        for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
        {
                if (MapInfo_Get_ByID(i))
@@ -2358,7 +2372,7 @@ MUTATOR_HOOKFUNCTION(ctf, GetRecords)
                }
        }
 
-       return false;
+       M_ARGV(1, string) = ret_string;
 }
 
 bool superspec_Spectate(entity _player); // TODO
index 9bc20a3..9079a2f 100644 (file)
@@ -213,15 +213,17 @@ MUTATOR_HOOKFUNCTION(cts, reset_map_global)
 }
 
 MUTATOR_HOOKFUNCTION(cts, ClientConnect)
-{SELFPARAM();
-       race_PreparePlayer(this);
-       self.race_checkpoint = -1;
+{
+       entity player = M_ARGV(0, entity);
+
+       race_PreparePlayer(player);
+       player.race_checkpoint = -1;
 
-       if(IS_REAL_CLIENT(self))
+       if(IS_REAL_CLIENT(player))
        {
                string rr = CTS_RECORD;
 
-               msg_entity = self;
+               msg_entity = player;
                race_send_recordtime(MSG_ONE);
                race_send_speedaward(MSG_ONE);
 
@@ -299,8 +301,10 @@ MUTATOR_HOOKFUNCTION(cts, PlayerDies)
 }
 
 MUTATOR_HOOKFUNCTION(cts, HavocBot_ChooseRole)
-{SELFPARAM();
-       self.havocbot_role = havocbot_role_cts;
+{
+       entity bot = M_ARGV(0, entity);
+
+       bot.havocbot_role = havocbot_role_cts;
        return true;
 }
 
@@ -387,6 +391,9 @@ MUTATOR_HOOKFUNCTION(cts, ForbidPlayerScore_Clear)
 
 MUTATOR_HOOKFUNCTION(cts, GetRecords)
 {
+       int record_page = M_ARGV(0, int);
+       string ret_string = M_ARGV(1, string);
+
        for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
        {
                if(MapInfo_Get_ByID(i))
@@ -401,7 +408,7 @@ MUTATOR_HOOKFUNCTION(cts, GetRecords)
                }
        }
 
-       return false;
+       M_ARGV(1, string) = ret_string;
 }
 
 void ClientKill_Now();
@@ -423,10 +430,10 @@ MUTATOR_HOOKFUNCTION(cts, ClientKill)
 
 MUTATOR_HOOKFUNCTION(cts, Race_FinalCheckpoint)
 {
-       if(autocvar_g_cts_finish_kill_delay)
-               CTS_ClientKill(race_player);
+       entity player = M_ARGV(0, entity);
 
-       return false;
+       if(autocvar_g_cts_finish_kill_delay)
+               CTS_ClientKill(player);
 }
 
 MUTATOR_HOOKFUNCTION(cts, FixClientCvars)
index ea70cb6..dca3e48 100644 (file)
@@ -519,14 +519,17 @@ MUTATOR_HOOKFUNCTION(dom, PlayerSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(dom, ClientConnect)
-{SELFPARAM();
-       set_dom_state(self);
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       set_dom_state(player);
 }
 
 MUTATOR_HOOKFUNCTION(dom, HavocBot_ChooseRole)
-{SELFPARAM();
-       self.havocbot_role = havocbot_role_dom;
+{
+       entity bot = M_ARGV(0, entity);
+
+       bot.havocbot_role = havocbot_role_dom;
        return true;
 }
 
index c10ba0b..52e2fe3 100644 (file)
@@ -586,13 +586,15 @@ MUTATOR_HOOKFUNCTION(ft, SetStartItems)
 }
 
 MUTATOR_HOOKFUNCTION(ft, HavocBot_ChooseRole)
-{SELFPARAM();
-       if (!IS_DEAD(self))
+{
+       entity bot = M_ARGV(0, entity);
+
+       if (!IS_DEAD(bot))
        {
                if (random() < 0.5)
-                       self.havocbot_role = havocbot_role_ft_freeing;
+                       bot.havocbot_role = havocbot_role_ft_freeing;
                else
-                       self.havocbot_role = havocbot_role_ft_offense;
+                       bot.havocbot_role = havocbot_role_ft_offense;
        }
 
        return true;
@@ -606,9 +608,8 @@ MUTATOR_HOOKFUNCTION(ft, GetTeamCount, CBC_ORDER_EXCLUSIVE)
 MUTATOR_HOOKFUNCTION(ft, SetWeaponArena)
 {
        // most weapons arena
-       if(ret_string == "0" || ret_string == "")
-               ret_string = "most";
-       return false;
+       if(M_ARGV(0, string) == "0" || M_ARGV(0, string) == "")
+               M_ARGV(0, string) = "most";
 }
 
 void freezetag_Initialize()
index d060685..2e04b14 100644 (file)
@@ -455,7 +455,9 @@ MUTATOR_HOOKFUNCTION(inv, SV_ParseClientCommand)
 
 MUTATOR_HOOKFUNCTION(inv, BotShouldAttack)
 {
-       if(!IS_MONSTER(checkentity))
+       entity targ = M_ARGV(1, entity);
+
+       if(!IS_MONSTER(targ))
                return true;
 
        return false;
@@ -480,6 +482,7 @@ MUTATOR_HOOKFUNCTION(inv, AccuracyTargetValid)
 MUTATOR_HOOKFUNCTION(inv, AllowMobSpawning)
 {
        // monster spawning disabled during an invasion
+       M_ARGV(1, string) = "You cannot spawn monsters during an invasion!";
        return true;
 }
 
@@ -490,7 +493,7 @@ MUTATOR_HOOKFUNCTION(inv, GetTeamCount, CBC_ORDER_EXCLUSIVE)
 
 MUTATOR_HOOKFUNCTION(inv, AllowMobButcher)
 {
-       ret_string = "This command does not work during an invasion!";
+       M_ARGV(0, string) = "This command does not work during an invasion!";
        return true;
 }
 
index e9e2efc..f93ddfe 100644 (file)
@@ -449,19 +449,24 @@ MUTATOR_HOOKFUNCTION(ka, PlayerPhysics)
 }
 
 MUTATOR_HOOKFUNCTION(ka, BotShouldAttack)
-{SELFPARAM();
+{
+       entity bot = M_ARGV(0, entity);
+       entity targ = M_ARGV(1, entity);
+
        // if neither player has ball then don't attack unless the ball is on the ground
-       if(!checkentity.ballcarried && !self.ballcarried && ka_ball.owner)
+       if(!targ.ballcarried && !bot.ballcarried && ka_ball.owner)
                return true;
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(ka, HavocBot_ChooseRole)
-{SELFPARAM();
-       if (self.ballcarried)
-               self.havocbot_role = havocbot_role_ka_carrier;
+{
+       entity bot = M_ARGV(0, entity);
+
+       if (bot.ballcarried)
+               bot.havocbot_role = havocbot_role_ka_carrier;
        else
-               self.havocbot_role = havocbot_role_ka_collector;
+               bot.havocbot_role = havocbot_role_ka_collector;
        return true;
 }
 
index 2fb8632..9b4c758 100644 (file)
@@ -1362,17 +1362,18 @@ MUTATOR_HOOKFUNCTION(kh, PlayerUseKey)
 
 MUTATOR_HOOKFUNCTION(kh, HavocBot_ChooseRole)
 {
-    SELFPARAM();
-       if(IS_DEAD(self))
+    entity bot = M_ARGV(0, entity);
+
+       if(IS_DEAD(bot))
                return true;
 
        float r = random() * 3;
        if (r < 1)
-               self.havocbot_role = havocbot_role_kh_offense;
+               bot.havocbot_role = havocbot_role_kh_offense;
        else if (r < 2)
-               self.havocbot_role = havocbot_role_kh_defense;
+               bot.havocbot_role = havocbot_role_kh_defense;
        else
-               self.havocbot_role = havocbot_role_kh_freelancer;
+               bot.havocbot_role = havocbot_role_kh_freelancer;
 
        return true;
 }
index 0e29e70..4e89f2b 100644 (file)
@@ -219,17 +219,17 @@ MUTATOR_HOOKFUNCTION(lms, MakePlayerObserver)
 }
 
 MUTATOR_HOOKFUNCTION(lms, ClientConnect)
-{SELFPARAM();
-       TRANSMUTE(Player, self);
+{
+       entity player = M_ARGV(0, entity);
+
+       TRANSMUTE(Player, player);
        campaign_bots_may_start = true;
 
-       if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
+       if(PlayerScore_Add(player, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
        {
-               PlayerScore_Add(self, SP_LMS_RANK, 666);
-               self.frags = FRAGS_SPECTATOR;
+               PlayerScore_Add(player, SP_LMS_RANK, 666);
+               player.frags = FRAGS_SPECTATOR;
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
@@ -335,11 +335,14 @@ MUTATOR_HOOKFUNCTION(lms, OnEntityPreSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(lms, ItemTouch)
-{SELFPARAM();
-       if(self.itemdef == ITEM_ExtraLife)
+{
+       entity item = M_ARGV(0, entity);
+       entity toucher = M_ARGV(1, entity);
+
+       if(item.itemdef == ITEM_ExtraLife)
        {
-               Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
-               PlayerScore_Add(other, SP_LMS_LIVES, autocvar_g_lms_extra_lives);
+               Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES);
+               PlayerScore_Add(toucher, SP_LMS_LIVES, autocvar_g_lms_extra_lives);
                return MUT_ITEMTOUCH_PICKUP;
        }
 
index 9e41ac4..8d5cbe9 100644 (file)
@@ -245,15 +245,17 @@ MUTATOR_HOOKFUNCTION(rc, reset_map_global)
 }
 
 MUTATOR_HOOKFUNCTION(rc, ClientConnect)
-{SELFPARAM();
-       race_PreparePlayer(this);
-       self.race_checkpoint = -1;
+{
+       entity player = M_ARGV(0, entity);
+
+       race_PreparePlayer(player);
+       player.race_checkpoint = -1;
 
        string rr = RACE_RECORD;
 
-       if(IS_REAL_CLIENT(self))
+       if(IS_REAL_CLIENT(player))
        {
-               msg_entity = self;
+               msg_entity = player;
                race_send_recordtime(MSG_ONE);
                race_send_speedaward(MSG_ONE);
 
@@ -330,8 +332,10 @@ MUTATOR_HOOKFUNCTION(rc, PlayerDies)
 }
 
 MUTATOR_HOOKFUNCTION(rc, HavocBot_ChooseRole)
-{SELFPARAM();
-       self.havocbot_role = havocbot_role_race;
+{
+       entity bot = M_ARGV(0, entity);
+
+       bot.havocbot_role = havocbot_role_race;
        return true;
 }
 
@@ -401,6 +405,9 @@ MUTATOR_HOOKFUNCTION(rc, Scores_CountFragsRemaining)
 
 MUTATOR_HOOKFUNCTION(rc, GetRecords)
 {
+       int record_page = M_ARGV(0, int);
+       string ret_string = M_ARGV(1, string);
+
        for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
        {
                if(MapInfo_Get_ByID(i))
@@ -415,7 +422,7 @@ MUTATOR_HOOKFUNCTION(rc, GetRecords)
                }
        }
 
-       return false;
+       M_ARGV(1, string) = ret_string;
 }
 
 MUTATOR_HOOKFUNCTION(rc, FixClientCvars)
index e7a3aa9..8c4126c 100644 (file)
@@ -531,19 +531,15 @@ void WinningConditionHelper()
                {
                        s = GetPlayerScoreString(it, 1);
                        s = strcat(s, IS_REAL_CLIENT(it) ? ":human" : ":bot");
-                       ret_string = string_null;
-                       if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
+                       if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it))
                                s = strcat(s, ":spectator");
-                       if (ret_string) s = strcat(s, ret_string);
                }
                else
                {
-                       ret_string = string_null;
-                       if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
+                       if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
                                s = GetPlayerScoreString(it, 2);
                        else
                                s = "-666";
-                       if (ret_string) s = strcat(s, ret_string);
                }
 
                if(it.clientstatus)
index db72469..f23385c 100644 (file)
@@ -100,7 +100,7 @@ string getwelcomemessage(entity this)
        string s, modifications, motd;
 
        MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
-       modifications = ret_string;
+       modifications = M_ARGV(0, string);
 
        if(g_weaponarena)
        {
@@ -147,7 +147,7 @@ string getwelcomemessage(entity this)
 
        string mutator_msg = "";
        MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg);
-       mutator_msg = ret_string;
+       mutator_msg = M_ARGV(0, string);
 
        s = strcat(s, mutator_msg); // trust that the mutator will do proper formatting
 
index 579e6fd..748f434 100644 (file)
@@ -36,7 +36,7 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
 
                string s = W_Apply_Weaponreplace(e.netname);
                MUTATOR_CALLHOOK(SetWeaponreplace, this, e, s);
-               s = ret_string;
+               s = M_ARGV(2, string);
                if (s == "")
                {
                        remove(this);
index 7bd69c9..6491d94 100644 (file)
@@ -433,7 +433,7 @@ void fireBullet(entity this, vector start, vector dir, float spread, float max_s
                        fireBullet_last_hit = hit;
                        yoda = 0;
                        MUTATOR_CALLHOOK(FireBullet_Hit, this, hit, start, end, damage);
-                       damage = frag_damage;
+                       damage = M_ARGV(4, float);
                        float g = accuracy_isgooddamage(this, hit);
                        Damage(hit, this, this, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
                        // calculate hits for ballistic weapons