- 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:
Christoph Oelckers 2019-02-21 00:35:27 +01:00
commit 48fcdacf06
16 changed files with 191 additions and 112 deletions

View file

@ -645,6 +645,7 @@ static void ParseListMenu(FScanner &sc)
desc->mWLeft = 0;
desc->mWRight = 0;
desc->mCenter = false;
desc->mFromEngine = Wads.GetLumpFile(sc.LumpNum) == 0; // flags menu if the definition is from the IWAD.
ParseListMenuBody(sc, desc);
ReplaceMenu(sc, desc);
@ -1078,16 +1079,31 @@ void M_ParseMenuDefs()
//
//=============================================================================
static void BuildEpisodeMenu()
void M_StartupEpisodeMenu(FGameStartup *gs)
{
// Build episode menu
bool success = false;
bool isOld = false;
DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Episodemenu);
if (desc != nullptr)
{
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
{
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
// Delete previous contents
for(unsigned i=0; i<ld->mItems.Size(); i++)
{
FName n = ld->mItems[i]->mAction;
if (n == NAME_Skillmenu)
{
isOld = true;
ld->mItems.Resize(i);
break;
}
}
int posy = (int)ld->mYpos;
int topy = posy;
@ -1114,16 +1130,17 @@ static void BuildEpisodeMenu()
posy -= topdelta;
}
ld->mSelectedItem = ld->mItems.Size();
if (!isOld) ld->mSelectedItem = ld->mItems.Size();
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
{
DMenuItemBase *it;
DMenuItemBase *it = nullptr;
if (AllEpisodes[i].mPicName.IsNotEmpty())
{
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
it = CreateListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i, AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor);
if (AllEpisodes[i].mEpisodeName.IsEmpty() || TexMan.OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
it = CreateListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i);
}
else
if (it == nullptr)
{
it = CreateListMenuItemText(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
@ -1142,6 +1159,7 @@ static void BuildEpisodeMenu()
}
}
}
else return; // do not recreate the option menu variant, because it is always text based.
}
if (!success)
{
@ -1186,6 +1204,7 @@ static void BuildPlayerclassMenu()
{
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
// add player display
ld->mSelectedItem = ld->mItems.Size();
int posy = (int)ld->mYpos;
@ -1482,7 +1501,6 @@ static void InitKeySections()
void M_CreateMenus()
{
BuildEpisodeMenu();
BuildPlayerclassMenu();
InitCrosshairsList();
InitMusicMenus();
@ -1617,7 +1635,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
for(unsigned int i = 0; i < MenuSkills.Size(); i++)
{
FSkillInfo &skill = *MenuSkills[i];
DMenuItemBase *li;
DMenuItemBase *li = nullptr;
// Using a different name for skills that must be confirmed makes handling this easier.
FName action = (skill.MustConfirm && !AllEpisodes[gs->Episode].mNoSkill) ?
NAME_StartgameConfirm : NAME_Startgame;
@ -1632,9 +1650,10 @@ void M_StartupSkillMenu(FGameStartup *gs)
if (skill.PicName.Len() != 0 && pItemText == nullptr)
{
FTextureID tex = GetMenuTexture(skill.PicName);
li = CreateListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, SkillIndices[i], skill.MenuName, ld->mFont, color);
if (skill.MenuName.IsEmpty() || TexMan.OkForLocalization(tex, skill.MenuName))
li = CreateListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, SkillIndices[i]);
}
else
if (li == nullptr)
{
li = CreateListMenuItemText(x, y, ld->mLinespacing, skill.Shortcut,
pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, SkillIndices[i]);