processEngineDamage

This commit is contained in:
Roman Masanin 2020-09-27 02:03:36 +03:00
parent bb2e601e13
commit c403df0861
2 changed files with 18 additions and 17 deletions

View file

@ -2265,34 +2265,36 @@ cAudioManager::HasAirBrakes(int32 model) const
|| model == COACH || model == PACKER || model == FLATBED; || model == COACH || model == PACKER || model == FLATBED;
} }
bool void
cAudioManager::ProcessEngineDamage(cVehicleParams *params) cAudioManager::ProcessEngineDamage(cVehicleParams *params)
{ {
const int engineDamageIntensity = 40; const int engineDamageIntensity = 40;
CAutomobile *veh; float health;
uint8 engineStatus;
uint8 emittingVolume; uint8 emittingVolume;
if (params->m_fDistance >= SQR(engineDamageIntensity)) if (params->m_fDistance >= SQR(engineDamageIntensity))
return false; return;
veh = (CAutomobile *)params->m_pVehicle; if (params->m_pVehicle->m_modelIndex == MI_CADDY)
if (veh->bEngineOn) { return;
engineStatus = veh->Damage.GetEngineStatus(); if (params->m_pVehicle->GetStatus() == STATUS_WRECKED)
if (engineStatus > 250 || engineStatus < 100) return;
return true; health = params->m_pVehicle->m_fHealth;
if (engineStatus < 225) { if (health < 390.0f) {
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; if (health < 250.0f) {
emittingVolume = 6;
m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nFrequency = 40000;
} else {
emittingVolume = 60; emittingVolume = 60;
m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
m_sQueueSample.m_nReleasingVolumeModificator = 7; m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); 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); 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); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 28; m_sQueueSample.m_nCounter = 28;
@ -2311,7 +2313,6 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
} }
} }
return true;
} }
bool bool

View file

@ -323,7 +323,7 @@ public:
bool ProcessCarBombTick(cVehicleParams *params); bool ProcessCarBombTick(cVehicleParams *params);
void ProcessCesna(cVehicleParams *params); void ProcessCesna(cVehicleParams *params);
//void ProcessCrane(); //void ProcessCrane();
bool ProcessEngineDamage(cVehicleParams *params); void ProcessEngineDamage(cVehicleParams *params); //done
void ProcessEntity(int32 sound); //done void ProcessEntity(int32 sound); //done
void ProcessExplosions(int32 explosion); void ProcessExplosions(int32 explosion);
void ProcessFireHydrant(); void ProcessFireHydrant();