From 199ba0ddf4ec0251c0e70bd56a8f4be0cb6282b7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 23:15:53 +0200 Subject: AVALANCHE: Remove verbosity related to the use of Magics enum --- engines/avalanche/animation.cpp | 172 ++++++++++++++++++++-------------------- engines/avalanche/avalanche.h | 19 ----- engines/avalanche/avalot.cpp | 59 -------------- engines/avalanche/enums.h | 15 +++- engines/avalanche/menu.cpp | 63 ++++++++++++++- engines/avalanche/menu.h | 4 + engines/avalanche/parser.cpp | 14 ++-- engines/avalanche/timer.cpp | 12 +-- 8 files changed, 177 insertions(+), 181 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 836864bf9e..fd7da5745c 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -191,27 +191,27 @@ void AnimationType::walk() { if ((magicColor != 255) & (!_anim->_vm->_doingSpriteRun)) { MagicType *magic = &_anim->_vm->_magics[magicColor]; switch (magic->_operation) { - case AvalancheEngine::kMagicExclaim: + case kMagicExclaim: bounce(); _anim->_mustExclaim = true; _anim->_sayWhat = magic->_data; break; - case AvalancheEngine::kMagicBounce: + case kMagicBounce: bounce(); break; - case AvalancheEngine::kMagicTransport: + case kMagicTransport: _anim->_vm->flipRoom((Room)(magic->_data >> 8), magic->_data & 0xff); break; - case AvalancheEngine::kMagicUnfinished: { + case kMagicUnfinished: { bounce(); 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 AvalancheEngine::kMagicSpecial: + case kMagicSpecial: _anim->callSpecial(magic->_data); break; - case AvalancheEngine::kMagicOpenDoor: + case kMagicOpenDoor: _anim->_vm->openDoor((Room)(magic->_data >> 8), magic->_data & 0xff, magicColor); break; } @@ -427,66 +427,66 @@ void Animation::catacombMove(byte ped) { switch (here & 0xf) { // West. case 0: // no connection (wall) - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); break; case 0x1: // no connection (wall + shield), - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 28); // ...shield. break; case 0x2: // wall with door - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door. break; case 0x3: // wall with door and shield - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door, and... _vm->_background->draw(-1, -1, 28); // ...shield. break; case 0x4: // no connection (wall + window), - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 4); // ...window. break; case 0x5: // wall with door and window - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door, and... _vm->_background->draw(-1, -1, 4); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // No door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicNothing; // No door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 6); // ...torches. break; case 0x7: // wall with door and torches - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door, and... _vm->_background->draw(-1, -1, 6); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicSpecial; // Straight wall. + _vm->_magics[1]._operation = kMagicNothing; // Sloping wall. + _vm->_magics[2]._operation = kMagicSpecial; // Straight wall. break; } @@ -494,90 +494,90 @@ void Animation::catacombMove(byte ped) { switch ((here & 0xf0) >> 4) { // East case 0: // no connection (wall) - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 18); break; case 0x1: // no connection (wall + window), - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 19); // ...window. break; case 0x2: // wall with door - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 20); // ...door. break; case 0x3: // wall with door and window - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 19); // ...door, and... _vm->_background->draw(-1, -1, 20); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // No door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicNothing; // No door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 17); // ...torches. break; case 0x7: // wall with door and torches - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 20); // ...door, and... _vm->_background->draw(-1, -1, 17); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_magics[4]._operation = AvalancheEngine::kMagicNothing; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicSpecial; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[4]._operation = kMagicNothing; // Sloping wall. + _vm->_magics[5]._operation = kMagicSpecial; // Straight wall. + _vm->_portals[6]._operation = kMagicNothing; // Door. break; } switch ((here & 0xf00) >> 8) { // South case 0: // No connection. - _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[6]._operation = kMagicBounce; + _vm->_magics[11]._operation = kMagicBounce; + _vm->_magics[12]._operation = kMagicBounce; break; case 0x1: _vm->_background->draw(-1, -1, 21); if ((xy_uint16 == 2051) && (_vm->_geidaFollows)) - _vm->_magics[12]._operation = AvalancheEngine::kMagicExclaim; + _vm->_magics[12]._operation = kMagicExclaim; else - _vm->_magics[12]._operation = AvalancheEngine::kMagicSpecial; // Right exit south. + _vm->_magics[12]._operation = kMagicSpecial; // Right exit south. - _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[6]._operation = kMagicBounce; + _vm->_magics[11]._operation = kMagicBounce; break; case 0x2: _vm->_background->draw(-1, -1, 22); - _vm->_magics[6]._operation = AvalancheEngine::kMagicSpecial; // Middle exit south. - _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[6]._operation = kMagicSpecial; // Middle exit south. + _vm->_magics[11]._operation = kMagicBounce; + _vm->_magics[12]._operation = kMagicBounce; break; case 0x3: _vm->_background->draw(-1, -1, 23); - _vm->_magics[11]._operation = AvalancheEngine::kMagicSpecial; // Left exit south. - _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[11]._operation = kMagicSpecial; // Left exit south. + _vm->_magics[6]._operation = kMagicBounce; + _vm->_magics[12]._operation = kMagicBounce; break; } switch ((here & 0xf000) >> 12) { // North case 0: // No connection - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; - _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[0]._operation = kMagicBounce; + _vm->_portals[3]._operation = kMagicNothing; // Door. break; // LEFT handles: #if 0 @@ -589,8 +589,8 @@ void Animation::catacombMove(byte ped) { #endif case 0x2: _vm->_background->draw(-1, -1, 3); - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; // Middle exit north. - _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[0]._operation = kMagicBounce; // Middle exit north. + _vm->_portals[3]._operation = kMagicSpecial; // Door. break; #if 0 case 0x3: @@ -607,8 +607,8 @@ void Animation::catacombMove(byte ped) { #endif case 0x5: _vm->_background->draw(-1, -1, 2); - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; // Middle exit north. - _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[0]._operation = kMagicBounce; // Middle exit north. + _vm->_portals[3]._operation = kMagicSpecial; // Door. break; #if 0 case 0x6: @@ -628,25 +628,25 @@ void Animation::catacombMove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_background->draw(-1, -1, 31); - _vm->_magics[0]._operation = AvalancheEngine::kMagicSpecial; // Middle arch north. - _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[0]._operation = kMagicSpecial; // Middle arch north. + _vm->_portals[3]._operation = kMagicNothing; // Door. break; // DECORATIONS: case 0xd: // No connection + WINDOW - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; - _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[0]._operation = kMagicBounce; + _vm->_portals[3]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 13); break; case 0xe: // No connection + TORCH - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; - _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[0]._operation = kMagicBounce; + _vm->_portals[3]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 7); break; // Recessed door: case 0xf: - _vm->_magics[0]._operation = AvalancheEngine::kMagicNothing; // Door to Geida's room. + _vm->_magics[0]._operation = kMagicNothing; // Door to Geida's room. _vm->_background->draw(-1, -1, 0); - _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_portals[3]._operation = kMagicSpecial; // Door. break; } @@ -701,17 +701,17 @@ void Animation::callSpecial(uint16 which) { case 1: // _vm->special 1: Room 22: top of stairs. _vm->_background->draw(-1, -1, 0); _vm->_brummieStairs = 1; - _vm->_magics[9]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[9]._operation = kMagicNothing; _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); stopWalking(); _vm->_userMovesAvvy = false; break; case 2: // _vm->special 2: Room 22: bottom of stairs. _vm->_brummieStairs = 3; - _vm->_magics[10]._operation = AvalancheEngine::kMagicNothing; - _vm->_magics[11]._operation = AvalancheEngine::kMagicExclaim; + _vm->_magics[10]._operation = kMagicNothing; + _vm->_magics[11]._operation = kMagicExclaim; _vm->_magics[11]._data = 5; - _vm->_magics[3]._operation = AvalancheEngine::kMagicBounce; // Now works as planned! + _vm->_magics[3]._operation = kMagicBounce; // Now works as planned! stopWalking(); _vm->_dialogs->displayScrollChain('q', 26); _vm->_userMovesAvvy = true; @@ -742,7 +742,7 @@ void Animation::callSpecial(uint16 which) { case 5: if (_vm->_friarWillTieYouUp) { // _vm->special 5: Room 42: touched tree, and get tied up. - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Boundary effect is now working again. + _vm->_magics[4]._operation = kMagicBounce; // Boundary effect is now working again. _vm->_dialogs->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; @@ -766,7 +766,7 @@ void Animation::callSpecial(uint16 which) { break; case 7: // _vm->special 7: stop falling down oubliette. _sprites[0]._visible = false; - _vm->_magics[9]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[9]._operation = kMagicNothing; stopWalking(); _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); //_vm->mblit(12, 80, 38, 160, 3, 0); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index cbbc469ac5..d7941ee485 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -169,17 +169,6 @@ public: static const bool kThing = true; static const bool kPerson = false; - // Magic/portal constants: - enum Magics { - kMagicNothing, // Ignore it if this line is touched. - kMagicBounce, // Bounce off this line. Not valid for portals. - kMagicExclaim, // Put up a chain of scrolls. - kMagicTransport, // Enter new room. - kMagicUnfinished, // Unfinished connection. - kMagicSpecial, // Special function. - kMagicOpenDoor // Opening door. - }; - // These following static constants should be included in CFG when it's written. static const int16 kWalk = 3; static const int16 kRun = 5; @@ -306,19 +295,11 @@ public: void spriteRun(); Common::String intToStr(int32 num); - - - - - void newGame(); // This sets up the DNA for a completely new game. bool getFlag(char x); bool decreaseMoney(uint16 amount); // Called pennycheck in the original. Common::String getName(People whose); - byte getNameChar(People whose); - Common::String getThing(byte which); - char getThingChar(byte which); Common::String getItem(byte which); // Called get_better in the original. Common::String f5Does(); // This procedure determines what f5 does. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 29224c1009..4732bbbd1e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1572,65 +1572,6 @@ Common::String AvalancheEngine::getName(People whose) { return kLasses[whose - kPeopleArkata]; } -byte AvalancheEngine::getNameChar(People whose) { - static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; - static const char kLassChar[] = "kG\0xB1o"; - - if (whose < kPeopleArkata) - return kLadChar[whose - kPeopleAvalot]; - else - return kLassChar[whose - kPeopleArkata]; -} - -Common::String AvalancheEngine::getThing(byte which) { - static const Common::String kThings[kObjectNum] = { - "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", - "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", - "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" - }; - - Common::String get_thing_result; - switch (which) { - case kObjectWine: - switch (_wineState) { - case 1: - case 4: - get_thing_result = kThings[which - 1]; - break; - case 3: - get_thing_result = "Vinegar"; - break; - } - break; - case kObjectOnion: - if (_rottenOnion) - get_thing_result = "rotten onion"; - else - get_thing_result = kThings[which - 1]; - break; - default: - get_thing_result = kThings[which - 1]; - } - return get_thing_result; -} - -char AvalancheEngine::getThingChar(byte which) { - static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar - - char get_thingchar_result; - switch (which) { - case kObjectWine: - if (_wineState == 3) - get_thingchar_result = 'V'; // Vinegar - else - get_thingchar_result = kThingsChar[which - 1]; - break; - default: - get_thingchar_result = kThingsChar[which - 1]; - } - return get_thingchar_result; -} - Common::String AvalancheEngine::getItem(byte which) { static const Common::String kItems[kObjectNum] = { "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index e10033a64c..779bfb7e7c 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -85,14 +85,25 @@ enum VerbCode { kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253, kVerbCodePardon = 254 }; -} // End of namespace Avalanche - enum MouseCursor { kCurUpArrow = 0, kCurScrewDriver = 1, kCurRightArrow = 2, kCurFletch = 3, kCurWait = 4, kCurHand = 5, kCurCrosshair = 6, kCurIBeam = 7 }; +// Magic/portal constants: +enum Magics { + kMagicNothing, // Ignore it if this line is touched. + kMagicBounce, // Bounce off this line. Not valid for portals. + kMagicExclaim, // Put up a chain of scrolls. + kMagicTransport, // Enter new room. + kMagicUnfinished, // Unfinished connection. + kMagicSpecial, // Special function. + kMagicOpenDoor // Opening door. +}; + static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; +} // End of namespace Avalanche + #endif // AVALANCHE_ENUMS_H diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 92949c5be2..2a3e3d9453 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -444,7 +444,7 @@ void Menu::setupMenuPeople() { for (int i = kPeopleAvalot; i <= kPeopleWisewoman; i++) { if (_vm->getRoom((People)i) == _vm->_room) { - _activeMenuItem.setupOption(_vm->getName((People)i), _vm->getNameChar((People)i), "", true); + _activeMenuItem.setupOption(_vm->getName((People)i), getNameChar((People)i), "", true); people += i; } } @@ -456,7 +456,7 @@ void Menu::setupMenuObjects() { _activeMenuItem.reset(); for (int i = 0; i < kObjectNum; i++) { if (_vm->_objects[i]) - _activeMenuItem.setupOption(_vm->getThing(i + 1), _vm->getThingChar(i + 1), "", true); + _activeMenuItem.setupOption(getThing(i + 1), getThingChar(i + 1), "", true); } _activeMenuItem.display(); } @@ -764,6 +764,65 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... _vm->_graphics->removeBackup(); } +char Menu::getThingChar(byte which) { + static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar + + char result; + switch (which) { + case kObjectWine: + if (_vm->_wineState == 3) + result = 'V'; // Vinegar + else + result = kThingsChar[which - 1]; + break; + default: + result = kThingsChar[which - 1]; + } + return result; +} + +byte Menu::getNameChar(People whose) { + static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; + static const char kLassChar[] = "kG\0xB1o"; + + if (whose < kPeopleArkata) + return kLadChar[whose - kPeopleAvalot]; + else + return kLassChar[whose - kPeopleArkata]; +} + +Common::String Menu::getThing(byte which) { + static const Common::String kThings[kObjectNum] = { + "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", + "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", + "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" + }; + + Common::String result; + switch (which) { + case kObjectWine: + switch (_vm->_wineState) { + case 1: + case 4: + result = kThings[which - 1]; + break; + case 3: + result = "Vinegar"; + break; + } + break; + case kObjectOnion: + if (_vm->_rottenOnion) + result = "rotten onion"; + else + result = kThings[which - 1]; + break; + default: + result = kThings[which - 1]; + } + return result; +} + bool Menu::isActive() { return _menuActive; } diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index 5de54a2dc8..a71093b6ad 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -151,6 +151,10 @@ private: void drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted); void bleep(); + char getThingChar(byte which); + byte getNameChar(People whose); + Common::String getThing(byte which); + void setupMenuGame(); void setupMenuFile(); void setupMenuAction(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index beb683a2ce..979c451531 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -674,7 +674,7 @@ void Parser::storeInterrogation(byte interrogation) { _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->_magics[1]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[1]._operation = kMagicNothing; _vm->_cardiffQuestionNum = 5; break; case 99: @@ -1193,21 +1193,21 @@ void Parser::openDoor() { if (_vm->_animation->inField(i + 8)) { MagicType *portal = &_vm->_portals[i]; switch (portal->_operation) { - case AvalancheEngine::kMagicExclaim: + case kMagicExclaim: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayScrollChain('x', portal->_data); break; - case AvalancheEngine::kMagicTransport: + case kMagicTransport: _vm->flipRoom((Room)((portal->_data) >> 8), portal->_data & 0x0F); break; - case AvalancheEngine::kMagicUnfinished: + case kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayText("Sorry. This place is not available yet!"); break; - case AvalancheEngine::kMagicSpecial: + case kMagicSpecial: _vm->_animation->callSpecial(portal->_data); break; - case AvalancheEngine::kMagicOpenDoor: + case kMagicOpenDoor: _vm->openDoor((Room)(portal->_data >> 8), portal->_data & 0x0F, i + 9); break; } @@ -2148,7 +2148,7 @@ void Parser::doThat() { _vm->_objects[kObjectBolt - 1] = false; _vm->_objects[kObjectCrossbow - 1] = false; _vm->refreshObjectList(); - _vm->_magics[11]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[11]._operation = kMagicNothing; _vm->incScore(7); _vm->_animation->_sprites[1].walkTo(1); _vm->_animation->_sprites[1]._vanishIfStill = true; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 1d145e439e..ff5cf828c5 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -232,7 +232,7 @@ void Timer::openDrawbridge() { _vm->_background->draw(-1, -1, _vm->_drawbridgeOpen - 2); if (_vm->_drawbridgeOpen == 4) - _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; // You may enter the drawbridge. + _vm->_magics[1]._operation = kMagicNothing; // You may enter the drawbridge. else addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); } @@ -273,9 +273,9 @@ void Timer::stairs() { _vm->_animation->_sprites[0].walkTo(3); _vm->_background->draw(-1, -1, 1); _vm->_brummieStairs = 2; - _vm->_magics[10]._operation = AvalancheEngine::kMagicSpecial; + _vm->_magics[10]._operation = kMagicSpecial; _vm->_magics[10]._data = 2; // Reached the bottom of the stairs. - _vm->_magics[3]._operation = AvalancheEngine::kMagicNothing; // Stop them hitting the sides (or the game will hang.) + _vm->_magics[3]._operation = kMagicNothing; // Stop them hitting the sides (or the game will hang.) } void Timer::cardiffSurvey() { @@ -315,7 +315,7 @@ void Timer::getTiedUp() { void Timer::getTiedUp2() { _vm->_animation->_sprites[0].walkTo(3); _vm->_animation->_sprites[1].walkTo(4); - _vm->_magics[3]._operation = AvalancheEngine::kMagicNothing; // No effect when you touch the boundaries. + _vm->_magics[3]._operation = kMagicNothing; // No effect when you touch the boundaries. _vm->_friarWillTieYouUp = true; } @@ -395,7 +395,7 @@ void Timer::jacquesWakesUp() { case 2 : // Going through the door. _vm->_background->draw(-1, -1, 1); // Not on the floor. _vm->_background->draw(-1, -1, 2); // But going through the door. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // You can't wake him up now. + _vm->_magics[5]._operation = kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. _vm->_background->draw(-1, -1, 1); // Not on the floor, either. @@ -538,7 +538,7 @@ void Timer::greetsMonk() { } void Timer::fallDownOubliette() { - _vm->_magics[8]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[8]._operation = kMagicNothing; AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->_moveY++; // Increments dx/dy! -- cgit v1.2.3