summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2019-06-30 22:44:43 +0200
committerFilip Gawin <filip.gawin@zoho.com>2019-07-04 01:02:00 +0200
commit1abd6941074b9f0ca74c8f0f5ef11b04291b0902 (patch)
tree51e7039b7495395f8bd0c4b2a5d8fd2b8c0871e8 /src/audio
parentPostTerminateGameSpecificShutdown (diff)
downloadre3-1abd6941074b9f0ca74c8f0f5ef11b04291b0902.tar
re3-1abd6941074b9f0ca74c8f0f5ef11b04291b0902.tar.gz
re3-1abd6941074b9f0ca74c8f0f5ef11b04291b0902.tar.bz2
re3-1abd6941074b9f0ca74c8f0f5ef11b04291b0902.tar.lz
re3-1abd6941074b9f0ca74c8f0f5ef11b04291b0902.tar.xz
re3-1abd6941074b9f0ca74c8f0f5ef11b04291b0902.tar.zst
re3-1abd6941074b9f0ca74c8f0f5ef11b04291b0902.zip
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioManager.cpp19
-rw-r--r--src/audio/AudioManager.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index e82c2302..0a87d0e9 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -10,6 +10,24 @@
cAudioManager &AudioManager = *(cAudioManager *)0x880FC0;
void
+cAudioManager::DestroyEntity(int32 id)
+{
+ if(m_bIsInitialised && id >= 0 && id < 200 && m_asAudioEntities[id].m_bIsUsed) {
+ m_asAudioEntities[id].m_bIsUsed = 0;
+ for(i = 0; i < m_nAudioEntitiesTotal; ++i) {
+ if(id == m_anAudioEntityIndices[i]) {
+ if(i < 199)
+ memmove(&m_anAudioEntityIndices[i],
+ &m_anAudioEntityIndices[i + 1],
+ 4 * (m_nAudioEntitiesTotal - (i + 1)));
+ m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = 200;
+ return;
+ }
+ }
+ }
+}
+
+void
cAudioManager::PostTerminateGameSpecificShutdown()
{
;
@@ -2705,6 +2723,7 @@ cAudioManager::Service()
}
STARTPATCHES
+InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP);
InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP);
InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP);
InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP);
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index faae3305..f270ada6 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -216,6 +216,7 @@ public:
char field_19195;
int m_nTimeOfRecentCrime;
+ void DestroyEntity(int32 id);
void PostTerminateGameSpecificShutdown();
bool IsAudioInitialised() const;
void SetDynamicAcousticModelingStatus(bool status);