Skip to content

Commit

Permalink
Code cleanup, added more robust check for loadiwd
Browse files Browse the repository at this point in the history
  • Loading branch information
Rex109 committed Mar 30, 2024
1 parent bb565de commit d2a2833
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 3 additions & 5 deletions cod4qol/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions cod4qol/commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cod4qol/game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int*>(0xCAF7554);
inline int* modIndex = reinterpret_cast<int*>(0xCAF7558);
Expand Down

0 comments on commit d2a2833

Please sign in to comment.