]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
Cleanse the physics hooks
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / nexball / nexball.qc
index 57539be68fe834f80c528f61d6083bb6077996bd..e624428ec2a319135fa35cf6849b8bd87b57914f 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,20 +922,24 @@ 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)
 {
+       entity frag_target = M_ARGV(2, entity);
+
        nb_DropBall(frag_target);
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nb, MakePlayerObserver)
-{SELFPARAM();
-       nb_DropBall(self);
+{
+       entity player = M_ARGV(0, entity);
+
+       nb_DropBall(player);
        return false;
 }
 
@@ -1008,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)
@@ -1032,29 +1038,36 @@ MUTATOR_HOOKFUNCTION(nb, PlayerSpawn)
 .float stat_sv_maxspeed;
 
 MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
-{SELFPARAM();
-       if(self.ballcarried)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.ballcarried)
        {
-               self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
-               self.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
+               player.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
+               player.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
        }
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
-{SELFPARAM();
-       return PS(self).m_weapon == WEP_NEXBALL;
+{
+       entity player = M_ARGV(0, entity);
+
+       return PS(player).m_weapon == WEP_NEXBALL;
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
-{SELFPARAM();
-       return PS(self).m_weapon == WEP_MORTAR; // TODO: what is this for?
+{
+       entity player = M_ARGV(0, entity);
+
+       return PS(player).m_weapon == WEP_MORTAR; // TODO: what is this for?
 }
 
 MUTATOR_HOOKFUNCTION(nb, FilterItem)
-{SELFPARAM();
-       if(self.classname == "droppedweapon")
-       if(self.weapon == WEP_NEXBALL.m_id)
+{
+       entity item = M_ARGV(0, entity);
+
+       if(item.classname == "droppedweapon")
+       if(item.weapon == WEP_NEXBALL.m_id)
                return true;
 
        return false;
@@ -1062,18 +1075,20 @@ 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;
 }
 
 MUTATOR_HOOKFUNCTION(nb, DropSpecialItems)
 {
+       entity frag_target = M_ARGV(0, entity);
+
        if(frag_target.ballcarried)
                DropBall(frag_target.ballcarried, frag_target.origin, frag_target.velocity);
 
@@ -1082,8 +1097,7 @@ MUTATOR_HOOKFUNCTION(nb, DropSpecialItems)
 
 MUTATOR_HOOKFUNCTION(nb, SendWaypoint)
 {
-       wp_sendflags &= ~0x80;
-       return false;
+       M_ARGV(2, int) &= ~0x80;
 }
 
 REGISTER_MUTATOR(nb, g_nexball)