mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-20 18:01:16 +00:00
Added lastmaploaded to replace the lastmapsaved check
This allows saving in special cases where you can go to a map that doesn't save, and then back to the map you saved on (see: SUBARASHII special stages), while still preventing you from killing your lives by repeatedly retrying in said map. Kept lastmapsaved just in case. Can be removed if deemed unnecessary.
This commit is contained in:
parent
0b05b10bdb
commit
9d17466d99
5 changed files with 13 additions and 6 deletions
|
@ -709,7 +709,8 @@ void D_StartTitle(void)
|
|||
botskin = 0;
|
||||
cv_debug = 0;
|
||||
emeralds = 0;
|
||||
|
||||
lastmaploaded = 0;
|
||||
|
||||
// In case someone exits out at the same time they start a time attack run,
|
||||
// reset modeattacking
|
||||
modeattacking = ATTACKING_NONE;
|
||||
|
|
|
@ -42,6 +42,7 @@ extern UINT8 globalweather;
|
|||
extern INT32 curWeather;
|
||||
extern INT32 cursaveslot;
|
||||
extern INT16 lastmapsaved;
|
||||
extern INT16 lastmaploaded;
|
||||
extern boolean gamecomplete;
|
||||
|
||||
#define PRECIP_NONE 0
|
||||
|
|
|
@ -78,6 +78,7 @@ UINT8 globalweather = 0;
|
|||
INT32 curWeather = PRECIP_NONE;
|
||||
INT32 cursaveslot = -1; // Auto-save 1p savegame slot
|
||||
INT16 lastmapsaved = 0; // Last map we auto-saved at
|
||||
INT16 lastmaploaded = 0; // Last map the game loaded
|
||||
boolean gamecomplete = false;
|
||||
|
||||
UINT16 mainwads = 0;
|
||||
|
|
|
@ -3160,7 +3160,8 @@ static inline void P_ArchiveMisc(void)
|
|||
WRITEINT16(save_p, gamemap);
|
||||
|
||||
lastmapsaved = gamemap;
|
||||
|
||||
lastmaploaded = gamemap;
|
||||
|
||||
WRITEUINT16(save_p, (botskin ? (emeralds|(1<<10)) : emeralds)+357);
|
||||
WRITESTRINGN(save_p, timeattackfolder, sizeof(timeattackfolder));
|
||||
}
|
||||
|
@ -3185,7 +3186,8 @@ static inline void P_UnArchiveSPGame(INT16 mapoverride)
|
|||
P_AllocMapHeader(gamemap-1);
|
||||
|
||||
lastmapsaved = gamemap;
|
||||
|
||||
lastmaploaded = gamemap;
|
||||
|
||||
tokenlist = 0;
|
||||
token = 0;
|
||||
|
||||
|
|
|
@ -2984,10 +2984,12 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
P_RunCachedActions();
|
||||
|
||||
if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking || players[consoleplayer].lives <= 0)
|
||||
&& (!modifiedgame || savemoddata) && cursaveslot >= 0 && !ultimatemode && !(G_IsSpecialStage(gamemap)) && !(mapheaderinfo[gamemap-1]->savemode == 2)
|
||||
&& ((mapheaderinfo[gamemap-1]->savemode == 1) || (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU) && gamemap != lastmapsaved && (mapheaderinfo[gamemap-1]->actnum < 2 || gamecomplete))))
|
||||
&& (!modifiedgame || savemoddata) && cursaveslot >= 0 && !ultimatemode && !(G_IsSpecialStage(gamemap)) && (gamemap != lastmaploaded) && !(mapheaderinfo[gamemap-1]->savemode == 2)
|
||||
&& ((mapheaderinfo[gamemap-1]->savemode == 1) || (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU) && (mapheaderinfo[gamemap-1]->actnum < 2 || gamecomplete))))
|
||||
G_SaveGame((UINT32)cursaveslot);
|
||||
|
||||
lastmaploaded = gamemap; // HAS to be set after saving!!
|
||||
|
||||
if (savedata.lives > 0)
|
||||
{
|
||||
players[consoleplayer].continues = savedata.continues;
|
||||
|
@ -3014,7 +3016,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
LUAh_MapLoad();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue