[Scummvm-cvs-logs] CVS: scummvm/scumm script_v2.cpp,1.24,1.25 scumm.h,1.35,1.36 string.cpp,1.26,1.27

James Brown ender at users.sourceforge.net
Sun Oct 6 00:24:01 CEST 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv3610/scumm

Modified Files:
	script_v2.cpp scumm.h string.cpp 
Log Message:
Fix drawDescString - still needs centering corrections


Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- script_v2.cpp	6 Oct 2002 06:51:59 -0000	1.24
+++ script_v2.cpp	6 Oct 2002 07:23:07 -0000	1.25
@@ -2827,9 +2827,7 @@
 				_string[0].color = (byte)args[2];
 				_string[0].xpos = args[3];
 				_string[0].ypos = args[4];
-
-				addMessageToStack(getStringAddressVar(VAR_STRING2DRAW));
-				drawDescString();
+				drawDescString(getStringAddressVar(VAR_STRING2DRAW));
 			}
 			break;
 		case 17:

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- scumm.h	6 Oct 2002 06:09:32 -0000	1.35
+++ scumm.h	6 Oct 2002 07:23:08 -0000	1.36
@@ -939,7 +939,7 @@
 	int hasCharsetMask(int x, int y, int x2, int y2);
 	void CHARSET_1();
 	void description();
-	void drawDescString();
+	void drawDescString(byte *msg);
 	byte *_msgPtrToAdd;
 	byte *addMessageToStack(byte *msg);
 	void addIntToStack(int var);

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- string.cpp	6 Oct 2002 06:47:01 -0000	1.26
+++ string.cpp	6 Oct 2002 07:23:08 -0000	1.27
@@ -504,70 +504,50 @@
 	gdi._mask_bottom = charset._strBottom;
 }
 
-void Scumm::drawDescString()
+void Scumm::drawDescString(byte *msg)
 {
-	byte byte1=0, chr, *buf, *charsetptr;
-	uint color, i;
+	byte c, *buf, buffer[256];
 
-	buf = charset._buffer;
-	charset._bufPos = 0;
+	buf = _msgPtrToAdd = buffer;
+	addMessageToStack(msg);
 
-	charset._left2 = charset._left = _string[0].xpos;
+	charset._bufPos = 0;
 	charset._top = _string[0].ypos;
+	charset._left = _string[0].xpos;
+	charset._left2 = _string[0].xpos;
+	charset._right = _realWidth - 1;
+	charset._xpos2 = _string[0].xpos;
+	charset._ypos2 = _string[0].ypos;
 	charset._curId = _string[0].charset;
 	charset._center = _string[0].center;
-	charset._right = _string[0].right;
 	charset._color = _string[0].color;
 
-	charset._xpos2 = _string[0].xpos;
-	charset._ypos2 = _string[0].ypos;
+	// Center text
+	charset._xpos2 -= charset.getStringWidth(0, buffer, 0) >> 1;
+	if (charset._xpos2 < 0)
+		charset._xpos2 = 0;
+
 	charset._disableOffsX = charset._unk12 = 1;
 	_bkColor = 0;
 	_talkDelay = 1;
 
-	charset._left -= charset.getStringWidth(0, buf, 0) >> 1;
-
 	restoreCharsetBg();
 
-	// Read color mapping and height information
-	charsetptr = getResourceAddress(rtCharset, charset._curId);
-	assert(charsetptr);
-	charsetptr += 29;
-	for (i = 0; i < 4; i++)
-			charset._colorMap[i] = _charsetData[charset._curId][i];
-
-	byte1 = charsetptr[1]; // Character height
-
-	for (i = 0; (chr = buf[i++]) != 0;) {
-		if (chr == 254)
-			chr = 255;
-		if (chr == 255) {
-			chr = buf[i++];
-			switch (chr) {
-			case 9:
-			case 10:
-			case 13:
-			case 14:
-				i += 2;
-				break;
-			case 1:
-			case 8:
-				charset._left = charset._left2 - charset.getStringWidth(0, buf, i);
-				charset._top += byte1;
-				break;
-			case 12:
-				color = buf[i] + (buf[i + 1] << 8);
-				i += 2;
-				if (color == 0xFF)
-					charset._color = _string[0].color;
-				else
-					charset._color = color;
-				break;
-			}
-		} else {
-				charset.printChar(chr);
+	do {
+		c = *buf++;
+		if (c == 0) {
+			_haveMsg = 1;
+			break;
 		}
-	}
+		if (c != 0xFF) {
+			charset._left = charset._xpos2;
+			charset._top = charset._ypos2;
+			charset.printChar(c);
+			charset._xpos2 = charset._left;
+			charset._ypos2 = charset._top;
+			continue;
+		}
+	} while (1);
 
 	gdi._mask_left = charset._strLeft;
 	gdi._mask_right = charset._strRight;





More information about the Scummvm-git-logs mailing list