diff options
| author | Max Horn | 2002-12-25 03:48:27 +0000 |
|---|---|---|
| committer | Max Horn | 2002-12-25 03:48:27 +0000 |
| commit | 1b0963dd760f4780dcd61f31706fb41fdb4331e9 (patch) | |
| tree | 49ad5b66f285c824aa9d7e5aedd45e56912804ae /scumm/object.cpp | |
| parent | bf41dbdba3c24b438e516850a8ba6ca584b2a82b (diff) | |
| download | scummvm-rg350-1b0963dd760f4780dcd61f31706fb41fdb4331e9.tar.gz scummvm-rg350-1b0963dd760f4780dcd61f31706fb41fdb4331e9.tar.bz2 scummvm-rg350-1b0963dd760f4780dcd61f31706fb41fdb4331e9.zip | |
added (broken) cursor support for V8; enabled bomp drawing
svn-id: r6113
Diffstat (limited to 'scumm/object.cpp')
| -rw-r--r-- | scumm/object.cpp | 89 |
1 files changed, 73 insertions, 16 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp index a28f7fdd36..5c2653cf85 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -884,6 +884,9 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint if (numobj > _numLocalObjects) error("findObjectInRoom: More (%d) than %d objects in room %d", numobj, _numLocalObjects, room); + if (_features & GF_AFTER_V7) { + roomptr = getResourceAddress(rtRoomScripts, room); + } if (findWhat & foCodeHeader) { searchptr = roomptr; for (i = 0;;) { @@ -920,6 +923,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint } } + roomptr = fo->roomptr; if (findWhat & foImageHeader) { searchptr = roomptr; for (i = 0;;) { @@ -1169,15 +1173,38 @@ void Scumm::setCursorImg(uint img, uint room, uint imgindex) h = READ_LE_UINT16(&foir.cdhd->v6.h) >> 3; } - dataptr = findResource(IMxx_tags[imgindex], foir.obim); - if (dataptr == NULL) - error("setCursorImg: No such image"); + // TODO - for V8 don't use IMxx_tags. Rather, we do something similiar to the V8 + // code in drawBlastObject. It would be *much* nicer if we could aggregate this + // common code into some helper functions, instead of having long convuluted + // cases scattered all over the place. + if (_features & GF_AFTER_V8) { + dataptr = findResource(MKID('IMAG'), foir.obim); + assert(dataptr); + + dataptr = findResource(MKID('WRAP'), dataptr); + assert(dataptr); + + dataptr = findResource(MKID('OFFS'), dataptr); + assert(dataptr); - size = READ_BE_UINT32_UNALIGNED(dataptr + 4); - if (size > sizeof(_grabbedCursor)) - error("setCursorImg: Cursor image too large"); + dataptr += READ_LE_UINT32(dataptr + 4 + 4*imgindex); + // TODO - distinguish between SMAP and BOMP here? - if ((bomp = findResource(MKID('BOMP'), dataptr)) != NULL) + // HACK - adjust dataptr here until bomp code gets adjusted for V8 + bomp = dataptr + 2; + } else { + dataptr = findResource(IMxx_tags[imgindex], foir.obim); + if (dataptr == NULL) + error("setCursorImg: No such image"); + + size = READ_BE_UINT32_UNALIGNED(dataptr + 4); + if (size > sizeof(_grabbedCursor)) + error("setCursorImg: Cursor image too large"); + + bomp = findResource(MKID('BOMP'), dataptr); + } + + if (bomp != NULL) useBompCursor(bomp, w, h); else useIm01Cursor(dataptr, w, h); @@ -1270,23 +1297,53 @@ void Scumm::drawBlastObject(BlastObject *eo) if (!ptr) error("BlastObject object %d image not found", eo->number); - img = findResource(IMxx_tags[eo->image], ptr); - if (!img) - img = findResource(IMxx_tags[1], ptr); // Backward compatibility with samnmax blast objects - if (!img) - error("blast-object %d invalid image %d (1-x)", eo->number, eo->image); + if (_features & GF_AFTER_V8) { + // The OBIM contains an IMAG, which in turn contains a WRAP, which contains + // an OFFS chunk and multiple BOMP chunks. To find the right BOMP, we can + // either use the offsets in the OFFS chunk, or iterate over all BOMPs we find. + // Here we use the first method. + img = findResource(MKID('IMAG'), ptr); + assert(img); + + img = findResource(MKID('WRAP'), img); + assert(img); + + img = findResource(MKID('OFFS'), img); + assert(img); + + bomp = img + READ_LE_UINT32(img + 4 + 4*eo->image) + 8; + } else { + img = findResource(IMxx_tags[eo->image], ptr); + if (!img) + img = findResource(IMxx_tags[1], ptr); // Backward compatibility with samnmax blast objects + + if (!img) + error("blast-object %d invalid image %d (1-x)", eo->number, eo->image); + + bomp = findResourceData(MKID('BOMP'), img); + } - bomp = findResourceData(MKID('BOMP'), img); if (!bomp) error("object %d is not a blast object", eo->number); - bdd.srcwidth = READ_LE_UINT16(&((BompHeader *)bomp)->width); - bdd.srcheight = READ_LE_UINT16(&((BompHeader *)bomp)->height); + hexdump(bomp,32); + if (_features & GF_AFTER_V8) { + bdd.srcwidth = READ_LE_UINT32(&((BompHeader *)bomp)->v8.width); + bdd.srcheight = READ_LE_UINT32(&((BompHeader *)bomp)->v8.height); + } else { + bdd.srcwidth = READ_LE_UINT16(&((BompHeader *)bomp)->old.width); + bdd.srcheight = READ_LE_UINT16(&((BompHeader *)bomp)->old.height); + } + bdd.out = vs->screenPtr + vs->xstart; bdd.outwidth = vs->width; bdd.outheight = vs->height; - bdd.dataptr = bomp + 10; + if (_features & GF_AFTER_V8) { + bdd.dataptr = bomp + 8; // Why this? See also useBompCursor + } else { + bdd.dataptr = bomp + 10; // Why this? See also useBompCursor + } bdd.x = eo->posX; bdd.y = eo->posY; bdd.scale_x = (byte)eo->scaleX; |
