PreTerminateGameSpecificShutdown

This commit is contained in:
Filip Gawin 2019-06-30 22:48:33 +02:00
parent 1abd694107
commit 9df4bc2029
2 changed files with 35 additions and 0 deletions

View File

@ -9,6 +9,39 @@
cAudioManager &AudioManager = *(cAudioManager *)0x880FC0; 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 void
cAudioManager::DestroyEntity(int32 id) cAudioManager::DestroyEntity(int32 id)
{ {
@ -2723,6 +2756,7 @@ cAudioManager::Service()
} }
STARTPATCHES STARTPATCHES
InjectHook(0x569570, &cAudioManager::PreTerminateGameSpecificShutdown, PATCH_JUMP);
InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP); InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP);
InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP); InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP);
InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP); InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP);

View File

@ -216,6 +216,7 @@ public:
char field_19195; char field_19195;
int m_nTimeOfRecentCrime; int m_nTimeOfRecentCrime;
void PreTerminateGameSpecificShutdown();
void DestroyEntity(int32 id); void DestroyEntity(int32 id);
void PostTerminateGameSpecificShutdown(); void PostTerminateGameSpecificShutdown();
bool IsAudioInitialised() const; bool IsAudioInitialised() const;