clean up some cvar uses
authorRudolf Polzer <divverent@alientrap.org>
Sat, 4 Dec 2010 13:38:25 +0000 (14:38 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 4 Dec 2010 13:38:25 +0000 (14:38 +0100)
qcsrc/server/cheats.qc
qcsrc/server/domination.qc
qcsrc/server/sv_main.qc

index 0104f89..1bb39df 100644 (file)
@@ -14,7 +14,7 @@ void Drag_MoveDrag(entity from, entity to) { }
 #else
 
 .float maycheat;
 #else
 
 .float maycheat;
-float sv_cheats;
+float gamestart_sv_cheats;
 
 #define CHIMPULSE_SPEEDRUN_INIT 30
 #define CHIMPULSE_GIVE_ALL 99
 
 #define CHIMPULSE_SPEEDRUN_INIT 30
 #define CHIMPULSE_GIVE_ALL 99
@@ -28,7 +28,7 @@ float sv_cheats;
 
 void CheatInit()
 {
 
 void CheatInit()
 {
-       sv_cheats = cvar("sv_cheats");
+       gamestart_sv_cheats = cvar("sv_cheats");
 }
 
 void CheatShutdown()
 }
 
 void CheatShutdown()
@@ -61,7 +61,7 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
                return 1;
        
        // sv_cheats
                return 1;
        
        // sv_cheats
-       if(sv_cheats && autocvar_sv_cheats)
+       if(gamestart_sv_cheats && autocvar_sv_cheats)
                return 1;
 
        // if we get here, player is not allowed to cheat. Log it.
                return 1;
 
        // if we get here, player is not allowed to cheat. Log it.
@@ -215,7 +215,7 @@ float CheatImpulse(float i)
                        break;
                case CHIMPULSE_TELEPORT:
                        IS_CHEAT(i, 0, 0);
                        break;
                case CHIMPULSE_TELEPORT:
                        IS_CHEAT(i, 0, 0);
-                       if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, ((sv_cheats >= 2) ? 100000 : 100), 1024, 256))
+                       if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, ((gamestart_sv_cheats >= 2) ? 100000 : 100), 1024, 256))
                        {
                                self.angles_x = -self.angles_x;
                                self.fixangle = TRUE;
                        {
                                self.angles_x = -self.angles_x;
                                self.fixangle = TRUE;
index 3e5bed8..9742da1 100644 (file)
@@ -17,9 +17,6 @@ Note: The only teams who can use dom control points are identified by spawnfunc_
 
 #define DOMPOINTFRAGS frags
 
 
 #define DOMPOINTFRAGS frags
 
-float g_domination_point_amt;
-float g_domination_point_rate;
-
 .float enemy_playerid;
 .entity sprite;
 .float captime;
 .float enemy_playerid;
 .entity sprite;
 .float captime;
@@ -67,12 +64,12 @@ void dompoint_captured ()
        //bprint("\n");
 
        float points, wait_time;
        //bprint("\n");
 
        float points, wait_time;
-       if (g_domination_point_amt)
-               points = g_domination_point_amt;
+       if (cvar("g_domination_point_amt"))
+               points = cvar("g_domination_point_amt");
        else
                points = self.frags;
        else
                points = self.frags;
-       if (g_domination_point_rate)
-               wait_time = g_domination_point_rate;
+       if (cvar("g_domination_point_rate"))
+               wait_time = cvar("g_domination_point_rate");
        else
                wait_time = self.wait;
 
        else
                wait_time = self.wait;
 
@@ -160,11 +157,8 @@ void dompointthink()
        if (gameover || self.delay > time || time < game_starttime)     // game has ended, don't keep giving points
                return;
 
        if (gameover || self.delay > time || time < game_starttime)     // game has ended, don't keep giving points
                return;
 
-       g_domination_point_rate = cvar("g_domination_point_rate");
-       g_domination_point_amt = cvar("g_domination_point_amt");
-
-       if(g_domination_point_rate)
-               self.delay = time + g_domination_point_rate;
+       if(cvar("g_domination_point_rate"))
+               self.delay = time + cvar("g_domination_point_rate");
        else
                self.delay = time + self.wait;
 
        else
                self.delay = time + self.wait;
 
@@ -172,8 +166,8 @@ void dompointthink()
        // NOTE: this defaults to 0
        if (self.goalentity.netname != "")
        {
        // NOTE: this defaults to 0
        if (self.goalentity.netname != "")
        {
-               if(g_domination_point_amt)
-                       fragamt = g_domination_point_amt;
+               if(cvar("g_domination_point_amt"))
+                       fragamt = cvar("g_domination_point_amt");
                else
                        fragamt = self.DOMPOINTFRAGS;
                TeamScore_AddToTeam(self.goalentity.team, ST_SCORE, fragamt);
                else
                        fragamt = self.DOMPOINTFRAGS;
                TeamScore_AddToTeam(self.goalentity.team, ST_SCORE, fragamt);
index a5f35aa..e5c4348 100644 (file)
@@ -197,11 +197,12 @@ void StartFrame (void)
        sv_warsowbunny_turnaccel = cvar("sv_warsowbunny_turnaccel");
        sv_warsowbunny_backtosideratio = cvar("sv_warsowbunny_backtosideratio");
        sv_airspeedlimit_nonqw = cvar("sv_airspeedlimit_nonqw");
        sv_warsowbunny_turnaccel = cvar("sv_warsowbunny_turnaccel");
        sv_warsowbunny_backtosideratio = cvar("sv_warsowbunny_backtosideratio");
        sv_airspeedlimit_nonqw = cvar("sv_airspeedlimit_nonqw");
+       sv_doublejump = cvar("sv_doublejump");
        teamplay = cvar ("teamplay");
        teamplay = cvar ("teamplay");
+
        sys_frametime = cvar("sys_ticrate") * cvar("slowmo");
        if(sys_frametime <= 0)
                sys_frametime = 1.0 / 60.0; // somewhat safe fallback
        sys_frametime = cvar("sys_ticrate") * cvar("slowmo");
        if(sys_frametime <= 0)
                sys_frametime = 1.0 / 60.0; // somewhat safe fallback
-       sv_doublejump = cvar("sv_doublejump");
 
        if (timeoutStatus == 1) // just before the timeout (when timeoutStatus will be 2)
                orig_slowmo = cvar("slowmo"); // slowmo will be restored after the timeout
 
        if (timeoutStatus == 1) // just before the timeout (when timeoutStatus will be 2)
                orig_slowmo = cvar("slowmo"); // slowmo will be restored after the timeout