diff options
author | Marisa-Chan | 2013-11-15 18:10:27 +0000 |
---|---|---|
committer | Marisa-Chan | 2013-11-15 18:10:27 +0000 |
commit | 468c44581f4a051d435f8574fa4f689b97188ae2 (patch) | |
tree | 2afea2395221a91d887b28798efaec2aba1a3c08 | |
parent | 9363a0d07115368f8964dfca5f48730552ef9855 (diff) | |
download | scummvm-rg350-468c44581f4a051d435f8574fa4f689b97188ae2.tar.gz scummvm-rg350-468c44581f4a051d435f8574fa4f689b97188ae2.tar.bz2 scummvm-rg350-468c44581f4a051d435f8574fa4f689b97188ae2.zip |
ZVISION: MouseUp and MouseDown now will return break process loop flag.
-rw-r--r-- | engines/zvision/control.h | 8 | ||||
-rw-r--r-- | engines/zvision/input_control.cpp | 3 | ||||
-rw-r--r-- | engines/zvision/input_control.h | 2 | ||||
-rw-r--r-- | engines/zvision/lever_control.cpp | 10 | ||||
-rw-r--r-- | engines/zvision/lever_control.h | 4 | ||||
-rw-r--r-- | engines/zvision/push_toggle_control.cpp | 6 | ||||
-rw-r--r-- | engines/zvision/push_toggle_control.h | 2 |
7 files changed, 22 insertions, 13 deletions
diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 32c59d6f27..65d76da5c4 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -54,14 +54,18 @@ public: * @param screenSpacePos The position of the mouse in screen space * @param backgroundImageSpacePos The position of the mouse in background image space */ - virtual void onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {} + virtual bool onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + return false; + } /** * Called when LeftMouse is lifted. Default is NOP. * * @param screenSpacePos The position of the mouse in screen space * @param backgroundImageSpacePos The position of the mouse in background image space */ - virtual void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {} + virtual bool onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + return false; + } /** * Called on every MouseMove. Default is NOP. * diff --git a/engines/zvision/input_control.cpp b/engines/zvision/input_control.cpp index 5723a4e4a4..8d9d79ba09 100644 --- a/engines/zvision/input_control.cpp +++ b/engines/zvision/input_control.cpp @@ -93,8 +93,9 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre } } -void InputControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { +bool InputControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { _engine->getScriptManager()->focusControl(_key); + return false; } void InputControl::onKeyDown(Common::KeyState keyState) { diff --git a/engines/zvision/input_control.h b/engines/zvision/input_control.h index 3d7db747d7..0179bd9006 100644 --- a/engines/zvision/input_control.h +++ b/engines/zvision/input_control.h @@ -54,7 +54,7 @@ public: void unfocus() { _focused = false; } - void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + bool onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); void onKeyDown(Common::KeyState keyState); bool process(uint32 deltaTimeInMillis); }; diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index bd2c186ffe..6d13d60b3e 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -190,19 +190,20 @@ void LeverControl::parseLevFile(const Common::String &fileName) { } } -void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { +bool LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) - return; + return false; if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { _mouseIsCaptured = true; _lastMousePos = backgroundImageSpacePos; } + return false; } -void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { +bool LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) - return; + return false; if (_mouseIsCaptured) { _mouseIsCaptured = false; @@ -212,6 +213,7 @@ void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common:: _returnRoutesCurrentProgress = _frameInfo[_currentFrame].returnRoute.begin(); _returnRoutesCurrentFrame = _currentFrame; } + return false; } bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h index 94d23c1f95..19ecc7b9ac 100644 --- a/engines/zvision/lever_control.h +++ b/engines/zvision/lever_control.h @@ -88,8 +88,8 @@ private: uint32 _accumulatedTime; public: - void onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); - void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + bool onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + bool onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); bool process(uint32 deltaTimeInMillis); diff --git a/engines/zvision/push_toggle_control.cpp b/engines/zvision/push_toggle_control.cpp index 2cea5db2d2..88619e8f97 100644 --- a/engines/zvision/push_toggle_control.cpp +++ b/engines/zvision/push_toggle_control.cpp @@ -72,13 +72,15 @@ PushToggleControl::~PushToggleControl() { _engine->getScriptManager()->setStateValue(_key, 0); } -void PushToggleControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { +bool PushToggleControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) - return; + return false; if (_hotspot.contains(backgroundImageSpacePos)) { _engine->getScriptManager()->setStateValue(_key, 1); + return true; } + return false; } bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { diff --git a/engines/zvision/push_toggle_control.h b/engines/zvision/push_toggle_control.h index 2a407cada9..1de279aa08 100644 --- a/engines/zvision/push_toggle_control.h +++ b/engines/zvision/push_toggle_control.h @@ -41,7 +41,7 @@ public: * @param screenSpacePos The position of the mouse in screen space * @param backgroundImageSpacePos The position of the mouse in background image space */ - void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + bool onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); /** * Called on every MouseMove. Tests if the mouse is inside _hotspot, and if so, sets the cursor. * |