Added "Miscellaneous Options" -> "Save/Load confirmation" option (defaults to true). When disabled, confirmation dialog won't be shown when performing quicksave/quickload.

This commit is contained in:
MaxED 2016-03-03 11:27:37 +03:00 committed by Christoph Oelckers
parent 59ad6206de
commit 81a5273b58
4 changed files with 25 additions and 4 deletions

View file

@ -2064,6 +2064,7 @@ FString G_BuildSaveName (const char *prefix, int slot)
CVAR (Int, autosavenum, 0, CVAR_NOSET|CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Int, autosavenum, 0, CVAR_NOSET|CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
static int nextautosave = -1; static int nextautosave = -1;
CVAR (Int, disableautosave, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) 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) CUSTOM_CVAR (Int, autosavecount, 4, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{ {
if (self < 0) if (self < 0)

View file

@ -47,6 +47,7 @@
extern FSaveGameNode *quickSaveSlot; extern FSaveGameNode *quickSaveSlot;
EXTERN_CVAR (Bool, saveloadconfirmation) // [mxd]
class DMessageBoxMenu : public DMenu class DMessageBoxMenu : public DMenu
{ {
@ -588,13 +589,22 @@ CCMD (quicksave)
if (gamestate != GS_LEVEL) if (gamestate != GS_LEVEL)
return; return;
S_Sound (CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE);
if (quickSaveSlot == NULL) if (quickSaveSlot == NULL)
{ {
S_Sound(CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE);
M_StartControlPanel(false); M_StartControlPanel(false);
M_SetMenu(NAME_Savegamemenu); M_SetMenu(NAME_Savegamemenu);
return; 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); DMenu *newmenu = new DQuickSaveMenu(false);
newmenu->mParentMenu = DMenu::CurrentMenu; newmenu->mParentMenu = DMenu::CurrentMenu;
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
@ -666,22 +676,30 @@ void DQuickLoadMenu::HandleResult(bool res)
CCMD (quickload) CCMD (quickload)
{ // F9 { // F9
M_StartControlPanel (true);
if (netgame) if (netgame)
{ {
M_StartControlPanel(true);
M_StartMessage (GStrings("QLOADNET"), 1); M_StartMessage (GStrings("QLOADNET"), 1);
return; return;
} }
if (quickSaveSlot == NULL) if (quickSaveSlot == NULL)
{ {
M_StartControlPanel(false); M_StartControlPanel(true);
// signal that whatever gets loaded should be the new quicksave // signal that whatever gets loaded should be the new quicksave
quickSaveSlot = (FSaveGameNode *)1; quickSaveSlot = (FSaveGameNode *)1;
M_SetMenu(NAME_Loadgamemenu); M_SetMenu(NAME_Loadgamemenu);
return; 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); DMenu *newmenu = new DQuickLoadMenu(false);
newmenu->mParentMenu = DMenu::CurrentMenu; newmenu->mParentMenu = DMenu::CurrentMenu;
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);

View file

@ -1853,6 +1853,7 @@ MISCMNU_QUERYIWAD = "Show IWAD selection dialog";
MISCMNU_ALLCHEATS = "Enable cheats from all games"; MISCMNU_ALLCHEATS = "Enable cheats from all games";
MISCMNU_ENABLEAUTOSAVES = "Enable autosaves"; MISCMNU_ENABLEAUTOSAVES = "Enable autosaves";
MISCMNU_AUTOSAVECOUNT = "Number of autosaves"; MISCMNU_AUTOSAVECOUNT = "Number of autosaves";
MISCMNU_SAVELOADCONFIRMATION = "Save/Load confirmation";
MISCMNU_DEHLOAD = "Load *.deh/*.bex lumps"; MISCMNU_DEHLOAD = "Load *.deh/*.bex lumps";
MISCMNU_CACHENODES = "Cache nodes"; MISCMNU_CACHENODES = "Cache nodes";
MISCMNU_CACHETIME = "Time threshold for node caching"; MISCMNU_CACHETIME = "Time threshold for node caching";

View file

@ -892,6 +892,7 @@ OptionMenu "MiscOptions"
StaticText " " StaticText " "
Option "$MISCMNU_ALLCHEATS", "allcheats", "OnOff" Option "$MISCMNU_ALLCHEATS", "allcheats", "OnOff"
Option "$MISCMNU_ENABLEAUTOSAVES", "disableautosave", "Autosave" Option "$MISCMNU_ENABLEAUTOSAVES", "disableautosave", "Autosave"
Option "$MISCMNU_SAVELOADCONFIRMATION", "saveloadconfirmation", "OnOff"
Slider "$MISCMNU_AUTOSAVECOUNT", "autosavecount", 1, 20, 1, 0 Slider "$MISCMNU_AUTOSAVECOUNT", "autosavecount", 1, 20, 1, 0
Option "$MISCMNU_DEHLOAD", "dehload", "dehopt" Option "$MISCMNU_DEHLOAD", "dehload", "dehopt"
StaticText " " StaticText " "