[Scummvm-cvs-logs] CVS: tools descumm.cpp,1.52,1.53

Max Horn fingolfin at users.sourceforge.net
Thu May 22 09:09:05 CEST 2003


Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1:/tmp/cvs-serv30650

Modified Files:
	descumm.cpp 
Log Message:
fixed do_decodeparsestring_v2

Index: descumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/descumm.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- descumm.cpp	22 May 2003 00:48:49 -0000	1.52
+++ descumm.cpp	22 May 2003 15:49:08 -0000	1.53
@@ -370,27 +370,24 @@
 
 void do_decodeparsestring_v2(char *buf, byte opcode)
 {
-	byte buffer[256];
-	byte *ptr = buffer;
 	byte c;
+	bool flag;
 
-	while (( c = get_byte())) {
-		if (c & 0x80) {
-			*ptr++ = c & 0x7F;
-			*ptr++ = ' ';
-		} else if (c < 8) {
-			*ptr++ = 0xFF;
-			*ptr++ = c;
+	while ((c = get_byte())) {
+		flag = (c & 0x80) != 0;
+		c &= 0x7f;
+
+		if (c < 8) {
+			buf += sprintf(buf, "^%d", c);
 			if (c > 3) {
-				*ptr++ = 0;
-				*ptr++ = get_byte();
+				buf += sprintf(buf, "^%d", get_byte());
 			}
 		} else
-			*ptr++ = c;
+			*buf++ = c;
+		if (flag)
+			*buf++ = ' ';
 	}
-	*ptr = 0;
-
-	strcat(buf, (char *)buffer);
+	*buf = 0;
 }
 
 void do_actorset_v2(char *buf, byte opcode)
@@ -1968,13 +1965,13 @@
 	case 0x14:
 	case 0x94:
 		// print
-		sprintf(buf, "print(\"");
+		buf += sprintf(buf, "print(\"");
 		do_decodeparsestring_v2(buf, opcode);
 		strcat(buf, "\")");
 		break;
 	case 0xD8:
 		//printEgo
-		sprintf(buf, "printEgo(\"");
+		buf += sprintf(buf, "printEgo(\"");
 		do_decodeparsestring_v2(buf, opcode);
 		strcat(buf, "\")");
 		break;





More information about the Scummvm-git-logs mailing list