aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/zvision/scripting/control.h4
-rw-r--r--engines/zvision/scripting/controls/input_control.cpp5
-rw-r--r--engines/zvision/scripting/controls/input_control.h2
-rw-r--r--engines/zvision/scripting/script_manager.cpp6
4 files changed, 10 insertions, 7 deletions
diff --git a/engines/zvision/scripting/control.h b/engines/zvision/scripting/control.h
index 6ec47c6455..ac245054ee 100644
--- a/engines/zvision/scripting/control.h
+++ b/engines/zvision/scripting/control.h
@@ -101,13 +101,13 @@ public:
*
* @param keycode The key that was pressed
*/
- virtual void onKeyDown(Common::KeyState keyState) {}
+ virtual bool onKeyDown(Common::KeyState keyState) {return false;}
/**
* Called when a key is released. Default is NOP.
*
* @param keycode The key that was pressed
*/
- virtual void onKeyUp(Common::KeyState keyState) {}
+ virtual bool onKeyUp(Common::KeyState keyState) {return false;}
/**
* Processes the node given the deltaTime since last frame. Default is NOP.
*
diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp
index 0bca01bf47..bebf3fae11 100644
--- a/engines/zvision/scripting/controls/input_control.cpp
+++ b/engines/zvision/scripting/controls/input_control.cpp
@@ -98,9 +98,9 @@ bool InputControl::onMouseUp(const Common::Point &screenSpacePos, const Common::
return false;
}
-void InputControl::onKeyDown(Common::KeyState keyState) {
+bool InputControl::onKeyDown(Common::KeyState keyState) {
if (!_focused) {
- return;
+ return false;
}
if (keyState.keycode == Common::KEYCODE_BACKSPACE) {
@@ -119,6 +119,7 @@ void InputControl::onKeyDown(Common::KeyState keyState) {
_textChanged = true;
}
}
+ return false;
}
bool InputControl::process(uint32 deltaTimeInMillis) {
diff --git a/engines/zvision/scripting/controls/input_control.h b/engines/zvision/scripting/controls/input_control.h
index 6fcdb2ca54..91fcd364cd 100644
--- a/engines/zvision/scripting/controls/input_control.h
+++ b/engines/zvision/scripting/controls/input_control.h
@@ -55,7 +55,7 @@ public:
_focused = false;
}
bool onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos);
- void onKeyDown(Common::KeyState keyState);
+ bool onKeyDown(Common::KeyState keyState);
bool process(uint32 deltaTimeInMillis);
};
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index ada06a5b51..53fa5832d9 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -471,7 +471,8 @@ void ScriptManager::onKeyDown(Common::KeyState keyState) {
if (!_activeControls)
return;
for (ControlList::iterator iter = _activeControls->begin(); iter != _activeControls->end(); ++iter) {
- (*iter)->onKeyDown(keyState);
+ if ((*iter)->onKeyDown(keyState))
+ return;
}
}
@@ -479,7 +480,8 @@ void ScriptManager::onKeyUp(Common::KeyState keyState) {
if (!_activeControls)
return;
for (ControlList::iterator iter = _activeControls->begin(); iter != _activeControls->end(); ++iter) {
- (*iter)->onKeyUp(keyState);
+ if ((*iter)->onKeyUp(keyState))
+ return;
}
}