]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanse more of the mutator hooks
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 06:19:27 +0000 (16:19 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 06:19:27 +0000 (16:19 +1000)
50 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/items/all.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/common/mutators/mutator/superspec/superspec.qc
qcsrc/common/stats.qh
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/server/bot/aim.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.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/mutators/mutator/gamemode_tdm.qc
qcsrc/server/scores.qc
qcsrc/server/teamplay.qc
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh

index 7d10f5d476493562ff9b9ac36e05934c700ace6f..2889b182c43edb3e949d0bcd4f154bce89443b47 100644 (file)
@@ -791,7 +791,7 @@ void W_Nexball_Attack(entity actor, float t)
                mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
        }
 
-       DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
+       DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor, actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
 
 
        //TODO: use the speed_up cvar too ??
@@ -922,9 +922,10 @@ void nb_DropBall(entity player)
 }
 
 MUTATOR_HOOKFUNCTION(nb, ClientDisconnect)
-{SELFPARAM();
-       nb_DropBall(self);
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       nb_DropBall(player);
 }
 
 MUTATOR_HOOKFUNCTION(nb, PlayerDies)
@@ -935,8 +936,10 @@ MUTATOR_HOOKFUNCTION(nb, PlayerDies)
 }
 
 MUTATOR_HOOKFUNCTION(nb, MakePlayerObserver)
-{SELFPARAM();
-       nb_DropBall(self);
+{
+       entity player = M_ARGV(0, entity);
+
+       nb_DropBall(player);
        return false;
 }
 
@@ -1009,8 +1012,10 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink)
 
 MUTATOR_HOOKFUNCTION(nb, SpectateCopy)
 {
-       SELFPARAM();
-       this.metertime = other.metertime;
+       entity spectatee = M_ARGV(0, entity);
+       entity client = M_ARGV(1, entity);
+
+       client.metertime = spectatee.metertime;
 }
 
 MUTATOR_HOOKFUNCTION(nb, PlayerSpawn)
@@ -1063,13 +1068,13 @@ MUTATOR_HOOKFUNCTION(nb, FilterItem)
 
 MUTATOR_HOOKFUNCTION(nb, GetTeamCount)
 {
-       ret_string = "nexball_team";
+       M_ARGV(1, string) = "nexball_team";
        return true;
 }
 
 MUTATOR_HOOKFUNCTION(nb, WantWeapon)
 {
-       ret_float = 0; // weapon is set a few lines later, apparently
+       M_ARGV(1, float) = 0; // weapon is set a few lines later, apparently
        return true;
 }
 
index 1f9c88780ee326dc6ee92436d9544de19b8ac2de..d7a615b87a2095554e7805c9455009a069f3666c 100644 (file)
@@ -1765,15 +1765,17 @@ MUTATOR_HOOKFUNCTION(ons, reset_map_global)
 }
 
 MUTATOR_HOOKFUNCTION(ons, ClientDisconnect)
-{SELFPARAM();
-       self.ons_deathloc = '0 0 0';
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       player.ons_deathloc = '0 0 0';
 }
 
 MUTATOR_HOOKFUNCTION(ons, MakePlayerObserver)
-{SELFPARAM();
-       self.ons_deathloc = '0 0 0';
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       player.ons_deathloc = '0 0 0';
 }
 
 MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
@@ -2022,9 +2024,11 @@ MUTATOR_HOOKFUNCTION(ons, GetTeamCount)
 }
 
 MUTATOR_HOOKFUNCTION(ons, SpectateCopy)
-{SELFPARAM();
-       self.ons_roundlost = other.ons_roundlost; // make spectators see it too
-       return false;
+{
+       entity spectatee = M_ARGV(0, entity);
+       entity client = M_ARGV(1, entity);
+
+       client.ons_roundlost = spectatee.ons_roundlost; // make spectators see it too
 }
 
 MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand)
@@ -2114,6 +2118,8 @@ MUTATOR_HOOKFUNCTION(ons, PlayerUseKey)
 
 MUTATOR_HOOKFUNCTION(ons, PlayHitsound)
 {
+       entity frag_victim = M_ARGV(0, entity);
+
        return (frag_victim.classname == "onslaught_generator" && !frag_victim.isshielded)
                || (frag_victim.classname == "onslaught_controlpoint_icon" && !frag_victim.owner.isshielded);
 }
@@ -2143,9 +2149,11 @@ MUTATOR_HOOKFUNCTION(ons, SendWaypoint)
 
 MUTATOR_HOOKFUNCTION(ons, TurretValidateTarget)
 {
+       entity turret_target = M_ARGV(1, entity);
+
        if(substring(turret_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!
        {
-               ret_float = -3;
+               M_ARGV(3, float) = -3;
                return true;
        }
 
index 9d7cfa8d32e428aed292e73b8a4d501cbfada5f9..7a3e5004696ee1c655a8f5eca7e3cb5cb3506b54 100644 (file)
@@ -14,7 +14,7 @@ string Item_Model(string item_mdl)
     string output = strcat("models/items/", item_mdl);
 #ifdef SVQC
     MUTATOR_CALLHOOK(ItemModel, item_mdl, output);
-    output = item_model_output;
+    output = M_ARGV(1, string);
 #endif
     return output;
 }
index 01e7f31bb362db86d008d0f7f45d491de621aadb..1349717664d99c534bb749fec079c874d039c5f8 100644 (file)
@@ -799,8 +799,8 @@ bool buffs_RemovePlayer(entity player)
 
        return false;
 }
-MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { SELFPARAM(); return buffs_RemovePlayer(self); }
-MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { SELFPARAM(); return buffs_RemovePlayer(self); }
+MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); }
+MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); }
 
 MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint)
 {SELFPARAM();
@@ -832,25 +832,25 @@ MUTATOR_HOOKFUNCTION(buffs, OnEntityPreSpawn, CBC_ORDER_LAST)
 }
 
 MUTATOR_HOOKFUNCTION(buffs, WeaponRateFactor)
-{SELFPARAM();
-       if(self.buffs & BUFF_SPEED.m_itemid)
-               weapon_rate *= autocvar_g_buffs_speed_rate;
+{
+       entity player = M_ARGV(1, entity);
 
-       if(time < self.buff_disability_time)
-               weapon_rate *= autocvar_g_buffs_disability_rate;
+       if(player.buffs & BUFF_SPEED.m_itemid)
+               M_ARGV(0, float) *= autocvar_g_buffs_speed_rate;
 
-       return false;
+       if(time < player.buff_disability_time)
+               M_ARGV(0, float) *= autocvar_g_buffs_disability_rate;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor)
-{SELFPARAM();
-       if(self.buffs & BUFF_SPEED.m_itemid)
-               ret_float *= autocvar_g_buffs_speed_weaponspeed;
+{
+       entity player = M_ARGV(1, entity);
 
-       if(time < self.buff_disability_time)
-               ret_float *= autocvar_g_buffs_disability_weaponspeed;
+       if(player.buffs & BUFF_SPEED.m_itemid)
+               M_ARGV(0, float) *= autocvar_g_buffs_speed_weaponspeed;
 
-       return false;
+       if(time < player.buff_disability_time)
+               M_ARGV(0, float) *= autocvar_g_buffs_disability_weaponspeed;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
@@ -1006,9 +1006,11 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
 }
 
 MUTATOR_HOOKFUNCTION(buffs, SpectateCopy)
-{SELFPARAM();
-       self.buffs = other.buffs;
-       return false;
+{
+       entity spectatee = M_ARGV(0, entity);
+       entity client = M_ARGV(1, entity);
+
+       client.buffs = spectatee.buffs;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, VehicleEnter)
index 34836ab3d4e40327dc5ea773c23f5c46de56f78c..89f98ade77065dbe55468f1b0d41addd8cabe86d 100644 (file)
@@ -170,9 +170,10 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, BotShouldAttack)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, MakePlayerObserver)
-{SELFPARAM();
-       instagib_stop_countdown(self);
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       instagib_stop_countdown(player);
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerSpawn)
index 089f03abb8c8c7827897c5a1af9914393d365384..16e181908b27406e3ed7aa8cdedebbef126391b1 100644 (file)
@@ -160,8 +160,10 @@ MUTATOR_HOOKFUNCTION(itemstime, reset_map_global)
 }
 
 MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver)
-{SELFPARAM();
-    Item_ItemsTime_SetTimesForPlayer(self);
+{
+    entity player = M_ARGV(0, entity);
+
+    Item_ItemsTime_SetTimesForPlayer(player);
 }
 
 MUTATOR_HOOKFUNCTION(itemstime, ClientConnect, CBC_ORDER_LAST)
index 999bd4ada0f08b695f675a089ec3a8769344f3be..112b2ca015f0e827d430cf0ad050208594451629 100644 (file)
@@ -813,7 +813,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
 }
 
 void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
-{SELFPARAM();
+{
        if(e.nade == world)
                return;
 
@@ -849,14 +849,14 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
        if (trace_startsolid)
                setorigin(_nade, e.origin);
 
-       if(self.v_angle.x >= 70 && self.v_angle.x <= 110 && PHYS_INPUT_BUTTON_CROUCH(self))
+       if(e.v_angle.x >= 70 && e.v_angle.x <= 110 && PHYS_INPUT_BUTTON_CROUCH(e))
                _nade.velocity = '0 0 100';
        else if(autocvar_g_nades_nade_newton_style == 1)
                _nade.velocity = e.velocity + _velocity;
        else if(autocvar_g_nades_nade_newton_style == 2)
                _nade.velocity = _velocity;
        else
-               _nade.velocity = W_CalculateProjectileVelocity(e.velocity, _velocity, true);
+               _nade.velocity = W_CalculateProjectileVelocity(e, e.velocity, _velocity, true);
 
        if(set_owner)
                _nade.realowner = e;
@@ -1351,27 +1351,34 @@ MUTATOR_HOOKFUNCTION(nades, DropSpecialItems)
        return false;
 }
 
-bool nades_RemovePlayer()
-{SELFPARAM();
-       nades_Clear(self);
-       nades_RemoveBonus(self);
-       return false;
+void nades_RemovePlayer(entity this)
+{
+       nades_Clear(this);
+       nades_RemoveBonus(this);
 }
 
-MUTATOR_HOOKFUNCTION(nades, MakePlayerObserver) { nades_RemovePlayer(); }
-MUTATOR_HOOKFUNCTION(nades, ClientDisconnect) { nades_RemovePlayer(); }
-MUTATOR_HOOKFUNCTION(nades, reset_map_global) { nades_RemovePlayer(); }
+MUTATOR_HOOKFUNCTION(nades, MakePlayerObserver) { entity player = M_ARGV(0, entity); nades_RemovePlayer(player); }
+MUTATOR_HOOKFUNCTION(nades, ClientDisconnect) { entity player = M_ARGV(0, entity); nades_RemovePlayer(player); }
+MUTATOR_HOOKFUNCTION(nades, reset_map_global)
+{
+       FOREACH_CLIENT(IS_PLAYER(it),
+       {
+               nades_RemovePlayer(it);
+       });
+}
 
 MUTATOR_HOOKFUNCTION(nades, SpectateCopy)
-{SELFPARAM();
-       self.nade_timer = other.nade_timer;
-       self.nade_type = other.nade_type;
-       self.pokenade_type = other.pokenade_type;
-       self.bonus_nades = other.bonus_nades;
-       self.bonus_nade_score = other.bonus_nade_score;
-       self.stat_healing_orb = other.stat_healing_orb;
-       self.stat_healing_orb_alpha = other.stat_healing_orb_alpha;
-       return false;
+{
+       entity spectatee = M_ARGV(0, entity);
+       entity client = M_ARGV(1, entity);
+
+       client.nade_timer = spectatee.nade_timer;
+       client.nade_type = spectatee.nade_type;
+       client.pokenade_type = spectatee.pokenade_type;
+       client.bonus_nades = spectatee.bonus_nades;
+       client.bonus_nade_score = spectatee.bonus_nade_score;
+       client.stat_healing_orb = spectatee.stat_healing_orb;
+       client.stat_healing_orb_alpha = spectatee.stat_healing_orb_alpha;
 }
 
 REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");
index 0d14164d1a0ed03d9cedb6b9f4185be07eb125b4..38aec81e7af892696232edc568034a5ff32fab64 100644 (file)
@@ -96,7 +96,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
                SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor);
 
        int slot = weaponslot(weaponentity);
-       ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(hmg, refire) * W_WeaponRateFactor();
+       ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(hmg, refire) * W_WeaponRateFactor(actor);
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
 }
 
index 71b11147625c9bf9108110814ef87881695b4e93..fc41bbc3d9e853c6bcd3405c4d5b56585d8a5b98 100644 (file)
@@ -222,7 +222,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
        if(!forbidWeaponUse(self) || self.weapon_blocked) // allow if weapon is blocked
        if(time >= self.jump_interval)
        {
-               self.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor();
+               self.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor(this);
                makevectors(self.v_angle);
 
                Weapon oldwep = PS(self).m_weapon;
@@ -353,11 +353,12 @@ MUTATOR_HOOKFUNCTION(ok, FilterItem)
 }
 
 MUTATOR_HOOKFUNCTION(ok, SpectateCopy)
-{SELFPARAM();
-       self.ammo_charge[PS(self).m_weapon.m_id] = other.ammo_charge[PS(other).m_weapon.m_id];
-       self.ok_use_ammocharge = other.ok_use_ammocharge;
+{
+       entity spectatee = M_ARGV(0, entity);
+       entity client = M_ARGV(1, entity);
 
-       return false;
+       client.ammo_charge[PS(client).m_weapon.m_id] = spectatee.ammo_charge[PS(spectatee).m_weapon.m_id];
+       client.ok_use_ammocharge = spectatee.ok_use_ammocharge;
 }
 
 MUTATOR_HOOKFUNCTION(ok, SetStartItems)
index c3ce2d27d4402b46bd0828c56540463fd7bac754..9913591af7cc70d2cfb89d6f8318071ae7fc4e61 100644 (file)
@@ -457,7 +457,8 @@ MUTATOR_HOOKFUNCTION(superspec, PlayerDies)
 
 MUTATOR_HOOKFUNCTION(superspec, ClientDisconnect)
 {
-       superspec_save_client_conf();
-       return false;
+       entity player = M_ARGV(0, entity);
+
+       WITHSELF(player, superspec_save_client_conf());
 }
 #endif
index e9828c69ee4329575a11715eff10594efdc8c069..f5eec57658a0bde68e47ad440ed69489921631c1 100644 (file)
@@ -63,9 +63,9 @@ REGISTER_STAT(SWITCHINGWEAPON, int)
 REGISTER_STAT(WEAPON_NEXTTHINK, float)
 #ifdef SVQC
 SPECTATE_COPYFIELD(_STAT(WEAPON_NEXTTHINK))
-float W_WeaponRateFactor();
+float W_WeaponRateFactor(entity this);
 #endif
-REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor())
+REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this))
 
 REGISTER_STAT(GAMESTARTTIME, float)
 REGISTER_STAT(STRENGTH_FINISHED, float)
index 769c0edf720bfc241d81a5b817f131bbebf6f7a9..b2b1d973bf39dfbb41827772e8d120dc407f2b9f 100644 (file)
@@ -704,7 +704,7 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
                return -1;
 
        if(MUTATOR_CALLHOOK(TurretValidateTarget, e_turret, e_target, validate_flags))
-               return ret_float;
+               return M_ARGV(3, float);
 
        if (validate_flags & TFL_TARGETSELECT_NO)
                return -4;
index 24ae60c3df039f8cd4e4ca9e2380c994c579d464..1e1ce3eede1b1b429aae7fbd53e9264eb8dce530 100644 (file)
@@ -262,7 +262,7 @@ string W_Sound(string w_snd)
        string output = strcat("weapons/", w_snd);
 #ifdef SVQC
                MUTATOR_CALLHOOK(WeaponSound, w_snd, output);
-               return weapon_sound_output;
+               return M_ARGV(1, string);
 #else
                return output;
 #endif
index 5df635f77d997af1a6a866fb2e2d929dc3cdc12c..ba75c98c5ce1bc7520196c2cc08bb0c635f511f7 100644 (file)
@@ -805,7 +805,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
         sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
         int slot = weaponslot(weaponentity);
-        ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
+        ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor(actor);
     }
     actor.arc_BUTTON_ATCK_prev = false;
 
@@ -816,7 +816,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
         W_Arc_Attack2();
         actor.arc_count = autocvar_g_balance_arc_secondary_count;
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
-        actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
+        actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor(actor);
     }
     #endif
 }
index 772b9ea6294c616d38aed6aa346de49ee4440e74..275c375f3d154259c812af2f61563307d0a49f0c 100644 (file)
@@ -267,9 +267,9 @@ void W_Devastator_Think(entity this)
 
        // accelerate
        makevectors(self.angles.x * '-1 0 0' + self.angles.y * '0 1 0');
-       velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor() - (self.velocity * v_forward);
+       velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor(self.realowner) - (self.velocity * v_forward);
        if(velspeed > 0)
-               self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor() * frametime, velspeed);
+               self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor(self.realowner) * frametime, velspeed);
 
        // laser guided, or remote detonation
        if(PS(self.realowner).m_weapon == WEP_DEVASTATOR)
index 64a5e06aa0621f0dd826f943cd0eec7018bfa217..19e3ff8a82f59e1062237228cf122fc84961d636 100644 (file)
@@ -492,7 +492,7 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit
             W_Electro_Attack_Orb(thiswep, actor);
             actor.electro_count = WEP_CVAR_SEC(electro, count);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
-            actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
+            actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor);
         }
     }
 }
index 3ee23e8f5f7a66f16682c004056b88e3a03635f3..d6768f9eb7bad42347f8ba1199e2163d16f28833 100644 (file)
@@ -386,7 +386,7 @@ METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponenti
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(fireball, refire)))
         {
             W_Fireball_Attack1_Frame0(thiswep, actor, weaponentity, fire);
-            actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
+            actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor(actor);
         }
     }
     else if(fire & 2)
index 577d4cf4e2671b562e8843601ce55a620e793609..a81479869e6cda8cbc0df0ba65f690ef55a5d771 100644 (file)
@@ -295,7 +295,7 @@ void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity)
        }
 
        weapon_thinkf(self, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
-       self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor();
+       self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor(actor);
        self.hagar_load = 0;
 }
 
@@ -332,7 +332,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
                                sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
 
                                // pause until we can load rockets again, once we re-press the alt fire button
-                               self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor();
+                               self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
 
                                // require letting go of the alt fire button before we can load again
                                self.hagar_loadblock = true;
@@ -353,7 +353,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
                                        if(self.hagar_load >= WEP_CVAR_SEC(hagar, load_max))
                                                stopped = true;
                                        else
-                                               self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor();
+                                               self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
                                }
                        }
                        if(stopped && !self.hagar_loadbeep && self.hagar_load) // prevents the beep from playing each frame
@@ -361,7 +361,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
                                // if this is the last rocket we can load, play a beep sound to notify the player
                                sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
                                self.hagar_loadbeep = true;
-                               self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor();
+                               self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(actor);
                        }
                }
        }
@@ -426,7 +426,7 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int
        W_Hagar_Attack(thiswep, actor);
 
        int slot = weaponslot(weaponentity);
-       ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor();
+       ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor(actor);
        int theframe = WFRAME_FIRE1;
        entity this = actor.(weaponentity);
        if(this)
index 3fa50ff0445565e0543a1dee20225326ecba2a7c..9d82c34f22f384ac643e73672f0f291596bf0587 100644 (file)
@@ -180,7 +180,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int
                }
 
                int slot = weaponslot(weaponentity);
-               ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
+               ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor(actor);
                W_HLAC_Attack(WEP_HLAC, actor);
                actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
index 7c4aabfe71e2b280e106bb4759cd893b81bf270d..fd8fd9aefac325ad61d801c9615271e728268fad 100644 (file)
@@ -215,7 +215,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
     if(actor.hook)
     {
         // if hooked, no bombs, and increase the timer
-        actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor());
+        actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor(actor));
 
         // hook also inhibits health regeneration, but only for 1 second
         if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -268,7 +268,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
             RemoveGrapplingHook(actor);
         WITHSELF(actor, FireGrapplingHook());
         actor.hook_state &= ~HOOK_FIRING;
-        actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
+        actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor(actor));
     }
     else if (actor.hook_state & HOOK_REMOVING)
     {
index 10a8c40a181dbcaa5bdb95723e9efc56a778b2f6..2bf2f18bdf7aa77d31f39270f8900ec695982743 100644 (file)
@@ -116,7 +116,7 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity we
        }
        int slot = weaponslot(weaponentity);
        // this attack_finished just enforces a cooldown at the end of a burst
-       ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
+       ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor);
 
        if(self.misc_bulletcounter == 1)
                fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
@@ -205,7 +205,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
                SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor);
 
        int slot = weaponslot(weaponentity);
-       ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
+       ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor);
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Auto);
 }
 
@@ -232,7 +232,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
        if(actor.misc_bulletcounter == 0)
        {
                int slot = weaponslot(weaponentity);
-               ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor();
+               ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor(actor);
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, burst_animtime), w_ready);
        }
        else
index 0852555510eba9eef9b71b98dd546fffad1314cd..2fc64252516bb68871e39bd491035c08b6b7f9bd 100644 (file)
@@ -425,7 +425,7 @@ void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seek
                return;
        }
 
-       this.nextthink = time + WEP_CVAR(seeker, missile_delay) * W_WeaponRateFactor();
+       this.nextthink = time + WEP_CVAR(seeker, missile_delay) * W_WeaponRateFactor(this.realowner);
 
        entity own = this.realowner;
 
index a39e7697b96dcb07c6127f3d86d9cd665bee4636..a138d6a68e6da870d9a511667d91279d2b161805 100644 (file)
@@ -137,7 +137,7 @@ void W_Shockwave_Melee_Think(entity this)
        makevectors(self.realowner.v_angle);
 
        // calculate swing percentage based on time
-       meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor();
+       meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor(this.realowner);
        swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
        f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
 
@@ -242,7 +242,7 @@ void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int f
        entity meleetemp = new_pure(meleetemp);
        meleetemp.owner = meleetemp.realowner = actor;
        setthink(meleetemp, W_Shockwave_Melee_Think);
-       meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
+       meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor(actor);
        W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
 }
 
@@ -689,7 +689,7 @@ METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponent
             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
             {
                 W_Shockwave_Attack(actor);
-                actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
+                actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor(actor);
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
             }
         }
index 2440ea42ede70009ce04de04918cf0f539a50ce3..8de7b6fb30dbc677e4ab630781d0d924879b77f5 100644 (file)
@@ -103,7 +103,7 @@ void W_Shotgun_Melee_Think(entity this)
        makevectors(self.realowner.v_angle); // update values for v_* vectors
 
        // calculate swing percentage based on time
-       meleetime = WEP_CVAR_SEC(shotgun, melee_time) * W_WeaponRateFactor();
+       meleetime = WEP_CVAR_SEC(shotgun, melee_time) * W_WeaponRateFactor(this.realowner);
        swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
        f = ((1 - swing) * WEP_CVAR_SEC(shotgun, melee_traces));
 
@@ -191,7 +191,7 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, .entity weaponentity, int f
        entity meleetemp = new_pure(meleetemp);
        meleetemp.realowner = actor;
        setthink(meleetemp, W_Shotgun_Melee_Think);
-       meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor();
+       meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor(actor);
        W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
 }
 
@@ -252,7 +252,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit
                 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
                 {
                     W_Shotgun_Attack(thiswep, actor, true);
-                    actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
+                    actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor(actor);
                     weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
                 }
             }
@@ -264,7 +264,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit
                 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
                 {
                     W_Shotgun_Attack(thiswep, actor, false);
-                    actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
+                    actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor(actor);
                     weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
                 }
             }
index 3dd1c26289f3a74e6c5c5190a04c051c06306a97..147f2e00ead68384af713927ccaba1b88c6c0209 100644 (file)
@@ -344,7 +344,7 @@ void W_Tuba_NoteOn(entity actor, float hittype)
                Net_LinkEntity(self.tuba_note, false, 0, W_Tuba_NoteSendEntity);
        }
 
-       self.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(); // so it can get prolonged safely
+       self.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(actor); // so it can get prolonged safely
 
        //sound(self, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation);
        RadiusDamage(self, self, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), NULL, NULL, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, NULL);
index 3ade59d5fd4db27278ddfe78949ab1ecee2fe468..ee77fc1c128b9f08bcdfc51e3d24d00b0d28c59d 100644 (file)
@@ -281,7 +281,7 @@ void W_RocketMinsta_Attack2(entity actor)
         //W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
                proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
                proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
-               proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
+               proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
         proj.angles = vectoangles(proj.velocity);
         settouch(proj, W_RocketMinsta_Laser_Touch);
         setsize(proj, '0 0 -3', '0 0 -3');
@@ -331,7 +331,7 @@ void W_RocketMinsta_Attack3 (entity actor)
 
         proj.movetype = MOVETYPE_BOUNCEMISSILE;
                proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
-               proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
+               proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
         proj.angles = vectoangles(proj.velocity);
         settouch(proj, W_RocketMinsta_Laser_Touch);
         setsize(proj, '0 0 -3', '0 0 -3');
@@ -395,7 +395,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
         else if (actor.jump_interval <= time)
         {
             // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
-            actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
+            actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor(actor);
 
             // decrease ammo for the laser?
             if(WEP_CVAR_SEC(vaporizer, ammo))
index 0f138d2d5610a57c75c5b013ba83c0766433993b..ebbacd6b8e2835ae66d694d86b903166c4408f22 100644 (file)
@@ -337,8 +337,8 @@ bool bot_aim(entity this, float shotspeed, float shotspeedupward, float maxshott
        hf = this.dphitcontentsmask;
        this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
 
-       shotspeed *= W_WeaponSpeedFactor();
-       shotspeedupward *= W_WeaponSpeedFactor();
+       shotspeed *= W_WeaponSpeedFactor(this);
+       shotspeedupward *= W_WeaponSpeedFactor(this);
        if (!shotspeed)
        {
                LOG_TRACE("bot_aim: WARNING: weapon ", PS(this).m_weapon.m_name, " shotspeed is zero!\n");
index 6f0e1d3aecb94e2347fbe1c24ff8cba7af1e091a..9d9d0fea24bc4bc034f1fe7e0216b145092d5a9a 100644 (file)
@@ -187,7 +187,7 @@ void FixPlayermodel(entity player);
 void PutObserverInServer()
 {
        SELFPARAM();
-    bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver);
+    bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver, this);
        PlayerState_detach(this);
 
        if (IS_PLAYER(this) && this.health >= 1) {
@@ -1191,7 +1191,7 @@ void ClientDisconnect()
 
        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, this.netname);
 
-    MUTATOR_CALLHOOK(ClientDisconnect);
+    MUTATOR_CALLHOOK(ClientDisconnect, this);
 
        ClientState_detach(this);
 
index 251c6921e423b2fbc0f5bc78f97ab12a999864fb..5c1e6ea60de41377d826617fd86c352d918f65c6 100644 (file)
@@ -248,7 +248,7 @@ IMPULSE(weapon_drop)
 {
        if (this.vehicle) return;
        if (IS_DEAD(this)) return;
-       W_ThrowWeapon(this, W_CalculateProjectileVelocity(this.velocity, v_forward * 750, false), '0 0 0', true);
+       W_ThrowWeapon(this, W_CalculateProjectileVelocity(this, this.velocity, v_forward * 750, false), '0 0 0', true);
 }
 
 IMPULSE(weapon_reload)
index 9d67d334669faa4802778388bd797d63206479ab..5e242e48cd04054d005cc06df1272b06fb0316ff 100644 (file)
@@ -1928,7 +1928,7 @@ void CheckRules_World()
        if(checkrules_status == WINNING_YES)
                bprint("Hey! Someone ran out of spawns!\n");
        else if(MUTATOR_CALLHOOK(CheckRules_World, checkrules_status, timelimit, fraglimit))
-               checkrules_status = ret_float;
+               checkrules_status = M_ARGV(0, float);
        else
                checkrules_status = WinningCondition_Scores(fraglimit, leadlimit);
 
index 0532feb6d208ba14138b750ee8d2ebd6c921a8f4..7eaf978a9997535d0d3dd50769efc394b114fe7a 100644 (file)
@@ -472,9 +472,9 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne
                return 0;
 
        bool mutator_returnvalue = MUTATOR_CALLHOOK(WantWeapon, weaponinfo, d, allguns, allow_mutatorblocked);
-       d = ret_float;
-       allguns = want_allguns;
-       allow_mutatorblocked = false;
+       d = M_ARGV(1, float);
+       allguns = M_ARGV(2, bool);
+       allow_mutatorblocked = M_ARGV(3, bool);
 
        if(allguns)
        {
index eaef39ae80e8383cd48063a84ce47bfd50e88e61..143627180b1ae6b81e1c264e3cf4394f59df4053 100644 (file)
@@ -6,6 +6,7 @@
 
 /** called when a player becomes observer, after shared setup */
 #define EV_MakePlayerObserver(i, o) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
 
@@ -39,6 +40,7 @@ MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_ForbidPlayerScore_Clear);
 
 /** called when a player disconnects */
 #define EV_ClientDisconnect(i, o) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
 
@@ -55,29 +57,24 @@ MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
 
 /** called when a player dies to e.g. remove stuff he was carrying */
 #define EV_PlayHitsound(i, o) \
-    /**/ i(entity, frag_victim) \
+    /** victim */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
-entity frag_victim;
 MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
 
 /** called when a weapon sound is about to be played, allows custom paths etc. */
 #define EV_WeaponSound(i, o) \
-    /**/ i(string, weapon_sound) \
-    /**/ i(string, weapon_sound_output) \
-    /**/ o(string, weapon_sound_output) \
+    /** sound       */ i(string, MUTATOR_ARGV_0_string) \
+    /** output      */ i(string, MUTATOR_ARGV_1_string) \
+    /**/               o(string, MUTATOR_ARGV_1_string) \
     /**/
-string weapon_sound;
-string weapon_sound_output;
 MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound);
 
 /** called when an item model is about to be set, allows custom paths etc. */
 #define EV_ItemModel(i, o) \
-    /**/ i(string, item_model) \
-    /**/ i(string, item_model_output) \
-    /**/ o(string, item_model_output) \
+    /** model       */ i(string, MUTATOR_ARGV_0_string) \
+    /** output      */ i(string, MUTATOR_ARGV_1_string) \
+    /**/               o(string, MUTATOR_ARGV_1_string) \
     /**/
-string item_model;
-string item_model_output;
 MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
 
 /** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
@@ -92,20 +89,19 @@ MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
 /** called when the match ends */
 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
 
-/** should adjust ret_float to contain the team count */
+/** should adjust number to contain the team count */
 #define EV_GetTeamCount(i, o) \
-    /**/ i(float, ret_float) \
-    /**/ o(float, ret_float) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** number of teams    */ i(float, MUTATOR_ARGV_0_float) \
+    /**/                      o(float, MUTATOR_ARGV_0_float) \
+    /** team entity name   */ i(string, MUTATOR_ARGV_1_string) \
+    /**/                      o(string, MUTATOR_ARGV_1_string) \
     /**/
-float ret_float;
 MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
 
 /** copies variables for spectating "other" to "self" */
 #define EV_SpectateCopy(i, o) \
-    /**/ i(entity, other) \
-    /**/ i(entity, __self) \
+    /** spectatee   */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** client      */ i(entity, MUTATOR_ARGV_1_entity) \
     /**/
 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
 
@@ -139,16 +135,17 @@ MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
 
 /** allows changing attack rate */
 #define EV_WeaponRateFactor(i, o) \
-    /**/ i(float, weapon_rate) \
-    /**/ o(float, weapon_rate) \
+    /** weapon rate */  i(float, MUTATOR_ARGV_0_float) \
+    /**/                o(float, MUTATOR_ARGV_0_float) \
+    /** player */       i(entity, MUTATOR_ARGV_1_entity) \
     /**/
-float weapon_rate;
 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
 
 /** allows changing weapon speed (projectiles mostly) */
 #define EV_WeaponSpeedFactor(i, o) \
-    /**/ i(float, ret_float) \
-    /**/ o(float, ret_float) \
+    /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
+    /**/                o(float, MUTATOR_ARGV_0_float) \
+    /** player */       i(entity, MUTATOR_ARGV_1_entity) \
     /**/
 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
 
@@ -405,9 +402,9 @@ MUTATOR_HOOKABLE(PlayerUseKey, EV_NO_ARGS);
  * }
  */
 #define EV_SV_ParseClientCommand(i, o) \
-       /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
-    /** command name */ i(string, MUTATOR_ARGV_1_string) \
-       /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
+       /** client sending the command */       i(entity, MUTATOR_ARGV_0_entity) \
+    /** command name */                     i(string, MUTATOR_ARGV_1_string) \
+       /** argc (also, argv() can be used) */  i(int, MUTATOR_ARGV_2_int) \
        /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
     /**/
 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
@@ -456,6 +453,7 @@ MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
     /**/ i(string, ret_string) \
     /**/ o(string, ret_string) \
     /**/
+//string ret_string;
 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
 
 /** called when an item is about to respawn */
@@ -669,16 +667,15 @@ MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
 
 /** called when player triggered kill (or is changing teams), return error to not do anything */
 #define EV_ClientKill(i, o) \
-    /** player */ i(entity, __self) \
-    /* kill delay */ i(float, ret_float) \
-    /* kill delay */ o(float, ret_float) \
+    /** player */        i(entity, MUTATOR_ARGV_0_entity) \
+    /** kill delay */    i(float, MUTATOR_ARGV_1_float) \
+    /**/                 o(float, MUTATOR_ARGV_1_float) \
     /**/
 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
 
 #define EV_FixClientCvars(i, o) \
-    /**/ i(entity, fix_client) \
+    /** player */        i(entity, MUTATOR_ARGV_0_entity) \
     /**/
-entity fix_client;
 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
 
 #define EV_SpectateSet(i, o) \
@@ -734,35 +731,30 @@ enum {
 };
 
 #define EV_CheckRules_World(i, o) \
-    /* status */ i(float, ret_float) \
-    /* status */ o(float, ret_float) \
-    /* time limit */ i(float, checkrules_timelimit) \
-    /* frag limit */ i(int, checkrules_fraglimit) \
+    /** status */    i(float, MUTATOR_ARGV_0_float) \
+    /**/             o(float, MUTATOR_ARGV_0_float) \
+    /* time limit */ i(float, MUTATOR_ARGV_1_float) \
+    /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
     /**/
-float checkrules_timelimit;
-int checkrules_fraglimit;
 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
 
 #define EV_WantWeapon(i, o) \
-    /**/ i(entity, want_weaponinfo) \
-    /**/ i(float, ret_float) \
-    /**/ o(float, ret_float) \
-    /**/ i(bool, want_allguns) \
-    /**/ o(bool, want_allguns) \
-    /**/ i(bool, want_mutatorblocked) \
-    /**/ o(bool, want_mutatorblocked) \
-    /**/
-entity want_weaponinfo;
-bool want_allguns;
-bool want_mutatorblocked;
+    /** weapon info entity */    i(entity, MUTATOR_ARGV_0_entity) \
+    /** do want? */              i(float, MUTATOR_ARGV_1_float) \
+    /**/                         o(float, MUTATOR_ARGV_1_float) \
+    /** want all guns */         i(bool, MUTATOR_ARGV_2_bool) \
+    /**/                         o(bool, MUTATOR_ARGV_2_bool) \
+    /** want mutator blocked */  i(bool, MUTATOR_ARGV_3_bool) \
+    /**/                         o(bool, MUTATOR_ARGV_3_bool) \
+    /**/
 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
 
 #define EV_AddPlayerScore(i, o) \
-    /**/ i(int, score_field) \
-    /**/ i(float, ret_float) \
-    /**/ o(float, ret_float) \
+    /** score field */  i(int, MUTATOR_ARGV_0_int) \
+    /** score */        i(float, MUTATOR_ARGV_1_float) \
+    /**/                o(float, MUTATOR_ARGV_1_float) \
+    /** player */       i(entity, MUTATOR_ARGV_2_entity) \
     /**/
-int score_field;
 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
 
 #define EV_GetPlayerStatus(i, o) \
@@ -806,13 +798,11 @@ int wp_flag;
 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
 
 #define EV_TurretValidateTarget(i, o) \
-    /**/ i(entity, turret_this) \
-    /**/ i(entity, turret_target) \
-    /**/ i(int, turret_vflags) \
+    /** turret */          i(entity, MUTATOR_ARGV_0_entity) \
+    /** target */          i(entity, MUTATOR_ARGV_1_entity) \
+    /** validate flags */  i(int, MUTATOR_ARGV_2_int) \
+    /** target score */    o(float, MUTATOR_ARGV_3_float) \
     /**/
-entity turret_this;
-entity turret_target;
-int turret_vflags;
 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
 
 #define EV_TurretThink(i, o) \
index c8519a76e1f6dcfbbee4bc2f68336fff7aeb675a..ca1779486c973097e9de6d2e676fd4e20f22a579 100644 (file)
@@ -647,6 +647,8 @@ MUTATOR_HOOKFUNCTION(as, HavocBot_ChooseRole)
 
 MUTATOR_HOOKFUNCTION(as, PlayHitsound)
 {
+       entity frag_victim = M_ARGV(0, entity);
+
        return (frag_victim.classname == "func_assault_destructible");
 }
 
@@ -659,7 +661,7 @@ MUTATOR_HOOKFUNCTION(as, GetTeamCount)
 
 MUTATOR_HOOKFUNCTION(as, CheckRules_World)
 {
-       ret_float = WinningCondition_Assault();
+       M_ARGV(0, float) = WinningCondition_Assault();
        return true;
 }
 
index 32c69096cae5d1ba761cee743f58d6cdab11ac9e..ff011b59deac11355d160bb3f10f6260c6f28ab3 100644 (file)
@@ -35,7 +35,6 @@ REGISTER_MUTATOR(ca, false)
                ca_teams = autocvar_g_ca_teams_override;
                if (ca_teams < 2) ca_teams = autocvar_g_ca_teams;
                ca_teams = bound(2, ca_teams, 4);
-               ret_float = ca_teams;
 
         ScoreRules_basics(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, true);
         ScoreInfo_SetLabel_TeamScore(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
@@ -276,8 +275,7 @@ MUTATOR_HOOKFUNCTION(ca, reset_map_global)
 
 MUTATOR_HOOKFUNCTION(ca, GetTeamCount, CBC_ORDER_EXCLUSIVE)
 {
-       ret_float = ca_teams;
-       return false;
+       M_ARGV(0, float) = ca_teams;
 }
 
 entity ca_LastPlayerForTeam()
@@ -320,10 +318,11 @@ MUTATOR_HOOKFUNCTION(ca, PlayerDies)
 
 MUTATOR_HOOKFUNCTION(ca, ClientDisconnect)
 {
-    SELFPARAM();
-       if (this.caplayer == 1)
+    entity player = M_ARGV(0, entity);
+
+       if (player.caplayer == 1)
                ca_LastPlayerForTeam_Notify();
-       return 1;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(ca, ForbidPlayerScore_Clear)
@@ -333,13 +332,14 @@ MUTATOR_HOOKFUNCTION(ca, ForbidPlayerScore_Clear)
 
 MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
 {
-    SELFPARAM();
-       if (!IS_DEAD(this))
+    entity player = M_ARGV(0, entity);
+
+       if (!IS_DEAD(player))
                ca_LastPlayerForTeam_Notify();
-       if (this.killindicator_teamchange == -2)
-               this.caplayer = 0;
-       if (this.caplayer)
-               this.frags = FRAGS_LMS_LOSER;
+       if (player.killindicator_teamchange == -2)
+               player.caplayer = 0;
+       if (player.caplayer)
+               player.frags = FRAGS_LMS_LOSER;
        if (!warmup_stage)
                eliminatedPlayers.SendFlags |= 1;
        return true;  // prevent team reset
@@ -497,8 +497,7 @@ MUTATOR_HOOKFUNCTION(ca, ClientCommand_Spectate)
 
 MUTATOR_HOOKFUNCTION(ca, WantWeapon)
 {
-       want_allguns = true;
-       return false;
+       M_ARGV(2, bool) = true; // all weapons
 }
 
 MUTATOR_HOOKFUNCTION(ca, GetPlayerStatus)
index 1d8ad402f27bdcabc44f286fd88b0b660657bea7..ab664794ad9b51ad55cca63cec0e56a11b904a82 100644 (file)
@@ -471,7 +471,7 @@ void ctf_Handle_Throw(entity player, entity receiver, int droptype)
                        makevectors((player.v_angle.y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle.x, autocvar_g_ctf_throw_angle_max) * '1 0 0'));
 
                        flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & ITEM_Strength.m_itemid) ? autocvar_g_ctf_throw_strengthmultiplier : 1)));
-                       flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, false);
+                       flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, flag_velocity, false);
                        ctf_Handle_Drop(flag, player, droptype);
                        break;
                }
@@ -485,7 +485,7 @@ void ctf_Handle_Throw(entity player, entity receiver, int droptype)
                default:
                case DROP_NORMAL:
                {
-                       flag.velocity = W_CalculateProjectileVelocity(player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), false);
+                       flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), false);
                        ctf_Handle_Drop(flag, player, droptype);
                        break;
                }
@@ -2104,15 +2104,18 @@ void ctf_RemovePlayer(entity player)
 }
 
 MUTATOR_HOOKFUNCTION(ctf, MakePlayerObserver)
-{SELFPARAM();
-       ctf_RemovePlayer(self);
+{
+       entity player = M_ARGV(0, entity);
+
+       ctf_RemovePlayer(player);
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf, ClientDisconnect)
-{SELFPARAM();
-       ctf_RemovePlayer(self);
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       ctf_RemovePlayer(player);
 }
 
 MUTATOR_HOOKFUNCTION(ctf, PortalTeleport)
@@ -2325,15 +2328,17 @@ MUTATOR_HOOKFUNCTION(ctf, HavocBot_ChooseRole)
 
 MUTATOR_HOOKFUNCTION(ctf, GetTeamCount)
 {
-       //ret_float = ctf_teams;
-       ret_string = "ctf_team";
+       //M_ARGV(0, float) = ctf_teams;
+       M_ARGV(1, string) = "ctf_team";
        return true;
 }
 
 MUTATOR_HOOKFUNCTION(ctf, SpectateCopy)
-{SELFPARAM();
-       self.ctf_flagstatus = other.ctf_flagstatus;
-       return false;
+{
+       entity spectatee = M_ARGV(0, entity);
+       entity client = M_ARGV(1, entity);
+
+       client.ctf_flagstatus = spectatee.ctf_flagstatus;
 }
 
 MUTATOR_HOOKFUNCTION(ctf, GetRecords)
index 65376b78d8bf896951768ce28af26a12dae063af..cbe6544c4c994773f6a0d18bfb7ba305fd77cce3 100644 (file)
@@ -240,14 +240,16 @@ MUTATOR_HOOKFUNCTION(cts, ClientConnect)
 }
 
 MUTATOR_HOOKFUNCTION(cts, MakePlayerObserver)
-{SELFPARAM();
-       if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
-               self.frags = FRAGS_LMS_LOSER;
+{
+       entity player = M_ARGV(0, entity);
+
+       if(PlayerScore_Add(player, SP_RACE_FASTEST, 0))
+               player.frags = FRAGS_LMS_LOSER;
        else
-               self.frags = FRAGS_SPECTATOR;
+               player.frags = FRAGS_SPECTATOR;
 
-       race_PreparePlayer(this);
-       self.race_checkpoint = -1;
+       race_PreparePlayer(player);
+       player.race_checkpoint = -1;
 
        return false;
 }
@@ -403,18 +405,18 @@ MUTATOR_HOOKFUNCTION(cts, GetRecords)
 void ClientKill_Now();
 MUTATOR_HOOKFUNCTION(cts, ClientKill)
 {
-    SELFPARAM();
-       ret_float = 0;
+    entity player = M_ARGV(0, entity);
 
-       if(self.killindicator && self.killindicator.health == 1) // self.killindicator.health == 1 means that the kill indicator was spawned by CTS_ClientKill
+       M_ARGV(1, float) = 0; // kill delay
+
+       if(player.killindicator && player.killindicator.health == 1) // player.killindicator.health == 1 means that the kill indicator was spawned by CTS_ClientKill
        {
-               remove(self.killindicator);
-               self.killindicator = world;
+               remove(player.killindicator);
+               player.killindicator = world;
 
-               ClientKill_Now(); // allow instant kill in this case
+               WITHSELF(player, ClientKill_Now()); // allow instant kill in this case
                return;
        }
-
 }
 
 MUTATOR_HOOKFUNCTION(cts, Race_FinalCheckpoint)
@@ -427,14 +429,15 @@ MUTATOR_HOOKFUNCTION(cts, Race_FinalCheckpoint)
 
 MUTATOR_HOOKFUNCTION(cts, FixClientCvars)
 {
-       stuffcmd(fix_client, "cl_cmd settemp cl_movecliptokeyboard 2\n");
-       return false;
+       entity player = M_ARGV(0, entity);
+
+       stuffcmd(player, "cl_cmd settemp cl_movecliptokeyboard 2\n");
 }
 
 MUTATOR_HOOKFUNCTION(cts, WantWeapon)
 {
-       ret_float = (want_weaponinfo == WEP_SHOTGUN);
-       want_mutatorblocked = true;
+       M_ARGV(1, float) = (M_ARGV(0, entity) == WEP_SHOTGUN); // want weapon = weapon info
+       M_ARGV(3, bool) = true; // want mutator blocked
        return true;
 }
 
index abee018bee1883f8d6efcd780fda951dd4f29a2c..ea70cb61a79e9f805a88766cf038d6578a3f5060 100644 (file)
@@ -468,8 +468,8 @@ void havocbot_role_dom(entity this)
 MUTATOR_HOOKFUNCTION(dom, GetTeamCount)
 {
        // fallback?
-       ret_float = domination_teams;
-       ret_string = "dom_team";
+       M_ARGV(0, float) = domination_teams;
+       string ret_string = "dom_team";
 
        entity head = find(world, classname, ret_string);
        while(head)
@@ -488,7 +488,7 @@ MUTATOR_HOOKFUNCTION(dom, GetTeamCount)
                head = find(head, classname, ret_string);
        }
 
-       ret_string = string_null;
+       M_ARGV(1, string) = string_null;
 
        return true;
 }
index 86b8d133612cf8abf7e2806139a61482e50f3d89..c10ba0b78024c360e97b95cd5e6df12a16e2605e 100644 (file)
@@ -352,24 +352,28 @@ void havocbot_role_ft_freeing(entity this)
 // Hook Functions
 // ==============
 
-void ft_RemovePlayer()
-{SELFPARAM();
-       self.health = 0; // neccessary to update correctly alive stats
-       if(!STAT(FROZEN, self))
+void ft_RemovePlayer(entity this)
+{
+       this.health = 0; // neccessary to update correctly alive stats
+       if(!STAT(FROZEN, this))
                freezetag_LastPlayerForTeam_Notify();
-       freezetag_Unfreeze(world);
+       WITHSELF(this, freezetag_Unfreeze(world));
        freezetag_count_alive_players();
 }
 
 MUTATOR_HOOKFUNCTION(ft, ClientDisconnect)
 {
-       ft_RemovePlayer();
-       return 1;
+       entity player = M_ARGV(0, entity);
+
+       ft_RemovePlayer(player);
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(ft, MakePlayerObserver)
 {
-       ft_RemovePlayer();
+       entity player = M_ARGV(0, entity);
+
+       ft_RemovePlayer(player);
        return false;
 }
 
@@ -596,8 +600,7 @@ MUTATOR_HOOKFUNCTION(ft, HavocBot_ChooseRole)
 
 MUTATOR_HOOKFUNCTION(ft, GetTeamCount, CBC_ORDER_EXCLUSIVE)
 {
-       ret_float = freezetag_teams;
-       return false;
+       M_ARGV(0, float) = freezetag_teams;
 }
 
 MUTATOR_HOOKFUNCTION(ft, SetWeaponArena)
index ea2ed6e1d1a458e6838660ea92898338e985ea93..cfd4f96123ae3daff59745fb2a0e9ed0d258e3b0 100644 (file)
@@ -481,8 +481,7 @@ MUTATOR_HOOKFUNCTION(inv, AllowMobSpawning)
 
 MUTATOR_HOOKFUNCTION(inv, GetTeamCount, CBC_ORDER_EXCLUSIVE)
 {
-       ret_float = invasion_teams;
-       return false;
+       M_ARGV(0, float) = invasion_teams;
 }
 
 MUTATOR_HOOKFUNCTION(inv, AllowMobButcher)
index 0da0e30251d97e396ee3b1b7ad22487f6723701c..d13e6220026852395176dc761e65ab462f9029d5 100644 (file)
@@ -408,14 +408,17 @@ MUTATOR_HOOKFUNCTION(ka, PlayerDamage_Calculate) // for changing damage and forc
 }
 
 MUTATOR_HOOKFUNCTION(ka, ClientDisconnect)
-{SELFPARAM();
-       if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.ballcarried) { ka_DropEvent(player); } // a player with the ball has left the match, drop it
 }
 
 MUTATOR_HOOKFUNCTION(ka, MakePlayerObserver)
-{SELFPARAM();
-       if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.ballcarried) { ka_DropEvent(player); } // a player with the ball has left the match, drop it
        return false;
 }
 
index ef23a91090aaee1ad0c05fd32510cd46be1a6ba7..2fb8632f8f59ccf8dab05932cbdbce7ffa87abcc 100644 (file)
@@ -878,7 +878,7 @@ void kh_Key_DropOne(entity key)
 
        kh_Key_AssignTo(key, world);
        makevectors(player.v_angle);
-       key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, false);
+       key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, false);
        key.pusher = world;
        key.pushltime = time + autocvar_g_balance_keyhunt_protecttime;
        key.kh_dropperteam = key.team;
@@ -903,7 +903,7 @@ void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies
                        Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT(key, INFO_KEYHUNT_LOST), player.netname);
                        kh_Key_AssignTo(key, world);
                        makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
-                       key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);
+                       key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);
                        key.pusher = mypusher;
                        key.pushltime = time + autocvar_g_balance_keyhunt_protecttime;
                        if(suicide)
@@ -1290,15 +1290,17 @@ void havocbot_role_kh_freelancer(entity this)
 // register this as a mutator
 
 MUTATOR_HOOKFUNCTION(kh, ClientDisconnect)
-{SELFPARAM();
-       kh_Key_DropAll(self, true);
-       return 0;
+{
+       entity player = M_ARGV(0, entity);
+
+       kh_Key_DropAll(player, true);
 }
 
 MUTATOR_HOOKFUNCTION(kh, MakePlayerObserver)
-{SELFPARAM();
-       kh_Key_DropAll(self, true);
-       return 0;
+{
+       entity player = M_ARGV(0, entity);
+
+       kh_Key_DropAll(player, true);
 }
 
 MUTATOR_HOOKFUNCTION(kh, PlayerDies)
@@ -1332,14 +1334,15 @@ MUTATOR_HOOKFUNCTION(kh, MatchEnd)
 
 MUTATOR_HOOKFUNCTION(kh, GetTeamCount, CBC_ORDER_EXCLUSIVE)
 {
-       ret_float = kh_teams;
-       return false;
+       M_ARGV(0, float) = kh_teams;
 }
 
 MUTATOR_HOOKFUNCTION(kh, SpectateCopy)
-{SELFPARAM();
-       self.kh_state = other.kh_state;
-       return 0;
+{
+       entity spectatee = M_ARGV(0, entity);
+       entity client = M_ARGV(1, entity);
+
+       client.kh_state = spectatee.kh_state;
 }
 
 MUTATOR_HOOKFUNCTION(kh, PlayerUseKey)
index 8670bbbef8c9bc36ba45c8c0a3c5a0bedf882026..8ff6c190a0bdbfdacedc2756938947e8ee41269e 100644 (file)
@@ -204,15 +204,17 @@ void lms_RemovePlayer(entity player)
 }
 
 MUTATOR_HOOKFUNCTION(lms, ClientDisconnect)
-{SELFPARAM();
-       lms_RemovePlayer(self);
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       lms_RemovePlayer(player);
 }
 
 MUTATOR_HOOKFUNCTION(lms, MakePlayerObserver)
 {
-    SELFPARAM();
-       lms_RemovePlayer(this);
+    entity player = M_ARGV(0, entity);
+
+       lms_RemovePlayer(player);
        return true;  // prevent team reset
 }
 
@@ -371,14 +373,13 @@ MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate)
 
 MUTATOR_HOOKFUNCTION(lms, CheckRules_World)
 {
-       ret_float = WinningCondition_LMS();
+       M_ARGV(0, float) = WinningCondition_LMS();
        return true;
 }
 
 MUTATOR_HOOKFUNCTION(lms, WantWeapon)
 {
-       want_allguns = true;
-       return false;
+       M_ARGV(2, bool) = true; // all weapons
 }
 
 MUTATOR_HOOKFUNCTION(lms, GetPlayerStatus)
@@ -389,7 +390,7 @@ MUTATOR_HOOKFUNCTION(lms, GetPlayerStatus)
 MUTATOR_HOOKFUNCTION(lms, AddPlayerScore)
 {
        if(gameover)
-       if(score_field == SP_LMS_RANK)
+       if(M_ARGV(0, int) == SP_LMS_RANK) // score field
                return true; // allow writing to this field in intermission as it is needed for newly joining players
        return false;
 }
index c3be9b247e29ef7db104d86983ffe13fe8b80a5c..9e41ac483d16ac12a34e07765723d95572d7608d 100644 (file)
@@ -272,17 +272,17 @@ MUTATOR_HOOKFUNCTION(rc, ClientConnect)
 }
 
 MUTATOR_HOOKFUNCTION(rc, MakePlayerObserver)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(g_race_qualifying)
-       if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
-               self.frags = FRAGS_LMS_LOSER;
+       if(PlayerScore_Add(player, SP_RACE_FASTEST, 0))
+               player.frags = FRAGS_LMS_LOSER;
        else
-               self.frags = FRAGS_SPECTATOR;
-
-       race_PreparePlayer(this);
-       self.race_checkpoint = -1;
+               player.frags = FRAGS_SPECTATOR;
 
-       return false;
+       race_PreparePlayer(player);
+       player.race_checkpoint = -1;
 }
 
 MUTATOR_HOOKFUNCTION(rc, PlayerSpawn)
@@ -387,8 +387,7 @@ MUTATOR_HOOKFUNCTION(rc, ForbidPlayerScore_Clear)
 
 MUTATOR_HOOKFUNCTION(rc, GetTeamCount, CBC_ORDER_EXCLUSIVE)
 {
-       ret_float = race_teams;
-       return false;
+       M_ARGV(0, float) = race_teams;
 }
 
 MUTATOR_HOOKFUNCTION(rc, Scores_CountFragsRemaining)
@@ -421,22 +420,26 @@ MUTATOR_HOOKFUNCTION(rc, GetRecords)
 
 MUTATOR_HOOKFUNCTION(rc, FixClientCvars)
 {
-       stuffcmd(fix_client, "cl_cmd settemp cl_movecliptokeyboard 2\n");
-       return false;
+       entity player = M_ARGV(0, entity);
+
+       stuffcmd(player, "cl_cmd settemp cl_movecliptokeyboard 2\n");
 }
 
 MUTATOR_HOOKFUNCTION(rc, CheckRules_World)
 {
+       float checkrules_timelimit = M_ARGV(1, float);
+       float checkrules_fraglimit = M_ARGV(2, float);
+
        if(checkrules_timelimit >= 0)
        {
                if(!g_race_qualifying)
                {
-                       ret_float = WinningCondition_Race(checkrules_fraglimit);
+                       M_ARGV(0, float) = WinningCondition_Race(checkrules_fraglimit);
                        return true;
                }
                else if(g_race_qualifying == 2)
                {
-                       ret_float = WinningCondition_QualifyingThenRace(checkrules_fraglimit);
+                       M_ARGV(0, float) = WinningCondition_QualifyingThenRace(checkrules_fraglimit);
                        return true;
                }
        }
index d391f11b23c6232d72ac6640e5d144167bd31cc8..2eeaafa3063e908ecef2ed8772196531b00f230f 100644 (file)
@@ -87,7 +87,7 @@ void tdm_DelayedInit(entity this)
 
 MUTATOR_HOOKFUNCTION(tdm, GetTeamCount, CBC_ORDER_EXCLUSIVE)
 {
-       ret_string = "tdm_team";
+       M_ARGV(1, string) = "tdm_team";
        return true;
 }
 
index efefcd17aaa26cf16897100a0123270dba7eba42..e7a3aa9ab5786c2187cb9753a08ff630d401dcdc 100644 (file)
@@ -333,8 +333,8 @@ void PlayerScore_Detach(entity player)
 
 float PlayerScore_Add(entity player, float scorefield, float score)
 {
-       bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score);
-       score = ret_float;
+       bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player);
+       score = M_ARGV(1, float);
 
        if(gameover)
        if(!mutator_returnvalue)
index 7d31de0aeab695c2834d06c6bac51638cd9cdd06..db724692bc46fedac8c25c581ab8930e293cfe4a 100644 (file)
@@ -214,8 +214,8 @@ void CheckAllowedTeams (entity for_whom)
        string teament_name = string_null;
 
        bool mutator_returnvalue = MUTATOR_CALLHOOK(GetTeamCount, dm, teament_name);
-       teament_name = ret_string;
-       dm = ret_float;
+       dm = M_ARGV(0, float);
+       teament_name = M_ARGV(1, string);
 
        if(!mutator_returnvalue)
        {
index 81fa73d49391e99b2f35d902dca09b2eac08e069..7bd69c9d46c50d03aa239fe5c4a66449ee0c9559 100644 (file)
@@ -146,13 +146,13 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
        //if(w_shotdir != prevdir) { printf("SERVER: shotDIR differs: %s - %s\n", vtos(w_shotdir), vtos(prevdir)); }
 }
 
-vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute)
+vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
 {
        vector mdirection;
        float mspeed;
        vector outvelocity;
 
-       mvelocity = mvelocity * W_WeaponSpeedFactor();
+       mvelocity = mvelocity * W_WeaponSpeedFactor(actor);
 
        mdirection = normalize(mvelocity);
        mspeed = vlen(mvelocity);
@@ -189,7 +189,7 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p
        LOG_INFO("avg: ", ftos(mspercallcount / mspercallsum), " per sec\n");
        #endif
 
-       proj.velocity = W_CalculateProjectileVelocity(proj.owner.velocity, pSpeed * dir, forceAbsolute);
+       proj.velocity = W_CalculateProjectileVelocity(proj.owner, proj.owner.velocity, pSpeed * dir, forceAbsolute);
 }
 
 
index decdc39d95a1e5637555147683eed05e5e9e46dd..52e5bd840e21e9adf9eb57a4e8cf3c9366000ab3 100644 (file)
@@ -15,7 +15,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
 #define W_SetupShot(ent,antilag,recoil,snd,chan,maxdamage) W_SetupShot_ProjectileSize(ent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
 #define W_SetupShot_Range(ent,antilag,recoil,snd,chan,maxdamage,range) W_SetupShot_Dir_ProjectileSize_Range(ent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range)
 
-vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute);
+vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute);
 
 #if 0
 float mspercallsum;
index d6b1550480acbef6b2e4cfefd4bf51bb141d9838..12b2e7daa60b980704fe4ae9f3e41a2a21a29717 100644 (file)
 
 .float weapon_frametime;
 
-float W_WeaponRateFactor()
+float W_WeaponRateFactor(entity this)
 {
        float t = 1.0 / g_weaponratefactor;
 
-       MUTATOR_CALLHOOK(WeaponRateFactor, t);
-       t = weapon_rate;
+       MUTATOR_CALLHOOK(WeaponRateFactor, t, this);
+       t = M_ARGV(0, float);
 
        return t;
 }
 
-float W_WeaponSpeedFactor()
+float W_WeaponSpeedFactor(entity this)
 {
        float t = 1.0 * g_weaponspeedfactor;
 
-       MUTATOR_CALLHOOK(WeaponSpeedFactor, t);
-       t = ret_float;
+       MUTATOR_CALLHOOK(WeaponSpeedFactor, t, this);
+       t = M_ARGV(0, float);
 
        return t;
 }
@@ -299,7 +299,7 @@ void weapon_prepareattack_do(entity actor, .entity weaponentity, bool secondary,
                        ATTACK_FINISHED(actor, slot) = time;
                        // dprint("resetting attack finished to ", ftos(time), "\n");
                }
-               ATTACK_FINISHED(actor, slot) = ATTACK_FINISHED(actor, slot) + attacktime * W_WeaponRateFactor();
+               ATTACK_FINISHED(actor, slot) = ATTACK_FINISHED(actor, slot) + attacktime * W_WeaponRateFactor(actor);
        }
        actor.bulletcounter += 1;
        // dprint("attack finished ", ftos(ATTACK_FINISHED(actor, slot)), "\n");
@@ -357,7 +357,7 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(
        if (this.weapon_think == w_ready && func != w_ready && this.state == WS_RAISE) backtrace(
                        "Tried to override initial weapon think function - should this really happen?");
 
-       t *= W_WeaponRateFactor();
+       t *= W_WeaponRateFactor(actor);
 
        // VorteX: haste can be added here
        if (this.weapon_think == w_ready)
index a43a40c2f95d0567d73d932f647b0315abcfe877..2aeca53811ecce7b1dae7595aea7b77b4713921a 100644 (file)
@@ -20,9 +20,9 @@ void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound);
 
 void W_WeaponFrame(Player actor);
 
-float W_WeaponRateFactor();
+float W_WeaponRateFactor(entity this);
 
-float W_WeaponSpeedFactor();
+float W_WeaponSpeedFactor(entity this);
 
 bool weapon_prepareattack(Weapon thiswep, entity actor, .entity weaponentity, bool secondary, float attacktime);