mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-29 15:12:11 +00:00
Merge branch 'master' of https://github.com/coelckers/gzdoom
This commit is contained in:
commit
1b9f3c3514
14 changed files with 310 additions and 324 deletions
|
@ -52,6 +52,7 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, ArmorIcon2)
|
|||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gametype)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, norandomplayerclass)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, infoPages)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mBackButton)
|
||||
|
||||
|
||||
const char *GameNames[17] =
|
||||
|
|
|
@ -164,53 +164,11 @@ DMenu::DMenu(DMenu *parent)
|
|||
GC::WriteBarrier(this, parent);
|
||||
}
|
||||
|
||||
bool DMenu::Responder (event_t *ev)
|
||||
{
|
||||
bool res = false;
|
||||
if (ev->type == EV_GUI_Event)
|
||||
{
|
||||
if (ev->subtype == EV_GUI_LButtonDown)
|
||||
{
|
||||
res = MouseEventBack(MOUSE_Click, ev->data1, ev->data2);
|
||||
// make the menu's mouse handler believe that the current coordinate is outside the valid range
|
||||
if (res) ev->data2 = -1;
|
||||
res |= CallMouseEvent(MOUSE_Click, ev->data1, ev->data2);
|
||||
if (res)
|
||||
{
|
||||
SetCapture();
|
||||
}
|
||||
|
||||
}
|
||||
else if (ev->subtype == EV_GUI_MouseMove)
|
||||
{
|
||||
BackbuttonTime = BACKBUTTON_TIME;
|
||||
if (mMouseCapture || m_use_mouse == 1)
|
||||
{
|
||||
res = MouseEventBack(MOUSE_Move, ev->data1, ev->data2);
|
||||
if (res) ev->data2 = -1;
|
||||
res |= CallMouseEvent(MOUSE_Move, ev->data1, ev->data2);
|
||||
}
|
||||
}
|
||||
else if (ev->subtype == EV_GUI_LButtonUp)
|
||||
{
|
||||
if (mMouseCapture)
|
||||
{
|
||||
ReleaseCapture();
|
||||
res = MouseEventBack(MOUSE_Release, ev->data1, ev->data2);
|
||||
if (res) ev->data2 = -1;
|
||||
res |= CallMouseEvent(MOUSE_Release, ev->data1, ev->data2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DMenu, Responder)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DMenu);
|
||||
PARAM_POINTER(ev, event_t);
|
||||
ACTION_RETURN_BOOL(self->Responder(ev));
|
||||
}
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
bool DMenu::CallResponder(event_t *ev)
|
||||
{
|
||||
|
@ -222,7 +180,7 @@ bool DMenu::CallResponder(event_t *ev)
|
|||
GlobalVMStack.Call(func, params, 2, &ret, 1, nullptr);
|
||||
return !!retval;
|
||||
}
|
||||
else return Responder(ev);
|
||||
else return false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -231,29 +189,6 @@ bool DMenu::CallResponder(event_t *ev)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
bool DMenu::MenuEvent (int mkey, bool fromcontroller)
|
||||
{
|
||||
switch (mkey)
|
||||
{
|
||||
case MKEY_Back:
|
||||
{
|
||||
Close();
|
||||
S_Sound (CHAN_VOICE | CHAN_UI,
|
||||
CurrentMenu != nullptr? "menu/backup" : "menu/clear", snd_menuvolume, ATTN_NONE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DMenu, MenuEvent)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DMenu);
|
||||
PARAM_INT(key);
|
||||
PARAM_BOOL(fromcontroller);
|
||||
ACTION_RETURN_BOOL(self->MenuEvent(key, fromcontroller));
|
||||
}
|
||||
|
||||
bool DMenu::CallMenuEvent(int mkey, bool fromcontroller)
|
||||
{
|
||||
IFVIRTUAL(DMenu, MenuEvent)
|
||||
|
@ -264,7 +199,7 @@ bool DMenu::CallMenuEvent(int mkey, bool fromcontroller)
|
|||
GlobalVMStack.Call(func, params, 3, &ret, 1, nullptr);
|
||||
return !!retval;
|
||||
}
|
||||
else return MenuEvent(mkey, fromcontroller);
|
||||
else return false;
|
||||
}
|
||||
//=============================================================================
|
||||
//
|
||||
|
@ -272,6 +207,15 @@ bool DMenu::CallMenuEvent(int mkey, bool fromcontroller)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DMenu, SetMouseCapture)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_BOOL(on);
|
||||
if (on) I_SetMouseCapture();
|
||||
else I_ReleaseMouseCapture();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DMenu::Close ()
|
||||
{
|
||||
if (CurrentMenu == nullptr) return; // double closing can happen in the save menu.
|
||||
|
@ -288,108 +232,19 @@ void DMenu::Close ()
|
|||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
bool DMenu::MouseEvent(int type, int x, int y)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DMenu, MouseEvent)
|
||||
DEFINE_ACTION_FUNCTION(DMenu, Close)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DMenu);
|
||||
PARAM_INT(type);
|
||||
PARAM_INT(x);
|
||||
PARAM_INT(y);
|
||||
ACTION_RETURN_BOOL(self->MouseEvent(type, x, y));
|
||||
}
|
||||
|
||||
bool DMenu::CallMouseEvent(int type, int x, int y)
|
||||
{
|
||||
IFVIRTUAL(DMenu, MouseEvent)
|
||||
{
|
||||
VMValue params[] = { (DObject*)this, type, x, y };
|
||||
int retval;
|
||||
VMReturn ret(&retval);
|
||||
GlobalVMStack.Call(func, params, 4, &ret, 1, nullptr);
|
||||
return !!retval;
|
||||
}
|
||||
else return MouseEvent (type, x, y);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
bool DMenu::MouseEventBack(int type, int x, int y)
|
||||
{
|
||||
if (m_show_backbutton >= 0)
|
||||
{
|
||||
FTexture *tex = TexMan(gameinfo.mBackButton);
|
||||
if (tex != nullptr)
|
||||
{
|
||||
if (m_show_backbutton&1) x -= screen->GetWidth() - tex->GetScaledWidth() * CleanXfac;
|
||||
if (m_show_backbutton&2) y -= screen->GetHeight() - tex->GetScaledHeight() * CleanYfac;
|
||||
mBackbuttonSelected = ( x >= 0 && x < tex->GetScaledWidth() * CleanXfac &&
|
||||
y >= 0 && y < tex->GetScaledHeight() * CleanYfac);
|
||||
if (mBackbuttonSelected && type == MOUSE_Release)
|
||||
{
|
||||
if (m_use_mouse == 2) mBackbuttonSelected = false;
|
||||
CallMenuEvent(MKEY_Back, true);
|
||||
}
|
||||
return mBackbuttonSelected;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
void DMenu::SetCapture()
|
||||
{
|
||||
if (!mMouseCapture)
|
||||
{
|
||||
mMouseCapture = true;
|
||||
I_SetMouseCapture();
|
||||
}
|
||||
}
|
||||
|
||||
void DMenu::ReleaseCapture()
|
||||
{
|
||||
if (mMouseCapture)
|
||||
{
|
||||
mMouseCapture = false;
|
||||
I_ReleaseMouseCapture();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
void DMenu::Ticker ()
|
||||
{
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DMenu, Ticker)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DMenu);
|
||||
self->Ticker();
|
||||
self->Close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
void DMenu::CallTicker()
|
||||
{
|
||||
IFVIRTUAL(DMenu, Ticker)
|
||||
|
@ -397,38 +252,9 @@ void DMenu::CallTicker()
|
|||
VMValue params[] = { (DObject*)this };
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
else Ticker();
|
||||
}
|
||||
|
||||
|
||||
void DMenu::Drawer ()
|
||||
{
|
||||
if (this == CurrentMenu && BackbuttonAlpha > 0 && m_show_backbutton >= 0 && m_use_mouse)
|
||||
{
|
||||
FTexture *tex = TexMan(gameinfo.mBackButton);
|
||||
int w = tex->GetScaledWidth() * CleanXfac;
|
||||
int h = tex->GetScaledHeight() * CleanYfac;
|
||||
int x = (!(m_show_backbutton&1))? 0:screen->GetWidth() - w;
|
||||
int y = (!(m_show_backbutton&2))? 0:screen->GetHeight() - h;
|
||||
if (mBackbuttonSelected && (mMouseCapture || m_use_mouse == 1))
|
||||
{
|
||||
screen->DrawTexture(tex, x, y, DTA_CleanNoMove, true, DTA_ColorOverlay, MAKEARGB(40, 255,255,255), TAG_DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->DrawTexture(tex, x, y, DTA_CleanNoMove, true, DTA_Alpha, BackbuttonAlpha, TAG_DONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DMenu, Drawer)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DMenu);
|
||||
self->Drawer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DMenu::CallDrawer()
|
||||
{
|
||||
IFVIRTUAL(DMenu, Drawer)
|
||||
|
@ -436,14 +262,6 @@ void DMenu::CallDrawer()
|
|||
VMValue params[] = { (DObject*)this };
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
else Drawer();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DMenu, Close)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DMenu);
|
||||
self->Close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool DMenu::TranslateKeyboardEvents()
|
||||
|
@ -500,7 +318,11 @@ void M_StartControlPanel (bool makeSound)
|
|||
void M_ActivateMenu(DMenu *menu)
|
||||
{
|
||||
if (menuactive == MENU_Off) menuactive = MENU_On;
|
||||
if (CurrentMenu != nullptr) CurrentMenu->ReleaseCapture();
|
||||
if (CurrentMenu != nullptr && CurrentMenu->mMouseCapture)
|
||||
{
|
||||
CurrentMenu->mMouseCapture = false;
|
||||
I_ReleaseMouseCapture();
|
||||
}
|
||||
CurrentMenu = menu;
|
||||
GC::WriteBarrier(CurrentMenu);
|
||||
}
|
||||
|
@ -647,10 +469,15 @@ void M_SetMenu(FName menu, int param)
|
|||
const PClass *menuclass = PClass::FindClass(menu);
|
||||
if (menuclass != nullptr)
|
||||
{
|
||||
if (menuclass->IsDescendantOf(RUNTIME_CLASS(DMenu)))
|
||||
if (menuclass->IsDescendantOf("GenericMenu"))
|
||||
{
|
||||
DMenu *newmenu = (DMenu*)menuclass->CreateNew();
|
||||
newmenu->mParentMenu = CurrentMenu;
|
||||
|
||||
IFVIRTUALPTRNAME(newmenu, "GenericMenu", Init)
|
||||
{
|
||||
VMValue params[3] = { newmenu, CurrentMenu };
|
||||
GlobalVMStack.Call(func, params, 2, nullptr, 0);
|
||||
}
|
||||
M_ActivateMenu(newmenu);
|
||||
return;
|
||||
}
|
||||
|
@ -939,13 +766,14 @@ void M_Drawer (void)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void M_ClearMenus ()
|
||||
void M_ClearMenus()
|
||||
{
|
||||
M_DemoNoPlay = false;
|
||||
if (CurrentMenu != nullptr)
|
||||
while (CurrentMenu != nullptr)
|
||||
{
|
||||
DMenu* parent = CurrentMenu->mParentMenu;
|
||||
CurrentMenu->Destroy();
|
||||
CurrentMenu = nullptr;
|
||||
CurrentMenu = parent;
|
||||
}
|
||||
V_SetBorderNeedRefresh();
|
||||
menuactive = MENU_Off;
|
||||
|
@ -1289,7 +1117,7 @@ DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBi
|
|||
return (DMenuItemBase*)p;
|
||||
}
|
||||
|
||||
DMenuItemBase * CreateListMenuItemPatch(int x, int y, int height, int hotkey, FTextureID tex, FName command, int param)
|
||||
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param)
|
||||
{
|
||||
auto c = PClass::FindClass("ListMenuItemPatchItem");
|
||||
auto p = c->CreateNew();
|
||||
|
@ -1299,7 +1127,7 @@ DMenuItemBase * CreateListMenuItemPatch(int x, int y, int height, int hotkey, FT
|
|||
return (DMenuItemBase*)p;
|
||||
}
|
||||
|
||||
DMenuItemBase * CreateListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param)
|
||||
DMenuItemBase * CreateListMenuItemText(double x, double y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param)
|
||||
{
|
||||
auto c = PClass::FindClass("ListMenuItemTextItem");
|
||||
auto p = c->CreateNew();
|
||||
|
|
|
@ -138,11 +138,11 @@ class DListMenuDescriptor : public DMenuDescriptor
|
|||
public:
|
||||
TArray<DMenuItemBase *> mItems;
|
||||
int mSelectedItem;
|
||||
int mSelectOfsX;
|
||||
int mSelectOfsY;
|
||||
double mSelectOfsX;
|
||||
double mSelectOfsY;
|
||||
FTextureID mSelector;
|
||||
int mDisplayTop;
|
||||
int mXpos, mYpos;
|
||||
double mXpos, mYpos;
|
||||
int mWLeft, mWRight;
|
||||
int mLinespacing; // needs to be stored for dynamically created menus
|
||||
int mAutoselect; // this can only be set by internal menu creation functions
|
||||
|
@ -263,42 +263,19 @@ public:
|
|||
MOUSE_Release
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
BACKBUTTON_TIME = 4*TICRATE
|
||||
};
|
||||
|
||||
TObjPtr<DMenu> mParentMenu;
|
||||
bool mMouseCapture;
|
||||
bool mBackbuttonSelected;
|
||||
bool DontDim;
|
||||
|
||||
DMenu(DMenu *parent = NULL);
|
||||
virtual bool Responder (event_t *ev);
|
||||
virtual bool MenuEvent (int mkey, bool fromcontroller);
|
||||
virtual void Ticker ();
|
||||
virtual void Drawer ();
|
||||
bool TranslateKeyboardEvents();
|
||||
virtual void Close();
|
||||
virtual bool MouseEvent(int type, int x, int y);
|
||||
|
||||
virtual void SetFocus(DMenuItemBase *fc) {}
|
||||
virtual bool CheckFocus(DMenuItemBase *fc) { return false; }
|
||||
virtual void ReleaseFocus() {}
|
||||
|
||||
bool CallResponder(event_t *ev);
|
||||
bool CallMenuEvent(int mkey, bool fromcontroller);
|
||||
bool CallMouseEvent(int type, int x, int y);
|
||||
void CallTicker();
|
||||
void CallDrawer();
|
||||
|
||||
bool MouseEventBack(int type, int x, int y);
|
||||
void SetCapture();
|
||||
void ReleaseCapture();
|
||||
bool HasCapture()
|
||||
{
|
||||
return mMouseCapture;
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
@ -311,7 +288,7 @@ class DMenuItemBase : public DObject
|
|||
{
|
||||
DECLARE_CLASS(DMenuItemBase, DObject)
|
||||
public:
|
||||
int mXpos, mYpos;
|
||||
double mXpos, mYpos;
|
||||
FNameNoInit mAction;
|
||||
bool mEnabled;
|
||||
|
||||
|
@ -321,7 +298,7 @@ public:
|
|||
bool SetValue(int i, int value);
|
||||
bool GetValue(int i, int *pvalue);
|
||||
void OffsetPositionY(int ydelta) { mYpos += ydelta; }
|
||||
int GetY() { return mYpos; }
|
||||
double GetY() { return mYpos; }
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
@ -378,7 +355,7 @@ DMenuItemBase * CreateOptionMenuItemStaticText(const char *name, bool v);
|
|||
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 * CreateListMenuItemPatch(int x, int y, int height, int hotkey, FTextureID tex, FName command, int param);
|
||||
DMenuItemBase * CreateListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param);
|
||||
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param);
|
||||
DMenuItemBase * CreateListMenuItemText(double x, double y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -301,11 +301,11 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
|
|||
sc.MustGetString();
|
||||
desc->mSelector = GetMenuTexture(sc.String);
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetNumber();
|
||||
desc->mSelectOfsX = sc.Number;
|
||||
sc.MustGetFloat();
|
||||
desc->mSelectOfsX = sc.Float;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetNumber();
|
||||
desc->mSelectOfsY = sc.Number;
|
||||
sc.MustGetFloat();
|
||||
desc->mSelectOfsY = sc.Float;
|
||||
}
|
||||
else if (sc.Compare("Linespacing"))
|
||||
{
|
||||
|
@ -314,11 +314,11 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
|
|||
}
|
||||
else if (sc.Compare("Position"))
|
||||
{
|
||||
sc.MustGetNumber();
|
||||
desc->mXpos = sc.Number;
|
||||
sc.MustGetFloat();
|
||||
desc->mXpos = sc.Float;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetNumber();
|
||||
desc->mYpos = sc.Number;
|
||||
sc.MustGetFloat();
|
||||
desc->mYpos = sc.Float;
|
||||
}
|
||||
else if (sc.Compare("Centermenu"))
|
||||
{
|
||||
|
@ -969,13 +969,13 @@ static void BuildEpisodeMenu()
|
|||
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
||||
{
|
||||
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
||||
int posy = ld->mYpos;
|
||||
int posy = (int)ld->mYpos;
|
||||
int topy = posy;
|
||||
|
||||
// Get lowest y coordinate of any static item in the menu
|
||||
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
||||
{
|
||||
int y = ld->mItems[i]->GetY();
|
||||
int y = (int)ld->mItems[i]->GetY();
|
||||
if (y < topy) topy = y;
|
||||
}
|
||||
|
||||
|
@ -1069,13 +1069,13 @@ static void BuildPlayerclassMenu()
|
|||
// add player display
|
||||
ld->mSelectedItem = ld->mItems.Size();
|
||||
|
||||
int posy = ld->mYpos;
|
||||
int posy = (int)ld->mYpos;
|
||||
int topy = posy;
|
||||
|
||||
// Get lowest y coordinate of any static item in the menu
|
||||
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
||||
{
|
||||
int y = ld->mItems[i]->GetY();
|
||||
int y = (int)ld->mItems[i]->GetY();
|
||||
if (y < topy) topy = y;
|
||||
}
|
||||
|
||||
|
@ -1329,8 +1329,8 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
|||
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
||||
{
|
||||
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
||||
int x = ld->mXpos;
|
||||
int y = ld->mYpos;
|
||||
int x = (int)ld->mXpos;
|
||||
int y = (int)ld->mYpos;
|
||||
|
||||
// Delete previous contents
|
||||
for(unsigned i=0; i<ld->mItems.Size(); i++)
|
||||
|
@ -1359,7 +1359,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
|||
// Get lowest y coordinate of any static item in the menu
|
||||
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
||||
{
|
||||
int y = ld->mItems[i]->GetY();
|
||||
int y = (int)ld->mItems[i]->GetY();
|
||||
if (y < topy) topy = y;
|
||||
}
|
||||
|
||||
|
@ -1376,7 +1376,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
|||
{
|
||||
ld->mItems[i]->OffsetPositionY(topdelta);
|
||||
}
|
||||
y = ld->mYpos = posy - topdelta;
|
||||
ld->mYpos = y = posy - topdelta;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -63,6 +63,9 @@
|
|||
static TArray<FPropertyInfo*> properties;
|
||||
static TArray<AFuncDesc> AFTable;
|
||||
static TArray<FieldDesc> FieldTable;
|
||||
extern int BackbuttonTime;
|
||||
extern float BackbuttonAlpha;
|
||||
static AWeapon *wpnochg;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -912,11 +915,17 @@ void InitThingdef()
|
|||
fieldptr = new PField("demoplayback", TypeSInt32, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&demoplayback);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
fieldptr = new PField("BackbuttonTime", TypeSInt32, VARF_Native | VARF_Static, (intptr_t)&BackbuttonTime);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
fieldptr = new PField("BackbuttonAlpha", TypeFloat32, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&BackbuttonAlpha);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
|
||||
// Argh. It sucks when bad hacks need to be supported. WP_NOCHANGE is just a bogus pointer but it used everywhere as a special flag.
|
||||
// It cannot be defined as constant because constants can either be numbers or strings but nothing else, so the only 'solution'
|
||||
// is to create a static variable from it and reference that in the script. Yuck!!!
|
||||
static AWeapon *wpnochg = WP_NOCHANGE;
|
||||
wpnochg = WP_NOCHANGE;
|
||||
fieldptr = new PField("WP_NOCHANGE", NewPointer(RUNTIME_CLASS(AWeapon), false), VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&wpnochg);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
|
|
|
@ -300,6 +300,7 @@ struct GameInfoStruct native
|
|||
native int gametype;
|
||||
native bool norandomplayerclass;
|
||||
native Array<Name> infoPages;
|
||||
native String mBackButton;
|
||||
}
|
||||
|
||||
class Object native
|
||||
|
|
|
@ -4,11 +4,11 @@ class ListMenuDescriptor : MenuDescriptor native
|
|||
{
|
||||
native Array<ListMenuItem> mItems;
|
||||
native int mSelectedItem;
|
||||
native int mSelectOfsX;
|
||||
native int mSelectOfsY;
|
||||
native double mSelectOfsX;
|
||||
native double mSelectOfsY;
|
||||
native TextureID mSelector;
|
||||
native int mDisplayTop;
|
||||
native int mXpos, mYpos;
|
||||
native double mXpos, mYpos;
|
||||
native int mWLeft, mWRight;
|
||||
native int mLinespacing; // needs to be stored for dynamically created menus
|
||||
native int mAutoselect; // this can only be set by internal menu creation functions
|
||||
|
@ -51,16 +51,16 @@ class ListMenu : Menu
|
|||
mDesc = desc;
|
||||
if (desc.mCenter)
|
||||
{
|
||||
int center = 160;
|
||||
double center = 160;
|
||||
for(int i=0; i < mDesc.mItems.Size(); i++)
|
||||
{
|
||||
int xpos = mDesc.mItems[i].GetX();
|
||||
double xpos = mDesc.mItems[i].GetX();
|
||||
int width = mDesc.mItems[i].GetWidth();
|
||||
int curx = mDesc.mSelectOfsX;
|
||||
double curx = mDesc.mSelectOfsX;
|
||||
|
||||
if (width > 0 && mDesc.mItems[i].Selectable())
|
||||
{
|
||||
int left = 160 - (width - curx) / 2 - curx;
|
||||
double left = 160 - (width - curx) / 2 - curx;
|
||||
if (left < center) center = left;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
class ListMenuItem : MenuItemBase
|
||||
{
|
||||
void DrawSelector(int xofs, int yofs, TextureID tex)
|
||||
void DrawSelector(double xofs, double yofs, TextureID tex)
|
||||
{
|
||||
if (tex.isNull())
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ class ListMenuItemStaticPatch : ListMenuItem
|
|||
TextureID mTexture;
|
||||
bool mCentered;
|
||||
|
||||
void Init(int x, int y, TextureID patch, bool centered = false)
|
||||
void Init(double x, double y, TextureID patch, bool centered = false)
|
||||
{
|
||||
Super.Init(x, y);
|
||||
mTexture = patch;
|
||||
|
@ -82,17 +82,17 @@ class ListMenuItemStaticPatch : ListMenuItem
|
|||
return;
|
||||
}
|
||||
|
||||
int x = mXpos;
|
||||
double x = mXpos;
|
||||
Vector2 vec = TexMan.GetScaledSize(mTexture);
|
||||
if (mYpos >= 0)
|
||||
{
|
||||
if (mCentered) x -= int(vec.X) / 2;
|
||||
if (mCentered) x -= vec.X / 2;
|
||||
screen.DrawTexture (mTexture, true, x, mYpos, DTA_Clean, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
int x = (mXpos - 160) * CleanXfac + (Screen.GetWidth()>>1);
|
||||
if (mCentered) x -= (int(vec.X) * CleanXfac)/2;
|
||||
x = (mXpos - 160) * CleanXfac + (Screen.GetWidth()>>1);
|
||||
if (mCentered) x -= (vec.X * CleanXfac)/2;
|
||||
screen.DrawTexture (mTexture, true, x, -mYpos*CleanYfac, DTA_CleanNoMove, true);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class ListMenuItemStaticPatch : ListMenuItem
|
|||
|
||||
class ListMenuItemStaticPatchCentered : ListMenuItemStaticPatch
|
||||
{
|
||||
void Init(int x, int y, TextureID patch)
|
||||
void Init(double x, double y, TextureID patch)
|
||||
{
|
||||
Super.Init(x, y, patch, true);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class ListMenuItemStaticText : ListMenuItem
|
|||
int mColor;
|
||||
bool mCentered;
|
||||
|
||||
void Init(ListMenuDescriptor desc, int x, int y, String text, int color = Font.CR_UNTRANSLATED)
|
||||
void Init(ListMenuDescriptor desc, double x, double y, String text, int color = Font.CR_UNTRANSLATED)
|
||||
{
|
||||
Super.Init(x, y);
|
||||
mText = text;
|
||||
|
@ -128,7 +128,7 @@ class ListMenuItemStaticText : ListMenuItem
|
|||
mCentered = false;
|
||||
}
|
||||
|
||||
void InitDirect(int x, int y, String text, Font font, int color = Font.CR_UNTRANSLATED, bool centered = false)
|
||||
void InitDirect(double x, double y, String text, Font font, int color = Font.CR_UNTRANSLATED, bool centered = false)
|
||||
{
|
||||
Super.Init(x, y);
|
||||
mText = text;
|
||||
|
@ -144,13 +144,13 @@ class ListMenuItemStaticText : ListMenuItem
|
|||
String text = Stringtable.Localize(mText);
|
||||
if (mYpos >= 0)
|
||||
{
|
||||
int x = mXpos;
|
||||
double x = mXpos;
|
||||
if (mCentered) x -= mFont.StringWidth(text)/2;
|
||||
screen.DrawText(mFont, mColor, x, mYpos, text, DTA_Clean, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
int x = (mXpos - 160) * CleanXfac + (Screen.GetWidth() >> 1);
|
||||
double x = (mXpos - 160) * CleanXfac + (Screen.GetWidth() >> 1);
|
||||
if (mCentered) x -= (mFont.StringWidth(text) * CleanXfac)/2;
|
||||
screen.DrawText (mFont, mColor, x, -mYpos*CleanYfac, text, DTA_CleanNoMove, true);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class ListMenuItemStaticText : ListMenuItem
|
|||
|
||||
class ListMenuItemStaticTextCentered : ListMenuItemStaticText
|
||||
{
|
||||
void Init(ListMenuDescriptor desc, int x, int y, String text, int color = -1)
|
||||
void Init(ListMenuDescriptor desc, double x, double y, String text, int color = -1)
|
||||
{
|
||||
Super.Init(desc, x, y, text, color);
|
||||
mCentered = true;
|
||||
|
@ -179,7 +179,7 @@ class ListMenuItemSelectable : ListMenuItem
|
|||
int mHeight;
|
||||
int mParam;
|
||||
|
||||
protected void Init(int x, int y, int height, Name childmenu, int param = -1)
|
||||
protected void Init(double x, double y, int height, Name childmenu, int param = -1)
|
||||
{
|
||||
Super.Init(x, y, childmenu);
|
||||
mHeight = height;
|
||||
|
@ -250,7 +250,7 @@ class ListMenuItemTextItem : ListMenuItemSelectable
|
|||
mHotkey = hotkey.CharCodeAt(0);
|
||||
}
|
||||
|
||||
void InitDirect(int x, int y, int height, String hotkey, String text, Font font, int color, int color2, Name child, int param = 0)
|
||||
void InitDirect(double x, double y, int height, String hotkey, String text, Font font, int color, int color2, Name child, int param = 0)
|
||||
{
|
||||
Super.Init(x, y, height, child, param);
|
||||
mText = text;
|
||||
|
@ -288,7 +288,7 @@ class ListMenuItemPatchItem : ListMenuItemSelectable
|
|||
mTexture = patch;
|
||||
}
|
||||
|
||||
void InitDirect(int x, int y, int height, TextureID patch, String hotkey, Name child, int param = 0)
|
||||
void InitDirect(double x, double y, int height, TextureID patch, String hotkey, Name child, int param = 0)
|
||||
{
|
||||
Super.Init(x, y, height, child, param);
|
||||
mHotkey = hotkey.CharCodeAt(0);
|
||||
|
|
|
@ -91,30 +91,189 @@ class Menu : Object native
|
|||
native bool mBackbuttonSelected;
|
||||
native bool DontDim;
|
||||
|
||||
void Init(Menu parent)
|
||||
{
|
||||
mParentMenu = parent;
|
||||
}
|
||||
|
||||
native static int MenuTime();
|
||||
native static void SetVideoMode();
|
||||
native static Menu GetCurrentMenu();
|
||||
native static void SetMenu(Name mnu, int param = 0);
|
||||
native static void StartMessage(String msg, int mode = 0, Name command = 'none');
|
||||
native static void SetMouseCapture(bool on);
|
||||
native void Close();
|
||||
native void ActivateMenu();
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
void Init(Menu parent)
|
||||
{
|
||||
mParentMenu = parent;
|
||||
mMouseCapture = false;
|
||||
mBackbuttonSelected = false;
|
||||
DontDim = false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
virtual bool MenuEvent (int mkey, bool fromcontroller)
|
||||
{
|
||||
switch (mkey)
|
||||
{
|
||||
case MKEY_Back:
|
||||
Close();
|
||||
MenuSound (GetCurrentMenu() != null? "menu/backup" : "menu/clear");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
protected bool MouseEventBack(int type, int x, int y)
|
||||
{
|
||||
if (m_show_backbutton >= 0)
|
||||
{
|
||||
let tex = TexMan.CheckForTexture(gameinfo.mBackButton, TexMan.Type_MiscPatch);
|
||||
if (tex.IsValid())
|
||||
{
|
||||
Vector2 v = TexMan.GetScaledSize(tex);
|
||||
int w = int(v.X + 0.5) * CleanXfac;
|
||||
int h = int(v.Y + 0.5) * CleanYfac;
|
||||
if (m_show_backbutton&1) x -= screen.GetWidth() - w;
|
||||
if (m_show_backbutton&2) y -= screen.GetHeight() - h;
|
||||
mBackbuttonSelected = ( x >= 0 && x < w && y >= 0 && y < h);
|
||||
if (mBackbuttonSelected && type == MOUSE_Release)
|
||||
{
|
||||
if (m_use_mouse == 2) mBackbuttonSelected = false;
|
||||
MenuEvent(MKEY_Back, true);
|
||||
}
|
||||
return mBackbuttonSelected;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
virtual bool Responder(InputEventData ev)
|
||||
{
|
||||
bool res = false;
|
||||
if (ev.type == InputEventData.GUI_Event)
|
||||
{
|
||||
if (ev.subtype == InputEventData.GUI_LButtonDown)
|
||||
{
|
||||
res = MouseEventBack(MOUSE_Click, ev.data1, ev.data2);
|
||||
// make the menu's mouse handler believe that the current coordinate is outside the valid range
|
||||
if (res) ev.data2 = -1;
|
||||
res |= MouseEvent(MOUSE_Click, ev.data1, ev.data2);
|
||||
if (res)
|
||||
{
|
||||
SetCapture(true);
|
||||
}
|
||||
|
||||
}
|
||||
else if (ev.subtype == InputEventData.GUI_MouseMove)
|
||||
{
|
||||
BackbuttonTime = 4*Thinker.TICRATE;
|
||||
if (mMouseCapture || m_use_mouse == 1)
|
||||
{
|
||||
res = MouseEventBack(MOUSE_Move, ev.data1, ev.data2);
|
||||
if (res) ev.data2 = -1;
|
||||
res |= MouseEvent(MOUSE_Move, ev.data1, ev.data2);
|
||||
}
|
||||
}
|
||||
else if (ev.subtype == InputEventData.GUI_LButtonUp)
|
||||
{
|
||||
if (mMouseCapture)
|
||||
{
|
||||
SetCapture(false);
|
||||
res = MouseEventBack(MOUSE_Release, ev.data1, ev.data2);
|
||||
if (res) ev.data2 = -1;
|
||||
res |= MouseEvent(MOUSE_Release, ev.data1, ev.data2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
virtual void Drawer ()
|
||||
{
|
||||
if (self == GetCurrentMenu() && BackbuttonAlpha > 0 && m_show_backbutton >= 0 && m_use_mouse)
|
||||
{
|
||||
let tex = TexMan.CheckForTexture(gameinfo.mBackButton, TexMan.Type_MiscPatch);
|
||||
if (tex.IsValid())
|
||||
{
|
||||
Vector2 v = TexMan.GetScaledSize(tex);
|
||||
int w = int(v.X + 0.5) * CleanXfac;
|
||||
int h = int(v.Y + 0.5) * CleanYfac;
|
||||
int x = (!(m_show_backbutton&1))? 0:screen.GetWidth() - w;
|
||||
int y = (!(m_show_backbutton&2))? 0:screen.GetHeight() - h;
|
||||
if (mBackbuttonSelected && (mMouseCapture || m_use_mouse == 1))
|
||||
{
|
||||
screen.DrawTexture(tex, true, x, y, DTA_CleanNoMove, true, DTA_ColorOverlay, Color(40, 255,255,255));
|
||||
}
|
||||
else
|
||||
{
|
||||
screen.DrawTexture(tex, true, x, y, DTA_CleanNoMove, true, DTA_Alpha, BackbuttonAlpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
void SetCapture(bool on)
|
||||
{
|
||||
if (mMouseCapture != on)
|
||||
{
|
||||
mMouseCapture = on;
|
||||
SetMouseCapture(on);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
virtual bool TranslateKeyboardEvents() { return true; }
|
||||
virtual void SetFocus(MenuItemBase fc) {}
|
||||
virtual bool CheckFocus(MenuItemBase fc) { return false; }
|
||||
virtual void ReleaseFocus() {}
|
||||
virtual void ResetColor() {}
|
||||
virtual bool MouseEvent(int type, int mx, int my) { return false; }
|
||||
virtual void Ticker() {}
|
||||
|
||||
native virtual bool Responder(InputEventData ev);
|
||||
native virtual bool MenuEvent (int mkey, bool fromcontroller);
|
||||
native virtual bool MouseEvent(int type, int mx, int my);
|
||||
native virtual void Ticker();
|
||||
native virtual void Drawer();
|
||||
native void Close();
|
||||
native void ActivateMenu();
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
static void MenuSound(Sound snd)
|
||||
{
|
||||
|
@ -137,3 +296,11 @@ class MenuDescriptor : Object native
|
|||
native static MenuDescriptor GetDescriptor(Name n);
|
||||
}
|
||||
|
||||
// This class is only needed to give it a virtual Init method that doesn't belong to Menu itself
|
||||
class GenericMenu : Menu
|
||||
{
|
||||
virtual void Init(Menu parent)
|
||||
{
|
||||
Super.Init(parent);
|
||||
}
|
||||
}
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
class MenuItemBase : Object native
|
||||
{
|
||||
protected native int mXpos, mYpos;
|
||||
protected native double mXpos, mYpos;
|
||||
protected native Name mAction;
|
||||
native bool mEnabled;
|
||||
|
||||
void Init(int xpos = 0, int ypos = 0, Name actionname = 'None')
|
||||
void Init(double xpos = 0, double ypos = 0, Name actionname = 'None')
|
||||
{
|
||||
mXpos = xpos;
|
||||
mYpos = ypos;
|
||||
|
@ -36,10 +36,10 @@ class MenuItemBase : Object native
|
|||
virtual int GetIndent() { return 0; }
|
||||
virtual int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { return indent; }
|
||||
|
||||
void OffsetPositionY(int ydelta) { mYpos += ydelta; }
|
||||
int GetY() { return mYpos; }
|
||||
int GetX() { return mXpos; }
|
||||
void SetX(int x) { mXpos = x; }
|
||||
void OffsetPositionY(double ydelta) { mYpos += ydelta; }
|
||||
double GetY() { return mYpos; }
|
||||
double GetX() { return mXpos; }
|
||||
void SetX(double x) { mXpos = x; }
|
||||
}
|
||||
|
||||
// this is only used to parse font color ranges in MENUDEF
|
||||
|
|
|
@ -181,12 +181,12 @@ class MessageBoxMenu : Menu
|
|||
int ch = ev.data1;
|
||||
ch = ch >= 65 && ch <91? ch + 32 : ch;
|
||||
|
||||
if (ch == 78 /*'n'*/ || ch == 32)
|
||||
if (ch == 110 /*'n'*/ || ch == 32)
|
||||
{
|
||||
HandleResult(false);
|
||||
return true;
|
||||
}
|
||||
else if (ch == 89 /*'y'*/)
|
||||
else if (ch == 121 /*'y'*/)
|
||||
{
|
||||
HandleResult(true);
|
||||
return true;
|
||||
|
|
|
@ -71,7 +71,7 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void InitDirect(int x, int y, int height, int frameofs, String text, Font font, int color, Name command)
|
||||
void InitDirect(double x, double y, int height, int frameofs, String text, Font font, int color, Name command)
|
||||
{
|
||||
Super.Init(x, y, height, command);
|
||||
mText = text;
|
||||
|
@ -113,7 +113,7 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
protected void DrawBorder (int x, int y, int len)
|
||||
protected void DrawBorder (double x, double y, int len)
|
||||
{
|
||||
let left = TexMan.CheckForTexture("M_LSLEFT", TexMan.Type_MiscPatch);
|
||||
let mid = TexMan.CheckForTexture("M_LSCNTR", TexMan.Type_MiscPatch);
|
||||
|
@ -141,7 +141,9 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable
|
|||
}
|
||||
else
|
||||
{
|
||||
screen.Clear(x, y, x + len, y + SmallFont.GetHeight() * 3/2, 0);
|
||||
int xx = int(x - 160) * CleanXfac + screen.GetWidth()/2;
|
||||
int yy = int(y - 100) * CleanXfac + screen.GetHeight()/2;
|
||||
screen.Clear(xx, yy, xx + len*CleanXfac, yy + SmallFont.GetHeight() * CleanYfac * 3/2, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +163,7 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable
|
|||
}
|
||||
|
||||
// Draw player name box
|
||||
int x = mXpos + mFont.StringWidth(text) + 16 + mFrameSize;
|
||||
double x = mXpos + mFont.StringWidth(text) + 16 + mFrameSize;
|
||||
DrawBorder (x, mYpos - mFrameSize, MAXPLAYERNAME+1);
|
||||
if (!mEnter)
|
||||
{
|
||||
|
@ -246,7 +248,7 @@ class ListMenuItemValueText : ListMenuItemSelectable
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void InitDirect(int x, int y, int height, String text, Font font, int color, int valuecolor, Name command, Name values)
|
||||
void InitDirect(double x, double y, int height, String text, Font font, int color, int valuecolor, Name command, Name values)
|
||||
{
|
||||
Super.Init(x, y, height, command);
|
||||
mText = text;
|
||||
|
@ -337,7 +339,7 @@ class ListMenuItemValueText : ListMenuItemSelectable
|
|||
String text = Stringtable.Localize(mText);
|
||||
screen.DrawText(mFont, selected? OptionMenuSettings.mFontColorSelection : mFontColor, mXpos, mYpos, text, DTA_Clean, true);
|
||||
|
||||
int x = mXpos + mFont.StringWidth(text) + 8;
|
||||
double x = mXpos + mFont.StringWidth(text) + 8;
|
||||
if (mSelections.Size() > 0)
|
||||
{
|
||||
screen.DrawText(mFont, mFontColor2, x, mYpos, mSelections[mSelection], DTA_Clean, true);
|
||||
|
@ -385,7 +387,7 @@ class ListMenuItemSlider : ListMenuItemSelectable
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void InitDirect(int x, int y, int height, String text, Font font, int color, Name command, int min, int max, int step)
|
||||
void InitDirect(double x, double y, int height, String text, Font font, int color, Name command, int min, int max, int step)
|
||||
{
|
||||
Super.Init(x, y, height, command);
|
||||
mText = text;
|
||||
|
@ -463,7 +465,7 @@ class ListMenuItemSlider : ListMenuItemSelectable
|
|||
lm.ReleaseFocus();
|
||||
}
|
||||
|
||||
int slide_left = SmallFont.StringWidth ("Green") + 8 + mXpos;
|
||||
int slide_left = SmallFont.StringWidth ("Green") + 8 + int(mXpos);
|
||||
int slide_right = slide_left + 12*8; // 12 char cells with 8 pixels each.
|
||||
|
||||
if (type == Menu.MOUSE_Click)
|
||||
|
@ -491,7 +493,7 @@ class ListMenuItemSlider : ListMenuItemSelectable
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
protected void DrawSlider (int x, int y)
|
||||
protected void DrawSlider (double x, double y)
|
||||
{
|
||||
int range = mMaxrange - mMinrange;
|
||||
int cur = mSelection - mMinrange;
|
||||
|
@ -515,8 +517,8 @@ class ListMenuItemSlider : ListMenuItemSelectable
|
|||
|
||||
screen.DrawText(mFont, selected? OptionMenuSettings.mFontColorSelection : mFontColor, mXpos, mYpos, text, DTA_Clean, true);
|
||||
|
||||
int x = SmallFont.StringWidth ("Green") + 8 + mXpos;
|
||||
int x2 = SmallFont.StringWidth (text) + 8 + mXpos;
|
||||
double x = SmallFont.StringWidth ("Green") + 8 + mXpos;
|
||||
double x2 = SmallFont.StringWidth (text) + 8 + mXpos;
|
||||
DrawSlider (MAX(x2, x), mYpos);
|
||||
}
|
||||
}
|
|
@ -252,8 +252,8 @@ class ListMenuItemPlayerDisplay : ListMenuItem
|
|||
}
|
||||
else
|
||||
{
|
||||
int x = (mXpos - 160) * CleanXfac + (screen.GetWidth() >> 1);
|
||||
int y = (mYpos - 100) * CleanYfac + (screen.GetHeight() >> 1);
|
||||
int x = int(mXpos - 160) * CleanXfac + (screen.GetWidth() >> 1);
|
||||
int y = int(mYpos - 100) * CleanYfac + (screen.GetHeight() >> 1);
|
||||
|
||||
screen.DrawTexture(mBackdrop, false, x, y - 1,
|
||||
DTA_DestWidth, 72 * CleanXfac,
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
**
|
||||
*/
|
||||
|
||||
class ReadThisMenu : Menu
|
||||
class ReadThisMenu : GenericMenu
|
||||
{
|
||||
int mScreen;
|
||||
int mInfoTic;
|
||||
|
@ -44,17 +44,18 @@ class ReadThisMenu : Menu
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
override void Init(Menu parent)
|
||||
{
|
||||
Super.Init(parent);
|
||||
mScreen = 1;
|
||||
mInfoTic = gametic;
|
||||
}
|
||||
|
||||
override void Drawer()
|
||||
{
|
||||
double alpha;
|
||||
TextureID tex, prevpic;
|
||||
|
||||
if (mScreen == 0)
|
||||
{
|
||||
mScreen = 1;
|
||||
mInfoTic = gametic;
|
||||
}
|
||||
|
||||
// Did the mapper choose a custom help page via MAPINFO?
|
||||
if (level.F1Pic.Length() != 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue