Introduce NOEXIT build option to disable Quit Game options in menus
This commit is contained in:
parent
df830f6495
commit
3546b41be0
10 changed files with 26 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ void UiMainMenuSelect(int value)
|
|||
MainMenuResult = (_mainmenu_selections)vecMenuItems[value]->m_value;
|
||||
}
|
||||
|
||||
#ifndef NOEXIT
|
||||
void MainmenuEsc()
|
||||
{
|
||||
std::size_t last = vecMenuItems.size() - 1;
|
||||
|
|
@ -28,6 +29,7 @@ void MainmenuEsc()
|
|||
SelectedItem = last;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainmenuLoad(const char *name, void (*fnSound)(const char *file))
|
||||
{
|
||||
|
|
@ -38,7 +40,9 @@ void MainmenuLoad(const char *name, void (*fnSound)(const char *file))
|
|||
vecMenuItems.push_back(std::make_unique<UiListItem>(_("Settings"), MAINMENU_SETTINGS));
|
||||
vecMenuItems.push_back(std::make_unique<UiListItem>(_("Support"), MAINMENU_SHOW_SUPPORT));
|
||||
vecMenuItems.push_back(std::make_unique<UiListItem>(_("Show Credits"), MAINMENU_SHOW_CREDITS));
|
||||
#ifndef NOEXIT
|
||||
vecMenuItems.push_back(std::make_unique<UiListItem>(gbIsHellfire ? _("Exit Hellfire") : _("Exit Diablo"), MAINMENU_EXIT_DIABLO));
|
||||
#endif
|
||||
|
||||
if (!gbIsSpawn || gbIsHellfire) {
|
||||
if (gbIsHellfire)
|
||||
|
|
@ -61,7 +65,11 @@ void MainmenuLoad(const char *name, void (*fnSound)(const char *file))
|
|||
SDL_Rect rect2 = { 17, (Sint16)(gnScreenHeight - 36), 605, 21 };
|
||||
vecMainMenuDialog.push_back(std::make_unique<UiArtText>(name, rect2, UiFlags::FontSize12 | UiFlags::ColorUiSilverDark));
|
||||
|
||||
#ifndef NOEXIT
|
||||
UiInitList(nullptr, UiMainMenuSelect, MainmenuEsc, vecMainMenuDialog, true);
|
||||
#else
|
||||
UiInitList(nullptr, UiMainMenuSelect, nullptr, vecMainMenuDialog, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainmenuFree()
|
||||
|
|
|
|||
|
|
@ -1455,12 +1455,14 @@ void InitKeymapActions()
|
|||
[] { gamemenu_load_game(false); },
|
||||
nullptr,
|
||||
[&]() { return !gbIsMultiplayer && gbValidSaveFile && stextflag == STORE_NONE && IsGameRunning(); });
|
||||
#ifndef NOEXIT
|
||||
sgOptions.Keymapper.AddAction(
|
||||
"QuitGame",
|
||||
N_("Quit game"),
|
||||
N_("Closes the game."),
|
||||
DVL_VK_INVALID,
|
||||
[] { gamemenu_quit_game(false); });
|
||||
#endif
|
||||
sgOptions.Keymapper.AddAction(
|
||||
"StopHero",
|
||||
N_("Stop hero"),
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ TMenuItem sgSingleMenu[] = {
|
|||
{ GMENU_ENABLED, N_("Options"), &GamemenuOptions },
|
||||
{ GMENU_ENABLED, N_("New Game"), &GamemenuNewGame },
|
||||
{ GMENU_ENABLED, N_("Load Game"), &gamemenu_load_game },
|
||||
#ifndef NOEXIT
|
||||
{ GMENU_ENABLED, N_("Quit Game"), &gamemenu_quit_game },
|
||||
#endif
|
||||
{ GMENU_ENABLED, nullptr, nullptr }
|
||||
// clang-format on
|
||||
};
|
||||
|
|
@ -47,7 +49,9 @@ TMenuItem sgMultiMenu[] = {
|
|||
{ GMENU_ENABLED, N_("Options"), &GamemenuOptions },
|
||||
{ GMENU_ENABLED, N_("New Game"), &GamemenuNewGame },
|
||||
{ GMENU_ENABLED, N_("Restart In Town"), &GamemenuRestartTown },
|
||||
#ifndef NOEXIT
|
||||
{ GMENU_ENABLED, N_("Quit Game"), &gamemenu_quit_game },
|
||||
#endif
|
||||
{ GMENU_ENABLED, nullptr, nullptr },
|
||||
// clang-format on
|
||||
};
|
||||
|
|
@ -290,11 +294,13 @@ void GamemenuSpeed(bool bActivate)
|
|||
|
||||
} // namespace
|
||||
|
||||
#ifndef NOEXIT
|
||||
void gamemenu_quit_game(bool bActivate)
|
||||
{
|
||||
GamemenuNewGame(bActivate);
|
||||
gbRunGameResult = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void gamemenu_load_game(bool /*bActivate*/)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ namespace devilution {
|
|||
void gamemenu_on();
|
||||
void gamemenu_off();
|
||||
void gamemenu_handle_previous();
|
||||
#ifndef NOEXIT
|
||||
void gamemenu_quit_game(bool bActivate);
|
||||
#endif
|
||||
void gamemenu_load_game(bool bActivate);
|
||||
void gamemenu_save_game(bool bActivate);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue