From 8cac11d25df4462080f2edc39a47aa54e8241dbc Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Mon, 3 Oct 2022 18:59:07 +0300 Subject: [PATCH] Match CScriptSpecialFunction::DeleteEmitter Former-commit-id: e48f6478f9013986c63a1e78fffb6ea91ba72288 --- include/Kyoto/Audio/CSfxHandle.hpp | 1 + .../ScriptObjects/CScriptSpecialFunction.hpp | 2 +- .../ScriptObjects/CScriptSpecialFunction.cpp | 9 ++++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/Kyoto/Audio/CSfxHandle.hpp b/include/Kyoto/Audio/CSfxHandle.hpp index 3ad4e7f3..e1b387b3 100644 --- a/include/Kyoto/Audio/CSfxHandle.hpp +++ b/include/Kyoto/Audio/CSfxHandle.hpp @@ -14,6 +14,7 @@ public: bool operator==(const CSfxHandle& other) { return mID == other.mID; } bool operator!=(const CSfxHandle& other) { return mID != other.mID; } operator bool() const { return mID != 0; } + void Clear() { mID = 0; } private: uint mID; diff --git a/include/MetroidPrime/ScriptObjects/CScriptSpecialFunction.hpp b/include/MetroidPrime/ScriptObjects/CScriptSpecialFunction.hpp index f25dfc99..a27aa318 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptSpecialFunction.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptSpecialFunction.hpp @@ -141,7 +141,7 @@ public: bool ShouldSkipCinematic(CStateManager& stateMgr) const; - void DeleteEmitter(const CSfxHandle& handle); + void DeleteEmitter(CSfxHandle& handle); u32 GetSpecialEnding(const CStateManager&) const; void AddOrUpdateEmitter(float pitch, CSfxHandle& handle, u16 id, const CVector3f& pos, uchar vol); }; diff --git a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp index f7e826cc..58819824 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp @@ -1078,12 +1078,11 @@ void CScriptSpecialFunction::ThinkPlayerInArea(float dt, CStateManager& mgr) { } } -void CScriptSpecialFunction::DeleteEmitter(const CSfxHandle& handle) { - if (!handle) { - return; +void CScriptSpecialFunction::DeleteEmitter(CSfxHandle& handle) { + if (handle) { + CSfxManager::RemoveEmitter(handle); + handle.Clear(); } - - CSfxManager::RemoveEmitter(handle); } u32 CScriptSpecialFunction::GetSpecialEnding(const CStateManager& mgr) const {