]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_nexball.qc
Turn #define'd constants into actual constants
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_nexball.qc
index dd8daccc2579123e20c8c8bde688baa223e2c7f9..92e707b061948c84ca2598c90bde7f42bfde3732 100644 (file)
@@ -8,9 +8,9 @@ vector autocvar_g_nexball_viewmodel_offset;
 void basketball_touch();
 void football_touch();
 void ResetBall();
-#define NBM_NONE 0
-#define NBM_FOOTBALL 2
-#define NBM_BASKETBALL 4
+const float NBM_NONE = 0;
+const float NBM_FOOTBALL = 2;
+const float NBM_BASKETBALL = 4;
 float nexball_mode;
 
 float OtherTeam(float t)  //works only if there are two teams on the map!
@@ -22,9 +22,9 @@ float OtherTeam(float t)  //works only if there are two teams on the map!
        return e.team;
 }
 
-#define ST_NEXBALL_GOALS 1
-#define SP_NEXBALL_GOALS 4
-#define SP_NEXBALL_FAULTS 5
+const float ST_NEXBALL_GOALS = 1;
+const float SP_NEXBALL_GOALS = 4;
+const float SP_NEXBALL_FAULTS = 5;
 void nb_ScoreRules(float teams)
 {
        ScoreRules_basics(teams, 0, 0, TRUE);
@@ -299,7 +299,7 @@ void basketball_touch(void)
                football_touch();
                return;
        }
-       if(!self.cnt && IS_PLAYER(other) && !other.frozen && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect))
+       if(!self.cnt && IS_PLAYER(other) && !other.frozen && !other.deadflag && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect))
        {
                if(other.health <= 0)
                        return;
@@ -695,7 +695,7 @@ void W_Nexball_Touch(void)
 
        PROJECTILE_TOUCH;
        if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
-               if((ball = other.ballcarried) && !other.deadflag && (IS_PLAYER(attacker)))
+               if((ball = other.ballcarried) && !other.frozen && !other.deadflag && (IS_PLAYER(attacker)))
                {
                        other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
                        other.flags &= ~FL_ONGROUND;
@@ -741,7 +741,7 @@ void W_Nexball_Attack(float t)
                mi = autocvar_g_nexball_basketball_meter_minpower;
                ma = max(mi, autocvar_g_nexball_basketball_meter_maxpower); // avoid confusion
                //One triangle wave period with 1 as max
-               mul = 2 * mod(t, g_nexball_meter_period) / g_nexball_meter_period;
+               mul = 2 * (t % g_nexball_meter_period) / g_nexball_meter_period;
                if(mul > 1)
                        mul = 2 - mul;
                mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
@@ -1012,8 +1012,6 @@ MUTATOR_DEFINITION(gamemode_nexball)
                g_nexball_meter_period = rint(g_nexball_meter_period * 32) / 32; //Round to 1/32ths to send as a byte multiplied by 32
                addstat(STAT_NB_METERSTART, AS_FLOAT, metertime);
 
-               W_Porto(WR_INIT); // abuse
-
                // General settings
                /*
                CVTOV(g_nexball_football_boost_forward);   //100