From 9df4bc202970f5b9025adc088132f9605e7a612c Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 30 Jun 2019 22:48:33 +0200 Subject: PreTerminateGameSpecificShutdown --- src/audio/AudioManager.cpp | 34 ++++++++++++++++++++++++++++++++++ src/audio/AudioManager.h | 1 + 2 files changed, 35 insertions(+) (limited to 'src') diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 0a87d0e9..45ac73c1 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -9,6 +9,39 @@ cAudioManager &AudioManager = *(cAudioManager *)0x880FC0; +void +cAudioManager::PreTerminateGameSpecificShutdown() +{ + if(m_nBridgeEntity >= 0) { + DestroyEntity(m_nBridgeEntity); + m_nBridgeEntity = -5; + } + if(m_nPoliceChannelEntity >= 0) { + DestroyEntity(m_nPoliceChannelEntity); + m_nPoliceChannelEntity = -5; + } + if(m_nWaterCannonEntity >= 0) { + DestroyEntity(m_nWaterCannonEntity); + m_nWaterCannonEntity = -5; + } + if(m_nFireAudioEntity >= 0) { + DestroyEntity(m_nFireAudioEntity); + m_nFireAudioEntity = -5; + } + if(m_nCollisionEntity >= 0) { + DestroyEntity(m_nCollisionEntity); + m_nCollisionEntity = -5; + } + if(m_nFrontEndEntity >= 0) { + DestroyEntity(m_nFrontEndEntity); + m_nFrontEndEntity = -5; + } + if(m_nProjectileEntity >= 0) { + DestroyEntity(m_nProjectileEntity); + m_nProjectileEntity = -5; + } +} + void cAudioManager::DestroyEntity(int32 id) { @@ -2723,6 +2756,7 @@ cAudioManager::Service() } STARTPATCHES +InjectHook(0x569570, &cAudioManager::PreTerminateGameSpecificShutdown, PATCH_JUMP); InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP); InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP); InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP); diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index f270ada6..8d01e1eb 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -216,6 +216,7 @@ public: char field_19195; int m_nTimeOfRecentCrime; + void PreTerminateGameSpecificShutdown(); void DestroyEntity(int32 id); void PostTerminateGameSpecificShutdown(); bool IsAudioInitialised() const; -- cgit v1.2.3