- added two more system callbacks for menu customization.

This commit is contained in:
Christoph Oelckers 2020-10-08 17:42:46 +02:00
parent 881a77b3a1
commit cf7518fe43
5 changed files with 14 additions and 6 deletions

View file

@ -24,6 +24,8 @@ struct SystemCallbacks
bool (*DispatchEvent)(event_t* ev);
bool (*CheckGame)(const char* nm);
int (*GetGender)();
void (*MenuClosed)();
bool (*CheckMenudefOption)(const char* opt);
};
extern SystemCallbacks sysCallbacks;

View file

@ -458,6 +458,7 @@ void M_DoStartControlPanel (bool scaleoverride)
delete CurrentScaleOverrider;
CurrentScaleOverrider = nullptr;
}
}
//=============================================================================
@ -869,6 +870,7 @@ void M_ClearMenus()
menuactive = MENU_Off;
if (CurrentScaleOverrider) delete CurrentScaleOverrider;
CurrentScaleOverrider = nullptr;
if (sysCallbacks.MenuClosed) sysCallbacks.MenuClosed();
}
//=============================================================================

View file

@ -220,7 +220,7 @@ static bool CheckSkipOptionBlock(FScanner &sc)
do
{
sc.MustGetString();
if (CheckSkipGameOptionBlock(sc)) filter = true;
if (sysCallbacks.CheckMenudefOption && sysCallbacks.CheckMenudefOption(sc.String)) filter = true;
else if (sc.Compare("Windows"))
{
#ifdef _WIN32

View file

@ -3025,6 +3025,9 @@ static void GC_MarkGameRoots()
// NextToThink must not be freed while thinkers are ticking.
GC::Mark(NextToThink);
}
bool CheckSkipGameOptionBlock(const char* str);
//==========================================================================
//
// D_DoomMain
@ -3067,8 +3070,9 @@ static int D_DoomMain_Internal (void)
System_GetPlayerName,
System_DispatchEvent,
StrTable_ValidFilter,
StrTable_GetGender
StrTable_GetGender,
nullptr,
CheckSkipGameOptionBlock,
};

View file

@ -1244,11 +1244,11 @@ bool OkForLocalization(FTextureID texnum, const char* substitute)
return TexMan.OkForLocalization(texnum, substitute, cl_gfxlocalization);
}
bool CheckSkipGameOptionBlock(FScanner &sc)
bool CheckSkipGameOptionBlock(const char *str)
{
bool filter = false;
if (sc.Compare("ReadThis")) filter |= gameinfo.drawreadthis;
else if (sc.Compare("Swapmenu")) filter |= gameinfo.swapmenu;
if (!stricmp(str, "ReadThis")) filter |= gameinfo.drawreadthis;
else if (!stricmp(str, "Swapmenu")) filter |= gameinfo.swapmenu;
return filter;
}