]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 0104f89b3f2bcfe5742fc0abb5ee6582880d5642..1bb39dfe0195dc71f9eeb43966db00cbe1fe6f66 100644 (file)
@@ -14,7 +14,7 @@ void Drag_MoveDrag(entity from, entity to) { }
 #else
 
 .float maycheat;
-float sv_cheats;
+float gamestart_sv_cheats;
 
 #define CHIMPULSE_SPEEDRUN_INIT 30
 #define CHIMPULSE_GIVE_ALL 99
@@ -28,7 +28,7 @@ float sv_cheats;
 
 void CheatInit()
 {
-       sv_cheats = cvar("sv_cheats");
+       gamestart_sv_cheats = cvar("sv_cheats");
 }
 
 void CheatShutdown()
@@ -61,7 +61,7 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
                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.
@@ -215,7 +215,7 @@ float CheatImpulse(float i)
                        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;
index 3e5bed8b25f23c35247fa2cf1c50c14da053dc3c..9742da1ecdc6701fa3016fb118e16aa5a7840b19 100644 (file)
@@ -17,9 +17,6 @@ Note: The only teams who can use dom control points are identified by spawnfunc_
 
 #define DOMPOINTFRAGS frags
 
-float g_domination_point_amt;
-float g_domination_point_rate;
-
 .float enemy_playerid;
 .entity sprite;
 .float captime;
@@ -67,12 +64,12 @@ void dompoint_captured ()
        //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;
-       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;
 
@@ -160,11 +157,8 @@ void dompointthink()
        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;
 
@@ -172,8 +166,8 @@ void dompointthink()
        // 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);
index a5f35aa89ae3bc04a0e8d51d9ab5587dea084c1d..e5c4348346d121a0656fcefbfdfe2a1fc5754134 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_doublejump = cvar("sv_doublejump");
        teamplay = cvar ("teamplay");
+
        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