Implement ProcessFires

This commit is contained in:
Filip Gawin 2020-02-24 21:09:05 +01:00
parent 0d1f42add1
commit 67398809a3
3 changed files with 79 additions and 7 deletions

View File

@ -3636,11 +3636,83 @@ cAudioManager::ProcessFireHydrant()
} }
} }
WRAPPER void cAudioManager::ProcessFires(int32)
void
cAudioManager::ProcessFires(int32 entity)
{ {
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 void

View File

@ -500,13 +500,13 @@ public:
bool ProcessCarBombTick(cVehicleParams *params); /// ok bool ProcessCarBombTick(cVehicleParams *params); /// ok
void ProcessCesna(cVehicleParams *params); /// ok void ProcessCesna(cVehicleParams *params); /// ok
void ProcessCinemaScriptObject(uint8 sound); /// ok void ProcessCinemaScriptObject(uint8 sound); /// ok
void ProcessCrane(); // todo requires CCrane void ProcessCrane(); /// ok
void ProcessDocksScriptObject(uint8 sound); /// ok void ProcessDocksScriptObject(uint8 sound); /// ok
bool ProcessEngineDamage(cVehicleParams *params); /// ok bool ProcessEngineDamage(cVehicleParams *params); /// ok
void ProcessEntity(int32 sound); /// ok void ProcessEntity(int32 sound); /// ok
void ProcessExplosions(int32 explosion); /// ok void ProcessExplosions(int32 explosion); /// ok
void ProcessFireHydrant(); /// ok void ProcessFireHydrant(); /// ok
void ProcessFires(int32 entity); // todo requires gFireManager void ProcessFires(int32 entity); /// ok
void ProcessFrontEnd(); /// ok void ProcessFrontEnd(); /// ok
void ProcessGarages(); // todo requires CGarages::aGarages void ProcessGarages(); // todo requires CGarages::aGarages
bool ProcessHelicopter(cVehicleParams *params); /// ok bool ProcessHelicopter(cVehicleParams *params); /// ok

View File

@ -28,8 +28,8 @@ class CFireManager
MAX_FIREMEN_ATTENDING = 2, MAX_FIREMEN_ATTENDING = 2,
}; };
uint32 m_nTotalFires; uint32 m_nTotalFires;
CFire m_aFires[NUM_FIRES];
public: public:
CFire m_aFires[NUM_FIRES];
void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32); void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32);
void StartFire(CVector, float, uint8); void StartFire(CVector, float, uint8);
void Update(void); void Update(void);