From 32945904d5267562975d01f2bae5c56a7c35af93 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Tue, 10 Jan 2012 19:43:24 +0100 Subject: SCUMM: fix kid selection in v0 The kid names are now displayed in the sentence line (instead of the verb area) as it is done in the original. --- engines/scumm/script_v0.cpp | 92 ++++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 38 deletions(-) (limited to 'engines/scumm/script_v0.cpp') diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp index f4b98a4ba5..cd2e8969bb 100644 --- a/engines/scumm/script_v0.cpp +++ b/engines/scumm/script_v0.cpp @@ -406,6 +406,42 @@ void ScummEngine_v0::decodeParseString() { actorTalk(buffer); } +void ScummEngine_v0::clearSentenceLine() { + Common::Rect sentenceline; + sentenceline.top = _virtscr[kVerbVirtScreen].topline; + sentenceline.bottom = _virtscr[kVerbVirtScreen].topline + 8; + sentenceline.left = 0; + sentenceline.right = _virtscr[kVerbVirtScreen].w - 1; + restoreBackground(sentenceline); +} + +void ScummEngine_v0::flushSentenceLine() { + byte string[80]; + const char *ptr = _sentenceBuf.c_str(); + int i = 0, len = 0; + + // Maximum length of printable characters + int maxChars = 40; + while (*ptr) { + if (*ptr != '@') + len++; + if (len > maxChars) { + break; + } + + string[i++] = *ptr++; + + } + string[i] = 0; + + _string[2].charset = 1; + _string[2].ypos = _virtscr[kVerbVirtScreen].topline; + _string[2].xpos = 0; + _string[2].right = _virtscr[kVerbVirtScreen].w - 1; + _string[2].color = 16; + drawString(2, (byte *)string); +} + void ScummEngine_v0::drawSentenceObject(int object) { const byte *temp; temp = getObjOrActorName(object); @@ -415,20 +451,30 @@ void ScummEngine_v0::drawSentenceObject(int object) { } } -void ScummEngine_v0::drawSentence() { - Common::Rect sentenceline; +void ScummEngine_v0::drawSentenceLine() { if (!(_userState & 32)) return; + clearSentenceLine(); + + if (_activeVerb == kVerbNewKid) { + _sentenceBuf = ""; + for (int i = 0; i < 3; ++i) { + Actor *a = derefActor(VAR(97 + i), "drawSentence"); + _sentenceBuf += Common::String::format("%-13s", a->getActorName()); + } + flushSentenceLine(); + return; + } + // Current Verb if (_activeVerb == kVerbNone) _activeVerb = kVerbWalkTo; - if (getResourceAddress(rtVerb, _activeVerb)) { - _sentenceBuf = (char *)getResourceAddress(rtVerb, _activeVerb); - } else { - return; - } + + char *verbName = (char *)getResourceAddress(rtVerb, _activeVerb); + assert(verbName); + _sentenceBuf = verbName; if (_activeObjectNr) { // Draw the 1st active object @@ -454,37 +500,7 @@ void ScummEngine_v0::drawSentence() { } } - _string[2].charset = 1; - _string[2].ypos = _virtscr[kVerbVirtScreen].topline; - _string[2].xpos = 0; - _string[2].right = _virtscr[kVerbVirtScreen].w - 1; - _string[2].color = 16; - - byte string[80]; - const char *ptr = _sentenceBuf.c_str(); - int i = 0, len = 0; - - // Maximum length of printable characters - int maxChars = 40; - while (*ptr) { - if (*ptr != '@') - len++; - if (len > maxChars) { - break; - } - - string[i++] = *ptr++; - - } - string[i] = 0; - - sentenceline.top = _virtscr[kVerbVirtScreen].topline; - sentenceline.bottom = _virtscr[kVerbVirtScreen].topline + 8; - sentenceline.left = 0; - sentenceline.right = _virtscr[kVerbVirtScreen].w - 1; - restoreBackground(sentenceline); - - drawString(2, (byte *)string); + flushSentenceLine(); } void ScummEngine_v0::o_stopCurrentScript() { -- cgit v1.2.3