diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/charset.cpp | 8 | ||||
-rw-r--r-- | scumm/gfx.cpp | 4 | ||||
-rw-r--r-- | scumm/scumm.h | 2 | ||||
-rw-r--r-- | scumm/string.cpp | 19 |
4 files changed, 24 insertions, 9 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp index b895043d25..c27d2a8c4a 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -597,7 +597,7 @@ void CharsetRendererClassic::printChar(int chr) { _vm->checkRange(_vm->_maxCharsets - 1, 1, _curId, "Printing with bad charset %d"); - if ((vs = _vm->findVirtScreen(_top)) == NULL) + if ((vs = _vm->findVirtScreen(_top)) == NULL && (vs = _vm->findVirtScreen(_top + getFontHeight())) == NULL) return; if (chr == '@') @@ -671,8 +671,6 @@ void CharsetRendererClassic::printChar(int chr) { _str.top = _top; int drawTop = _top - vs->topline; - if (drawTop < 0) - drawTop = 0; _vm->updateDirtyRect(vs->number, _left, _left + width, drawTop, drawTop + height + offsY, 0); @@ -740,7 +738,7 @@ void CharsetRendererClassic::drawBitsN(VirtScreen *vs, byte *dst, const byte *sr for (x = 0; x < width; x++) { color = (bits >> (8 - bpp)) & 0xFF; - if (color) { + if (color && y + drawTop >= 0) { *dst = _vm->_charsetColorMap[color]; if (useMask) { mask[maskpos] |= maskmask; @@ -778,7 +776,7 @@ void CharsetRendererCommon::drawBits1(VirtScreen *vs, byte *dst, const byte *src for (x = 0; x < width; x++) { if ((x % 8) == 0) bits = *src++; - if (bits & revBitMask[x % 8]) { + if ((bits & revBitMask[x % 8]) && y + drawTop >= 0) { if (_dropShadow) { *(dst + 1) = 0; *(dst + _vm->_screenWidth) = 0; diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index f70322b16c..c7655ac517 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -803,10 +803,10 @@ void Scumm::restoreBG(ScummVM::Rect rect, byte backColor) { byte *backbuff, *bgbak; bool lightsOn; - if (rect.left >= rect.right || rect.top >= rect.bottom) - return; if (rect.top < 0) rect.top = 0; + if (rect.left >= rect.right || rect.top >= rect.bottom) + return; if ((vs = findVirtScreen(rect.top)) == NULL) return; diff --git a/scumm/scumm.h b/scumm/scumm.h index aa7ce4e26a..33003414d4 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -919,7 +919,7 @@ protected: BlastObject _blastObjectQueue[128]; int _blastTextQueuePos; - BlastText _blastTextQueue[32]; // FIXME - how many blast texts can there be at once? + BlastText _blastTextQueue[35]; // FIXME - how many blast texts can there be at once? The Dig needs 33 for its end credits. void enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center); void drawBlastTexts(); diff --git a/scumm/string.cpp b/scumm/string.cpp index 8f21d2d49e..aab1d45147 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -690,8 +690,25 @@ void Scumm::initCharset(int charsetno) { } void Scumm::enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center) { + // The Dig will keep enqueueing texts long after they've scrolled off + // the screen, eventually overflowing the blast text queue if left + // unchecked. + + if (y < 0) { + byte old_charset; + int font_height; + + old_charset = _charset->getCurID(); + _charset->setCurID(charset); + font_height = _charset->getFontHeight(); + _charset->setCurID(old_charset); + + if (y <= -font_height) + return; + } + BlastText &bt = _blastTextQueue[_blastTextQueuePos++]; - assert(_blastTextQueuePos <= 32); + assert(_blastTextQueuePos <= ARRAYSIZE(_blastTextQueue)); strcpy((char *)bt.text, (const char *)text); bt.xpos = x; |