[Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.307,1.308

kirben kirben at users.sourceforge.net
Wed Nov 2 18:26:55 CET 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14770/scumm

Modified Files:
	string.cpp 
Log Message:

Cleanup HE changes.
Fix 0xFE check in drawString() too.


Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.307
retrieving revision 1.308
diff -u -d -r1.307 -r1.308
--- string.cpp	2 Nov 2005 21:47:44 -0000	1.307
+++ string.cpp	3 Nov 2005 02:24:53 -0000	1.308
@@ -138,7 +138,7 @@
 bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) {
 	uint32 talk_sound_a = 0;
 	uint32 talk_sound_b = 0;
-	int i, color, frme, c, oldy;
+	int color, frme, c, oldy;
 	bool endLoop = false;
 	byte *buffer = _charsetBuffer + _charsetBufPos;
 	while (!endLoop) {
@@ -203,8 +203,7 @@
 			oldy = _charset->getFontHeight();
 			_charset->setCurID(*buffer++);
 			buffer += 2;
-			for (i = 0; i < 4; i++)
-				_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
+			memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4);
 			_charset->_nextTop -= _charset->getFontHeight() - oldy;
 			break;
 		default:
@@ -223,8 +222,9 @@
 	uint32 talk_sound_b = 0;
 	int i, c;
 	char value[32];
+	bool endLoop = false;
 	byte *buffer = _charsetBuffer + _charsetBufPos;
-	do {
+	while (!endLoop) {
 		c = *buffer++;
 		if (c != charsetCode) {
 			break;
@@ -233,7 +233,7 @@
 		switch (c) {
 		case 84:
 			i = 0;
-			memset(value, 0, 32);
+			memset(value, 0, sizeof(value));
 			c = *buffer++;
 			while (c != 44) {
 				value[i] = c;
@@ -243,7 +243,7 @@
 			value[i] = 0;
 			talk_sound_a = atoi(value);
 			i = 0;
-			memset(value, 0, 32);
+			memset(value, 0, sizeof(value));
 			c = *buffer++;
 			while (c != charsetCode) {
 				value[i] = c;
@@ -257,13 +257,15 @@
 		case 104:
 			_haveMsg = 0;
 			_keepText = true;
+			endLoop = true;
 			break;
 		case 110:
 			c = 13; // new line
+			endLoop = true;
 			break;
 		case 116:
 			i = 0;
-			memset(value, 0, 32);
+			memset(value, 0, sizeof(value));
 			c = *buffer++;
 			while (c != charsetCode) {
 				value[i] = c;
@@ -278,14 +280,15 @@
 		case 119:
 			_haveMsg = 0xFF;
 			_keepText = false;
+			endLoop = true;
 			break;
 		default:
 			error("handleNextCharsetCode: invalid code %d", c);
 		}
-	} while (c != 13);
+	}
 	_charsetBufPos = buffer - _charsetBuffer;
 	*code = c;
-	return true;
+	return (c != 104 && c != 119);
 }
 #endif
 
@@ -526,10 +529,8 @@
 	_charset->_disableOffsX = _charset->_firstChar = true;
 	_charset->setCurID(_string[a].charset);
 
-	if (_version >= 5) {
-		for (i = 0; i < 4; i++)
-			_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
-	}
+	if (_version >= 5)
+		memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4);
 
 	fontHeight = _charset->getFontHeight();
 
@@ -573,7 +574,7 @@
 				_charset->_top += fontHeight;
 				break;
 			}
-		} else if (c == 0xFE || c == 0xFF) {
+		} else if (c == 0xFF || (_version <= 6 && c == 0xFE)) {
 			c = buf[i++];
 			switch (c) {
 			case 9:





More information about the Scummvm-git-logs mailing list