From beae41b2079645f5e2053d12fd794b1f0414aecf Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Sat, 24 Oct 2020 19:43:11 +0300 Subject: [PATCH] fires --- src/audio/AudioLogic.cpp | 36 ++++++++++++++++++++++++++++++------ src/audio/AudioManager.h | 2 +- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 6b6d1082..d999dfed 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -5070,7 +5070,7 @@ cAudioManager::ProcessFires(int32) if (entity) { switch (entity->GetType()) { case ENTITY_TYPE_BUILDING: - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; emittingVol = 100; m_sQueueSample.m_nFrequency = 8 * SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE) / 10; @@ -5086,7 +5086,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nReleasingVolumeModificator = 10; break; default: - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); @@ -5094,17 +5094,17 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nReleasingVolumeModificator = 8; } } else { - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); - m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); + //mb error in III emittingVol = 80; m_sQueueSample.m_nReleasingVolumeModificator = 8; } m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos; distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_fDistance = distSquared < 0.0f ? 0.0f : Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; @@ -5122,6 +5122,30 @@ cAudioManager::ProcessFires(int32) AddSampleToRequestedQueue(); } } + if (gFireManager.m_aFires[i].m_bExtinguishedWithWater) { + gFireManager.m_aFires[i].m_bExtinguishedWithWater = false; + emittingVol = 100.0f * gFireManager.m_aFires[i].m_fWaterExtinguishCountdown; + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; + m_sQueueSample.m_nFrequency = 19591; + m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); + m_sQueueSample.m_nReleasingVolumeModificator = 9; + m_sQueueSample.m_nCounter = i + 40; + m_sQueueSample.m_nBankIndex = SFX_BANK_0; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nReleasingVolumeDivider = 10; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } } } } @@ -6144,7 +6168,7 @@ cAudioManager::ProcessGarages() void cAudioManager::ProcessFireHydrant() { - const int SOUND_INTENSITY = 35; + const float SOUND_INTENSITY = 35; float distSquared; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index daa65470..5d6b4f9f 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -320,7 +320,7 @@ public: void ProcessEntity(int32 sound); // done void ProcessExplosions(int32 explosion); // done void ProcessFireHydrant(); // done - void ProcessFires(int32 entity); // + void ProcessFires(int32 entity); // done void ProcessFrontEnd(); // void ProcessGarages(); // void ProcessCarHeli(cVehicleParams* params); // done