aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
authorKirben2015-05-21 14:24:52 +1000
committerKirben2015-05-21 14:24:52 +1000
commit61f0d247aa5151381fa242327ff219790d25363d (patch)
tree5f5ee892138a65f169e144ad5917cd69a5fbd945 /engines/agos
parent4a13462db2401c9f90e2bc1675162aeff147662f (diff)
downloadscummvm-rg350-61f0d247aa5151381fa242327ff219790d25363d.tar.gz
scummvm-rg350-61f0d247aa5151381fa242327ff219790d25363d.tar.bz2
scummvm-rg350-61f0d247aa5151381fa242327ff219790d25363d.zip
AGOS: Add proper fix for regression when loading saved games in PC version of Waxworks.
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/saveload.cpp89
1 files changed, 45 insertions, 44 deletions
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 5c54e4874b..b968ae645c 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -1201,7 +1201,6 @@ bool AGOSEngine_Elvira2::loadGame(const Common::String &filename, bool restartMo
char ident[100];
Common::SeekableReadStream *f = NULL;
uint num, item_index, i, j;
- uint16 room = _currentRoom;
_videoLockOut |= 0x100;
@@ -1260,7 +1259,49 @@ bool AGOSEngine_Elvira2::loadGame(const Common::String &filename, bool restartMo
}
f->readUint16BE();
+ uint16 room = _currentRoom;
_currentRoom = f->readUint16BE();
+ if (_roomsListPtr) {
+ byte *p = _roomsListPtr;
+ if (room == _currentRoom) {
+ for (;;) {
+ uint16 minNum = READ_BE_UINT16(p); p += 2;
+ if (minNum == 0)
+ break;
+
+ uint16 maxNum = READ_BE_UINT16(p); p += 2;
+
+ for (uint16 z = minNum; z <= maxNum; z++) {
+ uint16 itemNum = z + 2;
+ Item *item = derefItem(itemNum);
+
+ num = (itemNum - _itemArrayInited);
+ item->state = _roomStates[num].state;
+ item->classFlags = _roomStates[num].classFlags;
+ SubRoom *subRoom = (SubRoom *)findChildOfType(item, kRoomType);
+ subRoom->roomExitStates = _roomStates[num].roomExitStates;
+ }
+ }
+ } else {
+ for (;;) {
+ uint16 minNum = READ_BE_UINT16(p); p += 2;
+ if (minNum == 0)
+ break;
+
+ uint16 maxNum = READ_BE_UINT16(p); p += 2;
+
+ for (uint16 z = minNum; z <= maxNum; z++) {
+ uint16 itemNum = z + 2;
+ _itemArrayPtr[itemNum] = 0;
+ }
+ }
+ }
+ }
+
+ if (room != _currentRoom) {
+ _roomsListPtr = 0;
+ loadRoomItems(_currentRoom);
+ }
}
item_index = 1;
@@ -1275,6 +1316,9 @@ bool AGOSEngine_Elvira2::loadGame(const Common::String &filename, bool restartMo
uint parent = f->readUint16BE();
uint next = f->readUint16BE();
+ if (getGameType() == GType_WW && getPlatform() == Common::kPlatformDOS && derefItem(item->parent) == NULL)
+ item->parent = 0;
+
parent_item = derefItem(parent);
setItemParent(item, parent_item);
@@ -1319,49 +1363,6 @@ bool AGOSEngine_Elvira2::loadGame(const Common::String &filename, bool restartMo
}
}
- if (getGameType() == GType_WW && getPlatform() == Common::kPlatformDOS) {
- if (_roomsListPtr) {
- byte *p = _roomsListPtr;
- if (room == _currentRoom) {
- for (;;) {
- uint16 minNum = READ_BE_UINT16(p); p += 2;
- if (minNum == 0)
- break;
-
- uint16 maxNum = READ_BE_UINT16(p); p += 2;
-
- for (uint16 z = minNum; z <= maxNum; z++) {
- uint16 itemNum = z + 2;
- Item *item = derefItem(itemNum);
-
- num = (itemNum - _itemArrayInited);
- item->state = _roomStates[num].state;
- item->classFlags = _roomStates[num].classFlags;
- SubRoom *subRoom = (SubRoom *)findChildOfType(item, kRoomType);
- subRoom->roomExitStates = _roomStates[num].roomExitStates;
- }
- }
- } else {
- for (;;) {
- uint16 minNum = READ_BE_UINT16(p); p += 2;
- if (minNum == 0)
- break;
-
- uint16 maxNum = READ_BE_UINT16(p); p += 2;
-
- for (uint16 z = minNum; z <= maxNum; z++) {
- uint16 itemNum = z + 2;
- _itemArrayPtr[itemNum] = 0;
- }
- }
- }
- }
-
- if (room != _currentRoom) {
- _roomsListPtr = 0;
- loadRoomItems(_currentRoom);
- }
- }
// read the variables
for (i = 0; i != _numVars; i++) {
writeVariable(i, f->readUint16BE());