diff options
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/AudioLogic.cpp | 39 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 86 |
2 files changed, 62 insertions, 63 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 18fe4fc5..ab05d213 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -4784,11 +4784,10 @@ void cAudioManager::ProcessExplosions(int32 explosion) { uint8 type; - CVector *pos; float distSquared; for (uint8 i = 0; i < ARRAY_SIZE(gaExplosion); i++) { - if (CExplosion::GetExplosionActiveCounter(i) == 1) { + if (CExplosion::DoesExplosionMakeSound(i) && CExplosion::GetExplosionActiveCounter(i) == 1) { CExplosion::ResetExplosionActiveCounter(i); type = CExplosion::GetExplosionType(i); switch (type) { @@ -4796,42 +4795,44 @@ cAudioManager::ProcessExplosions(int32 explosion) case EXPLOSION_ROCKET: case EXPLOSION_BARREL: case EXPLOSION_TANK_GRENADE: - m_sQueueSample.m_fSoundIntensity = 400.0f; + m_sQueueSample.m_fSoundIntensity = 200.0f; m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; + m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; + m_sQueueSample.m_bRequireReflection = true; break; case EXPLOSION_MOLOTOV: - m_sQueueSample.m_fSoundIntensity = 200.0f; + m_sQueueSample.m_fSoundIntensity = 150.0f; m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_3; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; + m_sQueueSample.m_bRequireReflection = false; break; case EXPLOSION_MINE: case EXPLOSION_HELI_BOMB: - m_sQueueSample.m_fSoundIntensity = 300.0f; + m_sQueueSample.m_fSoundIntensity = 200.0f; m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; + m_sQueueSample.m_bRequireReflection = true; break; default: - m_sQueueSample.m_fSoundIntensity = 400.0f; + m_sQueueSample.m_fSoundIntensity = 200.0f; m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; + m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19500; if (type == EXPLOSION_HELI) - m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10; + m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10; //same *= 8 / 10; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_GENERIC_EXTRA; break; } - pos = CExplosion::GetExplosionPosition(i); - m_sQueueSample.m_vecPos = *pos; + m_sQueueSample.m_vecPos = *CExplosion::GetExplosionPosition(i); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_fDistance = distSquared <= 0.0f ? 0.0f : Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; @@ -4839,12 +4840,10 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = true; AddSampleToRequestedQueue(); } } @@ -5933,15 +5932,15 @@ cAudioManager::ProcessGarages() void cAudioManager::ProcessFireHydrant() { + static const int SOUND_INTENSITY = 35; + float distSquared; - bool distCalculated = false; - static const int intensity = 35; m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition(); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(intensity)) { - CalculateDistance(distCalculated, distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance); + if (distSquared < SQR(SOUND_INTENSITY)) { + m_sQueueSample.m_fDistance = distSquared <= 0.0f ? 0.0f : Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(40, 35.0f, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; @@ -5954,7 +5953,7 @@ cAudioManager::ProcessFireHydrant() m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = intensity; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = false; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = true; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 267260c5..a43b4309 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -257,9 +257,9 @@ public: uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; // done int32 CreateEntity(eAudioType type, void *entity); // done - void DestroyAllGameCreatedEntities(); - void DestroyEntity(int32 id); //done (inlined in vc) - void DoPoliceRadioCrackle(); + void DestroyAllGameCreatedEntities(); // done ? I don't seed pEntity = nil; + void DestroyEntity(int32 id); // done (inlined in vc) ? I not seen id checks + void DoPoliceRadioCrackle(); // done // functions returning talk sfx, // order from GetPedCommentSfx @@ -296,12 +296,12 @@ public: bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; - void PlayLoadedMissionAudio(uint8 slot); // done - void PlayOneShot(int32 index, int16 sound, float vol); // done - void PlaySuspectLastSeen(float x, float y, float z); - void PlayerJustGotInCar() const; // done - void PlayerJustLeftCar() const; // done - void PostInitialiseGameSpecificSetup(); + void PlayLoadedMissionAudio(uint8 slot); // done + void PlayOneShot(int32 index, int16 sound, float vol); // done + void PlaySuspectLastSeen(float x, float y, float z); // + void PlayerJustGotInCar() const; // done + void PlayerJustLeftCar() const; // done + void PostInitialiseGameSpecificSetup(); // void PostTerminateGameSpecificShutdown(); // done void PreInitialiseGameSpecificSetup() const; // done void PreloadMissionAudio(uint8 slot, Const char *name); // done @@ -317,40 +317,40 @@ public: void ProcessBridgeOneShots(); void ProcessBridgeWarning(); #endif - bool ProcessCarBombTick(cVehicleParams *params); //done - void ProcessCesna(cVehicleParams *params); - //void ProcessCrane(); - bool ProcessEngineDamage(cVehicleParams *params); //done - void ProcessEntity(int32 sound); //done - void ProcessExplosions(int32 explosion); - void ProcessFireHydrant(); - void ProcessFires(int32 entity); - void ProcessFrontEnd(); - 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 ProcessLoopingScriptObject(uint8 sound); - void ProcessMissionAudio(); - void ProcessMissionAudioSlot(uint8 slot); - void ProcessModelCarEngine(cVehicleParams *params); - void ProcessOneShotScriptObject(uint8 sound); - void ProcessPed(CPhysical *ped); - void ProcessPedOneShots(cPedParams *params); - void ProcessPhysical(int32 id); //done - void ProcessPlane(cVehicleParams *params); //done - void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh); //done - void ProcessProjectiles(); - void ProcessRainOnVehicle(cVehicleParams *params); - void ProcessReverb() const; - bool ProcessReverseGear(cVehicleParams *params); //done - void ProcessScriptObject(int32 id); //done + bool ProcessCarBombTick(cVehicleParams *params); // done + void ProcessCesna(cVehicleParams *params); // + //void ProcessCrane(); // + bool ProcessEngineDamage(cVehicleParams *params); // done + void ProcessEntity(int32 sound); // done + void ProcessExplosions(int32 explosion); // done + void ProcessFireHydrant(); // done + void ProcessFires(int32 entity); // + void ProcessFrontEnd(); // + 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 ProcessLoopingScriptObject(uint8 sound); // + void ProcessMissionAudio(); // + void ProcessMissionAudioSlot(uint8 slot); // + void ProcessModelCarEngine(cVehicleParams *params); // + void ProcessOneShotScriptObject(uint8 sound); // + void ProcessPed(CPhysical *ped); // + void ProcessPedOneShots(cPedParams *params); // + void ProcessPhysical(int32 id); // done + void ProcessPlane(cVehicleParams *params); // done + void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh); // done + void ProcessProjectiles(); // + void ProcessRainOnVehicle(cVehicleParams *params); // + void ProcessReverb() const; // + bool ProcessReverseGear(cVehicleParams *params); // done + void ProcessScriptObject(int32 id); // done void ProcessSpecial(); #ifdef GTA_TRAIN bool ProcessTrainNoise(cVehicleParams *params); |