[Scummvm-cvs-logs] SF.net SVN: scummvm: [29213] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Oct 13 23:49:38 CEST 2007


Revision: 29213
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29213&view=rev
Author:   peres001
Date:     2007-10-13 14:49:38 -0700 (Sat, 13 Oct 2007)

Log Message:
-----------
Decoupled password request from actual rendering of the dialogue screen, thus making it possible to fix bug #1765300. This bug was present in the original game, causing garbled text to appear when asking for password (only in the English version).

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2007-10-13 21:20:24 UTC (rev 29212)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2007-10-13 21:49:38 UTC (rev 29213)
@@ -103,14 +103,13 @@
 uint16 DialogueManager::askPassword() {
 	debugC(3, kDebugExec, "checkDialoguePassword()");
 
-	char password[100];
 	uint16 passwordLen;
 
 	while (true) {
 		clear();
 
 		passwordLen = 0;
-		strcpy(password, ".......");
+		_password[0] = '\0';
 
 		Common::Rect r(_answerBalloonW[0], _answerBalloonH[0]);
 		r.moveTo(_answerBalloonX[0], _answerBalloonY[0]);
@@ -118,7 +117,6 @@
 		_vm->_gfx->drawBalloon(r, 1);
 		_vm->_gfx->displayWrappedString(_q->_answers[0]->_text, _answerBalloonX[0], _answerBalloonY[0], 3, MAX_BALLOON_WIDTH);
 		_vm->_gfx->flatBlitCnv(_answerer, 0, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y,	Gfx::kBitFront);
-		_vm->_gfx->displayString(_answerBalloonX[0] + 5, _answerBalloonY[0] + _answerBalloonH[0] - 15, "> ", 0);
 		_vm->_gfx->updateScreen();
 
 		Common::Event e;
@@ -132,19 +130,21 @@
 			if (e.type != Common::EVENT_KEYDOWN) continue;
 			if (!isdigit(e.kbd.ascii)) continue;
 
-			password[passwordLen] = e.kbd.ascii;
+			_password[passwordLen] = e.kbd.ascii;
 			passwordLen++;
-			password[passwordLen] = '\0';
+			_password[passwordLen] = '\0';
 
-			_vm->_gfx->displayString(_answerBalloonX[0] + 10, _answerBalloonY[0] + _answerBalloonH[0] - 15, password, 0);
+
+			_vm->_gfx->drawBalloon(r, 1);
+			_vm->_gfx->displayWrappedString(_q->_answers[0]->_text, _answerBalloonX[0], _answerBalloonY[0], 3, MAX_BALLOON_WIDTH);
 			_vm->_gfx->updateScreen();
 
 			g_system->delayMillis(20);
 		}
 
-		if ((!scumm_stricmp(_vm->_char.getBaseName(), _doughName) && !scumm_strnicmp(password, "1732461", 7)) ||
-			(!scumm_stricmp(_vm->_char.getBaseName(), _donnaName) && !scumm_strnicmp(password, "1622", 4)) ||
-			(!scumm_stricmp(_vm->_char.getBaseName(), _dinoName) && !scumm_strnicmp(password, "179", 3))) {
+		if ((!scumm_stricmp(_vm->_char.getBaseName(), _doughName) && !scumm_strnicmp(_password, "1732461", 7)) ||
+			(!scumm_stricmp(_vm->_char.getBaseName(), _donnaName) && !scumm_strnicmp(_password, "1622", 4)) ||
+			(!scumm_stricmp(_vm->_char.getBaseName(), _dinoName) && !scumm_strnicmp(_password, "179", 3))) {
 
 			break;
 

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-10-13 21:20:24 UTC (rev 29212)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-10-13 21:49:38 UTC (rev 29213)
@@ -556,24 +556,35 @@
 	while (strlen(text) > 0) {
 
 		text = parseNextToken(text, token, 40, "   ", true);
-		linewidth += getStringWidth(token);
 
-		if (linewidth > wrapwidth) {
-			// wrap line
+		if (!scumm_stricmp(token, "%p")) {
 			lines++;
-			rx = x + 10;			// x
+			rx = x + 10;
 			ry = y + 4 + lines*10;	// y
-			linewidth = getStringWidth(token);
-		}
 
-		if (!scumm_stricmp(token, "%s")) {
-			sprintf(token, "%d", _score);
-		}
-		if (!scumm_stricmp(token, "%p")) {
+			strcpy(token, "> .......");
+			strncpy(token+2, _password, strlen(_password));
 			rv = true;
-		} else
-			displayString(rx, ry, token, color);
+		} else {
 
+			linewidth += getStringWidth(token);
+
+			if (linewidth > wrapwidth) {
+				// wrap line
+				lines++;
+				rx = x + 10;			// x
+				ry = y + 4 + lines*10;	// y
+				linewidth = getStringWidth(token);
+			}
+
+			if (!scumm_stricmp(token, "%s")) {
+				sprintf(token, "%d", _score);
+			}
+
+		}
+
+		displayString(rx, ry, token, color);
+
 		rx += getStringWidth(token) + getStringWidth(" ");
 		linewidth += getStringWidth(" ");
 
@@ -601,13 +612,17 @@
 		text = parseNextToken(text, token, 40, "   ", true);
 		w += getStringWidth(token);
 
-		if (w > maxwidth) {
-			w -= getStringWidth(token);
+		if (!scumm_stricmp(token, "%p")) {
 			lines++;
-			if (w > *width)
-				*width = w;
+		} else {
+			if (w > maxwidth) {
+				w -= getStringWidth(token);
+				lines++;
+				if (w > *width)
+					*width = w;
 
-			w = getStringWidth(token);
+				w = getStringWidth(token);
+			}
 		}
 
 		w += getStringWidth(" ");

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-10-13 21:20:24 UTC (rev 29212)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-10-13 21:49:38 UTC (rev 29213)
@@ -53,6 +53,7 @@
 uint32		_engineFlags = 0;
 
 uint16		_score = 1;
+char		_password[8];
 
 Command *	_forwardedCommands[20] = {
 	NULL,

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-10-13 21:20:24 UTC (rev 29212)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-10-13 21:49:38 UTC (rev 29213)
@@ -155,6 +155,7 @@
 
 
 extern uint16 		_mouseButtons;
+extern char			_password[8];
 extern uint16 		_score;
 extern uint16 		_language;
 extern uint32 		_engineFlags;


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