RandomDisplacement

This commit is contained in:
Filip Gawin 2019-07-01 16:21:03 +02:00
parent 0ec77e8329
commit d6957aaa57
2 changed files with 21 additions and 0 deletions

View file

@ -12,6 +12,24 @@ cAudioManager &AudioManager = *(cAudioManager *)0x880FC0;
constexpr int totalAudioEntitiesSlots = 200; constexpr int totalAudioEntitiesSlots = 200;
int32
cAudioManager::RandomDisplacement(uint32 seed)
{
int32 value;
static bool bIsEven = true;
static uint8 base = 0;
if(!seed) return 0;
value = m_anRandomTable[(base + seed) % 5] % seed;
base += value;
if(value % 2) { bIsEven = !bIsEven; }
if(!bIsEven) value = -value;
return value;
}
void void
cAudioManager::ReleaseDigitalHandle() cAudioManager::ReleaseDigitalHandle()
{ {
@ -2814,6 +2832,7 @@ cAudioManager::Service()
} }
STARTPATCHES STARTPATCHES
InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP);
InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP); InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP);
InjectHook(0x57A9F0, &cAudioManager::RequireDigitalHandle, PATCH_JUMP); InjectHook(0x57A9F0, &cAudioManager::RequireDigitalHandle, PATCH_JUMP);

View file

@ -216,6 +216,8 @@ public:
char field_19195; char field_19195;
int m_nTimeOfRecentCrime; int m_nTimeOfRecentCrime;
int32 RandomDisplacement(uint32 seed);
void ReleaseDigitalHandle(); void ReleaseDigitalHandle();
void RequireDigitalHandle(); void RequireDigitalHandle();
void SetDynamicAcousticModelingStatus(bool status); void SetDynamicAcousticModelingStatus(bool status);