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 "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
@ -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
cAudioManager::PostTerminateGameSpecificShutdown()
{
;
}
bool
cAudioManager::IsAudioInitialised() const
{
return m_bIsInitialised;
}
void cAudioManager::SetDynamicAcousticModelingStatus(bool status)
{
m_bDynamicAcousticModelingStatus = status;
}
void
cAudioManager::GenerateIntegerRandomNumberTable()
{

View File

@ -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);

View File

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

View File

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