[Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.44,2.45 gfx.cpp,2.156,2.157 scumm.h,1.249,1.250 string.cpp,1.134,1.135

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sun Jun 8 08:18:02 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv4261

Modified Files:
	charset.cpp gfx.cpp scumm.h string.cpp 
Log Message:
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.)


Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.44
retrieving revision 2.45
diff -u -d -r2.44 -r2.45
--- charset.cpp	8 Jun 2003 11:54:35 -0000	2.44
+++ charset.cpp	8 Jun 2003 15:17:13 -0000	2.45
@@ -597,7 +597,7 @@
 
 	_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 @@
 		_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 @@
 		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 @@
 		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;

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.156
retrieving revision 2.157
diff -u -d -r2.156 -r2.157
--- gfx.cpp	7 Jun 2003 22:56:47 -0000	2.156
+++ gfx.cpp	8 Jun 2003 15:17:14 -0000	2.157
@@ -803,10 +803,10 @@
 	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;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -d -r1.249 -r1.250
--- scumm.h	8 Jun 2003 12:56:42 -0000	1.249
+++ scumm.h	8 Jun 2003 15:17:14 -0000	1.250
@@ -919,7 +919,7 @@
 	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();

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- string.cpp	7 Jun 2003 00:49:36 -0000	1.134
+++ string.cpp	8 Jun 2003 15:17:14 -0000	1.135
@@ -690,8 +690,25 @@
 }
 
 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;





More information about the Scummvm-git-logs mailing list