Skip to content

Commit

Permalink
Added basic version info on menu, modified .bat for mod, added iwd lo…
Browse files Browse the repository at this point in the history
…ading function pointer
  • Loading branch information
Rex109 committed Mar 29, 2024
1 parent 56d5cb4 commit c1fe679
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 3 deletions.
17 changes: 15 additions & 2 deletions cod4qol/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,27 @@ __declspec(naked) const char* game::hookedCon_LinePrefix()
}
}

void game::LoadModFiles()
{
std::string relative_dir = game::fs_homepath->current.string;
relative_dir.append("\\main\\xcommon_cod4qol.iwd");

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);
}
}

void game::hookedDB_LoadXZoneFromGfxConfig()
{
std::cout << "Calling DB_LoadXZoneFromGfxConfig();" << std::endl;

game::Sys_CreateConsole(0x0);

if (!strcmp(fs_game->current.string, "") || commands::qol_stockmenu->current.enabled)
game::Cbuf_AddText("loadzone qol\n", 0);
LoadModFiles();

commands::InitializeCommands();

Expand All @@ -48,7 +61,7 @@ void game::hookedCom_LoadUiFastFile()
std::cout << "Calling Com_LoadUiFastFile();" << std::endl;

if (!strcmp(fs_game->current.string, "") || commands::qol_stockmenu->current.enabled)
game::Cbuf_AddText("loadzone qol\n", 0);
LoadModFiles();

return game::pCom_LoadUiFastFile();
}
Expand Down
6 changes: 6 additions & 0 deletions cod4qol/game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ namespace game

int Cmd_Argc();
const char* Cmd_Argv(int arg);
void LoadModFiles();

dvar_s* Find(const char*);
cmd_function_s* Cmd_AddCommand(const char* cmdname, void(__cdecl* function)());
Expand Down Expand Up @@ -535,6 +536,9 @@ namespace game
typedef game::dvar_s*(*Cvar_RegisterString_t)(const char* name, const char* string, game::dvar_flags flags, const char* description);
extern Cvar_RegisterString_t Cvar_RegisterString;

typedef bool(*FS_AddSingleIwdFileForGameDirectory_t)(const char* pakfile, const char* basename, const char* gamename);
extern FS_AddSingleIwdFileForGameDirectory_t FS_AddSingleIwdFileForGameDirectory;

inline void* Cmd_AddCommand_fnc = (void*)(cod4x_entry + 0x2116C);
inline game::CmdArgs* cmd_args = reinterpret_cast<game::CmdArgs*>(0x1410B40);
inline game::gclient_s* g_clients = reinterpret_cast<game::gclient_s*>(0x13255A8);
Expand All @@ -548,6 +552,8 @@ namespace game
inline game::Cvar_RegisterEnum_t Cvar_RegisterEnum = Cvar_RegisterEnum_t(cod4x_entry + 0x2DCAF);
inline game::Cvar_RegisterString_t Cvar_RegisterString = Cvar_RegisterString_t(cod4x_entry + 0x2D87D);

inline game::FS_AddSingleIwdFileForGameDirectory_t FS_AddSingleIwdFileForGameDirectory = FS_AddSingleIwdFileForGameDirectory_t(cod4x_entry + 0x3867C);

inline game::dvar_s* fs_game = game::Find("fs_game");
inline game::dvar_s* fs_homepath = game::Find("fs_homepath");

Expand Down
Binary file added mod/cod4qol/images/discord_icon.iwi
Binary file not shown.
10 changes: 9 additions & 1 deletion mod/cod4qol/makeMod.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
del mod.ff
del xcommon_cod4qol.iwd

xcopy ui ..\..\raw\ui /SY
xcopy ui_mp ..\..\raw\ui_mp /SY
xcopy images ..\..\raw\images /SY
xcopy materials ..\..\raw\materials /SY
xcopy material_proprieties ..\..\raw\material_proprieties /SY
copy /Y mod.csv ..\..\zone_source

cd ..\..\bin
linker_pc.exe -language english -compress -cleanup mod
cd ..\mods\cod4qol
copy ..\..\zone\english\mod.ff
copy ..\..\zone\english\mod.ff
del ..\..\zone\english\qol.ff
ren ..\..\zone\english\mod.ff qol.ff

7za a -r -tzip xcommon_cod4qol.iwd images
Binary file added mod/cod4qol/material_properties/discord_icon
Binary file not shown.
Binary file added mod/cod4qol/materials/discord_icon
Binary file not shown.
2 changes: 2 additions & 0 deletions mod/cod4qol/mod.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
material,discord_icon

menufile,ui/options_game_pc.menu
menufile,ui/options_graphics_defaults.menu
menufile,ui/options_graphics_pc.menu
Expand Down
Binary file modified mod/cod4qol/mod.ff
Binary file not shown.
35 changes: 35 additions & 0 deletions mod/cod4qol/ui_mp/main.menu
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,35 @@
#include "ui/choices_setup_common.menu"
#include "ui_mp/stats_info.inc"

#define PREPROC_TEXT_DRAW_ALIGNED_EXTR( prect, porigin, ptext, psize, palignx, paligny, palign, pcolor ) \
itemDef { \
rect prect \
origin porigin \
textalignx palignx textaligny paligny \
textstyle ITEM_TEXTSTYLE_SHADOWED \
textalign palign \
textscale psize \
forecolor pcolor \
exp text( ptext ); \
visible 1 decoration }

#define PREPROC_SHADER_DRAW_ALIGNED_EXTR( prect, porigin, pshader, pcolor, pborder, pbordersize, pbordercolor, actionArg ) \
itemDef { \
style WINDOW_STYLE_SHADER \
rect prect \
origin porigin \
forecolor pcolor \
exp material( pshader ); \
border pborder \
bordersize pbordersize \
bordercolor pbordercolor \
visible 1 \
type 1 \
mouseEnter { play "mouse_over"; setcolor forecolor 1 1 1 1 } \
mouseExit { setcolor forecolor pcolor } \
action { play "mouse_click"; actionArg; } \
}

{
assetGlobalDef
{
Expand Down Expand Up @@ -107,6 +136,12 @@
open pc_cac_popup;

#define CLEARUIHINT exec "set ui_hint_text @MP_NULL"

PREPROC_TEXT_DRAW_ALIGNED_EXTR( 0 0 0 0 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, 0 0, "CoD4QOL v." + dvarString( qol_version ), TEXTSIZE_SMALL, -5, 20, ITEM_ALIGN_RIGHT, 0.69 0.69 0.69 0.2)
PREPROC_SHADER_DRAW_ALIGNED_EXTR( 0 0 20 20 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, -25 20, "discord_icon", 1 1 1 0.5, 0, 0, 0 0 0 0, exec "openlink 0" )
PREPROC_SHADER_DRAW_ALIGNED_EXTR( -25 0 20 20 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, -25 20, "$default", 1 1 1 0.5, 0, 0, 0 0 0 0, exec "openlink 0" )
PREPROC_SHADER_DRAW_ALIGNED_EXTR( -50 0 20 20 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, -25 20, "$default", 1 1 1 0.5, 0, 0, 0 0 0 0, exec "openlink 0" )
PREPROC_SHADER_DRAW_ALIGNED_EXTR( -80 25 100 20 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, -25 20, "$default", 1 1 1 0.5, 0, 0, 0 0 0 0, exec "openlink 0" )

CHOICE_BUTTON_VIS( 1, "@MENU_AUTO_UPDATE", open auconfirm;, when( dvarbool( cl_updateAvailable ) && !localvarBool( ui_hideBack ) ) )
//CHOICE_BUTTON_VIS( 2, "@MENU_JOIN_GAME", open join_game_popup;, when( !localvarBool( ui_hideBack ) ) )
Expand Down
Binary file added mod/cod4qol/xcommon_cod4qol.iwd
Binary file not shown.

0 comments on commit c1fe679

Please sign in to comment.