diff options
author | Max Horn | 2005-04-10 01:42:00 +0000 |
---|---|---|
committer | Max Horn | 2005-04-10 01:42:00 +0000 |
commit | 15fd220a8167197a1d5428c358dfc74ea37d9fbc (patch) | |
tree | 7f7a04914ddd285141a7a670ebccbc8e814e76a4 | |
parent | 063fa83483b69c4e3758015ea81b0eaad8d978a5 (diff) | |
download | scummvm-rg350-15fd220a8167197a1d5428c358dfc74ea37d9fbc.tar.gz scummvm-rg350-15fd220a8167197a1d5428c358dfc74ea37d9fbc.tar.bz2 scummvm-rg350-15fd220a8167197a1d5428c358dfc74ea37d9fbc.zip |
Init _numObjectsInRoom in another spot
svn-id: r17499
-rw-r--r-- | scumm/object.cpp | 17 | ||||
-rw-r--r-- | scumm/room.cpp | 8 |
2 files changed, 7 insertions, 18 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp index d5e18e72cc..4b93a25b9f 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -546,19 +546,10 @@ void ScummEngine::loadRoomObjects() { uint16 obim_id; const byte *room, *searchptr, *rootptr; const ImageHeader *imhd; - const RoomHeader *roomhdr; const CodeHeader *cdhd; CHECK_HEAP room = getResourceAddress(rtRoom, _roomResource); - roomhdr = (const RoomHeader *)findResourceData(MKID('RMHD'), room); - - if (_version == 8) - _numObjectsInRoom = (byte)READ_LE_UINT32(&(roomhdr->v8.numObjects)); - else if (_version == 7) - _numObjectsInRoom = (byte) READ_LE_UINT16(&(roomhdr->v7.numObjects)); - else - _numObjectsInRoom = (byte) READ_LE_UINT16(&(roomhdr->old.numObjects)); if (_numObjectsInRoom == 0) return; @@ -639,8 +630,6 @@ void ScummEngine_v3old::loadRoomObjects() { CHECK_HEAP room = getResourceAddress(rtRoom, _roomResource); - _numObjectsInRoom = room[20]; - if (_numObjectsInRoom == 0) return; @@ -677,13 +666,9 @@ void ScummEngine_v4::loadRoomObjects() { const byte *ptr; uint16 obim_id; const byte *room; - const RoomHeader *roomhdr; CHECK_HEAP room = getResourceAddress(rtRoom, _roomResource); - roomhdr = (const RoomHeader *)findResourceData(MKID('RMHD'), room); - - _numObjectsInRoom = (byte) READ_LE_UINT16(&(roomhdr->old.numObjects)); if (_numObjectsInRoom == 0) return; @@ -1191,7 +1176,7 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, for (i = 0; i < numobj; i++) { obimptr = roomptr + READ_LE_UINT16(searchptr); - obcdptr = roomptr + READ_LE_UINT16(searchptr + 2 * _numObjectsInRoom); + obcdptr = roomptr + READ_LE_UINT16(searchptr + 2 * numobj); id2 = READ_LE_UINT16(obcdptr + 4); if (id2 == (uint16)id) { diff --git a/scumm/room.cpp b/scumm/room.cpp index 4c47adf3f6..b820de15e9 100644 --- a/scumm/room.cpp +++ b/scumm/room.cpp @@ -235,12 +235,15 @@ void ScummEngine::initRoomSubBlocks() { if (_version == 8) { _roomWidth = READ_LE_UINT32(&(rmhd->v8.width)); _roomHeight = READ_LE_UINT32(&(rmhd->v8.height)); + _numObjectsInRoom = (byte)READ_LE_UINT32(&(rmhd->v8.numObjects)); } else if (_version == 7) { _roomWidth = READ_LE_UINT16(&(rmhd->v7.width)); _roomHeight = READ_LE_UINT16(&(rmhd->v7.height)); + _numObjectsInRoom = (byte)READ_LE_UINT16(&(rmhd->v7.numObjects)); } else { _roomWidth = READ_LE_UINT16(&(rmhd->old.width)); _roomHeight = READ_LE_UINT16(&(rmhd->old.height)); + _numObjectsInRoom = (byte)READ_LE_UINT16(&(rmhd->old.numObjects)); } // @@ -550,14 +553,14 @@ void ScummEngine_v3old::initRoomSubBlocks() { if (_version == 1) { if (_features & GF_NES) { - _roomWidth = READ_LE_UINT16(roomptr + 4) * 8; + _roomWidth = READ_LE_UINT16(&(rmhd->old.width)); + _roomHeight = READ_LE_UINT16(&(rmhd->old.height)); // HACK: To let our code work normal with narrow rooms we // adjust width. It will render garbage on right edge but we do // not render it anyway if (_roomWidth < 32 * 8) _roomWidth = 32 * 8; - _roomHeight = READ_LE_UINT16(roomptr + 6) * 8; } else { _roomWidth = roomptr[4] * 8; _roomHeight = roomptr[5] * 8; @@ -566,6 +569,7 @@ void ScummEngine_v3old::initRoomSubBlocks() { _roomWidth = READ_LE_UINT16(&(rmhd->old.width)); _roomHeight = READ_LE_UINT16(&(rmhd->old.height)); } + _numObjectsInRoom = roomptr[20]; // // Find the room image data |