From 62cb200a3b4732c135b7cfbf7af13bc1962bfc4c Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 8 Jun 2019 02:16:15 +0800 Subject: [PATCH] Removed cache of cvar sv_cheats ValveSoftware/halflife#2511 --- regamedll/dlls/client.cpp | 2 +- regamedll/dlls/multiplay_gamerules.cpp | 2 +- regamedll/dlls/player.cpp | 2 +- regamedll/dlls/world.cpp | 3 --- regamedll/dlls/world.h | 1 - 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index cac77a979..a70abf03b 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -3298,7 +3298,7 @@ void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *pa else if (FStrEq(pcmd, "fov")) { #if 0 - if (g_flWeaponCheat && CMD_ARGC() > 1) + if (CVAR_GET_FLOAT("sv_cheats") != 0.0f && CMD_ARGC() > 1) GetClassPtr((CBasePlayer *)pev)->m_iFOV = Q_atoi(CMD_ARGV(1)); else CLIENT_PRINTF(pEntity, print_console, UTIL_VarArgs("\"fov\" is \"%d\"\n", int(GetClassPtr((CBasePlayer *)pev)->m_iFOV))); diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 89b7ffa0d..6e2b76ab5 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -3243,7 +3243,7 @@ void CHalfLifeMultiplay::InitHUD(CBasePlayer *pl) UpdateGameMode(pl); - if (!g_flWeaponCheat) + if (!CVAR_GET_FLOAT("sv_cheats")) { MESSAGE_BEGIN(MSG_ONE, gmsgViewMode, nullptr, pl->edict()); MESSAGE_END(); diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index fa560e9d3..cab07175b 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -6060,7 +6060,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(ImpulseCommands)() void CBasePlayer::CheatImpulseCommands(int iImpulse) { - if (!g_flWeaponCheat) + if (!CVAR_GET_FLOAT("sv_cheats")) return; CBaseEntity *pEntity; diff --git a/regamedll/dlls/world.cpp b/regamedll/dlls/world.cpp index 291aaae58..3c31e764f 100644 --- a/regamedll/dlls/world.cpp +++ b/regamedll/dlls/world.cpp @@ -2,7 +2,6 @@ edict_t *g_pBodyQueueHead; CGlobalState gGlobalState; -float g_flWeaponCheat; DLL_DECALLIST gDecals[] = { @@ -216,7 +215,6 @@ void CWorld::Spawn() EmptyEntityHashTable(); Precache(); - g_flWeaponCheat = CVAR_GET_FLOAT("sv_cheats"); g_szMapBriefingText[0] = '\0'; Q_sprintf(szMapBriefingFile, "maps/%s.txt", STRING(gpGlobals->mapname)); @@ -251,7 +249,6 @@ void CWorld::Spawn() EmptyEntityHashTable(); Precache(); - g_flWeaponCheat = CVAR_GET_FLOAT("sv_cheats"); g_szMapBriefingText[0] = '\0'; int flength = 0; diff --git a/regamedll/dlls/world.h b/regamedll/dlls/world.h index 31a8bcb78..766495ef5 100644 --- a/regamedll/dlls/world.h +++ b/regamedll/dlls/world.h @@ -43,5 +43,4 @@ class CWorld: public CBaseEntity { void CopyToBodyQue(entvars_t *pev); void ClearBodyQue(); -extern float g_flWeaponCheat; extern char g_szMapBriefingText[512];