Removed cache of cvar sv_cheats ValveSoftware/halflife#2511

This commit is contained in:
s1lentq 2019-06-08 02:16:15 +08:00
parent caf1b47238
commit 62cb200a3b
5 changed files with 3 additions and 7 deletions

View File

@ -3298,7 +3298,7 @@ void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *pa
else if (FStrEq(pcmd, "fov")) else if (FStrEq(pcmd, "fov"))
{ {
#if 0 #if 0
if (g_flWeaponCheat && CMD_ARGC() > 1) if (CVAR_GET_FLOAT("sv_cheats") != 0.0f && CMD_ARGC() > 1)
GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->m_iFOV = Q_atoi(CMD_ARGV(1)); GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->m_iFOV = Q_atoi(CMD_ARGV(1));
else else
CLIENT_PRINTF(pEntity, print_console, UTIL_VarArgs("\"fov\" is \"%d\"\n", int(GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->m_iFOV))); CLIENT_PRINTF(pEntity, print_console, UTIL_VarArgs("\"fov\" is \"%d\"\n", int(GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->m_iFOV)));

View File

@ -3243,7 +3243,7 @@ void CHalfLifeMultiplay::InitHUD(CBasePlayer *pl)
UpdateGameMode(pl); UpdateGameMode(pl);
if (!g_flWeaponCheat) if (!CVAR_GET_FLOAT("sv_cheats"))
{ {
MESSAGE_BEGIN(MSG_ONE, gmsgViewMode, nullptr, pl->edict()); MESSAGE_BEGIN(MSG_ONE, gmsgViewMode, nullptr, pl->edict());
MESSAGE_END(); MESSAGE_END();

View File

@ -6060,7 +6060,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(ImpulseCommands)()
void CBasePlayer::CheatImpulseCommands(int iImpulse) void CBasePlayer::CheatImpulseCommands(int iImpulse)
{ {
if (!g_flWeaponCheat) if (!CVAR_GET_FLOAT("sv_cheats"))
return; return;
CBaseEntity *pEntity; CBaseEntity *pEntity;

View File

@ -2,7 +2,6 @@
edict_t *g_pBodyQueueHead; edict_t *g_pBodyQueueHead;
CGlobalState gGlobalState; CGlobalState gGlobalState;
float g_flWeaponCheat;
DLL_DECALLIST gDecals[] = DLL_DECALLIST gDecals[] =
{ {
@ -216,7 +215,6 @@ void CWorld::Spawn()
EmptyEntityHashTable(); EmptyEntityHashTable();
Precache(); Precache();
g_flWeaponCheat = CVAR_GET_FLOAT("sv_cheats");
g_szMapBriefingText[0] = '\0'; g_szMapBriefingText[0] = '\0';
Q_sprintf(szMapBriefingFile, "maps/%s.txt", STRING(gpGlobals->mapname)); Q_sprintf(szMapBriefingFile, "maps/%s.txt", STRING(gpGlobals->mapname));
@ -251,7 +249,6 @@ void CWorld::Spawn()
EmptyEntityHashTable(); EmptyEntityHashTable();
Precache(); Precache();
g_flWeaponCheat = CVAR_GET_FLOAT("sv_cheats");
g_szMapBriefingText[0] = '\0'; g_szMapBriefingText[0] = '\0';
int flength = 0; int flength = 0;

View File

@ -43,5 +43,4 @@ public:
void CopyToBodyQue(entvars_t *pev); void CopyToBodyQue(entvars_t *pev);
void ClearBodyQue(); void ClearBodyQue();
extern float g_flWeaponCheat;
extern char g_szMapBriefingText[512]; extern char g_szMapBriefingText[512];