]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
Fix up more mutator hooks
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / nexball / nexball.qc
index 426cab70e151aea46122fac85d0896113cf1319e..a7528d5a1945588d8a1d2eb7873a44f40aecf92c 100644 (file)
@@ -609,8 +609,8 @@ spawnfunc(nexball_football)
        SpawnBall(this);
 }
 
-float nb_Goal_Customize()
-{SELFPARAM();
+float nb_Goal_Customize(entity this)
+{
        entity e, wp_owner;
        e = WaypointSprite_getviewentity(other);
        wp_owner = self.owner;
@@ -629,7 +629,7 @@ void SpawnGoal(entity this)
        {
                entity wp = WaypointSprite_SpawnFixed(WP_NbGoal, (this.absmin + this.absmax) * 0.5, this, sprite, RADARICON_NONE);
                wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 0.5 0');
-               this.sprite.customizeentityforclient = nb_Goal_Customize;
+               setcefc(this.sprite, nb_Goal_Customize);
        }
 
        this.classname = "nexball_goal";
@@ -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 ??
@@ -838,13 +838,13 @@ void W_Nexball_Attack2(entity actor)
        CSQCProjectile(missile, true, PROJECTILE_ELECTRO, true);
 }
 
-float ball_customize()
-{SELFPARAM();
+float ball_customize(entity this)
+{
        if(!self.owner)
        {
                self.effects &= ~EF_FLAME;
                self.scale = 1;
-               self.customizeentityforclient = func_null;
+               setcefc(self, func_null);
                return true;
        }
 
@@ -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;
 }
 
@@ -948,7 +952,7 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink)
                {
                        // 'view ball'
                        self.ballcarried.velocity = self.velocity;
-                       self.ballcarried.customizeentityforclient = ball_customize;
+                       setcefc(self.ballcarried, ball_customize);
 
                        vector org = self.origin + self.view_ofs +
                                          v_forward * autocvar_g_nexball_viewmodel_offset.x +
@@ -1008,21 +1012,24 @@ 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)
 {
-       SELFPARAM();
-       this.metertime = 0;
+       entity player = M_ARGV(0, entity);
+
+       player.metertime = 0;
        .entity weaponentity = weaponentities[0];
-       this.(weaponentity).weapons = '0 0 0';
+       player.(weaponentity).weapons = '0 0 0';
 
        if (nexball_mode & NBM_BASKETBALL)
-               this.weapons |= WEPSET(NEXBALL);
+               player.weapons |= WEPSET(NEXBALL);
        else
-               this.weapons = '0 0 0';
+               player.weapons = '0 0 0';
 
        return false;
 }
@@ -1041,19 +1048,25 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
-{SELFPARAM();
-       return PS(self).m_weapon == WEP_NEXBALL;
+{
+       entity player = M_ARGV(0, entity);
+
+       return PS(player).m_weapon == WEP_NEXBALL;
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
-{SELFPARAM();
-       return PS(self).m_weapon == WEP_MORTAR; // TODO: what is this for?
+{
+       entity player = M_ARGV(0, entity);
+
+       return PS(player).m_weapon == WEP_MORTAR; // TODO: what is this for?
 }
 
 MUTATOR_HOOKFUNCTION(nb, FilterItem)
-{SELFPARAM();
-       if(self.classname == "droppedweapon")
-       if(self.weapon == WEP_NEXBALL.m_id)
+{
+       entity item = M_ARGV(0, entity);
+
+       if(item.classname == "droppedweapon")
+       if(item.weapon == WEP_NEXBALL.m_id)
                return true;
 
        return false;
@@ -1061,18 +1074,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);