diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index f2026575dea..9611a047535 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 806c8893b43..64bd46563a1 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 243a460645b..4f1d686b17d 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 080c045e279..6138be58cc2 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;