From 22b492a5b33537a1f1cc183fb10930682eda3325 Mon Sep 17 00:00:00 2001 From: NY00123 Date: Mon, 13 Jul 2020 23:20:14 +0300 Subject: [PATCH] SW: If a saved load is loaded at a point which is right after killing a boss, ensure that FinishTimer and FinishAnim are appropriately updated. This commit bumps GameVersion. Additionally, the set of FinishAnim to 0 in NewLevel had to move to a different location (InitLevelGlobals2), so it doesn't override the value stored in the saved game. # Conflicts: # source/sw/src/game.cpp --- source/sw/src/game.cpp | 5 ++--- source/sw/src/save.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 360918c8a..c47652f5a 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -140,8 +140,7 @@ SWBOOL Global_PLock = TRUE; SWBOOL Global_PLock = FALSE; #endif -// 12 was original source release. For future releases increment by two. -int GameVersion = 17; +int GameVersion = 20; char DemoText[3][64]; int DemoTextYstart = 0; @@ -943,6 +942,7 @@ void InitLevelGlobals2(void) InitTimingVars(); TotalKillable = 0; Bunny_Count = 0; + FinishAnim = 0; } void @@ -1339,7 +1339,6 @@ void NewLevel(void) STAT_Update(true); } } - FinishAnim = 0; } diff --git a/source/sw/src/save.cpp b/source/sw/src/save.cpp index ef0fb741a..77957cee2 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -82,6 +82,8 @@ extern SWBOOL NewGame; extern char CacheLastLevel[]; extern short PlayingLevel; extern int GodMode; +extern int FinishTimer; +extern SWBOOL FinishAnim; extern int GameVersion; //extern short Zombies; @@ -664,6 +666,9 @@ bool GameInterface::SaveGame(FSaveGameNode *sv) MWRITE(UserMapName,sizeof(UserMapName),1,fil); MWRITE(&GodMode,sizeof(GodMode),1,fil); + MWRITE(&FinishTimer,sizeof(FinishTimer),1,fil); + MWRITE(&FinishAnim,sizeof(FinishAnim),1,fil); + MWRITE(&serpwasseen, sizeof(serpwasseen), 1, fil); MWRITE(&sumowasseen, sizeof(sumowasseen), 1, fil); MWRITE(&zillawasseen, sizeof(zillawasseen), 1, fil); @@ -1051,6 +1056,9 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) MREAD(UserMapName,sizeof(UserMapName),1,fil); MREAD(&GodMode,sizeof(GodMode),1,fil); + MREAD(&FinishTimer,sizeof(FinishTimer),1,fil); + MREAD(&FinishAnim,sizeof(FinishAnim),1,fil); + MREAD(&serpwasseen, sizeof(serpwasseen), 1, fil); MREAD(&sumowasseen, sizeof(sumowasseen), 1, fil); MREAD(&zillawasseen, sizeof(zillawasseen), 1, fil);