diff options
author | Tobias Gunkel | 2012-01-10 19:43:24 +0100 |
---|---|---|
committer | Tobias Gunkel | 2012-02-11 08:28:27 +0100 |
commit | 32945904d5267562975d01f2bae5c56a7c35af93 (patch) | |
tree | 63c3b1ccbf54594d7fe8f0901c586286234f3265 /engines/scumm | |
parent | b337823bab5994b78f639a7625ff763f061a1c0c (diff) | |
download | scummvm-rg350-32945904d5267562975d01f2bae5c56a7c35af93.tar.gz scummvm-rg350-32945904d5267562975d01f2bae5c56a7c35af93.tar.bz2 scummvm-rg350-32945904d5267562975d01f2bae5c56a7c35af93.zip |
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.
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/script_v0.cpp | 92 | ||||
-rw-r--r-- | engines/scumm/scumm_v0.h | 5 | ||||
-rw-r--r-- | engines/scumm/verbs.cpp | 62 |
3 files changed, 76 insertions, 83 deletions
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() { diff --git a/engines/scumm/scumm_v0.h b/engines/scumm/scumm_v0.h index 3335a15ad2..78449eaa57 100644 --- a/engines/scumm/scumm_v0.h +++ b/engines/scumm/scumm_v0.h @@ -101,10 +101,11 @@ protected: virtual void handleMouseOver(bool updateInventory); int verbPrepIdType(int verbid); void resetVerbs(); - void setNewKidVerbs(); + void clearSentenceLine(); + void flushSentenceLine(); void drawSentenceObject(int object); - void drawSentence(); + void drawSentenceLine(); void switchActor(int slot); diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index 19ad003da6..e06ee3d949 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -131,37 +131,6 @@ void ScummEngine_v0::resetVerbs() { } } -void ScummEngine_v0::setNewKidVerbs() { - VirtScreen *virt = &_virtscr[kVerbVirtScreen]; - VerbSlot *vs; - int i; - - for (i = 1; i < 16; i++) - killVerb(i); - - for (i = 1; i < 4; i++) { - vs = &_verbs[i]; - vs->verbid = i; - vs->color = 5; - vs->hicolor = 7; - vs->dimcolor = 11; - vs->type = kTextVerbType; - vs->charset_nr = _string[0]._default.charset; - vs->curmode = 1; - vs->saveid = 0; - vs->key = 0; - vs->center = 0; - vs->imgindex = 0; - vs->prep = 0; - vs->curRect.left = (i * 8) * 8; - vs->curRect.top = virt->topline + 8; - - Actor *a = derefActor(VAR(96 + i), "setNewKidVerbs"); - loadPtrToResource(rtVerb, i, (const byte*)a->getActorName()); - } - setUserState(191); -} - void ScummEngine_v0::switchActor(int slot) { resetSentence(false); @@ -802,7 +771,24 @@ void ScummEngine_v0::checkExecVerbs() { // TODO: check keypresses } else if ((_mouseAndKeyboardStat & MBS_MOUSE_MASK) || _activeVerb == kVerbWhatIs) { if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) { - // TODO: handle click into sentence line + if (_activeVerb == kVerbNewKid) { + if (_currentMode == kModeNormal) { + int kid; + int lineX = _mouse.x >> V12_X_SHIFT; + if (lineX < 11) + kid = 0; + else if (lineX < 25) + kid = 1; + else + kid = 2; + // TODO: get clicked kid + _activeVerb = kVerbWalkTo; + drawSentenceLine(); + switchActor(kid); + } + _activeVerb = kVerbWalkTo; + return; + } } else { int obj = 0; @@ -867,23 +853,13 @@ void ScummEngine_v0::checkExecVerbs() { } if (sentenceLineChanged) { - drawSentence(); + drawSentenceLine(); sentenceLineChanged = false; } if (!execute || !_activeVerb) return; - if (_activeVerb == kVerbNewKid) { - if (_currentMode == kModeNormal) { - // TODO: get clicked kid - _activeVerb = kVerbWalkTo; - drawSentence(); - //switchActor(_verbs[over].verbid - 1); - } - _activeVerb = kVerbWalkTo; - } - if (_activeVerb == kVerbWalkTo) verbExec(); else if (_activeObjectNr) { |