- turned all menu items into actual objects.

This is needed for script export.
This commit is contained in:
Christoph Oelckers 2017-02-03 21:34:49 +01:00
commit d5962b290c
12 changed files with 499 additions and 372 deletions

View file

@ -104,16 +104,16 @@ CUSTOM_CVAR (Bool, vid_tft, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
FOptionMenuDescriptor *opt = GetVideoModeMenu();
if (opt != NULL)
{
FOptionMenuItem *it = opt->GetItem("menu_screenratios");
DOptionMenuItem *it = opt->GetItem("menu_screenratios");
if (it != NULL)
{
if (self)
{
it->SetString(FOptionMenuItemOptionBase::OP_VALUES, "RatiosTFT");
it->SetString(DOptionMenuItemOptionBase::OP_VALUES, "RatiosTFT");
}
else
{
it->SetString(FOptionMenuItemOptionBase::OP_VALUES, "Ratios");
it->SetString(DOptionMenuItemOptionBase::OP_VALUES, "Ratios");
}
}
}
@ -148,9 +148,9 @@ public:
mDesc->mSelectedItem < (int)mDesc->mItems.Size())
{
int sel;
bool selected = mDesc->mItems[mDesc->mSelectedItem]->GetValue(FOptionMenuScreenResolutionLine::SRL_SELECTION, &sel);
bool selected = mDesc->mItems[mDesc->mSelectedItem]->GetValue(DOptionMenuScreenResolutionLine::SRL_SELECTION, &sel);
bool res = Super::MenuEvent(mkey, fromcontroller);
if (selected) mDesc->mItems[mDesc->mSelectedItem]->SetValue(FOptionMenuScreenResolutionLine::SRL_SELECTION, sel);
if (selected) mDesc->mItems[mDesc->mSelectedItem]->SetValue(DOptionMenuScreenResolutionLine::SRL_SELECTION, sel);
return res;
}
return Super::MenuEvent(mkey, fromcontroller);
@ -236,10 +236,10 @@ static void BuildModesList (int hiwidth, int hiheight, int hi_bits)
{
for (i = NAME_res_0; i<= NAME_res_9; i++)
{
FOptionMenuItem *it = opt->GetItem((ENamedName)i);
DOptionMenuItem *it = opt->GetItem((ENamedName)i);
if (it != NULL)
{
it->SetValue(FOptionMenuScreenResolutionLine::SRL_HIGHLIGHT, -1);
it->SetValue(DOptionMenuScreenResolutionLine::SRL_HIGHLIGHT, -1);
for (c = 0; c < 3; c++)
{
bool haveMode = false;
@ -260,16 +260,16 @@ static void BuildModesList (int hiwidth, int hiheight, int hi_bits)
{
if (width == hiwidth && height == hiheight)
{
it->SetValue(FOptionMenuScreenResolutionLine::SRL_SELECTION, c);
it->SetValue(FOptionMenuScreenResolutionLine::SRL_HIGHLIGHT, c);
it->SetValue(DOptionMenuScreenResolutionLine::SRL_SELECTION, c);
it->SetValue(DOptionMenuScreenResolutionLine::SRL_HIGHLIGHT, c);
}
mysnprintf (strtemp, countof(strtemp), "%dx%d%s", width, height, letterbox?TEXTCOLOR_BROWN" LB":"");
it->SetString(FOptionMenuScreenResolutionLine::SRL_INDEX+c, strtemp);
it->SetString(DOptionMenuScreenResolutionLine::SRL_INDEX+c, strtemp);
}
else
{
it->SetString(FOptionMenuScreenResolutionLine::SRL_INDEX+c, "");
it->SetString(DOptionMenuScreenResolutionLine::SRL_INDEX+c, "");
}
}
}
@ -359,12 +359,12 @@ static bool GetSelectedSize (int *width, int *height)
{
int line = opt->mSelectedItem;
int hsel;
FOptionMenuItem *it = opt->mItems[line];
if (it->GetValue(FOptionMenuScreenResolutionLine::SRL_SELECTION, &hsel))
DOptionMenuItem *it = opt->mItems[line];
if (it->GetValue(DOptionMenuScreenResolutionLine::SRL_SELECTION, &hsel))
{
char buffer[32];
char *breakpt;
if (it->GetString(FOptionMenuScreenResolutionLine::SRL_INDEX+hsel, buffer, sizeof(buffer)))
if (it->GetString(DOptionMenuScreenResolutionLine::SRL_INDEX+hsel, buffer, sizeof(buffer)))
{
*width = (int)strtoll (buffer, &breakpt, 10);
*height = (int)strtoll (breakpt+1, NULL, 10);
@ -423,7 +423,7 @@ static void SetModesMenu (int w, int h, int bits)
FOptionMenuDescriptor *opt = GetVideoModeMenu();
if (opt != NULL)
{
FOptionMenuItem *it;
DOptionMenuItem *it;
if (testingmode <= 1)
{
it = opt->GetItem(NAME_VMEnterText);