From a9db60a1d9e8060920c23e1304a49a8fb8bbc7a7 Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Sat, 24 Oct 2020 20:47:03 +0300 Subject: jumbo --- src/audio/AudioLogic.cpp | 62 ++++++++++++++++++++++-------------------------- src/audio/AudioManager.h | 14 +++++------ 2 files changed, 35 insertions(+), 41 deletions(-) (limited to 'src/audio') 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); } } } diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 5d6b4f9f..57293442 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -325,13 +325,13 @@ public: void ProcessGarages(); // void ProcessCarHeli(cVehicleParams* params); // done void ProcessVehicleFlatTyre(cVehicleParams* params); // done - void ProcessJumbo(cVehicleParams *); // - void ProcessJumboAccel(CPlane *plane); // - void ProcessJumboDecel(CPlane *plane); // - void ProcessJumboFlying(); // - void ProcessJumboLanding(CPlane *plane); // - void ProcessJumboTakeOff(CPlane *plane); // - void ProcessJumboTaxi(); // + void ProcessJumbo(cVehicleParams *); // done + void ProcessJumboAccel(CPlane *plane); // done + void ProcessJumboDecel(CPlane *plane); // done + void ProcessJumboFlying(); // done + void ProcessJumboLanding(CPlane *plane); // done + void ProcessJumboTakeOff(CPlane *plane); // done + void ProcessJumboTaxi(); // done void ProcessLoopingScriptObject(uint8 sound); // void ProcessMissionAudio(); // void ProcessMissionAudioSlot(uint8 slot); // -- cgit v1.2.3