mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 13:00:43 +00:00
- made some adjustments to DMessageBoxMenu to handle screens that must close the menu before performing their option.
Fixes #173. The "End Game" menu option needs this.
This commit is contained in:
parent
2d545767ef
commit
2dad86a304
3 changed files with 8 additions and 4 deletions
|
@ -766,7 +766,7 @@ void I_ReleaseMouseCapture();
|
||||||
struct MenuClassDescriptor;
|
struct MenuClassDescriptor;
|
||||||
extern TArray<MenuClassDescriptor*> menuClasses;
|
extern TArray<MenuClassDescriptor*> menuClasses;
|
||||||
|
|
||||||
using hFunc = std::function<void(bool)>;
|
using hFunc = std::function<bool(bool)>;
|
||||||
DMenu* CreateMessageBoxMenu(DMenu* parent, const char* message, int messagemode, int scriptID, bool playsound, FName action = NAME_None, hFunc handler = nullptr);
|
DMenu* CreateMessageBoxMenu(DMenu* parent, const char* message, int messagemode, int scriptID, bool playsound, FName action = NAME_None, hFunc handler = nullptr);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class DMessageBoxMenu : public DMenu
|
||||||
int messageSelection;
|
int messageSelection;
|
||||||
int mMouseLeft, mMouseRight, mMouseY;
|
int mMouseLeft, mMouseRight, mMouseY;
|
||||||
FName mAction;
|
FName mAction;
|
||||||
std::function<void(bool)> mActionFunc;
|
std::function<bool(bool)> mActionFunc;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -170,8 +170,7 @@ void DMessageBoxMenu::HandleResult(bool res)
|
||||||
{
|
{
|
||||||
if (mActionFunc)
|
if (mActionFunc)
|
||||||
{
|
{
|
||||||
mActionFunc(res);
|
if (mActionFunc(res)) Close();
|
||||||
Close();
|
|
||||||
}
|
}
|
||||||
else if (mAction == NAME_None && mParentMenu)
|
else if (mAction == NAME_None && mParentMenu)
|
||||||
{
|
{
|
||||||
|
@ -433,7 +432,9 @@ CCMD (menu_endgame)
|
||||||
STAT_Cancel();
|
STAT_Cancel();
|
||||||
M_ClearMenus();
|
M_ClearMenus();
|
||||||
gi->QuitToTitle();
|
gi->QuitToTitle();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
M_ActivateMenu(newmenu);
|
M_ActivateMenu(newmenu);
|
||||||
|
@ -456,6 +457,7 @@ CCMD (menu_quit)
|
||||||
DMenu *newmenu = CreateMessageBoxMenu(CurrentMenu, EndString, 0, 500, false, NAME_None, [](bool res)
|
DMenu *newmenu = CreateMessageBoxMenu(CurrentMenu, EndString, 0, 500, false, NAME_None, [](bool res)
|
||||||
{
|
{
|
||||||
if (res) gi->ExitFromMenu();
|
if (res) gi->ExitFromMenu();
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
M_ActivateMenu(newmenu);
|
M_ActivateMenu(newmenu);
|
||||||
|
|
|
@ -668,6 +668,7 @@ CCMD(quicksave)
|
||||||
{
|
{
|
||||||
savegameManager.SaveGame(savegameManager.quickSaveSlot, true, true);
|
savegameManager.SaveGame(savegameManager.quickSaveSlot, true, true);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
M_ActivateMenu(newmenu);
|
M_ActivateMenu(newmenu);
|
||||||
|
@ -716,6 +717,7 @@ CCMD(quickload)
|
||||||
{
|
{
|
||||||
savegameManager.LoadGame(savegameManager.quickSaveSlot);
|
savegameManager.LoadGame(savegameManager.quickSaveSlot);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
M_ActivateMenu(newmenu);
|
M_ActivateMenu(newmenu);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue