[Scummvm-cvs-logs] SF.net SVN: scummvm: [23819] scummvm/branches/branch-0-9-0/engines/scumm

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sat Sep 2 07:51:26 CEST 2006


Revision: 23819
          http://svn.sourceforge.net/scummvm/?rev=23819&view=rev
Author:   kirben
Date:     2006-09-01 22:51:19 -0700 (Fri, 01 Sep 2006)

Log Message:
-----------
Backport fixes for Russian versions of HE72+ games

Modified Paths:
--------------
    scummvm/branches/branch-0-9-0/engines/scumm/he/intern_he.h
    scummvm/branches/branch-0-9-0/engines/scumm/scumm.h
    scummvm/branches/branch-0-9-0/engines/scumm/string.cpp

Modified: scummvm/branches/branch-0-9-0/engines/scumm/he/intern_he.h
===================================================================
--- scummvm/branches/branch-0-9-0/engines/scumm/he/intern_he.h	2006-09-02 05:49:59 UTC (rev 23818)
+++ scummvm/branches/branch-0-9-0/engines/scumm/he/intern_he.h	2006-09-02 05:51:19 UTC (rev 23819)
@@ -290,6 +290,7 @@
 	int getSoundResourceSize(int id);
 
 	virtual bool handleNextCharsetCode(Actor *a, int *c);
+	virtual int convertMessageToString(const byte *msg, byte *dst, int dstSize);
 
 	/* HE version 72 script opcodes */
 	void o72_pushDWord();

Modified: scummvm/branches/branch-0-9-0/engines/scumm/scumm.h
===================================================================
--- scummvm/branches/branch-0-9-0/engines/scumm/scumm.h	2006-09-02 05:49:59 UTC (rev 23818)
+++ scummvm/branches/branch-0-9-0/engines/scumm/scumm.h	2006-09-02 05:51:19 UTC (rev 23819)
@@ -1213,7 +1213,7 @@
 	void debugMessage(const byte *msg);
 	void showMessageDialog(const byte *msg);
 
-	int convertMessageToString(const byte *msg, byte *dst, int dstSize);
+	virtual int convertMessageToString(const byte *msg, byte *dst, int dstSize);
 	int convertIntMessage(byte *dst, int dstSize, int var);
 	int convertVerbMessage(byte *dst, int dstSize, int var);
 	int convertNameMessage(byte *dst, int dstSize, int var);

Modified: scummvm/branches/branch-0-9-0/engines/scumm/string.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/scumm/string.cpp	2006-09-02 05:49:59 UTC (rev 23818)
+++ scummvm/branches/branch-0-9-0/engines/scumm/string.cpp	2006-09-02 05:51:19 UTC (rev 23819)
@@ -715,7 +715,7 @@
 				_charset->_top += fontHeight;
 				break;
 			}
-		} else if (c == 0xFF || (_game.version <= 6 && c == 0xFE)) {
+		} else if (c == 0xFF || (_game.version <= 6 && c == 0xFE) && (_game.heversion <= 71)) {
 			c = buf[i++];
 			switch (c) {
 			case 9:
@@ -819,19 +819,6 @@
 
 	while (1) {
 		chr = src[num++];
-		if (_game.heversion >= 80 && src[num - 1] == '(' && (src[num] == 'p' || src[num] == 'P')) {
-			// Filter out the following prefixes in subtitles
-			// (pickup4)
-			// (PU1)
-			// (PU2)
-			while (src[num++] != ')');
-			continue;
-		}
-		if ((_game.features & GF_HE_LOCALIZED) && chr == '[') {
-			while (src[num++] != ']');
-			continue;
-		}
-
 		if (chr == 0)
 			break;
 		if (chr == 0xFF) {
@@ -899,6 +886,54 @@
 	return dstSize - (end - dst);
 }
 
+#ifndef DISABLE_HE
+int ScummEngine_v72he::convertMessageToString(const byte *msg, byte *dst, int dstSize) {
+	uint num = 0;
+	byte chr;
+	const byte *src;
+	byte *end;
+
+	assert(dst);
+	end = dst + dstSize;
+
+	if (msg == NULL) {
+		debug(0, "Bad message in convertMessageToString, ignoring");
+		return 0;
+	}
+
+	src = msg;
+	num = 0;
+
+	while (1) {
+		chr = src[num++];
+		if (_game.heversion >= 80 && src[num - 1] == '(' && (src[num] == 'p' || src[num] == 'P')) {
+			// Filter out the following prefixes in subtitles
+			// (pickup4)
+			// (PU1)
+			// (PU2)
+			while (src[num++] != ')');
+			continue;
+		}
+		if ((_game.features & GF_HE_LOCALIZED) && chr == '[') {
+			while (src[num++] != ']');
+			continue;
+		}
+
+		if (chr == 0)
+			break;
+
+		*dst++ = chr;
+
+		// Check for a buffer overflow
+		if (dst >= end)
+			error("convertMessageToString: buffer overflow!");
+	}
+	*dst = 0;
+
+	return dstSize - (end - dst);
+}
+#endif
+
 int ScummEngine::convertIntMessage(byte *dst, int dstSize, int var) {
 	int num;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list