aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-31 14:09:42 +0000
committerMartin Kiewitz2010-07-31 14:09:42 +0000
commit2d76fe009206f5a064c3e21485743e433aa8ac3c (patch)
treeb612eb03f7cdd6fdc55d35a9d8321adbf356df21
parentfd7bc295367f848b3a8f0658f65adb6a8447710a (diff)
downloadscummvm-rg350-2d76fe009206f5a064c3e21485743e433aa8ac3c.tar.gz
scummvm-rg350-2d76fe009206f5a064c3e21485743e433aa8ac3c.tar.bz2
scummvm-rg350-2d76fe009206f5a064c3e21485743e433aa8ac3c.zip
SCI: kGameIsRestarting returns 2 when we restored
fixes castle of dr. brain save issue in puzzle room, fixes island of dr. brain save issue when saving in first room svn-id: r51538
-rw-r--r--engines/sci/engine/kmisc.cpp4
-rw-r--r--engines/sci/engine/savegame.cpp3
-rw-r--r--engines/sci/engine/state.h8
-rw-r--r--engines/sci/sci.cpp4
4 files changed, 14 insertions, 5 deletions
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index f2026575de..9611a04753 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -46,11 +46,11 @@ reg_t kRestartGame(EngineState *s, int argc, reg_t *argv) {
** Returns the restarting_flag in acc
*/
reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
- s->r_acc = make_reg(0, s->gameWasRestarted);
+ s->r_acc = make_reg(0, s->gameIsRestarting);
if (argc) { // Only happens during replay
if (!argv[0].toUint16()) // Set restarting flag
- s->gameWasRestarted = false;
+ s->gameIsRestarting = GAMEISRESTARTING_NONE;
}
uint32 neededSleep = 30;
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 806c8893b4..64bd46563a 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -776,6 +776,9 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
s->_msgState = new MessageState(s->_segMan);
s->abortScriptProcessing = kAbortLoadGame;
+
+ // signal restored game to game scripts
+ s->gameIsRestarting = GAMEISRESTARTING_RESTORE;
}
bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata *meta) {
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 243a460645..4f1d686b17 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -87,6 +87,12 @@ enum {
SAVEGAMEID_OFFICIALRANGE_END = 1999
};
+enum {
+ GAMEISRESTARTING_NONE = 0,
+ GAMEISRESTARTING_RESTART = 1,
+ GAMEISRESTARTING_RESTORE = 2
+};
+
class FileHandle {
public:
Common::String _name;
@@ -159,7 +165,7 @@ public:
int variablesMax[4]; ///< Max. values for all variables
AbortGameState abortScriptProcessing;
- bool gameWasRestarted;
+ int16 gameIsRestarting; // is set when restarting (=1) or restoring the game (=2)
int scriptStepCounter; // Counts the number of steps executed
int scriptGCInterval; // Number of steps in between gcs
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 080c045e27..6138be58cc 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -290,7 +290,7 @@ bool SciEngine::initGame() {
_gamestate->_executionStackPosChanged = false;
_gamestate->abortScriptProcessing = kAbortNone;
- _gamestate->gameWasRestarted = false;
+ _gamestate->gameIsRestarting = GAMEISRESTARTING_NONE;
_gamestate->stack_base = stack->_entries;
_gamestate->stack_top = stack->_entries + stack->_capacity;
@@ -416,7 +416,7 @@ void SciEngine::runGame() {
_gamestate->_segMan->resetSegMan();
initGame();
initStackBaseWithSelector(SELECTOR(play));
- _gamestate->gameWasRestarted = true;
+ _gamestate->gameIsRestarting = GAMEISRESTARTING_RESTART;
if (_gfxMenu)
_gfxMenu->reset();
_gamestate->abortScriptProcessing = kAbortNone;