mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- removed native option menu controls. Note that this commit will not compile!
This commit is contained in:
parent
fc4e1ffcdf
commit
2a5b26c27c
12 changed files with 236 additions and 1731 deletions
|
@ -2523,7 +2523,10 @@ void D_DoomMain (void)
|
|||
|
||||
// Create replacements for dehacked pickups
|
||||
FinishDehPatch();
|
||||
|
||||
|
||||
if (!batchrun) Printf("M_Init: Init menus.\n");
|
||||
M_Init();
|
||||
|
||||
// clean up the compiler symbols which are not needed any longer.
|
||||
RemoveUnusedSymbols();
|
||||
|
||||
|
@ -2541,9 +2544,6 @@ void D_DoomMain (void)
|
|||
bglobal.spawn_tries = 0;
|
||||
bglobal.wanted_botnum = bglobal.getspawned.Size();
|
||||
|
||||
if (!batchrun) Printf ("M_Init: Init menus.\n");
|
||||
M_Init ();
|
||||
|
||||
if (!batchrun) Printf ("P_Init: Init Playloop state.\n");
|
||||
StartScreen->LoadingStatus ("Init game engine", 0x3f);
|
||||
AM_StaticInit();
|
||||
|
|
|
@ -81,14 +81,14 @@ public:
|
|||
// This menu uses some featurs that are hard to implement in an external control lump
|
||||
// so it creates its own list of menu items.
|
||||
desc->mItems.Resize(mStartItem+8);
|
||||
desc->mItems[mStartItem+0] = new DOptionMenuItemStaticText_(name, false);
|
||||
desc->mItems[mStartItem+1] = new DOptionMenuItemStaticText_(" ", false);
|
||||
desc->mItems[mStartItem+2] = new DOptionMenuSliderVar_("Red", &mRed, 0, 255, 15, 0);
|
||||
desc->mItems[mStartItem+3] = new DOptionMenuSliderVar_("Green", &mGreen, 0, 255, 15, 0);
|
||||
desc->mItems[mStartItem+4] = new DOptionMenuSliderVar_("Blue", &mBlue, 0, 255, 15, 0);
|
||||
desc->mItems[mStartItem+5] = new DOptionMenuItemStaticText_(" ", false);
|
||||
desc->mItems[mStartItem+6] = new DOptionMenuItemCommand_("Undo changes", "undocolorpic");
|
||||
desc->mItems[mStartItem+7] = new DOptionMenuItemStaticText_(" ", false);
|
||||
desc->mItems[mStartItem+0] = CreateOptionMenuItemStaticText(name, false);
|
||||
desc->mItems[mStartItem+1] = CreateOptionMenuItemStaticText(" ", false);
|
||||
desc->mItems[mStartItem+2] = CreateOptionMenuSliderVar("Red", 0, 0, 255, 15, 0);
|
||||
desc->mItems[mStartItem+3] = CreateOptionMenuSliderVar("Green", 1, 0, 255, 15, 0);
|
||||
desc->mItems[mStartItem+4] = CreateOptionMenuSliderVar("Blue", 2, 0, 255, 15, 0);
|
||||
desc->mItems[mStartItem+5] = CreateOptionMenuItemStaticText(" ", false);
|
||||
desc->mItems[mStartItem+6] = CreateOptionMenuItemCommand("Undo changes", "undocolorpic");
|
||||
desc->mItems[mStartItem+7] = CreateOptionMenuItemStaticText(" ", false);
|
||||
for (auto &p : desc->mItems)
|
||||
{
|
||||
GC::WriteBarrier(p);
|
||||
|
|
|
@ -128,177 +128,6 @@ DEFINE_ACTION_FUNCTION(IJoystickConfig, SetAxisMap)
|
|||
|
||||
DOptionMenuDescriptor *UpdateJoystickConfigMenu(IJoystickConfig *joy);
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class DOptionMenuSliderJoySensitivity_ : public DOptionMenuSliderBase_
|
||||
{
|
||||
public:
|
||||
DOptionMenuSliderJoySensitivity_(const char *label, double min, double max, double step, int showval)
|
||||
: DOptionMenuSliderBase_(label, min, max, step, showval)
|
||||
{
|
||||
}
|
||||
|
||||
double GetSliderValue()
|
||||
{
|
||||
return SELECTED_JOYSTICK->GetSensitivity();
|
||||
}
|
||||
|
||||
void SetSliderValue(double val)
|
||||
{
|
||||
SELECTED_JOYSTICK->SetSensitivity(float(val));
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class DOptionMenuSliderJoyScale_ : public DOptionMenuSliderBase_
|
||||
{
|
||||
int mAxis;
|
||||
int mNeg;
|
||||
|
||||
public:
|
||||
DOptionMenuSliderJoyScale_(const char *label, int axis, double min, double max, double step, int showval)
|
||||
: DOptionMenuSliderBase_(label, min, max, step, showval)
|
||||
{
|
||||
mAxis = axis;
|
||||
mNeg = 1;
|
||||
}
|
||||
|
||||
double GetSliderValue()
|
||||
{
|
||||
double d = SELECTED_JOYSTICK->GetAxisScale(mAxis);
|
||||
mNeg = d < 0? -1:1;
|
||||
return d;
|
||||
}
|
||||
|
||||
void SetSliderValue(double val)
|
||||
{
|
||||
SELECTED_JOYSTICK->SetAxisScale(mAxis, float(val * mNeg));
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class DOptionMenuSliderJoyDeadZone_ : public DOptionMenuSliderBase_
|
||||
{
|
||||
int mAxis;
|
||||
int mNeg;
|
||||
|
||||
public:
|
||||
DOptionMenuSliderJoyDeadZone_(const char *label, int axis, double min, double max, double step, int showval)
|
||||
: DOptionMenuSliderBase_(label, min, max, step, showval)
|
||||
{
|
||||
mAxis = axis;
|
||||
mNeg = 1;
|
||||
}
|
||||
|
||||
double GetSliderValue()
|
||||
{
|
||||
double d = SELECTED_JOYSTICK->GetAxisDeadZone(mAxis);
|
||||
mNeg = d < 0? -1:1;
|
||||
return d;
|
||||
}
|
||||
|
||||
void SetSliderValue(double val)
|
||||
{
|
||||
SELECTED_JOYSTICK->SetAxisDeadZone(mAxis, float(val * mNeg));
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class DOptionMenuItemJoyMap_ : public DOptionMenuItemOptionBase_
|
||||
{
|
||||
int mAxis;
|
||||
public:
|
||||
|
||||
DOptionMenuItemJoyMap_(const char *label, int axis, const char *values, int center)
|
||||
: DOptionMenuItemOptionBase_(label, "none", values, NULL, center)
|
||||
{
|
||||
mAxis = axis;
|
||||
}
|
||||
|
||||
int GetSelection()
|
||||
{
|
||||
double f = SELECTED_JOYSTICK->GetAxisMap(mAxis);
|
||||
FOptionValues **opt = OptionValues.CheckKey(mValues);
|
||||
if (opt != NULL && *opt != NULL)
|
||||
{
|
||||
// Map from joystick axis to menu selection.
|
||||
for(unsigned i = 0; i < (*opt)->mValues.Size(); i++)
|
||||
{
|
||||
if (fabs(f - (*opt)->mValues[i].Value) < FLT_EPSILON)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void SetSelection(int selection)
|
||||
{
|
||||
FOptionValues **opt = OptionValues.CheckKey(mValues);
|
||||
// Map from menu selection to joystick axis.
|
||||
if (opt == NULL || *opt == NULL || (unsigned)selection >= (*opt)->mValues.Size())
|
||||
{
|
||||
selection = JOYAXIS_None;
|
||||
}
|
||||
else
|
||||
{
|
||||
selection = (int)(*opt)->mValues[selection].Value;
|
||||
}
|
||||
SELECTED_JOYSTICK->SetAxisMap(mAxis, (EJoyAxis)selection);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class DOptionMenuItemInverter_ : public DOptionMenuItemOptionBase_
|
||||
{
|
||||
int mAxis;
|
||||
public:
|
||||
|
||||
DOptionMenuItemInverter_(const char *label, int axis, int center)
|
||||
: DOptionMenuItemOptionBase_(label, "none", "YesNo", NULL, center)
|
||||
{
|
||||
mAxis = axis;
|
||||
}
|
||||
|
||||
int GetSelection()
|
||||
{
|
||||
float f = SELECTED_JOYSTICK->GetAxisScale(mAxis);
|
||||
return f > 0? 0:1;
|
||||
}
|
||||
|
||||
void SetSelection(int Selection)
|
||||
{
|
||||
float f = fabsf(SELECTED_JOYSTICK->GetAxisScale(mAxis));
|
||||
if (Selection) f*=-1;
|
||||
SELECTED_JOYSTICK->SetAxisScale(mAxis, f);
|
||||
}
|
||||
};
|
||||
|
||||
class DJoystickConfigMenu : public DOptionMenu
|
||||
{
|
||||
DECLARE_CLASS(DJoystickConfigMenu, DOptionMenu)
|
||||
|
@ -306,33 +135,6 @@ class DJoystickConfigMenu : public DOptionMenu
|
|||
|
||||
IMPLEMENT_CLASS(DJoystickConfigMenu, false, false)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Executes a CCMD, action is a CCMD name
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class DOptionMenuItemJoyConfigMenu_ : public DOptionMenuItemSubmenu_
|
||||
{
|
||||
DECLARE_CLASS(DOptionMenuItemJoyConfigMenu_, DOptionMenuItemSubmenu_)
|
||||
IJoystickConfig *mJoy;
|
||||
public:
|
||||
DOptionMenuItemJoyConfigMenu_(const char *label = nullptr, IJoystickConfig *joy = nullptr)
|
||||
: DOptionMenuItemSubmenu_(label, "JoystickConfigMenu")
|
||||
{
|
||||
mJoy = joy;
|
||||
}
|
||||
|
||||
bool Activate()
|
||||
{
|
||||
UpdateJoystickConfigMenu(mJoy);
|
||||
return DOptionMenuItemSubmenu_::Activate();
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DOptionMenuItemJoyConfigMenu_, false, false)
|
||||
|
||||
|
||||
/*=======================================
|
||||
*
|
||||
* Joystick Menu
|
||||
|
@ -345,12 +147,12 @@ DOptionMenuDescriptor *UpdateJoystickConfigMenu(IJoystickConfig *joy)
|
|||
if (desc != NULL && (*desc)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor)))
|
||||
{
|
||||
DOptionMenuDescriptor *opt = (DOptionMenuDescriptor *)*desc;
|
||||
DOptionMenuItem *it;
|
||||
DMenuItemBase *it;
|
||||
opt->mItems.Clear();
|
||||
if (joy == NULL)
|
||||
{
|
||||
opt->mTitle = "Configure Controller";
|
||||
it = new DOptionMenuItemStaticText_("Invalid controller specified for menu", false);
|
||||
it = CreateOptionMenuItemStaticText("Invalid controller specified for menu", false);
|
||||
opt->mItems.Push(it);
|
||||
}
|
||||
else
|
||||
|
@ -359,34 +161,34 @@ DOptionMenuDescriptor *UpdateJoystickConfigMenu(IJoystickConfig *joy)
|
|||
|
||||
SELECTED_JOYSTICK = joy;
|
||||
|
||||
it = new DOptionMenuSliderJoySensitivity_("Overall sensitivity", 0, 2, 0.1, 3);
|
||||
it = CreateOptionMenuSliderJoySensitivity("Overall sensitivity", 0, 2, 0.1, 3);
|
||||
opt->mItems.Push(it);
|
||||
it = new DOptionMenuItemStaticText_(" ", false);
|
||||
it = CreateOptionMenuItemStaticText(" ", false);
|
||||
opt->mItems.Push(it);
|
||||
|
||||
if (joy->GetNumAxes() > 0)
|
||||
{
|
||||
it = new DOptionMenuItemStaticText_("Axis Configuration", true);
|
||||
it = CreateOptionMenuItemStaticText("Axis Configuration", true);
|
||||
opt->mItems.Push(it);
|
||||
|
||||
for (int i = 0; i < joy->GetNumAxes(); ++i)
|
||||
{
|
||||
it = new DOptionMenuItemStaticText_(" ", false);
|
||||
it = CreateOptionMenuItemStaticText(" ", false);
|
||||
opt->mItems.Push(it);
|
||||
|
||||
it = new DOptionMenuItemJoyMap_(joy->GetAxisName(i), i, "JoyAxisMapNames", false);
|
||||
it = CreateOptionMenuItemJoyMap(joy->GetAxisName(i), i, "JoyAxisMapNames", false);
|
||||
opt->mItems.Push(it);
|
||||
it = new DOptionMenuSliderJoyScale_("Overall sensitivity", i, 0, 4, 0.1, 3);
|
||||
it = CreateOptionMenuSliderJoyScale("Overall sensitivity", i, 0, 4, 0.1, 3);
|
||||
opt->mItems.Push(it);
|
||||
it = new DOptionMenuItemInverter_("Invert", i, false);
|
||||
it = CreateOptionMenuItemInverter("Invert", i, false);
|
||||
opt->mItems.Push(it);
|
||||
it = new DOptionMenuSliderJoyDeadZone_("Dead Zone", i, 0, 0.9, 0.05, 3);
|
||||
it = CreateOptionMenuSliderJoyDeadZone("Dead Zone", i, 0, 0.9, 0.05, 3);
|
||||
opt->mItems.Push(it);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
it = new DOptionMenuItemStaticText_("No configurable axes", false);
|
||||
it = CreateOptionMenuItemStaticText("No configurable axes", false);
|
||||
opt->mItems.Push(it);
|
||||
}
|
||||
}
|
||||
|
@ -412,7 +214,7 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
|
|||
if (desc != NULL && (*desc)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor)))
|
||||
{
|
||||
DOptionMenuDescriptor *opt = (DOptionMenuDescriptor *)*desc;
|
||||
DOptionMenuItem *it;
|
||||
DMenuItemBase *it;
|
||||
opt->mItems.Clear();
|
||||
|
||||
int i;
|
||||
|
@ -436,40 +238,40 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
|
|||
}
|
||||
|
||||
// Todo: Block joystick for changing this one.
|
||||
it = new DOptionMenuItemOption_("Enable controller support", "use_joystick", "YesNo", NULL, false);
|
||||
it = CreateOptionMenuItemOption("Enable controller support", "use_joystick", "YesNo", NULL, false);
|
||||
opt->mItems.Push(it);
|
||||
#ifdef _WIN32
|
||||
it = new DOptionMenuItemOption_("Enable DirectInput controllers", "joy_dinput", "YesNo", NULL, false);
|
||||
it = CreateOptionMenuItemOption("Enable DirectInput controllers", "joy_dinput", "YesNo", NULL, false);
|
||||
opt->mItems.Push(it);
|
||||
it = new DOptionMenuItemOption_("Enable XInput controllers", "joy_xinput", "YesNo", NULL, false);
|
||||
it = CreateOptionMenuItemOption("Enable XInput controllers", "joy_xinput", "YesNo", NULL, false);
|
||||
opt->mItems.Push(it);
|
||||
it = new DOptionMenuItemOption_("Enable raw PlayStation 2 adapters", "joy_ps2raw", "YesNo", NULL, false);
|
||||
it = CreateOptionMenuItemOption("Enable raw PlayStation 2 adapters", "joy_ps2raw", "YesNo", NULL, false);
|
||||
opt->mItems.Push(it);
|
||||
#endif
|
||||
|
||||
it = new DOptionMenuItemStaticText_(" ", false);
|
||||
it = CreateOptionMenuItemStaticText(" ", false);
|
||||
opt->mItems.Push(it);
|
||||
|
||||
if (Joysticks.Size() == 0)
|
||||
{
|
||||
it = new DOptionMenuItemStaticText_("No controllers detected", false);
|
||||
it = CreateOptionMenuItemStaticText("No controllers detected", false);
|
||||
opt->mItems.Push(it);
|
||||
if (!use_joystick)
|
||||
{
|
||||
it = new DOptionMenuItemStaticText_("Controller support must be", false);
|
||||
it = CreateOptionMenuItemStaticText("Controller support must be", false);
|
||||
opt->mItems.Push(it);
|
||||
it = new DOptionMenuItemStaticText_("enabled to detect any", false);
|
||||
it = CreateOptionMenuItemStaticText("enabled to detect any", false);
|
||||
opt->mItems.Push(it);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
it = new DOptionMenuItemStaticText_("Configure controllers:", false);
|
||||
it = CreateOptionMenuItemStaticText("Configure controllers:", false);
|
||||
opt->mItems.Push(it);
|
||||
|
||||
for (int i = 0; i < (int)Joysticks.Size(); ++i)
|
||||
{
|
||||
it = new DOptionMenuItemJoyConfigMenu_(Joysticks[i]->GetName(), Joysticks[i]);
|
||||
it = CreateOptionMenuItemJoyConfigMenu(Joysticks[i]->GetName(), Joysticks[i]);
|
||||
opt->mItems.Push(it);
|
||||
if (i == itemnum) opt->mSelectedItem = opt->mItems.Size();
|
||||
}
|
||||
|
|
|
@ -1093,7 +1093,6 @@ CCMD(reset2saved)
|
|||
|
||||
//native void OptionMenuDescriptor.CalcIndent();
|
||||
//native OptionMenuItem OptionMenuDescriptor.GetItem(Name iname);
|
||||
//native void OptionMenuItem.drawLabel(int indent, int y, EColorRange color, bool grayed = false);
|
||||
|
||||
DEFINE_FIELD(DMenuDescriptor, mMenuName)
|
||||
DEFINE_FIELD(DMenuDescriptor, mNetgameMessage)
|
||||
|
@ -1131,8 +1130,8 @@ DEFINE_FIELD(DOptionMenuDescriptor, mIndent)
|
|||
DEFINE_FIELD(DOptionMenuDescriptor, mPosition)
|
||||
DEFINE_FIELD(DOptionMenuDescriptor, mDontDim)
|
||||
|
||||
DEFINE_FIELD(DOptionMenuItem, mLabel)
|
||||
DEFINE_FIELD(DOptionMenuItem, mCentered)
|
||||
//DEFINE_FIELD(DMenuItemBase, mLabel)
|
||||
//DEFINE_FIELD(DMenuItemBase, mCentered)
|
||||
|
||||
DEFINE_FIELD(DOptionMenu, CanScrollUp)
|
||||
DEFINE_FIELD(DOptionMenu, CanScrollDown)
|
||||
|
@ -1148,3 +1147,19 @@ DEFINE_FIELD(FOptionMenuSettings, mFontColorHeader)
|
|||
DEFINE_FIELD(FOptionMenuSettings, mFontColorHighlight)
|
||||
DEFINE_FIELD(FOptionMenuSettings, mFontColorSelection)
|
||||
DEFINE_FIELD(FOptionMenuSettings, mLinespacing)
|
||||
|
||||
|
||||
struct IJoystickConfig;
|
||||
DMenuItemBase * CreateOptionMenuItemStaticText(const char *name, bool v);
|
||||
DMenuItemBase * CreateOptionMenuSliderVar(const char *name, int index, double min, double max, double step, int showval);
|
||||
DMenuItemBase * CreateOptionMenuItemCommand(const char * label, FName cmd);
|
||||
DMenuItemBase * CreateOptionMenuItemOption(const char * label, FName cmd, FName values, FBaseCVar *graycheck, bool center);
|
||||
DMenuItemBase * CreateOptionMenuItemJoyConfigMenu(const char *label, IJoystickConfig *joy);
|
||||
DMenuItemBase * CreateOptionMenuItemJoyMap(const char *label, int axis, FName values, bool center);
|
||||
DMenuItemBase * CreateOptionMenuSliderJoySensitivity(const char * label, double min, double max, double step, int showval);
|
||||
DMenuItemBase * CreateOptionMenuSliderJoyScale(const char *label, int axis, double min, double max, double step, int showval);
|
||||
DMenuItemBase * CreateOptionMenuItemInverter(const char *label, int axis, int center);
|
||||
DMenuItemBase * CreateOptionMenuSliderJoyDeadZone(const char *label, int axis, double min, double max, double step, int showval);
|
||||
|
||||
DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int center);
|
||||
DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings);
|
||||
|
|
|
@ -118,7 +118,6 @@ public:
|
|||
};
|
||||
|
||||
class DMenuItemBase;
|
||||
class DOptionMenuItem;
|
||||
|
||||
class DListMenuDescriptor : public DMenuDescriptor
|
||||
{
|
||||
|
@ -176,7 +175,7 @@ class DOptionMenuDescriptor : public DMenuDescriptor
|
|||
DECLARE_CLASS(DOptionMenuDescriptor, DMenuDescriptor)
|
||||
|
||||
public:
|
||||
TArray<DOptionMenuItem *> mItems;
|
||||
TArray<DMenuItemBase *> mItems;
|
||||
FString mTitle;
|
||||
int mSelectedItem;
|
||||
int mDrawTop;
|
||||
|
@ -187,7 +186,7 @@ public:
|
|||
bool mDontDim;
|
||||
|
||||
void CalcIndent();
|
||||
DOptionMenuItem *GetItem(FName name);
|
||||
DMenuItemBase *GetItem(FName name);
|
||||
void Reset()
|
||||
{
|
||||
// Reset the default settings (ignore all other values in the struct)
|
||||
|
@ -330,11 +329,14 @@ public:
|
|||
virtual bool MouseEvent(int type, int x, int y);
|
||||
virtual bool CheckHotkey(int c);
|
||||
virtual int GetWidth();
|
||||
virtual int GetIndent() { return 0; }
|
||||
virtual int Draw(DOptionMenuDescriptor *desc, int y, int indent, bool selected) { return indent; }
|
||||
void DrawSelector(int xofs, int yofs, FTextureID tex);
|
||||
void OffsetPositionY(int ydelta) { mYpos += ydelta; }
|
||||
int GetY() { return mYpos; }
|
||||
int GetX() { return mXpos; }
|
||||
void SetX(int x) { mXpos = x; }
|
||||
|
||||
};
|
||||
|
||||
class DListMenuItemStaticPatch_ : public DMenuItemBase
|
||||
|
@ -598,16 +600,17 @@ public:
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
class DOptionMenuItem : public DMenuItemBase
|
||||
/*
|
||||
class DMenuItemBase : public DMenuItemBase
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DOptionMenuItem, DMenuItemBase)
|
||||
DECLARE_ABSTRACT_CLASS(DMenuItemBase, DMenuItemBase)
|
||||
public:
|
||||
FString mLabel;
|
||||
bool mCentered;
|
||||
|
||||
void drawLabel(int indent, int y, EColorRange color, bool grayed = false);
|
||||
|
||||
DOptionMenuItem(const char *text = nullptr, FName action = NAME_None, bool center = false)
|
||||
DMenuItemBase(const char *text = nullptr, FName action = NAME_None, bool center = false)
|
||||
: DMenuItemBase(0, 0, action)
|
||||
{
|
||||
mLabel = text;
|
||||
|
@ -618,7 +621,8 @@ public:
|
|||
virtual bool Selectable();
|
||||
virtual int GetIndent();
|
||||
virtual bool MouseEvent(int type, int x, int y);
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
|
@ -657,11 +661,11 @@ public: // needs to be public for script access
|
|||
bool CanScrollUp;
|
||||
bool CanScrollDown;
|
||||
int VisBottom;
|
||||
DOptionMenuItem *mFocusControl;
|
||||
DMenuItemBase *mFocusControl;
|
||||
DOptionMenuDescriptor *mDesc;
|
||||
|
||||
//public:
|
||||
DOptionMenuItem *GetItem(FName name);
|
||||
DMenuItemBase *GetItem(FName name);
|
||||
DOptionMenu(DMenu *parent = NULL, DOptionMenuDescriptor *desc = NULL);
|
||||
virtual void Init(DMenu *parent = NULL, DOptionMenuDescriptor *desc = NULL);
|
||||
int FirstSelectable();
|
||||
|
@ -671,11 +675,11 @@ public: // needs to be public for script access
|
|||
void Ticker ();
|
||||
void Drawer ();
|
||||
const DOptionMenuDescriptor *GetDescriptor() const { return mDesc; }
|
||||
void SetFocus(DOptionMenuItem *fc)
|
||||
void SetFocus(DMenuItemBase *fc)
|
||||
{
|
||||
mFocusControl = fc;
|
||||
}
|
||||
bool CheckFocus(DOptionMenuItem *fc)
|
||||
bool CheckFocus(DMenuItemBase *fc)
|
||||
{
|
||||
return mFocusControl == fc;
|
||||
}
|
||||
|
@ -745,4 +749,18 @@ void M_InitVideoModesMenu ();
|
|||
void M_MarkMenus();
|
||||
|
||||
|
||||
struct IJoystickConfig;
|
||||
DMenuItemBase * CreateOptionMenuItemStaticText(const char *name, bool v);
|
||||
DMenuItemBase * CreateOptionMenuSliderVar(const char *name, int index, double min, double max, double step, int showval);
|
||||
DMenuItemBase * CreateOptionMenuItemCommand(const char * label, FName cmd);
|
||||
DMenuItemBase * CreateOptionMenuItemOption(const char * label, FName cmd, FName values, FBaseCVar *graycheck, bool center);
|
||||
DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int center);
|
||||
DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings);
|
||||
DMenuItemBase * CreateOptionMenuItemJoyConfigMenu(const char *label, IJoystickConfig *joy);
|
||||
DMenuItemBase * CreateOptionMenuItemJoyMap(const char *label, int axis, FName values, bool center);
|
||||
DMenuItemBase * CreateOptionMenuSliderJoySensitivity(const char * label, double min, double max, double step, int showval);
|
||||
DMenuItemBase * CreateOptionMenuSliderJoyScale(const char *label, int axis, double min, double max, double step, int showval);
|
||||
DMenuItemBase * CreateOptionMenuItemInverter(const char *label, int axis, int center);
|
||||
DMenuItemBase * CreateOptionMenuSliderJoyDeadZone(const char *label, int axis, double min, double max, double step, int showval);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -785,198 +785,114 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc)
|
|||
sc.MustGetNumber();
|
||||
desc->mIndent = sc.Number;
|
||||
}
|
||||
else if (sc.Compare("Submenu"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
DOptionMenuItem *it = new DOptionMenuItemSubmenu_(label, sc.String);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("Option"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FString cvar = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FString values = sc.String;
|
||||
FString check;
|
||||
int center = 0;
|
||||
if (sc.CheckString(","))
|
||||
{
|
||||
sc.MustGetString();
|
||||
if (*sc.String != 0) check = sc.String;
|
||||
if (sc.CheckString(","))
|
||||
{
|
||||
sc.MustGetNumber();
|
||||
center = sc.Number;
|
||||
}
|
||||
}
|
||||
DOptionMenuItem *it = new DOptionMenuItemOption_(label, cvar, values, check, center);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("Command"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
DOptionMenuItem *it = new DOptionMenuItemCommand_(label, sc.String);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("SafeCommand"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FString command = sc.String;
|
||||
FString prompt;
|
||||
// Check for optional custom prompt
|
||||
if (sc.CheckString(","))
|
||||
{
|
||||
sc.MustGetString();
|
||||
prompt = sc.String;
|
||||
}
|
||||
DOptionMenuItem *it = new DOptionMenuItemSafeCommand_(label, command, prompt);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("Control") || sc.Compare("MapControl"))
|
||||
{
|
||||
bool map = sc.Compare("MapControl");
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
DOptionMenuItem *it = new DOptionMenuItemControl_(label, sc.String, map? &AutomapBindings : &Bindings);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("ColorPicker"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
DOptionMenuItem *it = new DOptionMenuItemColorPicker_(label, sc.String);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("StaticText"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
EColorRange cr = ParseOptionColor(sc, desc);
|
||||
DOptionMenuItem *it = new DOptionMenuItemStaticText_(label, cr);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("StaticTextSwitchable"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FString label2 = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FName action = sc.String;
|
||||
EColorRange cr = ParseOptionColor(sc, desc);
|
||||
DOptionMenuItem *it = new DOptionMenuItemStaticTextSwitchable_(label, label2, action, cr);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("Slider"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString text = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetString();
|
||||
FString action = sc.String;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetFloat();
|
||||
double min = sc.Float;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetFloat();
|
||||
double max = sc.Float;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetFloat();
|
||||
double step = sc.Float;
|
||||
int showvalue = 1;
|
||||
if (sc.CheckString(","))
|
||||
{
|
||||
sc.MustGetNumber();
|
||||
showvalue = sc.Number;
|
||||
}
|
||||
DOptionMenuItem *it = new DOptionMenuSliderCVar_(text, action, min, max, step, showvalue);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
else if (sc.Compare("screenresolution"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
DOptionMenuItem *it = new DOptionMenuScreenResolutionLine_(sc.String);
|
||||
desc->mItems.Push(it);
|
||||
}
|
||||
// [TP] -- Text input widget
|
||||
else if ( sc.Compare( "TextField" ))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
sc.MustGetStringName( "," );
|
||||
sc.MustGetString();
|
||||
FString cvar = sc.String;
|
||||
FString check;
|
||||
|
||||
if ( sc.CheckString( "," ))
|
||||
{
|
||||
sc.MustGetString();
|
||||
check = sc.String;
|
||||
}
|
||||
|
||||
DOptionMenuItem* it = new DOptionMenuTextField_( label, cvar, check );
|
||||
desc->mItems.Push( it );
|
||||
}
|
||||
// [TP] -- Number input widget
|
||||
else if ( sc.Compare( "NumberField" ))
|
||||
{
|
||||
sc.MustGetString();
|
||||
FString label = sc.String;
|
||||
sc.MustGetStringName( "," );
|
||||
sc.MustGetString();
|
||||
FString cvar = sc.String;
|
||||
float minimum = 0.0f;
|
||||
float maximum = 100.0f;
|
||||
float step = 1.0f;
|
||||
FString check;
|
||||
|
||||
if ( sc.CheckString( "," ))
|
||||
{
|
||||
sc.MustGetFloat();
|
||||
minimum = (float) sc.Float;
|
||||
sc.MustGetStringName( "," );
|
||||
sc.MustGetFloat();
|
||||
maximum = (float) sc.Float;
|
||||
|
||||
if ( sc.CheckString( "," ))
|
||||
{
|
||||
sc.MustGetFloat();
|
||||
step = (float) sc.Float;
|
||||
|
||||
if ( sc.CheckString( "," ))
|
||||
{
|
||||
sc.MustGetString();
|
||||
check = sc.String;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DOptionMenuItem* it = new DOptionMenuNumberField_( label, cvar,
|
||||
minimum, maximum, step, check );
|
||||
desc->mItems.Push( it );
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError("Unknown keyword '%s'", sc.String);
|
||||
bool success = false;
|
||||
FStringf buildname("OptionMenuItem%s", sc.String);
|
||||
// Handle one special case: MapControl maps to Control with one parameter different
|
||||
FKeyBindings *bind = sc.Compare("MapControl") ? &AutomapBindings : &Bindings;
|
||||
PClass *cls = PClass::FindClass(buildname);
|
||||
if (cls != nullptr && cls->IsDescendantOf("OptionMenuItem"))
|
||||
{
|
||||
auto func = dyn_cast<PFunction>(cls->Symbols.FindSymbol("Init", false));
|
||||
if (func != nullptr && !(func->Variants[0].Flags & (VARF_Protected | VARF_Private))) // skip internal classes which have a protexted init method.
|
||||
{
|
||||
auto &args = func->Variants[0].Proto->ArgumentTypes;
|
||||
TArray<VMValue> params;
|
||||
|
||||
params.Push(0);
|
||||
auto TypeCVar = NewPointer(NewNativeStruct("CVar", nullptr));
|
||||
auto TypeBind = NewPointer(NewNativeStruct("KeyBindings", nullptr));
|
||||
for (unsigned i = 1; i < args.Size(); i++)
|
||||
{
|
||||
sc.MustGetString();
|
||||
if (args[i] == TypeString)
|
||||
{
|
||||
params.Push(sc.String);
|
||||
}
|
||||
else if (args[i] == TypeName)
|
||||
{
|
||||
params.Push(FName(sc.String).GetIndex());
|
||||
}
|
||||
else if (args[i] == TypeColor)
|
||||
{
|
||||
params.Push(V_GetColor(nullptr, sc));
|
||||
}
|
||||
else if (args[i]->IsKindOf(RUNTIME_CLASS(PInt)))
|
||||
{
|
||||
char *endp;
|
||||
int v = (int)strtoll(sc.String, &endp, 0);
|
||||
if (*endp != 0)
|
||||
{
|
||||
// special check for font color ranges.
|
||||
v = V_FindFontColor(sc.String);
|
||||
if (v == CR_UNTRANSLATED && !sc.Compare("untranslated"))
|
||||
{
|
||||
// todo: check other data types that may get used.
|
||||
sc.ScriptError("Integer expected, got %s", sc.String);
|
||||
}
|
||||
}
|
||||
if (args[i] == TypeBool) v = !!v;
|
||||
params.Push(v);
|
||||
}
|
||||
else if (args[i]->IsKindOf(RUNTIME_CLASS(PInt)))
|
||||
{
|
||||
char *endp;
|
||||
double v = strtod(sc.String, &endp);
|
||||
if (*endp != 0)
|
||||
{
|
||||
sc.ScriptError("Float expected, got %s", sc.String);
|
||||
}
|
||||
params.Push(v);
|
||||
}
|
||||
else if (args[i] == TypeCVar)
|
||||
{
|
||||
auto cv = FindCVar(sc.String, nullptr);
|
||||
if (cv == nullptr && *sc.String)
|
||||
{
|
||||
sc.ScriptError("Unknown CVar %s", sc.String);
|
||||
}
|
||||
params.Push(cv);
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError("Invalid parameter type %s for menu item", args[i]->DescriptiveName());
|
||||
}
|
||||
if (sc.CheckString(","))
|
||||
{
|
||||
if (i == args.Size() - 1)
|
||||
{
|
||||
sc.ScriptError("Too many parameters for %s", cls->TypeName.GetChars());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args[i + 1] == TypeBind)
|
||||
{
|
||||
// Bindings are not parsed, they just get tacked on.
|
||||
params.Push(bind);
|
||||
i++;
|
||||
}
|
||||
if (i < args.Size() - 1 && !(func->Variants[0].ArgFlags[i + 1] & VARF_Optional))
|
||||
{
|
||||
sc.ScriptError("Insufficient parameters for %s", cls->TypeName.GetChars());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
DMenuItemBase *item = (DMenuItemBase*)cls->CreateNew();
|
||||
params[0] = item;
|
||||
GlobalVMStack.Call(func->Variants[0].Implementation, ¶ms[0], params.Size(), nullptr, 0);
|
||||
desc->mItems.Push((DMenuItemBase*)item);
|
||||
*/
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
if (!success)
|
||||
{
|
||||
sc.ScriptError("Unknown keyword '%s'", sc.String);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto &p : desc->mItems)
|
||||
|
@ -1185,7 +1101,7 @@ static void BuildEpisodeMenu()
|
|||
GC::WriteBarrier(od);
|
||||
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
||||
{
|
||||
DOptionMenuItemSubmenu_ *it = new DOptionMenuItemSubmenu_(AllEpisodes[i].mEpisodeName, "Skillmenu", i);
|
||||
auto it = CreateOptionMenuItemSubmenu(AllEpisodes[i].mEpisodeName, "Skillmenu", i);
|
||||
od->mItems.Push(it);
|
||||
GC::WriteBarrier(od, it);
|
||||
}
|
||||
|
@ -1324,13 +1240,13 @@ static void BuildPlayerclassMenu()
|
|||
const char *pname = GetPrintableDisplayName(PlayerClasses[i].Type);
|
||||
if (pname != nullptr)
|
||||
{
|
||||
DOptionMenuItemSubmenu_ *it = new DOptionMenuItemSubmenu_(pname, "Episodemenu", i);
|
||||
auto it = CreateOptionMenuItemSubmenu(pname, "Episodemenu", i);
|
||||
od->mItems.Push(it);
|
||||
GC::WriteBarrier(od, it);
|
||||
}
|
||||
}
|
||||
}
|
||||
DOptionMenuItemSubmenu_ *it = new DOptionMenuItemSubmenu_("Random", "Episodemenu", -1);
|
||||
auto it = CreateOptionMenuItemSubmenu("Random", "Episodemenu", -1);
|
||||
od->mItems.Push(it);
|
||||
GC::WriteBarrier(od, it);
|
||||
}
|
||||
|
@ -1411,14 +1327,14 @@ static void InitKeySections()
|
|||
for (unsigned i = 0; i < KeySections.Size(); i++)
|
||||
{
|
||||
FKeySection *sect = &KeySections[i];
|
||||
DOptionMenuItem *item = new DOptionMenuItemStaticText_(" ", false);
|
||||
DMenuItemBase *item = CreateOptionMenuItemStaticText(" ", false);
|
||||
menu->mItems.Push(item);
|
||||
item = new DOptionMenuItemStaticText_(sect->mTitle, true);
|
||||
item = CreateOptionMenuItemStaticText(sect->mTitle, true);
|
||||
menu->mItems.Push(item);
|
||||
for (unsigned j = 0; j < sect->mActions.Size(); j++)
|
||||
{
|
||||
FKeyAction *act = §->mActions[j];
|
||||
item = new DOptionMenuItemControl_(act->mTitle, act->mAction, &Bindings);
|
||||
item = CreateOptionMenuItemControl(act->mTitle, act->mAction, &Bindings);
|
||||
menu->mItems.Push(item);
|
||||
}
|
||||
}
|
||||
|
@ -1599,7 +1515,7 @@ fail:
|
|||
for(unsigned int i = 0; i < AllSkills.Size(); i++)
|
||||
{
|
||||
FSkillInfo &skill = AllSkills[i];
|
||||
DOptionMenuItem *li;
|
||||
DMenuItemBase *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";
|
||||
|
@ -1609,7 +1525,7 @@ fail:
|
|||
{
|
||||
pItemText = skill.MenuNamesForPlayerClass.CheckKey(gs->PlayerClass);
|
||||
}
|
||||
li = new DOptionMenuItemSubmenu_(pItemText? *pItemText : skill.MenuName, action, i);
|
||||
li = CreateOptionMenuItemSubmenu(pItemText? *pItemText : skill.MenuName, action, i);
|
||||
od->mItems.Push(li);
|
||||
GC::WriteBarrier(od, li);
|
||||
if (!done)
|
||||
|
|
|
@ -129,10 +129,8 @@ int DOptionMenu::FirstSelectable()
|
|||
//
|
||||
//
|
||||
//=============================================================================
|
||||
IMPLEMENT_CLASS(DOptionMenuItem, true, false)
|
||||
|
||||
|
||||
DOptionMenuItem *DOptionMenu::GetItem(FName name)
|
||||
DMenuItemBase *DOptionMenu::GetItem(FName name)
|
||||
{
|
||||
for(unsigned i=0;i<mDesc->mItems.Size(); i++)
|
||||
{
|
||||
|
@ -476,51 +474,6 @@ void DOptionMenu::Drawer ()
|
|||
Super::Drawer();
|
||||
}
|
||||
|
||||
int DOptionMenuItem::Draw(DOptionMenuDescriptor *desc, int y, int indent, bool selected)
|
||||
{
|
||||
return indent;
|
||||
}
|
||||
|
||||
bool DOptionMenuItem::Selectable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DOptionMenuItem::MouseEvent(int type, int x, int y)
|
||||
{
|
||||
if (Selectable() && type == DMenu::MOUSE_Release)
|
||||
{
|
||||
return DMenu::CurrentMenu->CallMenuEvent(MKEY_Enter, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int DOptionMenuItem::GetIndent()
|
||||
{
|
||||
if (mCentered)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
const char *label = mLabel.GetChars();
|
||||
if (*label == '$') label = GStrings(label+1);
|
||||
return SmallFont->StringWidth(label);
|
||||
}
|
||||
|
||||
void DOptionMenuItem::drawLabel(int indent, int y, EColorRange color, bool grayed)
|
||||
{
|
||||
const char *label = mLabel.GetChars();
|
||||
if (*label == '$') label = GStrings(label+1);
|
||||
|
||||
int overlay = grayed? MAKEARGB(96,48,0,0) : 0;
|
||||
|
||||
int x;
|
||||
int w = SmallFont->StringWidth(label) * CleanXfac_1;
|
||||
if (!mCentered) x = indent - w;
|
||||
else x = (screen->GetWidth() - w) / 2;
|
||||
screen->DrawText (SmallFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay, TAG_DONE);
|
||||
}
|
||||
|
||||
|
||||
void DOptionMenuDescriptor::CalcIndent()
|
||||
{
|
||||
// calculate the menu indent
|
||||
|
@ -540,7 +493,7 @@ void DOptionMenuDescriptor::CalcIndent()
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
DOptionMenuItem *DOptionMenuDescriptor::GetItem(FName name)
|
||||
DMenuItemBase *DOptionMenuDescriptor::GetItem(FName name)
|
||||
{
|
||||
for(unsigned i=0;i<mItems.Size(); i++)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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);
|
||||
|
|
|
@ -129,7 +129,7 @@ class OptionMenuItemJoyMap : OptionMenuItemOptionBase
|
|||
{
|
||||
int mAxis;
|
||||
|
||||
void Init(String label, int axis, String values, int center)
|
||||
void Init(String label, int axis, Name values, int center)
|
||||
{
|
||||
Super.Init(label, 'none', values, null, center);
|
||||
mAxis = axis;
|
||||
|
|
|
@ -38,5 +38,8 @@ native virtual bool MenuEvent (int mkey, bool fromcontroller);// { return false;
|
|||
virtual int GetY() { return mYpos; }
|
||||
virtual int GetX() { return mXpos; }
|
||||
virtual void SetX(int x) { mXpos = x; }
|
||||
virtual int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { return indent; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -57,11 +57,6 @@ class OptionMenuItem : MenuItemBase native
|
|||
screen.DrawText (SmallFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
|
||||
}
|
||||
|
||||
virtual int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected)
|
||||
{
|
||||
return indent;
|
||||
}
|
||||
|
||||
int CursorSpace()
|
||||
{
|
||||
return (14 * CleanXfac_1);
|
||||
|
@ -195,7 +190,7 @@ class OptionMenuItemOptionBase : OptionMenuItem
|
|||
|
||||
const OP_VALUES = 0x11001;
|
||||
|
||||
void Init(String label, Name command, Name values, CVar graycheck, int center)
|
||||
protected void Init(String label, Name command, Name values, CVar graycheck, int center)
|
||||
{
|
||||
Super.Init(label, command);
|
||||
mValues = values;
|
||||
|
@ -295,7 +290,7 @@ class OptionMenuItemOption : OptionMenuItemOptionBase
|
|||
{
|
||||
CVar mCVar;
|
||||
|
||||
void Init(String label, Name command, String values, CVar graycheck, int center)
|
||||
void Init(String label, Name command, Name values, CVar graycheck = null, int center = 0)
|
||||
{
|
||||
Super.Init(label, command, values, graycheck, center);
|
||||
mCVar = CVar.FindCVar(mAction);
|
||||
|
@ -590,7 +585,7 @@ class OptionMenuSliderBase : OptionMenuItem
|
|||
int mDrawX;
|
||||
int mSliderShort;
|
||||
|
||||
void Init(String label, double min, double max, double step, int showval)
|
||||
protected void Init(String label, double min, double max, double step, int showval)
|
||||
{
|
||||
Super.Init(label, 'None');
|
||||
mMin = min;
|
||||
|
@ -731,11 +726,11 @@ class OptionMenuSliderBase : OptionMenuItem
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
class OptionMenuSliderCVar : OptionMenuSliderBase
|
||||
class OptionMenuItemSlider : OptionMenuSliderBase
|
||||
{
|
||||
CVar mCVar;
|
||||
|
||||
void Init(String label, Name command, double min, double max, double step, int showval)
|
||||
void Init(String label, Name command, double min, double max, double step, int showval = 1)
|
||||
{
|
||||
Super.Init(label, min, max, step, showval);
|
||||
mCVar =CVar.FindCVar(command);
|
||||
|
@ -825,7 +820,7 @@ class OptionMenuItemColorPicker : OptionMenuItem
|
|||
}
|
||||
|
||||
|
||||
class OptionMenuScreenResolutionLine : OptionMenuItem
|
||||
class OptionMenuItemScreenResolution : OptionMenuItem
|
||||
{
|
||||
String mResTexts[3];
|
||||
int mSelection;
|
||||
|
@ -1033,7 +1028,7 @@ class OptionMenuFieldBase : OptionMenuItem
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
class OptionMenuTextField : OptionMenuFieldBase
|
||||
class OptionMenuItemTextField : OptionMenuFieldBase
|
||||
{
|
||||
void Init (String label, Name command, CVar graycheck = null)
|
||||
{
|
||||
|
@ -1102,9 +1097,9 @@ class OptionMenuTextField : OptionMenuFieldBase
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
class OptionMenuNumberField : OptionMenuFieldBase
|
||||
class OptionMenuItemNumberField : OptionMenuFieldBase
|
||||
{
|
||||
void Init (String label, Name command, float minimum, float maximum, float step, CVar graycheck = null)
|
||||
void Init (String label, Name command, float minimum = 0, float maximum = 100, float step = 1, CVar graycheck = null)
|
||||
{
|
||||
Super.Init(label, command, graycheck);
|
||||
mMinimum = min(minimum, maximum);
|
||||
|
|
Loading…
Reference in a new issue