From 19cc1d7854fa37c53a6d593decaf862a886efcfa Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Fri, 25 Dec 2020 01:29:18 +0100 Subject: fixes --- src/audio/AudioLogic.cpp | 139 ++++++++++++++++++++++----------------------- src/audio/AudioManager.cpp | 2 +- 2 files changed, 69 insertions(+), 72 deletions(-) (limited to 'src') diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 452c3936..0a7ac98c 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -1402,7 +1402,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) } else if (params.m_fVelocityChange == 0.0f) { traction = 0.9f; } - if (transmission->fMaxVelocity <= 0.0) { + if (transmission->fMaxVelocity <= 0.0f) { relativeChange = 0.0f; modificator = 0.0f; } else { @@ -1420,7 +1420,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) } modificator = relativeChange; } else { - modificator = Min(1.0, Abs(params.m_fVelocityChange / transmission->fMaxVelocity > 1.0f)); + modificator = Min(1.0f, Abs(params.m_fVelocityChange / transmission->fMaxVelocity > 1.0f)); } } } else { @@ -1505,14 +1505,10 @@ cAudioManager::UpdateGasPedalAudio(CVehicle* veh, int vehType) float gasPedal = Abs(veh->m_fGasPedal); float* gasPealAudioPtr; - switch (vehType) { - case VEHICLE_TYPE_CAR: - gasPealAudioPtr = &((CAutomobile*)veh)->m_fGasPedalAudio; - case VEHICLE_TYPE_BIKE: - gasPealAudioPtr = &((CBike*)veh)->m_fGasPedalAudio; - default: - return; - break; + switch(vehType) { + case VEHICLE_TYPE_CAR: gasPealAudioPtr = &((CAutomobile *)veh)->m_fGasPedalAudio; break; + case VEHICLE_TYPE_BIKE: gasPealAudioPtr = &((CBike *)veh)->m_fGasPedalAudio; break; + default: return; } if (*gasPealAudioPtr < gasPedal) *gasPealAudioPtr = Min(*gasPealAudioPtr + 0.09f, gasPedal); @@ -3058,6 +3054,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) pedParams.m_bDistanceCalculated = params.m_bDistanceCalculated; pedParams.m_fDistance = params.m_fDistance; SetupPedComments(pedParams, SOUND_PED_VCPA_PLAYER_FOUND); + continue; } case SOUND_WATER_FALL: { const float SOUND_INTENSITY = 40.0f; @@ -3143,7 +3140,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nCounter = GunIndex++; if (GunIndex > 58) GunIndex = 53; - m_sQueueSample.m_bRequireReflection = 0; + m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); continue; #endif @@ -3612,7 +3609,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) //after accel rotor sound emittingVol = ((cameraAngle + 1.0f) * volumeModifier * 127.0f) / 2.0f; - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 140.0, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 140.0f, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 1; if (hunterBool) { @@ -3659,7 +3656,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) if (automobile->bEngineOn) { if (propellerSpeed < 1.0f) { emittingVol = (1.0f - propellerSpeed / 2.0f) * 70.0f; - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.0, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.0f, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { if (hunterBool) { m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_4; @@ -3700,7 +3697,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nFrequency = 18000 + Min(1.0f, (Max(accelerateState, brakeState) / 255.0f) * freqModifier) * 2204; else m_sQueueSample.m_nFrequency = 14287 + Min(1.0f, freqModifier) * 3713; - if (propellerSpeed < 1.0) + if (propellerSpeed < 1.0f) m_sQueueSample.m_nFrequency = (propellerSpeed + 1) * (m_sQueueSample.m_nFrequency / 2.0f); m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqSkimmerPrev, 197); freqSkimmerPrev = m_sQueueSample.m_nFrequency; @@ -3743,7 +3740,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = hunterBool ? SFX_HELI_APACHE_3 : SFX_CAR_HELI_REA; m_sQueueSample.m_nBankIndex = 0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = (volumeModifier + 1.0f) * 16000; m_sQueueSample.m_nLoopCount = 0; @@ -8457,7 +8454,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_POLICE_CELL_DOOR_SLIDING_LOOP: case SCRIPT_SOUND_GARAGE_DOOR_SLIDING_LOOP: @@ -8469,7 +8466,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_SNORING_LOOP: m_sQueueSample.m_fSoundIntensity = 6.0f; @@ -8479,8 +8476,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BUILDING_SNORE); m_sQueueSample.m_nReleasingVolumeModificator = 6; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 3.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 3.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_SHOOTING_RANGE_TARGET_MOVING_LOOP: m_sQueueSample.m_fSoundIntensity = 40.0f; @@ -8490,152 +8487,152 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TANK_TURRET); m_sQueueSample.m_nReleasingVolumeModificator = 4; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_BAR_1: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_1; m_sQueueSample.m_nBankIndex = 0; - m_sQueueSample.m_fSoundIntensity = 80.0; + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_BAR_2: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_2; m_sQueueSample.m_nBankIndex = 0; - m_sQueueSample.m_fSoundIntensity = 80.0; + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_BAR_3: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_3; m_sQueueSample.m_nBankIndex = 0; - m_sQueueSample.m_fSoundIntensity = 80.0; + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_BAR_4: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_4; m_sQueueSample.m_nBankIndex = 0; - m_sQueueSample.m_fSoundIntensity = 80.0; + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_MALIBU_1: - if(MusicManager.m_nPlayingTrack == 18) return; + if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_MALIBU_AMBIENT) return; m_sQueueSample.m_nSampleIndex = SFX_BUILDING_MAL1; m_sQueueSample.m_nBankIndex = 0; - MusicManager.SetMalibuClubTrackPos(40); - m_sQueueSample.m_fSoundIntensity = 80.0; + MusicManager.SetMalibuClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_MALIBU_1); + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_MALIBU_2: - if(MusicManager.m_nPlayingTrack == 18) return; + if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_MALIBU_AMBIENT) return; m_sQueueSample.m_nSampleIndex = SFX_BUILDING_MAL2; m_sQueueSample.m_nBankIndex = 0; - MusicManager.SetMalibuClubTrackPos(41); - m_sQueueSample.m_fSoundIntensity = 80.0; + MusicManager.SetMalibuClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_MALIBU_2); + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_MALIBU_3: - if(MusicManager.m_nPlayingTrack == 18) return; + if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_MALIBU_AMBIENT) return; m_sQueueSample.m_nSampleIndex = SFX_BUILDING_MAL3; m_sQueueSample.m_nBankIndex = 0; - MusicManager.SetMalibuClubTrackPos(42); - m_sQueueSample.m_fSoundIntensity = 80.0; + MusicManager.SetMalibuClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_MALIBU_3); + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_STRIP_1: - if(MusicManager.m_nPlayingTrack == 17) return; + if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_STRIPCLUB_AMBIENT) return; m_sQueueSample.m_nSampleIndex = SFX_BUILDING_STR1; m_sQueueSample.m_nBankIndex = 0; - MusicManager.SetStripClubTrackPos(43); - m_sQueueSample.m_fSoundIntensity = 80.0; + MusicManager.SetStripClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_STRIP_1); + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_STRIP_2: - if(MusicManager.m_nPlayingTrack == 17) return; + if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_STRIPCLUB_AMBIENT) return; m_sQueueSample.m_nSampleIndex = SFX_BUILDING_STR2; m_sQueueSample.m_nBankIndex = 0; - MusicManager.SetStripClubTrackPos(44); - m_sQueueSample.m_fSoundIntensity = 80.0; + MusicManager.SetStripClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_STRIP_2); + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_STRIP_3: - if(MusicManager.m_nPlayingTrack == 17) return; + if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_STRIPCLUB_AMBIENT) return; m_sQueueSample.m_nSampleIndex = SFX_BUILDING_STR3; m_sQueueSample.m_nBankIndex = 0; - MusicManager.SetStripClubTrackPos(45); - m_sQueueSample.m_fSoundIntensity = 80.0; + MusicManager.SetStripClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_STRIP_3); + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_BUILDING_CHURCH: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_CHURCH; m_sQueueSample.m_nBankIndex = 0; - m_sQueueSample.m_fSoundIntensity = 80.0; + m_sQueueSample.m_fSoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; - m_sQueueSample.m_fSpeedMultiplier = 4.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bIs2D = false; break; case SCRIPT_SOUND_NEW_WATERFALL: emittingVolume = 30; - m_sQueueSample.m_fSoundIntensity = 80.0; + m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nBankIndex = 0; m_sQueueSample.m_nFrequency = 20812; m_sQueueSample.m_nReleasingVolumeModificator = 4; m_sQueueSample.m_nReleasingVolumeDivider = 9; - m_sQueueSample.m_fSpeedMultiplier = 2.0; - m_sQueueSample.m_bIs2D = 0; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_bIs2D = false; break; default: return; } @@ -8726,7 +8723,7 @@ cAudioManager::ProcessWeather(int32 id) modifier = Max(Abs(x), Abs(y)) * 10.0f; modifier = Min(1.0f, modifier); wind = Max(CWeather::Wind, modifier); - if (wind > 0.0f && CObject::fDistToNearestTree < 75.0) { + if (wind > 0.0f && CObject::fDistToNearestTree < 75.0f) { m_sQueueSample.m_nSampleIndex = SFX_PALM_TREE_LO; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PALM_TREE_LO); m_sQueueSample.m_nVolume = (m_anRandomTable[1] % 10 + 45.0f) * (75.0f - CObject::fDistToNearestTree) * (4.0f / 300.0f) * wind; @@ -9213,7 +9210,7 @@ cAudioManager::ProcessFireHydrant() const float SOUND_INTENSITY = 35; float distSquared; - bool distCalculated = 0; + bool distCalculated = false; m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition(); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 069a68be..949d8bfb 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -803,7 +803,7 @@ cAudioManager::AddReleasingSounds() if (sample.m_nReleasingVolumeModificator < 20) ++sample.m_nReleasingVolumeModificator; } - sample.m_bReleasingSoundFlag = 0; + sample.m_bReleasingSoundFlag = false; } memcpy(&m_sQueueSample, &sample, sizeof(tSound)); AddSampleToRequestedQueue(); -- cgit v1.2.3