aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarisa-Chan2013-10-25 15:39:38 +0700
committerMarisa-Chan2013-10-25 15:39:38 +0700
commit8e4070c68b9a6a5e81d80f6805a199c2872089fe (patch)
treedef251cc737c381df5284c6bcd8d4bd1fb3efa21
parent91cbb1ec790a604309c766ef38f6a2704922365b (diff)
downloadscummvm-rg350-8e4070c68b9a6a5e81d80f6805a199c2872089fe.tar.gz
scummvm-rg350-8e4070c68b9a6a5e81d80f6805a199c2872089fe.tar.bz2
scummvm-rg350-8e4070c68b9a6a5e81d80f6805a199c2872089fe.zip
ZVISION: Added global StateFlags and set/get/unset functions.
-rw-r--r--engines/zvision/script_manager.cpp24
-rw-r--r--engines/zvision/script_manager.h6
2 files changed, 30 insertions, 0 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp
index 7531182e95..01a6e6d09e 100644
--- a/engines/zvision/script_manager.cpp
+++ b/engines/zvision/script_manager.cpp
@@ -253,6 +253,30 @@ void ScriptManager::setStateValue(uint32 key, uint value) {
queuePuzzles(key);
}
+uint ScriptManager::getStateFlag(uint32 key) {
+ if (_globalStateFlags.contains(key))
+ return _globalStateFlags[key];
+ else
+ return 0;
+}
+
+void ScriptManager::setStateFlag(uint32 key, uint value) {
+ queuePuzzles(key);
+
+ _globalStateFlags[key] |= value;
+}
+
+void ScriptManager::unsetStateFlag(uint32 key, uint value) {
+ queuePuzzles(key);
+
+ if (_globalStateFlags.contains(key)) {
+ _globalStateFlags[key] &= ~value;
+
+ if (_globalStateFlags[key] == 0)
+ _globalStateFlags.erase(key);
+ }
+}
+
void ScriptManager::addToStateValue(uint32 key, uint valueToAdd) {
_globalState[key] += valueToAdd;
}
diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h
index a5324533c0..71fefaf41f 100644
--- a/engines/zvision/script_manager.h
+++ b/engines/zvision/script_manager.h
@@ -143,6 +143,8 @@ private:
* particular state key are checked after the key is modified.
*/
StateMap _globalState;
+ /** Holds execute flags */
+ StateMap _globalStateFlags;
/** References _globalState keys to Puzzles */
PuzzleMap _referenceTable;
/** Holds the Puzzles that should be checked this frame */
@@ -169,6 +171,10 @@ public:
void setStateValue(uint32 key, uint value);
void addToStateValue(uint32 key, uint valueToAdd);
+ uint getStateFlag(uint32 key);
+ void setStateFlag(uint32 key, uint value);
+ void unsetStateFlag(uint32 key, uint value);
+
void addControl(Control *control);
Control *getControl(uint32 key);