summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2019-07-01 16:21:03 +0200
committerFilip Gawin <filip.gawin@zoho.com>2019-07-04 01:02:00 +0200
commitd6957aaa57c814a2d779874cd714c65ab9e321c3 (patch)
treec70a3f00472aa736e0b8eeea8cabf45f00001f10 /src/audio
parentRequireDigitalHandle (diff)
downloadre3-d6957aaa57c814a2d779874cd714c65ab9e321c3.tar
re3-d6957aaa57c814a2d779874cd714c65ab9e321c3.tar.gz
re3-d6957aaa57c814a2d779874cd714c65ab9e321c3.tar.bz2
re3-d6957aaa57c814a2d779874cd714c65ab9e321c3.tar.lz
re3-d6957aaa57c814a2d779874cd714c65ab9e321c3.tar.xz
re3-d6957aaa57c814a2d779874cd714c65ab9e321c3.tar.zst
re3-d6957aaa57c814a2d779874cd714c65ab9e321c3.zip
Diffstat (limited to '')
-rw-r--r--src/audio/AudioManager.cpp19
-rw-r--r--src/audio/AudioManager.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index d9b7fee2..0a7cd93a 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -12,6 +12,24 @@ cAudioManager &AudioManager = *(cAudioManager *)0x880FC0;
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
cAudioManager::ReleaseDigitalHandle()
{
@@ -2814,6 +2832,7 @@ cAudioManager::Service()
}
STARTPATCHES
+InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP);
InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP);
InjectHook(0x57A9F0, &cAudioManager::RequireDigitalHandle, PATCH_JUMP);
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 6b320b60..95478922 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -216,6 +216,8 @@ public:
char field_19195;
int m_nTimeOfRecentCrime;
+ int32 RandomDisplacement(uint32 seed);
+
void ReleaseDigitalHandle();
void RequireDigitalHandle();
void SetDynamicAcousticModelingStatus(bool status);