diff options
author | uruk | 2013-09-15 12:25:07 +0200 |
---|---|---|
committer | uruk | 2013-09-15 12:25:07 +0200 |
commit | ba05f95bb472af8530f70e62afd07a84ee273140 (patch) | |
tree | c109e067b20791f184718e9a895a20586cc677f5 /engines | |
parent | f7ee139501403e4f55d1a6fcbe5c421d3317cfa1 (diff) | |
download | scummvm-rg350-ba05f95bb472af8530f70e62afd07a84ee273140.tar.gz scummvm-rg350-ba05f95bb472af8530f70e62afd07a84ee273140.tar.bz2 scummvm-rg350-ba05f95bb472af8530f70e62afd07a84ee273140.zip |
AVALANCHE: Get rid of Visa. Move everything from it to Scrolls.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/avalanche/acci2.cpp | 173 | ||||
-rw-r--r-- | engines/avalanche/animation.cpp | 17 | ||||
-rw-r--r-- | engines/avalanche/avalanche.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/avalanche.h | 2 | ||||
-rw-r--r-- | engines/avalanche/avalot.cpp | 3 | ||||
-rw-r--r-- | engines/avalanche/gyro2.cpp | 3 | ||||
-rw-r--r-- | engines/avalanche/lucerna2.cpp | 5 | ||||
-rw-r--r-- | engines/avalanche/module.mk | 1 | ||||
-rw-r--r-- | engines/avalanche/scrolls2.cpp | 239 | ||||
-rw-r--r-- | engines/avalanche/scrolls2.h | 10 | ||||
-rw-r--r-- | engines/avalanche/timer.cpp | 57 | ||||
-rw-r--r-- | engines/avalanche/visa2.cpp | 281 | ||||
-rw-r--r-- | engines/avalanche/visa2.h | 56 |
13 files changed, 373 insertions, 476 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index bbbc04af61..1008a60157 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -33,7 +33,6 @@ #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" #include "avalanche/scrolls2.h" -#include "avalanche/visa2.h" #include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/enid2.h" @@ -576,7 +575,7 @@ void Acci::storeInterrogation(byte interrogation) { if (!_vm->_gyro->_spareEvening.empty()) _vm->_gyro->_spareEvening.clear(); _vm->_gyro->_spareEvening = _vm->_parser->_inputText; - _vm->_visa->displayScrollChain('z', 5); // His closing statement... + _vm->_scrolls->displayScrollChain('z', 5); // His closing statement... _vm->_animation->_sprites[1].walkTo(4); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; @@ -798,24 +797,24 @@ void Acci::examineObject() { case Gyro::kObjectWine : switch (_vm->_gyro->_wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: - _vm->_visa->displayScrollChain('t', 1); // Normal examine wine scroll + _vm->_scrolls->displayScrollChain('t', 1); // Normal examine wine scroll break; case 2: - _vm->_visa->displayScrollChain('d', 6); // Bad wine + _vm->_scrolls->displayScrollChain('d', 6); // Bad wine break; case 3: - _vm->_visa->displayScrollChain('d', 7); // Vinegar + _vm->_scrolls->displayScrollChain('d', 7); // Vinegar break; } break; case Gyro::kObjectOnion: if (_vm->_gyro->_rottenOnion) - _vm->_visa->displayScrollChain('q', 21); // Yucky onion. + _vm->_scrolls->displayScrollChain('q', 21); // Yucky onion. else - _vm->_visa->displayScrollChain('t', 18); // Normal onion scroll + _vm->_scrolls->displayScrollChain('t', 18); // Normal onion scroll break; default: - _vm->_visa->displayScrollChain('t', _thing); // <<< Ordinarily + _vm->_scrolls->displayScrollChain('t', _thing); // <<< Ordinarily } } @@ -841,24 +840,24 @@ void Acci::exampers() { switch (_person) { // Special cases case 11: if (_vm->_gyro->_wonNim) { - _vm->_visa->displayScrollChain('Q', 8); // "I'm Not Playing!" + _vm->_scrolls->displayScrollChain('Q', 8); // "I'm Not Playing!" return; } break; case 99: if (_vm->_gyro->_lustieIsAsleep) { - _vm->_visa->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) + _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) return; } break; } // Otherwise... - _vm->_visa->displayScrollChain('p', _person); + _vm->_scrolls->displayScrollChain('p', _person); } // And afterwards... if ((_person == 14) && (!_vm->_gyro->_aylesIsAwake)) - _vm->_visa->displayScrollChain('Q', 13); + _vm->_scrolls->displayScrollChain('Q', 13); } /** @@ -953,43 +952,43 @@ void Acci::swallow() { // Eat something. switch (_vm->_gyro->_wineState) { // 4 is perfect case 1: if (_vm->_gyro->_teetotal) { - _vm->_visa->displayScrollChain('D', 6); + _vm->_scrolls->displayScrollChain('D', 6); return; } - _vm->_visa->displayScrollChain('U', 1); + _vm->_scrolls->displayScrollChain('U', 1); _vm->_pingo->wobble(); - _vm->_visa->displayScrollChain('U', 2); + _vm->_scrolls->displayScrollChain('U', 2); _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; _vm->_lucerna->refreshObjectList(); drink(); break; case 2: case 3: - _vm->_visa->displayScrollChain('d', 8); + _vm->_scrolls->displayScrollChain('d', 8); break; // You can't drink it! } break; case Gyro::kObjectPotion: _vm->_gyro->setBackgroundColor(4); - _vm->_visa->displayScrollChain('U', 3); + _vm->_scrolls->displayScrollChain('U', 3); _vm->_lucerna->gameOver(); _vm->_gyro->setBackgroundColor(0); break; case Gyro::kObjectInk: - _vm->_visa->displayScrollChain('U', 4); + _vm->_scrolls->displayScrollChain('U', 4); break; case Gyro::kObjectChastity: - _vm->_visa->displayScrollChain('U', 5); + _vm->_scrolls->displayScrollChain('U', 5); break; case Gyro::kObjectMushroom: - _vm->_visa->displayScrollChain('U', 6); + _vm->_scrolls->displayScrollChain('U', 6); _vm->_lucerna->gameOver(); break; case Gyro::kObjectOnion: if (_vm->_gyro->_rottenOnion) - _vm->_visa->displayScrollChain('U', 11); + _vm->_scrolls->displayScrollChain('U', 11); else { - _vm->_visa->displayScrollChain('U', 8); + _vm->_scrolls->displayScrollChain('U', 8); _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; _vm->_lucerna->refreshObjectList(); } @@ -1040,34 +1039,34 @@ void Acci::lookAround() { switch (_vm->_gyro->_room) { case r__spludwicks: if (_vm->_gyro->_avariciusTalk > 0) - _vm->_visa->displayScrollChain('q', 23); + _vm->_scrolls->displayScrollChain('q', 23); else peopleInRoom(); break; case r__robins: if (_vm->_gyro->_tiedUp) - _vm->_visa->displayScrollChain('q', 38); + _vm->_scrolls->displayScrollChain('q', 38); if (_vm->_gyro->_mushroomGrowing) - _vm->_visa->displayScrollChain('q', 55); + _vm->_scrolls->displayScrollChain('q', 55); break; case r__insidecardiffcastle: if (!_vm->_gyro->_takenPen) - _vm->_visa->displayScrollChain('q', 49); + _vm->_scrolls->displayScrollChain('q', 49); break; case r__lustiesroom: if (_vm->_gyro->_lustieIsAsleep) - _vm->_visa->displayScrollChain('q', 65); + _vm->_scrolls->displayScrollChain('q', 65); break; case r__catacombs: switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { case 258 : - _vm->_visa->displayScrollChain('q', 80); // Inside art gallery. + _vm->_scrolls->displayScrollChain('q', 80); // Inside art gallery. break; case 514 : - _vm->_visa->displayScrollChain('q', 81); // Outside ditto. + _vm->_scrolls->displayScrollChain('q', 81); // Outside ditto. break; case 260 : - _vm->_visa->displayScrollChain('q', 82); // Outside Geida's room. + _vm->_scrolls->displayScrollChain('q', 82); // Outside Geida's room. break; } break; @@ -1090,7 +1089,7 @@ void Acci::openDoor() { break; case r__spludwicks: if (_thing == 61) { - _vm->_visa->displayScrollChain('q', 85); + _vm->_scrolls->displayScrollChain('q', 85); return; } break; @@ -1105,7 +1104,7 @@ void Acci::openDoor() { switch (portal->_operation) { case Gyro::kMagicExclaim: _vm->_animation->_sprites[0].bounce(); - _vm->_visa->displayScrollChain('x', portal->_data); + _vm->_scrolls->displayScrollChain('x', portal->_data); break; case Gyro::kMagicTransport: _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); @@ -1163,7 +1162,7 @@ void Acci::putProc() { } else { // Put onion into vinegar! Yes! _vm->_gyro->_onionInVinegar = true; _vm->_lucerna->incScore(7); - _vm->_visa->displayScrollChain('u', 9); + _vm->_scrolls->displayScrollChain('u', 9); } } } else @@ -1248,10 +1247,10 @@ bool Acci::giveToSpludwick() { case Gyro::kObjectOnion: _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; if (_vm->_gyro->_rottenOnion) - _vm->_visa->displayScrollChain('q', 22); + _vm->_scrolls->displayScrollChain('q', 22); else { _vm->_gyro->_givenToSpludwick++; - _vm->_visa->displayScrollChain('q', 20); + _vm->_scrolls->displayScrollChain('q', 20); goToCauldron(); _vm->_lucerna->incScore(3); } @@ -1261,13 +1260,13 @@ bool Acci::giveToSpludwick() { _vm->_gyro->_objects[Gyro::kObjectInk - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_givenToSpludwick++; - _vm->_visa->displayScrollChain('q', 24); + _vm->_scrolls->displayScrollChain('q', 24); goToCauldron(); _vm->_lucerna->incScore(3); break; case Gyro::kObjectMushroom: _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = false; - _vm->_visa->displayScrollChain('q', 25); + _vm->_scrolls->displayScrollChain('q', 25); _vm->_lucerna->incScore(5); _vm->_gyro->_givenToSpludwick++; goToCauldron(); @@ -1321,9 +1320,9 @@ void Acci::standUp() { case r__yours: // Avvy isn't asleep. if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) { // But he's in bed. if (_vm->_gyro->_teetotal) { - _vm->_visa->displayScrollChain('d', 12); + _vm->_scrolls->displayScrollChain('d', 12); _vm->_gyro->setBackgroundColor(0); - _vm->_visa->displayScrollChain('d', 14); + _vm->_scrolls->displayScrollChain('d', 14); } _vm->_animation->_sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; @@ -1372,7 +1371,7 @@ void Acci::getProc(char thing) { _vm->_scrolls->displayText(tmpStr); } } else - _vm->_visa->displayScrollChain('q', 57); + _vm->_scrolls->displayScrollChain('q', 57); break; case r__insidecardiffcastle: switch (thing) { @@ -1390,15 +1389,15 @@ void Acci::getProc(char thing) { _vm->_scrolls->displayText("Taken."); } } else if (_vm->_gyro->_standingOnDais) - _vm->_visa->displayScrollChain('q', 53); + _vm->_scrolls->displayScrollChain('q', 53); else - _vm->_visa->displayScrollChain('q', 51); + _vm->_scrolls->displayScrollChain('q', 51); break; case Gyro::kObjectBolt: - _vm->_visa->displayScrollChain('q', 52); + _vm->_scrolls->displayScrollChain('q', 52); break; default: - _vm->_visa->displayScrollChain('q', 57); + _vm->_scrolls->displayScrollChain('q', 57); } break; case r__robins: @@ -1411,10 +1410,10 @@ void Acci::getProc(char thing) { _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); } else - _vm->_visa->displayScrollChain('q', 57); + _vm->_scrolls->displayScrollChain('q', 57); break; default: - _vm->_visa->displayScrollChain('q', 57); + _vm->_scrolls->displayScrollChain('q', 57); } } @@ -1430,7 +1429,7 @@ void Acci::giveGeidaTheLute() { } _vm->_gyro->_objects[Gyro::kObjectLute - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_visa->displayScrollChain('q', 64); // She plays it. + _vm->_scrolls->displayScrollChain('q', 64); // She plays it. _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); _vm->_enid->backToBootstrap(4); @@ -1444,7 +1443,7 @@ void Acci::playHarp() { } void Acci::winSequence() { - _vm->_visa->displayScrollChain('q', 78); + _vm->_scrolls->displayScrollChain('q', 78); _vm->_sequence->firstShow(7); _vm->_sequence->thenShow(8); _vm->_sequence->thenShow(9); @@ -1576,10 +1575,10 @@ void Acci::doThat() { if ((_person == 0) || (_person == kPardon)) _vm->_scrolls->displayText("Talk to whom?"); else if (isPersonHere()) - _vm->_visa->talkTo(_person); + _vm->_scrolls->talkTo(_person); } } else if (isPersonHere()) - _vm->_visa->talkTo(_person); + _vm->_scrolls->talkTo(_person); break; case kVerbCodeGive: if (isHolding()) { @@ -1617,7 +1616,7 @@ void Acci::doThat() { break; case Gyro::kPeopleIbythneth: if (_thing == Gyro::kObjectBadge) { - _vm->_visa->displayScrollChain('q', 32); // Thanks! Wow! + _vm->_scrolls->displayScrollChain('q', 32); // Thanks! Wow! _vm->_lucerna->incScore(3); _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; @@ -1631,7 +1630,7 @@ void Acci::doThat() { if (_vm->_gyro->_aylesIsAwake) { if (_thing == Gyro::kObjectPen) { _vm->_gyro->_objects[Gyro::kObjectPen - 1] = false; - _vm->_visa->displayScrollChain('q', 54); + _vm->_scrolls->displayScrollChain('q', 54); _vm->_gyro->_objects[Gyro::kObjectInk - 1] = true; _vm->_gyro->_givenPenToAyles = true; _vm->_lucerna->refreshObjectList(); @@ -1645,7 +1644,7 @@ void Acci::doThat() { switch (_thing) { case Gyro::kObjectPotion: _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = false; - _vm->_visa->displayScrollChain('u', 16); // She drinks it. + _vm->_scrolls->displayScrollChain('u', 16); // She drinks it. _vm->_lucerna->incScore(2); _vm->_gyro->_givenPotionToGeida = true; _vm->_lucerna->refreshObjectList(); @@ -1663,7 +1662,7 @@ void Acci::doThat() { if (_vm->_gyro->_givenPotionToGeida) winSequence(); else - _vm->_visa->displayScrollChain('q', 77); // That Geida woman! + _vm->_scrolls->displayScrollChain('q', 77); // That Geida woman! break; default: heyThanks(); @@ -1788,20 +1787,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->_visa->displayScrollChain('Q', 6); + _vm->_scrolls->displayScrollChain('Q', 6); return; } if (!_vm->_gyro->_askedDogfoodAboutNim) { - _vm->_visa->displayScrollChain('q', 84); + _vm->_scrolls->displayScrollChain('q', 84); return; } - _vm->_visa->displayScrollChain('Q', 3); + _vm->_scrolls->displayScrollChain('Q', 3); _vm->_gyro->_playedNim++; // You won - strange! - _vm->_visa->displayScrollChain('Q', 7); // You won! Give us a lute! + _vm->_scrolls->displayScrollChain('Q', 7); // You won! Give us a lute! _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wonNim = true; @@ -1823,13 +1822,13 @@ void Acci::doThat() { } else if (isHolding()) { switch (_thing) { case Gyro::kObjectLute : - _vm->_visa->displayScrollChain('U', 7); + _vm->_scrolls->displayScrollChain('U', 7); if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room) - _vm->_visa->displayScrollChain('U', 10); + _vm->_scrolls->displayScrollChain('U', 10); if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_room) - _vm->_visa->displayScrollChain('U', 15); + _vm->_scrolls->displayScrollChain('U', 15); break; case 52: if (_vm->_gyro->_room == r__musicroom) @@ -1891,12 +1890,12 @@ void Acci::doThat() { break; case kVerbCodeMagic: if (_vm->_gyro->_avariciusTalk > 0) - _vm->_visa->displayScrollChain('q', 19); + _vm->_scrolls->displayScrollChain('q', 19); else { if ((_vm->_gyro->_room == 12) & (_vm->_animation->inField(2))) { // Avaricius appears! - _vm->_visa->displayScrollChain('q', 17); + _vm->_scrolls->displayScrollChain('q', 17); if (_vm->_gyro->_whereIs[1] == 12) - _vm->_visa->displayScrollChain('q', 18); + _vm->_scrolls->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(1, false, _vm->_animation); // Avaricius @@ -1956,12 +1955,12 @@ void Acci::doThat() { case 54: case 58: // Beer, whisky, cider or mead. if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_visa->displayScrollChain('D', 15); + _vm->_scrolls->displayScrollChain('D', 15); return; } if (_vm->_gyro->_teetotal) { - _vm->_visa->displayScrollChain('D', 6); + _vm->_scrolls->displayScrollChain('D', 6); return; } @@ -1981,10 +1980,10 @@ 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->_visa->displayScrollChain('D', 2); // 1 bottle's shufishent! + _vm->_scrolls->displayScrollChain('D', 2); // 1 bottle's shufishent! else { if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_visa->displayScrollChain('D', 15); + _vm->_scrolls->displayScrollChain('D', 15); return; } @@ -2006,21 +2005,21 @@ void Acci::doThat() { break; } } else - _vm->_visa->displayScrollChain('D', 5); // Go to the bar! + _vm->_scrolls->displayScrollChain('D', 5); // Go to the bar! break; case r__outsideducks: if (_vm->_animation->inField(6)) { if (_thing == Gyro::kObjectOnion) { if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) - _vm->_visa->displayScrollChain('D', 10); // Not planning to juggle with the things! + _vm->_scrolls->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."); else { if (_vm->_gyro->_boughtOnion) - _vm->_visa->displayScrollChain('D', 11); + _vm->_scrolls->displayScrollChain('D', 11); else { - _vm->_visa->displayScrollChain('D', 9); + _vm->_scrolls->displayScrollChain('D', 9); _vm->_lucerna->incScore(3); } _vm->_gyro->decreaseMoney(3); // It costs thruppence. @@ -2031,16 +2030,16 @@ void Acci::doThat() { _vm->_gyro->_onionInVinegar = false; } } else - _vm->_visa->displayScrollChain('D', 0); + _vm->_scrolls->displayScrollChain('D', 0); } else - _vm->_visa->displayScrollChain('D', 0); + _vm->_scrolls->displayScrollChain('D', 0); break; case r__nottspub: - _vm->_visa->displayScrollChain('n', 15); // Can't sell to southerners. + _vm->_scrolls->displayScrollChain('n', 15); // Can't sell to southerners. break; default: - _vm->_visa->displayScrollChain('D', 0); // Can't buy that. + _vm->_scrolls->displayScrollChain('D', 0); // Can't buy that. } break; case kVerbCodeAttack: @@ -2050,7 +2049,7 @@ 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->_visa->displayScrollChain('Q', 10); + _vm->_scrolls->displayScrollChain('Q', 10); _vm->_scrolls->displayText("(At the very least, don't use your bare hands!)"); break; case 1: @@ -2060,7 +2059,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: - _vm->_visa->displayScrollChain('Q', 11); + _vm->_scrolls->displayScrollChain('Q', 11); _vm->_gyro->_cwytalotGone = true; _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = false; _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = false; @@ -2073,14 +2072,14 @@ void Acci::doThat() { _vm->_gyro->_whereIs[7] = 177; break; default: - _vm->_visa->displayScrollChain('Q', 10); // Please try not to be so violent! + _vm->_scrolls->displayScrollChain('Q', 10); // Please try not to be so violent! } } else - _vm->_visa->displayScrollChain('Q', 10); + _vm->_scrolls->displayScrollChain('Q', 10); break; case kVerbCodePasswd: if (_vm->_gyro->_room != r__bridge) - _vm->_visa->displayScrollChain('Q', 12); + _vm->_scrolls->displayScrollChain('Q', 12); else { bool ok = true; for (byte i = 0; i < _thats.size(); i++) { @@ -2103,7 +2102,7 @@ void Acci::doThat() { _vm->_gyro->_drawbridgeOpen = 1; } } else - _vm->_visa->displayScrollChain('Q', 12); + _vm->_scrolls->displayScrollChain('Q', 12); } break; case kVerbCodeDir: @@ -2129,16 +2128,16 @@ void Acci::doThat() { else if (isPersonHere()) { switch (_person) { case Gyro::kPeopleArkata: - _vm->_visa->displayScrollChain('U', 12); + _vm->_scrolls->displayScrollChain('U', 12); break; case Gyro::kPeopleGeida: - _vm->_visa->displayScrollChain('U', 13); + _vm->_scrolls->displayScrollChain('U', 13); break; case Gyro::kPeopleWisewoman: - _vm->_visa->displayScrollChain('U', 14); + _vm->_scrolls->displayScrollChain('U', 14); break; default: - _vm->_visa->displayScrollChain('U', 5); // You WHAT? + _vm->_scrolls->displayScrollChain('U', 5); // You WHAT? } } else if ((150 <= _person) && (_person <= 174)) _vm->_scrolls->displayText("Hey, what kind of a weirdo are you??"); @@ -2170,7 +2169,7 @@ void Acci::doThat() { _vm->_gyro->_avvyInBed = true; _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of Avvy, awake in bed. if (_vm->_gyro->_teetotal) - _vm->_visa->displayScrollChain('d', 13); + _vm->_scrolls->displayScrollChain('d', 13); } else _vm->_scrolls->displayText("You're already awake, Avvy!"); break; diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index c6fbe957b4..21063e09a7 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -32,7 +32,6 @@ #include "avalanche/animation.h" #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" -#include "avalanche/visa2.h" #include "avalanche/gyro2.h" #include "avalanche/celer2.h" #include "avalanche/sequence2.h" @@ -759,7 +758,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->_visa->displayScrollChain('q', 26); + _vm->_scrolls->displayScrollChain('q', 26); _vm->_gyro->_userMovesAvvy = true; break; case 3: // _vm->_gyro->special 3: Room 71: triggers dart. @@ -789,11 +788,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->_visa->displayScrollChain('q', 35); + _vm->_scrolls->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; _vm->_celer->drawBackgroundSprite(-1, -1, 2); - _vm->_visa->displayScrollChain('q', 36); + _vm->_scrolls->displayScrollChain('q', 36); _vm->_gyro->_tiedUp = true; _vm->_gyro->_friarWillTieYouUp = false; _sprites[1].walkTo(3); @@ -822,7 +821,7 @@ void Animation::callSpecial(uint16 which) { break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_geidaFollows) && (!_vm->_gyro->_lustieIsAsleep)) { - _vm->_visa->displayScrollChain('q', 63); + _vm->_scrolls->displayScrollChain('q', 63); _sprites[1].turn(kDirDown); _sprites[1].stopWalk(); _sprites[1]._callEachStepFl = false; // Geida @@ -842,9 +841,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->_visa->displayScrollChain('q', 62); + _vm->_scrolls->displayScrollChain('q', 62); else { - _vm->_visa->displayScrollChain('q', 61); + _vm->_scrolls->displayScrollChain('q', 61); return; } } @@ -1065,7 +1064,7 @@ void Animation::arrowProcs(byte tripnum) { // OK, it's hit him... what now? _sprites[1]._callEachStepFl = false; // prevent recursion. - _vm->_visa->displayScrollChain('Q', 47); // Complaint! + _vm->_scrolls->displayScrollChain('Q', 47); // Complaint! _sprites[tripnum].remove(); // Deallocate the arrow. #if 0 tr[1].done; { Deallocate normal pic of Avvy. } @@ -1273,7 +1272,7 @@ void Animation::animLink() { if (_mustExclaim) { _mustExclaim = false; - _vm->_visa->displayScrollChain('x', _sayWhat); + _vm->_scrolls->displayScrollChain('x', _sayWhat); } } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 6312546ef4..c768fc1346 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -64,7 +64,6 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _pingo; delete _scrolls; - delete _visa; delete _lucerna; delete _enid; delete _celer; @@ -85,7 +84,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _gyro = new Gyro(this); _pingo = new Pingo(this); _scrolls = new Scrolls(this); - _visa = new Visa(this); _lucerna = new Lucerna(this); _enid = new Enid(this); _celer = new Celer(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 69c157fdbb..b93c117377 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -37,7 +37,6 @@ #include "avalanche/gyro2.h" #include "avalanche/pingo2.h" #include "avalanche/scrolls2.h" -#include "avalanche/visa2.h" #include "avalanche/lucerna2.h" #include "avalanche/enid2.h" #include "avalanche/celer2.h" @@ -74,7 +73,6 @@ public: Gyro *_gyro; Pingo *_pingo; Scrolls *_scrolls; - Visa *_visa; Lucerna *_lucerna; Enid *_enid; Celer *_celer; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index fe5d4d040d..a5b3e06ff8 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -41,7 +41,6 @@ #include "avalanche/timer.h" #include "avalanche/celer2.h" #include "avalanche/enid2.h" -#include "avalanche/visa2.h" #include "avalanche/closing2.h" #include "common/str.h" @@ -179,7 +178,7 @@ void Avalot::setup() { _vm->_lucerna->fxToggle(); _vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); - _vm->_visa->displayScrollChain('q', 83); // Info on the game, etc. + _vm->_scrolls->displayScrollChain('q', 83); // Info on the game, etc. } } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 9be471c9fd..8bfa53f616 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -33,7 +33,6 @@ #include "avalanche/pingo2.h" #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" -#include "avalanche/visa2.h" #include "avalanche/acci2.h" #include "avalanche/animation.h" @@ -385,7 +384,7 @@ void Gyro::forceNumlock() { bool Gyro::decreaseMoney(uint16 howmuchby) { _money -= howmuchby; if (_money < 0) { - _vm->_visa->displayScrollChain('Q', 2); // "You are now denariusless!" + _vm->_scrolls->displayScrollChain('Q', 2); // "You are now denariusless!" _vm->_lucerna->gameOver(); return false; } else diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index dc635aae66..961202b7ad 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -32,7 +32,6 @@ #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/scrolls2.h" -#include "avalanche/visa2.h" #include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/enid2.h" @@ -621,12 +620,12 @@ void Lucerna::enterRoom(byte room, byte ped) { //setactivepage(1 - cp); if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { - _vm->_visa->displayScrollChain('q', 9); // Don't want to waste the wine! + _vm->_scrolls->displayScrollChain('q', 9); // Don't want to waste the wine! _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; refreshObjectList(); } - _vm->_visa->displayScrollChain('q', 69); + _vm->_scrolls->displayScrollChain('q', 69); break; case r__catacombs: diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 0f1722a482..6881a3e216 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -10,7 +10,6 @@ MODULE_OBJS = \ gyro2.o \ pingo2.o \ scrolls2.o \ - visa2.o \ lucerna2.o \ enid2.o \ celer2.o \ diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index f96d56edc1..56e9b2f1c4 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -34,7 +34,6 @@ #include "avalanche/lucerna2.h" #include "avalanche/animation.h" #include "avalanche/acci2.h" -#include "avalanche/visa2.h" #include "avalanche/timer.h" #include "common/textconsole.h" @@ -44,6 +43,7 @@ namespace Avalanche { Scrolls::Scrolls(AvalancheEngine *vm) { _vm = vm; + _noError = true; } void Scrolls::init() { @@ -729,7 +729,7 @@ void Scrolls::callScrollDriver() { case 10: switch (_vm->_gyro->_boxContent) { case 0: // Sixpence. - _vm->_visa->displayScrollChain('q', 37); // You find the sixpence. + _vm->_scrolls->displayScrollChain('q', 37); // You find the sixpence. _vm->_gyro->_money += 6; _vm->_gyro->_boxContent = _vm->_acci->kNothing; _vm->_lucerna->incScore(2); @@ -826,4 +826,239 @@ void Scrolls::musicalScroll() { 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->_bufSize++; + _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; +} + +/** + * 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 (byte 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] = 177; // Crapulus walks off. + + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->_vanishIfStill = true; + spr->walkTo(3); // Walks away. + + _vm->_lucerna->incScore(2); + } +} + } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 026c5888e1..a8938a5d34 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -78,6 +78,10 @@ public: 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; @@ -116,6 +120,12 @@ private: 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 diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 2df7ce217a..4e3f3aa2a9 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -30,7 +30,6 @@ #include "avalanche/avalanche.h" #include "avalanche/timer.h" -#include "avalanche/visa2.h" #include "avalanche/lucerna2.h" #include "avalanche/animation.h" #include "avalanche/scrolls2.h" @@ -243,7 +242,7 @@ void Timer::openDrawbridge() { } void Timer::avariciusTalks() { - _vm->_visa->displayScrollChain('q', _vm->_gyro->_avariciusTalk); + _vm->_scrolls->displayScrollChain('q', _vm->_gyro->_avariciusTalk); _vm->_gyro->_avariciusTalk++; if (_vm->_gyro->_avariciusTalk < 17) @@ -286,25 +285,25 @@ void Timer::stairs() { void Timer::cardiffSurvey() { if (_vm->_gyro->_cardiffQuestionNum == 0) { _vm->_gyro->_cardiffQuestionNum++; - _vm->_visa->displayScrollChain('q', 27); + _vm->_scrolls->displayScrollChain('q', 27); } - _vm->_visa->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); + _vm->_scrolls->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); _vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } void Timer::cardiffReturn() { - _vm->_visa->displayScrollChain('q', 28); + _vm->_scrolls->displayScrollChain('q', 28); cardiffSurvey(); // Add end of question. } void Timer::cwytalotInHerts() { - _vm->_visa->displayScrollChain('q', 29); + _vm->_scrolls->displayScrollChain('q', 29); } void Timer::getTiedUp() { - _vm->_visa->displayScrollChain('q', 34); // ...Trouble! + _vm->_scrolls->displayScrollChain('q', 34); // ...Trouble! _vm->_gyro->_userMovesAvvy = false; _vm->_gyro->_beenTiedUp = true; _vm->_animation->stopWalking(); @@ -331,18 +330,18 @@ void Timer::hangAround() { avvy->init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = r__robins; _vm->_animation->appearPed(1, 2); - _vm->_visa->displayScrollChain('q', 39); + _vm->_scrolls->displayScrollChain('q', 39); avvy->walkTo(7); addTimer(55, kProcHangAround2, kReasonHangingAround); } void Timer::hangAround2() { - _vm->_visa->displayScrollChain('q', 40); + _vm->_scrolls->displayScrollChain('q', 40); AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(4); _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = r__robins; - _vm->_visa->displayScrollChain('q', 41); + _vm->_scrolls->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -387,7 +386,7 @@ void Timer::afterTheShootemup() { warning("STUB: Timer::after_the_shootemup()"); - _vm->_visa->displayScrollChain('q', 70); + _vm->_scrolls->displayScrollChain('q', 70); } void Timer::jacquesWakesUp() { @@ -396,7 +395,7 @@ void Timer::jacquesWakesUp() { switch (_vm->_gyro->_jacquesState) { // Additional pictures. case 1 : _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Eyes open. - _vm->_visa->displayScrollChain('Q', 45); + _vm->_scrolls->displayScrollChain('Q', 45); break; case 2 : // Going through the door. _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor. @@ -444,7 +443,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->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!" + _vm->_scrolls->displayScrollChain('q', 48); // "Ha ha, it worked again!" spr->walkTo(1); // Walk to the door. spr->_vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); @@ -498,14 +497,14 @@ void Timer::jump() { _vm->_gyro->_arrowInTheDoor = false; // You've got it. _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_visa->displayScrollChain('q', 50); + _vm->_scrolls->displayScrollChain('q', 50); _vm->_lucerna->incScore(3); } } } void Timer::crapulusSaysSpludOut() { - _vm->_visa->displayScrollChain('q', 56); + _vm->_scrolls->displayScrollChain('q', 56); _vm->_gyro->_crapulusWillTell = false; } @@ -513,11 +512,11 @@ void Timer::buyDrinks() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; - _vm->_visa->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. + _vm->_scrolls->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. - _vm->_visa->displayScrollChain('D', 1); // That'll be thruppence. + _vm->_scrolls->displayScrollChain('D', 1); // That'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. - _vm->_visa->displayScrollChain('D', 3); // Tell 'em you paid up. + _vm->_scrolls->displayScrollChain('D', 3); // Tell 'em you paid up. _vm->_acci->drink(); } @@ -525,10 +524,10 @@ void Timer::buyWine() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; - _vm->_visa->displayScrollChain('D', 50); // You buy the wine. - _vm->_visa->displayScrollChain('D', 1); // It'll be thruppence. + _vm->_scrolls->displayScrollChain('D', 50); // You buy the wine. + _vm->_scrolls->displayScrollChain('D', 1); // It'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) { - _vm->_visa->displayScrollChain('D', 4); // You paid up. + _vm->_scrolls->displayScrollChain('D', 4); // You paid up. _vm->_gyro->_objects[Gyro::kObjectWine - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wineState = 1; // OK Wine. @@ -536,12 +535,12 @@ void Timer::buyWine() { } void Timer::callsGuards() { - _vm->_visa->displayScrollChain('Q', 58); // "GUARDS!!!" + _vm->_scrolls->displayScrollChain('Q', 58); // "GUARDS!!!" _vm->_lucerna->gameOver(); } void Timer::greetsMonk() { - _vm->_visa->displayScrollChain('Q', 59); + _vm->_scrolls->displayScrollChain('Q', 59); _vm->_gyro->_enteredLustiesRoomAsMonk = true; } @@ -560,7 +559,7 @@ void Timer::meetAvaroid() { _vm->_scrolls->displayText(tmpStr); _vm->_lucerna->gameOver(); } else { - _vm->_visa->displayScrollChain('Q', 60); + _vm->_scrolls->displayScrollChain('Q', 60); _vm->_gyro->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); @@ -599,7 +598,7 @@ void Timer::robinHoodAndGeida() { } void Timer::robinHoodAndGeidaTalk() { - _vm->_visa->displayScrollChain('q', 66); + _vm->_scrolls->displayScrollChain('q', 66); AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -618,7 +617,7 @@ void Timer::avalotReturns() { spr->remove(); avvy->init(0, true, _vm->_animation); _vm->_animation->appearPed(1, 1); - _vm->_visa->displayScrollChain('q', 67); + _vm->_scrolls->displayScrollChain('q', 67); _vm->_gyro->_userMovesAvvy = true; } @@ -649,12 +648,12 @@ void Timer::arkataShouts() { if (_vm->_gyro->_teetotal) return; - _vm->_visa->displayScrollChain('q', 76); + _vm->_scrolls->displayScrollChain('q', 76); addTimer(160, kProcArkataShouts, kReasonArkataShouts); } void Timer::winning() { - _vm->_visa->displayScrollChain('q', 79); + _vm->_scrolls->displayScrollChain('q', 79); _vm->_pingo->winningPic(); warning("STUB: Timer::winning()"); @@ -698,7 +697,7 @@ void Timer::spludwickLeavesCauldron() { } void Timer::giveLuteToGeida() { // Moved here from Acci. - _vm->_visa->displayScrollChain('Q', 86); + _vm->_scrolls->displayScrollChain('Q', 86); _vm->_lucerna->incScore(4); _vm->_gyro->_lustieIsAsleep = true; _vm->_sequence->firstShow(5); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp deleted file mode 100644 index cbf0e05069..0000000000 --- a/engines/avalanche/visa2.cpp +++ /dev/null @@ -1,281 +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. - */ - -/* VISA The new Sez handler. (Replaces Access.) */ - -#include "avalanche/avalanche.h" - -#include "avalanche/visa2.h" -#include "avalanche/gyro2.h" -#include "avalanche/scrolls2.h" -#include "avalanche/acci2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/animation.h" - -#include "common/textconsole.h" - -namespace Avalanche { - -Visa::Visa(AvalancheEngine *vm) { - _vm = vm; - _noError = true; -} - -void Visa::unSkrimble() { - for (uint16 i = 0; i < _vm->_gyro->_bufSize; i++) - _vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; -} - -void Visa::doTheBubble() { - _vm->_gyro->_bufSize++; - _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; -} - -/** - * Display a string in a scroll - * @remarks Originally called 'dixi' - */ -void Visa::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 Visa::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 Visa::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 (byte 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] = 177; // Crapulus walks off. - - AnimationType *spr = &_vm->_animation->_sprites[1]; - spr->_vanishIfStill = true; - spr->walkTo(3); // Walks away. - - _vm->_lucerna->incScore(2); - } -} - -} // End of namespace Avalanche. diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h deleted file mode 100644 index c811053fab..0000000000 --- a/engines/avalanche/visa2.h +++ /dev/null @@ -1,56 +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. - */ - -/* VISA The new Sez handler. (Replaces Access.) */ - -#ifndef AVALANCHE_VISA2_H -#define AVALANCHE_VISA2_H - -#include "common/scummsys.h" - -namespace Avalanche { -class AvalancheEngine; - -class Visa { -public: - Visa(AvalancheEngine *vm); - - void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); - void talkTo(byte whom); - -private: - AvalancheEngine *_vm; - - bool _noError; - void unSkrimble(); - void doTheBubble(); - void speak(byte who, byte subject); -}; - -} // End of namespace Avalanche. - -#endif // AVALANCHE_VISA2_H |