Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hexen: Fix wrong save being deleted #1227

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/hexen/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -2094,7 +2094,8 @@ void G_LoadGame(int slot)
void G_DoLoadGame(void)
{
gameaction = ga_nothing;
SV_LoadGame(GameLoadSlot);
// [crispy] support multiple pages of saves
SV_LoadGame(GameLoadSlot + savepage * 10);
if (!netgame)
{ // Copy the base slot to the reborn slot
SV_UpdateRebornSlot();
Expand Down Expand Up @@ -2127,7 +2128,8 @@ void G_SaveGame(int slot, char *description)

void G_DoSaveGame(void)
{
SV_SaveGame(savegameslot, savedescription);
// [crispy] support multiple pages of saves
SV_SaveGame(savegameslot + savepage * 10, savedescription);
gameaction = ga_nothing;
savedescription[0] = 0;
P_SetMessage(&players[consoleplayer], TXT_GAMESAVED, true);
Expand Down
4 changes: 3 additions & 1 deletion src/hexen/mn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ int InfoType;
int messageson = true;
boolean mn_SuicideConsole;

int savepage; // [crispy] support 8 pages of savegames

// PRIVATE DATA DEFINITIONS ------------------------------------------------

static int FontABaseLump;
Expand Down Expand Up @@ -1263,7 +1265,7 @@ static void SCDeleteGame(int option)
return;
}

SV_ClearSaveSlot(option);
SV_ClearSaveSlot(option + savepage * 10);
CurrentMenu->oldItPos = CurrentItPos;
MN_LoadSlotText();
BorderNeedRefresh = true;
Expand Down
20 changes: 0 additions & 20 deletions src/hexen/sv_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ char *SavePath = DEFAULT_SAVEPATH;

int vanilla_savegame_limit = 1;

int savepage; // [crispy] support 8 pages of savegames

// PRIVATE DATA DEFINITIONS ------------------------------------------------

static int MobjCount;
Expand Down Expand Up @@ -1980,12 +1978,6 @@ void SV_SaveGame(int slot, const char *description)
char versionText[HXS_VERSION_TEXT_LENGTH];
unsigned int i;

// [crispy] get expanded save slot number
if (slot != BASE_SLOT && slot != REBORN_SLOT)
{
slot += savepage * 10;
}

// Open the output file
M_snprintf(fileName, sizeof(fileName), "%shex%d.hxs", SavePath, BASE_SLOT);
SV_OpenWrite(fileName);
Expand Down Expand Up @@ -2092,12 +2084,6 @@ void SV_LoadGame(int slot)

p = &players[consoleplayer]; // [crispy]

// [crispy] get expanded save slot number
if (slot != BASE_SLOT && slot != REBORN_SLOT)
{
slot += savepage * 10;
}

// Copy all needed save files to the base slot
if (slot != BASE_SLOT)
{
Expand Down Expand Up @@ -3284,12 +3270,6 @@ void SV_ClearSaveSlot(int slot)
int i;
char fileName[100];

// [crispy] get expanded save slot number
if (slot != BASE_SLOT && slot != REBORN_SLOT)
{
slot += savepage * 10;
}

for (i = 0; i < MAX_MAPS; i++)
{
M_snprintf(fileName, sizeof(fileName),
Expand Down
Loading