diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/action.cpp | 56 | ||||
-rw-r--r-- | engines/mads/action.h | 10 | ||||
-rw-r--r-- | engines/mads/animation.cpp | 6 | ||||
-rw-r--r-- | engines/mads/animation.h | 2 | ||||
-rw-r--r-- | engines/mads/game.cpp | 25 | ||||
-rw-r--r-- | engines/mads/game.h | 5 | ||||
-rw-r--r-- | engines/mads/messages.cpp | 10 | ||||
-rw-r--r-- | engines/mads/messages.h | 2 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes1.cpp | 24 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes2.cpp | 86 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes8.cpp | 10 | ||||
-rw-r--r-- | engines/mads/player.cpp | 17 | ||||
-rw-r--r-- | engines/mads/player.h | 19 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 46 | ||||
-rw-r--r-- | engines/mads/scene_data.cpp | 2 | ||||
-rw-r--r-- | engines/mads/screen.cpp | 22 | ||||
-rw-r--r-- | engines/mads/screen.h | 2 | ||||
-rw-r--r-- | engines/mads/sequence.cpp | 4 | ||||
-rw-r--r-- | engines/mads/user_interface.cpp | 28 | ||||
-rw-r--r-- | engines/mads/user_interface.h | 4 |
20 files changed, 199 insertions, 181 deletions
diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index c13f65a96c..e997261938 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -47,7 +47,7 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { } void MADSAction::clear() { - _v83338 = 1; + _interAwaiting = AWAITING_COMMAND; _actionMode = ACTIONMODE_NONE; _actionMode2 = ACTIONMODE2_0; _v86F42 = 0; @@ -269,7 +269,7 @@ void MADSAction::startAction() { DynamicHotspots &dynHotspots = scene._dynamicHotspots; Hotspots &hotspots = scene._hotspots; - game._player.moveComplete(); + game._player.cancelCommand(); _inProgress = true; _v8453A = ABORTMODE_0; @@ -354,12 +354,12 @@ void MADSAction::checkActionAtMousePos() { UserInterface &userInterface = scene._userInterface; ScreenObjects &screenObjects = _vm->_game->_screenObjects; - if ((userInterface._category == CAT_ACTION || userInterface._category == CAT_INV_VOCAB) && - _v83338 != 1 && scene._highlightedHotspot >= 0) { + if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) && + _interAwaiting != 1 && scene._highlightedHotspot >= 0) { if (_v86F4E == userInterface._category || _v86F4C != scene._highlightedHotspot || - (_v83338 != 2 && _v83338 != 3)) + (_interAwaiting != 2 && _interAwaiting != 3)) clear(); - else if (_selectedRow != 0 || userInterface._category != CAT_ACTION) + else if (_selectedRow != 0 || userInterface._category != CAT_COMMAND) scene._lookFlag = false; else scene._lookFlag = true; @@ -367,19 +367,19 @@ void MADSAction::checkActionAtMousePos() { if (screenObjects._v7FECA && _vm->_events->_mouseButtons) { switch (userInterface._category) { - case CAT_ACTION: + case CAT_COMMAND: case CAT_INV_VOCAB: return; case CAT_INV_LIST: case CAT_TALK_ENTRY: - if (_v83338 != 3) { + if (_interAwaiting != 3) { if (userInterface._selectedActionIndex >= 0) { _actionMode = ACTIONMODE_VERB; _selectedRow = userInterface._selectedActionIndex; _flags1 = scene._verbList[_selectedRow]._action1; _flags2 = scene._verbList[_selectedRow]._action2; - _v83338 = 2; + _interAwaiting = AWAITING_THIS; } else if (userInterface._selectedItemVocabIdx >= 0) { _actionMode = ACTIONMODE_OBJECT; _selectedRow = userInterface._selectedItemVocabIdx; @@ -393,20 +393,20 @@ void MADSAction::checkActionAtMousePos() { _articleNumber = _flags2; if ((_flags1 == 1 && _flags2 == 0) || (_flags1 == 2 && _flags2 != 0)) - _v83338 = 4; + _interAwaiting = AWAITING_RIGHT_MOUSE; else - _v83338 = 3; + _interAwaiting = AWAITING_THAT; } } break; } } - switch (_v83338) { + switch (_interAwaiting) { case 1: _articleNumber = 0; switch (userInterface._category) { - case CAT_ACTION: + case CAT_COMMAND: _actionMode = ACTIONMODE_VERB; _selectedRow = scene._highlightedHotspot; if (_selectedRow >= 0) { @@ -491,13 +491,13 @@ void MADSAction::leftClick() { ScreenObjects &screenObjects = _vm->_game->_screenObjects; bool abortFlag = false; - if ((userInterface._category == CAT_ACTION || userInterface._category == CAT_INV_VOCAB) && - _v83338 != 1 && scene._highlightedHotspot >= 0 && + if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) && + _interAwaiting != 1 && scene._highlightedHotspot >= 0 && _v86F4E == userInterface._category && _v86F4C == scene._highlightedHotspot && - (_v83338 == 2 || userInterface._category == CAT_INV_VOCAB)) { + (_interAwaiting == 2 || userInterface._category == CAT_INV_VOCAB)) { abortFlag = true; - if (_selectedRow == 0 && userInterface._category == CAT_ACTION) { - _selectedAction = CAT_ACTION; + if (_selectedRow == 0 && userInterface._category == CAT_COMMAND) { + _selectedAction = CAT_COMMAND; scene._lookFlag = true; } else { _selectedAction = CAT_NONE; @@ -506,14 +506,14 @@ void MADSAction::leftClick() { } } - if (abortFlag || (screenObjects._v7FECA && (userInterface._category == CAT_ACTION || + if (abortFlag || (screenObjects._v7FECA && (userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB))) return; - switch (_v83338) { - case 1: + switch (_interAwaiting) { + case AWAITING_COMMAND: switch (userInterface._category) { - case CAT_ACTION: + case CAT_COMMAND: if (_selectedRow >= 0) { if (!_flags1) { _selectedAction = -1; @@ -521,7 +521,7 @@ void MADSAction::leftClick() { else { _v86F4C = _selectedRow; _v86F4E = _actionMode; - _v83338 = 2; + _interAwaiting = AWAITING_THIS; } } break; @@ -536,7 +536,7 @@ void MADSAction::leftClick() { if (_selectedRow >= 0) { if (_flags1 != 1 || _flags2 != 0) { if (_flags1 != 2 || _flags2 == 0) { - _v83338 = 3; + _interAwaiting = AWAITING_THAT; _articleNumber = _flags2; } else { @@ -560,7 +560,7 @@ void MADSAction::leftClick() { if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) { scene._customDest = _vm->_events->currentPos() + scene._posAdjust; _selectedAction = -1; - _v86F4A = -1; + _v86F4A = true; } break; @@ -574,7 +574,7 @@ void MADSAction::leftClick() { } break; - case 2: + case AWAITING_THIS: switch (userInterface._category) { case CAT_INV_LIST: case CAT_HOTSPOT: @@ -582,7 +582,7 @@ void MADSAction::leftClick() { if (_hotspotId >= 0) { if (_flags2) { _articleNumber = _flags2; - _v83338 = 3; + _interAwaiting = AWAITING_THAT; } else { _selectedAction = -1; @@ -599,7 +599,7 @@ void MADSAction::leftClick() { } break; - case 3: + case AWAITING_THAT: switch (userInterface._category) { case CAT_INV_LIST: case CAT_HOTSPOT: diff --git a/engines/mads/action.h b/engines/mads/action.h index 26ab062673..74de167a4e 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -32,6 +32,14 @@ enum ActionMode { ACTIONMODE_NONE = 0, ACTIONMODE_VERB = 1, ACTIONMODE_OBJECT = enum ActionMode2 { ACTIONMODE2_0 = 0, ACTIONMODE2_2 = 2, ACTIONMODE2_4 = 4, ACTIONMODE2_5 = 5 }; enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; +enum InterAwaiting { + AWAITING_NONE = 0, + AWAITING_COMMAND = 1, // Initial state: waiting for a command verb + AWAITING_THIS = 2, // Waiting for object + AWAITING_THAT = 3, // Waiting for a second object + AWAITING_RIGHT_MOUSE = 4 // Waiting for mouse button release +}; + enum { VERB_NONE = 0, VERB_LOOK = 3, @@ -98,7 +106,7 @@ public: int16 _v86F4E; bool _v86F4A; int16 _v86F4C; - int _v83338; + InterAwaiting _interAwaiting; bool _inProgress; int _v8453A; diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index b0b69b946a..96b9cfb90e 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -316,7 +316,7 @@ void Animation::startAnimation(int abortTimers) { _currentFrame = 0; _oldFrameEntry = 0; _nextFrameTimer = _vm->_game->_scene._frameStartTime; - _abortTimers = abortTimers; + _trigger = abortTimers; _abortTimersMode = _vm->_game->_abortTimersMode2; _vm->_game->_scene._action._activeAction = _actionDetails; @@ -530,8 +530,8 @@ void Animation::update() { _currentFrame++; if (_currentFrame >= (int)_miscEntries.size()) { // Animation is complete - if (_abortTimers != 0) { - _vm->_game->_abortTimers = _abortTimers; + if (_trigger != 0) { + _vm->_game->_trigger = _trigger; _vm->_game->_abortTimersMode = _abortTimersMode; if (_abortTimersMode != ABORTMODE_1) { diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 1207ff6100..7c3d864184 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -128,7 +128,7 @@ private: uint32 _nextFrameTimer; uint32 _nextScrollTimer; int _messageCtr; - int _abortTimers; + int _trigger; AbortTimerMode _abortTimersMode; ActionDetails _actionDetails; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index b89f83384b..900d4dc86a 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -54,7 +54,6 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _quoteEmergency = false; _vocabEmergency = false; _aaName = "*I0.AA"; - _playerSpritesFlag = false; _priorFrameTimer = 0; _updateSceneFlag = false; _abortTimersMode = ABORTMODE_0; @@ -191,7 +190,7 @@ void Game::sectionLoop() { if (!_player._spritesLoaded && _player._loadsFirst) { if (_player.loadSprites("")) _vm->quitGame(); - _playerSpritesFlag = true; + _player._loadedFirst = true; } _scene.loadScene(_scene._nextSceneId, _aaName, 0); @@ -200,33 +199,33 @@ void Game::sectionLoop() { if (!_player._spritesLoaded) { if (_player.loadSprites("")) _vm->quitGame(); - _playerSpritesFlag = false; + _player._loadedFirst = false; } _vm->_events->initVars(); + _scene._userInterface._highlightedCommandIndex = -1; + _scene._userInterface._highlightedItemIndex = -1; _scene._userInterface._highlightedActionIndex = -1; - _scene._userInterface._v1C = -1; - _scene._userInterface._v1E = -1; _scene._action.clear(); - _player.turnToDestFacing(); + _player.setFinalFacing(); _player._facing = _player._turnToFacing; - _player.moveComplete(); + _player.cancelCommand(); + _kernelMode = KERNEL_ROOM_INIT; switch (_vm->_screenFade) { case SCREEN_FADE_SMOOTH: - _abortTimers2 = kTransitionFadeOutIn; + _fx = kTransitionFadeOutIn; break; case SCREEN_FADE_FAST: - _abortTimers2 = kCenterVertTransition; + _fx = kCenterVertTransition; break; default: - _abortTimers2 = kTransitionNone; + _fx = kTransitionNone; break; } - _abortTimers = 0; - _abortTimersMode2 = ABORTMODE_1; + _trigger = 0; _priorFrameTimer = _scene._frameStartTime; // Call the scene logic for entering the given scene @@ -271,7 +270,7 @@ void Game::sectionLoop() { warning("TODO: sub_1DD8C, sub_1DD7E"); - if (!_playerSpritesFlag) { + if (!_player._loadedFirst) { _player._spritesLoaded = false; _player._spritesChanged = true; } diff --git a/engines/mads/game.h b/engines/mads/game.h index 11fd95491e..f3e2a67e23 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -78,7 +78,6 @@ protected: bool _quoteEmergency; bool _vocabEmergency; bool _updateSceneFlag; - bool _playerSpritesFlag; /** * Constructor @@ -133,8 +132,8 @@ public: Scene _scene; KernelMode _kernelMode; int _v2; - int _abortTimers; - int _abortTimers2; + int _trigger; + ScreenTransition _fx; AbortTimerMode _abortTimersMode; AbortTimerMode _abortTimersMode2; uint32 _priorFrameTimer; diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index be84739fc0..617bd6d2a0 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -74,7 +74,7 @@ int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, rec._textDisplayIndex = -1; rec._timeout = timeout; rec._frameTimer = _vm->_game->_priorFrameTimer; - rec._abortTimers = abortTimers; + rec._trigger = abortTimers; rec._abortMode = _vm->_game->_abortTimersMode2; rec._actionDetails = scene._action._activeAction; @@ -143,7 +143,7 @@ void KernelMessages::reset() { void KernelMessages::update() { uint32 currentTimer = _vm->_game->_scene._frameStartTime; - for (uint i = 0; i < _entries.size() && !_vm->_game->_abortTimers; ++i) { + for (uint i = 0; i < _entries.size() && !_vm->_game->_trigger; ++i) { KernelMessage &msg = _entries[i]; if (((msg._flags & KMSG_ACTIVE) != 0) && (currentTimer >= msg._frameTimer)) @@ -173,10 +173,10 @@ void KernelMessages::processText(int msgIndex) { msg._timeout = 0; } - if ((msg._timeout <= 0) && (_vm->_game->_abortTimers == 0)) { + if ((msg._timeout <= 0) && (_vm->_game->_trigger == 0)) { msg._flags |= KMSG_EXPIRE; - if (msg._abortTimers != 0) { - _vm->_game->_abortTimers = msg._abortTimers; + if (msg._trigger != 0) { + _vm->_game->_trigger = msg._trigger; _vm->_game->_abortTimersMode = msg._abortMode; if (_vm->_game->_abortTimersMode != ABORTMODE_1) { diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 03a4e01234..1254b1dafc 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -56,7 +56,7 @@ public: uint32 _frameTimer2; uint32 _frameTimer; uint32 _timeout; - int _abortTimers; + int _trigger; AbortTimerMode _abortMode; ActionDetails _actionDetails; Common::String _msg; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 554c73ddc6..e5c0abd4bd 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -215,7 +215,7 @@ void Scene103::step() { Common::Point pt; int dist; - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 70: _vm->_game->_player._stepEnabled = true; break; @@ -260,7 +260,7 @@ void Scene103::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(10322); } else if (_action.isAction(395, 110, 0)) { - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 0: _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[6], false, 6, 1); @@ -280,7 +280,7 @@ void Scene103::actions() { } } else if (_action.isAction(VERB_TAKE, 371, 0) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 0: _scene->changeDepthSurface(1); _globals._spriteIndexes[28] = _scene->_sequences.startReverseCycle( @@ -312,7 +312,7 @@ void Scene103::actions() { break; } } else if (_action.isAction(VERB_TAKE, 289, 0) && _game._objects.isInRoom(OBJ_REBREATHER)) { - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 0: _scene->changeDepthSurface(1); _globals._spriteIndexes[27] = _scene->_sequences.startReverseCycle( @@ -344,26 +344,26 @@ void Scene103::actions() { } else if (_action.isAction(VERB_LOOK, 362, 0)) { _vm->_dialogs->show(10301); } else if (_action.isAction(VERB_TAKE, 362, 0)) { - if (!_vm->_game->_abortTimers) + if (!_vm->_game->_trigger) _vm->_sound->command(31); - if (_vm->_game->_abortTimers2 < 2) { + if (_vm->_game->_fx < 2) { _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[9], false, 6, - _vm->_game->_abortTimers < 1 ? 1 : 0); - if (_vm->_game->_abortTimers) { + _vm->_game->_trigger < 1 ? 1 : 0); + if (_vm->_game->_trigger) { _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -1, 0); Common::String msg = _game.getQuote(51); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 18, 0, 60, msg); - _scene->_sequences.addTimer(120, _vm->_game->_abortTimers); + _scene->_sequences.addTimer(120, _vm->_game->_trigger); } else { _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); } - _game._player._stepEnabled = _game._abortTimers == 2; + _game._player._stepEnabled = _game._trigger == 2; _globals[kTurkeyExploded] = -1; - if (_game._abortTimers == 2) { + if (_game._trigger == 2) { _vm->_dialogs->show(1030); _scene->_hotspots.activate(362, false); } @@ -372,7 +372,7 @@ void Scene103::actions() { _vm->_dialogs->show(!_globals[kTurkeyExploded] ? 10323 : 10303); } else if (_action.isAction(VERB_TALKTO, 27, 0)) { - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 0: { _game._player._stepEnabled = false; Common::String msg = _game.getQuote(71); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 83dcfa3865..38f87ba412 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -218,7 +218,7 @@ void Scene201::step() { _pterodactylFlag = false; } - if (_game._abortTimers == 70) { + if (_game._trigger == 70) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); _game._player._visible = false; _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 12, 16); @@ -231,24 +231,24 @@ void Scene201::step() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 73); } - if (_game._abortTimers == 81) { + if (_game._trigger == 81) { _scene->_kernelMessages.reset(); } - if (_game._abortTimers == 71) { + if (_game._trigger == 71) { _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], -2, -2); _scene->_sequences.setDepth(_globals._spriteIndexes[22], 1); } - if (_game._abortTimers == 73) { + if (_game._trigger == 73) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 17, -2); _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 74); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); } - if (_game._abortTimers == 74) { + if (_game._trigger == 74) { _vm->_sound->command(40); _scene->_kernelMessages.add(Common::Point(125, 56), 0xFDFC, 32, 82, 180, _game.getQuote(91)); @@ -258,24 +258,24 @@ void Scene201::step() { _scene->_sequences.addTimer(180, 75); } - if (_game._abortTimers == 75) { + if (_game._trigger == 75) { _globals[kMeteorologistEverSeen] = 0; _scene->_nextSceneId = 202; } - if (_game._abortTimers == 76) { + if (_game._trigger == 76) { _game._player._stepEnabled = true; _game._player._visible = true; _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; } - if (_game._abortTimers == 77) { + if (_game._trigger == 77) { _globals[kTeleporterCommand] = 1; _scene->_nextSceneId = _globals[kTeleporterDestination]; _scene->_reloadSceneFlag = true; } - if (_game._abortTimers == 78) { + if (_game._trigger == 78) { _vm->_sound->command(40); _vm->_dialogs->show(0x4E92); _scene->_reloadSceneFlag = true; @@ -288,12 +288,12 @@ void Scene201::actions() { if (action->isAction(0x18C, 0x83, 0)) _scene->_nextSceneId = 202; else if ((action->isAction(0x50, 0x156, 0)) || (action->isAction(0x188, 0x16C, 0)) || (action->isAction(0x188, 0x1B6, 0))) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible = false; int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; _scene->loadAnimation(formAnimName(sepChar, 0), 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _scene->_nextSceneId = 213; } } else if (action->isAction(0x3, 0x1A6, 0)) { @@ -474,10 +474,10 @@ void Scene202::step() { setRandomKernelMessage(); } - if (_game._abortTimers == 70) + if (_game._trigger == 70) _activeMsgFl = false; - if (_game._abortTimers == 71) { + if (_game._trigger == 71) { _vm->_sound->command(3); _vm->_sound->command(9); _globals._v8425C = 900 + _scene->_frameStartTime; @@ -507,7 +507,7 @@ void Scene202::step() { _globals[kMeteorologistWatch] = 0; } - switch (_game._abortTimers) { + switch (_game._trigger) { case 90: _vm->_sound->command(41); _scene->_sequences.remove(_globals._spriteIndexes[25]); @@ -717,7 +717,7 @@ void Scene202::preActions() { _scene->_kernelMessages.reset(); if (!_ladderTopFl && (action->isAction(0x4E, 0xC7, 0) || !action->_walkFlag)) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _vm->_sound->command(29); action->_walkFlag = false; _game._player._stepEnabled = false; @@ -725,7 +725,7 @@ void Scene202::preActions() { _globals._spriteIndexes[23] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[23]); warning("CHECKME: _scene->_dynamicHotspots.remove(_globals._frameTime);"); _scene->_dynamicHotspots.remove(_globals._frameTime); @@ -765,7 +765,7 @@ void Scene202::actions() { _scene->_nextSceneId = 201; } else if (action->isAction(0x4, 0x2C, 0)) { if (action->_actionMode2 == 4) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { if (_game._objects.isInInventory(OBJ_BONES)) { _vm->_dialogs->show(0x4EFB); } else { @@ -776,7 +776,7 @@ void Scene202::actions() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_FRAME_INDEX, 6, 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 2); } - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { if ((_game._player._playerPos.x == 132) && (_game._player._playerPos.y == 97)) { _scene->_sequences.remove(_globals._spriteIndexes[16]); _globals[kBone202Status] |= 1; @@ -784,7 +784,7 @@ void Scene202::actions() { _scene->_sequences.remove(_globals._spriteIndexes[21]); _globals[kBone202Status] |= 2; } - } else if (_game._abortTimers == 2) { + } else if (_game._trigger == 2) { if (_game._objects.isInInventory(OBJ_BONE)) { _game._objects.removeFromInventory(OBJ_BONE, 1); _game._objects.addToInventory(OBJ_BONES); @@ -802,7 +802,7 @@ void Scene202::actions() { } } } else if ((action->isAction(0x50, 0xC7, 0)) && (_globals[kLadderBroken] == 0)) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _vm->_sound->command(29); _globals._v8425C = _scene->_frameStartTime; _game._player._visible = false; @@ -814,7 +814,7 @@ void Scene202::actions() { _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); @@ -829,7 +829,7 @@ void Scene202::actions() { } } else if (((action->isAction(0x3, 0x27, 0x82)) || (action->isAction(0x3, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { if (!_ladderTopFl) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible= false; _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); @@ -838,7 +838,7 @@ void Scene202::actions() { _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); @@ -848,7 +848,7 @@ void Scene202::actions() { } else { _scene->_sequences.addTimer(120, 2); } - } else if (_game._abortTimers == 2) { + } else if (_game._trigger == 2) { if (!_scene->_activeAnimation && (_globals._abortVal == 0)) { _vm->_dialogs->show(0x4EFE); } @@ -858,7 +858,7 @@ void Scene202::actions() { _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 3); - } else if (_game._abortTimers == 3) { + } else if (_game._trigger == 3) { _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); _game._player._stepEnabled = true; _game._player._visible = true; @@ -867,7 +867,7 @@ void Scene202::actions() { return; } } else { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _globals._v84268 = 1; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._spriteIndexes[24]); @@ -875,7 +875,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); @@ -897,7 +897,7 @@ void Scene202::actions() { } else { _scene->_sequences.addTimer(120, 2); } - } else if (_game._abortTimers == 2) { + } else if (_game._trigger == 2) { if (!_scene->_activeAnimation) _vm->_dialogs->show(0x4EFE); _globals._abortVal = 0; @@ -906,7 +906,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 3); - } else if (_game._abortTimers == 3) { + } else if (_game._trigger == 3) { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); @@ -1024,7 +1024,7 @@ void Scene203::step() { if (_globals._v0 == 0) return; - if ((_game._abortTimers == 0) && (_globals._frameTime != 0)) + if ((_game._trigger == 0) && (_globals._frameTime != 0)) return; if ((_game._player._playerPos != Common::Point(158, 136)) || (_game._player._facing != 2)) @@ -1032,7 +1032,7 @@ void Scene203::step() { _globals._frameTime = 0xFFFF; - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _game._player._visible = false; _game._player._stepEnabled = false; _vm->_palette->sub7BBF8(); @@ -1040,7 +1040,7 @@ void Scene203::step() { _scene->resetScene(); _vm->_events->setCursor2(CURSOR_WAIT); _scene->loadAnimation(Resources::formatName(203, 'a', -1, EXT_AA, ""), 81); - } else if (_game._abortTimers == 81) { + } else if (_game._trigger == 81) { _scene->_nextSceneId = 208; _scene->_reloadSceneFlag = true; } @@ -1257,13 +1257,13 @@ void Scene207::step() { warning("TODO: sub3ADD6(...)"); } - if (_game._abortTimers == 70) { + if (_game._trigger == 70) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 23, 34); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 6); } - if (_game._abortTimers == 71) + if (_game._trigger == 71) _globals._v2 = 0; if (_globals._v2) @@ -1419,21 +1419,21 @@ void Scene208::step() { if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._facing != 6)) return; - if ((_game._abortTimers == 0) && ((_globals._frameTime & 0xFFFF) != 0)) + if ((_game._trigger == 0) && ((_globals._frameTime & 0xFFFF) != 0)) return; _globals._frameTime |= 0xFFFF; - if (_game._abortTimers == 82) { + if (_game._trigger == 82) { _game._player._stepEnabled = true; return; } - if (_game._abortTimers > 82) + if (_game._trigger > 82) return; - if (_game._abortTimers & 0xFF) { - if ((_game._abortTimers & 0xFF) == 81) { + if (_game._trigger & 0xFF) { + if ((_game._trigger & 0xFF) == 81) { _scene->_sequences.remove(_globals._spriteIndexes[15]); _globals[kRhotundaStatus] = 1; warning("TODO: sub34648(...)"); @@ -1459,20 +1459,20 @@ void Scene208::actions() { if (_action.isAction(0x18C, 0x19F, 0)) { if (_globals[kRhotundaStatus]) _scene->_nextSceneId = 203; - else if (_game._abortTimers == 0) { + else if (_game._trigger == 0) { _game._player._stepEnabled = false; int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 120, _game.getQuote(70)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _scene->_nextSceneId = 203; } } else if (_action.isAction(0x18C, 0x83, 0)) { _scene->_nextSceneId = 212; - } else if (_action.isAction(0x4, 0x1AA, 0) && (!_globals[kLeavesStatus] || _game._abortTimers)) { + } else if (_action.isAction(0x4, 0x1AA, 0) && (!_globals[kLeavesStatus] || _game._trigger)) { warning("TODO: sub3B282(1);"); if (_game._player._stepEnabled) _vm->_dialogs->showPicture(OBJ_BIG_LEAVES, 0x326, 0); - } else if (_action.isAction(0x7, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._abortTimers)) { + } else if (_action.isAction(0x7, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { warning("TODO: sub3B282(2);"); } else if (_action.isAction(0x7, 0x17A, 0x1A9)) { warning("TODO: sub3B282(3);"); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 64c4916240..cb761ca138 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -181,7 +181,7 @@ void Scene804::step() { _globals._v2 = 0; } - if (_game._abortTimers == 70) + if (_game._trigger == 70) _globals._v5 = 42; if (_scene->_activeAnimation->getCurrentFrame() == 65) _scene->_sequences.remove(_globals._spriteIndexes[22]); @@ -222,7 +222,7 @@ void Scene804::step() { _scene->_sequences.addTimer(60, 80); } - if (_game._abortTimers == 80) + if (_game._trigger == 80) _scene->_nextSceneId = 803; if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[kWindowFixed]) { @@ -267,9 +267,9 @@ void Scene804::step() { } } - if (_game._abortTimers == 120) + if (_game._trigger == 120) _vm->_dialogs->show(0x13a26); - if (_game._abortTimers == 110) + if (_game._trigger == 110) _vm->_dialogs->show(0x13a2a); if (_globals._v6) { @@ -281,7 +281,7 @@ void Scene804::step() { _globals._v5 = -1; } - if (_game._abortTimers == 90) + if (_game._trigger == 90) _scene->_nextSceneId = 803; if (_scene->_activeAnimation->getCurrentFrame() == 7 &&!_globals._v8) { diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 7e1cebaf32..eaec85c8fc 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -46,6 +46,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _priorVisible = false; _visible3 = false; _loadsFirst = false; + _loadedFirst = false; _walkAnywhere = false; _special = 0; _ticksAmount = 0; @@ -71,7 +72,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { Common::fill(&_spriteSetsPresent[0], &_spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT], false); } -void Player::reset() { +void Player::cancelWalk() { _action = &_vm->_game->_scene._action; _destPos = _playerPos; _targetFacing = FACING_NONE; @@ -133,8 +134,8 @@ bool Player::loadSprites(const Common::String &prefix) { } } -void Player::turnToDestFacing() { - if (_targetFacing != 5) +void Player::setFinalFacing() { + if (_targetFacing != FACING_NONE) _turnToFacing = _targetFacing; } @@ -176,8 +177,8 @@ void Player::dirChanged() { _priorTimer += 1; } -void Player::moveComplete() { - reset(); +void Player::cancelCommand() { + cancelWalk(); _action->_inProgress = false; } @@ -365,7 +366,7 @@ void Player::setDest(const Common::Point &pt, Facing facing) { void Player::startWalking(const Common::Point &pos, Facing direction) { Scene &scene = _vm->_game->_scene; - reset(); + cancelWalk(); scene._action._startWalkFlag = true; scene._action._walkFlag = true; scene._destPos = pos; @@ -406,7 +407,7 @@ void Player::move() { // End of walking path _routeCount = 0; _moving = false; - turnToDestFacing(); + setFinalFacing(); routeFlag = true; idx = _routeCount; } @@ -475,7 +476,7 @@ void Player::move() { _v8452E -= var1; if (routeFlag) - moveComplete(); + cancelCommand(); else { if (!_newSceneId) { // If the move is complete, make sure the position is exactly on the given destination diff --git a/engines/mads/player.h b/engines/mads/player.h index afd55b2686..004c412901 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -64,8 +64,6 @@ private: int _actionList2[12]; int _hypotenuse; - void reset(); - void resetActionList(); void move(); @@ -121,6 +119,7 @@ public: bool _walkAnywhere; int _frameNum; bool _loadsFirst; + bool _loadedFirst; Common::Point _playerPos; Common::Point _destPos; Common::Point _posChange; @@ -152,9 +151,21 @@ public: */ bool loadSprites(const Common::String &prefix); - void turnToDestFacing(); + /** + * Called when the player has reached the given destination, start him + * turning to the specified facing + */ + void setFinalFacing(); + + /** + * Stops the player walking + */ + void cancelWalk(); - void moveComplete(); + /** + * Cancels any oustanding player action + */ + void cancelCommand(); void setupFrame(); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index f16b2c3889..aa57a7e6b3 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -275,7 +275,7 @@ void Scene::loop() { // TODO: Verify correctness of frame wait _vm->_events->waitForNextFrame(); - if (_vm->_dialogs->_pendingDialog != DIALOG_NONE && !_vm->_game->_abortTimers + if (_vm->_dialogs->_pendingDialog != DIALOG_NONE && !_vm->_game->_trigger && _vm->_game->_player._stepEnabled) _reloadSceneFlag = true; } @@ -290,18 +290,18 @@ void Scene::doFrame() { _action._selectedAction = 0; } - if (!_vm->_game->_abortTimers && !player._unk3) { + if (!_vm->_game->_trigger && !player._unk3) { // Refresh the dynamic hotspots if they've changed if (_dynamicHotspots._changed) _dynamicHotspots.refresh(); // Check all on-screen visual objects _vm->_game->_screenObjects.check(player._stepEnabled && !_action._startWalkFlag && - !_vm->_game->_abortTimers2); + !_vm->_game->_fx); } if (_action._selectedAction && player._stepEnabled && !_action._startWalkFlag && - !_vm->_game->_abortTimers && !player._unk3) { + !_vm->_game->_trigger && !player._unk3) { _action.startAction(); if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) { _action._activeAction._verbId = VERB_LOOK; @@ -311,17 +311,17 @@ void Scene::doFrame() { flag = true; } - if (flag || (_vm->_game->_abortTimers && _vm->_game->_abortTimersMode == ABORTMODE_2)) { + if (flag || (_vm->_game->_trigger && _vm->_game->_abortTimersMode == ABORTMODE_2)) { doPreactions(); } checkStartWalk(); - if (!_vm->_game->_abortTimers2) + if (!_vm->_game->_fx) _frameStartTime = _vm->_events->getFrameCounter(); if ((_action._inProgress && !player._moving && !_action._startWalkFlag && player._turnToFacing == player._facing) || - (_vm->_game->_abortTimers && _vm->_game->_abortTimersMode == ABORTMODE_0)) { + (_vm->_game->_trigger && _vm->_game->_abortTimersMode == ABORTMODE_0)) { doAction(); } @@ -339,7 +339,7 @@ void Scene::doFrame() { // Cursor update code updateCursor(); - if (!_vm->_game->_abortTimers) { + if (!_vm->_game->_trigger) { // Handle any active sequences _sequences.tick(); @@ -357,24 +357,24 @@ void Scene::doFrame() { 0x203, 0, 0, 1, msg); } - if (!_vm->_game->_abortTimers) { + if (!_vm->_game->_trigger) { if (_reloadSceneFlag || _currentSceneId != _nextSceneId) _kernelMessages.reset(); _kernelMessages.update(); } - _userInterface._uiSlots.draw(_vm->_game->_abortTimers2 == 0, - _vm->_game->_abortTimers2 != 0); + _userInterface._uiSlots.draw(_vm->_game->_fx == 0, + _vm->_game->_fx != 0); // Write any text needed by the interface - if (_vm->_game->_abortTimers2) + if (_vm->_game->_fx) _userInterface.drawTextElements(); // Draw any elements - drawElements((ScreenTransition)_vm->_game->_abortTimers2, _vm->_game->_abortTimers2); + drawElements((ScreenTransition)_vm->_game->_fx, _vm->_game->_fx); // Handle message updates - if (_vm->_game->_abortTimers2) { + if (_vm->_game->_fx) { uint32 priorTime = _vm->_game->_priorFrameTimer; uint32 newTime = _vm->_events->getFrameCounter(); _sequences.delay(newTime, priorTime); @@ -390,9 +390,9 @@ void Scene::doFrame() { } } - if (_vm->_game->_abortTimers2) + if (_vm->_game->_fx) _animFlag = true; - _vm->_game->_abortTimers2 = 0; + _vm->_game->_fx = kTransitionNone; if (_freeAnimationFlag) { _activeAnimation->free(); @@ -450,7 +450,7 @@ void Scene::doPreactions() { _sceneLogic->preActions(); if (_vm->_game->_abortTimersMode == ABORTMODE_2) - _vm->_game->_abortTimers = 0; + _vm->_game->_trigger = 0; } } @@ -458,7 +458,7 @@ void Scene::doAction() { int flag = 0; _vm->_game->_abortTimersMode2 = ABORTMODE_0; - if ((_action._inProgress || _vm->_game->_abortTimers) && !_action._v8453A) { + if ((_action._inProgress || _vm->_game->_trigger) && !_action._v8453A) { _sceneLogic->actions(); _action._inProgress = true; flag = -1; @@ -467,14 +467,14 @@ void Scene::doAction() { if (_vm->_game->_screenObjects._v832EC == 1) { _action._inProgress = false; } else { - if ((_action._inProgress || _vm->_game->_abortTimers) || + if ((_action._inProgress || _vm->_game->_trigger) || (!flag && _action._v8453A == flag)) { _vm->_game->_sectionHandler->sectionPtr2(); _action._inProgress = true; flag = -1; } - if ((_action._inProgress || _vm->_game->_abortTimers) && (!flag || _action._v8453A == flag)) { + if ((_action._inProgress || _vm->_game->_trigger) && (!flag || _action._v8453A == flag)) { _vm->_game->doObjectAction(); } @@ -496,7 +496,7 @@ void Scene::doAction() { _action._inProgress = false; if (_vm->_game->_abortTimersMode == ABORTMODE_0) - _vm->_game->_abortTimers = 0; + _vm->_game->_trigger = 0; } void Scene::checkStartWalk() { @@ -515,7 +515,7 @@ void Scene::doSceneStep() { _vm->_game->_player._unk3 = 0; if (_vm->_game->_abortTimersMode == ABORTMODE_1) - _vm->_game->_abortTimers = 0; + _vm->_game->_trigger = 0; } void Scene::checkKeyboard() { @@ -537,7 +537,7 @@ void Scene::updateCursor() { Player &player = _vm->_game->_player; CursorType cursorId = CURSOR_ARROW; - if (_action._v83338 == 1 && !_vm->_game->_screenObjects._v7FECA && + if (_action._interAwaiting == 1 && !_vm->_game->_screenObjects._v7FECA && _vm->_game->_screenObjects._category == CAT_HOTSPOT) { int idx = _vm->_game->_screenObjects._selectedObject - _userInterface._categoryIndexes[CAT_HOTSPOT - 1]; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 712d065fb9..b6304679cb 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -49,7 +49,7 @@ KernelMessage::KernelMessage() { _frameTimer2 = 0; _frameTimer = 0; _timeout = 0; - _abortTimers = 0; + _trigger = 0; _abortMode = ABORTMODE_0; _actionDetails._verbId = 0; _actionDetails._objectNameId = 0; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index c881e9560e..0c78b0c8a1 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -303,7 +303,7 @@ void ScreenObjects::check(bool scanFlag) { if (_vm->_easyMouse && _vm->_events->_mouseButtons && category != _category && scene._userInterface._category != CAT_NONE) { _released = true; - if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { + if (category >= CAT_COMMAND && category <= CAT_TALK_ENTRY) { elementHighlighted(); } @@ -315,12 +315,12 @@ void ScreenObjects::check(bool scanFlag) { scene._userInterface._category = _category; if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { - if (userInterface._category >= CAT_ACTION && userInterface._category <= CAT_TALK_ENTRY) { + if (userInterface._category >= CAT_COMMAND && userInterface._category <= CAT_TALK_ENTRY) { elementHighlighted(); } } - if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._v83338 > 1 + if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._interAwaiting > 1 && scene._userInterface._category == CAT_INV_LIST) || (_vm->_easyMouse && scene._userInterface._category == CAT_HOTSPOT)) { scene._action.checkActionAtMousePos(); @@ -465,12 +465,12 @@ void ScreenObjects::elementHighlighted() { int uiCount; switch (userInterface._category) { - case CAT_ACTION: + case CAT_COMMAND: index = 10; indexEnd = 9; varA = 5; topIndex = 0; - idxP = !_v7FECA ? &userInterface._highlightedActionIndex : + idxP = !_v7FECA ? &userInterface._highlightedCommandIndex : &userInterface._selectedActionIndex; if (_v7FECA && userInterface._selectedItemVocabIdx >= 0) @@ -486,8 +486,8 @@ void ScreenObjects::elementHighlighted() { indexEnd = invList.size() - 1; varA = 0; topIndex = userInterface._inventoryTopIndex; - idxP = &userInterface._v1C; - var4 = (!_released || (_vm->_events->_mouseButtons && action._v83338 == 1)) ? 0 : 1; + idxP = &userInterface._highlightedItemIndex; + var4 = (!_released || (_vm->_events->_mouseButtons && action._interAwaiting == 1)) ? 0 : 1; break; case CAT_INV_VOCAB: @@ -502,10 +502,10 @@ void ScreenObjects::elementHighlighted() { varA = 0; topIndex = 0; - idxP = _v7FECA ? &userInterface._selectedItemVocabIdx : &userInterface._v1E; + idxP = _v7FECA ? &userInterface._selectedItemVocabIdx : &userInterface._highlightedActionIndex; if (_v7FECA && userInterface._selectedActionIndex >= 0) - userInterface.updateSelection(CAT_ACTION, -1, &userInterface._selectedActionIndex); + userInterface.updateSelection(CAT_COMMAND, -1, &userInterface._selectedActionIndex); var4 = _released && !_v7FECA ? 1 : 0; break; @@ -529,7 +529,7 @@ void ScreenObjects::elementHighlighted() { indexEnd = index - 1; varA = 0; topIndex = 0; - idxP = &userInterface._highlightedActionIndex; + idxP = &userInterface._highlightedCommandIndex; var4 = -1; break; @@ -597,7 +597,7 @@ void ScreenObjects::elementHighlighted() { _vm->_game->_scene._highlightedHotspot = newIndex; if (_category == CAT_INV_LIST || _category == CAT_INV_ANIM) { - if (action._v83338 == 1 && newIndex >= 0 && _released && + if (action._interAwaiting == 1 && newIndex >= 0 && _released && (!_vm->_events->_mouseReleased || !_vm->_easyMouse)) newIndex = -1; } diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 7fa5722e18..c733452aa2 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -33,7 +33,7 @@ namespace MADS { #define MADS_SCREEN_HEIGHT 200 enum ScrCategory { - CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, + CAT_NONE = 0, CAT_COMMAND = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7, CAT_12 = 12 }; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index bb2454d3fc..97d8674f51 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -327,7 +327,7 @@ bool SequenceList::loadSprites(int seqIndex) { } if (idx >= 0) { - _vm->_game->_abortTimers = seqEntry._entries._abortVal[idx]; + _vm->_game->_trigger = seqEntry._entries._abortVal[idx]; _vm->_game->_abortTimersMode = seqEntry._abortMode; if (seqEntry._abortMode == ABORTMODE_1) @@ -343,7 +343,7 @@ bool SequenceList::loadSprites(int seqIndex) { void SequenceList::tick() { Scene &scene = _vm->_game->_scene; for (uint idx = 0; idx < _entries.size(); ++idx) { - if ((_vm->_game->_abortTimers2 == 0) && (_vm->_game->_abortTimers != 0)) + if ((_vm->_game->_fx == 0) && (_vm->_game->_trigger != 0)) break; SequenceEntry &seqEntry = _entries[idx]; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 8a7bac117f..d0139e2897 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -199,9 +199,9 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _selectedActionIndex = 0; _selectedItemVocabIdx = -1; _scrollerY = 0; + _highlightedCommandIndex = -1; + _highlightedItemIndex = -1; _highlightedActionIndex = -1; - _v1C = -1; - _v1E = -1; _dirtyAreas.resize(50); _inventoryChanged = false; Common::fill(&_categoryIndexes[0], &_categoryIndexes[7], 0); @@ -265,9 +265,9 @@ void UserInterface::setup(int id) { scene._userInterface._uiSlots.clear(); scene._userInterface._uiSlots.fullRefresh(); _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); + _highlightedCommandIndex = -1; _highlightedActionIndex = -1; - _v1E = -1; - _v1C = -1; + _highlightedItemIndex = -1; if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE) scene._userInterface._uiSlots.draw(false, false); @@ -291,7 +291,7 @@ void UserInterface::drawTextElements() { void UserInterface::drawActions() { for (int idx = 0; idx < 10; ++idx) { - writeVocab(CAT_ACTION, idx); + writeVocab(CAT_COMMAND, idx); } } @@ -329,10 +329,10 @@ void UserInterface::writeVocab(ScrCategory category, int id) { int vocabId; Common::String vocabStr; switch (category) { - case CAT_ACTION: + case CAT_COMMAND: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = scene._verbList[id]._id; - if (id == _highlightedActionIndex) { + if (id == _highlightedCommandIndex) { _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { _vm->_font->setColorMode(id == _selectedActionIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); @@ -345,7 +345,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { case CAT_INV_LIST: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(id)._descId; - if (id == _v1C) { + if (id == _highlightedItemIndex) { _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); @@ -386,7 +386,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { // Item specific verbs font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(_selectedInvIndex)._vocabList[id]._vocabId; - if (id == _v1E) { + if (id == _highlightedActionIndex) { _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); @@ -418,12 +418,12 @@ void UserInterface::loadElements() { } // Set up actions - _categoryIndexes[CAT_ACTION - 1] = _vm->_game->_screenObjects.size() + 1; + _categoryIndexes[CAT_COMMAND - 1] = _vm->_game->_screenObjects.size() + 1; for (int idx = 0; idx < 10; ++idx) { - getBounds(CAT_ACTION, idx, bounds); + getBounds(CAT_COMMAND, idx, bounds); moveRect(bounds); - _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_ACTION, idx); + _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_COMMAND, idx); } // Set up inventory list @@ -478,7 +478,7 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) int leftStart, yOffset, widthAmt; switch (category) { - case CAT_ACTION: + case CAT_COMMAND: heightMultiplier = v % 5; widthMultiplier = v / 5; leftStart = 2; @@ -635,7 +635,7 @@ void UserInterface::inventoryAnim() { } void UserInterface::categoryChanged() { - _v1C = -1; + _highlightedItemIndex = -1; _vm->_events->initVars(); _category = CAT_NONE; } diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index ee5bc7aa0d..740ea66c4e 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -143,9 +143,9 @@ public: int _selectedActionIndex; int _selectedItemVocabIdx; int _scrollerY; + int _highlightedCommandIndex; + int _highlightedItemIndex; int _highlightedActionIndex; - int _v1C; - int _v1E; bool _inventoryChanged; int _categoryIndexes[8]; Common::StringArray _talkStrings; |