- added the final missing piece of localization support, i.e. forcing text based menus.

Now a localization mod can disable the graphics patches containing text entirely so that it can properly localize the text based menu variant.
If this flag gets set in MAPINFO, it will override all user settings.
This commit is contained in:
Christoph Oelckers 2019-02-23 10:40:07 +01:00
commit 2874a36fbe
5 changed files with 24 additions and 14 deletions

View file

@ -414,23 +414,30 @@ void M_SetMenu(FName menu, int param)
switch (menu)
{
case NAME_Mainmenu:
if (gameinfo.gametype & GAME_DoomStrifeChex)
if (gameinfo.gametype & GAME_DoomStrifeChex) // Raven's games always used text based menus
{
// For these games we must check up-front if they get localized because in that case another template must be used.
DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Playerclassmenu);
if (desc != nullptr)
if (gameinfo.forcetextinmenus) // If text is forced, this overrides any check.
{
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
menu = NAME_MainmenuTextOnly;
}
else
{
// For these games we must check up-front if they get localized because in that case another template must be used.
DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Mainmenu);
if (desc != nullptr)
{
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
if (ld->mFromEngine && cl_localizationmode != 0)
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
{
// This assumes that replacing one graphic will replace all of them.
// So this only checks the "New game" entry for localization capability.
FTextureID texid = TexMan.CheckForTexture("M_NGAME", ETextureType::MiscPatch);
if (!TexMan.OkForLocalization(texid, "$MNU_NEWGAME"))
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
if (ld->mFromEngine && cl_localizationmode != 0)
{
menu = NAME_MainmenuTextOnly;
// This assumes that replacing one graphic will replace all of them.
// So this only checks the "New game" entry for localization capability.
FTextureID texid = TexMan.CheckForTexture("M_NGAME", ETextureType::MiscPatch);
if (!TexMan.OkForLocalization(texid, "$MNU_NEWGAME"))
{
menu = NAME_MainmenuTextOnly;
}
}
}
}