quicksave to classic savegame slot, but skip questions (#440)

* Revert "remove unnecessary string buffer for quicksave questions"

This reverts commit 7516634729144e3718a490f31487e619eff5f5ee.

* Revert "parametrize quicksave file name"

This reverts commit 992e69e59121a5eabe58616e9a6624c5c0a9e24e.

* Revert "skip questions and save to dedicated quicksave slot (#421)"

This reverts commit f567b7ab911f87c5b0c59b23eaa81eda3c57c2e8.

* quicksave to classic savegame slot, but skip questions

* reset quickSaveSlot if it has been deleted
This commit is contained in:
Fabian Greffrath 2022-02-04 10:53:28 +01:00 committed by GitHub
parent 1bf73e5186
commit 7a0b5c6001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 29 deletions

View File

@ -1549,18 +1549,13 @@ void CheckSaveGame(size_t size)
// [FG] support up to 8 pages of savegames
extern int savepage;
extern const int quickSaveSlot;
char* G_SaveGameName(int slot)
{
// Ty 05/04/98 - use savegamename variable (see d_deh.c)
// killough 12/98: add .7 to truncate savegamename
char buf[16] = {0};
// save to dedicated quicksave slot
if (slot == quickSaveSlot)
sprintf(buf, "%.4s%s.dsg", savegamename, "quick");
else
sprintf(buf, "%.7s%d.dsg", savegamename, 10*savepage+slot);
sprintf(buf, "%.7s%d.dsg", savegamename, 10*savepage+slot);
#ifdef _WIN32
if (M_CheckParm("-cdrom"))
@ -1722,15 +1717,6 @@ static void G_DoSaveGame(void)
if (name) (free)(name);
}
// directly save to dedicated quicksave slot
void G_QuickSaveGame(void)
{
savegameslot = quickSaveSlot;
strcpy(savedescription, "quicksave");
// skip the BTS_SAVEGAME round trip
G_DoSaveGame();
}
static void G_DoLoadGame(void)
{
int length, i;

View File

@ -48,7 +48,6 @@ void G_DeferedPlayDemo(char *demo);
void G_LoadGame(char *name, int slot, boolean is_command); // killough 5/15/98
void G_ForcedLoadGame(void); // killough 5/15/98: forced loadgames
void G_SaveGame(int slot, char *description); // Called by M_Responder.
void G_QuickSaveGame();
void G_RecordDemo(char *name); // Only called by startup code.
void G_BeginRecording(void);
void G_PlayDemo(char *name);

View File

@ -86,7 +86,7 @@ int screenblocks; // has default
int screenSize; // temp for screenblocks (0-9)
const int quickSaveSlot = -1; // save to dedicated quicksave slot
int quickSaveSlot; // -1 = no quicksave slot picked!
int messageToPrint; // 1 = message to be printed
@ -799,6 +799,9 @@ static void M_DeleteGame(int i)
char *name = G_SaveGameName(i);
remove(name);
if (i == quickSaveSlot)
quickSaveSlot = -1;
M_ReadSaveStrings();
if (name) (free)(name);
@ -877,16 +880,13 @@ void M_LoadSelect(int choice)
saveg_compat = saveg_woof510;
if (access(name, F_OK) != 0 && choice != quickSaveSlot)
if (access(name, F_OK) != 0)
{
if (name) (free)(name);
name = G_MBFSaveGameName(choice);
saveg_compat = saveg_mbf;
}
if (access(name, F_OK) != 0)
dprintf("loadgame failed!");
else
G_LoadGame(name, choice, false); // killough 3/16/98, 5/15/98: add slot, cmd
M_ClearMenus ();
@ -1039,6 +1039,10 @@ void M_DoSave(int slot)
{
G_SaveGame (slot,savegamestrings[slot]);
M_ClearMenus ();
// PICK QUICKSAVE SLOT YET?
if (quickSaveSlot == -2)
quickSaveSlot = slot;
}
// [FG] generate a default save slot name when the user saves to an empty slot
@ -1490,6 +1494,15 @@ void M_ControllerTurn(int choice)
// M_QuickSave
//
void M_QuickSaveResponse(int ch)
{
if (ch == 'y')
{
M_DoSave(quickSaveSlot);
S_StartSound(NULL,sfx_swtchx);
}
}
void M_QuickSave(void)
{
if (!usergame && (!demoplayback || netgame)) // killough 10/98
@ -1501,10 +1514,15 @@ void M_QuickSave(void)
if (gamestate != GS_LEVEL)
return;
// skip quicksave questions, directly save to dedicated quicksave slot
G_QuickSaveGame();
S_StartSound(NULL,sfx_swtchx);
dprintf("quicksave");
if (quickSaveSlot < 0)
{
M_StartControlPanel();
M_ReadSaveStrings();
M_SetupNextMenu(&SaveDef);
quickSaveSlot = -2; // means to pick a slot now
return;
}
M_QuickSaveResponse('y');
}
/////////////////////////////
@ -1512,6 +1530,15 @@ void M_QuickSave(void)
// M_QuickLoad
//
void M_QuickLoadResponse(int ch)
{
if (ch == 'y')
{
M_LoadSelect(quickSaveSlot);
S_StartSound(NULL,sfx_swtchx);
}
}
void M_QuickLoad(void)
{
if (netgame && !demoplayback) // killough 5/26/98: add !demoplayback
@ -1527,10 +1554,13 @@ void M_QuickLoad(void)
NULL, false); // killough 5/26/98: not externalized
return;
}
// skip quicksave questions
M_LoadSelect(quickSaveSlot);
S_StartSound(NULL,sfx_swtchx);
if (quickSaveSlot < 0)
{
M_StartMessage(s_QSAVESPOT,NULL,false); // Ty 03/27/98 - externalized
return;
}
M_QuickLoadResponse('y');
}
/////////////////////////////
@ -5004,6 +5034,7 @@ boolean M_Responder (event_t* ev)
if (savepage > 0)
{
savepage--;
quickSaveSlot = -1;
M_ReadSaveStrings();
S_StartSound(NULL,sfx_pstop);
}
@ -5014,6 +5045,7 @@ boolean M_Responder (event_t* ev)
if (savepage < savepage_max)
{
savepage++;
quickSaveSlot = -1;
M_ReadSaveStrings();
S_StartSound(NULL,sfx_pstop);
}
@ -6222,6 +6254,7 @@ void M_Init(void)
messageToPrint = 0;
messageString = NULL;
messageLastMenuActive = menuactive;
quickSaveSlot = -1;
// Here we could catch other version dependencies,
// like HELP1/2, and four episodes.