From 81a5273b586f580b50a13d13195bc75f5abf2dc9 Mon Sep 17 00:00:00 2001 From: MaxED Date: Thu, 3 Mar 2016 11:27:37 +0300 Subject: [PATCH] Added "Miscellaneous Options" -> "Save/Load confirmation" option (defaults to true). When disabled, confirmation dialog won't be shown when performing quicksave/quickload. --- src/g_game.cpp | 1 + src/menu/messagebox.cpp | 26 ++++++++++++++++++++++---- wadsrc/static/language.enu | 1 + wadsrc/static/menudef.txt | 1 + 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 2532acd0f..627853acb 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2064,6 +2064,7 @@ FString G_BuildSaveName (const char *prefix, int slot) CVAR (Int, autosavenum, 0, CVAR_NOSET|CVAR_ARCHIVE|CVAR_GLOBALCONFIG) static int nextautosave = -1; CVAR (Int, disableautosave, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +CVAR (Bool, saveloadconfirmation, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // [mxd] CUSTOM_CVAR (Int, autosavecount, 4, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { if (self < 0) diff --git a/src/menu/messagebox.cpp b/src/menu/messagebox.cpp index 2d07ee51d..601c3e736 100644 --- a/src/menu/messagebox.cpp +++ b/src/menu/messagebox.cpp @@ -47,6 +47,7 @@ extern FSaveGameNode *quickSaveSlot; +EXTERN_CVAR (Bool, saveloadconfirmation) // [mxd] class DMessageBoxMenu : public DMenu { @@ -588,13 +589,22 @@ CCMD (quicksave) if (gamestate != GS_LEVEL) return; - S_Sound (CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE); if (quickSaveSlot == NULL) { + S_Sound(CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE); M_StartControlPanel(false); M_SetMenu(NAME_Savegamemenu); return; } + + // [mxd]. Just save the game, no questions asked. + if (!saveloadconfirmation) + { + G_SaveGame(quickSaveSlot->Filename.GetChars(), quickSaveSlot->Title); + return; + } + + S_Sound(CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE); DMenu *newmenu = new DQuickSaveMenu(false); newmenu->mParentMenu = DMenu::CurrentMenu; M_ActivateMenu(newmenu); @@ -666,22 +676,30 @@ void DQuickLoadMenu::HandleResult(bool res) CCMD (quickload) { // F9 - M_StartControlPanel (true); - if (netgame) { + M_StartControlPanel(true); M_StartMessage (GStrings("QLOADNET"), 1); return; } if (quickSaveSlot == NULL) { - M_StartControlPanel(false); + M_StartControlPanel(true); // signal that whatever gets loaded should be the new quicksave quickSaveSlot = (FSaveGameNode *)1; M_SetMenu(NAME_Loadgamemenu); return; } + + // [mxd]. Just load the game, no questions asked. + if (!saveloadconfirmation) + { + G_LoadGame(quickSaveSlot->Filename.GetChars()); + return; + } + + M_StartControlPanel(true); DMenu *newmenu = new DQuickLoadMenu(false); newmenu->mParentMenu = DMenu::CurrentMenu; M_ActivateMenu(newmenu); diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 95b7fad1a..e507a8d68 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1853,6 +1853,7 @@ MISCMNU_QUERYIWAD = "Show IWAD selection dialog"; MISCMNU_ALLCHEATS = "Enable cheats from all games"; MISCMNU_ENABLEAUTOSAVES = "Enable autosaves"; MISCMNU_AUTOSAVECOUNT = "Number of autosaves"; +MISCMNU_SAVELOADCONFIRMATION = "Save/Load confirmation"; MISCMNU_DEHLOAD = "Load *.deh/*.bex lumps"; MISCMNU_CACHENODES = "Cache nodes"; MISCMNU_CACHETIME = "Time threshold for node caching"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index a36ecc764..a1f654b97 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -892,6 +892,7 @@ OptionMenu "MiscOptions" StaticText " " Option "$MISCMNU_ALLCHEATS", "allcheats", "OnOff" Option "$MISCMNU_ENABLEAUTOSAVES", "disableautosave", "Autosave" + Option "$MISCMNU_SAVELOADCONFIRMATION", "saveloadconfirmation", "OnOff" Slider "$MISCMNU_AUTOSAVECOUNT", "autosavecount", 1, 20, 1, 0 Option "$MISCMNU_DEHLOAD", "dehload", "dehopt" StaticText " "