summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio/AudioManager.cpp69
-rw-r--r--src/audio/AudioManager.h2
2 files changed, 68 insertions, 3 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index f136e6b2..a6f357c2 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -9290,11 +9290,75 @@ cAudioManager::UpdateGasPedalAudio(CAutomobile *automobile)
automobile->m_fGasPedalAudio = newGasPedalAudio;
}
-WRAPPER
void
cAudioManager::UpdateReflections()
{
- EAXJMP(0x57B470);
+ const CVector &camPos = TheCamera.GetPosition();
+ CColPoint colpoint;
+ CEntity *ent;
+
+ if(m_nTimeOfRecentCrime & 7) {
+ if(((uint8)m_nTimeOfRecentCrime + 1) & 7) {
+ if(((uint8)m_nTimeOfRecentCrime + 2) & 7) {
+ if(((uint8)m_nTimeOfRecentCrime + 3) & 7) {
+ if(!(((uint8)m_nTimeOfRecentCrime + 4) & 7)) {
+ m_avecReflectionsPos[4] = camPos;
+ m_avecReflectionsPos[4].z += 50.f;
+ if(CWorld::ProcessVerticalLine(
+ camPos, m_avecReflectionsPos[4].z, colpoint,
+ ent, true, false, false, false, true, false,
+ false)) {
+ m_afReflectionsDistances[4] =
+ colpoint.point.z - camPos.z;
+ } else {
+ m_afReflectionsDistances[4] = 50.0f;
+ }
+ }
+ } else {
+ m_avecReflectionsPos[3] = camPos;
+ m_avecReflectionsPos[3].x += 50.f;
+ if(CWorld::ProcessLineOfSight(
+ camPos, m_avecReflectionsPos[3], colpoint, ent, true,
+ false, false, true, false, true, true)) {
+ m_afReflectionsDistances[3] =
+ Distance(camPos, colpoint.point);
+ } else {
+ m_afReflectionsDistances[3] = 50.0f;
+ }
+ }
+ } else {
+ m_avecReflectionsPos[2] = camPos;
+ m_avecReflectionsPos[2].x -= 50.f;
+ if(CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2],
+ colpoint, ent, true, false, false,
+ true, false, true, true)) {
+ m_afReflectionsDistances[2] =
+ Distance(camPos, colpoint.point);
+ } else {
+ m_afReflectionsDistances[2] = 50.0f;
+ }
+ }
+ } else {
+ m_avecReflectionsPos[1] = camPos;
+ m_avecReflectionsPos[1].y -= 50.f;
+ if(CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint,
+ ent, true, false, false, true, false, true,
+ true)) {
+ m_afReflectionsDistances[1] = Distance(camPos, colpoint.point);
+ } else {
+ m_afReflectionsDistances[1] = 50.0f;
+ }
+ }
+ } else {
+ m_avecReflectionsPos[0] = camPos;
+ m_avecReflectionsPos[0].y += 50.f;
+ if(CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true,
+ false, false, true, false, true, true)) {
+ m_afReflectionsDistances[0] = Distance(camPos, colpoint.point);
+ } else {
+ m_afReflectionsDistances[0] = 50.0f;
+ }
+ }
}
bool
@@ -9571,6 +9635,7 @@ InjectHook(0x57FCC0, &cAudioManager::SetupSuspectLastSeenReport, PATCH_JUMP);
InjectHook(0x57A150, &cAudioManager::Terminate, PATCH_JUMP);
InjectHook(0x57AC60, &cAudioManager::TranslateEntity, PATCH_JUMP);
InjectHook(0x56AC80, &cAudioManager::UpdateGasPedalAudio, PATCH_JUMP);
+InjectHook(0x57B470, &cAudioManager::UpdateReflections, PATCH_JUMP);
InjectHook(0x56C600, &cAudioManager::UsesReverseWarning, PATCH_JUMP);
InjectHook(0x56C3C0, &cAudioManager::UsesSiren, PATCH_JUMP);
InjectHook(0x56C3F0, &cAudioManager::UsesSirenSwitching, PATCH_JUMP);
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 30f411a7..19809286 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -689,7 +689,7 @@ public:
void TranslateEntity(CVector *v1, CVector *v2) const;
void UpdateGasPedalAudio(CAutomobile *automobile);
- void UpdateReflections(); // todo
+ void UpdateReflections();
bool UsesReverseWarning(int32 model) const;
bool UsesSiren(int32 model) const;
bool UsesSirenSwitching(int32 model) const;