aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/saveload.cpp
diff options
context:
space:
mode:
authorRobert Špalek2009-10-04 22:11:46 +0000
committerRobert Špalek2009-10-04 22:11:46 +0000
commiteb56dfa965718163535df46ecbcfa7a94dbcff4b (patch)
tree168f880ee5f8adb4df9ca7133b4513961cea9827 /engines/draci/saveload.cpp
parent6063d5fbe9c183a106ddeca27992b26b8a6a38d5 (diff)
downloadscummvm-rg350-eb56dfa965718163535df46ecbcfa7a94dbcff4b.tar.gz
scummvm-rg350-eb56dfa965718163535df46ecbcfa7a94dbcff4b.tar.bz2
scummvm-rg350-eb56dfa965718163535df46ecbcfa7a94dbcff4b.zip
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
Diffstat (limited to 'engines/draci/saveload.cpp')
-rw-r--r--engines/draci/saveload.cpp13
1 files changed, 8 insertions, 5 deletions
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;
}