From 51a342b9ecc4282837f974a7bf06374a4de2680e Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 5 Aug 2017 14:01:11 +0200 Subject: MOHAWK: Riven: Make sure to update the cursor when entering a card --- engines/mohawk/riven.cpp | 2 +- engines/mohawk/riven_stack.cpp | 10 ++++++++++ engines/mohawk/riven_stack.h | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 59a41f5258..4d4f54c240 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -412,7 +412,7 @@ void MohawkEngine_Riven::changeToCard(uint16 dest) { _card->enter(true); // Now we need to redraw the cursor if necessary and handle mouse over scripts - _stack->onMouseMove(_stack->getMousePosition()); + _stack->queueMouseCursorRefresh(); // Finally, install any hardcoded timer _stack->installCardTimer(); diff --git a/engines/mohawk/riven_stack.cpp b/engines/mohawk/riven_stack.cpp index 2e1fd69082..847a98f5ab 100644 --- a/engines/mohawk/riven_stack.cpp +++ b/engines/mohawk/riven_stack.cpp @@ -40,6 +40,7 @@ RivenStack::RivenStack(MohawkEngine_Riven *vm, uint16 id) : _vm(vm), _id(id), _mouseIsDown(false), + _shouldRefreshMouseCursor(false), _keyPressed(Common::KEYCODE_INVALID) { removeTimer(); @@ -275,6 +276,10 @@ void RivenStack::mouseForceUp() { _mouseIsDown = false; } +void RivenStack::queueMouseCursorRefresh() { + _shouldRefreshMouseCursor = true; +} + void RivenStack::onFrame() { if (!_vm->getCard() || _vm->_scriptMan->hasQueuedScripts()) { return; @@ -284,6 +289,11 @@ void RivenStack::onFrame() { _vm->_gfx->updateEffects(); + if (_shouldRefreshMouseCursor) { + _vm->getCard()->onMouseMove(getMousePosition()); + _shouldRefreshMouseCursor = false; + } + RivenScriptPtr script(new RivenScript()); if (_mouseIsDown) { script += _vm->getCard()->onMouseDragUpdate(); diff --git a/engines/mohawk/riven_stack.h b/engines/mohawk/riven_stack.h index 429169b960..740dff8adc 100644 --- a/engines/mohawk/riven_stack.h +++ b/engines/mohawk/riven_stack.h @@ -129,6 +129,13 @@ public: /** Handle a mouse move event */ void onMouseMove(const Common::Point &mouse); + /** + * The mouse cursor needs to be refreshed on the next interactive frame + * + * Even if the mouse didn't move. + */ + void queueMouseCursorRefresh(); + /** Frame update handler */ void onFrame(); @@ -208,6 +215,7 @@ private: bool _mouseIsDown; Common::Point _mousePosition; Common::Point _mouseDragStartPosition; + bool _shouldRefreshMouseCursor; // Timer Common::SharedPtr _timerProc; -- cgit v1.2.3