Skip to content

Commit

Permalink
add m_quickexit option for quick exit in game menu
Browse files Browse the repository at this point in the history
Default: off (false)

When this option is enabled (true), then exiting the game from
main menu and by menu_quit command doesn't require confirmation
and doesn't play sound.
  • Loading branch information
mmaulwurff authored and coelckers committed Sep 30, 2019
1 parent 0c2ed71 commit ff9715c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/menu/messagebox.cpp
Expand Up @@ -46,6 +46,8 @@
EXTERN_CVAR (Bool, saveloadconfirmation) // [mxd]
EXTERN_CVAR (Bool, quicksaverotation)

CVAR(Bool, m_quickexit, false, CVAR_ARCHIVE)

typedef void(*hfunc)();
DEFINE_ACTION_FUNCTION(DMessageBoxMenu, CallHandler)
{
Expand Down Expand Up @@ -85,9 +87,14 @@ DMenu *CreateMessageBoxMenu(DMenu *parent, const char *message, int messagemode,

CCMD (menu_quit)
{ // F10
if (m_quickexit)
{
ST_Endoom();
}

M_StartControlPanel (true);

int messageindex = gametic % gameinfo.quitmessages.Size();
const size_t messageindex = static_cast<size_t>(gametic) % gameinfo.quitmessages.Size();
FString EndString;
const char *msg = gameinfo.quitmessages[messageindex];
if (msg[0] == '$')
Expand Down
4 changes: 4 additions & 0 deletions wadsrc/static/menudef.txt
Expand Up @@ -1202,6 +1202,10 @@ OptionMenu "MiscOptions" protected
SafeCommand "$MISCMNU_CLEARNODECACHE", "clearnodecache"
StaticText " "
Option "$OPTMNU_LANGUAGE", "language", "LanguageOptions"

StaticText " "
Option "$MISCMNU_QUICKEXIT", "m_quickexit", "OnOff"

IfOption(Windows)
{
StaticText " "
Expand Down

0 comments on commit ff9715c

Please sign in to comment.