aboutsummaryrefslogtreecommitdiff
path: root/engines/lure
diff options
context:
space:
mode:
authorPaul Gilbert2007-11-17 10:21:27 +0000
committerPaul Gilbert2007-11-17 10:21:27 +0000
commit2e3866b6f4717212a61c79b3ff368b937405336e (patch)
tree4650ffcbfe15dfa4bdc09047b10d5227b7dc37a1 /engines/lure
parenta3abaaa70973f7ca0567a2b3b9b9eb2c0dd13fee (diff)
downloadscummvm-rg350-2e3866b6f4717212a61c79b3ff368b937405336e.tar.gz
scummvm-rg350-2e3866b6f4717212a61c79b3ff368b937405336e.tar.bz2
scummvm-rg350-2e3866b6f4717212a61c79b3ff368b937405336e.zip
Identified some more Endian issues (thanks to Max)
svn-id: r29533
Diffstat (limited to 'engines/lure')
-rw-r--r--engines/lure/res.cpp9
-rw-r--r--engines/lure/res_struct.cpp12
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: