diff options
author | James Brown | 2002-12-24 12:27:35 +0000 |
---|---|---|
committer | James Brown | 2002-12-24 12:27:35 +0000 |
commit | 9df8cf4ebadc08bdac3d003644430b53c5251b96 (patch) | |
tree | c04bb9b1731de522646f3d3ab719eba9b876e77f /scumm/object.cpp | |
parent | 600e516ef2f14d2a9d694d36b2b397d6877d734b (diff) | |
download | scummvm-rg350-9df8cf4ebadc08bdac3d003644430b53c5251b96.tar.gz scummvm-rg350-9df8cf4ebadc08bdac3d003644430b53c5251b96.tar.bz2 scummvm-rg350-9df8cf4ebadc08bdac3d003644430b53c5251b96.zip |
Fix a typo, add some more code.
Current crash is caused due to the non-existant mapping between objid's and the object names
svn-id: r6098
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r-- | scumm/object.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp index 8d77358761..3a7aadeb5d 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -420,7 +420,7 @@ void Scumm::loadRoomObjects() od = &_objs[1]; - if (_features & GF_AFTER_V7) + if (_features & GF_AFTER_V8) searchptr = getResourceAddress(rtRoomScripts, _roomResource); else searchptr = room; @@ -430,7 +430,7 @@ void Scumm::loadRoomObjects() if (ptr == NULL) error("Room %d missing object code block(s)", _roomResource); - od->offs_obcd_to_room = ptr - room; + od->offs_obcd_to_room = ptr - searchptr; cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), ptr); if (_features & GF_AFTER_V7) @@ -474,6 +474,7 @@ void Scumm::loadRoomObjects() } od = &_objs[1]; + for (i = 1; i <= _numObjectsInRoom; i++, od++) { setupRoomObject(od, room); } @@ -544,8 +545,9 @@ CHECK_HEAP} void Scumm::setupRoomObject(ObjectData *od, byte *room) { - CodeHeader *cdhd; - ImageHeader *imhd; + CodeHeader *cdhd = NULL; + ImageHeader *imhd = NULL; + byte *searchptr = NULL; if (_features & GF_SMALL_HEADER) { @@ -577,7 +579,14 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room) return; } - cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), room + od->offs_obcd_to_room); + if (_features & GF_AFTER_V8) + searchptr = getResourceAddress(rtRoomScripts, _roomResource); + else + searchptr = room; + + cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), searchptr + od->offs_obcd_to_room); + if (cdhd == NULL) + error("Room %d missing CDHD blocks(s)", _roomResource); if (_features & GF_AFTER_V8) { od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); |