[Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.67,1.68 command.h,1.17,1.18 graphics.cpp,1.93,1.94

Joost Peters joostp at users.sourceforge.net
Fri Feb 13 14:40:08 CET 2004


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

Modified Files:
	command.cpp command.h graphics.cpp 
Log Message:
Applied patch #896726 (reversed hebrew text) and reduced overhead a little by introducing an _isReversed boolean


Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- command.cpp	23 Jan 2004 10:27:30 -0000	1.67
+++ command.cpp	13 Feb 2004 22:33:21 -0000	1.68
@@ -45,15 +45,27 @@
 }
 
 void CmdText::displayTemp(uint8 color, bool locked, Verb v, const char *name) {
-	char temp[MAX_COMMAND_LEN];
-	if (locked) {
-		sprintf(temp, "%s%s", _vm->logic()->joeResponse(39), _vm->logic()->verbName(v));
+	char temp[MAX_COMMAND_LEN] = "";
+	if (_isReversed) {
+		if (name != NULL)
+			sprintf(temp, "%s ", name);
+
+		if (locked) {
+			strcat(temp, _vm->logic()->verbName(v));
+			strcat(temp, " ");
+			strcat(temp, _vm->logic()->joeResponse(39));
+		} else
+			strcat(temp, _vm->logic()->verbName(v));
 	} else {
-		strcpy(temp, _vm->logic()->verbName(v));
-	}
-	if (name != NULL) {
-		strcat(temp, " ");
-		strcat(temp, name);
+		if (locked)
+			sprintf(temp, "%s %s", _vm->logic()->joeResponse(39), _vm->logic()->verbName(v));
+		else
+			strcpy(temp, _vm->logic()->verbName(v));
+
+		if (name != NULL) {
+			strcat(temp, " ");
+			strcat(temp, name);
+		}
 	}
 	_vm->display()->textCurrentColor(color);
 	_vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
@@ -61,7 +73,10 @@
 
 void CmdText::displayTemp(uint8 color, const char *name) {
 	char temp[MAX_COMMAND_LEN];
-	sprintf(temp, "%s %s", _command, name);
+	if (_isReversed)
+		sprintf(temp, "%s %s", name, _command);
+	else
+		sprintf(temp, "%s %s", _command, name);
 	_vm->display()->textCurrentColor(color);
 	_vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
 }
@@ -71,13 +86,31 @@
 }
 
 void CmdText::addLinkWord(Verb v) {
-	strcat(_command, " ");
-	strcat(_command, _vm->logic()->verbName(v));
+	if (_isReversed) {
+		char temp[MAX_COMMAND_LEN];
+		
+		strcpy(temp, _command);
+		strcpy(_command, _vm->logic()->verbName(v));
+		strcat(_command, " ");
+		strcat(_command, temp);
+	} else {
+		strcat(_command, " ");
+		strcat(_command, _vm->logic()->verbName(v));
+	}
 }
 
 void CmdText::addObject(const char *objName) {
-	strcat(_command, " ");
-	strcat(_command, objName);
+	if (_isReversed) {
+		char temp[MAX_COMMAND_LEN];
+		
+		strcpy(temp, _command);
+		strcpy(_command, objName);
+		strcat(_command, " ");
+		strcat(_command, temp);
+	} else {
+		strcat(_command, " ");
+		strcat(_command, objName);
+	}
 }
 
 bool CmdText::isEmpty() const {
@@ -95,6 +128,7 @@
 
 Command::Command(QueenEngine *vm)
 	: _vm(vm) {
+	_cmdText._isReversed = (vm->resource()->getLanguage() == HEBREW);
 	_cmdText._vm = vm;
 }
 

Index: command.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- command.h	14 Jan 2004 10:40:25 -0000	1.17
+++ command.h	13 Feb 2004 22:33:21 -0000	1.18
@@ -46,6 +46,7 @@
 		COMMAND_Y_POS   = 151
 	};
 
+	bool _isReversed;
 	char _command[MAX_COMMAND_LEN];
 	QueenEngine *_vm;
 };

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- graphics.cpp	27 Jan 2004 16:56:11 -0000	1.93
+++ graphics.cpp	13 Feb 2004 22:33:21 -0000	1.94
@@ -432,25 +432,35 @@
 
 	char lines[8][MAX_STRING_SIZE];
 	int lineCount = 0;
-	int wordCount = 0;
 	int lineLength = 0;
 	int i;
 
-	for (i = 0; i < length; i++) {
-		if (textCopy[i] == ' ')
-			wordCount++;
+	// Hebrew strings are written from right to left and should be cut
+	// to lines in reverse
+	if (_vm->resource()->getLanguage() == HEBREW) {
+		for (i = length - 1; i >= 0; i--) {
+			lineLength++;
 
-		lineLength++;
+			if ((lineLength > 20 && textCopy[i] == ' ') || i == 0) {
+				memcpy(lines[lineCount], textCopy + i, lineLength);
+				lines[lineCount][lineLength] = '\0';
+				lineCount++;
+				lineLength = 0;
+			}
+		}
+	} else {
+		for (i = 0; i < length; i++) {
+			lineLength++;
 
-		if ((lineLength > 20 && textCopy[i] == ' ') || i == (length-1)) {
-			memcpy(lines[lineCount], textCopy + i + 1 - lineLength, lineLength);
-			lines[lineCount][lineLength] = '\0';
-			lineCount++;
-			lineLength = 0;
+			if ((lineLength > 20 && textCopy[i] == ' ') || i == (length-1)) {
+				memcpy(lines[lineCount], textCopy + i + 1 - lineLength, lineLength);
+				lines[lineCount][lineLength] = '\0';
+				lineCount++;
+				lineLength = 0;
+			}
 		}
 	}
 
-
 	// Plan: write each line to Screen 2, put black outline around lines and
 	// pick them up as a BOB.
 





More information about the Scummvm-git-logs mailing list