diff options
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/avalot.cpp | 23 | ||||
-rw-r--r-- | engines/avalanche/avalot.h | 2 | ||||
-rw-r--r-- | engines/avalanche/enums.h | 65 | ||||
-rw-r--r-- | engines/avalanche/menu.cpp | 71 | ||||
-rw-r--r-- | engines/avalanche/parser.cpp | 17 | ||||
-rw-r--r-- | engines/avalanche/parser.h | 16 | ||||
-rw-r--r-- | engines/avalanche/timer.cpp | 2 |
7 files changed, 86 insertions, 110 deletions
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 90d2542136..5d182341bc 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -37,6 +37,7 @@ #include "avalanche/timer.h" #include "avalanche/background.h" #include "avalanche/closing.h" +#include "avalanche/enums.h" #include "common/file.h" #include "common/random.h" @@ -469,7 +470,7 @@ void Avalot::init() { * Call a given Verb * @remarks Originally called 'callverb' */ -void Avalot::callVerb(byte id) { +void Avalot::callVerb(VerbCode id) { if (id == _vm->_parser->kPardon) { 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 " \ @@ -1439,13 +1440,13 @@ void Avalot::checkClick() { _vm->_parser->_person = (People) _thinks; _vm->_parser->_thing = _vm->_parser->kPardon; } - callVerb(Parser::kVerbCodeExam); + callVerb(kVerbCodeExam); } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. do { _vm->updateEvents(); } while (_holdLeftMouse); - callVerb(Parser::kVerbCodeScore); + callVerb(kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. _vm->_animation->_sprites[0]._speedX = kWalk; _vm->_animation->updateSpeed(); @@ -1864,29 +1865,29 @@ Common::String Avalot::f5Does() { switch (_room) { case kRoomYours: if (!_avvyIsAwake) - return Common::String::format("%cWWake up", Parser::kVerbCodeWake); + return Common::String::format("%cWWake up", kVerbCodeWake); else if (_avvyInBed) - return Common::String::format("%cGGet up", Parser::kVerbCodeStand); + return Common::String::format("%cGGet up", kVerbCodeStand); break; case kRoomInsideCardiffCastle: if (_standingOnDais) - return Common::String::format("%cCClimb down", Parser::kVerbCodeClimb); + return Common::String::format("%cCClimb down", kVerbCodeClimb); else - return Common::String::format("%cCClimb up", Parser::kVerbCodeClimb); + return Common::String::format("%cCClimb up", kVerbCodeClimb); break; case kRoomNottsPub: if (_sittingInPub) - return Common::String::format("%cSStand up", Parser::kVerbCodeStand); + return Common::String::format("%cSStand up", kVerbCodeStand); else - return Common::String::format("%cSSit down", Parser::kVerbCodeSit); + return Common::String::format("%cSSit down", kVerbCodeSit); break; case kRoomMusicRoom: if (_vm->_animation->inField(5)) - return Common::String::format("%cPPlay the harp", Parser::kVerbCodePlay); + return Common::String::format("%cPPlay the harp", kVerbCodePlay); break; } - return Common::String::format("%c", _vm->_parser->kPardon); // If all else fails... + return Common::String::format("%c", kVerbCodePardon); // If all else fails... } void Avalot::loadMouse(byte which) { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 3999c19f25..ae4024a588 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -291,7 +291,7 @@ public: void runAvalot(); void init(); - void callVerb(byte id); + void callVerb(VerbCode id); void drawAlsoLines(); void loadRoom(byte num); void exitRoom(byte x); diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index 9965091eb8..c3c9a54480 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -51,55 +51,38 @@ enum Room { // Objects you can hold: enum Object { - kObjectWine = 1, - kObjectMoney, - kObjectBodkin, - kObjectPotion, - kObjectChastity, - kObjectBolt, - kObjectCrossbow, - kObjectLute, - kObjectBadge, - kObjectMushroom, - kObjectKey, - kObjectBell, - kObjectPrescription, - kObjectPen, - kObjectInk, - kObjectClothes, - kObjectHabit, - kObjectOnion, - kObjectDummy = 177 + kObjectWine = 1, kObjectMoney, kObjectBodkin, kObjectPotion, kObjectChastity, + kObjectBolt, kObjectCrossbow, kObjectLute, kObjectBadge, kObjectMushroom, + kObjectKey, kObjectBell, kObjectPrescription, kObjectPen, kObjectInk, + kObjectClothes, kObjectHabit, kObjectOnion, kObjectDummy = 177 }; // People who hang around this game. enum People { // Boys: - kPeopleAvalot = 150, - kPeopleSpludwick = 151, - kPeopleCrapulus = 152, - kPeopleDrDuck = 153, - kPeopleMalagauche = 154, - kPeopleFriarTuck = 155, - kPeopleRobinHood = 156, - kPeopleCwytalot = 157, - kPeopleDuLustie = 158, - kPeopleDuke = 159, - kPeopleDogfood = 160, - kPeopleTrader = 161, - kPeopleIbythneth = 162, - kPeopleAyles = 163, - kPeoplePort = 164, - kPeopleSpurge = 165, + kPeopleAvalot = 150, kPeopleSpludwick = 151, kPeopleCrapulus = 152, kPeopleDrDuck = 153, + kPeopleMalagauche = 154, kPeopleFriarTuck = 155, kPeopleRobinHood = 156, kPeopleCwytalot = 157, + kPeopleDuLustie = 158, kPeopleDuke = 159, kPeopleDogfood = 160, kPeopleTrader = 161, + kPeopleIbythneth = 162, kPeopleAyles = 163, kPeoplePort = 164, kPeopleSpurge = 165, kPeopleJacques = 166, // Girls: - kPeopleArkata = 175, - kPeopleGeida = 176, - kPeopleInvisible = 177, - kPeopleWisewoman = 178, + kPeopleArkata = 175, kPeopleGeida = 176, kPeopleInvisible = 177, kPeopleWisewoman = 178, // - kPeoplePardon = 254, - kPeopleNone = 0 + kPeoplePardon = 254, kPeopleNone = 0 +}; + +enum VerbCode { + kVerbCodeExam = 1, kVerbCodeOpen = 2, kVerbCodePause = 3, kVerbCodeGet = 4, kVerbCodeDrop = 5, + kVerbCodeInv = 6, kVerbCodeTalk = 7, kVerbCodeGive = 8, kVerbCodeDrink = 9, kVerbCodeLoad = 10, + kVerbCodeSave = 11, kVerbCodePay = 12, kVerbCodeLook = 13, kVerbCodeBreak = 14, kVerbCodeQuit = 15, + kVerbCodeSit = 16, kVerbCodeStand = 17, kVerbCodeGo = 18, kVerbCodeInfo = 19, kVerbCodeUndress = 20, + kVerbCodeWear = 21, kVerbCodePlay = 22, kVerbCodeRing = 23, kVerbCodeHelp = 24, kVerbCodeLarrypass = 25, + kVerbCodePhaon = 26, kVerbCodeBoss = 27, kVerbCodePee = 28, kVerbCodeCheat = 29, kVerbCodeMagic = 30, + kVerbCodeRestart = 31, kVerbCodeEat = 32, kVerbCodeListen = 33, kVerbCodeBuy = 34, kVerbCodeAttack = 35, + kVerbCodePasswd = 36, kVerbCodeDir = 37, kVerbCodeDie = 38, kVerbCodeScore = 39, kVerbCodePut = 40, + kVerbCodeKiss = 41, kVerbCodeClimb = 42, kVerbCodeJump = 43, kVerbCodeHiscores = 44, kVerbCodeWake = 45, + kVerbCodeHello = 46, kVerbCodeThanks = 47, + kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253, kVerbCodePardon = 254 }; } // End of namespace Avalanche diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 0686fbbf44..42a787e046 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -266,26 +266,26 @@ void Menu::findWhatYouCanDoWithIt() { case kObjectWine: case kObjectPotion: case kObjectInk: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeDrink; break; case kObjectBell: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeRing; break; case kObjectChastity: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; case kObjectLute: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodePlay; break; case kObjectMushroom: case kObjectOnion: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeEat; break; case kObjectClothes: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; default: - _vm->_avalot->_verbStr = Parser::kVerbCodeExam; // Anything else. + _vm->_avalot->_verbStr = kVerbCodeExam; // Anything else. } } @@ -492,21 +492,21 @@ void Menu::setupMenuWith() { _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_avalot->getName(_vm->_avalot->_lastPerson), 'G', "", true); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeGive; + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodeGive; } } else { _activeMenuItem.setupOption("Examine", 'x', "", true); _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_avalot->_thinks), 'T', "", true); - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeTalk; switch (_vm->_avalot->_thinks) { case kPeopleGeida: case kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeKiss; + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodeKiss; break; case kPeopleDogfood: _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_avalot->_wonNim); // True if you HAVEN'T won. - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodePlay; + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodePlay; break; case kPeopleMalagauche: { bool isSober = !_vm->_avalot->_teetotal; @@ -531,19 +531,19 @@ void Menu::runMenuGame() { // Help, boss, untrash screen. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_avalot->callVerb(Parser::kVerbCodeHelp); + _vm->_avalot->callVerb(kVerbCodeHelp); break; case 1: - _vm->_avalot->callVerb(Parser::kVerbCodeBoss); + _vm->_avalot->callVerb(kVerbCodeBoss); break; case 2: _vm->_avalot->majorRedraw(); break; case 3: - _vm->_avalot->callVerb(Parser::kVerbCodeScore); + _vm->_avalot->callVerb(kVerbCodeScore); break; case 4: - _vm->_avalot->callVerb(Parser::kVerbCodeInfo); + _vm->_avalot->callVerb(kVerbCodeInfo); break; } } @@ -552,17 +552,17 @@ void Menu::runMenuFile() { // New game, load, save, save as, DOS shell, about, quit. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_avalot->callVerb(Parser::kVerbCodeRestart); + _vm->_avalot->callVerb(kVerbCodeRestart); break; case 1: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_avalot->callVerb(Parser::kVerbCodeLoad); + _vm->_avalot->callVerb(kVerbCodeLoad); break; case 2: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_avalot->callVerb(Parser::kVerbCodeSave); + _vm->_avalot->callVerb(kVerbCodeSave); break; case 3: //_vm->_basher->filename_edit(); @@ -572,34 +572,35 @@ void Menu::runMenuFile() { //_vm->_enid->backToBootstrap(2); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: - _vm->_avalot->callVerb(Parser::kVerbCodeQuit); + _vm->_avalot->callVerb(kVerbCodeQuit); break; } } void Menu::runMenuAction() { - Common::String f5Does; // Get up, pause game, open door, look, inventory, walk/run. switch (_activeMenuItem._choiceNum) { - case 0: + case 0: { _vm->_parser->_person = kPeoplePardon; _vm->_parser->_thing = _vm->_parser->kPardon; - f5Does = _vm->_avalot->f5Does(); - _vm->_avalot->callVerb(f5Does[0]); + Common::String f5Does = _vm->_avalot->f5Does(); + VerbCode verb = (VerbCode)f5Does[0]; + _vm->_avalot->callVerb(verb); + } break; case 1: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_avalot->callVerb(Parser::kVerbCodePause); + _vm->_avalot->callVerb(kVerbCodePause); break; case 2: - _vm->_avalot->callVerb(Parser::kVerbCodeOpen); + _vm->_avalot->callVerb(kVerbCodeOpen); break; case 3: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_avalot->callVerb(Parser::kVerbCodeLook); + _vm->_avalot->callVerb(kVerbCodeLook); break; case 4: - _vm->_avalot->callVerb(Parser::kVerbCodeInv); + _vm->_avalot->callVerb(kVerbCodeInv); break; case 5: { AnimationType *avvy = &_vm->_animation->_sprites[0]; @@ -628,7 +629,7 @@ void Menu::runMenuWith() { if (_vm->_avalot->_thinkThing) { _vm->_parser->_thing += 49; - if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive) + if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == kVerbCodeGive) _vm->_parser->_person = _vm->_avalot->_lastPerson; else _vm->_parser->_person = kPeoplePardon; @@ -636,27 +637,27 @@ void Menu::runMenuWith() { switch (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer _vm->_parser->_thing = 100; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 101: // Wine _vm->_parser->_thing = 50; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 102: // Whisky _vm->_parser->_thing = 102; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 103: // Cider _vm->_parser->_thing = 103; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 104: // Mead _vm->_parser->_thing = 107; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 105: // Onion (trader) _vm->_parser->_thing = 67; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; default: _vm->_parser->_person = (People)_vm->_parser->_thing; @@ -664,7 +665,7 @@ void Menu::runMenuWith() { _vm->_avalot->_subjectNum = 0; } } - _vm->_avalot->callVerb(_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]); + _vm->_avalot->callVerb((VerbCode)_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]); } void Menu::setup() { diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 3e318558ef..0685bcf6d4 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -420,13 +420,16 @@ void Parser::handleReturn() { void Parser::handleFunctionKey(const Common::Event &event) { switch (event.kbd.keycode) { - case Common::KEYCODE_F5: + case Common::KEYCODE_F5: { _person = kPeoplePardon; _thing = kPardon; - _vm->_avalot->callVerb(_vm->_avalot->f5Does()[0]); + Common::String f5does = _vm->_avalot->f5Does(); + VerbCode verb = (VerbCode)f5does[0]; + _vm->_avalot->callVerb(verb); + } break; case Common::KEYCODE_F7: - _vm->_avalot->callVerb(Parser::kVerbCodeOpen); + _vm->_avalot->callVerb(kVerbCodeOpen); break; default: break; @@ -710,7 +713,7 @@ void Parser::parse() { byte n = 0; _polite = false; - _verb = kPardon; + _verb = kVerbCodePardon; _thing = kPardon; _thing2 = kPardon; _person = kPeoplePardon; @@ -870,7 +873,7 @@ void Parser::parse() { for (int16 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used. byte curChar = (byte)_thats[i]; if ((curChar == 253) || (curChar == 249) || ((1 <= curChar) && (curChar <= 49))) - _verb = curChar; + _verb = (VerbCode)curChar; else if ((50 <= curChar) && (curChar <= 149)) { _thing2 = _thing; _thing = curChar; @@ -1668,7 +1671,7 @@ void Parser::doThat() { for (int i = 0; i < 10; i++) _realWords[i] = _realWords[i + 1]; - _verb = _vm->_avalot->_subjectNum; + _verb = (VerbCode)_vm->_avalot->_subjectNum; doThat(); return; } else { @@ -2310,7 +2313,7 @@ void Parser::doThat() { _vm->_avalot->dawn(); } break; - case kPardon: + case kVerbCodePardon: _vm->_dialogs->displayText("Hey, a verb would be helpful!"); break; case kVerbCodeHello: { diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index a0e26817d6..e45d668b46 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -41,19 +41,6 @@ class AvalancheEngine; class Parser { public: - enum VerbCode { - kVerbCodeExam = 1, kVerbCodeOpen = 2, kVerbCodePause = 3, kVerbCodeGet = 4, kVerbCodeDrop = 5, - kVerbCodeInv = 6, kVerbCodeTalk = 7, kVerbCodeGive = 8, kVerbCodeDrink = 9, kVerbCodeLoad = 10, - kVerbCodeSave = 11, kVerbCodePay = 12, kVerbCodeLook = 13, kVerbCodeBreak = 14, kVerbCodeQuit = 15, - kVerbCodeSit = 16, kVerbCodeStand = 17, kVerbCodeGo = 18, kVerbCodeInfo = 19, kVerbCodeUndress = 20, - kVerbCodeWear = 21, kVerbCodePlay = 22, kVerbCodeRing = 23, kVerbCodeHelp = 24, kVerbCodeLarrypass = 25, - kVerbCodePhaon = 26, kVerbCodeBoss = 27, kVerbCodePee = 28, kVerbCodeCheat = 29, kVerbCodeMagic = 30, - kVerbCodeRestart = 31, kVerbCodeEat = 32, kVerbCodeListen = 33, kVerbCodeBuy = 34, kVerbCodeAttack = 35, - kVerbCodePasswd = 36, kVerbCodeDir = 37, kVerbCodeDie = 38, kVerbCodeScore = 39, kVerbCodePut = 40, - kVerbCodeKiss = 41, kVerbCodeClimb = 42, kVerbCodeJump = 43, kVerbCodeHiscores = 44, kVerbCodeWake = 45, - kVerbCodeHello = 46, kVerbCodeThanks = 47, kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253 - }; - static const byte kPardon = 254; // Didn't understand / wasn't given. static const int16 kParserWordsNum = 277; // How many words does the parser know? static const byte kNothing = 250; @@ -73,7 +60,8 @@ public: VocabEntry _vocabulary[kParserWordsNum]; Common::String _realWords[11]; - byte _verb, _thing; + VerbCode _verb; + byte _thing; People _person; bool _polite; Common::String _inputText; // Original name: current diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 425feeaaf6..342ed7b8bc 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -658,7 +658,7 @@ void Timer::winning() { #endif // TODO: To be implemented with Pingo::winningPic(). - _vm->_avalot->callVerb(Parser::kVerbCodeScore); + _vm->_avalot->callVerb(kVerbCodeScore); _vm->_dialogs->displayText(" T H E E N D "); _vm->_avalot->_letMeOut = true; } |