Skip to content

Commit

Permalink
Added more icons, added forceiwdextract for updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Rex109 committed Mar 29, 2024
1 parent 7802b64 commit 6e14497
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 13 deletions.
2 changes: 2 additions & 0 deletions cod4qol/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ void commands::InitializeCommands()

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.");

static const char* qol_getss_names[] = { "Off", "Notify", "Notify + Block", NULL };
qol_getss = game::Cvar_RegisterEnum("qol_getss", qol_getss_names, 0, game::dvar_flags::saved, "Notify and block getss from servers.");

Expand Down
1 change: 1 addition & 0 deletions cod4qol/commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace commands
inline game::dvar_s* qol_rename_text;

inline game::dvar_s* qol_version;
inline game::dvar_s* qol_forceiwdextract;
inline game::dvar_s* qol_check_updates;
inline game::dvar_s* qol_getss;
inline game::dvar_s* qol_vstr_block;
Expand Down
15 changes: 11 additions & 4 deletions cod4qol/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void game::LoadModFiles()
std::string relative_dir = game::fs_homepath->current.string;
relative_dir.append("\\main\\xcommon_cod4qol.iwd");

if (startup && !std::filesystem::exists(relative_dir))
if (startup && (!std::filesystem::exists(relative_dir) || commands::qol_forceiwdextract->current.enabled))
{
HRSRC hRes = FindResource(game::GetCurrentModule(), MAKEINTRESOURCE(COD4QOL_IWD), RT_RCDATA);

Expand All @@ -66,7 +66,14 @@ void game::LoadModFiles()
UnlockResource(data);
FreeResource(hData);

std::cout << "Resource extracted to file: " << relative_dir << std::endl;
if(!commands::qol_forceiwdextract->current.enabled)
std::cout << "Resource extracted to file: " << relative_dir << std::endl;
else
{
std::cout << "Resource updated to file: " << relative_dir << std::endl;
commands::qol_forceiwdextract->current.enabled = false;
commands::qol_forceiwdextract->latched.enabled = false;
}
}

LoadIWD(relative_dir.c_str(), "xcommon_cod4qol.iwd", "main");
Expand All @@ -93,11 +100,11 @@ void game::hookedDB_LoadXZoneFromGfxConfig()

game::Sys_CreateConsole(0x0);

commands::InitializeCommands();

if (!strcmp(fs_game->current.string, "") || commands::qol_stockmenu->current.enabled)
LoadModFiles();

commands::InitializeCommands();

if (startup)
{
#ifndef _DEBUG
Expand Down
Binary file modified mod/cod4qol/images/discord_icon.iwi
Binary file not shown.
Binary file added mod/cod4qol/images/github_icon.iwi
Binary file not shown.
Binary file added mod/cod4qol/images/kofi_icon.iwi
Binary file not shown.
Binary file added mod/cod4qol/images/youtube_icon.iwi
Binary file not shown.
Binary file added mod/cod4qol/material_properties/github_icon
Binary file not shown.
Binary file added mod/cod4qol/material_properties/kofi_icon
Binary file not shown.
Binary file added mod/cod4qol/material_properties/youtube_icon
Binary file not shown.
Binary file added mod/cod4qol/materials/github_icon
Binary file not shown.
Binary file added mod/cod4qol/materials/kofi_icon
Binary file not shown.
Binary file added mod/cod4qol/materials/youtube_icon
Binary file not shown.
3 changes: 3 additions & 0 deletions mod/cod4qol/mod.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
material,discord_icon
material,github_icon
material,kofi_icon
material,youtube_icon

menufile,ui/options_game_pc.menu
menufile,ui/options_graphics_defaults.menu
Expand Down
Binary file modified mod/cod4qol/mod.ff
Binary file not shown.
18 changes: 9 additions & 9 deletions mod/cod4qol/ui_mp/main.menu
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#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 ) \
#define PREPROC_TEXT_DRAW_ALIGNED_EXTR( prect, porigin, ptext, psize, palignx, paligny, palign, pcolor, visArg ) \
itemDef { \
rect prect \
origin porigin \
Expand All @@ -24,9 +24,9 @@ itemDef { \
textscale psize \
forecolor pcolor \
exp text( ptext ); \
visible 1 decoration }
visible visArg decoration }

#define PREPROC_SHADER_DRAW_ALIGNED_EXTR( prect, porigin, pshader, pcolor, pborder, pbordersize, pbordercolor, actionArg ) \
#define PREPROC_SHADER_DRAW_ALIGNED_EXTR( prect, porigin, pshader, pcolor, pborder, pbordersize, pbordercolor, actionArg, visArg ) \
itemDef { \
style WINDOW_STYLE_SHADER \
rect prect \
Expand All @@ -36,7 +36,7 @@ itemDef { \
border pborder \
bordersize pbordersize \
bordercolor pbordercolor \
visible 1 \
visible visArg \
type 1 \
mouseEnter { play "mouse_over"; setcolor forecolor 1 1 1 1 } \
mouseExit { setcolor forecolor pcolor } \
Expand Down Expand Up @@ -137,11 +137,11 @@ itemDef { \

#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" )
PREPROC_TEXT_DRAW_ALIGNED_EXTR( 0 0 0 0 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, 0 0, "CoD4QOL " + dvarString( qol_version ), TEXTSIZE_SMALL, -5, 20, ITEM_ALIGN_RIGHT, 0.69 0.69 0.69 0.4, when( !localvarBool( ui_hideBack ) ))
PREPROC_SHADER_DRAW_ALIGNED_EXTR( 0 17 15 15 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, -20 20, "discord_icon", 1 1 1 0.2, 0, 0, 0 0 0 0, exec "openlink 0", when( !localvarBool( ui_hideBack ) ) )
PREPROC_SHADER_DRAW_ALIGNED_EXTR( -20 17 15 15 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, -20 20, "youtube_icon", 1 1 1 0.2, 0, 0, 0 0 0 0, exec "openlink 1", when( !localvarBool( ui_hideBack ) ) )
PREPROC_SHADER_DRAW_ALIGNED_EXTR( -40 17 15 15 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, -20 20, "github_icon", 1 1 1 0.2, 0, 0, 0 0 0 0, exec "openlink 2", when( !localvarBool( ui_hideBack ) ) )
PREPROC_SHADER_DRAW_ALIGNED_EXTR( -81 0 96 15 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_TOP, -20 20, "kofi_icon", 1 1 1 0.2, 0, 0, 0 0 0 0, exec "openlink 3", when( !localvarBool( ui_hideBack ) ) )

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 modified mod/cod4qol/xcommon_cod4qol.iwd
Binary file not shown.

0 comments on commit 6e14497

Please sign in to comment.