aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/control.h9
-rw-r--r--engines/zvision/script_manager.cpp21
-rw-r--r--engines/zvision/script_manager.h3
3 files changed, 31 insertions, 2 deletions
diff --git a/engines/zvision/control.h b/engines/zvision/control.h
index 2d5426c0c4..b374383a45 100644
--- a/engines/zvision/control.h
+++ b/engines/zvision/control.h
@@ -35,11 +35,16 @@ class ZVision;
class Control {
public:
+ Control() : _key(0), _enabled(false) {}
virtual ~Control() {}
- virtual bool execute(ZVision *engine) = 0;
+ virtual bool enable(ZVision *engine) = 0;
+ virtual bool disable(ZVision *engine) { return true; }
+
+public:
+ uint32 _key;
protected:
- uint32 key;
+ bool _enabled;
// Static member functions
public:
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp
index 8a1d1c98ed..13f30ca0d2 100644
--- a/engines/zvision/script_manager.cpp
+++ b/engines/zvision/script_manager.cpp
@@ -185,6 +185,22 @@ void ScriptManager::addToStateValue(uint32 key, uint valueToAdd) {
_globalState[key] += valueToAdd;
}
+bool ScriptManager::enableControl(uint32 key) {
+ if (!_activeControls.contains(key)) {
+ return false;
+ } else {
+ return _activeControls[key]->enable(_engine);
+ }
+}
+
+bool ScriptManager::disableControl(uint32 key) {
+ if (!_activeControls.contains(key)) {
+ return false;
+ } else {
+ return _activeControls[key]->disable(_engine);
+ }
+}
+
void ScriptManager::addActionNode(const Common::SharedPtr<ActionNode> &node) {
_activeNodes.push_back(node);
}
@@ -225,6 +241,11 @@ void ScriptManager::changeLocationIntern() {
_engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset);
// Add all the local puzzles to the stack to be checked
+ // Enable all the controls
+ for (Common::HashMap<uint32, Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
+ (*iter)._value->enable(_engine);
+ }
+
for (Common::List<Puzzle>::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) {
// Reset any Puzzles that have the flag ONCE_PER_INST
if ((*iter).flags & Puzzle::ONCE_PER_INST == Puzzle::ONCE_PER_INST) {
diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h
index 3d64727506..7012ee0c5e 100644
--- a/engines/zvision/script_manager.h
+++ b/engines/zvision/script_manager.h
@@ -84,6 +84,9 @@ public:
void setStateValue(uint32 key, uint value);
void addToStateValue(uint32 key, uint valueToAdd);
+ bool enableControl(uint32 key);
+ bool disableControl(uint32 key);
+
void addActionNode(const Common::SharedPtr<ActionNode> &node);
void changeLocation(char world, char room, char node, char view, uint32 offset);