From 311e8cc46c69cd2414db2efbf6c911915a980e88 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 4 Dec 2010 14:38:25 +0100 Subject: [PATCH] clean up some cvar uses --- qcsrc/server/cheats.qc | 8 ++++---- qcsrc/server/domination.qc | 22 ++++++++-------------- qcsrc/server/sv_main.qc | 3 ++- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 0104f89b3f..1bb39dfe01 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -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; diff --git a/qcsrc/server/domination.qc b/qcsrc/server/domination.qc index 3e5bed8b25..9742da1ecd 100644 --- a/qcsrc/server/domination.qc +++ b/qcsrc/server/domination.qc @@ -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); diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index a5f35aa89a..e5c4348346 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -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 -- 2.39.2