diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/zvision/script_manager.cpp | 24 | ||||
-rw-r--r-- | engines/zvision/script_manager.h | 6 |
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); |