diff options
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/AudioLogic.cpp | 54 | ||||
-rw-r--r-- | src/audio/AudioManager.cpp | 4 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 2 | ||||
-rw-r--r-- | src/audio/MusicManager.cpp | 10 | ||||
-rw-r--r-- | src/audio/PoliceRadio.cpp | 2 |
5 files changed, 26 insertions, 46 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index be8ab269..5b2fb75c 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -123,39 +123,39 @@ cAudioManager::PostInitialiseGameSpecificSetup() { m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager); if (m_nFireAudioEntity >= 0) - SetEntityStatus(m_nFireAudioEntity, 1); + SetEntityStatus(m_nFireAudioEntity, true); m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1); if (m_nCollisionEntity >= 0) - SetEntityStatus(m_nCollisionEntity, 1); + SetEntityStatus(m_nCollisionEntity, true); m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1); if (m_nFrontEndEntity >= 0) - SetEntityStatus(m_nFrontEndEntity, 1); + SetEntityStatus(m_nFrontEndEntity, true); m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1); if (m_nProjectileEntity >= 0) - SetEntityStatus(m_nProjectileEntity, 1); + SetEntityStatus(m_nProjectileEntity, true); m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1); if (m_nWaterCannonEntity >= 0) - SetEntityStatus(m_nWaterCannonEntity, 1); + SetEntityStatus(m_nWaterCannonEntity, true); m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1); if (m_nPoliceChannelEntity >= 0) - SetEntityStatus(m_nPoliceChannelEntity, 1); + SetEntityStatus(m_nPoliceChannelEntity, true); #ifdef GTA_BRIDGE m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void*)1); if (m_nBridgeEntity >= 0) - SetEntityStatus(m_nBridgeEntity, 1); + SetEntityStatus(m_nBridgeEntity, true); #endif // GTA_BRIDGE m_nEscalatorEntity = CreateEntity(AUDIOTYPE_ESCALATOR, (void*)1); if (m_nEscalatorEntity >= 0) - SetEntityStatus(m_nEscalatorEntity, 1); + SetEntityStatus(m_nEscalatorEntity, true); m_nExtraSoundsEntity = CreateEntity(AUDIOTYPE_EXTRA_SOUNDS, (void*)1); if (m_nExtraSoundsEntity >= 0) - SetEntityStatus(m_nExtraSoundsEntity, 1); + SetEntityStatus(m_nExtraSoundsEntity, true); m_sMissionAudio.m_nSampleIndex[0] = NO_SAMPLE; @@ -261,7 +261,7 @@ cAudioManager::ProcessReverb() const if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) { for (uint32 i = 0; i < numChannels; i++) { if (m_asActiveSamples[i].m_bReverbFlag) - SampleManager.SetChannelReverbFlag(i, 1); + SampleManager.SetChannelReverbFlag(i, true); } } } @@ -349,7 +349,7 @@ cAudioManager::ProcessSpecial() if (playerPed != nil) { if (playerPed->m_audioEntityId >= 0 && m_asAudioEntities[playerPed->m_audioEntityId].m_bIsUsed) { if (playerPed->EnteringCar()) { - if(!playerPed->bInVehicle&& CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == nil) + if(!playerPed->bInVehicle && CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == nil) SampleManager.StopChannel(m_nActiveSamples); } } @@ -360,7 +360,7 @@ cAudioManager::ProcessSpecial() void cAudioManager::ProcessEntity(int32 id) { - if (m_asAudioEntities[id].m_nStatus != STATUS_PLAYER) { + if (m_asAudioEntities[id].m_bStatus) { m_sQueueSample.m_nEntityIndex = id; switch (m_asAudioEntities[id].m_nType) { case AUDIOTYPE_PHYSICAL: @@ -1980,27 +1980,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh } } else { nCruising = 1; - params.m_pVehicle->bAudioChangingGear = true; - bAccelSampleStopped = true; - SampleManager.StopChannel(m_nActiveSamples); - if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn - && !lostTraction && currentGear >= params.m_pTransmission->nNumberOfGears - 1) { - if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) { - if (nCruising < 800) - ++nCruising; - } else if (nCruising > 3) { - --nCruising; - } - freq = 27 * nCruising + freqModifier + 22050; - if (engineSoundType == SFX_BANK_TRUCK) - freq /= 2; - AudioManager.AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); - } else { - nCruising = 0; - } + goto PlayCruising; } } } else { +PlayCruising: bAccelSampleStopped = true; SampleManager.StopChannel(m_nActiveSamples); if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn @@ -2014,7 +1998,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freq = 27 * nCruising + freqModifier + 22050; if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; - AudioManager.AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); + AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); } else { nCruising = 0; } @@ -2210,7 +2194,6 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) if (veh->m_modelIndex == MI_MRWHOOP) return true; - veh->m_nAlarmState; if (veh->IsAlarmOn()) return true; @@ -4433,8 +4416,6 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_bRequireReflection = true; break; } - // TODO: breaks the game right now, probably needs AudioManager.cpp to be done first - /* case SOUND_WEAPON_CHAINSAW_ATTACK: if (FindVehicleOfPlayer()) continue; @@ -4469,7 +4450,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_AFTER_ACCEL_13); m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bReleasingSoundFlag = false; @@ -4491,13 +4472,12 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_AFTER_ACCEL_13); m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bReleasingSoundFlag = false; m_sQueueSample.m_nReleasingVolumeDivider = 5; break; - */ case SOUND_WEAPON_SHOT_FIRED: weapon = ped->GetWeapon(); if (!weapon) diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 949d8bfb..d441b750 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -128,7 +128,7 @@ cAudioManager::CreateEntity(eAudioType type, void *entity) for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) { if (!m_asAudioEntities[i].m_bIsUsed) { m_asAudioEntities[i].m_bIsUsed = true; - m_asAudioEntities[i].m_nStatus = 0; + m_asAudioEntities[i].m_bStatus = false; m_asAudioEntities[i].m_nType = type; m_asAudioEntities[i].m_pEntity = entity; m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_NO_SOUND; @@ -163,7 +163,7 @@ void cAudioManager::SetEntityStatus(int32 id, uint8 status) { if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) - m_asAudioEntities[id].m_nStatus = status; + m_asAudioEntities[id].m_bStatus = status; } void diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index d0f11427..378e16d3 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -49,7 +49,7 @@ public: eAudioType m_nType; void *m_pEntity; bool m_bIsUsed; - uint8 m_nStatus; + uint8 m_bStatus; int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS]; float m_afVolume[NUM_AUDIOENTITY_EVENTS]; uint8 m_AudioEvents; diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 8aedf306..c4abf351 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -223,8 +223,8 @@ void cMusicManager::SetRadioChannelByScript(uint32 station, int32 pos) { if (m_bIsInitialised) { - if (station == USERTRACK) - station = RADIO_OFF; + if (station == STREAMED_SOUND_RADIO_MP3_PLAYER) + station = STREAMED_SOUND_CITY_AMBIENT; if (station <= STREAMED_SOUND_RADIO_POLICE) { m_bRadioSetByScript = true; m_nRadioStation = station; @@ -512,7 +512,7 @@ cMusicManager::ServiceGameMode() gRetuneCounter = 0; field_2 = false; } else if (ped) { - if (ped->m_objective != OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN && ped->m_objective != OBJ_55) { + if(!ped->DyingOrDead()) { #ifdef GTA_PC if (SampleManager.IsMP3RadioChannelAvailable() && vehicle->m_nRadioStation < USERTRACK @@ -564,8 +564,8 @@ cMusicManager::ServiceGameMode() gRetuneCounter = 0; return; } - if (m_nAnnouncement == NO_TRACK) - { + if(m_nAnnouncement == NO_TRACK) { + m_nStreamedTrack = NO_TRACK; m_nFrontendTrack = GetCarTuning(); field_2 = false; gRetuneCounter = 0; diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index 781040d6..30fcbde0 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -67,7 +67,7 @@ cAudioManager::InitialisePoliceRadio() for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE; - SampleManager.SetChannelReverbFlag(policeChannel, 0); + SampleManager.SetChannelReverbFlag(policeChannel, false); gSpecialSuspectLastSeenReport = false; for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++) gMinTimeToNextReport[i] = m_FrameCounter; |