diff options
author | Travis Howell | 2006-09-20 06:39:27 +0000 |
---|---|---|
committer | Travis Howell | 2006-09-20 06:39:27 +0000 |
commit | e63717a2eb4df76fb97736daebb40b72c2f888fa (patch) | |
tree | 3326874a5d61b5940fea0dea912b6daad4ed795b /engines/simon/items.cpp | |
parent | 68360e4ddedd8806d269320bac91ab6cace34a18 (diff) | |
download | scummvm-rg350-e63717a2eb4df76fb97736daebb40b72c2f888fa.tar.gz scummvm-rg350-e63717a2eb4df76fb97736daebb40b72c2f888fa.tar.bz2 scummvm-rg350-e63717a2eb4df76fb97736daebb40b72c2f888fa.zip |
Fix crashes during WW startup
svn-id: r23944
Diffstat (limited to 'engines/simon/items.cpp')
-rw-r--r-- | engines/simon/items.cpp | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp index be3b39cd68..fbe8591de6 100644 --- a/engines/simon/items.cpp +++ b/engines/simon/items.cpp @@ -679,7 +679,12 @@ void SimonEngine::o_random() { void SimonEngine::o_goto() { // 55: set itemA parent - setItemParent(me(), getNextItemPtr()); + uint item = getNextItemID(); + if (_itemArrayPtr[item] == NULL) { + setItemParent(me(), NULL); + loadRoomItems(item); + } + setItemParent(me(), _itemArrayPtr[item]); } void SimonEngine::o_oset() { @@ -1542,38 +1547,6 @@ void SimonEngine::o_unfreezeZones() { // Waxworks 1 Opcodes // ----------------------------------------------------------------------- -uint16 SimonEngine::getDoorState(Item *item, uint16 d) { - uint16 mask = 3; - uint16 n; - - SubRoom *subRoom = (SubRoom *)findChildOfType(item, 1); - if (subRoom == NULL) - return 0; - - d <<= 1; - mask <<= d; - n = subRoom->roomExitStates & mask; - n >>= d; - - return n; -} - -uint16 SimonEngine::getExitOf(Item *item, uint16 d) { - uint16 x; - uint16 y = 0; - - SubRoom *subRoom = (SubRoom *)findChildOfType(item, 1); - if (subRoom == NULL) - return 0; - x = d; - while (x > y) { - if (getDoorState(item, y) == 0) - d--; - y++; - } - return subRoom->roomExit[d]; -} - void SimonEngine::oww_whereTo() { // 85: where to Item *i = getNextItemPtr(); |