diff options
author | Roman Masanin <36927roma@gmail.com> | 2020-09-27 01:03:36 +0200 |
---|---|---|
committer | Roman Masanin <36927roma@gmail.com> | 2020-09-27 01:03:36 +0200 |
commit | c403df08611c857f43ebf708799974f06b4e8a8a (patch) | |
tree | 1a7d23e887174729006bbd8072265d52e4f84d89 /src/audio | |
parent | Merge remote-tracking branch 'upstream/miami' into miami (diff) | |
download | re3-c403df08611c857f43ebf708799974f06b4e8a8a.tar re3-c403df08611c857f43ebf708799974f06b4e8a8a.tar.gz re3-c403df08611c857f43ebf708799974f06b4e8a8a.tar.bz2 re3-c403df08611c857f43ebf708799974f06b4e8a8a.tar.lz re3-c403df08611c857f43ebf708799974f06b4e8a8a.tar.xz re3-c403df08611c857f43ebf708799974f06b4e8a8a.tar.zst re3-c403df08611c857f43ebf708799974f06b4e8a8a.zip |
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/AudioLogic.cpp | 33 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 2 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 60989aba..b174a924 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -2265,34 +2265,36 @@ cAudioManager::HasAirBrakes(int32 model) const || model == COACH || model == PACKER || model == FLATBED; } -bool +void cAudioManager::ProcessEngineDamage(cVehicleParams *params) { const int engineDamageIntensity = 40; - CAutomobile *veh; - uint8 engineStatus; + float health; uint8 emittingVolume; if (params->m_fDistance >= SQR(engineDamageIntensity)) - return false; - veh = (CAutomobile *)params->m_pVehicle; - if (veh->bEngineOn) { - engineStatus = veh->Damage.GetEngineStatus(); - if (engineStatus > 250 || engineStatus < 100) - return true; - if (engineStatus < 225) { - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; - emittingVolume = 6; - m_sQueueSample.m_nReleasingVolumeModificator = 7; - m_sQueueSample.m_nFrequency = 40000; - } else { + return; + if (params->m_pVehicle->m_modelIndex == MI_CADDY) + return; + if (params->m_pVehicle->GetStatus() == STATUS_WRECKED) + return; + health = params->m_pVehicle->m_fHealth; + if (health < 390.0f) { + if (health < 250.0f) { emittingVolume = 60; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nReleasingVolumeModificator = 7; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); + } else { + emittingVolume = 30; + m_sQueueSample.m_nSampleIndex = SFX_PALM_TREE_LO; + m_sQueueSample.m_nReleasingVolumeModificator = 7; + m_sQueueSample.m_nFrequency = 27000; } CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + if (params->m_pVehicle->bIsDrowning) + emittingVolume /= 2; m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 28; @@ -2311,7 +2313,6 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params) AddSampleToRequestedQueue(); } } - return true; } bool diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 0cd86219..c3462291 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -323,7 +323,7 @@ public: bool ProcessCarBombTick(cVehicleParams *params); void ProcessCesna(cVehicleParams *params); //void ProcessCrane(); - bool ProcessEngineDamage(cVehicleParams *params); + void ProcessEngineDamage(cVehicleParams *params); //done void ProcessEntity(int32 sound); //done void ProcessExplosions(int32 explosion); void ProcessFireHydrant(); |