DestroyEntity

This commit is contained in:
Filip Gawin 2019-06-30 22:44:43 +02:00
parent bd23f2c425
commit 1abd694107
2 changed files with 20 additions and 0 deletions

View File

@ -9,6 +9,24 @@
cAudioManager &AudioManager = *(cAudioManager *)0x880FC0; cAudioManager &AudioManager = *(cAudioManager *)0x880FC0;
void
cAudioManager::DestroyEntity(int32 id)
{
if(m_bIsInitialised && id >= 0 && id < 200 && m_asAudioEntities[id].m_bIsUsed) {
m_asAudioEntities[id].m_bIsUsed = 0;
for(i = 0; i < m_nAudioEntitiesTotal; ++i) {
if(id == m_anAudioEntityIndices[i]) {
if(i < 199)
memmove(&m_anAudioEntityIndices[i],
&m_anAudioEntityIndices[i + 1],
4 * (m_nAudioEntitiesTotal - (i + 1)));
m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = 200;
return;
}
}
}
}
void void
cAudioManager::PostTerminateGameSpecificShutdown() cAudioManager::PostTerminateGameSpecificShutdown()
{ {
@ -2705,6 +2723,7 @@ cAudioManager::Service()
} }
STARTPATCHES STARTPATCHES
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);
InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP); InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP);

View File

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