From d5dc2e075a1e19ecdb9b7f0791704c1c7d2cafd3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Nov 2007 00:19:45 +0000 Subject: [PATCH] Bugfixes to restoring or restarting a game from the Restore/Restart dialog svn-id: r29524 --- engines/lure/game.cpp | 10 ++++++++-- engines/lure/room.cpp | 3 ++- engines/lure/room.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index c8abff2b920..1026925f327 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -135,18 +135,21 @@ void Game::execute() { screen.setPaletteEmpty(); // Flag for starting game - setState(GS_RESTART); + setState(GS_RESTART); + bool initialRestart = true; while (!events.quitFlag) { if ((_state & GS_RESTART) != 0) { res.reset(); + if (!initialRestart) room.reset(); setState(0); Script::execute(STARTUP_SCRIPT); - int bootParam = ConfMan.getInt("boot_param"); + int bootParam = initialRestart ? ConfMan.getInt("boot_param") : 0; handleBootParam(bootParam); + initialRestart = false; } room.update(); @@ -1003,6 +1006,9 @@ void Game::loadFromStream(ReadStream *stream) { _soundFlag = stream->readByte() != 0; menu.getMenu(2).entries()[2] = sl.getString(_soundFlag ? S_SOUND_ON : S_SOUND_OFF); + + // Reset game state flags + setState(0); } diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp index b5afe377bdc..2fca7fbc714 100644 --- a/engines/lure/room.cpp +++ b/engines/lure/room.cpp @@ -85,6 +85,7 @@ Room::Room(): _screen(Screen::getReference()) { _numLayers = 0; _showInfo = false; _isExit = false; + _roomNumber = 0; _destRoomNumber = 0; _cursorState = CS_NONE; @@ -532,7 +533,7 @@ void Room::setRoomNumber(uint16 newRoomNumber, bool showOverlay) { _roomData = res.getRoom(newRoomNumber); if (!_roomData) error("Tried to change to non-existant room: %d", newRoomNumber); - bool leaveFlag = (_layers[0] && (newRoomNumber != _roomNumber) && (_roomNumber != 0)); + bool leaveFlag = (newRoomNumber != _roomNumber) && (_roomNumber != 0); _roomNumber = _roomData->roomNumber; _descId = _roomData->descId; diff --git a/engines/lure/room.h b/engines/lure/room.h index 1fbe853b725..419b757e2eb 100644 --- a/engines/lure/room.h +++ b/engines/lure/room.h @@ -127,6 +127,7 @@ public: char *statusLine() { return _statusLine; } void saveToStream(Common::WriteStream *stream); void loadFromStream(Common::ReadStream *stream); + void reset() { _roomNumber = 999; } }; } // end of namespace Lure