Skip to content

Commit

Permalink
Save new stats without changing savegame version
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Sep 13, 2024
1 parent 1c61d2c commit b90a50e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 40 deletions.
47 changes: 11 additions & 36 deletions src/p_saveg.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,21 +526,9 @@ static void saveg_read_player_t(void)
for (int i = 0; i < NUMWEAPONS; i++)
viewplayer->shotssuccessful[i] = saveg_read32();

if (!M_StringCompare(savegameversion, DOOMRETRO_SAVEGAMEVERSION_3_6))
{
viewplayer->shotssuccessful_incinerator = saveg_read32();
viewplayer->shotssuccessful_calamityblade = saveg_read32();
}

for (int i = 0; i < NUMWEAPONS; i++)
viewplayer->shotsfired[i] = saveg_read32();

if (!M_StringCompare(savegameversion, DOOMRETRO_SAVEGAMEVERSION_3_6))
{
viewplayer->shotsfired_incinerator = saveg_read32();
viewplayer->shotsfired_calamityblade = saveg_read32();
}

viewplayer->deaths = saveg_read32();

for (int i = 0; i < NUMMOBJTYPES; i++)
Expand All @@ -551,9 +539,6 @@ static void saveg_read_player_t(void)
viewplayer->itemspickedup_ammo_bullets = saveg_read32();
viewplayer->itemspickedup_ammo_cells = saveg_read32();

if (!M_StringCompare(savegameversion, DOOMRETRO_SAVEGAMEVERSION_3_6))
viewplayer->itemspickedup_ammo_fuel = saveg_read32();

viewplayer->itemspickedup_ammo_rockets = saveg_read32();
viewplayer->itemspickedup_ammo_shells = saveg_read32();
viewplayer->itemspickedup_armor = saveg_read32();
Expand All @@ -578,12 +563,11 @@ static void saveg_read_player_t(void)

viewplayer->itemspickedup_keys = saveg_read32();

// [BH] For future features without breaking savegame compatibility
saveg_read32();
saveg_read32();
saveg_read32();
saveg_read32();
saveg_read32();
viewplayer->shotssuccessful_incinerator = saveg_read32();
viewplayer->shotssuccessful_calamityblade = saveg_read32();
viewplayer->shotsfired_incinerator = saveg_read32();
viewplayer->shotsfired_calamityblade = saveg_read32();
viewplayer->itemspickedup_ammo_fuel = saveg_read32();
}

static void saveg_write_player_t(void)
Expand Down Expand Up @@ -654,15 +638,9 @@ static void saveg_write_player_t(void)
for (int i = 0; i < NUMWEAPONS; i++)
saveg_write32(viewplayer->shotssuccessful[i]);

saveg_write32(viewplayer->shotssuccessful_incinerator);
saveg_write32(viewplayer->shotssuccessful_calamityblade);

for (int i = 0; i < NUMWEAPONS; i++)
saveg_write32(viewplayer->shotsfired[i]);

saveg_write32(viewplayer->shotsfired_incinerator);
saveg_write32(viewplayer->shotsfired_calamityblade);

saveg_write32(viewplayer->deaths);

for (int i = 0; i < NUMMOBJTYPES; i++)
Expand All @@ -672,7 +650,6 @@ static void saveg_write_player_t(void)
saveg_write32(viewplayer->gamessaved);
saveg_write32(viewplayer->itemspickedup_ammo_bullets);
saveg_write32(viewplayer->itemspickedup_ammo_cells);
saveg_write32(viewplayer->itemspickedup_ammo_fuel);
saveg_write32(viewplayer->itemspickedup_ammo_rockets);
saveg_write32(viewplayer->itemspickedup_ammo_shells);
saveg_write32(viewplayer->itemspickedup_armor);
Expand All @@ -696,12 +673,11 @@ static void saveg_write_player_t(void)

saveg_write32(viewplayer->itemspickedup_keys);

// [BH] For future features without breaking savegame compatibility
saveg_write32(0);
saveg_write32(0);
saveg_write32(0);
saveg_write32(0);
saveg_write32(0);
saveg_write32(viewplayer->shotssuccessful_incinerator);
saveg_write32(viewplayer->shotssuccessful_calamityblade);
saveg_write32(viewplayer->shotsfired_incinerator);
saveg_write32(viewplayer->shotsfired_calamityblade);
saveg_write32(viewplayer->itemspickedup_ammo_fuel);
}

//
Expand Down Expand Up @@ -1054,8 +1030,7 @@ bool P_ReadSaveGameHeader(char *description)
for (int i = 0; i < VERSIONSIZE; i++)
savegameversion[i] = saveg_read8();

if (!M_StringCompare(savegameversion, DOOMRETRO_SAVEGAMEVERSION_3_6)
&& !M_StringCompare(savegameversion, DOOMRETRO_SAVEGAMEVERSION_5_6))
if (!M_StringCompare(savegameversion, DOOMRETRO_SAVEGAMEVERSIONSTRING))
{
menuactive = false;
quicksaveslot = -1;
Expand Down
5 changes: 1 addition & 4 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
#define DOOMRETRO_VERSION 5,6,0,0
#define DOOMRETRO_VERSIONSTRING "5.6"
#define DOOMRETRO_NAMEANDVERSIONSTRING "DOOM Retro v5.6"

#define DOOMRETRO_SAVEGAMEVERSION_3_6 "DOOM Retro v3.6"
#define DOOMRETRO_SAVEGAMEVERSION_5_6 "DOOM Retro v5.6"
#define DOOMRETRO_SAVEGAMEVERSIONSTRING DOOMRETRO_SAVEGAMEVERSION_5_6
#define DOOMRETRO_SAVEGAMEVERSIONSTRING "DOOM Retro v3.6"

#define DOOMRETRO "doomretro"
#define DOOMRETRO_AUTOLOADFOLDER "autoload"
Expand Down

0 comments on commit b90a50e

Please sign in to comment.