aboutsummaryrefslogtreecommitdiff
path: root/scumm/object.cpp
diff options
context:
space:
mode:
authorMax Horn2002-12-25 11:59:55 +0000
committerMax Horn2002-12-25 11:59:55 +0000
commit65ee9da7436edca39504a94775e5fe4a68a3b4cc (patch)
tree58acc1728c7d3b22f60eae85c2e872669b66ed01 /scumm/object.cpp
parenteb6dbed75019909dc91e35bf2834aa17cd15d0c3 (diff)
downloadscummvm-rg350-65ee9da7436edca39504a94775e5fe4a68a3b4cc.tar.gz
scummvm-rg350-65ee9da7436edca39504a94775e5fe4a68a3b4cc.tar.bz2
scummvm-rg350-65ee9da7436edca39504a94775e5fe4a68a3b4cc.zip
cleanup (really need to factor out a lot of this stuff into seperate methods)
svn-id: r6118
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r--scumm/object.cpp71
1 files changed, 30 insertions, 41 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 55ac3da319..868c8eefdd 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -896,26 +896,21 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
obcdptr = findResource(MKID('OBCD'), searchptr);
if (obcdptr == NULL)
error("findObjectInRoom: Not enough code blocks in room %d", room);
- if (_features & GF_SMALL_HEADER) {
- if (READ_LE_UINT16(obcdptr + 6) == (uint16)id) {
- fo->cdhd = NULL;
- fo->obcd = obcdptr;
- break;
- }
- } else {
- cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), obcdptr);
- if (_features & GF_AFTER_V7)
- id2 = READ_LE_UINT16(&(cdhd->v7.obj_id));
- else if (_features & GF_AFTER_V6)
- id2 = READ_LE_UINT16(&(cdhd->v6.obj_id));
- else
- id2 = READ_LE_UINT16(&(cdhd->v5.obj_id));
-
- if (id2 == (uint16)id) {
- fo->cdhd = cdhd;
- fo->obcd = obcdptr;
- break;
- }
+ cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), obcdptr);
+
+ if (_features & GF_SMALL_HEADER)
+ id2 = READ_LE_UINT16(obcdptr + 6);
+ else if (_features & GF_AFTER_V7)
+ id2 = READ_LE_UINT16(&(cdhd->v7.obj_id));
+ else if (_features & GF_AFTER_V6)
+ id2 = READ_LE_UINT16(&(cdhd->v6.obj_id));
+ else
+ id2 = READ_LE_UINT16(&(cdhd->v5.obj_id));
+
+ if (id2 == (uint16)id) {
+ fo->cdhd = cdhd;
+ fo->obcd = obcdptr;
+ break;
}
if (++i == numobj)
error("findObjectInRoom: Object %d not found in room %d", id, room);
@@ -934,26 +929,21 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
if (obimptr == NULL)
error("findObjectInRoom: Not enough image blocks in room %d", room);
imhd = (ImageHeader *)findResourceData(MKID('IMHD'), obimptr);
- if (_features & GF_SMALL_HEADER) {
- if (READ_LE_UINT16(obimptr + 6) == (uint16)id) {
- fo->obim = obimptr;
- fo->imhd = imhd;
- break;
- }
- } else {
- if (_features & GF_AFTER_V8)
- // In V8, IMHD has no obj_id, but rather a name string. We map the name
- // back to an object id using a table derived from the DOBJ resource.
- id3 = _objectIDMap[imhd->v8.name];
- else if (_features & GF_AFTER_V7)
- id3 = READ_LE_UINT16(&imhd->v7.obj_id);
- else
- id3 = READ_LE_UINT16(&imhd->old.obj_id);
- if (id3 == (uint16)id) {
- fo->obim = obimptr;
- fo->imhd = imhd;
- break;
- }
+ if (_features & GF_SMALL_HEADER)
+ id3 = READ_LE_UINT16(obimptr + 6);
+ else if (_features & GF_AFTER_V8)
+ // In V8, IMHD has no obj_id, but rather a name string. We map the name
+ // back to an object id using a table derived from the DOBJ resource.
+ id3 = _objectIDMap[imhd->v8.name];
+ else if (_features & GF_AFTER_V7)
+ id3 = READ_LE_UINT16(&imhd->v7.obj_id);
+ else
+ id3 = READ_LE_UINT16(&imhd->old.obj_id);
+
+ if (id3 == (uint16)id) {
+ fo->obim = obimptr;
+ fo->imhd = imhd;
+ break;
}
if (++i == numobj)
error("findObjectInRoom: Object %d image not found in room %d", id, room);
@@ -1272,7 +1262,6 @@ void Scumm::drawBlastObjects()
}
}
-
void Scumm::drawBlastObject(BlastObject *eo)
{
VirtScreen *vs;