diff options
author | Max Horn | 2003-05-10 12:59:32 +0000 |
---|---|---|
committer | Max Horn | 2003-05-10 12:59:32 +0000 |
commit | 114af3159e7c4fc552972a460f845e982fbc6ef5 (patch) | |
tree | c941da35b4115d80046ace0f8d05f1026cdd78ba | |
parent | 97197f95ea5159e3b8caa5cc7f92fdbf0523a9ed (diff) | |
download | scummvm-rg350-114af3159e7c4fc552972a460f845e982fbc6ef5.tar.gz scummvm-rg350-114af3159e7c4fc552972a460f845e982fbc6ef5.tar.bz2 scummvm-rg350-114af3159e7c4fc552972a460f845e982fbc6ef5.zip |
added a 'width' parameter to drawBitmap (contrary to 'numstrips', it specifies the full width of the image passed in, not how much we shoul draw of it) - this will be used for the new V2 drawBitmap code; renamed drawBitmap parameter 'h' to 'height'
svn-id: r7412
-rw-r--r-- | scumm/gfx.cpp | 53 | ||||
-rw-r--r-- | scumm/gfx.h | 3 | ||||
-rw-r--r-- | scumm/object.cpp | 2 | ||||
-rw-r--r-- | scumm/verbs.cpp | 6 |
4 files changed, 35 insertions, 29 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 7d14145949..c2468cb53c 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -720,7 +720,7 @@ void Scumm::redrawBGStrip(int start, int num) { setGfxUsageBit(s + i, USAGE_BIT_DIRTY); gdi.drawBitmap(getResourceAddress(rtRoom, _roomResource) + _IM00_offs, - &virtscr[0], s, 0, virtscr[0].height, s, num, 0); + &virtscr[0], s, 0, virtscr[0].width, virtscr[0].height, s, num, 0); } void Scumm::restoreCharsetBg() { @@ -838,10 +838,10 @@ byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) { return false; } -void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h, - int stripnr, int numstrip, byte flag) { +void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height, + int stripnr, int numstrip, byte flag) { assert(ptr); - assert(h > 0); + assert(height > 0); byte *backbuff_ptr, *bgbak_ptr, *smap_ptr; int i; byte *zplane_list[9]; @@ -926,18 +926,23 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h, smap_ptr += 24; } - bottom = y + h; + bottom = y + height; if (bottom > vs->height) { warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", bottom, vs->height); } - _vertStripNextInc = h * _vm->_realWidth - 1; + _vertStripNextInc = height * _vm->_realWidth - 1; sx = x; if (vs->scrollable) sx -= vs->xstart >> 3; - do { + if (_vm->_features & GF_AFTER_V2) { + // TODO: implement new V2 strip / zplane drawing in here + + //return; + } + while (numstrip--) { CHECK_HEAP; if (sx < 0) @@ -961,27 +966,27 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h, _mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + (y * _numStrips + x); if (_vm->_features & GF_AFTER_V2) { - decodeStripOldEGA(bgbak_ptr, roomptr + _vm->_egaStripOffsets[stripnr], h, stripnr); + decodeStripOldEGA(bgbak_ptr, roomptr + _vm->_egaStripOffsets[stripnr], height, stripnr); } else if (_vm->_features & GF_16COLOR) { - decodeStripEGA(bgbak_ptr, smap_ptr + READ_LE_UINT16(smap_ptr + stripnr * 2 + 2), h); + decodeStripEGA(bgbak_ptr, smap_ptr + READ_LE_UINT16(smap_ptr + stripnr * 2 + 2), height); } else if (_vm->_features & GF_SMALL_HEADER) { - useOrDecompress = decompressBitmap(bgbak_ptr, smap_ptr + READ_LE_UINT32(smap_ptr + stripnr * 4 + 4), h); + useOrDecompress = decompressBitmap(bgbak_ptr, smap_ptr + READ_LE_UINT32(smap_ptr + stripnr * 4 + 4), height); } else { - useOrDecompress = decompressBitmap(bgbak_ptr, smap_ptr + READ_LE_UINT32(smap_ptr + stripnr * 4 + 8), h); + useOrDecompress = decompressBitmap(bgbak_ptr, smap_ptr + READ_LE_UINT32(smap_ptr + stripnr * 4 + 8), height); } CHECK_HEAP; if (vs->alloctwobuffers) { if (_vm->hasCharsetMask(sx << 3, y, (sx + 1) << 3, bottom)) { if (flag & dbClear || !lightsOn) - clear8ColWithMasking(backbuff_ptr, h, _mask_ptr); + clear8ColWithMasking(backbuff_ptr, height, _mask_ptr); else - draw8ColWithMasking(backbuff_ptr, bgbak_ptr, h, _mask_ptr); + draw8ColWithMasking(backbuff_ptr, bgbak_ptr, height, _mask_ptr); } else { if (flag & dbClear || !lightsOn) - clear8Col(backbuff_ptr, h); + clear8Col(backbuff_ptr, height); else - draw8Col(backbuff_ptr, bgbak_ptr, h); + draw8Col(backbuff_ptr, bgbak_ptr, height); } } CHECK_HEAP; @@ -1011,9 +1016,9 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h, for (i = 0; i < numzbuf; i++) { _mask_ptr_dest = _vm->getResourceAddress(rtBuffer, 9) + y * _numStrips + x + _imgBufOffs[i]; if (useOrDecompress && (flag & dbAllowMaskOr)) - decompressMaskImgOr(_mask_ptr_dest, z_plane_ptr, h); + decompressMaskImgOr(_mask_ptr_dest, z_plane_ptr, height); else - decompressMaskImg(_mask_ptr_dest, z_plane_ptr, h); + decompressMaskImg(_mask_ptr_dest, z_plane_ptr, height); } } else { for (i = 1; i < numzbuf; i++) { @@ -1043,16 +1048,16 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h, if (_vm->_features & GF_AFTER_V2) decompressMaskImgOld(_mask_ptr_dest, roomptr + _vm->_egaStripZOffsets[stripnr], stripnr); else if (useOrDecompress && (flag & dbAllowMaskOr)) { - decompressMaskImgOr(_mask_ptr_dest, z_plane_ptr, h); + decompressMaskImgOr(_mask_ptr_dest, z_plane_ptr, height); } else { - decompressMaskImg(_mask_ptr_dest, z_plane_ptr, h); + decompressMaskImg(_mask_ptr_dest, z_plane_ptr, height); } } else { if (!(useOrDecompress && (flag & dbAllowMaskOr))) - for (int height = 0; height < h; height++) - _mask_ptr_dest[height * _numStrips] = 0; - /* needs better abstraction, FIXME */ + for (int h = 0; h < height; h++) + _mask_ptr_dest[h * _numStrips] = 0; + // FIXME: needs better abstraction } } } @@ -1062,7 +1067,7 @@ next_iter: x++; sx++; stripnr++; - } while (--numstrip); + } } void Gdi::decodeStripEGA(byte *dst, byte *src, int height) { @@ -3392,7 +3397,7 @@ void Scumm::useIm01Cursor(byte *im, int w, int h) { vs->alloctwobuffers = false; gdi._disable_zbuffer = true; - gdi.drawBitmap(im, vs, _screenStartStrip, 0, h, 0, w >> 3, 0); + gdi.drawBitmap(im, vs, _screenStartStrip, 0, w, h, 0, w >> 3, 0); vs->alloctwobuffers = true; gdi._disable_zbuffer = false; diff --git a/scumm/gfx.h b/scumm/gfx.h index acdaa44eec..d59973e0fe 100644 --- a/scumm/gfx.h +++ b/scumm/gfx.h @@ -161,7 +161,8 @@ protected: void updateDirtyScreen(VirtScreen *vs); public: - void drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h, int stripnr, int numstrip, byte flag); + void drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height, + int stripnr, int numstrip, byte flag); void clearUpperMask(); void disableZBuffer() { _disable_zbuffer++; } diff --git a/scumm/object.cpp b/scumm/object.cpp index fd33c4a140..f022af1a95 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -396,7 +396,7 @@ void Scumm::drawObject(int obj, int arg) { // the inventory and conversation icons. if ((_features & GF_AFTER_V7 || _gameId == GID_SAMNMAX) && getClass(od->obj_nr, 22)) flags |= Gdi::dbDrawMaskOnAll; - gdi.drawBitmap(ptr, &virtscr[0], x, ypos, height, x - xpos, numstrip, flags); + gdi.drawBitmap(ptr, &virtscr[0], x, ypos, width << 3, height, x - xpos, numstrip, flags); } } diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index 53b217903f..285a4f6eae 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -270,12 +270,12 @@ void Scumm::drawVerbBitmap(int verb, int x, int y) { for (i = 0; i < imgw; i++) { tmp = xstrip + i; if (tmp < gdi._numStrips) - gdi.drawBitmap(imptr, vs, tmp, ydiff, imgh << 3, i, 1, Gdi::dbAllowMaskOr); + gdi.drawBitmap(imptr, vs, tmp, ydiff, imgw << 3, imgh << 3, i, 1, Gdi::dbAllowMaskOr); } vst = &_verbs[verb]; - vst->right = vst->x + imgw * 8; - vst->bottom = vst->y + imgh * 8; + vst->right = vst->x + imgw << 3; + vst->bottom = vst->y + imgh << 3; vst->oldleft = vst->x; vst->oldright = vst->right; vst->oldtop = vst->y; |