[Scummvm-cvs-logs] SF.net SVN: scummvm: [23814] scummvm/trunk/engines/scumm

kirben at users.sourceforge.net kirben at users.sourceforge.net
Fri Sep 1 14:04:51 CEST 2006


Revision: 23814
          http://svn.sourceforge.net/scummvm/?rev=23814&view=rev
Author:   kirben
Date:     2006-09-01 05:04:40 -0700 (Fri, 01 Sep 2006)

Log Message:
-----------
Add HE72+ specific version of convertMessageToString(), to reduce filtering and since special codes aren't used.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/he/intern_he.h
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h
    scummvm/trunk/engines/scumm/string.cpp

Modified: scummvm/trunk/engines/scumm/he/intern_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/intern_he.h	2006-08-31 19:32:38 UTC (rev 23813)
+++ scummvm/trunk/engines/scumm/he/intern_he.h	2006-09-01 12:04:40 UTC (rev 23814)
@@ -286,6 +286,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/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-08-31 19:32:38 UTC (rev 23813)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-09-01 12:04:40 UTC (rev 23814)
@@ -1710,7 +1710,7 @@
 	}
 
 	if (_game.heversion >= 80) {
-		((SoundHE *)_sound)->processSoundCode();
+		//((SoundHE *)_sound)->processSoundCode();
 	}
 	runAllScripts();
 	checkExecVerbs();

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2006-08-31 19:32:38 UTC (rev 23813)
+++ scummvm/trunk/engines/scumm/scumm.h	2006-09-01 12:04:40 UTC (rev 23814)
@@ -1214,7 +1214,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/trunk/engines/scumm/string.cpp
===================================================================
--- scummvm/trunk/engines/scumm/string.cpp	2006-08-31 19:32:38 UTC (rev 23813)
+++ scummvm/trunk/engines/scumm/string.cpp	2006-09-01 12:04:40 UTC (rev 23814)
@@ -792,13 +792,11 @@
 	_string[a].xpos = _charset->_str.right + 8;	// Indy3: Fixes Grail Diary text positioning
 }
 
-int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) {
+int ScummEngine_v72he::convertMessageToString(const byte *msg, byte *dst, int dstSize) {
 	uint num = 0;
-	uint32 val;
 	byte chr;
 	const byte *src;
 	byte *end;
-	byte transBuf[384];
 
 	assert(dst);
 	end = dst + dstSize;
@@ -808,13 +806,7 @@
 		return 0;
 	}
 
-	if (_game.version >= 7) {
-		translateText(msg, transBuf);
-		src = transBuf;
-	} else {
-		src = msg;
-	}
-
+	src = msg;
 	num = 0;
 
 	while (1) {
@@ -834,6 +826,47 @@
 
 		if (chr == 0)
 			break;
+
+		*dst++ = chr;
+
+		// Check for a buffer overflow
+		if (dst >= end)
+			error("convertMessageToString: buffer overflow!");
+	}
+	*dst = 0;
+
+	return dstSize - (end - dst);
+}
+
+int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) {
+	uint num = 0;
+	uint32 val;
+	byte chr;
+	const byte *src;
+	byte *end;
+	byte transBuf[384];
+
+	assert(dst);
+	end = dst + dstSize;
+
+	if (msg == NULL) {
+		debug(0, "Bad message in convertMessageToString, ignoring");
+		return 0;
+	}
+
+	if (_game.version >= 7) {
+		translateText(msg, transBuf);
+		src = transBuf;
+	} else {
+		src = msg;
+	}
+
+	num = 0;
+
+	while (1) {
+		chr = src[num++];
+		if (chr == 0)
+			break;
 		if (chr == 0xFF) {
 			chr = src[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