Open Razish opened 7 months ago
This allows you to programmatically expose values to .menu files from cgame/ui via preprocessor defines.
.menu
So we could in theory do:
diff --git a/codemp/cgame/cg_main.c b/codemp/cgame/cg_main.c index 12bbd470e..ff1827912 100644 --- a/codemp/cgame/cg_main.c +++ b/codemp/cgame/cg_main.c @@ -2196,6 +2196,9 @@ void CG_LoadMenus(const char *menuFile) buf[len] = 0; trap->FS_Close( f ); + trap->PC_AddGlobalDefine("ARCH_STRING \"" ARCH_STRING "\""); + trap->PC_LoadGlobalDefines("ui/jamp/menudef.h"); + p = buf; COM_BeginParseSession ("CG_LoadMenus"); diff --git a/codemp/ui/ui_main.c b/codemp/ui/ui_main.c index 45501d947..d11a20f21 100644 --- a/codemp/ui/ui_main.c +++ b/codemp/ui/ui_main.c @@ -1423,6 +1423,7 @@ void UI_LoadMenus(const char *menuFile, qboolean reset) { int handle; // int start = trap->Milliseconds(); + trap->PC_AddGlobalDefine("ARCH_STRING \"" ARCH_STRING "\""); trap->PC_LoadGlobalDefines ( "ui/jamp/menudef.h" ); handle = trap->PC_LoadSource( menuFile );
Personally I would also remove the define and always have define hashing enabled, as non-hashed behavior would be worse performance I expect.
https://gist.github.com/ensiform/8c9a6ea23aebe7e2bdfe5929db36e637
This allows you to programmatically expose values to
.menu
files from cgame/ui via preprocessor defines.So we could in theory do: