From 9357e5cc83f0a0df1fa259d3194a0b13cbfb374f Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 30 Jun 2019 23:58:24 +0200 Subject: ReleaseDigitalHandle --- src/audio/AudioManager.cpp | 89 ++++++++++++++++++++++++--------------------- src/audio/AudioManager.h | 14 +++++-- src/audio/SampleManager.cpp | 6 +++ src/audio/SampleManager.h | 1 + 4 files changed, 65 insertions(+), 45 deletions(-) diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index acf17afe..89d8332a 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -3,6 +3,7 @@ #include "ModelIndices.h" #include "Ped.h" #include "PlayerPed.h" +#include "SampleManager.h" #include "World.h" #include "common.h" #include "patcher.h" @@ -12,44 +13,20 @@ cAudioManager &AudioManager = *(cAudioManager *)0x880FC0; constexpr int totalAudioEntitiesSlots = 200; void -cAudioManager::SetEntityStatus(int32 id, bool status) +cAudioManager::ReleaseDigitalHandle() { - if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots) { - if(m_asAudioEntities[id].m_bIsUsed) { m_asAudioEntities[id].m_bStatus = status; } - } + if(m_bIsInitialised) { cSampleManager.ReleaseDigitalHandle(); } } -void -cAudioManager::PreTerminateGameSpecificShutdown() +void cAudioManager::SetDynamicAcousticModelingStatus(bool status) { - 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; - } + m_bDynamicAcousticModelingStatus = status; +} + +bool +cAudioManager::IsAudioInitialised() const +{ + return m_bIsInitialised; } int32 @@ -97,20 +74,50 @@ cAudioManager::DestroyEntity(int32 id) } void -cAudioManager::PostTerminateGameSpecificShutdown() +cAudioManager::SetEntityStatus(int32 id, bool status) { - ; + if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots) { + if(m_asAudioEntities[id].m_bIsUsed) { m_asAudioEntities[id].m_bStatus = status; } + } } -bool -cAudioManager::IsAudioInitialised() const +void +cAudioManager::PreTerminateGameSpecificShutdown() { - return m_bIsInitialised; + 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::SetDynamicAcousticModelingStatus(bool status) +void +cAudioManager::PostTerminateGameSpecificShutdown() { - m_bDynamicAcousticModelingStatus = status; + ; } void diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index df48475f..9cbb82b4 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -216,17 +216,23 @@ public: char field_19195; int m_nTimeOfRecentCrime; - void SetEntityStatus(int32 id, bool status); - void PreTerminateGameSpecificShutdown(); + void ReleaseDigitalHandle(); + void SetDynamicAcousticModelingStatus(bool status); + + bool IsAudioInitialised() const; + int32 CreateEntity(int32 type, void *memory); void DestroyEntity(int32 id); + void SetEntityStatus(int32 id, bool status); + + void PreTerminateGameSpecificShutdown(); void PostTerminateGameSpecificShutdown(); - bool IsAudioInitialised() const; - void SetDynamicAcousticModelingStatus(bool status); + void GenerateIntegerRandomNumberTable(); void PlayerJustGotInCar(); void PlayerJustLeftCar(); + void Service(); void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset); diff --git a/src/audio/SampleManager.cpp b/src/audio/SampleManager.cpp index 2319baec..2f27a3fa 100644 --- a/src/audio/SampleManager.cpp +++ b/src/audio/SampleManager.cpp @@ -7,3 +7,9 @@ uint32 &CSampleManager::nNumOfMp3Files = *(uint32*)0x95CC00; bool CSampleManager::IsMP3RadioChannelAvailable() { return nNumOfMp3Files != 0; } + +WRAPPER void +CSampleManager::ReleaseDigitalHandle() +{ + EAXJMP(0x5664B0); +} diff --git a/src/audio/SampleManager.h b/src/audio/SampleManager.h index ae036947..8486cb52 100644 --- a/src/audio/SampleManager.h +++ b/src/audio/SampleManager.h @@ -5,6 +5,7 @@ public: static uint32 &nNumOfMp3Files; public: + void ReleaseDigitalHandle(); static bool IsMP3RadioChannelAvailable(); }; -- cgit v1.2.3