aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision
diff options
context:
space:
mode:
authorrichiesams2013-08-18 15:28:16 -0500
committerrichiesams2013-08-18 19:53:03 -0500
commit908e784957ec3cf01bc54a5c76c18f5ed6a8faa6 (patch)
treeefc7eed5c2527af743f70fb522fbc84b338294c3 /engines/zvision
parent3a23873c45f8b274836eacd8d1de471da6defb5b (diff)
downloadscummvm-rg350-908e784957ec3cf01bc54a5c76c18f5ed6a8faa6.tar.gz
scummvm-rg350-908e784957ec3cf01bc54a5c76c18f5ed6a8faa6.tar.bz2
scummvm-rg350-908e784957ec3cf01bc54a5c76c18f5ed6a8faa6.zip
ZVISION: Allow controls to be enabled or disabled
Diffstat (limited to 'engines/zvision')
-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);