Skip to content

Commit

Permalink
Added iwd loading on startup, added loadiwd command
Browse files Browse the repository at this point in the history
  • Loading branch information
Rex109 committed Mar 29, 2024
1 parent c1fe679 commit 39f52ae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
18 changes: 18 additions & 0 deletions cod4qol/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ void commands::InitializeCommands()
std::cout << "Initializing commands..." << std::endl;

game::Cmd_AddCommand("loadzone", LoadZone);
game::Cmd_AddCommand("loadiwd", LoadIWD);
game::Cmd_AddCommand("vm_anim", VmAnim);
game::Cmd_AddCommand("readprotectedconfig", ReadProtectedConfig);
game::Cmd_AddCommand("writeprotectedconfig", WriteProtectedConfig);
Expand Down Expand Up @@ -103,6 +104,23 @@ void commands::LoadZone()
game::DB_LoadXAssets(info, 2, 1);
}

void commands::LoadIWD()
{
if (game::Cmd_Argc() < 2)
{
game::Com_PrintMessage(0, "Usage: loadiwd <iwdName>\n", 0);
return;
}

std::string iwdName = game::Cmd_Argv(1);

std::string relative_dir = game::fs_homepath->current.string;
relative_dir.append("\\main\\");
relative_dir.append(iwdName);

game::FS_AddSingleIwdFileForGameDirectory(relative_dir.c_str(), iwdName.c_str(), "main");
}

void commands::VmAnim()
{
if (!sv_running->current.enabled)
Expand Down
1 change: 1 addition & 0 deletions cod4qol/commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace commands
void InitializeCommands();

void LoadZone();
void LoadIWD();
void iPrintLnBold(const char* text);
void WriteProtectedConfig();
void ReadProtectedConfig();
Expand Down
8 changes: 2 additions & 6 deletions cod4qol/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ void game::LoadModFiles()
{
std::string relative_dir = game::fs_homepath->current.string;
relative_dir.append("\\main\\xcommon_cod4qol.iwd");
FS_AddSingleIwdFileForGameDirectory(relative_dir.c_str(), "xcommon_cod4qol.iwd", "main");

if (!strcmp(fs_game->current.string, "") || commands::qol_stockmenu->current.enabled)
{
FS_AddSingleIwdFileForGameDirectory(relative_dir.c_str(), "xcommon_cod4qol.iwd", "main");

game::Cbuf_AddText("loadzone qol\n", 0);
}
game::Cbuf_AddText("loadzone qol\n", 0);
}

void game::hookedDB_LoadXZoneFromGfxConfig()
Expand Down

0 comments on commit 39f52ae

Please sign in to comment.