diff options
Diffstat (limited to 'engines/lure')
-rw-r--r-- | engines/lure/res.cpp | 9 | ||||
-rw-r--r-- | engines/lure/res_struct.cpp | 12 |
2 files changed, 10 insertions, 11 deletions
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp index 7d0d925c36..40d8c4cc3c 100644 --- a/engines/lure/res.cpp +++ b/engines/lure/res.cpp @@ -115,9 +115,7 @@ void Resources::reloadData() { paths = d.getEntry(ROOM_PATHS_RESOURCE_ID); offset = (uint16 *) mb->data(); - for (ctr = 0; READ_LE_UINT16(offset) != 0xffff; ++ctr, ++offset) { - offsetVal = READ_LE_UINT16(offset); - + while ((offsetVal = READ_LE_UINT16(offset++)) != 0xffff) { if (offsetVal != 0) { // Get room resource RoomResource *rec = (RoomResource *) (mb->data() + offsetVal); @@ -125,11 +123,12 @@ void Resources::reloadData() { RoomData *newEntry = new RoomData(rec, paths); _roomData.push_back(newEntry); - if (rec->numExits > 0) { + uint16 numExits = READ_LE_UINT16(&rec->numExits); + if (numExits > 0) { RoomExitResource *exitRes = (RoomExitResource *) (mb->data() + offsetVal + sizeof(RoomResource)); - for (uint16 exitCtr = 0; exitCtr < rec->numExits; ++exitCtr, ++exitRes) { + for (uint16 exitCtr = 0; exitCtr < numExits; ++exitCtr, ++exitRes) { RoomExitData *exit = new RoomExitData(exitRes); newEntry->exits.push_back(exit); } diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index ae229fa4e4..076e691d42 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -113,14 +113,14 @@ RoomExitHotspotData::RoomExitHotspotData(RoomExitHotspotResource *rec) { // Room exit class RoomExitData::RoomExitData(RoomExitResource *rec) { - xs = READ_LE_UINT16(&rec->xs); - ys = READ_LE_UINT16(&rec->ys); - xe = READ_LE_UINT16(&rec->xe); - ye = READ_LE_UINT16(&rec->ye); + xs = READ_LE_INT16(&rec->xs); + ys = READ_LE_INT16(&rec->ys); + xe = READ_LE_INT16(&rec->xe); + ye = READ_LE_INT16(&rec->ye); sequenceOffset = READ_LE_UINT16(&rec->sequenceOffset); roomNumber = rec->newRoom; - x = rec->newRoomX; - y = rec->newRoomY; + x = READ_LE_INT16(&rec->newRoomX); + y = READ_LE_INT16(&rec->newRoomY); switch (rec->direction) { case 0x80: |