diff options
author | Roman Masanin <36927roma@gmail.com> | 2020-10-24 19:47:03 +0200 |
---|---|---|
committer | Roman Masanin <36927roma@gmail.com> | 2020-10-24 19:47:03 +0200 |
commit | a9db60a1d9e8060920c23e1304a49a8fb8bbc7a7 (patch) | |
tree | 1fd67aa6c9aab5f78af4210a75773e873c9679e0 /src/audio/AudioLogic.cpp | |
parent | fires (diff) | |
download | re3-a9db60a1d9e8060920c23e1304a49a8fb8bbc7a7.tar re3-a9db60a1d9e8060920c23e1304a49a8fb8bbc7a7.tar.gz re3-a9db60a1d9e8060920c23e1304a49a8fb8bbc7a7.tar.bz2 re3-a9db60a1d9e8060920c23e1304a49a8fb8bbc7a7.tar.lz re3-a9db60a1d9e8060920c23e1304a49a8fb8bbc7a7.tar.xz re3-a9db60a1d9e8060920c23e1304a49a8fb8bbc7a7.tar.zst re3-a9db60a1d9e8060920c23e1304a49a8fb8bbc7a7.zip |
Diffstat (limited to '')
-rw-r--r-- | src/audio/AudioLogic.cpp | 62 |
1 files changed, 28 insertions, 34 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index d999dfed..78cebf0e 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -3704,38 +3704,34 @@ DoJumboVolOffset() } void -cAudioManager::ProcessJumbo(cVehicleParams *params) +cAudioManager::ProcessJumbo(cVehicleParams* params) { - CPlane *plane; + CPlane* plane; float position; - if (params->m_fDistance < SQR(440)) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - plane = (CPlane *)params->m_pVehicle; - DoJumboVolOffset(); - position = PlanePathPosition[plane->m_nPlaneId]; - if (position <= TakeOffPoint) { - if (plane->m_fSpeed <= 0.103344f) { - ProcessJumboTaxi(); - return; - } + if (params->m_fDistance >= SQR(440)) + return; + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + plane = (CPlane*)params->m_pVehicle; + DoJumboVolOffset(); + position = PlanePathPosition[plane->m_nPlaneId]; + if (position <= TakeOffPoint) { + if (plane->m_fSpeed > 0.103344f) { ProcessJumboAccel(plane); - } else if (300.0f + TakeOffPoint >= position) { - ProcessJumboTakeOff(plane); - } else if (LandingPoint - 350.0f >= position) { - ProcessJumboFlying(); } else { - if (position > LandingPoint) { - if (plane->m_fSpeed > 0.103344f) { - ProcessJumboDecel(plane); - return; - } - ProcessJumboTaxi(); - return; - } - ProcessJumboLanding(plane); + ProcessJumboTaxi(); } + } else if (position <= TakeOffPoint + 300.0f) { + ProcessJumboTakeOff(plane); + } else if (position <= LandingPoint - 350.0f) { + ProcessJumboFlying(); + } else if (position <= LandingPoint) { + ProcessJumboLanding(plane); + } else if (plane->m_fSpeed > 0.103344f) { + ProcessJumboDecel(plane); + } else { + ProcessJumboTaxi(); } } @@ -3753,25 +3749,23 @@ cAudioManager::ProcessJumboAccel(CPlane *plane) { int32 engineFreq; int32 vol; - float whineSoundFreq; float modificator; + float freqModifier; if (SetupJumboFlySound(20)) { - modificator = (plane->m_fSpeed - 0.103344f) * 1.6760077f; - if (modificator > 1.0f) - modificator = 1.0f; + modificator = Min(1.0f, (plane->m_fSpeed - 0.103344f) * 1.6760077f); if (SetupJumboRumbleSound(MAX_VOLUME * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { if (modificator < 0.2f) { - whineSoundFreq = modificator * 5.f * 14600.0f + 29500; - vol = modificator * 5.f * MAX_VOLUME; - engineFreq = modificator * 5.f * 6050.f + 16000; + freqModifier = modificator * 5.0f; + vol = MAX_VOLUME * freqModifier; + engineFreq = 6050.0f * freqModifier + 16000; } else { - whineSoundFreq = 44100; + freqModifier = 1.0f; engineFreq = 22050; vol = MAX_VOLUME; } SetupJumboEngineSound(vol, engineFreq); - SetupJumboWhineSound(18, whineSoundFreq); + SetupJumboWhineSound(18, 14600.0f * freqModifier + 29500); } } } |