diff options
author | Filip Gawin <filip.gawin@zoho.com> | 2020-02-24 21:09:05 +0100 |
---|---|---|
committer | Filip Gawin <filip.gawin@zoho.com> | 2020-03-22 17:30:54 +0100 |
commit | 67398809a301cf7968bdd6eaae798c8871c4ea4a (patch) | |
tree | d1e77b4e2ece88e291cd1cac3c08a357215cb002 | |
parent | Implement ProcessCrane (diff) | |
download | re3-67398809a301cf7968bdd6eaae798c8871c4ea4a.tar re3-67398809a301cf7968bdd6eaae798c8871c4ea4a.tar.gz re3-67398809a301cf7968bdd6eaae798c8871c4ea4a.tar.bz2 re3-67398809a301cf7968bdd6eaae798c8871c4ea4a.tar.lz re3-67398809a301cf7968bdd6eaae798c8871c4ea4a.tar.xz re3-67398809a301cf7968bdd6eaae798c8871c4ea4a.tar.zst re3-67398809a301cf7968bdd6eaae798c8871c4ea4a.zip |
-rw-r--r-- | src/audio/AudioManager.cpp | 80 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 4 | ||||
-rw-r--r-- | src/core/Fire.h | 2 |
3 files changed, 79 insertions, 7 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index eafd1c9a..ab3745f5 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -3636,11 +3636,83 @@ cAudioManager::ProcessFireHydrant() } } -WRAPPER -void -cAudioManager::ProcessFires(int32 entity) +void cAudioManager::ProcessFires(int32) { - EAXJMP(0x575CD0); + CEntity *entity; + uint8 emittingVol; + float maxDist; + float distSquared; + + for(uint8 i = 0; i < NUM_FIRES; i++) { + if(gFireManager.m_aFires[i].m_bIsOngoing && gFireManager.m_aFires[i].m_bAudioSet) { + entity = gFireManager.m_aFires[i].m_pEntity; + if(entity) { + switch(entity->m_type & 7) { + case ENTITY_TYPE_BUILDING: + maxDist = 2500.f; + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; + emittingVol = 100; + m_sQueueSample.m_nFrequency = + 8 / 10 * SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); + m_sQueueSample.m_nFrequency += i * ((uint32)m_sQueueSample.m_nFrequency >> 6); + m_sQueueSample.field_16 = 6; + break; + case ENTITY_TYPE_PED: + maxDist = 625.f; + m_sQueueSample.m_fSoundIntensity = 25.0f; + m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE); + emittingVol = 60; + m_sQueueSample.m_nFrequency += i * ((uint32)m_sQueueSample.m_nFrequency >> 6); + m_sQueueSample.field_16 = 10; + break; + default: + maxDist = 2500.f; + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); + m_sQueueSample.m_nFrequency += i * ((uint32)m_sQueueSample.m_nFrequency >> 6); + emittingVol = 80; + m_sQueueSample.field_16 = 8; + } + } else { + maxDist = 2500.f; + m_sQueueSample.m_fSoundIntensity = 50.0; + m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); + m_sQueueSample.m_nFrequency += i * ((uint32)m_sQueueSample.m_nFrequency >> 6); + emittingVol = 80; + m_sQueueSample.field_16 = 8; + } + m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos; + distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + if(distSquared < maxDist) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, + m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_counter = i; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.field_48 = 2.0; + m_sQueueSample.field_76 = 10; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.field_56 = 0; + m_sQueueSample.m_bEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = + SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + } + } + } } void diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 5e533bff..e4d2fa6d 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -500,13 +500,13 @@ public: bool ProcessCarBombTick(cVehicleParams *params); /// ok void ProcessCesna(cVehicleParams *params); /// ok void ProcessCinemaScriptObject(uint8 sound); /// ok - void ProcessCrane(); // todo requires CCrane + void ProcessCrane(); /// ok void ProcessDocksScriptObject(uint8 sound); /// ok bool ProcessEngineDamage(cVehicleParams *params); /// ok void ProcessEntity(int32 sound); /// ok void ProcessExplosions(int32 explosion); /// ok void ProcessFireHydrant(); /// ok - void ProcessFires(int32 entity); // todo requires gFireManager + void ProcessFires(int32 entity); /// ok void ProcessFrontEnd(); /// ok void ProcessGarages(); // todo requires CGarages::aGarages bool ProcessHelicopter(cVehicleParams *params); /// ok diff --git a/src/core/Fire.h b/src/core/Fire.h index 9d72179e..624bf608 100644 --- a/src/core/Fire.h +++ b/src/core/Fire.h @@ -28,8 +28,8 @@ class CFireManager MAX_FIREMEN_ATTENDING = 2, }; uint32 m_nTotalFires; - CFire m_aFires[NUM_FIRES]; public: + CFire m_aFires[NUM_FIRES]; void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32); void StartFire(CVector, float, uint8); void Update(void); |