From eb56dfa965718163535df46ecbcfa7a94dbcff4b Mon Sep 17 00:00:00 2001 From: Robert Špalek Date: Sun, 4 Oct 2009 22:11:46 +0000 Subject: Fixed two bugs concerning loading: 1. a room need to be reloaded by force when the loaded game is in the same room as the game before the load 2. objects from the last room and their animations must be deallocated before I change the room number svn-id: r44638 --- engines/draci/saveload.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'engines/draci/saveload.cpp') diff --git a/engines/draci/saveload.cpp b/engines/draci/saveload.cpp index cb70000cca..f74deb5c14 100644 --- a/engines/draci/saveload.cpp +++ b/engines/draci/saveload.cpp @@ -136,21 +136,24 @@ Common::Error loadSavegameData(int saveGameIdx, DraciEngine *vm) { readSavegameHeader(f, header); if (header.thumbnail) delete header.thumbnail; + // Pre-processing + vm->_game->rememberRoomNumAsPrevious(); + vm->_game->deleteObjectAnimations(); + // Synchronise the remaining data of the savegame Common::Serializer s(f, NULL); - int oldRoomNum = vm->_game->getRoomNum(); vm->_game->DoSync(s); - delete f; - // Post processing - vm->_engineStartTime = vm->_system->getMillis() / 1000 - header.playtime; + // Post-processing vm->_game->scheduleEnteringRoomUsingGate(vm->_game->getRoomNum(), 0); - vm->_game->setRoomNum(oldRoomNum); + vm->_game->setRoomNum(vm->_game->getPreviousRoomNum()); vm->_game->setExitLoop(2); // 2 > true means immediate exit for the loop vm->_game->inventoryReload(); + vm->_engineStartTime = vm->_system->getMillis() / 1000 - header.playtime; + return Common::kNoError; } -- cgit v1.2.3