aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/scumm/object.cpp')
-rw-r--r--engines/scumm/object.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp
index f4aea93b8b..df0b3e1035 100644
--- a/engines/scumm/object.cpp
+++ b/engines/scumm/object.cpp
@@ -45,6 +45,7 @@ void ScummEngine::addObjectToInventory(uint obj, uint room) {
idx = getObjectIndex(obj);
assert(idx >= 0);
ptr = getResourceAddress(rtFlObject, _objs[idx].fl_object_index) + 8;
+ assert(ptr);
size = READ_BE_UINT32(ptr + 4);
} else {
findObjectInRoom(&foir, foCodeHeader, obj, room);
@@ -742,6 +743,7 @@ void ScummEngine::resetRoomObjects() {
const CodeHeader *cdhd;
room = getResourceAddress(rtRoom, _roomResource);
+ assert(room);
if (_numObjectsInRoom == 0)
return;
@@ -756,7 +758,7 @@ void ScummEngine::resetRoomObjects() {
assert(searchptr);
// Load in new room objects
- ResourceIterator obcds(searchptr, false);
+ ResourceIterator obcds(searchptr, false);
for (i = 0; i < _numObjectsInRoom; i++) {
od = &_objs[findLocalObjectSlot()];
@@ -784,7 +786,7 @@ void ScummEngine::resetRoomObjects() {
}
searchptr = room;
- ResourceIterator obims(room, false);
+ ResourceIterator obims(room, false);
for (i = 0; i < _numObjectsInRoom; i++) {
ptr = obims.findNext(MKTAG('O','B','I','M'));
if (ptr == NULL)
@@ -810,6 +812,7 @@ void ScummEngine_v3old::resetRoomObjects() {
const byte *room, *ptr;
room = getResourceAddress(rtRoom, _roomResource);
+ assert(room);
if (_numObjectsInRoom == 0)
return;
@@ -854,6 +857,7 @@ void ScummEngine_v4::resetRoomObjects() {
const byte *room;
room = getResourceAddress(rtRoom, _roomResource);
+ assert(room);
if (_numObjectsInRoom == 0)
return;
@@ -861,7 +865,7 @@ void ScummEngine_v4::resetRoomObjects() {
if (_numObjectsInRoom > _numLocalObjects)
error("More than %d objects in room %d", _numLocalObjects, _roomResource);
- ResourceIterator obcds(room, true);
+ ResourceIterator obcds(room, true);
for (i = 0; i < _numObjectsInRoom; i++) {
od = &_objs[findLocalObjectSlot()];
@@ -878,7 +882,7 @@ void ScummEngine_v4::resetRoomObjects() {
}
}
- ResourceIterator obims(room, true);
+ ResourceIterator obims(room, true);
for (i = 0; i < _numObjectsInRoom; i++) {
// In the PC Engine version of Loom, there aren't image blocks
// for all objects.
@@ -979,10 +983,12 @@ void ScummEngine::resetRoomObject(ObjectData *od, const byte *room, const byte *
assert(room);
if (searchptr == NULL) {
- if (_game.version == 8)
+ if (_game.version == 8) {
searchptr = getResourceAddress(rtRoomScripts, _roomResource);
- else
+ assert(searchptr);
+ } else {
searchptr = room;
+ }
}
cdhd = (const CodeHeader *)findResourceData(MKTAG('C','D','H','D'), searchptr + od->OBCDoffset);