diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 7531182e95e6..01a6e6d09e43 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 a5324533c066..71fefaf41f0a 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -143,6 +143,8 @@ class ScriptManager { * 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 @@ class ScriptManager { 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);