diff options
author | Marisa-Chan | 2013-10-18 20:11:33 +0000 |
---|---|---|
committer | Marisa-Chan | 2013-10-18 20:11:33 +0000 |
commit | a6f025c74f7aac95154d56dc23a7b62eca965dd4 (patch) | |
tree | 23baa8feeb1a4b788ba0c61620d7138e10160222 /engines/zvision/script_manager.cpp | |
parent | 82348a74df8edd2f9e628ec939ba515c1703bc70 (diff) | |
download | scummvm-rg350-a6f025c74f7aac95154d56dc23a7b62eca965dd4.tar.gz scummvm-rg350-a6f025c74f7aac95154d56dc23a7b62eca965dd4.tar.bz2 scummvm-rg350-a6f025c74f7aac95154d56dc23a7b62eca965dd4.zip |
ZVISION: Basic integration of SideFX into scriptManager.
Diffstat (limited to 'engines/zvision/script_manager.cpp')
-rw-r--r-- | engines/zvision/script_manager.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 66a54088fd..4b4f1303aa 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -108,6 +108,16 @@ void ScriptManager::createReferenceTable() { } void ScriptManager::updateNodes(uint deltaTimeMillis) { + // If process() returns true, it means the node can be deleted + for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end();) { + if ((*iter)->process(deltaTimeMillis)) { + delete (*iter); + // Remove the node + iter = _activeSideFx.erase(iter); + } else { + ++iter; + } + } // If process() returns true, it means the node can be deleted for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end();) { if ((*iter)->process(deltaTimeMillis)) { @@ -262,7 +272,7 @@ void ScriptManager::disableControl(uint32 key) { void ScriptManager::focusControl(uint32 key) { for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { uint32 controlKey = (*iter)->getKey(); - + if (controlKey == key) { (*iter)->focus(); } else if (controlKey == _currentlyFocusedControl) { @@ -273,6 +283,20 @@ void ScriptManager::focusControl(uint32 key) { _currentlyFocusedControl = key; } +void ScriptManager::addSideFX(SideFX *fx) { + _activeSideFx.push_back(fx); +} + +SideFX *ScriptManager::getSideFX(uint32 key) { + for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end(); ++iter) { + if ((*iter)->getKey() == key) { + return (*iter); + } + } + + return nullptr; +} + void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos); |