Fixed recent regression (too many blast texts) in The Dig's end credits and

made the text scroll off the screen instead of just vanishing at the top.
(The latter also applies to Full Throttle's end credits.)

svn-id: r8402
This commit is contained in:
Torbjörn Andersson 2003-06-08 15:17:14 +00:00
parent 8ab745de66
commit ab7f8b3378
4 changed files with 24 additions and 9 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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();

View file

@ -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;