mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
* Per Mystic's request, only set the number of lives in the save file if you actually use a continue, or completely wipe out your lives and continues.
* Fix a bug where I got emeralds and mapnumbers mixed up when checking for the "there's a tailsbot" flag. * Consider a save with an invalid skin an invalid save, rather than allowing its continued presence.
This commit is contained in:
parent
fd63db0aaf
commit
42211f02b4
4 changed files with 14 additions and 7 deletions
13
src/g_game.c
13
src/g_game.c
|
@ -3132,6 +3132,9 @@ static void G_DoContinued(void)
|
|||
tokenlist = 0;
|
||||
token = 0;
|
||||
|
||||
if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking) && (!modifiedgame || savemoddata) && cursaveslot >= 0)
|
||||
G_SaveGameOver((UINT32)cursaveslot, true);
|
||||
|
||||
// Reset # of lives
|
||||
pl->lives = (ultimatemode) ? 1 : startinglivesbalance[numgameovers];
|
||||
|
||||
|
@ -3664,7 +3667,7 @@ void G_SaveGame(UINT32 slot)
|
|||
|
||||
#define BADSAVE goto cleanup;
|
||||
#define CHECKPOS if (save_p >= end_p) BADSAVE
|
||||
void G_SaveGameOver(UINT32 slot)
|
||||
void G_SaveGameOver(UINT32 slot, boolean modifylives)
|
||||
{
|
||||
boolean saved = false;
|
||||
size_t length;
|
||||
|
@ -3700,12 +3703,14 @@ void G_SaveGameOver(UINT32 slot)
|
|||
save_p += VERSIONSIZE;
|
||||
|
||||
// P_UnArchiveMisc()
|
||||
fake = READINT16(save_p);
|
||||
(void)READINT16(save_p);
|
||||
CHECKPOS
|
||||
(void)READUINT16(save_p); // emeralds
|
||||
fake = READUINT16(save_p)-357; // emeralds
|
||||
CHECKPOS
|
||||
READSTRINGN(save_p, temp, sizeof(temp)); // mod it belongs to
|
||||
if (strcmp(temp, timeattackfolder)) BADSAVE
|
||||
|
||||
// P_UnArchivePlayer()
|
||||
CHECKPOS
|
||||
(void)READUINT8(save_p);
|
||||
CHECKPOS
|
||||
|
@ -3718,7 +3723,7 @@ void G_SaveGameOver(UINT32 slot)
|
|||
lives_p = save_p;
|
||||
pllives = READSINT8(save_p); // lives
|
||||
CHECKPOS
|
||||
if (pllives < startinglivesbalance[numgameovers])
|
||||
if (modifylives && pllives < startinglivesbalance[numgameovers])
|
||||
{
|
||||
pllives = startinglivesbalance[numgameovers];
|
||||
WRITESINT8(lives_p, pllives);
|
||||
|
|
|
@ -116,7 +116,7 @@ void G_SaveGameData(void);
|
|||
|
||||
void G_SaveGame(UINT32 slot);
|
||||
|
||||
void G_SaveGameOver(UINT32 slot);
|
||||
void G_SaveGameOver(UINT32 slot, boolean modifylives);
|
||||
|
||||
// Only called by startup code.
|
||||
void G_RecordDemo(const char *name);
|
||||
|
|
|
@ -6098,7 +6098,7 @@ static void M_DrawLoadGameData(void)
|
|||
// Use the big face pic for lives, duh. :3
|
||||
V_DrawScaledPatch(ecks + 12, 175, 0, W_CachePatchName("STLIVEX", PU_HUDGFX));
|
||||
if (savegameinfo[saveSlotSelected].lives == 0x7F)
|
||||
V_DrawScaledPatch(ecks + 40 - 18, 172, 0, tallinfin);
|
||||
V_DrawScaledPatch(ecks + 40 - 17, 172, 0, tallinfin);
|
||||
else
|
||||
V_DrawTallNum(ecks + 40, 172, 0, savegameinfo[saveSlotSelected].lives);
|
||||
|
||||
|
@ -6290,8 +6290,10 @@ static void M_ReadSavegameInfo(UINT32 slot)
|
|||
// P_UnArchivePlayer()
|
||||
CHECKPOS
|
||||
savegameinfo[slot].skincolor = READUINT8(save_p);
|
||||
|
||||
CHECKPOS
|
||||
savegameinfo[slot].skinnum = READUINT8(save_p);
|
||||
if (savegameinfo[slot].skinnum >= numskins) BADSAVE
|
||||
|
||||
CHECKPOS
|
||||
(void)READUINT8(save_p); // numgameovers
|
||||
|
|
|
@ -2294,7 +2294,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
{
|
||||
numgameovers++;
|
||||
if ((!modifiedgame || savemoddata) && cursaveslot >= 0)
|
||||
G_SaveGameOver((UINT32)cursaveslot);
|
||||
G_SaveGameOver((UINT32)cursaveslot, (target->player->continues <= 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue