From 08883a807f8c568109430910836aeee6b96b64f2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 01:34:38 +0200 Subject: AVALANCHE: Merge Avalot and AvalancheEngine --- engines/avalanche/animation.cpp | 378 ++++++++++---------- engines/avalanche/avalanche.cpp | 233 +++++++------ engines/avalanche/avalanche.h | 247 ++++++++++++- engines/avalanche/avalot.cpp | 732 ++++++++++++++++++--------------------- engines/avalanche/avalot.h | 255 -------------- engines/avalanche/background.cpp | 94 ++--- engines/avalanche/dialogs.cpp | 354 +++++++++---------- engines/avalanche/menu.cpp | 178 +++++----- engines/avalanche/parser.cpp | 564 +++++++++++++++--------------- engines/avalanche/pingo.cpp | 6 +- engines/avalanche/sequence.cpp | 10 +- engines/avalanche/timer.cpp | 166 ++++----- 12 files changed, 1595 insertions(+), 1622 deletions(-) (limited to 'engines/avalanche') diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 101eccbdfe..cb64bb8fe0 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -147,8 +147,8 @@ void AnimationType::turn(Direction whichway) { void AnimationType::appear(int16 wx, int16 wy, Direction wf) { _x = (wx / 8) * 8; _y = wy; - _oldX[_anim->_vm->_avalot->_cp] = wx; - _oldY[_anim->_vm->_avalot->_cp] = wy; + _oldX[_anim->_vm->_cp] = wx; + _oldY[_anim->_vm->_cp] = wy; turn(wf); _visible = true; _moveX = 0; @@ -180,9 +180,9 @@ void AnimationType::walk() { r._y2 = _y + _info._yLength + 2; } - if (!_anim->_vm->_avalot->_doingSpriteRun) { - _oldX[_anim->_vm->_avalot->_cp] = _x; - _oldY[_anim->_vm->_avalot->_cp] = _y; + if (!_anim->_vm->_doingSpriteRun) { + _oldX[_anim->_vm->_cp] = _x; + _oldY[_anim->_vm->_cp] = _y; if (_homing) homeStep(); _x += _moveX; @@ -195,40 +195,40 @@ void AnimationType::walk() { return; } - byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_avalot->_cp], _y, _info._yLength) - 1; + byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . - if ((magicColor != 255) & (!_anim->_vm->_avalot->_doingSpriteRun)) { - MagicType *magic = &_anim->_vm->_avalot->_magics[magicColor]; + if ((magicColor != 255) & (!_anim->_vm->_doingSpriteRun)) { + MagicType *magic = &_anim->_vm->_magics[magicColor]; switch (magic->_operation) { - case Avalot::kMagicExclaim: + case AvalancheEngine::kMagicExclaim: bounce(); _anim->_mustExclaim = true; _anim->_sayWhat = magic->_data; break; - case Avalot::kMagicBounce: + case AvalancheEngine::kMagicBounce: bounce(); break; - case Avalot::kMagicTransport: - _anim->_vm->_avalot->flipRoom((Room)(magic->_data >> 8), magic->_data & 0xff); + case AvalancheEngine::kMagicTransport: + _anim->_vm->flipRoom((Room)(magic->_data >> 8), magic->_data & 0xff); break; - case Avalot::kMagicUnfinished: { + case AvalancheEngine::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 Avalot::kMagicSpecial: + case AvalancheEngine::kMagicSpecial: _anim->callSpecial(magic->_data); break; - case Avalot::kMagicOpenDoor: - _anim->_vm->_avalot->openDoor((Room)(magic->_data >> 8), magic->_data & 0xff, magicColor); + case AvalancheEngine::kMagicOpenDoor: + _anim->_vm->openDoor((Room)(magic->_data >> 8), magic->_data & 0xff, magicColor); break; } } } - if (!_anim->_vm->_avalot->_doingSpriteRun) { + if (!_anim->_vm->_doingSpriteRun) { _count++; if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) { _stepNum++; @@ -240,13 +240,13 @@ void AnimationType::walk() { } void AnimationType::bounce() { - _x = _oldX[_anim->_vm->_avalot->_cp]; - _y = _oldY[_anim->_vm->_avalot->_cp]; + _x = _oldX[_anim->_vm->_cp]; + _y = _oldY[_anim->_vm->_cp]; if (_doCheck) _anim->stopWalking(); else stopWalk(); - _anim->_vm->_avalot->drawDirection(); + _anim->_vm->drawDirection(); } int8 AnimationType::getSign(int16 val) { @@ -259,7 +259,7 @@ int8 AnimationType::getSign(int16 val) { } void AnimationType::walkTo(byte pedNum) { - PedType *curPed = &_anim->_vm->_avalot->_peds[pedNum]; + PedType *curPed = &_anim->_vm->_peds[pedNum]; setSpeed(getSign(curPed->_x - _x) * 4, getSign(curPed->_y - _y)); _homingX = curPed->_x - _info._xLength / 2; @@ -327,10 +327,10 @@ void AnimationType::stopWalk() { } void AnimationType::chatter() { - _anim->_vm->_avalot->_talkX = _x + _info._xLength / 2; - _anim->_vm->_avalot->_talkY = _y; - _anim->_vm->_avalot->_talkFontColor = _stat._fgBubbleCol; - _anim->_vm->_avalot->_talkBackgroundColor = _stat._bgBubbleCol; + _anim->_vm->_talkX = _x + _info._xLength / 2; + _anim->_vm->_talkY = _y; + _anim->_vm->_talkFontColor = _stat._fgBubbleCol; + _anim->_vm->_talkBackgroundColor = _stat._bgBubbleCol; } void AnimationType::remove() { @@ -368,7 +368,7 @@ void Animation::resetAnims() { } byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { - if (!_vm->_avalot->_alive) + if (!_vm->_alive) return 0; if (x1 < 0) @@ -413,98 +413,98 @@ void Animation::catacombMove(byte ped) { // XY_uint16 is cat_x+cat_y*256. Thus, every room in the // catacombs has a different number for it. - xy_uint16 = _vm->_avalot->_catacombX + _vm->_avalot->_catacombY * 256; + xy_uint16 = _vm->_catacombX + _vm->_catacombY * 256; _geidaSpin = 0; switch (xy_uint16) { case 1801: // Exit catacombs - _vm->_avalot->flipRoom(kRoomLustiesRoom, 4); + _vm->flipRoom(kRoomLustiesRoom, 4); _vm->_dialogs->displayText("Phew! Nice to be out of there!"); return; case 1033:{ // Oubliette - _vm->_avalot->flipRoom(kRoomOubliette, 1); + _vm->flipRoom(kRoomOubliette, 1); Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } return; case 4: - _vm->_avalot->flipRoom(kRoomGeidas, 1); + _vm->flipRoom(kRoomGeidas, 1); return; case 2307: - _vm->_avalot->flipRoom(kRoomLusties, 5); + _vm->flipRoom(kRoomLusties, 5); _vm->_dialogs->displayText("Oh no... here we go again..."); - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; _sprites[0]._moveY = 1; _sprites[0]._moveX = 0; return; } - if (!_vm->_avalot->_enterCatacombsFromLustiesRoom) - _vm->_avalot->loadRoom(29); - here = _vm->_avalot->kCatacombMap[_vm->_avalot->_catacombY - 1][_vm->_avalot->_catacombX - 1]; + if (!_vm->_enterCatacombsFromLustiesRoom) + _vm->loadRoom(29); + here = _vm->kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1]; switch (here & 0xf) { // West. case 0: // no connection (wall) - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); break; case 0x1: // no connection (wall + shield), - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 28); // ...shield. break; case 0x2: // wall with door - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // 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->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door. break; case 0x3: // wall with door and shield - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // 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->_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->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::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->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // 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->_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->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // No door. + _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->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 6); // ...torches. break; case 0x7: // wall with door and torches - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // 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->_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->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicSpecial; // Straight wall. + _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicSpecial; // Straight wall. break; } @@ -512,127 +512,127 @@ void Animation::catacombMove(byte ped) { switch ((here & 0xf0) >> 4) { // East case 0: // no connection (wall) - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 18); break; case 0x1: // no connection (wall + window), - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 19); // ...window. break; case 0x2: // wall with door - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // 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->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 20); // ...door. break; case 0x3: // wall with door and window - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // 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->_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->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // No door. + _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->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 17); // ...torches. break; case 0x7: // wall with door and torches - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // 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->_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->_avalot->_magics[4]._operation = Avalot::kMagicNothing; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicSpecial; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicNothing; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicSpecial; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. break; } switch ((here & 0xf00) >> 8) { // South case 0: // No connection. - _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; + _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; break; case 0x1: _vm->_background->draw(-1, -1, 21); - if ((xy_uint16 == 2051) && (_vm->_avalot->_geidaFollows)) - _vm->_avalot->_magics[12]._operation = Avalot::kMagicExclaim; + if ((xy_uint16 == 2051) && (_vm->_geidaFollows)) + _vm->_magics[12]._operation = AvalancheEngine::kMagicExclaim; else - _vm->_avalot->_magics[12]._operation = Avalot::kMagicSpecial; // Right exit south. + _vm->_magics[12]._operation = AvalancheEngine::kMagicSpecial; // Right exit south. - _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; + _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; break; case 0x2: _vm->_background->draw(-1, -1, 22); - _vm->_avalot->_magics[6]._operation = Avalot::kMagicSpecial; // Middle exit south. - _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; + _vm->_magics[6]._operation = AvalancheEngine::kMagicSpecial; // Middle exit south. + _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; break; case 0x3: _vm->_background->draw(-1, -1, 23); - _vm->_avalot->_magics[11]._operation = Avalot::kMagicSpecial; // Left exit south. - _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; + _vm->_magics[11]._operation = AvalancheEngine::kMagicSpecial; // Left exit south. + _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; break; } switch ((here & 0xf000) >> 12) { // North case 0: // No connection - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; - _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; + _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. break; // LEFT handles: #if 0 case 0x1: _vm->_celer->show_one(-1, -1, 4); - _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! } - _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } + _vm->magics[1].op = _vm->bounces; // { Left exit north. } { Change magic number! } + _vm->portals[12].op = _vm->special; // { Door. } break; #endif case 0x2: _vm->_background->draw(-1, -1, 3); - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. - _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; // Middle exit north. + _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. break; #if 0 case 0x3: _vm->_celer->show_one(-1, -1, 4); - _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. } { Change magic number! } - _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } + _vm->magics[1].op = _vm->bounces; // { Right exit north. } { Change magic number! } + _vm->portals[12].op = _vm->special; // { Door. } break; // RIGHT handles: case 0x4: _vm->_celer->show_one(-1, -1, 3); - _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! } - _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } + _vm->magics[1].op = _vm->bounces; // { Left exit north. } { Change magic number! } + _vm->portals[12].op = _vm->special; // { Door. } break; #endif case 0x5: _vm->_background->draw(-1, -1, 2); - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. - _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; // Middle exit north. + _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. break; #if 0 case 0x6: _vm->_celer->show_one(-1, -1, 3); - _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. } - _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } + _vm->magics[1].op = _vm->bounces; // { Right exit north. } + _vm->portals[12].op = _vm->special; // { Door. } break; #endif // ARCHWAYS: @@ -646,25 +646,25 @@ void Animation::catacombMove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_background->draw(-1, -1, 31); - _vm->_avalot->_magics[0]._operation = Avalot::kMagicSpecial; // Middle arch north. - _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicSpecial; // Middle arch north. + _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. break; // DECORATIONS: case 0xd: // No connection + WINDOW - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; - _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; + _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 13); break; case 0xe: // No connection + TORCH - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; - _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; + _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 7); break; // Recessed door: case 0xf: - _vm->_avalot->_magics[0]._operation = Avalot::kMagicNothing; // Door to Geida's room. + _vm->_magics[0]._operation = AvalancheEngine::kMagicNothing; // Door to Geida's room. _vm->_background->draw(-1, -1, 0); - _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. + _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. break; } @@ -700,7 +700,7 @@ void Animation::catacombMove(byte ped) { break; // [1,1] : the other two. } - if ((_vm->_avalot->_geidaFollows) && (ped > 0)) { + if ((_vm->_geidaFollows) && (ped > 0)) { if (!_sprites[1]._quick) // If we don't already have her... _sprites[1].init(5, true, this); // ...Load Geida. appearPed(1, geidaPed(ped)); @@ -709,36 +709,36 @@ void Animation::catacombMove(byte ped) { } } -// This proc gets called whenever you touch a line defined as _vm->_avalot->special. +// This proc gets called whenever you touch a line defined as _vm->special. void Animation::dawnDelay() { _vm->_timer->addTimer(2, Timer::kProcDawnDelay, Timer::kReasonDawndelay); } void Animation::callSpecial(uint16 which) { switch (which) { - case 1: // _vm->_avalot->special 1: Room 22: top of stairs. + case 1: // _vm->special 1: Room 22: top of stairs. _vm->_background->draw(-1, -1, 0); - _vm->_avalot->_brummieStairs = 1; - _vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing; + _vm->_brummieStairs = 1; + _vm->_magics[9]._operation = AvalancheEngine::kMagicNothing; _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); stopWalking(); - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; break; - case 2: // _vm->_avalot->special 2: Room 22: bottom of stairs. - _vm->_avalot->_brummieStairs = 3; - _vm->_avalot->_magics[10]._operation = Avalot::kMagicNothing; - _vm->_avalot->_magics[11]._operation = Avalot::kMagicExclaim; - _vm->_avalot->_magics[11]._data = 5; - _vm->_avalot->_magics[3]._operation = Avalot::kMagicBounce; // Now works as planned! + 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[11]._data = 5; + _vm->_magics[3]._operation = AvalancheEngine::kMagicBounce; // Now works as planned! stopWalking(); _vm->_dialogs->displayScrollChain('q', 26); - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; break; - case 3: // _vm->_avalot->special 3: Room 71: triggers dart. + case 3: // _vm->special 3: Room 71: triggers dart. _sprites[0].bounce(); // Must include that. - if (!_vm->_avalot->_arrowTriggered) { - _vm->_avalot->_arrowTriggered = true; + if (!_vm->_arrowTriggered) { + _vm->_arrowTriggered = true; appearPed(1, 3); // The dart starts at ped 4, and... _sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). _sprites[1]._facingDir = kDirUp; // Only face. @@ -752,80 +752,80 @@ void Animation::callSpecial(uint16 which) { } break; case 4: // This is the ghost room link. - _vm->_avalot->dusk(); + _vm->dusk(); _sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap _vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew); //_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: - if (_vm->_avalot->_friarWillTieYouUp) { - // _vm->_avalot->special 5: Room 42: touched tree, and get tied up. - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Boundary effect is now working again. + 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->_dialogs->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; _vm->_background->draw(-1, -1, 1); _vm->_dialogs->displayScrollChain('q', 36); - _vm->_avalot->_tiedUp = true; - _vm->_avalot->_friarWillTieYouUp = false; + _vm->_tiedUp = true; + _vm->_friarWillTieYouUp = false; _sprites[1].walkTo(2); _sprites[1]._vanishIfStill = true; _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. - _vm->_avalot->setRoom(kPeopleFriarTuck, kRoomDummy); // Not here, then. + _vm->setRoom(kPeopleFriarTuck, kRoomDummy); // Not here, then. _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); } break; - case 6: // _vm->_avalot->special 6: fall down oubliette. - _vm->_avalot->_userMovesAvvy = false; + case 6: // _vm->special 6: fall down oubliette. + _vm->_userMovesAvvy = false; _sprites[0]._moveX = 3; _sprites[0]._moveY = 0; _sprites[0]._facingDir = kDirRight; _vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette); break; - case 7: // _vm->_avalot->special 7: stop falling down oubliette. + case 7: // _vm->special 7: stop falling down oubliette. _sprites[0]._visible = false; - _vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing; + _vm->_magics[9]._operation = AvalancheEngine::kMagicNothing; stopWalking(); _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); - //_vm->_avalot->mblit(12, 80, 38, 160, 3, 0); - //_vm->_avalot->mblit(12, 80, 38, 160, 3, 1); + //_vm->mblit(12, 80, 38, 160, 3, 0); + //_vm->mblit(12, 80, 38, 160, 3, 1); _vm->_dialogs->displayText("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid); break; - case 8: // _vm->_avalot->special 8: leave du Lustie's room. - if ((_vm->_avalot->_geidaFollows) && (!_vm->_avalot->_lustieIsAsleep)) { + case 8: // _vm->special 8: leave du Lustie's room. + if ((_vm->_geidaFollows) && (!_vm->_lustieIsAsleep)) { _vm->_dialogs->displayScrollChain('q', 63); _sprites[1].turn(kDirDown); _sprites[1].stopWalk(); _sprites[1]._callEachStepFl = false; // Geida - _vm->_avalot->gameOver(); + _vm->gameOver(); } break; - case 9: // _vm->_avalot->special 9: lose Geida to Robin Hood... - if (!_vm->_avalot->_geidaFollows) + case 9: // _vm->special 9: lose Geida to Robin Hood... + if (!_vm->_geidaFollows) return; // DOESN'T COUNT: no Geida. _sprites[1]._callEachStepFl = false; // She no longer follows Avvy around. _sprites[1].walkTo(3); // She walks to somewhere... _sprites[0].remove(); // Lose Avvy. - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; _vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida); break; - case 10: // _vm->_avalot->special 10: transfer north in catacombs. - if ((_vm->_avalot->_catacombX == 4) && (_vm->_avalot->_catacombY == 1)) { + case 10: // _vm->special 10: transfer north in catacombs. + if ((_vm->_catacombX == 4) && (_vm->_catacombY == 1)) { // Into Geida's room. - if (_vm->_avalot->_objects[kObjectKey - 1]) + if (_vm->_objects[kObjectKey - 1]) _vm->_dialogs->displayScrollChain('q', 62); else { _vm->_dialogs->displayScrollChain('q', 61); return; } } - _vm->_avalot->dusk(); - _vm->_avalot->_catacombY--; + _vm->dusk(); + _vm->_catacombY--; catacombMove(4); - if (_vm->_avalot->_room != kRoomCatacombs) + if (_vm->_room != kRoomCatacombs) return; - switch ((_vm->_avalot->kCatacombMap[_vm->_avalot->_catacombY - 1][_vm->_avalot->_catacombX - 1] & 0xf00) >> 8) { + switch ((_vm->kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1] & 0xf00) >> 8) { case 0x1: appearPed(0, 11); break; @@ -837,29 +837,29 @@ void Animation::callSpecial(uint16 which) { } dawnDelay(); break; - case 11: // _vm->_avalot->special 11: transfer east in catacombs. - _vm->_avalot->dusk(); - _vm->_avalot->_catacombX++; + case 11: // _vm->special 11: transfer east in catacombs. + _vm->dusk(); + _vm->_catacombX++; catacombMove(1); - if (_vm->_avalot->_room != kRoomCatacombs) + if (_vm->_room != kRoomCatacombs) return; appearPed(0, 0); dawnDelay(); break; - case 12: // _vm->_avalot->special 12: transfer south in catacombs. - _vm->_avalot->dusk(); - _vm->_avalot->_catacombY++; + case 12: // _vm->special 12: transfer south in catacombs. + _vm->dusk(); + _vm->_catacombY++; catacombMove(2); - if (_vm->_avalot->_room != kRoomCatacombs) + if (_vm->_room != kRoomCatacombs) return; appearPed(0, 1); dawnDelay(); break; - case 13: // _vm->_avalot->special 13: transfer west in catacombs. - _vm->_avalot->dusk(); - _vm->_avalot->_catacombX--; + case 13: // _vm->special 13: transfer west in catacombs. + _vm->dusk(); + _vm->_catacombX--; catacombMove(3); - if (_vm->_avalot->_room != kRoomCatacombs) + if (_vm->_room != kRoomCatacombs) return; appearPed(0, 2); dawnDelay(); @@ -872,7 +872,7 @@ void Animation::updateSpeed() { _sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; - if (_sprites[0]._speedX == _vm->_avalot->kRun) { + if (_sprites[0]._speedX == _vm->kRun) { _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); } else { @@ -912,7 +912,7 @@ void Animation::setMoveSpeed(byte t, Direction dir) { void Animation::appearPed(byte sprNum, byte pedNum) { AnimationType *curSpr = &_sprites[sprNum]; - PedType *curPed = &_vm->_avalot->_peds[pedNum]; + PedType *curPed = &_vm->_peds[pedNum]; curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); setMoveSpeed(sprNum, curPed->_direction); } @@ -972,15 +972,15 @@ void Animation::arrowProcs(byte tripnum) { _vm->_dialogs->displayScrollChain('Q', 47); // Complaint! _sprites[tripnum].remove(); // Deallocate the arrow. - _vm->_avalot->gameOver(); + _vm->gameOver(); - _vm->_avalot->_userMovesAvvy = false; // Stop the user from moving him. + _vm->_userMovesAvvy = false; // Stop the user from moving him. _vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke); } } else { // Arrow has hit the wall! _sprites[tripnum].remove(); // Deallocate the arrow. _vm->_background->draw(-1, -1, 2); // Show pic of arrow stuck into the door. - _vm->_avalot->_arrowInTheDoor = true; // So that we can pick it up. + _vm->_arrowInTheDoor = true; // So that we can pick it up. } } @@ -1114,7 +1114,7 @@ void Animation::drawSprites() { * @remarks Originally called 'trippancy_link' */ void Animation::animLink() { - if (_vm->_menu->isActive() | _vm->_avalot->_onToolbar | _vm->_avalot->_seeScroll) + if (_vm->_menu->isActive() | _vm->_onToolbar | _vm->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._visible) @@ -1158,7 +1158,7 @@ void Animation::animLink() { void Animation::stopWalking() { _sprites[0].stopWalk(); _direction = kDirStopped; - if (_vm->_avalot->_alive) + if (_vm->_alive) _sprites[0]._stepNum = 1; } @@ -1167,39 +1167,39 @@ void Animation::stopWalking() { * @remarks Originally called 'hide_in_the_cupboard' */ void Animation::hideInCupboard() { - if (_vm->_avalot->_avvysInTheCupboard) { + if (_vm->_avvysInTheCupboard) { if (_vm->_parser->_wearing == kObjectDummy) { Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { _sprites[0]._visible = true; - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; appearPed(0, 2); // Walk out of the cupboard. _vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!"); - _vm->_avalot->_avvysInTheCupboard = false; + _vm->_avvysInTheCupboard = false; _vm->_sequence->startCupboardSeq(); } } else { // Not hiding in the cupboard _sprites[0]._visible = false; - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_avvysInTheCupboard = true; + _vm->_avvysInTheCupboard = true; _vm->_background->draw(-1, -1, 7); } } bool Animation::inField(byte which) { - FieldType *curField = &_vm->_avalot->_fields[which]; + FieldType *curField = &_vm->_fields[which]; int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); } bool Animation::nearDoor() { - if (_vm->_avalot->_fieldNum < 8) { + if (_vm->_fieldNum < 8) { // there ARE no doors here! return false; } @@ -1207,8 +1207,8 @@ bool Animation::nearDoor() { int16 ux = _sprites[0]._x; int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; - for (int i = 8; i < _vm->_avalot->_fieldNum; i++) { - FieldType *curField = &_vm->_avalot->_fields[i]; + for (int i = 8; i < _vm->_fieldNum; i++) { + FieldType *curField = &_vm->_fields[i]; if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2)) return true; } @@ -1217,7 +1217,7 @@ bool Animation::nearDoor() { } void Animation::handleMoveKey(const Common::Event &event) { - if (!_vm->_avalot->_userMovesAvvy) + if (!_vm->_userMovesAvvy) return; if (_vm->_menu->_activeMenuItem._activeNow) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 222414ca02..cd943513ba 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -45,13 +45,21 @@ namespace Avalanche { AvalancheEngine *AvalancheEngine::s_Engine = 0; -AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) { +AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd), _fxHidden(false), _interrogation(0) { _system = syst; s_Engine = this; _console = new AvalancheConsole(this); _rnd = new Common::RandomSource("avalanche"); _rnd->setSeed(42); + + // Needed because of Lucerna::load_also() + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) + _also[i][j] = nullptr; + } + + _totalTime = 0; } AvalancheEngine::~AvalancheEngine() { @@ -61,7 +69,7 @@ AvalancheEngine::~AvalancheEngine() { delete _graphics; delete _parser; - delete _avalot; + delete _clock; delete _pingo; delete _dialogs; delete _background; @@ -71,13 +79,28 @@ AvalancheEngine::~AvalancheEngine() { delete _menu; delete _closing; delete _sound; + + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { + if (_also[i][j] != nullptr) { + delete _also[i][j]; + _also[i][j] = nullptr; + } + } + } + + for (int i = 0; i < 9; i++) { + _digits[i].free(); + _directions[i].free(); + } + _digits[9].free(); } Common::ErrorCode AvalancheEngine::initialize() { _graphics = new Graphics(this); _parser = new Parser(this); - _avalot = new Avalot(this); + _clock = new Clock(this); _pingo = new Pingo(this); _dialogs = new Dialogs(this); _background = new Background(this); @@ -90,7 +113,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _graphics->init(); _dialogs->init(); - _avalot->init(); + init(); _parser->init(); return Common::kNoError; @@ -117,138 +140,138 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { _parser->synchronize(sz); _sequence->synchronize(sz); - sz.syncAsByte(_avalot->_carryNum); + sz.syncAsByte(_carryNum); for (int i = 0; i < kObjectNum; i++) - sz.syncAsByte(_avalot->_objects[i]); - sz.syncAsSint16LE(_avalot->_dnascore); - sz.syncAsSint32LE(_avalot->_money); - sz.syncAsByte(_avalot->_room); + sz.syncAsByte(_objects[i]); + sz.syncAsSint16LE(_dnascore); + sz.syncAsSint32LE(_money); + sz.syncAsByte(_room); if (sz.isSaving()) _saveNum++; sz.syncAsByte(_saveNum); - sz.syncBytes(_avalot->_roomCount, 100); - sz.syncAsByte(_avalot->_wonNim); - sz.syncAsByte(_avalot->_wineState); - sz.syncAsByte(_avalot->_cwytalotGone); - sz.syncAsByte(_avalot->_passwordNum); - sz.syncAsByte(_avalot->_aylesIsAwake); - sz.syncAsByte(_avalot->_drawbridgeOpen); - sz.syncAsByte(_avalot->_avariciusTalk); - sz.syncAsByte(_avalot->_rottenOnion); - sz.syncAsByte(_avalot->_onionInVinegar); - sz.syncAsByte(_avalot->_givenToSpludwick); - sz.syncAsByte(_avalot->_brummieStairs); - sz.syncAsByte(_avalot->_cardiffQuestionNum); - sz.syncAsByte(_avalot->_passedCwytalotInHerts); - sz.syncAsByte(_avalot->_avvyIsAwake); - sz.syncAsByte(_avalot->_avvyInBed); - sz.syncAsByte(_avalot->_userMovesAvvy); - sz.syncAsByte(_avalot->_npcFacing); - sz.syncAsByte(_avalot->_givenBadgeToIby); - sz.syncAsByte(_avalot->_friarWillTieYouUp); - sz.syncAsByte(_avalot->_tiedUp); - sz.syncAsByte(_avalot->_boxContent); - sz.syncAsByte(_avalot->_talkedToCrapulus); - sz.syncAsByte(_avalot->_jacquesState); - sz.syncAsByte(_avalot->_bellsAreRinging); - sz.syncAsByte(_avalot->_standingOnDais); - sz.syncAsByte(_avalot->_takenPen); - sz.syncAsByte(_avalot->_arrowTriggered); - sz.syncAsByte(_avalot->_arrowInTheDoor); + sz.syncBytes(_roomCount, 100); + sz.syncAsByte(_wonNim); + sz.syncAsByte(_wineState); + sz.syncAsByte(_cwytalotGone); + sz.syncAsByte(_passwordNum); + sz.syncAsByte(_aylesIsAwake); + sz.syncAsByte(_drawbridgeOpen); + sz.syncAsByte(_avariciusTalk); + sz.syncAsByte(_rottenOnion); + sz.syncAsByte(_onionInVinegar); + sz.syncAsByte(_givenToSpludwick); + sz.syncAsByte(_brummieStairs); + sz.syncAsByte(_cardiffQuestionNum); + sz.syncAsByte(_passedCwytalotInHerts); + sz.syncAsByte(_avvyIsAwake); + sz.syncAsByte(_avvyInBed); + sz.syncAsByte(_userMovesAvvy); + sz.syncAsByte(_npcFacing); + sz.syncAsByte(_givenBadgeToIby); + sz.syncAsByte(_friarWillTieYouUp); + sz.syncAsByte(_tiedUp); + sz.syncAsByte(_boxContent); + sz.syncAsByte(_talkedToCrapulus); + sz.syncAsByte(_jacquesState); + sz.syncAsByte(_bellsAreRinging); + sz.syncAsByte(_standingOnDais); + sz.syncAsByte(_takenPen); + sz.syncAsByte(_arrowTriggered); + sz.syncAsByte(_arrowInTheDoor); if (sz.isSaving()) { - uint16 like2drinkSize = _avalot->_favouriteDrink.size(); + uint16 like2drinkSize = _favouriteDrink.size(); sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { - char actChr = _avalot->_favouriteDrink[i]; + char actChr = _favouriteDrink[i]; sz.syncAsByte(actChr); } - uint16 favourite_songSize = _avalot->_favouriteSong.size(); + uint16 favourite_songSize = _favouriteSong.size(); sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { - char actChr = _avalot->_favouriteSong[i]; + char actChr = _favouriteSong[i]; sz.syncAsByte(actChr); } - uint16 worst_place_on_earthSize = _avalot->_worstPlaceOnEarth.size(); + uint16 worst_place_on_earthSize = _worstPlaceOnEarth.size(); sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { - char actChr = _avalot->_worstPlaceOnEarth[i]; + char actChr = _worstPlaceOnEarth[i]; sz.syncAsByte(actChr); } - uint16 spare_eveningSize = _avalot->_spareEvening.size(); + uint16 spare_eveningSize = _spareEvening.size(); sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { - char actChr = _avalot->_spareEvening[i]; + char actChr = _spareEvening[i]; sz.syncAsByte(actChr); } } else { - if (!_avalot->_favouriteDrink.empty()) - _avalot->_favouriteDrink.clear(); + if (!_favouriteDrink.empty()) + _favouriteDrink.clear(); uint16 like2drinkSize = 0; char actChr = ' '; sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { sz.syncAsByte(actChr); - _avalot->_favouriteDrink += actChr; + _favouriteDrink += actChr; } - if (!_avalot->_favouriteSong.empty()) - _avalot->_favouriteSong.clear(); + if (!_favouriteSong.empty()) + _favouriteSong.clear(); uint16 favourite_songSize = 0; sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { sz.syncAsByte(actChr); - _avalot->_favouriteSong += actChr; + _favouriteSong += actChr; } - if (!_avalot->_worstPlaceOnEarth.empty()) - _avalot->_worstPlaceOnEarth.clear(); + if (!_worstPlaceOnEarth.empty()) + _worstPlaceOnEarth.clear(); uint16 worst_place_on_earthSize = 0; sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { sz.syncAsByte(actChr); - _avalot->_worstPlaceOnEarth += actChr; + _worstPlaceOnEarth += actChr; } - if (!_avalot->_spareEvening.empty()) - _avalot->_spareEvening.clear(); + if (!_spareEvening.empty()) + _spareEvening.clear(); uint16 spare_eveningSize = 0; sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { sz.syncAsByte(actChr); - _avalot->_spareEvening += actChr; + _spareEvening += actChr; } } - sz.syncAsSint32LE(_avalot->_totalTime); - sz.syncAsByte(_avalot->_jumpStatus); - sz.syncAsByte(_avalot->_mushroomGrowing); - sz.syncAsByte(_avalot->_spludwickAtHome); - sz.syncAsByte(_avalot->_lastRoom); - sz.syncAsByte(_avalot->_lastRoomNotMap); - sz.syncAsByte(_avalot->_crapulusWillTell); - sz.syncAsByte(_avalot->_enterCatacombsFromLustiesRoom); - sz.syncAsByte(_avalot->_teetotal); - sz.syncAsByte(_avalot->_malagauche); - sz.syncAsByte(_avalot->_drinking); - sz.syncAsByte(_avalot->_enteredLustiesRoomAsMonk); - sz.syncAsByte(_avalot->_catacombX); - sz.syncAsByte(_avalot->_catacombY); - sz.syncAsByte(_avalot->_avvysInTheCupboard); - sz.syncAsByte(_avalot->_geidaFollows); - sz.syncAsByte(_avalot->_nextBell); - sz.syncAsByte(_avalot->_givenPotionToGeida); - sz.syncAsByte(_avalot->_lustieIsAsleep); - sz.syncAsByte(_avalot->_beenTiedUp); - sz.syncAsByte(_avalot->_sittingInPub); - sz.syncAsByte(_avalot->_spurgeTalkCount); - sz.syncAsByte(_avalot->_metAvaroid); - sz.syncAsByte(_avalot->_takenMushroom); - sz.syncAsByte(_avalot->_givenPenToAyles); - sz.syncAsByte(_avalot->_askedDogfoodAboutNim); + sz.syncAsSint32LE(_totalTime); + sz.syncAsByte(_jumpStatus); + sz.syncAsByte(_mushroomGrowing); + sz.syncAsByte(_spludwickAtHome); + sz.syncAsByte(_lastRoom); + sz.syncAsByte(_lastRoomNotMap); + sz.syncAsByte(_crapulusWillTell); + sz.syncAsByte(_enterCatacombsFromLustiesRoom); + sz.syncAsByte(_teetotal); + sz.syncAsByte(_malagauche); + sz.syncAsByte(_drinking); + sz.syncAsByte(_enteredLustiesRoomAsMonk); + sz.syncAsByte(_catacombX); + sz.syncAsByte(_catacombY); + sz.syncAsByte(_avvysInTheCupboard); + sz.syncAsByte(_geidaFollows); + sz.syncAsByte(_nextBell); + sz.syncAsByte(_givenPotionToGeida); + sz.syncAsByte(_lustieIsAsleep); + sz.syncAsByte(_beenTiedUp); + sz.syncAsByte(_sittingInPub); + sz.syncAsByte(_spurgeTalkCount); + sz.syncAsByte(_metAvaroid); + sz.syncAsByte(_takenMushroom); + sz.syncAsByte(_givenPenToAyles); + sz.syncAsByte(_askedDogfoodAboutNim); for (int i = 0; i < 7; i++) { sz.syncAsSint32LE(_timer->_times[i]._timeLeft); @@ -259,7 +282,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! - return (!_avalot->_seeScroll && _avalot->_alive); + return (!_seeScroll && _alive); } Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) { @@ -305,7 +328,7 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) { } bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! - return (!_avalot->_seeScroll); + return (!_seeScroll); } Common::Error AvalancheEngine::loadGameState(int slot) { @@ -354,29 +377,29 @@ bool AvalancheEngine::loadGame(const int16 slot) { synchronize(sz); delete f; - _avalot->_isLoaded = true; - _avalot->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. + _isLoaded = true; + _seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. - if (_avalot->_holdTheDawn) { - _avalot->_holdTheDawn = false; - _avalot->dawn(); + if (_holdTheDawn) { + _holdTheDawn = false; + dawn(); } _background->release(); - _avalot->minorRedraw(); + minorRedraw(); _menu->setup(); - _avalot->setRoom(kPeopleAvalot, _avalot->_room); - _avalot->_alive = true; - _avalot->refreshObjectList(); + setRoom(kPeopleAvalot, _room); + _alive = true; + refreshObjectList(); _animation->updateSpeed(); - _avalot->drawDirection(); - _avalot->_onToolbar = false; + drawDirection(); + _onToolbar = false; _animation->animLink(); _background->update(); Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter, - Dialogs::kControlNewLine, Dialogs::kControlNewLine, _avalot->_roomnName.c_str(), Dialogs::kControlNewLine, + Dialogs::kControlNewLine, Dialogs::kControlNewLine, _roomnName.c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); _dialogs->displayText(tmpStr); @@ -393,7 +416,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { }; Common::String month = months[m]; - Common::String day = _avalot->intToStr(d); + Common::String day = intToStr(d); if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31))) switch (d % 10) { @@ -410,7 +433,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { day += "th"; } - return day + ' ' + month + ' ' + _avalot->intToStr(y + 1900); + return day + ' ' + month + ' ' + intToStr(y + 1900); } void AvalancheEngine::updateEvents() { @@ -419,13 +442,13 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: - _avalot->_holdLeftMouse = true; // Used in Avalot::checkclick() and Menu::menu_link(). + _holdLeftMouse = true; // Used in checkclick() and Menu::menu_link(). break; case Common::EVENT_LBUTTONUP: - _avalot->_holdLeftMouse = false; // Same as above. + _holdLeftMouse = false; // Same as above. break; case Common::EVENT_KEYDOWN: - _avalot->handleKeyDown(event); + handleKeyDown(event); break; default: break; @@ -447,7 +470,7 @@ Common::Error AvalancheEngine::run() { return err; do { - _avalot->runAvalot(); + runAvalot(); #if 0 switch (_storage._operation) { @@ -466,7 +489,7 @@ Common::Error AvalancheEngine::run() { } #endif - } while (!_avalot->_letMeOut && !shouldQuit()); + } while (!_letMeOut && !shouldQuit()); return Common::kNoError; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 27a5bd6321..5977721997 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -59,11 +59,18 @@ struct AvalancheGameDescription; static const int kSavegameVersion = 1; +enum Pitch { + kPitchInvalid, + kPitchLower, + kPitchSame, + kPitchHigher +}; + class AvalancheEngine : public Engine { public: byte _saveNum; // number of times this game has been saved - Avalot *_avalot; + Clock *_clock; Graphics *_graphics; Parser *_parser; Pingo *_pingo; @@ -153,6 +160,244 @@ private: void cursorOn(); void quit(); #endif + +public: + static const int16 kXW = 30; + static const int16 kYW = 36; // x width & y whatsit + static const int16 kMargin = 5; + static const MouseHotspotType kMouseHotSpots[9]; + static const int16 kMaxSprites = 2; // Current max no. of sprites. + + // For Thinkabout: + 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 bool kSlowComputer = false; // Stops walking when mouse touches toolbar. + static const int16 kBorder = 1; // size of border on shadowboxes + static const int16 kWalk = 3; + static const int16 kRun = 5; + static const int32 kCatacombMap[8][8]; + static const char kSpludwicksOrder[3]; + static const QuasipedType kQuasipeds[16]; + + static const uint16 kNotes[12]; + static const TuneType kTune; + + static const char *kVersionNum; + static const char *kCopyright; + static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".". + static const int16 kGameCode = 2; // Avalot's code number + + bool _holdLeftMouse; + + // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. + // If a scroll comes up, or you leave the room, it's automatically set to zero. + byte _interrogation; + + // Former DNA structure + byte _carryNum; // How many objects you're carrying... + bool _objects[kObjectNum]; // ...and which ones they are. + int16 _dnascore; // your score, of course + int32 _money; // your current amount of dosh + Room _room; // your current room + byte _roomCount[100]; // Add one to each every time you enter a room + bool _wonNim; // Have you *won* Nim? (That's harder.) + byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. + bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? + byte _passwordNum; // Number of the passw for this game. + bool _aylesIsAwake; // pretty obvious! + byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). + byte _avariciusTalk; // How much Avaricius has said to you. + bool _rottenOnion; // And has it rotted? + bool _onionInVinegar; // Is the onion in the vinegar? + byte _givenToSpludwick; // 0 = nothing given, 1 = onion... + byte _brummieStairs; // Progression through the stairs trick. + byte _cardiffQuestionNum; // Things you get asked in Cardiff. + bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? + bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) + bool _avvyInBed; // True if Avvy's in bed, but awake. + bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. + byte _npcFacing; // If there's an NPC in the current room which turns it's head according to Avvy's movement (keep looking at him), this variable tells which way it's facing at the moment. + bool _givenBadgeToIby; // Have you given the badge to Iby yet? + bool _friarWillTieYouUp; // If you're going to get tied up. + bool _tiedUp; // You ARE tied up! + byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. + bool _talkedToCrapulus; // Pretty self-explanatory. + byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. + bool _bellsAreRinging; // Is Jacques ringing the bells? + bool _standingOnDais; // In room 71, inside Cardiff Castle. + bool _takenPen; // Have you taken the pen (in Cardiff?) + bool _arrowTriggered; // And has the arrow been triggered? + bool _arrowInTheDoor; // Did the arrow hit the wall? + Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's + uint32 _totalTime; // Your total time playing this game, in ticks. + byte _jumpStatus; // Fixes how high you're jumping. + bool _mushroomGrowing; // Is the mushroom growing in 42? + bool _spludwickAtHome; // Is Spludwick at home? + byte _lastRoom; + byte _lastRoomNotMap; + bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? + bool _enterCatacombsFromLustiesRoom; + bool _teetotal; // Are we touching any more drinks? + byte _malagauche; // Position of Malagauche. See Celer for more info. + char _drinking; // What's he getting you? + bool _enteredLustiesRoomAsMonk; + byte _catacombX, _catacombY; // XY coords in the catacombs. + bool _avvysInTheCupboard; // On screen 22. + bool _geidaFollows; // Is Geida following you? + byte _nextBell; // For the ringing. + bool _givenPotionToGeida; // Does Geida have the potion? + bool _lustieIsAsleep; // Is BDL asleep? + bool _beenTiedUp; // In r__Robins. + bool _sittingInPub; // Are you sitting down in the pub? + byte _spurgeTalkCount; // Count for talking to Spurge. + bool _metAvaroid; + bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; + // End of former DNA Structure + + byte _lineNum; // Number of lines. + LineType _lines[50]; // For Also. + enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; + bool _dropsOk, _soundFx, _cheat; + Common::String _mouseText; + bool _weirdWord; + bool _letMeOut; + Common::String _scroll[15]; + byte _scrollNum, _whichwas; + byte _thinks; + bool _thinkThing; + int16 _talkX, _talkY; + byte _talkBackgroundColor, _talkFontColor; + byte _scrollBells; // no. of times to ring the bell + bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? + char _objectList[10]; + ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! + ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. + // Called .free() for them in ~Gyro(). + int8 _scoreToDisplay[3]; + byte _currentMouse; // current mouse-void + Common::String _verbStr; // what you can do with your object. :-) + Common::String *_also[31][2]; + PedType _peds[15]; + MagicType _magics[15]; + MagicType _portals[7]; + FieldType _fields[30]; + byte _fieldNum; + Common::String _flags; + Common::String _listen; + byte _cp, _ledStatus, _defaultLed; + FontType _font; + bool _alive; + byte _buffer[2000]; + uint16 _bufSize; + int16 _underScroll; // Y-coord of just under the scroll text. + Common::String _roomnName; // Name of actual room + Common::String _subject; // What you're talking to them about. + byte _subjectNum; // The same thing. + bool _keyboardClick; // Is a keyboard click noise wanted? + People _him, _her; + byte _it; + int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. + + People _lastPerson; // Last person to have been selected using the People menu. + bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. + bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. + bool _isLoaded; // Is it a loaded gamestate? + Common::String _enidFilename; + + void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). + void setup(); + void runAvalot(); + + void init(); + void callVerb(VerbCode id); + void drawAlsoLines(); + void loadRoom(byte num); + void exitRoom(byte x); + void enterRoom(Room room, byte ped); + void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! + void loadDigits(); // Load the scoring digits & rwlites + void drawToolbar(); + void drawScore(); + void incScore(byte num); // Add on no. of points + void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement. + void fxToggle(); + void refreshObjectList(); + void checkClick(); + void errorLed(); + void dusk(); + void dawn(); + void drawDirection(); // Draws the little icon at the left end of the text input field. + void gameOver(); + uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. + void fixFlashers(); + void loadAlso(byte num); + + // There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING. + void minorRedraw(); + void majorRedraw(); + + void spriteRun(); + + Common::String intToStr(int32 num); + void newMouse(byte id); + void setMousePointerWait(); // Makes hourglass. + void loadMouse(byte which); + + void setBackgroundColor(byte x); + + void resetVariables(); + void newGame(); // This sets up the DNA for a completely new game. + void slowDown(); + bool setFlag(char x); + bool decreaseMoney(uint16 amount); // Called pennycheck in the original. + void hangAroundForAWhile(); + + 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. + + void openDoor(Room whither, byte ped, byte magicnum); // Handles slidey-open doors. + void flipRoom(Room room, byte ped); + + void setRoom(People persId, Room roomId); + Room getRoom(People persId); +private: + static Room _whereIs[29]; + + Common::File file; + Common::String readAlsoStringFromFile(); + void scram(Common::String &str); + void unScramble(); + + void zoomOut(int16 x, int16 y); // Only used when entering the map. + void enterNewTown(); + void findPeople(byte room); + void putGeidaAt(byte whichPed, byte ped); + void guideAvvy(Common::Point cursorPos); + + // Will be used in dusk() and dawn(). + bool _fxHidden; + + int8 fades(int8 x); + void fadeOut(byte n); + void fadeIn(byte n); }; } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6bf1b46913..e5ed210d05 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -28,16 +28,6 @@ /* AVALOT The kernel of the program. */ #include "avalanche/avalanche.h" -#include "avalanche/graphics.h" -#include "avalanche/avalot.h" -#include "avalanche/animation.h" -#include "avalanche/dialogs.h" -#include "avalanche/menu.h" -#include "avalanche/pingo.h" -#include "avalanche/timer.h" -#include "avalanche/background.h" -#include "avalanche/closing.h" -#include "avalanche/enums.h" #include "common/file.h" #include "common/random.h" @@ -47,10 +37,10 @@ namespace Avalanche { -const char *Avalot::kVersionNum = "1.30"; -const char *Avalot::kCopyright = "1995"; +const char *AvalancheEngine::kVersionNum = "1.30"; +const char *AvalancheEngine::kCopyright = "1995"; -const MouseHotspotType Avalot::kMouseHotSpots[9] = { +const MouseHotspotType AvalancheEngine::kMouseHotSpots[9] = { {8,0}, // 0 - up-arrow {0,0}, // 1 - screwdriver {15,6}, // 2 - right-arrow @@ -63,7 +53,7 @@ const MouseHotspotType Avalot::kMouseHotSpots[9] = { }; // Art gallery at 2,1; notice about this at 2,2. -const int32 Avalot::kCatacombMap[8][8] = { +const int32 AvalancheEngine::kCatacombMap[8][8] = { // Geida's room // 1 2 3 | 4 5 6 7 8 {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, @@ -113,11 +103,11 @@ const int32 Avalot::kCatacombMap[8][8] = { 7 = wall with door and candles, F = straight-through corridor. */ -const char Avalot::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom}; +const char AvalancheEngine::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom}; // A quasiped defines how people who aren't sprites talk. For example, quasiped // "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. -const QuasipedType Avalot::kQuasipeds[16] = { +const QuasipedType AvalancheEngine::kQuasipeds[16] = { //_whichPed, _foregroundColor, _room, _backgroundColor, _who {1, kColorLightgray, kRoomArgentPub, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). {2, kColorGreen, kRoomArgentPub, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). @@ -137,14 +127,14 @@ const QuasipedType Avalot::kQuasipeds[16] = { {1, kColorLightgreen, kRoomDucks, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). }; -const uint16 Avalot::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; -const TuneType Avalot::kTune = { +const uint16 AvalancheEngine::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; +const TuneType AvalancheEngine::kTune = { kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher }; -Room Avalot::_whereIs[29] = { +Room AvalancheEngine::_whereIs[29] = { // The Lads kRoomYours, // Avvy kRoomSpludwicks, // Spludwick @@ -240,14 +230,14 @@ void Clock::plotHands() { } void Clock::chime() { - if ((_oldHour == 17717) || (!_vm->_avalot->_soundFx)) // Too high - must be first time around + if ((_oldHour == 17717) || (!_vm->_soundFx)) // Too high - must be first time around return; byte hour = _hour % 12; if (hour == 0) hour = 12; - _vm->_avalot->setMousePointerWait(); + _vm->setMousePointerWait(); for (int i = 1; i <= hour; i++) { for (int j = 1; j <= 3; j++) @@ -258,42 +248,13 @@ void Clock::chime() { } -Avalot::Avalot(AvalancheEngine *vm) : _fxHidden(false), _clock(vm), _interrogation(0) { - _vm = vm; - - // Needed because of Lucerna::load_also() - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) - _also[i][j] = nullptr; - } - - _totalTime = 0; -} - -Avalot::~Avalot() { - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) { - if (_also[i][j] != nullptr) { - delete _also[i][j]; - _also[i][j] = nullptr; - } - } - } - - for (int i = 0; i < 9; i++) { - _digits[i].free(); - _directions[i].free(); - } - _digits[9].free(); -} - -void Avalot::handleKeyDown(Common::Event &event) { - _vm->_sound->click(); +void AvalancheEngine::handleKeyDown(Common::Event &event) { + _sound->click(); if ((Common::KEYCODE_F1 <= event.kbd.keycode) && (event.kbd.keycode <= Common::KEYCODE_F15)) - _vm->_parser->handleFunctionKey(event); + _parser->handleFunctionKey(event); else if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) - _vm->_parser->handleInputText(event); + _parser->handleInputText(event); else switch (event.kbd.keycode) { // We can control Avvy with the numpad as well. case Common::KEYCODE_KP8: @@ -335,15 +296,15 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_END: case Common::KEYCODE_KP5: if (_alive && _avvyIsAwake) { - _vm->_animation->handleMoveKey(event); // Fallthroughs are intended. + _animation->handleMoveKey(event); // Fallthroughs are intended. drawDirection(); return; } case Common::KEYCODE_BACKSPACE: - _vm->_parser->handleBackspace(); + _parser->handleBackspace(); break; case Common::KEYCODE_RETURN: - _vm->_parser->handleReturn(); + _parser->handleReturn(); break; default: break; @@ -352,89 +313,89 @@ void Avalot::handleKeyDown(Common::Event &event) { drawDirection(); } -void Avalot::setup() { +void AvalancheEngine::setup() { init(); - _vm->_dialogs->reset(); + _dialogs->reset(); dusk(); loadDigits(); - _vm->_parser->_inputTextPos = 0; - _vm->_parser->_quote = true; + _parser->_inputTextPos = 0; + _parser->_quote = true; - _vm->_animation->setDirection(kDirStopped); - _vm->_animation->resetAnims(); + _animation->setDirection(kDirStopped); + _animation->resetAnims(); drawToolbar(); - _vm->_dialogs->setReadyLight(2); + _dialogs->setReadyLight(2); dawn(); - _vm->_parser->_cursorState = false; - _vm->_parser->cursorOn(); - _vm->_animation->_sprites[0]._speedX = kWalk; - _vm->_animation->updateSpeed(); + _parser->_cursorState = false; + _parser->cursorOn(); + _animation->_sprites[0]._speedX = kWalk; + _animation->updateSpeed(); - _vm->_menu->init(); + _menu->init(); int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { _thinks = 2; // You always have money. - thinkAbout(kObjectMoney, Avalot::kThing); + thinkAbout(kObjectMoney, kThing); - _vm->loadGame(loadSlot); + loadGame(loadSlot); } else { _isLoaded = false; // Set to true in _vm->loadGame(). newGame(); _soundFx = !_soundFx; fxToggle(); - thinkAbout(kObjectMoney, Avalot::kThing); + thinkAbout(kObjectMoney, kThing); - _vm->_dialogs->displayScrollChain('q', 83); // Info on the game, etc. + _dialogs->displayScrollChain('q', 83); // Info on the game, etc. } } -void Avalot::runAvalot() { +void AvalancheEngine::runAvalot() { setup(); do { - uint32 beginLoop = _vm->_system->getMillis(); + uint32 beginLoop = _system->getMillis(); - _vm->updateEvents(); // The event handler. + updateEvents(); // The event handler. - _clock.update(); - _vm->_menu->update(); - _vm->_background->update(); - _vm->_animation->animLink(); + _clock->update(); + _menu->update(); + _background->update(); + _animation->animLink(); checkClick(); - _vm->_timer->updateTimer(); + _timer->updateTimer(); #ifdef DEBUG for (int i = 0; i < _lineNum; i++) { LineType *curLine = &_lines[i]; - _vm->_graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); + _graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); } for (int i = 0; i < _fieldNum; i++) { FieldType *curField = &_fields[i]; if (curField->_x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); + _graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); } #endif - _vm->_graphics->refreshScreen(); + _graphics->refreshScreen(); - uint32 delay = _vm->_system->getMillis() - beginLoop; + uint32 delay = _system->getMillis() - beginLoop; if (delay <= 55) - _vm->_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight). - } while (!_letMeOut && !_vm->shouldQuit()); + _system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight). + } while (!_letMeOut && !shouldQuit()); - warning("STUB: Avalot::run()"); + warning("STUB: run()"); - _vm->_closing->exitGame(); + _closing->exitGame(); } -void Avalot::init() { +void AvalancheEngine::init() { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) _also[i][j] = nullptr; @@ -470,31 +431,31 @@ void Avalot::init() { * Call a given Verb * @remarks Originally called 'callverb' */ -void Avalot::callVerb(VerbCode id) { - if (id == _vm->_parser->kPardon) { +void AvalancheEngine::callVerb(VerbCode id) { + if (id == _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 " \ "what the current setting of this key is."); - _vm->_dialogs->displayText(tmpStr); + _dialogs->displayText(tmpStr); } else { _weirdWord = false; - _vm->_parser->_polite = true; - _vm->_parser->_verb = id; - _vm->_parser->doThat(); + _parser->_polite = true; + _parser->_verb = id; + _parser->doThat(); } } -void Avalot::drawAlsoLines() { +void AvalancheEngine::drawAlsoLines() { CursorMan.showMouse(false); - _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); - _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); + _graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); + _graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); for (int i = 0; i < _lineNum; i++) { // We had to check if the lines are within the borders of the screen. - if ((_lines[i]._x1 >= 0) && (_lines[i]._x1 < _vm->_graphics->kScreenWidth) && (_lines[i]._y1 >= 0) && (_lines[i]._y1 < _vm->_graphics->kScreenHeight) - && (_lines[i]._x2 >= 0) && (_lines[i]._x2 < _vm->_graphics->kScreenWidth) && (_lines[i]._y2 >= 0) && (_lines[i]._y2 < _vm->_graphics->kScreenHeight)) - _vm->_graphics->_magics.drawLine(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); + if ((_lines[i]._x1 >= 0) && (_lines[i]._x1 < _graphics->kScreenWidth) && (_lines[i]._y1 >= 0) && (_lines[i]._y1 < _graphics->kScreenHeight) + && (_lines[i]._x2 >= 0) && (_lines[i]._x2 < _graphics->kScreenWidth) && (_lines[i]._y2 >= 0) && (_lines[i]._y2 < _graphics->kScreenHeight)) + _graphics->_magics.drawLine(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); } CursorMan.showMouse(true); @@ -504,7 +465,7 @@ void Avalot::drawAlsoLines() { * Check is it's possible to give something to Spludwick * @remarks Originally called 'nextstring' */ -Common::String Avalot::readAlsoStringFromFile() { +Common::String AvalancheEngine::readAlsoStringFromFile() { Common::String str; byte length = file.readByte(); for (int i = 0; i < length; i++) @@ -512,12 +473,12 @@ Common::String Avalot::readAlsoStringFromFile() { return str; } -void Avalot::scram(Common::String &str) { +void AvalancheEngine::scram(Common::String &str) { for (uint i = 0; i < str.size(); i++) str.setChar(str[i] ^ 177, i); } -void Avalot::unScramble() { +void AvalancheEngine::unScramble() { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) { if (_also[i][j] != nullptr) @@ -528,7 +489,7 @@ void Avalot::unScramble() { scram(_flags); } -void Avalot::loadAlso(byte num) { +void AvalancheEngine::loadAlso(byte num) { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) { if (_also[i][j] != nullptr) { @@ -616,10 +577,10 @@ void Avalot::loadAlso(byte num) { } } -void Avalot::loadRoom(byte num) { +void AvalancheEngine::loadRoom(byte num) { CursorMan.showMouse(false); - _vm->_graphics->fleshColors(); + _graphics->fleshColors(); Common::String filename = Common::String::format("place%d.avd", num); if (!file.open(filename)) @@ -637,21 +598,21 @@ void Avalot::loadRoom(byte num) { file.seek(177); - _vm->_graphics->_background = _vm->_graphics->loadPictureRow(file, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); - _vm->_graphics->refreshBackground(); + _graphics->_background = _graphics->loadPictureRow(file, _graphics->kBackgroundWidth, _graphics->kBackgroundHeight); + _graphics->refreshBackground(); file.close(); loadAlso(num); - _vm->_background->load(num); + _background->load(num); CursorMan.showMouse(true); } -void Avalot::zoomOut(int16 x, int16 y) { +void AvalancheEngine::zoomOut(int16 x, int16 y) { //setlinestyle(dottedln, 0, 1); TODO: Implement it with a dotted line style!!! ::Graphics::Surface backup; - backup.copyFrom(_vm->_graphics->_surface); + backup.copyFrom(_graphics->_surface); for (byte i = 1; i <= 20; i ++) { int16 x1 = x - (x / 20) * i; @@ -659,17 +620,17 @@ void Avalot::zoomOut(int16 x, int16 y) { int16 x2 = x + (((639 - x) / 20) * i); int16 y2 = y + (((161 - y) / 20) * i); - _vm->_graphics->_surface.frameRect(Common::Rect(x1, y1, x2, y2), kColorWhite); - _vm->_graphics->refreshScreen(); - _vm->_system->delayMillis(17); - _vm->_graphics->_surface.copyFrom(backup); - _vm->_graphics->refreshScreen(); + _graphics->_surface.frameRect(Common::Rect(x1, y1, x2, y2), kColorWhite); + _graphics->refreshScreen(); + _system->delayMillis(17); + _graphics->_surface.copyFrom(backup); + _graphics->refreshScreen(); } backup.free(); } -void Avalot::findPeople(byte room) { +void AvalancheEngine::findPeople(byte room) { for (int i = 1; i < 29; i++) { if (_whereIs[i] == room) { if (i < 25) @@ -680,28 +641,28 @@ void Avalot::findPeople(byte room) { } } -void Avalot::exitRoom(byte x) { - _vm->_sound->stopSound(); - _vm->_background->release(); +void AvalancheEngine::exitRoom(byte x) { + _sound->stopSound(); + _background->release(); _seeScroll = true; // This stops the trippancy system working over the length of this procedure. switch (x) { case kRoomSpludwicks: - _vm->_timer->loseTimer(Timer::kReasonAvariciusTalks); + _timer->loseTimer(Timer::kReasonAvariciusTalks); _avariciusTalk = 0; // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; case kRoomBridge: if (_drawbridgeOpen > 0) { _drawbridgeOpen = 4; // Fully open. - _vm->_timer->loseTimer(Timer::kReasonDrawbridgeFalls); + _timer->loseTimer(Timer::kReasonDrawbridgeFalls); } break; case kRoomOutsideCardiffCastle: - _vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); + _timer->loseTimer(Timer::kReasonCardiffsurvey); break; case kRoomRobins: - _vm->_timer->loseTimer(Timer::kReasonGettingTiedUp); + _timer->loseTimer(Timer::kReasonGettingTiedUp); break; } @@ -719,8 +680,8 @@ void Avalot::exitRoom(byte x) { * but choosing another from the map. * @remarks Originally called 'new_town' */ -void Avalot::enterNewTown() { - _vm->_menu->setup(); +void AvalancheEngine::enterNewTown() { + _menu->setup(); switch (_room) { case kRoomOutsideNottsPub: // Entry into Nottingham. @@ -744,18 +705,18 @@ void Avalot::enterNewTown() { _rottenOnion = true; // You're holding the onion } -void Avalot::putGeidaAt(byte whichPed, byte ped) { +void AvalancheEngine::putGeidaAt(byte whichPed, byte ped) { if (ped == 0) return; - AnimationType *spr1 = &_vm->_animation->_sprites[1]; + AnimationType *spr1 = &_animation->_sprites[1]; - spr1->init(5, false, _vm->_animation); // load Geida - _vm->_animation->appearPed(1, whichPed); + spr1->init(5, false, _animation); // load Geida + _animation->appearPed(1, whichPed); spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; } -void Avalot::enterRoom(Room roomId, byte ped) { +void AvalancheEngine::enterRoom(Room roomId, byte ped) { _seeScroll = true; // This stops the trippancy system working over the length of this procedure. findPeople(roomId); @@ -782,24 +743,24 @@ void Avalot::enterRoom(Room roomId, byte ped) { switch (roomId) { case kRoomYours: if (_avvyInBed) { - _vm->_background->draw(-1, -1, 2); - _vm->_graphics->refreshBackground(); - _vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); + _background->draw(-1, -1, 2); + _graphics->refreshBackground(); + _timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); } break; case kRoomOutsideYours: if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; + AnimationType *spr1 = &_animation->_sprites[1]; if (!_talkedToCrapulus) { _whereIs[kPeopleCrapulus - 150] = kRoomOutsideYours; - spr1->init(8, false, _vm->_animation); // load Crapulus + spr1->init(8, false, _animation); // load Crapulus if (_roomCount[kRoomOutsideYours] == 1) { - _vm->_animation->appearPed(1, 3); // Start on the right-hand side of the screen. + _animation->appearPed(1, 3); // Start on the right-hand side of the screen. spr1->walkTo(4); // Walks up to greet you. } else { - _vm->_animation->appearPed(1, 4); // Starts where he was before. + _animation->appearPed(1, 4); // Starts where he was before. spr1->_facingDir = kDirLeft; } @@ -810,10 +771,10 @@ void Avalot::enterRoom(Room roomId, byte ped) { _whereIs[kPeopleCrapulus - 150] = kRoomNowhere; if (_crapulusWillTell) { - spr1->init(8, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); + spr1->init(8, false, _animation); + _animation->appearPed(1, 1); spr1->walkTo(3); - _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); + _timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); _crapulusWillTell = false; } } @@ -821,17 +782,17 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomOutsideSpludwicks: if ((_roomCount[kRoomOutsideSpludwicks] == 1) && (ped == 1)) { - _vm->_timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); + _timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); _spludwickAtHome = true; } break; case kRoomSpludwicks: if (_spludwickAtHome) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; + AnimationType *spr1 = &_animation->_sprites[1]; if (ped > 0) { - spr1->init(2, false, _vm->_animation); // load Spludwick - _vm->_animation->appearPed(1, 1); + spr1->init(2, false, _animation); // load Spludwick + _animation->appearPed(1, 1); _whereIs[kPeopleSpludwick - 150] = kRoomSpludwicks; } @@ -845,21 +806,21 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (_geidaFollows) putGeidaAt(4, ped); if (_cwytalotGone) { - _magics[kColorLightred - 1]._operation = Avalot::kMagicNothing; + _magics[kColorLightred - 1]._operation = kMagicNothing; _whereIs[kPeopleCwytalot - 150] = kRoomNowhere; } else if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(4, false, _vm->_animation); // 4 = Cwytalot + AnimationType *spr1 = &_animation->_sprites[1]; + spr1->init(4, false, _animation); // 4 = Cwytalot spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcFollowAvvyY; _whereIs[kPeopleCwytalot - 150] = kRoomBrummieRoad; if (_roomCount[kRoomBrummieRoad] == 1) { // First time here... - _vm->_animation->appearPed(1, 1); // He appears on the right of the screen... + _animation->appearPed(1, 1); // He appears on the right of the screen... spr1->walkTo(3); // ...and he walks up... } else { // You've been here before. - _vm->_animation->appearPed(1, 3); // He's standing in your way straight away... + _animation->appearPed(1, 3); // He's standing in your way straight away... spr1->_facingDir = kDirLeft; } } @@ -867,22 +828,22 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomArgentRoad: if ((_cwytalotGone) && (!_passedCwytalotInHerts) && (ped == 2) && (_roomCount[kRoomArgentRoad] > 3)) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again - _vm->_animation->appearPed(1, 0); + AnimationType *spr1 = &_animation->_sprites[1]; + spr1->init(4, false, _animation); // 4 = Cwytalot again + _animation->appearPed(1, 0); spr1->walkTo(1); spr1->_vanishIfStill = true; _passedCwytalotInHerts = true; // whereis[#157] = r__Nowhere; // can we fit this in? - _vm->_timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); + _timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); } break; case kRoomBridge: if (_drawbridgeOpen == 4) { // open - _vm->_background->draw(-1, -1, 2); // Position of drawbridge - _vm->_graphics->refreshBackground(); - _magics[kColorGreen - 1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge. + _background->draw(-1, -1, 2); // Position of drawbridge + _graphics->refreshBackground(); + _magics[kColorGreen - 1]._operation = kMagicNothing; // You may enter the drawbridge. } if (_geidaFollows) putGeidaAt(ped + 2, ped); // load Geida @@ -891,11 +852,11 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomRobins: if ((ped > 0) && (!_beenTiedUp)) { // A welcome party... or maybe not... - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(6, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); + AnimationType *spr1 = &_animation->_sprites[1]; + spr1->init(6, false, _animation); + _animation->appearPed(1, 1); spr1->walkTo(2); - _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); + _timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); } if (_beenTiedUp) { @@ -904,31 +865,31 @@ void Avalot::enterRoom(Room roomId, byte ped) { } if (_tiedUp) - _vm->_background->draw(-1, -1, 1); + _background->draw(-1, -1, 1); if (!_mushroomGrowing) - _vm->_background->draw(-1, -1, 2); - _vm->_graphics->refreshBackground(); + _background->draw(-1, -1, 2); + _graphics->refreshBackground(); break; case kRoomOutsideCardiffCastle: if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; + AnimationType *spr1 = &_animation->_sprites[1]; switch (_cardiffQuestionNum) { case 0 : // You've answered NONE of his questions. - spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); + spr1->init(9, false, _animation); + _animation->appearPed(1, 1); spr1->walkTo(2); - _vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); + _timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); break; case 5 : - _magics[1]._operation = Avalot::kMagicNothing; + _magics[1]._operation = kMagicNothing; break; // You've answered ALL his questions. => nothing happens. default: // You've answered SOME of his questions. - spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(1, 2); + spr1->init(9, false, _animation); + _animation->appearPed(1, 2); spr1->_facingDir = kDirRight; - _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); + _timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); } } @@ -945,12 +906,12 @@ void Avalot::enterRoom(Room roomId, byte ped) { zoomOut(_peds[ped]._x, _peds[ped]._y); if ((_objects[kObjectWine - 1]) && (_wineState != 3)) { - _vm->_dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! + _dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! _objects[kObjectWine - 1] = false; refreshObjectList(); } - _vm->_dialogs->displayScrollChain('q', 69); + _dialogs->displayScrollChain('q', 69); break; case kRoomCatacombs: @@ -972,35 +933,35 @@ void Avalot::enterRoom(Room roomId, byte ped) { } _enterCatacombsFromLustiesRoom = true; - _vm->_animation->catacombMove(ped); + _animation->catacombMove(ped); _enterCatacombsFromLustiesRoom = false; } break; case kRoomArgentPub: if (_wonNim) - _vm->_background->draw(-1, -1, 0); // No lute by the settle. + _background->draw(-1, -1, 0); // No lute by the settle. _malagauche = 0; // Ready to boot Malagauche if (_givenBadgeToIby) { - _vm->_background->draw(-1, -1, 7); - _vm->_background->draw(-1, -1, 8); + _background->draw(-1, -1, 7); + _background->draw(-1, -1, 8); } - _vm->_graphics->refreshBackground(); + _graphics->refreshBackground(); break; case kRoomLustiesRoom: _npcFacing = 1; // du Lustie. - if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes - _vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); + if (_animation->_sprites[0]._id == 0) // Avvy in his normal clothes + _timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); else if (!_enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. - _vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); + _timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); if (_geidaFollows) { putGeidaAt(4, ped); if (_lustieIsAsleep) { - _vm->_background->draw(-1, -1, 4); - _vm->_graphics->refreshBackground(); + _background->draw(-1, -1, 4); + _graphics->refreshBackground(); } } break; @@ -1008,43 +969,43 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomMusicRoom: if (_jacquesState > 0) { _jacquesState = 5; - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); - _vm->_background->draw(-1, -1, 3); - _magics[kColorBrown - 1]._operation = Avalot::kMagicNothing; + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); + _background->draw(-1, -1, 3); + _magics[kColorBrown - 1]._operation = kMagicNothing; _whereIs[kPeopleJacques - 150] = kRoomNowhere; } if (ped != 0) { - _vm->_background->draw(-1, -1, 5); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startMusicRoomSeq(); + _background->draw(-1, -1, 5); + _graphics->refreshBackground(); + _sequence->startMusicRoomSeq(); } break; case kRoomOutsideNottsPub: if (ped == 2) { - _vm->_background->draw(-1, -1, 2); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startDuckSeq(); + _background->draw(-1, -1, 2); + _graphics->refreshBackground(); + _sequence->startDuckSeq(); } break; case kRoomOutsideArgentPub: if (ped == 2) { - _vm->_background->draw(-1, -1, 5); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startMusicRoomSeq(); + _background->draw(-1, -1, 5); + _graphics->refreshBackground(); + _sequence->startMusicRoomSeq(); } break; case kRoomWiseWomans: { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(11, false, _vm->_animation); + AnimationType *spr1 = &_animation->_sprites[1]; + spr1->init(11, false, _animation); if ((_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) { - _vm->_animation->appearPed(1, 1); // Start on the right-hand side of the screen. + _animation->appearPed(1, 1); // Start on the right-hand side of the screen. spr1->walkTo(3); // Walks up to greet you. } else { - _vm->_animation->appearPed(1, 3); // Starts where she was before. + _animation->appearPed(1, 3); // Starts where she was before. spr1->_facingDir = kDirLeft; } @@ -1055,25 +1016,25 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomInsideCardiffCastle: if (ped > 0) { - _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. - _vm->_background->draw(-1, -1, 0); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startCardiffSeq2(); + _animation->_sprites[1].init(10, false, _animation); // Define the dart. + _background->draw(-1, -1, 0); + _graphics->refreshBackground(); + _sequence->startCardiffSeq2(); } else { - _vm->_background->draw(-1, -1, 0); + _background->draw(-1, -1, 0); if (_arrowInTheDoor) - _vm->_background->draw(-1, -1, 2); + _background->draw(-1, -1, 2); else - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); } break; case kRoomAvvysGarden: if (ped == 1) { - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startGardenSeq(); + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); + _sequence->startGardenSeq(); } break; @@ -1083,22 +1044,22 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (ped == 2) { #if 0 // It was the original: - _vm->_celer->show_one(-1, -1, 2); - _vm->_sequence->first_show(1); - _vm->_sequence->then_show(3); - _vm->_sequence->start_to_close(); + _celer->show_one(-1, -1, 2); + _sequence->first_show(1); + _sequence->then_show(3); + _sequence->start_to_close(); #endif - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startGardenSeq(); + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); + _sequence->startGardenSeq(); } break; case kRoomAylesOffice: if (_aylesIsAwake) - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); break; // Ayles awake. case kRoomGeidas: @@ -1118,16 +1079,16 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomNottsPub: if (_sittingInPub) - _vm->_background->draw(-1, -1, 2); + _background->draw(-1, -1, 2); _npcFacing = 1; // Port. break; case kRoomOutsideDucks: if (ped == 2) { // Shut the door - _vm->_background->draw(-1, -1, 2); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startDuckSeq(); + _background->draw(-1, -1, 2); + _graphics->refreshBackground(); + _sequence->startDuckSeq(); } break; @@ -1140,7 +1101,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { _isLoaded = false; } -void Avalot::thinkAbout(byte object, bool type) { +void AvalancheEngine::thinkAbout(byte object, bool type) { const int16 picSize = 966; _thinks = object; @@ -1148,10 +1109,10 @@ void Avalot::thinkAbout(byte object, bool type) { setMousePointerWait(); - if (type == Avalot::kThing) { + if (type == kThing) { if (!file.open("thinks.avd")) error("AVALANCHE: Lucerna: File not found: thinks.avd"); - } else { // Avalot::kPerson + } else { // kPerson if (!file.open("folk.avd")) error("AVALANCHE: Lucerna: File not found: folk.avd"); @@ -1165,8 +1126,8 @@ void Avalot::thinkAbout(byte object, bool type) { CursorMan.showMouse(false); file.seek(object * picSize + 65); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); + ::Graphics::Surface picture = _graphics->loadPictureGraphic(file); + _graphics->drawPicture(_graphics->_surface, picture, 205, 170); picture.free(); file.close(); @@ -1175,7 +1136,7 @@ void Avalot::thinkAbout(byte object, bool type) { _thinkThing = type; } -void Avalot::loadDigits() { // Load the scoring digits & rwlites +void AvalancheEngine::loadDigits() { // Load the scoring digits & rwlites const byte digitsize = 134; const byte rwlitesize = 126; @@ -1184,36 +1145,36 @@ void Avalot::loadDigits() { // Load the scoring digits & rwlites for (int i = 0; i < 10; i++) { file.seek(i * digitsize); - _digits[i] = _vm->_graphics->loadPictureGraphic(file); + _digits[i] = _graphics->loadPictureGraphic(file); } for (int i = 0; i < 9; i++) { file.seek(10 * digitsize + i * rwlitesize); - _directions[i] = _vm->_graphics->loadPictureGraphic(file); + _directions[i] = _graphics->loadPictureGraphic(file); } file.close(); } -void Avalot::drawToolbar() { +void AvalancheEngine::drawToolbar() { if (!file.open("useful.avd")) error("AVALANCHE: Lucerna: File not found: useful.avd"); file.seek(40); CursorMan.showMouse(false); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169); + ::Graphics::Surface picture = _graphics->loadPictureGraphic(file); + _graphics->drawPicture(_graphics->_surface, picture, 5, 169); picture.free(); file.close(); CursorMan.showMouse(true); - _vm->_animation->setOldDirection(kDirNone); + _animation->setOldDirection(kDirNone); drawDirection(); } -void Avalot::drawScore() { +void AvalancheEngine::drawScore() { uint16 score = _dnascore; int8 numbers[3] = {0, 0, 0}; for (int i = 0; i < 2; i++) { @@ -1229,7 +1190,7 @@ void Avalot::drawScore() { for (int i = 0; i < 3; i++) { if (_scoreToDisplay[i] != numbers[i]) - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _digits[numbers[i]], 250 + (i + 1) * 15, 177); + _graphics->drawPicture(_graphics->_surface, _digits[numbers[i]], 250 + (i + 1) * 15, 177); } CursorMan.showMouse(true); @@ -1238,63 +1199,63 @@ void Avalot::drawScore() { _scoreToDisplay[i] = numbers[i]; } -void Avalot::incScore(byte num) { +void AvalancheEngine::incScore(byte num) { for (int i = 1; i <= num; i++) { _dnascore++; if (_soundFx) { for (int j = 1; j <= 97; j++) // Length os 2 is a guess, the original doesn't have a delay specified - _vm->_sound->playNote(177 + _dnascore * 3, 2); + _sound->playNote(177 + _dnascore * 3, 2); } } - warning("STUB: Avalot::points()"); + warning("STUB: points()"); drawScore(); } -void Avalot::useCompass(const Common::Point &cursorPos) { - byte color = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); +void AvalancheEngine::useCompass(const Common::Point &cursorPos) { + byte color = *(byte *)_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); switch (color) { case kColorGreen: - _vm->_animation->setDirection(kDirUp); - _vm->_animation->setMoveSpeed(0, kDirUp); + _animation->setDirection(kDirUp); + _animation->setMoveSpeed(0, kDirUp); drawDirection(); break; case kColorBrown: - _vm->_animation->setDirection(kDirDown); - _vm->_animation->setMoveSpeed(0, kDirDown); + _animation->setDirection(kDirDown); + _animation->setMoveSpeed(0, kDirDown); drawDirection(); break; case kColorCyan: - _vm->_animation->setDirection(kDirLeft); - _vm->_animation->setMoveSpeed(0, kDirLeft); + _animation->setDirection(kDirLeft); + _animation->setMoveSpeed(0, kDirLeft); drawDirection(); break; case kColorLightmagenta: - _vm->_animation->setDirection(kDirRight); - _vm->_animation->setMoveSpeed(0, kDirRight); + _animation->setDirection(kDirRight); + _animation->setMoveSpeed(0, kDirRight); drawDirection(); break; case kColorRed: case kColorWhite: case kColorLightcyan: case kColorYellow: // Fall-throughs are intended. - _vm->_animation->stopWalking(); + _animation->stopWalking(); drawDirection(); break; } } -void Avalot::fxToggle() { - warning("STUB: Avalot::fxtoggle()"); +void AvalancheEngine::fxToggle() { + warning("STUB: fxtoggle()"); } -void Avalot::refreshObjectList() { +void AvalancheEngine::refreshObjectList() { _carryNum = 0; if (_thinkThing && !_objects[_thinks - 1]) - thinkAbout(kObjectMoney, Avalot::kThing); // you always have money + thinkAbout(kObjectMoney, kThing); // you always have money for (int i = 0; i < kObjectNum; i++) { if (_objects[i]) { @@ -1307,15 +1268,15 @@ void Avalot::refreshObjectList() { /** * @remarks Originally called 'verte' */ -void Avalot::guideAvvy(Common::Point cursorPos) { +void AvalancheEngine::guideAvvy(Common::Point cursorPos) { if (!_userMovesAvvy) return; cursorPos.y /= 2; byte what; - // _vm->_animation->tr[0] is Avalot.) - AnimationType *avvy = &_vm->_animation->_sprites[0]; + // _animation->tr[0] is Avalot.) + AnimationType *avvy = &_animation->_sprites[0]; if (cursorPos.x < avvy->_x) what = 1; else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) @@ -1330,39 +1291,39 @@ void Avalot::guideAvvy(Common::Point cursorPos) { switch (what) { case 0: - _vm->_animation->stopWalking(); + _animation->stopWalking(); break; // Clicked on Avvy: no movement. case 1: - _vm->_animation->setMoveSpeed(0, kDirLeft); + _animation->setMoveSpeed(0, kDirLeft); break; case 2: - _vm->_animation->setMoveSpeed(0, kDirRight); + _animation->setMoveSpeed(0, kDirRight); break; case 3: - _vm->_animation->setMoveSpeed(0, kDirUp); + _animation->setMoveSpeed(0, kDirUp); break; case 4: - _vm->_animation->setMoveSpeed(0, kDirUpLeft); + _animation->setMoveSpeed(0, kDirUpLeft); break; case 5: - _vm->_animation->setMoveSpeed(0, kDirUpRight); + _animation->setMoveSpeed(0, kDirUpRight); break; case 6: - _vm->_animation->setMoveSpeed(0, kDirDown); + _animation->setMoveSpeed(0, kDirDown); break; case 7: - _vm->_animation->setMoveSpeed(0, kDirDownLeft); + _animation->setMoveSpeed(0, kDirDownLeft); break; case 8: - _vm->_animation->setMoveSpeed(0, kDirDownRight); + _animation->setMoveSpeed(0, kDirDownRight); break; } // No other values are possible. drawDirection(); } -void Avalot::checkClick() { - Common::Point cursorPos = _vm->getMousePos(); +void AvalancheEngine::checkClick() { + Common::Point cursorPos = getMousePos(); _onToolbar = kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); /*if (mrelease > 0) @@ -1374,7 +1335,7 @@ void Avalot::checkClick() { newMouse(7); //I-beam else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) newMouse(1); // screwdriver - else if (!_vm->_menu->isActive()) { // Dropdown can handle its own pointers. + else if (!_menu->isActive()) { // Dropdown can handle its own pointers. if (_holdLeftMouse) { newMouse(6); // Mark's crosshairs guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. @@ -1385,45 +1346,45 @@ void Avalot::checkClick() { if (_holdLeftMouse) { if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. if (_dropsOk) - _vm->_menu->update(); + _menu->update(); } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. - _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; - if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) - _vm->_parser->_inputTextPos = _vm->_parser->_inputText.size() + 1; - if (_vm->_parser->_inputTextPos < 1) - _vm->_parser->_inputTextPos = 1; - _vm->_parser->_inputTextPos--; - _vm->_parser->plotText(); + _parser->_inputTextPos = (cursorPos.x - 23) / 8; + if (_parser->_inputTextPos > _parser->_inputText.size() + 1) + _parser->_inputTextPos = _parser->_inputText.size() + 1; + if (_parser->_inputTextPos < 1) + _parser->_inputTextPos = 1; + _parser->_inputTextPos--; + _parser->plotText(); } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. if (_alive && _avvyIsAwake) useCompass(cursorPos); } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. do { - _vm->updateEvents(); + updateEvents(); } while (_holdLeftMouse); if (_thinkThing) { - _vm->_parser->_thing = _thinks; - _vm->_parser->_thing += 49; - _vm->_parser->_person = kPeoplePardon; + _parser->_thing = _thinks; + _parser->_thing += 49; + _parser->_person = kPeoplePardon; } else { - _vm->_parser->_person = (People) _thinks; - _vm->_parser->_thing = _vm->_parser->kPardon; + _parser->_person = (People) _thinks; + _parser->_thing = _parser->kPardon; } callVerb(kVerbCodeExam); } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. do { - _vm->updateEvents(); + updateEvents(); } while (_holdLeftMouse); callVerb(kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. - _vm->_animation->_sprites[0]._speedX = kWalk; - _vm->_animation->updateSpeed(); + _animation->_sprites[0]._speedX = kWalk; + _animation->updateSpeed(); } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. - _vm->_animation->_sprites[0]._speedX = kRun; - _vm->_animation->updateSpeed(); + _animation->_sprites[0]._speedX = kRun; + _animation->updateSpeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) @@ -1433,60 +1394,60 @@ void Avalot::checkClick() { } } -void Avalot::errorLed() { - warning("STUB: Avalot::errorled()"); +void AvalancheEngine::errorLed() { + warning("STUB: errorled()"); } -int8 Avalot::fades(int8 x) { - warning("STUB: Avalot::fades()"); +int8 AvalancheEngine::fades(int8 x) { + warning("STUB: fades()"); return 0; } -void Avalot::fadeOut(byte n) { - warning("STUB: Avalot::fadeOut()"); +void AvalancheEngine::fadeOut(byte n) { + warning("STUB: fadeOut()"); } -void Avalot::dusk() { - warning("STUB: Avalot::dusk()"); +void AvalancheEngine::dusk() { + warning("STUB: dusk()"); } -void Avalot::fadeIn(byte n) { - warning("STUB: Avalot::fadeIn()"); +void AvalancheEngine::fadeIn(byte n) { + warning("STUB: fadeIn()"); } -void Avalot::dawn() { - warning("STUB: Avalot::dawn()"); +void AvalancheEngine::dawn() { + warning("STUB: dawn()"); } -void Avalot::drawDirection() { // It's data is loaded in load_digits(). - if (_vm->_animation->getOldDirection() == _vm->_animation->getDirection()) +void AvalancheEngine::drawDirection() { // It's data is loaded in load_digits(). + if (_animation->getOldDirection() == _animation->getDirection()) return; - _vm->_animation->setOldDirection(_vm->_animation->getDirection()); + _animation->setOldDirection(_animation->getDirection()); CursorMan.showMouse(false); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _directions[_vm->_animation->getDirection()], 0, 161); + _graphics->drawPicture(_graphics->_surface, _directions[_animation->getDirection()], 0, 161); CursorMan.showMouse(true); } -void Avalot::gameOver() { +void AvalancheEngine::gameOver() { _userMovesAvvy = false; - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = &_animation->_sprites[0]; int16 sx = avvy->_x; int16 sy = avvy->_y; avvy->remove(); - avvy->init(12, true, _vm->_animation); // 12 = Avalot falls + avvy->init(12, true, _animation); // 12 = Avalot falls avvy->_stepNum = 0; avvy->appear(sx, sy, kDirUp); - _vm->_timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); + _timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); _alive = false; } -void Avalot::minorRedraw() { +void AvalancheEngine::minorRedraw() { dusk(); enterRoom(_room, 0); // Ped unknown or non-existant. @@ -1498,13 +1459,13 @@ void Avalot::minorRedraw() { dawn(); } -void Avalot::majorRedraw() { - warning("STUB: Avalot::major_redraw()"); +void AvalancheEngine::majorRedraw() { + warning("STUB: major_redraw()"); } -uint16 Avalot::bearing(byte whichPed) { +uint16 AvalancheEngine::bearing(byte whichPed) { static const double rad2deg = 180 / 3.14; // Pi - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = &_animation->_sprites[0]; PedType *curPed = &_peds[whichPed]; if (avvy->_x == curPed->_x) @@ -1519,24 +1480,24 @@ uint16 Avalot::bearing(byte whichPed) { /** * @remarks Originally called 'sprite_run' */ -void Avalot::spriteRun() { +void AvalancheEngine::spriteRun() { _doingSpriteRun = true; - _vm->_animation->animLink(); + _animation->animLink(); _doingSpriteRun = false; } -void Avalot::fixFlashers() { +void AvalancheEngine::fixFlashers() { _ledStatus = 177; - _vm->_animation->setOldDirection(kDirNone); - _vm->_dialogs->setReadyLight(2); + _animation->setOldDirection(kDirNone); + _dialogs->setReadyLight(2); drawDirection(); } -Common::String Avalot::intToStr(int32 num) { +Common::String AvalancheEngine::intToStr(int32 num) { return Common::String::format("%d", num); } -void Avalot::newMouse(byte id) { +void AvalancheEngine::newMouse(byte id) { if (id == _currentMouse) return; @@ -1548,12 +1509,12 @@ void Avalot::newMouse(byte id) { * Set the mouse pointer to 'HourGlass" * @remarks Originally called 'wait' */ -void Avalot::setMousePointerWait() { +void AvalancheEngine::setMousePointerWait() { newMouse(4); } -void Avalot::resetVariables() { - _vm->_animation->setDirection(kDirUp); +void AvalancheEngine::resetVariables() { + _animation->setDirection(kDirUp); _carryNum = 0; for (int i = 0; i < kObjectNum; i++) _objects[i] = false; @@ -1561,7 +1522,7 @@ void Avalot::resetVariables() { _dnascore = 0; _money = 0; _room = kRoomNowhere; - _vm->_saveNum = 0; + _saveNum = 0; for (int i = 0; i < 100; i++) _roomCount[i] = 0; @@ -1624,32 +1585,32 @@ void Avalot::resetVariables() { _givenPenToAyles = false; _askedDogfoodAboutNim = false; - _vm->_parser->resetVariables(); - _vm->_animation->resetVariables(); - _vm->_sequence->resetVariables(); + _parser->resetVariables(); + _animation->resetVariables(); + _sequence->resetVariables(); } -void Avalot::newGame() { +void AvalancheEngine::newGame() { for (int i = 0; i < kMaxSprites; i++) { - AnimationType *spr = &_vm->_animation->_sprites[i]; + AnimationType *spr = &_animation->_sprites[i]; if (spr->_quick) spr->remove(); } // Deallocate sprite. Sorry, beta testers! - AnimationType *avvy = &_vm->_animation->_sprites[0]; - avvy->init(0, true, _vm->_animation); + AnimationType *avvy = &_animation->_sprites[0]; + avvy->init(0, true, _animation); _alive = true; resetVariables(); - _vm->_dialogs->setBubbleStateNatural(); + _dialogs->setBubbleStateNatural(); _spareEvening = "answer a questionnaire"; _favouriteDrink = "beer"; _money = 30; // 2/6 - _vm->_animation->setDirection(kDirStopped); - _vm->_parser->_wearing = kObjectClothes; + _animation->setDirection(kDirStopped); + _parser->_wearing = kObjectClothes; _objects[kObjectMoney - 1] = true; _objects[kObjectBodkin - 1] = true; _objects[kObjectBell - 1] = true; @@ -1668,7 +1629,7 @@ void Avalot::newGame() { _her = kPeoplePardon; _it = Parser::kPardon; _lastPerson = kPeoplePardon; // = Pardon? - _passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; + _passwordNum = _rnd->getRandomNumber(30) + 1; //Random(30) + 1; _userMovesAvvy = false; _doingSpriteRun = false; _avvyInBed = true; @@ -1677,16 +1638,16 @@ void Avalot::newGame() { enterRoom(kRoomYours, 1); avvy->_visible = false; drawScore(); - _vm->_menu->setup(); - _clock.update(); + _menu->setup(); + _clock->update(); spriteRun(); } -void Avalot::slowDown() { - warning("STUB: Avalot::slowdown()"); +void AvalancheEngine::slowDown() { + warning("STUB: slowdown()"); } -bool Avalot::setFlag(char x) { +bool AvalancheEngine::setFlag(char x) { for (uint16 i = 0; i < _flags.size(); i++) { if (_flags[i] == x) return true; @@ -1695,17 +1656,17 @@ bool Avalot::setFlag(char x) { return false; } -bool Avalot::decreaseMoney(uint16 amount) { +bool AvalancheEngine::decreaseMoney(uint16 amount) { _money -= amount; if (_money < 0) { - _vm->_dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" + _dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" gameOver(); return false; } else return true; } -Common::String Avalot::getName(People whose) { +Common::String AvalancheEngine::getName(People whose) { static const Common::String kLads[17] = { "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", @@ -1720,7 +1681,7 @@ Common::String Avalot::getName(People whose) { return kLasses[whose - kPeopleArkata]; } -byte Avalot::getNameChar(People whose) { +byte AvalancheEngine::getNameChar(People whose) { static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; static const char kLassChar[] = "kG\0xB1o"; @@ -1730,7 +1691,7 @@ byte Avalot::getNameChar(People whose) { return kLassChar[whose - kPeopleArkata]; } -Common::String Avalot::getThing(byte which) { +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", @@ -1762,7 +1723,7 @@ Common::String Avalot::getThing(byte which) { return get_thing_result; } -char Avalot::getThingChar(byte which) { +char AvalancheEngine::getThingChar(byte which) { static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar char get_thingchar_result; @@ -1779,7 +1740,7 @@ char Avalot::getThingChar(byte which) { return get_thingchar_result; } -Common::String Avalot::getItem(byte which) { +Common::String AvalancheEngine::getItem(byte which) { static const Common::String kItems[kObjectNum] = { "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", @@ -1821,8 +1782,7 @@ Common::String Avalot::getItem(byte which) { return get_better_result; } - -Common::String Avalot::f5Does() { +Common::String AvalancheEngine::f5Does() { switch (_room) { case kRoomYours: if (!_avvyIsAwake) @@ -1843,7 +1803,7 @@ Common::String Avalot::f5Does() { return Common::String::format("%cSSit down", kVerbCodeSit); break; case kRoomMusicRoom: - if (_vm->_animation->inField(5)) + if (_animation->inField(5)) return Common::String::format("%cPPlay the harp", kVerbCodePlay); break; } @@ -1851,7 +1811,7 @@ Common::String Avalot::f5Does() { return Common::String::format("%c", kVerbCodePardon); // If all else fails... } -void Avalot::loadMouse(byte which) { +void AvalancheEngine::loadMouse(byte which) { Common::File f; if (!f.open("mice.avd")) @@ -1865,7 +1825,7 @@ void Avalot::loadMouse(byte which) { // The AND mask. f.seek(kMouseSize * 2 * which + 134); - ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); + ::Graphics::Surface mask = _graphics->loadPictureGraphic(f); for (int j = 0; j < mask.h; j++) { for (int i = 0; i < mask.w; i++) { @@ -1882,7 +1842,7 @@ void Avalot::loadMouse(byte which) { // The OR mask. f.seek(kMouseSize * 2 * which + 134 * 2); - mask = _vm->_graphics->loadPictureGraphic(f); + mask = _graphics->loadPictureGraphic(f); for (int j = 0; j < mask.h; j++) { for (int i = 0; i < mask.w; i++) { @@ -1901,51 +1861,51 @@ void Avalot::loadMouse(byte which) { cursor.free(); } -void Avalot::setBackgroundColor(byte x) { - warning("STUB: Avalot::background()"); +void AvalancheEngine::setBackgroundColor(byte x) { + warning("STUB: background()"); } -void Avalot::hangAroundForAWhile() { +void AvalancheEngine::hangAroundForAWhile() { for (int i = 0; i < 28; i++) slowDown(); } -void Avalot::flipRoom(Room room, byte ped) { +void AvalancheEngine::flipRoom(Room room, byte ped) { assert((ped > 0) && (ped < 15)); if (!_alive) { // You can't leave the room if you're dead. - _vm->_animation->_sprites[0]._moveX = 0; - _vm->_animation->_sprites[0]._moveY = 0; // Stop him from moving. + _animation->_sprites[0]._moveX = 0; + _animation->_sprites[0]._moveY = 0; // Stop him from moving. return; } if ((room == kRoomDummy) && (_room == kRoomLusties)) { - _vm->_animation->hideInCupboard(); + _animation->hideInCupboard(); return; } if ((_jumpStatus > 0) && (_room == kRoomInsideCardiffCastle)) { // You can't *jump* out of Cardiff Castle! - _vm->_animation->_sprites[0]._moveX = 0; + _animation->_sprites[0]._moveX = 0; return; } exitRoom(_room); dusk(); - for (int16 i = 1; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]._quick) - _vm->_animation->_sprites[i].remove(); + for (int16 i = 1; i < _animation->kSpriteNumbMax; i++) { + if (_animation->_sprites[i]._quick) + _animation->_sprites[i].remove(); } // Deallocate sprite if (_room == kRoomLustiesRoom) _enterCatacombsFromLustiesRoom = true; enterRoom(room, ped); - _vm->_animation->appearPed(0, ped - 1); + _animation->appearPed(0, ped - 1); _enterCatacombsFromLustiesRoom = false; - _vm->_animation->setOldDirection(_vm->_animation->getDirection()); - _vm->_animation->setDirection(_vm->_animation->_sprites[0]._facingDir); + _animation->setOldDirection(_animation->getDirection()); + _animation->setDirection(_animation->_sprites[0]._facingDir); drawDirection(); dawn(); @@ -1958,54 +1918,54 @@ void Avalot::flipRoom(Room room, byte ped) { * here. * @remarks Originally called 'open_the_door' */ -void Avalot::openDoor(Room whither, byte ped, byte magicnum) { +void AvalancheEngine::openDoor(Room whither, byte ped, byte magicnum) { switch (_room) { case kRoomOutsideYours: case kRoomOutsideNottsPub: case kRoomOutsideDucks: - _vm->_sequence->startOutsideSeq(whither, ped); + _sequence->startOutsideSeq(whither, ped); break; case kRoomInsideCardiffCastle: - _vm->_sequence->startCardiffSeq(whither, ped); + _sequence->startCardiffSeq(whither, ped); break; case kRoomAvvysGarden: case kRoomEntranceHall: case kRoomInsideAbbey: case kRoomYourHall: - _vm->_sequence->startHallSeq(whither, ped); + _sequence->startHallSeq(whither, ped); break; case kRoomMusicRoom: case kRoomOutsideArgentPub: - _vm->_sequence->startMusicRoomSeq2(whither, ped); + _sequence->startMusicRoomSeq2(whither, ped); break; case kRoomLusties: switch (magicnum) { case 14: if (_avvysInTheCupboard) { - _vm->_animation->hideInCupboard(); - _vm->_sequence->startCupboardSeq(); + _animation->hideInCupboard(); + _sequence->startCupboardSeq(); return; } else { - _vm->_animation->appearPed(0, 5); - _vm->_animation->_sprites[0]._facingDir = kDirRight; - _vm->_sequence->startLustiesSeq2(whither, ped); + _animation->appearPed(0, 5); + _animation->_sprites[0]._facingDir = kDirRight; + _sequence->startLustiesSeq2(whither, ped); } break; case 12: - _vm->_sequence->startLustiesSeq3(whither, ped); + _sequence->startLustiesSeq3(whither, ped); break; } break; default: - _vm->_sequence->startDummySeq(whither, ped); + _sequence->startDummySeq(whither, ped); } } -void Avalot::setRoom(People persId, Room roomId) { +void AvalancheEngine::setRoom(People persId, Room roomId) { _whereIs[persId - kPeopleAvalot] = roomId; } -Room Avalot::getRoom(People persId) { +Room AvalancheEngine::getRoom(People persId) { return _whereIs[persId - kPeopleAvalot]; } } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index a80d80d275..af7ba2c71d 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -111,261 +111,6 @@ struct Sundry { // Things which must be saved over a backtobootstrap, outside DN }; #endif -class Avalot { -public: - static const int16 kXW = 30; - static const int16 kYW = 36; // x width & y whatsit - static const int16 kMargin = 5; - static const MouseHotspotType kMouseHotSpots[9]; - static const int16 kMaxSprites = 2; // Current max no. of sprites. - - // For Thinkabout: - 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 bool kSlowComputer = false; // Stops walking when mouse touches toolbar. - static const int16 kBorder = 1; // size of border on shadowboxes - static const int16 kWalk = 3; - static const int16 kRun = 5; - static const int32 kCatacombMap[8][8]; - static const char kSpludwicksOrder[3]; - static const QuasipedType kQuasipeds[16]; - - enum Pitch { - kPitchInvalid, - kPitchLower, - kPitchSame, - kPitchHigher - }; - - static const uint16 kNotes[12]; - static const TuneType kTune; - - static const char *kVersionNum; - static const char *kCopyright; - static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".". - static const int16 kGameCode = 2; // Avalot's code number - - - - Avalot(AvalancheEngine *vm); - ~Avalot(); - - bool _holdLeftMouse; - Clock _clock; - - // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. - // If a scroll comes up, or you leave the room, it's automatically set to zero. - byte _interrogation; - - // Former DNA structure - byte _carryNum; // How many objects you're carrying... - bool _objects[kObjectNum]; // ...and which ones they are. - int16 _dnascore; // your score, of course - int32 _money; // your current amount of dosh - Room _room; // your current room - byte _roomCount[100]; // Add one to each every time you enter a room - bool _wonNim; // Have you *won* Nim? (That's harder.) - byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. - bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? - byte _passwordNum; // Number of the passw for this game. - bool _aylesIsAwake; // pretty obvious! - byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). - byte _avariciusTalk; // How much Avaricius has said to you. - bool _rottenOnion; // And has it rotted? - bool _onionInVinegar; // Is the onion in the vinegar? - byte _givenToSpludwick; // 0 = nothing given, 1 = onion... - byte _brummieStairs; // Progression through the stairs trick. - byte _cardiffQuestionNum; // Things you get asked in Cardiff. - bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? - bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) - bool _avvyInBed; // True if Avvy's in bed, but awake. - bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. - byte _npcFacing; // If there's an NPC in the current room which turns it's head according to Avvy's movement (keep looking at him), this variable tells which way it's facing at the moment. - bool _givenBadgeToIby; // Have you given the badge to Iby yet? - bool _friarWillTieYouUp; // If you're going to get tied up. - bool _tiedUp; // You ARE tied up! - byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. - bool _talkedToCrapulus; // Pretty self-explanatory. - byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. - bool _bellsAreRinging; // Is Jacques ringing the bells? - bool _standingOnDais; // In room 71, inside Cardiff Castle. - bool _takenPen; // Have you taken the pen (in Cardiff?) - bool _arrowTriggered; // And has the arrow been triggered? - bool _arrowInTheDoor; // Did the arrow hit the wall? - Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's - uint32 _totalTime; // Your total time playing this game, in ticks. - byte _jumpStatus; // Fixes how high you're jumping. - bool _mushroomGrowing; // Is the mushroom growing in 42? - bool _spludwickAtHome; // Is Spludwick at home? - byte _lastRoom; - byte _lastRoomNotMap; - bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? - bool _enterCatacombsFromLustiesRoom; - bool _teetotal; // Are we touching any more drinks? - byte _malagauche; // Position of Malagauche. See Celer for more info. - char _drinking; // What's he getting you? - bool _enteredLustiesRoomAsMonk; - byte _catacombX, _catacombY; // XY coords in the catacombs. - bool _avvysInTheCupboard; // On screen 22. - bool _geidaFollows; // Is Geida following you? - byte _nextBell; // For the ringing. - bool _givenPotionToGeida; // Does Geida have the potion? - bool _lustieIsAsleep; // Is BDL asleep? - bool _beenTiedUp; // In r__Robins. - bool _sittingInPub; // Are you sitting down in the pub? - byte _spurgeTalkCount; // Count for talking to Spurge. - bool _metAvaroid; - bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; - // End of former DNA Structure - - byte _lineNum; // Number of lines. - LineType _lines[50]; // For Also. - enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; - bool _dropsOk, _soundFx, _cheat; - Common::String _mouseText; - bool _weirdWord; - bool _letMeOut; - Common::String _scroll[15]; - byte _scrollNum, _whichwas; - byte _thinks; - bool _thinkThing; - int16 _talkX, _talkY; - byte _talkBackgroundColor, _talkFontColor; - byte _scrollBells; // no. of times to ring the bell - bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? - char _objectList[10]; - ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! - ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. - // Called .free() for them in ~Gyro(). - int8 _scoreToDisplay[3]; - byte _currentMouse; // current mouse-void - Common::String _verbStr; // what you can do with your object. :-) - Common::String *_also[31][2]; - PedType _peds[15]; - MagicType _magics[15]; - MagicType _portals[7]; - FieldType _fields[30]; - byte _fieldNum; - Common::String _flags; - Common::String _listen; - byte _cp, _ledStatus, _defaultLed; - FontType _font; - bool _alive; - byte _buffer[2000]; - uint16 _bufSize; - int16 _underScroll; // Y-coord of just under the scroll text. - Common::String _roomnName; // Name of actual room - Common::String _subject; // What you're talking to them about. - byte _subjectNum; // The same thing. - bool _keyboardClick; // Is a keyboard click noise wanted? - People _him, _her; - byte _it; - int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. - - People _lastPerson; // Last person to have been selected using the People menu. - bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. - bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. - bool _isLoaded; // Is it a loaded gamestate? - Common::String _enidFilename; - - void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). - void setup(); - void runAvalot(); - - void init(); - void callVerb(VerbCode id); - void drawAlsoLines(); - void loadRoom(byte num); - void exitRoom(byte x); - void enterRoom(Room room, byte ped); - void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! - void loadDigits(); // Load the scoring digits & rwlites - void drawToolbar(); - void drawScore(); - void incScore(byte num); // Add on no. of points - void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement. - void fxToggle(); - void refreshObjectList(); - void checkClick(); - void errorLed(); - void dusk(); - void dawn(); - void drawDirection(); // Draws the little icon at the left end of the text input field. - void gameOver(); - uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. - void fixFlashers(); - void loadAlso(byte num); - - // There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING. - void minorRedraw(); - void majorRedraw(); - - void spriteRun(); - - Common::String intToStr(int32 num); - void newMouse(byte id); - void setMousePointerWait(); // Makes hourglass. - void loadMouse(byte which); - - void setBackgroundColor(byte x); - - void resetVariables(); - void newGame(); // This sets up the DNA for a completely new game. - void slowDown(); - bool setFlag(char x); - bool decreaseMoney(uint16 amount); // Called pennycheck in the original. - void hangAroundForAWhile(); - - 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. - - void openDoor(Room whither, byte ped, byte magicnum); // Handles slidey-open doors. - void flipRoom(Room room, byte ped); - - void setRoom(People persId, Room roomId); - Room getRoom(People persId); -private: - AvalancheEngine *_vm; - - static Room _whereIs[29]; - - Common::File file; - Common::String readAlsoStringFromFile(); - void scram(Common::String &str); - void unScramble(); - - void zoomOut(int16 x, int16 y); // Only used when entering the map. - void enterNewTown(); - void findPeople(byte room); - void putGeidaAt(byte whichPed, byte ped); - void guideAvvy(Common::Point cursorPos); - - // Will be used in dusk() and dawn(). - bool _fxHidden; - - int8 fades(int8 x); - void fadeOut(byte n); - void fadeIn(byte n); -}; - } // End of namespace Avalanche #endif // AVALANCHE_AVALOT_H diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 00c51beba6..c4abc660de 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -53,28 +53,28 @@ void Background::update() { if (_vm->_menu->isActive()) return; // No animation when the menus are up. - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomOutsideArgentPub: - if ((_vm->_avalot->_roomTime % 12) == 0) - draw(-1, -1, (_vm->_avalot->_roomTime / 12) % 4); + if ((_vm->_roomTime % 12) == 0) + draw(-1, -1, (_vm->_roomTime / 12) % 4); break; case kRoomBrummieRoad: - if ((_vm->_avalot->_roomTime % 2) == 0) - draw(-1, -1, (_vm->_avalot->_roomTime / 2) % 4); + if ((_vm->_roomTime % 2) == 0) + draw(-1, -1, (_vm->_roomTime / 2) % 4); break; case kRoomBridge: - if ((_vm->_avalot->_roomTime % 2) == 0) - draw(-1, -1, 3 + (_vm->_avalot->_roomTime / 2) % 4); + if ((_vm->_roomTime % 2) == 0) + draw(-1, -1, 3 + (_vm->_roomTime / 2) % 4); break; case kRoomYours: - if ((!_vm->_avalot->_avvyIsAwake) && ((_vm->_avalot->_roomTime % 4) == 0)) - draw(-1, -1, (_vm->_avalot->_roomTime / 12) % 2); + if ((!_vm->_avvyIsAwake) && ((_vm->_roomTime % 4) == 0)) + draw(-1, -1, (_vm->_roomTime / 12) % 2); break; case kRoomArgentPub: - if (((_vm->_avalot->_roomTime % 7) == 1) && (_vm->_avalot->_malagauche != 177)) { + if (((_vm->_roomTime % 7) == 1) && (_vm->_malagauche != 177)) { // Malagauche cycle. - _vm->_avalot->_malagauche++; - switch (_vm->_avalot->_malagauche) { + _vm->_malagauche++; + switch (_vm->_malagauche) { case 1: case 11: case 21: @@ -90,12 +90,12 @@ void Background::update() { draw(-1, -1, 12); // Winks. break; case 33: - _vm->_avalot->_malagauche = 0; + _vm->_malagauche = 0; break; } } - switch (_vm->_avalot->_roomTime % 200) { + switch (_vm->_roomTime % 200) { case 179: case 197: draw(-1, -1, 4); // Dogfood's drinking cycle. @@ -108,13 +108,13 @@ void Background::update() { draw(-1, -1, 6); break; case 199: - _vm->_avalot->_npcFacing = 177; // Impossible value for this. + _vm->_npcFacing = 177; // Impossible value for this. break; } - if ((_vm->_avalot->_roomTime % 200 >= 0) && (_vm->_avalot->_roomTime % 200 <= 178)) { // Normally. + if ((_vm->_roomTime % 200 >= 0) && (_vm->_roomTime % 200 <= 178)) { // Normally. byte direction = 0; - uint16 angle = _vm->_avalot->bearing(1); + uint16 angle = _vm->bearing(1); if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360))) direction = 3; else if ((angle >= 293) && (angle <= 357)) @@ -122,15 +122,15 @@ void Background::update() { else if ((angle >= 271) && (angle <= 292)) direction = 4; - if (direction != _vm->_avalot->_npcFacing) { // Dogfood. + if (direction != _vm->_npcFacing) { // Dogfood. draw(-1, -1, direction - 1); - _vm->_avalot->_npcFacing = direction; + _vm->_npcFacing = direction; } } break; case kRoomWestHall: - if ((_vm->_avalot->_roomTime % 3) == 0) { - switch ((_vm->_avalot->_roomTime / int32(3)) % int32(6)) { + if ((_vm->_roomTime % 3) == 0) { + switch ((_vm->_roomTime / int32(3)) % int32(6)) { case 4: draw(-1, -1, 0); break; @@ -147,10 +147,10 @@ void Background::update() { } break; case kRoomLustiesRoom: - if (!(_vm->_avalot->_lustieIsAsleep)) { + if (!(_vm->_lustieIsAsleep)) { byte direction = 0; - uint16 angle = _vm->_avalot->bearing(1); - if ((_vm->_avalot->_roomTime % 45) > 42) + uint16 angle = _vm->bearing(1); + if ((_vm->_roomTime % 45) > 42) direction = 4; // du Lustie blinks. // Bearing of Avvy from du Lustie. else if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) @@ -160,15 +160,15 @@ void Background::update() { else if ((angle >= 181) && (angle <= 314)) direction = 3; // Right. - if (direction != _vm->_avalot->_npcFacing) { // du Lustie. + if (direction != _vm->_npcFacing) { // du Lustie. draw(-1, -1, direction - 1); - _vm->_avalot->_npcFacing = direction; + _vm->_npcFacing = direction; } } break; case kRoomAylesOffice: - if ((!_vm->_avalot->_aylesIsAwake) && (_vm->_avalot->_roomTime % 14 == 0)) { - switch ((_vm->_avalot->_roomTime / 14) % 2) { + if ((!_vm->_aylesIsAwake) && (_vm->_roomTime % 14 == 0)) { + switch ((_vm->_roomTime / 14) % 2) { case 0: draw(-1, -1, 0); // Frame 2: EGA. break; @@ -179,8 +179,8 @@ void Background::update() { } break; case kRoomRobins: - if (_vm->_avalot->_tiedUp) { - switch (_vm->_avalot->_roomTime % 54) { + if (_vm->_tiedUp) { + switch (_vm->_roomTime % 54) { case 20: draw(-1, -1, 3); // Frame 4: Avalot blinks. break; @@ -193,7 +193,7 @@ void Background::update() { case kRoomNottsPub: { // Bearing of Avvy from Port. byte direction = 0; - uint16 angle = _vm->_avalot->bearing(4); + uint16 angle = _vm->bearing(4); if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 2; // Middle. else if ((angle >= 45) && (angle <= 180)) @@ -201,15 +201,15 @@ void Background::update() { else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. - if ((_vm->_avalot->_roomTime % 60) > 57) + if ((_vm->_roomTime % 60) > 57) direction--; // Blinks. - if (direction != _vm->_avalot->_npcFacing) { // Port. + if (direction != _vm->_npcFacing) { // Port. draw(-1, -1, direction - 1); - _vm->_avalot->_npcFacing = direction; + _vm->_npcFacing = direction; } - switch (_vm->_avalot->_roomTime % 50) { + switch (_vm->_roomTime % 50) { case 45 : draw(-1, -1, 8); // Spurge blinks. break; @@ -220,12 +220,12 @@ void Background::update() { break; } case kRoomDucks: { - if ((_vm->_avalot->_roomTime % 3) == 0) // The fire flickers. - draw(-1, -1, (_vm->_avalot->_roomTime / 3) % 3); + if ((_vm->_roomTime % 3) == 0) // The fire flickers. + draw(-1, -1, (_vm->_roomTime / 3) % 3); // Bearing of Avvy from Duck. byte direction = 0; - uint16 angle = _vm->_avalot->bearing(1); + uint16 angle = _vm->bearing(1); if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 4; // Middle. else if ((angle >= 45) && (angle <= 180)) @@ -233,26 +233,26 @@ void Background::update() { else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. - if ((_vm->_avalot->_roomTime % 45) > 42) + if ((_vm->_roomTime % 45) > 42) direction++; // Duck blinks. - if (direction != _vm->_avalot->_npcFacing) { // Duck. + if (direction != _vm->_npcFacing) { // Duck. draw(-1, -1, direction - 1); - _vm->_avalot->_npcFacing = direction; + _vm->_npcFacing = direction; } break; } } - if ((_vm->_avalot->_bellsAreRinging) && (_vm->_avalot->setFlag('B'))) { + if ((_vm->_bellsAreRinging) && (_vm->setFlag('B'))) { // They're ringing the bells. - switch (_vm->_avalot->_roomTime % 4) { + switch (_vm->_roomTime % 4) { case 1: - if (_vm->_avalot->_nextBell < 5) - _vm->_avalot->_nextBell = 12; - _vm->_avalot->_nextBell--; + if (_vm->_nextBell < 5) + _vm->_nextBell = 12; + _vm->_nextBell--; // CHECKME: 2 is a guess. No length in the original? - _vm->_sound->playNote(_vm->_avalot->kNotes[_vm->_avalot->_nextBell], 2); + _vm->_sound->playNote(_vm->kNotes[_vm->_nextBell], 2); break; case 2: _vm->_sound->stopSound(); diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 7eb8d50b3b..c8fe128b57 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -48,7 +48,7 @@ void Dialogs::init() { } void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever - if (_vm->_avalot->_ledStatus == state) + if (_vm->_ledStatus == state) return; // Already like that! byte color = kColorBlack; @@ -69,7 +69,7 @@ void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); CursorMan.showMouse(true); - _vm->_avalot->_ledStatus = state; + _vm->_ledStatus = state; } void Dialogs::easterEgg() { @@ -114,8 +114,8 @@ void Dialogs::scrollModeNormal() { Common::String e = "(c) 1994"; setReadyLight(3); - _vm->_avalot->_seeScroll = true; - _vm->_avalot->newMouse(3); + _vm->_seeScroll = true; + _vm->newMouse(3); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -143,7 +143,7 @@ void Dialogs::scrollModeNormal() { bool oktoexit; do { do { - _vm->_avalot->check(); // was "checkclick;" + _vm->check(); // was "checkclick;" //#ifdef RECORD slowdown(); basher::count++; #endif @@ -168,12 +168,12 @@ void Dialogs::scrollModeNormal() { //#ifdef RECORD record_one(); #endif - _vm->_avalot->screturn = r == '#'; // "back door" + _vm->screturn = r == '#'; // "back door" #endif setReadyLight(0); - _vm->_avalot->_seeScroll = false; - _vm->_avalot->_holdLeftMouse = false; // Used in Lucerna::checkclick(). + _vm->_seeScroll = false; + _vm->_holdLeftMouse = false; // Used in Lucerna::checkclick(). warning("STUB: Scrolls::scrollModeNormal()"); } @@ -196,8 +196,8 @@ void Dialogs::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::Stri bool offset = text.size() % 2; x1 = (x2 - x1) / 2 + x1 - text.size() / 2 * 8 - offset * 3; y1 = (y2 - y1) / 2 + y1 - 4; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, _vm->_avalot->_font, 8, x1, y1, kColorBlue); - _vm->_graphics->drawText(_vm->_graphics->_scrolls, Common::String('_'), _vm->_avalot->_font, 8, x1, y1, kColorBlue); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, _vm->_font, 8, x1, y1, kColorBlue); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, Common::String('_'), _vm->_font, 8, x1, y1, kColorBlue); CursorMan.showMouse(true); } @@ -206,7 +206,7 @@ void Dialogs::scrollModeDialogue() { warning("STUB: Scrolls::scrollModeDialogue()"); // It should work with keypresses too! TODO: Implement it! - _vm->_avalot->loadMouse(5); + _vm->loadMouse(5); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -243,7 +243,7 @@ bool Dialogs::theyMatch(TuneType &played) { byte mistakes = 0; for (unsigned int i = 0; i < sizeof(played); i++) { - if (played[i] != _vm->_avalot->kTune[i]) + if (played[i] != _vm->kTune[i]) mistakes++; } @@ -252,16 +252,16 @@ bool Dialogs::theyMatch(TuneType &played) { void Dialogs::scrollModeMusic() { setReadyLight(3); - _vm->_avalot->_seeScroll = true; + _vm->_seeScroll = true; CursorMan.showMouse(false); - _vm->_avalot->newMouse(3); + _vm->newMouse(3); TuneType played; for (unsigned int i = 0; i < sizeof(played); i++) - played[i] = Avalot::kPitchInvalid; + played[i] = kPitchInvalid; int8 lastOne = -1, thisOne = -1; // Invalid values. - _vm->_avalot->_seeScroll = true; + _vm->_seeScroll = true; ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -332,16 +332,16 @@ void Dialogs::scrollModeMusic() { lastOne = thisOne; thisOne = value; - _vm->_sound->playNote(_vm->_avalot->kNotes[thisOne], 100); + _vm->_sound->playNote(_vm->kNotes[thisOne], 100); _vm->_system->delayMillis(200); - if (!_vm->_avalot->_bellsAreRinging) { // These handle playing the right tune. + if (!_vm->_bellsAreRinging) { // These handle playing the right tune. if (thisOne < lastOne) - store(Avalot::kPitchLower, played); + store(kPitchLower, played); else if (thisOne == lastOne) - store(Avalot::kPitchSame, played); + store(kPitchSame, played); else - store(Avalot::kPitchHigher, played); + store(kPitchHigher, played); } if (theyMatch(played)) { @@ -354,30 +354,30 @@ void Dialogs::scrollModeMusic() { _vm->_graphics->_surface.copyFrom(temp); temp.free(); - _vm->_avalot->_seeScroll = false; + _vm->_seeScroll = false; CursorMan.showMouse(true); } void Dialogs::resetScrollDriver() { - _vm->_avalot->_scrollBells = 0; + _vm->_scrollBells = 0; _currentFont = kFontStyleRoman; _useIcon = 0; - _vm->_avalot->_interrogation = 0; // Always reset after a scroll comes up. + _vm->_interrogation = 0; // Always reset after a scroll comes up. } void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... - for (int i = 0; i < _vm->_avalot->_scrollBells; i++) - _vm->_avalot->errorLed(); // Ring the bell "x" times. + for (int i = 0; i < _vm->_scrollBells; i++) + _vm->errorLed(); // Ring the bell "x" times. } void Dialogs::dodgem() { _dodgeCoord = _vm->getMousePos(); - g_system->warpMouse(_dodgeCoord.x, _vm->_avalot->_underScroll); // Move the pointer off the scroll. + g_system->warpMouse(_dodgeCoord.x, _vm->_underScroll); // Move the pointer off the scroll. } void Dialogs::unDodgem() { Common::Point actCoord = _vm->getMousePos(); - if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_avalot->_underScroll)) + if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_underScroll)) g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. } @@ -408,7 +408,7 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); #if 0 - uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_avalot->cp) * _vm->_avalot->pagetop); + uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->cp) * _vm->pagetop); byte bit; for (uint16 i = 1; i <= yl; i++) for (bit = 0; bit <= 3; bit++) { @@ -428,10 +428,10 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; - int16 ly = (_vm->_avalot->_scrollNum) * 6; + int16 ly = (_vm->_scrollNum) * 6; int16 ex; - for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { - ex = _vm->_avalot->_scroll[i].size() * 8; + for (int i = 0; i < _vm->_scrollNum; i++) { + ex = _vm->_scroll[i].size() * 8; if (lx < ex) lx = ex; } @@ -497,44 +497,44 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { iconIndent = 53; } - for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { - if (!_vm->_avalot->_scroll[i].empty()) - switch (_vm->_avalot->_scroll[i][_vm->_avalot->_scroll[i].size() - 1]) { + for (int i = 0; i < _vm->_scrollNum; i++) { + if (!_vm->_scroll[i].empty()) + switch (_vm->_scroll[i][_vm->_scroll[i].size() - 1]) { case kControlCenter: centre = true; - _vm->_avalot->_scroll[i].deleteLastChar(); + _vm->_scroll[i].deleteLastChar(); break; case kControlLeftJustified: centre = false; - _vm->_avalot->_scroll[i].deleteLastChar(); + _vm->_scroll[i].deleteLastChar(); break; case kControlQuestion: _shadowBoxX = mx + lx; _shadowBoxY = my + ly; - _vm->_avalot->_scroll[i].setChar(' ', 0); + _vm->_scroll[i].setChar(' ', 0); drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); break; } if (centre) - say(320 - _vm->_avalot->_scroll[i].size() * 4 + iconIndent, my, _vm->_avalot->_scroll[i]); + say(320 - _vm->_scroll[i].size() * 4 + iconIndent, my, _vm->_scroll[i]); else - say(mx + iconIndent, my, _vm->_avalot->_scroll[i]); + say(mx + iconIndent, my, _vm->_scroll[i]); my += 12; } - _vm->_avalot->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. + _vm->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. ringBell(); - _vm->_avalot->_dropsOk = false; + _vm->_dropsOk = false; dodgem(); (this->*modeFunc)(); unDodgem(); - _vm->_avalot->_dropsOk = true; + _vm->_dropsOk = true; resetScrollDriver(); } @@ -544,9 +544,9 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { CursorMan.showMouse(false); int16 xl = 0; - int16 yl = _vm->_avalot->_scrollNum * 5; - for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { - uint16 textWidth = _vm->_avalot->_scroll[i].size() * 8; + int16 yl = _vm->_scrollNum * 5; + for (int i = 0; i < _vm->_scrollNum; i++) { + uint16 textWidth = _vm->_scroll[i].size() * 8; if (textWidth > xl) xl = textWidth; } @@ -557,90 +557,90 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { int16 my = yw * 2 - 2; int16 xc = 0; - if ((_vm->_avalot->_talkX - xw) < 0) - xc = -(_vm->_avalot->_talkX - xw); - if ((_vm->_avalot->_talkX + xw) > 639) - xc = 639 - (_vm->_avalot->_talkX + xw); + if ((_vm->_talkX - xw) < 0) + xc = -(_vm->_talkX - xw); + if ((_vm->_talkX + xw) > 639) + xc = 639 - (_vm->_talkX + xw); - points[0].x = _vm->_avalot->_talkX - 10; + points[0].x = _vm->_talkX - 10; points[0].y = yw; - points[1].x = _vm->_avalot->_talkX + 10; + points[1].x = _vm->_talkX + 10; points[1].y = yw; - points[2].x = _vm->_avalot->_talkX; - points[2].y = _vm->_avalot->_talkY; + points[2].x = _vm->_talkX; + points[2].y = _vm->_talkY; // Backup the screen before drawing the bubble. _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); // The body of the bubble. - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_avalot->_talkX - xw + 9, 7, _vm->_avalot->_talkX + xw - 8 + xc, my + 1), _vm->_avalot->_talkBackgroundColor); - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_avalot->_talkX - xw - 1, 12, _vm->_avalot->_talkX + xw + xc + 2, my - 4), _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _vm->_talkBackgroundColor); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _vm->_talkBackgroundColor); // Top right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX + xw - 10, 11, 0, 90, 9, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _vm->_talkBackgroundColor); // Bottom right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_talkBackgroundColor); // Top left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX - xw + 10, 11, 90, 180, 9, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _vm->_talkBackgroundColor); // Bottom left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_talkBackgroundColor); // "Tail" of the speech bubble. - _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_talkBackgroundColor); // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). - // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Avalot::characters instead. + // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { - int16 x = xc + _vm->_avalot->_talkX - _vm->_avalot->_scroll[i].size() / 2 * 8; - bool offset = _vm->_avalot->_scroll[i].size() % 2; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_avalot->_scroll[i], _vm->_avalot->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_avalot->_talkFontColor); + for (int i = 0; i < _vm->_scrollNum; i++) { + int16 x = xc + _vm->_talkX - _vm->_scroll[i].size() / 2 * 8; + bool offset = _vm->_scroll[i].size() % 2; + _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); } ringBell(); CursorMan.showMouse(false); - _vm->_avalot->_dropsOk = false; + _vm->_dropsOk = false; // This does the actual drawing to the screen. (this->*modeFunc)(); - _vm->_avalot->_dropsOk = true; + _vm->_dropsOk = true; CursorMan.showMouse(true); // sink; resetScrollDriver(); } void Dialogs::reset() { - _vm->_avalot->_scrollNum = 1; + _vm->_scrollNum = 1; for (int i = 0; i < 15; i++) { - if (!_vm->_avalot->_scroll[i].empty()) - _vm->_avalot->_scroll[i].clear(); + if (!_vm->_scroll[i].empty()) + _vm->_scroll[i].clear(); } } void Dialogs::setBubbleStateNatural() { - _vm->_avalot->_talkX = 320; - _vm->_avalot->_talkY = 200; - _vm->_avalot->_talkBackgroundColor = 8; - _vm->_avalot->_talkFontColor = 15; + _vm->_talkX = 320; + _vm->_talkY = 200; + _vm->_talkBackgroundColor = 8; + _vm->_talkFontColor = 15; } Common::String Dialogs::displayMoney() { Common::String result; - if (_vm->_avalot->_money < 12) { // just pence - result = Common::String::format("%dd", _vm->_avalot->_money); - } else if (_vm->_avalot->_money < 240) { // shillings & pence - if ((_vm->_avalot->_money % 12) == 0) - result = Common::String::format("%d/-", _vm->_avalot->_money / 12); + if (_vm->_money < 12) { // just pence + result = Common::String::format("%dd", _vm->_money); + } else if (_vm->_money < 240) { // shillings & pence + if ((_vm->_money % 12) == 0) + result = Common::String::format("%d/-", _vm->_money / 12); else - result = Common::String::format("%d/%d", _vm->_avalot->_money / 12, _vm->_avalot->_money % 12); + result = Common::String::format("%d/%d", _vm->_money / 12, _vm->_money % 12); } else { // L, s & d - result = Common::String::format("\x9C%d.%d.%d", _vm->_avalot->_money / 240, (_vm->_avalot->_money / 12) % 20, - _vm->_avalot->_money % 12); + result = Common::String::format("\x9C%d.%d.%d", _vm->_money / 240, (_vm->_money / 12) % 20, + _vm->_money % 12); } - if (_vm->_avalot->_money > 12) { - Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_avalot->_money); + if (_vm->_money > 12) { + Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_money); result += extraStr; } @@ -653,16 +653,16 @@ void Dialogs::stripTrailingSpaces(Common::String &str) { } void Dialogs::solidify(byte n) { - if (!_vm->_avalot->_scroll[n].contains(' ')) + if (!_vm->_scroll[n].contains(' ')) return; // No spaces. // So there MUST be a space there, somewhere... do { - _vm->_avalot->_scroll[n + 1] = _vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] + _vm->_avalot->_scroll[n + 1]; - _vm->_avalot->_scroll[n].deleteLastChar(); - } while (_vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] != ' '); + _vm->_scroll[n + 1] = _vm->_scroll[n][_vm->_scroll[n].size() - 1] + _vm->_scroll[n + 1]; + _vm->_scroll[n].deleteLastChar(); + } while (_vm->_scroll[n][_vm->_scroll[n].size() - 1] != ' '); - stripTrailingSpaces(_vm->_avalot->_scroll[n]); + stripTrailingSpaces(_vm->_scroll[n]); } void Dialogs::callDialogDriver() { @@ -676,38 +676,38 @@ void Dialogs::callDialogDriver() { bool mouthnext = false; bool call_spriterun = true; // Only call sprite_run the FIRST time. - switch (_vm->_avalot->_buffer[_vm->_avalot->_bufSize - 1]) { + switch (_vm->_buffer[_vm->_bufSize - 1]) { case kControlToBuffer: - _vm->_avalot->_bufSize--; + _vm->_bufSize--; break; // ^D = (D)on't include pagebreak case kControlSpeechBubble: case kControlQuestion: break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box default: - _vm->_avalot->_buffer[_vm->_avalot->_bufSize] = kControlParagraph; - _vm->_avalot->_bufSize++; + _vm->_buffer[_vm->_bufSize] = kControlParagraph; + _vm->_bufSize++; } - uint16 size = _vm->_avalot->_bufSize; + uint16 size = _vm->_bufSize; for (uint16 i = 0; i < size; i++) { if (mouthnext) { - if (_vm->_avalot->_buffer[i] == kControlRegister) + if (_vm->_buffer[i] == kControlRegister) _param = 0; - else if (('0' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= '9')) - _param = _vm->_avalot->_buffer[i] - 48; - else if (('A' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= 'Z')) - _param = _vm->_avalot->_buffer[i] - 55; + else if (('0' <= _vm->_buffer[i]) && (_vm->_buffer[i] <= '9')) + _param = _vm->_buffer[i] - 48; + else if (('A' <= _vm->_buffer[i]) && (_vm->_buffer[i] <= 'Z')) + _param = _vm->_buffer[i] - 55; mouthnext = false; } else { - switch (_vm->_avalot->_buffer[i]) { + switch (_vm->_buffer[i]) { case kControlParagraph: - if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty())) + if ((_vm->_scrollNum == 1) && (_vm->_scroll[0].empty())) break; if (call_spriterun) - _vm->_avalot->spriteRun(); + _vm->spriteRun(); call_spriterun = false; drawScroll(&Avalanche::Dialogs::scrollModeNormal); @@ -718,14 +718,14 @@ void Dialogs::callDialogDriver() { return; break; case kControlBell: - _vm->_avalot->_scrollBells++; + _vm->_scrollBells++; break; // #7 = "Bel" case kControlSpeechBubble: - if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty())) + if ((_vm->_scrollNum == 1) && (_vm->_scroll[0].empty())) break; if (call_spriterun) - _vm->_avalot->spriteRun(); + _vm->spriteRun(); call_spriterun = false; if (_param == 0) @@ -733,7 +733,7 @@ void Dialogs::callDialogDriver() { else if ((1 <= _param) && (_param <= 9)) { AnimationType *spr = &_vm->_animation->_sprites[_param - 1]; if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. - _vm->_avalot->errorLed(); + _vm->errorLed(); setBubbleStateNatural(); } else spr->chatter(); // Normal sprite talking routine. @@ -741,14 +741,14 @@ void Dialogs::callDialogDriver() { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - PedType *quasiPed = &_vm->_avalot->_peds[_vm->_avalot->kQuasipeds[_param - 10]._whichPed]; - _vm->_avalot->_talkX = quasiPed->_x; - _vm->_avalot->_talkY = quasiPed->_y; // Position. + PedType *quasiPed = &_vm->_peds[_vm->kQuasipeds[_param - 10]._whichPed]; + _vm->_talkX = quasiPed->_x; + _vm->_talkY = quasiPed->_y; // Position. - _vm->_avalot->_talkFontColor = _vm->_avalot->kQuasipeds[_param - 10]._foregroundColor; - _vm->_avalot->_talkBackgroundColor = _vm->_avalot->kQuasipeds[_param - 10]._backgroundColor; // Colors. + _vm->_talkFontColor = _vm->kQuasipeds[_param - 10]._foregroundColor; + _vm->_talkBackgroundColor = _vm->kQuasipeds[_param - 10]._backgroundColor; // Colors. } else { - _vm->_avalot->errorLed(); // Not valid. + _vm->errorLed(); // Not valid. setBubbleStateNatural(); } @@ -767,46 +767,46 @@ void Dialogs::callDialogDriver() { displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) break; case 2: { - int pwdId = _vm->_parser->kFirstPassword + _vm->_avalot->_passwordNum; + int pwdId = _vm->_parser->kFirstPassword + _vm->_passwordNum; displayText(_vm->_parser->_vocabulary[pwdId]._word + kControlToBuffer); } break; case 3: - displayText(_vm->_avalot->_favouriteDrink + kControlToBuffer); + displayText(_vm->_favouriteDrink + kControlToBuffer); break; case 4: - displayText(_vm->_avalot->_favouriteSong + kControlToBuffer); + displayText(_vm->_favouriteSong + kControlToBuffer); break; case 5: - displayText(_vm->_avalot->_worstPlaceOnEarth + kControlToBuffer); + displayText(_vm->_worstPlaceOnEarth + kControlToBuffer); break; case 6: - displayText(_vm->_avalot->_spareEvening + kControlToBuffer); + displayText(_vm->_spareEvening + kControlToBuffer); break; case 9: { - Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_avalot->_catacombX, _vm->_avalot->_catacombY, kControlToBuffer); + Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_catacombX, _vm->_catacombY, kControlToBuffer); displayText(tmpStr); } break; case 10: - switch (_vm->_avalot->_boxContent) { + switch (_vm->_boxContent) { case 0: // Sixpence. displayScrollChain('q', 37); // You find the sixpence. - _vm->_avalot->_money += 6; - _vm->_avalot->_boxContent = _vm->_parser->kNothing; - _vm->_avalot->incScore(2); + _vm->_money += 6; + _vm->_boxContent = _vm->_parser->kNothing; + _vm->incScore(2); return; case Parser::kNothing: displayText("nothing at all. It's completely empty."); break; default: - displayText(_vm->_avalot->getItem(_vm->_avalot->_boxContent) + '.'); + displayText(_vm->getItem(_vm->_boxContent) + '.'); } break; case 11: for (int j = 0; j < kObjectNum; j++) { - if (_vm->_avalot->_objects[j]) - displayText(_vm->_avalot->getItem(j) + ", " + kControlToBuffer); + if (_vm->_objects[j]) + displayText(_vm->getItem(j) + ", " + kControlToBuffer); } break; } @@ -815,15 +815,15 @@ void Dialogs::callDialogDriver() { _useIcon = _param; break; case kControlNewLine: - _vm->_avalot->_scrollNum++; + _vm->_scrollNum++; break; case kControlQuestion: if (call_spriterun) - _vm->_avalot->spriteRun(); + _vm->spriteRun(); call_spriterun = false; - _vm->_avalot->_scroll[_vm->_avalot->_scrollNum] = kControlQuestion; - _vm->_avalot->_scrollNum++; + _vm->_scroll[_vm->_scrollNum] = kControlQuestion; + _vm->_scrollNum++; drawScroll(&Avalanche::Dialogs::scrollModeDialogue); reset(); @@ -833,14 +833,14 @@ void Dialogs::callDialogDriver() { break; case kControlInsertSpaces: for (int j = 0; j < 9; j++) - _vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1] += ' '; + _vm->_scroll[_vm->_scrollNum - 1] += ' '; break; default: // Add new char. - if (_vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1].size() == 50) { - solidify(_vm->_avalot->_scrollNum - 1); - _vm->_avalot->_scrollNum++; + if (_vm->_scroll[_vm->_scrollNum - 1].size() == 50) { + solidify(_vm->_scrollNum - 1); + _vm->_scrollNum++; } - _vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1] += _vm->_avalot->_buffer[i]; + _vm->_scroll[_vm->_scrollNum - 1] += _vm->_buffer[i]; break; } } @@ -848,8 +848,8 @@ void Dialogs::callDialogDriver() { } void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! - _vm->_avalot->_bufSize = text.size(); - memcpy(_vm->_avalot->_buffer, text.c_str(), _vm->_avalot->_bufSize); + _vm->_bufSize = text.size(); + memcpy(_vm->_buffer, text.c_str(), _vm->_bufSize); callDialogDriver(); } @@ -880,7 +880,7 @@ void Dialogs::loadFont() { error("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); for (int16 i = 0; i < 256; i++) - file.read(_vm->_avalot->_font[i],16); + file.read(_vm->_font[i],16); file.close(); } @@ -889,7 +889,7 @@ void Dialogs::displayMusicalScroll() { kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer); displayText(tmpStr); - _vm->_avalot->spriteRun(); + _vm->spriteRun(); CursorMan.showMouse(false); drawScroll(&Avalanche::Dialogs::scrollModeMusic); CursorMan.showMouse(true); @@ -899,13 +899,13 @@ void Dialogs::displayMusicalScroll() { // From Visa: void Dialogs::unSkrimble() { - for (uint16 i = 0; i < _vm->_avalot->_bufSize; i++) - _vm->_avalot->_buffer[i] = (~(_vm->_avalot->_buffer[i] - (i + 1))) % 256; + for (uint16 i = 0; i < _vm->_bufSize; i++) + _vm->_buffer[i] = (~(_vm->_buffer[i] - (i + 1))) % 256; } void Dialogs::doTheBubble() { - _vm->_avalot->_buffer[_vm->_avalot->_bufSize] = 2; - _vm->_avalot->_bufSize++; + _vm->_buffer[_vm->_bufSize] = 2; + _vm->_bufSize++; } /** @@ -946,8 +946,8 @@ void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbl ::error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sez_offset); - _vm->_avalot->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize); + _vm->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_buffer, _vm->_bufSize); sezfile.close(); unSkrimble(); @@ -992,8 +992,8 @@ void Dialogs::speak(byte who, byte subject) { error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sez_offset); - _vm->_avalot->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize); + _vm->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_buffer, _vm->_bufSize); sezfile.close(); unSkrimble(); @@ -1005,26 +1005,26 @@ void Dialogs::speak(byte who, byte subject) { void Dialogs::talkTo(byte whom) { if (_vm->_parser->_person == kPeoplePardon) { - _vm->_parser->_person = (People)_vm->_avalot->_subjectNum; - _vm->_avalot->_subjectNum = 0; + _vm->_parser->_person = (People)_vm->_subjectNum; + _vm->_subjectNum = 0; } - if (_vm->_avalot->_subjectNum == 0) { + if (_vm->_subjectNum == 0) { switch (whom) { case kPeopleSpludwick: - if ((_vm->_avalot->_lustieIsAsleep) & (!_vm->_avalot->_objects[kObjectPotion - 1])) { + if ((_vm->_lustieIsAsleep) & (!_vm->_objects[kObjectPotion - 1])) { displayScrollChain('q', 68); - _vm->_avalot->_objects[kObjectPotion - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->incScore(3); + _vm->_objects[kObjectPotion - 1] = true; + _vm->refreshObjectList(); + _vm->incScore(3); return; - } else if (_vm->_avalot->_talkedToCrapulus) { + } else if (_vm->_talkedToCrapulus) { // Spludwick - what does he need? // 0 - let it through to use normal routine. - switch (_vm->_avalot->_givenToSpludwick) { + switch (_vm->_givenToSpludwick) { case 1: // Fallthrough is intended. case 2: { - Common::String objStr = _vm->_avalot->getItem(Avalot::kSpludwicksOrder[_vm->_avalot->_givenToSpludwick]); + Common::String objStr = _vm->getItem(AvalancheEngine::kSpludwicksOrder[_vm->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); displayText(tmpStr); } @@ -1039,23 +1039,23 @@ void Dialogs::talkTo(byte whom) { } break; case kPeopleIbythneth: - if (_vm->_avalot->_givenBadgeToIby) { + if (_vm->_givenBadgeToIby) { displayScrollChain('q', 33); // Thanks a lot! return; // And leave the proc. } break; // Or... just continue, 'cos he hasn't got it. case kPeopleDogfood: - if (_vm->_avalot->_wonNim) { // We've won the game. + if (_vm->_wonNim) { // We've won the game. displayScrollChain('q', 6); // "I'm Not Playing!" return; // Zap back. } else - _vm->_avalot->_askedDogfoodAboutNim = true; + _vm->_askedDogfoodAboutNim = true; break; case kPeopleAyles: - if (!_vm->_avalot->_aylesIsAwake) { + if (!_vm->_aylesIsAwake) { displayScrollChain('q', 43); // He's fast asleep! return; - } else if (!_vm->_avalot->_givenPenToAyles) { + } else if (!_vm->_givenPenToAyles) { displayScrollChain('q', 44); // Can you get me a pen, Avvy? return; } @@ -1066,29 +1066,29 @@ void Dialogs::talkTo(byte whom) { return; case kPeopleGeida: - if (_vm->_avalot->_givenPotionToGeida) - _vm->_avalot->_geidaFollows = true; + if (_vm->_givenPotionToGeida) + _vm->_geidaFollows = true; else { displayScrollChain('u', 17); return; } break; case kPeopleSpurge: - if (!_vm->_avalot->_sittingInPub) { + if (!_vm->_sittingInPub) { displayScrollChain('q', 71); // Try going over and sitting down. return; } else { - if (_vm->_avalot->_spurgeTalkCount < 5) - _vm->_avalot->_spurgeTalkCount++; - if (_vm->_avalot->_spurgeTalkCount > 1) { // no. 1 falls through - displayScrollChain('q', 70 + _vm->_avalot->_spurgeTalkCount); + if (_vm->_spurgeTalkCount < 5) + _vm->_spurgeTalkCount++; + if (_vm->_spurgeTalkCount > 1) { // no. 1 falls through + displayScrollChain('q', 70 + _vm->_spurgeTalkCount); return; } } break; } // On a subject. Is there any reason to block it? - } else if ((whom == kPeopleAyles) && (!_vm->_avalot->_aylesIsAwake)) { + } else if ((whom == kPeopleAyles) && (!_vm->_aylesIsAwake)) { displayScrollChain('q', 43); // He's fast asleep! return; } @@ -1111,23 +1111,23 @@ void Dialogs::talkTo(byte whom) { displayText(tmpStr); } - speak(whom, _vm->_avalot->_subjectNum); + speak(whom, _vm->_subjectNum); if (!_noError) displayScrollChain('n', whom); // File not found! - if ((_vm->_avalot->_subjectNum == 0) && ((whom + 149) == kPeopleCrapulus)) { // Crapulus: get the badge - first time only - _vm->_avalot->_objects[kObjectBadge - 1] = true; - _vm->_avalot->refreshObjectList(); + if ((_vm->_subjectNum == 0) && ((whom + 149) == kPeopleCrapulus)) { // Crapulus: get the badge - first time only + _vm->_objects[kObjectBadge - 1] = true; + _vm->refreshObjectList(); displayScrollChain('q', 1); // Circular from Cardiff. - _vm->_avalot->_talkedToCrapulus = true; - _vm->_avalot->setRoom(kPeopleCrapulus, kRoomDummy); // Crapulus walks off. + _vm->_talkedToCrapulus = true; + _vm->setRoom(kPeopleCrapulus, kRoomDummy); // Crapulus walks off. AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = true; spr->walkTo(2); // Walks away. - _vm->_avalot->incScore(2); + _vm->incScore(2); } } diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index c3caec7b55..7264cbcf19 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -65,7 +65,7 @@ void HeadType::highlight() { _menu->_activeMenuItem._activeNum = _position; _menu->_menuActive = true; - _menu->_vm->_avalot->_currentMouse = 177; // Force redraw of cursor. + _menu->_vm->_currentMouse = 177; // Force redraw of cursor. } bool HeadType::parseAltTrigger(char key) { @@ -135,8 +135,8 @@ void MenuItem::display() { for (int y = 1; y < _optionNum; y++) displayOption(y, false); - _dr->_vm->_avalot->_defaultLed = 1; - _dr->_vm->_avalot->_currentMouse = 177; + _dr->_vm->_defaultLed = 1; + _dr->_vm->_currentMouse = 177; CursorMan.showMouse(true); // 4 = fletch } @@ -149,7 +149,7 @@ void MenuItem::wipe() { _activeNow = false; _dr->_menuActive = false; _firstlix = false; - _dr->_vm->_avalot->_defaultLed = 2; + _dr->_vm->_defaultLed = 2; CursorMan.showMouse(true); } @@ -218,13 +218,13 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Menu void MenuBar::draw() { _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); - byte savecp = _dr->_vm->_avalot->_cp; - _dr->_vm->_avalot->_cp = 3; + byte savecp = _dr->_vm->_cp; + _dr->_vm->_cp = 3; for (int i = 0; i < _menuNum; i++) _menuItems[i].draw(); - _dr->_vm->_avalot->_cp = savecp; + _dr->_vm->_cp = savecp; } void MenuBar::parseAltTrigger(char c) { @@ -262,30 +262,30 @@ Menu::Menu(AvalancheEngine *vm) { } void Menu::findWhatYouCanDoWithIt() { - switch (_vm->_avalot->_thinks) { + switch (_vm->_thinks) { case kObjectWine: case kObjectPotion: case kObjectInk: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeDrink; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeDrink; break; case kObjectBell: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeRing; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeRing; break; case kObjectChastity: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; case kObjectLute: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodePlay; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodePlay; break; case kObjectMushroom: case kObjectOnion: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeEat; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeEat; break; case kObjectClothes: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; default: - _vm->_avalot->_verbStr = kVerbCodeExam; // Anything else. + _vm->_verbStr = kVerbCodeExam; // Anything else. } } @@ -310,7 +310,7 @@ void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, boo for (uint i = 0; i < text.size(); i++) { for (int j = 0; j < 8; j++) { byte idx = text[i]; - font[idx][j] = _vm->_avalot->_font[idx][j] & ander; // Set the font. + font[idx][j] = _vm->_font[idx][j] & ander; // Set the font. // And set the background of the text to the desired color. for (int k = 0; k < 8; k++) *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; @@ -412,8 +412,8 @@ void Menu::setupMenuFile() { _activeMenuItem.reset(); _activeMenuItem.setupOption("New game", 'N', "f4", true); _activeMenuItem.setupOption("Load...", 'L', "^f3", true); - _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_avalot->_alive); - _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_avalot->_alive); + _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_alive); + _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_alive); _activeMenuItem.setupOption("DOS Shell", 'D', "alt-1", false); _activeMenuItem.setupOption("Quit", 'Q', "alt-X", true); _activeMenuItem.display(); @@ -422,7 +422,7 @@ void Menu::setupMenuFile() { void Menu::setupMenuAction() { _activeMenuItem.reset(); - Common::String f5Does = _vm->_avalot->f5Does(); + Common::String f5Does = _vm->f5Does(); for (int i = 0; i < 2; i++) if (!f5Does.empty()) f5Does.deleteChar(0); @@ -431,13 +431,13 @@ void Menu::setupMenuAction() { else _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true); - if (_vm->_avalot->_room == kRoomMap) + if (_vm->_room == kRoomMap) _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->nearDoor()); else _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_animation->_sprites[0]._speedX == _vm->_avalot->kWalk) + if (_vm->_animation->_sprites[0]._speedX == _vm->kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -452,8 +452,8 @@ void Menu::setupMenuPeople() { _activeMenuItem.reset(); for (int i = kPeopleAvalot; i <= kPeopleWisewoman; i++) { - if (_vm->_avalot->getRoom((People)i) == _vm->_avalot->_room) { - _activeMenuItem.setupOption(_vm->_avalot->getName((People)i), _vm->_avalot->getNameChar((People)i), "", true); + if (_vm->getRoom((People)i) == _vm->_room) { + _activeMenuItem.setupOption(_vm->getName((People)i), _vm->getNameChar((People)i), "", true); people += i; } } @@ -464,8 +464,8 @@ void Menu::setupMenuPeople() { void Menu::setupMenuObjects() { _activeMenuItem.reset(); for (int i = 0; i < kObjectNum; i++) { - if (_vm->_avalot->_objects[i]) - _activeMenuItem.setupOption(_vm->_avalot->getThing(i + 1), _vm->_avalot->getThingChar(i + 1), "", true); + if (_vm->_objects[i]) + _activeMenuItem.setupOption(_vm->getThing(i + 1), _vm->getThingChar(i + 1), "", true); } _activeMenuItem.display(); } @@ -473,54 +473,54 @@ void Menu::setupMenuObjects() { void Menu::setupMenuWith() { _activeMenuItem.reset(); - if (_vm->_avalot->_thinkThing) { + if (_vm->_thinkThing) { findWhatYouCanDoWithIt(); - for (uint i = 0; i < _vm->_avalot->_verbStr.size(); i++) { + for (uint i = 0; i < _vm->_verbStr.size(); i++) { char vbchar; Common::String verb; - _vm->_parser->verbOpt(_vm->_avalot->_verbStr[i], verb, vbchar); + _vm->_parser->verbOpt(_vm->_verbStr[i], verb, vbchar); _activeMenuItem.setupOption(verb, vbchar, "", true); } // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // or (c), the _person you've selected is YOU! - if ((_vm->_avalot->_lastPerson == kPeopleAvalot) || (_vm->_avalot->_lastPerson == _vm->_parser->kNothing) - || (_vm->_avalot->getRoom(_vm->_avalot->_lastPerson) != _vm->_avalot->_room)) + if ((_vm->_lastPerson == kPeopleAvalot) || (_vm->_lastPerson == _vm->_parser->kNothing) + || (_vm->getRoom(_vm->_lastPerson) != _vm->_room)) _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 + kVerbCodeGive; + _activeMenuItem.setupOption(Common::String("Give to ") + _vm->getName(_vm->_lastPerson), 'G', "", true); + _vm->_verbStr = _vm->_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(kVerbCodeExam) + kVerbCodeTalk; - switch (_vm->_avalot->_thinks) { + _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_thinks), 'T', "", true); + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeTalk; + switch (_vm->_thinks) { case kPeopleGeida: case kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodeKiss; + _vm->_verbStr = _vm->_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 + kVerbCodePlay; + _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_wonNim); // True if you HAVEN'T won. + _vm->_verbStr = _vm->_verbStr + kVerbCodePlay; break; case kPeopleMalagauche: { - bool isSober = !_vm->_avalot->_teetotal; - _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_avalot->_objects[kObjectWine - 1]); + bool isSober = !_vm->_teetotal; + _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_objects[kObjectWine - 1]); _activeMenuItem.setupOption("Buy some beer", 'b', "", isSober); _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); _activeMenuItem.setupOption("Buy some mead", 'm', "", isSober); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 101 + 100 + 102 + 103 + 104; + _vm->_verbStr = _vm->_verbStr + 101 + 100 + 102 + 103 + 104; } break; case kPeopleTrader: - _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_avalot->_objects[kObjectOnion - 1]); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 105; + _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_objects[kObjectOnion - 1]); + _vm->_verbStr = _vm->_verbStr + 105; break; } } @@ -531,19 +531,19 @@ void Menu::runMenuGame() { // Help, boss, untrash screen. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_avalot->callVerb(kVerbCodeHelp); + _vm->callVerb(kVerbCodeHelp); break; case 1: - _vm->_avalot->callVerb(kVerbCodeBoss); + _vm->callVerb(kVerbCodeBoss); break; case 2: - _vm->_avalot->majorRedraw(); + _vm->majorRedraw(); break; case 3: - _vm->_avalot->callVerb(kVerbCodeScore); + _vm->callVerb(kVerbCodeScore); break; case 4: - _vm->_avalot->callVerb(kVerbCodeInfo); + _vm->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(kVerbCodeRestart); + _vm->callVerb(kVerbCodeRestart); break; case 1: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_avalot->callVerb(kVerbCodeLoad); + _vm->callVerb(kVerbCodeLoad); break; case 2: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_avalot->callVerb(kVerbCodeSave); + _vm->callVerb(kVerbCodeSave); break; case 3: //_vm->_basher->filename_edit(); @@ -572,7 +572,7 @@ 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(kVerbCodeQuit); + _vm->callVerb(kVerbCodeQuit); break; } } @@ -583,31 +583,31 @@ void Menu::runMenuAction() { case 0: { _vm->_parser->_person = kPeoplePardon; _vm->_parser->_thing = _vm->_parser->kPardon; - Common::String f5Does = _vm->_avalot->f5Does(); + Common::String f5Does = _vm->f5Does(); VerbCode verb = (VerbCode)f5Does[0]; - _vm->_avalot->callVerb(verb); + _vm->callVerb(verb); } break; case 1: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_avalot->callVerb(kVerbCodePause); + _vm->callVerb(kVerbCodePause); break; case 2: - _vm->_avalot->callVerb(kVerbCodeOpen); + _vm->callVerb(kVerbCodeOpen); break; case 3: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_avalot->callVerb(kVerbCodeLook); + _vm->callVerb(kVerbCodeLook); break; case 4: - _vm->_avalot->callVerb(kVerbCodeInv); + _vm->callVerb(kVerbCodeInv); break; case 5: { AnimationType *avvy = &_vm->_animation->_sprites[0]; - if (avvy->_speedX == _vm->_avalot->kWalk) - avvy->_speedX = _vm->_avalot->kRun; + if (avvy->_speedX == _vm->kWalk) + avvy->_speedX = _vm->kRun; else - avvy->_speedX = _vm->_avalot->kWalk; + avvy->_speedX = _vm->kWalk; _vm->_animation->updateSpeed(); } break; @@ -615,57 +615,57 @@ void Menu::runMenuAction() { } void Menu::runMenuObjects() { - _vm->_avalot->thinkAbout(_vm->_avalot->_objectList[_activeMenuItem._choiceNum], Avalot::kThing); + _vm->thinkAbout(_vm->_objectList[_activeMenuItem._choiceNum], AvalancheEngine::kThing); } void Menu::runMenuPeople() { - _vm->_avalot->thinkAbout(people[_activeMenuItem._choiceNum], Avalot::kPerson); - _vm->_avalot->_lastPerson = (People)people[_activeMenuItem._choiceNum]; + _vm->thinkAbout(people[_activeMenuItem._choiceNum], AvalancheEngine::kPerson); + _vm->_lastPerson = (People)people[_activeMenuItem._choiceNum]; } void Menu::runMenuWith() { - _vm->_parser->_thing = _vm->_avalot->_thinks; + _vm->_parser->_thing = _vm->_thinks; - if (_vm->_avalot->_thinkThing) { + if (_vm->_thinkThing) { _vm->_parser->_thing += 49; - if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == kVerbCodeGive) - _vm->_parser->_person = _vm->_avalot->_lastPerson; + if (_vm->_verbStr[_activeMenuItem._choiceNum] == kVerbCodeGive) + _vm->_parser->_person = _vm->_lastPerson; else _vm->_parser->_person = kPeoplePardon; } else { - switch (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]) { + switch (_vm->_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer _vm->_parser->_thing = 100; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 101: // Wine _vm->_parser->_thing = 50; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 102: // Whisky _vm->_parser->_thing = 102; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 103: // Cider _vm->_parser->_thing = 103; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 104: // Mead _vm->_parser->_thing = 107; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 105: // Onion (trader) _vm->_parser->_thing = 67; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; default: _vm->_parser->_person = (People)_vm->_parser->_thing; _vm->_parser->_thing = Parser::kPardon; - _vm->_avalot->_subjectNum = 0; + _vm->_subjectNum = 0; } } - _vm->_avalot->callVerb((VerbCode)_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]); + _vm->callVerb((VerbCode)_vm->_verbStr[_activeMenuItem._choiceNum]); } void Menu::setup() { @@ -687,11 +687,11 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... ::Graphics::Surface backup; backup.copyFrom(_vm->_graphics->_surface); - while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_avalot->_holdLeftMouse) { + while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_holdLeftMouse) { _menuBar.chooseMenuItem(cursorPos.x); do _vm->updateEvents(); - while (_vm->_avalot->_holdLeftMouse); + while (_vm->_holdLeftMouse); while (!_vm->shouldQuit()) { do { @@ -701,28 +701,28 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... cursorPos = _vm->getMousePos(); // Change arrow... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_avalot->newMouse(0); // Up arrow + _vm->newMouse(0); // Up arrow else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1)) - _vm->_avalot->newMouse(2); // Right-arrow + _vm->newMouse(2); // Right-arrow else - _vm->_avalot->newMouse(3); // Fletch + _vm->newMouse(3); // Fletch } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_avalot->newMouse(1); // Screwdriver + _vm->newMouse(1); // Screwdriver _activeMenuItem.lightUp(cursorPos); _vm->_graphics->refreshScreen(); - } while (!_vm->_avalot->_holdLeftMouse); + } while (!_vm->_holdLeftMouse); - if (_vm->_avalot->_holdLeftMouse) { + if (_vm->_holdLeftMouse) { if (cursorPos.y > 21) { if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1))))) { // Clicked OUTSIDE the menu. if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); - _vm->_avalot->_holdLeftMouse = false; + _vm->_holdLeftMouse = false; backup.free(); return; } // No "else"- clicking on menu has no effect (only releasing). @@ -736,11 +736,11 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. // If we clicked on the same menu item (the one that is already active) on the bar... - _vm->_avalot->_holdLeftMouse = false; + _vm->_holdLeftMouse = false; backup.free(); return; } else { - _vm->_avalot->_holdLeftMouse = true; + _vm->_holdLeftMouse = true; break; } } @@ -757,7 +757,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... _vm->_graphics->refreshScreen(); _vm->updateEvents(); - if (!_vm->_avalot->_holdLeftMouse) + if (!_vm->_holdLeftMouse) break; } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index b8b461b053..f8f0d4478c 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -50,7 +50,7 @@ void Parser::init() { _inputText.clear(); _inputTextPos = 0; - _vm->_avalot->_weirdWord = false; + _vm->_weirdWord = false; // Initailaze the vocabulary. // Verbs: 1-49 @@ -422,13 +422,13 @@ void Parser::handleFunctionKey(const Common::Event &event) { case Common::KEYCODE_F5: { _person = kPeoplePardon; _thing = kPardon; - Common::String f5does = _vm->_avalot->f5Does(); + Common::String f5does = _vm->f5Does(); VerbCode verb = (VerbCode)f5does[0]; - _vm->_avalot->callVerb(verb); + _vm->callVerb(verb); } break; case Common::KEYCODE_F7: - _vm->_avalot->callVerb(kVerbCodeOpen); + _vm->callVerb(kVerbCodeOpen); break; default: break; @@ -440,7 +440,7 @@ void Parser::plotText() { cursorOff(); _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. - _vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_avalot->_font, 8, 24, 161, kColorWhite); + _vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_font, 8, 24, 161, kColorWhite); cursorOn(); CursorMan.showMouse(true); @@ -539,7 +539,7 @@ Common::String Parser::rank() { }; for (int i = 0; i < 8; i++) { - if ((_vm->_avalot->_dnascore >= kRanks[i]._score) && (_vm->_avalot->_dnascore < kRanks[i + 1]._score)) { + if ((_vm->_dnascore >= kRanks[i]._score) && (_vm->_dnascore < kRanks[i + 1]._score)) { return kRanks[i]._title; } } @@ -551,7 +551,7 @@ Common::String Parser::totalTime() { const double ticksInOneSec = (double)(65535) / 3600; uint16 h, m, s; - h = (uint16)floor(_vm->_avalot->_totalTime / ticksInOneSec); // No. of seconds. + h = (uint16)floor(_vm->_totalTime / ticksInOneSec); // No. of seconds. m = h % 3600; h /= 3600; s = m % 60; @@ -593,10 +593,10 @@ void Parser::displayWhat(byte target, bool animate, bool &ambiguous) { _vm->_dialogs->displayText("What?"); } else { if (animate) { - Common::String tmpStr = Common::String::format("{ %s }", _vm->_avalot->getName((People)target).c_str()); + Common::String tmpStr = Common::String::format("{ %s }", _vm->getName((People)target).c_str()); _vm->_dialogs->displayText(tmpStr); } else { - Common::String z = _vm->_avalot->getItem(target); + Common::String z = _vm->getItem(target); if (z != "") { Common::String tmpStr = Common::String::format("{ %s }", z.c_str()); _vm->_dialogs->displayText(tmpStr); @@ -612,16 +612,16 @@ bool Parser::doPronouns() { byte wordCode = _thats[i]; switch (wordCode) { case 200: - displayWhat(_vm->_avalot->_him, true, ambiguous); - _thats.setChar(_vm->_avalot->_him, i); + displayWhat(_vm->_him, true, ambiguous); + _thats.setChar(_vm->_him, i); break; case 201: - displayWhat(_vm->_avalot->_her, true, ambiguous); - _thats.setChar(_vm->_avalot->_her, i); + displayWhat(_vm->_her, true, ambiguous); + _thats.setChar(_vm->_her, i); break; case 202: - displayWhat(_vm->_avalot->_it, false, ambiguous); - _thats.setChar(_vm->_avalot->_it, i); + displayWhat(_vm->_it, false, ambiguous); + _thats.setChar(_vm->_it, i); break; } } @@ -666,32 +666,32 @@ void Parser::storeInterrogation(byte interrogation) { case 1: _inputText.toLowercase(); sayIt(); - _vm->_avalot->_favouriteDrink = _inputText; - _vm->_avalot->_cardiffQuestionNum = 2; + _vm->_favouriteDrink = _inputText; + _vm->_cardiffQuestionNum = 2; break; case 2: properNouns(); sayIt(); - _vm->_avalot->_favouriteSong = _inputText; - _vm->_avalot->_cardiffQuestionNum = 3; + _vm->_favouriteSong = _inputText; + _vm->_cardiffQuestionNum = 3; break; case 3: properNouns(); sayIt(); - _vm->_avalot->_worstPlaceOnEarth = _inputText; - _vm->_avalot->_cardiffQuestionNum = 4; + _vm->_worstPlaceOnEarth = _inputText; + _vm->_cardiffQuestionNum = 4; break; case 4: _inputText.toLowercase(); sayIt(); - if (!_vm->_avalot->_spareEvening.empty()) - _vm->_avalot->_spareEvening.clear(); - _vm->_avalot->_spareEvening = _inputText; + if (!_vm->_spareEvening.empty()) + _vm->_spareEvening.clear(); + _vm->_spareEvening = _inputText; _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->_avalot->_magics[1]._operation = Avalot::kMagicNothing; - _vm->_avalot->_cardiffQuestionNum = 5; + _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; + _vm->_cardiffQuestionNum = 5; break; case 99: //store_high(_inputText); @@ -727,9 +727,9 @@ void Parser::parse() { } // Are we being interrogated right now? - if (_vm->_avalot->_interrogation > 0) { - storeInterrogation(_vm->_avalot->_interrogation); - _vm->_avalot->_weirdWord = true; + if (_vm->_interrogation > 0) { + storeInterrogation(_vm->_interrogation); + _vm->_weirdWord = true; return; } @@ -761,7 +761,7 @@ void Parser::parse() { // Check also[] first, which contains words about the actual room. if (!thisword.empty()) { for (int i = 0; i < 31; i++) { - if ((_vm->_avalot->_also[i][0]) && (getPos(',' + thisword, *_vm->_avalot->_also[i][0]) > -1)) { + if ((_vm->_also[i][0]) && (getPos(',' + thisword, *_vm->_also[i][0]) > -1)) { _thats += Common::String(99 + i); notfound = false; } @@ -813,12 +813,12 @@ void Parser::parse() { replace(Common::String("\x4\xE5"), 20); // "take off" = "doff" // Words that could mean more than one _person - if (_vm->_avalot->_room == kRoomNottsPub) + if (_vm->_room == kRoomNottsPub) replace(Common::String('\xCC'), 164); // Barman = Port else replace(Common::String('\xCC'), 154); // Barman = Malagauche - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomAylesOffice: replace(Common::String('\xCB'), 163); // Monk = Ayles break; @@ -830,39 +830,39 @@ void Parser::parse() { } if (doPronouns()) { - _vm->_avalot->_weirdWord = true; + _vm->_weirdWord = true; _thats = kNothing; return; } // Second parsing. - if (!_vm->_avalot->_subject.empty()) - _vm->_avalot->_subject.clear(); - _vm->_avalot->_subjectNum = 0; // Find subject of conversation. + if (!_vm->_subject.empty()) + _vm->_subject.clear(); + _vm->_subjectNum = 0; // Find subject of conversation. for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) { if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { - _vm->_avalot->_subjectNum = (byte)_thats[i]; + _vm->_subjectNum = (byte)_thats[i]; _thats.setChar(kMoved, i); break; } } - if ((_vm->_avalot->_subjectNum == 0) && !_thats.empty()) { // Still not found. + if ((_vm->_subjectNum == 0) && !_thats.empty()) { // Still not found. for (uint16 i = 0; i < _thats.size() - 1; i++) { if ((byte)_thats[i] == 252) { // The word is "about", or something similar. - _vm->_avalot->_subjectNum = (byte)_thats[i + 1]; + _vm->_subjectNum = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } } } - if ((_vm->_avalot->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". + if ((_vm->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". for (uint16 i = 0; i < _thats.size() - 1; i++) { if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { // SAY not followed by a preposition - _vm->_avalot->_subjectNum = (byte)_thats[i + 1]; + _vm->_subjectNum = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } @@ -885,30 +885,30 @@ void Parser::parse() { if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_weirdWord = true; + _vm->_weirdWord = true; } else - _vm->_avalot->_weirdWord = false; + _vm->_weirdWord = false; if (_thats.empty()) _thats = kNothing; if (_thing != kPardon) - _vm->_avalot->_it = _thing; + _vm->_it = _thing; if (_person != kPardon) { if (_person < kPeopleArkata) - _vm->_avalot->_him = _person; + _vm->_him = _person; else - _vm->_avalot->_her = _person; + _vm->_her = _person; } } void Parser::examineObject() { - if (_thing != _vm->_avalot->_thinks) - _vm->_avalot->thinkAbout(_thing, Avalot::kThing); + if (_thing != _vm->_thinks) + _vm->thinkAbout(_thing, AvalancheEngine::kThing); switch (_thing) { case kObjectWine : - switch (_vm->_avalot->_wineState) {// 4 is perfect wine. 0 is not holding the wine. + switch (_vm->_wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: _vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll break; @@ -921,7 +921,7 @@ void Parser::examineObject() { } break; case kObjectOnion: - if (_vm->_avalot->_rottenOnion) + if (_vm->_rottenOnion) _vm->_dialogs->displayScrollChain('q', 21); // Yucky onion else _vm->_dialogs->displayScrollChain('t', 18); // Normal onion @@ -932,7 +932,7 @@ void Parser::examineObject() { } bool Parser::isPersonHere() { // Person equivalent of "holding". - if ((_person == kPeoplePardon) || (_person == kPeopleNone) || (_vm->_avalot->getRoom(_person) == _vm->_avalot->_room)) + if ((_person == kPeoplePardon) || (_person == kPeopleNone) || (_vm->getRoom(_person) == _vm->_room)) return true; else { Common::String tmpStr; @@ -947,19 +947,19 @@ bool Parser::isPersonHere() { // Person equivalent of "holding". void Parser::exampers() { if (isPersonHere()) { - if (_thing != _vm->_avalot->_thinks) - _vm->_avalot->thinkAbout(_person, Avalot::kPerson); + if (_thing != _vm->_thinks) + _vm->thinkAbout(_person, AvalancheEngine::kPerson); byte newPerson = _person - 149; - if ((_person == kPeopleDogfood) && _vm->_avalot->_wonNim) + if ((_person == kPeopleDogfood) && _vm->_wonNim) _vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" - else if ((_person == kPeopleDuLustie) && _vm->_avalot->_lustieIsAsleep) + else if ((_person == kPeopleDuLustie) && _vm->_lustieIsAsleep) _vm->_dialogs->displayScrollChain('Q', 65); // He's asleep. else _vm->_dialogs->displayScrollChain('p', newPerson); - if ((_person == kPeopleAyles) && !_vm->_avalot->_aylesIsAwake) + if ((_person == kPeopleAyles) && !_vm->_aylesIsAwake) _vm->_dialogs->displayScrollChain('Q', 13); // CHECKME: Present in the original, but it doesn't make sense. @@ -979,7 +979,7 @@ bool Parser::isHolding() { if (_thing > 100) _vm->_dialogs->displayText("Be reasonable!"); - else if (!_vm->_avalot->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. + else if (!_vm->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. _vm->_dialogs->displayText("You're not holding it, Avvy."); else holdingResult = true; @@ -988,7 +988,7 @@ bool Parser::isHolding() { } void Parser::openBox(bool isOpening) { - if ((_vm->_avalot->_room == kRoomYours) && (_thing == 54)) { + if ((_vm->_room == kRoomYours) && (_thing == 54)) { _vm->_background->draw(-1, -1, 4); _vm->_background->update(); @@ -1015,7 +1015,7 @@ void Parser::examine() { examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing openBox(true); - _vm->_dialogs->displayText(*_vm->_avalot->_also[_thing - 50][1]); + _vm->_dialogs->displayText(*_vm->_also[_thing - 50][1]); openBox(false); } } @@ -1030,17 +1030,17 @@ void Parser::inventory() { Common::String tmpStr = Common::String("You're carrying "); for (int i = 0; i < kObjectNum; i++) { - if (_vm->_avalot->_objects[i]) { + if (_vm->_objects[i]) { itemNum++; - if (itemNum == _vm->_avalot->_carryNum) + if (itemNum == _vm->_carryNum) tmpStr += "and "; - tmpStr += _vm->_avalot->getItem(i + 1); + tmpStr += _vm->getItem(i + 1); if ((i + 1) == _wearing) tmpStr += ", which you're wearing"; - if (itemNum < _vm->_avalot->_carryNum) + if (itemNum < _vm->_carryNum) tmpStr += ", "; } } @@ -1056,17 +1056,17 @@ void Parser::inventory() { void Parser::swallow() { // Eat something. switch (_thing) { case kObjectWine: - switch (_vm->_avalot->_wineState) { // 4 is perfect + switch (_vm->_wineState) { // 4 is perfect case 1: - if (_vm->_avalot->_teetotal) { + if (_vm->_teetotal) { _vm->_dialogs->displayScrollChain('D', 6); return; } _vm->_dialogs->displayScrollChain('U', 1); _vm->_pingo->wobble(); _vm->_dialogs->displayScrollChain('U', 2); - _vm->_avalot->_objects[kObjectWine - 1] = false; - _vm->_avalot->refreshObjectList(); + _vm->_objects[kObjectWine - 1] = false; + _vm->refreshObjectList(); drink(); break; case 2: @@ -1076,10 +1076,10 @@ void Parser::swallow() { // Eat something. } break; case kObjectPotion: - _vm->_avalot->setBackgroundColor(4); + _vm->setBackgroundColor(4); _vm->_dialogs->displayScrollChain('U', 3); - _vm->_avalot->gameOver(); - _vm->_avalot->setBackgroundColor(0); + _vm->gameOver(); + _vm->setBackgroundColor(0); break; case kObjectInk: _vm->_dialogs->displayScrollChain('U', 4); @@ -1089,19 +1089,19 @@ void Parser::swallow() { // Eat something. break; case kObjectMushroom: _vm->_dialogs->displayScrollChain('U', 6); - _vm->_avalot->gameOver(); + _vm->gameOver(); break; case kObjectOnion: - if (_vm->_avalot->_rottenOnion) + if (_vm->_rottenOnion) _vm->_dialogs->displayScrollChain('U', 11); else { _vm->_dialogs->displayScrollChain('U', 8); - _vm->_avalot->_objects[kObjectOnion - 1] = false; - _vm->_avalot->refreshObjectList(); + _vm->_objects[kObjectOnion - 1] = false; + _vm->refreshObjectList(); } break; default: - if ((_vm->_avalot->_room == kRoomArgentPub) || (_vm->_avalot->_room == kRoomNottsPub)) + if ((_vm->_room == kRoomArgentPub) || (_vm->_room == kRoomNottsPub)) _vm->_dialogs->displayText("Try BUYing things before you drink them!"); else _vm->_dialogs->displayText("The taste of it makes you retch!"); @@ -1112,7 +1112,7 @@ void Parser::peopleInRoom() { byte numPeople = 0; // Number of people in the room. for (int i = 151; i < 179; i++) { // Start at 1 so we don't list Avvy himself! - if (_vm->_avalot->getRoom((People)i) == _vm->_avalot->_room) + if (_vm->getRoom((People)i) == _vm->_room) numPeople++; } @@ -1122,14 +1122,14 @@ void Parser::peopleInRoom() { Common::String tmpStr; byte actPerson = 0; // Actually listed people. for (int i = 151; i < 179; i++) { - if (_vm->_avalot->getRoom((People)i) == _vm->_avalot->_room) { + if (_vm->getRoom((People)i) == _vm->_room) { actPerson++; if (actPerson == 1) // First on the list. - tmpStr = _vm->_avalot->getName((People)i); + tmpStr = _vm->getName((People)i); else if (actPerson < numPeople) // The middle... - tmpStr += ", " + _vm->_avalot->getName((People)i); + tmpStr += ", " + _vm->getName((People)i); else // The end. - tmpStr += " and " + _vm->_avalot->getName((People)i); + tmpStr += " and " + _vm->getName((People)i); } } @@ -1142,30 +1142,30 @@ void Parser::peopleInRoom() { } void Parser::lookAround() { - _vm->_dialogs->displayText(*_vm->_avalot->_also[0][1]); - switch (_vm->_avalot->_room) { + _vm->_dialogs->displayText(*_vm->_also[0][1]); + switch (_vm->_room) { case kRoomSpludwicks: - if (_vm->_avalot->_avariciusTalk > 0) + if (_vm->_avariciusTalk > 0) _vm->_dialogs->displayScrollChain('q', 23); else peopleInRoom(); break; case kRoomRobins: - if (_vm->_avalot->_tiedUp) + if (_vm->_tiedUp) _vm->_dialogs->displayScrollChain('q', 38); - if (_vm->_avalot->_mushroomGrowing) + if (_vm->_mushroomGrowing) _vm->_dialogs->displayScrollChain('q', 55); break; case kRoomInsideCardiffCastle: - if (!_vm->_avalot->_takenPen) + if (!_vm->_takenPen) _vm->_dialogs->displayScrollChain('q', 49); break; case kRoomLustiesRoom: - if (_vm->_avalot->_lustieIsAsleep) + if (_vm->_lustieIsAsleep) _vm->_dialogs->displayScrollChain('q', 65); break; case kRoomCatacombs: - switch (_vm->_avalot->_catacombY * 256 + _vm->_avalot->_catacombX) { + switch (_vm->_catacombY * 256 + _vm->_catacombX) { case 258 : _vm->_dialogs->displayScrollChain('q', 80); // Inside art gallery. break; @@ -1184,7 +1184,7 @@ void Parser::lookAround() { void Parser::openDoor() { // Special cases. - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomYours: if (_vm->_animation->inField(1)) { // Opening the box. @@ -1202,29 +1202,29 @@ void Parser::openDoor() { break; } - if ((!_vm->_avalot->_userMovesAvvy) && (_vm->_avalot->_room != kRoomLusties)) + if ((!_vm->_userMovesAvvy) && (_vm->_room != kRoomLusties)) return; // No doors can open if you can't move Avvy. for (int i = 0; i < 7; i++) { if (_vm->_animation->inField(i + 8)) { - MagicType *portal = &_vm->_avalot->_portals[i]; + MagicType *portal = &_vm->_portals[i]; switch (portal->_operation) { - case Avalot::kMagicExclaim: + case AvalancheEngine::kMagicExclaim: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayScrollChain('x', portal->_data); break; - case Avalot::kMagicTransport: - _vm->_avalot->flipRoom((Room)((portal->_data) >> 8), portal->_data & 0x0F); + case AvalancheEngine::kMagicTransport: + _vm->flipRoom((Room)((portal->_data) >> 8), portal->_data & 0x0F); break; - case Avalot::kMagicUnfinished: + case AvalancheEngine::kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayText("Sorry. This place is not available yet!"); break; - case Avalot::kMagicSpecial: + case AvalancheEngine::kMagicSpecial: _vm->_animation->callSpecial(portal->_data); break; - case Avalot::kMagicOpenDoor: - _vm->_avalot->openDoor((Room)(portal->_data >> 8), portal->_data & 0x0F, i + 9); + case AvalancheEngine::kMagicOpenDoor: + _vm->openDoor((Room)(portal->_data >> 8), portal->_data & 0x0F, i + 9); break; } @@ -1232,7 +1232,7 @@ void Parser::openDoor() { } } - if (_vm->_avalot->_room == kRoomMap) + if (_vm->_room == kRoomMap) _vm->_dialogs->displayText("Avvy, you can complete the whole game without ever going " \ "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); else @@ -1258,15 +1258,15 @@ void Parser::putProc() { switch (_thing2) { case kObjectWine: if (_thing == kObjectOnion) { - if (_vm->_avalot->_rottenOnion) + if (_vm->_rottenOnion) _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? - if (_vm->_avalot->_wineState != 3) { + if (_vm->_wineState != 3) { Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { // Put onion into vinegar! Yes! - _vm->_avalot->_onionInVinegar = true; - _vm->_avalot->incScore(7); + _vm->_onionInVinegar = true; + _vm->incScore(7); _vm->_dialogs->displayScrollChain('u', 9); } } @@ -1275,8 +1275,8 @@ void Parser::putProc() { break; case 54: - if (_vm->_avalot->_room == kRoomYours) { // Put something into the box. - if (_vm->_avalot->_boxContent != kNothing) + if (_vm->_room == kRoomYours) { // Put something into the box. + if (_vm->_boxContent != kNothing) _vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { @@ -1294,14 +1294,14 @@ void Parser::putProc() { break; default: // Put the object into the box... if (_wearing == _thing) { - Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_avalot->getItem(_thing).c_str()); + Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->getItem(_thing).c_str()); _vm->_dialogs->displayText(tmpStr); } else { openBox(true); // Open box. - _vm->_avalot->_boxContent = _thing; - _vm->_avalot->_objects[_thing - 1] = false; - _vm->_avalot->refreshObjectList(); + _vm->_boxContent = _thing; + _vm->_objects[_thing - 1] = false; + _vm->refreshObjectList(); _vm->_dialogs->displayText("OK, it's in the box."); openBox(false); // Shut box. @@ -1322,7 +1322,7 @@ void Parser::putProc() { * @remarks Originally called 'not_in_order' */ void Parser::notInOrder() { - Common::String itemStr = _vm->_avalot->getItem(_vm->_avalot->kSpludwicksOrder[_vm->_avalot->_givenToSpludwick]); + Common::String itemStr = _vm->getItem(_vm->kSpludwicksOrder[_vm->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ "What I need next is %s%c2%c", itemStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); @@ -1343,40 +1343,40 @@ void Parser::goToCauldron() { * @remarks Originally called 'give2spludwick' */ bool Parser::giveToSpludwick() { - if (_vm->_avalot->kSpludwicksOrder[_vm->_avalot->_givenToSpludwick] != _thing) { + if (_vm->kSpludwicksOrder[_vm->_givenToSpludwick] != _thing) { notInOrder(); return false; } switch (_thing) { case kObjectOnion: - _vm->_avalot->_objects[kObjectOnion - 1] = false; - if (_vm->_avalot->_rottenOnion) + _vm->_objects[kObjectOnion - 1] = false; + if (_vm->_rottenOnion) _vm->_dialogs->displayScrollChain('q', 22); else { - _vm->_avalot->_givenToSpludwick++; + _vm->_givenToSpludwick++; _vm->_dialogs->displayScrollChain('q', 20); goToCauldron(); - _vm->_avalot->incScore(3); + _vm->incScore(3); } - _vm->_avalot->refreshObjectList(); + _vm->refreshObjectList(); break; case kObjectInk: - _vm->_avalot->_objects[kObjectInk - 1] = false; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_givenToSpludwick++; + _vm->_objects[kObjectInk - 1] = false; + _vm->refreshObjectList(); + _vm->_givenToSpludwick++; _vm->_dialogs->displayScrollChain('q', 24); goToCauldron(); - _vm->_avalot->incScore(3); + _vm->incScore(3); break; case kObjectMushroom: - _vm->_avalot->_objects[kObjectMushroom - 1] = false; + _vm->_objects[kObjectMushroom - 1] = false; _vm->_dialogs->displayScrollChain('q', 25); - _vm->_avalot->incScore(5); - _vm->_avalot->_givenToSpludwick++; + _vm->incScore(5); + _vm->_givenToSpludwick++; goToCauldron(); - _vm->_avalot->_objects[kObjectPotion - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->_objects[kObjectPotion - 1] = true; + _vm->refreshObjectList(); break; default: return true; @@ -1388,27 +1388,27 @@ bool Parser::giveToSpludwick() { void Parser::drink() { _alcoholLevel++; if (_alcoholLevel == 5) { - _vm->_avalot->_objects[kObjectKey - 1] = true; // Get the key. - _vm->_avalot->_teetotal = true; - _vm->_avalot->_avvyIsAwake = false; - _vm->_avalot->_avvyInBed = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->dusk(); - _vm->_avalot->hangAroundForAWhile(); - _vm->_avalot->flipRoom(kRoomYours, 1); - _vm->_avalot->setBackgroundColor(14); + _vm->_objects[kObjectKey - 1] = true; // Get the key. + _vm->_teetotal = true; + _vm->_avvyIsAwake = false; + _vm->_avvyInBed = true; + _vm->refreshObjectList(); + _vm->dusk(); + _vm->hangAroundForAWhile(); + _vm->flipRoom(kRoomYours, 1); + _vm->setBackgroundColor(14); _vm->_animation->_sprites[0]._visible = false; } } void Parser::cardiffClimbing() { - if (_vm->_avalot->_standingOnDais) { // Clamber up. + if (_vm->_standingOnDais) { // Clamber up. _vm->_dialogs->displayText("You climb down, back onto the floor."); - _vm->_avalot->_standingOnDais = false; + _vm->_standingOnDais = false; _vm->_animation->appearPed(0, 2); } else if (_vm->_animation->inField(0)) { // Clamber down _vm->_dialogs->displayText("You clamber up onto the dais."); - _vm->_avalot->_standingOnDais = true; + _vm->_standingOnDais = true; _vm->_animation->appearPed(0, 1); } else _vm->_dialogs->displayText("Get a bit closer, Avvy."); @@ -1419,21 +1419,21 @@ void Parser::already() { } void Parser::standUp() { - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomYours: // Avvy isn't asleep. - if (_vm->_avalot->_avvyIsAwake && _vm->_avalot->_avvyInBed) { // But he's in bed. - if (_vm->_avalot->_teetotal) { + if (_vm->_avvyIsAwake && _vm->_avvyInBed) { // But he's in bed. + if (_vm->_teetotal) { _vm->_dialogs->displayScrollChain('d', 12); - _vm->_avalot->setBackgroundColor(0); + _vm->setBackgroundColor(0); _vm->_dialogs->displayScrollChain('d', 14); } _vm->_animation->_sprites[0]._visible = true; - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; _vm->_animation->appearPed(0, 1); _vm->_animation->setDirection(kDirLeft); _vm->_background->draw(-1, -1, 3); // Picture of empty pillow. - _vm->_avalot->incScore(1); - _vm->_avalot->_avvyInBed = false; + _vm->incScore(1); + _vm->_avvyInBed = false; _vm->_timer->loseTimer(Timer::kReasonArkataShouts); } else already(); @@ -1444,12 +1444,12 @@ void Parser::standUp() { break; case kRoomNottsPub: - if (_vm->_avalot->_sittingInPub) { + if (_vm->_sittingInPub) { _vm->_background->draw(-1, -1, 3); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. _vm->_animation->appearPed(0, 3); // And walking away. - _vm->_avalot->_sittingInPub = false; // Really not sitting down. - _vm->_avalot->_userMovesAvvy = true; // And ambulant. + _vm->_sittingInPub = false; // Really not sitting down. + _vm->_userMovesAvvy = true; // And ambulant. } else already(); break; @@ -1459,18 +1459,18 @@ void Parser::standUp() { } void Parser::getProc(char thing) { - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomYours: if (_vm->_animation->inField(1)) { - if (_vm->_avalot->_boxContent == thing) { + if (_vm->_boxContent == thing) { _vm->_background->draw(-1, -1, 4); _vm->_dialogs->displayText("OK, I've got it."); - _vm->_avalot->_objects[thing - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_boxContent = kNothing; + _vm->_objects[thing - 1] = true; + _vm->refreshObjectList(); + _vm->_boxContent = kNothing; _vm->_background->draw(-1, -1, 5); } else { - Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_avalot->getItem(thing).c_str()); + Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->getItem(thing).c_str()); _vm->_dialogs->displayText(tmpStr); } } else @@ -1480,18 +1480,18 @@ void Parser::getProc(char thing) { switch (thing) { case kObjectPen: if (_vm->_animation->inField(1)) { // Standing on the dais. - if (_vm->_avalot->_takenPen) + if (_vm->_takenPen) _vm->_dialogs->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_background->draw(-1, -1, 3); // No pen there now. _vm->_animation->callSpecial(3); // Zap! - _vm->_avalot->_takenPen = true; - _vm->_avalot->_objects[kObjectPen - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->_takenPen = true; + _vm->_objects[kObjectPen - 1] = true; + _vm->refreshObjectList(); _vm->_dialogs->displayText("Taken."); } - } else if (_vm->_avalot->_standingOnDais) + } else if (_vm->_standingOnDais) _vm->_dialogs->displayScrollChain('q', 53); else _vm->_dialogs->displayScrollChain('q', 51); @@ -1504,14 +1504,14 @@ void Parser::getProc(char thing) { } break; case kRoomRobins: - if ((thing == kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_avalot->_mushroomGrowing)) { + if ((thing == kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_mushroomGrowing)) { _vm->_background->draw(-1, -1, 2); _vm->_dialogs->displayText("Got it!"); - _vm->_avalot->_mushroomGrowing = false; - _vm->_avalot->_takenMushroom = true; - _vm->_avalot->_objects[kObjectMushroom - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->incScore(3); + _vm->_mushroomGrowing = false; + _vm->_takenMushroom = true; + _vm->_objects[kObjectMushroom - 1] = true; + _vm->refreshObjectList(); + _vm->incScore(3); } else _vm->_dialogs->displayScrollChain('q', 57); break; @@ -1525,13 +1525,13 @@ void Parser::getProc(char thing) { * @remarks Originally called 'give_Geida_the_lute' */ void Parser::giveGeidaTheLute() { - if (_vm->_avalot->_room != kRoomLustiesRoom) { + if (_vm->_room != kRoomLustiesRoom) { Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); return; } - _vm->_avalot->_objects[kObjectLute - 1] = false; - _vm->_avalot->refreshObjectList(); + _vm->_objects[kObjectLute - 1] = false; + _vm->refreshObjectList(); _vm->_dialogs->displayScrollChain('q', 64); // She plays it. _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); @@ -1553,13 +1553,13 @@ void Parser::winSequence() { Common::String Parser::personSpeaks() { if ((_person == kPeoplePardon) || (_person == kPeopleNone)) { - if ((_vm->_avalot->_him == kPeoplePardon) || (_vm->_avalot->getRoom(_vm->_avalot->_him) != _vm->_avalot->_room)) - _person = _vm->_avalot->_her; + if ((_vm->_him == kPeoplePardon) || (_vm->getRoom(_vm->_him) != _vm->_room)) + _person = _vm->_her; else - _person = _vm->_avalot->_him; + _person = _vm->_him; } - if (_vm->_avalot->getRoom(_person) != _vm->_avalot->_room) { + if (_vm->getRoom(_person) != _vm->_room) { return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself! } @@ -1577,7 +1577,7 @@ Common::String Parser::personSpeaks() { return tmpStr; for (int i = 0; i < 16; i++) { - if ((_vm->_avalot->kQuasipeds[i]._who == _person) && (_vm->_avalot->kQuasipeds[i]._room == _vm->_avalot->_room)) + if ((_vm->kQuasipeds[i]._who == _person) && (_vm->kQuasipeds[i]._room == _vm->_room)) tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, 'A' + i); } @@ -1588,7 +1588,7 @@ void Parser::heyThanks() { Common::String tmpStr = personSpeaks(); tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_objects[_thing - 1] = false; + _vm->_objects[_thing - 1] = false; } /** @@ -1604,7 +1604,7 @@ void Parser::doThat() { return; } - if (_vm->_avalot->_weirdWord) + if (_vm->_weirdWord) return; if (_thing < 200) @@ -1614,11 +1614,11 @@ void Parser::doThat() { if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { - if (!_vm->_avalot->_alive) { + if (!_vm->_alive) { _vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); return; } - if (!_vm->_avalot->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { + if (!_vm->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { _vm->_dialogs->displayText("Talking in your sleep? Try waking up!"); return; } @@ -1638,7 +1638,7 @@ void Parser::doThat() { break; case kVerbCodeGet: if (_thing != kPardon) { // Legitimate try to pick something up. - if (_vm->_avalot->_carryNum >= kCarryLimit) + if (_vm->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("You can't carry any more!"); else getProc(_thing); @@ -1658,21 +1658,21 @@ void Parser::doThat() { break; case kVerbCodeTalk: if (_person == kPeoplePardon) { - if (_vm->_avalot->_subjectNum == 99) { // They typed "say password". + if (_vm->_subjectNum == 99) { // They typed "say password". Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); - } else if (((1 <= _vm->_avalot->_subjectNum) && (_vm->_avalot->_subjectNum <= 49)) || (_vm->_avalot->_subjectNum == 253) || (_vm->_avalot->_subjectNum == 249)) { + } else if (((1 <= _vm->_subjectNum) && (_vm->_subjectNum <= 49)) || (_vm->_subjectNum == 253) || (_vm->_subjectNum == 249)) { _thats.deleteChar(0); for (int i = 0; i < 10; i++) _realWords[i] = _realWords[i + 1]; - _verb = (VerbCode)_vm->_avalot->_subjectNum; + _verb = (VerbCode)_vm->_subjectNum; doThat(); return; } else { - _person = (People)_vm->_avalot->_subjectNum; - _vm->_avalot->_subjectNum = 0; + _person = (People)_vm->_subjectNum; + _vm->_subjectNum = 0; if ((_person == kPeopleNone) || (_person == kPeoplePardon)) _vm->_dialogs->displayText("Talk to whom?"); else if (isPersonHere()) @@ -1701,7 +1701,7 @@ void Parser::doThat() { case kPeopleCrapulus: if (_thing == kObjectWine) { _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); - _vm->_avalot->_objects[kObjectWine - 1] = false; + _vm->_objects[kObjectWine - 1] = false; } else heyThanks(); break; @@ -1718,24 +1718,24 @@ void Parser::doThat() { case kPeopleIbythneth: if (_thing == kObjectBadge) { _vm->_dialogs->displayScrollChain('q', 32); // Thanks! Wow! - _vm->_avalot->incScore(3); - _vm->_avalot->_objects[kObjectBadge - 1] = false; - _vm->_avalot->_objects[kObjectHabit - 1] = true; - _vm->_avalot->_givenBadgeToIby = true; + _vm->incScore(3); + _vm->_objects[kObjectBadge - 1] = false; + _vm->_objects[kObjectHabit - 1] = true; + _vm->_givenBadgeToIby = true; _vm->_background->draw(-1, -1, 7); _vm->_background->draw(-1, -1, 8); } else heyThanks(); break; case kPeopleAyles: - if (_vm->_avalot->_aylesIsAwake) { + if (_vm->_aylesIsAwake) { if (_thing == kObjectPen) { - _vm->_avalot->_objects[kObjectPen - 1] = false; + _vm->_objects[kObjectPen - 1] = false; _vm->_dialogs->displayScrollChain('q', 54); - _vm->_avalot->_objects[kObjectInk - 1] = true; - _vm->_avalot->_givenPenToAyles = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->incScore(2); + _vm->_objects[kObjectInk - 1] = true; + _vm->_givenPenToAyles = true; + _vm->refreshObjectList(); + _vm->incScore(2); } else heyThanks(); } else @@ -1744,11 +1744,11 @@ void Parser::doThat() { case kPeopleGeida: switch (_thing) { case kObjectPotion: - _vm->_avalot->_objects[kObjectPotion - 1] = false; + _vm->_objects[kObjectPotion - 1] = false; _vm->_dialogs->displayScrollChain('u', 16); // She drinks it. - _vm->_avalot->incScore(2); - _vm->_avalot->_givenPotionToGeida = true; - _vm->_avalot->refreshObjectList(); + _vm->incScore(2); + _vm->_givenPotionToGeida = true; + _vm->refreshObjectList(); break; case kObjectLute: giveGeidaTheLute(); @@ -1760,7 +1760,7 @@ void Parser::doThat() { case kPeopleArkata: switch (_thing) { case kObjectPotion: - if (_vm->_avalot->_givenPotionToGeida) + if (_vm->_givenPotionToGeida) winSequence(); else _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! @@ -1774,7 +1774,7 @@ void Parser::doThat() { } } } - _vm->_avalot->refreshObjectList(); // Just in case... + _vm->refreshObjectList(); // Just in case... } break; @@ -1805,7 +1805,7 @@ void Parser::doThat() { else { Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Dialogs::kControlRegister, Dialogs::kControlIcon); if (_vm->_dialogs->displayQuestion(tmpStr)) - _vm->_avalot->_letMeOut = true; + _vm->_letMeOut = true; } break; case kVerbCodeGo: @@ -1820,8 +1820,8 @@ void Parser::doThat() { toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine + "The medi\x91val descendant of" + Dialogs::kControlNewLine + "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine - + "version " + _vm->_avalot->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " - + _vm->_avalot->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; + + "version " + _vm->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " + + _vm->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; _vm->_dialogs->displayText(toDisplay); _vm->_dialogs->_aboutBox = false; } @@ -1829,11 +1829,11 @@ void Parser::doThat() { case kVerbCodeUndress: if (_wearing == kNothing) _vm->_dialogs->displayText("You're already stark naked!"); - else if (_vm->_avalot->_avvysInTheCupboard) { - Common::String tmpStr = Common::String::format("You take off %s.", _vm->_avalot->getItem(_wearing).c_str()); + else if (_vm->_avvysInTheCupboard) { + Common::String tmpStr = Common::String::format("You take off %s.", _vm->getItem(_wearing).c_str()); _vm->_dialogs->displayText(tmpStr); _wearing = kNothing; - _vm->_avalot->refreshObjectList(); + _vm->refreshObjectList(); } else _vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?"); break; @@ -1855,7 +1855,7 @@ void Parser::doThat() { } else _wearing = _thing; - _vm->_avalot->refreshObjectList(); + _vm->refreshObjectList(); byte i; if (_thing == kObjectHabit) @@ -1880,19 +1880,19 @@ void Parser::doThat() { break; case kVerbCodePlay: if (_thing == kPardon) { - switch (_vm->_avalot->_room) { // They just typed "play"... + switch (_vm->_room) { // They just typed "play"... case kRoomArgentPub: // ...in the pub, => play Nim. warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()"); // play_nim(); // The following parts are copied from play_nim(). // The player automatically wins the game everytime he wins, until I implement the mini-game. - if (_vm->_avalot->_wonNim) { // Already won the game. + if (_vm->_wonNim) { // Already won the game. _vm->_dialogs->displayScrollChain('Q', 6); return; } - if (!_vm->_avalot->_askedDogfoodAboutNim) { + if (!_vm->_askedDogfoodAboutNim) { _vm->_dialogs->displayScrollChain('q', 84); return; } @@ -1902,14 +1902,14 @@ void Parser::doThat() { // You won - strange! _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! - _vm->_avalot->_objects[kObjectLute - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_wonNim = true; + _vm->_objects[kObjectLute - 1] = true; + _vm->refreshObjectList(); + _vm->_wonNim = true; _vm->_background->draw(-1, -1, 0); // Show the settle with no lute on it. - _vm->_avalot->incScore(7); // 7 points for winning! + _vm->incScore(7); // 7 points for winning! if (_playedNim == 1) - _vm->_avalot->incScore(3); // 3 points for playing your 1st game. + _vm->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") @@ -1924,20 +1924,20 @@ void Parser::doThat() { case kObjectLute : _vm->_dialogs->displayScrollChain('U', 7); - if (_vm->_avalot->getRoom(kPeopleCwytalot) == _vm->_avalot->_room) + if (_vm->getRoom(kPeopleCwytalot) == _vm->_room) _vm->_dialogs->displayScrollChain('U', 10); - if (_vm->_avalot->getRoom(kPeopleDuLustie) == _vm->_avalot->_room) + if (_vm->getRoom(kPeopleDuLustie) == _vm->_room) _vm->_dialogs->displayScrollChain('U', 15); break; case 52: - if (_vm->_avalot->_room == kRoomMusicRoom) + if (_vm->_room == kRoomMusicRoom) playHarp(); else _vm->_dialogs->displayText(kWhat); break; case 55: - if (_vm->_avalot->_room == kRoomArgentPub) + if (_vm->_room == kRoomArgentPub) // play_nim(); warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()"); else @@ -1952,7 +1952,7 @@ void Parser::doThat() { if (isHolding()) { if (_thing == kObjectBell) { _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B'))) + if ((_vm->_bellsAreRinging) & (_vm->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph _vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)"); } else @@ -1974,7 +1974,7 @@ void Parser::doThat() { warning("STUB: Parser::doThat() - case kVerbCodeboss"); break; case kVerbCodePee: - if (_vm->_avalot->setFlag('P')) { + if (_vm->setFlag('P')) { _vm->_dialogs->displayText("Hmm, I don't think anyone will notice..."); _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); } else { @@ -1985,16 +1985,16 @@ void Parser::doThat() { case kVerbCodeCheat: { Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Dialogs::kControlItalic); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_cheat = true; + _vm->_cheat = true; } break; case kVerbCodeMagic: - if (_vm->_avalot->_avariciusTalk > 0) + if (_vm->_avariciusTalk > 0) _vm->_dialogs->displayScrollChain('q', 19); else { - if ((_vm->_avalot->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! + if ((_vm->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! _vm->_dialogs->displayScrollChain('q', 17); - if (_vm->_avalot->getRoom(kPeopleSpludwick) == kRoomSpludwicks) + if (_vm->getRoom(kPeopleSpludwick) == kRoomSpludwicks) _vm->_dialogs->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -2003,7 +2003,7 @@ void Parser::doThat() { spr->walkTo(4); spr->_callEachStepFl = true; spr->_eachStepProc = Animation::kProcBackAndForth; - _vm->_avalot->_avariciusTalk = 14; + _vm->_avariciusTalk = 14; _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); } } else @@ -2031,21 +2031,21 @@ void Parser::doThat() { _vm->_pingo->zonk(); Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->gameOver(); + _vm->gameOver(); } } _sworeNum++; break; case kVerbCodeListen: - if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B'))) + if ((_vm->_bellsAreRinging) & (_vm->setFlag('B'))) _vm->_dialogs->displayText("All other noise is drowned out by the ringing of the bells."); - else if (_vm->_avalot->_listen.empty()) + else if (_vm->_listen.empty()) _vm->_dialogs->displayText("You can't hear anything much at the moment, Avvy."); else - _vm->_dialogs->displayText(_vm->_avalot->_listen); + _vm->_dialogs->displayText(_vm->_listen); break; case kVerbCodeBuy: // What are they trying to buy? - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomArgentPub: if (_vm->_animation->inField(5)) { // We're in a pub, and near the bar. switch (_thing) { @@ -2053,40 +2053,40 @@ void Parser::doThat() { case 53: case 54: case 58: // Beer, whisky, cider or mead. - if (_vm->_avalot->_malagauche == 177) { // Already getting us one. + if (_vm->_malagauche == 177) { // Already getting us one. _vm->_dialogs->displayScrollChain('D', 15); return; } - if (_vm->_avalot->_teetotal) { + if (_vm->_teetotal) { _vm->_dialogs->displayScrollChain('D', 6); return; } if (_alcoholLevel == 0) - _vm->_avalot->incScore(3); + _vm->incScore(3); _vm->_background->draw(-1, -1, 11); _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); - _vm->_avalot->_drinking = _thing; + _vm->_drinking = _thing; _vm->_background->draw(-1, -1, 9); - _vm->_avalot->_malagauche = 177; + _vm->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); break; case 52: examine(); break; // We have a right one here - buy Pepsi??! case kObjectWine: - if (_vm->_avalot->_objects[kObjectWine - 1]) // We've already got the wine! + if (_vm->_objects[kObjectWine - 1]) // We've already got the wine! _vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent! else { - if (_vm->_avalot->_malagauche == 177) { // Already getting us one. + if (_vm->_malagauche == 177) { // Already getting us one. _vm->_dialogs->displayScrollChain('D', 15); return; } - if (_vm->_avalot->_carryNum >= kCarryLimit) { + if (_vm->_carryNum >= kCarryLimit) { _vm->_dialogs->displayText("Your hands are full."); return; } @@ -2095,9 +2095,9 @@ void Parser::doThat() { Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); if (_alcoholLevel == 0) - _vm->_avalot->incScore(3); + _vm->incScore(3); _vm->_background->draw(-1, -1, 9); - _vm->_avalot->_malagauche = 177; + _vm->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); } @@ -2110,23 +2110,23 @@ void Parser::doThat() { case kRoomOutsideDucks: if (_vm->_animation->inField(5)) { if (_thing == kObjectOnion) { - if (_vm->_avalot->_objects[kObjectOnion - 1]) + if (_vm->_objects[kObjectOnion - 1]) _vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! - else if (_vm->_avalot->_carryNum >= kCarryLimit) + else if (_vm->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); else { if (_boughtOnion) _vm->_dialogs->displayScrollChain('D', 11); else { _vm->_dialogs->displayScrollChain('D', 9); - _vm->_avalot->incScore(3); + _vm->incScore(3); } - _vm->_avalot->decreaseMoney(3); // It costs thruppence. - _vm->_avalot->_objects[kObjectOnion - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->decreaseMoney(3); // It costs thruppence. + _vm->_objects[kObjectOnion - 1] = true; + _vm->refreshObjectList(); _boughtOnion = true; - _vm->_avalot->_rottenOnion = false; // It's OK when it leaves the stall! - _vm->_avalot->_onionInVinegar = false; + _vm->_rottenOnion = false; // It's OK when it leaves the stall! + _vm->_onionInVinegar = false; } } else _vm->_dialogs->displayScrollChain('D', 0); @@ -2142,33 +2142,33 @@ void Parser::doThat() { } break; case kVerbCodeAttack: - if ((_vm->_avalot->_room == kRoomBrummieRoad) && + if ((_vm->_room == kRoomBrummieRoad) && ((_person == kPeopleCwytalot) || (_thing == kObjectCrossbow) || (_thing == kObjectBolt)) && - (_vm->_avalot->getRoom(kPeopleCwytalot) == _vm->_avalot->_room)) { - switch (_vm->_avalot->_objects[kObjectBolt - 1] + _vm->_avalot->_objects[kObjectCrossbow - 1] * 2) { + (_vm->getRoom(kPeopleCwytalot) == _vm->_room)) { + switch (_vm->_objects[kObjectBolt - 1] + _vm->_objects[kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_dialogs->displayScrollChain('Q', 10); _vm->_dialogs->displayText("(At the very least, don't use your bare hands!)"); break; case 1: - _vm->_dialogs->displayText("Attack _vm->_avalot->him with only a crossbow bolt? Are you planning on playing darts?!"); + _vm->_dialogs->displayText("Attack _vm->him with only a crossbow bolt? Are you planning on playing darts?!"); break; case 2: _vm->_dialogs->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: _vm->_dialogs->displayScrollChain('Q', 11); - _vm->_avalot->_cwytalotGone = true; - _vm->_avalot->_objects[kObjectBolt - 1] = false; - _vm->_avalot->_objects[kObjectCrossbow - 1] = false; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_magics[11]._operation = Avalot::kMagicNothing; - _vm->_avalot->incScore(7); + _vm->_cwytalotGone = true; + _vm->_objects[kObjectBolt - 1] = false; + _vm->_objects[kObjectCrossbow - 1] = false; + _vm->refreshObjectList(); + _vm->_magics[11]._operation = AvalancheEngine::kMagicNothing; + _vm->incScore(7); _vm->_animation->_sprites[1].walkTo(1); _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_animation->_sprites[1]._callEachStepFl = false; - _vm->_avalot->setRoom(kPeopleCwytalot, kRoomDummy); + _vm->setRoom(kPeopleCwytalot, kRoomDummy); break; default: _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! @@ -2177,14 +2177,14 @@ void Parser::doThat() { _vm->_dialogs->displayScrollChain('Q', 10); break; case kVerbCodePasswd: - if (_vm->_avalot->_room != kRoomBridge) + if (_vm->_room != kRoomBridge) _vm->_dialogs->displayScrollChain('Q', 12); else { bool ok = true; for (uint i = 0; i < _thats.size(); i++) { Common::String temp = _realWords[i]; temp.toUppercase(); - int pwdId = _vm->_avalot->_passwordNum + kFirstPassword; + int pwdId = _vm->_passwordNum + kFirstPassword; for (uint j = 0; j < _vocabulary[pwdId]._word.size(); j++) { if (_vocabulary[pwdId]._word[j] != temp[j]) ok = false; @@ -2192,13 +2192,13 @@ void Parser::doThat() { } if (ok) { - if (_vm->_avalot->_drawbridgeOpen != 0) + if (_vm->_drawbridgeOpen != 0) _vm->_dialogs->displayText("Contrary to your expectations, the drawbridge fails to close again."); else { - _vm->_avalot->incScore(4); + _vm->incScore(4); _vm->_dialogs->displayText("The drawbridge opens!"); _vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); - _vm->_avalot->_drawbridgeOpen = 1; + _vm->_drawbridgeOpen = 1; } } else _vm->_dialogs->displayScrollChain('Q', 12); @@ -2208,10 +2208,10 @@ void Parser::doThat() { //_vm->_enid->dir(_realWords[1]); TODO: Replace it with proper ScummVM-friendly function(s)! break; case kVerbCodeDie: - _vm->_avalot->gameOver(); + _vm->gameOver(); break; case kVerbCodeScore: { - Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_avalot->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); + Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); _vm->_dialogs->displayText(tmpStr); } break; @@ -2243,14 +2243,14 @@ void Parser::doThat() { break; case kVerbCodeClimb: - if (_vm->_avalot->_room == kRoomInsideCardiffCastle) + if (_vm->_room == kRoomInsideCardiffCastle) cardiffClimbing(); else // In the wrong room! _vm->_dialogs->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: _vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; break; case kVerbCodeHiscores: // show_highs(); @@ -2262,18 +2262,18 @@ void Parser::doThat() { case kPeoplePardon: case kPeopleAvalot: case 0: - if (!_vm->_avalot->_avvyIsAwake) { - _vm->_avalot->_avvyIsAwake = true; - _vm->_avalot->incScore(1); - _vm->_avalot->_avvyInBed = true; + if (!_vm->_avvyIsAwake) { + _vm->_avvyIsAwake = true; + _vm->incScore(1); + _vm->_avvyInBed = true; _vm->_background->draw(-1, -1, 2); // Picture of Avvy, awake in bed. - if (_vm->_avalot->_teetotal) + if (_vm->_teetotal) _vm->_dialogs->displayScrollChain('d', 13); } else _vm->_dialogs->displayText("You're already awake, Avvy!"); break; case kPeopleAyles: - if (!_vm->_avalot->_aylesIsAwake) + if (!_vm->_aylesIsAwake) _vm->_dialogs->displayText("You can't seem to wake him by yourself."); break; case kPeopleJacques: { @@ -2287,26 +2287,26 @@ void Parser::doThat() { } break; case kVerbCodeSit: - if (_vm->_avalot->_room == kRoomNottsPub) { - if (_vm->_avalot->_sittingInPub) + if (_vm->_room == kRoomNottsPub) { + if (_vm->_sittingInPub) _vm->_dialogs->displayText("You're already sitting!"); else { _vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down. _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); } } else { // Default doodah. - _vm->_avalot->dusk(); - _vm->_avalot->hangAroundForAWhile(); - _vm->_avalot->dawn(); + _vm->dusk(); + _vm->hangAroundForAWhile(); + _vm->dawn(); Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph); _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeRestart: if (_vm->_dialogs->displayQuestion("Restart game and lose changes?")) { - _vm->_avalot->dusk(); - _vm->_avalot->newGame(); - _vm->_avalot->dawn(); + _vm->dusk(); + _vm->newGame(); + _vm->dawn(); } break; case kVerbCodePardon: diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 368fa0dfd7..9a11e6f661 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -76,7 +76,7 @@ void Pingo::zonk() { void Pingo::winningPic() { Common::File f; - _vm->_avalot->dusk(); + _vm->dusk(); if (!f.open("finale.avd")) error("AVALANCHE: Lucerna: File not found: finale.avd"); @@ -95,11 +95,11 @@ void Pingo::winningPic() { warning("STUB: Pingo::winningPic()"); - _vm->_avalot->dawn(); + _vm->dawn(); #if 0 do { - _vm->_avalot->check(); + _vm->check(); } while (!(keypressed() || (mrelease > 0))); while (keypressed()) char r = readkey(); diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index bbbbf6229c..fecbc0c3c3 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -75,7 +75,7 @@ void Sequence::startTimer() { } void Sequence::startTimerImmobilized() { - _vm->_avalot->_userMovesAvvy = false; // They can't move. + _vm->_userMovesAvvy = false; // They can't move. _vm->_animation->stopWalking(); // And they're not moving now. startTimer(); // Apart from that, it's the same thing. } @@ -94,8 +94,8 @@ void Sequence::callSequencer() { return; // No more routines. break; case kNowFlip: // Flip room. - _vm->_avalot->_userMovesAvvy = true; - _vm->_avalot->flipRoom(_flipToWhere, _flipToPed); + _vm->_userMovesAvvy = true; + _vm->flipRoom(_flipToWhere, _flipToPed); // CHECKME: Always true? if (curSeq == kNowFlip) shoveLeft(); @@ -202,12 +202,12 @@ void Sequence::startLustiesSeq2(Room whither, byte ped) { void Sequence::startCardiffSeq2() { init(1); - if (_vm->_avalot->_arrowInTheDoor) + if (_vm->_arrowInTheDoor) add(3); else add(2); - if (_vm->_avalot->_takenPen) + if (_vm->_takenPen) _vm->_background->draw(-1, -1, 3); startTimer(); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index d1d25ba740..5576a4826e 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -54,7 +54,7 @@ Timer::Timer(AvalancheEngine *vm) { * @remarks Originally called 'set_up_timer' */ void Timer::addTimer(int32 duration, byte action, byte reason) { - if ((_vm->_avalot->_isLoaded == false) || (_timerLost == true)) { + if ((_vm->_isLoaded == false) || (_timerLost == true)) { byte i = 0; while ((i < 7) && (_times[i]._timeLeft != 0)) i++; @@ -67,7 +67,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) { _times[i]._action = action; _times[i]._reason = reason; } else { - _vm->_avalot->_isLoaded = false; + _vm->_isLoaded = false; return; } } @@ -155,7 +155,7 @@ void Timer::updateTimer() { crapulusSaysSpludOut(); break; case kProcDawnDelay: - _vm->_avalot->dawn(); + _vm->dawn(); break; case kProcBuyDrinks: buyDrinks(); @@ -214,8 +214,8 @@ void Timer::updateTimer() { } } } - _vm->_avalot->_roomTime++; // Cycles since you've been in this room. - _vm->_avalot->_totalTime++; // Total amount of time for this game. + _vm->_roomTime++; // Cycles since you've been in this room. + _vm->_totalTime++; // Total amount of time for this game. } void Timer::loseTimer(byte which) { @@ -228,29 +228,29 @@ void Timer::loseTimer(byte which) { } void Timer::openDrawbridge() { - _vm->_avalot->_drawbridgeOpen++; - _vm->_background->draw(-1, -1, _vm->_avalot->_drawbridgeOpen - 2); + _vm->_drawbridgeOpen++; + _vm->_background->draw(-1, -1, _vm->_drawbridgeOpen - 2); - if (_vm->_avalot->_drawbridgeOpen == 4) - _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge. + if (_vm->_drawbridgeOpen == 4) + _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; // You may enter the drawbridge. else addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); } void Timer::avariciusTalks() { - _vm->_dialogs->displayScrollChain('q', _vm->_avalot->_avariciusTalk); - _vm->_avalot->_avariciusTalk++; + _vm->_dialogs->displayScrollChain('q', _vm->_avariciusTalk); + _vm->_avariciusTalk++; - if (_vm->_avalot->_avariciusTalk < 17) + if (_vm->_avariciusTalk < 17) addTimer(177, kProcAvariciusTalks, kReasonAvariciusTalks); else - _vm->_avalot->incScore(3); + _vm->incScore(3); } void Timer::urinate() { _vm->_animation->_sprites[0].turn(kDirUp); _vm->_animation->stopWalking(); - _vm->_avalot->drawDirection(); + _vm->drawDirection(); addTimer(14, kProcToilet, kReasonGoToToilet); } @@ -272,20 +272,20 @@ void Timer::stairs() { _vm->_sound->blip(); _vm->_animation->_sprites[0].walkTo(3); _vm->_background->draw(-1, -1, 1); - _vm->_avalot->_brummieStairs = 2; - _vm->_avalot->_magics[10]._operation = Avalot::kMagicSpecial; - _vm->_avalot->_magics[10]._data = 2; // Reached the bottom of the stairs. - _vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // Stop them hitting the sides (or the game will hang.) + _vm->_brummieStairs = 2; + _vm->_magics[10]._operation = AvalancheEngine::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.) } void Timer::cardiffSurvey() { - if (_vm->_avalot->_cardiffQuestionNum == 0) { - _vm->_avalot->_cardiffQuestionNum++; + if (_vm->_cardiffQuestionNum == 0) { + _vm->_cardiffQuestionNum++; _vm->_dialogs->displayScrollChain('q', 27); } - _vm->_dialogs->displayScrollChain('z', _vm->_avalot->_cardiffQuestionNum); - _vm->_avalot->_interrogation = _vm->_avalot->_cardiffQuestionNum; + _vm->_dialogs->displayScrollChain('z', _vm->_cardiffQuestionNum); + _vm->_interrogation = _vm->_cardiffQuestionNum; addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } @@ -300,8 +300,8 @@ void Timer::cwytalotInHerts() { void Timer::getTiedUp() { _vm->_dialogs->displayScrollChain('q', 34); // ...Trouble! - _vm->_avalot->_userMovesAvvy = false; - _vm->_avalot->_beenTiedUp = true; + _vm->_userMovesAvvy = false; + _vm->_beenTiedUp = true; _vm->_animation->stopWalking(); AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -315,8 +315,8 @@ void Timer::getTiedUp() { void Timer::getTiedUp2() { _vm->_animation->_sprites[0].walkTo(3); _vm->_animation->_sprites[1].walkTo(4); - _vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // No effect when you touch the boundaries. - _vm->_avalot->_friarWillTieYouUp = true; + _vm->_magics[3]._operation = AvalancheEngine::kMagicNothing; // No effect when you touch the boundaries. + _vm->_friarWillTieYouUp = true; } void Timer::hangAround() { @@ -324,7 +324,7 @@ void Timer::hangAround() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); // Robin Hood - _vm->_avalot->setRoom(kPeopleRobinHood, kRoomRobins); + _vm->setRoom(kPeopleRobinHood, kRoomRobins); _vm->_animation->appearPed(0, 1); _vm->_dialogs->displayScrollChain('q', 39); avvy->walkTo(6); @@ -336,7 +336,7 @@ void Timer::hangAround2() { AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(3); - _vm->_avalot->setRoom(kPeopleFriarTuck, kRoomRobins); + _vm->setRoom(kPeopleFriarTuck, kRoomRobins); _vm->_dialogs->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -344,20 +344,20 @@ void Timer::hangAround2() { addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). - _vm->_avalot->_tiedUp = false; + _vm->_tiedUp = false; // _vm->_enid->backToBootstrap(1); Call the shoot-'em-up. TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! } void Timer::afterTheShootemup() { // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! - _vm->_avalot->flipRoom(_vm->_avalot->_room, 1); + _vm->flipRoom(_vm->_room, 1); _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->appearPed(0, 1); - _vm->_avalot->_userMovesAvvy = true; - _vm->_avalot->_objects[kObjectCrossbow - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->_userMovesAvvy = true; + _vm->_objects[kObjectCrossbow - 1] = true; + _vm->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") @@ -385,9 +385,9 @@ void Timer::afterTheShootemup() { } void Timer::jacquesWakesUp() { - _vm->_avalot->_jacquesState++; + _vm->_jacquesState++; - switch (_vm->_avalot->_jacquesState) { // Additional pictures. + switch (_vm->_jacquesState) { // Additional pictures. case 1 : _vm->_background->draw(-1, -1, 0); // Eyes open. _vm->_dialogs->displayScrollChain('Q', 45); @@ -395,22 +395,22 @@ 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->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // You can't wake him up now. + _vm->_magics[5]._operation = AvalancheEngine::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. _vm->_background->draw(-1, -1, 3); // He's gone... so the door's open. - _vm->_avalot->setRoom(kPeopleJacques, kRoomNowhere); // Gone! + _vm->setRoom(kPeopleJacques, kRoomNowhere); // Gone! break; } - if (_vm->_avalot->_jacquesState == 5) { - _vm->_avalot->_bellsAreRinging = true; - _vm->_avalot->_aylesIsAwake = true; - _vm->_avalot->incScore(2); + if (_vm->_jacquesState == 5) { + _vm->_bellsAreRinging = true; + _vm->_aylesIsAwake = true; + _vm->incScore(2); } - switch (_vm->_avalot->_jacquesState) { + switch (_vm->_jacquesState) { case 1: case 2: case 3: @@ -452,8 +452,8 @@ void Timer::naughtyDuke3() { void Timer::jump() { AnimationType *avvy = &_vm->_animation->_sprites[0]; - _vm->_avalot->_jumpStatus++; - switch (_vm->_avalot->_jumpStatus) { + _vm->_jumpStatus++; + switch (_vm->_jumpStatus) { case 1: case 2: case 3: @@ -472,73 +472,73 @@ void Timer::jump() { break; } - if (_vm->_avalot->_jumpStatus == 20) { // End of jump. - _vm->_avalot->_userMovesAvvy = true; - _vm->_avalot->_jumpStatus = 0; + if (_vm->_jumpStatus == 20) { // End of jump. + _vm->_userMovesAvvy = true; + _vm->_jumpStatus = 0; } else // Still jumping. addTimer(1, kProcJump, kReasonJumping); - if ((_vm->_avalot->_jumpStatus == 10) // You're at the highest point of your jump. - && (_vm->_avalot->_room == kRoomInsideCardiffCastle) - && (_vm->_avalot->_arrowInTheDoor == true) + if ((_vm->_jumpStatus == 10) // You're at the highest point of your jump. + && (_vm->_room == kRoomInsideCardiffCastle) + && (_vm->_arrowInTheDoor == true) && (_vm->_animation->inField(2))) { // Beside the wall // Grab the arrow! - if (_vm->_avalot->_carryNum >= kCarryLimit) + if (_vm->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("You fail to grab it, because your hands are full."); else { _vm->_background->draw(-1, -1, 1); - _vm->_avalot->_arrowInTheDoor = false; // You've got it. - _vm->_avalot->_objects[kObjectBolt - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->_arrowInTheDoor = false; // You've got it. + _vm->_objects[kObjectBolt - 1] = true; + _vm->refreshObjectList(); _vm->_dialogs->displayScrollChain('q', 50); - _vm->_avalot->incScore(3); + _vm->incScore(3); } } } void Timer::crapulusSaysSpludOut() { _vm->_dialogs->displayScrollChain('q', 56); - _vm->_avalot->_crapulusWillTell = false; + _vm->_crapulusWillTell = false; } void Timer::buyDrinks() { _vm->_background->draw(-1, -1, 10); // Malagauche gets up again. - _vm->_avalot->_malagauche = 0; + _vm->_malagauche = 0; - _vm->_dialogs->displayScrollChain('D', _vm->_avalot->_drinking); // Display message about it. + _vm->_dialogs->displayScrollChain('D', _vm->_drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. _vm->_dialogs->displayScrollChain('D', 1); // That'll be thruppence. - if (_vm->_avalot->decreaseMoney(3)) // Pay 3d. + if (_vm->decreaseMoney(3)) // Pay 3d. _vm->_dialogs->displayScrollChain('D', 3); // Tell 'em you paid up. _vm->_parser->drink(); } void Timer::buyWine() { _vm->_background->draw(-1, -1, 10); // Malagauche gets up again. - _vm->_avalot->_malagauche = 0; + _vm->_malagauche = 0; _vm->_dialogs->displayScrollChain('D', 50); // You buy the wine. _vm->_dialogs->displayScrollChain('D', 1); // It'll be thruppence. - if (_vm->_avalot->decreaseMoney(3)) { + if (_vm->decreaseMoney(3)) { _vm->_dialogs->displayScrollChain('D', 4); // You paid up. - _vm->_avalot->_objects[kObjectWine - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_wineState = 1; // OK Wine. + _vm->_objects[kObjectWine - 1] = true; + _vm->refreshObjectList(); + _vm->_wineState = 1; // OK Wine. } } void Timer::callsGuards() { _vm->_dialogs->displayScrollChain('Q', 58); // "GUARDS!!!" - _vm->_avalot->gameOver(); + _vm->gameOver(); } void Timer::greetsMonk() { _vm->_dialogs->displayScrollChain('Q', 59); - _vm->_avalot->_enteredLustiesRoomAsMonk = true; + _vm->_enteredLustiesRoomAsMonk = true; } void Timer::fallDownOubliette() { - _vm->_avalot->_magics[8]._operation = Avalot::kMagicNothing; + _vm->_magics[8]._operation = AvalancheEngine::kMagicNothing; AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->_moveY++; // Increments dx/dy! @@ -547,13 +547,13 @@ void Timer::fallDownOubliette() { } void Timer::meetAvaroid() { - if (_vm->_avalot->_metAvaroid) { + if (_vm->_metAvaroid) { Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->gameOver(); + _vm->gameOver(); } else { _vm->_dialogs->displayScrollChain('Q', 60); - _vm->_avalot->_metAvaroid = true; + _vm->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); AnimationType *avvy = &_vm->_animation->_sprites[0]; @@ -562,7 +562,7 @@ void Timer::meetAvaroid() { avvy->_moveX = -3; avvy->_moveY = -5; - _vm->_avalot->setBackgroundColor(2); + _vm->setBackgroundColor(2); } } @@ -574,7 +574,7 @@ void Timer::riseUpOubliette() { if (avvy->_moveY > 0) addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette); else - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; } void Timer::robinHoodAndGeida() { @@ -587,7 +587,7 @@ void Timer::robinHoodAndGeida() { spr->stopWalk(); spr->_facingDir = kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); - _vm->_avalot->_geidaFollows = false; + _vm->_geidaFollows = false; } void Timer::robinHoodAndGeidaTalk() { @@ -611,7 +611,7 @@ void Timer::avalotReturns() { avvy->init(0, true, _vm->_animation); _vm->_animation->appearPed(0, 0); _vm->_dialogs->displayScrollChain('q', 67); - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; } /** @@ -625,8 +625,8 @@ void Timer::avvySitDown() { addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { _vm->_background->draw(-1, -1, 2); - _vm->_avalot->_sittingInPub = true; - _vm->_avalot->_userMovesAvvy = false; + _vm->_sittingInPub = true; + _vm->_userMovesAvvy = false; avvy->_visible = false; } } @@ -638,7 +638,7 @@ void Timer::ghostRoomPhew() { } void Timer::arkataShouts() { - if (_vm->_avalot->_teetotal) + if (_vm->_teetotal) return; _vm->_dialogs->displayScrollChain('q', 76); @@ -652,14 +652,14 @@ void Timer::winning() { warning("STUB: Timer::winning()"); #if 0 do { - _vm->_avalot->checkclick(); - } while (!(_vm->_avalot->mrelease == 0)); + _vm->checkclick(); + } while (!(_vm->mrelease == 0)); #endif // TODO: To be implemented with Pingo::winningPic(). - _vm->_avalot->callVerb(kVerbCodeScore); + _vm->callVerb(kVerbCodeScore); _vm->_dialogs->displayText(" T H E E N D "); - _vm->_avalot->_letMeOut = true; + _vm->_letMeOut = true; } void Timer::avalotFalls() { @@ -691,8 +691,8 @@ void Timer::spludwickLeavesCauldron() { void Timer::giveLuteToGeida() { // Moved here from Acci. _vm->_dialogs->displayScrollChain('Q', 86); - _vm->_avalot->incScore(4); - _vm->_avalot->_lustieIsAsleep = true; + _vm->incScore(4); + _vm->_lustieIsAsleep = true; _vm->_sequence->startGeidaLuteSeq(); } -- cgit v1.2.3