From 350d622324581fe0ceb2eee38d4a7750690a0cf0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 Sep 2013 18:06:37 +0200 Subject: AVALANCHE: rename scrolls to dialogs --- engines/avalanche/acci.cpp | 472 ++++++++--------- engines/avalanche/animation.cpp | 44 +- engines/avalanche/avalanche.cpp | 14 +- engines/avalanche/avalanche.h | 4 +- engines/avalanche/avalot.cpp | 8 +- engines/avalanche/dialogs.cpp | 1087 +++++++++++++++++++++++++++++++++++++++ engines/avalanche/dialogs.h | 133 +++++ engines/avalanche/gyro.cpp | 6 +- engines/avalanche/lucerna.cpp | 16 +- engines/avalanche/module.mk | 2 +- engines/avalanche/pingo.cpp | 2 +- engines/avalanche/scrolls.cpp | 1087 --------------------------------------- engines/avalanche/scrolls.h | 133 ----- engines/avalanche/timer.cpp | 94 ++-- 14 files changed, 1551 insertions(+), 1551 deletions(-) create mode 100644 engines/avalanche/dialogs.cpp create mode 100644 engines/avalanche/dialogs.h delete mode 100644 engines/avalanche/scrolls.cpp delete mode 100644 engines/avalanche/scrolls.h (limited to 'engines/avalanche') diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 28f05a9ca8..f98eb916b6 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -31,7 +31,7 @@ #include "avalanche/acci.h" #include "avalanche/gyro.h" #include "avalanche/lucerna.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/background.h" @@ -466,18 +466,18 @@ void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { if (target == kPardon) { ambiguous = true; if (animate) - _vm->_scrolls->displayText("Whom?"); + _vm->_dialogs->displayText("Whom?"); else - _vm->_scrolls->displayText("What?"); + _vm->_dialogs->displayText("What?"); } else { if (animate) { Common::String tmpStr = Common::String::format("{ %s }", _vm->_gyro->getName(target).c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } else { Common::String z = _vm->_gyro->getItem(target); if (z != "") { Common::String tmpStr = Common::String::format("{ %s }", z.c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } } } @@ -523,9 +523,9 @@ void Acci::properNouns() { void Acci::sayIt() { Common::String x = _vm->_parser->_inputText; x.setChar(toupper(x[0]), 0); - Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Scrolls::kControlRegister, x.c_str(), - Scrolls::kControlSpeechBubble, Scrolls::kControlRegister); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Dialogs::kControlRegister, x.c_str(), + Dialogs::kControlSpeechBubble, Dialogs::kControlRegister); + _vm->_dialogs->displayText(tmpStr); } void Acci::storeInterrogation(byte interrogation) { @@ -565,7 +565,7 @@ void Acci::storeInterrogation(byte interrogation) { if (!_vm->_gyro->_spareEvening.empty()) _vm->_gyro->_spareEvening.clear(); _vm->_gyro->_spareEvening = _vm->_parser->_inputText; - _vm->_scrolls->displayScrollChain('z', 5); // His closing statement... + _vm->_dialogs->displayScrollChain('z', 5); // His closing statement... _vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; @@ -761,7 +761,7 @@ void Acci::parse() { if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_weirdWord = true; } else _vm->_gyro->_weirdWord = false; @@ -787,24 +787,24 @@ void Acci::examineObject() { case Gyro::kObjectWine : switch (_vm->_gyro->_wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: - _vm->_scrolls->displayScrollChain('t', 1); // Normal examine wine scroll + _vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll break; case 2: - _vm->_scrolls->displayScrollChain('d', 6); // Bad wine + _vm->_dialogs->displayScrollChain('d', 6); // Bad wine break; case 3: - _vm->_scrolls->displayScrollChain('d', 7); // Vinegar + _vm->_dialogs->displayScrollChain('d', 7); // Vinegar break; } break; case Gyro::kObjectOnion: if (_vm->_gyro->_rottenOnion) - _vm->_scrolls->displayScrollChain('q', 21); // Yucky onion + _vm->_dialogs->displayScrollChain('q', 21); // Yucky onion else - _vm->_scrolls->displayScrollChain('t', 18); // Normal onion + _vm->_dialogs->displayScrollChain('t', 18); // Normal onion break; default: - _vm->_scrolls->displayScrollChain('t', _thing); // Ordinarily + _vm->_dialogs->displayScrollChain('t', _thing); // Ordinarily } } @@ -817,7 +817,7 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". tmpStr = "He isn't around at the moment."; else tmpStr = "She isn't around at the moment."; - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); return false; } } @@ -830,14 +830,14 @@ void Acci::exampers() { byte newPerson = _person - 149; if ((_person == Gyro::kPeopleDogfood) && _vm->_gyro->_wonNim) - _vm->_scrolls->displayScrollChain('Q', 8); // "I'm Not Playing!" + _vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" else if ((_person == Gyro::kPeopleDuLustie) && _vm->_gyro->_lustieIsAsleep) - _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. + _vm->_dialogs->displayScrollChain('Q', 65); // He's asleep. else - _vm->_scrolls->displayScrollChain('p', newPerson); + _vm->_dialogs->displayScrollChain('p', newPerson); if ((_person == Gyro::kPeopleAyles) && !_vm->_gyro->_aylesIsAwake) - _vm->_scrolls->displayScrollChain('Q', 13); + _vm->_dialogs->displayScrollChain('Q', 13); _person = newPerson; } @@ -854,9 +854,9 @@ bool Acci::isHolding() { bool holdingResult = false; if (_thing > 100) - _vm->_scrolls->displayText("Be reasonable!"); + _vm->_dialogs->displayText("Be reasonable!"); else if (!_vm->_gyro->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. - _vm->_scrolls->displayText("You're not holding it, Avvy."); + _vm->_dialogs->displayText("You're not holding it, Avvy."); else holdingResult = true; @@ -891,14 +891,14 @@ void Acci::examine() { examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing openBox(true); - _vm->_scrolls->displayText(*_vm->_gyro->_also[_thing - 50][1]); + _vm->_dialogs->displayText(*_vm->_gyro->_also[_thing - 50][1]); openBox(false); } } } else if (_person != kPardon) exampers(); else - _vm->_scrolls->displayText("It's just as it looks on the picture."); // Don't know: guess. + _vm->_dialogs->displayText("It's just as it looks on the picture."); // Don't know: guess. } void Acci::inventory() { @@ -922,11 +922,11 @@ void Acci::inventory() { } if (_vm->_gyro->_wearing == kNothing) - tmpStr += Common::String::format("...%c%c...and you're stark naked!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); + tmpStr += Common::String::format("...%c%c...and you're stark naked!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); else tmpStr += '.'; - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } void Acci::swallow() { // Eat something. @@ -935,52 +935,52 @@ void Acci::swallow() { // Eat something. switch (_vm->_gyro->_wineState) { // 4 is perfect case 1: if (_vm->_gyro->_teetotal) { - _vm->_scrolls->displayScrollChain('D', 6); + _vm->_dialogs->displayScrollChain('D', 6); return; } - _vm->_scrolls->displayScrollChain('U', 1); + _vm->_dialogs->displayScrollChain('U', 1); _vm->_pingo->wobble(); - _vm->_scrolls->displayScrollChain('U', 2); + _vm->_dialogs->displayScrollChain('U', 2); _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; _vm->_lucerna->refreshObjectList(); drink(); break; case 2: case 3: - _vm->_scrolls->displayScrollChain('d', 8); + _vm->_dialogs->displayScrollChain('d', 8); break; // You can't drink it! } break; case Gyro::kObjectPotion: _vm->_gyro->setBackgroundColor(4); - _vm->_scrolls->displayScrollChain('U', 3); + _vm->_dialogs->displayScrollChain('U', 3); _vm->_lucerna->gameOver(); _vm->_gyro->setBackgroundColor(0); break; case Gyro::kObjectInk: - _vm->_scrolls->displayScrollChain('U', 4); + _vm->_dialogs->displayScrollChain('U', 4); break; case Gyro::kObjectChastity: - _vm->_scrolls->displayScrollChain('U', 5); + _vm->_dialogs->displayScrollChain('U', 5); break; case Gyro::kObjectMushroom: - _vm->_scrolls->displayScrollChain('U', 6); + _vm->_dialogs->displayScrollChain('U', 6); _vm->_lucerna->gameOver(); break; case Gyro::kObjectOnion: if (_vm->_gyro->_rottenOnion) - _vm->_scrolls->displayScrollChain('U', 11); + _vm->_dialogs->displayScrollChain('U', 11); else { - _vm->_scrolls->displayScrollChain('U', 8); + _vm->_dialogs->displayScrollChain('U', 8); _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; _vm->_lucerna->refreshObjectList(); } break; default: if ((_vm->_gyro->_room == kRoomArgentPub) || (_vm->_gyro->_room == kRoomNottsPub)) - _vm->_scrolls->displayText("Try BUYing things before you drink them!"); + _vm->_dialogs->displayText("Try BUYing things before you drink them!"); else - _vm->_scrolls->displayText("The taste of it makes you retch!"); + _vm->_dialogs->displayText("The taste of it makes you retch!"); } } @@ -1014,42 +1014,42 @@ void Acci::peopleInRoom() { else tmpStr += " are"; - _vm->_scrolls->displayText(tmpStr + " here."); // End and display it. + _vm->_dialogs->displayText(tmpStr + " here."); // End and display it. } void Acci::lookAround() { - _vm->_scrolls->displayText(*_vm->_gyro->_also[0][1]); + _vm->_dialogs->displayText(*_vm->_gyro->_also[0][1]); switch (_vm->_gyro->_room) { case kRoomSpludwicks: if (_vm->_gyro->_avariciusTalk > 0) - _vm->_scrolls->displayScrollChain('q', 23); + _vm->_dialogs->displayScrollChain('q', 23); else peopleInRoom(); break; case kRoomRobins: if (_vm->_gyro->_tiedUp) - _vm->_scrolls->displayScrollChain('q', 38); + _vm->_dialogs->displayScrollChain('q', 38); if (_vm->_gyro->_mushroomGrowing) - _vm->_scrolls->displayScrollChain('q', 55); + _vm->_dialogs->displayScrollChain('q', 55); break; case kRoomInsideCardiffCastle: if (!_vm->_gyro->_takenPen) - _vm->_scrolls->displayScrollChain('q', 49); + _vm->_dialogs->displayScrollChain('q', 49); break; case kRoomLustiesRoom: if (_vm->_gyro->_lustieIsAsleep) - _vm->_scrolls->displayScrollChain('q', 65); + _vm->_dialogs->displayScrollChain('q', 65); break; case kRoomCatacombs: switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { case 258 : - _vm->_scrolls->displayScrollChain('q', 80); // Inside art gallery. + _vm->_dialogs->displayScrollChain('q', 80); // Inside art gallery. break; case 514 : - _vm->_scrolls->displayScrollChain('q', 81); // Outside ditto. + _vm->_dialogs->displayScrollChain('q', 81); // Outside ditto. break; case 260 : - _vm->_scrolls->displayScrollChain('q', 82); // Outside Geida's room. + _vm->_dialogs->displayScrollChain('q', 82); // Outside Geida's room. break; } break; @@ -1072,7 +1072,7 @@ void Acci::openDoor() { break; case kRoomSpludwicks: if (_thing == 61) { - _vm->_scrolls->displayScrollChain('q', 85); + _vm->_dialogs->displayScrollChain('q', 85); return; } break; @@ -1087,14 +1087,14 @@ void Acci::openDoor() { switch (portal->_operation) { case Gyro::kMagicExclaim: _vm->_animation->_sprites[0].bounce(); - _vm->_scrolls->displayScrollChain('x', portal->_data); + _vm->_dialogs->displayScrollChain('x', portal->_data); break; case Gyro::kMagicTransport: _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); break; case Gyro::kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); - _vm->_scrolls->displayText("Sorry. This place is not available yet!"); + _vm->_dialogs->displayText("Sorry. This place is not available yet!"); break; case Gyro::kMagicSpecial: _vm->_animation->callSpecial(portal->_data); @@ -1109,14 +1109,14 @@ void Acci::openDoor() { } if (_vm->_gyro->_room == kRoomMap) - _vm->_scrolls->displayText("Avvy, you can complete the whole game without ever going " \ + _vm->_dialogs->displayText("Avvy, you can complete the whole game without ever going " \ "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); else - _vm->_scrolls->displayText("Door? What door?"); + _vm->_dialogs->displayText("Door? What door?"); } void Acci::silly() { - _vm->_scrolls->displayText("Don't be silly!"); + _vm->_dialogs->displayText("Don't be silly!"); } void Acci::putProc() { @@ -1135,15 +1135,15 @@ void Acci::putProc() { case Gyro::kObjectWine: if (_thing == Gyro::kObjectOnion) { if (_vm->_gyro->_rottenOnion) - _vm->_scrolls->displayText("That's a bit like shutting the stable door after the horse has bolted!"); + _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? if (_vm->_gyro->_wineState != 3) { - Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); } else { // Put onion into vinegar! Yes! _vm->_gyro->_onionInVinegar = true; _vm->_lucerna->incScore(7); - _vm->_scrolls->displayScrollChain('u', 9); + _vm->_dialogs->displayScrollChain('u', 9); } } } else @@ -1153,32 +1153,32 @@ void Acci::putProc() { case 54: if (_vm->_gyro->_room == kRoomYours) { // Put something into the box. if (_vm->_gyro->_boxContent != kNothing) - _vm->_scrolls->displayText("There's something in the box already, Avvy. Try taking that out first."); + _vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { case Gyro::kObjectMoney: - _vm->_scrolls->displayText("You'd better keep some ready cash on you!"); + _vm->_dialogs->displayText("You'd better keep some ready cash on you!"); break; case Gyro::kObjectBell: - _vm->_scrolls->displayText("That's a silly place to keep a bell."); + _vm->_dialogs->displayText("That's a silly place to keep a bell."); break; case Gyro::kObjectBodkin: - _vm->_scrolls->displayText("But you might need it!"); + _vm->_dialogs->displayText("But you might need it!"); break; case Gyro::kObjectOnion: - _vm->_scrolls->displayText("Just give it to Spludwick, Avvy!"); + _vm->_dialogs->displayText("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... if (_vm->_gyro->_wearing == _thing) { Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_gyro->getItem(_thing).c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } else { openBox(true); // Open box. _vm->_gyro->_boxContent = _thing; _vm->_gyro->_objects[_thing - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->displayText("OK, it's in the box."); + _vm->_dialogs->displayText("OK, it's in the box."); openBox(false); // Shut box. } @@ -1200,8 +1200,8 @@ void Acci::putProc() { void Acci::notInOrder() { Common::String itemStr = _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ - "What I need next is %s%c2%c", itemStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + "What I need next is %s%c2%c", itemStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } /** @@ -1228,10 +1228,10 @@ bool Acci::giveToSpludwick() { case Gyro::kObjectOnion: _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; if (_vm->_gyro->_rottenOnion) - _vm->_scrolls->displayScrollChain('q', 22); + _vm->_dialogs->displayScrollChain('q', 22); else { _vm->_gyro->_givenToSpludwick++; - _vm->_scrolls->displayScrollChain('q', 20); + _vm->_dialogs->displayScrollChain('q', 20); goToCauldron(); _vm->_lucerna->incScore(3); } @@ -1241,13 +1241,13 @@ bool Acci::giveToSpludwick() { _vm->_gyro->_objects[Gyro::kObjectInk - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_givenToSpludwick++; - _vm->_scrolls->displayScrollChain('q', 24); + _vm->_dialogs->displayScrollChain('q', 24); goToCauldron(); _vm->_lucerna->incScore(3); break; case Gyro::kObjectMushroom: _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = false; - _vm->_scrolls->displayScrollChain('q', 25); + _vm->_dialogs->displayScrollChain('q', 25); _vm->_lucerna->incScore(5); _vm->_gyro->_givenToSpludwick++; goToCauldron(); @@ -1279,19 +1279,19 @@ void Acci::drink() { void Acci::cardiffClimbing() { if (_vm->_gyro->_standingOnDais) { // Clamber up. - _vm->_scrolls->displayText("You climb down, back onto the floor."); + _vm->_dialogs->displayText("You climb down, back onto the floor."); _vm->_gyro->_standingOnDais = false; _vm->_animation->appearPed(0, 2); } else if (_vm->_animation->inField(0)) { // Clamber down - _vm->_scrolls->displayText("You clamber up onto the dais."); + _vm->_dialogs->displayText("You clamber up onto the dais."); _vm->_gyro->_standingOnDais = true; _vm->_animation->appearPed(0, 1); } else - _vm->_scrolls->displayText("Get a bit closer, Avvy."); + _vm->_dialogs->displayText("Get a bit closer, Avvy."); } void Acci::already() { - _vm->_scrolls->displayText("You're already standing!"); + _vm->_dialogs->displayText("You're already standing!"); } void Acci::standUp() { @@ -1299,9 +1299,9 @@ void Acci::standUp() { case kRoomYours: // Avvy isn't asleep. if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) { // But he's in bed. if (_vm->_gyro->_teetotal) { - _vm->_scrolls->displayScrollChain('d', 12); + _vm->_dialogs->displayScrollChain('d', 12); _vm->_gyro->setBackgroundColor(0); - _vm->_scrolls->displayScrollChain('d', 14); + _vm->_dialogs->displayScrollChain('d', 14); } _vm->_animation->_sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; @@ -1340,24 +1340,24 @@ void Acci::getProc(char thing) { if (_vm->_animation->inField(1)) { if (_vm->_gyro->_boxContent == thing) { _vm->_background->drawBackgroundSprite(-1, -1, 4); - _vm->_scrolls->displayText("OK, I've got it."); + _vm->_dialogs->displayText("OK, I've got it."); _vm->_gyro->_objects[thing - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_boxContent = kNothing; _vm->_background->drawBackgroundSprite(-1, -1, 5); } else { Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } } else - _vm->_scrolls->displayScrollChain('q', 57); + _vm->_dialogs->displayScrollChain('q', 57); break; case kRoomInsideCardiffCastle: switch (thing) { case Gyro::kObjectPen: if (_vm->_animation->inField(1)) { // Standing on the dais. if (_vm->_gyro->_takenPen) - _vm->_scrolls->displayText("It's not there, Avvy."); + _vm->_dialogs->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now. @@ -1365,34 +1365,34 @@ void Acci::getProc(char thing) { _vm->_gyro->_takenPen = true; _vm->_gyro->_objects[Gyro::kObjectPen - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->displayText("Taken."); + _vm->_dialogs->displayText("Taken."); } } else if (_vm->_gyro->_standingOnDais) - _vm->_scrolls->displayScrollChain('q', 53); + _vm->_dialogs->displayScrollChain('q', 53); else - _vm->_scrolls->displayScrollChain('q', 51); + _vm->_dialogs->displayScrollChain('q', 51); break; case Gyro::kObjectBolt: - _vm->_scrolls->displayScrollChain('q', 52); + _vm->_dialogs->displayScrollChain('q', 52); break; default: - _vm->_scrolls->displayScrollChain('q', 57); + _vm->_dialogs->displayScrollChain('q', 57); } break; case kRoomRobins: if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) { _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_scrolls->displayText("Got it!"); + _vm->_dialogs->displayText("Got it!"); _vm->_gyro->_mushroomGrowing = false; _vm->_gyro->_takenMushroom = true; _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); } else - _vm->_scrolls->displayScrollChain('q', 57); + _vm->_dialogs->displayScrollChain('q', 57); break; default: - _vm->_scrolls->displayScrollChain('q', 57); + _vm->_dialogs->displayScrollChain('q', 57); } } @@ -1402,13 +1402,13 @@ void Acci::getProc(char thing) { */ void Acci::giveGeidaTheLute() { if (_vm->_gyro->_room != kRoomLustiesRoom) { - Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); return; } _vm->_gyro->_objects[Gyro::kObjectLute - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->displayScrollChain('q', 64); // She plays it. + _vm->_dialogs->displayScrollChain('q', 64); // She plays it. _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); //_vm->_enid->backToBootstrap(4); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! @@ -1416,13 +1416,13 @@ void Acci::giveGeidaTheLute() { void Acci::playHarp() { if (_vm->_animation->inField(6)) - _vm->_scrolls->musicalScroll(); + _vm->_dialogs->displayMusicalScroll(); else - _vm->_scrolls->displayText("Get a bit closer to it, Avvy!"); + _vm->_dialogs->displayText("Get a bit closer to it, Avvy!"); } void Acci::winSequence() { - _vm->_scrolls->displayScrollChain('q', 78); + _vm->_dialogs->displayScrollChain('q', 78); _vm->_sequence->firstShow(7); _vm->_sequence->thenShow(8); _vm->_sequence->thenShow(9); @@ -1439,7 +1439,7 @@ Common::String Acci::personSpeaks() { } if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_room) { - return Common::String::format("%c1", Scrolls::kControlRegister); // Avvy himself! + return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself! } bool found = false; // The _person we're looking for's code is in _person. @@ -1447,7 +1447,7 @@ Common::String Acci::personSpeaks() { for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { - tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, '1' + i); + tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, '1' + i); found = true; } } @@ -1457,7 +1457,7 @@ Common::String Acci::personSpeaks() { for (int i = 0; i < 16; i++) { if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_room)) - tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, 'A' + i); + tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, 'A' + i); } return tmpStr; @@ -1465,8 +1465,8 @@ Common::String Acci::personSpeaks() { void Acci::heyThanks() { Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_objects[_thing - 1] = false; } @@ -1494,11 +1494,11 @@ void Acci::doThat() { && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { if (!_vm->_gyro->_alive) { - _vm->_scrolls->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); + _vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); return; } if (!_vm->_gyro->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { - _vm->_scrolls->displayText("Talking in your sleep? Try waking up!"); + _vm->_dialogs->displayText("Talking in your sleep? Try waking up!"); return; } } @@ -1511,25 +1511,25 @@ void Acci::doThat() { openDoor(); break; case kVerbCodePause: { // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. - Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the \"O.K.\" box to continue.", Scrolls::kControlCenter, Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the \"O.K.\" box to continue.", Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeGet: if (_thing != kPardon) { // Legitimate try to pick something up. if (_vm->_gyro->_carryNum >= kCarryLimit) - _vm->_scrolls->displayText("You can't carry any more!"); + _vm->_dialogs->displayText("You can't carry any more!"); else getProc(_thing); } else { // Not... ditto. if (_person != kPardon) - _vm->_scrolls->displayText("You can't sweep folk off their feet!"); + _vm->_dialogs->displayText("You can't sweep folk off their feet!"); else - _vm->_scrolls->displayText("I assure you, you don't need it."); + _vm->_dialogs->displayText("I assure you, you don't need it."); } break; case kVerbCodeDrop: - _vm->_scrolls->displayText("Two years ago you dropped a florin in the street. Three days " \ + _vm->_dialogs->displayText("Two years ago you dropped a florin in the street. Three days " \ "later it was gone! So now you never leave ANYTHING lying around. OK?"); break; case kVerbCodeInv: @@ -1538,8 +1538,8 @@ void Acci::doThat() { case kVerbCodeTalk: if (_person == kPardon) { if (_vm->_gyro->_subjectNum == 99) { // They typed "say password". - Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); } else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { _thats.deleteChar(0); @@ -1553,40 +1553,40 @@ void Acci::doThat() { _person = _vm->_gyro->_subjectNum; _vm->_gyro->_subjectNum = 0; if ((_person == 0) || (_person == kPardon)) - _vm->_scrolls->displayText("Talk to whom?"); + _vm->_dialogs->displayText("Talk to whom?"); else if (isPersonHere()) - _vm->_scrolls->talkTo(_person); + _vm->_dialogs->talkTo(_person); } } else if (isPersonHere()) - _vm->_scrolls->talkTo(_person); + _vm->_dialogs->talkTo(_person); break; case kVerbCodeGive: if (isHolding()) { if (_person == kPardon) - _vm->_scrolls->displayText("Give to whom?"); + _vm->_dialogs->displayText("Give to whom?"); else if (isPersonHere()) { switch (_thing) { case Gyro::kObjectMoney : - _vm->_scrolls->displayText("You can't bring yourself to give away your moneybag."); + _vm->_dialogs->displayText("You can't bring yourself to give away your moneybag."); break; case Gyro::kObjectBodkin: case Gyro::kObjectBell: case Gyro::kObjectClothes: case Gyro::kObjectHabit : - _vm->_scrolls->displayText("Don't give it away, it might be useful!"); + _vm->_dialogs->displayText("Don't give it away, it might be useful!"); break; default: switch (_person) { case Gyro::kPeopleCrapulus: if (_thing == Gyro::kObjectWine) { - _vm->_scrolls->displayText("Crapulus grabs the wine and gulps it down."); + _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; } else heyThanks(); break; case Gyro::kPeopleCwytalot: if ((_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) - _vm->_scrolls->displayText("You might be able to influence Cwytalot more if you used it!"); + _vm->_dialogs->displayText("You might be able to influence Cwytalot more if you used it!"); else heyThanks(); break; @@ -1596,7 +1596,7 @@ void Acci::doThat() { break; case Gyro::kPeopleIbythneth: if (_thing == Gyro::kObjectBadge) { - _vm->_scrolls->displayScrollChain('q', 32); // Thanks! Wow! + _vm->_dialogs->displayScrollChain('q', 32); // Thanks! Wow! _vm->_lucerna->incScore(3); _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; @@ -1610,7 +1610,7 @@ void Acci::doThat() { if (_vm->_gyro->_aylesIsAwake) { if (_thing == Gyro::kObjectPen) { _vm->_gyro->_objects[Gyro::kObjectPen - 1] = false; - _vm->_scrolls->displayScrollChain('q', 54); + _vm->_dialogs->displayScrollChain('q', 54); _vm->_gyro->_objects[Gyro::kObjectInk - 1] = true; _vm->_gyro->_givenPenToAyles = true; _vm->_lucerna->refreshObjectList(); @@ -1618,13 +1618,13 @@ void Acci::doThat() { } else heyThanks(); } else - _vm->_scrolls->displayText("But he's asleep!"); + _vm->_dialogs->displayText("But he's asleep!"); break; case Gyro::kPeopleGeida: switch (_thing) { case Gyro::kObjectPotion: _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = false; - _vm->_scrolls->displayScrollChain('u', 16); // She drinks it. + _vm->_dialogs->displayScrollChain('u', 16); // She drinks it. _vm->_lucerna->incScore(2); _vm->_gyro->_givenPotionToGeida = true; _vm->_lucerna->refreshObjectList(); @@ -1642,7 +1642,7 @@ void Acci::doThat() { if (_vm->_gyro->_givenPotionToGeida) winSequence(); else - _vm->_scrolls->displayScrollChain('q', 77); // That Geida woman! + _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! break; default: heyThanks(); @@ -1670,66 +1670,66 @@ void Acci::doThat() { // We don't handle these two because we use ScummVM's save/load system. case kVerbCodePay: - _vm->_scrolls->displayText("No money need change hands."); + _vm->_dialogs->displayText("No money need change hands."); break; case kVerbCodeLook: lookAround(); break; case kVerbCodeBreak: - _vm->_scrolls->displayText("Vandalism is prohibited within this game!"); + _vm->_dialogs->displayText("Vandalism is prohibited within this game!"); break; case kVerbCodeQuit: // quit if (!_polite) - _vm->_scrolls->displayText("How about a `please\", Avvy?"); + _vm->_dialogs->displayText("How about a `please\", Avvy?"); else { - Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Scrolls::kControlRegister, Scrolls::kControlIcon); - if (_vm->_scrolls->displayQuestion(tmpStr)) + Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Dialogs::kControlRegister, Dialogs::kControlIcon); + if (_vm->_dialogs->displayQuestion(tmpStr)) _vm->_gyro->_letMeOut = true; } break; case kVerbCodeGo: - _vm->_scrolls->displayText("Just use the arrow keys to walk there."); + _vm->_dialogs->displayText("Just use the arrow keys to walk there."); break; case kVerbCodeInfo: { - _vm->_scrolls->_aboutScroll = true; + _vm->_dialogs->_aboutBox = true; Common::String toDisplay; for (int i = 0; i < 7; i++) - toDisplay += Scrolls::kControlNewLine; - toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Scrolls::kControlCenter + Scrolls::kControlNewLine - + "The medi\x91val descendant of" + Scrolls::kControlNewLine - + "Denarius Avaricius Sextus" + Scrolls::kControlNewLine + Scrolls::kControlNewLine - + "version " + _vm->_gyro->kVersionNum + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Copyright \xEF " - + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + Scrolls::kControlRegister + 'Y' + Scrolls::kControlIcon; - _vm->_scrolls->displayText(toDisplay); - _vm->_scrolls->_aboutScroll = false; + toDisplay += Dialogs::kControlNewLine; + toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine + + "The medi\x91val descendant of" + Dialogs::kControlNewLine + + "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine + + "version " + _vm->_gyro->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " + + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; + _vm->_dialogs->displayText(toDisplay); + _vm->_dialogs->_aboutBox = false; } break; case kVerbCodeUndress: if (_vm->_gyro->_wearing == kNothing) - _vm->_scrolls->displayText("You're already stark naked!"); + _vm->_dialogs->displayText("You're already stark naked!"); else if (_vm->_gyro->_avvysInTheCupboard) { Common::String tmpStr = Common::String::format("You take off %s.", _vm->_gyro->getItem(_vm->_gyro->_wearing).c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_wearing = kNothing; _vm->_lucerna->refreshObjectList(); } else - _vm->_scrolls->displayText("Hadn't you better find somewhere more private, Avvy?"); + _vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?"); break; case kVerbCodeWear: if (isHolding()) { // Wear something. switch (_thing) { case Gyro::kObjectChastity: // \? are used to avoid that ??! is parsed as a trigraph - _vm->_scrolls->displayText("Hey, what kind of a weirdo are you\?\?!"); + _vm->_dialogs->displayText("Hey, what kind of a weirdo are you\?\?!"); break; case Gyro::kObjectClothes: case Gyro::kObjectHabit: { // Change this! if (_vm->_gyro->_wearing != kNothing) { if (_vm->_gyro->_wearing == _thing) - _vm->_scrolls->displayText("You're already wearing that."); + _vm->_dialogs->displayText("You're already wearing that."); else - _vm->_scrolls->displayText("You'll be rather warm wearing two sets of clothes!"); + _vm->_dialogs->displayText("You'll be rather warm wearing two sets of clothes!"); return; } else _vm->_gyro->_wearing = _thing; @@ -1753,7 +1753,7 @@ void Acci::doThat() { } break; default: - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); } } break; @@ -1767,20 +1767,20 @@ void Acci::doThat() { // The player automatically wins the game everytime he wins, until I implement the mini-game. if (_vm->_gyro->_wonNim) { // Already won the game. - _vm->_scrolls->displayScrollChain('Q', 6); + _vm->_dialogs->displayScrollChain('Q', 6); return; } if (!_vm->_gyro->_askedDogfoodAboutNim) { - _vm->_scrolls->displayScrollChain('q', 84); + _vm->_dialogs->displayScrollChain('q', 84); return; } - _vm->_scrolls->displayScrollChain('Q', 3); + _vm->_dialogs->displayScrollChain('Q', 3); _vm->_gyro->_playedNim++; // You won - strange! - _vm->_scrolls->displayScrollChain('Q', 7); // You won! Give us a lute! + _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wonNim = true; @@ -1791,8 +1791,8 @@ void Acci::doThat() { _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! - _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") - + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); + _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") + + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Peter (uruk)"); break; case kRoomMusicRoom: playHarp(); @@ -1801,41 +1801,41 @@ void Acci::doThat() { } else if (isHolding()) { switch (_thing) { case Gyro::kObjectLute : - _vm->_scrolls->displayScrollChain('U', 7); + _vm->_dialogs->displayScrollChain('U', 7); if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room) - _vm->_scrolls->displayScrollChain('U', 10); + _vm->_dialogs->displayScrollChain('U', 10); if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_room) - _vm->_scrolls->displayScrollChain('U', 15); + _vm->_dialogs->displayScrollChain('U', 15); break; case 52: if (_vm->_gyro->_room == kRoomMusicRoom) playHarp(); else - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); break; case 55: if (_vm->_gyro->_room == kRoomArgentPub) // play_nim(); warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); else - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); break; default: - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); } } break; case kVerbCodeRing: if (isHolding()) { if (_thing == Gyro::kObjectBell) { - _vm->_scrolls->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); + _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph - _vm->_scrolls->displayText("(Are you trying to join in, Avvy\?\?!)"); + _vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)"); } else - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); } break; case kVerbCodeHelp: @@ -1843,10 +1843,10 @@ void Acci::doThat() { warning("STUB: Acci::doThat() - case kVerbCodehelp"); break; case kVerbCodeLarrypass: - _vm->_scrolls->displayText("Wrong game!"); + _vm->_dialogs->displayText("Wrong game!"); break; case kVerbCodePhaon: - _vm->_scrolls->displayText("Hello, Phaon!"); + _vm->_dialogs->displayText("Hello, Phaon!"); break; case kVerbCodeBoss: // bosskey(); @@ -1854,27 +1854,27 @@ void Acci::doThat() { break; case kVerbCodePee: if (_vm->_gyro->setFlag('P')) { - _vm->_scrolls->displayText("Hmm, I don't think anyone will notice..."); + _vm->_dialogs->displayText("Hmm, I don't think anyone will notice..."); _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); } else { - Common::String tmpStr = Common::String::format("It would be %cVERY%c unwise to do that here, Avvy!", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("It would be %cVERY%c unwise to do that here, Avvy!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeCheat: { - Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Scrolls::kControlItalic); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Dialogs::kControlItalic); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_cheat = true; } break; case kVerbCodeMagic: if (_vm->_gyro->_avariciusTalk > 0) - _vm->_scrolls->displayScrollChain('q', 19); + _vm->_dialogs->displayScrollChain('q', 19); else { if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! - _vm->_scrolls->displayScrollChain('q', 17); + _vm->_dialogs->displayScrollChain('q', 17); if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) - _vm->_scrolls->displayScrollChain('q', 18); + _vm->_dialogs->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(1, false, _vm->_animation); // Avaricius @@ -1886,31 +1886,31 @@ void Acci::doThat() { _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); } } else - _vm->_scrolls->displayText("Nothing appears to happen..."); + _vm->_dialogs->displayText("Nothing appears to happen..."); } break; case kVerbCodeSmartAlec: - _vm->_scrolls->displayText("Listen, smart alec, that was just rhetoric."); + _vm->_dialogs->displayText("Listen, smart alec, that was just rhetoric."); break; case kVerbCodeExpletive: switch (_vm->_gyro->_sworeNum) { case 0: { Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ - "(I shouldn't say it again, if I were you!)", Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + "(I shouldn't say it again, if I were you!)", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); } break; case 1: { Common::String tmpStr = Common::String::format("You hear a distant rumble of thunder. Must you always" \ - "do things I tell you not to?%c%cDon't do it again!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + "do things I tell you not to?%c%cDon't do it again!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); } break; default: { _vm->_pingo->zonk(); // CHECKME: Weird character in string - Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); _vm->_lucerna->gameOver(); } } @@ -1918,11 +1918,11 @@ void Acci::doThat() { break; case kVerbCodeListen: if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) - _vm->_scrolls->displayText("All other noise is drowned out by the ringing of the bells."); + _vm->_dialogs->displayText("All other noise is drowned out by the ringing of the bells."); else if (_vm->_gyro->_listen.empty()) - _vm->_scrolls->displayText("You can't hear anything much at the moment, Avvy."); + _vm->_dialogs->displayText("You can't hear anything much at the moment, Avvy."); else - _vm->_scrolls->displayText(_vm->_gyro->_listen); + _vm->_dialogs->displayText(_vm->_gyro->_listen); break; case kVerbCodeBuy: // What are they trying to buy? switch (_vm->_gyro->_room) { @@ -1934,12 +1934,12 @@ void Acci::doThat() { case 54: case 58: // Beer, whisky, cider or mead. if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_scrolls->displayScrollChain('D', 15); + _vm->_dialogs->displayScrollChain('D', 15); return; } if (_vm->_gyro->_teetotal) { - _vm->_scrolls->displayScrollChain('D', 6); + _vm->_dialogs->displayScrollChain('D', 6); return; } @@ -1947,7 +1947,7 @@ void Acci::doThat() { _vm->_lucerna->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 11); - _vm->_scrolls->displayText(booze[_thing - 51] + ", please." + Scrolls::kControlRegister + '1' + Scrolls::kControlSpeechBubble); + _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); _vm->_gyro->_drinking = _thing; _vm->_background->drawBackgroundSprite(-1, -1, 9); @@ -1959,21 +1959,21 @@ void Acci::doThat() { break; // We have a right one here - buy Pepsi??! case Gyro::kObjectWine: if (_vm->_gyro->_objects[Gyro::kObjectWine - 1]) // We've already got the wine! - _vm->_scrolls->displayScrollChain('D', 2); // 1 bottle's shufishent! + _vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent! else { if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_scrolls->displayScrollChain('D', 15); + _vm->_dialogs->displayScrollChain('D', 15); return; } if (_vm->_gyro->_carryNum >= kCarryLimit) { - _vm->_scrolls->displayText("Your hands are full."); + _vm->_dialogs->displayText("Your hands are full."); return; } _vm->_background->drawBackgroundSprite(-1, -1, 11); - Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); if (_vm->_gyro->_alcoholLevel == 0) _vm->_lucerna->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 9); @@ -1984,21 +1984,21 @@ void Acci::doThat() { break; } } else - _vm->_scrolls->displayScrollChain('D', 5); // Go to the bar! + _vm->_dialogs->displayScrollChain('D', 5); // Go to the bar! break; case kRoomOutsideDucks: if (_vm->_animation->inField(5)) { if (_thing == Gyro::kObjectOnion) { if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) - _vm->_scrolls->displayScrollChain('D', 10); // Not planning to juggle with the things! + _vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! else if (_vm->_gyro->_carryNum >= kCarryLimit) - _vm->_scrolls->displayText("Before you ask, you remember that your hands are full."); + _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); else { if (_vm->_gyro->_boughtOnion) - _vm->_scrolls->displayScrollChain('D', 11); + _vm->_dialogs->displayScrollChain('D', 11); else { - _vm->_scrolls->displayScrollChain('D', 9); + _vm->_dialogs->displayScrollChain('D', 9); _vm->_lucerna->incScore(3); } _vm->_gyro->decreaseMoney(3); // It costs thruppence. @@ -2009,16 +2009,16 @@ void Acci::doThat() { _vm->_gyro->_onionInVinegar = false; } } else - _vm->_scrolls->displayScrollChain('D', 0); + _vm->_dialogs->displayScrollChain('D', 0); } else - _vm->_scrolls->displayScrollChain('D', 0); + _vm->_dialogs->displayScrollChain('D', 0); break; case kRoomNottsPub: - _vm->_scrolls->displayScrollChain('n', 15); // Can't sell to southerners. + _vm->_dialogs->displayScrollChain('n', 15); // Can't sell to southerners. break; default: - _vm->_scrolls->displayScrollChain('D', 0); // Can't buy that. + _vm->_dialogs->displayScrollChain('D', 0); // Can't buy that. } break; case kVerbCodeAttack: @@ -2028,17 +2028,17 @@ void Acci::doThat() { switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: - _vm->_scrolls->displayScrollChain('Q', 10); - _vm->_scrolls->displayText("(At the very least, don't use your bare hands!)"); + _vm->_dialogs->displayScrollChain('Q', 10); + _vm->_dialogs->displayText("(At the very least, don't use your bare hands!)"); break; case 1: - _vm->_scrolls->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); + _vm->_dialogs->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); break; case 2: - _vm->_scrolls->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); + _vm->_dialogs->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: - _vm->_scrolls->displayScrollChain('Q', 11); + _vm->_dialogs->displayScrollChain('Q', 11); _vm->_gyro->_cwytalotGone = true; _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = false; _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = false; @@ -2051,14 +2051,14 @@ void Acci::doThat() { _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomDummy; break; default: - _vm->_scrolls->displayScrollChain('Q', 10); // Please try not to be so violent! + _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! } } else - _vm->_scrolls->displayScrollChain('Q', 10); + _vm->_dialogs->displayScrollChain('Q', 10); break; case kVerbCodePasswd: if (_vm->_gyro->_room != kRoomBridge) - _vm->_scrolls->displayScrollChain('Q', 12); + _vm->_dialogs->displayScrollChain('Q', 12); else { bool ok = true; for (uint i = 0; i < _thats.size(); i++) { @@ -2073,15 +2073,15 @@ void Acci::doThat() { if (ok) { if (_vm->_gyro->_drawbridgeOpen != 0) - _vm->_scrolls->displayText("Contrary to your expectations, the drawbridge fails to close again."); + _vm->_dialogs->displayText("Contrary to your expectations, the drawbridge fails to close again."); else { _vm->_lucerna->incScore(4); - _vm->_scrolls->displayText("The drawbridge opens!"); + _vm->_dialogs->displayText("The drawbridge opens!"); _vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); _vm->_gyro->_drawbridgeOpen = 1; } } else - _vm->_scrolls->displayScrollChain('Q', 12); + _vm->_dialogs->displayScrollChain('Q', 12); } break; case kVerbCodeDir: @@ -2091,8 +2091,8 @@ void Acci::doThat() { _vm->_lucerna->gameOver(); break; case kVerbCodeScore: { - Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dnascore, Scrolls::kControlCenter, Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, rank().c_str(), Scrolls::kControlNewLine, Scrolls::kControlNewLine, totalTime().c_str()); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodePut: @@ -2103,30 +2103,30 @@ void Acci::doThat() { break; case kVerbCodeKiss: if (_person == kPardon) - _vm->_scrolls->displayText("Kiss whom?"); + _vm->_dialogs->displayText("Kiss whom?"); else if (isPersonHere()) { switch (_person) { case Gyro::kPeopleArkata: - _vm->_scrolls->displayScrollChain('U', 12); + _vm->_dialogs->displayScrollChain('U', 12); break; case Gyro::kPeopleGeida: - _vm->_scrolls->displayScrollChain('U', 13); + _vm->_dialogs->displayScrollChain('U', 13); break; case Gyro::kPeopleWisewoman: - _vm->_scrolls->displayScrollChain('U', 14); + _vm->_dialogs->displayScrollChain('U', 14); break; default: - _vm->_scrolls->displayScrollChain('U', 5); // You WHAT? + _vm->_dialogs->displayScrollChain('U', 5); // You WHAT? } } else if ((Gyro::kPeopleAvalot <= _person) && (_person < Gyro::kPeopleArkata)) - _vm->_scrolls->displayText("Hey, what kind of a weirdo are you??"); + _vm->_dialogs->displayText("Hey, what kind of a weirdo are you??"); break; case kVerbCodeClimb: if (_vm->_gyro->_room == kRoomInsideCardiffCastle) cardiffClimbing(); else // In the wrong room! - _vm->_scrolls->displayText("Not with your head for heights, Avvy!"); + _vm->_dialogs->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: _vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); @@ -2148,28 +2148,28 @@ void Acci::doThat() { _vm->_gyro->_avvyInBed = true; _vm->_background->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. if (_vm->_gyro->_teetotal) - _vm->_scrolls->displayScrollChain('d', 13); + _vm->_dialogs->displayScrollChain('d', 13); } else - _vm->_scrolls->displayText("You're already awake, Avvy!"); + _vm->_dialogs->displayText("You're already awake, Avvy!"); break; case Gyro::kPeopleAyles: if (!_vm->_gyro->_aylesIsAwake) - _vm->_scrolls->displayText("You can't seem to wake him by yourself."); + _vm->_dialogs->displayText("You can't seem to wake him by yourself."); break; case Gyro::kPeopleJacques: { Common::String tmpStr = Common::String::format("Brother Jacques, Brother Jacques, are you asleep?%c1%c" \ - "Hmmm... that doesn't seem to do any good...", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + "Hmmm... that doesn't seem to do any good...", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } break; default: - _vm->_scrolls->displayText("It's difficult to awaken people who aren't asleep...!"); + _vm->_dialogs->displayText("It's difficult to awaken people who aren't asleep...!"); } break; case kVerbCodeSit: if (_vm->_gyro->_room == kRoomNottsPub) { if (_vm->_gyro->_sittingInPub) - _vm->_scrolls->displayText("You're already sitting!"); + _vm->_dialogs->displayText("You're already sitting!"); else { _vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down. _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); @@ -2178,35 +2178,35 @@ void Acci::doThat() { _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); _vm->_lucerna->dawn(); - Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Scrolls::kControlParagraph); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeRestart: - if (_vm->_scrolls->displayQuestion("Restart game and lose changes?")) { + if (_vm->_dialogs->displayQuestion("Restart game and lose changes?")) { _vm->_lucerna->dusk(); _vm->_gyro->newGame(); _vm->_lucerna->dawn(); } break; case kPardon: - _vm->_scrolls->displayText("Hey, a verb would be helpful!"); + _vm->_dialogs->displayText("Hey, a verb would be helpful!"); break; case kVerbCodeHello: { Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("Hello.%c", Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + tmpStr += Common::String::format("Hello.%c", Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeThanks: { Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("That's OK.%c", Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + tmpStr += Common::String::format("That's OK.%c", Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } break; default: - Common::String tmpStr = Common::String::format("%cParser bug!", Scrolls::kControlBell); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%cParser bug!", Dialogs::kControlBell); + _vm->_dialogs->displayText(tmpStr); } } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index fafd088b58..8fb28eda15 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -29,7 +29,7 @@ #include "avalanche/avalanche.h" #include "avalanche/animation.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/lucerna.h" #include "avalanche/gyro.h" #include "avalanche/background.h" @@ -216,8 +216,8 @@ void AnimationType::walk() { break; case Gyro::kMagicUnfinished: { bounce(); - Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Scrolls::kControlBell, Scrolls::kControlCenter, Scrolls::kControlRoman); - _anim->_vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Dialogs::kControlBell, Dialogs::kControlCenter, Dialogs::kControlRoman); + _anim->_vm->_dialogs->displayText(tmpStr); } break; case Gyro::kMagicSpecial: @@ -421,12 +421,12 @@ void Animation::catacombMove(byte ped) { switch (xy_uint16) { case 1801: // Exit catacombs flipRoom(kRoomLustiesRoom, 4); - _vm->_scrolls->displayText("Phew! Nice to be out of there!"); + _vm->_dialogs->displayText("Phew! Nice to be out of there!"); return; case 1033:{ // Oubliette flipRoom(kRoomOubliette, 1); - Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } return; case 4: @@ -434,7 +434,7 @@ void Animation::catacombMove(byte ped) { return; case 2307: flipRoom(kRoomLusties, 5); - _vm->_scrolls->displayText("Oh no... here we go again..."); + _vm->_dialogs->displayText("Oh no... here we go again..."); _vm->_gyro->_userMovesAvvy = false; _sprites[0]._moveY = 1; _sprites[0]._moveX = 0; @@ -733,7 +733,7 @@ void Animation::callSpecial(uint16 which) { _vm->_gyro->_magics[11]._data = 5; _vm->_gyro->_magics[3]._operation = Gyro::kMagicBounce; // Now works as planned! stopWalking(); - _vm->_scrolls->displayScrollChain('q', 26); + _vm->_dialogs->displayScrollChain('q', 26); _vm->_gyro->_userMovesAvvy = true; break; case 3: // _vm->_gyro->special 3: Room 71: triggers dart. @@ -763,11 +763,11 @@ void Animation::callSpecial(uint16 which) { if (_vm->_gyro->_friarWillTieYouUp) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Boundary effect is now working again. - _vm->_scrolls->displayScrollChain('q', 35); + _vm->_dialogs->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; _vm->_background->drawBackgroundSprite(-1, -1, 1); - _vm->_scrolls->displayScrollChain('q', 36); + _vm->_dialogs->displayScrollChain('q', 36); _vm->_gyro->_tiedUp = true; _vm->_gyro->_friarWillTieYouUp = false; _sprites[1].walkTo(2); @@ -791,12 +791,12 @@ void Animation::callSpecial(uint16 which) { _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); - _vm->_scrolls->displayText("Oh dear, you seem to be down the bottom of an oubliette."); + _vm->_dialogs->displayText("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid); break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_geidaFollows) && (!_vm->_gyro->_lustieIsAsleep)) { - _vm->_scrolls->displayScrollChain('q', 63); + _vm->_dialogs->displayScrollChain('q', 63); _sprites[1].turn(kDirDown); _sprites[1].stopWalk(); _sprites[1]._callEachStepFl = false; // Geida @@ -816,9 +816,9 @@ void Animation::callSpecial(uint16 which) { if ((_vm->_gyro->_catacombX == 4) && (_vm->_gyro->_catacombY == 1)) { // Into Geida's room. if (_vm->_gyro->_objects[Gyro::kObjectKey - 1]) - _vm->_scrolls->displayScrollChain('q', 62); + _vm->_dialogs->displayScrollChain('q', 62); else { - _vm->_scrolls->displayScrollChain('q', 61); + _vm->_dialogs->displayScrollChain('q', 61); return; } } @@ -1034,7 +1034,7 @@ void Animation::arrowProcs(byte tripnum) { // OK, it's hit him... what now? _sprites[1]._callEachStepFl = false; // prevent recursion. - _vm->_scrolls->displayScrollChain('Q', 47); // Complaint! + _vm->_dialogs->displayScrollChain('Q', 47); // Complaint! _sprites[tripnum].remove(); // Deallocate the arrow. _vm->_lucerna->gameOver(); @@ -1091,7 +1091,7 @@ void Animation::spin(byte whichway, byte &tripnum) { _vm->_gyro->_geidaSpin += 1; _vm->_gyro->_geidaTime = 20; if (_vm->_gyro->_geidaSpin == 5) { - _vm->_scrolls->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); + _vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); _vm->_gyro->_geidaSpin = 0; _vm->_gyro->_geidaTime = 0; // knock out records } @@ -1215,7 +1215,7 @@ void Animation::animLink() { if (_mustExclaim) { _mustExclaim = false; - _vm->_scrolls->displayScrollChain('x', _sayWhat); + _vm->_dialogs->displayScrollChain('x', _sayWhat); } } @@ -1233,13 +1233,13 @@ void Animation::stopWalking() { void Animation::hideInCupboard() { if (_vm->_gyro->_avvysInTheCupboard) { if (_vm->_gyro->_wearing == Acci::kNothing) { - Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); } else { _sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; appearPed(0, 2); // Walk out of the cupboard. - _vm->_scrolls->displayText("You leave the cupboard. Nice to be out of there!"); + _vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!"); _vm->_gyro->_avvysInTheCupboard = false; _vm->_sequence->firstShow(8); _vm->_sequence->thenShow(7); @@ -1250,8 +1250,8 @@ void Animation::hideInCupboard() { _sprites[0]._visible = false; _vm->_gyro->_userMovesAvvy = false; Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ - "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Scrolls::kControlParagraph); - _vm->_scrolls->displayText(tmpStr); + "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_avvysInTheCupboard = true; _vm->_background->drawBackgroundSprite(-1, -1, 7); } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f140ae90b6..d7a07fe41d 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -63,7 +63,7 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _pingo; - delete _scrolls; + delete _dialogs; delete _lucerna; delete _background; delete _sequence; @@ -83,7 +83,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _avalot = new Avalot(this); _gyro = new Gyro(this); _pingo = new Pingo(this); - _scrolls = new Scrolls(this); + _dialogs = new Dialogs(this); _lucerna = new Lucerna(this); _background = new Background(this); _sequence = new Sequence(this); @@ -95,7 +95,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _sound = new SoundHandler(this); _graphics->init(); - _scrolls->init(); + _dialogs->init(); _lucerna->init(); _acci->init(); _parser->init(); @@ -453,10 +453,10 @@ bool AvalancheEngine::loadGame(const int16 slot) { _background->updateBackgroundSprites(); Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", - Scrolls::kControlItalic, Scrolls::kControlRoman, description.c_str(), Scrolls::kControlCenter, - Scrolls::kControlNewLine, Scrolls::kControlNewLine, _gyro->_roomnName.c_str(), Scrolls::kControlNewLine, - Scrolls::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); - _scrolls->displayText(tmpStr); + Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter, + Dialogs::kControlNewLine, Dialogs::kControlNewLine, _gyro->_roomnName.c_str(), Dialogs::kControlNewLine, + Dialogs::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); + _dialogs->displayText(tmpStr); AnimationType *avvy = &_animation->_sprites[0]; if (avvy->_quick && avvy->_visible) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 16482c8c92..2a7df29a32 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -34,7 +34,7 @@ #include "avalanche/avalot.h" #include "avalanche/gyro.h" #include "avalanche/pingo.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/lucerna.h" #include "avalanche/background.h" #include "avalanche/sequence.h" @@ -70,7 +70,7 @@ public: Avalot *_avalot; Gyro *_gyro; Pingo *_pingo; - Scrolls *_scrolls; + Dialogs *_dialogs; Lucerna *_lucerna; Background *_background; Sequence *_sequence; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 7126f332e7..5dc7fcfcba 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -34,7 +34,7 @@ #include "avalanche/animation.h" #include "avalanche/gyro.h" #include "avalanche/lucerna.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/menu.h" #include "avalanche/pingo.h" #include "avalanche/timer.h" @@ -120,7 +120,7 @@ void Avalot::handleKeyDown(Common::Event &event) { void Avalot::setup() { _vm->_gyro->init(); - _vm->_scrolls->resetScroll(); + _vm->_dialogs->reset(); _vm->_lucerna->dusk(); _vm->_lucerna->loadDigits(); @@ -128,7 +128,7 @@ void Avalot::setup() { _vm->_parser->_quote = true; _vm->_lucerna->drawToolbar(); - _vm->_scrolls->setReadyLight(2); + _vm->_dialogs->setReadyLight(2); _vm->_animation->_direction = Animation::kDirStopped; _vm->_animation->loadAnims(); @@ -155,7 +155,7 @@ void Avalot::setup() { _vm->_lucerna->fxToggle(); _vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); - _vm->_scrolls->displayScrollChain('q', 83); // Info on the game, etc. + _vm->_dialogs->displayScrollChain('q', 83); // Info on the game, etc. } } diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp new file mode 100644 index 0000000000..a496fcd177 --- /dev/null +++ b/engines/avalanche/dialogs.cpp @@ -0,0 +1,1087 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + + /* SCROLLS The scroll driver. */ + +#include "avalanche/avalanche.h" +#include "avalanche/dialogs.h" +#include "avalanche/gyro.h" +#include "avalanche/lucerna.h" +#include "avalanche/animation.h" +#include "avalanche/acci.h" +#include "avalanche/timer.h" + +#include "common/textconsole.h" +#include "common/file.h" + +namespace Avalanche { + +Dialogs::Dialogs(AvalancheEngine *vm) { + _vm = vm; + _noError = true; +} + +void Dialogs::init() { + loadFont(); + resetScrollDriver(); +} + +void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever + if (_vm->_gyro->_ledStatus == state) + return; // Already like that! + + byte color = kColorBlack; + switch (state) { + case 0: + color = kColorBlack; + break; // Off + case 1: + case 2: + case 3: + color = kColorGreen; + break; // Hit a key + } + warning("STUB: Scrolls::state()"); + + CursorMan.showMouse(false); + + _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); + + CursorMan.showMouse(true); + _vm->_gyro->_ledStatus = state; +} + +void Dialogs::easterEgg() { + warning("STUB: Scrolls::easterEgg()"); +} + +void Dialogs::say(int16 x, int16 y, Common::String z) { + FontType itw; + byte lz = z.size(); + + bool offset = x % 8 == 4; + x /= 8; + y++; + int16 i = 0; + for (int xx = 0; xx < lz; xx++) { + switch (z[xx]) { + case kControlRoman: + _currentFont = kFontStyleRoman; + break; + case kControlItalic: + _currentFont = kFontStyleItalic; + break; + default: { + for (int yy = 0; yy < 12; yy++) + itw[(byte)z[xx]][yy] = _fonts[_currentFont][(byte)z[xx]][yy + 2]; + + // We have to draw the characters one-by-one because of the accidental font changes. + i++; + Common::String chr(z[xx]); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, kColorBlack); + } + } + } +} + +void Dialogs::scrollModeNormal() { + // Original code is: + // egg : array[1..8] of char = ^P^L^U^G^H+'***'; + // this is not using kControl characters: it's the secret code to be entered to trigger the easter egg + // TODO: To be fixed when the Easter egg code is implemented + Common::String egg = Common::String::format("%c%c%c%c%c***", kControlParagraph, kControlLeftJustified, kControlNegative, kControlBell, kControlBackspace); + Common::String e = "(c) 1994"; + + setReadyLight(3); + _vm->_gyro->_seeScroll = true; + _vm->_gyro->newMouse(3); + + ::Graphics::Surface temp; + temp.copyFrom(_vm->_graphics->_surface); + _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! + + Common::Event event; + while (!_vm->shouldQuit()) { + _vm->_graphics->refreshScreen(); + + _vm->getEvent(event); + if (_vm->shouldQuit() || + (event.type == Common::EVENT_LBUTTONUP) || + ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) + || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) + || (event.kbd.keycode == Common::KEYCODE_PLUS)))) + break; + } + + _vm->_graphics->_surface.copyFrom(temp); + temp.free(); + + warning("STUB: scrollModeNormal() - Check Easter Egg trigger"); +#if 0 + char r; + bool oktoexit; + do { + do { + _vm->_gyro->check(); // was "checkclick;" + +//#ifdef RECORD slowdown(); basher::count += 1; #endif + + if (_vm->_enhanced->keypressede()) + break; + } while (!((mrelease > 0) || (buttona1()) || (buttonb1()))); + + + if (mrelease == 0) { + inkey(); + if (aboutscroll) { + move(e[2 - 1], e[1 - 1], 7); + e[8 - 1] = inchar; + if (egg == e) + easteregg(); + } + oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); + if (!oktoexit) errorled(); + } + + } while (!((oktoexit) || (mrelease > 0))); + +//#ifdef RECORD record_one(); #endif + + _vm->_gyro->screturn = r == '#'; // "back door" +#endif + + setReadyLight(0); + _vm->_gyro->_seeScroll = false; + _vm->_lucerna->_holdLeftMouse = false; // Used in Lucerna::checkclick(). + + warning("STUB: Scrolls::scrollModeNormal()"); +} + +void Dialogs::scrollModeDialogue() { + warning("STUB: Scrolls::scrollModeDialogue()"); +} + +void Dialogs::store(byte what, TuneType &played) { + memcpy(played, played + 1, sizeof(played) - 1); + played[30] = what; +} + +bool Dialogs::theyMatch(TuneType &played) { + byte mistakes = 0; + + for (unsigned int i = 0; i < sizeof(played); i++) { + if (played[i] != _vm->_gyro->kTune[i]) + mistakes += 1; + } + + return mistakes < 5; +} + +void Dialogs::scrollModeMusic() { + setReadyLight(3); + _vm->_gyro->_seeScroll = true; + CursorMan.showMouse(false); + _vm->_gyro->newMouse(3); + + TuneType played; + for (unsigned int i = 0; i < sizeof(played); i++) + played[i] = Gyro::kPitchInvalid; + int8 lastOne = -1, thisOne = -1; // Invalid values. + + _vm->_gyro->_seeScroll = true; + + ::Graphics::Surface temp; + temp.copyFrom(_vm->_graphics->_surface); + _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! + + Common::Event event; + while (!_vm->shouldQuit()) { + _vm->_graphics->refreshScreen(); + + _vm->getEvent(event); + + // When we stop playing? + if ((event.type == Common::EVENT_LBUTTONDOWN) || + ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_ESCAPE)))) { + break; + } + + // When we DO play: + if ((event.type == Common::EVENT_KEYDOWN) + && ((event.kbd.keycode == Common::KEYCODE_q) || (event.kbd.keycode == Common::KEYCODE_w) + || (event.kbd.keycode == Common::KEYCODE_e) || (event.kbd.keycode == Common::KEYCODE_r) + || (event.kbd.keycode == Common::KEYCODE_t) || (event.kbd.keycode == Common::KEYCODE_y) + || (event.kbd.keycode == Common::KEYCODE_u) || (event.kbd.keycode == Common::KEYCODE_i) + || (event.kbd.keycode == Common::KEYCODE_o) || (event.kbd.keycode == Common::KEYCODE_p) + || (event.kbd.keycode == Common::KEYCODE_LEFTBRACKET) || (event.kbd.keycode == Common::KEYCODE_RIGHTBRACKET))) { + byte value; + switch (event.kbd.keycode) { + case Common::KEYCODE_q: + value = 0; + break; + case Common::KEYCODE_w: + value = 1; + break; + case Common::KEYCODE_e: + value = 2; + break; + case Common::KEYCODE_r: + value = 3; + break; + case Common::KEYCODE_t: + value = 4; + break; + case Common::KEYCODE_y: + value = 5; + break; + case Common::KEYCODE_u: + value = 6; + break; + case Common::KEYCODE_i: + value = 7; + break; + case Common::KEYCODE_o: + value = 8; + break; + case Common::KEYCODE_p: + value = 9; + break; + case Common::KEYCODE_LEFTBRACKET: + value = 10; + break; + case Common::KEYCODE_RIGHTBRACKET: + value = 11; + break; + default: + break; + } + + lastOne = thisOne; + thisOne = value; + + _vm->_sound->playNote(_vm->_gyro->kNotes[thisOne], 100); + _vm->_system->delayMillis(200); + + if (!_vm->_gyro->_bellsAreRinging) { // These handle playing the right tune. + if (thisOne < lastOne) + store(Gyro::kPitchLower, played); + else if (thisOne == lastOne) + store(Gyro::kPitchSame, played); + else + store(Gyro::kPitchHigher, played); + } + + if (theyMatch(played)) { + setReadyLight(0); + _vm->_timer->addTimer(8, Timer::kProcJacquesWakesUp, Timer::kReasonJacquesWakingUp); + break; + } + } + } + + _vm->_graphics->_surface.copyFrom(temp); + temp.free(); + _vm->_gyro->_seeScroll = false; + CursorMan.showMouse(true); +} + +void Dialogs::resetScrollDriver() { + _vm->_gyro->_scrollBells = 0; + _currentFont = kFontStyleRoman; + _useIcon = 0; + _vm->_gyro->_interrogation = 0; // Always reset after a scroll comes up. +} + +void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... + for (int i = 0; i < _vm->_gyro->_scrollBells; i++) + _vm->_lucerna->errorLed(); // Ring the bell "x" times. +} + +void Dialogs::dodgem() { + _dodgeCoord = _vm->getMousePos(); + g_system->warpMouse(_dodgeCoord.x, _vm->_gyro->_underScroll); // Move the pointer off the scroll. +} + +void Dialogs::unDodgem() { + Common::Point actCoord = _vm->getMousePos(); + if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_gyro->_underScroll)) + g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. +} + +void Dialogs::getIcon(int16 x, int16 y, byte which) { + Common::File file; + + if (!file.open("icons.avd")) + error("AVALANCHE: Scrolls: File not found: icons.avd"); + + which--; + file.seek(which * 426); + + byte *p = new byte[426]; + file.read(p, 426); + + //putimage(x, y, p, 0); + warning("STUB: Scrolls::getIcon()"); + + delete[] p; + file.close(); +} + +void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { + Common::File file; + Common::String filename = Common::String::format("%s.avd", fn.c_str()); + + if (!file.open(filename)) + error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); + +#if 0 + uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); + byte bit; + for (uint16 i = 1; i <= yl; i++) + for (bit = 0; bit <= 3; bit++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * st + (i * 80)], xl); + } + bit = getpixel(0, 0); +#endif + + warning("STUB: Scrolls::drawSign()"); + + file.close(); +} + +void Dialogs::drawScroll(DialogFunctionType modeFunc) { + int16 lx = 0; + int16 ly = (_vm->_gyro->_scrollNum) * 6; + int16 ex; + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { + ex = _vm->_gyro->_scroll[i].size() * 8; + if (lx < ex) + lx = ex; + } + int16 mx = 320; + int16 my = 100; // Getmaxx & getmaxy div 2, both. + lx /= 2; + ly -= 2; + + if ((1 <= _useIcon) && (_useIcon <= 34)) + lx += kHalfIconWidth; + + _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); + + CursorMan.showMouse(false); + + // The right corners of the scroll. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorLightgray); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorLightgray); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorRed); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorRed); + + // The body of the scroll. + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), kColorLightgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly + 1), kColorLightgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly + 1), kColorLightgray); + + // The left corners of the scroll. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorDarkgray); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorRed); + _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my - ly, mx - lx - 31 + 15, my - ly, kColorRed); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorDarkgray); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorRed); + _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my + ly, mx - lx - 31 + 15, my + ly, kColorRed); + + // The rear borders of the scroll. + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5), kColorRed); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), kColorRed); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), kColorRed); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); + + mx -= lx; + my -= ly + 2; + + bool centre = false; + + byte iconIndent = 0; + switch (_useIcon) { + case 0: + iconIndent = 0; + break; // No icon. + case 34: + drawSign("about", 28, 76, 15); + iconIndent = 0; + break; + case 35: + drawSign("gameover", 52, 59, 71); + iconIndent = 0; + break; + } + + if ((1 <= _useIcon) && (_useIcon <= 33)) { // Standard icon. + getIcon(mx, my + ly / 2, _useIcon); + iconIndent = 53; + } + + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { + if (!_vm->_gyro->_scroll[i].empty()) + switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { + case kControlCenter: + centre = true; + _vm->_gyro->_scroll[i].deleteLastChar(); + break; + case kControlLeftJustified: + centre = false; + _vm->_gyro->_scroll[i].deleteLastChar(); + break; + case kControlQuestion: + //settextjustify(1, 1); + _shadowBoxX = mx + lx; + _shadowBoxY = my + ly; + _vm->_gyro->_scroll[i].setChar(' ', 0); + // byte groi = *_vm->_graphics->getPixel(0, 0); + // inc(diy,14); + _vm->_gyro->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); + _vm->_gyro->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); + break; + } + + if (centre) + say(320 - _vm->_gyro->_scroll[i].size() * 4 + iconIndent, my, _vm->_gyro->_scroll[i]); + else + say(mx + iconIndent, my, _vm->_gyro->_scroll[i]); + + my += 12; + } + + _vm->_gyro->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. + ringBell(); + + _vm->_gyro->_dropsOk = false; + dodgem(); + + (this->*modeFunc)(); + + unDodgem(); + _vm->_gyro->_dropsOk = true; + + resetScrollDriver(); +} + +void Dialogs::drawBubble(DialogFunctionType modeFunc) { + Common::Point points[3]; + + CursorMan.showMouse(false); + int16 xl = 0; + int16 yl = _vm->_gyro->_scrollNum * 5; + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { + uint16 textWidth = _vm->_gyro->_scroll[i].size() * 8; + if (textWidth > xl) + xl = textWidth; + } + xl /= 2; + + int16 xw = xl + 18; + int16 yw = yl + 7; + int16 my = yw * 2 - 2; + int16 xc = 0; + + if ((_vm->_gyro->_talkX - xw) < 0) + xc = -(_vm->_gyro->_talkX - xw); + if ((_vm->_gyro->_talkX + xw) > 639) + xc = 639 - (_vm->_gyro->_talkX + xw); + + points[0].x = _vm->_gyro->_talkX - 10; + points[0].y = yw; + points[1].x = _vm->_gyro->_talkX + 10; + points[1].y = yw; + points[2].x = _vm->_gyro->_talkX; + points[2].y = _vm->_gyro->_talkY; + + // Backup the screen before drawing the bubble. + _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); + + // The body of the bubble. + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw + 9, 7, _vm->_gyro->_talkX + xw - 8 + xc, my + 1), _vm->_gyro->_talkBackgroundColor); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw - 1, 12, _vm->_gyro->_talkX + xw + xc + 2, my - 4), _vm->_gyro->_talkBackgroundColor); + + // Top right corner of the bubble. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, 11, 0, 90, 9, _vm->_gyro->_talkBackgroundColor); + // Bottom right corner of the bubble. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_gyro->_talkBackgroundColor); + // Top left corner of the bubble. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, 11, 90, 180, 9, _vm->_gyro->_talkBackgroundColor); + // Bottom left corner of the bubble. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_gyro->_talkBackgroundColor); + + // "Tail" of the speech bubble. + _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_gyro->_talkBackgroundColor); + + + // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). + // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. + // It's almost the same, only notable differences are '?', '!', etc. + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { + int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[i].size() / 2 * 8; + bool offset = _vm->_gyro->_scroll[i].size() % 2; + _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[i], _vm->_gyro->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_gyro->_talkFontColor); + } + + ringBell(); + CursorMan.showMouse(false); + _vm->_gyro->_dropsOk = false; + + // This does the actual drawing to the screen. + (this->*modeFunc)(); + + _vm->_gyro->_dropsOk = true; + CursorMan.showMouse(true); // sink; + resetScrollDriver(); +} + +bool Dialogs::displayQuestion(Common::String question) { + warning("STUB: Scrolls::displayQuestion()"); + return true; +} + +void Dialogs::reset() { + _vm->_gyro->_scrollNum = 1; + for (int i = 0; i < 15; i++) { + if (!_vm->_gyro->_scroll[i].empty()) + _vm->_gyro->_scroll[i].clear(); + } +} + +void Dialogs::setBubbleStateNatural() { + _vm->_gyro->_talkX = 320; + _vm->_gyro->_talkY = 200; + _vm->_gyro->_talkBackgroundColor = 8; + _vm->_gyro->_talkFontColor = 15; +} + +Common::String Dialogs::displayMoney() { + Common::String result; + + if (_vm->_gyro->_money < 12) { // just pence + result = Common::String::format("%dd", _vm->_gyro->_money); + } else if (_vm->_gyro->_money < 240) { // shillings & pence + if ((_vm->_gyro->_money % 12) == 0) + result = Common::String::format("%d/-", _vm->_gyro->_money / 12); + else + result = Common::String::format("%d/%d", _vm->_gyro->_money / 12, _vm->_gyro->_money % 12); + } else { // L, s & d + result = Common::String::format("\x9C%d.%d.%d", _vm->_gyro->_money / 240, (_vm->_gyro->_money / 12) % 20, + _vm->_gyro->_money % 12); + } + if (_vm->_gyro->_money > 12) { + Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_gyro->_money); + result += extraStr; + } + + return result; +} + +void Dialogs::stripTrailingSpaces(Common::String &str) { + while (str[str.size() - 1] == ' ') + str.deleteLastChar(); +} + +void Dialogs::solidify(byte n) { + if (!_vm->_gyro->_scroll[n].contains(' ')) + return; // No spaces. + + // So there MUST be a space there, somewhere... + do { + _vm->_gyro->_scroll[n + 1] = _vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] + _vm->_gyro->_scroll[n + 1]; + _vm->_gyro->_scroll[n].deleteLastChar(); + } while (_vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] != ' '); + + stripTrailingSpaces(_vm->_gyro->_scroll[n]); +} + +void Dialogs::callDialogDriver() { +// bool was_virtual; // Was the mouse cursor virtual on entry to this proc? + warning("STUB: Scrolls::calldrivers()"); + + _vm->_sound->stopSound(); + + setReadyLight(0); + _vm->_gyro->_scReturn = false; + bool mouthnext = false; + bool call_spriterun = true; // Only call sprite_run the FIRST time. + + switch (_vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1]) { + case kControlToBuffer: + _vm->_gyro->_bufSize--; + break; // ^D = (D)on't include pagebreak + case kControlSpeechBubble: + case kControlQuestion: + break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box + default: + _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = kControlParagraph; + _vm->_gyro->_bufSize++; + } + + uint16 size = _vm->_gyro->_bufSize; + + for (uint16 i = 0; i < size; i++) { + if (mouthnext) { + if (_vm->_gyro->_buffer[i] == kControlRegister) + _param = 0; + else if (('0' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= '9')) + _param = _vm->_gyro->_buffer[i] - 48; + else if (('A' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= 'Z')) + _param = _vm->_gyro->_buffer[i] - 55; + + mouthnext = false; + } else { + switch (_vm->_gyro->_buffer[i]) { + case kControlParagraph: + if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) + break; + + if (call_spriterun) + _vm->_lucerna->spriteRun(); + call_spriterun = false; + + drawScroll(&Avalanche::Dialogs::scrollModeNormal); + + reset(); + + if (_vm->_gyro->_scReturn) + return; + break; + case kControlBell: + _vm->_gyro->_scrollBells++; + break; // #7 = "Bel" + case kControlSpeechBubble: + if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) + break; + + if (call_spriterun) + _vm->_lucerna->spriteRun(); + call_spriterun = false; + + if (_param == 0) + setBubbleStateNatural(); + else if ((1 <= _param) && (_param <= 9)) { + AnimationType *spr = &_vm->_animation->_sprites[_param - 1]; + if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. + _vm->_lucerna->errorLed(); + setBubbleStateNatural(); + } else + spr->chatter(); // Normal sprite talking routine. + } else if ((10 <= _param) && (_param <= 36)) { + // Quasi-peds. (This routine performs the same + // thing with QPs as triptype.chatter does with the + // sprites.) + PedType *quasiPed = &_vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed]; + _vm->_gyro->_talkX = quasiPed->_x; + _vm->_gyro->_talkY = quasiPed->_y; // Position. + + _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[_param - 10]._foregroundColor; + _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[_param - 10]._backgroundColor; // Colors. + } else { + _vm->_lucerna->errorLed(); // Not valid. + setBubbleStateNatural(); + } + + drawBubble(&Avalanche::Dialogs::scrollModeNormal); + + reset(); + + if (_vm->_gyro->_scReturn) + return; + break; + + // CHECME: The whole kControlNegative block seems completely unused, as the only use (the easter egg check) is a false positive + case kControlNegative: + switch (_param) { + case 1: + displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) + break; + case 2: { + int pwdId = _vm->_acci->kFirstPassword + _vm->_gyro->_passwordNum; + displayText(_vm->_acci->_vocabulary[pwdId]._word + kControlToBuffer); + } + break; + case 3: + displayText(_vm->_gyro->_favouriteDrink + kControlToBuffer); + break; + case 4: + displayText(_vm->_gyro->_favouriteSong + kControlToBuffer); + break; + case 5: + displayText(_vm->_gyro->_worstPlaceOnEarth + kControlToBuffer); + break; + case 6: + displayText(_vm->_gyro->_spareEvening + kControlToBuffer); + break; + case 9: { + Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_gyro->_catacombX, _vm->_gyro->_catacombY, kControlToBuffer); + displayText(tmpStr); + } + break; + case 10: + switch (_vm->_gyro->_boxContent) { + case 0: // Sixpence. + _vm->_dialogs->displayScrollChain('q', 37); // You find the sixpence. + _vm->_gyro->_money += 6; + _vm->_gyro->_boxContent = _vm->_acci->kNothing; + _vm->_lucerna->incScore(2); + return; + case Acci::kNothing: + displayText("nothing at all. It's completely empty."); + break; + default: + displayText(_vm->_gyro->getItem(_vm->_gyro->_boxContent) + '.'); + } + break; + case 11: + for (int j = 0; j < kObjectNum; j++) { + if (_vm->_gyro->_objects[j]) + displayText(_vm->_gyro->getItem(j) + ", " + kControlToBuffer); + } + break; + } + break; + case kControlIcon: + _useIcon = _param; + break; + case kControlNewLine: + _vm->_gyro->_scrollNum++; + break; + case kControlQuestion: + if (call_spriterun) + _vm->_lucerna->spriteRun(); + call_spriterun = false; + + _vm->_gyro->_scroll[_vm->_gyro->_scrollNum] = kControlQuestion; + _vm->_gyro->_scrollNum++; + + drawScroll(&Avalanche::Dialogs::scrollModeDialogue); + reset(); + break; + case kControlRegister: + mouthnext = true; + break; + case kControlInsertSpaces: + for (int j = 0; j < 9; j++) + _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; + break; + default: // Add new char. + if (_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1].size() == 50) { + solidify(_vm->_gyro->_scrollNum - 1); + _vm->_gyro->_scrollNum++; + } + _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += _vm->_gyro->_buffer[i]; + break; + } + } + } +} + +void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! + _vm->_gyro->_bufSize = text.size(); + memcpy(_vm->_gyro->_buffer, text.c_str(), _vm->_gyro->_bufSize); + callDialogDriver(); +} + +void Dialogs::loadFont() { + Common::File file; + + if (!file.open("avalot.fnt")) + error("AVALANCHE: Scrolls: File not found: avalot.fnt"); + + for (int16 i = 0; i < 256; i++) + file.read(_fonts[0][i], 16); + file.close(); + + if (!file.open("avitalic.fnt")) + error("AVALANCHE: Scrolls: File not found: avitalic.fnt"); + + for (int16 i = 0; i < 256; i++) + file.read(_fonts[1][i], 16); + file.close(); + + if (!file.open("ttsmall.fnt")) + error("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); + + for (int16 i = 0; i < 256; i++) + file.read(_vm->_gyro->_font[i],16); + file.close(); +} + +void Dialogs::displayMusicalScroll() { + Common::String tmpStr = Common::String::format("To play the harp...%c%cUse these keys:%c%cQ W E R T Y U I O P [ ]%c%cOr press Enter to stop playing.%c", + kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer); + displayText(tmpStr); + + _vm->_lucerna->spriteRun(); + CursorMan.showMouse(false); + drawScroll(&Avalanche::Dialogs::scrollModeMusic); + CursorMan.showMouse(true); + reset(); +} + +// From Visa: + +void Dialogs::unSkrimble() { + for (uint16 i = 0; i < _vm->_gyro->_bufSize; i++) + _vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; +} + +void Dialogs::doTheBubble() { + _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = 2; + _vm->_gyro->_bufSize++; +} + +/** + * Display a string in a scroll + * @remarks Originally called 'dixi' + */ +void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbling) { + Common::File indexfile; + if (!indexfile.open("avalot.idx")) + error("AVALANCHE: Visa: File not found: avalot.idx"); + + bool error = false; + + indexfile.seek((toupper(block) - 65) * 2); + uint16 idx_offset = indexfile.readUint16LE(); + if (idx_offset == 0) + error = true; + + indexfile.seek(idx_offset + point * 2); + uint16 sez_offset = indexfile.readUint16LE(); + if (sez_offset == 0) + error = true; + + indexfile.close(); + + _noError = !error; + + if (error) { + if (report) { + Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", Dialogs::kControlBell, block, point); + _vm->_dialogs->displayText(todisplay); + } + return; + } + + Common::File sezfile; + if (!sezfile.open("avalot.sez")) + ::error("AVALANCHE: Visa: File not found: avalot.sez"); + + sezfile.seek(sez_offset); + _vm->_gyro->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); + sezfile.close(); + unSkrimble(); + + if (bubbling) + doTheBubble(); + + _vm->_dialogs->callDialogDriver(); +} + +/** + * Start speech + * @remarks Originally called 'speech' + */ +void Dialogs::speak(byte who, byte subject) { + if (subject == 0) { // No subject. + displayScrollChain('s', who, false, true); + return; + } + + // Subject given. + _noError = false; // Assume that until we know otherwise. + + Common::File indexfile; + if (!indexfile.open("converse.avd")) + error("AVALANCHE: Visa: File not found: converse.avd"); + + indexfile.seek(who * 2 - 2); + uint16 idx_offset = indexfile.readUint16LE(); + uint16 next_idx_offset = indexfile.readUint16LE(); + + if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) + return; + + indexfile.seek(idx_offset + subject * 2); + uint16 sez_offset = indexfile.readUint16LE(); + if ((sez_offset == 0) || (indexfile.err())) + return; + indexfile.close(); + + Common::File sezfile; + if (!sezfile.open("avalot.sez")) + error("AVALANCHE: Visa: File not found: avalot.sez"); + + sezfile.seek(sez_offset); + _vm->_gyro->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); + sezfile.close(); + + unSkrimble(); + doTheBubble(); + + _vm->_dialogs->callDialogDriver(); + _noError = true; +} + +void Dialogs::talkTo(byte whom) { + if (_vm->_acci->_person == _vm->_acci->kPardon) { + _vm->_acci->_person = _vm->_gyro->_subjectNum; + _vm->_gyro->_subjectNum = 0; + } + + if (_vm->_gyro->_subjectNum == 0) { + switch (whom) { + case Gyro::kPeopleSpludwick: + if ((_vm->_gyro->_lustieIsAsleep) & (!_vm->_gyro->_objects[Gyro::kObjectPotion - 1])) { + displayScrollChain('q', 68); + _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; + _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->incScore(3); + return; + } else if (_vm->_gyro->_talkedToCrapulus) { + // Spludwick - what does he need? + // 0 - let it through to use normal routine. + switch (_vm->_gyro->_givenToSpludwick) { + case 1: // Fallthrough is intended. + case 2: { + Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); + Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); + } + return; + case 3: + displayScrollChain('q', 30); // Need any help with the game? + return; + } + } else { + displayScrollChain('q', 42); // Haven't talked to Crapulus. Go and talk to him. + return; + } + break; + case Gyro::kPeopleIbythneth: + if (_vm->_gyro->_givenBadgeToIby) { + displayScrollChain('q', 33); // Thanks a lot! + return; // And leave the proc. + } + break; // Or... just continue, 'cos he hasn't got it. + case Gyro::kPeopleDogfood: + if (_vm->_gyro->_wonNim) { // We've won the game. + displayScrollChain('q', 6); // "I'm Not Playing!" + return; // Zap back. + } else + _vm->_gyro->_askedDogfoodAboutNim = true; + break; + case Gyro::kPeopleAyles: + if (!_vm->_gyro->_aylesIsAwake) { + displayScrollChain('q', 43); // He's fast asleep! + return; + } else if (!_vm->_gyro->_givenPenToAyles) { + displayScrollChain('q', 44); // Can you get me a pen, Avvy? + return; + } + break; + + case Gyro::kPeopleJacques: + displayScrollChain('q', 43); + return; + + case Gyro::kPeopleGeida: + if (_vm->_gyro->_givenPotionToGeida) + _vm->_gyro->_geidaFollows = true; + else { + displayScrollChain('u', 17); + return; + } + break; + case Gyro::kPeopleSpurge: + if (!_vm->_gyro->_sittingInPub) { + displayScrollChain('q', 71); // Try going over and sitting down. + return; + } else { + if (_vm->_gyro->_spurgeTalkCount < 5) + _vm->_gyro->_spurgeTalkCount++; + if (_vm->_gyro->_spurgeTalkCount > 1) { // no. 1 falls through + displayScrollChain('q', 70 + _vm->_gyro->_spurgeTalkCount); + return; + } + } + break; + } + // On a subject. Is there any reason to block it? + } else if ((whom == Gyro::kPeopleAyles) && (!_vm->_gyro->_aylesIsAwake)) { + displayScrollChain('q', 43); // He's fast asleep! + return; + } + + if (whom > 149) + whom -= 149; + + bool noMatches = true; + for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { + if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { + Common::String tmpStr = Common::String::format("%c%c%c", Dialogs::kControlRegister, i + 49, Dialogs::kControlToBuffer); + _vm->_dialogs->displayText(tmpStr); + noMatches = false; + break; + } + } + + if (noMatches) { + Common::String tmpStr = Common::String::format("%c%c%c", Dialogs::kControlRegister, Dialogs::kControlRegister, Dialogs::kControlToBuffer); + _vm->_dialogs->displayText(tmpStr); + } + + speak(whom, _vm->_gyro->_subjectNum); + + if (!_noError) + displayScrollChain('n', whom); // File not found! + + if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == Gyro::kPeopleCrapulus)) { // Crapulus: get the badge - first time only + _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = true; + _vm->_lucerna->refreshObjectList(); + displayScrollChain('q', 1); // Circular from Cardiff. + _vm->_gyro->_talkedToCrapulus = true; + _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. + + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->_vanishIfStill = true; + spr->walkTo(2); // Walks away. + + _vm->_lucerna->incScore(2); + } +} + +} // End of namespace Avalanche diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h new file mode 100644 index 0000000000..9cb4470959 --- /dev/null +++ b/engines/avalanche/dialogs.h @@ -0,0 +1,133 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + + /* SCROLLS The scroll driver. */ + +#ifndef AVALANCHE_DIALOGS_H +#define AVALANCHE_DIALOGS_H + +#include "common/system.h" + +namespace Avalanche { +class AvalancheEngine; + +class Dialogs; + +typedef void (Dialogs::*DialogFunctionType)(); + +class Dialogs { +public: + // Constants to replace the command characters from Pascal. + // For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers + enum ControlCharacter { + kControlSpeechBubble = 2, // ^B + kControlCenter = 3, // ^C + kControlToBuffer = 4, // ^D + kControlItalic = 6, // ^F + kControlBell = 7, // ^G + kControlBackspace = 8, // ^H + kControlInsertSpaces = 9, // ^I + kControlLeftJustified = 12, // ^L + kControlNewLine = 13, // ^M + kControlParagraph = 16, // ^P + kControlQuestion = 17, // ^Q + kControlRoman = 18, // ^R + kControlRegister = 19, // ^S + kControlNegative = 21, // ^U + kControlIcon = 22 // ^V + }; + + bool _aboutBox; // Is this the about box? + FontType _fonts[2]; + + Dialogs(AvalancheEngine *vm); + + void init(); + void setReadyLight(byte state); // Sets "Ready" light to whatever. + void drawScroll(DialogFunctionType modeFunc); + void drawBubble(DialogFunctionType modeFunc); + void reset(); + void callDialogDriver(); + void displayText(Common::String text); + bool displayQuestion(Common::String question); + void setBubbleStateNatural(); // Natural state of bubbles + Common::String displayMoney(); + void displayMusicalScroll(); // Practically this one is a mini-game which called when you play the harp in the monastery. + + // From Visa: + void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); + void talkTo(byte whom); + +private: + AvalancheEngine *_vm; + + enum FontStyle { + kFontStyleRoman, + kFontStyleItalic + }; + + static const int16 kHalfIconWidth = 19; // Half the width of an icon. + + int16 _shadowBoxX, _shadowBoxY; + byte _currentFont; // Current font + Common::Point _dodgeCoord; + byte _param; // For using arguments code + byte _useIcon; + + // These 3 functions are always passed as ScrollsFunctionType parameters. + void scrollModeNormal(); + void scrollModeDialogue(); + void scrollModeMusic(); + + // These 2 are used only in musicalScroll(). + void store(byte what, TuneType &played); + bool theyMatch(TuneType &played); + + void stripTrailingSpaces(Common::String &str); // Original: strip. + void solidify(byte n); // Does the word wrapping. + + void dodgem(); // This moves the mouse pointer off the scroll so that you can read it. + void unDodgem(); // This is the opposite of Dodgem. It moves the mouse pointer back, IF you haven't moved it in the meantime. + + void easterEgg(); + void say(int16 x, int16 y, Common::String text); + void resetScrollDriver(); + void ringBell(); // Original: dingdongbell + void getIcon(int16 x, int16 y, byte which); + void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. + void loadFont(); + + // From Visa: + bool _noError; + void unSkrimble(); + void doTheBubble(); + void speak(byte who, byte subject); +}; + +} // End of namespace Avalanche + +#endif // AVALANCHE_DIALOGS_H diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index e338ecddbc..3d86d34b38 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -30,7 +30,7 @@ #include "avalanche/avalanche.h" #include "avalanche/gyro.h" #include "avalanche/pingo.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/lucerna.h" #include "avalanche/acci.h" #include "avalanche/animation.h" @@ -311,7 +311,7 @@ void Gyro::newGame() { _alive = true; resetVariables(); - _vm->_scrolls->setBubbleStateNatural(); + _vm->_dialogs->setBubbleStateNatural(); _spareEvening = "answer a questionnaire"; _favouriteDrink = "beer"; @@ -366,7 +366,7 @@ bool Gyro::setFlag(char x) { bool Gyro::decreaseMoney(uint16 howmuchby) { _money -= howmuchby; if (_money < 0) { - _vm->_scrolls->displayScrollChain('Q', 2); // "You are now denariusless!" + _vm->_dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" _vm->_lucerna->gameOver(); return false; } else diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 539bb40ed8..34ba7c11c1 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -30,7 +30,7 @@ #include "avalanche/avalanche.h" #include "avalanche/lucerna.h" #include "avalanche/gyro.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/background.h" @@ -70,8 +70,8 @@ void Clock::update() { // TODO: Move variables from Gyro to here (or at least so if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) { Common::String tmpStr = Common::String::format("Good morning!%c%cYes, it's just past " \ "midnight. Are you having an all-night Avvy session? Glad you like the game that much!", - Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); } _oldHour = _hour; _oldHourAngle = _hourAngle; @@ -148,7 +148,7 @@ void Lucerna::callVerb(byte id) { Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ "situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ "what the current setting of this key is."); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } else { _vm->_gyro->_weirdWord = false; _vm->_acci->_polite = true; @@ -606,12 +606,12 @@ void Lucerna::enterRoom(byte room, byte ped) { zoomOut(_vm->_gyro->_peds[ped]._x, _vm->_gyro->_peds[ped]._y); if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { - _vm->_scrolls->displayScrollChain('q', 9); // Don't want to waste the wine! + _vm->_dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; refreshObjectList(); } - _vm->_scrolls->displayScrollChain('q', 69); + _vm->_dialogs->displayScrollChain('q', 69); break; case kRoomCatacombs: @@ -1117,7 +1117,7 @@ void Lucerna::checkClick() { } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) - _vm->_gyro->_mouseText.insertChar(Scrolls::kControlNewLine, 0); + _vm->_gyro->_mouseText.insertChar(Dialogs::kControlNewLine, 0); } else if (!_vm->_gyro->_dropsOk) _vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; } @@ -1218,7 +1218,7 @@ void Lucerna::spriteRun() { void Lucerna::fixFlashers() { _vm->_gyro->_ledStatus = 177; _vm->_animation->_oldDirection = 177; - _vm->_scrolls->setReadyLight(2); + _vm->_dialogs->setReadyLight(2); drawDirection(); } diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index be8a103f66..f044a41071 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -15,7 +15,7 @@ MODULE_OBJS = \ menu.o \ parser.o \ pingo.o \ - scrolls.o \ + dialogs.o \ sequence.o \ sound.o \ timer.o diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 7196f46687..95e15e599f 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -33,7 +33,7 @@ #include "avalanche/gyro.h" #include "avalanche/lucerna.h" #include "avalanche/animation.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "common/textconsole.h" #include "common/file.h" diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp deleted file mode 100644 index e5d08ecfc6..0000000000 --- a/engines/avalanche/scrolls.cpp +++ /dev/null @@ -1,1087 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - - /* SCROLLS The scroll driver. */ - -#include "avalanche/avalanche.h" -#include "avalanche/scrolls.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h" -#include "avalanche/animation.h" -#include "avalanche/acci.h" -#include "avalanche/timer.h" - -#include "common/textconsole.h" -#include "common/file.h" - -namespace Avalanche { - -Scrolls::Scrolls(AvalancheEngine *vm) { - _vm = vm; - _noError = true; -} - -void Scrolls::init() { - loadFont(); - resetScrollDriver(); -} - -void Scrolls::setReadyLight(byte state) { // Sets "Ready" light to whatever - if (_vm->_gyro->_ledStatus == state) - return; // Already like that! - - byte color = kColorBlack; - switch (state) { - case 0: - color = kColorBlack; - break; // Off - case 1: - case 2: - case 3: - color = kColorGreen; - break; // Hit a key - } - warning("STUB: Scrolls::state()"); - - CursorMan.showMouse(false); - - _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); - - CursorMan.showMouse(true); - _vm->_gyro->_ledStatus = state; -} - -void Scrolls::easterEgg() { - warning("STUB: Scrolls::easterEgg()"); -} - -void Scrolls::say(int16 x, int16 y, Common::String z) { - FontType itw; - byte lz = z.size(); - - bool offset = x % 8 == 4; - x /= 8; - y++; - int16 i = 0; - for (int xx = 0; xx < lz; xx++) { - switch (z[xx]) { - case kControlRoman: - _currentFont = kFontStyleRoman; - break; - case kControlItalic: - _currentFont = kFontStyleItalic; - break; - default: { - for (int yy = 0; yy < 12; yy++) - itw[(byte)z[xx]][yy] = _scrollFonts[_currentFont][(byte)z[xx]][yy + 2]; - - // We have to draw the characters one-by-one because of the accidental font changes. - i++; - Common::String chr(z[xx]); - _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, kColorBlack); - } - } - } -} - -void Scrolls::scrollModeNormal() { - // Original code is: - // egg : array[1..8] of char = ^P^L^U^G^H+'***'; - // this is not using kControl characters: it's the secret code to be entered to trigger the easter egg - // TODO: To be fixed when the Easter egg code is implemented - Common::String egg = Common::String::format("%c%c%c%c%c***", kControlParagraph, kControlLeftJustified, kControlNegative, kControlBell, kControlBackspace); - Common::String e = "(c) 1994"; - - setReadyLight(3); - _vm->_gyro->_seeScroll = true; - _vm->_gyro->newMouse(3); - - ::Graphics::Surface temp; - temp.copyFrom(_vm->_graphics->_surface); - _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! - - Common::Event event; - while (!_vm->shouldQuit()) { - _vm->_graphics->refreshScreen(); - - _vm->getEvent(event); - if (_vm->shouldQuit() || - (event.type == Common::EVENT_LBUTTONUP) || - ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) - || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) - || (event.kbd.keycode == Common::KEYCODE_PLUS)))) - break; - } - - _vm->_graphics->_surface.copyFrom(temp); - temp.free(); - - warning("STUB: scrollModeNormal() - Check Easter Egg trigger"); -#if 0 - char r; - bool oktoexit; - do { - do { - _vm->_gyro->check(); // was "checkclick;" - -//#ifdef RECORD slowdown(); basher::count += 1; #endif - - if (_vm->_enhanced->keypressede()) - break; - } while (!((mrelease > 0) || (buttona1()) || (buttonb1()))); - - - if (mrelease == 0) { - inkey(); - if (aboutscroll) { - move(e[2 - 1], e[1 - 1], 7); - e[8 - 1] = inchar; - if (egg == e) - easteregg(); - } - oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); - if (!oktoexit) errorled(); - } - - } while (!((oktoexit) || (mrelease > 0))); - -//#ifdef RECORD record_one(); #endif - - _vm->_gyro->screturn = r == '#'; // "back door" -#endif - - setReadyLight(0); - _vm->_gyro->_seeScroll = false; - _vm->_lucerna->_holdLeftMouse = false; // Used in Lucerna::checkclick(). - - warning("STUB: Scrolls::scrollModeNormal()"); -} - -void Scrolls::scrollModeDialogue() { - warning("STUB: Scrolls::scrollModeDialogue()"); -} - -void Scrolls::store(byte what, TuneType &played) { - memcpy(played, played + 1, sizeof(played) - 1); - played[30] = what; -} - -bool Scrolls::theyMatch(TuneType &played) { - byte mistakes = 0; - - for (unsigned int i = 0; i < sizeof(played); i++) { - if (played[i] != _vm->_gyro->kTune[i]) - mistakes += 1; - } - - return mistakes < 5; -} - -void Scrolls::scrollModeMusic() { - setReadyLight(3); - _vm->_gyro->_seeScroll = true; - CursorMan.showMouse(false); - _vm->_gyro->newMouse(3); - - TuneType played; - for (unsigned int i = 0; i < sizeof(played); i++) - played[i] = Gyro::kPitchInvalid; - int8 lastOne = -1, thisOne = -1; // Invalid values. - - _vm->_gyro->_seeScroll = true; - - ::Graphics::Surface temp; - temp.copyFrom(_vm->_graphics->_surface); - _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! - - Common::Event event; - while (!_vm->shouldQuit()) { - _vm->_graphics->refreshScreen(); - - _vm->getEvent(event); - - // When we stop playing? - if ((event.type == Common::EVENT_LBUTTONDOWN) || - ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_ESCAPE)))) { - break; - } - - // When we DO play: - if ((event.type == Common::EVENT_KEYDOWN) - && ((event.kbd.keycode == Common::KEYCODE_q) || (event.kbd.keycode == Common::KEYCODE_w) - || (event.kbd.keycode == Common::KEYCODE_e) || (event.kbd.keycode == Common::KEYCODE_r) - || (event.kbd.keycode == Common::KEYCODE_t) || (event.kbd.keycode == Common::KEYCODE_y) - || (event.kbd.keycode == Common::KEYCODE_u) || (event.kbd.keycode == Common::KEYCODE_i) - || (event.kbd.keycode == Common::KEYCODE_o) || (event.kbd.keycode == Common::KEYCODE_p) - || (event.kbd.keycode == Common::KEYCODE_LEFTBRACKET) || (event.kbd.keycode == Common::KEYCODE_RIGHTBRACKET))) { - byte value; - switch (event.kbd.keycode) { - case Common::KEYCODE_q: - value = 0; - break; - case Common::KEYCODE_w: - value = 1; - break; - case Common::KEYCODE_e: - value = 2; - break; - case Common::KEYCODE_r: - value = 3; - break; - case Common::KEYCODE_t: - value = 4; - break; - case Common::KEYCODE_y: - value = 5; - break; - case Common::KEYCODE_u: - value = 6; - break; - case Common::KEYCODE_i: - value = 7; - break; - case Common::KEYCODE_o: - value = 8; - break; - case Common::KEYCODE_p: - value = 9; - break; - case Common::KEYCODE_LEFTBRACKET: - value = 10; - break; - case Common::KEYCODE_RIGHTBRACKET: - value = 11; - break; - default: - break; - } - - lastOne = thisOne; - thisOne = value; - - _vm->_sound->playNote(_vm->_gyro->kNotes[thisOne], 100); - _vm->_system->delayMillis(200); - - if (!_vm->_gyro->_bellsAreRinging) { // These handle playing the right tune. - if (thisOne < lastOne) - store(Gyro::kPitchLower, played); - else if (thisOne == lastOne) - store(Gyro::kPitchSame, played); - else - store(Gyro::kPitchHigher, played); - } - - if (theyMatch(played)) { - setReadyLight(0); - _vm->_timer->addTimer(8, Timer::kProcJacquesWakesUp, Timer::kReasonJacquesWakingUp); - break; - } - } - } - - _vm->_graphics->_surface.copyFrom(temp); - temp.free(); - _vm->_gyro->_seeScroll = false; - CursorMan.showMouse(true); -} - -void Scrolls::resetScrollDriver() { - _vm->_gyro->_scrollBells = 0; - _currentFont = kFontStyleRoman; - _useIcon = 0; - _vm->_gyro->_interrogation = 0; // Always reset after a scroll comes up. -} - -void Scrolls::ringBell() { // Pussy's in the well. Who put her in? Little... - for (int i = 0; i < _vm->_gyro->_scrollBells; i++) - _vm->_lucerna->errorLed(); // Ring the bell "x" times. -} - -void Scrolls::dodgem() { - _dodgeCoord = _vm->getMousePos(); - g_system->warpMouse(_dodgeCoord.x, _vm->_gyro->_underScroll); // Move the pointer off the scroll. -} - -void Scrolls::unDodgem() { - Common::Point actCoord = _vm->getMousePos(); - if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_gyro->_underScroll)) - g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. -} - -void Scrolls::getIcon(int16 x, int16 y, byte which) { - Common::File file; - - if (!file.open("icons.avd")) - error("AVALANCHE: Scrolls: File not found: icons.avd"); - - which--; - file.seek(which * 426); - - byte *p = new byte[426]; - file.read(p, 426); - - //putimage(x, y, p, 0); - warning("STUB: Scrolls::getIcon()"); - - delete[] p; - file.close(); -} - -void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { - Common::File file; - Common::String filename = Common::String::format("%s.avd", fn.c_str()); - - if (!file.open(filename)) - error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); - -#if 0 - uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); - byte bit; - for (uint16 i = 1; i <= yl; i++) - for (bit = 0; bit <= 3; bit++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * st + (i * 80)], xl); - } - bit = getpixel(0, 0); -#endif - - warning("STUB: Scrolls::drawSign()"); - - file.close(); -} - -void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { - int16 lx = 0; - int16 ly = (_vm->_gyro->_scrollNum) * 6; - int16 ex; - for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { - ex = _vm->_gyro->_scroll[i].size() * 8; - if (lx < ex) - lx = ex; - } - int16 mx = 320; - int16 my = 100; // Getmaxx & getmaxy div 2, both. - lx /= 2; - ly -= 2; - - if ((1 <= _useIcon) && (_useIcon <= 34)) - lx += kHalfIconWidth; - - _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); - - CursorMan.showMouse(false); - - // The right corners of the scroll. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorLightgray); - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorLightgray); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorRed); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorRed); - - // The body of the scroll. - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), kColorLightgray); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly + 1), kColorLightgray); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly + 1), kColorLightgray); - - // The left corners of the scroll. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorDarkgray); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorRed); - _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my - ly, mx - lx - 31 + 15, my - ly, kColorRed); - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorDarkgray); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorRed); - _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my + ly, mx - lx - 31 + 15, my + ly, kColorRed); - - // The rear borders of the scroll. - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5), kColorRed); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), kColorRed); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), kColorRed); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); - - mx -= lx; - my -= ly + 2; - - bool centre = false; - - byte iconIndent = 0; - switch (_useIcon) { - case 0: - iconIndent = 0; - break; // No icon. - case 34: - drawSign("about", 28, 76, 15); - iconIndent = 0; - break; - case 35: - drawSign("gameover", 52, 59, 71); - iconIndent = 0; - break; - } - - if ((1 <= _useIcon) && (_useIcon <= 33)) { // Standard icon. - getIcon(mx, my + ly / 2, _useIcon); - iconIndent = 53; - } - - for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { - if (!_vm->_gyro->_scroll[i].empty()) - switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { - case kControlCenter: - centre = true; - _vm->_gyro->_scroll[i].deleteLastChar(); - break; - case kControlLeftJustified: - centre = false; - _vm->_gyro->_scroll[i].deleteLastChar(); - break; - case kControlQuestion: - //settextjustify(1, 1); - _shadowBoxX = mx + lx; - _shadowBoxY = my + ly; - _vm->_gyro->_scroll[i].setChar(' ', 0); - // byte groi = *_vm->_graphics->getPixel(0, 0); - // inc(diy,14); - _vm->_gyro->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); - _vm->_gyro->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); - break; - } - - if (centre) - say(320 - _vm->_gyro->_scroll[i].size() * 4 + iconIndent, my, _vm->_gyro->_scroll[i]); - else - say(mx + iconIndent, my, _vm->_gyro->_scroll[i]); - - my += 12; - } - - _vm->_gyro->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. - ringBell(); - - _vm->_gyro->_dropsOk = false; - dodgem(); - - (this->*modeFunc)(); - - unDodgem(); - _vm->_gyro->_dropsOk = true; - - resetScrollDriver(); -} - -void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { - Common::Point points[3]; - - CursorMan.showMouse(false); - int16 xl = 0; - int16 yl = _vm->_gyro->_scrollNum * 5; - for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { - uint16 textWidth = _vm->_gyro->_scroll[i].size() * 8; - if (textWidth > xl) - xl = textWidth; - } - xl /= 2; - - int16 xw = xl + 18; - int16 yw = yl + 7; - int16 my = yw * 2 - 2; - int16 xc = 0; - - if ((_vm->_gyro->_talkX - xw) < 0) - xc = -(_vm->_gyro->_talkX - xw); - if ((_vm->_gyro->_talkX + xw) > 639) - xc = 639 - (_vm->_gyro->_talkX + xw); - - points[0].x = _vm->_gyro->_talkX - 10; - points[0].y = yw; - points[1].x = _vm->_gyro->_talkX + 10; - points[1].y = yw; - points[2].x = _vm->_gyro->_talkX; - points[2].y = _vm->_gyro->_talkY; - - // Backup the screen before drawing the bubble. - _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); - - // The body of the bubble. - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw + 9, 7, _vm->_gyro->_talkX + xw - 8 + xc, my + 1), _vm->_gyro->_talkBackgroundColor); - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw - 1, 12, _vm->_gyro->_talkX + xw + xc + 2, my - 4), _vm->_gyro->_talkBackgroundColor); - - // Top right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, 11, 0, 90, 9, _vm->_gyro->_talkBackgroundColor); - // Bottom right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_gyro->_talkBackgroundColor); - // Top left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, 11, 90, 180, 9, _vm->_gyro->_talkBackgroundColor); - // Bottom left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_gyro->_talkBackgroundColor); - - // "Tail" of the speech bubble. - _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_gyro->_talkBackgroundColor); - - - // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). - // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. - // It's almost the same, only notable differences are '?', '!', etc. - for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { - int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[i].size() / 2 * 8; - bool offset = _vm->_gyro->_scroll[i].size() % 2; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[i], _vm->_gyro->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_gyro->_talkFontColor); - } - - ringBell(); - CursorMan.showMouse(false); - _vm->_gyro->_dropsOk = false; - - // This does the actual drawing to the screen. - (this->*modeFunc)(); - - _vm->_gyro->_dropsOk = true; - CursorMan.showMouse(true); // sink; - resetScrollDriver(); -} - -bool Scrolls::displayQuestion(Common::String question) { - warning("STUB: Scrolls::displayQuestion()"); - return true; -} - -void Scrolls::resetScroll() { - _vm->_gyro->_scrollNum = 1; - for (int i = 0; i < 15; i++) { - if (!_vm->_gyro->_scroll[i].empty()) - _vm->_gyro->_scroll[i].clear(); - } -} - -void Scrolls::setBubbleStateNatural() { - _vm->_gyro->_talkX = 320; - _vm->_gyro->_talkY = 200; - _vm->_gyro->_talkBackgroundColor = 8; - _vm->_gyro->_talkFontColor = 15; -} - -Common::String Scrolls::displayMoney() { - Common::String result; - - if (_vm->_gyro->_money < 12) { // just pence - result = Common::String::format("%dd", _vm->_gyro->_money); - } else if (_vm->_gyro->_money < 240) { // shillings & pence - if ((_vm->_gyro->_money % 12) == 0) - result = Common::String::format("%d/-", _vm->_gyro->_money / 12); - else - result = Common::String::format("%d/%d", _vm->_gyro->_money / 12, _vm->_gyro->_money % 12); - } else { // L, s & d - result = Common::String::format("\x9C%d.%d.%d", _vm->_gyro->_money / 240, (_vm->_gyro->_money / 12) % 20, - _vm->_gyro->_money % 12); - } - if (_vm->_gyro->_money > 12) { - Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_gyro->_money); - result += extraStr; - } - - return result; -} - -void Scrolls::stripTrailingSpaces(Common::String &str) { - while (str[str.size() - 1] == ' ') - str.deleteLastChar(); -} - -void Scrolls::solidify(byte n) { - if (!_vm->_gyro->_scroll[n].contains(' ')) - return; // No spaces. - - // So there MUST be a space there, somewhere... - do { - _vm->_gyro->_scroll[n + 1] = _vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] + _vm->_gyro->_scroll[n + 1]; - _vm->_gyro->_scroll[n].deleteLastChar(); - } while (_vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] != ' '); - - stripTrailingSpaces(_vm->_gyro->_scroll[n]); -} - -void Scrolls::callScrollDriver() { -// bool was_virtual; // Was the mouse cursor virtual on entry to this proc? - warning("STUB: Scrolls::calldrivers()"); - - _vm->_sound->stopSound(); - - setReadyLight(0); - _vm->_gyro->_scReturn = false; - bool mouthnext = false; - bool call_spriterun = true; // Only call sprite_run the FIRST time. - - switch (_vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1]) { - case kControlToBuffer: - _vm->_gyro->_bufSize--; - break; // ^D = (D)on't include pagebreak - case kControlSpeechBubble: - case kControlQuestion: - break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box - default: - _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = kControlParagraph; - _vm->_gyro->_bufSize++; - } - - uint16 size = _vm->_gyro->_bufSize; - - for (uint16 i = 0; i < size; i++) { - if (mouthnext) { - if (_vm->_gyro->_buffer[i] == kControlRegister) - _param = 0; - else if (('0' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= '9')) - _param = _vm->_gyro->_buffer[i] - 48; - else if (('A' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= 'Z')) - _param = _vm->_gyro->_buffer[i] - 55; - - mouthnext = false; - } else { - switch (_vm->_gyro->_buffer[i]) { - case kControlParagraph: - if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) - break; - - if (call_spriterun) - _vm->_lucerna->spriteRun(); - call_spriterun = false; - - drawScroll(&Avalanche::Scrolls::scrollModeNormal); - - resetScroll(); - - if (_vm->_gyro->_scReturn) - return; - break; - case kControlBell: - _vm->_gyro->_scrollBells++; - break; // #7 = "Bel" - case kControlSpeechBubble: - if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) - break; - - if (call_spriterun) - _vm->_lucerna->spriteRun(); - call_spriterun = false; - - if (_param == 0) - setBubbleStateNatural(); - else if ((1 <= _param) && (_param <= 9)) { - AnimationType *spr = &_vm->_animation->_sprites[_param - 1]; - if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. - _vm->_lucerna->errorLed(); - setBubbleStateNatural(); - } else - spr->chatter(); // Normal sprite talking routine. - } else if ((10 <= _param) && (_param <= 36)) { - // Quasi-peds. (This routine performs the same - // thing with QPs as triptype.chatter does with the - // sprites.) - PedType *quasiPed = &_vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed]; - _vm->_gyro->_talkX = quasiPed->_x; - _vm->_gyro->_talkY = quasiPed->_y; // Position. - - _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[_param - 10]._foregroundColor; - _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[_param - 10]._backgroundColor; // Colors. - } else { - _vm->_lucerna->errorLed(); // Not valid. - setBubbleStateNatural(); - } - - drawBubble(&Avalanche::Scrolls::scrollModeNormal); - - resetScroll(); - - if (_vm->_gyro->_scReturn) - return; - break; - - // CHECME: The whole kControlNegative block seems completely unused, as the only use (the easter egg check) is a false positive - case kControlNegative: - switch (_param) { - case 1: - displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) - break; - case 2: { - int pwdId = _vm->_acci->kFirstPassword + _vm->_gyro->_passwordNum; - displayText(_vm->_acci->_vocabulary[pwdId]._word + kControlToBuffer); - } - break; - case 3: - displayText(_vm->_gyro->_favouriteDrink + kControlToBuffer); - break; - case 4: - displayText(_vm->_gyro->_favouriteSong + kControlToBuffer); - break; - case 5: - displayText(_vm->_gyro->_worstPlaceOnEarth + kControlToBuffer); - break; - case 6: - displayText(_vm->_gyro->_spareEvening + kControlToBuffer); - break; - case 9: { - Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_gyro->_catacombX, _vm->_gyro->_catacombY, kControlToBuffer); - displayText(tmpStr); - } - break; - case 10: - switch (_vm->_gyro->_boxContent) { - case 0: // Sixpence. - _vm->_scrolls->displayScrollChain('q', 37); // You find the sixpence. - _vm->_gyro->_money += 6; - _vm->_gyro->_boxContent = _vm->_acci->kNothing; - _vm->_lucerna->incScore(2); - return; - case Acci::kNothing: - displayText("nothing at all. It's completely empty."); - break; - default: - displayText(_vm->_gyro->getItem(_vm->_gyro->_boxContent) + '.'); - } - break; - case 11: - for (int j = 0; j < kObjectNum; j++) { - if (_vm->_gyro->_objects[j]) - displayText(_vm->_gyro->getItem(j) + ", " + kControlToBuffer); - } - break; - } - break; - case kControlIcon: - _useIcon = _param; - break; - case kControlNewLine: - _vm->_gyro->_scrollNum++; - break; - case kControlQuestion: - if (call_spriterun) - _vm->_lucerna->spriteRun(); - call_spriterun = false; - - _vm->_gyro->_scroll[_vm->_gyro->_scrollNum] = kControlQuestion; - _vm->_gyro->_scrollNum++; - - drawScroll(&Avalanche::Scrolls::scrollModeDialogue); - resetScroll(); - break; - case kControlRegister: - mouthnext = true; - break; - case kControlInsertSpaces: - for (int j = 0; j < 9; j++) - _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; - break; - default: // Add new char. - if (_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1].size() == 50) { - solidify(_vm->_gyro->_scrollNum - 1); - _vm->_gyro->_scrollNum++; - } - _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += _vm->_gyro->_buffer[i]; - break; - } - } - } -} - -void Scrolls::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! - _vm->_gyro->_bufSize = text.size(); - memcpy(_vm->_gyro->_buffer, text.c_str(), _vm->_gyro->_bufSize); - callScrollDriver(); -} - -void Scrolls::loadFont() { - Common::File file; - - if (!file.open("avalot.fnt")) - error("AVALANCHE: Scrolls: File not found: avalot.fnt"); - - for (int16 i = 0; i < 256; i++) - file.read(_scrollFonts[0][i], 16); - file.close(); - - if (!file.open("avitalic.fnt")) - error("AVALANCHE: Scrolls: File not found: avitalic.fnt"); - - for (int16 i = 0; i < 256; i++) - file.read(_scrollFonts[1][i], 16); - file.close(); - - if (!file.open("ttsmall.fnt")) - error("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); - - for (int16 i = 0; i < 256; i++) - file.read(_vm->_gyro->_font[i],16); - file.close(); -} - -void Scrolls::musicalScroll() { - Common::String tmpStr = Common::String::format("To play the harp...%c%cUse these keys:%c%cQ W E R T Y U I O P [ ]%c%cOr press Enter to stop playing.%c", - kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer); - displayText(tmpStr); - - _vm->_lucerna->spriteRun(); - CursorMan.showMouse(false); - drawScroll(&Avalanche::Scrolls::scrollModeMusic); - CursorMan.showMouse(true); - resetScroll(); -} - -// From Visa: - -void Scrolls::unSkrimble() { - for (uint16 i = 0; i < _vm->_gyro->_bufSize; i++) - _vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; -} - -void Scrolls::doTheBubble() { - _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = 2; - _vm->_gyro->_bufSize++; -} - -/** - * Display a string in a scroll - * @remarks Originally called 'dixi' - */ -void Scrolls::displayScrollChain(char block, byte point, bool report, bool bubbling) { - Common::File indexfile; - if (!indexfile.open("avalot.idx")) - error("AVALANCHE: Visa: File not found: avalot.idx"); - - bool error = false; - - indexfile.seek((toupper(block) - 65) * 2); - uint16 idx_offset = indexfile.readUint16LE(); - if (idx_offset == 0) - error = true; - - indexfile.seek(idx_offset + point * 2); - uint16 sez_offset = indexfile.readUint16LE(); - if (sez_offset == 0) - error = true; - - indexfile.close(); - - _noError = !error; - - if (error) { - if (report) { - Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", Scrolls::kControlBell, block, point); - _vm->_scrolls->displayText(todisplay); - } - return; - } - - Common::File sezfile; - if (!sezfile.open("avalot.sez")) - ::error("AVALANCHE: Visa: File not found: avalot.sez"); - - sezfile.seek(sez_offset); - _vm->_gyro->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); - sezfile.close(); - unSkrimble(); - - if (bubbling) - doTheBubble(); - - _vm->_scrolls->callScrollDriver(); -} - -/** - * Start speech - * @remarks Originally called 'speech' - */ -void Scrolls::speak(byte who, byte subject) { - if (subject == 0) { // No subject. - displayScrollChain('s', who, false, true); - return; - } - - // Subject given. - _noError = false; // Assume that until we know otherwise. - - Common::File indexfile; - if (!indexfile.open("converse.avd")) - error("AVALANCHE: Visa: File not found: converse.avd"); - - indexfile.seek(who * 2 - 2); - uint16 idx_offset = indexfile.readUint16LE(); - uint16 next_idx_offset = indexfile.readUint16LE(); - - if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) - return; - - indexfile.seek(idx_offset + subject * 2); - uint16 sez_offset = indexfile.readUint16LE(); - if ((sez_offset == 0) || (indexfile.err())) - return; - indexfile.close(); - - Common::File sezfile; - if (!sezfile.open("avalot.sez")) - error("AVALANCHE: Visa: File not found: avalot.sez"); - - sezfile.seek(sez_offset); - _vm->_gyro->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); - sezfile.close(); - - unSkrimble(); - doTheBubble(); - - _vm->_scrolls->callScrollDriver(); - _noError = true; -} - -void Scrolls::talkTo(byte whom) { - if (_vm->_acci->_person == _vm->_acci->kPardon) { - _vm->_acci->_person = _vm->_gyro->_subjectNum; - _vm->_gyro->_subjectNum = 0; - } - - if (_vm->_gyro->_subjectNum == 0) { - switch (whom) { - case Gyro::kPeopleSpludwick: - if ((_vm->_gyro->_lustieIsAsleep) & (!_vm->_gyro->_objects[Gyro::kObjectPotion - 1])) { - displayScrollChain('q', 68); - _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_lucerna->incScore(3); - return; - } else if (_vm->_gyro->_talkedToCrapulus) { - // Spludwick - what does he need? - // 0 - let it through to use normal routine. - switch (_vm->_gyro->_givenToSpludwick) { - case 1: // Fallthrough is intended. - case 2: { - Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); - Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); - } - return; - case 3: - displayScrollChain('q', 30); // Need any help with the game? - return; - } - } else { - displayScrollChain('q', 42); // Haven't talked to Crapulus. Go and talk to him. - return; - } - break; - case Gyro::kPeopleIbythneth: - if (_vm->_gyro->_givenBadgeToIby) { - displayScrollChain('q', 33); // Thanks a lot! - return; // And leave the proc. - } - break; // Or... just continue, 'cos he hasn't got it. - case Gyro::kPeopleDogfood: - if (_vm->_gyro->_wonNim) { // We've won the game. - displayScrollChain('q', 6); // "I'm Not Playing!" - return; // Zap back. - } else - _vm->_gyro->_askedDogfoodAboutNim = true; - break; - case Gyro::kPeopleAyles: - if (!_vm->_gyro->_aylesIsAwake) { - displayScrollChain('q', 43); // He's fast asleep! - return; - } else if (!_vm->_gyro->_givenPenToAyles) { - displayScrollChain('q', 44); // Can you get me a pen, Avvy? - return; - } - break; - - case Gyro::kPeopleJacques: - displayScrollChain('q', 43); - return; - - case Gyro::kPeopleGeida: - if (_vm->_gyro->_givenPotionToGeida) - _vm->_gyro->_geidaFollows = true; - else { - displayScrollChain('u', 17); - return; - } - break; - case Gyro::kPeopleSpurge: - if (!_vm->_gyro->_sittingInPub) { - displayScrollChain('q', 71); // Try going over and sitting down. - return; - } else { - if (_vm->_gyro->_spurgeTalkCount < 5) - _vm->_gyro->_spurgeTalkCount++; - if (_vm->_gyro->_spurgeTalkCount > 1) { // no. 1 falls through - displayScrollChain('q', 70 + _vm->_gyro->_spurgeTalkCount); - return; - } - } - break; - } - // On a subject. Is there any reason to block it? - } else if ((whom == Gyro::kPeopleAyles) && (!_vm->_gyro->_aylesIsAwake)) { - displayScrollChain('q', 43); // He's fast asleep! - return; - } - - if (whom > 149) - whom -= 149; - - bool noMatches = true; - for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { - Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, i + 49, Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - noMatches = false; - break; - } - } - - if (noMatches) { - Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, Scrolls::kControlRegister, Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } - - speak(whom, _vm->_gyro->_subjectNum); - - if (!_noError) - displayScrollChain('n', whom); // File not found! - - if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == Gyro::kPeopleCrapulus)) { // Crapulus: get the badge - first time only - _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = true; - _vm->_lucerna->refreshObjectList(); - displayScrollChain('q', 1); // Circular from Cardiff. - _vm->_gyro->_talkedToCrapulus = true; - _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. - - AnimationType *spr = &_vm->_animation->_sprites[1]; - spr->_vanishIfStill = true; - spr->walkTo(2); // Walks away. - - _vm->_lucerna->incScore(2); - } -} - -} // End of namespace Avalanche diff --git a/engines/avalanche/scrolls.h b/engines/avalanche/scrolls.h deleted file mode 100644 index a8938a5d34..0000000000 --- a/engines/avalanche/scrolls.h +++ /dev/null @@ -1,133 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - - /* SCROLLS The scroll driver. */ - -#ifndef AVALANCHE_SCROLLS2_H -#define AVALANCHE_SCROLLS2_H - -#include "common/system.h" - -namespace Avalanche { -class AvalancheEngine; - -class Scrolls; - -typedef void (Scrolls::*ScrollsFunctionType)(); - -class Scrolls { -public: - // Constants to replace the command characters from Pascal. - // For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers - enum ControlCharacter { - kControlSpeechBubble = 2, // ^B - kControlCenter = 3, // ^C - kControlToBuffer = 4, // ^D - kControlItalic = 6, // ^F - kControlBell = 7, // ^G - kControlBackspace = 8, // ^H - kControlInsertSpaces = 9, // ^I - kControlLeftJustified = 12, // ^L - kControlNewLine = 13, // ^M - kControlParagraph = 16, // ^P - kControlQuestion = 17, // ^Q - kControlRoman = 18, // ^R - kControlRegister = 19, // ^S - kControlNegative = 21, // ^U - kControlIcon = 22 // ^V - }; - - bool _aboutScroll; // Is this the about box? - FontType _scrollFonts[2]; - - Scrolls(AvalancheEngine *vm); - - void init(); - void setReadyLight(byte state); // Sets "Ready" light to whatever. - void drawScroll(ScrollsFunctionType modeFunc); - void drawBubble(ScrollsFunctionType modeFunc); - void resetScroll(); - void callScrollDriver(); - void displayText(Common::String text); - bool displayQuestion(Common::String question); - void setBubbleStateNatural(); // Natural state of bubbles - Common::String displayMoney(); - void musicalScroll(); // Practically this one is a mini-game which called when you play the harp in the monastery. - - // From Visa: - void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); - void talkTo(byte whom); - -private: - AvalancheEngine *_vm; - - enum FontStyle { - kFontStyleRoman, - kFontStyleItalic - }; - - static const int16 kHalfIconWidth = 19; // Half the width of an icon. - - int16 _shadowBoxX, _shadowBoxY; - byte _currentFont; // Current font - Common::Point _dodgeCoord; - byte _param; // For using arguments code - byte _useIcon; - - // These 3 functions are always passed as ScrollsFunctionType parameters. - void scrollModeNormal(); - void scrollModeDialogue(); - void scrollModeMusic(); - - // These 2 are used only in musicalScroll(). - void store(byte what, TuneType &played); - bool theyMatch(TuneType &played); - - void stripTrailingSpaces(Common::String &str); // Original: strip. - void solidify(byte n); // Does the word wrapping. - - void dodgem(); // This moves the mouse pointer off the scroll so that you can read it. - void unDodgem(); // This is the opposite of Dodgem. It moves the mouse pointer back, IF you haven't moved it in the meantime. - - void easterEgg(); - void say(int16 x, int16 y, Common::String text); - void resetScrollDriver(); - void ringBell(); // Original: dingdongbell - void getIcon(int16 x, int16 y, byte which); - void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. - void loadFont(); - - // From Visa: - bool _noError; - void unSkrimble(); - void doTheBubble(); - void speak(byte who, byte subject); -}; - -} // End of namespace Avalanche - -#endif // AVALANCHE_SCROLLS2_H diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 9f51e2a734..c76c9892df 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -31,7 +31,7 @@ #include "avalanche/timer.h" #include "avalanche/lucerna.h" #include "avalanche/animation.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/acci.h" #include "avalanche/sequence.h" #include "avalanche/pingo.h" @@ -240,7 +240,7 @@ void Timer::openDrawbridge() { } void Timer::avariciusTalks() { - _vm->_scrolls->displayScrollChain('q', _vm->_gyro->_avariciusTalk); + _vm->_dialogs->displayScrollChain('q', _vm->_gyro->_avariciusTalk); _vm->_gyro->_avariciusTalk++; if (_vm->_gyro->_avariciusTalk < 17) @@ -257,17 +257,17 @@ void Timer::urinate() { } void Timer::toilet() { - _vm->_scrolls->displayText("That's better!"); + _vm->_dialogs->displayText("That's better!"); } void Timer::bang() { - Common::String tmpStr = Common::String::format("%c< BANG! >", Scrolls::kControlItalic); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%c< BANG! >", Dialogs::kControlItalic); + _vm->_dialogs->displayText(tmpStr); addTimer(30, kProcBang2, kReasonExplosion); } void Timer::bang2() { - _vm->_scrolls->displayText("Hmm... sounds like Spludwick's up to something..."); + _vm->_dialogs->displayText("Hmm... sounds like Spludwick's up to something..."); } void Timer::stairs() { @@ -283,25 +283,25 @@ void Timer::stairs() { void Timer::cardiffSurvey() { if (_vm->_gyro->_cardiffQuestionNum == 0) { _vm->_gyro->_cardiffQuestionNum++; - _vm->_scrolls->displayScrollChain('q', 27); + _vm->_dialogs->displayScrollChain('q', 27); } - _vm->_scrolls->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); + _vm->_dialogs->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); _vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } void Timer::cardiffReturn() { - _vm->_scrolls->displayScrollChain('q', 28); + _vm->_dialogs->displayScrollChain('q', 28); cardiffSurvey(); // Add end of question. } void Timer::cwytalotInHerts() { - _vm->_scrolls->displayScrollChain('q', 29); + _vm->_dialogs->displayScrollChain('q', 29); } void Timer::getTiedUp() { - _vm->_scrolls->displayScrollChain('q', 34); // ...Trouble! + _vm->_dialogs->displayScrollChain('q', 34); // ...Trouble! _vm->_gyro->_userMovesAvvy = false; _vm->_gyro->_beenTiedUp = true; _vm->_animation->stopWalking(); @@ -328,18 +328,18 @@ void Timer::hangAround() { avvy->init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = kRoomRobins; _vm->_animation->appearPed(0, 1); - _vm->_scrolls->displayScrollChain('q', 39); + _vm->_dialogs->displayScrollChain('q', 39); avvy->walkTo(6); addTimer(55, kProcHangAround2, kReasonHangingAround); } void Timer::hangAround2() { - _vm->_scrolls->displayScrollChain('q', 40); + _vm->_dialogs->displayScrollChain('q', 40); AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(3); _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = kRoomRobins; - _vm->_scrolls->displayScrollChain('q', 41); + _vm->_dialogs->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -362,8 +362,8 @@ void Timer::afterTheShootemup() { _vm->_lucerna->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! - _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") - + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); + _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") + + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Peter (uruk)"); #if 0 byte shootscore, gain; @@ -383,7 +383,7 @@ void Timer::afterTheShootemup() { warning("STUB: Timer::after_the_shootemup()"); - _vm->_scrolls->displayScrollChain('q', 70); + _vm->_dialogs->displayScrollChain('q', 70); } void Timer::jacquesWakesUp() { @@ -392,7 +392,7 @@ void Timer::jacquesWakesUp() { switch (_vm->_gyro->_jacquesState) { // Additional pictures. case 1 : _vm->_background->drawBackgroundSprite(-1, -1, 0); // Eyes open. - _vm->_scrolls->displayScrollChain('Q', 45); + _vm->_dialogs->displayScrollChain('Q', 45); break; case 2 : // Going through the door. _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor. @@ -440,7 +440,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon void Timer::naughtyDuke2() { AnimationType *spr = &_vm->_animation->_sprites[1]; - _vm->_scrolls->displayScrollChain('q', 48); // "Ha ha, it worked again!" + _vm->_dialogs->displayScrollChain('q', 48); // "Ha ha, it worked again!" spr->walkTo(0); // Walk to the door. spr->_vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); @@ -487,20 +487,20 @@ void Timer::jump() { && (_vm->_animation->inField(2))) { // Beside the wall // Grab the arrow! if (_vm->_gyro->_carryNum >= kCarryLimit) - _vm->_scrolls->displayText("You fail to grab it, because your hands are full."); + _vm->_dialogs->displayText("You fail to grab it, because your hands are full."); else { _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_arrowInTheDoor = false; // You've got it. _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->displayScrollChain('q', 50); + _vm->_dialogs->displayScrollChain('q', 50); _vm->_lucerna->incScore(3); } } } void Timer::crapulusSaysSpludOut() { - _vm->_scrolls->displayScrollChain('q', 56); + _vm->_dialogs->displayScrollChain('q', 56); _vm->_gyro->_crapulusWillTell = false; } @@ -508,11 +508,11 @@ void Timer::buyDrinks() { _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; - _vm->_scrolls->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. + _vm->_dialogs->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. - _vm->_scrolls->displayScrollChain('D', 1); // That'll be thruppence. + _vm->_dialogs->displayScrollChain('D', 1); // That'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. - _vm->_scrolls->displayScrollChain('D', 3); // Tell 'em you paid up. + _vm->_dialogs->displayScrollChain('D', 3); // Tell 'em you paid up. _vm->_acci->drink(); } @@ -520,10 +520,10 @@ void Timer::buyWine() { _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; - _vm->_scrolls->displayScrollChain('D', 50); // You buy the wine. - _vm->_scrolls->displayScrollChain('D', 1); // It'll be thruppence. + _vm->_dialogs->displayScrollChain('D', 50); // You buy the wine. + _vm->_dialogs->displayScrollChain('D', 1); // It'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) { - _vm->_scrolls->displayScrollChain('D', 4); // You paid up. + _vm->_dialogs->displayScrollChain('D', 4); // You paid up. _vm->_gyro->_objects[Gyro::kObjectWine - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wineState = 1; // OK Wine. @@ -531,12 +531,12 @@ void Timer::buyWine() { } void Timer::callsGuards() { - _vm->_scrolls->displayScrollChain('Q', 58); // "GUARDS!!!" + _vm->_dialogs->displayScrollChain('Q', 58); // "GUARDS!!!" _vm->_lucerna->gameOver(); } void Timer::greetsMonk() { - _vm->_scrolls->displayScrollChain('Q', 59); + _vm->_dialogs->displayScrollChain('Q', 59); _vm->_gyro->_enteredLustiesRoomAsMonk = true; } @@ -551,11 +551,11 @@ void Timer::fallDownOubliette() { void Timer::meetAvaroid() { if (_vm->_gyro->_metAvaroid) { - Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); _vm->_lucerna->gameOver(); } else { - _vm->_scrolls->displayScrollChain('Q', 60); + _vm->_dialogs->displayScrollChain('Q', 60); _vm->_gyro->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); @@ -594,7 +594,7 @@ void Timer::robinHoodAndGeida() { } void Timer::robinHoodAndGeidaTalk() { - _vm->_scrolls->displayScrollChain('q', 66); + _vm->_dialogs->displayScrollChain('q', 66); AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -613,7 +613,7 @@ void Timer::avalotReturns() { spr->remove(); avvy->init(0, true, _vm->_animation); _vm->_animation->appearPed(0, 0); - _vm->_scrolls->displayScrollChain('q', 67); + _vm->_dialogs->displayScrollChain('q', 67); _vm->_gyro->_userMovesAvvy = true; } @@ -636,20 +636,20 @@ void Timer::avvySitDown() { void Timer::ghostRoomPhew() { Common::String tmpStr = Common::String::format("%cPHEW!%c You're glad to get out of %cthere!", - Scrolls::kControlItalic, Scrolls::kControlRoman, Scrolls::kControlItalic); - _vm->_scrolls->displayText(tmpStr); + Dialogs::kControlItalic, Dialogs::kControlRoman, Dialogs::kControlItalic); + _vm->_dialogs->displayText(tmpStr); } void Timer::arkataShouts() { if (_vm->_gyro->_teetotal) return; - _vm->_scrolls->displayScrollChain('q', 76); + _vm->_dialogs->displayScrollChain('q', 76); addTimer(160, kProcArkataShouts, kReasonArkataShouts); } void Timer::winning() { - _vm->_scrolls->displayScrollChain('q', 79); + _vm->_dialogs->displayScrollChain('q', 79); _vm->_pingo->winningPic(); warning("STUB: Timer::winning()"); @@ -661,7 +661,7 @@ void Timer::winning() { // TODO: To be implemented with Pingo::winningPic(). _vm->_lucerna->callVerb(Acci::kVerbCodeScore); - _vm->_scrolls->displayText(" T H E E N D "); + _vm->_dialogs->displayText(" T H E E N D "); _vm->_gyro->_letMeOut = true; } @@ -672,12 +672,12 @@ void Timer::avalotFalls() { addTimer(3, kProcAvalotFalls, kReasonFallingOver); } else { Common::String toDisplay = Common::String::format("%c%c%c%c%c%c%c%c%c%c%c%c%cZ%c", - Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, - Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, - Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, - Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, - Scrolls::kControlRegister, Scrolls::kControlIcon); - _vm->_scrolls->displayText(toDisplay); + Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, + Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, + Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, + Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, + Dialogs::kControlRegister, Dialogs::kControlIcon); + _vm->_dialogs->displayText(toDisplay); } } @@ -693,7 +693,7 @@ void Timer::spludwickLeavesCauldron() { } void Timer::giveLuteToGeida() { // Moved here from Acci. - _vm->_scrolls->displayScrollChain('Q', 86); + _vm->_dialogs->displayScrollChain('Q', 86); _vm->_lucerna->incScore(4); _vm->_gyro->_lustieIsAsleep = true; _vm->_sequence->firstShow(5); -- cgit v1.2.3