diff options
-rw-r--r-- | engines/mads/action.cpp | 18 | ||||
-rw-r--r-- | engines/mads/action.h | 1 | ||||
-rw-r--r-- | engines/mads/events.cpp | 26 | ||||
-rw-r--r-- | engines/mads/events.h | 2 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 3 | ||||
-rw-r--r-- | engines/mads/screen.cpp | 4 |
6 files changed, 32 insertions, 22 deletions
diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index ca29527748..c13f65a96c 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -31,7 +31,6 @@ namespace MADS { MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { clear(); - _currentAction = VERB_NONE; _startWalkFlag = false; _statusTextIndex = -1; _selectedAction = 0; @@ -124,18 +123,18 @@ void MADSAction::set() { if (_selectedRow >= 0) { if (_actionMode == ACTIONMODE_VERB) { // Standard verb action - _currentAction = scene._verbList[_selectedRow]._id; + _action._verbId = scene._verbList[_selectedRow]._id; } else { // Selected action on an inventory object int invIndex = userInterface._selectedInvIndex; InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex); - _currentAction = objEntry._vocabList[_selectedRow]._vocabId; + _action._verbId = objEntry._vocabList[_selectedRow]._vocabId; } appendVocab(_action._verbId, true); - if (_currentAction == VERB_LOOK) { + if (_action._verbId == VERB_LOOK) { // Add in the word 'add' _statusText += kAtStr; _statusText += " "; @@ -164,11 +163,11 @@ void MADSAction::set() { if (verbId > 0) { // Set the specified action - _currentAction = verbId; - appendVocab(_currentAction, true); + _action._verbId = verbId; + appendVocab(_action._verbId, true); } else { // Default to a standard 'walk to' - _currentAction = VERB_WALKTO; + _action._verbId = VERB_WALKTO; _statusText += kWalkToStr; } } @@ -558,8 +557,11 @@ void MADSAction::leftClick() { _v86F4C = -1; _v86F4E = 0; - if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) + if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) { scene._customDest = _vm->_events->currentPos() + scene._posAdjust; + _selectedAction = -1; + _v86F4A = -1; + } break; case CAT_TALK_ENTRY: diff --git a/engines/mads/action.h b/engines/mads/action.h index 802dfb0576..26ab062673 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -78,7 +78,6 @@ private: void checkCustomDest(int v); public: ActionDetails _action, _activeAction; - int _currentAction; int8 _flags1, _flags2; ActionMode _actionMode; ActionMode2 _actionMode2; diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index a4e1a96a5a..4b143ec0e2 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -128,6 +128,7 @@ void EventsManager::pollEvents() { case Common::EVENT_RBUTTONDOWN: _mouseClicked = true; _mouseButtons = 1; + _mouseMoved = true; return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: @@ -176,9 +177,27 @@ void EventsManager::delay(int cycles) { } void EventsManager::waitForNextFrame() { + _mouseClicked = false; + _mouseReleased = false; + _mouseButtons = 0; + + bool mouseClicked = false; + bool mouseReleased = false; + int mouseButtons = 0; + uint32 frameCtr = getFrameCounter(); - while (!_vm->shouldQuit() && frameCtr == _frameCounter) + while (!_vm->shouldQuit() && frameCtr == _frameCounter) { delay(1); + + mouseClicked |= _mouseClicked; + mouseReleased |= _mouseReleased; + mouseButtons |= _mouseButtons; + } + + _mouseClicked = mouseClicked; + _mouseReleased = mouseReleased; + _mouseButtons = mouseButtons; + _mouseMoved = _mouseClicked || _mouseReleased; } void EventsManager::initVars() { @@ -187,9 +206,4 @@ void EventsManager::initVars() { _vD2 = _vD8 = 0; } -void EventsManager::resetMouseFlags() { - _mouseClicked = false; - _mouseReleased = false; -} - } // End of namespace MADS diff --git a/engines/mads/events.h b/engines/mads/events.h index b7af148e7e..219af20c2a 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -141,8 +141,6 @@ public: uint32 getFrameCounter() const { return _frameCounter; } void initVars(); - - void resetMouseFlags(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index c90a54c317..f16b2c3889 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -272,9 +272,6 @@ void Scene::loop() { // Handle drawing a game frame doFrame(); - // Reset mouse flags - _vm->_events->resetMouseFlags(); - // TODO: Verify correctness of frame wait _vm->_events->waitForNextFrame(); diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index a2cc75f381..c881e9560e 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -300,7 +300,7 @@ void ScreenObjects::check(bool scanFlag) { // Handling for easy mouse ScrCategory category = scene._userInterface._category; - if (_vm->_easyMouse && !_vm->_events->_vD4 && category != _category + if (_vm->_easyMouse && _vm->_events->_mouseButtons && category != _category && scene._userInterface._category != CAT_NONE) { _released = true; if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { @@ -310,7 +310,7 @@ void ScreenObjects::check(bool scanFlag) { scene._action.checkActionAtMousePos(); } - _released = _vm->_events->_mouseReleased; + //_released = _vm->_events->_mouseReleased; if (_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_vD4)) scene._userInterface._category = _category; |