mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
- episode menu setup.
This commit is contained in:
parent
556c61b60b
commit
d73f915c66
5 changed files with 59 additions and 79 deletions
|
@ -324,6 +324,7 @@ class FListMenuItem
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int mXpos, mYpos;
|
int mXpos, mYpos;
|
||||||
|
int mHeight;
|
||||||
FName mAction;
|
FName mAction;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -361,6 +362,7 @@ public:
|
||||||
int GetX() { return mXpos; }
|
int GetX() { return mXpos; }
|
||||||
void SetX(int x) { mXpos = x; }
|
void SetX(int x) { mXpos = x; }
|
||||||
void SetY(int x) { mYpos = x; }
|
void SetY(int x) { mYpos = x; }
|
||||||
|
void SetHeight(int x) { mHeight = x; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class FListMenuItemStaticPatch : public FListMenuItem
|
class FListMenuItemStaticPatch : public FListMenuItem
|
||||||
|
@ -398,7 +400,6 @@ class FListMenuItemSelectable : public FListMenuItem
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int mHotkey;
|
int mHotkey;
|
||||||
int mHeight;
|
|
||||||
int mParam;
|
int mParam;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -991,90 +991,70 @@ void M_ParseMenuDefs()
|
||||||
|
|
||||||
static void BuildEpisodeMenu()
|
static void BuildEpisodeMenu()
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
// Build episode menu
|
// Build episode menu
|
||||||
bool success = false;
|
int addedVolumes = 0;
|
||||||
FMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Episodemenu);
|
FMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_EpisodeMenu);
|
||||||
if (desc != NULL)
|
if (desc != NULL)
|
||||||
{
|
{
|
||||||
if ((*desc)->mType == MDESC_ListMenu)
|
if ((*desc)->mType == MDESC_ListMenu)
|
||||||
{
|
{
|
||||||
FListMenuDescriptor *ld = static_cast<FListMenuDescriptor*>(*desc);
|
FListMenuDescriptor *ld = static_cast<FListMenuDescriptor*>(*desc);
|
||||||
int posy = ld->mYpos;
|
ld->mSelectedItem = 1;
|
||||||
int topy = posy;
|
|
||||||
|
|
||||||
// Get lowest y coordinate of any static item in the menu
|
for (int i = 0; i < MAXVOLUMES; i++)
|
||||||
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
|
||||||
{
|
{
|
||||||
int y = ld->mItems[i]->GetY();
|
if (gVolumeNames[i].IsNotEmpty())
|
||||||
if (y < topy) topy = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// center the menu on the screen if the top space is larger than the bottom space
|
|
||||||
int totalheight = posy + AllEpisodes.Size() * ld->mLinespacing - topy;
|
|
||||||
|
|
||||||
if (totalheight < 190 || AllEpisodes.Size() == 1)
|
|
||||||
{
|
{
|
||||||
int newtop = (200 - totalheight + topy) / 2;
|
auto it = new FListMenuItemNativeText(ld->mXpos, 0, 0, gVolumeNames[i][0], gVolumeNames[i], NIT_BigFont, NIT_ActiveState, 1, NAME_SkillMenu, i + 1);
|
||||||
int topdelta = newtop - topy;
|
|
||||||
if (topdelta < 0)
|
|
||||||
{
|
|
||||||
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
|
||||||
{
|
|
||||||
ld->mItems[i]->OffsetPositionY(topdelta);
|
|
||||||
}
|
|
||||||
posy -= topdelta;
|
|
||||||
}
|
|
||||||
|
|
||||||
ld->mSelectedItem = ld->mItems.Size();
|
|
||||||
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
|
||||||
{
|
|
||||||
FListMenuItem *it;
|
|
||||||
if (AllEpisodes[i].mPicName.IsNotEmpty())
|
|
||||||
{
|
|
||||||
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
|
||||||
it = new FListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
|
||||||
tex, NAME_Skillmenu, i);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
it = new FListMenuItemText(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
|
||||||
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
|
|
||||||
}
|
|
||||||
ld->mItems.Push(it);
|
ld->mItems.Push(it);
|
||||||
posy += ld->mLinespacing;
|
addedVolumes++;
|
||||||
}
|
if (gVolumeSubtitles[i].IsNotEmpty())
|
||||||
if (AllEpisodes.Size() == 1)
|
|
||||||
{
|
{
|
||||||
ld->mAutoselect = ld->mSelectedItem;
|
//auto it = new FListMenuItemNativeStaticText(ld->mXpos, gVolumeSubtitles[i], NIT_SmallFont);
|
||||||
}
|
//ld->mItems.Push(it);
|
||||||
success = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (1 /*CheckUserMaps()*/)
|
||||||
if (!success)
|
|
||||||
{
|
{
|
||||||
// Couldn't create the episode menu, either because there's too many episodes or some error occured
|
//auto it = new FListMenuItemNativeStaticText(ld->mXpos, "", NIT_SmallFont); // empty entry as spacer.
|
||||||
// Create an option menu for episode selection instead.
|
//ld->mItems.Push(it);
|
||||||
FOptionMenuDescriptor *od = new FOptionMenuDescriptor;
|
|
||||||
if (desc != NULL) delete *desc;
|
auto it = new FListMenuItemNativeText(ld->mXpos, 0, 0, 0, "$MNU_USERMAP", NIT_BigFont, NIT_ActiveState, 1, NAME_SkillMenu, i + 1);
|
||||||
MenuDescriptors[NAME_Episodemenu] = od;
|
ld->mItems.Push(it);
|
||||||
od->mType = MDESC_OptionsMenu;
|
addedVolumes++;
|
||||||
od->mMenuName = NAME_Episodemenu;
|
if (g_gameType & GAMEFLAG_SW) // fixme: make this game independent.
|
||||||
od->mTitle = "$MNU_EPISODE";
|
|
||||||
od->mSelectedItem = 0;
|
|
||||||
od->mScrollPos = 0;
|
|
||||||
od->mClass = NULL;
|
|
||||||
od->mPosition = -15;
|
|
||||||
od->mScrollTop = 0;
|
|
||||||
od->mIndent = 160;
|
|
||||||
od->mDontDim = false;
|
|
||||||
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
|
||||||
{
|
{
|
||||||
FOptionMenuItemSubmenu *it = new FOptionMenuItemSubmenu(AllEpisodes[i].mEpisodeName, "Skillmenu", i);
|
//auto it = new FListMenuItemNativeStaticText(ld->mXpos, "$MNU_SELECTUSERMAP", NIT_SmallFont);
|
||||||
od->mItems.Push(it);
|
//ld->mItems.Push(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (addedVolumes == 1)
|
||||||
|
{
|
||||||
|
ld->mAutoselect = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
if (gVolumeNames[i].IsNotEmpty())
|
||||||
|
{
|
||||||
|
if (!(gVolumeFlags[i] & EF_HIDEFROMSP))
|
||||||
|
{
|
||||||
|
MEL_EPISODE[i] = &ME_EPISODE[i];
|
||||||
|
ME_EPISODE[i] = ME_EPISODE_TEMPLATE;
|
||||||
|
ME_EPISODE[i].name = gVolumeNames[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (!(EpisodeFlags[i] & EF_HIDEFROMMP))
|
||||||
|
{
|
||||||
|
MEOSN_NetEpisodes[k] = gVolumeNames[i];
|
||||||
|
MEOSV_NetEpisodes[k] = i;
|
||||||
|
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
M_EPISODE.numEntries = g_volumeCnt + 2;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,3 +24,13 @@ xx(SaveMenu)
|
||||||
xx(LoadMenu)
|
xx(LoadMenu)
|
||||||
xx(SoundMenu)
|
xx(SoundMenu)
|
||||||
xx(ConfirmPlayerReset)
|
xx(ConfirmPlayerReset)
|
||||||
|
xx(EpisodeMenu)
|
||||||
|
xx(SkillMenu)
|
||||||
|
xx(CustomGameMenu)
|
||||||
|
xx(CustomSubMenu1)
|
||||||
|
xx(CustomSubMenu2)
|
||||||
|
xx(CustomSubMenu3)
|
||||||
|
xx(CustomSubMenu4)
|
||||||
|
xx(CustomSubMenu5)
|
||||||
|
xx(CustomSubMenu6)
|
||||||
|
xx(CustomSubMenu7)
|
||||||
|
|
|
@ -547,6 +547,7 @@ protected:
|
||||||
numvalidentries--;
|
numvalidentries--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
entry->SetHeight(height);
|
||||||
totalheight += height;
|
totalheight += height;
|
||||||
}
|
}
|
||||||
if (mDesc->mSpacing <= 0) calculatedentryspacing = std::max(0, (y_lower - y_upper - totalheight) / (numvalidentries > 1 ? numvalidentries - 1 : 1));
|
if (mDesc->mSpacing <= 0) calculatedentryspacing = std::max(0, (y_lower - y_upper - totalheight) / (numvalidentries > 1 ? numvalidentries - 1 : 1));
|
||||||
|
|
|
@ -19,7 +19,6 @@ LISTMENU "MainMenu"
|
||||||
position 160, 55, 115
|
position 160, 55, 115
|
||||||
centermenu
|
centermenu
|
||||||
}
|
}
|
||||||
linespacing 15
|
|
||||||
class "Duke.MainMenu"
|
class "Duke.MainMenu"
|
||||||
NativeTextItem "$MNU_NEWGAME", "n", "PlayerclassMenu"
|
NativeTextItem "$MNU_NEWGAME", "n", "PlayerclassMenu"
|
||||||
//NativeTextItem "$MNU_NEWGAME", "m", "MultiMenu" // In EDuke this replaces "New Game" when in networking mode. Kept here as a reminder (I'm not going to support EDuke's C/S implementation)
|
//NativeTextItem "$MNU_NEWGAME", "m", "MultiMenu" // In EDuke this replaces "New Game" when in networking mode. Kept here as a reminder (I'm not going to support EDuke's C/S implementation)
|
||||||
|
@ -134,25 +133,14 @@ LISTMENU "EpisodeMenu"
|
||||||
{
|
{
|
||||||
ScriptId 100
|
ScriptId 100
|
||||||
// Episode names filled in programmatically
|
// Episode names filled in programmatically
|
||||||
NativeTextItem "", "", "SkillMenu", 1
|
|
||||||
NativeStaticTextItem ""
|
|
||||||
NativeTextItem "", "", "SkillMenu", 2
|
|
||||||
NativeStaticTextItem ""
|
|
||||||
NativeTextItem "", "", "SkillMenu", 3
|
|
||||||
NativeStaticTextItem ""
|
|
||||||
NativeTextItem "", "", "SkillMenu", 4
|
|
||||||
NativeStaticTextItem ""
|
|
||||||
NativeTextItem "", "", "SkillMenu", 5
|
|
||||||
NativeStaticTextItem ""
|
|
||||||
NativeTextItem "", "", "SkillMenu", 6
|
|
||||||
NativeStaticTextItem ""
|
|
||||||
NativeTextItem "", "", "SkillMenu", 7
|
|
||||||
//Spacer
|
//Spacer
|
||||||
|
/*
|
||||||
NativeTextItem "$MNU_USERMAP", "u", "UserMap"
|
NativeTextItem "$MNU_USERMAP", "u", "UserMap"
|
||||||
ifgame(ShadowWarrior)
|
ifgame(ShadowWarrior)
|
||||||
{
|
{
|
||||||
NativeStaticTextItem "$MNU_SELECTUSERMAP"
|
NativeStaticTextItem "$MNU_SELECTUSERMAP"
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
LISTMENU "SkillMenu"
|
LISTMENU "SkillMenu"
|
||||||
|
|
Loading…
Reference in a new issue