diff options
author | Max Horn | 2003-05-29 18:45:58 +0000 |
---|---|---|
committer | Max Horn | 2003-05-29 18:45:58 +0000 |
commit | 746b0bdc5b77f82bdb83b88eb1513b7abd595cdb (patch) | |
tree | f1b60c008196a4d5ddb33772ca745a37078a8523 | |
parent | f0c0b5f4f8bb308900747bc206399dbf9375904c (diff) | |
download | scummvm-rg350-746b0bdc5b77f82bdb83b88eb1513b7abd595cdb.tar.gz scummvm-rg350-746b0bdc5b77f82bdb83b88eb1513b7abd595cdb.tar.bz2 scummvm-rg350-746b0bdc5b77f82bdb83b88eb1513b7abd595cdb.zip |
cleanup; fixed crashes that occured when an actor was drawn partly offscreen
svn-id: r8113
-rw-r--r-- | scumm/akos.cpp | 12 | ||||
-rw-r--r-- | scumm/costume.cpp | 27 | ||||
-rw-r--r-- | scumm/costume.h | 1 |
3 files changed, 11 insertions, 29 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp index a42410bb69..0d88984c01 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -351,7 +351,7 @@ void AkosRenderer::codec1_genericDecode() { do { if (*scaleytab++ < _scaleY) { - masked = v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit); + masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit); if (color && y < _outheight && !masked) { pcolor = palette[color]; @@ -508,7 +508,6 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { int skip = 0, startScaleIndexX, startScaleIndexY; int cur_x, x_right, x_left; int cur_y, y_top, y_bottom; - bool y_clipping; bool charsetmask, masking; int step; byte drawFlag = 1; @@ -690,8 +689,6 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { _vm->updateDirtyRect(0, x_left, x_right, y_top, y_bottom, _dirty_id); - y_clipping = ((uint) y_bottom > _outheight || y_top < 0); - if ((uint) y_top > (uint) _outheight) y_top = 0; @@ -703,10 +700,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { if (_draw_bottom < y_bottom) _draw_bottom = y_bottom; - if (cur_x == -1) - cur_x = 0; /* ?? */ - - v1.destptr = _outptr + cur_x + cur_y * _outwidth; + v1.destptr = _outptr + v1.y * _outwidth + v1.x; charsetmask = _vm->hasCharsetMask(x_left, y_top + _vm->virtscr[0].topline, x_right, @@ -720,7 +714,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { v1.mask_ptr = NULL; if (masking || charsetmask || _shadow_mode) { - v1.mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + cur_y * _numStrips + _vm->_screenStartStrip; + v1.mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + v1.y * _numStrips + _vm->_screenStartStrip; v1.imgbufoffs = _vm->gdi._imgBufOffs[_zbuf]; if (!charsetmask && masking) { v1.mask_ptr += v1.imgbufoffs; diff --git a/scumm/costume.cpp b/scumm/costume.cpp index 36cdd5060a..81fb964fc2 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -223,12 +223,12 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { if (_width2 == 0) return 0; - if ((uint) y_top > (uint) _outheight) - y_top = 0; - if (x_left < 0) x_left = 0; + if ((uint) y_top > (uint) _outheight) + y_top = 0; + if ((uint) y_bottom > _outheight) y_bottom = _outheight; @@ -247,18 +247,6 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { 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 - // to mask if there was a mask to apply, unless _zbuf is 0. - // - // However, when _zbuf is 0 masking and charset masking are the same - // thing. I believe the only thing that is ever written to the - // frontmost mask buffer is the charset mask, except in Sam & Max - // where it's also used for the inventory box and conversation icons. - - _use_mask = true; - _use_charset_mask = true; - CHECK_HEAP if (_vm->_features & GF_AMIGA) @@ -278,8 +266,6 @@ void CostumeRenderer::proc3() { uint y; bool masked; - mask = v1.mask_ptr + (v1.x >> 3); - maskbit = revBitMask[v1.x & 7]; y = v1.y; src = _srcptr; dst = v1.destptr; @@ -288,6 +274,9 @@ void CostumeRenderer::proc3() { height = _height; width = _width2; + maskbit = revBitMask[v1.x & 7]; + mask = v1.mask_ptr + (v1.x >> 3); + if (len) goto StartPos; @@ -300,7 +289,7 @@ void CostumeRenderer::proc3() { do { if (_scaleY == 255 || cost_scaleTable[_scaleIndexY++] < _scaleY) { - masked = (_use_mask && (mask[v1.imgbufoffs] & maskbit)) || (_use_charset_mask && (mask[0] & maskbit)); + masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit); if (color && y < _outheight && !masked) { // FIXME: Fully implement _shadow_mode. @@ -369,7 +358,7 @@ void CostumeRenderer::proc3_ami() { len = *src++; do { if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) { - masked = (_use_mask && (mask[v1.imgbufoffs] & maskbit)) || (_use_charset_mask && (mask[0] & maskbit)); + masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit); if (color && v1.x >= 0 && v1.x < _vm->_screenWidth && !masked) { *dst = _palette[color]; diff --git a/scumm/costume.h b/scumm/costume.h index ef8d6d631d..317f70d5f4 100644 --- a/scumm/costume.h +++ b/scumm/costume.h @@ -47,7 +47,6 @@ class CostumeRenderer : public BaseCostumeRenderer { protected: LoadedCostume _loaded; - bool _use_mask, _use_charset_mask; byte _width2; byte _scaleIndexX; /* must wrap at 256 */ |