diff options
author | Max Horn | 2003-01-13 15:27:06 +0000 |
---|---|---|
committer | Max Horn | 2003-01-13 15:27:06 +0000 |
commit | d900d280c08bb5932c66ba1b9d481587e4a797fe (patch) | |
tree | ca6c1057caf12d1c1dec92063dbbe8ddd26065a2 /scumm/object.cpp | |
parent | 0a3bc7d36fb2764d65e2666d4f7542333f94b498 (diff) | |
download | scummvm-rg350-d900d280c08bb5932c66ba1b9d481587e4a797fe.tar.gz scummvm-rg350-d900d280c08bb5932c66ba1b9d481587e4a797fe.tar.bz2 scummvm-rg350-d900d280c08bb5932c66ba1b9d481587e4a797fe.zip |
fixed checkRange output; added checkRange call to drawObject; cleanup
svn-id: r6447
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r-- | scumm/object.cpp | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp index 5206baf6ff..fd95c2c062 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -188,41 +188,35 @@ void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir) byte *ptr; ImageHeader *imhd; - if (!(_features & GF_SMALL_HEADER)) { - if (_features & GF_AFTER_V6) { - state = getState(object) - 1; - if (state < 0) - state = 0; - - if (od->fl_object_index) { - ptr = getResourceAddress(rtFlObject, od->fl_object_index); - ptr = findResource(MKID('OBIM'), ptr); - } else { - ptr = getResourceAddress(rtRoom, _roomResource); - ptr += od->OBIMoffset; - } - assert(ptr); - imhd = (ImageHeader *)findResourceData(MKID('IMHD'), ptr); - if (_features & GF_AFTER_V8) { - x = od->x_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].x); - y = od->y_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].y); - } else if (_features & GF_AFTER_V7) { - x = od->x_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].x); - y = od->y_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].y); - } else { - x = od->x_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].x); - y = od->y_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].y); - } + if (_features & GF_AFTER_V6) { + state = getState(object) - 1; + if (state < 0) + state = 0; + + if (od->fl_object_index) { + ptr = getResourceAddress(rtFlObject, od->fl_object_index); + ptr = findResource(MKID('OBIM'), ptr); } else { - x = od->walk_x; - y = od->walk_y; + ptr = getResourceAddress(rtRoom, _roomResource); + ptr += od->OBIMoffset; + } + assert(ptr); + imhd = (ImageHeader *)findResourceData(MKID('IMHD'), ptr); + if (_features & GF_AFTER_V8) { + x = od->x_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].x); + y = od->y_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].y); + } else if (_features & GF_AFTER_V7) { + x = od->x_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].x); + y = od->y_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].y); + } else { + x = od->x_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].x); + y = od->y_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].y); } - dir = oldDirToNewDir(od->actordir & 3); } else { x = od->walk_x; y = od->walk_y; - dir = oldDirToNewDir(od->actordir & 3); } + dir = oldDirToNewDir(od->actordir & 3); } int Scumm::getObjActToObjActDist(int a, int b) @@ -352,6 +346,8 @@ void Scumm::drawObject(int obj, int arg) if (od->obj_nr == 0) return; + checkRange(_numGlobalObjects - 1, 0, od->obj_nr, "Object %d out of range in drawObject"); + xpos = od->x_pos >> 3; ypos = od->y_pos; |