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
This commit is contained in:
Martin Kiewitz 2010-07-31 14:09:42 +00:00
parent fd7bc29536
commit 2d76fe0092
4 changed files with 14 additions and 5 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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

View File

@ -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;