ReleaseDigitalHandle

This commit is contained in:
Filip Gawin 2019-06-30 23:58:24 +02:00
parent e589589538
commit 9357e5cc83
4 changed files with 69 additions and 49 deletions

View File

@ -3,6 +3,7 @@
#include "ModelIndices.h" #include "ModelIndices.h"
#include "Ped.h" #include "Ped.h"
#include "PlayerPed.h" #include "PlayerPed.h"
#include "SampleManager.h"
#include "World.h" #include "World.h"
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
@ -12,44 +13,20 @@ cAudioManager &AudioManager = *(cAudioManager *)0x880FC0;
constexpr int totalAudioEntitiesSlots = 200; constexpr int totalAudioEntitiesSlots = 200;
void void
cAudioManager::SetEntityStatus(int32 id, bool status) cAudioManager::ReleaseDigitalHandle()
{ {
if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots) { if(m_bIsInitialised) { cSampleManager.ReleaseDigitalHandle(); }
if(m_asAudioEntities[id].m_bIsUsed) { m_asAudioEntities[id].m_bStatus = status; }
}
} }
void void cAudioManager::SetDynamicAcousticModelingStatus(bool status)
cAudioManager::PreTerminateGameSpecificShutdown()
{ {
if(m_nBridgeEntity >= 0) { m_bDynamicAcousticModelingStatus = status;
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;
} }
bool
cAudioManager::IsAudioInitialised() const
{
return m_bIsInitialised;
} }
int32 int32
@ -96,23 +73,53 @@ cAudioManager::DestroyEntity(int32 id)
} }
} }
void
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; }
}
}
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::PostTerminateGameSpecificShutdown() cAudioManager::PostTerminateGameSpecificShutdown()
{ {
; ;
} }
bool
cAudioManager::IsAudioInitialised() const
{
return m_bIsInitialised;
}
void cAudioManager::SetDynamicAcousticModelingStatus(bool status)
{
m_bDynamicAcousticModelingStatus = status;
}
void void
cAudioManager::GenerateIntegerRandomNumberTable() cAudioManager::GenerateIntegerRandomNumberTable()
{ {

View File

@ -216,17 +216,23 @@ public:
char field_19195; char field_19195;
int m_nTimeOfRecentCrime; int m_nTimeOfRecentCrime;
void SetEntityStatus(int32 id, bool status); void ReleaseDigitalHandle();
void PreTerminateGameSpecificShutdown(); void SetDynamicAcousticModelingStatus(bool status);
bool IsAudioInitialised() const;
int32 CreateEntity(int32 type, void *memory); int32 CreateEntity(int32 type, void *memory);
void DestroyEntity(int32 id); void DestroyEntity(int32 id);
void SetEntityStatus(int32 id, bool status);
void PreTerminateGameSpecificShutdown();
void PostTerminateGameSpecificShutdown(); void PostTerminateGameSpecificShutdown();
bool IsAudioInitialised() const;
void SetDynamicAcousticModelingStatus(bool status);
void GenerateIntegerRandomNumberTable(); void GenerateIntegerRandomNumberTable();
void PlayerJustGotInCar(); void PlayerJustGotInCar();
void PlayerJustLeftCar(); void PlayerJustLeftCar();
void Service(); void Service();
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample,
uint32 maxOffset); uint32 maxOffset);

View File

@ -7,3 +7,9 @@ uint32 &CSampleManager::nNumOfMp3Files = *(uint32*)0x95CC00;
bool CSampleManager::IsMP3RadioChannelAvailable() { bool CSampleManager::IsMP3RadioChannelAvailable() {
return nNumOfMp3Files != 0; return nNumOfMp3Files != 0;
} }
WRAPPER void
CSampleManager::ReleaseDigitalHandle()
{
EAXJMP(0x5664B0);
}

View File

@ -5,6 +5,7 @@ public:
static uint32 &nNumOfMp3Files; static uint32 &nNumOfMp3Files;
public: public:
void ReleaseDigitalHandle();
static bool IsMP3RadioChannelAvailable(); static bool IsMP3RadioChannelAvailable();
}; };