- more work on graphics substitutiion
* added a CVAR that sets how localizable graphics need to be dealt with. * pass the substitution string to OkForLocalization so that proper checks can be performed. * increased item spacing on Doom's list menus to 18 from 16 pixels, because otherwise the diacritic letters would not fit. 20 would have been more ideal but 18 was the limit without compromising its visual style * added a second text-only main menu because here the spacing cannot be changed. Doing so would render any single-patch main menu non-functional. So here the rules are that if substitution takes place, it will swap out the entire menu class. * fixed some issues with the summary screen's "entering" and "finished" graphics.
This commit is contained in:
parent
a0c10df387
commit
48fcdacf06
16 changed files with 191 additions and 112 deletions
|
|
@ -52,6 +52,7 @@
|
|||
#include "vm.h"
|
||||
#include "events.h"
|
||||
#include "v_video.h"
|
||||
#include "i_system.h"
|
||||
#include "scripting/types.h"
|
||||
|
||||
int DMenu::InMenu;
|
||||
|
|
@ -404,11 +405,38 @@ DEFINE_ACTION_FUNCTION(DMenu, ActivateMenu)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
EXTERN_CVAR(Int, cl_localizationmode)
|
||||
|
||||
|
||||
void M_SetMenu(FName menu, int param)
|
||||
{
|
||||
// some menus need some special treatment
|
||||
switch (menu)
|
||||
{
|
||||
case NAME_Mainmenu:
|
||||
if (gameinfo.gametype & GAME_DoomStrifeChex)
|
||||
{
|
||||
// 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 ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
||||
{
|
||||
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
||||
if (ld->mFromEngine && cl_localizationmode != 0)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NAME_Episodemenu:
|
||||
// sent from the player class menu
|
||||
GameStartupInfo.Skill = -1;
|
||||
|
|
@ -416,6 +444,7 @@ void M_SetMenu(FName menu, int param)
|
|||
GameStartupInfo.PlayerClass =
|
||||
param == -1000? nullptr :
|
||||
param == -1? "Random" : GetPrintableDisplayName(PlayerClasses[param].Type).GetChars();
|
||||
M_StartupEpisodeMenu(&GameStartupInfo); // needs player class name from class menu (later)
|
||||
break;
|
||||
|
||||
case NAME_Skillmenu:
|
||||
|
|
@ -1265,13 +1294,12 @@ DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool c
|
|||
return (DMenuItemBase*)p;
|
||||
}
|
||||
|
||||
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param, const char *label, FFont *font, int color)
|
||||
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param)
|
||||
{
|
||||
auto c = PClass::FindClass("ListMenuItemPatchItem");
|
||||
auto p = c->CreateNew();
|
||||
FString keystr = FString(char(hotkey));
|
||||
FString labelstr = label;
|
||||
VMValue params[] = { p, x, y, height, tex.GetIndex(), &keystr, command.GetIndex(), param, &labelstr, font, color };
|
||||
VMValue params[] = { p, x, y, height, tex.GetIndex(), &keystr, command.GetIndex(), param };
|
||||
auto f = dyn_cast<PFunction>(c->FindSymbol("InitDirect", false));
|
||||
VMCall(f->Variants[0].Implementation, params, countof(params), nullptr, 0);
|
||||
return (DMenuItemBase*)p;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue