- removed native option menu controls. Note that this commit will not compile!

This commit is contained in:
Christoph Oelckers 2017-02-11 21:28:48 +01:00
commit 2a5b26c27c
12 changed files with 229 additions and 1724 deletions

View file

@ -101,19 +101,21 @@ CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE)
CUSTOM_CVAR (Bool, vid_tft, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
const int OptionMenuItemOptionBase_OP_VALUES = 0x11001;
DOptionMenuDescriptor *opt = GetVideoModeMenu();
if (opt != NULL)
{
DOptionMenuItem *it = opt->GetItem("menu_screenratios");
DMenuItemBase *it = opt->GetItem("menu_screenratios");
if (it != NULL)
{
if (self)
{
it->SetString(DOptionMenuItemOptionBase_::OP_VALUES, "RatiosTFT");
it->SetString(OptionMenuItemOptionBase_OP_VALUES, "RatiosTFT");
}
else
{
it->SetString(DOptionMenuItemOptionBase_::OP_VALUES, "Ratios");
it->SetString(OptionMenuItemOptionBase_OP_VALUES, "Ratios");
}
}
}
@ -131,6 +133,15 @@ CUSTOM_CVAR (Bool, vid_tft, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
//
//=============================================================================
struct OptionMenuItemScreenResolution // temporary workaround
{
enum EValues
{
SRL_INDEX = 0x30000,
SRL_SELECTION = 0x30003,
SRL_HIGHLIGHT = 0x30004,
};
};
class DVideoModeMenu : public DOptionMenu
{
DECLARE_CLASS(DVideoModeMenu, DOptionMenu)
@ -148,9 +159,9 @@ public:
mDesc->mSelectedItem < (int)mDesc->mItems.Size())
{
int sel;
bool selected = mDesc->mItems[mDesc->mSelectedItem]->GetValue(DOptionMenuScreenResolutionLine_::SRL_SELECTION, &sel);
bool selected = mDesc->mItems[mDesc->mSelectedItem]->GetValue(OptionMenuItemScreenResolution::SRL_SELECTION, &sel);
bool res = Super::MenuEvent(mkey, fromcontroller);
if (selected) mDesc->mItems[mDesc->mSelectedItem]->SetValue(DOptionMenuScreenResolutionLine_::SRL_SELECTION, sel);
if (selected) mDesc->mItems[mDesc->mSelectedItem]->SetValue(OptionMenuItemScreenResolution::SRL_SELECTION, sel);
return res;
}
return Super::MenuEvent(mkey, fromcontroller);
@ -236,10 +247,10 @@ static void BuildModesList (int hiwidth, int hiheight, int hi_bits)
{
for (i = NAME_res_0; i<= NAME_res_9; i++)
{
DOptionMenuItem *it = opt->GetItem((ENamedName)i);
DMenuItemBase *it = opt->GetItem((ENamedName)i);
if (it != NULL)
{
it->SetValue(DOptionMenuScreenResolutionLine_::SRL_HIGHLIGHT, -1);
it->SetValue(OptionMenuItemScreenResolution::SRL_HIGHLIGHT, -1);
for (c = 0; c < 3; c++)
{
bool haveMode = false;
@ -260,16 +271,16 @@ static void BuildModesList (int hiwidth, int hiheight, int hi_bits)
{
if (width == hiwidth && height == hiheight)
{
it->SetValue(DOptionMenuScreenResolutionLine_::SRL_SELECTION, c);
it->SetValue(DOptionMenuScreenResolutionLine_::SRL_HIGHLIGHT, c);
it->SetValue(OptionMenuItemScreenResolution::SRL_SELECTION, c);
it->SetValue(OptionMenuItemScreenResolution::SRL_HIGHLIGHT, c);
}
mysnprintf (strtemp, countof(strtemp), "%dx%d%s", width, height, letterbox?TEXTCOLOR_BROWN" LB":"");
it->SetString(DOptionMenuScreenResolutionLine_::SRL_INDEX+c, strtemp);
it->SetString(OptionMenuItemScreenResolution::SRL_INDEX+c, strtemp);
}
else
{
it->SetString(DOptionMenuScreenResolutionLine_::SRL_INDEX+c, "");
it->SetString(OptionMenuItemScreenResolution::SRL_INDEX+c, "");
}
}
}
@ -359,12 +370,12 @@ static bool GetSelectedSize (int *width, int *height)
{
int line = opt->mSelectedItem;
int hsel;
DOptionMenuItem *it = opt->mItems[line];
if (it->GetValue(DOptionMenuScreenResolutionLine_::SRL_SELECTION, &hsel))
DMenuItemBase *it = opt->mItems[line];
if (it->GetValue(OptionMenuItemScreenResolution::SRL_SELECTION, &hsel))
{
char buffer[32];
char *breakpt;
if (it->GetString(DOptionMenuScreenResolutionLine_::SRL_INDEX+hsel, buffer, sizeof(buffer)))
if (it->GetString(OptionMenuItemScreenResolution::SRL_INDEX+hsel, buffer, sizeof(buffer)))
{
*width = (int)strtoll (buffer, &breakpt, 10);
*height = (int)strtoll (breakpt+1, NULL, 10);
@ -428,7 +439,7 @@ static void SetModesMenu (int w, int h, int bits)
DOptionMenuDescriptor *opt = GetVideoModeMenu();
if (opt != NULL)
{
DOptionMenuItem *it;
DMenuItemBase *it;
if (testingmode <= 1)
{
it = opt->GetItem(NAME_VMEnterText);