From 377cbbe77d5c7f16aba086e4fb1707de843ddc1a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 27 Mar 2014 21:04:27 -0400 Subject: MADS: Cleanup of game and player fields used during initialization --- engines/mads/dialogs.cpp | 4 + engines/mads/dialogs.h | 5 +- engines/mads/events.cpp | 2 +- engines/mads/events.h | 4 +- engines/mads/game.cpp | 35 +++---- engines/mads/game.h | 14 ++- engines/mads/inventory.cpp | 6 +- engines/mads/nebular/nebular_scenes1.cpp | 46 ++++----- engines/mads/nebular/nebular_scenes2.cpp | 158 +++++++++++++++---------------- engines/mads/nebular/nebular_scenes8.cpp | 4 +- engines/mads/player.cpp | 6 +- engines/mads/player.h | 2 + engines/mads/user_interface.cpp | 2 +- 13 files changed, 150 insertions(+), 138 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index d5d7d64380..c5e99f859e 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -341,4 +341,8 @@ Dialogs::Dialogs(MADSEngine *vm): _vm(vm) { _pendingDialog = DIALOG_NONE; } +void Dialogs::show(int msgId) { + +} + } // End of namespace MADS diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 56bc8ced53..3f623a688b 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -68,10 +68,6 @@ public: * Destructor */ virtual ~Dialog(); - - static void show(int msgId) { - warning("TODO: Dialog::show"); - } }; enum { @@ -194,6 +190,7 @@ public: virtual void showDialog() = 0; virtual void showPicture(int objId, int msgId, int arg3 = 0) = 0; + void show(int msgId); }; } // End of namespace MADS diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 4b143ec0e2..37a1eec969 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -76,7 +76,7 @@ void EventsManager::hideCursor() { CursorMan.showMouse(false); } -void EventsManager::resetCursor() { +void EventsManager::waitCursor() { CursorType cursorId = (CursorType)MIN(_cursorSprites->getCount(), (int)CURSOR_WAIT); _newCursorId = cursorId; if (_cursorId != _newCursorId) { diff --git a/engines/mads/events.h b/engines/mads/events.h index 219af20c2a..b0b20b4853 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -101,9 +101,9 @@ public: void hideCursor(); /** - * Resets the cursor, if necessary + * Shows the wait cursor */ - void resetCursor(); + void waitCursor(); /** * Free currently loaded cursors diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 50a4f6358d..b89f83384b 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -49,9 +49,10 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _sectionNumber = 1; _priorSectionNumber = 0; _currentSectionNumber = -1; - _v1 = _v2 = 0; - _v3 = _v4 = 0; - _v5 = _v6 = 0; + _kernelMode = KERNEL_GAME_LOAD; + _v2 = 0; + _quoteEmergency = false; + _vocabEmergency = false; _aaName = "*I0.AA"; _playerSpritesFlag = false; _priorFrameTimer = 0; @@ -142,7 +143,7 @@ void Game::gameLoop() { } // TODO: Extra reset methods - _vm->_events->resetCursor(); + _vm->_events->waitCursor(); _vm->_events->freeCursors(); _vm->_sound->closeDriver(); } @@ -152,29 +153,31 @@ void Game::gameLoop() { void Game::sectionLoop() { while (!_vm->shouldQuit() && _statusFlag && _sectionNumber == _currentSectionNumber) { - _v1 = 3; + _kernelMode = KERNEL_ROOM_PRELOAD; _player._spritesChanged = true; - _v5 = 0; - _v6 = 0; - _vm->_events->resetCursor(); + _quoteEmergency = false; + _vocabEmergency = false; + _vm->_events->waitCursor(); _scene.clearVocab(); _scene._dynamicHotspots.clear(); _scene.loadSceneLogic(); - _v4 = 0; + _player._walkAnywhere = false; _player._stepEnabled = true; _player._visible = true; _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); _visitedScenes.add(_scene._nextSceneId); + // Reset the user interface _screenObjects._v8333C = true; _screenObjects._v832EC = 0; _scene._userInterface._scrollerY = 0; - _v3 = -1; + + _player._loadsFirst = true; _scene._sceneLogic->setup(); - if (_player._spritesChanged || _v3) { + if (_player._spritesChanged || _player._loadsFirst) { if (_player._spritesLoaded) _scene._spriteSlots.releasePlayerSprites(); _vm->_palette->resetGamePalette(18, 10); @@ -185,7 +188,7 @@ void Game::sectionLoop() { _vm->_palette->_paletteUsage.load(3, 0xF0, 0xF1, 0xF2); - if (!_player._spritesLoaded && _v3) { + if (!_player._spritesLoaded && _player._loadsFirst) { if (_player.loadSprites("")) _vm->quitGame(); _playerSpritesFlag = true; @@ -247,10 +250,10 @@ void Game::sectionLoop() { _scene._userInterface.noInventoryAnim(); } - _v1 = 5; + _kernelMode = KERNEL_ACTIVE_CODE; _scene._roomChanged = false; - if ((_v5 || _v6) && !_updateSceneFlag) { + if ((_quoteEmergency || _vocabEmergency) && !_updateSceneFlag) { _scene._currentSceneId = _scene._priorSceneId; _updateSceneFlag = true; } else { @@ -258,8 +261,8 @@ void Game::sectionLoop() { _scene.loop(); } - _vm->_events->resetCursor(); - _v1 = 3; + _vm->_events->waitCursor(); + _kernelMode = KERNEL_ROOM_PRELOAD; delete _scene._animationData; _scene._animationData = nullptr; diff --git a/engines/mads/game.h b/engines/mads/game.h index 0d7178a567..11fd95491e 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -43,9 +43,15 @@ enum Difficulty { DIFFICULTY_HARD = 1, DIFFICULTY_REALLY_HARD = 2, DIFFICULTY_IMPOSSIBLE = 3 }; +enum KernelMode { + KERNEL_GAME_LOAD = 0, KERNEL_SECTION_PRELOAD = 1, KERNEL_SECTION_INIT = 2, + KERNEL_ROOM_PRELOAD = 3, KERNEL_ROOM_INIT = 4, KERNEL_ACTIVE_CODE = 5 +}; + enum ProtectionResult { PROTECTION_SUCCEED = 0, PROTECTION_FAIL = 1, PROTECTION_ESCAPE = 2 }; +; class Game { private: @@ -69,8 +75,8 @@ protected: int _saveSlot; int _statusFlag; Common::StringArray _quotes; - int _v5; - int _v6; + bool _quoteEmergency; + bool _vocabEmergency; bool _updateSceneFlag; bool _playerSpritesFlag; @@ -125,10 +131,8 @@ public: SectionHandler *_sectionHandler; VisitedScenes _visitedScenes; Scene _scene; - int _v1; + KernelMode _kernelMode; int _v2; - int _v3; - int _v4; int _abortTimers; int _abortTimers2; AbortTimerMode _abortTimersMode; diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 3237d55b77..a8e50e6ae1 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -116,7 +116,7 @@ void InventoryObjects::addToInventory(int objectId) { (*this)[objectId]._roomNumber = PLAYER_INVENTORY; - if (_vm->_game->_v1 == 5 && !_vm->_game->_screenObjects._v832EC) { + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) { userInterface.categoryChanged(); userInterface.selectObject(userInterface._selectedInvIndex); } @@ -137,7 +137,7 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { int selectedIndex = userInterface._selectedInvIndex; bool noSelection = selectedIndex < 0; - if (_vm->_game->_v1 == 5 && !_vm->_game->_screenObjects._v832EC) + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) userInterface.selectObject(-1); // Remove the item from the inventory list @@ -158,7 +158,7 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { newIndex = 0; } - if (_vm->_game->_v1 == 5 && !_vm->_game->_screenObjects._v832EC) { + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) { userInterface.categoryChanged(); userInterface.selectObject(newIndex); } diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 4c3b67f3c5..554c73ddc6 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -89,7 +89,7 @@ void Scene1xx::setPlayerSpritesPrefix() { _game._player._spritesChanged = true; if (_scene->_nextSceneId == 105 || (_scene->_nextSceneId == 109 && _globals[kHoovicAlive])) { _game._player._spritesChanged = true; - _game._v3 = 0; + _game._player._loadsFirst = false; } _game._player._unk3 = 0; @@ -258,7 +258,7 @@ void Scene103::preActions() { void Scene103::actions() { if (_action._savedFields._lookFlag) { - Dialog::show(10322); + _vm->_dialogs->show(10322); } else if (_action.isAction(395, 110, 0)) { switch (_vm->_game->_abortTimers) { case 0: @@ -342,7 +342,7 @@ void Scene103::actions() { break; } } else if (_action.isAction(VERB_LOOK, 362, 0)) { - Dialog::show(10301); + _vm->_dialogs->show(10301); } else if (_action.isAction(VERB_TAKE, 362, 0)) { if (!_vm->_game->_abortTimers) _vm->_sound->command(31); @@ -364,12 +364,12 @@ void Scene103::actions() { _game._player._stepEnabled = _game._abortTimers == 2; _globals[kTurkeyExploded] = -1; if (_game._abortTimers == 2) { - Dialog::show(1030); + _vm->_dialogs->show(1030); _scene->_hotspots.activate(362, false); } } } else if (_action.isAction(VERB_LOOK, 250, 0)) { - Dialog::show(!_globals[kTurkeyExploded] ? 10323 : 10303); + _vm->_dialogs->show(!_globals[kTurkeyExploded] ? 10323 : 10303); } else if (_action.isAction(VERB_TALKTO, 27, 0)) { switch (_vm->_game->_abortTimers) { @@ -394,46 +394,46 @@ void Scene103::actions() { case 3: _game._player._stepEnabled = true; - Dialog::show(10306); + _vm->_dialogs->show(10306); break; default: break; } } else if (!_action.isAction(VERB_LOOK, 27, 0)) { - Dialog::show(10304); + _vm->_dialogs->show(10304); } else if (!_action.isAction(VERB_LOOK, 36, 0)) { - Dialog::show(10307); + _vm->_dialogs->show(10307); } else if (!_action.isAction(VERB_LOOK, 55, 0)) { - Dialog::show(10308); + _vm->_dialogs->show(10308); } else if (!_action.isAction(VERB_TAKE, 315, 0)) { - Dialog::show(10309); + _vm->_dialogs->show(10309); } else if (!_action.isAction(VERB_TAKE, 85, 0)) { - Dialog::show(10310); + _vm->_dialogs->show(10310); } else if (!_action.isAction(VERB_LOOK, 144, 0)) { - Dialog::show(10312); + _vm->_dialogs->show(10312); } else if (!_action.isAction(VERB_OPEN, 144, 0)) { - Dialog::show(10313); + _vm->_dialogs->show(10313); } else if (!_action.isAction(VERB_CLOSE, 27, 0)) { - Dialog::show(10314); + _vm->_dialogs->show(10314); } else if (!_action.isAction(VERB_LOOK, 310, 0)) { - Dialog::show(10315); + _vm->_dialogs->show(10315); } else if (!_action.isAction(VERB_LOOK, 178, 0)) { - Dialog::show(10316); + _vm->_dialogs->show(10316); } else if (!_action.isAction(VERB_LOOK, 283, 0)) { - Dialog::show(10317); + _vm->_dialogs->show(10317); } else if (!_action.isAction(VERB_LOOK, 120, 0)) { - Dialog::show(10318); + _vm->_dialogs->show(10318); } else if (_action.isAction(VERB_LOOK, 289, 0) && _game._objects.isInInventory(OBJ_REBREATHER)) { - Dialog::show(10319); + _vm->_dialogs->show(10319); } else if (_action.isAction(VERB_LOOK, 371, 0) && _game._objects.isInInventory(OBJ_TIMER_MODULE)) { - Dialog::show(10320); + _vm->_dialogs->show(10320); } else if (!_action.isAction(VERB_LOOK, 137, 0)) { - Dialog::show(10321); + _vm->_dialogs->show(10321); } else if (_action.isAction(VERB_LOOK, 409, 0)) { - Dialog::show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); + _vm->_dialogs->show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); } _action._inProgress = false; @@ -441,7 +441,7 @@ void Scene103::actions() { void Scene103::postActions() { if (_action.isAction(27) && !_action.isAction(13)) { - Dialog::show(0x2841); + _vm->_dialogs->show(0x2841); _action._inProgress = false; } else { if (_action.isAction(7, 85, 144)) { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 4a1dd097ee..83dcfa3865 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -62,7 +62,7 @@ void Scene2xx::setPlayerSpritesPrefix() { _game._player._spritesChanged = true; if ((_scene->_nextSceneId == 203 || _scene->_nextSceneId == 204) && _globals[kRhotundaStatus]) - _game._v3 = 0; + _game._player._loadsFirst = false; _vm->_palette->setEntry(16, 10, 63, 63); _vm->_palette->setEntry(17, 10, 45, 45); @@ -277,7 +277,7 @@ void Scene201::step() { if (_game._abortTimers == 78) { _vm->_sound->command(40); - Dialog::show(0x4E92); + _vm->_dialogs->show(0x4E92); _scene->_reloadSceneFlag = true; } } @@ -297,34 +297,34 @@ void Scene201::actions() { _scene->_nextSceneId = 213; } } else if (action->isAction(0x3, 0x1A6, 0)) { - Dialog::show(0x4E85); + _vm->_dialogs->show(0x4E85); } else if (action->isAction(0x3, 0x129, 0)) { - Dialog::show(0x4E86); + _vm->_dialogs->show(0x4E86); } else if (action->isAction(0x3, 0x16F, 0)) { - Dialog::show(0x4E87); + _vm->_dialogs->show(0x4E87); } else if (action->isAction(0x3, 0x142, 0)) { - Dialog::show(0x4E88); + _vm->_dialogs->show(0x4E88); } else if (action->isAction(0x3, 0x18F, 0)) { - Dialog::show(0x4E89); + _vm->_dialogs->show(0x4E89); } else if (action->isAction(0x3, 0x1B9, 0)) { - Dialog::show(0x4E8A); + _vm->_dialogs->show(0x4E8A); } else if (action->isAction(0x3, 0x192, 0)) { - Dialog::show(0x4E8B); + _vm->_dialogs->show(0x4E8B); } else if (action->isAction(0x3, 0x1BA, 0)) { - Dialog::show(0x4E8C); + _vm->_dialogs->show(0x4E8C); } else if (action->isAction(0x3, 0x83, 0)) { - Dialog::show(0x4E8E); + _vm->_dialogs->show(0x4E8E); } else if (action->isAction(0x3, 0x1B6, 0)) { if (_globals[kMeteorologistEverSeen]) - Dialog::show(0x4E90); + _vm->_dialogs->show(0x4E90); else - Dialog::show(0x4E8D); + _vm->_dialogs->show(0x4E8D); } else if (action->isAction(0x3, 0x16C, 0)) { - Dialog::show(0x4E91); + _vm->_dialogs->show(0x4E91); } else return; } else { - Dialog::show(0x4E8F); + _vm->_dialogs->show(0x4E8F); } action->_inProgress = false; } @@ -580,7 +580,7 @@ void Scene202::step() { if ((_globals[kMeteorologistWatch] == 2) || _globals[kLadderBroken]) { _scene->_nextSceneId = 213; } else { - Dialog::show(0x4EE9); + _vm->_dialogs->show(0x4EE9); _scene->_reloadSceneFlag = true; } } @@ -767,7 +767,7 @@ void Scene202::actions() { if (action->_actionMode2 == 4) { if (_game._abortTimers == 0) { if (_game._objects.isInInventory(OBJ_BONES)) { - Dialog::show(0x4EFB); + _vm->_dialogs->show(0x4EFB); } else { _game._player._stepEnabled = false; _game._player._visible = false; @@ -850,7 +850,7 @@ void Scene202::actions() { } } else if (_game._abortTimers == 2) { if (!_scene->_activeAnimation && (_globals._abortVal == 0)) { - Dialog::show(0x4EFE); + _vm->_dialogs->show(0x4EFE); } _scene->_sequences.remove(_globals._spriteIndexes[25]); _globals._spriteIndexes[25] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); @@ -899,7 +899,7 @@ void Scene202::actions() { } } else if (_game._abortTimers == 2) { if (!_scene->_activeAnimation) - Dialog::show(0x4EFE); + _vm->_dialogs->show(0x4EFE); _globals._abortVal = 0; _scene->_sequences.remove(_globals._spriteIndexes[25]); _globals._spriteIndexes[24] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); @@ -919,53 +919,53 @@ void Scene202::actions() { } else if (action->isAction(0x188, 0xAA, 0)) { setRandomKernelMessage(); } else if (action->isAction(0x3, 0x129, 0)) { - Dialog::show(0x4EEA); + _vm->_dialogs->show(0x4EEA); } else if (action->isAction(0x3, 0x86, 0)) { - Dialog::show(0x4EEB); + _vm->_dialogs->show(0x4EEB); } else if (action->isAction(0x3, 0x19C, 0)) { - Dialog::show(0x4EEC); + _vm->_dialogs->show(0x4EEC); } else if (action->isAction(0x3, 0x82, 0)) { if ((_globals[kMeteorologistStatus] == 0) || (_globals[kMeteorologistStatus] == 2)) { - Dialog::show(0x4EED); + _vm->_dialogs->show(0x4EED); } else if (_globals[kMeteorologistStatus] == 1) { - Dialog::show(0x4EFC); + _vm->_dialogs->show(0x4EFC); } else { action->_inProgress = false; return; } } else if (action->isAction(0x3, 0x18E, 0)) { - Dialog::show(0x4EEE); + _vm->_dialogs->show(0x4EEE); } else if (action->isAction(0x3, 0x164, 0)) { - Dialog::show(0x4EEF); + _vm->_dialogs->show(0x4EEF); } else if (action->isAction(0x3, 0x175, 0)) { - Dialog::show(0x4EF0); + _vm->_dialogs->show(0x4EF0); } else if (action->isAction(0x3, 0x174, 0)) { - Dialog::show(0x4EF1); + _vm->_dialogs->show(0x4EF1); } else if (action->isAction(0x3, 0x142, 0)) { - Dialog::show(0x4EF2); + _vm->_dialogs->show(0x4EF2); } else if (action->isAction(0x3, 0xAA, 0)) { if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8)) - Dialog::show(0x4EF4); + _vm->_dialogs->show(0x4EF4); else - Dialog::show(0x4EF3); + _vm->_dialogs->show(0x4EF3); } else if (action->isAction(0x3, 0x186, 0)) { - Dialog::show(0x4EF5); + _vm->_dialogs->show(0x4EF5); } else if (action->isAction(0x3, 0x1B5, 0)) { - Dialog::show(0x4EF6); + _vm->_dialogs->show(0x4EF6); } else if (action->isAction(0x3, 0x140, 0)) { - Dialog::show(0x4EF7); + _vm->_dialogs->show(0x4EF7); } else if (action->isAction(0x4, 0x140, 0)) { - Dialog::show(0x4EF8); + _vm->_dialogs->show(0x4EF8); } else if (action->isAction(0x3, 0x2D, 0)) { if (action->_actionMode == 4) - Dialog::show(0x4EF9); + _vm->_dialogs->show(0x4EF9); else return; } else { return; } } else { - Dialog::show(0x4EFB); + _vm->_dialogs->show(0x4EFB); } action->_inProgress = false; } @@ -1059,23 +1059,23 @@ void Scene203::preActions() { void Scene203::actions() { if (_action._savedFields._lookFlag) { - Dialog::show(0x4F53); + _vm->_dialogs->show(0x4F53); } else if (_action.isAction(0x18C, 0x83, 0)) { _scene->_nextSceneId = 208; } else if (_action.isAction(0x18C, 0x82, 0)) { _scene->_nextSceneId = 202; } else if (_action.isAction(0x3, 0x142, 0)) { - Dialog::show(0x4F4D); + _vm->_dialogs->show(0x4F4D); } else if (_action.isAction(0x3, 0x4D, 0)) { - Dialog::show(0x4F4E); + _vm->_dialogs->show(0x4F4E); } else if (_action.isAction(0x3, 0x100, 0)) { - Dialog::show(0x4F4F); + _vm->_dialogs->show(0x4F4F); } else if (_action.isAction(0x3, 0x82, 0)) { - Dialog::show(0x4F50); + _vm->_dialogs->show(0x4F50); } else if (_action.isAction(0x3, 0x1A6, 0)) { - Dialog::show(0x4F51); + _vm->_dialogs->show(0x4F51); } else if (_action.isAction(0x3, 0x30, 0)) { - Dialog::show(0x4F51); + _vm->_dialogs->show(0x4F51); } else return; @@ -1299,7 +1299,7 @@ void Scene207::preActions() { void Scene207::actions() { if (_action._savedFields._lookFlag) { - Dialog::show(0x50E7); + _vm->_dialogs->show(0x50E7); } else { if (_action.isAction(0x18B, 0x70, 0)) _scene->_nextSceneId = 214; @@ -1320,33 +1320,33 @@ void Scene207::actions() { } if (_action.isAction(3, 0x69, 0)) { - Dialog::show(0x50DD); + _vm->_dialogs->show(0x50DD); } else if (_action.isAction(3, 0x1AF, 0)) { - Dialog::show(0x50DE); + _vm->_dialogs->show(0x50DE); } else if (_action.isAction(3, 0x141, 0)) { - Dialog::show(0x50DF); + _vm->_dialogs->show(0x50DF); } else if (_action.isAction(3, 0x3E, 0)) { - Dialog::show(0x50E0); + _vm->_dialogs->show(0x50E0); } else if (_action.isAction(3, 0x198, 0)) { - Dialog::show(0x50E1); + _vm->_dialogs->show(0x50E1); } else if (_action.isAction(3, 0x1AE, 0)) { - Dialog::show(0x50E2); + _vm->_dialogs->show(0x50E2); } else if (_action.isAction(3, 0xE8, 0)) { - Dialog::show(0x50E3); + _vm->_dialogs->show(0x50E3); } else if (_action.isAction(3, 0x12, 0)) { - Dialog::show(0x50E4); + _vm->_dialogs->show(0x50E4); } else if (_action.isAction(3, 0x1AC, 0)) { - Dialog::show(0x50E5); + _vm->_dialogs->show(0x50E5); } else if (_action.isAction(3, 0x185, 0)) { - Dialog::show(0x50E6); + _vm->_dialogs->show(0x50E6); } else if (_action.isAction(4, 0x141, 0)) { - Dialog::show(0x50E8); + _vm->_dialogs->show(0x50E8); } else if (_action.isAction(4, 0x12, 0)) { - Dialog::show(0x50E9); + _vm->_dialogs->show(0x50E9); } else if (_action.isAction(3, 0x14D, 0)) { - Dialog::show(0x50EA); + _vm->_dialogs->show(0x50EA); } else if (_action.isAction(4, 0x14D, 0)) { - Dialog::show(0x50EB); + _vm->_dialogs->show(0x50EB); } else return; } @@ -1484,52 +1484,52 @@ void Scene208::actions() { } else if (_action.isAction(0x7, 0x35, 0x1A9)) { warning("TODO: sub3B282(4);"); if (_game._player._stepEnabled) { - Dialog::show(0x514C); + _vm->_dialogs->show(0x514C); } } else if (_action.isAction(0x7, 0x65, 0x1A9)) { warning("TODO: sub3B282(5);"); if (_game._player._stepEnabled) { - Dialog::show(0x514C); + _vm->_dialogs->show(0x514C); } } else if (_action.isAction(0x3, 0x5D, 0)) { - Dialog::show(0x5141); + _vm->_dialogs->show(0x5141); } else if (_action.isAction(0x3, 0xF6, 0)) { - Dialog::show(0x5142); + _vm->_dialogs->show(0x5142); } else if (_action.isAction(0x3, 0x16F, 0)) { - Dialog::show(0x5143); + _vm->_dialogs->show(0x5143); } else if (_action.isAction(0x3, 0x129, 0)) { - Dialog::show(0x5144); + _vm->_dialogs->show(0x5144); } else if (_action.isAction(0x3, 0x1A1, 0)) { - Dialog::show(0x5145); + _vm->_dialogs->show(0x5145); } else if (_action.isAction(0x4, 0x1A1, 0)) { - Dialog::show(0x5146); + _vm->_dialogs->show(0x5146); } else if (_action.isAction(0x3, 0x9B, 0)) { - Dialog::show(0x5147); + _vm->_dialogs->show(0x5147); } else if (_action.isAction(0x3, 0x19E, 0)) { - Dialog::show(0x5148); + _vm->_dialogs->show(0x5148); } else if (_action.isAction(0x3, 0x1AA, 0)) { - Dialog::show(0x5149); + _vm->_dialogs->show(0x5149); } else if (_action.isAction(0x3, 0x1A9, 0)) { if (_game._difficulty == DIFFICULTY_IMPOSSIBLE) - Dialog::show(0x514A); + _vm->_dialogs->show(0x514A); else - Dialog::show(0x514B); + _vm->_dialogs->show(0x514B); } else if (_action.isAction(0x3, 0x174, 0) || _action.isAction(0x3, 0x175, 0)) { - Dialog::show(0x514D); + _vm->_dialogs->show(0x514D); } else if (_action.isAction(0x4, 0x1A9, 0)) { - Dialog::show(0x514E); + _vm->_dialogs->show(0x514E); } else if (_action.isAction(0x3, 0x1A8, 0)) { - Dialog::show(0x514F); + _vm->_dialogs->show(0x514F); } else if (_action.isAction(0x4, 0x1A8, 0) || _action.isAction(0xA, 0x1A8, 0)) { - Dialog::show(0x5150); + _vm->_dialogs->show(0x5150); } else if (_action._savedFields._lookFlag == 0) { return; } else if (_globals[kRhotundaStatus] == 1) { - Dialog::show(0x5153); + _vm->_dialogs->show(0x5153); } else if (_globals[kLeavesStatus] == 2) { - Dialog::show(0x5152); + _vm->_dialogs->show(0x5152); } else { - Dialog::show(0x5151); + _vm->_dialogs->show(0x5151); } _action._inProgress = false; diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index fa928916d6..64c4916240 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -268,9 +268,9 @@ void Scene804::step() { } if (_game._abortTimers == 120) - Dialog::show(0x13a26); + _vm->_dialogs->show(0x13a26); if (_game._abortTimers == 110) - Dialog::show(0x13a2a); + _vm->_dialogs->show(0x13a2a); if (_globals._v6) { _globals._v5 = 32; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 115a63045f..7e1cebaf32 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -45,6 +45,8 @@ Player::Player(MADSEngine *vm): _vm(vm) { _visible = false; _priorVisible = false; _visible3 = false; + _loadsFirst = false; + _walkAnywhere = false; _special = 0; _ticksAmount = 0; _priorTimer = 0; @@ -78,8 +80,8 @@ void Player::reset() { _newSceneId = _v844BE = 0; _next = 0; _routeCount = 0; + _walkAnywhere = false; - _vm->_game->_v4 = 0; _action->_startWalkFlag = false; _action->_walkFlag = false; } @@ -311,7 +313,7 @@ void Player::update() { playerY < 0 || (playerY + yScale) >= MADS_SCENE_HEIGHT) { scene._nextSceneId = _newSceneId; _newSceneId = 0; - _vm->_game->_v4 = 0; + _walkAnywhere = false; } } diff --git a/engines/mads/player.h b/engines/mads/player.h index 754ac7edc8..afd55b2686 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -118,7 +118,9 @@ public: bool _visible; bool _priorVisible; bool _visible3; + bool _walkAnywhere; int _frameNum; + bool _loadsFirst; Common::Point _playerPos; Common::Point _destPos; Common::Point _posChange; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 2a99b61a63..8a7bac117f 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -269,7 +269,7 @@ void UserInterface::setup(int id) { _v1E = -1; _v1C = -1; - if (_vm->_game->_v1 == 5) + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE) scene._userInterface._uiSlots.draw(false, false); scene._action.clear(); -- cgit v1.2.3