diff options
author | Nicola Mettifogo | 2007-10-13 21:49:38 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-10-13 21:49:38 +0000 |
commit | 1c52ea0562f9c4d93c3505a57593efc45c9104c1 (patch) | |
tree | fa0e328f170158db6a616092537d0afa47db3e2a /engines | |
parent | 16175cf368622102d6ff18e2581618ed8c5c27a5 (diff) | |
download | scummvm-rg350-1c52ea0562f9c4d93c3505a57593efc45c9104c1.tar.gz scummvm-rg350-1c52ea0562f9c4d93c3505a57593efc45c9104c1.tar.bz2 scummvm-rg350-1c52ea0562f9c4d93c3505a57593efc45c9104c1.zip |
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).
svn-id: r29213
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/dialogue.cpp | 18 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 51 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 1 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 1 |
4 files changed, 44 insertions, 27 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 1b380103be..906a2c076e 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -103,14 +103,13 @@ protected: 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 @@ uint16 DialogueManager::askPassword() { _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 @@ uint16 DialogueManager::askPassword() { 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; diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index c9320014ed..bc50bee41a 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -556,23 +556,34 @@ bool Gfx::displayWrappedString(char *text, uint16 x, uint16 y, byte color, int16 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 @@ void Gfx::getStringExtent(char *text, uint16 maxwidth, int16* width, int16* heig 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; - - w = getStringWidth(token); + } else { + if (w > maxwidth) { + w -= getStringWidth(token); + lines++; + if (w > *width) + *width = w; + + w = getStringWidth(token); + } } w += getStringWidth(" "); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index e1e66d3b83..9005585a8e 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -53,6 +53,7 @@ char _slideText[2][40]; uint32 _engineFlags = 0; uint16 _score = 1; +char _password[8]; Command * _forwardedCommands[20] = { NULL, diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 4b6022b39a..87c071ab2b 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -155,6 +155,7 @@ public: extern uint16 _mouseButtons; +extern char _password[8]; extern uint16 _score; extern uint16 _language; extern uint32 _engineFlags; |