aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/script_v0.cpp
diff options
context:
space:
mode:
authorTobias Gunkel2012-01-10 19:43:24 +0100
committerTobias Gunkel2012-02-11 08:28:27 +0100
commit32945904d5267562975d01f2bae5c56a7c35af93 (patch)
tree63c3b1ccbf54594d7fe8f0901c586286234f3265 /engines/scumm/script_v0.cpp
parentb337823bab5994b78f639a7625ff763f061a1c0c (diff)
downloadscummvm-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/script_v0.cpp')
-rw-r--r--engines/scumm/script_v0.cpp92
1 files changed, 54 insertions, 38 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() {