From 1c0362d22f2d16fa87ff4789001e6a4f549eb3ec Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Mon, 11 Apr 2016 00:09:35 +0100 Subject: DRASCULA: Improve loading savegames in Pendulum scene The previous fix only fixed the incomplete state when loading from the launcher. Now this is fixed when loading from the game as well. It also fixes loading a savegame from the first stage of the pendulum scene (when the protagonist is not visible) to any other scene in chapter 6. The protagonist was not made visible again when loading the savegame. --- engines/drascula/saveload.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'engines/drascula/saveload.cpp') diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp index d0f16aa941..e67ada50fa 100644 --- a/engines/drascula/saveload.cpp +++ b/engines/drascula/saveload.cpp @@ -255,6 +255,19 @@ bool DrasculaEngine::loadGame(int slot) { if (!(in = _saveFileMan->openForLoading(saveFileName))) { error("missing savegame file %s", saveFileName.c_str()); } + + // If we currently are in room 102 while being attached below the pendulum + // the character is invisible and some surface are temporarily used for other + // things. Reset those before loading the savegame otherwise we may have some + // issues such as the protagonist being invisible after reloading a savegame. + if (_roomNumber == 102 && flags[1] == 2) { + hare_se_ve = 1; + loadPic(96, frontSurface); + loadPic(97, frontSurface); + loadPic(97, extraSurface); + loadPic(99, backSurface); + } + loadMetaData(in, slot, true); Graphics::skipThumbnail(*in); @@ -289,6 +302,11 @@ bool DrasculaEngine::loadGame(int slot) { } enterRoom(roomNum); selectVerb(kVerbNone); + + // When loading room 102 while being attached below the pendulum we + // need to call activatePendulum() to properly initialized the scene. + if (_roomNumber == 102 && flags[1] == 2) + activatePendulum(); return true; } -- cgit v1.2.3 From a97f9d0ec6f0006add3d0a47f33074f1ee731b36 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Mon, 11 Apr 2016 01:22:31 +0100 Subject: DRASCULA: Rename variable to clarify its meaning --- engines/drascula/saveload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/drascula/saveload.cpp') diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp index e67ada50fa..9063fbc792 100644 --- a/engines/drascula/saveload.cpp +++ b/engines/drascula/saveload.cpp @@ -261,7 +261,7 @@ bool DrasculaEngine::loadGame(int slot) { // things. Reset those before loading the savegame otherwise we may have some // issues such as the protagonist being invisible after reloading a savegame. if (_roomNumber == 102 && flags[1] == 2) { - hare_se_ve = 1; + characterVivible = 1; loadPic(96, frontSurface); loadPic(97, frontSurface); loadPic(97, extraSurface); -- cgit v1.2.3 From d4a747705fa06be9a02a0fea2c5705f421ddd516 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Mon, 11 Apr 2016 03:40:17 +0100 Subject: DRASCULA: Fix random crash when loading pendulum scene savegame When saving from the pendulum scene the curX and curY values are negative while the curWidth and curHeight values are unset. This causes random crashes as we may do an array out of bound access when enterRoom() is called at the end of the load. --- engines/drascula/saveload.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'engines/drascula/saveload.cpp') diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp index 9063fbc792..94c4e817ee 100644 --- a/engines/drascula/saveload.cpp +++ b/engines/drascula/saveload.cpp @@ -300,6 +300,16 @@ bool DrasculaEngine::loadGame(int slot) { if (!sscanf(currentData, "%d.ald", &roomNum)) { error("Bad save format"); } + + // When loading room 102 while being attached below the pendulum Some variables + // are not correctly set and can cause random crashes when calling enterRoom below. + // The crash occurs in moveCharacters() when accessing factor_red[curY + curHeight]. + if (roomNum == 102 && flags[1] == 2) { + curX = 103; + curY = 108; + curWidth = curHeight = 0; + } + enterRoom(roomNum); selectVerb(kVerbNone); -- cgit v1.2.3 From 882299a1b485888b42b4f6a7ff45b9fbc561525f Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Mon, 11 Apr 2016 09:10:44 +0100 Subject: DRASCULA: Fix typo in variable name --- engines/drascula/saveload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/drascula/saveload.cpp') diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp index 94c4e817ee..eb72a999d4 100644 --- a/engines/drascula/saveload.cpp +++ b/engines/drascula/saveload.cpp @@ -261,7 +261,7 @@ bool DrasculaEngine::loadGame(int slot) { // things. Reset those before loading the savegame otherwise we may have some // issues such as the protagonist being invisible after reloading a savegame. if (_roomNumber == 102 && flags[1] == 2) { - characterVivible = 1; + characterVisible = 1; loadPic(96, frontSurface); loadPic(97, frontSurface); loadPic(97, extraSurface); -- cgit v1.2.3