- turned all menu items into actual objects.
This is needed for script export.
This commit is contained in:
parent
c6e42d6fa0
commit
d5962b290c
12 changed files with 499 additions and 372 deletions
|
|
@ -294,7 +294,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
sc.MustGetString();
|
||||
FTextureID tex = GetMenuTexture(sc.String);
|
||||
|
||||
FListMenuItem *it = new FListMenuItemStaticPatch(x, y, tex, centered);
|
||||
DListMenuItem *it = new DListMenuItemStaticPatch(x, y, tex, centered);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("StaticText") || sc.Compare("StaticTextCentered"))
|
||||
|
|
@ -315,7 +315,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
cr = V_FindFontColor(sc.String);
|
||||
if (cr == CR_UNTRANSLATED && !sc.Compare("untranslated")) cr = desc->mFontColor;
|
||||
}
|
||||
FListMenuItem *it = new FListMenuItemStaticText(x, y, label, desc->mFont, cr, centered);
|
||||
DListMenuItem *it = new DListMenuItemStaticText(x, y, label, desc->mFont, cr, centered);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("PatchItem"))
|
||||
|
|
@ -335,7 +335,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
param = sc.Number;
|
||||
}
|
||||
|
||||
FListMenuItem *it = new FListMenuItemPatch(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, tex, action, param);
|
||||
DListMenuItem *it = new DListMenuItemPatch(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, tex, action, param);
|
||||
desc->mItems.Push(it);
|
||||
desc->mYpos += desc->mLinespacing;
|
||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||
|
|
@ -357,7 +357,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
param = sc.Number;
|
||||
}
|
||||
|
||||
FListMenuItem *it = new FListMenuItemText(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, param);
|
||||
DListMenuItem *it = new DListMenuItemText(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, param);
|
||||
desc->mItems.Push(it);
|
||||
desc->mYpos += desc->mLinespacing;
|
||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||
|
|
@ -414,7 +414,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
action = sc.String;
|
||||
}
|
||||
}
|
||||
FListMenuItemPlayerDisplay *it = new FListMenuItemPlayerDisplay(desc, x, y, c1, c2, noportrait, action);
|
||||
DListMenuItemPlayerDisplay *it = new DListMenuItemPlayerDisplay(desc, x, y, c1, c2, noportrait, action);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("PlayerNameBox"))
|
||||
|
|
@ -426,7 +426,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
int ofs = sc.Number;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FListMenuItem *it = new FPlayerNameBox(desc->mXpos, desc->mYpos, desc->mLinespacing, ofs, text, desc->mFont, desc->mFontColor, sc.String);
|
||||
DListMenuItem *it = new DPlayerNameBox(desc->mXpos, desc->mYpos, desc->mLinespacing, ofs, text, desc->mFont, desc->mFontColor, sc.String);
|
||||
desc->mItems.Push(it);
|
||||
desc->mYpos += desc->mLinespacing;
|
||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||
|
|
@ -444,7 +444,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
sc.MustGetString();
|
||||
values = sc.String;
|
||||
}
|
||||
FListMenuItem *it = new FValueTextItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, values);
|
||||
DListMenuItem *it = new DValueTextItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, values);
|
||||
desc->mItems.Push(it);
|
||||
desc->mYpos += desc->mLinespacing;
|
||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||
|
|
@ -465,7 +465,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
sc.MustGetStringName(",");
|
||||
sc.MustGetNumber();
|
||||
int step = sc.Number;
|
||||
FListMenuItem *it = new FSliderItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, action, min, max, step);
|
||||
DListMenuItem *it = new DSliderItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, action, min, max, step);
|
||||
desc->mItems.Push(it);
|
||||
desc->mYpos += desc->mLinespacing;
|
||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||
|
|
@ -739,7 +739,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FOptionMenuItem *it = new FOptionMenuItemSubmenu(label, sc.String);
|
||||
DOptionMenuItem *it = new DOptionMenuItemSubmenu(label, sc.String);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("Option"))
|
||||
|
|
@ -764,7 +764,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
center = sc.Number;
|
||||
}
|
||||
}
|
||||
FOptionMenuItem *it = new FOptionMenuItemOption(label, cvar, values, check, center);
|
||||
DOptionMenuItem *it = new DOptionMenuItemOption(label, cvar, values, check, center);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("Command"))
|
||||
|
|
@ -773,7 +773,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FOptionMenuItem *it = new FOptionMenuItemCommand(label, sc.String);
|
||||
DOptionMenuItem *it = new DOptionMenuItemCommand(label, sc.String);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("SafeCommand"))
|
||||
|
|
@ -790,7 +790,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
sc.MustGetString();
|
||||
prompt = sc.String;
|
||||
}
|
||||
FOptionMenuItem *it = new FOptionMenuItemSafeCommand(label, command, prompt);
|
||||
DOptionMenuItem *it = new DOptionMenuItemSafeCommand(label, command, prompt);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("Control") || sc.Compare("MapControl"))
|
||||
|
|
@ -800,7 +800,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FOptionMenuItem *it = new FOptionMenuItemControl(label, sc.String, map? &AutomapBindings : &Bindings);
|
||||
DOptionMenuItem *it = new DOptionMenuItemControl(label, sc.String, map? &AutomapBindings : &Bindings);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("ColorPicker"))
|
||||
|
|
@ -809,7 +809,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FOptionMenuItem *it = new FOptionMenuItemColorPicker(label, sc.String);
|
||||
DOptionMenuItem *it = new DOptionMenuItemColorPicker(label, sc.String);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("StaticText"))
|
||||
|
|
@ -817,7 +817,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
EColorRange cr = ParseOptionColor(sc, desc);
|
||||
FOptionMenuItem *it = new FOptionMenuItemStaticText(label, cr);
|
||||
DOptionMenuItem *it = new DOptionMenuItemStaticText(label, cr);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("StaticTextSwitchable"))
|
||||
|
|
@ -831,7 +831,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
sc.MustGetString();
|
||||
FName action = sc.String;
|
||||
EColorRange cr = ParseOptionColor(sc, desc);
|
||||
FOptionMenuItem *it = new FOptionMenuItemStaticTextSwitchable(label, label2, action, cr);
|
||||
DOptionMenuItem *it = new DOptionMenuItemStaticTextSwitchable(label, label2, action, cr);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("Slider"))
|
||||
|
|
@ -856,13 +856,13 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
sc.MustGetNumber();
|
||||
showvalue = sc.Number;
|
||||
}
|
||||
FOptionMenuItem *it = new FOptionMenuSliderCVar(text, action, min, max, step, showvalue);
|
||||
DOptionMenuItem *it = new DOptionMenuSliderCVar(text, action, min, max, step, showvalue);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("screenresolution"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FOptionMenuItem *it = new FOptionMenuScreenResolutionLine(sc.String);
|
||||
DOptionMenuItem *it = new DOptionMenuScreenResolutionLine(sc.String);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
// [TP] -- Text input widget
|
||||
|
|
@ -881,7 +881,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
check = sc.String;
|
||||
}
|
||||
|
||||
FOptionMenuItem* it = new FOptionMenuTextField( label, cvar, check );
|
||||
DOptionMenuItem* it = new DOptionMenuTextField( label, cvar, check );
|
||||
desc->mItems.Push( it );
|
||||
}
|
||||
// [TP] -- Number input widget
|
||||
|
|
@ -918,7 +918,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
}
|
||||
}
|
||||
|
||||
FOptionMenuItem* it = new FOptionMenuNumberField( label, cvar,
|
||||
DOptionMenuItem* it = new DOptionMenuNumberField( label, cvar,
|
||||
minimum, maximum, step, check );
|
||||
desc->mItems.Push( it );
|
||||
}
|
||||
|
|
@ -1081,16 +1081,16 @@ static void BuildEpisodeMenu()
|
|||
ld->mSelectedItem = ld->mItems.Size();
|
||||
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
||||
{
|
||||
FListMenuItem *it;
|
||||
DListMenuItem *it;
|
||||
if (AllEpisodes[i].mPicName.IsNotEmpty())
|
||||
{
|
||||
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
||||
it = new FListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
||||
it = new DListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
||||
tex, NAME_Skillmenu, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
it = new FListMenuItemText(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
||||
it = new DListMenuItemText(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
||||
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
|
||||
}
|
||||
ld->mItems.Push(it);
|
||||
|
|
@ -1123,7 +1123,7 @@ static void BuildEpisodeMenu()
|
|||
od->mDontDim = false;
|
||||
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
||||
{
|
||||
FOptionMenuItemSubmenu *it = new FOptionMenuItemSubmenu(AllEpisodes[i].mEpisodeName, "Skillmenu", i);
|
||||
DOptionMenuItemSubmenu *it = new DOptionMenuItemSubmenu(AllEpisodes[i].mEpisodeName, "Skillmenu", i);
|
||||
od->mItems.Push(it);
|
||||
}
|
||||
}
|
||||
|
|
@ -1179,7 +1179,7 @@ static void BuildPlayerclassMenu()
|
|||
if (numclassitems <= 1)
|
||||
{
|
||||
// create a dummy item that auto-chooses the default class.
|
||||
FListMenuItemText *it = new FListMenuItemText(0, 0, 0, 'p', "player",
|
||||
DListMenuItemText *it = new DListMenuItemText(0, 0, 0, 'p', "player",
|
||||
ld->mFont,ld->mFontColor, ld->mFontColor2, NAME_Episodemenu, -1000);
|
||||
ld->mAutoselect = ld->mItems.Push(it);
|
||||
success = true;
|
||||
|
|
@ -1205,7 +1205,7 @@ static void BuildPlayerclassMenu()
|
|||
const char *pname = GetPrintableDisplayName(PlayerClasses[i].Type);
|
||||
if (pname != NULL)
|
||||
{
|
||||
FListMenuItemText *it = new FListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, *pname,
|
||||
DListMenuItemText *it = new DListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, *pname,
|
||||
pname, ld->mFont,ld->mFontColor,ld->mFontColor2, NAME_Episodemenu, i);
|
||||
ld->mItems.Push(it);
|
||||
ld->mYpos += ld->mLinespacing;
|
||||
|
|
@ -1215,7 +1215,7 @@ static void BuildPlayerclassMenu()
|
|||
}
|
||||
if (n > 1 && !gameinfo.norandomplayerclass)
|
||||
{
|
||||
FListMenuItemText *it = new FListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, 'r',
|
||||
DListMenuItemText *it = new DListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, 'r',
|
||||
"$MNU_RANDOM", ld->mFont,ld->mFontColor,ld->mFontColor2, NAME_Episodemenu, -1);
|
||||
ld->mItems.Push(it);
|
||||
}
|
||||
|
|
@ -1224,7 +1224,7 @@ static void BuildPlayerclassMenu()
|
|||
const char *pname = GetPrintableDisplayName(PlayerClasses[0].Type);
|
||||
if (pname != NULL)
|
||||
{
|
||||
FListMenuItemText *it = new FListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, *pname,
|
||||
DListMenuItemText *it = new DListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, *pname,
|
||||
pname, ld->mFont,ld->mFontColor,ld->mFontColor2, NAME_Episodemenu, 0);
|
||||
ld->mItems.Push(it);
|
||||
}
|
||||
|
|
@ -1259,12 +1259,12 @@ static void BuildPlayerclassMenu()
|
|||
const char *pname = GetPrintableDisplayName(PlayerClasses[i].Type);
|
||||
if (pname != NULL)
|
||||
{
|
||||
FOptionMenuItemSubmenu *it = new FOptionMenuItemSubmenu(pname, "Episodemenu", i);
|
||||
DOptionMenuItemSubmenu *it = new DOptionMenuItemSubmenu(pname, "Episodemenu", i);
|
||||
od->mItems.Push(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
FOptionMenuItemSubmenu *it = new FOptionMenuItemSubmenu("Random", "Episodemenu", -1);
|
||||
DOptionMenuItemSubmenu *it = new DOptionMenuItemSubmenu("Random", "Episodemenu", -1);
|
||||
od->mItems.Push(it);
|
||||
}
|
||||
}
|
||||
|
|
@ -1344,14 +1344,14 @@ static void InitKeySections()
|
|||
for (unsigned i = 0; i < KeySections.Size(); i++)
|
||||
{
|
||||
FKeySection *sect = &KeySections[i];
|
||||
FOptionMenuItem *item = new FOptionMenuItemStaticText(" ", false);
|
||||
DOptionMenuItem *item = new DOptionMenuItemStaticText(" ", false);
|
||||
menu->mItems.Push(item);
|
||||
item = new FOptionMenuItemStaticText(sect->mTitle, true);
|
||||
item = new DOptionMenuItemStaticText(sect->mTitle, true);
|
||||
menu->mItems.Push(item);
|
||||
for (unsigned j = 0; j < sect->mActions.Size(); j++)
|
||||
{
|
||||
FKeyAction *act = §->mActions[j];
|
||||
item = new FOptionMenuItemControl(act->mTitle, act->mAction, &Bindings);
|
||||
item = new DOptionMenuItemControl(act->mTitle, act->mAction, &Bindings);
|
||||
menu->mItems.Push(item);
|
||||
}
|
||||
}
|
||||
|
|
@ -1410,10 +1410,6 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
|||
FName n = ld->mItems[i]->GetAction(NULL);
|
||||
if (n == NAME_Startgame || n == NAME_StartgameConfirm)
|
||||
{
|
||||
for(unsigned j=i; j<ld->mItems.Size(); j++)
|
||||
{
|
||||
delete ld->mItems[j];
|
||||
}
|
||||
ld->mItems.Resize(i);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1469,7 +1465,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
|||
for(unsigned int i = 0; i < AllSkills.Size(); i++)
|
||||
{
|
||||
FSkillInfo &skill = AllSkills[i];
|
||||
FListMenuItem *li;
|
||||
DListMenuItem *li;
|
||||
// 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;
|
||||
|
|
@ -1482,13 +1478,13 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
|||
if (skill.PicName.Len() != 0 && pItemText == NULL)
|
||||
{
|
||||
FTextureID tex = GetMenuTexture(skill.PicName);
|
||||
li = new FListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, i);
|
||||
li = new DListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
EColorRange color = (EColorRange)skill.GetTextColor();
|
||||
if (color == CR_UNTRANSLATED) color = ld->mFontColor;
|
||||
li = new FListMenuItemText(x, y, ld->mLinespacing, skill.Shortcut,
|
||||
li = new DListMenuItemText(x, y, ld->mLinespacing, skill.Shortcut,
|
||||
pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, i);
|
||||
}
|
||||
ld->mItems.Push(li);
|
||||
|
|
@ -1528,16 +1524,12 @@ fail:
|
|||
else
|
||||
{
|
||||
od = static_cast<FOptionMenuDescriptor*>(*desc);
|
||||
for(unsigned i=0;i<od->mItems.Size(); i++)
|
||||
{
|
||||
delete od->mItems[i];
|
||||
}
|
||||
od->mItems.Clear();
|
||||
}
|
||||
for(unsigned int i = 0; i < AllSkills.Size(); i++)
|
||||
{
|
||||
FSkillInfo &skill = AllSkills[i];
|
||||
FOptionMenuItem *li;
|
||||
DOptionMenuItem *li;
|
||||
// Using a different name for skills that must be confirmed makes handling this easier.
|
||||
const char *action = (skill.MustConfirm && !AllEpisodes[gs->Episode].mNoSkill) ?
|
||||
"StartgameConfirm" : "Startgame";
|
||||
|
|
@ -1547,7 +1539,7 @@ fail:
|
|||
{
|
||||
pItemText = skill.MenuNamesForPlayerClass.CheckKey(gs->PlayerClass);
|
||||
}
|
||||
li = new FOptionMenuItemSubmenu(pItemText? *pItemText : skill.MenuName, action, i);
|
||||
li = new DOptionMenuItemSubmenu(pItemText? *pItemText : skill.MenuName, action, i);
|
||||
od->mItems.Push(li);
|
||||
if (!done)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue