diff options
author | Marisa-Chan | 2013-10-30 07:51:05 +0000 |
---|---|---|
committer | Marisa-Chan | 2013-10-30 07:51:05 +0000 |
commit | fa74bcc4d50c746c3f06b156200a064a11369baa (patch) | |
tree | 302b328c37412a4e66c723c6e9988ee24ee137c1 | |
parent | 41088f5516ba9566dcd558a103216c3798bcf9d4 (diff) | |
download | scummvm-rg350-fa74bcc4d50c746c3f06b156200a064a11369baa.tar.gz scummvm-rg350-fa74bcc4d50c746c3f06b156200a064a11369baa.tar.bz2 scummvm-rg350-fa74bcc4d50c746c3f06b156200a064a11369baa.zip |
ZVISION: Add to sidefx and scriptManager classes stop and kill methods
-rw-r--r-- | engines/zvision/script_manager.cpp | 46 | ||||
-rw-r--r-- | engines/zvision/script_manager.h | 4 | ||||
-rw-r--r-- | engines/zvision/sidefx.h | 5 |
3 files changed, 55 insertions, 0 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 3054466cd0..111865302a 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -336,6 +336,52 @@ SideFX *ScriptManager::getSideFX(uint32 key) { return nullptr; } +void ScriptManager::deleteSideFx(uint32 key) { + for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end(); ++iter) { + if ((*iter)->getKey() == key) { + delete(*iter); + _activeSideFx.erase(iter); + break; + } + } +} + +void ScriptManager::stopSideFx(uint32 key) { + for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end(); ++iter) { + if ((*iter)->getKey() == key) { + bool ret = (*iter)->stop(); + if (ret) { + delete(*iter); + _activeSideFx.erase(iter); + } + break; + } + } +} + +void ScriptManager::killSideFx(uint32 key) { + for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end(); ++iter) { + if ((*iter)->getKey() == key) { + (*iter)->kill(); + delete(*iter); + _activeSideFx.erase(iter); + break; + } + } +} + +void ScriptManager::killSideFxType(SideFX::SideFXType type) { + for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end();) { + if ((*iter)->getType() & type) { + (*iter)->kill(); + delete(*iter); + _activeSideFx.erase(iter); + } else { + ++iter; + } + } +} + void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (!_activeControls) return; diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 90df2ccee5..3399484970 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -187,6 +187,10 @@ public: void addSideFX(SideFX *fx); SideFX *getSideFX(uint32 key); + void deleteSideFx(uint32 key); + void stopSideFx(uint32 key); + void killSideFx(uint32 key); + void killSideFxType(SideFX::SideFXType type); /** * Called when LeftMouse is pushed. diff --git a/engines/zvision/sidefx.h b/engines/zvision/sidefx.h index 6f75ad6649..9c18371ef4 100644 --- a/engines/zvision/sidefx.h +++ b/engines/zvision/sidefx.h @@ -88,6 +88,11 @@ public: return false; } + virtual bool stop() { + return true; + } + virtual void kill() {} + protected: ZVision *_engine; uint32 _key; |