diff options
author | Max Horn | 2003-05-29 02:14:31 +0000 |
---|---|---|
committer | Max Horn | 2003-05-29 02:14:31 +0000 |
commit | 59acd18cee517101ad900c1522764350f198605b (patch) | |
tree | 6a78c7e10546da005902640085d4948b8c4a9f59 /scumm | |
parent | 3da16e64044c7e6f52631ce75baf66993c2eb6fc (diff) | |
download | scummvm-rg350-59acd18cee517101ad900c1522764350f198605b.tar.gz scummvm-rg350-59acd18cee517101ad900c1522764350f198605b.tar.bz2 scummvm-rg350-59acd18cee517101ad900c1522764350f198605b.zip |
they are getting more and more similar :-)
svn-id: r8073
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/actor.cpp | 10 | ||||
-rw-r--r-- | scumm/akos.cpp | 89 | ||||
-rw-r--r-- | scumm/akos.h | 26 | ||||
-rw-r--r-- | scumm/base-costume.h | 22 | ||||
-rw-r--r-- | scumm/costume.cpp | 200 | ||||
-rw-r--r-- | scumm/costume.h | 17 |
6 files changed, 171 insertions, 193 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index c77d8b733c..0faa1c53f7 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -906,8 +906,6 @@ void Actor::drawActorCostume() { if (!(_vm->_features & GF_NEW_COSTUMES)) { CostumeRenderer& cr = *(CostumeRenderer *)bcr; - cr._outheight = _vm->virtscr[0].height; - if (forceClip) cr._zbuf = forceClip; else if (isInClass(kObjectClassNeverClip)) @@ -930,14 +928,14 @@ void Actor::drawActorCostume() { ar._zbuf = _vm->gdi._numZBuffer; } - ar.outptr = _vm->virtscr[0].screenPtr + _vm->virtscr[0].xstart; - ar.outwidth = _vm->virtscr[0].width; - ar.outheight = _vm->virtscr[0].height; - ar._draw_top = top = 0x7fffffff; ar._draw_bottom = bottom = 0; } + bcr->_outptr = _vm->virtscr[0].screenPtr + _vm->virtscr[0].xstart; + bcr->_outwidth = _vm->virtscr[0].width; + bcr->_outheight = _vm->virtscr[0].height; + // If the actor is partially hidden, redraw it next frame. // Note: for akos, this only works for codec 1 so far; we need to look // if we can (or even should) implement this for the other codecs, too. diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 7fc761a35f..923f550846 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -256,7 +256,7 @@ byte AkosRenderer::drawLimb(const CostumeData &cost, int limb) { assert((code & 0xFFF) * 6 < READ_BE_UINT32_UNALIGNED((const byte *)akof - 4) - 8); assert((code & 0x7000) == 0); - srcptr = akcd + READ_LE_UINT32(&off->akcd); + _srcptr = akcd + READ_LE_UINT32(&off->akcd); costumeInfo = (const CostumeInfo *) (akci + READ_LE_UINT16(&off->akci)); _width = READ_LE_UINT16(&costumeInfo->width); @@ -289,7 +289,7 @@ byte AkosRenderer::drawLimb(const CostumeData &cost, int limb) { code = ((code & 0xF) << 8) | p[5]; off = akof + code; - srcptr = akcd + READ_LE_UINT32(&off->akcd); + _srcptr = akcd + READ_LE_UINT32(&off->akcd); costumeInfo = (const CostumeInfo *) (akci + READ_LE_UINT16(&off->akci)); _width = READ_LE_UINT16(&costumeInfo->width); @@ -327,10 +327,9 @@ void AkosRenderer::codec1_genericDecode() { const byte *scaleytab, *mask; y = v1.y; - - len = v1.replen; - src = srcptr; + src = _srcptr; dst = v1.destptr; + len = v1.replen; color = v1.repcolor; height = _height; @@ -350,12 +349,12 @@ void AkosRenderer::codec1_genericDecode() { do { if (*scaleytab++ < _scaleY) { - if (color && y < outheight + if (color && y < _outheight && (!v1.mask_ptr || !((mask[0] | mask[v1.imgbufoffs]) & maskbit))) { *dst = palette[color]; } mask += _numStrips; - dst += outwidth; + dst += _outwidth; y++; } if (!--height) { @@ -391,10 +390,9 @@ void AkosRenderer::codec1_spec1() { const byte *scaleytab, *mask; y = v1.y; - - len = v1.replen; - src = srcptr; + src = _srcptr; dst = v1.destptr; + len = v1.replen; color = v1.repcolor; height = _height; @@ -414,7 +412,7 @@ void AkosRenderer::codec1_spec1() { do { if (*scaleytab++ < _scaleY) { - if (color && y < outheight + if (color && y < _outheight && (!v1.mask_ptr || !((mask[0] | mask[v1.imgbufoffs]) & maskbit))) { pcolor = palette[color]; if (pcolor == 13) @@ -422,7 +420,7 @@ void AkosRenderer::codec1_spec1() { *dst = pcolor; } mask += _numStrips; - dst += outwidth; + dst += _outwidth; y++; } if (!--height) { @@ -462,10 +460,9 @@ void AkosRenderer::codec1_spec3() { const byte *scaleytab, *mask; y = v1.y; - - len = v1.replen; - src = srcptr; + src = _srcptr; dst = v1.destptr; + len = v1.replen; color = v1.repcolor; height = _height; @@ -485,7 +482,7 @@ void AkosRenderer::codec1_spec3() { do { if (*scaleytab++ < _scaleY) { - if (color && y < outheight + if (color && y < _outheight && (!v1.mask_ptr || !((mask[0] | mask[v1.imgbufoffs]) & maskbit))) { pcolor = palette[color]; if (pcolor < 8) { @@ -496,7 +493,7 @@ void AkosRenderer::codec1_spec3() { } } mask += _numStrips; - dst += outwidth; + dst += _outwidth; y++; } if (!--height) { @@ -632,7 +629,8 @@ byte AkosRenderer::codec1() { int num_colors; bool use_scaling; int i, j; - int cur_x, x_right, x_left, skip = 0, startScaleIndexX, tmp_y; + int skip = 0, startScaleIndexX, tmp_y; + int cur_x, x_right, x_left; int cur_y, y_top, y_bottom; bool y_clipping; bool charsetmask, masking; @@ -709,7 +707,7 @@ byte AkosRenderer::codec1() { j = startScaleIndexX; for (i = 0, skip = 0; i < _width; i++) { - if (x_left >= (int)outwidth) { + if (x_left >= (int)_outwidth) { startScaleIndexX = j; skip++; } @@ -771,17 +769,15 @@ byte AkosRenderer::codec1() { if (_mirror) v1.scaleXstep = -v1.scaleXstep; - if ((int) y_top >= (int)outheight || y_bottom <= 0) + if ((int) y_top >= (int)_outheight || y_bottom <= 0) return 0; - if ((int)x_left >= (int)outwidth || x_right <= 0) + if ((int)x_left >= (int)_outwidth || x_right <= 0) return 1; v1.replen = 0; - v1.y_pitch = _height * outwidth; if (_mirror) { - v1.y_pitch--; if (!use_scaling) skip = -cur_x; if (skip > 0) { @@ -789,7 +785,7 @@ byte AkosRenderer::codec1() { codec1_ignorePakCols(skip); cur_x = 0; } else { - skip = x_right - outwidth; + skip = x_right - _outwidth; if (skip <= 0) { drawFlag = 2; } else { @@ -797,14 +793,12 @@ byte AkosRenderer::codec1() { } } } else { - v1.y_pitch++; - if (!use_scaling) { - skip = x_right - outwidth + 1; - } + if (!use_scaling) + skip = x_right - _outwidth + 1; if (skip > 0) { v1.skip_width -= skip; codec1_ignorePakCols(skip); - cur_x = outwidth - 1; + cur_x = _outwidth - 1; } else { skip = -1 - x_left; if (skip <= 0) { @@ -823,13 +817,13 @@ byte AkosRenderer::codec1() { _vm->updateDirtyRect(0, x_left, x_right, y_top, y_bottom, _dirty_id); - y_clipping = ((uint) y_bottom > outheight || y_top < 0); + y_clipping = ((uint) y_bottom > _outheight || y_top < 0); - if ((uint) y_top > (uint) outheight) + if ((uint) y_top > (uint) _outheight) y_top = 0; - if ((uint) y_bottom > (uint) outheight) - y_bottom = outheight; + if ((uint) y_bottom > (uint) _outheight) + y_bottom = _outheight; if (_draw_top > y_top) _draw_top = y_top; @@ -839,7 +833,7 @@ byte AkosRenderer::codec1() { if (cur_x == -1) cur_x = 0; /* ?? */ - v1.destptr = outptr + cur_x + cur_y * outwidth; + v1.destptr = _outptr + cur_x + cur_y * _outwidth; charsetmask = _vm->hasCharsetMask(x_left, y_top + _vm->virtscr[0].topline, x_right, @@ -886,11 +880,12 @@ void AkosRenderer::codec1_ignorePakCols(int num) { n = _height; if (num > 1) n *= num; + do { - v1.repcolor = *srcptr++; + v1.repcolor = *_srcptr++; v1.replen = v1.repcolor & v1.mask; if (v1.replen == 0) { - v1.replen = *srcptr++; + v1.replen = *_srcptr++; } do { if (!--n) { @@ -913,8 +908,8 @@ byte AkosRenderer::codec5() { clip_right = (clip_left + _width) - 1; clip_top = _actorY + _ymoveCur; clip_bottom = (clip_top + _height) - 1; - maxw = outwidth - 1; - maxh = outheight - 1; + maxw = _outwidth - 1; + maxh = _outheight - 1; if (clip_left < 0) { clip_left = 0; @@ -949,10 +944,10 @@ byte AkosRenderer::codec5() { bdd.srcwidth = _width; bdd.srcheight = _height; - bdd.out = outptr; - bdd.outwidth = outwidth; - bdd.outheight = outheight; - bdd.dataptr = srcptr; + bdd.out = _outptr; + bdd.outwidth = _outwidth; + bdd.outheight = _outheight; + bdd.dataptr = _srcptr; bdd.scale_x = 255; bdd.scale_y = 255; bdd.shadowMode = _shadow_mode; @@ -1198,8 +1193,8 @@ byte AkosRenderer::codec16() { int32 skip_y = 0; int32 cur_x = _width - 1; int32 cur_y = _height - 1; - int32 maxw = outwidth - 1; - int32 maxh = outheight - 1; + int32 maxw = _outwidth - 1; + int32 maxh = _outheight - 1; int32 tmp_x, tmp_y; byte transparency = (_vm->_features & GF_HUMONGOUS) ? 0 : 255; @@ -1282,16 +1277,16 @@ byte AkosRenderer::codec16() { int32 numskip_before = skip_x + (skip_y * _width); int32 numskip_after = _width - cur_x; - byte *dest = outptr + width_unk + height_unk * _vm->_screenWidth; + byte *dest = _outptr + width_unk + height_unk * _outwidth; if (_zbuf == 0) { - akos16Decompress(dest, pitch, srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency); + akos16Decompress(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency); return 0; } byte *ptr = _vm->_screenStartStrip + _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf]; ptr += _numStrips * clip_top + (clip_left / 8); - akos16DecompressMask(dest, pitch, srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, ptr, clip_left / 8); + akos16DecompressMask(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, ptr, clip_left / 8); return 0; } diff --git a/scumm/akos.h b/scumm/akos.h index e40294c759..a91dc1f459 100644 --- a/scumm/akos.h +++ b/scumm/akos.h @@ -30,13 +30,9 @@ struct AkosHeader; struct AkosOffset; class AkosRenderer : public BaseCostumeRenderer { -public: - byte *outptr; - uint outwidth, outheight; - protected: uint16 codec; - const byte *srcptr; + const byte *_srcptr; // movement of cel to decode int _xmoveCur, _ymoveCur; @@ -53,23 +49,6 @@ protected: const byte *akcd; struct { - /* codec stuff */ - const byte *scaletable; - byte mask, shr; - bool doContinue; - byte repcolor; - byte replen; - int scaleXstep; - int x, y; - int tmp_x, tmp_y; - int y_pitch; - int skip_width; - byte *destptr; - byte *mask_ptr; - int imgbufoffs; - } v1; - - struct { byte unk5; int unk6; byte mask; @@ -83,8 +62,7 @@ protected: public: AkosRenderer(Scumm *scumm) : BaseCostumeRenderer(scumm) { - outptr = 0; - srcptr = 0; + _srcptr = 0; akos = 0; akhd = 0; akpl = 0; diff --git a/scumm/base-costume.h b/scumm/base-costume.h index 327bb8bf99..fcd638abab 100644 --- a/scumm/base-costume.h +++ b/scumm/base-costume.h @@ -57,6 +57,10 @@ public: int _draw_top, _draw_bottom; + // Destination params + byte *_outptr; + uint _outwidth, _outheight; + protected: Scumm *_vm; int32 _numStrips; @@ -70,6 +74,21 @@ protected: // width and height of cel to decode int _width, _height; + struct { + /* codec stuff */ + const byte *scaletable; + byte mask, shr; + byte repcolor; + byte replen; + int scaleXstep; + int x, y; + int tmp_x, tmp_y; + int skip_width; + byte *destptr; + const byte *mask_ptr; + int imgbufoffs; + } v1; + public: BaseCostumeRenderer(Scumm *scumm) { _dirty_id = 0; @@ -85,6 +104,9 @@ public: _xmove = _ymove = 0; _mirror = false; _width = _height = 0; + + _outptr = 0; + _outwidth = _outheight = 0; } virtual void setPalette(byte *palette) = 0; diff --git a/scumm/costume.cpp b/scumm/costume.cpp index f807037ef0..fe7d485999 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -36,17 +36,17 @@ void CostumeRenderer::ignorePakCols(int num) { n *= num; do { - _repcolor = *_srcptr++; - _replen = _repcolor & _maskval; - if (_replen == 0) { - _replen = *_srcptr++; + v1.repcolor = *_srcptr++; + v1.replen = v1.repcolor & v1.mask; + if (v1.replen == 0) { + v1.replen = *_srcptr++; } do { if (!--n) { - _repcolor >>= _shrval; + v1.repcolor >>= v1.shr; return; } - } while (--_replen); + } while (--v1.replen); } while (1); } @@ -84,14 +84,16 @@ byte CostumeRenderer::mainRoutine() { bool use_scaling; byte startScaleIndexX; int ex1, ex2; + int y_top, y_bottom; + int x_left, x_right; const CostumeInfo *costumeInfo; CHECK_HEAP - _maskval = 0xF; - _shrval = 4; + v1.mask = 0xF; + v1.shr = 4; if (_loaded._numColors == 32) { - _maskval = 7; - _shrval = 3; + v1.mask = 7; + v1.shr = 3; } // FIXME: those are here just in case... you never now... @@ -100,7 +102,7 @@ byte CostumeRenderer::mainRoutine() { costumeInfo = (const CostumeInfo *)_srcptr; _width = _width2 = READ_LE_UINT16(&costumeInfo->width); - _height = _height2 = READ_LE_UINT16(&costumeInfo->height); + _height = READ_LE_UINT16(&costumeInfo->height); xmove = _xmove + (int16)READ_LE_UINT16(&costumeInfo->rel_x); ymove = _ymove + (int16)READ_LE_UINT16(&costumeInfo->rel_y); _xmove += (int16)READ_LE_UINT16(&costumeInfo->move_x); @@ -119,8 +121,8 @@ byte CostumeRenderer::mainRoutine() { } } - _xpos = _actorX; - _ypos = _actorY; + v1.x = _actorX; + v1.y = _actorY; use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF); @@ -137,36 +139,36 @@ byte CostumeRenderer::mainRoutine() { startScaleIndexX = _scaleIndexX = 128 - xmove; for (i = 0; i < xmove; i++) { if (cost_scaleTable[_scaleIndexX++] < _scaleX) - _xpos -= _scaleIndexXStep; + v1.x -= _scaleIndexXStep; } - _right = _left = _xpos; + x_right = x_left = v1.x; _scaleIndexX = startScaleIndexX; for (i = 0; i < _width; i++) { - if (_right < 0) { + if (x_right < 0) { s++; startScaleIndexX = _scaleIndexX; } scal = cost_scaleTable[_scaleIndexX++]; if (scal < _scaleX) - _right++; + x_right++; } } else { startScaleIndexX = _scaleIndexX = xmove + 128; for (i = 0; i < xmove; i++) { scal = cost_scaleTable[_scaleIndexX--]; if (scal < _scaleX) - _xpos += _scaleIndexXStep; + v1.x += _scaleIndexXStep; } - _right = _left = _xpos; + x_right = x_left = v1.x; _scaleIndexX = startScaleIndexX; for (i = 0; i < _width; i++) { - if (_left > (_vm->_screenWidth - 1)) { + if (x_left > (_vm->_screenWidth - 1)) { s++; startScaleIndexX = _scaleIndexX; } scal = cost_scaleTable[_scaleIndexX--]; if (scal < _scaleX) - _left--; + x_left--; } } _scaleIndexX = startScaleIndexX; @@ -181,58 +183,56 @@ byte CostumeRenderer::mainRoutine() { for (i = 0; i < ymove; i++) { scal = cost_scaleTable[_scaleIndexY++]; if (scal < _scaleY) - _ypos -= _scaleIndexYStep; + v1.y -= _scaleIndexYStep; } - _top = _bottom = _ypos; + y_top = y_bottom = v1.y; _scaleIndexY = 128 - ymove; for (i = 0; i < _height; i++) { scal = cost_scaleTable[_scaleIndexY++]; if (scal < _scaleY) - _bottom++; + y_bottom++; } _scaleIndexY = _scaleIndexYTop = 128 - ymove; } else { - if (_mirror == 0) + if (!_mirror) xmove = -xmove; - _xpos += xmove; - _ypos += ymove; + v1.x += xmove; + v1.y += ymove; if (_mirror) { - _left = _xpos; - _right = _xpos + _width; + x_left = v1.x; + x_right = v1.x + _width; } else { - _left = _xpos - _width; - _right = _xpos; + x_left = v1.x - _width; + x_right = v1.x; } - _top = _ypos; - _bottom = _top + _height; + y_top = v1.y; + y_bottom = y_top + _height; } _scaleIndexXStep = -1; if (_mirror) _scaleIndexXStep = 1; - _ypostop = _ypos; + _ypostop = v1.y; - _vm->updateDirtyRect(0, _left, _right + 1, _top, _bottom, _dirty_id); + _vm->updateDirtyRect(0, x_left, x_right + 1, y_top, y_bottom, _dirty_id); - if (_top >= (int)_outheight || _bottom <= 0) + if (y_top >= (int)_outheight || y_bottom <= 0) return 0; - _ypitch = _height * _vm->_screenWidth; _docontinue = 0; - if (_left >= _vm->_screenWidth || _right <= 0) + if (x_left >= _vm->_screenWidth || x_right <= 0) return 1; if (_mirror) { - _ypitch--; - if (use_scaling == 0) - s = -_xpos; + if (!use_scaling) + s = -v1.x; if (s > 0) { _width2 -= s; ignorePakCols(s); - _xpos = 0; + v1.x = 0; _docontinue = 1; } else { - s = _right - _vm->_screenWidth; + s = x_right - _vm->_screenWidth; if (s <= 0) { drawFlag = 2; } else { @@ -240,16 +240,15 @@ byte CostumeRenderer::mainRoutine() { } } } else { - _ypitch++; - if (use_scaling == 0) - s = _right - _vm->_screenWidth; + if (!use_scaling) + s = x_right - _vm->_screenWidth; if (s > 0) { _width2 -= s; ignorePakCols(s); - _xpos = _vm->_screenWidth - 1; + v1.x = _vm->_screenWidth - 1; _docontinue = 1; } else { - s = -1 - _left; + s = -1 - x_left; if (s <= 0) drawFlag = 2; else @@ -260,32 +259,29 @@ byte CostumeRenderer::mainRoutine() { if (_width2 == 0) return 0; - if ((uint) _top > (uint) _outheight) - _top = 0; + if ((uint) y_top > (uint) _outheight) + y_top = 0; - if (_left < 0) - _left = 0; + if (x_left < 0) + x_left = 0; - if ((uint) _bottom > _outheight) - _bottom = _outheight; + if ((uint) y_bottom > _outheight) + y_bottom = _outheight; - if (_draw_top > _top) - _draw_top = _top; + if (_draw_top > y_top) + _draw_top = y_top; + if (_draw_bottom < y_bottom) + _draw_bottom = y_bottom; - if (_draw_bottom < _bottom) - _draw_bottom = _bottom; - - if (_height2 + _top >= 256) { + if (_height + y_top >= 256) { CHECK_HEAP return 2; } - _bgbak_ptr = _vm->getResourceAddress(rtBuffer, 5) + _vm->virtscr[0].xstart + _ypos * _vm->_screenWidth + _xpos; - _backbuff_ptr = _vm->virtscr[0].screenPtr + _vm->virtscr[0].xstart + _ypos * _vm->_screenWidth + _xpos; + v1.destptr = _outptr + v1.y * _vm->_screenWidth + v1.x; - _mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + _ypos * _numStrips + _vm->_screenStartStrip; - _imgbufoffs = _vm->gdi._imgBufOffs[_zbuf]; - _mask_ptr_dest = _mask_ptr + _xpos / 8; + v1.mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + v1.y * _numStrips + _vm->_screenStartStrip; + v1.imgbufoffs = _vm->gdi._imgBufOffs[_zbuf]; // FIXME: Masking used to be conditional. Will it cause regressions // to always do it? I don't think so, since the behaviour used to be @@ -311,20 +307,21 @@ byte CostumeRenderer::mainRoutine() { } void CostumeRenderer::proc3() { - byte *mask, *src, *dst; + const byte *mask, *src; + byte *dst; byte maskbit, len, height, pcolor, width; int color, t; uint y; bool masked; - mask = _mask_ptr_dest; - maskbit = revBitMask[_xpos & 7]; - y = _ypos; + mask = v1.mask_ptr + (v1.x >> 3); + maskbit = revBitMask[v1.x & 7]; + y = v1.y; src = _srcptr; - dst = _backbuff_ptr; - len = _replen; - color = _repcolor; - height = _height2; + dst = v1.destptr; + len = v1.repcolor; + color = v1.repcolor; + height = _height; width = _width2; if (_docontinue) @@ -332,14 +329,14 @@ void CostumeRenderer::proc3() { do { len = *src++; - color = len >> _shrval; - len &= _maskval; + color = len >> v1.shr; + len &= v1.mask; if (!len) len = *src++; do { if (_scaleY == 255 || cost_scaleTable[_scaleIndexY++] < _scaleY) { - masked = (_use_mask && (mask[_imgbufoffs] & maskbit)) || (_use_charset_mask && (mask[0] & maskbit)); + masked = (_use_mask && (mask[v1.imgbufoffs] & maskbit)) || (_use_charset_mask && (mask[0] & maskbit)); if (color && y < _outheight && !masked) { // FIXME: Fully implement _shadow_mode. @@ -367,14 +364,14 @@ void CostumeRenderer::proc3() { t = _scaleIndexX; _scaleIndexX += _scaleIndexXStep; if (_scaleX == 255 || cost_scaleTable[t] < _scaleX) { - _xpos += _scaleIndexXStep; - if (_xpos < 0 || _xpos >= _vm->_screenWidth) + v1.x += _scaleIndexXStep; + if (v1.x < 0 || v1.x >= _vm->_screenWidth) return; - maskbit = revBitMask[_xpos & 7]; - _backbuff_ptr += _scaleIndexXStep; + maskbit = revBitMask[v1.x & 7]; + v1.destptr += _scaleIndexXStep; } - dst = _backbuff_ptr; - mask = _mask_ptr + (_xpos >> 3); + dst = v1.destptr; + mask = v1.mask_ptr + (v1.x >> 3); } StartPos:; } while (--len); @@ -382,45 +379,46 @@ void CostumeRenderer::proc3() { } void CostumeRenderer::proc3_ami() { - byte *mask, *src, *dst; + const byte *mask, *src; + byte *dst; byte maskbit, len, height, width; int color, t; uint y; bool masked; int oldXpos, oldScaleIndexX; - mask = _mask_ptr_dest; - dst = _backbuff_ptr; - height = _height2; + mask = v1.mask_ptr + (v1.x >> 3); + dst = v1.destptr; + height = _height; width = _width; src = _srcptr; - maskbit = revBitMask[_xpos & 7]; - y = _ypos; - oldXpos = _xpos; + maskbit = revBitMask[v1.x & 7]; + y = v1.y; + oldXpos = v1.x; oldScaleIndexX = _scaleIndexX; do { len = *src++; - color = len >> _shrval; - len &= _maskval; + color = len >> v1.shr; + len &= v1.mask; if (!len) len = *src++; do { if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) { - masked = (_use_mask && (mask[_imgbufoffs] & maskbit)) || (_use_charset_mask && (mask[0] & maskbit)); + masked = (_use_mask && (mask[v1.imgbufoffs] & maskbit)) || (_use_charset_mask && (mask[0] & maskbit)); - if (color && _xpos >= 0 && _xpos < _vm->_screenWidth && !masked) { + if (color && v1.x >= 0 && v1.x < _vm->_screenWidth && !masked) { *dst = _palette[color]; } t = _scaleIndexX; _scaleIndexX = t + _scaleIndexXStep; if (_scaleX == 255 || cost_scaleTable[t] < _scaleX) { - _xpos += _scaleIndexXStep; + v1.x += _scaleIndexXStep; dst += _scaleIndexXStep; - maskbit = revBitMask[_xpos & 7]; + maskbit = revBitMask[v1.x & 7]; } - mask = _mask_ptr + (_xpos >> 3); + mask = v1.mask_ptr + (v1.x >> 3); } if (!--width) { if (!--height) @@ -429,14 +427,14 @@ void CostumeRenderer::proc3_ami() { if (y >= _outheight) return; - if (_xpos != oldXpos) { - dst += _vm->_screenWidth - (_xpos - oldXpos); - _mask_ptr += _numStrips; - mask = _mask_ptr; + if (v1.x != oldXpos) { + dst += _vm->_screenWidth - (v1.x - oldXpos); + v1.mask_ptr += _numStrips; + mask = v1.mask_ptr; y++; } width = _width; - _xpos = oldXpos; + v1.x = oldXpos; _scaleIndexX = oldScaleIndexX; _scaleIndexY++; } diff --git a/scumm/costume.h b/scumm/costume.h index 6257b15d95..cb1de49675 100644 --- a/scumm/costume.h +++ b/scumm/costume.h @@ -42,35 +42,22 @@ protected: byte increaseAnim(Actor *a, int slot); }; -class CostumeRenderer : public BaseCostumeRenderer { -public: - uint _outheight; +class CostumeRenderer : public BaseCostumeRenderer { protected: LoadedCostume _loaded; byte *_frameptr; - byte *_srcptr; - byte *_bgbak_ptr, *_backbuff_ptr, *_mask_ptr, *_mask_ptr_dest; - byte _maskval; + const byte *_srcptr; bool _use_mask, _use_charset_mask; - byte _shrval; byte _width2; - byte _height2; - int _xpos, _ypos; int _scaleIndexXStep; int _scaleIndexYStep; byte _scaleIndexX; /* must wrap at 256 */ byte _scaleIndexY, _scaleIndexYTop; - int _left, _right; - int _top, _bottom; int _ypostop; - int _ypitch; byte _docontinue; - int _imgbufoffs; - byte _repcolor; - byte _replen; byte _palette[32]; public: |