mirror of https://github.com/ZDoom/gzdoom.git
- use original menu spacing for skill and episode menus if all elements are patches.
This commit is contained in:
parent
f29eff5b4c
commit
99c66071fb
|
@ -571,8 +571,21 @@ void M_StartupEpisodeMenu(FNewGameStartup *gs)
|
||||||
if (y < topy) topy = y;
|
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
|
// 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)
|
if (totalheight < 190 || AllEpisodes.Size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -613,15 +626,15 @@ void M_StartupEpisodeMenu(FNewGameStartup *gs)
|
||||||
{
|
{
|
||||||
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
||||||
if (AllEpisodes[i].mEpisodeName.IsEmpty() || OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
|
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)
|
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);
|
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
|
||||||
}
|
}
|
||||||
ld->mItems.Push(it);
|
ld->mItems.Push(it);
|
||||||
posy += ld->mLinespacing;
|
posy += spacing;
|
||||||
}
|
}
|
||||||
if (AllEpisodes.Size() == 1)
|
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;
|
ld->mSelectedItem = ld->mItems.Size() + defindex;
|
||||||
|
|
||||||
int posy = y;
|
int posy = y;
|
||||||
|
@ -1088,8 +1102,20 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
|
||||||
if (y < topy) topy = y;
|
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
|
// 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)
|
if (totalheight < 190 || MenuSkills.Size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -1157,16 +1183,16 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
|
||||||
{
|
{
|
||||||
FTextureID tex = GetMenuTexture(skill.PicName);
|
FTextureID tex = GetMenuTexture(skill.PicName);
|
||||||
if (skill.MenuName.IsEmpty() || OkForLocalization(tex, skill.MenuName))
|
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)
|
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]);
|
pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, SkillIndices[i]);
|
||||||
}
|
}
|
||||||
ld->mItems.Push(li);
|
ld->mItems.Push(li);
|
||||||
GC::WriteBarrier(*desc, li);
|
GC::WriteBarrier(*desc, li);
|
||||||
y += ld->mLinespacing;
|
y += spacing;
|
||||||
}
|
}
|
||||||
if (AllEpisodes[gs->Episode].mNoSkill || MenuSkills.Size() == 1)
|
if (AllEpisodes[gs->Episode].mNoSkill || MenuSkills.Size() == 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,6 +209,7 @@ ListMenu "EpisodeMenu"
|
||||||
{
|
{
|
||||||
Position 48, 63
|
Position 48, 63
|
||||||
StaticPatch 54, 38, "M_EPISOD", 0 , "$MNU_EPISODE"
|
StaticPatch 54, 38, "M_EPISOD", 0 , "$MNU_EPISODE"
|
||||||
|
linespacing 16
|
||||||
}
|
}
|
||||||
IfGame(Strife)
|
IfGame(Strife)
|
||||||
{
|
{
|
||||||
|
@ -234,6 +235,7 @@ ListMenu "SkillMenu"
|
||||||
IfGame(Doom, Chex)
|
IfGame(Doom, Chex)
|
||||||
{
|
{
|
||||||
StaticPatch 96, 14, "M_NEWG", 0, "$MNU_NEWGAME"
|
StaticPatch 96, 14, "M_NEWG", 0, "$MNU_NEWGAME"
|
||||||
|
linespacing 16
|
||||||
}
|
}
|
||||||
IfGame(Strife)
|
IfGame(Strife)
|
||||||
{
|
{
|
||||||
|
|
|
@ -328,6 +328,36 @@ class ListMenu : Menu
|
||||||
{
|
{
|
||||||
mFocusControl = NULL;
|
mFocusControl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
void ChangeLineSpacing(int newspace)
|
||||||
|
{
|
||||||
|
double top = -32767;
|
||||||
|
|
||||||
|
for (int i = 0; i < mDesc.mItems.Size(); i++)
|
||||||
|
{
|
||||||
|
let selitem = ListMenuItemSelectable(mDesc.mItems[i]);
|
||||||
|
if (selitem)
|
||||||
|
{
|
||||||
|
let y = mDesc.mItems[i].GetY();
|
||||||
|
if (top == -32767)
|
||||||
|
{
|
||||||
|
top = y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
let newy = top + (y - top) / mDesc.mLineSpacing * newspace;
|
||||||
|
mDesc.mItems[i].SetY(newy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mDesc.mLineSpacing = newspace;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ class MenuItemBase : Object native ui version("2.4")
|
||||||
double GetY() { return mYpos; }
|
double GetY() { return mYpos; }
|
||||||
double GetX() { return mXpos; }
|
double GetX() { return mXpos; }
|
||||||
void SetX(double x) { mXpos = x; }
|
void SetX(double x) { mXpos = x; }
|
||||||
|
void SetY(double x) { mYpos = x; }
|
||||||
virtual void OnMenuCreated() {}
|
virtual void OnMenuCreated() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue