- use original menu spacing for skill and episode menus if all elements are patches.

This commit is contained in:
Christoph Oelckers 2021-08-10 21:08:26 +02:00
commit 99c66071fb
4 changed files with 69 additions and 10 deletions

View file

@ -571,8 +571,21 @@ void M_StartupEpisodeMenu(FNewGameStartup *gs)
if (y < topy) topy = y;
}
int spacing = ld->mLinespacing;
for (unsigned i = 0; i < AllEpisodes.Size(); i++)
{
if (AllEpisodes[i].mPicName.IsNotEmpty())
{
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
if (AllEpisodes[i].mEpisodeName.IsEmpty() || OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
continue;
}
if ((gameinfo.gametype & GAME_DoomStrifeChex) && spacing == 16) spacing = 18;
break;
}
// center the menu on the screen if the top space is larger than the bottom space
int totalheight = posy + AllEpisodes.Size() * ld->mLinespacing - topy;
int totalheight = posy + AllEpisodes.Size() * spacing - topy;
if (totalheight < 190 || AllEpisodes.Size() == 1)
{
@ -613,15 +626,15 @@ void M_StartupEpisodeMenu(FNewGameStartup *gs)
{
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
if (AllEpisodes[i].mEpisodeName.IsEmpty() || OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
it = CreateListMenuItemPatch(posx, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i);
it = CreateListMenuItemPatch(posx, posy, spacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i);
}
if (it == nullptr)
{
it = CreateListMenuItemText(posx, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
it = CreateListMenuItemText(posx, posy, spacing, AllEpisodes[i].mShortcut,
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
}
ld->mItems.Push(it);
posy += ld->mLinespacing;
posy += spacing;
}
if (AllEpisodes.Size() == 1)
{
@ -1073,9 +1086,10 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
}
}
if (done != restart)
int spacing = ld->mLinespacing;
//if (done != restart)
{
done = restart;
//done = restart;
ld->mSelectedItem = ld->mItems.Size() + defindex;
int posy = y;
@ -1088,8 +1102,20 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
if (y < topy) topy = y;
}
for (unsigned i = 0; i < MenuSkills.Size(); i++)
{
if (MenuSkills[i]->PicName.IsNotEmpty())
{
FTextureID tex = GetMenuTexture(MenuSkills[i]->PicName);
if (MenuSkills[i]->MenuName.IsEmpty() || OkForLocalization(tex, MenuSkills[i]->MenuName))
continue;
}
if ((gameinfo.gametype & GAME_DoomStrifeChex) && spacing == 16) spacing = 18;
break;
}
// center the menu on the screen if the top space is larger than the bottom space
int totalheight = posy + MenuSkills.Size() * ld->mLinespacing - topy;
int totalheight = posy + MenuSkills.Size() * spacing - topy;
if (totalheight < 190 || MenuSkills.Size() == 1)
{
@ -1157,16 +1183,16 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
{
FTextureID tex = GetMenuTexture(skill.PicName);
if (skill.MenuName.IsEmpty() || OkForLocalization(tex, skill.MenuName))
li = CreateListMenuItemPatch(posx, y, ld->mLinespacing, skill.Shortcut, tex, action, SkillIndices[i]);
li = CreateListMenuItemPatch(posx, y, spacing, skill.Shortcut, tex, action, SkillIndices[i]);
}
if (li == nullptr)
{
li = CreateListMenuItemText(posx, y, ld->mLinespacing, skill.Shortcut,
li = CreateListMenuItemText(posx, y, spacing, skill.Shortcut,
pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, SkillIndices[i]);
}
ld->mItems.Push(li);
GC::WriteBarrier(*desc, li);
y += ld->mLinespacing;
y += spacing;
}
if (AllEpisodes[gs->Episode].mNoSkill || MenuSkills.Size() == 1)
{