This commit is contained in:
Roman Masanin 2020-10-24 20:47:03 +03:00
parent beae41b207
commit a9db60a1d9
2 changed files with 35 additions and 41 deletions

View file

@ -3704,38 +3704,34 @@ DoJumboVolOffset()
} }
void void
cAudioManager::ProcessJumbo(cVehicleParams *params) cAudioManager::ProcessJumbo(cVehicleParams* params)
{ {
CPlane *plane; CPlane* plane;
float position; float position;
if (params->m_fDistance < SQR(440)) { if (params->m_fDistance >= SQR(440))
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); return;
plane = (CPlane *)params->m_pVehicle;
DoJumboVolOffset();
position = PlanePathPosition[plane->m_nPlaneId];
if (position <= TakeOffPoint) {
if (plane->m_fSpeed <= 0.103344f) {
ProcessJumboTaxi();
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); ProcessJumboAccel(plane);
} else if (300.0f + TakeOffPoint >= position) {
ProcessJumboTakeOff(plane);
} else if (LandingPoint - 350.0f >= position) {
ProcessJumboFlying();
} else { } else {
if (position > LandingPoint) { ProcessJumboTaxi();
if (plane->m_fSpeed > 0.103344f) {
ProcessJumboDecel(plane);
return;
}
ProcessJumboTaxi();
return;
}
ProcessJumboLanding(plane);
} }
} 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 engineFreq;
int32 vol; int32 vol;
float whineSoundFreq;
float modificator; float modificator;
float freqModifier;
if (SetupJumboFlySound(20)) { if (SetupJumboFlySound(20)) {
modificator = (plane->m_fSpeed - 0.103344f) * 1.6760077f; modificator = Min(1.0f, (plane->m_fSpeed - 0.103344f) * 1.6760077f);
if (modificator > 1.0f)
modificator = 1.0f;
if (SetupJumboRumbleSound(MAX_VOLUME * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { if (SetupJumboRumbleSound(MAX_VOLUME * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) {
if (modificator < 0.2f) { if (modificator < 0.2f) {
whineSoundFreq = modificator * 5.f * 14600.0f + 29500; freqModifier = modificator * 5.0f;
vol = modificator * 5.f * MAX_VOLUME; vol = MAX_VOLUME * freqModifier;
engineFreq = modificator * 5.f * 6050.f + 16000; engineFreq = 6050.0f * freqModifier + 16000;
} else { } else {
whineSoundFreq = 44100; freqModifier = 1.0f;
engineFreq = 22050; engineFreq = 22050;
vol = MAX_VOLUME; vol = MAX_VOLUME;
} }
SetupJumboEngineSound(vol, engineFreq); SetupJumboEngineSound(vol, engineFreq);
SetupJumboWhineSound(18, whineSoundFreq); SetupJumboWhineSound(18, 14600.0f * freqModifier + 29500);
} }
} }
} }

View file

@ -325,13 +325,13 @@ public:
void ProcessGarages(); // void ProcessGarages(); //
void ProcessCarHeli(cVehicleParams* params); // done void ProcessCarHeli(cVehicleParams* params); // done
void ProcessVehicleFlatTyre(cVehicleParams* params); // done void ProcessVehicleFlatTyre(cVehicleParams* params); // done
void ProcessJumbo(cVehicleParams *); // void ProcessJumbo(cVehicleParams *); // done
void ProcessJumboAccel(CPlane *plane); // void ProcessJumboAccel(CPlane *plane); // done
void ProcessJumboDecel(CPlane *plane); // void ProcessJumboDecel(CPlane *plane); // done
void ProcessJumboFlying(); // void ProcessJumboFlying(); // done
void ProcessJumboLanding(CPlane *plane); // void ProcessJumboLanding(CPlane *plane); // done
void ProcessJumboTakeOff(CPlane *plane); // void ProcessJumboTakeOff(CPlane *plane); // done
void ProcessJumboTaxi(); // void ProcessJumboTaxi(); // done
void ProcessLoopingScriptObject(uint8 sound); // void ProcessLoopingScriptObject(uint8 sound); //
void ProcessMissionAudio(); // void ProcessMissionAudio(); //
void ProcessMissionAudioSlot(uint8 slot); // void ProcessMissionAudioSlot(uint8 slot); //