From 16ff379ebeca2092e9609eb3163a6bd2ffd68060 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 17 Aug 2021 13:58:48 +0300 Subject: [PATCH] Add AUDIO_REFLECTIONS define, fix a bunch of types, fix heli chatter intensity --- src/audio/AudioCollision.cpp | 8 +- src/audio/AudioLogic.cpp | 392 +++++++++++++++++++-------------- src/audio/AudioManager.cpp | 46 ++-- src/audio/AudioManager.h | 37 ++-- src/audio/DMAudio.cpp | 2 + src/audio/PolRadio.cpp | 2 +- src/audio/sampman_miles.cpp | 14 +- src/audio/sampman_oal.cpp | 14 +- src/core/MenuScreens.cpp | 2 + src/core/MenuScreensCustom.cpp | 2 + src/core/config.h | 5 + 11 files changed, 313 insertions(+), 211 deletions(-) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index 1b72764e..02231773 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -203,7 +203,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance); - if(m_sQueueSample.m_nVolume) { + if(m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = gOneShotCol[s1]; switch(m_sQueueSample.m_nSampleIndex) { case SFX_COL_TARMAC_1: @@ -269,7 +269,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -285,7 +285,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance); - if(m_sQueueSample.m_nVolume) { + if(m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = counter; m_sQueueSample.m_vecPos = col.m_vecPosition; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -299,7 +299,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 3ce3c3cf..7ccd7134 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -676,7 +676,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); float emittingVol = 30.f * CWeather::Rain; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = veh->m_bRainSamplesCounter++; if (veh->m_bRainSamplesCounter > 4) veh->m_bRainSamplesCounter = 68; @@ -692,7 +692,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = rainOnVehicleIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -725,7 +725,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) modificator = Abs(modificator); emittingVol = (24.f * modificator); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (params.m_pVehicle->m_fGasPedal >= 0.0f) { m_sQueueSample.m_nCounter = 62; m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2; @@ -745,7 +745,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -780,7 +780,7 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams& params) if (emittingVol) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_REMOTE_CONTROLLED_CAR; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -795,7 +795,7 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -824,7 +824,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); emittingVol = 30.f * Min(1.f, velocity / (0.5f * params.m_pTransmission->fMaxVelocity)); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; @@ -847,7 +847,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -877,7 +877,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) relativeVelocity = Min(1.0f, velChange / (0.5f * params.m_pTransmission->fMaxVelocity)); emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -894,7 +894,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1006,7 +1006,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); } m_sQueueSample.m_nVolume = volume; - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (automobile->GetStatus() == STATUS_SIMPLE) { if (modificator < 0.02f) { m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1; @@ -1040,7 +1040,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 8; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1078,7 +1078,7 @@ void cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = counter; m_sQueueSample.m_nSampleIndex = sample; #ifdef GTA_PS2 @@ -1101,7 +1101,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 samp m_sQueueSample.m_SoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1129,7 +1129,7 @@ cAudioManager::ProcessCesna(cVehicleParams& params) } else if (params.m_fDistance < SQR(200)) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 52; m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1144,12 +1144,12 @@ cAudioManager::ProcessCesna(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 200.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } if (params.m_fDistance < SQR(90)) { m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1164,7 +1164,7 @@ cAudioManager::ProcessCesna(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 90.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1453,7 +1453,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) if (skidVal > 0.0f) { emittingVol = 50.f * skidVal; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 3; switch (params.m_pVehicle->m_nSurfaceTouched) { case SURFACE_GRASS: @@ -1490,7 +1490,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1565,7 +1565,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 4; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nHornSample; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1580,7 +1580,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1630,7 +1630,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 5; if (UsesSiren(params.m_nIndex)) { if (params.m_pVehicle->GetStatus() == STATUS_ABANDONED) @@ -1661,7 +1661,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); return TRUE; } else @@ -1689,7 +1689,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 12; m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1704,7 +1704,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1734,7 +1734,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) if (velocity > 0.0035f) { emittingVol = (100.f * velocity * 10.f / 3.f); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i + 6; m_sQueueSample.m_nSampleIndex = m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) + RandomDisplacement(1000); @@ -1748,7 +1748,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); } } @@ -1777,7 +1777,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); rand = m_anRandomTable[0] % 10 + 70; m_sQueueSample.m_nVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 13; m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES); @@ -1792,7 +1792,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 30.0f; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1834,7 +1834,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) } CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 28; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; @@ -1846,7 +1846,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1864,7 +1864,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 35; m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1879,7 +1879,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1903,7 +1903,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) for (uint16 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { noReflections = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); event = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; switch (event) { case SOUND_CAR_DOOR_CLOSE_BONNET: @@ -1943,7 +1943,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_CAR_DOOR_OPEN_BONNET: @@ -1981,7 +1981,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_CAR_WINDSHIELD_CRACK: { @@ -2027,7 +2027,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_CAR_LIGHT_BREAK: { @@ -2167,7 +2167,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVol = 60; break; } @@ -2227,7 +2227,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVol = 50; maxDist = SQR(SOUND_INTENSITY); break; @@ -2258,7 +2258,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVol = m_anRandomTable[4] % 20 + 90; break; } @@ -2275,7 +2275,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[4] % 20 + 55; CrunchOffset %= 2; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_CAR_PED_COLLISION: { @@ -2301,7 +2301,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) if (params.m_fDistance < maxDist) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (noReflections) { m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2338,7 +2338,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) emittingVol = (75.f * speedMultipler); if (train->m_fWagonPosition == 0.0f) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 32; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2353,14 +2353,14 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } const float SOUND_INTENSITY = 70.0f; if (params.m_fDistance < SQR(SOUND_INTENSITY)) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 33; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2375,7 +2375,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -2403,7 +2403,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) if (params.m_nIndex == REEFER) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, intensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 39; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; m_sQueueSample.m_nFrequency = 10386; @@ -2419,7 +2419,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } if (FindPlayerVehicle() == params.m_pVehicle) { @@ -2442,23 +2442,24 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) } } m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, intensity, m_sQueueSample.m_fDistance); - if (!m_sQueueSample.m_nVolume) - return TRUE; - m_sQueueSample.m_nCounter = 40; - m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL; - m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; - m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nLoopCount = 0; - SET_EMITTING_VOLUME(emittingVol); - SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_SoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + if (m_sQueueSample.m_nVolume > 0) { + m_sQueueSample.m_nCounter = 40; + m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL; + m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; + m_sQueueSample.m_nBankIndex = SFX_BANK_0; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nLoopCount = 0; + SET_EMITTING_VOLUME(emittingVol); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_SoundIntensity = intensity; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_nReleasingVolumeDivider = 7; + m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REFLECTION(FALSE); + AddSampleToRequestedQueue(); + } } else { if (FindPlayerVehicle() == params.m_pVehicle) { padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake()); @@ -2499,23 +2500,23 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) } CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, intensity, m_sQueueSample.m_fDistance); - if (!m_sQueueSample.m_nVolume) - return TRUE; - m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; - m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nLoopCount = 0; - SET_EMITTING_VOLUME(emittingVol); - SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_SoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + if (m_sQueueSample.m_nVolume > 0) { + m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; + m_sQueueSample.m_nBankIndex = SFX_BANK_0; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nLoopCount = 0; + SET_EMITTING_VOLUME(emittingVol); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_SoundIntensity = intensity; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_nReleasingVolumeDivider = 7; + m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REFLECTION(FALSE); + AddSampleToRequestedQueue(); + } } - AddSampleToRequestedQueue(); return TRUE; } return FALSE; @@ -2540,7 +2541,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); vol = (30.f * multiplier); m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 38; m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2555,7 +2556,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -2595,7 +2596,7 @@ cAudioManager::ProcessHelicopter(cVehicleParams& params) emittingVol = gHeliSfxRanges[i].m_bBaseVolume; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i + 65; m_sQueueSample.m_nSampleIndex = i + SFX_HELI_1; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2610,7 +2611,7 @@ cAudioManager::ProcessHelicopter(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -2769,7 +2770,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2784,7 +2785,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return TRUE; @@ -2800,7 +2801,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2815,7 +2816,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return TRUE; @@ -2830,7 +2831,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 3; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2845,7 +2846,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return TRUE; @@ -2860,7 +2861,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) int32 vol = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = vol; - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2875,7 +2876,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return TRUE; @@ -2890,7 +2891,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 5; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2906,7 +2907,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nReleasingVolumeDivider = 12; m_sQueueSample.m_nOffset = 0; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); m_sQueueSample.m_nCounter = 6; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; @@ -2970,7 +2971,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams ¶ms) } m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 64; m_sQueueSample.m_nSampleIndex = SFX_HEADPHONES; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2985,7 +2986,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams ¶ms) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return; @@ -3013,7 +3014,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { stereo = FALSE; narrowSoundRange = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); sound = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; switch (sound) { case SOUND_STEP_START: @@ -3091,7 +3092,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_FALL_LAND: case SOUND_FALL_COLLAPSE: @@ -3118,7 +3119,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_FIGHT_PUNCH_33: m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; @@ -3182,7 +3183,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_WEAPON_BAT_ATTACK: m_sQueueSample.m_nSampleIndex = SFX_BAT_HIT_LEFT; @@ -3200,9 +3201,11 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; +#ifdef AUDIO_REFLECTIONS if (m_bDynamicAcousticModelingStatus) m_sQueueSample.m_bRequireReflection = TRUE; else +#endif stereo = TRUE; break; case SOUND_WEAPON_SHOT_FIRED: @@ -3225,9 +3228,11 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; +#ifdef AUDIO_REFLECTIONS if (m_bDynamicAcousticModelingStatus) m_sQueueSample.m_bRequireReflection = TRUE; else +#endif stereo = TRUE; break; case WEAPONTYPE_UZI: @@ -3265,9 +3270,11 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; +#ifdef AUDIO_REFLECTIONS if (m_bDynamicAcousticModelingStatus) m_sQueueSample.m_bRequireReflection = TRUE; else +#endif stereo = TRUE; break; case WEAPONTYPE_AK47: @@ -3323,9 +3330,11 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; +#ifdef AUDIO_REFLECTIONS if (m_bDynamicAcousticModelingStatus) m_sQueueSample.m_bRequireReflection = TRUE; else +#endif stereo = TRUE; break; case WEAPONTYPE_ROCKETLAUNCHER: @@ -3345,9 +3354,11 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; +#ifdef AUDIO_REFLECTIONS if (m_bDynamicAcousticModelingStatus) m_sQueueSample.m_bRequireReflection = TRUE; else +#endif stereo = TRUE; break; case WEAPONTYPE_FLAMETHROWER: @@ -3366,9 +3377,11 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 6; +#ifdef AUDIO_REFLECTIONS if (m_bDynamicAcousticModelingStatus) m_sQueueSample.m_bRequireReflection = TRUE; else +#endif stereo = TRUE; break; default: @@ -3424,7 +3437,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(75); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_WEAPON_AK47_BULLET_ECHO: case SOUND_WEAPON_UZI_BULLET_ECHO: @@ -3445,9 +3458,11 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; +#ifdef AUDIO_REFLECTIONS if (m_bDynamicAcousticModelingStatus) m_sQueueSample.m_bRequireReflection = TRUE; else +#endif stereo = TRUE; break; case SOUND_WEAPON_FLAMETHROWER_FIRE: @@ -3501,7 +3516,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; default: SetupPedComments(params, sound); @@ -3513,7 +3528,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) if (params.m_fDistance < maxDist) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (stereo) { if (m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_SoundIntensity) { m_sQueueSample.m_bIs2D = TRUE; @@ -3614,7 +3629,7 @@ cAudioManager::SetupPedComments(cPedParams ¶ms, uint16 sound) } m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance); pedComment.m_nProcess = 10; - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex; pedComment.m_vecPos = m_sQueueSample.m_vecPos; pedComment.m_fDistance = m_sQueueSample.m_fDistance; @@ -6070,6 +6085,34 @@ cPedComments::Process() case SFX_POLICE_HELI_1: case SFX_POLICE_HELI_2: case SFX_POLICE_HELI_3: +#ifdef FIX_BUGS + case SFX_POLICE_HELI_4: + case SFX_POLICE_HELI_5: + case SFX_POLICE_HELI_6: + case SFX_POLICE_HELI_7: + case SFX_POLICE_HELI_8: + case SFX_POLICE_HELI_9: + case SFX_POLICE_HELI_10: + case SFX_POLICE_HELI_11: + case SFX_POLICE_HELI_12: + case SFX_POLICE_HELI_13: + case SFX_POLICE_HELI_14: + case SFX_POLICE_HELI_15: + case SFX_POLICE_HELI_16: + case SFX_POLICE_HELI_17: + case SFX_POLICE_HELI_18: + case SFX_POLICE_HELI_19: + case SFX_POLICE_HELI_20: + case SFX_POLICE_HELI_21: + case SFX_POLICE_HELI_22: + case SFX_POLICE_HELI_23: + case SFX_POLICE_HELI_24: + case SFX_POLICE_HELI_25: + case SFX_POLICE_HELI_26: + case SFX_POLICE_HELI_27: + case SFX_POLICE_HELI_28: + case SFX_POLICE_HELI_29: +#endif AudioManager.m_sQueueSample.m_SoundIntensity = 400.0f; break; default: @@ -6081,10 +6124,21 @@ cPedComments::Process() if (sampleIndex >= SFX_AMMU_D && sampleIndex <= SFX_AMMU_F) { AudioManager.m_sQueueSample.m_bReverbFlag = FALSE; +#ifdef AUDIO_REFLECTIONS AudioManager.m_sQueueSample.m_bRequireReflection = FALSE; +#endif +#ifdef FIX_BUGS + } else if (sampleIndex >= SFX_POLICE_HELI_1 && sampleIndex <= SFX_POLICE_HELI_29) { + AudioManager.m_sQueueSample.m_bReverbFlag = TRUE; +#ifdef AUDIO_REFLECTIONS + AudioManager.m_sQueueSample.m_bRequireReflection = FALSE; +#endif // AUDIO_REFLECTIONS +#endif // FIX_BUGS } else { AudioManager.m_sQueueSample.m_bReverbFlag = TRUE; +#ifdef AUDIO_REFLECTIONS AudioManager.m_sQueueSample.m_bRequireReflection = TRUE; +#endif } AudioManager.m_sQueueSample.m_bIs2D = FALSE; @@ -6175,7 +6229,7 @@ cAudioManager::ProcessExplosions(int32 explosion) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_bIs2D = FALSE; @@ -6185,7 +6239,7 @@ cAudioManager::ProcessExplosions(int32 explosion) SET_EMITTING_VOLUME(MAX_VOLUME); RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); } } @@ -6242,7 +6296,7 @@ cAudioManager::ProcessFires(int32) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -6253,7 +6307,7 @@ cAudioManager::ProcessFires(int32) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -6277,7 +6331,7 @@ cAudioManager::ProcessWaterCannon(int32) #else m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); #endif - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { #ifdef FIX_BUGS m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; #else @@ -6296,7 +6350,7 @@ cAudioManager::ProcessWaterCannon(int32) SET_EMITTING_VOLUME(50); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -6359,7 +6413,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = RandomDisplacement(10) + 50; break; case SCRIPT_SOUND_BULLET_HIT_GROUND_1: @@ -6397,7 +6451,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); break; case SCRIPT_SOUND_GLASS_BREAK_L: m_sQueueSample.m_SoundIntensity = 60.0f; @@ -6428,7 +6482,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SCRIPT_SOUND_GLASS_LIGHT_BREAK: m_sQueueSample.m_SoundIntensity = 55.0f; @@ -6448,7 +6502,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_BOX_DESTROYED_2: @@ -6459,7 +6513,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_METAL_COLLISION: @@ -6471,7 +6525,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = m_anRandomTable[2] % 30 + 70; break; case SCRIPT_SOUND_TIRE_COLLISION: @@ -6483,7 +6537,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = m_anRandomTable[2] % 30 + 60; break; case SCRIPT_SOUND_GUNSHELL_DROP: @@ -6539,7 +6593,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -7144,7 +7198,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; @@ -7152,7 +7206,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_bReverbFlag = TRUE; SET_EMITTING_VOLUME(emittingVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -7214,7 +7268,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) m_sQueueSample.m_fDistance = Sqrt(distSquared); if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) { m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = FALSE; @@ -7225,7 +7279,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) SET_EMITTING_VOLUME(MAX_VOLUME); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -7233,7 +7287,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) time = CTimer::GetTimeInMilliseconds(); if (time > gPornNextTime) { m_sQueueSample.m_nVolume = ComputeVolume(90, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { rand = m_anRandomTable[1] & 1; m_sQueueSample.m_nSampleIndex = rand + sample; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -7249,7 +7303,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) #endif RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); gPornNextTime = time + 2000 + m_anRandomTable[3] % 6000; } @@ -7274,7 +7328,7 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_WORKSHOP_1; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_WORKSHOP; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_WORKSHOP_1); @@ -7287,7 +7341,7 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound) SET_EMITTING_VOLUME(30); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -7312,7 +7366,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_SAWMILL; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SAWMILL_LOOP); @@ -7325,13 +7379,13 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) SET_EMITTING_VOLUME(30); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } time = CTimer::GetTimeInMilliseconds(); if (time > gSawMillNextTime) { m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_CUT_WOOD; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_SAWMILL; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -7346,7 +7400,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) #endif RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); gSawMillNextTime = time + 2000 + m_anRandomTable[3] % 4000; } @@ -7369,7 +7423,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_LAUNDERETTE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_LOOP); @@ -7382,11 +7436,11 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) SET_EMITTING_VOLUME(45); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_SONG_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_LAUNDERETTE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_SONG_LOOP); @@ -7399,7 +7453,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) SET_EMITTING_VOLUME(110); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -7424,7 +7478,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_SHOP_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_SHOP; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOP_LOOP); @@ -7437,13 +7491,13 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) SET_EMITTING_VOLUME(30); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } time = CTimer::GetTimeInMilliseconds(); if (time > gShopNextTime) { m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { rand = m_anRandomTable[1] & 1; m_sQueueSample.m_nSampleIndex = rand + SFX_SHOP_TILL_1; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_SHOP; @@ -7457,7 +7511,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) SET_EMITTING_VOLUME(70); RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); gShopNextTime = time + 3000 + m_anRandomTable[3] % 7000; } @@ -7486,7 +7540,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_AIRPORT; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -7499,7 +7553,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) SET_EMITTING_VOLUME(110); RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); gAirportNextTime = time + 10000 + m_anRandomTable[3] % 20000; } @@ -7531,7 +7585,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) m_sQueueSample.m_fDistance = Sqrt(distSquared); rand = m_anRandomTable[0] % 90 + 30; m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = iSound % 3 + SFX_CINEMA_BASS_1; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_CINEMA; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -7545,7 +7599,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) SET_EMITTING_VOLUME(rand); RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); gCinemaNextTime = time + 1000 + m_anRandomTable[3] % 4000; } @@ -7579,7 +7633,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) m_sQueueSample.m_fDistance = Sqrt(distSquared); rand = m_anRandomTable[0] % 60 + 40; m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_DOCKS_FOGHORN; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_DOCKS; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN); @@ -7593,7 +7647,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) SET_EMITTING_VOLUME(rand); RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); gDocksNextTime = time + 10000 + m_anRandomTable[3] % 40000; } @@ -7626,7 +7680,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) m_sQueueSample.m_fDistance = Sqrt(dist); rand = m_anRandomTable[0] % 30 + 40; m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 5 + SFX_HOME_1; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_HOME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -7640,7 +7694,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) SET_EMITTING_VOLUME(rand); RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); gHomeNextTime = time + 1000 + m_anRandomTable[3] % 4000; } @@ -7678,7 +7732,7 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = sampleIndex; emittingVol = m_anRandomTable[0] % 50 + 55; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); @@ -7691,7 +7745,7 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) SET_EMITTING_VOLUME(emittingVol); RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); cPedParams params; params.m_bDistanceCalculated = TRUE; @@ -7738,7 +7792,7 @@ cAudioManager::ProcessWeather(int32 id) SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume); RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } if (CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { @@ -7756,7 +7810,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_bReverbFlag = FALSE; SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -7935,7 +7989,7 @@ cAudioManager::ProcessFrontEnd() else m_sQueueSample.m_nOffset = 63; m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); if (stereo) { ++m_sQueueSample.m_nSampleIndex; @@ -7962,7 +8016,7 @@ cAudioManager::ProcessCrane() if (distSquared < SQR(intensity)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -7977,7 +8031,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents > 0) { @@ -7987,7 +8041,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); } } @@ -8033,7 +8087,7 @@ cAudioManager::ProcessProjectiles() if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; @@ -8041,7 +8095,7 @@ cAudioManager::ProcessProjectiles() SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -8078,7 +8132,7 @@ cAudioManager::ProcessGarages() while (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(90, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { if (CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) { if (m_FrameCounter & 1) { @@ -8122,7 +8176,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } break; @@ -8135,7 +8189,7 @@ cAudioManager::ProcessGarages() if (distSquared < SQR(SOUND_INTENSITY)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; m_sQueueSample.m_nFrequency = 6735; @@ -8159,7 +8213,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nCounter = iSound++; if (iSound < 32) iSound = 32; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); } } @@ -8183,7 +8237,7 @@ cAudioManager::ProcessFireHydrant() if (distSquared < SQR(intensity)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -8198,7 +8252,7 @@ cAudioManager::ProcessFireHydrant() m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -8242,7 +8296,7 @@ cAudioManager::ProcessBridgeWarning() { if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) { m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING; m_sQueueSample.m_nBankIndex = SFX_BANK_GENERIC_EXTRA; @@ -8257,7 +8311,7 @@ cAudioManager::ProcessBridgeWarning() m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 8; m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -8268,7 +8322,7 @@ cAudioManager::ProcessBridgeMotor() { if (m_sQueueSample.m_fDistance < bridgeIntensity) { m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -8303,7 +8357,7 @@ cAudioManager::ProcessBridgeOneShots() if (m_sQueueSample.m_fDistance < bridgeIntensity) { m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; @@ -8316,7 +8370,7 @@ cAudioManager::ProcessBridgeOneShots() m_sQueueSample.m_SoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 9b1337c9..15c8c00e 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -30,7 +30,9 @@ cAudioManager::cAudioManager() ClearActiveSamples(); GenerateIntegerRandomNumberTable(); m_bDoubleVolume = FALSE; +#ifdef AUDIO_REFLECTIONS m_bDynamicAcousticModelingStatus = TRUE; +#endif for (int i = 0; i < NUM_AUDIOENTITIES; i++) { m_asAudioEntities[i].m_bIsUsed = FALSE; @@ -114,7 +116,7 @@ cAudioManager::Service() if (m_bIsInitialised) { m_nPreviousUserPause = m_nUserPause; m_nUserPause = CTimer::GetIsUserPaused(); -#if GTA_VERSION >= GTA3_PC_10 +#ifdef AUDIO_REFLECTIONS UpdateReflections(); #endif ServiceSoundEffects(); @@ -434,11 +436,13 @@ cAudioManager::ReacquireDigitalHandle() } } +#ifdef AUDIO_REFLECTIONS void cAudioManager::SetDynamicAcousticModelingStatus(bool8 status) { m_bDynamicAcousticModelingStatus = status; } +#endif bool8 cAudioManager::CheckForAnAudioFileOnCD() @@ -601,9 +605,11 @@ cAudioManager::InterrogateAudioEntities() void cAudioManager::AddSampleToRequestedQueue() { - int32 calculatedVolume; + uint32 calculatedVolume; uint8 sampleIndex; +#ifdef AUDIO_REFLECTIONS bool8 bReflections; +#endif if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) { calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (MAX_VOLUME - m_sQueueSample.m_nVolume); @@ -617,11 +623,12 @@ cAudioManager::AddSampleToRequestedQueue() } m_sQueueSample.m_nCalculatedVolume = calculatedVolume; m_sQueueSample.m_bLoopEnded = FALSE; +#ifdef AUDIO_REFLECTIONS if (m_sQueueSample.m_bIs2D) { m_sQueueSample.m_bRequireReflection = FALSE; m_sQueueSample.m_nLoopsRemaining = 0; } - if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount) { + if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount > 0) { bReflections = m_sQueueSample.m_bRequireReflection; } else { bReflections = FALSE; @@ -631,12 +638,15 @@ cAudioManager::AddSampleToRequestedQueue() if (!m_bDynamicAcousticModelingStatus) m_sQueueSample.m_bReverbFlag = FALSE; +#endif m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample; AddDetailsToRequestedOrderList(sampleIndex); +#ifdef AUDIO_REFLECTIONS if (bReflections) AddReflectionsToRequestedQueue(); +#endif } } @@ -657,7 +667,7 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample) m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample; } -#if GTA_VERSION >= GTA3_PC_10 +#ifdef AUDIO_REFLECTIONS void cAudioManager::AddReflectionsToRequestedQueue() { @@ -675,12 +685,12 @@ cAudioManager::AddReflectionsToRequestedQueue() m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume > emittingVolume / 16) { m_sQueueSample.m_nCounter += (i + 1) * 256; - if (m_sQueueSample.m_nLoopCount) { + if (m_sQueueSample.m_nLoopCount > 0) { noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - if (noise <= 0) - m_sQueueSample.m_nFrequency += noise; - else + if (noise > 0) m_sQueueSample.m_nFrequency -= noise; + else + m_sQueueSample.m_nFrequency += noise; } m_sQueueSample.m_nReleasingVolumeModificator += 20; m_sQueueSample.m_vecPos = m_avecReflectionsPos[i]; @@ -740,7 +750,7 @@ cAudioManager::UpdateReflections() m_afReflectionsDistances[4] = 50.0f; } } -#endif // GTA_VERSION >= GTA3_PC_10 +#endif // AUDIO_REFLECTIONS void cAudioManager::AddReleasingSounds() @@ -768,7 +778,10 @@ cAudioManager::AddReleasingSounds() } } if (!toProcess[i]) { - if (sample.m_nCounter <= 255 || sample.m_nLoopsRemaining == 0) { +#ifdef AUDIO_REFLECTIONS + if (sample.m_nCounter <= 255 || sample.m_nLoopsRemaining == 0) // check if not reflection +#endif + { if (sample.m_nReleasingVolumeDivider == 0) continue; if (sample.m_nLoopCount == 0) { @@ -831,7 +844,7 @@ cAudioManager::ProcessActiveQueues() for (int32 j = 0; j < m_nActiveSamples; j++) { if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex && sample.m_nCounter == m_asActiveSamples[j].m_nCounter && sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) { - if (sample.m_nLoopCount) { + if (sample.m_nLoopCount > 0) { if (m_FrameCounter & 1) flag = !!(j & 1); else @@ -914,13 +927,16 @@ cAudioManager::ProcessActiveQueues() for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) { tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]]; if (!sample.m_bIsProcessed && !sample.m_bLoopEnded && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) { - if (sample.m_nCounter > 255 && sample.m_nLoopCount != 0 && sample.m_nLoopsRemaining != 0) { +#ifdef AUDIO_REFLECTIONS + if (sample.m_nCounter > 255 && sample.m_nLoopCount > 0 && sample.m_nLoopsRemaining > 0) { // check if reflection sample.m_nLoopsRemaining--; sample.m_nReleasingVolumeDivider = 1; - } else { + } else +#endif + { for (uint8 j = 0; j < m_nActiveSamples; j++) { if (!m_asActiveSamples[j].m_bIsProcessed) { - if (sample.m_nLoopCount != 0) { + if (sample.m_nLoopCount > 0) { samplesPerFrame = sample.m_nFrequency / m_nTimeSpent; samplesToPlay = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex); if (samplesPerFrame == 0) @@ -1028,7 +1044,7 @@ cAudioManager::ClearActiveSamples() m_asActiveSamples[i].m_nVolumeChange = -1; m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f); m_asActiveSamples[i].m_bReverbFlag = FALSE; -#if GTA_VERSION >= GTA3_PC_10 +#ifdef AUDIO_REFLECTIONS m_asActiveSamples[i].m_nLoopsRemaining = 0; m_asActiveSamples[i].m_bRequireReflection = FALSE; #endif diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 7934996e..3b413965 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -9,20 +9,20 @@ class tSound public: int32 m_nEntityIndex; #if GTA_VERSION >= GTA3_PC_10 - int32 m_nCounter; + uint32 m_nCounter; #else uint8 m_nCounter; #endif - int32 m_nSampleIndex; + uint32 m_nSampleIndex; uint8 m_nBankIndex; bool8 m_bIs2D; - int32 m_nReleasingVolumeModificator; + uint32 m_nReleasingVolumeModificator; uint32 m_nFrequency; uint8 m_nVolume; float m_fDistance; - int32 m_nLoopCount; + uint32 m_nLoopCount; #ifndef GTA_PS2 - int32 m_nLoopStart; + uint32 m_nLoopStart; int32 m_nLoopEnd; #endif #ifdef EXTERNAL_3D_SOUND @@ -37,18 +37,18 @@ public: bool8 m_bReleasingSoundFlag; CVector m_vecPos; bool8 m_bReverbFlag; -#if GTA_VERSION >= GTA3_PC_10 +#ifdef AUDIO_REFLECTIONS uint8 m_nLoopsRemaining; bool8 m_bRequireReflection; // Used for oneshots #endif uint8 m_nOffset; - int32 m_nReleasingVolumeDivider; + uint32 m_nReleasingVolumeDivider; bool8 m_bIsProcessed; bool8 m_bLoopEnded; #if GTA_VERSION < GTA3_PC_10 int32 unk; // only on PS2, seems unused #endif - int32 m_nCalculatedVolume; + uint32 m_nCalculatedVolume; int8 m_nVolumeChange; }; @@ -74,7 +74,7 @@ VALIDATE_SIZE(tAudioEntity, 40); class tPedComment { public: - int32 m_nSampleIndex; + uint32 m_nSampleIndex; int32 m_nEntityIndex; CVector m_vecPos; float m_fDistance; @@ -120,7 +120,7 @@ class cMissionAudio public: CVector m_vecPos; bool8 m_bPredefinedProperties; - int32 m_nSampleIndex; + uint32 m_nSampleIndex; uint8 m_nLoadingStatus; uint8 m_nPlayStatus; bool8 m_bIsPlaying; @@ -168,7 +168,7 @@ public: float m_fDistance; CVehicle *m_pVehicle; cTransmission *m_pTransmission; - int32 m_nIndex; + uint32 m_nIndex; float m_fVelocityChange; cVehicleParams() @@ -211,8 +211,10 @@ public: bool8 m_bReverb; // unused bool8 m_bFifthFrameFlag; uint8 m_nActiveSamples; - uint8 m_bDoubleVolume; // unused + bool8 m_bDoubleVolume; // unused +#if GTA_VERSION >= GTA3_PC_10 bool8 m_bDynamicAcousticModelingStatus; +#endif float m_fSpeedOfSound; bool8 m_bTimerJustReset; int32 m_nTimer; @@ -225,7 +227,7 @@ public: tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES]; int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES]; int32 m_nAudioEntitiesTotal; -#if GTA_VERSION >= GTA3_PC_10 +#ifdef AUDIO_REFLECTIONS CVector m_avecReflectionsPos[MAX_REFLECTIONS]; float m_afReflectionsDistances[MAX_REFLECTIONS]; #endif @@ -276,7 +278,9 @@ public: bool8 IsMP3RadioChannelAvailable(); void ReleaseDigitalHandle(); void ReacquireDigitalHandle(); +#ifdef AUDIO_REFLECTIONS void SetDynamicAcousticModelingStatus(bool8 status); +#endif bool8 CheckForAnAudioFileOnCD(); char GetCDAudioDriveLetter(); bool8 IsAudioInitialised(); @@ -292,7 +296,7 @@ public: void InterrogateAudioEntities(); // inlined on PS2 void AddSampleToRequestedQueue(); void AddDetailsToRequestedOrderList(uint8 sample); // inlined on PS2 -#if GTA_VERSION >= GTA3_PC_10 +#ifdef AUDIO_REFLECTIONS void AddReflectionsToRequestedQueue(); void UpdateReflections(); #endif @@ -548,6 +552,11 @@ public: #else #define SET_EMITTING_VOLUME(vol) #endif +#ifdef AUDIO_REFLECTIONS +#define SET_SOUND_REFLECTION(b) m_sQueueSample.m_bRequireReflection = b +#else +#define SET_SOUND_REFLECTION(b) +#endif #if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS) static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error"); diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index 688da201..d88bfddd 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -155,7 +155,9 @@ cDMAudio::ReacquireDigitalHandle(void) void cDMAudio::SetDynamicAcousticModelingStatus(bool8 status) { +#ifdef AUDIO_REFLECTIONS AudioManager.SetDynamicAcousticModelingStatus(status); +#endif } bool8 diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp index 742e5ea5..4c84829a 100644 --- a/src/audio/PolRadio.cpp +++ b/src/audio/PolRadio.cpp @@ -139,7 +139,7 @@ cAudioManager::DoPoliceRadioCrackle() m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nOffset = 63; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 0ba6b544..71ff00ee 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -1652,10 +1652,16 @@ cSampleManager::UpdateReverb(void) if ( AudioManager.m_FrameCounter & 15 ) return FALSE; - + +#ifdef AUDIO_REFLECTIONS float y = AudioManager.m_afReflectionsDistances[REFLECTION_TOP] + AudioManager.m_afReflectionsDistances[REFLECTION_BOTTOM]; float x = AudioManager.m_afReflectionsDistances[REFLECTION_LEFT] + AudioManager.m_afReflectionsDistances[REFLECTION_RIGHT]; float z = AudioManager.m_afReflectionsDistances[REFLECTION_UP]; +#else + float x = 0.0f; + float y = 0.0f; + float z = 0.0f; +#endif float normy = norm(y, 5.0f, 40.0f); float normx = norm(x, 5.0f, 40.0f); @@ -2169,7 +2175,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) bool8 cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) { - int i = 0; + uint32 i = 0; uint32 position = nPos; char filename[MAX_PATH]; @@ -2250,7 +2256,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) if ( !_pMP3List ) { nFile = 0; - _bIsMp3Active = 0; + _bIsMp3Active = FALSE; #ifdef PS2_AUDIO_PATHS strcpy(filename, m_szCDRomRootPath); strcat(filename, PS2StreamedNameTable[nFile]); @@ -2295,7 +2301,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) } } - _bIsMp3Active = 0; + _bIsMp3Active = FALSE; } while ( ++i < nNumMP3s ); position = 0; diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 17776347..b8a3ed3d 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1362,10 +1362,16 @@ bool8 cSampleManager::UpdateReverb(void) if ( AudioManager.m_FrameCounter & 15 ) return FALSE; - + +#ifdef AUDIO_REFLECTIONS float y = AudioManager.m_afReflectionsDistances[REFLECTION_TOP] + AudioManager.m_afReflectionsDistances[REFLECTION_BOTTOM]; float x = AudioManager.m_afReflectionsDistances[REFLECTION_LEFT] + AudioManager.m_afReflectionsDistances[REFLECTION_RIGHT]; float z = AudioManager.m_afReflectionsDistances[REFLECTION_UP]; +#else + float x = 0.0f; + float y = 0.0f; + float z = 0.0f; +#endif float normy = norm(y, 5.0f, 40.0f); float normx = norm(x, 5.0f, 40.0f); @@ -1653,7 +1659,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) bool8 cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) { - int i = 0; + uint32 i = 0; uint32 position = nPos; char filename[MAX_PATH]; @@ -1728,7 +1734,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) if ( !_pMP3List ) { nFile = 0; - _bIsMp3Active = 0; + _bIsMp3Active = FALSE; CStream *stream = aStream[nStream]; #ifdef PS2_AUDIO_PATHS if(!stream->Open(PS2StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000)) @@ -1767,7 +1773,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) } } - _bIsMp3Active = 0; + _bIsMp3Active = FALSE; } while ( ++i < nNumMP3s ); position = 0; diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp index 0a149f27..247de98a 100644 --- a/src/core/MenuScreens.cpp +++ b/src/core/MenuScreens.cpp @@ -44,7 +44,9 @@ CMenuScreen aScreens[MENUPAGES] = { MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_SPEAKERCONF, "FEA_SPK", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, #endif +#ifdef AUDIO_REFLECTIONS MENUACTION_DYNAMICACOUSTIC, "FET_DAM", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, +#endif MENUACTION_RADIO, "FEA_RSS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp index 5eecd841..d33650f8 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -439,7 +439,9 @@ CMenuScreenCustom aScreens[MENUPAGES] = { MENUACTION_AUDIOHW, "FEA_3DH", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS }, MENUACTION_SPEAKERCONF, "FEA_SPK", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS }, #endif +#ifdef AUDIO_REFLECTIONS MENUACTION_DYNAMICACOUSTIC, "FET_DAM", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS }, +#endif MENUACTION_RADIO, "FEA_RSS", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS }, MENUACTION_RESTOREDEF, "FET_DEF", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS }, MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, diff --git a/src/core/config.h b/src/core/config.h index d26f9546..5ec6f3ee 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -171,6 +171,7 @@ enum Config { # define PS2_MENU #elif defined GTA_PC # define EXTERNAL_3D_SOUND +# define AUDIO_REFLECTIONS # ifndef GTA_HANDHELD # define PC_PLAYER_CONTROLS // mouse player/cam mode # endif @@ -429,6 +430,7 @@ enum Config { // Audio #define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space // originally and making it work in 2d only requires more resource). Will not work on PS2 +#define AUDIO_REFLECTIONS // Enable audio reflections. Disabled on mobile, didn't exist yet on PS2. #define RADIO_SCROLL_TO_PREV_STATION #define AUDIO_CACHE #define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 44 (PC has 28 originally) @@ -490,3 +492,6 @@ enum Config { #if defined(GTA_PS2) && defined(EXTERNAL_3D_SOUND) #error EXTERNAL_3D_SOUND cannot work on PS2 #endif +#if defined(AUDIO_REFLECTIONS) && GTA_VERSION < GTA3_PC_10 +#error AUDIO_REFLECTIONS cannot work with versions below GTA3_PC_10 +#endif \ No newline at end of file