[Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.205,1.206 script_v6.cpp,1.324,1.325

Max Horn fingolfin at users.sourceforge.net
Fri Apr 2 12:44:02 CEST 2004


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

Modified Files:
	string.cpp script_v6.cpp 
Log Message:
Added support for %___ strings (used in localized version of The Dig)

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- string.cpp	19 Mar 2004 23:19:57 -0000	1.205
+++ string.cpp	2 Apr 2004 20:31:39 -0000	1.206
@@ -589,8 +589,15 @@
 	num = readVar(var);
 	if (num) {
 		const byte *ptr = getObjOrActorName(num);
-		if (ptr)
-			addMessageToStack(ptr, 0, 0);
+		if (ptr) {
+			if ((_version >= 7) && (ptr[0] == '/')) {
+				byte buf[128];
+				translateText(ptr, buf);
+				addMessageToStack(buf, 0, 0);
+			} else {
+				addMessageToStack(ptr, 0, 0);
+			}
+		}
 	}
 }
 
@@ -613,9 +620,10 @@
 	if (var) {
 		ptr = getStringAddress(var);
 		if (ptr) {
-			if ((_version == 8) && (ptr[0] == '/')) {
-				translateText(ptr, _transText);
-				addMessageToStack(_transText, 0, 0);
+			if ((_version >= 7) && (ptr[0] == '/')) {
+				byte buf[128];
+				translateText(ptr, buf);
+				addMessageToStack(buf, 0, 0);
 			} else {
 				addMessageToStack(ptr, 0, 0);
 			}
@@ -898,6 +906,30 @@
 			found = (LangIndexNode *)bsearch(&target, _languageIndex, _languageIndexSize, sizeof(LangIndexNode), indexCompare);
 		if (found != NULL) {
 			strcpy((char *)trans_buff, _languageBuffer + found->offset);
+
+			// FIXME / TODO: Maybe this should be enabled for Full Throttle, too?
+			if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
+				// Replace any '%___' by the corresponding special codes in the source text
+				const byte *src = text;
+				char *dst = (char *)trans_buff;
+
+				while ((dst = strstr(dst, "%___"))) {
+					// Search for a special code in the message. They have
+					// the form:  255-byte OP-byte ARG-int16
+					while (*src && *src != 0xFF) {
+						src++;
+					}
+					
+					// Replace the %___ by the special code
+					if (*src == 0xFF) {
+						memcpy(dst, src, 4);
+						src += 4;
+						dst += 4;
+					} else
+						break;
+				}
+			}
+
 			return;
 		}
 	}

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.324
retrieving revision 1.325
diff -u -d -r1.324 -r1.325
--- script_v6.cpp	27 Mar 2004 20:55:26 -0000	1.324
+++ script_v6.cpp	2 Apr 2004 20:31:39 -0000	1.325
@@ -2479,32 +2479,16 @@
 			break;
 		case 16:
 		case 17:{
-			const byte *message;
-			byte buf_input[300], buf_output[300];
-			message = buf_input;
-			addMessageToStack(getStringAddressVar(VAR_STRING2DRAW), buf_input, sizeof(buf_input));
+			byte buf_input[300];
+			const byte *message = getStringAddressVar(VAR_STRING2DRAW);
+
 			if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
-				byte buf_trans[300];
-				char *t_ptr = (char *)buf_input;
-				buf_output[0] = 0;
-				while (t_ptr != NULL) {
-					if (*t_ptr == '/') {
-						translateText((byte *)t_ptr, buf_trans);
-						// hack 
-						if (strstr((char *)buf_trans, "%___") != 0) {
-							strcat((char *)buf_output, " ");
-						} else {
-							strcat((char *)buf_output, (char *)buf_trans);
-						}
-					}
-					t_ptr = strchr((char *)t_ptr + 1, '/');
-					if (t_ptr == NULL)
-						break;
-					t_ptr = strchr((char *)t_ptr + 1, '/');
-				}
-				message = buf_output;
+				translateText(message, _transText);
+				message = _transText;
 			}
-			enqueueText(message, args[3], args[4], args[2], args[1], true);
+
+			addMessageToStack(message, buf_input, sizeof(buf_input));
+			enqueueText(buf_input, args[3], args[4], args[2], args[1], true);
 			break;}
 		case 20:
 			// it's used for turn on/off 'RadioChatter' effect for voice in the dig, but i's not needed





More information about the Scummvm-git-logs mailing list