diff --git a/build/msvc_2019/game.vcxproj b/build/msvc_2019/game.vcxproj index 6ec6ae7..332b328 100644 --- a/build/msvc_2019/game.vcxproj +++ b/build/msvc_2019/game.vcxproj @@ -263,6 +263,7 @@ + diff --git a/build/msvc_2019/game.vcxproj.filters b/build/msvc_2019/game.vcxproj.filters index 5bb9af6..c197cc9 100644 --- a/build/msvc_2019/game.vcxproj.filters +++ b/build/msvc_2019/game.vcxproj.filters @@ -287,6 +287,9 @@ game\mods\features + + game\mods\features + game\mods\features diff --git a/build/qvm_build/build_game.bat b/build/qvm_build/build_game.bat index 6c1a97c..8dbff9c 100644 --- a/build/qvm_build/build_game.bat +++ b/build/qvm_build/build_game.bat @@ -72,6 +72,7 @@ set src=game\mods\components&set name=comp_pending_item&call :compile set src=game\mods\components&set name=comp_warmup_sequence&call :compile set src=game\mods\features&set name=feat_altswap_handler&call :compile set src=game\mods\features&set name=feat_bot_adding&call :compile +set src=game\mods\features&set name=feat_misc&call :compile set src=game\mods\features&set name=feat_player_move&call :compile set src=game\mods\features&set name=feat_spect_passthrough&call :compile set src=game\mods\features&set name=feat_spawn_protect&call :compile diff --git a/code/game/mods/features/feat_misc.c b/code/game/mods/features/feat_misc.c new file mode 100644 index 0000000..9af2e11 --- /dev/null +++ b/code/game/mods/features/feat_misc.c @@ -0,0 +1,42 @@ +/* +* Misc Features +* +* This module can be used to add minor tweaks or cvar-controlled options that +* don't fit anywhere else and are too minor to justify their own mod file. +*/ + +#define MOD_PREFIX( x ) ModMiscFeatures_##x + +#include "mods/g_mod_local.h" + +static struct { + // For mod function stacking + ModFNType_AddModConfigInfo Prev_AddModConfigInfo; +} *MOD_STATE; + +/* +============== +(ModFN) AddModConfigInfo +============== +*/ +LOGFUNCTION_VOID( MOD_PREFIX(AddModConfigInfo), ( char *info ), ( info ), "G_MODFN_ADDMODCONFIGINFO" ) { + // Indicate to cMod client to use preferred default UI module if possible, to avoid + // potential settings reset on disconnect or other engine incompatibilities. + // This should be disabled if creating a mod that has a need for a customized UI. + Info_SetValueForKey( info, "nativeUI", "1" ); + + MOD_STATE->Prev_AddModConfigInfo( info ); +} + +/* +================ +ModMiscFeatures_Init +================ +*/ +LOGFUNCTION_VOID( ModMiscFeatures_Init, ( void ), (), "G_MOD_INIT" ) { + if ( !MOD_STATE ) { + MOD_STATE = G_Alloc( sizeof( *MOD_STATE ) ); + + INIT_FN_STACKABLE( AddModConfigInfo ); + } +} diff --git a/code/game/mods/g_mod_local.h b/code/game/mods/g_mod_local.h index 7a2bfb1..4567be8 100644 --- a/code/game/mods/g_mod_local.h +++ b/code/game/mods/g_mod_local.h @@ -45,6 +45,7 @@ void ModTournament_Init( void ); void ModAltSwapHandler_Init( void ); void ModBotAdding_Init( void ); +void ModMiscFeatures_Init( void ); void ModPingcomp_Init( void ); void ModPlayerMove_Init( void ); void ModSpawnProtect_Init( void ); diff --git a/code/game/mods/g_mod_main.c b/code/game/mods/g_mod_main.c index 040ad61..e2c1520 100644 --- a/code/game/mods/g_mod_main.c +++ b/code/game/mods/g_mod_main.c @@ -42,6 +42,7 @@ LOGFUNCTION_VOID( G_ModsInit, ( void ), (), "G_MOD_INIT" ) { // Default mods if ( modsEnabled >= 2 ) { + ModMiscFeatures_Init(); ModPlayerMove_Init(); ModAltSwapHandler_Init(); ModPingcomp_Init();