From d2a2833a89a0643d480a3d6d2bc79972b3db655f Mon Sep 17 00:00:00 2001 From: Rex109 Date: Sat, 30 Mar 2024 21:14:38 +0100 Subject: [PATCH] Code cleanup, added more robust check for loadiwd --- cod4qol/commands.cpp | 8 +++----- cod4qol/commands.hpp | 2 -- cod4qol/game.hpp | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cod4qol/commands.cpp b/cod4qol/commands.cpp index 9f9eb9b..8af6264 100644 --- a/cod4qol/commands.cpp +++ b/cod4qol/commands.cpp @@ -60,8 +60,6 @@ void commands::InitializeCommands() cg_drawgun = game::Find("cg_drawgun"); cg_drawgun->flags = game::none; - sv_running = game::Find("sv_running"); - qol_check_updates = game::Cvar_RegisterBool("qol_check_updates", 1, game::dvar_flags::saved, "Enable cod4qol to check for updates at every startup."); qol_forceiwdextract = game::Cvar_RegisterBool("qol_forceiwdextract", 0, game::dvar_flags::saved, "Force the extraction of the iwd files at the next startup."); @@ -110,9 +108,9 @@ void commands::LoadZone() void commands::LoadIWD() { - if (!sv_running->current.enabled) + if (!game::sv_cheats->current.enabled) { - game::Com_PrintMessage(0, "You must be playing on a local server to use loadiwd\n", 0); + game::Com_PrintMessage(0, "You must be playing with cheats enabled to use loadiwd\n", 0); return; } @@ -133,7 +131,7 @@ void commands::LoadIWD() void commands::VmAnim() { - if (!sv_running->current.enabled) + if (!game::sv_cheats->current.enabled) { game::Com_PrintMessage(0, "You must be playing on a local server to use vm_anim\n", 0); return; diff --git a/cod4qol/commands.hpp b/cod4qol/commands.hpp index e0bc8cd..8223975 100644 --- a/cod4qol/commands.hpp +++ b/cod4qol/commands.hpp @@ -5,8 +5,6 @@ namespace commands { - inline game::dvar_s* sv_running; - inline game::dvar_s* cg_fovscale; inline game::dvar_s* r_fullbright; inline game::dvar_s* r_zfar; diff --git a/cod4qol/game.hpp b/cod4qol/game.hpp index b4fdf33..49afa43 100644 --- a/cod4qol/game.hpp +++ b/cod4qol/game.hpp @@ -560,7 +560,7 @@ namespace game inline game::dvar_s* fs_game = game::Find("fs_game"); inline game::dvar_s* fs_homepath = game::Find("fs_homepath"); - inline game::dvar_s* sv_pure = game::Find("sv_pure"); + inline game::dvar_s* sv_cheats = game::Find("sv_cheats"); inline int* modCount = reinterpret_cast(0xCAF7554); inline int* modIndex = reinterpret_cast(0xCAF7558);