diff options
Diffstat (limited to '')
99 files changed, 6012 insertions, 2728 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 39352f0e..a5b44461 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -29,12 +29,10 @@ after_build: $url = "$releases/download/$latestVersion/$name" - Start-FileDownload $url -FileName 'C:\Ultimate-ASI-Loader.zip' 7z e c:\Ultimate-ASI-Loader.zip -oc:\Projects\re3\bin\${env:CONFIGURATION} - cd "bin\${env:CONFIGURATION}" copy re3.dll re3.asi @@ -44,4 +42,4 @@ after_build: Get-ChildItem .\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } artifacts: - path: bin/%CONFIGURATION%/re3.dll - name: re3.dll
\ No newline at end of file + name: re3.dll diff --git a/premake5.lua b/premake5.lua index 8b2373a1..b06749c5 100644 --- a/premake5.lua +++ b/premake5.lua @@ -15,6 +15,7 @@ workspace "re3" files { "src/render/*.*" } files { "src/skel/*.*" } files { "src/skel/win/*.*" } + files { "src/text/*.*" } files { "src/vehicles/*.*" } files { "src/weapons/*.*" } files { "eax/*.*" } @@ -32,6 +33,7 @@ workspace "re3" includedirs { "src/render" } includedirs { "src/skel/" } includedirs { "src/skel/win" } + includedirs { "src/text" } includedirs { "src/vehicles" } includedirs { "src/weapons" } includedirs { "eax" } diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index b82c650c..e3ae9068 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -1,21 +1,26 @@ #include "common.h" #include "patcher.h" +#include "audio_enums.h" #include "AudioManager.h" #include "Automobile.h" #include "Boat.h" #include "Bridge.h" +#include "CProjectileInfo.h" #include "Camera.h" #include "DMAudio.h" +#include "Entity.h" #include "Explosion.h" #include "Garages.h" +#include "HandlingMgr.h" #include "Heli.h" #include "ModelIndices.h" #include "MusicManager.h" #include "Pad.h" #include "Ped.h" #include "Physical.h" +#include "Placeable.h" #include "Plane.h" #include "PlayerPed.h" #include "Pools.h" @@ -25,9 +30,11 @@ #include "Train.h" #include "Transmission.h" #include "Vehicle.h" +#include "WaterCannon.h" #include "Weather.h" #include "World.h" #include "ZoneCull.h" +#include "Zones.h" #include "sampman.h" cAudioManager &AudioManager = *(cAudioManager *)0x880FC0; @@ -39,9 +46,25 @@ int32 *BankStartOffset = (int32 *)0x6FAB70; //[2] int32 &g_nMissionAudioSfx = *(int32 *)0x60ED84; bool &bPlayerJustEnteredCar = *(bool *)0x6508C4; bool &g_bMissionAudioLoadFailed = *(bool *)0x95CD8E; +uint32 *gMinTimeToNextReport = (uint32 *)0x8E2828; +uint8 &gSpecialSuspectLastSeenReport = *(uint8 *)0x95CD4D; +bool hornPatternsArray[8][44] = { + {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false}, + {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false}, + {false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false}, + {false, false, true, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false}, + {false, false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, + {false, false, true, true, true, false, false, false, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, + {false, false, true, true, true, true, false, false, false, false, true, true, true, false, false, true, true, true, false, false, true, true, true, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, false, false}, + {false, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false}, +}; constexpr int totalAudioEntitiesSlots = 200; constexpr int maxVolume = 127; +constexpr int policeChannel = 28; +constexpr uint8 panTable[64]{0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, + 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, + 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63}; // TODO: where is this used? Is this the right file? enum eVehicleModel { @@ -122,7 +145,7 @@ cPedComments::Add(tPedComment *com) { uint8 index; - if(nrOfCommentsInBank[activeBank] >= 20u) { + if(nrOfCommentsInBank[activeBank] >= 20) { index = indexMap[activeBank][19]; if(m_asPedComments[activeBank][index].m_bVolume > com->m_bVolume) return; } else { @@ -144,8 +167,7 @@ cPedComments::Add(tPedComment *com) } } - if(i < index) - memmove(&indexMap[activeBank][i + 1], &indexMap[activeBank][i], 19 - i); + if(i < index) memmove(&indexMap[activeBank][i + 1], &indexMap[activeBank][i], 19 - i); } indexMap[activeBank][i] = index; @@ -160,10 +182,8 @@ cPedComments::Process() if(!AudioManager.m_bUserPause) { if(nrOfCommentsInBank[activeBank]) { - sampleIndex = - m_asPedComments[activeBank][indexMap[activeBank][0]].m_nSampleIndex; - if(!SampleManager.IsPedCommentLoaded(sampleIndex)) - SampleManager.LoadPedComment(sampleIndex); + sampleIndex = m_asPedComments[activeBank][indexMap[activeBank][0]].m_nSampleIndex; + if(!SampleManager.IsPedCommentLoaded(sampleIndex)) SampleManager.LoadPedComment(sampleIndex); AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[activeBank][indexMap[activeBank][0]].m_entityIndex; @@ -203,12 +223,9 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_bIsDistant = 0; AudioManager.m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency( - AudioManager.m_sQueueSample.m_nSampleIndex) + - AudioManager.RandomDisplacement(750u); - if(CTimer::GetIsSlowMotionActive()) - AudioManager.m_sQueueSample.m_nFrequency = - AudioManager.m_sQueueSample.m_nFrequency >> 1; + SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) + + AudioManager.RandomDisplacement(750); + if(CTimer::GetIsSlowMotionActive()) AudioManager.m_sQueueSample.m_nFrequency /= 2; m_asPedComments[activeBank][indexMap[activeBank][0]].field_25 = -1; AudioManager.AddSampleToRequestedQueue(); } @@ -223,10 +240,8 @@ cPedComments::Process() } comment = m_asPedComments[actualUsedBank]; for(uint32 i = 0; i < nrOfCommentsInBank[actualUsedBank]; i++) { - if(m_asPedComments[actualUsedBank][indexMap[actualUsedBank][i]].field_25 > - 0) { - --m_asPedComments[actualUsedBank][indexMap[actualUsedBank][i]] - .field_25; + if(m_asPedComments[actualUsedBank][indexMap[actualUsedBank][i]].field_25 > 0) { + --m_asPedComments[actualUsedBank][indexMap[actualUsedBank][i]].field_25; Add(&comment[indexMap[actualUsedBank][i]]); } } @@ -236,6 +251,42 @@ cPedComments::Process() } } +void +cAudioCollisionManager::AddCollisionToRequestedQueue() +{ + int32 collisionsIndex; + int32 i; + + if(m_bCollisionsInQueue >= 10) { + collisionsIndex = m_bIndicesTable[9]; + if(m_sQueue.m_fDistance >= m_asCollisions1[collisionsIndex].m_fDistance) return; + } else { + collisionsIndex = m_bCollisionsInQueue++; + } + + m_asCollisions1[collisionsIndex] = m_sQueue; + + i = 0; + if(collisionsIndex) { + while(m_asCollisions1[m_bIndicesTable[i]].m_fDistance <= m_asCollisions1[collisionsIndex].m_fDistance) { + if(++i >= collisionsIndex) { + m_bIndicesTable[i] = collisionsIndex; + return; + } + } + memmove(&m_bIndicesTable[i + 1], &m_bIndicesTable[i], 9 - i); + } + m_bIndicesTable[i] = collisionsIndex; +} + +void +cAudioScriptObject::Reset() +{ + AudioId = 125; + Posn = {0.0f, 0.0f, 0.0f}; + AudioEntity = AEHANDLE_NONE; +} + void * cAudioScriptObject::operator new(size_t sz) { @@ -263,24 +314,21 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample) uint32 i = 0; if(sample != 0) { for(; i < sample; i++) { - if(m_asSamples[m_bActiveSampleQueue] - [m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]] - .calculatedVolume > - m_asSamples[m_bActiveSampleQueue][sample].calculatedVolume) + if(m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]] + .calculatedVolume > m_asSamples[m_bActiveSampleQueue][sample].calculatedVolume) break; } if(i < sample) { memmove(&m_abSampleQueueIndexTable[m_bActiveSampleQueue][i + 1], - &m_abSampleQueueIndexTable[m_bActiveSampleQueue][i], - m_bActiveSamples - i - 1); + &m_abSampleQueueIndexTable[m_bActiveSampleQueue][i], m_bActiveSamples - i - 1); } } m_abSampleQueueIndexTable[m_bActiveSampleQueue][i] = sample; } void -cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, - uint8 counter, bool notLooping) +cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, uint8 counter, + bool notLooping) { m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { @@ -297,10 +345,8 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl m_sQueueSample.m_nLoopCount = 1; } m_sQueueSample.m_bEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 6.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.field_56 = 0; @@ -317,22 +363,20 @@ cAudioManager::AddReflectionsToRequestedQueue() int32 noise; uint8 emittingVolume = (m_sQueueSample.m_bVolume >> 1) + (m_sQueueSample.m_bVolume >> 3); - for(uint32 i = 0; i < 5u; i++) { + for(uint32 i = 0; i < 5; i++) { reflectionDistance = m_afReflectionsDistances[i]; if(reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_fSoundIntensity) { m_sQueueSample.m_bLoopsRemaining = (reflectionDistance * 500.f / 1029.f); - if(m_sQueueSample.m_bLoopsRemaining > 5u) { + if(m_sQueueSample.m_bLoopsRemaining > 5) { m_sQueueSample.m_fDistance = m_afReflectionsDistances[i]; m_sQueueSample.m_bEmittingVolume = emittingVolume; - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume( + emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume > emittingVolume >> 4) { m_sQueueSample.m_counter += ((i + 1) << 8); if(m_sQueueSample.m_nLoopCount) { - noise = RandomDisplacement( - m_sQueueSample.m_nFrequency >> 5); + noise = RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); if(noise <= 0) m_sQueueSample.m_nFrequency += noise; else @@ -347,15 +391,55 @@ cAudioManager::AddReflectionsToRequestedQueue() } } -#if 1 -WRAPPER void +void cAudioManager::AddReleasingSounds() { - EAXJMP(0x57B8D0); + bool toProcess[44]; + + for(int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; i++) { + tActiveSample &sample = + m_asSamples[!m_bActiveSampleQueue][m_abSampleQueueIndexTable[!m_bActiveSampleQueue][i]]; + if(!m_asSamples[!m_bActiveSampleQueue][m_abSampleQueueIndexTable[!m_bActiveSampleQueue][i]] + .m_bLoopEnded) { + toProcess[i] = false; + for(int32 j = 0; j < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; j++) { + if(sample.m_nEntityIndex == + m_asSamples[m_bActiveSampleQueue] + [m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]] + .m_nEntityIndex && + sample.m_counter == m_asSamples[m_bActiveSampleQueue] + [m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]] + .m_counter) { + toProcess[i] = true; + break; + } + } + if(!toProcess[i]) { + if(sample.m_counter <= 255u || !sample.m_bLoopsRemaining) { + if(!sample.field_76) continue; + if(!sample.m_nLoopCount) { + if(sample.field_88 == -1) { + sample.field_88 = sample.m_bVolume / sample.field_76; + if(sample.field_88 <= 0) sample.field_88 = 1; + } + if(sample.m_bVolume <= sample.field_88) { + sample.field_76 = 0; + continue; + } + sample.m_bVolume -= sample.field_88; + } + --sample.field_76; + if(field_2) { + if(sample.field_16 < 20) ++sample.field_16; + } + sample.field_56 = 0; + } + memcpy(&m_sQueueSample, &sample, 92); + AddSampleToRequestedQueue(); + } + } + } } -#else - -#endif void cAudioManager::AddSampleToRequestedQueue() @@ -368,11 +452,8 @@ cAudioManager::AddSampleToRequestedQueue() calculatedVolume = m_sQueueSample.field_16 * (maxVolume - m_sQueueSample.m_bVolume); sampleIndex = m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; if(sampleIndex >= m_bActiveSamples) { - sampleIndex = - m_abSampleQueueIndexTable[m_bActiveSampleQueue][m_bActiveSamples - 1]; - if(m_asSamples[m_bActiveSampleQueue][sampleIndex].calculatedVolume <= - calculatedVolume) - return; + sampleIndex = m_abSampleQueueIndexTable[m_bActiveSampleQueue][m_bActiveSamples - 1]; + if(m_asSamples[m_bActiveSampleQueue][sampleIndex].calculatedVolume <= calculatedVolume) return; } else { ++m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; } @@ -399,18 +480,21 @@ cAudioManager::AddSampleToRequestedQueue() } } -WRAPPER void cAudioManager::AgeCrimes() { - EAXJMP(0x580AF0); + for(uint8 i = 0; i < 10; i++) { + if(crimes[i].type) { + if(++crimes[i].timer > 1500) crimes[i].type = 0; + } + } } void cAudioManager::CalculateDistance(bool *ptr, float dist) { if(*ptr == false) { - m_sQueueSample.m_fDistance = sqrt(dist); + m_sQueueSample.m_fDistance = Sqrt(dist); *ptr = true; } } @@ -422,6 +506,39 @@ cAudioManager::CheckForAnAudioFileOnCD() const } void +cAudioManager::ClearActiveSamples() +{ + for(int32 i = 0; i < m_bActiveSamples; i++) { + m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE; + m_asActiveSamples[i].m_counter = 0; + m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE; + m_asActiveSamples[i].m_bBankIndex = 3; + m_asActiveSamples[i].m_bIsDistant = 0; + m_asActiveSamples[i].field_16 = 5; + m_asActiveSamples[i].m_nFrequency = 0; + m_asActiveSamples[i].m_bVolume = 0; + m_asActiveSamples[i].m_bEmittingVolume = 0; + m_asActiveSamples[i].m_fDistance = 0.0f; + m_asActiveSamples[i].m_bIsProcessed = 0; + m_asActiveSamples[i].m_bLoopEnded = 0; + m_asActiveSamples[i].m_nLoopCount = 1; + m_asActiveSamples[i].m_nLoopStart = 0; + m_asActiveSamples[i].m_nLoopEnd = -1; + m_asActiveSamples[i].field_48 = 0.0f; + m_asActiveSamples[i].m_fSoundIntensity = 200.0f; + m_asActiveSamples[i].m_bOffset = 63; + m_asActiveSamples[i].field_56 = 0; + m_asActiveSamples[i].calculatedVolume = 0; + m_asActiveSamples[i].field_76 = 0; + m_asActiveSamples[i].field_88 = -1; + m_asActiveSamples[i].m_vecPos = {0.0f, 0.0f, 0.0f}; + m_asActiveSamples[i].m_bReverbFlag = 0; + m_asActiveSamples[i].m_bLoopsRemaining = 0; + m_asActiveSamples[i].m_bRequireReflection = 0; + } +} + +void cAudioManager::ClearMissionAudio() { if(m_bIsInitialised) { @@ -466,23 +583,24 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, return newFreq; } -WRAPPER int32 -cAudioManager::ComputePan(float, CVector *) +cAudioManager::ComputePan(float dist, CVector *vec) { - EAXJMP(0x57AD20); + int32 index = min(63, Abs(vec->x / (dist / 64.f))); + + if(vec->x > 0.f) return max(20, 63 - panTable[index]); + return min(107, panTable[index] + 63); } -uint32 -cAudioManager::ComputeVolume(int emittingVolume, float soundIntensity, float distance) const +uint8 +cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const { float newSoundIntensity; if(soundIntensity <= 0.0f) return 0; if((soundIntensity * 0.2f) <= distance) { newSoundIntensity = soundIntensity * 0.2f; emittingVolume = - sq((soundIntensity - distance) / (soundIntensity - newSoundIntensity)) * - emittingVolume; + sq((soundIntensity - distance) / (soundIntensity - newSoundIntensity)) * emittingVolume; } return emittingVolume; } @@ -527,9 +645,11 @@ cAudioManager::DestroyAllGameCreatedEntities() case AUDIOTYPE_GARAGE: case AUDIOTYPE_FIREHYDRANT: DestroyEntity(i); break; case AUDIOTYPE_SCRIPTOBJECT: - entity = - (cAudioScriptObject *)m_asAudioEntities[i].m_pEntity; - if(entity) { delete entity; } + entity = (cAudioScriptObject *)m_asAudioEntities[i].m_pEntity; + if(entity) { + delete entity; + m_asAudioEntities[i].m_pEntity = nil; + } DestroyEntity(i); break; default: break; @@ -543,17 +663,14 @@ cAudioManager::DestroyAllGameCreatedEntities() void cAudioManager::DestroyEntity(int32 id) { - if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && - m_asAudioEntities[id].m_bIsUsed) { + if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed) { m_asAudioEntities[id].m_bIsUsed = 0; for(int32 i = 0; i < m_nAudioEntitiesTotal; ++i) { if(id == m_anAudioEntityIndices[i]) { if(i < totalAudioEntitiesSlots - 1) - memmove(&m_anAudioEntityIndices[i], - &m_anAudioEntityIndices[i + 1], + memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1], 4 * (m_nAudioEntitiesTotal - (i + 1))); - m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = - totalAudioEntitiesSlots; + m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = totalAudioEntitiesSlots; return; } } @@ -563,8 +680,7 @@ cAudioManager::DestroyEntity(int32 id) void cAudioManager::DoJumboVolOffset() const { - if(!(m_FrameCounter % (m_anRandomTable[0] % 6u + 3))) - jumboVolOffset = m_anRandomTable[1] % 60u; + if(!(m_nTimeOfRecentCrime % (m_anRandomTable[0] % 6 + 3))) jumboVolOffset = m_anRandomTable[1] % 60; } void @@ -576,9 +692,8 @@ cAudioManager::DoPoliceRadioCrackle() m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 1; m_sQueueSample.field_16 = 10; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_SCANNER_CRACKLE); - m_sQueueSample.m_bVolume = m_anRandomTable[2] % 20u + 15; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_SCANNER_CRACKLE); + m_sQueueSample.m_bVolume = m_anRandomTable[2] % 20 + 15; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(188); @@ -598,14 +713,9 @@ cAudioManager::GetPlayerTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_DAMAGE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DAMAGE_REACTION_1, 11u); - break; - - case SOUND_PED_HIT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HIT_REACTION_1, 10u); break; - - case SOUND_PED_LAND: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FALL_REACTION_1, 6u); break; - + case SOUND_PED_DAMAGE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DAMAGE_REACTION_1, 11); break; + case SOUND_PED_HIT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HIT_REACTION_1, 10); break; + case SOUND_PED_LAND: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FALL_REACTION_1, 6); break; default: sfx = NO_SAMPLE; break; } return sfx; @@ -619,14 +729,13 @@ cAudioManager::GetCopTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; if(sound == SOUND_PED_ARREST_COP) { - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_COP_1_ARREST_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_COP_1_ARREST_1, 6); } else { if(sound != SOUND_PED_PURSUIT_COP) { return GetGenericMaleTalkSfx(sound); } pedState = FindPlayerPed()->m_nPedState; - if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) - return NO_SAMPLE; - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_COP_1_PURSUIT_1, 7u); + if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE; + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_COP_1_PURSUIT_1, 7); } return 13 * (m_sQueueSample.m_nEntityIndex % 5) + sfx; @@ -640,14 +749,13 @@ cAudioManager::GetSwatTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; if(sound == SOUND_PED_ARREST_SWAT) { - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_SWAT_1_PURSUIT_ARREST_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_SWAT_1_PURSUIT_ARREST_1, 6); } else { if(sound != SOUND_PED_PURSUIT_SWAT) { return GetGenericMaleTalkSfx(sound); } pedState = FindPlayerPed()->m_nPedState; - if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) - return NO_SAMPLE; - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_SWAT_1_PURSUIT_ARREST_1, 6u); + if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE; + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_SWAT_1_PURSUIT_ARREST_1, 6); } return 6 * (m_sQueueSample.m_nEntityIndex % 3) + sfx; @@ -661,14 +769,13 @@ cAudioManager::GetFBITalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; if(sound == SOUND_PED_ARREST_FBI) { - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_FBI_1_PURSUIT_ARREST_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_FBI_1_PURSUIT_ARREST_1, 6); } else { if(sound != SOUND_PED_PURSUIT_FBI) { return GetGenericMaleTalkSfx(sound); } pedState = FindPlayerPed()->m_nPedState; - if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) - return NO_SAMPLE; - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_FBI_1_PURSUIT_ARREST_1, 6u); + if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE; + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_FBI_1_PURSUIT_ARREST_1, 6); } return 6 * (m_sQueueSample.m_nEntityIndex % 3) + sfx; @@ -684,9 +791,8 @@ cAudioManager::GetArmyTalkSfx(int16 sound) if(sound != SOUND_PED_PURSUIT_ARMY) { return GetGenericMaleTalkSfx(sound); } pedState = FindPlayerPed()->m_nPedState; - if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) - return NO_SAMPLE; - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_ARMY_1_PURSUIT_1, 15u); + if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE; + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_POLICE_ARMY_1_PURSUIT_1, 15); return 15 * (m_sQueueSample.m_nEntityIndex % 1) + sfx; } @@ -698,21 +804,11 @@ cAudioManager::GetMedicTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_HANDS_COWER_1, 5u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_CAR_JACKED_1, 5u); - break; - case SOUND_PED_HEALING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_HEALING_1, 12u); - break; - case SOUND_PED_LEAVE_VEHICLE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_LEAVE_VEHICLE_1, 9u); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_FLEE_RUN_1, 6u); - break; + case SOUND_PED_HANDS_COWER: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_HANDS_COWER_1, 5); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_CAR_JACKED_1, 5); break; + case SOUND_PED_HEALING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_HEALING_1, 12); break; + case SOUND_PED_LEAVE_VEHICLE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_LEAVE_VEHICLE_1, 9); break; + case SOUND_PED_FLEE_RUN: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MEDIC_1_FLEE_RUN_1, 6); break; default: return GetGenericMaleTalkSfx(sound); } return 37 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -731,30 +827,16 @@ cAudioManager::GetNormalMaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_HANDS_COWER_1, 7u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CAR_JACKED_1, 7u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_EVADE_1, 9u); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_FLEE_RUN_1, 5u); - break; + case SOUND_PED_HANDS_COWER: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_HANDS_COWER_1, 7); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CAR_JACKED_1, 7); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_EVADE_1, 9); break; + case SOUND_PED_FLEE_RUN: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_FLEE_RUN_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CAR_COLLISION_1, 12u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CHAT_SEXY_1, 8u); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CHAT_EVENT_1, 0xAu); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CHAT_1, 25u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CAR_COLLISION_1, 12); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CHAT_SEXY_1, 8); break; + case SOUND_PED_CHAT_EVENT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CHAT_EVENT_1, 10); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_NORMAL_MALE_CHAT_1, 25); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -767,10 +849,10 @@ cAudioManager::GetTaxiDriverTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; if(sound == SOUND_PED_CAR_JACKED) { - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TAXI_DRIVER_1_CAR_JACKED_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TAXI_DRIVER_1_CAR_JACKED_1, 7); } else { if(sound != SOUND_PED_CAR_COLLISION) return GetGenericMaleTalkSfx(sound); - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TAXI_DRIVER_1_CAR_COLLISION_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TAXI_DRIVER_1_CAR_COLLISION_1, 6); } return 13 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; } @@ -782,21 +864,13 @@ cAudioManager::GetPimpTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_HANDS_UP_1, 7u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_CAR_JACKED_1, 4u); - break; - case SOUND_PED_DEFEND: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_DEFEND_1, 9u); break; - case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_EVADE_1, 6u); break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_CHAT_EVENT_1, 2u); - break; - case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_CHAT_1, 17u); break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_HANDS_UP_1, 7); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_CAR_JACKED_1, 4); break; + case SOUND_PED_DEFEND: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_DEFEND_1, 9); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_EVADE_1, 6); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT_EVENT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_CHAT_EVENT_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_PIMP_CHAT_1, 17); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -809,25 +883,13 @@ cAudioManager::GetMafiaTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CAR_JACKING_1, 2u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_EVADE_1, 5u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CHAT_SEXY_1, 3u); - break; - case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CHAT_1, 7u); break; + case SOUND_PED_CAR_JACKING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CAR_JACKING_1, 2); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_EVADE_1, 5); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CHAT_SEXY_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MAFIA_1_CHAT_1, 7); break; default: return GetGenericMaleTalkSfx(sound); } return 30 * (m_sQueueSample.m_nEntityIndex % 3) + sfx; @@ -840,28 +902,14 @@ cAudioManager::GetTriadTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_HANDS_UP_1, 3u); - break; - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CAR_JACKING_1, 2u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_EVADE_1, 4u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CAR_COLLISION_1, 7u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CHAT_SEXY_1, 3u); - break; - case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CHAT_1, 8u); break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_HANDS_UP_1, 3); break; + case SOUND_PED_CAR_JACKING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CAR_JACKING_1, 2); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_EVADE_1, 4); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CAR_COLLISION_1, 7); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CHAT_SEXY_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_TRIAD_1_CHAT_1, 8); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -874,32 +922,18 @@ cAudioManager::GetDiabloTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_HANDS_UP_1, 4u); - break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_HANDS_UP_1, 4); break; case SOUND_PED_HANDS_COWER: sound = SOUND_PED_FLEE_SPRINT; return GetGenericMaleTalkSfx(sound); break; - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CAR_JACKING_1, 2u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_EVADE_1, 4u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CHAT_SEXY_1, 4u); - break; - case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CHAT_1, 5u); break; + case SOUND_PED_CAR_JACKING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CAR_JACKING_1, 2); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_EVADE_1, 4); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CHAT_SEXY_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_DIABLO_1_CHAT_1, 5); break; default: return GetGenericMaleTalkSfx(sound); } return 30 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -912,22 +946,12 @@ cAudioManager::GetYakuzaTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_CAR_JACKING_1, 2u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_EVADE_1, 4u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_CHAT_1, 5u); break; + case SOUND_PED_CAR_JACKING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_CAR_JACKING_1, 2); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_EVADE_1, 4); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YAKUZA_1_CHAT_1, 5); break; default: return GetGenericMaleTalkSfx(sound); } return 24 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -941,23 +965,13 @@ cAudioManager::GetYardieTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_UP: sfx = AUDIO_SAMPLE_PED_YARDIE_1_HANDS_UP_1; break; - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_CAR_JACKING_1, 2u); - break; + case SOUND_PED_CAR_JACKING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_CAR_JACKING_1, 2); break; case SOUND_PED_CAR_JACKED: sfx = AUDIO_SAMPLE_PED_YARDIE_1_CAR_JACKED_1; break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_ATTACK_1, 6u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_EVADE_1, 5u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_CHAT_SEXY_1, 2u); - break; - case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_CHAT_1, 8u); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_ATTACK_1, 6); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_EVADE_1, 5); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_CHAT_SEXY_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_YARDIE_1_CHAT_1, 8); break; default: return GetGenericMaleTalkSfx(sound); } return 31 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -970,25 +984,13 @@ cAudioManager::GetColumbianTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CAR_JACKING_1, 2u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_EVADE_1, 5u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CHAT_SEXY_1, 2u); - break; - case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CHAT_1, 5u); break; + case SOUND_PED_CAR_JACKING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CAR_JACKING_1, 2); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_EVADE_1, 5); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CHAT_SEXY_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_COLUMB_1_CHAT_1, 5); break; default: return GetGenericMaleTalkSfx(sound); } return 27 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -1001,28 +1003,14 @@ cAudioManager::GetHoodTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_HANDS_UP_1, 5u); - break; - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CAR_JACKING_1, 2u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_ATTACK_1, 6u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_EVADE_1, 5u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CAR_COLLISION_1, 7u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CHAT_SEXY_1, 2u); - break; - case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CHAT_1, 6u); break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_HANDS_UP_1, 5); break; + case SOUND_PED_CAR_JACKING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CAR_JACKING_1, 2); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_ATTACK_1, 6); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_EVADE_1, 5); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CAR_COLLISION_1, 7); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CHAT_SEXY_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOODS_1_CHAT_1, 6); break; default: return GetGenericMaleTalkSfx(sound); break; } @@ -1036,21 +1024,13 @@ cAudioManager::GetBlackCriminalTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_HANDS_UP_1, 4u); - break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_HANDS_UP_1, 4); break; case SOUND_PED_CAR_JACKING: sfx = AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_CAR_JACKING_1; break; - case SOUND_PED_MUGGING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_MUGGING_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_EVADE_1, 6u); - break; + case SOUND_PED_MUGGING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_MUGGING_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_EVADE_1, 6); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_CAR_COLLISION_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CRIMINAL_1_CAR_COLLISION_1, 5); break; default: return GetGenericMaleTalkSfx(sound); break; } @@ -1064,21 +1044,13 @@ cAudioManager::GetWhiteCriminalTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_HANDS_UP_1, 3u); - break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_HANDS_UP_1, 3); break; case SOUND_PED_CAR_JACKING: sfx = AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_CAR_JACKING_1; break; - case SOUND_PED_MUGGING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_MUGGING_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_EVADE_1, 5u); - break; + case SOUND_PED_MUGGING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_MUGGING_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_CAR_COLLISION_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CRIMINAL_1_CAR_COLLISION_1, 4); break; default: return GetGenericMaleTalkSfx(sound); break; } @@ -1092,27 +1064,13 @@ cAudioManager::GetMaleNo2TalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_CAR_JACKED_1, 3u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_ROBBED_1, 4u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_EVADE_1, 4u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_CAR_COLLISION_1, 7u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_CHAT_SEXY_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_CHAT_1, 7u); - break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_CAR_JACKED_1, 3); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_ROBBED_1, 4); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_EVADE_1, 4); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_CAR_COLLISION_1, 7); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_CHAT_SEXY_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_NO_2_CHAT_1, 7); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1125,30 +1083,20 @@ cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_HANDS_UP_1, 3u); - break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_HANDS_UP_1, 3); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_ATTACK_1, 6u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_EVADE_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_ATTACK_1, 6); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_CAR_COLLISION_1, - 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_CAR_COLLISION_1, 7); break; case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_CHAT_SEXY_1, 3u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_CHAT_SEXY_1, 3); break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_CHAT_1, 6u); + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_MALE_1_CHAT_1, 6); default: return GetGenericMaleTalkSfx(sound); } @@ -1163,23 +1111,16 @@ cAudioManager::GetWhiteFatMaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_CAR_JACKED_1, 3u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_ROBBED_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_EVADE_1, 9u); - break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_CAR_JACKED_1, 3); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_ROBBED_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_EVADE_1, 9); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_CAR_COLLISION_1, 9u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_CAR_COLLISION_1, 9); break; case SOUND_PED_WAIT_DOUBLEBACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_WAIT_DOUBLEBACK_1, 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_WAIT_DOUBLEBACK_1, 2); break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_CHAT_1, 9u); + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_MALE_1_CHAT_1, 9); default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1192,24 +1133,16 @@ cAudioManager::GetBlackFatMaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_CAR_JACKED_1, 4u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_ROBBED_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_EVADE_1, 7u); - break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_CAR_JACKED_1, 4); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_ROBBED_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_EVADE_1, 7); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_CAR_COLLISION_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_CAR_COLLISION_1, 6); break; case SOUND_PED_WAIT_DOUBLEBACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_WAIT_DOUBLEBACK_1, 3u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_CHAT_1, 8u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_WAIT_DOUBLEBACK_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_MALE_1_CHAT_1, 8); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1223,30 +1156,23 @@ cAudioManager::GetBlackCasualFemaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_HANDS_COWER_1, 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_HANDS_COWER_1, 2); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_ROBBED_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_EVADE_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_ROBBED_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_EVADE_1, 6); break; case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_FLEE_RUN_1, 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_FLEE_RUN_1, 2); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_CAR_COLLISION_1, - 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_CAR_COLLISION_1, 7); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_CHAT_EVENT_1, 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_CHAT_1, 8u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_CHAT_EVENT_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CASUAL_FEMALE_1_CHAT_1, 8); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1260,28 +1186,23 @@ cAudioManager::GetWhiteCasualFemaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_HANDS_COWER_1, 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_HANDS_COWER_1, 2); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_CAR_JACKED_1, 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_CAR_JACKED_1, 2); break; case SOUND_PED_ROBBED: sfx = AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_ROBBED_1; break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_EVADE_1, 3u); - break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_EVADE_1, 3); break; case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_FLEE_RUN_1, 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_FLEE_RUN_1, 2); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_CAR_COLLISION_1, - 8u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_CAR_COLLISION_1, 8); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_CHAT_EVENT_1, 2u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_CHAT_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_CHAT_EVENT_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CASUAL_FEMALE_1_CHAT_1, 4); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1294,30 +1215,16 @@ cAudioManager::GetFemaleNo3TalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_HANDS_COWER_1, 5u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_CAR_JACKED_1, 3u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_ROBBED_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_EVADE_1, 6u); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_FLEE_RUN_1, 4u); - break; + case SOUND_PED_HANDS_COWER: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_HANDS_COWER_1, 5); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_CAR_JACKED_1, 3); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_ROBBED_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_EVADE_1, 6); break; + case SOUND_PED_FLEE_RUN: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_FLEE_RUN_1, 4); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_CHAT_EVENT_1, 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_CHAT_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT_EVENT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_CHAT_EVENT_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_NO_3_CHAT_1, 5); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1331,26 +1238,20 @@ cAudioManager::GetBlackFatFemaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_HANDS_COWER_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_HANDS_COWER_1, 4); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_ROBBED_1, 2u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_EVADE_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_ROBBED_1, 2); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_CAR_COLLISION_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_CAR_COLLISION_1, 6); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_CHAT_EVENT_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_CHAT_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_CHAT_EVENT_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FAT_FEMALE_1_CHAT_1, 7); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1364,27 +1265,20 @@ cAudioManager::GetWhiteFatFemaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_ROBBED_1, 2u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_EVADE_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_ROBBED_1, 2); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_EVADE_1, 6); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_CAR_COLLISION_1, 8u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_CAR_COLLISION_1, 8); break; case SOUND_PED_WAIT_DOUBLEBACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_WAIT_DOUBLEBACK_1, - 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_WAIT_DOUBLEBACK_1, 2); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_CHAT_EVENT_1, 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_CHAT_1, 8u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_CHAT_EVENT_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FAT_FEMALE_1_CHAT_1, 8); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1398,26 +1292,20 @@ cAudioManager::GetBlackFemaleProstituteTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_HANDS_UP_1, - 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_HANDS_UP_1, 4); break; case SOUND_PED_ROBBED: sfx = AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_ROBBED_1; break; case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_EVADE_1, 3u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_EVADE_1, 3); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, - AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_CAR_COLLISION_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_CAR_COLLISION_1, 4); break; case SOUND_PED_SOLICIT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_SOLICIT_1, 8u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_CHAT_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_SOLICIT_1, 8); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_FEMALE_PROSTITUTE_1_CHAT_1, 4); break; default: return GetGenericFemaleTalkSfx(sound); } return 28 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -1431,24 +1319,19 @@ cAudioManager::GetWhiteFemaleProstituteTalkSfx(int16 sound) switch(sound) { case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_ROBBED_1, 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_ROBBED_1, 2); break; case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_EVADE_1, 3u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_EVADE_1, 3); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, - AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_CAR_COLLISION_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_CAR_COLLISION_1, 4); break; case SOUND_PED_SOLICIT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_SOLICIT_1, 8u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_CHAT_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_SOLICIT_1, 8); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_FEMALE_PROSTITUTE_1_CHAT_1, 4); break; default: return GetGenericFemaleTalkSfx(sound); } return 25 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -1462,30 +1345,24 @@ cAudioManager::GetBlackProjectFemaleOldTalkSfx(int16 sound) switch(sound) { case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_CAR_JACKED_1, - 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_CAR_JACKED_1, 6); break; case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_ROBBED_1, 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_ROBBED_1, 2); break; case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_EVADE_1, 10u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_EVADE_1, 10); break; case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_FLEE_RUN_1, - 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_FLEE_RUN_1, 6); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, - AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_CAR_COLLISION_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_CAR_COLLISION_1, 7); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_CHAT_EVENT_1, - 2u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_CHAT_1, 10u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_CHAT_EVENT_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_OLD_1_CHAT_1, 10); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1499,31 +1376,22 @@ cAudioManager::GetBlackProjectFemaleYoungTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, - AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_HANDS_COWER_1, 4u); - break; - case SOUND_PED_CAR_JACKED: - sfx = AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_CAR_JACKED_1; + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_HANDS_COWER_1, 4); break; + case SOUND_PED_CAR_JACKED: sfx = AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_CAR_JACKED_1; break; case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_ROBBED_1, - 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_ROBBED_1, 2); break; case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_EVADE_1, - 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, - AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_CAR_COLLISION_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_CAR_COLLISION_1, 6); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, - AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_CHAT_EVENT_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_CHAT_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_CHAT_EVENT_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_PROJECT_FEMALE_YOUNG_1_CHAT_1, 7); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1537,26 +1405,18 @@ cAudioManager::GetChinatownMaleOldTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_HANDS_COWER_1, 3u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_HANDS_COWER_1, 3); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_EVADE_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_CAR_JACKED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_EVADE_1, 6); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_CHAT_SEXY_1, 3u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_CHAT_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_CHAT_SEXY_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_OLD_CHAT_1, 7); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1570,27 +1430,20 @@ cAudioManager::GetChinatownMaleYoungTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_HANDS_COWER_1, 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_HANDS_COWER_1, 2); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_ATTACK_1, 6u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_EVADE_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_CAR_JACKED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_ATTACK_1, 6); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_CAR_COLLISION_1, - 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_CAR_COLLISION_1, 6); break; case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_CHAT_SEXY_1, 3u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_CHAT_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_CHAT_SEXY_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_MALE_YOUNG_CHAT_1, 6); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1604,22 +1457,15 @@ cAudioManager::GetChinatownFemaleOldTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_HANDS_COWER_1, 3u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_ROBBED_1, 2u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_EVADE_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_HANDS_COWER_1, 3); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_ROBBED_1, 2); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_CAR_COLLISION_1, - 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_CAR_COLLISION_1, 5); break; case SOUND_PED_CHAT_EVENT: sfx = AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_CHAT_EVENT_1; break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_CHAT_1, 6u); - break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_OLD_CHAT_1, 6); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1633,24 +1479,17 @@ cAudioManager::GetChinatownFemaleYoungTalkSfx(int16 sound) switch(sound) { case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_ROBBED_1, 2u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_EVADE_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_ROBBED_1, 2); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_EVADE_1, 6); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_CAR_COLLISION_1, - 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_CAR_COLLISION_1, 7); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_CHAT_EVENT_1, 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_CHAT_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_CHAT_EVENT_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHINATOWN_FEMALE_YOUNG_CHAT_1, 7); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1664,26 +1503,18 @@ cAudioManager::GetLittleItalyMaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_HANDS_COWER_1, 3u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_HANDS_COWER_1, 3); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_EVADE_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_CAR_COLLISION_1, 7u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_CHAT_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_CAR_COLLISION_1, 7); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_MALE_1_CHAT_1, 6); break; default: return GetGenericMaleTalkSfx(sound); } return 30 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -1697,26 +1528,17 @@ cAudioManager::GetLittleItalyFemaleOldTalkSfx(int16 sound) switch(sound) { case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_CAR_JACKED_1, - 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_ROBBED_1, 2u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_EVADE_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_ROBBED_1, 2); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_EVADE_1, 6); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_CAR_COLLISION_1, - 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_CAR_COLLISION_1, 7); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_CHAT_EVENT_1, - 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_CHAT_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_CHAT_EVENT_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_OLD_CHAT_1, 7); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1730,26 +1552,19 @@ cAudioManager::GetLittleItalyFemaleYoungTalkSfx(int16 sound) switch(sound) { case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_CAR_JACKED_1, - 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_CAR_JACKED_1, 2); break; case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_ROBBED_1, 2u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_EVADE_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_ROBBED_1, 2); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_EVADE_1, 7); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, - AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_CAR_COLLISION_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_CAR_COLLISION_1, 6); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_CHAT_EVENT_1, - 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_CHAT_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_CHAT_EVENT_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_LITTLE_ITALY_FEMALE_YOUNG_CHAT_1, 6); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1763,23 +1578,15 @@ cAudioManager::GetWhiteDockerMaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_HANDS_COWER_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_ATTACK_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_EVADE_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_HANDS_COWER_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_ATTACK_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_EVADE_1, 4); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_CAR_COLLISION_1, 4u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_CHAT_SEXY_1, 3u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_CHAT_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_CAR_COLLISION_1, 4); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_CHAT_SEXY_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_DOCKER_MALE_CHAT_1, 5); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1793,23 +1600,15 @@ cAudioManager::GetBlackDockerMaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_HANDS_COWER_1, 3u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_EVADE_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_HANDS_COWER_1, 3); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_CHAT_SEXY_1, 3u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_CHAT_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_CHAT_SEXY_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_DOCKER_MALE_CHAT_1, 5); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1822,28 +1621,16 @@ cAudioManager::GetScumMaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_HANDS_COWER_1, 5u); - break; + case SOUND_PED_HANDS_COWER: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_HANDS_COWER_1, 5); break; case SOUND_PED_ROBBED: sfx = AUDIO_SAMPLE_PED_SCUM_MALE_ROBBED_1; break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_ATTACK_1, 0xAu); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_EVADE_1, 5u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_CAR_COLLISION_1, 6u); - break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_ATTACK_1, 0xA); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_EVADE_1, 5); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_CAR_COLLISION_1, 6); break; case SOUND_PED_WAIT_DOUBLEBACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_WAIT_DOUBLEBACK_1, 3u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_CHAT_SEXY_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_CHAT_1, 9u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_WAIT_DOUBLEBACK_1, 3); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_CHAT_SEXY_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_MALE_CHAT_1, 9); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1856,24 +1643,14 @@ cAudioManager::GetScumFemaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_HANDS_COWER_1, 4u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_EVADE_1, 8u); - break; + case SOUND_PED_HANDS_COWER: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_HANDS_COWER_1, 4); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_EVADE_1, 8); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_CHAT_1, 13u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SCUM_FEMALE_CHAT_1, 13); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -1887,23 +1664,15 @@ cAudioManager::GetWhiteWorkerMaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_HANDS_COWER_1, 3u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_ATTACK_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_EVADE_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_HANDS_COWER_1, 3); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_ATTACK_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_EVADE_1, 4); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_CHAT_SEXY_1, 2u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_CHAT_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_CHAT_SEXY_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_WORKER_MALE_CHAT_1, 6); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1917,24 +1686,15 @@ cAudioManager::GetBlackWorkerMaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_HANDS_COWER_1, 4u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_ATTACK_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_EVADE_1, 3u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_HANDS_COWER_1, 4); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_ATTACK_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_EVADE_1, 3); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_CAR_COLLISION_1, 4u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_CHAT_SEXY_1, 3u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_CHAT_1, 4u); - + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_CAR_COLLISION_1, 4); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_CHAT_SEXY_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_WORKER_MALE_CHAT_1, 4); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -1948,30 +1708,21 @@ cAudioManager::GetBusinessMaleYoungTalkSfx(int16 sound, int32 model) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_HANDS_COWER_1, 3u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_HANDS_COWER_1, 3); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_EVADE_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_EVADE_1, 4); break; case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_FLEE_RUN_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_FLEE_RUN_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_CAR_COLLISION_1, - 6u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_CHAT_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_YOUNG_1_CHAT_1, 6); break; default: return GetGenericMaleTalkSfx(sound); } @@ -1987,30 +1738,19 @@ cAudioManager::GetBusinessMaleOldTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_HANDS_COWER_1, 3u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_HANDS_COWER_1, 3); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_EVADE_1, 4u); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_FLEE_RUN_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_EVADE_1, 4); break; + case SOUND_PED_FLEE_RUN: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_FLEE_RUN_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_CHAT_1, 5u); - + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_MALE_OLD_1_CHAT_1, 5); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2024,29 +1764,17 @@ cAudioManager::GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_HANDS_COWER_1, 4u); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_ROBBED_1, 2u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_EVADE_1, 6u); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_FLEE_RUN_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_HANDS_COWER_1, 4); break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_ROBBED_1, 2); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_EVADE_1, 6); break; + case SOUND_PED_FLEE_RUN: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_FLEE_RUN_1, 4); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_CHAT_EVENT_1, 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_CHAT_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT_EVENT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_CHAT_EVENT_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BUSINESS_WOMAN_1_CHAT_1, 7); break; default: return GetGenericFemaleTalkSfx(sound); } @@ -2062,31 +1790,23 @@ cAudioManager::GetBlackBusinessFemaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_HANDS_COWER_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_HANDS_COWER_1, 5); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_CAR_JACKED_1, 4u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_ROBBED_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_EVADE_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_CAR_JACKED_1, 4); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_ROBBED_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_EVADE_1, 6); break; case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_FLEE_RUN_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_FLEE_RUN_1, 6); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_CAR_COLLISION_1, - 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_CAR_COLLISION_1, 7); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_CHAT_EVENT_1, 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_CHAT_1, 7u); - + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_CHAT_EVENT_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_BUSINESS_FEMALE_CHAT_1, 7); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -2099,28 +1819,15 @@ cAudioManager::GetSupermodelMaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_EVADE_1, 6u); - break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_EVADE_1, 6); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_CHAT_SEXY_1, 3u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_CHAT_1, 6u); - + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_CHAT_SEXY_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_MALE_CHAT_1, 6); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2134,24 +1841,17 @@ cAudioManager::GetSupermodelFemaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_HANDS_COWER_1, 4u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_ROBBED_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_EVADE_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_HANDS_COWER_1, 4); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_ROBBED_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_EVADE_1, 4); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_CAR_COLLISION_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_CAR_COLLISION_1, 7); break; case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_CHAT_EVENT_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_CHAT_1, 8u); - + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_CHAT_EVENT_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SUPERMODEL_FEMALE_CHAT_1, 8); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -2164,22 +1864,13 @@ cAudioManager::GetStewardMaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_HANDS_COWER_1, 3u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_EVADE_1, 3u); - break; + case SOUND_PED_HANDS_COWER: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_HANDS_COWER_1, 3); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_EVADE_1, 3); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_CHAT_1, 4u); - + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_MALE_CHAT_1, 4); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2193,17 +1884,13 @@ cAudioManager::GetStewardFemaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_FEMALE_1_HANDS_COWER_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_FEMALE_1_EVADE_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_FEMALE_1_HANDS_COWER_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_FEMALE_1_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_FEMALE_1_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_FEMALE_1_CHAT_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_FEMALE_1_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STEWARD_FEMALE_1_CHAT_1, 5); break; default: return GetGenericFemaleTalkSfx(sound); } return 18 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -2216,21 +1903,11 @@ cAudioManager::GetFanMaleTalkSfx(int16 sound, int32 model) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_ATTACK_1, 3u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_EVADE_1, 4u); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_CHAT_EVENT_1, 2u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_CHAT_1, 6u); - break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_ATTACK_1, 3); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_EVADE_1, 4); break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT_EVENT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_CHAT_EVENT_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_MALE_1_CHAT_1, 6); break; default: return GetGenericMaleTalkSfx(sound); } @@ -2246,18 +1923,12 @@ cAudioManager::GetFanFemaleTalkSfx(int16 sound) switch(sound) { case SOUND_PED_ROBBED: sfx = AUDIO_SAMPLE_PED_FAN_FEMALE_1_ROBBED_1; break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_FEMALE_1_EVADE_1, 4u); - break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_FEMALE_1_EVADE_1, 4); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_FEMALE_1_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_FEMALE_1_CHAT_EVENT_1, 2u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_FEMALE_1_CHAT_1, 6u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_FEMALE_1_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT_EVENT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_FEMALE_1_CHAT_EVENT_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FAN_FEMALE_1_CHAT_1, 6); break; default: return GetGenericFemaleTalkSfx(sound); } return 18 * (m_sQueueSample.m_nEntityIndex & 1) + sfx; @@ -2270,21 +1941,13 @@ cAudioManager::GetHospitalMaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_HANDS_COWER_1, 4u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_EVADE_1, 4u); - break; + case SOUND_PED_HANDS_COWER: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_HANDS_COWER_1, 4); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_EVADE_1, 4); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_CAR_COLLISION_1, 5u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_CHAT_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_CAR_COLLISION_1, 5); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_MALE_CHAT_1, 5); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2297,16 +1960,11 @@ cAudioManager::GetHospitalFemaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_FEMALE_EVADE_1, 5u); - break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_FEMALE_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_FEMALE_CAR_COLLISION_1, 6u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_FEMALE_CHAT_1, 6u); - + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_FEMALE_CAR_COLLISION_1, 6); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_HOSPITAL_FEMALE_CHAT_1, 6); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -2320,29 +1978,20 @@ cAudioManager::GetWhiteConstructionWorkerTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_HANDS_COWER_1, - 3u); - break; - case SOUND_PED_CAR_JACKED: - sfx = AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_CAR_JACKED_1; + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_HANDS_COWER_1, 3); break; + case SOUND_PED_CAR_JACKED: sfx = AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_CAR_JACKED_1; break; case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_EVADE_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, - AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_CAR_COLLISION_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_CAR_COLLISION_1, 4); break; case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_CHAT_SEXY_1, - 3u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_CHAT_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_CHAT_SEXY_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_WHITE_CONSTRUCTION_WORKER_CHAT_1, 7); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2356,30 +2005,22 @@ cAudioManager::GetBlackConstructionWorkerTalkSfx(int16 sound) switch(sound) { case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_HANDS_COWER_1, - 3u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_HANDS_COWER_1, 3); break; case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_CAR_JACKED_1, - 2u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_CAR_JACKED_1, 2); break; case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_ATTACK_1, 5u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_EVADE_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_ATTACK_1, 5); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_EVADE_1, 5); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, - AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_CAR_COLLISION_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_CAR_COLLISION_1, 5); break; case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_CHAT_SEXY_1, - 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_CHAT_1, 4u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_CHAT_SEXY_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BLACK_CONSTRUCTION_WORKER_CHAT_1, 4); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2392,24 +2033,14 @@ cAudioManager::GetShopperFemaleTalkSfx(int16 sound, int32 model) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_CAR_JACKED_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_ROBBED_1, 2u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_EVADE_1, 6u); - break; + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_CAR_JACKED_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_ROBBED_1, 2); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_EVADE_1, 6); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_CAR_COLLISION_1, 7u); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_CHAT_EVENT_1, 4u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_CHAT_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_CAR_COLLISION_1, 7); break; + case SOUND_PED_CHAT_EVENT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_CHAT_EVENT_1, 4); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SHOPPER_FEMALE_1_CHAT_1, 7); break; default: return GetGenericFemaleTalkSfx(sound); } @@ -2428,28 +2059,15 @@ cAudioManager::GetStudentMaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_HANDS_COWER_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_EVADE_1, 4u); - break; + case SOUND_PED_HANDS_COWER: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_HANDS_COWER_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_EVADE_1, 4); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_CAR_COLLISION_1, 4u); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_CHAT_EVENT_1, 3u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_CHAT_1, 5u); - + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_CAR_COLLISION_1, 4); break; + case SOUND_PED_CHAT_EVENT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_CHAT_EVENT_1, 3); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_MALE_CHAT_1, 5); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2462,28 +2080,15 @@ cAudioManager::GetStudentFemaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_HANDS_COWER_1, 4u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_EVADE_1, 4u); - break; + case SOUND_PED_HANDS_COWER: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_HANDS_COWER_1, 4); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_EVADE_1, 4); break; case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_CAR_COLLISION_1, 4u); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_CHAT_EVENT_1, 2u); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_CHAT_1, 4u); - + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_CAR_COLLISION_1, 4); break; + case SOUND_PED_CHAT_EVENT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_CHAT_EVENT_1, 2); break; + case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_STUDENT_FEMALE_CHAT_1, 4); break; default: return GetGenericFemaleTalkSfx(sound); } return sfx; @@ -2499,14 +2104,10 @@ uint32 cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound) { char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName(); - if(strcmp(modelName, "eight") == 0 || strcmp(modelName, "eight2") == 0) { - return GetEightTalkSfx(sound); - } + if(strcmp(modelName, "eight") == 0 || strcmp(modelName, "eight2") == 0) { return GetEightTalkSfx(sound); } if(strcmp(modelName, "frankie") == 0) { return GetFrankieTalkSfx(sound); } if(strcmp(modelName, "misty") == 0) { return GetMistyTalkSfx(sound); } - if(strcmp(modelName, "ojg") == 0 || strcmp(modelName, "ojg_p") == 0) { - return GetOJGTalkSfx(sound); - } + if(strcmp(modelName, "ojg") == 0 || strcmp(modelName, "ojg_p") == 0) { return GetOJGTalkSfx(sound); } if(strcmp(modelName, "cat") == 0) { return GetCatatalinaTalkSfx(sound); } if(strcmp(modelName, "bomber") == 0) { return GetBomberTalkSfx(sound); } if(strcmp(modelName, "s_guard") == 0) { return GetSecurityGuardTalkSfx(sound); } @@ -2523,16 +2124,10 @@ cAudioManager::GetEightTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_EIGHT_HANDS_UP_1, 2u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_EIGHT_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_EIGHT_ATTACK_1, 6u); - break; - case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_EIGHT_EVADE_1, 7u); break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_EIGHT_HANDS_UP_1, 2); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_EIGHT_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_EIGHT_ATTACK_1, 6); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_EIGHT_EVADE_1, 7); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2545,18 +2140,10 @@ cAudioManager::GetFrankieTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FRANKIE_HANDS_UP_1, 4u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FRANKIE_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FRANKIE_ATTACK_1, 6u); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FRANKIE_EVADE_1, 3u); - break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FRANKIE_HANDS_UP_1, 4); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FRANKIE_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FRANKIE_ATTACK_1, 6); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FRANKIE_EVADE_1, 3); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2569,19 +2156,11 @@ cAudioManager::GetMistyTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_HANDS_UP_1, 5u); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_ROBBED_1, 2u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_ATTACK_1, 4u); - break; - case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_EVADE_1, 5u); break; - case SOUND_PED_TAXI_CALL: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_THUMB_LIFT_1, 4u); - break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_HANDS_UP_1, 5); break; + case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_ROBBED_1, 2); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_ATTACK_1, 4); break; + case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_EVADE_1, 5); break; + case SOUND_PED_TAXI_CALL: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MISTY_THUMB_LIFT_1, 4); break; default: return GetGenericFemaleTalkSfx(sound); break; } return sfx; @@ -2607,7 +2186,7 @@ cAudioManager::GetBomberTalkSfx(int16 sound) if(sound != SOUND_PED_BOMBER) return GetGenericMaleTalkSfx(sound); - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BOMBER_THREAT_1, 7u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_BOMBER_THREAT_1, 7); return sfx; } @@ -2618,20 +2197,12 @@ cAudioManager::GetSecurityGuardTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SECURITY_GUARD_HANDS_UP_1, 2u); - break; + case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SECURITY_GUARD_HANDS_UP_1, 2); break; case SOUND_PED_HANDS_COWER: sfx = AUDIO_SAMPLE_PED_SECURITY_GUARD_HANDS_COWER_1; break; case SOUND_PED_CAR_JACKED: - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SECURITY_GUARD_CAR_EVENT_1, 6u); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SECURITY_GUARD_ATTACK_1, 2u); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SECURITY_GUARD_CAR_EVENT_1, 12u); - break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SECURITY_GUARD_CAR_EVENT_1, 6); break; + case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SECURITY_GUARD_ATTACK_1, 2); break; + case SOUND_PED_FLEE_RUN: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_SECURITY_GUARD_CAR_EVENT_1, 12); break; default: return GetGenericMaleTalkSfx(sound); } return sfx; @@ -2647,7 +2218,7 @@ cAudioManager::GetChunkyTalkSfx(int16 sound) if(sound != SOUND_PED_FLEE_RUN) return GetGenericMaleTalkSfx(sound); - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHUNKY_FLEE_RUN_1, 5u); + GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_CHUNKY_FLEE_RUN_1, 5); return sfx; } @@ -2658,17 +2229,11 @@ cAudioManager::GetGenericMaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_DEATH: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_DEATH_1, 8u); break; + case SOUND_PED_DEATH: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_DEATH_1, 8); break; case SOUND_PED_BULLET_HIT: - case SOUND_PED_DEFEND: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_INJURED_PED_MALE_OUCH_1, 15u); - break; - case SOUND_PED_BURNING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_BURNING_1, 8u); - break; - case SOUND_PED_FLEE_SPRINT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_FLEE_SPRINT_1, 6u); - break; + case SOUND_PED_DEFEND: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_INJURED_PED_MALE_OUCH_1, 15); break; + case SOUND_PED_BURNING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_BURNING_1, 8); break; + case SOUND_PED_FLEE_SPRINT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_MALE_FLEE_SPRINT_1, 6); break; default: return NO_SAMPLE; } return sfx; @@ -2681,19 +2246,11 @@ cAudioManager::GetGenericFemaleTalkSfx(int16 sound) static uint32 lastSfx = NO_SAMPLE; switch(sound) { - case SOUND_PED_DEATH: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_DEATH_1, 10u); - break; + case SOUND_PED_DEATH: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_DEATH_1, 10); break; case SOUND_PED_BULLET_HIT: - case SOUND_PED_DEFEND: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_INJURED_PED_FEMALE_OUCH_1, 11u); - break; - case SOUND_PED_BURNING: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_BURNING_1, 9u); - break; - case SOUND_PED_FLEE_SPRINT: - GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_FLEE_SPRINT_1, 8u); - break; + case SOUND_PED_DEFEND: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_INJURED_PED_FEMALE_OUCH_1, 11); break; + case SOUND_PED_BURNING: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_BURNING_1, 9); break; + case SOUND_PED_FLEE_SPRINT: GetPhrase(&sfx, &lastSfx, AUDIO_SAMPLE_PED_FEMALE_FLEE_SPRINT_1, 8); break; default: return NO_SAMPLE; } return sfx; @@ -2736,46 +2293,47 @@ cAudioManager::GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const } float -cAudioManager::GetCollisionOneShotRatio(uint32 a, float b) const +cAudioManager::GetCollisionOneShotRatio(int32 a, float b) const { float result; switch(a) { - case 0u: - case 1u: - case 5u: - case 26u: - case 31u: result = GetCollisionRatio(b, 10.0, 60.0, 50.0); break; - case 2u: - case 3u: - case 4u: - case 30u: result = GetCollisionRatio(b, 0.0, 2.0, 2.0); break; - case 6u: result = GetCollisionRatio(b, 6.0, 50.0, 44.0); break; - case 7u: - case 16u: result = GetCollisionRatio(b, 0.1, 10.0, 9.9); break; - case 8u: - case 11u: result = GetCollisionRatio(b, 30.0, 130.0, 100.0); break; - case 9u: result = GetCollisionRatio(b, 20.0, 100.0, 80.0); break; - case 10u: result = GetCollisionRatio(b, 0.0, 4.0, 4.0); break; - case 12u: - case 13u: - case 32u: result = GetCollisionRatio(b, 1.0, 10.0, 9.0); break; - case 14u: result = GetCollisionRatio(b, 1.0, 15.0, 14.0); break; - case 15u: result = GetCollisionRatio(b, 8.0, 50.0, 42.0); break; - case 17u: result = GetCollisionRatio(b, 0.0, 20.0, 20.0); break; - case 18u: - case 19u: - case 23u: - case 29u: result = GetCollisionRatio(b, 0.0, 10.0, 10.0); break; - case 20u: result = GetCollisionRatio(b, 1.0, 4.0, 3.0); break; - case 21u: result = GetCollisionRatio(b, 0.1, 5.0, 4.9); break; - case 22u: result = GetCollisionRatio(b, 0.1, 40.0, 39.9); break; - case 24u: result = GetCollisionRatio(b, 0.1, 4.0, 3.9); break; - case 25u: result = GetCollisionRatio(b, 0.0, 0.5, 0.5); break; - case 27u: result = GetCollisionRatio(b, 4.0, 40.0, 36.0); break; - case 28u: result = GetCollisionRatio(b, 0.0, 5.0, 5.0); break; - default: result = 0.0; break; + case SURFACE_DEFAULT: + case SURFACE_TARMAC: + case SURFACE_PAVEMENT: + case SURFACE_STONE: + case SURFACE_BOLLARD: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break; + case SURFACE_GRASS: + case SURFACE_LOOSE30: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; + case SURFACE_DIRT: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; + case SURFACE_DIRTTRACK: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; + case SURFACE_METAL6: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break; + case SURFACE_GLASS: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break; + case SURFACE_SCAFFOLD: + case SURFACE_STEEL: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break; + case SURFACE_METAL_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break; + case SURFACE_BILLBOARD: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break; + case SURFACE_METAL_POLE: + case SURFACE_GATE: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break; + case SURFACE_STREET_LIGHT: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break; + case SURFACE_METAL14: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break; + case SURFACE_METAL15: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break; + case SURFACE_METAL_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break; + case SURFACE_FLESH: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break; + case SURFACE_SAND: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; + case SURFACE_PUDDLE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; + case SURFACE_WOOD: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break; + case SURFACE_WOOD_BOX: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break; + case SURFACE_WOOD_PLANK: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break; + case SURFACE_TIRE: + case SURFACE_RUBBER29: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; + case SURFACE_HARD24: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break; + case SURFACE_HEDGE: result = GetCollisionRatio(b, 0.f, 0.5f, 0.5f); break; + case SURFACE_METAL27: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break; + case SURFACE_METAL28: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break; + default: result = 0.f; break; } + return result; } @@ -2926,11 +2484,64 @@ cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint *prevPhrase = *phrase; } +float +cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, + float velocityChange) +{ + tWheelState wheelState; + float relativeVelChange; + float gasPedalAudio = automobile->m_fGasPedalAudio; + float modificator; + float velChange; + float relativeVel; + + wheelState = automobile->m_aWheelState[wheel]; + if(wheelState == WHEEL_STATE_SPINNING && gasPedalAudio > 0.4f) { + relativeVelChange = (gasPedalAudio - 0.4f) * 1.25f; + + } else if(wheelState == WHEEL_STATE_SKIDDING) { + relativeVelChange = min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); + } else if(wheelState == WHEEL_STATE_FIXED) { + modificator = 0.4f; + relativeVelChange = gasPedalAudio; + if(relativeVelChange > 0.4f) { + relativeVelChange = relativeVelChange - 0.4f; + modificator = 5.f / 3.f; + } + velChange = Abs(velocityChange); + if(relativeVelChange > 0.4f) relativeVelChange = relativeVelChange * modificator; + if(velChange > 0.04f) { + relativeVel = min(1.0f, velChange / transmission->fMaxVelocity); + } else { + relativeVel = 0.0f; + } + if(relativeVel >= relativeVelChange) relativeVelChange = relativeVel; + } else { + relativeVelChange = 0.0f; + } + + return max(relativeVelChange, min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); +} + +float +cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, + float velocityChange) +{ + float relativeVelChange; + + if(automobile->m_aWheelState[wheel] == 2) { + relativeVelChange = min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); + } else { + relativeVelChange = 0.0; + } + + return max(relativeVelChange, min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); +} + bool cAudioManager::HasAirBrakes(int32 model) const { - return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || - model == COACH; + return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH; } void @@ -2941,7 +2552,7 @@ cAudioManager::Initialise() m_bIsInitialised = SampleManager.Initialise(); if(m_bIsInitialised) { m_bActiveSamples = SampleManager.GetMaximumSupportedChannels(); - if(m_bActiveSamples <= 1u) { + if(m_bActiveSamples <= 1) { Terminate(); } else { --m_bActiveSamples; @@ -2954,18 +2565,108 @@ cAudioManager::Initialise() } } -WRAPPER void cAudioManager::InitialisePoliceRadio() { - EAXJMP(0x57EEC0); + policeChannelTimer = 0; + policeChannelTimerSeconds = 0; + policeChannelCounterSeconds = 0; + for(int32 i = 0; i < 10; i++) { crimes[i].type = 0; } + + SampleManager.SetChannelReverbFlag(28, 0); + gSpecialSuspectLastSeenReport = 0; + for(int32 i = 0; i < 18; i++) { gMinTimeToNextReport[i] = m_nTimeOfRecentCrime; } } -WRAPPER +struct tPoliceRadioZone { + char m_aName[8]; + uint32 m_nSampleIndex; + int32 field_12; +}; + +tPoliceRadioZone *ZoneSfx = (tPoliceRadioZone *)0x880240; +char *SubZo2Label = (char *)0x6E9918; +char *SubZo3Label = (char *)0x6E9870; + void cAudioManager::InitialisePoliceRadioZones() { - EAXJMP(0x57EAC0); + for(int32 i = 0; i < 36; i++) { + for(int32 j = 0; j < 8; j++) { ZoneSfx[i].m_aName[j] = 0; } + } + + strcpy(ZoneSfx[0].m_aName, "HOSPI_2"); + ZoneSfx[0].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; + strcpy(ZoneSfx[1].m_aName, "CONSTRU"); + ZoneSfx[1].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_FORT_STAUNTON; + strcpy(ZoneSfx[2].m_aName, "STADIUM"); + ZoneSfx[2].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ASPATRIA; + strcpy(ZoneSfx[3].m_aName, "YAKUSA"); + ZoneSfx[3].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_TORRINGTON; + strcpy(ZoneSfx[4].m_aName, "SHOPING"); + ZoneSfx[4].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_BEDFORD_POINT; + strcpy(ZoneSfx[5].m_aName, "COM_EAS"); + ZoneSfx[5].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_NEWPORT; + strcpy(ZoneSfx[6].m_aName, "PARK"); + ZoneSfx[6].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_BELLEVILLE; + strcpy(ZoneSfx[7].m_aName, "UNIVERS"); + ZoneSfx[7].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_LIBERTY_CAMPUS; + strcpy(ZoneSfx[8].m_aName, "BIG_DAM"); + ZoneSfx[8].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_COCHRANE; + strcpy(ZoneSfx[9].m_aName, "SUB_IND"); + ZoneSfx[9].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PIKE_CREEK; + strcpy(ZoneSfx[10].m_aName, "SWANKS"); + ZoneSfx[10].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_CEDAR_GROVE; + strcpy(ZoneSfx[11].m_aName, "PROJECT"); + ZoneSfx[11].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_WICHITA_GARDEN; + strcpy(ZoneSfx[12].m_aName, "AIRPORT"); + ZoneSfx[12].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_FRANCIS_INTNL; + strcpy(ZoneSfx[13].m_aName, "PORT_W"); + ZoneSfx[13].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_CALLAHAN_POINT; + strcpy(ZoneSfx[14].m_aName, "PORT_S"); + ZoneSfx[14].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ATLANTIC_QUAYS; + strcpy(ZoneSfx[15].m_aName, "PORT_E"); + ZoneSfx[15].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND_HARBOUR; + strcpy(ZoneSfx[16].m_aName, "PORT_I"); + ZoneSfx[16].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_TRENTON; + strcpy(ZoneSfx[17].m_aName, "CHINA"); + ZoneSfx[17].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_CHINATOWN; + strcpy(ZoneSfx[18].m_aName, "REDLIGH"); + ZoneSfx[18].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_REDLIGHT; + strcpy(ZoneSfx[19].m_aName, "TOWERS"); + ZoneSfx[19].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_HEPBURN_HEIGHTS; + strcpy(ZoneSfx[20].m_aName, "LITTLEI"); + ZoneSfx[20].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ST_MARKS; + strcpy(ZoneSfx[21].m_aName, "HARWOOD"); + ZoneSfx[21].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_HARWOOD; + strcpy(ZoneSfx[22].m_aName, "EASTBAY"); + ZoneSfx[22].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND_BEACH; + strcpy(ZoneSfx[23].m_aName, "S_VIEW"); + ZoneSfx[23].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND_VIEW; + strcpy(ZoneSfx[24].m_aName, "CITYZON"); + ZoneSfx[24].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_LIBERTY_CITY; + strcpy(ZoneSfx[25].m_aName, "IND_ZON"); + ZoneSfx[25].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND; + strcpy(ZoneSfx[26].m_aName, "COM_ZON"); + ZoneSfx[26].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_STAUNTON; + strcpy(ZoneSfx[27].m_aName, "SUB_ZON"); + ZoneSfx[27].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE; + strcpy(ZoneSfx[28].m_aName, "SUB_ZO2"); + ZoneSfx[28].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE; + strcpy(ZoneSfx[29].m_aName, "SUB_ZO3"); + ZoneSfx[29].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE; + strcpy(ZoneSfx[30].m_aName, "A"); + ZoneSfx[30].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; + strcpy(ZoneSfx[31].m_aName, "A"); + ZoneSfx[31].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; + strcpy(ZoneSfx[32].m_aName, "A"); + ZoneSfx[32].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; + strcpy(ZoneSfx[33].m_aName, "A"); + ZoneSfx[33].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; + strcpy(ZoneSfx[34].m_aName, "A"); + ZoneSfx[34].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; + strcpy(SubZo2Label, "SUB_ZO2"); + strcpy(SubZo3Label, "SUB_ZO3"); } void @@ -3024,24 +2725,255 @@ cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const void cAudioManager::PlayLoadedMissionAudio() { - if(m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE && - m_sMissionAudio.m_bLoadingStatus == 1 && !m_sMissionAudio.m_bPlayStatus) { + if(m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE && m_sMissionAudio.m_bLoadingStatus == 1 && + !m_sMissionAudio.m_bPlayStatus) { m_sMissionAudio.m_bIsPlayed = true; } } -WRAPPER void cAudioManager::PlayOneShot(int32 index, int16 sound, float vol) { - EAXJMP(0x57A500); + static constexpr uint8 byte_60ABD0[] = { + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 4, 4, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 1, 1, 1, 9, + 2, 2, 0, 0, 0, 0, 3, 3, 5, 1, 1, 1, 1, 3, 4, 7, 6, 6, 6, 6, 1, 3, 4, 3, 4, 2, 1, 3, 5, 4, 6, 6, 1, 3, + 1, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + if(m_bIsInitialised) { + if(index >= 0 && index < totalAudioEntitiesSlots) { + if(m_asAudioEntities[index].m_bIsUsed) { + if(sound < SOUND_TOTAL_SOUNDS) { + if(m_asAudioEntities[index].m_nType == AUDIOTYPE_SCRIPTOBJECT) { + if(m_nScriptObjectEntityTotal < 40) { + m_asAudioEntities[index].m_awAudioEvent[0] = sound; + m_asAudioEntities[index].m_Loops = 1; + m_anScriptObjectEntityIndices[m_nScriptObjectEntityTotal++] = + index; + } + } else { + int32 i = 0; + while(1) { + if(i >= m_asAudioEntities[index].m_Loops) { + if(m_asAudioEntities[index].m_Loops < 4) { + m_asAudioEntities[index].m_awAudioEvent[i] = + sound; + m_asAudioEntities[index].m_afVolume[i] = vol; + ++m_asAudioEntities[index].m_Loops; + } + return; + } + if(byte_60ABD0[m_asAudioEntities[index].m_awAudioEvent[i]] > + byte_60ABD0[sound]) + break; + ++i; + } + if(i < 3) { + memmove(&m_asAudioEntities[index].m_awAudioEvent[i + 1], + &m_asAudioEntities[index].m_awAudioEvent[i], 3 - i); + memmove(&m_asAudioEntities[index].m_afVolume[i + 1], + &m_asAudioEntities[index].m_afVolume[i], 3 - i); + } + m_asAudioEntities[index].m_awAudioEvent[i] = sound; + m_asAudioEntities[index].m_afVolume[i] = vol; + if(m_asAudioEntities[index].m_Loops < 4) + ++m_asAudioEntities[index].m_Loops; + } + } + } + } + } } -WRAPPER -uint32 +void cAudioManager::PlaySuspectLastSeen(float x, float y, float z) { - EAXJMP(0x580500); + int16 audioZone; + CZone *zone; + int32 i; + float rangeX; + float rangeY; + float halfX; + float halfY; + float quarterX; + float quarterY; + int32 sample; + bool processed = false; + CVector vec = {x, y, z}; + + if(m_bIsInitialised) { + if(MusicManager.m_nMusicMode != 2 && 60 - policeChannelTimer > 9) { + + audioZone = CTheZones::FindAudioZone(&vec); + if(audioZone >= 0 && audioZone < 36) { + i = 0; + zone = &CTheZones::ZoneArray[CTheZones::AudioZoneArray[audioZone]]; + while(strcmp(zone->name, ZoneSfx[i].m_aName) != 0) { + ++i; + if(i >= 36) return; + } + sample = ZoneSfx[i].m_nSampleIndex; + if(i < 36) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[4] % 3 + + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_SUSPECT; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_LAST_SEEN; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_IN; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(sample == AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE && + (strcmp(zone->name, SubZo2Label) == 0 || + strcmp(zone->name, SubZo3Label) == 0)) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_NORTH; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer == 60) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = sample; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[2] % 3 + + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + TOTAL_AUDIO_SAMPLES; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + gSpecialSuspectLastSeenReport = 1; + return; + } + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_EAST; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + rangeX = zone->maxx - zone->minx; + rangeY = zone->maxy - zone->miny; + halfX = 0.5f * rangeX + zone->minx; + halfY = 0.5f * rangeY + zone->miny; + quarterX = 0.25f * rangeX; + quarterY = 0.25f * rangeY; + if(halfY + quarterY < vec.y) { + if(halfY - quarterY > vec.y) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_SOUTH; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + processed = 1; + } + } + } else if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_NORTH; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + processed = 1; + } + if(halfX + quarterX < vec.x) { + if(halfX - quarterX <= vec.x) { + if(processed || policeChannelTimer == 60) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + sample; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[2] % 3 + + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + TOTAL_AUDIO_SAMPLES; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + gSpecialSuspectLastSeenReport = 1; + return; + } + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_CENTRAL; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_WEST; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + } else if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_EAST; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = sample; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[2] % 3 + + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = TOTAL_AUDIO_SAMPLES; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + gSpecialSuspectLastSeenReport = 1; + return; + } + } + } + } } void @@ -3059,9 +2991,8 @@ cAudioManager::PlayerJustLeftCar(void) const void cAudioManager::PostInitialiseGameSpecificSetup() { - m_nFireAudioEntity = - CreateEntity(AUDIOTYPE_FIRE, - (CPhysical *)0x8F31D0); // last is addr of firemanager @todo change + m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, + (CPhysical *)0x8F31D0); // last is addr of firemanager @todo change if(m_nFireAudioEntity >= 0) SetEntityStatus(m_nFireAudioEntity, 1); m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (CPhysical *)1); @@ -3117,36 +3048,34 @@ cAudioManager::PreTerminateGameSpecificShutdown() { if(m_nBridgeEntity >= 0) { DestroyEntity(m_nBridgeEntity); - m_nBridgeEntity = -5; + m_nBridgeEntity = AEHANDLE_NONE; } if(m_nPoliceChannelEntity >= 0) { DestroyEntity(m_nPoliceChannelEntity); - m_nPoliceChannelEntity = -5; + m_nPoliceChannelEntity = AEHANDLE_NONE; } if(m_nWaterCannonEntity >= 0) { DestroyEntity(m_nWaterCannonEntity); - m_nWaterCannonEntity = -5; + m_nWaterCannonEntity = AEHANDLE_NONE; } if(m_nFireAudioEntity >= 0) { DestroyEntity(m_nFireAudioEntity); - m_nFireAudioEntity = -5; + m_nFireAudioEntity = AEHANDLE_NONE; } if(m_nCollisionEntity >= 0) { DestroyEntity(m_nCollisionEntity); - m_nCollisionEntity = -5; + m_nCollisionEntity = AEHANDLE_NONE; } if(m_nFrontEndEntity >= 0) { DestroyEntity(m_nFrontEndEntity); - m_nFrontEndEntity = -5; + m_nFrontEndEntity = AEHANDLE_NONE; } if(m_nProjectileEntity >= 0) { DestroyEntity(m_nProjectileEntity); - m_nProjectileEntity = -5; + m_nProjectileEntity = AEHANDLE_NONE; } } -#if 1 - WRAPPER void cAudioManager::ProcessActiveQueues() @@ -3154,10 +3083,6 @@ cAudioManager::ProcessActiveQueues() EAXJMP(0x57BA60); } -#else - -#endif - bool cAudioManager::ProcessAirBrakes(cVehicleParams *params) { @@ -3168,19 +3093,17 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params) automobile = (CAutomobile *)params->m_pVehicle; if(!automobile->bEngineOn) return 1; - if((automobile->m_fVelocityChangeForAudio < 0.025f || - params->m_fVelocityChange >= 0.025f) && + if((automobile->m_fVelocityChangeForAudio < 0.025f || params->m_fVelocityChange >= 0.025f) && (automobile->m_fVelocityChangeForAudio > -0.025f || params->m_fVelocityChange <= 0.025f)) return 1; CalculateDistance((bool *)params, params->m_fDistance); - rand = m_anRandomTable[0] % 10u + 70; + rand = m_anRandomTable[0] % 10 + 70; m_sQueueSample.m_bVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 13; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_VEHICLE_AIR_BRAKES; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_VEHICLE_AIR_BRAKES); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_VEHICLE_AIR_BRAKES); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; @@ -3204,7 +3127,6 @@ void cAudioManager::ProcessAirportScriptObject(uint8 sound) { float dist; - float distSquared; float maxDist; static uint8 counter = 0; @@ -3220,20 +3142,19 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; break; - default: break; + default: return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { dist = sqrt(distSquared); m_sQueueSample.m_fDistance = dist; - m_sQueueSample.m_bVolume = ComputeVolume( - 110u, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { - m_sQueueSample.m_nSampleIndex = - (m_anRandomTable[1] & 3) + AUDIO_SAMPLE_AIRPORT_1; + m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + AUDIO_SAMPLE_AIRPORT_1; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_counter = counter++; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 1; @@ -3246,7 +3167,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) m_sQueueSample.m_bReverbFlag = 1; m_sQueueSample.m_bRequireReflection = 0; AddSampleToRequestedQueue(); - audioLogicTimers[3] = time + 10000 + m_anRandomTable[3] % 20000u; + audioLogicTimers[3] = time + 10000 + m_anRandomTable[3] % 20000; } } } @@ -3269,24 +3190,21 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) boat = (CBoat *)params->m_pVehicle; if(params->m_nIndex == REEFER) { CalculateDistance((bool *)params, params->m_fDistance); - m_sQueueSample.m_bVolume = - ComputeVolume(80u, 50.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 39; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_MOTOR; m_sQueueSample.m_nFrequency = 10386; - m_sQueueSample.m_nFrequency += - (m_sQueueSample.m_nEntityIndex << 16) % 1000; + m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex << 16) % 1000; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = 80; m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset( - m_sQueueSample.m_nSampleIndex); + SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.field_56 = 0; @@ -3304,8 +3222,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) emittingVol = (100.f * padRelativeAccerate) + 15; m_sQueueSample.m_nFrequency = (3000.f * padRelativeAccerate) + 6000; if(!boat->m_bIsAnchored) - m_sQueueSample.m_nFrequency = - 11 * m_sQueueSample.m_nFrequency / 10u; + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; } else { gasPedal = Abs(boat->m_fGasPedal); if(gasPedal > 0.0f) { @@ -3315,12 +3232,10 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) emittingVol = (100.f * gasPedal) + 15; m_sQueueSample.m_nFrequency = (3000.f * gasPedal) + 6000; if(!boat->m_bIsAnchored) - m_sQueueSample.m_nFrequency = - 11 * m_sQueueSample.m_nFrequency / 10u; + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; } } - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); if(!m_sQueueSample.m_bVolume) return 1; m_sQueueSample.m_counter = 40; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BOAT_ENGINE; @@ -3332,8 +3247,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) 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_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.field_56 = 0; @@ -3350,20 +3264,16 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) emittingVol = 45 - 45 * padAccelerate / 40; m_sQueueSample.m_nFrequency = 100 * padAccelerate + 11025; m_sQueueSample.m_counter = 39; - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_BOAT_ENGINE_IDLE; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BOAT_ENGINE_IDLE; if(LastAccel > 20) { oneShotVol = LastVol; - PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_17, - oneShotVol); + PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_17, oneShotVol); } } else { emittingVol = 105 * padAccelerate / 255 + 15; - m_sQueueSample.m_nFrequency = - 4000 * padAccelerate / 255 + 8000; + m_sQueueSample.m_nFrequency = 4000 * padAccelerate / 255 + 8000; if(!boat->m_bIsAnchored) - m_sQueueSample.m_nFrequency = - 11 * m_sQueueSample.m_nFrequency / 10u; + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; m_sQueueSample.m_counter = 40; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BOAT_ENGINE; } @@ -3375,21 +3285,18 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) m_sQueueSample.m_nFrequency = 11025; emittingVol = 45; m_sQueueSample.m_counter = 39; - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_BOAT_ENGINE_IDLE; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BOAT_ENGINE_IDLE; } else { emittingVol = (105.f * gasPedal) + 15; m_sQueueSample.m_nFrequency = (4000.f * gasPedal) + 8000; if(!boat->m_bIsAnchored) - m_sQueueSample.m_nFrequency = - 11 * m_sQueueSample.m_nFrequency / 10u; + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; m_sQueueSample.m_counter = 40; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BOAT_ENGINE; } } CalculateDistance((bool *)params, params->m_fDistance); - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); if(!m_sQueueSample.m_bVolume) return 1; m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex << 16) % 1000; m_sQueueSample.m_bBankIndex = 0; @@ -3399,8 +3306,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) 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_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.field_56 = 0; @@ -3440,10 +3346,8 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params) m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = vol; - m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.field_56 = 0; @@ -3487,8 +3391,7 @@ void cAudioManager::ProcessBridgeMotor() { if(m_sQueueSample.m_fDistance < 400.f) { - m_sQueueSample.m_bVolume = - ComputeVolume(maxVolume, 400.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, 400.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 1; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_MOTOR; @@ -3500,8 +3403,7 @@ cAudioManager::ProcessBridgeMotor() m_sQueueSample.m_bEmittingVolume = maxVolume; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 400.0f; m_sQueueSample.field_56 = 0; @@ -3517,32 +3419,30 @@ cAudioManager::ProcessBridgeOneShots() { float maxDist; - if(CBridge::State != STATE_LIFT_PART_IS_UP || - CBridge::OldState != STATE_LIFT_PART_MOVING_UP) { - if(CBridge::State != STATE_LIFT_PART_IS_DOWN || - CBridge::OldState != STATE_LIFT_PART_MOVING_DOWN) { - if(CBridge::State != STATE_LIFT_PART_MOVING_UP || - CBridge::OldState != STATE_LIFT_PART_ABOUT_TO_MOVE_UP) { - if(CBridge::State != STATE_LIFT_PART_MOVING_DOWN || - CBridge::OldState != STATE_LIFT_PART_IS_UP) - return; + if(CBridge::State == STATE_LIFT_PART_IS_UP && CBridge::OldState == STATE_LIFT_PART_MOVING_UP) { + maxDist = 400.f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_METAL_27; + } else { + if(CBridge::State == STATE_LIFT_PART_IS_DOWN && CBridge::OldState == STATE_LIFT_PART_MOVING_DOWN) { + maxDist = 400.f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_METAL_27; + } else { + if(CBridge::State == STATE_LIFT_PART_MOVING_UP && + CBridge::OldState == STATE_LIFT_PART_ABOUT_TO_MOVE_UP) { maxDist = 400.f; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_METAL_27; } else { - maxDist = 400.f; - m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_METAL_27; + if(CBridge::State == STATE_LIFT_PART_MOVING_DOWN && + CBridge::OldState == STATE_LIFT_PART_IS_UP) { + maxDist = 400.f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_METAL_27; + } else + return; } - } else { - maxDist = 400.f; - m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_METAL_27; } - } else { - maxDist = 400.f; - m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_METAL_27; } if(m_sQueueSample.m_fDistance < maxDist) { - m_sQueueSample.m_bVolume = - ComputeVolume(maxVolume, maxDist, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, maxDist, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 2; m_sQueueSample.m_bBankIndex = 0; @@ -3568,21 +3468,19 @@ void cAudioManager::ProcessBridgeWarning() { if(CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) { - m_sQueueSample.m_bVolume = ComputeVolume(100u, 450.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 0; m_sQueueSample.m_nSampleIndex = 457; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 1; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BRIDGE_WARNING); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BRIDGE_WARNING); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = 100; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 450.0f; m_sQueueSample.field_56 = 0; @@ -3603,21 +3501,19 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params) automobile = (CAutomobile *)params->m_pVehicle; if(automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) { CalculateDistance((bool *)params, params->m_fDistance); - m_sQueueSample.m_bVolume = ComputeVolume(60u, 40.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 35; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_CAR_BOMB_TICK; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CAR_BOMB_TICK); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CAR_BOMB_TICK); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = 60; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 40.0f; m_sQueueSample.field_56 = 0; @@ -3641,7 +3537,6 @@ void cAudioManager::ProcessCinemaScriptObject(uint8 sound) { uint8 rand; - float distSquared; float maxDist; static uint8 counter = 0; @@ -3657,21 +3552,20 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; break; - default: break; + default: return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = sqrt(distSquared); - rand = m_anRandomTable[0] % 90u + 30; - m_sQueueSample.m_bVolume = ComputeVolume( - rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + rand = m_anRandomTable[0] % 90 + 30; + m_sQueueSample.m_bVolume = + ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = counter % 3 + AUDIO_SAMPLE_CINEMA_1; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 2); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 4); m_sQueueSample.m_counter = counter++; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 1; @@ -3684,7 +3578,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) m_sQueueSample.m_bReverbFlag = 1; m_sQueueSample.m_bRequireReflection = 0; AddSampleToRequestedQueue(); - audioLogicTimers[4] = time + 1000 + m_anRandomTable[3] % 4000u; + audioLogicTimers[4] = time + 1000 + m_anRandomTable[3] % 4000; } } } @@ -3718,21 +3612,19 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; break; - default: break; + default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = sqrt(distSquared); - rand = m_anRandomTable[0] % 60u + 40; - m_sQueueSample.m_bVolume = ComputeVolume( - rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + rand = m_anRandomTable[0] % 60 + 40; + m_sQueueSample.m_bVolume = + ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_DOCKS; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_DOCKS); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 3); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_DOCKS); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 3); m_sQueueSample.m_counter = counter++; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 1; @@ -3745,7 +3637,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) m_sQueueSample.m_bReverbFlag = 1; m_sQueueSample.m_bRequireReflection = 0; AddSampleToRequestedQueue(); - audioLogicTimers[5] = time + 10000 + m_anRandomTable[3] % 40000u; + audioLogicTimers[5] = time + 10000 + m_anRandomTable[3] % 40000; } } } @@ -3762,8 +3654,8 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params) veh = (CAutomobile *)params->m_pVehicle; if(veh->bEngineOn) { engineStatus = veh->Damage.GetEngineStatus(); - if(engineStatus > 250u || engineStatus < 100u) return 1; - if(engineStatus < 225u) { + if(engineStatus > 250u || engineStatus < 100) return 1; + if(engineStatus < 225) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_TAXI_SOUND; emittingVolume = 6; m_sQueueSample.field_16 = 7; @@ -3772,12 +3664,10 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params) emittingVolume = 60; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FIRE_ENTITY; m_sQueueSample.field_16 = 7; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FIRE_ENTITY); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FIRE_ENTITY); } CalculateDistance((bool *)params, params->m_fDistance); - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVolume, 40.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, 40.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 28; m_sQueueSample.m_bBankIndex = 0; @@ -3786,8 +3676,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params) m_sQueueSample.m_bEmittingVolume = emittingVolume; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 40.0f; m_sQueueSample.field_56 = 0; @@ -3886,7 +3775,7 @@ cAudioManager::ProcessExplosions(int32 explosion) float maxDist; float distSquared; - for(uint8 i = 0; i < 48u; i++) { + for(uint8 i = 0; i < 48; i++) { if(CExplosion::GetExplosionActiveCounter(i) == 1) { CExplosion::ResetExplosionActiveCounter(i); type = CExplosion::GetExplosionType(i); @@ -3897,18 +3786,16 @@ cAudioManager::ProcessExplosions(int32 explosion) case EXPLOSION_TANK_GRENADE: maxDist = 160000.f; m_sQueueSample.m_fSoundIntensity = 400.0f; - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_WEAPON_GRENADE_EXPLOSION; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000u) + 38000; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WEAPON_GRENADE_EXPLOSION; + m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; m_sQueueSample.field_16 = 0; m_sQueueSample.m_bBankIndex = 0; break; case EXPLOSION_MOLOTOV: maxDist = 40000.f; m_sQueueSample.m_fSoundIntensity = 200.0f; - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_WEAPON_MOLOTOV_EXPLOSION; - m_sQueueSample.m_nFrequency = RandomDisplacement(1000u) + 19000; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WEAPON_MOLOTOV_EXPLOSION; + m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; m_sQueueSample.field_16 = 0; m_sQueueSample.m_bBankIndex = 0; break; @@ -3917,7 +3804,7 @@ cAudioManager::ProcessExplosions(int32 explosion) maxDist = 90000.f; m_sQueueSample.m_fSoundIntensity = 300.0f; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WEAPON_ROCKET_SHOT; - m_sQueueSample.m_nFrequency = RandomDisplacement(1000u) + 12347; + m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347; m_sQueueSample.field_16 = 0; m_sQueueSample.m_bBankIndex = 0; break; @@ -3925,10 +3812,9 @@ cAudioManager::ProcessExplosions(int32 explosion) maxDist = 160000.f; m_sQueueSample.m_fSoundIntensity = 400.0f; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_EXPLOSION_CAR; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000u) + 38000; + m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; if(type == EXPLOSION_HELI) - m_sQueueSample.m_nFrequency = - 8 * m_sQueueSample.m_nFrequency / 10u; + m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10; m_sQueueSample.field_16 = 0; m_sQueueSample.m_bBankIndex = 0; break; @@ -3938,9 +3824,8 @@ cAudioManager::ProcessExplosions(int32 explosion) distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_bVolume = - ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, + m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = i; m_sQueueSample.field_48 = 2.0f; @@ -3966,12 +3851,11 @@ cAudioManager::ProcessFireHydrant() float distSquared; bool something = false; - m_sQueueSample.m_vecPos = - *(CVector *)((size_t)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity + 52); + m_sQueueSample.m_vecPos = *(CVector *)((size_t)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity + 52); distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < 1225.f) { CalculateDistance(&something, distSquared); - m_sQueueSample.m_bVolume = ComputeVolume(40u, 35.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 0; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_TAXI_SOUND; @@ -3983,8 +3867,7 @@ cAudioManager::ProcessFireHydrant() m_sQueueSample.m_bEmittingVolume = 40; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 35.0f; m_sQueueSample.field_56 = 0; @@ -4013,8 +3896,7 @@ cAudioManager::ProcessFrontEnd() for(uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_Loops; i++) { processed = 0; - switch( - m_asAudioEntities[0].m_awAudioEvent[i + 20 * m_sQueueSample.m_nEntityIndex]) { + switch(m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]) { case SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM: m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_SNIPER_NO_ZOOM; break; @@ -4065,16 +3947,12 @@ cAudioManager::ProcessFrontEnd() case SOUND_RACE_START_3: case SOUND_RACE_START_2: case SOUND_RACE_START_1: - case SOUND_CLOCK_TICK: - m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FRONTEND_CLOCK_TICK; - break; + case SOUND_CLOCK_TICK: m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FRONTEND_CLOCK_TICK; break; case SOUND_RACE_START_GO: - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_FRONTEND_PART_MISSION_COMPLETED; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FRONTEND_PART_MISSION_COMPLETED; break; case SOUND_PART_MISSION_COMPLETE: - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_FRONTEND_PART_MISSION_COMPLETED; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FRONTEND_PART_MISSION_COMPLETED; break; case SOUND_FRONTEND_MENU_STARTING: processed = 1; @@ -4103,7 +3981,7 @@ cAudioManager::ProcessFrontEnd() case SOUND_9B: m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_382; break; case SOUND_FRONTEND_AUDIO_TEST: m_sQueueSample.m_nSampleIndex = - m_anRandomTable[0] % 3u + AUDIO_SAMPLE_FRONTEND_MENU_AUDIO_TEST_1; + m_anRandomTable[0] % 3 + AUDIO_SAMPLE_FRONTEND_MENU_AUDIO_TEST_1; break; case SOUND_FRONTEND_FAIL: processed = 1; @@ -4113,19 +3991,15 @@ cAudioManager::ProcessFrontEnd() case SOUND_FRONTEND_RADIO_CHANGE: m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FRONTEND_GAMEPLAY_FAIL; break; - case SOUND_A0: - m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FRONTEND_GAMEPLAY_SUCCESS; - break; + case SOUND_A0: m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FRONTEND_GAMEPLAY_SUCCESS; break; default: continue; } - sample = - m_asAudioEntities[0].m_awAudioEvent[i + 20 * m_sQueueSample.m_nEntityIndex]; + sample = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; if(sample == AUDIO_SAMPLE_COLLISION_LOOPING_GRASS) { m_sQueueSample.m_nFrequency = 28509; } else if(sample == AUDIO_SAMPLE_PICKUP_NEUTRAL_1) { - if(1.f == - m_asAudioEntities[0].m_afVolume[i + 10 * m_sQueueSample.m_nEntityIndex]) + if(1.f == m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]) m_sQueueSample.m_nFrequency = 32000; else m_sQueueSample.m_nFrequency = 48000; @@ -4169,12 +4043,9 @@ cAudioManager::ProcessGarages() struct tHelicopterSampleData { float m_fMaxDistance; float m_fBaseDistance; - char m_bBaseVolume; - char gap_9[3]; + uint8 m_bBaseVolume; }; -tHelicopterSampleData *gHeliSfxRanges = (tHelicopterSampleData *)0x604784; - bool cAudioManager::ProcessHelicopter(cVehicleParams *params) { @@ -4183,10 +4054,10 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params) float dist; float baseDist; int32 emittingVol; + static constexpr tHelicopterSampleData gHeliSfxRanges[3] = { + {400.f, 380.f, 100}, {100.f, 70.f, maxVolume}, {60.f, 30.f, maxVolume}}; - if(gHeliSfxRanges[0].m_fMaxDistance * gHeliSfxRanges[0].m_fMaxDistance <= - params->m_fDistance) - return 0; + if(gHeliSfxRanges[0].m_fMaxDistance * gHeliSfxRanges[0].m_fMaxDistance <= params->m_fDistance) return 0; CalculateDistance((bool *)params, params->m_fDistance); heli = (CHeli *)params->m_pVehicle; @@ -4196,28 +4067,25 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params) if(dist >= MaxDist) return 1; baseDist = gHeliSfxRanges[i].m_fBaseDistance; if(dist < baseDist) - emittingVol = (gHeliSfxRanges[i].m_bBaseVolume * - ((MaxDist - dist) / (MaxDist - baseDist))); + emittingVol = (gHeliSfxRanges[i].m_bBaseVolume * ((MaxDist - dist) / (MaxDist - baseDist))); else emittingVol = gHeliSfxRanges[i].m_bBaseVolume; - m_sQueueSample.m_bVolume = ComputeVolume( - emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = i + 65; m_sQueueSample.m_nSampleIndex = i + AUDIO_SAMPLE_HELI_FAR; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 0; - m_sQueueSample.m_nFrequency = - 1200 * heli->m_nHeliId + - SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = 1200 * heli->m_nHeliId + SampleManager.GetSampleBaseFrequency( + m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopCount = 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_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 6.0f; m_sQueueSample.m_fSoundIntensity = gHeliSfxRanges[i].m_fMaxDistance; m_sQueueSample.field_56 = 0; @@ -4251,22 +4119,20 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; break; - default: break; + default: return; } dist = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(dist < maxDist) { m_sQueueSample.m_fDistance = sqrt(dist); - rand = m_anRandomTable[0] % 30u + 40; - m_sQueueSample.m_bVolume = ComputeVolume( - rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + rand = m_anRandomTable[0] % 30 + 40; + m_sQueueSample.m_bVolume = + ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { - m_sQueueSample.m_nSampleIndex = - m_anRandomTable[0] % 5u + AUDIO_SAMPLE_HOME_1; + m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 5 + AUDIO_SAMPLE_HOME_1; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_counter = counter++; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 1; @@ -4279,7 +4145,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) m_sQueueSample.m_bReverbFlag = 1; m_sQueueSample.m_bRequireReflection = 1; AddSampleToRequestedQueue(); - audioLogicTimers[6] = time + 1000 + m_anRandomTable[3] % 4000u; + audioLogicTimers[6] = time + 1000 + m_anRandomTable[3] % 4000; } } } @@ -4329,11 +4195,10 @@ cAudioManager::ProcessJumboAccel(CPlane *plane) float whineSoundFreq; float modificator; - if(SetupJumboFlySound(20u)) { + if(SetupJumboFlySound(20)) { modificator = (plane->m_fSpeed - 0.10334f) * 1.676f; if(modificator > 1.0f) modificator = 1.0f; - if(SetupJumboRumbleSound(maxVolume * modificator) && - SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { + if(SetupJumboRumbleSound(maxVolume * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { if(modificator < 0.2f) { whineSoundFreq = modificator * 5.f * 14600.0f + 29500; vol = modificator * 5.f * maxVolume; @@ -4344,7 +4209,7 @@ cAudioManager::ProcessJumboAccel(CPlane *plane) vol = maxVolume; } SetupJumboEngineSound(vol, engineFreq); - SetupJumboWhineSound(18u, whineSoundFreq); + SetupJumboWhineSound(18, whineSoundFreq); } } } @@ -4354,29 +4219,28 @@ cAudioManager::ProcessJumboDecel(CPlane *plane) { float modificator; - if(SetupJumboFlySound(20u) && SetupJumboTaxiSound(75u)) { + if(SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) { modificator = (plane->m_fSpeed - 0.10334f) * 1.676f; if(modificator > 1.0f) modificator = 1.0f; SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000); - SetupJumboWhineSound(18u, 29500); + SetupJumboWhineSound(18, 29500); } } void cAudioManager::ProcessJumboFlying() { - if(SetupJumboFlySound(maxVolume)) SetupJumboEngineSound(63u, 22050); + if(SetupJumboFlySound(maxVolume)) SetupJumboEngineSound(63, 22050); } void cAudioManager::ProcessJumboLanding(CPlane *plane) { - float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) * 0.0028571f; + float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f; if(SetupJumboFlySound(107.f * modificator + 20)) { if(SetupJumboTaxiSound(75.f * (1.f - modificator))) { SetupJumboEngineSound(maxVolume, 22050); - SetupJumboWhineSound(18.f * (1.f - modificator), - 14600.f * modificator + 29500); + SetupJumboWhineSound(18.f * (1.f - modificator), 14600.f * modificator + 29500); } } } @@ -4384,20 +4248,18 @@ cAudioManager::ProcessJumboLanding(CPlane *plane) void cAudioManager::ProcessJumboTakeOff(CPlane *plane) { - float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) * 0.0033333f; + float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f; - if(SetupJumboFlySound((107.f * modificator) + 20) && - SetupJumboRumbleSound(maxVolume * (1.f - modificator))) { - if(SetupJumboEngineSound(maxVolume, 22050)) - SetupJumboWhineSound(18.f * (1.f - modificator), 44100); + if(SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(maxVolume * (1.f - modificator))) { + if(SetupJumboEngineSound(maxVolume, 22050)) SetupJumboWhineSound(18.f * (1.f - modificator), 44100); } } void cAudioManager::ProcessJumboTaxi() { - if(SetupJumboFlySound(20u)) { - if(SetupJumboTaxiSound(75u)) SetupJumboWhineSound(18u, 29500); + if(SetupJumboFlySound(20)) { + if(SetupJumboTaxiSound(75)) SetupJumboWhineSound(18, 29500); } } @@ -4405,7 +4267,6 @@ void cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) { float maxDist; - float distSquared; switch(sound) { case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: @@ -4413,18 +4274,17 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; break; - default: break; + default: return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = sqrt(distSquared); - m_sQueueSample.m_bVolume = ComputeVolume(45u, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_LAUNDERETTE_1; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_1); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_1); m_sQueueSample.m_counter = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 0; @@ -4434,19 +4294,17 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) m_sQueueSample.m_bEmittingVolume = 45; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(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(); } - m_sQueueSample.m_bVolume = ComputeVolume(110u, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_LAUNDERETTE_2; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_2); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_2); m_sQueueSample.m_counter = 1; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 0; @@ -4456,8 +4314,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) m_sQueueSample.m_bEmittingVolume = 110; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(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(); @@ -4479,8 +4336,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_1; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4491,8 +4347,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_1; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4503,8 +4358,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_2; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4515,8 +4369,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_2; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4527,8 +4380,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_3; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4539,8 +4391,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_3; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4551,8 +4402,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_4; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4563,8 +4413,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_4; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4575,8 +4424,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_5; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4587,8 +4435,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_5; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4599,8 +4446,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_6; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4611,8 +4457,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_6; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4623,8 +4468,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_7; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4635,8 +4479,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_7; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4647,8 +4490,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_8; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4659,8 +4501,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_8; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4671,8 +4512,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_9; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4683,8 +4523,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_9; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4695,8 +4534,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_10; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4707,8 +4545,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_10; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4719,8 +4556,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_11; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4731,8 +4567,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_11; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4743,8 +4578,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_12; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4755,8 +4589,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_12; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4767,8 +4600,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_13; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4779,8 +4611,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_13; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4791,8 +4622,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_STRIP_CLUB_1; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4803,8 +4633,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_STRIP_CLUB_1; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4815,8 +4644,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_STRIP_CLUB_2; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4827,8 +4655,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_STRIP_CLUB_2; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4843,8 +4670,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_409; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409); m_sQueueSample.field_16 = 6; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4855,8 +4681,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_409; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409); m_sQueueSample.field_16 = 6; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4869,8 +4694,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_CHINATOWN_RESTAURANT; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4881,8 +4705,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_CHINATOWN_RESTAURANT; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4893,8 +4716,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_CIPRIANI_RESTAURANT; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4905,8 +4727,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_CIPRIANI_RESTAURANT; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4917,8 +4738,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_414; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4929,8 +4749,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_414; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4941,8 +4760,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_MARCO_BISTRO; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4953,8 +4771,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_MARCO_BISTRO; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 110; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4975,8 +4792,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FRANKIE_PIANO; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FRANKIE_PIANO); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FRANKIE_PIANO); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -4987,8 +4803,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_1; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5007,8 +4822,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BANK_ALARM; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 90; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM); m_sQueueSample.field_16 = 2; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5019,8 +4833,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BANK_ALARM; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 90; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM); m_sQueueSample.field_16 = 2; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5031,8 +4844,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_POLICE_BALL; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL); m_sQueueSample.field_16 = 2; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5043,8 +4855,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_POLICE_BALL; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL); m_sQueueSample.field_16 = 2; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5055,8 +4866,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_INDUSTRIAL; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5067,16 +4877,13 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_INDUSTRIAL; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S: - case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: - ProcessPoliceCellBeatingScriptObject(sound); - return; + case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: ProcessPoliceCellBeatingScriptObject(sound); return; case SCRIPT_SOUND_RAVE_1_LOOP_S: case SCRIPT_SOUND_RAVE_2_LOOP_S: maxDist = 900.f; @@ -5084,8 +4891,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_1; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5097,8 +4903,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_1; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5109,8 +4914,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_2; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5121,8 +4925,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_2; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2); m_sQueueSample.field_16 = 3; m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; @@ -5133,8 +4936,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FIRE_ENTITY; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 80; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FIRE_ENTITY); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FIRE_ENTITY); m_sQueueSample.field_16 = 8; m_sQueueSample.field_76 = 10; m_sQueueSample.field_48 = 2.0f; @@ -5145,8 +4947,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_bVolume = ComputeVolume( - emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 0; m_sQueueSample.m_bIsDistant = 0; @@ -5156,8 +4958,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_bEmittingVolume = emittingVolume; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_bRequireReflection = 0; AddSampleToRequestedQueue(); } @@ -5181,8 +4982,7 @@ cAudioManager::ProcessMissionAudio() if(m_sMissionAudio.m_nSampleIndex != 3033) { switch(m_sMissionAudio.m_bLoadingStatus) { case 0: - SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, - 1u); + SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1); m_sMissionAudio.m_bLoadingStatus = 1; nFramesUntilFailedLoad = 0; return; @@ -5191,12 +4991,12 @@ cAudioManager::ProcessMissionAudio() if(g_bMissionAudioLoadFailed) { if(m_bTimerJustReset) { ClearMissionAudio(); - SampleManager.StopStreamedFile(1u); + SampleManager.StopStreamedFile(1); nFramesForPretendPlaying = 0; nCheckPlayingDelay = 0; nFramesUntilFailedLoad = 0; } else if(!m_bUserPause) { - if(++nFramesForPretendPlaying < 120u) { + if(++nFramesForPretendPlaying < 120) { m_sMissionAudio.m_bPlayStatus = 1; } else { m_sMissionAudio.m_bPlayStatus = 2; @@ -5208,7 +5008,7 @@ cAudioManager::ProcessMissionAudio() if(m_sMissionAudio.m_bPlayStatus != 1) return; if(m_bTimerJustReset) { ClearMissionAudio(); - SampleManager.StopStreamedFile(1u); + SampleManager.StopStreamedFile(1); return; } if(MissionScriptAudioUsesPoliceChannel( @@ -5216,42 +5016,32 @@ cAudioManager::ProcessMissionAudio() if(!m_bUserPause) { if(nCheckPlayingDelay) { --nCheckPlayingDelay; - } else if( - GetMissionScriptPoliceAudioPlayingStatus() == - 2 || - --m_sMissionAudio.field_24) { - m_sMissionAudio - .m_bPlayStatus = 2; - m_sMissionAudio - .m_nSampleIndex = 3033; - SampleManager - .StopStreamedFile(1u); - m_sMissionAudio.field_24 = - 0; + } else if(GetMissionScriptPoliceAudioPlayingStatus() == + 2 || + --m_sMissionAudio.field_24) { + m_sMissionAudio.m_bPlayStatus = 2; + m_sMissionAudio.m_nSampleIndex = 3033; + SampleManager.StopStreamedFile(1); + m_sMissionAudio.field_24 = 0; } } } else if(m_sMissionAudio.field_22) { - if(SampleManager.IsStreamPlaying(1u) || - m_bUserPause || m_bPreviousUserPause) { + if(SampleManager.IsStreamPlaying(1) || m_bUserPause || + m_bPreviousUserPause) { if(m_bUserPause) - SampleManager.PauseStream( - 1, 1u); + SampleManager.PauseStream(1, 1); else - SampleManager.PauseStream( - 0, 1u); + SampleManager.PauseStream(0, 1); } else { m_sMissionAudio.m_bPlayStatus = 2; - m_sMissionAudio.m_nSampleIndex = - 3033; - SampleManager.StopStreamedFile(1u); + m_sMissionAudio.m_nSampleIndex = 3033; + SampleManager.StopStreamedFile(1); m_sMissionAudio.field_24 = 0; } } else { if(m_bUserPause) return; if(nCheckPlayingDelay--) { - if(!SampleManager.IsStreamPlaying( - 1u)) - return; + if(!SampleManager.IsStreamPlaying(1)) return; nCheckPlayingDelay = 0; } m_sMissionAudio.field_22 = 1; @@ -5259,38 +5049,28 @@ cAudioManager::ProcessMissionAudio() } else { if(MissionScriptAudioUsesPoliceChannel( m_sMissionAudio.m_nSampleIndex)) { - SetMissionScriptPoliceAudio( - m_sMissionAudio.m_nSampleIndex); + SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex); } else { - if(m_bUserPause) - SampleManager.PauseStream(1, 1u); + if(m_bUserPause) SampleManager.PauseStream(1, 1); if(m_sMissionAudio.field_12) { - SampleManager - .SetStreamedVolumeAndPan( - 80u, 63u, 1, 1u); + SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1); } else { - distSquared = GetDistanceSquared( - &m_sMissionAudio.m_vecPos); + distSquared = + GetDistanceSquared(&m_sMissionAudio.m_vecPos); if(distSquared >= 2500.f) { emittingVol = 0; pan = 63; } else { dist = Sqrt(distSquared); - emittingVol = ComputeVolume( - 80u, 50.0f, dist); - TranslateEntity( - &m_sMissionAudio - .m_vecPos, - &vec); - pan = - ComputePan(50.f, &vec); + emittingVol = ComputeVolume(80, 50.0f, dist); + TranslateEntity(&m_sMissionAudio.m_vecPos, + &vec); + pan = ComputePan(50.f, &vec); } - SampleManager - .SetStreamedVolumeAndPan( - emittingVol, pan, 1, 1u); + SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, + 1, 1); } - SampleManager.StartPreloadedStreamedFile( - 1u); + SampleManager.StartPreloadedStreamedFile(1); } m_sMissionAudio.m_bPlayStatus = 1; nCheckPlayingDelay = 30; @@ -5298,7 +5078,7 @@ cAudioManager::ProcessMissionAudio() } break; case 2: - if(++nFramesUntilFailedLoad >= 90u) { + if(++nFramesUntilFailedLoad >= 90) { nFramesForPretendPlaying = 0; g_bMissionAudioLoadFailed = 1; nFramesUntilFailedLoad = 0; @@ -5328,10 +5108,8 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params) velocityChange = Abs(params->m_fVelocityChange); } else { if(automobile->m_nDriveWheelsOnGround) - automobile->m_fGasPedalAudio = - automobile->m_fGasPedalAudio * 0.4f; - velocityChange = automobile->m_fGasPedalAudio * - params->m_pTransmission->fMaxVelocity; + automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f; + velocityChange = automobile->m_fGasPedalAudio * params->m_pTransmission->fMaxVelocity; } if(velocityChange > 0.001f) { allowedVelocity = 0.5f * params->m_pTransmission->fMaxVelocity; @@ -5341,27 +5119,23 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params) emittingVol = 90; if(emittingVol) { CalculateDistance((bool *)params, params->m_fDistance); - m_sQueueSample.m_bVolume = ComputeVolume( - emittingVol, 30.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 2; - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_MODEL_VEHICLE_ACCELERATING; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_MODEL_VEHICLE_ACCELERATING; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 1; m_sQueueSample.m_nFrequency = - (11025.f * velocityChange / - params->m_pTransmission->fMaxVelocity + + (11025.f * velocityChange / params->m_pTransmission->fMaxVelocity + 11025.f); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset( - m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset( + m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset( - m_sQueueSample.m_nSampleIndex); + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 3.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.field_56 = 0; @@ -5418,18 +5192,16 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_bRequireReflection = 1; - emittingVolume = RandomDisplacement(10u) + 50; + emittingVolume = RandomDisplacement(10) + 50; break; case SCRIPT_SOUND_BULLET_HIT_GROUND_1: case SCRIPT_SOUND_BULLET_HIT_GROUND_2: case SCRIPT_SOUND_BULLET_HIT_GROUND_3: maxDist = 2500.f; m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_nSampleIndex = - m_anRandomTable[iSound % 5] % 3u + AUDIO_SAMPLE_BULLET_HIT_GROUND_1; + m_sQueueSample.m_nSampleIndex = m_anRandomTable[iSound % 5] % 3 + AUDIO_SAMPLE_BULLET_HIT_GROUND_1; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); m_sQueueSample.field_16 = 9; m_sQueueSample.field_48 = 0.0f; @@ -5444,8 +5216,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_389; m_sQueueSample.m_bBankIndex = 0; emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_389); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_389); m_sQueueSample.field_16 = 0; m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_bIsDistant = 0; @@ -5456,8 +5227,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PAYPHONE_RINGING; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 80; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PAYPHONE_RINGING); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PAYPHONE_RINGING); m_sQueueSample.field_16 = 1; m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_bIsDistant = 0; @@ -5469,8 +5239,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_GLASS_GENERIC_BREAK; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 70; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_GLASS_GENERIC_BREAK); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_GLASS_GENERIC_BREAK); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_bIsDistant = 0; @@ -5481,8 +5250,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_GLASS_GENERIC_BREAK; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 60; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_GLASS_GENERIC_BREAK); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_GLASS_GENERIC_BREAK); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_bIsDistant = 0; @@ -5493,8 +5261,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_GLASS_WINDSHIELD_CRACK; m_sQueueSample.m_bBankIndex = 0; emittingVolume = 70; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_GLASS_WINDSHIELD_CRACK); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_GLASS_WINDSHIELD_CRACK); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_bIsDistant = 0; @@ -5503,21 +5270,20 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) case SCRIPT_SOUND_GLASS_LIGHT_BREAK: maxDist = 3025.f; m_sQueueSample.m_fSoundIntensity = 55.0f; - m_sQueueSample.m_nSampleIndex = - (m_anRandomTable[4] & 3) + AUDIO_SAMPLE_GLASS_LIGHT_BREAK_1; + m_sQueueSample.m_nSampleIndex = (m_anRandomTable[4] & 3) + AUDIO_SAMPLE_GLASS_LIGHT_BREAK_1; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000u) + 19000; + m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 19000; m_sQueueSample.field_16 = 9; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_bIsDistant = 0; - emittingVolume = RandomDisplacement(11u) + 25; + emittingVolume = RandomDisplacement(11) + 25; break; case SCRIPT_SOUND_BOX_DESTROYED_1: maxDist = 3600.f; m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BOX_DESTROYED_1; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = RandomDisplacement(1500u) + 18600; + m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_bIsDistant = 0; @@ -5529,7 +5295,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BOX_DESTROYED_2; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = RandomDisplacement(1500u) + 18600; + m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_bIsDistant = 0; @@ -5539,11 +5305,9 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) case SCRIPT_SOUND_METAL_COLLISION: maxDist = 3600.f; m_sQueueSample.m_fSoundIntensity = 60.0f; - m_sQueueSample.m_nSampleIndex = - m_anRandomTable[3] % 5u + AUDIO_SAMPLE_COLLISION_METAL; + m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 5 + AUDIO_SAMPLE_COLLISION_METAL; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; @@ -5556,8 +5320,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_RUBBER; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; @@ -5577,9 +5340,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) case SURFACE_SAND: case SURFACE_TIRE: case SURFACE_HEDGE: - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_BULLET_GUNSHELL_SOFT_DROP; - m_sQueueSample.m_nFrequency = RandomDisplacement(500u) + 11000; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BULLET_GUNSHELL_SOFT_DROP; + m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; m_sQueueSample.field_16 = 18; maxDist = 400.f; m_sQueueSample.m_fSoundIntensity = 20.0f; @@ -5590,9 +5352,9 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_bVolume = ComputeVolume( - emittingVolume, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, + m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = iSound++; m_sQueueSample.m_nLoopCount = 1; @@ -5610,7 +5372,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) } } m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BULLET_GUNSHELL_HARD_DROP; - m_sQueueSample.m_nFrequency = RandomDisplacement(750u) + 18000; + m_sQueueSample.m_nFrequency = RandomDisplacement(750) + 18000; m_sQueueSample.field_16 = 15; maxDist = 400.f; m_sQueueSample.m_fSoundIntensity = 20.0f; @@ -5621,7 +5383,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) break; case SCRIPT_SOUND_GUNSHELL_DROP_SOFT: m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BULLET_GUNSHELL_SOFT_DROP; - m_sQueueSample.m_nFrequency = RandomDisplacement(500u) + 11000; + m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; m_sQueueSample.field_16 = 18; maxDist = 400.f; m_sQueueSample.m_fSoundIntensity = 20.0f; @@ -5636,8 +5398,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_bVolume = ComputeVolume( - emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = iSound++; m_sQueueSample.m_nLoopCount = 1; @@ -5685,8 +5447,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params) veh = ped->m_pMyVehicle; if(veh && veh->m_type == 0) { for(int32 i = 2; i < 6; i++) { - if(!veh->IsDoorClosed((eDoors)i) || - veh->IsDoorMissing((eDoors)i)) { + if(!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) { emittingVol = 42; break; } @@ -5696,23 +5457,21 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params) emittingVol = 42; } - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 64; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PED_HEADPHONES; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 5; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_PED_HEADPHONES); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PED_HEADPHONES); m_sQueueSample.m_nLoopCount = 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); + SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_fSoundIntensity = 7.0f; m_sQueueSample.field_56 = 0; @@ -5760,20 +5519,17 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) case SOUND_STEP_START: case SOUND_STEP_END: if(!params->m_pPed->bIsLooking) { - emittingVol = m_anRandomTable[3] % 15u + 45; - if(FindPlayerPed() != - m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity) + emittingVol = m_anRandomTable[3] % 15 + 45; + if(FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity) emittingVol >>= 1; maxDist = 400.f; switch(params->m_pPed->m_nSurfaceTouched) { case SURFACE_GRASS: - sampleIndex = - m_anRandomTable[1] % 5u + AUDIO_SAMPLE_PED_FALL_GRASS_1; + sampleIndex = m_anRandomTable[1] % 5 + AUDIO_SAMPLE_PED_FALL_GRASS_1; break; case SURFACE_DIRT: case SURFACE_DIRTTRACK: - sampleIndex = - m_anRandomTable[4] % 5u + AUDIO_SAMPLE_PED_FALL_DIRT_1; + sampleIndex = m_anRandomTable[4] % 5 + AUDIO_SAMPLE_PED_FALL_DIRT_1; break; case SURFACE_METAL6: case SURFACE_METAL_DOOR: @@ -5786,57 +5542,43 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) case SURFACE_METAL_FENCE: case SURFACE_METAL27: case SURFACE_METAL28: - sampleIndex = - m_anRandomTable[0] % 5u + AUDIO_SAMPLE_PED_FALL_METAL_1; + sampleIndex = m_anRandomTable[0] % 5 + AUDIO_SAMPLE_PED_FALL_METAL_1; break; case SURFACE_SAND: - sampleIndex = - (m_anRandomTable[4] & 3) + AUDIO_SAMPLE_PED_FALL_SAND_1; + sampleIndex = (m_anRandomTable[4] & 3) + AUDIO_SAMPLE_PED_FALL_SAND_1; break; case SURFACE_PUDDLE: - sampleIndex = (m_anRandomTable[3] & 3) + - AUDIO_SAMPLE_PED_FALL_IN_WATER_1; + sampleIndex = (m_anRandomTable[3] & 3) + AUDIO_SAMPLE_PED_FALL_IN_WATER_1; break; case SURFACE_WOOD: case SURFACE_WOOD_BOX: case SURFACE_WOOD_PLANK: - sampleIndex = - m_anRandomTable[2] % 5u + AUDIO_SAMPLE_PED_FALL_WOOD_1; + sampleIndex = m_anRandomTable[2] % 5 + AUDIO_SAMPLE_PED_FALL_WOOD_1; break; case SURFACE_HEDGE: - sampleIndex = - m_anRandomTable[2] % 5u + AUDIO_SAMPLE_COLLISION_HEDGE; + sampleIndex = m_anRandomTable[2] % 5 + AUDIO_SAMPLE_COLLISION_HEDGE; break; default: - sampleIndex = m_anRandomTable[2] % 5u + - AUDIO_SAMPLE_PED_FALL_PAVEMENT_1; + sampleIndex = m_anRandomTable[2] % 5 + AUDIO_SAMPLE_PED_FALL_PAVEMENT_1; break; } m_sQueueSample.m_nSampleIndex = sampleIndex; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = - m_asAudioEntities[m_sQueueSample.m_nEntityIndex] - .m_awAudioEvent[i] - - 28; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency / 17u); + m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - 28; + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17); switch(params->m_pPed->m_nMoveState) { case 2: emittingVol >>= 2; - m_sQueueSample.m_nFrequency = - 9 * m_sQueueSample.m_nFrequency / 10u; + m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10; break; case 3: emittingVol >>= 1; - m_sQueueSample.m_nFrequency = - 11 * m_sQueueSample.m_nFrequency / 10u; - break; - case 4: - m_sQueueSample.m_nFrequency = - 12 * m_sQueueSample.m_nFrequency / 10u; + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; break; + case 4: m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10; break; default: break; } m_sQueueSample.field_16 = 5; @@ -5858,20 +5600,17 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) emittingVol = m_anRandomTable[3] % 20 + 80; if(ped->m_nSurfaceTouched == SURFACE_PUDDLE) { m_sQueueSample.m_nSampleIndex = - (m_anRandomTable[3] & 3) + - AUDIO_SAMPLE_PED_FALL_IN_WATER_1; + (m_anRandomTable[3] & 3) + AUDIO_SAMPLE_PED_FALL_IN_WATER_1; } else if(sound == SOUND_FALL_LAND) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PED_FALL_LAND; } else { - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_PED_FALL_COLLAPSE; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PED_FALL_COLLAPSE; } m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency / 17u); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17); m_sQueueSample.field_16 = 2; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; @@ -6130,7 +5869,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000u) + 22000; + m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 22000; m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; @@ -6155,10 +5894,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_PISTOL_SHOT); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_PISTOL_SHOT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; @@ -6180,10 +5918,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_UZI_SHOT); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_UZI_SHOT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; @@ -6201,10 +5938,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_SHOTGUN_SHOT); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_SHOTGUN_SHOT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 60.0f; @@ -6226,10 +5962,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_CHAINGUN_SHOT); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_CHAINGUN_SHOT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; @@ -6247,10 +5982,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_M16_SHOT); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_M16_SHOT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; @@ -6268,10 +6002,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_SNIPER_SHOT); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_SNIPER_SHOT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 60.0f; @@ -6293,10 +6026,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_ROCKET_SHOT); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_ROCKET_SHOT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5); m_sQueueSample.field_16 = 1; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 90.0f; @@ -6314,25 +6046,22 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) noReflection = 1; break; case WEAPONTYPE_FLAMETHROWER: - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_WEAPON_FLAMETHROWER_SHOT; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WEAPON_FLAMETHROWER_SHOT; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = 9; emittingVol = 90; m_sQueueSample.m_nFrequency = (10 * m_sQueueSample.m_nEntityIndex & 2047) + - SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_FLAMETHROWER_SHOT); + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_FLAMETHROWER_SHOT); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_fSoundIntensity = 60.0f; maxDist = 3600.f; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset( - m_sQueueSample.m_nSampleIndex); + SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_bEmittingVolume = 90; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_56 = 0; @@ -6355,10 +6084,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_counter = iSound++; processed = 1; m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_PISTOL_RELOAD) + - RandomDisplacement(300u); - m_sQueueSample.m_nFrequency += RandomDisplacement(300u); + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_PISTOL_RELOAD) + + RandomDisplacement(300); + m_sQueueSample.m_nFrequency += RandomDisplacement(300); m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; @@ -6378,7 +6106,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_counter = iSound++; processed = 1; m_sQueueSample.m_nFrequency = 39243; - m_sQueueSample.m_nFrequency += RandomDisplacement(300u); + m_sQueueSample.m_nFrequency += RandomDisplacement(300); m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; @@ -6398,7 +6126,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_counter = iSound++; processed = 1; m_sQueueSample.m_nFrequency = 30290; - m_sQueueSample.m_nFrequency += RandomDisplacement(300u); + m_sQueueSample.m_nFrequency += RandomDisplacement(300); m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; @@ -6417,9 +6145,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) emittingVol = 75; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_CHAINGUN_RELOAD); - m_sQueueSample.m_nFrequency += RandomDisplacement(300u); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_CHAINGUN_RELOAD); + m_sQueueSample.m_nFrequency += RandomDisplacement(300); m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; @@ -6438,9 +6166,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) emittingVol = 75; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_UZI_RELOAD); - m_sQueueSample.m_nFrequency += RandomDisplacement(300u); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_UZI_RELOAD); + m_sQueueSample.m_nFrequency += RandomDisplacement(300); m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; @@ -6459,9 +6187,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) emittingVol = 75; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_SNIPER_RELOAD); - m_sQueueSample.m_nFrequency += RandomDisplacement(300u); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_SNIPER_RELOAD); + m_sQueueSample.m_nFrequency += RandomDisplacement(300); m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; @@ -6480,9 +6208,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) emittingVol = 75; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_ROCKET_RELOAD); - m_sQueueSample.m_nFrequency += RandomDisplacement(300u); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_ROCKET_RELOAD); + m_sQueueSample.m_nFrequency += RandomDisplacement(300); m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; @@ -6506,10 +6234,8 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_75); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_75); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; @@ -6530,10 +6256,9 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WEAPON_FLAMETHROWER_FIRE; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_WEAPON_FLAMETHROWER_FIRE); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_FLAMETHROWER_FIRE); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_fSoundIntensity = 60.0f; @@ -6551,10 +6276,8 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BULLET_HIT_PED); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 3); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BULLET_HIT_PED); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 3); m_sQueueSample.field_16 = 7; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; @@ -6572,7 +6295,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_counter = iSound++; processed = 1; - m_sQueueSample.m_nFrequency = RandomDisplacement(1400u) + 20000; + m_sQueueSample.m_nFrequency = RandomDisplacement(1400) + 20000; m_sQueueSample.field_16 = 1; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 40.0f; @@ -6590,12 +6313,11 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) SetupPedComments(params, sound); continue; - if(processed && iSound > 60u) iSound = 21; + if(processed && iSound > 60) iSound = 21; if(params->m_fDistance < maxDist) { CalculateDistance((bool *)params, params->m_fDistance); - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, + m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { if(noReflection) { if(0.2f * m_sQueueSample.m_fSoundIntensity > @@ -6611,12 +6333,11 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) if(noReflection) { m_sQueueSample.m_bOffset = 127; ++m_sQueueSample.m_nSampleIndex; - if(m_asAudioEntities[m_sQueueSample.m_nEntityIndex] - .m_awAudioEvent[i] != 47 || - weapon->m_eWeaponType != - WEAPONTYPE_FLAMETHROWER) { + if(m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] != + 47 || + weapon->m_eWeaponType != WEAPONTYPE_FLAMETHROWER) { m_sQueueSample.m_counter = iSound++; - if(iSound > 60u) iSound = 21; + if(iSound > 60) iSound = 21; } else { ++m_sQueueSample.m_counter; } @@ -6635,12 +6356,8 @@ cAudioManager::ProcessPhysical(int32 id) CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity; if(entity) { switch(entity->m_type & 7) { - case ENTITY_TYPE_VEHICLE: - ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity); - break; - case ENTITY_TYPE_PED: - ProcessPed((CPhysical *)m_asAudioEntities[id].m_pEntity); - break; + case ENTITY_TYPE_VEHICLE: ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity); break; + case ENTITY_TYPE_PED: ProcessPed((CPhysical *)m_asAudioEntities[id].m_pEntity); break; default: return; } } @@ -6669,16 +6386,7 @@ struct tVehicleSampleData { }; int32 *CSWTCH_554 = (int32 *)0x606A50; -tVehicleSampleData *vehicleSampleData = (tVehicleSampleData *)0x606204; - -#if 0 -WRAPPER -void -cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile) -{ - EAXJMP(0x56B0D0); -} -#else +tVehicleSampleData *CarSounds = (tVehicleSampleData *)0x606204; void cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile) @@ -6748,15 +6456,14 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * do { if(automobile->m_aWheelState[i]) ++wheelInUseCounter; ++i; - } while(i < 4u); - if(wheelInUseCounter > 2u) lostTraction = 1; + } while(i < 4); + if(wheelInUseCounter > 2) lostTraction = 1; } else if(transmission->nDriveType == 'F') { if((automobile->m_aWheelState[0] || automobile->m_aWheelState[2]) && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { lostTraction = 1; } - } else if(transmission->nDriveType == 'R' && - (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { + } else if(transmission->nDriveType == 'R' && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { lostTraction = 1; } if(0.0f != velocityChange) { @@ -6770,7 +6477,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * } else { freqModifier = 0; } - engineSoundType = vehicleSampleData[params->m_nIndex].m_bEngineSoundType; + engineSoundType = CarSounds[params->m_nIndex].m_bEngineSoundType; soundOffset = 3 * (engineSoundType - 1); if(accelerateState <= 0) { if(params->m_fVelocityChange < -0.001f) { @@ -6778,13 +6485,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * SampleManager.StopChannel(m_bActiveSamples); bAccelSampleStopped = 1; } - if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || - lostTraction) { + if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { gasPedalAudio = automobile->m_fGasPedalAudio; } else { gasPedalAudio = - min(1.0f, params->m_fVelocityChange / - params->m_pTransmission->fMaxReverseVelocity); + min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity); } gasPedalAudio = max(0.0f, gasPedalAudio); automobile->m_fGasPedalAudio = gasPedalAudio; @@ -6794,27 +6499,23 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * bAccelSampleStopped = 1; } nCruising = 0; - if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || - lostTraction || - params->m_fVelocityChange >= 0.01f && - automobile->m_fGasPedalAudio > 0.2f) { + if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || + params->m_fVelocityChange >= 0.01f && automobile->m_fGasPedalAudio > 0.2f) { automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f; gasPedalAudio = automobile->m_fGasPedalAudio; } if(gasPedalAudio > 0.05f) { freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000; if(engineSoundType == 6) freq >>= 1; - AddPlayerCarSample( - (25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, - (soundOffset + AUDIO_SAMPLE_VEHICLE_ENGINE_STOPPING_GENERIC), - engineSoundType, 63u, 0); + AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, + (soundOffset + AUDIO_SAMPLE_VEHICLE_ENGINE_STOPPING_GENERIC), + engineSoundType, 63, 0); } } freq = (10000.f * gasPedalAudio) + 22050; if(engineSoundType == 6) freq >>= 1; AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, - (engineSoundType + AUDIO_SAMPLE_VEHICLE_ENGINE_IDLE_NONE), 0, - 52u, 1); + (engineSoundType + AUDIO_SAMPLE_VEHICLE_ENGINE_IDLE_NONE), 0, 52, 1); CurrentPretendGear = max(1, currentGear); LastAccel = accelerateState; @@ -6824,19 +6525,15 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * return; } if(!nCruising) { - if(accelerateState < 150 || !automobile->m_nWheelsOnGround || - automobile->bIsHandbrakeOn || lostTraction || - currentGear < 2u && - velocityChange - automobile->m_fVelocityChangeForAudio >= 0.01f) { - if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || - lostTraction) { - if(!automobile->m_nWheelsOnGround && - automobile->m_nDriveWheelsOnGround || + if(accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || + lostTraction || + currentGear < 2u && velocityChange - automobile->m_fVelocityChangeForAudio >= 0.01f) { + if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { + if(!automobile->m_nWheelsOnGround && automobile->m_nDriveWheelsOnGround || (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround) { - automobile->m_fGasPedalAudio = - automobile->m_fGasPedalAudio * 0.6f; + automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f; } freqModifier = 0; baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000; @@ -6852,8 +6549,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * SampleManager.StopChannel(m_bActiveSamples); bAccelSampleStopped = 1; } - AddPlayerCarSample( - vol, freq, (engineSoundType + AUDIO_SAMPLE_PAYPHONE_RINGING), 0, 2u, 1); + AddPlayerCarSample(vol, freq, (engineSoundType + AUDIO_SAMPLE_PAYPHONE_RINGING), 0, 2, 1); LastAccel = accelerateState; bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; @@ -6871,7 +6567,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * bAccelSampleStopped = 0; } if(channelUsed) { - SampleManager.SetChannelEmittingVolume(m_bActiveSamples, 85u); + SampleManager.SetChannelEmittingVolume(m_bActiveSamples, 85); SampleManager.SetChannel3DPosition(m_bActiveSamples, pos.x, pos.y, pos.z); SampleManager.SetChannel3DDistances(m_bActiveSamples, 50.f, 12.5f); if(engineSoundType == 6) @@ -6880,8 +6576,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * freq = CSWTCH_554[CurrentPretendGear] + freqModifier + 22050; SampleManager.SetChannelFrequency(m_bActiveSamples, freq); if(!channelUsed) { - SampleManager.SetChannelReverbFlag( - m_bActiveSamples, m_bDynamicAcousticModelingStatus != 0); + SampleManager.SetChannelReverbFlag(m_bActiveSamples, + m_bDynamicAcousticModelingStatus != 0); SampleManager.StartChannel(m_bActiveSamples); } LastAccel = accelerateState; @@ -6891,11 +6587,10 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * return; } if(processedAccelSampleStopped) { - if(!SampleManager.InitialiseChannel(m_bActiveSamples, soundOffset + 345, 0)) - return; + if(!SampleManager.InitialiseChannel(m_bActiveSamples, soundOffset + 345, 0)) return; SampleManager.SetChannelLoopCount(m_bActiveSamples, 1); SampleManager.SetChannelLoopPoints(m_bActiveSamples, 0, -1); - SampleManager.SetChannelEmittingVolume(m_bActiveSamples, 85u); + SampleManager.SetChannelEmittingVolume(m_bActiveSamples, 85); SampleManager.SetChannel3DPosition(m_bActiveSamples, pos.x, pos.y, pos.z); SampleManager.SetChannel3DDistances(m_bActiveSamples, 50.f, 12.5f); if(engineSoundType == 6) @@ -6904,8 +6599,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * freq = CSWTCH_554[CurrentPretendGear] + freqModifier + 22050; SampleManager.SetChannelFrequency(m_bActiveSamples, freq); if(!channelUsed) { - SampleManager.SetChannelReverbFlag( - m_bActiveSamples, m_bDynamicAcousticModelingStatus != 0); + SampleManager.SetChannelReverbFlag(m_bActiveSamples, + m_bDynamicAcousticModelingStatus != 0); SampleManager.StartChannel(m_bActiveSamples); } LastAccel = accelerateState; @@ -6916,11 +6611,10 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * } if(CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) { ++CurrentPretendGear; - if(!SampleManager.InitialiseChannel(m_bActiveSamples, soundOffset + 345, 0)) - return; + if(!SampleManager.InitialiseChannel(m_bActiveSamples, soundOffset + 345, 0)) return; SampleManager.SetChannelLoopCount(m_bActiveSamples, 1); SampleManager.SetChannelLoopPoints(m_bActiveSamples, 0, -1); - SampleManager.SetChannelEmittingVolume(m_bActiveSamples, 85u); + SampleManager.SetChannelEmittingVolume(m_bActiveSamples, 85); SampleManager.SetChannel3DPosition(m_bActiveSamples, pos.x, pos.y, pos.z); SampleManager.SetChannel3DDistances(m_bActiveSamples, 50.f, 12.5f); freq = CSWTCH_554[CurrentPretendGear] + freqModifier + 22050; @@ -6929,8 +6623,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * SampleManager.SetChannelFrequency(m_bActiveSamples, freq); if(!channelUsed) { - SampleManager.SetChannelReverbFlag( - m_bActiveSamples, m_bDynamicAcousticModelingStatus != 0); + SampleManager.SetChannelReverbFlag(m_bActiveSamples, + m_bDynamicAcousticModelingStatus != 0); SampleManager.StartChannel(m_bActiveSamples); } LastAccel = accelerateState; @@ -6942,8 +6636,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * nCruising = 1; } bAccelSampleStopped = 1; - if(accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || - lostTraction || currentGear < params->m_pTransmission->nNumberOfGears - 1) { + if(accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || + currentGear < params->m_pTransmission->nNumberOfGears - 1) { nCruising = 0; } else { if(accelerateState >= 220 && @@ -6954,22 +6648,75 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * } freq = 27 * nCruising + freqModifier + 22050; if(engineSoundType == 6) freq >>= 1; - AddPlayerCarSample(85u, freq, - (soundOffset + AUDIO_SAMPLE_VEHICLE_ENGINE_CHANGE_GEAR_GENERIC), - engineSoundType, 64u, 1); + AddPlayerCarSample(85, freq, (soundOffset + AUDIO_SAMPLE_VEHICLE_ENGINE_CHANGE_GEAR_GENERIC), + engineSoundType, 64, 1); } LastAccel = accelerateState; bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; bLostTractionLastFrame = lostTraction; } -#endif -WRAPPER void cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) { - EAXJMP(0x578190); + uint32 time = CTimer::GetTimeInMilliseconds(); + int32 sampleIndex; + uint8 emittingVol; + float distSquared; + float maxDist; + cPedParams params; + + static uint8 counter = 0; + + if(time > audioLogicTimers[7]) { + switch(sound) { + case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + break; + case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + break; + default: return; + } + distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + if(distSquared < maxDist) { + m_sQueueSample.m_fDistance = sqrt(distSquared); + if(m_nTimeOfRecentCrime & 1) + sampleIndex = (m_anRandomTable[1] & 3) + AUDIO_SAMPLE_PED_HIT_1; + else + sampleIndex = (m_anRandomTable[3] & 1) + AUDIO_SAMPLE_PED_HIT_BY_BAT; + m_sQueueSample.m_nSampleIndex = sampleIndex; + emittingVol = m_anRandomTable[0] % 50 + 55; + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_counter = counter++; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.field_56 = 1; + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_48 = 0.0f; + m_sQueueSample.m_bEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + params.m_bDistanceCalculated = 1; + params.m_fDistance = distSquared; + params.m_pPed = 0; + SetupPedComments(¶ms, SOUND_8A); + } + audioLogicTimers[7] = time + 500 + m_anRandomTable[3] % 1500; + } + } } void @@ -7027,18 +6774,17 @@ cAudioManager::ProcessPornCinema(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; sample = AUDIO_SAMPLE_PORN_CINEMA_3_SEX_1; break; - default: break; + default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = sqrt(distSquared); if(sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) { m_sQueueSample.m_bVolume = - ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_counter = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 0; @@ -7047,10 +6793,9 @@ cAudioManager::ProcessPornCinema(uint8 sound) m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_bEmittingVolume = maxVolume; m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset( - m_sQueueSample.m_nSampleIndex); + 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(); @@ -7059,15 +6804,14 @@ cAudioManager::ProcessPornCinema(uint8 sound) time = CTimer::GetTimeInMilliseconds(); if(time > audioLogicTimers[0]) { - m_sQueueSample.m_bVolume = ComputeVolume( - 90u, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(90, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { rand = m_anRandomTable[1] & 1; m_sQueueSample.m_nSampleIndex = rand + sample; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += - RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); m_sQueueSample.m_counter = rand + 1; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 1; @@ -7079,17 +6823,68 @@ cAudioManager::ProcessPornCinema(uint8 sound) m_sQueueSample.m_bReverbFlag = 1; m_sQueueSample.m_bRequireReflection = 0; AddSampleToRequestedQueue(); - audioLogicTimers[0] = time + 2000 + m_anRandomTable[3] % 6000u; + audioLogicTimers[0] = time + 2000 + m_anRandomTable[3] % 6000; } } } } -WRAPPER void cAudioManager::ProcessProjectiles() { - EAXJMP(0x578A80); + uint8 emittingVol; + float maxDist; + + for(int32 i = 0; i < 32; i++) { + if(CProjectileInfo::GetProjectileInfo(i)->m_bInUse) { + switch(CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) { + case WEAPONTYPE_ROCKETLAUNCHER: + emittingVol = maxVolume; + maxDist = 8100.f; + m_sQueueSample.m_fSoundIntensity = 90.0; + m_sQueueSample.m_nSampleIndex = 81; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WEAPON_ROCKET_PROCESS); + m_sQueueSample.field_16 = 3; + break; + case WEAPONTYPE_MOLOTOV: + emittingVol = 50; + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FIRE_PED; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_nFrequency = + 32 * SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FIRE_PED) / 25; + m_sQueueSample.field_16 = 7; + break; + default: return; + } + m_sQueueSample.field_48 = 4.0; + m_sQueueSample.field_76 = 3; + m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i].GetPosition(); + float 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_bIsDistant = 0; + m_sQueueSample.m_nLoopCount = 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.field_56 = 0; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + } + } + } } void @@ -7102,22 +6897,21 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params) (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { ++params->m_pVehicle->m_bRainAudioCounter; veh = params->m_pVehicle; - if(veh->m_bRainAudioCounter >= 2u) { + if(veh->m_bRainAudioCounter >= 2) { veh->m_bRainAudioCounter = 0; CalculateDistance((bool *)params, params->m_fDistance); emittingVol = 30.f * CWeather::Rain; - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, 22.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 22.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = veh->m_bRainSamplesCounter++; veh = params->m_pVehicle; - if(veh->m_bRainSamplesCounter > 4u) veh->m_bRainSamplesCounter = 68; + if(veh->m_bRainSamplesCounter > 4) veh->m_bRainSamplesCounter = 68; m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + AUDIO_SAMPLE_RAIN_ON_VEHICLE_1; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 9; - m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000u + 28000; + m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000 + 28000; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bEmittingVolume = (uint8)emittingVol; m_sQueueSample.m_nLoopStart = 0; @@ -7138,8 +6932,7 @@ cAudioManager::ProcessReverb() const { if(SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) { for(uint32 i = 0; i < 28; i++) { - if(m_asActiveSamples[i].m_bReverbFlag) - SampleManager.SetChannelReverbFlag(i, 1); + if(m_asActiveSamples[i].m_bReverbFlag) SampleManager.SetChannelReverbFlag(i, 1); } } } @@ -7158,8 +6951,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params) CalculateDistance((bool *)params, params->m_fDistance); automobile = (CAutomobile *)params->m_pVehicle; if(automobile->m_nWheelsOnGround) { - modificator = params->m_fVelocityChange / - params->m_pTransmission->fMaxReverseVelocity; + modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity; } else { if(automobile->m_nDriveWheelsOnGround) automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f; @@ -7167,16 +6959,14 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params) } modificator = Abs(modificator); emittingVol = (24.f * modificator); - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { if(params->m_pVehicle->m_fGasPedal >= 0.0f) { m_sQueueSample.m_counter = 62; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_REVERSE_GEAR_CONSTANT; } else { m_sQueueSample.m_counter = 61; - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_REVERSE_GEAR_ACCELERATING; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_REVERSE_GEAR_ACCELERATING; } m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; @@ -7186,8 +6976,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params) 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_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 3.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.field_56 = 0; @@ -7213,18 +7002,17 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; break; - default: break; + default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = sqrt(distSquared); - m_sQueueSample.m_bVolume = ComputeVolume(30u, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_SAWMILL_1; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_SAWMILL_1); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_SAWMILL_1); m_sQueueSample.m_counter = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 0; @@ -7234,21 +7022,20 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) m_sQueueSample.m_bEmittingVolume = 30; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(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(); } time = CTimer::GetTimeInMilliseconds(); if(time > audioLogicTimers[1]) { - m_sQueueSample.m_bVolume = ComputeVolume( - 70u, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_SAWMILL_2; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_counter = 1; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 1; @@ -7260,7 +7047,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) m_sQueueSample.m_bReverbFlag = 1; m_sQueueSample.m_bRequireReflection = 0; AddSampleToRequestedQueue(); - audioLogicTimers[1] = time + 2000 + m_anRandomTable[3] % 4000u; + audioLogicTimers[1] = time + 2000 + m_anRandomTable[3] % 4000; } } } @@ -7293,18 +7080,17 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; break; - default: break; + default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = sqrt(distSquared); - m_sQueueSample.m_bVolume = ComputeVolume(30u, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_SHOP_1; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_SHOP_1); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_SHOP_1); m_sQueueSample.m_counter = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 0; @@ -7314,22 +7100,21 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) m_sQueueSample.m_bEmittingVolume = 30; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(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(); } time = CTimer::GetTimeInMilliseconds(); if(time > audioLogicTimers[2]) { - m_sQueueSample.m_bVolume = ComputeVolume( - 70u, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { rand = m_anRandomTable[1] & 1; m_sQueueSample.m_nSampleIndex = rand + AUDIO_SAMPLE_SHOP_2; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_counter = rand + 1; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 1; @@ -7342,7 +7127,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) m_sQueueSample.m_bReverbFlag = 1; m_sQueueSample.m_bRequireReflection = 0; AddSampleToRequestedQueue(); - audioLogicTimers[2] = time + 3000 + m_anRandomTable[3] % 7000u; + audioLogicTimers[2] = time + 3000 + m_anRandomTable[3] % 7000; } } } @@ -7353,20 +7138,19 @@ cAudioManager::ProcessSpecial() { if(m_bUserPause) { if(!m_bPreviousUserPause) { - MusicManager.ChangeMusicMode(0); + MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND); SampleManager.SetEffectsFadeVolume(maxVolume); SampleManager.SetMusicFadeVolume(maxVolume); } } else { if(m_bPreviousUserPause) { MusicManager.StopFrontEndTrack(); - MusicManager.ChangeMusicMode(1u); + MusicManager.ChangeMusicMode(MUSICMODE_GAME); } CPlayerPed *playerPed = FindPlayerPed(); if(playerPed) { const PedState &state = playerPed->m_nPedState; - if(state != PED_ENTER_CAR && state != PED_STEAL_CAR && - !playerPed->bInVehicle) + if(state != PED_ENTER_CAR && state != PED_STEAL_CAR && !playerPed->bInVehicle) SampleManager.StopChannel(m_bActiveSamples); } } @@ -7387,8 +7171,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params) speedMultipler = min(1.0f, train->m_fSpeed * 250.f / 51.f); emittingVol = (75.f * speedMultipler); if(train->m_fWagonPosition == 0.0f) { - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, 300.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 300.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 32; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_TRAIN_FAR; @@ -7400,10 +7183,9 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params) m_sQueueSample.m_nLoopCount = 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); + SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 3.0f; m_sQueueSample.m_fSoundIntensity = 300.0f; m_sQueueSample.field_56 = 0; @@ -7414,8 +7196,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params) } } if(params->m_fDistance < 4900.f) { - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, 70.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 70.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 33; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_TRAIN_CLOSE; @@ -7442,21 +7223,95 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params) return 1; } -#if 1 -WRAPPER void -cAudioManager::ProcessVehicle(CVehicle *) +cAudioManager::ProcessVehicle(CVehicle *veh) { - EAXJMP(0x569A00); -} + tHandlingData *handling = veh->pHandling; + float velChange; + cVehicleParams params; + m_sQueueSample.m_vecPos = veh->GetPosition(); -#else -void -cAudioManager::ProcessVehicle(CVehicle *) -{ - EAXJMP(0x569A00); + params.m_bDistancECalculated = 0; + params.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos); + params.m_pVehicle = veh; + params.m_pTransmission = nil; + params.m_nIndex = 0; + params.m_fVelocityChange = 0.0; + + if(handling) params.m_pTransmission = &handling->Transmission; + + params.m_nIndex = veh->m_modelIndex - 90; + if(params.m_pVehicle->m_status == STATUS_SIMPLE) + velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f; + else + velChange = DotProduct(params.m_pVehicle->m_vecMoveSpeed, params.m_pVehicle->GetForward()); + params.m_fVelocityChange = velChange; + switch(params.m_pVehicle->m_vehType) { + case VEHICLE_TYPE_CAR: + UpdateGasPedalAudio((CAutomobile *)veh); + if(params.m_nIndex == RCBANDIT) { + ProcessModelCarEngine(¶ms); + ProcessVehicleOneShots(¶ms); + ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; + ProcessRainOnVehicle(¶ms); + break; + } + if(params.m_nIndex == DODO) { + if(!ProcessVehicleRoadNoise(¶ms)) { + ProcessVehicleOneShots(¶ms); + ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; + ProcessRainOnVehicle(¶ms); + break; + } + if(CWeather::WetRoads > 0.f) ProcessWetRoadNoise(¶ms); + ProcessVehicleSkidding(¶ms); + } else { + if(!ProcessVehicleRoadNoise(¶ms)) { + ProcessVehicleOneShots(¶ms); + ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; + ProcessRainOnVehicle(¶ms); + break; + } + ProcessReverseGear(¶ms); + if(CWeather::WetRoads > 0.f) ProcessWetRoadNoise(¶ms); + ProcessVehicleSkidding(¶ms); + ProcessVehicleHorn(¶ms); + ProcessVehicleSirenOrAlarm(¶ms); + if(UsesReverseWarning(params.m_nIndex)) ProcessVehicleReverseWarning(¶ms); + if(HasAirBrakes(params.m_nIndex)) ProcessAirBrakes(¶ms); + } + ProcessCarBombTick(¶ms); + ProcessVehicleEngine(¶ms); + ProcessEngineDamage(¶ms); + ProcessVehicleDoors(¶ms); + ProcessVehicleOneShots(¶ms); + ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; + ProcessRainOnVehicle(¶ms); + break; + case VEHICLE_TYPE_BOAT: + ProcessBoatEngine(¶ms); + ProcessBoatMovingOverWater(¶ms); + ProcessVehicleOneShots(¶ms); + ProcessRainOnVehicle(¶ms); + break; + case VEHICLE_TYPE_TRAIN: + ProcessTrainNoise(¶ms); + ProcessVehicleOneShots(¶ms); + ProcessRainOnVehicle(¶ms); + break; + case VEHICLE_TYPE_HELI: + ProcessHelicopter(¶ms); + ProcessVehicleOneShots(¶ms); + ProcessRainOnVehicle(¶ms); + break; + case VEHICLE_TYPE_PLANE: + ProcessPlane(¶ms); + ProcessVehicleOneShots(¶ms); + ProcessRainOnVehicle(¶ms); + break; + default: ProcessRainOnVehicle(¶ms); break; + } } -#endif bool cAudioManager::ProcessVehicleDoors(cVehicleParams *params) @@ -7477,17 +7332,15 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params) velocity = min(0.3f, Abs(automobile->Doors[i].m_fAngVel)); if(velocity > 0.0035f) { emittingVol = (100.f * velocity * 10.f / 3.f); - m_sQueueSample.m_bVolume = ComputeVolume( - emittingVol, 40.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVol, 40.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = i + 6; m_sQueueSample.m_nSampleIndex = - m_anRandomTable[1] % 6u + - AUDIO_SAMPLE_CAR_DOOR_MOVEMENT_1; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency( - m_sQueueSample.m_nSampleIndex) + - RandomDisplacement(1000u); + m_anRandomTable[1] % 6 + AUDIO_SAMPLE_CAR_DOOR_MOVEMENT_1; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency( + m_sQueueSample.m_nSampleIndex) + + RandomDisplacement(1000); m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 10; @@ -7509,6 +7362,94 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params) return 1; } +WRAPPER +bool +cAudioManager::ProcessVehicleEngine(cVehicleParams *params) +{ + EAXJMP(0x56A610); +} + +void +cAudioManager::ProcessVehicleHorn(cVehicleParams *params) +{ + CAutomobile *automobile; + + if(params->m_fDistance < 1600.f) { + automobile = (CAutomobile *)params->m_pVehicle; + if((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && + automobile->m_modelIndex != MI_MRWHOOP) { + if(automobile->m_nCarHornTimer) { + if(!params->m_pVehicle->m_status) { + CalculateDistance((bool *)params, params->m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(80, 40.f, m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_counter = 4; + m_sQueueSample.m_nSampleIndex = + CarSounds[params->m_nIndex].m_nHornSample; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.field_16 = 2; + m_sQueueSample.m_nFrequency = + CarSounds[params->m_nIndex].m_nHornFrequency; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bEmittingVolume = 80; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset( + m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.field_48 = 5.0; + m_sQueueSample.m_fSoundIntensity = 40.0; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_76 = 3; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + return; + } + if(automobile->m_nCarHornTimer > 44) automobile->m_nCarHornTimer = 44; + if(automobile->m_nCarHornTimer == 44) + automobile->field_22D = + (LOBYTE(m_nTimeOfRecentCrime) + LOBYTE(m_sQueueSample.m_nEntityIndex)) & 7; + if(hornPatternsArray[automobile->field_22D][44 - automobile->m_nCarHornTimer]) { + CalculateDistance((bool *)params, params->m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(80, 40.f, m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_counter = 4; + m_sQueueSample.m_nSampleIndex = + CarSounds[params->m_nIndex].m_nHornSample; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.field_16 = 2; + m_sQueueSample.m_nFrequency = + CarSounds[params->m_nIndex].m_nHornFrequency; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bEmittingVolume = 80; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset( + m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.field_48 = 5.0; + m_sQueueSample.m_fSoundIntensity = 40.0; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_76 = 3; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + } + } + } + } +} + +WRAPPER +void +cAudioManager::ProcessVehicleOneShots(void *) +{ + EAXJMP(0x56CD40); +} + bool cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params) { @@ -7518,7 +7459,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params) if(veh->bEngineOn && veh->m_fGasPedal < 0.0f) { CalculateDistance((bool *)params, params->m_fDistance); - m_sQueueSample.m_bVolume = ComputeVolume(60u, 50.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(60, 50.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 12; m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_VEHICLE_REVERSE_WARNING; @@ -7526,15 +7467,13 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params) m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 2; m_sQueueSample.m_nFrequency = - (100 * m_sQueueSample.m_nEntityIndex & 0x3FF) + - SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_VEHICLE_REVERSE_WARNING); + (100 * m_sQueueSample.m_nEntityIndex & 1023) + + SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_VEHICLE_REVERSE_WARNING); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = 60; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 3.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.field_56 = 0; @@ -7563,40 +7502,30 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params) if(velocity > 0.0f) { CalculateDistance((bool *)params, params->m_fDistance); emittingVol = - 30.f * - min(1.f, - velocity / (0.5f * params->m_pTransmission->fMaxVelocity)); - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, 95.f, m_sQueueSample.m_fDistance); + 30.f * min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity)); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 95.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 0; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 3; - if(params->m_pVehicle->m_nSurfaceTouched == - SURFACE_PUDDLE) { - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_LOOPING_WATER; + if(params->m_pVehicle->m_nSurfaceTouched == SURFACE_PUDDLE) { + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_LOOPING_WATER; freq = 6050 * emittingVol / 30 + 16000; } else { - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_VEHICLE_ROAD_NOISE; - modificator = - m_sQueueSample.m_fDistance * 1.f / 95.f * 0.5f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_VEHICLE_ROAD_NOISE; + modificator = m_sQueueSample.m_fDistance * 1.f / 95.f * 0.5f; sampleFreq = SampleManager.GetSampleBaseFrequency( AUDIO_SAMPLE_VEHICLE_ROAD_NOISE); - freq = (sampleFreq * modificator) + - ((3 * sampleFreq) >> 2); + freq = (sampleFreq * modificator) + ((3 * sampleFreq) >> 2); } m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = emittingVol; m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset( - m_sQueueSample.m_nSampleIndex); + SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset( - m_sQueueSample.m_nSampleIndex); + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 6.0f; m_sQueueSample.m_fSoundIntensity = 95.0f; m_sQueueSample.field_56 = 0; @@ -7612,7 +7541,142 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params) } WRAPPER -void cAudioManager::ProcessWaterCannon(int32) { EAXJMP(0x575F30); } +void +cAudioManager::ProcessVehicleSirenOrAlarm(void *) +{ + EAXJMP(0x56C420); +} + +void +cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) +{ + CAutomobile *automobile; + cTransmission *transmission; + int32 emittingVol; + float newSkidVal = 0.f; + float skidVal = 0.f; + + if(params->m_fDistance >= 1600.f) return; + automobile = (CAutomobile *)params->m_pVehicle; + if(!automobile->m_nWheelsOnGround) return; + CalculateDistance((bool *)params, params->m_fDistance); + for(int32 i = 0; i < 4; i++) { + if(!automobile->m_aWheelState[i] || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING) + continue; + transmission = params->m_pTransmission; + if(transmission->nDriveType == '4') { + newSkidVal = + GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); + if(newSkidVal > skidVal) skidVal = newSkidVal; + continue; + } + if(transmission->nDriveType != 'F') { + if(transmission->nDriveType != 'R') { + if(newSkidVal > skidVal) skidVal = newSkidVal; + continue; + } + if(i != 1 && i != 3) { + newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, + params->m_fVelocityChange); + if(newSkidVal > skidVal) skidVal = newSkidVal; + continue; + } + newSkidVal = + GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); + if(newSkidVal > skidVal) skidVal = newSkidVal; + continue; + } + if(i == 0 || i == 2) { + newSkidVal = + GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); + if(newSkidVal > skidVal) skidVal = newSkidVal; + continue; + } + newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); + if(newSkidVal > skidVal) skidVal = newSkidVal; + } + + if(skidVal > 0.0f) { + emittingVol = 50.f * skidVal; + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 40.f, m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_counter = 3; + switch(params->m_pVehicle->m_nSurfaceTouched) { + case SURFACE_GRASS: + case SURFACE_HEDGE: + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_LOOPING_GRASS; + emittingVol /= 4; + m_sQueueSample.m_nFrequency = (signed __int64)(13000.f * skidVal + 35000.f); + m_sQueueSample.m_bVolume /= 4; + break; + case SURFACE_DIRT: + case SURFACE_DIRTTRACK: + case SURFACE_SAND: + case SURFACE_PUDDLE: + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_LOOPING_SOFT; + m_sQueueSample.m_nFrequency = 6000.f * skidVal + 10000.f; + break; + + default: + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_VEHICLE_SKIDDING; + m_sQueueSample.m_nFrequency = 5000.f * skidVal + 11000.f; + break; + } + + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.field_16 = 8; + m_sQueueSample.m_nLoopCount = 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.field_48 = 3.0; + m_sQueueSample.m_fSoundIntensity = 40.0; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_76 = 3; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + } +} + +void cAudioManager::ProcessWaterCannon(int32) +{ + for(int32 i = 0; i < 3; i++) { + if(aCannons[i].m_nId) { + m_sQueueSample.m_vecPos = aCannons[0].m_avecPos[aCannons[i].m_wIndex]; + float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + if(distSquared < 900.f) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_bVolume = + ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_fSoundIntensity = 900.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_TAXI_SOUND; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_nFrequency = 15591; + m_sQueueSample.field_16 = 5; + m_sQueueSample.m_counter = i; + m_sQueueSample.field_48 = 2.0f; + m_sQueueSample.field_76 = 8; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.field_56 = 0; + m_sQueueSample.m_bEmittingVolume = 50; + 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 cAudioManager::ProcessWeather(int32 id) @@ -7620,17 +7684,16 @@ cAudioManager::ProcessWeather(int32 id) uint8 vol; static uint8 counter = 0; - if(m_asAudioEntities[id].m_Loops && - m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) { + if(m_asAudioEntities[id].m_Loops && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) { if(m_asAudioEntities[id].m_afVolume[0] >= 10.f) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_EXPLOSION_CAR; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = RandomDisplacement(500u) + 4000; + m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; vol = (m_asAudioEntities[id].m_afVolume[0] - 10.f) + 40; } else { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WEAPON_GRENADE_EXPLOSION; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = RandomDisplacement(500u) + 4000; + m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; vol = (m_asAudioEntities[id].m_afVolume[0]) + 35; } m_sQueueSample.m_bVolume = vol; @@ -7647,7 +7710,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_bReverbFlag = 0; m_sQueueSample.m_bRequireReflection = 0; - cAudioManager::AddSampleToRequestedQueue(); + AddSampleToRequestedQueue(); } if(CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_LOOPING_GRASS; @@ -7664,12 +7727,10 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.field_76 = 30; m_sQueueSample.m_bReverbFlag = 0; m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume; - m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_bRequireReflection = 0; - cAudioManager::AddSampleToRequestedQueue(); + AddSampleToRequestedQueue(); } } @@ -7689,30 +7750,24 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params) if(velChange > 0.f) { CalculateDistance((bool *)params, params->m_fDistance); relativeVelocity = - min(1.0f, - velChange / (0.5f * params->m_pTransmission->fMaxVelocity)); + min(1.0f, velChange / (0.5f * params->m_pTransmission->fMaxVelocity)); emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads; - m_sQueueSample.m_bVolume = - ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 1; - m_sQueueSample.m_nSampleIndex = - AUDIO_SAMPLE_VEHICLE_ROAD_NOISE; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_VEHICLE_ROAD_NOISE; m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.field_16 = 3; modificator = m_sQueueSample.m_fDistance * 1.f / 3.f * 0.5f; - freq = SampleManager.GetSampleBaseFrequency( - AUDIO_SAMPLE_VEHICLE_ROAD_NOISE); + freq = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_VEHICLE_ROAD_NOISE); m_sQueueSample.m_nFrequency = freq + freq * modificator; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = emittingVol; m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset( - m_sQueueSample.m_nSampleIndex); + SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset( - m_sQueueSample.m_nSampleIndex); + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 6.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.field_56 = 0; @@ -7739,18 +7794,17 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound) maxDist = 400.f; m_sQueueSample.m_fSoundIntensity = 20.0f; break; - default: break; + default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < maxDist) { m_sQueueSample.m_fDistance = sqrt(distSquared); - m_sQueueSample.m_bVolume = ComputeVolume(30u, m_sQueueSample.m_fSoundIntensity, - m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WORK_SHOP; m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WORK_SHOP); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WORK_SHOP); m_sQueueSample.m_counter = 0; m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_nLoopCount = 0; @@ -7760,8 +7814,7 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound) m_sQueueSample.m_bEmittingVolume = 30; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(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(); @@ -7799,18 +7852,66 @@ cAudioManager::ReleaseDigitalHandle() const if(m_bIsInitialised) { SampleManager.ReleaseDigitalHandle(); } } -WRAPPER -int32 -cAudioManager::ReportCollision(CEntity *a2, CEntity *a3, uint8 a4, uint8 a5, float a6, float a7) +void +cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower, + float velocity) { - EAXJMP(0x568410); + float dist; + CVector v1; + CVector v2; + + if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_bUserPause || + (velocity < 0.0016f && collisionPower < 0.01f)) + return; + + if(entity1->IsBuilding()) { + v1 = v2 = entity2->GetPosition(); + } else if(entity2->IsBuilding()) { + v1 = v2 = entity1->GetPosition(); + } else { + v1 = entity1->GetPosition(); + v2 = entity2->GetPosition(); + } + CVector pos = (v1 + v2) * 0.5f; + dist = GetDistanceSquared(&pos); + if(dist < SQR(60.f)) { + m_sCollisionManager.m_sQueue.m_pEntity1 = entity1; + m_sCollisionManager.m_sQueue.m_pEntity2 = entity2; + m_sCollisionManager.m_sQueue.m_bSurface1 = surface1; + m_sCollisionManager.m_sQueue.m_bSurface2 = surface2; + m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower; + m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity; + m_sCollisionManager.m_sQueue.m_vecPosition = pos; + m_sCollisionManager.m_sQueue.m_fDistance = dist; + m_sCollisionManager.AddCollisionToRequestedQueue(); + } } -WRAPPER -int32 -cAudioManager::ReportCrime(eCrimeType crime, const CVector *pos) -{ - EAXJMP(0x5803D0); +void +cAudioManager::ReportCrime(int32 type, const CVector *pos) +{ + int32 lastCrime = 10; + if(m_bIsInitialised && MusicManager.m_nMusicMode != 2 && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && + (type > 0 || type < 17) && m_nTimeOfRecentCrime >= gMinTimeToNextReport[type]) { + for(int32 i = 0; i < 10; i++) { + if(crimes[i].type) { + if(crimes[i].type == type) { + crimes[i].position = *pos; + crimes[i].timer = 0; + return; + } + } else { + lastCrime = i; + } + } + + if(lastCrime < 10) { + crimes[lastCrime].type = type; + crimes[lastCrime].position = *pos; + crimes[lastCrime].timer = 0; + gMinTimeToNextReport[type] = m_nTimeOfRecentCrime + 500; + } + } } void @@ -7830,38 +7931,264 @@ cAudioManager::ResetAudioLogicTimers(int32 timer) CPed *ped = (CPed *)m_asAudioEntities[m_anAudioEntityIndices[i]].m_pEntity; if(ped->IsPed()) { ped->m_lastSoundStart = timer; - ped->m_soundStart = timer + m_anRandomTable[0] % 3000u; + ped->m_soundStart = timer + m_anRandomTable[0] % 3000; } } } ClearMissionAudio(); - SampleManager.StopChannel(28); + SampleManager.StopChannel(policeChannel); } void cAudioManager::ResetPoliceRadio() { if(m_bIsInitialised) { - if(SampleManager.GetChannelUsedFlag(28)) SampleManager.StopChannel(28); + if(SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel); InitialisePoliceRadio(); } } -WRAPPER void -cAudioManager::ResetTimers(uint32 a2) +cAudioManager::ResetTimers(uint32 time) { - EAXJMP(0x57A7B0); + if(m_bIsInitialised) { + m_bTimerJustReset = 1; + m_nTimer = time; + ClearRequestedQueue(); + if(m_bActiveSampleQueue) { + m_bActiveSampleQueue = 0; + ClearRequestedQueue(); + m_bActiveSampleQueue = 1; + } else { + m_bActiveSampleQueue = 1; + ClearRequestedQueue(); + m_bActiveSampleQueue = 0; + } + ClearActiveSamples(); + ClearMissionAudio(); + SampleManager.StopChannel(policeChannel); + SampleManager.SetEffectsFadeVolume(0); + SampleManager.SetMusicFadeVolume(0); + MusicManager.ResetMusicAfterReload(); + } } -WRAPPER void +void cAudioManager::Service() { - EAXJMP(0x57A2A0); + GenerateIntegerRandomNumberTable(); + if(m_bTimerJustReset) { + ResetAudioLogicTimers(m_nTimer); + MusicManager.ResetTimers(m_nTimer); + m_bTimerJustReset = 0; + } + if(m_bIsInitialised) { + m_bPreviousUserPause = m_bUserPause; + m_bUserPause = CTimer::GetIsUserPaused(); + UpdateReflections(); + ServiceSoundEffects(); + MusicManager.Service(); + } } WRAPPER -int8 cAudioManager::SetCurrent3DProvider(uint8) { EAXJMP(0x57A910); } +void +cAudioManager::ServiceCollisions() +{ + EAXJMP(0x5686D0); +} + +void +cAudioManager::ServicePoliceRadio() +{ + int32 wantedLevel = 0; // bug?; + static uint32 nLastSeen = 300; + + if(m_bIsInitialised) { + if(!m_bUserPause) { + bool crimeReport = SetupCrimeReport(); + wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel; + if(!crimeReport) { + if(wantedLevel) { + if(nLastSeen) { + --nLastSeen; + } else { + nLastSeen = m_anRandomTable[1] % 1000 + 2000; + SetupSuspectLastSeenReport(); + } + } + } + } + ServicePoliceRadioChannel(wantedLevel); + } +} + +void +cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel) +{ + bool processed = false; + uint32 sample; + int32 freq; + + static int cWait = 0; + static bool bChannelOpen = 0; + static uint8 bMissionAudioPhysicalPlayingStatus = 0; + static int32 PoliceChannelFreq = 5500; + + if(m_bIsInitialised) { + if(m_bUserPause) { + if(SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel); + if(g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == 1 && + SampleManager.IsStreamPlaying(1)) { + SampleManager.PauseStream(1, 1); + } + } else { + if(m_bPreviousUserPause && g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && + bMissionAudioPhysicalPlayingStatus == 1) { + SampleManager.PauseStream(0, 1); + } + if(!policeChannelTimer) bChannelOpen = 0; + if(cWait) { + --cWait; + return; + } + if(g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && !bChannelOpen) { + if(g_nMissionAudioPlayingStatus) { + if(g_nMissionAudioPlayingStatus == 1 && !bMissionAudioPhysicalPlayingStatus && + SampleManager.IsStreamPlaying(1)) { + bMissionAudioPhysicalPlayingStatus = 1; + } + if(bMissionAudioPhysicalPlayingStatus == 1) { + if(SampleManager.IsStreamPlaying(1)) { + DoPoliceRadioCrackle(); + } else { + bMissionAudioPhysicalPlayingStatus = 2; + g_nMissionAudioPlayingStatus = 2; + g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES; + cWait = 30; + } + return; + } + } else if(!SampleManager.GetChannelUsedFlag(policeChannel)) { + SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1); + SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 1); + SampleManager.StartPreloadedStreamedFile(1); + g_nMissionAudioPlayingStatus = 1; + bMissionAudioPhysicalPlayingStatus = 0; + return; + } + } + if(bChannelOpen) DoPoliceRadioCrackle(); + if((g_nMissionAudioSfx == TOTAL_AUDIO_SAMPLES || g_nMissionAudioPlayingStatus != 1) && + !SampleManager.GetChannelUsedFlag(policeChannel) && policeChannelTimer) { + if(policeChannelTimer) { + sample = crimesSamples[policeChannelCounterSeconds]; + --policeChannelTimer; + policeChannelCounterSeconds = (policeChannelCounterSeconds + 1) % 60; + } else { + sample = TOTAL_AUDIO_SAMPLES; + } + if(!wantedLevel) { + if(gSpecialSuspectLastSeenReport) { + gSpecialSuspectLastSeenReport = 0; + } else if((unsigned int)(sample - 212) <= 2 || sample == TOTAL_AUDIO_SAMPLES) { + bChannelOpen = 0; + processed = 1; + } + } + if(sample == TOTAL_AUDIO_SAMPLES) { + if(!processed) cWait = 30; + } else { + SampleManager.InitialiseChannel(policeChannel, sample, 0); + switch(sample) { + case AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1: + case AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_2: + case AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_3: + freq = m_anRandomTable[4] % 2000 + 10025; + bChannelOpen = bChannelOpen == 0; + break; + default: freq = SampleManager.GetSampleBaseFrequency(sample); break; + } + PoliceChannelFreq = freq; + SampleManager.SetChannelFrequency(policeChannel, freq); + SampleManager.SetChannelVolume(policeChannel, 100); + SampleManager.SetChannelPan(policeChannel, 63); + SampleManager.SetChannelLoopCount(policeChannel, 1); + SampleManager.SetChannelLoopPoints(policeChannel, 0, -1); + SampleManager.StartChannel(policeChannel); + } + if(processed) ResetPoliceRadio(); + } + } + } +} + +void +cAudioManager::ServiceSoundEffects() +{ + uint32 timeOfRecentCrime; + cAudioScriptObject *object; + + timeOfRecentCrime = m_nTimeOfRecentCrime; + ++m_nTimeOfRecentCrime; + if(timeOfRecentCrime % 5) + field_2 = 0; + else + field_2 = 1; + if(m_bUserPause && !m_bPreviousUserPause) { + for(int32 i = 0; i < 29; i++) SampleManager.StopChannel(i); + + ClearRequestedQueue(); + if(m_bActiveSampleQueue) { + m_bActiveSampleQueue = 0; + ClearRequestedQueue(); + m_bActiveSampleQueue = 1; + } else { + m_bActiveSampleQueue = 1; + ClearRequestedQueue(); + m_bActiveSampleQueue = 0; + } + ClearActiveSamples(); + } + m_bActiveSampleQueue = m_bActiveSampleQueue != 1; + ProcessReverb(); + ProcessSpecial(); + ClearRequestedQueue(); + InterrogateAudioEntities(); + m_sPedComments.Process(); + ServicePoliceRadio(); + ServiceCollisions(); + AddReleasingSounds(); + ProcessMissionAudio(); + AdjustSamplesVolume(); + ProcessActiveQueues(); + for(int32 i = 0; i < m_nScriptObjectEntityTotal; ++i) { + object = (cAudioScriptObject *)m_asAudioEntities[m_anScriptObjectEntityIndices[i]].m_pEntity; + if(object) { delete object; } + DestroyEntity(m_anScriptObjectEntityIndices[i]); + } + m_nScriptObjectEntityTotal = 0; +} + +int8 +cAudioManager::SetCurrent3DProvider(uint8 which) +{ + if(!m_bIsInitialised) return -1; + for(uint8 i = 0; i < m_bActiveSamples + 1; ++i) SampleManager.StopChannel(i); + ClearRequestedQueue(); + if(m_bActiveSampleQueue) + m_bActiveSampleQueue = 0; + else + m_bActiveSampleQueue = 1; + ClearRequestedQueue(); + ClearActiveSamples(); + int8 current = SampleManager.SetCurrent3DProvider(which); + if(current > 0) { + m_bActiveSamples = SampleManager.GetMaximumSupportedChannels(); + if(m_bActiveSamples > 1) --m_bActiveSamples; + } + return current; +} void cAudioManager::SetDynamicAcousticModelingStatus(bool status) @@ -7884,9 +8211,50 @@ cAudioManager::SetEffectsMasterVolume(uint8 volume) const void cAudioManager::SetEntityStatus(int32 id, bool status) { - if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots) { - if(m_asAudioEntities[id].m_bIsUsed) { m_asAudioEntities[id].m_bStatus = status; } + if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed) { + m_asAudioEntities[id].m_bStatus = status; + } +} + +uint32 +cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision) +{ + uint8 surface1 = audioCollision->m_bSurface1; + uint8 surface2 = audioCollision->m_bSurface2; + int32 vol; + float ratio; + + if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE || + surface2 == SURFACE_HEDGE) { + ratio = GetCollisionRatio(audioCollision->m_fIntensity2, 0.0001f, 0.09f, 0.0899f); + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_LOOPING_GRASS; + m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000; + vol = 50.f * ratio; + } else { + if(surface1 == SURFACE_PUDDLE || surface2 == SURFACE_PUDDLE) { + ratio = GetCollisionRatio(audioCollision->m_fIntensity2, 0.0001f, 0.09f, 0.0899f); + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_LOOPING_WATER; + m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000; + vol = 30.f * ratio; + + } else { + if(surface1 == SURFACE_DIRT || surface2 == SURFACE_DIRT || surface1 == SURFACE_DIRTTRACK || + surface2 == SURFACE_DIRTTRACK || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) { + ratio = GetCollisionRatio(audioCollision->m_fIntensity2, 0.0001f, 0.09f, 0.0899f); + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_LOOPING_SOFT; + m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000; + vol = 50.f * ratio; + } else { + if(surface1 == SURFACE_FLESH || surface2 == SURFACE_FLESH) { return 0; } + ratio = GetCollisionRatio(audioCollision->m_fIntensity2, 0.0001f, 0.09f, 0.0899f); + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_LOOPING_GENERIC; + m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000; + vol = 40.f * ratio; + } + } } + if(audioCollision->m_nBaseVolume < 2) vol = audioCollision->m_nBaseVolume * vol / 2; + return vol; } void @@ -7894,9 +8262,7 @@ cAudioManager::SetMissionAudioLocation(float x, float y, float z) { if(m_bIsInitialised) { m_sMissionAudio.field_12 = 0; - m_sMissionAudio.m_vecPos.x = x; - m_sMissionAudio.m_vecPos.y = y; - m_sMissionAudio.m_vecPos.z = z; + m_sMissionAudio.m_vecPos = {x, y, z}; } } @@ -7929,17 +8295,362 @@ cAudioManager::SetSpeakerConfig(int32 conf) const SampleManager.SetSpeakerConfig(conf); } +void +cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter) +{ + if(col->m_fIntensity2 > 0.0016f) { + uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col); + if(emittingVol) { + m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 60.f, m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_counter = counter; + m_sQueueSample.m_vecPos = col->m_vecPosition; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.field_16 = 7; + m_sQueueSample.m_nLoopCount = 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.field_48 = 4.0f; + m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_76 = 5; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + } + } +} + +void +cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col) +{ + static constexpr int32 gOneShotCol[] = { + AUDIO_SAMPLE_COLLISION_PAVEMENT, AUDIO_SAMPLE_COLLISION_PAVEMENT, AUDIO_SAMPLE_COLLISION_MUFFLED, + AUDIO_SAMPLE_COLLISION_DIRT, AUDIO_SAMPLE_COLLISION_MUD, AUDIO_SAMPLE_COLLISION_PAVEMENT, + AUDIO_SAMPLE_COLLISION_METAL, AUDIO_SAMPLE_COLLISION_MUFFLED, AUDIO_SAMPLE_COLLISION_HARD, + AUDIO_SAMPLE_COLLISION_METAL_DOOR, AUDIO_SAMPLE_CAR_DOOR_MOVEMENT_1, AUDIO_SAMPLE_COLLISION_METAL_11, + AUDIO_SAMPLE_COLLISION_HARD, AUDIO_SAMPLE_COLLISION_METAL_13, AUDIO_SAMPLE_COLLISION_METAL_14, + AUDIO_SAMPLE_COLLISION_METAL_14, AUDIO_SAMPLE_COLLISION_FENCE, AUDIO_SAMPLE_COLLISION_FLESH, + AUDIO_SAMPLE_COLLISION_SAND, AUDIO_SAMPLE_COLLISION_WATER, AUDIO_SAMPLE_COLLISION_WOOD, + AUDIO_SAMPLE_COLLISION_WOOD_BOX, AUDIO_SAMPLE_COLLISION_WOOD_PLANK, AUDIO_SAMPLE_COLLISION_MUFFLED, + AUDIO_SAMPLE_COLLISION_MUFFLED, AUDIO_SAMPLE_COLLISION_HEDGE, AUDIO_SAMPLE_COLLISION_PAVEMENT, + AUDIO_SAMPLE_COLLISION_METAL_27, AUDIO_SAMPLE_COLLISION_METAL_28, AUDIO_SAMPLE_COLLISION_RUBBER, + AUDIO_SAMPLE_COLLISION_LOOSE, AUDIO_SAMPLE_COLLISION_PAVEMENT, AUDIO_SAMPLE_COLLISION_GATE}; + + int16 s1; + int16 s2; + + int32 emittingVol; + float ratio; + + static uint16 counter = 28; + + for(int32 i = 0; i < 2; i++) { + if(i) { + s1 = col->m_bSurface2; + s2 = col->m_bSurface1; + } else { + s1 = col->m_bSurface1; + s2 = col->m_bSurface2; + } + ratio = GetCollisionOneShotRatio(s1, col->m_fIntensity1); + if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio = 0.25f * ratio; + if(s1 == SURFACE_METAL6 && ratio < 0.6f) { + s1 = SURFACE_BILLBOARD; + ratio = min(1.f, 2.f * ratio); + } + emittingVol = 40.f * ratio; + if(emittingVol) { + m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 60.f, m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_nSampleIndex = gOneShotCol[s1]; + switch(m_sQueueSample.m_nSampleIndex) { + case AUDIO_SAMPLE_COLLISION_PAVEMENT: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[3] % 5; + break; + case AUDIO_SAMPLE_CAR_DOOR_MOVEMENT_1: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[0] % 6; + break; + case AUDIO_SAMPLE_COLLISION_METAL_13: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[1] & 1; + break; + case AUDIO_SAMPLE_COLLISION_FENCE: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[3] & 3; + break; + case AUDIO_SAMPLE_COLLISION_FLESH: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[4] % 5; + break; + case AUDIO_SAMPLE_COLLISION_WOOD: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[4] & 3; + break; + case AUDIO_SAMPLE_COLLISION_WOOD_BOX: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[1] & 3; + break; + case AUDIO_SAMPLE_COLLISION_HEDGE: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[2] % 5; + break; + case AUDIO_SAMPLE_COLLISION_METAL_28: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[2] % 3; + break; + case AUDIO_SAMPLE_COLLISION_METAL: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[1] % 5; + break; + case AUDIO_SAMPLE_COLLISION_LOOSE: + m_sQueueSample.m_nSampleIndex += m_anRandomTable[3] & 1; + break; + default: break; + } + switch(s1) { + case SURFACE_GLASS: m_sQueueSample.m_nFrequency = 13500; break; + case SURFACE_METAL15: m_sQueueSample.m_nFrequency = 8819; break; + case SURFACE_PUDDLE: + m_sQueueSample.m_nFrequency = + 2 * SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + break; + case SURFACE_TIRE: m_sQueueSample.m_nFrequency = 6000; break; + case SURFACE_HARD24: m_sQueueSample.m_nFrequency = 8000; break; + default: + m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + break; + } + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_counter = counter++; + if(counter >= 255) counter = 28; + m_sQueueSample.m_vecPos = col->m_vecPosition; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.field_16 = 11; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.field_48 = 4.0; + m_sQueueSample.m_fSoundIntensity = 60.0; + m_sQueueSample.field_56 = 1; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + } + } +} + +bool +cAudioManager::SetupCrimeReport() +{ + int16 audioZoneId; + CZone *zone; + int j; + float rangeX; + float rangeY; + float halfX; + float halfY; + float quarterX; + float quarterY; + int i; + int32 sampleIndex; + bool processed = false; + + if(MusicManager.m_nMusicMode == 2) return 0; + + if(60 - policeChannelTimer <= 9) { + AgeCrimes(); + return 1; + } + + for(i = 0; i < 10; i++) { + if(crimes[i].type) break; + } + + if(i == 10) return 0; + audioZoneId = CTheZones::FindAudioZone(&crimes[i].position); + if(audioZoneId >= 0 && audioZoneId < 36) { + j = 0; + zone = &CTheZones::ZoneArray[CTheZones::AudioZoneArray[audioZoneId]]; + while(strcmp(zone->name, ZoneSfx[j].m_aName) != 0) { + ++j; + if(j >= 36) { + crimes[i].type = 0; + AgeCrimes(); + return 1; + } + } + sampleIndex = ZoneSfx[j].m_nSampleIndex; + + if(j < 36) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[4] % 3 + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[0] % 3 + AUDIO_SAMPLE_POLICE_SCANNER_WE_GOT_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + (m_anRandomTable[1] & 1) + AUDIO_SAMPLE_POLICE_SCANNER_TEN_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + switch(crimes[i].type) { + case CRIME_PED_BURNED: crimes[i].type = 2; break; + case CRIME_COP_BURNED: crimes[i].type = 3; break; + case CRIME_VEHICLE_BURNED: crimes[i].type = 6; break; + case CRIME_DESTROYED_CESSNA: crimes[i].type = 12; break; + default: break; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + crimes[i].type + AUDIO_SAMPLE_POLICE_SCANNER_TEN_2; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = AUDIO_SAMPLE_POLICE_SCANNER_IN; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(sampleIndex == AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE && + (strcmp(zone->name, SubZo2Label) == 0 || strcmp(zone->name, SubZo3Label) == 0)) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = AUDIO_SAMPLE_POLICE_SCANNER_NORTH; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer == 60) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = sampleIndex; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[2] % 3 + + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = TOTAL_AUDIO_SAMPLES; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + crimes[i].type = 0; + AgeCrimes(); + return 1; + } + crimesSamples[policeChannelTimerSeconds] = AUDIO_SAMPLE_POLICE_SCANNER_EAST; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + rangeX = zone->maxx - zone->minx; + rangeY = zone->maxy - zone->miny; + halfX = 0.5f * rangeX + zone->minx; + halfY = 0.5f * rangeY + zone->miny; + quarterX = 0.25f * rangeX; + quarterY = 0.25f * rangeY; + if(halfY + quarterY < crimes[i].position.y) { + if(halfY - quarterY > crimes[i].position.y) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_SOUTH; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + processed = 1; + } + } else if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = AUDIO_SAMPLE_POLICE_SCANNER_NORTH; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + processed = 1; + } + + if(halfX + quarterX < crimes[i].position.x) { + if(halfX - quarterX <= crimes[i].position.x) { + if(processed || policeChannelTimer == 60) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = sampleIndex; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[2] % 3 + + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = TOTAL_AUDIO_SAMPLES; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + crimes[i].type = 0; + AgeCrimes(); + return 1; + } + crimesSamples[policeChannelTimerSeconds] = AUDIO_SAMPLE_POLICE_SCANNER_CENTRAL; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = AUDIO_SAMPLE_POLICE_SCANNER_WEST; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + } else if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = AUDIO_SAMPLE_POLICE_SCANNER_EAST; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = sampleIndex; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[2] % 3 + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = TOTAL_AUDIO_SAMPLES; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + } + } + crimes[i].type = 0; + AgeCrimes(); + return 1; +} + WRAPPER bool cAudioManager::SetupJumboEngineSound(uint8, int32) { EAXJMP(0x56F140); } bool cAudioManager::SetupJumboFlySound(uint8 emittingVol) { - int32 vol; - if(m_sQueueSample.m_fDistance >= 440.0f) return 0; - vol = ComputeVolume(emittingVol, 440.0f, m_sQueueSample.m_fDistance); + int32 vol = ComputeVolume(emittingVol, 440.0f, m_sQueueSample.m_fDistance); m_sQueueSample.m_bVolume = vol; if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_FLY_SOUND; @@ -7949,17 +8660,14 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) m_sQueueSample.field_16 = 1; m_sQueueSample.m_bEmittingVolume = emittingVol; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_FLY_SOUND); - m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_FLY_SOUND); + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSoundIntensity = 440.0f; m_sQueueSample.field_56 = 0; m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_bReverbFlag = 1; m_sQueueSample.field_76 = 5; - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); AddSampleToRequestedQueue(); } return 1; @@ -7978,14 +8686,11 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_bBankIndex = 0; m_sQueueSample.m_bIsDistant = 1; m_sQueueSample.field_16 = 1; - m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND); + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND); m_sQueueSample.m_nLoopCount = 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_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_fSoundIntensity = 240.0f; m_sQueueSample.field_56 = 0; @@ -8006,14 +8711,11 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) bool cAudioManager::SetupJumboTaxiSound(uint8 vol) { - uint8 emittingVol; - if(m_sQueueSample.m_fDistance >= 180.f) return 0; - emittingVol = (vol >> 1) + ((vol >> 1) * m_sQueueSample.m_fDistance * 0.0055556f); + uint8 emittingVol = (vol >> 1) + ((vol >> 1) * m_sQueueSample.m_fDistance / 180); - if(m_sQueueSample.m_fDistance * 0.0055556f < 0.7f) - emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100; + if(m_sQueueSample.m_fDistance / 180 < 0.7f) emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100; m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { @@ -8025,10 +8727,8 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) m_sQueueSample.m_nFrequency = GetJumboTaxiFreq(); m_sQueueSample.m_nLoopCount = 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_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_fSoundIntensity = 180.0f; m_sQueueSample.field_56 = 0; @@ -8056,10 +8756,8 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 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_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_fSoundIntensity = 170.0f; m_sQueueSample.field_56 = 0; @@ -8082,15 +8780,9 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) if(ped) { switch(sound) { - case SOUND_AMMUNATION_WELCOME_1: - pedComment.m_nSampleIndex = AUDIO_SAMPLE_AMMUNATION_WELCOME_1; - break; - case SOUND_AMMUNATION_WELCOME_2: - pedComment.m_nSampleIndex = AUDIO_SAMPLE_AMMUNATION_WELCOME_2; - break; - case SOUND_AMMUNATION_WELCOME_3: - pedComment.m_nSampleIndex = AUDIO_SAMPLE_AMMUNATION_WELCOME_3; - break; + case SOUND_AMMUNATION_WELCOME_1: pedComment.m_nSampleIndex = AUDIO_SAMPLE_AMMUNATION_WELCOME_1; break; + case SOUND_AMMUNATION_WELCOME_2: pedComment.m_nSampleIndex = AUDIO_SAMPLE_AMMUNATION_WELCOME_2; break; + case SOUND_AMMUNATION_WELCOME_3: pedComment.m_nSampleIndex = AUDIO_SAMPLE_AMMUNATION_WELCOME_3; break; default: pedComment.m_nSampleIndex = GetPedCommentSfx(ped, sound); if(pedComment.m_nSampleIndex == NO_SAMPLE) return; @@ -8108,17 +8800,17 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) case SOUND_AMMUNATION_WELCOME_2: case SOUND_AMMUNATION_WELCOME_3: emittingVol = maxVolume; break; default: - if(CWorld::GetIsLineOfSightClear( - TheCamera.GetGameCamPosition(), - m_sQueueSample.m_vecPos, 1, 0, 0, 0, 0, 0, 0)) { + if(CWorld::GetIsLineOfSightClear(TheCamera.GetGameCamPosition(), + m_sQueueSample.m_vecPos, 1, 0, 0, 0, 0, 0, + 0)) { emittingVol = maxVolume; } else { emittingVol = 31; } break; } - m_sQueueSample.m_bVolume = ComputeVolume( - emittingVol, soundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance); pedComment.field_25 = 10; if(m_sQueueSample.m_bVolume) { pedComment.m_entityIndex = m_sQueueSample.m_nEntityIndex; @@ -8134,9 +8826,8 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) case SOUND_PED_HELI_PLAYER_FOUND: maxDist = 160000.f; soundIntensity = 400.f; - pedComment.m_nSampleIndex = - m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 29u + - AUDIO_SAMPLE_POLICE_HELI_FOUND_PLAYER_1; + pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 29 + + AUDIO_SAMPLE_POLICE_HELI_FOUND_PLAYER_1; break; case SOUND_PED_BODYCAST_HIT: if(CTimer::GetTimeInMilliseconds() <= audioLogicTimers[8]) return; @@ -8144,23 +8835,20 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) soundIntensity = 50.f; audioLogicTimers[8] = CTimer::GetTimeInMilliseconds() + 500; pedComment.m_nSampleIndex = - (m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] & 3) + - AUDIO_SAMPLE_PED_BODYCAST_HIT_1; + (m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] & 3) + AUDIO_SAMPLE_PED_BODYCAST_HIT_1; break; case SOUND_INJURED_PED_MALE_OUCH: case SOUND_8A: maxDist = 2500.f; soundIntensity = 50.f; - pedComment.m_nSampleIndex = - m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 15u + - AUDIO_SAMPLE_INJURED_PED_MALE_OUCH_1; + pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 15 + + AUDIO_SAMPLE_INJURED_PED_MALE_OUCH_1; break; case SOUND_INJURED_PED_FEMALE: maxDist = 2500.f; soundIntensity = 50.f; - pedComment.m_nSampleIndex = - m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 11u + - AUDIO_SAMPLE_INJURED_PED_FEMALE_OUCH_1; + pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 11 + + AUDIO_SAMPLE_INJURED_PED_FEMALE_OUCH_1; break; default: return; } @@ -8173,17 +8861,17 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) case SOUND_AMMUNATION_WELCOME_2: case SOUND_AMMUNATION_WELCOME_3: emittingVol = maxVolume; break; default: - if(CWorld::GetIsLineOfSightClear( - TheCamera.GetGameCamPosition(), - m_sQueueSample.m_vecPos, 1, 0, 0, 0, 0, 0, 0)) { + if(CWorld::GetIsLineOfSightClear(TheCamera.GetGameCamPosition(), + m_sQueueSample.m_vecPos, 1, 0, 0, 0, 0, 0, + 0)) { emittingVol = maxVolume; } else { emittingVol = 31; } break; } - m_sQueueSample.m_bVolume = ComputeVolume( - emittingVol, soundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance); pedComment.field_25 = 10; if(m_sQueueSample.m_bVolume) { pedComment.m_entityIndex = m_sQueueSample.m_nEntityIndex; @@ -8198,6 +8886,203 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) } void +cAudioManager::SetupSuspectLastSeenReport() +{ + CAutomobile *automobile; + uint8 color1; + int32 index; + int32 main_color; + int32 sample; + + int32 color_pre_modifier; + int32 color_post_modifier; + + constexpr int32 colors[] = { + 3032, 248, 3032, 3032, 249, 3032, 3032, 250, 3032, 3032, 251, 3032, 258, 250, 3032, 3032, 252, 3032, + 3032, 253, 3032, 260, 250, 3032, 259, 250, 254, 259, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, + 258, 251, 3032, 3032, 251, 3032, 3032, 251, 3032, 3032, 251, 3032, 3032, 251, 3032, 3032, 251, 3032, + 3032, 251, 3032, 259, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, 3032, 255, 3032, + 3032, 255, 3032, 3032, 255, 3032, 3032, 255, 3032, 3032, 255, 3032, 3032, 255, 3032, 259, 3032, 3032, + 258, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, 3032, 253, 3032, 3032, 253, 3032, 3032, 253, 3032, + 3032, 253, 3032, 3032, 253, 3032, 3032, 253, 3032, 259, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, + 258, 3032, 3032, 3032, 256, 3032, 3032, 256, 3032, 3032, 256, 3032, 3032, 256, 3032, 3032, 256, 3032, + 3032, 256, 3032, 259, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, 3032, 250, 3032, + 3032, 250, 3032, 3032, 250, 3032, 3032, 250, 3032, 3032, 250, 3032, 3032, 250, 3032, 259, 3032, 3032, + 258, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, 3032, 252, 3032, 3032, 252, 3032, 3032, 252, 3032, + 3032, 252, 3032, 3032, 252, 3032, 3032, 252, 3032, 259, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, + 258, 3032, 3032, 3032, 257, 3032, 3032, 257, 3032, 3032, 257, 3032, 3032, 257, 3032, 3032, 257, 3032, + 3032, 257, 3032, 259, 3032, 3032, 259, 3032, 3032, 259, 3032, 3032, 259, 3032, 3032, 259, 3032, 3032, + 259, 3032, 3032, 259, 3032, 3032, 259, 3032, 3032, 259, 3032, 3032, 259, 3032, 3032, 259, 3032, 3032, + 258, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032, 258, 3032, 3032}; + + if(MusicManager.m_nMusicMode != 2) { + automobile = (CAutomobile *)FindPlayerVehicle(); + if(automobile) { + if(60 - policeChannelTimer > 9) { + color1 = automobile->m_currentColour1; + if(color1 >= 95) { + debug("\n *** UNKNOWN CAR COLOUR %d *** ", color1); + } else { + index = 3 * color1; + main_color = colors[index + 1]; // todo refactor struct + color_pre_modifier = colors[index]; + color_post_modifier = colors[index + 2]; + switch(automobile->m_modelIndex) { + case MI_LANDSTAL: + case MI_BLISTA: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_CRUISER; break; + case MI_IDAHO: + case MI_STALLION: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_CONVERTIBLE; break; + case MI_STINGER: + case MI_INFERNUS: + case MI_CHEETAH: + case MI_BANSHEE: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_SPORTS_CAR; break; + case MI_PEREN: + case MI_SENTINEL: + case MI_FBICAR: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_ECONOMY; break; + case MI_PATRIOT: + case MI_BOBCAT: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_PICKUP; break; + case MI_FIRETRUCK: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_FIRETRUCK; break; + case MI_TRASH: + case MI_BARRACKS: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_TRUCK; break; + case MI_STRETCH: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_LIMO; break; + case MI_MANANA: + case MI_ESPERANT: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_COUPE; break; + case MI_PONY: + case MI_MULE: + case MI_MOONBEAM: + case MI_ENFORCER: + case MI_SECURICA: + case MI_RUMPO: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_VAN; break; + case MI_AMBULAN: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_AMBULANCE; break; + case MI_TAXI: + case MI_CABBIE: + case MI_BORGNINE: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_TAXI; break; + case MI_MRWHOOP: + sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_ICE_CREAM_TRUCK; + break; + case MI_BFINJECT: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_BUGGY; break; + case MI_POLICE: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_POLICE_CAR; break; + case MI_PREDATOR: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_BOAT; break; + case MI_BUS: + case MI_COACH: sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_BUS; break; + case MI_RHINO: + sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_TANK; + main_color = TOTAL_AUDIO_SAMPLES; + color_post_modifier = TOTAL_AUDIO_SAMPLES; + break; + case MI_TRAIN: + sample = AUDIO_SAMPLE_POLICE_SCANNER_CAR_SUBWAY_CAR; + main_color = TOTAL_AUDIO_SAMPLES; + color_post_modifier = TOTAL_AUDIO_SAMPLES; + + break; + default: + debug("\n *** UNKNOWN CAR MODEL INDEX %d *** ", + automobile->m_modelIndex); + return; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[4] % 3 + + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_SUSPECT; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(m_anRandomTable[3] & 1 && policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_LAST_SEEN; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(main_color == AUDIO_SAMPLE_POLICE_SCANNER_COLOR_ORANGE) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_IN_AN; + ++policeChannelTimer; + policeChannelTimerSeconds = + (policeChannelTimerSeconds + 1) % 60; + } + } else if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + AUDIO_SAMPLE_POLICE_SCANNER_IN_A; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(color_pre_modifier != 3032 && policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = color_pre_modifier; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(main_color != 3032 && policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = main_color; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(color_post_modifier != 3032 && policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = color_post_modifier; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = sample; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[0] % 3 + + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = TOTAL_AUDIO_SAMPLES; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + } + } + } else { + if(60 - policeChannelTimer > 4) { + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[4] % 3 + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = AUDIO_SAMPLE_POLICE_SCANNER_SUSPECT; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = AUDIO_SAMPLE_POLICE_SCANNER_ON_FOOT; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = + m_anRandomTable[0] % 3 + AUDIO_SAMPLE_POLICE_SCANNER_SMALL_CRACKLE_1; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + if(policeChannelTimer != 60) { + crimesSamples[policeChannelTimerSeconds] = TOTAL_AUDIO_SAMPLES; + ++policeChannelTimer; + policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60; + } + } + } + } +} + +void cAudioManager::Terminate() { if(m_bIsInitialised) { @@ -8256,11 +9141,17 @@ cAudioManager::UpdateGasPedalAudio(CAutomobile *automobile) automobile->m_fGasPedalAudio = newGasPedalAudio; } +WRAPPER +void +cAudioManager::UpdateReflections() +{ + EAXJMP(0x57B470); +} + bool cAudioManager::UsesReverseWarning(int32 model) const { - return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || - model == COACH; + return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH; } bool @@ -8289,18 +9180,42 @@ cAudioManager::UsesSirenSwitching(int32 model) const } } +void +cAudioManager::AdjustSamplesVolume() +{ + for(int i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; i++) { + tActiveSample* pSample = &m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i] + 1]; + + if(!pSample->m_bBankIndex) // all non-speech sounds on PC + pSample->m_bEmittingVolume = ComputeEmittingVolume( + pSample->m_bEmittingVolume, pSample->m_fSoundIntensity, pSample->m_fDistance); + } +} + +int32 +cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist) +{ + float quatIntensity = intensity / 4.0f; + float diffIntensity = intensity - quatIntensity; + if(dist > diffIntensity) + return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity; + return emittingVolume; +} + STARTPATCHES InjectHook(0x57B210, &cAudioManager::AddDetailsToRequestedOrderList, PATCH_JUMP); InjectHook(0x56AD30, &cAudioManager::AddPlayerCarSample, PATCH_JUMP); InjectHook(0x57B300, &cAudioManager::AddReflectionsToRequestedQueue, PATCH_JUMP); -// InjectHook(0x57B8D0, &cAudioManager::AddReleasingSounds, PATCH_JUMP); +InjectHook(0x57B8D0, &cAudioManager::AddReleasingSounds, PATCH_JUMP); InjectHook(0x57B070, &cAudioManager::AddSampleToRequestedQueue, PATCH_JUMP); -// InjectHook(0x580AF0, &cAudioManager::AgeCrimes, PATCH_JUMP); +InjectHook(0x580AF0, &cAudioManager::AgeCrimes, PATCH_JUMP); InjectHook(0x5697A0, &cAudioManager::CalculateDistance, PATCH_JUMP); InjectHook(0x57AA10, &cAudioManager::CheckForAnAudioFileOnCD, PATCH_JUMP); +InjectHook(0x57C160, &cAudioManager::ClearActiveSamples, PATCH_JUMP); InjectHook(0x5796A0, &cAudioManager::ClearMissionAudio, PATCH_JUMP); InjectHook(0x57C120, &cAudioManager::ClearRequestedQueue, PATCH_JUMP); InjectHook(0x57AE00, &cAudioManager::ComputeDopplerEffectedFrequency, PATCH_JUMP); +InjectHook(0x57AD20, &cAudioManager::ComputePan, PATCH_JUMP); InjectHook(0x57ABB0, &cAudioManager::ComputeVolume, PATCH_JUMP); InjectHook(0x57A310, &cAudioManager::CreateEntity, PATCH_JUMP); InjectHook(0x57A830, &cAudioManager::DestroyAllGameCreatedEntities, PATCH_JUMP); @@ -8366,6 +9281,8 @@ InjectHook(0x57A8A0, &cAudioManager::GetNum3DProvidersAvailable, PATCH_JUMP); InjectHook(0x574FD0, &cAudioManager::GetOJGTalkSfx, PATCH_JUMP); InjectHook(0x570960, &cAudioManager::GetPedCommentSfx, PATCH_JUMP); InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP); +InjectHook(0x56BF80, &cAudioManager::GetVehicleDriveWheelSkidValue, PATCH_JUMP); +InjectHook(0x56C120, &cAudioManager::GetVehicleNonDriveWheelSkidValue, PATCH_JUMP); InjectHook(0x575240, &cAudioManager::GetPimpTalkSfx, PATCH_JUMP); InjectHook(0x570E00, &cAudioManager::GetPlayerTalkSfx, PATCH_JUMP); InjectHook(0x5737E0, &cAudioManager::GetScumFemaleTalkSfx, PATCH_JUMP); @@ -8395,7 +9312,8 @@ InjectHook(0x5718D0, &cAudioManager::GetYakuzaTalkSfx, PATCH_JUMP); InjectHook(0x5719E0, &cAudioManager::GetYardieTalkSfx, PATCH_JUMP); InjectHook(0x56CAB0, &cAudioManager::HasAirBrakes, PATCH_JUMP); InjectHook(0x57A0E0, &cAudioManager::Initialise, PATCH_JUMP); -// InjectHook(0x57EAC0, &cAudioManager::InitialisePoliceRadioZones, PATCH_JUMP); +InjectHook(0x57EEC0, &cAudioManager::InitialisePoliceRadio, PATCH_JUMP); +InjectHook(0x57EAC0, &cAudioManager::InitialisePoliceRadioZones, PATCH_JUMP); InjectHook(0x57B030, &cAudioManager::InterrogateAudioEntities, PATCH_JUMP); InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP); InjectHook(0x579650, &cAudioManager::IsMissionAudioSampleFinished, PATCH_JUMP); @@ -8404,6 +9322,8 @@ InjectHook(0x579520, &cAudioManager::MissionScriptAudioUsesPoliceChannel, PATCH_ InjectHook(0x56AD10, &cAudioManager::PlayerJustGotInCar, PATCH_JUMP); InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP); InjectHook(0x579620, &cAudioManager::PlayLoadedMissionAudio, PATCH_JUMP); +InjectHook(0x57A500, &cAudioManager::PlayOneShot, PATCH_JUMP); +InjectHook(0x580500, &cAudioManager::PlaySuspectLastSeen, PATCH_JUMP); InjectHook(0x569420, &cAudioManager::PostInitialiseGameSpecificSetup, PATCH_JUMP); InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP); InjectHook(0x569400, &cAudioManager::PreInitialiseGameSpecificSetup, PATCH_JUMP); @@ -8445,7 +9365,9 @@ InjectHook(0x56F4D0, &cAudioManager::ProcessPedHeadphones, PATCH_JUMP); InjectHook(0x5699C0, &cAudioManager::ProcessPhysical, PATCH_JUMP); InjectHook(0x56E860, &cAudioManager::ProcessPlane, PATCH_JUMP); InjectHook(0x56B0D0, &cAudioManager::ProcessPlayersVehicleEngine, PATCH_JUMP); +InjectHook(0x578190, &cAudioManager::ProcessPoliceCellBeatingScriptObject, PATCH_JUMP); InjectHook(0x577280, &cAudioManager::ProcessPornCinema, PATCH_JUMP); +InjectHook(0x578A80, &cAudioManager::ProcessProjectiles, PATCH_JUMP); InjectHook(0x569CC0, &cAudioManager::ProcessRainOnVehicle, PATCH_JUMP); InjectHook(0x569700, &cAudioManager::ProcessReverb, PATCH_JUMP); InjectHook(0x569E50, &cAudioManager::ProcessReverseGear, PATCH_JUMP); @@ -8454,37 +9376,60 @@ InjectHook(0x576070, &cAudioManager::ProcessScriptObject, PATCH_JUMP); InjectHook(0x577970, &cAudioManager::ProcessShopScriptObject, PATCH_JUMP); InjectHook(0x5697D0, &cAudioManager::ProcessSpecial, PATCH_JUMP); InjectHook(0x56DBF0, &cAudioManager::ProcessTrainNoise, PATCH_JUMP); +InjectHook(0x569A00, &cAudioManager::ProcessVehicle, PATCH_JUMP); InjectHook(0x56C770, &cAudioManager::ProcessVehicleDoors, PATCH_JUMP); +InjectHook(0x56C200, &cAudioManager::ProcessVehicleHorn, PATCH_JUMP); InjectHook(0x56C640, &cAudioManager::ProcessVehicleReverseWarning, PATCH_JUMP); InjectHook(0x56A230, &cAudioManager::ProcessVehicleRoadNoise, PATCH_JUMP); +InjectHook(0x56BCB0, &cAudioManager::ProcessVehicleSkidding, PATCH_JUMP); +InjectHook(0x575F30, &cAudioManager::ProcessWaterCannon, PATCH_JUMP); InjectHook(0x578370, &cAudioManager::ProcessWeather, PATCH_JUMP); InjectHook(0x56A440, &cAudioManager::ProcessWetRoadNoise, PATCH_JUMP); InjectHook(0x577530, &cAudioManager::ProcessWorkShopScriptObject, PATCH_JUMP); InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP); InjectHook(0x57A9F0, &cAudioManager::ReacquireDigitalHandle, PATCH_JUMP); InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP); +InjectHook(0x568410, &cAudioManager::ReportCollision, PATCH_JUMP); +InjectHook(0x5803D0, &cAudioManager::ReportCrime, PATCH_JUMP); InjectHook(0x569650, &cAudioManager::ResetAudioLogicTimers, PATCH_JUMP); InjectHook(0x57EFF0, &cAudioManager::ResetPoliceRadio, PATCH_JUMP); +InjectHook(0x57A7B0, &cAudioManager::ResetTimers, PATCH_JUMP); +InjectHook(0x57A2A0, &cAudioManager::Service, PATCH_JUMP); +InjectHook(0x57F110, &cAudioManager::ServicePoliceRadio, PATCH_JUMP); +InjectHook(0x57F1B0, &cAudioManager::ServicePoliceRadioChannel, PATCH_JUMP); +InjectHook(0x57AA60, &cAudioManager::ServiceSoundEffects, PATCH_JUMP); +InjectHook(0x57A910, &cAudioManager::SetCurrent3DProvider, PATCH_JUMP); InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP); InjectHook(0x57A770, &cAudioManager::SetEffectsFadeVolume, PATCH_JUMP); InjectHook(0x57A730, &cAudioManager::SetEffectsMasterVolume, PATCH_JUMP); InjectHook(0x57A4C0, &cAudioManager::SetEntityStatus, PATCH_JUMP); +InjectHook(0x568E20, &cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol, PATCH_JUMP); InjectHook(0x5795F0, &cAudioManager::SetMissionAudioLocation, PATCH_JUMP); InjectHook(0x57F020, &cAudioManager::SetMissionScriptPoliceAudio, PATCH_JUMP); InjectHook(0x57A790, &cAudioManager::SetMusicFadeVolume, PATCH_JUMP); InjectHook(0x57A750, &cAudioManager::SetMusicMasterVolume, PATCH_JUMP); InjectHook(0x57A9A0, &cAudioManager::SetSpeakerConfig, PATCH_JUMP); +InjectHook(0x568D30, &cAudioManager::SetUpLoopingCollisionSound, PATCH_JUMP); +InjectHook(0x5689D0, &cAudioManager::SetUpOneShotCollisionSound, PATCH_JUMP); +InjectHook(0x57F5B0, &cAudioManager::SetupCrimeReport, PATCH_JUMP); InjectHook(0x56F230, &cAudioManager::SetupJumboFlySound, PATCH_JUMP); InjectHook(0x56F310, &cAudioManager::SetupJumboRumbleSound, PATCH_JUMP); InjectHook(0x56EF20, &cAudioManager::SetupJumboTaxiSound, PATCH_JUMP); InjectHook(0x56F070, &cAudioManager::SetupJumboWhineSound, PATCH_JUMP); InjectHook(0x570690, &cAudioManager::SetupPedComments, PATCH_JUMP); +InjectHook(0x57FCC0, &cAudioManager::SetupSuspectLastSeenReport, PATCH_JUMP); InjectHook(0x57A150, &cAudioManager::Terminate, PATCH_JUMP); InjectHook(0x57AC60, &cAudioManager::TranslateEntity, PATCH_JUMP); InjectHook(0x56AC80, &cAudioManager::UpdateGasPedalAudio, PATCH_JUMP); InjectHook(0x56C600, &cAudioManager::UsesReverseWarning, PATCH_JUMP); InjectHook(0x56C3C0, &cAudioManager::UsesSiren, PATCH_JUMP); InjectHook(0x56C3F0, &cAudioManager::UsesSirenSwitching, PATCH_JUMP); + +InjectHook(0x57C2B0, &cAudioManager::AdjustSamplesVolume, PATCH_JUMP); +InjectHook(0x57C320, &cAudioManager::ComputeEmittingVolume, PATCH_JUMP); + InjectHook(0x5755C0, &cPedComments::Add, PATCH_JUMP); InjectHook(0x575730, &cPedComments::Process, PATCH_JUMP); +InjectHook(0x5685E0, &cAudioCollisionManager::AddCollisionToRequestedQueue, PATCH_JUMP); +InjectHook(0x57C430, &cAudioScriptObject::Reset, PATCH_JUMP); ENDPATCHES diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index fb462e94..6ac6dda7 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -1,9 +1,136 @@ #pragma once -#include "AudioSamples.h" #include "DMAudio.h" #include "common.h" +enum eScriptSounds : int16 +{ + SCRIPT_SOUND_0 = 0, + SCRIPT_SOUND_1 = 1, + SCRIPT_SOUND_2 = 2, + SCRIPT_SOUND_3 = 3, + SCRIPT_SOUND_PARTY_1_LOOP_S = 4, + SCRIPT_SOUND_PARTY_1_LOOP_L = 5, + SCRIPT_SOUND_PARTY_2_LOOP_S = 6, + SCRIPT_SOUND_PARTY_2_LOOP_L = 7, + SCRIPT_SOUND_PARTY_3_LOOP_S = 8, + SCRIPT_SOUND_PARTY_3_LOOP_L = 9, + SCRIPT_SOUND_PARTY_4_LOOP_S = 10, + SCRIPT_SOUND_PARTY_4_LOOP_L = 11, + SCRIPT_SOUND_PARTY_5_LOOP_S = 12, + SCRIPT_SOUND_PARTY_5_LOOP_L = 13, + SCRIPT_SOUND_PARTY_6_LOOP_S = 14, + SCRIPT_SOUND_PARTY_6_LOOP_L = 15, + SCRIPT_SOUND_PARTY_7_LOOP_S = 16, + SCRIPT_SOUND_PARTY_7_LOOP_L = 17, + SCRIPT_SOUND_PARTY_8_LOOP_S = 18, + SCRIPT_SOUND_PARTY_8_LOOP_L = 19, + SCRIPT_SOUND_PARTY_9_LOOP_S = 20, + SCRIPT_SOUND_PARTY_9_LOOP_L = 21, + SCRIPT_SOUND_PARTY_10_LOOP_S = 22, + SCRIPT_SOUND_PARTY_10_LOOP_L = 23, + SCRIPT_SOUND_PARTY_11_LOOP_S = 24, + SCRIPT_SOUND_PARTY_11_LOOP_L = 25, + SCRIPT_SOUND_PARTY_12_LOOP_S = 26, + SCRIPT_SOUND_PARTY_12_LOOP_L = 27, + SCRIPT_SOUND_PARTY_13_LOOP_S = 28, + SCRIPT_SOUND_PARTY_13_LOOP_L = 29, + SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S = 30, + SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L = 31, + SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S = 32, + SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L = 33, + SCRIPT_SOUND_WORK_SHOP_LOOP_S = 34, + SCRIPT_SOUND_WORK_SHOP_LOOP_L = 35, + SCRIPT_SOUND_SAWMILL_LOOP_S = 36, + SCRIPT_SOUND_SAWMILL_LOOP_L = 37, + SCRIPT_SOUND_38 = 38, + SCRIPT_SOUND_39 = 39, + SCRIPT_SOUND_LAUNDERETTE_LOOP_S = 40, + SCRIPT_SOUND_LAUNDERETTE_LOOP_L = 41, + SCRIPT_SOUND_CHINATOWN_RESTAURANT_S = 42, + SCRIPT_SOUND_CHINATOWN_RESTAURANT_L = 43, + SCRIPT_SOUND_CIPRIANI_RESAURANT_S = 44, + SCRIPT_SOUND_CIPRIANI_RESAURANT_L = 45, + SCRIPT_SOUND_46 = 46, + SCRIPT_SOUND_47 = 47, + SCRIPT_SOUND_MARCO_BISTRO_S = 48, + SCRIPT_SOUND_MARCO_BISTRO_L = 49, + SCRIPT_SOUND_AIRPORT_LOOP_S = 50, + SCRIPT_SOUND_AIRPORT_LOOP_L = 51, + SCRIPT_SOUND_SHOP_LOOP_S = 52, + SCRIPT_SOUND_SHOP_LOOP_L = 53, + SCRIPT_SOUND_CINEMA_LOOP_S = 54, + SCRIPT_SOUND_CINEMA_LOOP_L = 55, + SCRIPT_SOUND_DOCKS_LOOP_S = 56, + SCRIPT_SOUND_DOCKS_LOOP_L = 57, + SCRIPT_SOUND_HOME_LOOP_S = 58, + SCRIPT_SOUND_HOME_LOOP_L = 59, + SCRIPT_SOUND_FRANKIE_PIANO = 60, + SCRIPT_SOUND_PARTY_1_LOOP = 61, + SCRIPT_SOUND_PORN_CINEMA_1_S = 62, + SCRIPT_SOUND_PORN_CINEMA_1_L = 63, + SCRIPT_SOUND_PORN_CINEMA_2_S = 64, + SCRIPT_SOUND_PORN_CINEMA_2_L = 65, + SCRIPT_SOUND_PORN_CINEMA_3_S = 66, + SCRIPT_SOUND_PORN_CINEMA_3_L = 67, + SCRIPT_SOUND_BANK_ALARM_LOOP_S = 68, + SCRIPT_SOUND_BANK_ALARM_LOOP_L = 69, + SCRIPT_SOUND_POLICE_BALL_LOOP_S = 70, + SCRIPT_SOUND_POLICE_BALL_LOOP_L = 71, + SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S = 72, + SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L = 73, + SCRIPT_SOUND_74 = 74, + SCRIPT_SOUND_75 = 75, + SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S = 76, + SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L = 77, + SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S = 78, + SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L = 79, + SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S = 80, + SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L = 81, + SCRIPT_SOUND_EVIDENCE_PICKUP = 82, + SCRIPT_SOUND_UNLOAD_GOLD = 83, + SCRIPT_SOUND_RAVE_1_LOOP_S = 84, + SCRIPT_SOUND_RAVE_1_LOOP_L = 85, + SCRIPT_SOUND_RAVE_2_LOOP_S = 86, + SCRIPT_SOUND_RAVE_2_LOOP_L = 87, + SCRIPT_SOUND_RAVE_3_LOOP_S = 88, + SCRIPT_SOUND_RAVE_3_LOOP_L = 89, + SCRIPT_SOUND_MISTY_SEX_S = 90, + SCRIPT_SOUND_MISTY_SEX_L = 91, + SCRIPT_SOUND_GATE_START_CLUNK = 92, + SCRIPT_SOUND_GATE_STOP_CLUNK = 93, + SCRIPT_SOUND_PART_MISSION_COMPLETE = 94, + SCRIPT_SOUND_CHUNKY_RUN_SHOUT = 95, + SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT = 96, + SCRIPT_SOUND_RACE_START_3 = 97, + SCRIPT_SOUND_RACE_START_2 = 98, + SCRIPT_SOUND_RACE_START_1 = 99, + SCRIPT_SOUND_RACE_START_GO = 100, + SCRIPT_SOUND_SWAT_PED_SHOUT = 101, + SCRIPT_SOUND_PRETEND_FIRE_LOOP = 102, + SCRIPT_SOUND_AMMUNATION_CHAT_1 = 103, + SCRIPT_SOUND_AMMUNATION_CHAT_2 = 104, + SCRIPT_SOUND_AMMUNATION_CHAT_3 = 105, + SCRIPT_SOUND_BULLET_HIT_GROUND_1 = 106, + SCRIPT_SOUND_BULLET_HIT_GROUND_2 = 107, + SCRIPT_SOUND_BULLET_HIT_GROUND_3 = 108, + SCRIPT_SOUND_109 = 109, + SCRIPT_SOUND_110 = 110, + SCRIPT_SOUND_111 = 111, + SCRIPT_SOUND_PAYPHONE_RINGING = 112, + SCRIPT_SOUND_113 = 113, + SCRIPT_SOUND_GLASS_BREAK_L = 114, + SCRIPT_SOUND_GLASS_BREAK_S = 115, + SCRIPT_SOUND_GLASS_CRACK = 116, + SCRIPT_SOUND_GLASS_LIGHT_BREAK = 117, + SCRIPT_SOUND_BOX_DESTROYED_1 = 118, + SCRIPT_SOUND_BOX_DESTROYED_2 = 119, + SCRIPT_SOUND_METAL_COLLISION = 120, + SCRIPT_SOUND_TIRE_COLLISION = 121, + SCRIPT_SOUND_GUNSHELL_DROP = 122, + SCRIPT_SOUND_GUNSHELL_DROP_SOFT = 123, +}; + class tActiveSample { public: @@ -45,7 +172,7 @@ public: uint8 field_82; uint8 field_83; int32 calculatedVolume; - uint8 field_88; + int8 field_88; uint8 field_89; uint8 field_90; uint8 field_91; @@ -55,7 +182,8 @@ public: static_assert(sizeof(tActiveSample) == 92, "tActiveSample: error"); -enum eAudioType : int32 { +enum eAudioType : int32 +{ AUDIOTYPE_PHYSICAL = 0, AUDIOTYPE_EXPLOSION = 1, AUDIOTYPE_FIRE = 2, @@ -158,7 +286,8 @@ public: uint8 gap_811; cAudioCollision m_sQueue; - void AddCollisionToRequestedQueue(); // todo + // reversed all methods + void AddCollisionToRequestedQueue(); /// ok }; static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error"); @@ -199,6 +328,8 @@ public: CVector Posn; int32 AudioEntity; + void Reset(); /// ok + static void *operator new(size_t); static void *operator new(size_t, int); static void operator delete(void *, size_t); @@ -232,6 +363,15 @@ enum AudioEntityHandle { AEHANDLE_ERROR_BADAUDIOTYPE = -1, }; +struct Crime { + int32 type; + CVector position; + uint16 timer; + uint16 gap; +}; + +static_assert(sizeof(Crime) == 20, "Crime: error "); + class cAudioManager { public: @@ -250,7 +390,7 @@ public: uint8 field_15; int32 m_nTimer; tActiveSample m_sQueueSample; - uint8 m_bActiveSampleQueue; + bool m_bActiveSampleQueue; uint8 gap_109[3]; tActiveSample m_asSamples[2][27]; uint8 m_abSampleQueueIndexTable[2][27]; @@ -267,7 +407,12 @@ public: int32 m_nFireAudioEntity; int32 m_nWaterCannonEntity; int32 m_nPoliceChannelEntity; - uint8 gap45B8[444]; + int32 crimesSamples[60]; + uint8 policeChannelTimer; + uint8 policeChannelTimerSeconds; + uint8 policeChannelCounterSeconds; + uint8 gap30; + Crime crimes[10]; int32 m_nFrontEndEntity; int32 m_nCollisionEntity; cAudioCollisionManager m_sCollisionManager; @@ -279,30 +424,31 @@ public: uint8 m_bUserPause; uint8 m_bPreviousUserPause; uint8 field_19195; // time? - uint32 m_FrameCounter; + uint32 m_nTimeOfRecentCrime; // getters - uint32 GetFrameCounter() const { return m_FrameCounter; } + uint32 GetFrameCounter() const { return m_nTimeOfRecentCrime; } float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; } int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; } // "Should" be in alphabetic order, except "getXTalkSfx" - void AddDetailsToRequestedOrderList(uint8 sample); /// ok + void AddDetailsToRequestedOrderList(uint8 sample); /// ok (check once more) void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, uint8 counter, bool notLooping); /// ok void AddReflectionsToRequestedQueue(); /// ok (check value) - void AddReleasingSounds(); // todo (difficult) + void AddReleasingSounds(); /// ok (check) void AddSampleToRequestedQueue(); /// ok - void AgeCrimes(); // todo + void AgeCrimes(); /// ok void CalculateDistance(bool *ptr, float dist); /// ok bool CheckForAnAudioFileOnCD() const; /// ok + void ClearActiveSamples(); /// ok void ClearMissionAudio(); /// ok void ClearRequestedQueue(); /// ok int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, - float speedMultiplier) const; /// ok - int32 ComputePan(float, CVector *); // todo - uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance) const; /// ok + float speedMultiplier) const; /// ok + int32 ComputePan(float, CVector *); /// ok + uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; /// ok int32 CreateEntity(int32 type, CPhysical *entity); /// ok void DestroyAllGameCreatedEntities(); /// ok @@ -395,7 +541,7 @@ public: uint8 GetCDAudioDriveLetter() const; int8 GetCurrent3DProviderIndex() const; /// ok float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used - float GetCollisionOneShotRatio(uint32 a, float b) const; /// ok + float GetCollisionOneShotRatio(int32 a, float b) const; /// ok float GetCollisionRatio(float a, float b, float c, float d) const; /// ok float GetDistanceSquared(CVector *v) const; /// ok int32 GetJumboTaxiFreq() const; /// ok @@ -404,15 +550,18 @@ public: uint8 GetNum3DProvidersAvailable() const; int32 GetPedCommentSfx(CPed *ped, int32 sound); void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const; - float GetVehicleDriveWheelSkidValue(uint8 a1, CAutomobile *a2, cTransmission *a3, - float a4); // todo - int32 GetVehicleNonDriveWheelSkidValue(float a1, int a2, int a3, int a4, float a5); // todo + float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, + cTransmission *transmission, + float velocityChange); /// ok + float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, + cTransmission *transmission, + float velocityChange); /// ok bool HasAirBrakes(int32 model) const; /// ok void Initialise(); /// ok - void InitialisePoliceRadio(); // todo - void InitialisePoliceRadioZones(); // todo + void InitialisePoliceRadio(); /// ok + void InitialisePoliceRadioZones(); /// ok void InterrogateAudioEntities(); /// ok bool IsAudioInitialised() const; /// ok bool IsMissionAudioSampleFinished(); /// ok @@ -421,15 +570,15 @@ public: bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; /// ok void PlayLoadedMissionAudio(); /// ok - void PlayOneShot(int32 index, int16 sound, float vol); // todo - uint32 PlaySuspectLastSeen(float x, float y, float z); // todo + void PlayOneShot(int32 index, int16 sound, float vol); /// ok + void PlaySuspectLastSeen(float x, float y, float z); /// ok void PlayerJustGotInCar() const; /// ok void PlayerJustLeftCar() const; /// ok void PostInitialiseGameSpecificSetup(); /// ok void PostTerminateGameSpecificShutdown(); /// ok - void PreInitialiseGameSpecificSetup() const; - void PreloadMissionAudio(char *); // todo - void PreTerminateGameSpecificShutdown(); /// ok + void PreInitialiseGameSpecificSetup() const; // ok + void PreloadMissionAudio(char *); // todo + void PreTerminateGameSpecificShutdown(); /// ok /// processX - main logic of adding new sounds void ProcessActiveQueues(); // todo bool ProcessAirBrakes(cVehicleParams *params); /// ok @@ -464,7 +613,7 @@ public: void ProcessLaunderetteScriptObject(uint8 sound); /// ok void ProcessLoopingScriptObject(uint8 sound); /// ok void ProcessMissionAudio(); /// ok - void ProcessModelCarEngine(cVehicleParams *params); /// ok (check float comparisons) + void ProcessModelCarEngine(cVehicleParams *params); /// ok void ProcessOneShotScriptObject(uint8 sound); /// ok void ProcessPed(CPhysical *ped); /// ok void ProcessPedHeadphones(cPedParams *params); /// ok @@ -472,10 +621,10 @@ public: void ProcessPhysical(int32 id); /// ok void ProcessPlane(cVehicleParams *params); /// ok void ProcessPlayersVehicleEngine(cVehicleParams *params, - CAutomobile *automobile); /// ok (check float comparisons) - void ProcessPoliceCellBeatingScriptObject(uint8 sound); // todo + CAutomobile *automobile); /// ok + void ProcessPoliceCellBeatingScriptObject(uint8 sound); /// ok void ProcessPornCinema(uint8 sound); /// ok - void ProcessProjectiles(); // todo requires CProjectileInfo + void ProcessProjectiles(); /// ok void ProcessRainOnVehicle(cVehicleParams *params); /// ok void ProcessReverb() const; /// ok bool ProcessReverseGear(cVehicleParams *a2); /// ok @@ -484,65 +633,71 @@ public: void ProcessShopScriptObject(uint8 sound); /// ok void ProcessSpecial(); /// ok bool ProcessTrainNoise(cVehicleParams *params); /// ok - void ProcessVehicle(CVehicle *); // todo + void ProcessVehicle(CVehicle *vehicle); /// ok bool ProcessVehicleDoors(cVehicleParams *params); /// ok - // bool ProcessVehicleEngine(void *); - // void ProcessVehicleHorn(cVehicleParams *params); - // void ProcessVehicleOneShots(void *); + bool ProcessVehicleEngine(cVehicleParams *params); // todo + void ProcessVehicleHorn(cVehicleParams *params); /// ok + void ProcessVehicleOneShots(void *); // todo bool ProcessVehicleReverseWarning(cVehicleParams *params); /// ok bool ProcessVehicleRoadNoise(cVehicleParams *params); /// ok - // void ProcessVehicleSirenOrAlarm(void *); - // void ProcessVehicleSkidding(void *); - void ProcessWaterCannon(int32); // todo - void ProcessWeather(int32 id); /// ok - bool ProcessWetRoadNoise(cVehicleParams *params); /// ok - void ProcessWorkShopScriptObject(uint8 sound); /// ok + void ProcessVehicleSirenOrAlarm(void *); // todo + void ProcessVehicleSkidding(cVehicleParams *params); /// ok + void ProcessWaterCannon(int32); /// ok + void ProcessWeather(int32 id); /// ok + bool ProcessWetRoadNoise(cVehicleParams *params); /// ok + void ProcessWorkShopScriptObject(uint8 sound); /// ok int32 RandomDisplacement(uint32 seed) const; void ReacquireDigitalHandle() const; void ReleaseDigitalHandle() const; - int32 ReportCollision(CEntity *a2, CEntity *a3, uint8 a4, uint8 a5, float a6, - float a7); // todo - int32 ReportCrime(eCrimeType crime, const CVector *pos); // todo - void ResetAudioLogicTimers(int32 timer); /// ok - void ResetPoliceRadio(); /// ok - void ResetTimers(uint32 a2); // todo - - void Service(); // todo - void ServiceCollisions(); // todo - void ServicePoliceRadio(); // todo - void ServicePoliceRadioChannel(int a2); // todo - void ServiceSoundEffects(); // todo - int8 SetCurrent3DProvider(uint8); // todo + void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, + float collisionPower, float intensity2); /// ok + void ReportCrime(int32 crime, const CVector *pos); /// ok + void ResetAudioLogicTimers(int32 timer); /// ok + void ResetPoliceRadio(); /// ok + void ResetTimers(uint32 time); /// ok + + void Service(); /// ok + void ServiceCollisions(); // todo + void ServicePoliceRadio(); /// ok + void ServicePoliceRadioChannel(int32 wantedLevel); /// ok + void ServiceSoundEffects(); /// ok + int8 SetCurrent3DProvider(uint8 which); /// ok void SetDynamicAcousticModelingStatus(bool status); void SetEffectsFadeVolume(uint8 volume) const; void SetEffectsMasterVolume(uint8 volume) const; void SetEntityStatus(int32 id, bool status); - uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(int32); // todo + uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision); /// ok void SetMissionAudioLocation(float x, float y, float z); void SetMissionScriptPoliceAudio(int32 sfx) const; - void SetMonoMode(uint8); // todo + void SetMonoMode(uint8); // todo (mobile) void SetMusicFadeVolume(uint8 volume) const; void SetMusicMasterVolume(uint8 volume) const; void SetSpeakerConfig(int32 conf) const; - void SetUpLoopingCollisionSound(int a2, int a3); // todo - void SetUpOneShotCollisionSound(int a2); // todo - void SetupCrimeReport(); // todo - bool SetupJumboEngineSound(uint8, int32); // todo - bool SetupJumboFlySound(uint8 emittingVol); /// ok - bool SetupJumboRumbleSound(uint8 emittingVol); /// ok - bool SetupJumboTaxiSound(uint8 vol); /// ok - bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok - void SetupPedComments(cPedParams *params, uint32 sound); /// ok - void SetupSuspectLastSeenReport(); // todo + void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter); /// ok + void SetUpOneShotCollisionSound(cAudioCollision *col); /// ok + bool SetupCrimeReport(); /// ok + bool SetupJumboEngineSound(uint8 a2, int32 a3); // todo + bool SetupJumboFlySound(uint8 emittingVol); /// ok + bool SetupJumboRumbleSound(uint8 emittingVol); /// ok + bool SetupJumboTaxiSound(uint8 vol); /// ok + bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok + void SetupPedComments(cPedParams *params, uint32 sound); /// ok + void SetupSuspectLastSeenReport(); /// ok void Terminate(); - void TranslateEntity(CVector *v1, CVector *v2) const; /// ok + void TranslateEntity(CVector *v1, CVector *v2) const; - void UpdateGasPedalAudio(CAutomobile *automobile); // todo hook + void UpdateGasPedalAudio(CAutomobile *automobile); + void UpdateReflections(); // todo bool UsesReverseWarning(int32 model) const; bool UsesSiren(int32 model) const; bool UsesSirenSwitching(int32 model) const; + + // only used in pc + void AdjustSamplesVolume(); /// ok + int32 ComputeEmittingVolume(uint8 emittingVolume, float intensity, + float dist); /// ok }; static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error"); diff --git a/src/audio/AudioSamples.h b/src/audio/AudioSamples.h index 7d71be54..2c4f8df8 100644 --- a/src/audio/AudioSamples.h +++ b/src/audio/AudioSamples.h @@ -3047,130 +3047,3 @@ enum eAudioSamples : uint32 { SAMPLEBANK_PED_MAX = AUDIO_SAMPLE_AMMUNATION_WELCOME_3+1, }; -enum eScriptSounds : int16 -{ - SCRIPT_SOUND_0 = 0, - SCRIPT_SOUND_1 = 1, - SCRIPT_SOUND_2 = 2, - SCRIPT_SOUND_3 = 3, - SCRIPT_SOUND_PARTY_1_LOOP_S = 4, - SCRIPT_SOUND_PARTY_1_LOOP_L = 5, - SCRIPT_SOUND_PARTY_2_LOOP_S = 6, - SCRIPT_SOUND_PARTY_2_LOOP_L = 7, - SCRIPT_SOUND_PARTY_3_LOOP_S = 8, - SCRIPT_SOUND_PARTY_3_LOOP_L = 9, - SCRIPT_SOUND_PARTY_4_LOOP_S = 10, - SCRIPT_SOUND_PARTY_4_LOOP_L = 11, - SCRIPT_SOUND_PARTY_5_LOOP_S = 12, - SCRIPT_SOUND_PARTY_5_LOOP_L = 13, - SCRIPT_SOUND_PARTY_6_LOOP_S = 14, - SCRIPT_SOUND_PARTY_6_LOOP_L = 15, - SCRIPT_SOUND_PARTY_7_LOOP_S = 16, - SCRIPT_SOUND_PARTY_7_LOOP_L = 17, - SCRIPT_SOUND_PARTY_8_LOOP_S = 18, - SCRIPT_SOUND_PARTY_8_LOOP_L = 19, - SCRIPT_SOUND_PARTY_9_LOOP_S = 20, - SCRIPT_SOUND_PARTY_9_LOOP_L = 21, - SCRIPT_SOUND_PARTY_10_LOOP_S = 22, - SCRIPT_SOUND_PARTY_10_LOOP_L = 23, - SCRIPT_SOUND_PARTY_11_LOOP_S = 24, - SCRIPT_SOUND_PARTY_11_LOOP_L = 25, - SCRIPT_SOUND_PARTY_12_LOOP_S = 26, - SCRIPT_SOUND_PARTY_12_LOOP_L = 27, - SCRIPT_SOUND_PARTY_13_LOOP_S = 28, - SCRIPT_SOUND_PARTY_13_LOOP_L = 29, - SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S = 30, - SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L = 31, - SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S = 32, - SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L = 33, - SCRIPT_SOUND_WORK_SHOP_LOOP_S = 34, - SCRIPT_SOUND_WORK_SHOP_LOOP_L = 35, - SCRIPT_SOUND_SAWMILL_LOOP_S = 36, - SCRIPT_SOUND_SAWMILL_LOOP_L = 37, - SCRIPT_SOUND_38 = 38, - SCRIPT_SOUND_39 = 39, - SCRIPT_SOUND_LAUNDERETTE_LOOP_S = 40, - SCRIPT_SOUND_LAUNDERETTE_LOOP_L = 41, - SCRIPT_SOUND_CHINATOWN_RESTAURANT_S = 42, - SCRIPT_SOUND_CHINATOWN_RESTAURANT_L = 43, - SCRIPT_SOUND_CIPRIANI_RESAURANT_S = 44, - SCRIPT_SOUND_CIPRIANI_RESAURANT_L = 45, - SCRIPT_SOUND_46 = 46, - SCRIPT_SOUND_47 = 47, - SCRIPT_SOUND_MARCO_BISTRO_S = 48, - SCRIPT_SOUND_MARCO_BISTRO_L = 49, - SCRIPT_SOUND_AIRPORT_LOOP_S = 50, - SCRIPT_SOUND_AIRPORT_LOOP_L = 51, - SCRIPT_SOUND_SHOP_LOOP_S = 52, - SCRIPT_SOUND_SHOP_LOOP_L = 53, - SCRIPT_SOUND_CINEMA_LOOP_S = 54, - SCRIPT_SOUND_CINEMA_LOOP_L = 55, - SCRIPT_SOUND_DOCKS_LOOP_S = 56, - SCRIPT_SOUND_DOCKS_LOOP_L = 57, - SCRIPT_SOUND_HOME_LOOP_S = 58, - SCRIPT_SOUND_HOME_LOOP_L = 59, - SCRIPT_SOUND_FRANKIE_PIANO = 60, - SCRIPT_SOUND_PARTY_1_LOOP = 61, - SCRIPT_SOUND_PORN_CINEMA_1_S = 62, - SCRIPT_SOUND_PORN_CINEMA_1_L = 63, - SCRIPT_SOUND_PORN_CINEMA_2_S = 64, - SCRIPT_SOUND_PORN_CINEMA_2_L = 65, - SCRIPT_SOUND_PORN_CINEMA_3_S = 66, - SCRIPT_SOUND_PORN_CINEMA_3_L = 67, - SCRIPT_SOUND_BANK_ALARM_LOOP_S = 68, - SCRIPT_SOUND_BANK_ALARM_LOOP_L = 69, - SCRIPT_SOUND_POLICE_BALL_LOOP_S = 70, - SCRIPT_SOUND_POLICE_BALL_LOOP_L = 71, - SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S = 72, - SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L = 73, - SCRIPT_SOUND_74 = 74, - SCRIPT_SOUND_75 = 75, - SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S = 76, - SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L = 77, - SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S = 78, - SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L = 79, - SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S = 80, - SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L = 81, - SCRIPT_SOUND_EVIDENCE_PICKUP = 82, - SCRIPT_SOUND_UNLOAD_GOLD = 83, - SCRIPT_SOUND_RAVE_1_LOOP_S = 84, - SCRIPT_SOUND_RAVE_1_LOOP_L = 85, - SCRIPT_SOUND_RAVE_2_LOOP_S = 86, - SCRIPT_SOUND_RAVE_2_LOOP_L = 87, - SCRIPT_SOUND_RAVE_3_LOOP_S = 88, - SCRIPT_SOUND_RAVE_3_LOOP_L = 89, - SCRIPT_SOUND_MISTY_SEX_S = 90, - SCRIPT_SOUND_MISTY_SEX_L = 91, - SCRIPT_SOUND_GATE_START_CLUNK = 92, - SCRIPT_SOUND_GATE_STOP_CLUNK = 93, - SCRIPT_SOUND_PART_MISSION_COMPLETE = 94, - SCRIPT_SOUND_CHUNKY_RUN_SHOUT = 95, - SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT = 96, - SCRIPT_SOUND_RACE_START_3 = 97, - SCRIPT_SOUND_RACE_START_2 = 98, - SCRIPT_SOUND_RACE_START_1 = 99, - SCRIPT_SOUND_RACE_START_GO = 100, - SCRIPT_SOUND_SWAT_PED_SHOUT = 101, - SCRIPT_SOUND_PRETEND_FIRE_LOOP = 102, - SCRIPT_SOUND_AMMUNATION_CHAT_1 = 103, - SCRIPT_SOUND_AMMUNATION_CHAT_2 = 104, - SCRIPT_SOUND_AMMUNATION_CHAT_3 = 105, - SCRIPT_SOUND_BULLET_HIT_GROUND_1 = 106, - SCRIPT_SOUND_BULLET_HIT_GROUND_2 = 107, - SCRIPT_SOUND_BULLET_HIT_GROUND_3 = 108, - SCRIPT_SOUND_109 = 109, - SCRIPT_SOUND_110 = 110, - SCRIPT_SOUND_111 = 111, - SCRIPT_SOUND_PAYPHONE_RINGING = 112, - SCRIPT_SOUND_113 = 113, - SCRIPT_SOUND_GLASS_BREAK_L = 114, - SCRIPT_SOUND_GLASS_BREAK_S = 115, - SCRIPT_SOUND_GLASS_CRACK = 116, - SCRIPT_SOUND_GLASS_LIGHT_BREAK = 117, - SCRIPT_SOUND_BOX_DESTROYED_1 = 118, - SCRIPT_SOUND_BOX_DESTROYED_2 = 119, - SCRIPT_SOUND_METAL_COLLISION = 120, - SCRIPT_SOUND_TIRE_COLLISION = 121, - SCRIPT_SOUND_GUNSHELL_DROP = 122, - SCRIPT_SOUND_GUNSHELL_DROP_SOFT = 123, -}; diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index 82267858..8b4de961 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -26,7 +26,7 @@ cDMAudio::Service(void) } int32 -cDMAudio::CreateEntity(eAudioType type, void *UID) +cDMAudio::CreateEntity(int32 type, void *UID) { return AudioManager.CreateEntity(type, (CPhysical *)UID); } diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index fe120576..a6910b58 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -1,5 +1,6 @@ #pragma once +#include "audio_enums.h" #include "Wanted.h" enum eSound : int16 @@ -180,7 +181,6 @@ enum eSound : int16 class cAudioScriptObject; class CEntity; enum eCrimeType; -enum eAudioType; class cDMAudio { @@ -192,7 +192,7 @@ public: void Terminate(void); void Service(void); - int32 CreateEntity(eAudioType type, void *UID); + int32 CreateEntity(int32 type, void *UID); void DestroyEntity(int32 audioEntity); void SetEntityStatus(int32 audioEntity, uint8 status); void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume); diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 01a21d5d..1d059a46 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -1,34 +1,33 @@ #include "common.h" -#include "patcher.h" #include "MusicManager.h" +#include "Camera.h" #include "Font.h" #include "Hud.h" +#include "ModelIndices.h" +#include "Replay.h" #include "Text.h" #include "Timer.h" -#include "Camera.h" #include "World.h" -#include "ModelIndices.h" #include "sampman.h" -#include "Replay.h" - -cMusicManager &MusicManager = *(cMusicManager*)0x8F3964; -int32 &gNumRetunePresses = *(int32*)0x650B80; -wchar *pCurrentStation = (wchar*)0x650B9C; -uint8 &cDisplay = *(uint8*)0x650BA1; +#include "patcher.h" -WRAPPER char* cMusicManager::Get3DProviderName(char) { EAXJMP(0x57A8C0); } +cMusicManager &MusicManager = *(cMusicManager *)0x8F3964; +int32 &gNumRetunePresses = *(int32 *)0x650B80; +wchar *pCurrentStation = (wchar *)0x650B9C; +uint8 &cDisplay = *(uint8 *)0x650BA1; -bool cMusicManager::PlayerInCar() +bool +cMusicManager::PlayerInCar() { - if (!FindPlayerVehicle()) + if(!FindPlayerVehicle()) return false; else { int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState; - if (State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED) + if(State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED) return false; - switch (FindPlayerVehicle()->m_modelIndex) { + switch(FindPlayerVehicle()->m_modelIndex) { case MI_FIRETRUCK: case MI_AMBULAN: case MI_MRWHOOP: @@ -36,10 +35,8 @@ bool cMusicManager::PlayerInCar() case MI_TRAIN: case MI_SPEEDER: case MI_REEFER: - case MI_GHOST: - return false; - default: - return true; + case MI_GHOST: return false; + default: return true; } } } @@ -47,56 +44,56 @@ bool cMusicManager::PlayerInCar() #if 0 WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); } #else -void cMusicManager::DisplayRadioStationName() +void +cMusicManager::DisplayRadioStationName() { int8 pRetune; int8 gStreamedSound; int8 gRetuneCounter; - if (!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && cMusicManager::PlayerInCar() && !CReplay::IsPlayingBack()) { - if (MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar) + if(!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && cMusicManager::PlayerInCar() && + !CReplay::IsPlayingBack()) { + if(MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar) pCurrentStation = nil; - if (SampleManager.IsMP3RadioChannelAvailable()) { + if(SampleManager.IsMP3RadioChannelAvailable()) { gStreamedSound = MusicManager.m_nCurrentStreamedSound; - if (gStreamedSound != STREAMED_SOUND_CITY_AMBIENT && gStreamedSound != STREAMED_SOUND_WATER_AMBIENT) { - if (gStreamedSound > STREAMED_SOUND_RADIO_MP3_PLAYER) - return; - } - else { + if(gStreamedSound == STREAMED_SOUND_CITY_AMBIENT || + gStreamedSound == STREAMED_SOUND_WATER_AMBIENT) { gStreamedSound = STREAMED_SOUND_RADIO_POLICE; + } else { + + if(gStreamedSound > + STREAMED_SOUND_RADIO_MP3_PLAYER) + return; } pRetune = gNumRetunePresses + gStreamedSound; - if (pRetune == POLICE_RADIO) { + if(pRetune == POLICE_RADIO) { pRetune = RADIO_OFF; - } - else if (pRetune > POLICE_RADIO) { + } else if(pRetune > POLICE_RADIO) { pRetune = pRetune - 11; } - } - else { + } else { gStreamedSound = MusicManager.m_nCurrentStreamedSound; pRetune = gNumRetunePresses + gStreamedSound; - if (pRetune >= USERTRACK) { + if(pRetune >= USERTRACK) { gRetuneCounter = gNumRetunePresses; pRetune = MusicManager.m_nCurrentStreamedSound; - if (gStreamedSound == STREAMED_SOUND_WATER_AMBIENT) + if(gStreamedSound == STREAMED_SOUND_WATER_AMBIENT) pRetune = RADIO_OFF; - while (gRetuneCounter) { - if (pRetune == RADIO_OFF) { + while(gRetuneCounter) { + if(pRetune == RADIO_OFF) { pRetune = HEAD_RADIO; - } - else if (pRetune < USERTRACK) { + } else if(pRetune < USERTRACK) { pRetune = pRetune + 1; } - if (pRetune == USERTRACK) - pRetune = RADIO_OFF; + if(pRetune == USERTRACK) pRetune = RADIO_OFF; --gRetuneCounter; } @@ -105,52 +102,29 @@ void cMusicManager::DisplayRadioStationName() wchar *string = nil; - switch (pRetune) { - case HEAD_RADIO: - string = TheText.Get("FEA_FM0"); - break; - case DOUBLE_CLEF: - string = TheText.Get("FEA_FM1"); - break; - case JAH_RADIO: - string = TheText.Get("FEA_FM2"); - break; - case RISE_FM: - string = TheText.Get("FEA_FM3"); - break; - case LIPS_106: - string = TheText.Get("FEA_FM4"); - break; - case GAME_FM: - string = TheText.Get("FEA_FM5"); - break; - case MSX_FM: - string = TheText.Get("FEA_FM6"); - break; - case FLASHBACK: - string = TheText.Get("FEA_FM7"); - break; - case CHATTERBOX: - string = TheText.Get("FEA_FM8"); - break; - case USERTRACK: - string = TheText.Get("FEA_FM9"); - break; - default: - return; + switch(pRetune) { + case HEAD_RADIO: string = TheText.Get("FEA_FM0"); break; + case DOUBLE_CLEF: string = TheText.Get("FEA_FM1"); break; + case JAH_RADIO: string = TheText.Get("FEA_FM2"); break; + case RISE_FM: string = TheText.Get("FEA_FM3"); break; + case LIPS_106: string = TheText.Get("FEA_FM4"); break; + case GAME_FM: string = TheText.Get("FEA_FM5"); break; + case MSX_FM: string = TheText.Get("FEA_FM6"); break; + case FLASHBACK: string = TheText.Get("FEA_FM7"); break; + case CHATTERBOX: string = TheText.Get("FEA_FM8"); break; + case USERTRACK: string = TheText.Get("FEA_FM9"); break; + default: return; }; - if (pRetune > CHATTERBOX && !SampleManager.IsMP3RadioChannelAvailable()) { - return; - } + if(pRetune > CHATTERBOX && !SampleManager.IsMP3RadioChannelAvailable()) { return; } - if (string && pCurrentStation != string || MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_MP3_PLAYER && MusicManager.m_nPreviousStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER) { + if(string && pCurrentStation != string || + MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_MP3_PLAYER && + MusicManager.m_nPreviousStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER) { pCurrentStation = string; cDisplay = 60; - } - else { - if (!cDisplay) - return; + } else { + if(!cDisplay) return; --cDisplay; } @@ -164,7 +138,7 @@ void cMusicManager::DisplayRadioStationName() CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), pCurrentStation); - if (gNumRetunePresses) + if(gNumRetunePresses) CFont::SetColor(CRGBA(102, 133, 143, 255)); else CFont::SetColor(CRGBA(147, 196, 211, 255)); @@ -203,43 +177,67 @@ cMusicManager::StopFrontEndTrack() EAXJMP(0x57E3D0); } - -WRAPPER void cMusicManager::PlayAnnouncement(unsigned char) +WRAPPER void +cMusicManager::PlayAnnouncement(uint8) { EAXJMP(0x57E430); } -WRAPPER void cMusicManager::PlayFrontEndTrack(unsigned char, unsigned char) +WRAPPER void +cMusicManager::PlayFrontEndTrack(uint8, uint8) { EAXJMP(0x57E2E0); } -WRAPPER void cMusicManager::PreloadCutSceneMusic(unsigned char) +WRAPPER void +cMusicManager::PreloadCutSceneMusic(uint8) { EAXJMP(0x57E210); } -WRAPPER void cMusicManager::PlayPreloadedCutSceneMusic(void) +WRAPPER void +cMusicManager::PlayPreloadedCutSceneMusic(void) { EAXJMP(0x57E290); } -WRAPPER void cMusicManager::StopCutSceneMusic(void) +WRAPPER void +cMusicManager::StopCutSceneMusic(void) { EAXJMP(0x57E2B0); } -WRAPPER int32 cMusicManager::GetRadioInCar(void) +WRAPPER int32 +cMusicManager::GetRadioInCar(void) { EAXJMP(0x57D1D0); } -WRAPPER void cMusicManager::SetRadioInCar(unsigned int) +WRAPPER void +cMusicManager::SetRadioInCar(uint32) { EAXJMP(0x57D2C0); } -WRAPPER void cMusicManager::SetRadioChannelByScript(unsigned char, int) +WRAPPER void +cMusicManager::SetRadioChannelByScript(uint8, int32) { EAXJMP(0x57D180); -}
\ No newline at end of file +} + +WRAPPER +void +cMusicManager::ResetMusicAfterReload() +{ + EAXJMP(0x57CF30); +} + +WRAPPER +void cMusicManager::ResetTimers(int32) { EAXJMP(0x57D420); } + +WRAPPER +void +cMusicManager::Service() +{ + EAXJMP(0x57D440); +} diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h index f20424a8..709fe56a 100644 --- a/src/audio/MusicManager.h +++ b/src/audio/MusicManager.h @@ -1,231 +1,6 @@ #pragma once -enum eRadioStation -{ - HEAD_RADIO, - DOUBLE_CLEF, - JAH_RADIO, - RISE_FM, - LIPS_106, - GAME_FM, - MSX_FM, - FLASHBACK, - CHATTERBOX, - USERTRACK, - POLICE_RADIO, - RADIO_OFF, -}; - -enum eMusicMode -{ - MUSICMODE_FRONTEND = 0, - MUSICMODE_GAME, - MUSICMODE_CUTSCENE, - MUSICMODE_OFF, - MUSICMODE_4, -}; - -enum eStreamedSounds -{ - STREAMED_SOUND_RADIO_HEAD = 0, - STREAMED_SOUND_RADIO_CLASSIC = 1, - STREAMED_SOUND_RADIO_KJAH = 2, - STREAMED_SOUND_RADIO_RISE = 3, - STREAMED_SOUND_RADIO_LIPS = 4, - STREAMED_SOUND_RADIO_GAME = 5, - STREAMED_SOUND_RADIO_MSX = 6, - STREAMED_SOUND_RADIO_FLASH = 7, - STREAMED_SOUND_RADIO_CHAT = 8, - STREAMED_SOUND_RADIO_MP3_PLAYER = 9, - STREAMED_SOUND_RADIO_POLICE = 10, - STREAMED_SOUND_CITY_AMBIENT = 11, - STREAMED_SOUND_WATER_AMBIENT = 12, - STREAMED_SOUND_ANNOUNCE_COMMERCIAL_OPEN = 13, - STREAMED_SOUND_ANNOUNCE_SUBURBAN_OPEN = 14, - STREAMED_SOUND_NEWS_INTRO = 15, - STREAMED_SOUND_BANK_INTRO = 16, - STREAMED_SOUND_CUTSCENE_LUIGI1_LG = 17, - STREAMED_SOUND_CUTSCENE_LUIGI2_DSB = 18, - STREAMED_SOUND_CUTSCENE_LUIGI3_DM = 19, - STREAMED_SOUND_CUTSCENE_LUIGI4_PAP = 20, - STREAMED_SOUND_CUTSCENE_LUIGI5_TFB = 21, - STREAMED_SOUND_CUTSCENE_JOEY0_DM2 = 22, - STREAMED_SOUND_CUTSCENE_JOEY1_LFL = 23, - STREAMED_SOUND_CUTSCENE_JOEY2_KCL = 24, - STREAMED_SOUND_CUTSCENE_JOEY3_VH = 25, - STREAMED_SOUND_CUTSCENE_JOEY4_ETH = 26, - STREAMED_SOUND_CUTSCENE_JOEY5_DST = 27, - STREAMED_SOUND_CUTSCENE_JOEY6_TBJ = 28, - STREAMED_SOUND_CUTSCENE_TONI1_TOL = 29, - STREAMED_SOUND_CUTSCENE_TONI2_TPU = 30, - STREAMED_SOUND_CUTSCENE_TONI3_MAS = 31, - STREAMED_SOUND_CUTSCENE_TONI4_TAT = 32, - STREAMED_SOUND_CUTSCENE_TONI5_BF = 33, - STREAMED_SOUND_CUTSCENE_SAL0_MAS = 34, - STREAMED_SOUND_CUTSCENE_SAL1_PF = 35, - STREAMED_SOUND_CUTSCENE_SAL2_CTG = 36, - STREAMED_SOUND_CUTSCENE_SAL3_RTC = 37, - STREAMED_SOUND_CUTSCENE_SAL5_LRQ = 38, - STREAMED_SOUND_CUTSCENE_SAL4_BDBA = 39, - STREAMED_SOUND_CUTSCENE_SAL4_BDBB = 40, - STREAMED_SOUND_CUTSCENE_SAL2_CTG2 = 41, - STREAMED_SOUND_CUTSCENE_SAL4_BDBD = 42, - STREAMED_SOUND_CUTSCENE_SAL5_LRQB = 43, - STREAMED_SOUND_CUTSCENE_SAL5_LRQC = 44, - STREAMED_SOUND_CUTSCENE_ASUKA_1_SSO = 45, - STREAMED_SOUND_CUTSCENE_ASUKA_2_PP = 46, - STREAMED_SOUND_CUTSCENE_ASUKA_3_SS = 47, - STREAMED_SOUND_CUTSCENE_ASUKA_4_PDR = 48, - STREAMED_SOUND_CUTSCENE_ASUKA_5_K2FT = 49, - STREAMED_SOUND_CUTSCENE_KENJI1_KBO = 50, - STREAMED_SOUND_CUTSCENE_KENJI2_GIS = 51, - STREAMED_SOUND_CUTSCENE_KENJI3_DS = 52, - STREAMED_SOUND_CUTSCENE_KENJI4_SHI = 53, - STREAMED_SOUND_CUTSCENE_KENJI5_SD = 54, - STREAMED_SOUND_CUTSCENE_RAY0_PDR2 = 55, - STREAMED_SOUND_CUTSCENE_RAY1_SW = 56, - STREAMED_SOUND_CUTSCENE_RAY2_AP = 57, - STREAMED_SOUND_CUTSCENE_RAY3_ED = 58, - STREAMED_SOUND_CUTSCENE_RAY4_GF = 59, - STREAMED_SOUND_CUTSCENE_RAY5_PB = 60, - STREAMED_SOUND_CUTSCENE_RAY6_MM = 61, - STREAMED_SOUND_CUTSCENE_DONALD1_STOG = 62, - STREAMED_SOUND_CUTSCENE_DONALD2_KK = 63, - STREAMED_SOUND_CUTSCENE_DONALD3_ADO = 64, - STREAMED_SOUND_CUTSCENE_DONALD5_ES = 65, - STREAMED_SOUND_CUTSCENE_DONALD7_MLD = 66, - STREAMED_SOUND_CUTSCENE_DONALD4_GTA = 67, - STREAMED_SOUND_CUTSCENE_DONALD4_GTA2 = 68, - STREAMED_SOUND_CUTSCENE_DONALD6_STS = 69, - STREAMED_SOUND_CUTSCENE_ASUKA6_BAIT = 70, - STREAMED_SOUND_CUTSCENE_ASUKA7_ETG = 71, - STREAMED_SOUND_CUTSCENE_ASUKA8_PS = 72, - STREAMED_SOUND_CUTSCENE_ASUKA9_ASD = 73, - STREAMED_SOUND_CUTSCENE_KENJI4_SHI2 = 74, - STREAMED_SOUND_CUTSCENE_CATALINA1_TEX = 75, - STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 = 76, - STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 = 77, - STREAMED_SOUND_CUTSCENE_ELBURRO3_PH3 = 78, - STREAMED_SOUND_CUTSCENE_ELBURRO4_PH4 = 79, - STREAMED_SOUND_CUTSCENE_YARDIE_PH1 = 80, - STREAMED_SOUND_CUTSCENE_YARDIE_PH2 = 81, - STREAMED_SOUND_CUTSCENE_YARDIE_PH3 = 82, - STREAMED_SOUND_CUTSCENE_YARDIE_PH4 = 83, - STREAMED_SOUND_CUTSCENE_HOODS_PH1 = 84, - STREAMED_SOUND_CUTSCENE_HOODS_PH2 = 85, - STREAMED_SOUND_CUTSCENE_HOODS_PH3 = 86, - STREAMED_SOUND_CUTSCENE_HOODS_PH4 = 87, - STREAMED_SOUND_CUTSCENE_HOODS_PH5 = 88, - STREAMED_SOUND_CUTSCENE_MARTY_PH1 = 89, - STREAMED_SOUND_CUTSCENE_MARTY_PH2 = 90, - STREAMED_SOUND_CUTSCENE_MARTY_PH3 = 91, - STREAMED_SOUND_CUTSCENE_MARTY_PH4 = 92, - STREAMED_SOUND_MISSION_COMPLETED = 93, - STREAMED_SOUND_GAME_COMPLETED = 94, - STREAMED_SOUND_MISSION_LIB_A1 = 95, - STREAMED_SOUND_MISSION_LIB_A2 = 96, - STREAMED_SOUND_MISSION_LIB_A = 97, - STREAMED_SOUND_MISSION_LIB_B = 98, - STREAMED_SOUND_MISSION_LIB_C = 99, - STREAMED_SOUND_MISSION_LIB_D = 100, - STREAMED_SOUND_MISSION_L2_A = 101, - STREAMED_SOUND_MISSION_J4T_1 = 102, - STREAMED_SOUND_MISSION_J4T_2 = 103, - STREAMED_SOUND_MISSION_J4T_3 = 104, - STREAMED_SOUND_MISSION_J4T_4 = 105, - STREAMED_SOUND_MISSION_J4_A = 106, - STREAMED_SOUND_MISSION_J4_B = 107, - STREAMED_SOUND_MISSION_J4_C = 108, - STREAMED_SOUND_MISSION_J4_D = 109, - STREAMED_SOUND_MISSION_J4_E = 110, - STREAMED_SOUND_MISSION_J4_F = 111, - STREAMED_SOUND_MISSION_J6_1 = 112, - STREAMED_SOUND_MISSION_J6_A = 113, - STREAMED_SOUND_MISSION_J6_B = 114, - STREAMED_SOUND_MISSION_J6_C = 115, - STREAMED_SOUND_MISSION_J6_D = 116, - STREAMED_SOUND_MISSION_T4_A = 117, - STREAMED_SOUND_MISSION_S1_A = 118, - STREAMED_SOUND_MISSION_S1_A1 = 119, - STREAMED_SOUND_MISSION_S1_B = 120, - STREAMED_SOUND_MISSION_S1_C = 121, - STREAMED_SOUND_MISSION_S1_C1 = 122, - STREAMED_SOUND_MISSION_S1_D = 123, - STREAMED_SOUND_MISSION_S1_E = 124, - STREAMED_SOUND_MISSION_S1_F = 125, - STREAMED_SOUND_MISSION_S1_G = 126, - STREAMED_SOUND_MISSION_S1_H = 127, - STREAMED_SOUND_MISSION_S1_I = 128, - STREAMED_SOUND_MISSION_S1_J = 129, - STREAMED_SOUND_MISSION_S1_K = 130, - STREAMED_SOUND_MISSION_S1_L = 131, - STREAMED_SOUND_MISSION_S3_A = 132, - STREAMED_SOUND_MISSION_S3_B = 133, - STREAMED_SOUND_MISSION_EL3_A = 134, - STREAMED_SOUND_MISSION_MF1_A = 135, - STREAMED_SOUND_MISSION_MF2_A = 136, - STREAMED_SOUND_MISSION_MF3_A = 137, - STREAMED_SOUND_MISSION_MF3_B = 138, - STREAMED_SOUND_MISSION_MF3_B1 = 139, - STREAMED_SOUND_MISSION_MF3_C = 140, - STREAMED_SOUND_MISSION_MF4_A = 141, - STREAMED_SOUND_MISSION_MF4_B = 142, - STREAMED_SOUND_MISSION_MF4_C = 143, - STREAMED_SOUND_MISSION_A1_A = 144, - STREAMED_SOUND_MISSION_A3_A = 145, - STREAMED_SOUND_MISSION_A5_A = 146, - STREAMED_SOUND_MISSION_A4_A = 147, - STREAMED_SOUND_MISSION_A4_B = 148, - STREAMED_SOUND_MISSION_A4_C = 149, - STREAMED_SOUND_MISSION_A4_D = 150, - STREAMED_SOUND_MISSION_K1_A = 151, - STREAMED_SOUND_MISSION_K3_A = 152, - STREAMED_SOUND_MISSION_R1_A = 153, - STREAMED_SOUND_MISSION_R2_A = 154, - STREAMED_SOUND_MISSION_R2_B = 155, - STREAMED_SOUND_MISSION_R2_C = 156, - STREAMED_SOUND_MISSION_R2_D = 157, - STREAMED_SOUND_MISSION_R2_E = 158, - STREAMED_SOUND_MISSION_R2_F = 159, - STREAMED_SOUND_MISSION_R2_G = 160, - STREAMED_SOUND_MISSION_R2_H = 161, - STREAMED_SOUND_MISSION_R5_A = 162, - STREAMED_SOUND_MISSION_R6_A = 163, - STREAMED_SOUND_MISSION_R6_A1 = 164, - STREAMED_SOUND_MISSION_R6_B = 165, - STREAMED_SOUND_MISSION_LO2_A = 166, - STREAMED_SOUND_MISSION_LO6_A = 167, - STREAMED_SOUND_MISSION_YD2_A = 168, - STREAMED_SOUND_MISSION_YD2_B = 169, - STREAMED_SOUND_MISSION_YD2_C = 170, - STREAMED_SOUND_MISSION_YD2_C1 = 171, - STREAMED_SOUND_MISSION_YD2_D = 172, - STREAMED_SOUND_MISSION_YD2_E = 173, - STREAMED_SOUND_MISSION_YD2_F = 174, - STREAMED_SOUND_MISSION_YD2_G = 175, - STREAMED_SOUND_MISSION_YD2_H = 176, - STREAMED_SOUND_MISSION_YD2_ASS = 177, - STREAMED_SOUND_MISSION_YD2_OK = 178, - STREAMED_SOUND_MISSION_H5_A = 179, - STREAMED_SOUND_MISSION_H5_B = 180, - STREAMED_SOUND_MISSION_H5_C = 181, - STREAMED_SOUND_MISSION_AMMU_A = 182, - STREAMED_SOUND_MISSION_AMMU_B = 183, - STREAMED_SOUND_MISSION_AMMU_C = 184, - STREAMED_SOUND_MISSION_DOOR_1 = 185, - STREAMED_SOUND_MISSION_DOOR_2 = 186, - STREAMED_SOUND_MISSION_DOOR_3 = 187, - STREAMED_SOUND_MISSION_DOOR_4 = 188, - STREAMED_SOUND_MISSION_DOOR_5 = 189, - STREAMED_SOUND_MISSION_DOOR_6 = 190, - STREAMED_SOUND_MISSION_T3_A = 191, - STREAMED_SOUND_MISSION_T3_B = 192, - STREAMED_SOUND_MISSION_T3_C = 193, - STREAMED_SOUND_MISSION_K1_B = 194, - STREAMED_SOUND_MISSION_CAT1 = 195, - TOTAL_STREAMED_SOUNDS = 196, - NO_STREAMED_SOUND = 197, -}; +#include "audio_enums.h" class tMP3Sample { @@ -250,7 +25,7 @@ public: bool m_bPreviousPlayerInCar; bool m_bPlayerInCar; bool m_bAnnouncementInProgress; - tMP3Sample m_asMP3Samples[196]; + tMP3Sample m_asMP3Samples[TOTAL_STREAMED_SOUNDS]; uint8 field_2364; uint8 field_2365; uint8 field_2366; @@ -283,18 +58,22 @@ public: void ChangeMusicMode(int32 mode); void StopFrontEndTrack(); - char *Get3DProviderName(char); bool PlayerInCar(); void DisplayRadioStationName(); - - void PlayAnnouncement(unsigned char); - void PlayFrontEndTrack(unsigned char, unsigned char); - void PreloadCutSceneMusic(unsigned char); + + void PlayAnnouncement(uint8); + void PlayFrontEndTrack(uint8, uint8); + void PreloadCutSceneMusic(uint8); void PlayPreloadedCutSceneMusic(void); void StopCutSceneMusic(void); int32 GetRadioInCar(void); - void SetRadioInCar(unsigned int); - void SetRadioChannelByScript(unsigned char, int); + void SetRadioInCar(uint32); + void SetRadioChannelByScript(uint8, int32); + + void ResetMusicAfterReload(); + + void ResetTimers(int32); + void Service(); }; static_assert(sizeof(cMusicManager) == 0x95C, "cMusicManager: error"); diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h new file mode 100644 index 00000000..55bc5b70 --- /dev/null +++ b/src/audio/audio_enums.h @@ -0,0 +1,228 @@ +#pragma once + +enum eRadioStation +{ + HEAD_RADIO, + DOUBLE_CLEF, + JAH_RADIO, + RISE_FM, + LIPS_106, + GAME_FM, + MSX_FM, + FLASHBACK, + CHATTERBOX, + USERTRACK, + POLICE_RADIO, + RADIO_OFF, +}; + +enum eMusicMode +{ + MUSICMODE_FRONTEND = 0, + MUSICMODE_GAME, + MUSICMODE_CUTSCENE, + MUSICMODE_OFF, + MUSICMODE_4, +}; + +enum eStreamedSounds +{ + STREAMED_SOUND_RADIO_HEAD = 0, + STREAMED_SOUND_RADIO_CLASSIC = 1, + STREAMED_SOUND_RADIO_KJAH = 2, + STREAMED_SOUND_RADIO_RISE = 3, + STREAMED_SOUND_RADIO_LIPS = 4, + STREAMED_SOUND_RADIO_GAME = 5, + STREAMED_SOUND_RADIO_MSX = 6, + STREAMED_SOUND_RADIO_FLASH = 7, + STREAMED_SOUND_RADIO_CHAT = 8, + STREAMED_SOUND_RADIO_MP3_PLAYER = 9, + STREAMED_SOUND_RADIO_POLICE = 10, + STREAMED_SOUND_CITY_AMBIENT = 11, + STREAMED_SOUND_WATER_AMBIENT = 12, + STREAMED_SOUND_ANNOUNCE_COMMERCIAL_OPEN = 13, + STREAMED_SOUND_ANNOUNCE_SUBURBAN_OPEN = 14, + STREAMED_SOUND_NEWS_INTRO = 15, + STREAMED_SOUND_BANK_INTRO = 16, + STREAMED_SOUND_CUTSCENE_LUIGI1_LG = 17, + STREAMED_SOUND_CUTSCENE_LUIGI2_DSB = 18, + STREAMED_SOUND_CUTSCENE_LUIGI3_DM = 19, + STREAMED_SOUND_CUTSCENE_LUIGI4_PAP = 20, + STREAMED_SOUND_CUTSCENE_LUIGI5_TFB = 21, + STREAMED_SOUND_CUTSCENE_JOEY0_DM2 = 22, + STREAMED_SOUND_CUTSCENE_JOEY1_LFL = 23, + STREAMED_SOUND_CUTSCENE_JOEY2_KCL = 24, + STREAMED_SOUND_CUTSCENE_JOEY3_VH = 25, + STREAMED_SOUND_CUTSCENE_JOEY4_ETH = 26, + STREAMED_SOUND_CUTSCENE_JOEY5_DST = 27, + STREAMED_SOUND_CUTSCENE_JOEY6_TBJ = 28, + STREAMED_SOUND_CUTSCENE_TONI1_TOL = 29, + STREAMED_SOUND_CUTSCENE_TONI2_TPU = 30, + STREAMED_SOUND_CUTSCENE_TONI3_MAS = 31, + STREAMED_SOUND_CUTSCENE_TONI4_TAT = 32, + STREAMED_SOUND_CUTSCENE_TONI5_BF = 33, + STREAMED_SOUND_CUTSCENE_SAL0_MAS = 34, + STREAMED_SOUND_CUTSCENE_SAL1_PF = 35, + STREAMED_SOUND_CUTSCENE_SAL2_CTG = 36, + STREAMED_SOUND_CUTSCENE_SAL3_RTC = 37, + STREAMED_SOUND_CUTSCENE_SAL5_LRQ = 38, + STREAMED_SOUND_CUTSCENE_SAL4_BDBA = 39, + STREAMED_SOUND_CUTSCENE_SAL4_BDBB = 40, + STREAMED_SOUND_CUTSCENE_SAL2_CTG2 = 41, + STREAMED_SOUND_CUTSCENE_SAL4_BDBD = 42, + STREAMED_SOUND_CUTSCENE_SAL5_LRQB = 43, + STREAMED_SOUND_CUTSCENE_SAL5_LRQC = 44, + STREAMED_SOUND_CUTSCENE_ASUKA_1_SSO = 45, + STREAMED_SOUND_CUTSCENE_ASUKA_2_PP = 46, + STREAMED_SOUND_CUTSCENE_ASUKA_3_SS = 47, + STREAMED_SOUND_CUTSCENE_ASUKA_4_PDR = 48, + STREAMED_SOUND_CUTSCENE_ASUKA_5_K2FT = 49, + STREAMED_SOUND_CUTSCENE_KENJI1_KBO = 50, + STREAMED_SOUND_CUTSCENE_KENJI2_GIS = 51, + STREAMED_SOUND_CUTSCENE_KENJI3_DS = 52, + STREAMED_SOUND_CUTSCENE_KENJI4_SHI = 53, + STREAMED_SOUND_CUTSCENE_KENJI5_SD = 54, + STREAMED_SOUND_CUTSCENE_RAY0_PDR2 = 55, + STREAMED_SOUND_CUTSCENE_RAY1_SW = 56, + STREAMED_SOUND_CUTSCENE_RAY2_AP = 57, + STREAMED_SOUND_CUTSCENE_RAY3_ED = 58, + STREAMED_SOUND_CUTSCENE_RAY4_GF = 59, + STREAMED_SOUND_CUTSCENE_RAY5_PB = 60, + STREAMED_SOUND_CUTSCENE_RAY6_MM = 61, + STREAMED_SOUND_CUTSCENE_DONALD1_STOG = 62, + STREAMED_SOUND_CUTSCENE_DONALD2_KK = 63, + STREAMED_SOUND_CUTSCENE_DONALD3_ADO = 64, + STREAMED_SOUND_CUTSCENE_DONALD5_ES = 65, + STREAMED_SOUND_CUTSCENE_DONALD7_MLD = 66, + STREAMED_SOUND_CUTSCENE_DONALD4_GTA = 67, + STREAMED_SOUND_CUTSCENE_DONALD4_GTA2 = 68, + STREAMED_SOUND_CUTSCENE_DONALD6_STS = 69, + STREAMED_SOUND_CUTSCENE_ASUKA6_BAIT = 70, + STREAMED_SOUND_CUTSCENE_ASUKA7_ETG = 71, + STREAMED_SOUND_CUTSCENE_ASUKA8_PS = 72, + STREAMED_SOUND_CUTSCENE_ASUKA9_ASD = 73, + STREAMED_SOUND_CUTSCENE_KENJI4_SHI2 = 74, + STREAMED_SOUND_CUTSCENE_CATALINA1_TEX = 75, + STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 = 76, + STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 = 77, + STREAMED_SOUND_CUTSCENE_ELBURRO3_PH3 = 78, + STREAMED_SOUND_CUTSCENE_ELBURRO4_PH4 = 79, + STREAMED_SOUND_CUTSCENE_YARDIE_PH1 = 80, + STREAMED_SOUND_CUTSCENE_YARDIE_PH2 = 81, + STREAMED_SOUND_CUTSCENE_YARDIE_PH3 = 82, + STREAMED_SOUND_CUTSCENE_YARDIE_PH4 = 83, + STREAMED_SOUND_CUTSCENE_HOODS_PH1 = 84, + STREAMED_SOUND_CUTSCENE_HOODS_PH2 = 85, + STREAMED_SOUND_CUTSCENE_HOODS_PH3 = 86, + STREAMED_SOUND_CUTSCENE_HOODS_PH4 = 87, + STREAMED_SOUND_CUTSCENE_HOODS_PH5 = 88, + STREAMED_SOUND_CUTSCENE_MARTY_PH1 = 89, + STREAMED_SOUND_CUTSCENE_MARTY_PH2 = 90, + STREAMED_SOUND_CUTSCENE_MARTY_PH3 = 91, + STREAMED_SOUND_CUTSCENE_MARTY_PH4 = 92, + STREAMED_SOUND_MISSION_COMPLETED = 93, + STREAMED_SOUND_GAME_COMPLETED = 94, + STREAMED_SOUND_MISSION_LIB_A1 = 95, + STREAMED_SOUND_MISSION_LIB_A2 = 96, + STREAMED_SOUND_MISSION_LIB_A = 97, + STREAMED_SOUND_MISSION_LIB_B = 98, + STREAMED_SOUND_MISSION_LIB_C = 99, + STREAMED_SOUND_MISSION_LIB_D = 100, + STREAMED_SOUND_MISSION_L2_A = 101, + STREAMED_SOUND_MISSION_J4T_1 = 102, + STREAMED_SOUND_MISSION_J4T_2 = 103, + STREAMED_SOUND_MISSION_J4T_3 = 104, + STREAMED_SOUND_MISSION_J4T_4 = 105, + STREAMED_SOUND_MISSION_J4_A = 106, + STREAMED_SOUND_MISSION_J4_B = 107, + STREAMED_SOUND_MISSION_J4_C = 108, + STREAMED_SOUND_MISSION_J4_D = 109, + STREAMED_SOUND_MISSION_J4_E = 110, + STREAMED_SOUND_MISSION_J4_F = 111, + STREAMED_SOUND_MISSION_J6_1 = 112, + STREAMED_SOUND_MISSION_J6_A = 113, + STREAMED_SOUND_MISSION_J6_B = 114, + STREAMED_SOUND_MISSION_J6_C = 115, + STREAMED_SOUND_MISSION_J6_D = 116, + STREAMED_SOUND_MISSION_T4_A = 117, + STREAMED_SOUND_MISSION_S1_A = 118, + STREAMED_SOUND_MISSION_S1_A1 = 119, + STREAMED_SOUND_MISSION_S1_B = 120, + STREAMED_SOUND_MISSION_S1_C = 121, + STREAMED_SOUND_MISSION_S1_C1 = 122, + STREAMED_SOUND_MISSION_S1_D = 123, + STREAMED_SOUND_MISSION_S1_E = 124, + STREAMED_SOUND_MISSION_S1_F = 125, + STREAMED_SOUND_MISSION_S1_G = 126, + STREAMED_SOUND_MISSION_S1_H = 127, + STREAMED_SOUND_MISSION_S1_I = 128, + STREAMED_SOUND_MISSION_S1_J = 129, + STREAMED_SOUND_MISSION_S1_K = 130, + STREAMED_SOUND_MISSION_S1_L = 131, + STREAMED_SOUND_MISSION_S3_A = 132, + STREAMED_SOUND_MISSION_S3_B = 133, + STREAMED_SOUND_MISSION_EL3_A = 134, + STREAMED_SOUND_MISSION_MF1_A = 135, + STREAMED_SOUND_MISSION_MF2_A = 136, + STREAMED_SOUND_MISSION_MF3_A = 137, + STREAMED_SOUND_MISSION_MF3_B = 138, + STREAMED_SOUND_MISSION_MF3_B1 = 139, + STREAMED_SOUND_MISSION_MF3_C = 140, + STREAMED_SOUND_MISSION_MF4_A = 141, + STREAMED_SOUND_MISSION_MF4_B = 142, + STREAMED_SOUND_MISSION_MF4_C = 143, + STREAMED_SOUND_MISSION_A1_A = 144, + STREAMED_SOUND_MISSION_A3_A = 145, + STREAMED_SOUND_MISSION_A5_A = 146, + STREAMED_SOUND_MISSION_A4_A = 147, + STREAMED_SOUND_MISSION_A4_B = 148, + STREAMED_SOUND_MISSION_A4_C = 149, + STREAMED_SOUND_MISSION_A4_D = 150, + STREAMED_SOUND_MISSION_K1_A = 151, + STREAMED_SOUND_MISSION_K3_A = 152, + STREAMED_SOUND_MISSION_R1_A = 153, + STREAMED_SOUND_MISSION_R2_A = 154, + STREAMED_SOUND_MISSION_R2_B = 155, + STREAMED_SOUND_MISSION_R2_C = 156, + STREAMED_SOUND_MISSION_R2_D = 157, + STREAMED_SOUND_MISSION_R2_E = 158, + STREAMED_SOUND_MISSION_R2_F = 159, + STREAMED_SOUND_MISSION_R2_G = 160, + STREAMED_SOUND_MISSION_R2_H = 161, + STREAMED_SOUND_MISSION_R5_A = 162, + STREAMED_SOUND_MISSION_R6_A = 163, + STREAMED_SOUND_MISSION_R6_A1 = 164, + STREAMED_SOUND_MISSION_R6_B = 165, + STREAMED_SOUND_MISSION_LO2_A = 166, + STREAMED_SOUND_MISSION_LO6_A = 167, + STREAMED_SOUND_MISSION_YD2_A = 168, + STREAMED_SOUND_MISSION_YD2_B = 169, + STREAMED_SOUND_MISSION_YD2_C = 170, + STREAMED_SOUND_MISSION_YD2_C1 = 171, + STREAMED_SOUND_MISSION_YD2_D = 172, + STREAMED_SOUND_MISSION_YD2_E = 173, + STREAMED_SOUND_MISSION_YD2_F = 174, + STREAMED_SOUND_MISSION_YD2_G = 175, + STREAMED_SOUND_MISSION_YD2_H = 176, + STREAMED_SOUND_MISSION_YD2_ASS = 177, + STREAMED_SOUND_MISSION_YD2_OK = 178, + STREAMED_SOUND_MISSION_H5_A = 179, + STREAMED_SOUND_MISSION_H5_B = 180, + STREAMED_SOUND_MISSION_H5_C = 181, + STREAMED_SOUND_MISSION_AMMU_A = 182, + STREAMED_SOUND_MISSION_AMMU_B = 183, + STREAMED_SOUND_MISSION_AMMU_C = 184, + STREAMED_SOUND_MISSION_DOOR_1 = 185, + STREAMED_SOUND_MISSION_DOOR_2 = 186, + STREAMED_SOUND_MISSION_DOOR_3 = 187, + STREAMED_SOUND_MISSION_DOOR_4 = 188, + STREAMED_SOUND_MISSION_DOOR_5 = 189, + STREAMED_SOUND_MISSION_DOOR_6 = 190, + STREAMED_SOUND_MISSION_T3_A = 191, + STREAMED_SOUND_MISSION_T3_B = 192, + STREAMED_SOUND_MISSION_T3_C = 193, + STREAMED_SOUND_MISSION_K1_B = 194, + STREAMED_SOUND_MISSION_CAT1 = 195, + TOTAL_STREAMED_SOUNDS = 196, + NO_STREAMED_SOUND = 197, +};
\ No newline at end of file diff --git a/src/control/AccidentManager.cpp b/src/control/AccidentManager.cpp index e2b1f6d0..46d254fc 100644 --- a/src/control/AccidentManager.cpp +++ b/src/control/AccidentManager.cpp @@ -6,6 +6,8 @@ CAccidentManager& gAccidentManager = *(CAccidentManager*)0x87FD10; +WRAPPER void CAccidentManager::Update(void) { EAXJMP(0x456710); } + uint16 CAccidentManager::CountActiveAccidents() { uint16 accidents = 0; diff --git a/src/control/AccidentManager.h b/src/control/AccidentManager.h index 999abddc..6d7f25c8 100644 --- a/src/control/AccidentManager.h +++ b/src/control/AccidentManager.h @@ -22,6 +22,7 @@ class CAccidentManager public: uint16 CountActiveAccidents(); CAccident* FindNearestAccident(CVector, float*); + void Update(void); }; extern CAccidentManager& gAccidentManager;
\ No newline at end of file diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp index 81f43f32..dacb7aab 100644 --- a/src/control/Bridge.cpp +++ b/src/control/Bridge.cpp @@ -123,8 +123,7 @@ void CBridge::FindBridgeEntities() pLiftRoad = nil; pLiftPart = nil; - for (int i = 1; i < CPools::GetBuildingPool()->GetSize(); ++i) - { + for (int i = CPools::GetBuildingPool()->GetSize()-1; i >= 0; i--) { CBuilding* entry = CPools::GetBuildingPool()->GetSlot(i); if (entry) { diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp index bb0c1ec3..b4dd8777 100644 --- a/src/control/CarAI.cpp +++ b/src/control/CarAI.cpp @@ -588,7 +588,7 @@ void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle) CVector2D forward = pVehicle->GetMoveSpeed() / flatSpeed; float projection = flatSpeed * 45 + 20; int i = CPools::GetVehiclePool()->GetSize(); - while (i--) { + while (--i >= 0) { CVehicle* vehicle = CPools::GetVehiclePool()->GetSlot(i); if (!vehicle) continue; diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index fd6d8057..cf77b5a4 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -648,8 +648,7 @@ CCarCtrl::AddToCarArray(int32 id, int32 vehclass) void CCarCtrl::RemoveDistantCars() { - uint32 i = CPools::GetVehiclePool()->GetSize(); - while (--i){ + for (int i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) { CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); if (!pVehicle) continue; @@ -733,8 +732,7 @@ int32 CCarCtrl::CountCarsOfType(int32 mi) { int32 total = 0; - uint32 i = CPools::GetVehiclePool()->GetSize(); - while (i--){ + for (int i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) { CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); if (!pVehicle) continue; diff --git a/src/control/Cranes.cpp b/src/control/Cranes.cpp index ebdbf957..291e147f 100644 --- a/src/control/Cranes.cpp +++ b/src/control/Cranes.cpp @@ -5,4 +5,6 @@ WRAPPER bool CCranes::IsThisCarBeingTargettedByAnyCrane(CVehicle*) { EAXJMP(0x5451E0); } WRAPPER bool CCranes::IsThisCarBeingCarriedByAnyCrane(CVehicle*) { EAXJMP(0x545190); } WRAPPER void CCranes::ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float) { EAXJMP(0x543650); } -WRAPPER void CCranes::DeActivateCrane(float, float) { EAXJMP(0x543890); }
\ No newline at end of file +WRAPPER void CCranes::DeActivateCrane(float, float) { EAXJMP(0x543890); } +WRAPPER void CCranes::InitCranes(void) { EAXJMP(0x543360); } +WRAPPER void CCranes::UpdateCranes(void) { EAXJMP(0x5439E0); }
\ No newline at end of file diff --git a/src/control/Cranes.h b/src/control/Cranes.h index be586398..956e2e84 100644 --- a/src/control/Cranes.h +++ b/src/control/Cranes.h @@ -10,4 +10,6 @@ public: static bool IsThisCarBeingCarriedByAnyCrane(CVehicle*); static void ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float); static void DeActivateCrane(float, float); + static void InitCranes(void); + static void UpdateCranes(void); }; diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index ed101cad..0ed5d5cf 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -30,7 +30,7 @@ CGameLogic::InitAtStartOfGame() void
CGameLogic::PassTime(uint32 time)
{
- uint8 minutes, hours, days;
+ int32 minutes, hours, days;
minutes = time + CClock::GetMinutes();
hours = CClock::GetHours();
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 9a58bec7..b7a1fa8b 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -25,6 +25,9 @@ bool &CGarages::PlayerInGarage = *(bool *)0x95CD83; int32 &CGarages::PoliceCarsCollected = *(int32 *)0x941444; uint32 &CGarages::GarageToBeTidied = *(uint32 *)0x623570; +WRAPPER void CGarages::Init(void) { EAXJMP(0x421C60); } +WRAPPER void CGarages::Update(void) { EAXJMP(0x421E40); } + bool CGarages::IsModelIndexADoor(uint32 id) { @@ -119,4 +122,4 @@ void CGarages::PrintMessages() } } } -#endif +#endif
\ No newline at end of file diff --git a/src/control/Garages.h b/src/control/Garages.h index ad1ca0e0..af592716 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -30,6 +30,8 @@ public: static bool IsPointWithinHideOutGarage(CVector&); static bool IsPointWithinAnyGarage(CVector&); static void PlayerArrestedOrDied(); + static void Init(void); + static void Update(void); static int16 AddOne(float, float, float, float, float, float, uint8, uint32); static void SetTargetCarForMissonGarage(int16, CVehicle*); static bool HasCarBeenDroppedOffYet(int16); diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp index f8005899..ef978868 100644 --- a/src/control/Phones.cpp +++ b/src/control/Phones.cpp @@ -15,6 +15,8 @@ CPhone *&CPhoneInfo::pickedUpPhone = *(CPhone**)0x6283B0; bool &CPhoneInfo::isPhoneBeingPickedUp = *(bool*)0x6283B4; CPed *&CPhoneInfo::pedWhoPickingUpPhone = *(CPed**)0x6283B8; +WRAPPER void CPhoneInfo::Update(void) { EAXJMP(0x42F7A0); } + int CPhoneInfo::FindNearestFreePhone(CVector *pos) { @@ -151,8 +153,8 @@ CPhoneInfo::Initialise(void) pickedUpPhone = nil; m_nMax = 0; m_nNum = 0; - for (int v5 = pool->GetSize() - 1; v5 >= 0; v5--) { - CBuilding *building = pool->GetSlot(v5); + for (int i = pool->GetSize() - 1; i >= 0; i--) { + CBuilding *building = pool->GetSlot(i); if (building) { if (building->m_modelIndex == MI_PHONEBOOTH1) { CPhone *maxPhone = &m_aPhones[m_nMax]; diff --git a/src/control/Phones.h b/src/control/Phones.h index 6842eef4..99ec520c 100644 --- a/src/control/Phones.h +++ b/src/control/Phones.h @@ -56,6 +56,7 @@ public: int GrabPhone(float, float); void Initialise(void); void Shutdown(void); + void Update(void); }; extern CPhoneInfo &gPhoneInfo; diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index e095ec8e..91fd889c 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -47,6 +47,7 @@ uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 25 float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f };
WRAPPER void CPacManPickups::Render(void) { EAXJMP(0x432F60); }
+WRAPPER void CPacManPickups::Update(void) { EAXJMP(0x432800); }
void
@@ -296,7 +297,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) m_pObject->UpdateRwFrame();
bool touched = false;
- for (int32 i = CPools::GetVehiclePool()->GetSize(); i > 0; i--) { // TODO: check if i > 0 is not a R* mistake
+ for (int32 i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
touched = true;
@@ -323,7 +324,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) if (CTimer::GetTimeInMilliseconds() > m_nTimer)
explode = true;
else {// added else here since vehicle lookup is useless
- for (int32 i = CPools::GetVehiclePool()->GetSize(); i > 0; i--) { // TODO: check if i > 0 is not a R* mistake
+ for (int32 i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
explode = true;
diff --git a/src/control/Pickups.h b/src/control/Pickups.h index cbf3f245..5f9814c3 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -106,4 +106,5 @@ class CPacManPickups {
public:
static void Render(void);
+ static void Update(void);
};
diff --git a/src/control/Population.cpp b/src/control/Population.cpp index 3e7ab427..a98721ac 100644 --- a/src/control/Population.cpp +++ b/src/control/Population.cpp @@ -11,15 +11,74 @@ int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570; float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C; uint32 &CPopulation::ms_nTotalMissionPeds = *(uint32*)0x8F5F70; int32 &CPopulation::MaxNumberOfPedsInUse = *(int32*)0x5FA574; +uint32& CPopulation::ms_nNumCivMale = *(uint32*)0x8F2548; +uint32& CPopulation::ms_nNumCivFemale = *(uint32*)0x8F5F44; +uint32& CPopulation::ms_nNumCop = *(uint32*)0x885AFC; +bool& CPopulation::bZoneChangeHasHappened = *(bool*)0x95CD79; +uint32& CPopulation::ms_nNumEmergency = *(uint32*)0x94071C; +uint32& CPopulation::m_CountDownToPedsAtStart = *(uint32*)0x95CD4F; +uint32& CPopulation::ms_nNumGang1 = *(uint32*)0x8F1B1C; +uint32& CPopulation::ms_nNumGang2 = *(uint32*)0x8F1B14; +uint32& CPopulation::ms_nTotalPeds = *(uint32*)0x95CB50; +uint32& CPopulation::ms_nNumGang3 = *(uint32*)0x8F2548; +uint32& CPopulation::ms_nTotalGangPeds = *(uint32*)0x885AF0; +uint32& CPopulation::ms_nNumGang4 = *(uint32*)0x8F1B2C; +uint32& CPopulation::ms_nTotalCivPeds = *(uint32*)0x8F2C3C; +uint32& CPopulation::ms_nNumGang5 = *(uint32*)0x8F1B30; +uint32& CPopulation::ms_nNumDummy = *(uint32*)0x8F1A98; +uint32& CPopulation::ms_nNumGang6 = *(uint32*)0x8F1B20; +uint32& CPopulation::ms_nNumGang9 = *(uint32*)0x8F1B10; +uint32& CPopulation::ms_nNumGang7 = *(uint32*)0x8F1B28; +uint32& CPopulation::ms_nNumGang8 = *(uint32*)0x8F1B0C; +WRAPPER void CPopulation::Update(void) { EAXJMP(0x4F39A0); } +WRAPPER void CPopulation::LoadPedGroups() { EAXJMP(0x4F3870); } WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); } WRAPPER void CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool) { EAXJMP(0x4F6200); } WRAPPER CPed *CPopulation::AddPedInCar(CVehicle *vehicle) { EAXJMP(0x4F5800); } WRAPPER bool CPopulation::IsPointInSafeZone(CVector *coors) { EAXJMP(0x4F60C0); } void +CPopulation::Initialise() +{ + debug("Initialising CPopulation...\n"); + + ms_nNumCivMale = 0; + m_AllRandomPedsThisType = -1; + ms_nNumCivFemale = 0; + PedDensityMultiplier = 1.0; + ms_nNumCop = 0; + bZoneChangeHasHappened = 0; + ms_nNumEmergency = 0; + m_CountDownToPedsAtStart = 2; + ms_nNumGang1 = 0; + ms_nTotalMissionPeds = 0; + ms_nNumGang2 = 0; + ms_nTotalPeds = 0; + ms_nNumGang3 = 0; + ms_nTotalGangPeds = 0; + ms_nNumGang4 = 0; + ms_nTotalCivPeds = 0; + ms_nNumGang5 = 0; + ms_nNumDummy = 0; + ms_nNumGang6 = 0; + ms_nNumGang9 = 0; + ms_nNumGang7 = 0; + ms_nNumGang8 = 0; + + LoadPedGroups(); + DealWithZoneChange(LEVEL_COMMERCIAL, LEVEL_INDUSTRIAL, true); + + debug("CPopulation ready\n"); +} + +void CPopulation::RemovePed(CEntity* ent) { CWorld::Remove(ent); delete ent; } + +STARTPATCHES +InjectHook(0x4F3770, CPopulation::Initialise, PATCH_JUMP); +ENDPATCHES
\ No newline at end of file diff --git a/src/control/Population.h b/src/control/Population.h index 7757a7a6..006e6104 100644 --- a/src/control/Population.h +++ b/src/control/Population.h @@ -19,7 +19,29 @@ public: static float &PedDensityMultiplier; static uint32 &ms_nTotalMissionPeds; static int32 &MaxNumberOfPedsInUse; + static uint32& ms_nNumCivMale; + static uint32 &ms_nNumCivFemale; + static uint32 &ms_nNumCop; + static bool &bZoneChangeHasHappened; + static uint32 &ms_nNumEmergency; + static uint32& m_CountDownToPedsAtStart; + static uint32& ms_nNumGang1; + static uint32& ms_nNumGang2; + static uint32& ms_nTotalPeds; + static uint32& ms_nNumGang3; + static uint32& ms_nTotalGangPeds; + static uint32& ms_nNumGang4; + static uint32& ms_nTotalCivPeds; + static uint32& ms_nNumGang5; + static uint32& ms_nNumDummy; + static uint32& ms_nNumGang6; + static uint32& ms_nNumGang9; + static uint32& ms_nNumGang7; + static uint32& ms_nNumGang8; + static void Initialise(); + static void Update(void); + static void LoadPedGroups(); static void UpdatePedCount(uint32, bool); static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool); static CPed *AddPedInCar(CVehicle *vehicle); diff --git a/src/control/Record.cpp b/src/control/Record.cpp index cff4a19b..802ca516 100644 --- a/src/control/Record.cpp +++ b/src/control/Record.cpp @@ -6,5 +6,8 @@ uint16 &CRecordDataForGame::RecordingState = *(uint16*)0x95CC24; uint8 &CRecordDataForChase::Status = *(uint8*)0x95CDCE; +WRAPPER void CRecordDataForGame::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0x4341F0); } + +WRAPPER void CRecordDataForChase::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0x4347F0); } WRAPPER void CRecordDataForChase::ProcessControlCars(void) { EAXJMP(0x435540); } WRAPPER void CRecordDataForChase::SaveOrRetrieveCarPositions(void) { EAXJMP(0x434B20); }
\ No newline at end of file diff --git a/src/control/Record.h b/src/control/Record.h index 08e9f7c8..9f396c96 100644 --- a/src/control/Record.h +++ b/src/control/Record.h @@ -11,6 +11,7 @@ class CRecordDataForChase public: static uint8 &Status; + static void SaveOrRetrieveDataForThisFrame(void); static void ProcessControlCars(void); static void SaveOrRetrieveCarPositions(void); }; @@ -20,4 +21,6 @@ class CRecordDataForGame { public: static uint16 &RecordingState; + + static void SaveOrRetrieveDataForThisFrame(void); }; diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 65ee2840..1bd1bf4b 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1036,7 +1036,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca bAllowLookAroundCam = true; bPlayingBackFromFile = false; OldRadioStation = DMAudio.GetRadioInCar(); - DMAudio.ChangeMusicMode(0); + DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); DMAudio.SetEffectsFadeVol(0); DMAudio.SetMusicFadeVol(0); int current; @@ -1156,7 +1156,7 @@ void CReplay::RestoreStuffFromMem(void) FindPlayerPed()->m_pWanted = new CWanted(PlayerWanted); /* Nice memory leak */ CWorld::Players[0] = PlayerInfo; int i = CPools::GetPedPool()->GetSize(); - while (i--){ + while (--i >= 0) { CPed* ped = CPools::GetPedPool()->GetSlot(i); if (!ped) continue; @@ -1174,7 +1174,7 @@ void CReplay::RestoreStuffFromMem(void) ped->AddWeaponModel(ped->m_wepModelID); } i = CPools::GetVehiclePool()->GetSize(); - while (i--){ + while (--i >= 0) { CVehicle* vehicle = CPools::GetVehiclePool()->GetSlot(i); if (!vehicle) continue; @@ -1233,7 +1233,7 @@ void CReplay::RestoreStuffFromMem(void) } PrintElementsInPtrList(); i = CPools::GetObjectPool()->GetSize(); - while (i--){ + while (--i >= 0) { CObject* object = CPools::GetObjectPool()->GetSlot(i); if (!object) continue; @@ -1248,7 +1248,7 @@ void CReplay::RestoreStuffFromMem(void) object->GetMatrix().AttachRW(RwFrameGetMatrix(RpAtomicGetFrame(object->m_rwObject)), false); } i = CPools::GetDummyPool()->GetSize(); - while (i--){ + while (--i >= 0) { CDummy* dummy = CPools::GetDummyPool()->GetSlot(i); if (!dummy) continue; @@ -1282,9 +1282,9 @@ void CReplay::RestoreStuffFromMem(void) } delete[] pPedAnims; pPedAnims = nil; - DMAudio.ChangeMusicMode(0); + DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); DMAudio.SetRadioInCar(OldRadioStation); - DMAudio.ChangeMusicMode(1); + DMAudio.ChangeMusicMode(MUSICMODE_GAME); } #endif @@ -1294,7 +1294,7 @@ WRAPPER void CReplay::EmptyPedsAndVehiclePools(void) { EAXJMP(0x5970E0); } void CReplay::EmptyPedsAndVehiclePools(void) { int i = CPools::GetVehiclePool()->GetSize(); - while (i--) { + while (--i >= 0) { CVehicle* v = CPools::GetVehiclePool()->GetSlot(i); if (!v) continue; @@ -1302,7 +1302,7 @@ void CReplay::EmptyPedsAndVehiclePools(void) delete v; } i = CPools::GetPedPool()->GetSize(); - while (i--) { + while (--i >= 0) { CPed* p = CPools::GetPedPool()->GetSlot(i); if (!p) continue; @@ -1319,7 +1319,7 @@ void CReplay::EmptyAllPools(void) { EmptyPedsAndVehiclePools(); int i = CPools::GetObjectPool()->GetSize(); - while (i--) { + while (--i >= 0) { CObject* o = CPools::GetObjectPool()->GetSlot(i); if (!o) continue; @@ -1327,7 +1327,7 @@ void CReplay::EmptyAllPools(void) delete o; } i = CPools::GetDummyPool()->GetSize(); - while (i--) { + while (--i >= 0) { CDummy* d = CPools::GetDummyPool()->GetSlot(i); if (!d) continue; @@ -1343,14 +1343,14 @@ WRAPPER void CReplay::MarkEverythingAsNew(void) { EAXJMP(0x597280); } void CReplay::MarkEverythingAsNew(void) { int i = CPools::GetVehiclePool()->GetSize(); - while (i--) { + while (--i >= 0) { CVehicle* v = CPools::GetVehiclePool()->GetSlot(i); if (!v) continue; v->bHasAlreadyBeenRecorded = false; } i = CPools::GetPedPool()->GetSize(); - while (i--) { + while (--i >= 0) { CPed* p = CPools::GetPedPool()->GetSlot(i); if (!p) continue; diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 3683ff28..ed092391 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -2,4 +2,6 @@ #include "patcher.h" #include "RoadBlocks.h" +WRAPPER void CRoadBlocks::Init(void) { EAXJMP(0x436F50); } WRAPPER void CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle*, int32, int16) { EAXJMP(0x4376A0); } +WRAPPER void CRoadBlocks::GenerateRoadBlocks(void) { EAXJMP(0x436FA0); }
\ No newline at end of file diff --git a/src/control/RoadBlocks.h b/src/control/RoadBlocks.h index 0d965e48..b1bb3589 100644 --- a/src/control/RoadBlocks.h +++ b/src/control/RoadBlocks.h @@ -6,5 +6,7 @@ class CVehicle; class CRoadBlocks { public: + static void Init(void); static void GenerateRoadBlockCopsForCar(CVehicle*, int32, int16); + static void GenerateRoadBlocks(void); }; diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp new file mode 100644 index 00000000..287b3c98 --- /dev/null +++ b/src/control/SceneEdit.cpp @@ -0,0 +1,5 @@ +#include "common.h" +#include "patcher.h" +#include "SceneEdit.h" + +WRAPPER void CSceneEdit::Update(void) { EAXJMP(0x585570); } diff --git a/src/control/SceneEdit.h b/src/control/SceneEdit.h new file mode 100644 index 00000000..f44b0011 --- /dev/null +++ b/src/control/SceneEdit.h @@ -0,0 +1,7 @@ +#pragma once + +class CSceneEdit +{ +public: + static void Update(void); +}; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 804a50c4..45fef232 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -670,12 +670,12 @@ void CRunningScript::Process() if (!CPad::GetPad(0)->GetCrossJustDown()) return; m_nWakeTime = 0; - for (int i = 0; i < 6; i++){ /* TODO: add constant for number of messages */ - if (CMessages::BIGMessages[i].m_Current.m_pText) - CMessages::BIGMessages[i].m_Current.m_nStartTime = 0; - if (CMessages::BriefMessages[0].m_pText) - CMessages::BriefMessages[0].m_nStartTime = 0; + for (int i = 0; i < NUMBIGMESSAGES; i++){ + if (CMessages::BIGMessages[i].m_Stack[0].m_pText != nil) + CMessages::BIGMessages[i].m_Stack[0].m_nStartTime = 0; } + if (CMessages::BriefMessages[0].m_pText != nil) + CMessages::BriefMessages[0].m_nStartTime = 0; } int8 CRunningScript::ProcessOneCommand() @@ -2191,7 +2191,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command) wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += 8; CollectParameters(&m_nIp, 2); - CMessages::AddMessage(key, ScriptParams[0], ScriptParams[1]); + CMessages::AddMessageSoon(key, ScriptParams[0], ScriptParams[1]); return 0; } case COMMAND_CLEAR_PRINTS: diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp index 61c941b8..2cd09a03 100644 --- a/src/control/TrafficLights.cpp +++ b/src/control/TrafficLights.cpp @@ -5,6 +5,7 @@ #include "Vehicle.h" WRAPPER void CTrafficLights::DisplayActualLight(CEntity *ent) { EAXJMP(0x455800); } +WRAPPER void CTrafficLights::ScanForLightsOnMap(void) { EAXJMP(0x454F40); } WRAPPER bool CTrafficLights::ShouldCarStopForLight(CVehicle*, bool) { EAXJMP(0x455350); } WRAPPER bool CTrafficLights::ShouldCarStopForBridge(CVehicle*) { EAXJMP(0x456460); } diff --git a/src/control/TrafficLights.h b/src/control/TrafficLights.h index f0d0248d..06505ed6 100644 --- a/src/control/TrafficLights.h +++ b/src/control/TrafficLights.h @@ -13,6 +13,7 @@ class CTrafficLights { public: static void DisplayActualLight(CEntity *ent); + static void ScanForLightsOnMap(void); static uint8 LightForPeds(void); static bool ShouldCarStopForLight(CVehicle*, bool); static bool ShouldCarStopForBridge(CVehicle*); diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index e3a586b2..6eef4d3d 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -22,6 +22,7 @@ WRAPPER void CControllerConfigManager::ClearSimButtonPressCheckers() { EAXJMP(0x WRAPPER void CControllerConfigManager::AffectPadFromKeyBoard() { EAXJMP(0x58D0C0); } WRAPPER void CControllerConfigManager::AffectPadFromMouse() { EAXJMP(0x58D1A0); } WRAPPER void CControllerConfigManager::ClearSettingsAssociatedWithAction(int, int) { EAXJMP(0x58EB40); } +WRAPPER void CControllerConfigManager::GetWideStringOfCommandKeys(uint16, wchar*, uint16) { EAXJMP(0x58F460); } void CControllerConfigManager::LoadSettings(int32 file) { diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h index b064a381..ab17577b 100644 --- a/src/core/ControllerConfig.h +++ b/src/core/ControllerConfig.h @@ -9,10 +9,64 @@ enum eControllerType OPTIONAL_EXTRA, MOUSE, JOYSTICK, + TOTAL_CONTROLLER_TYPES +}; + +enum e_ControllerAction
+{
+ PED_FIREWEAPON = 0,
+ PED_CYCLE_WEAPON_RIGHT,
+ PED_CYCLE_WEAPON_LEFT,
+ GO_FORWARD,
+ GO_BACK,
+ GO_LEFT,
+ GO_RIGHT,
+ PED_SNIPER_ZOOM_IN,
+ PED_SNIPER_ZOOM_OUT,
+ VEHICLE_ENTER_EXIT,
+ CAMERA_CHANGE_VIEW_ALL_SITUATIONS,
+ PED_JUMPING,
+ PED_SPRINT,
+ PED_LOOKBEHIND,
+ //PED_DUCK, // VC
+ //PED_ANSWER_PHONE, // VC
+ VEHICLE_ACCELERATE,
+ VEHICLE_BRAKE,
+ VEHICLE_CHANGE_RADIO_STATION,
+ VEHICLE_HORN,
+ TOGGLE_SUBMISSIONS,
+ VEHICLE_HANDBRAKE,
+ PED_1RST_PERSON_LOOK_LEFT,
+ PED_1RST_PERSON_LOOK_RIGHT,
+ VEHICLE_LOOKLEFT,
+ VEHICLE_LOOKRIGHT,
+ VEHICLE_LOOKBEHIND,
+ VEHICLE_TURRETLEFT,
+ VEHICLE_TURRETRIGHT,
+ VEHICLE_TURRETUP,
+ VEHICLE_TURRETDOWN,
+ PED_CYCLE_TARGET_LEFT,
+ PED_CYCLE_TARGET_RIGHT,
+ PED_CENTER_CAMERA_BEHIND_PLAYER,
+ PED_LOCK_TARGET,
+ NETWORK_TALK,
+ PED_1RST_PERSON_LOOK_UP,
+ PED_1RST_PERSON_LOOK_DOWN,
+
+ CONTROLLERACTION_36, // unk, unused?
+
+ TOGGLE_DPAD,
+ SWITCH_DEBUG_CAM_ON,
+ TAKE_SCREEN_SHOT,
+ SHOW_MOUSE_POINTER_TOGGLE,
+
+ TOTAL_CONTROL_ACTIONS
}; class CMouseControllerState; +#define ACTIONNAME_LENGTH 40 + class CControllerConfigManager { public: @@ -23,16 +77,13 @@ public: }; bool firstCapture; - char _pad0[3]; DIJOYSTATE2 m_OldState; DIJOYSTATE2 m_NewState; - wchar m_aActionNames[41][40]; + wchar m_aActionNames[TOTAL_CONTROL_ACTIONS][ACTIONNAME_LENGTH]; bool m_aButtonStates[17]; - char _pad1[3]; - tControllerConfigBind m_aSettings[41][4]; + tControllerConfigBind m_aSettings[TOTAL_CONTROL_ACTIONS][TOTAL_CONTROLLER_TYPES]; uint8 m_aSimCheckers[4][4]; bool m_bMouseAssociated; - char _pad2[3]; void UpdateJoyButtonState(int padnumber); void UpdateJoyInConfigMenus_ButtonDown(int button, int padnumber); @@ -52,6 +103,7 @@ public: void AffectPadFromMouse(); void ClearSettingsAssociatedWithAction(int, int); + void GetWideStringOfCommandKeys(uint16, wchar*, uint16); }; VALIDATE_SIZE(CControllerConfigManager, 0x143C); diff --git a/src/core/CutsceneMgr.cpp b/src/core/CutsceneMgr.cpp index 95abfcc9..f147e8c9 100644 --- a/src/core/CutsceneMgr.cpp +++ b/src/core/CutsceneMgr.cpp @@ -17,7 +17,6 @@ #include "RpAnimBlend.h" #include "ModelIndices.h" #include "TempColModels.h" -#include "MusicManager.h" const struct { const char *szTrackName; @@ -209,7 +208,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName) CFileMgr::CloseFile(file);
if (strcmpi(ms_cutsceneName, "end")) {
- DMAudio.ChangeMusicMode(2);
+ DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
int trackId = FindCutsceneAudioTrackId(szCutsceneName);
if (trackId != -1) {
printf("Start preload audio %s\n", szCutsceneName);
@@ -368,7 +367,7 @@ CCutsceneMgr::DeleteCutsceneData(void) if (strcmpi(ms_cutsceneName, "end")) {
DMAudio.StopCutSceneMusic();
if (strcmpi(ms_cutsceneName, "bet"))
- DMAudio.ChangeMusicMode(1);
+ DMAudio.ChangeMusicMode(MUSICMODE_GAME);
}
CTimer::Stop();
//TheCamera.GetScreenFadeStatus() == 2; // what for??
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index e9c06201..6f3b0971 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -25,6 +25,8 @@ #include "CdStream.h" #include "FileLoader.h" +WRAPPER void CFileLoader::ReloadPaths(const char *filename) { EAXJMP(0x476DB0); } + char CFileLoader::ms_line[256]; const char* diff --git a/src/core/FileLoader.h b/src/core/FileLoader.h index f9121ace..7ef96da3 100644 --- a/src/core/FileLoader.h +++ b/src/core/FileLoader.h @@ -9,7 +9,7 @@ public: static char *LoadLine(int fd); static RwTexDictionary *LoadTexDictionary(const char *filename); static void LoadCollisionFile(const char *filename); - static void LoadCollisionModel(uint8 *buf, CColModel &model, char *name); + static void LoadCollisionModel(uint8 *buf, struct CColModel &model, char *name); static void LoadModelFile(const char *filename); static RpAtomic *FindRelatedModelInfoCB(RpAtomic *atomic, void *data); static void LoadClumpFile(const char *filename); @@ -39,4 +39,6 @@ public: static void LoadPickup(const char *line); static void LoadMapZones(const char *filename); + + static void ReloadPaths(const char *filename); }; diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp index 2181f91c..0317ccbe 100644 --- a/src/core/Fire.cpp +++ b/src/core/Fire.cpp @@ -32,4 +32,5 @@ CFire* CFireManager::FindNearestFire(CVector vecPos, float* pDistance) } WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); } +WRAPPER void CFireManager::Update(void) { EAXJMP(0x479310); } WRAPPER CFire *CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); } diff --git a/src/core/Fire.h b/src/core/Fire.h index 5080fd89..c752b2a6 100644 --- a/src/core/Fire.h +++ b/src/core/Fire.h @@ -31,6 +31,7 @@ class CFireManager CFire m_aFires[NUM_FIRES]; public: void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32); + void Update(void); CFire *FindFurthestFire_NeverMindFireMen(CVector coors, float, float); CFire *FindNearestFire(CVector, float*); uint32 GetTotalActiveFires() const { return m_nTotalFires; } diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 0be25e8a..5f87049a 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -11,7 +11,6 @@ #include "Timer.h" #include "Game.h" #include "DMAudio.h" -#include "MusicManager.h" #include "FileMgr.h" #include "Streaming.h" #include "TxdStore.h" @@ -535,7 +534,7 @@ void CMenuManager::Draw() if (m_nPrefsAudio3DProviderIndex == -1) textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEA_NAH"); else { - char *provider = MusicManager.Get3DProviderName(m_nPrefsAudio3DProviderIndex); + char *provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex); AsciiToUnicode(provider, gUString); textToPrint[MENUCOLUMN_RIGHT] = gUString; } @@ -1086,7 +1085,7 @@ void CMenuManager::LoadAllTextures() { if (!m_bSpritesLoaded) { CMenuManager::CentreMousePointer(); - DMAudio.ChangeMusicMode(0); + DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0); m_nCurrOption = 0; m_PrefsRadioStation = DMAudio.GetRadioInCar(); @@ -2133,7 +2132,7 @@ WRAPPER void CMenuManager::RequestFrontEndShutdown() { EAXJMP(0x488750); } void CMenuManager::RequestFrontEndShutdown() { m_bShutDownFrontEndRequested = true; - DMAudio.ChangeMusicMode(1); + DMAudio.ChangeMusicMode(MUSICMODE_GAME); } #endif diff --git a/src/core/Game.cpp b/src/core/Game.cpp index b488a217..b2bac8dd 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -2,8 +2,60 @@ #include "patcher.h" #include "Game.h" #include "main.h" +#include "AccidentManager.h" +#include "Antennas.h" +#include "Bridge.h" +#include "Camera.h" +#include "CarCtrl.h" +#include "CarGen.h" #include "CdStream.h" +#include "Clock.h" +#include "Clouds.h" +#include "Collision.h" +#include "Coronas.h" +#include "Cranes.h" +#include "CutsceneMgr.h" +#include "Darkel.h" +#include "EventList.h" +#include "FileLoader.h" #include "FileMgr.h" +#include "Fire.h" +#include "Fluff.h" +#include "Font.h" +#include "Frontend.h" +#include "GameLogic.h" +#include "Garages.h" +#include "Glass.h" +#include "Heli.h" +#include "Pad.h" +#include "Particle.h" +#include "Phones.h" +#include "Pickups.h" +#include "Plane.h" +#include "Population.h" +#include "Record.h" +#include "Renderer.h" +#include "Replay.h" +#include "RoadBlocks.h" +#include "Rubbish.h" +#include "SceneEdit.h" +#include "Script.h" +#include "Shadows.h" +#include "Skidmarks.h" +#include "SpecialFX.h" +#include "Sprite2d.h" +#include "Streaming.h" +#include "TimeCycle.h" +#include "TrafficLights.h" +#include "Train.h" +#include "TxdStore.h" +#include "User.h" +#include "WaterCannon.h" +#include "Weapon.h" +#include "Weather.h" +#include "World.h" +#include "ZoneCull.h" +#include "Zones.h" eLevelName &CGame::currLevel = *(eLevelName*)0x941514; bool &CGame::bDemoMode = *(bool*)0x5F4DD0; @@ -25,14 +77,128 @@ CGame::InitialiseOnceBeforeRW(void) } WRAPPER void CGame::Initialise(const char *datFile) { EAXJMP(0x48BED0); } +#if 0 WRAPPER void CGame::Process(void) { EAXJMP(0x48C850); } +#else +extern void (*DebugMenuProcess)(void); +void CGame::Process(void) +{ + CPad::UpdatePads(); + TheCamera.SetMotionBlurAlpha(0); + if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL) + TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE); + + DebugMenuProcess(); + CCutsceneMgr::Update(); + if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused()) + FrontEndMenuManager.Process(); + CStreaming::Update(); + if (!CTimer::GetIsPaused()) + { + CTheZones::Update(); + CSprite2d::SetRecipNearClip(); + CSprite2d::InitPerFrame(); + CFont::InitPerFrame(); + CRecordDataForGame::SaveOrRetrieveDataForThisFrame(); + CRecordDataForChase::SaveOrRetrieveDataForThisFrame(); + CPad::DoCheats(); + CClock::Update(); + CWeather::Update(); + CTheScripts::Process(); + CCollision::Update(); + CTrain::UpdateTrains(); + CPlane::UpdatePlanes(); + CHeli::UpdateHelis(); + CDarkel::Update(); + CSkidmarks::Update(); + CAntennas::Update(); + CGlass::Update(); + CSceneEdit::Update(); + CEventList::Update(); + CParticle::Update(); + gFireManager.Update(); + CPopulation::Update(); + CWeapon::UpdateWeapons(); + if (!CCutsceneMgr::IsRunning()) + CTheCarGenerators::Process(); + if (!CReplay::IsPlayingBack()) + CCranes::UpdateCranes(); + CClouds::Update(); + CMovingThings::Update(); + CWaterCannons::Update(); + CUserDisplay::Process(); + CReplay::Update(); + CWorld::Process(); + gAccidentManager.Update(); + CPacManPickups::Update(); + CPickups::Update(); + CGarages::Update(); + CRubbish::Update(); + CSpecialFX::Update(); + CTimeCycle::Update(); + if (CReplay::ShouldStandardCameraBeProcessed()) + TheCamera.Process(); + CCullZones::Update(); + if (!CReplay::IsPlayingBack()) + CGameLogic::Update(); + CBridge::Update(); + CCoronas::DoSunAndMoon(); + CCoronas::Update(); + CShadows::UpdateStaticShadows(); + CShadows::UpdatePermanentShadows(); + gPhoneInfo.Update(); + if (!CReplay::IsPlayingBack()) + { + CCarCtrl::GenerateRandomCars(); + CRoadBlocks::GenerateRoadBlocks(); + CCarCtrl::RemoveDistantCars(); + } + } +} +#endif +void CGame::ReloadIPLs(void) +{ + CTimer::Stop(); + CWorld::RemoveStaticObjects(); + ThePaths.Init(); + CCullZones::Init(); + CFileLoader::ReloadPaths("GTA3.IDE"); + CFileLoader::LoadScene("INDUST.IPL"); + CFileLoader::LoadScene("COMMER.IPL"); + CFileLoader::LoadScene("SUBURBAN.IPL"); + CFileLoader::LoadScene("CULL.IPL"); + ThePaths.PreparePathData(); + CTrafficLights::ScanForLightsOnMap(); + CRoadBlocks::Init(); + CCranes::InitCranes(); + CGarages::Init(); + CWorld::RepositionCertainDynamicObjects(); + CCullZones::ResolveVisibilities(); + CRenderer::SortBIGBuildings(); + CTimer::Update(); +} +#if 0 +WRAPPER void CGame::FinalShutdown(void) { EAXJMP(0x48BEC0); } +#else +void +CGame::FinalShutdown(void) +{ + CTxdStore::Shutdown(); + CPedStats::Shutdown(); + CdStreamShutdown(); +} +#endif WRAPPER bool CGame::InitialiseRenderWare(void) { EAXJMP(0x48BBA0); } WRAPPER void CGame::ShutdownRenderWare(void) { EAXJMP(0x48BCB0); } -WRAPPER void CGame::FinalShutdown(void) { EAXJMP(0x48BEC0); } WRAPPER void CGame::ShutDown(void) { EAXJMP(0x48C3A0); } WRAPPER void CGame::ShutDownForRestart(void) { EAXJMP(0x48C6B0); } WRAPPER void CGame::InitialiseWhenRestarting(void) { EAXJMP(0x48C740); } WRAPPER bool CGame::InitialiseOnceAfterRW(void) { EAXJMP(0x48BD50); } + +STARTPATCHES + InjectHook(0x48C850, CGame::Process, PATCH_JUMP); + InjectHook(0x48BEC0, CGame::FinalShutdown, PATCH_JUMP); +ENDPATCHES diff --git a/src/core/Game.h b/src/core/Game.h index 3bc3e633..dca38bdb 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -30,6 +30,7 @@ public: static void FinalShutdown(void); static void ShutDownForRestart(void); static void Process(void); + static void ReloadIPLs(void); // NB: these do something on PS2 static void TidyUpMemory(bool, bool) {} diff --git a/src/core/Lists.h b/src/core/Lists.h index 7572e882..ecf24740 100644 --- a/src/core/Lists.h +++ b/src/core/Lists.h @@ -1,5 +1,7 @@ #pragma once +#include "common.h" + class CPtrNode { public: diff --git a/src/core/Messages.cpp b/src/core/Messages.cpp deleted file mode 100644 index e0ab751a..00000000 --- a/src/core/Messages.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "common.h" -#include "patcher.h" -#include "Messages.h" - -WRAPPER void CMessages::Display(void) { EAXJMP(0x529800); } -WRAPPER void CMessages::ClearAllMessagesDisplayedByGame(void) { EAXJMP(0x52B670); } -WRAPPER int CMessages::WideStringCopy(wchar* dst, wchar* src, unsigned short size) { EAXJMP(0x5294B0); } -WRAPPER char CMessages::WideStringCompare(wchar* str1, wchar* str2, unsigned short size) { EAXJMP(0x529510); } -WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); } -WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); } -WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); } -WRAPPER void CMessages::AddBigMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529EB0); } -WRAPPER void CMessages::AddBigMessageQ(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529F60); } -WRAPPER void CMessages::AddBigMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52AD10); } -WRAPPER void CMessages::AddBigMessageWithNumberQ(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52AE00); } -WRAPPER void CMessages::AddMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529900); } -WRAPPER void CMessages::AddMessageJumpQ(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529A10); } -WRAPPER void CMessages::AddMessageSoon(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529AF0); } -WRAPPER void CMessages::AddMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52A850); } -WRAPPER void CMessages::AddMessageJumpQWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52A9A0); } -WRAPPER void CMessages::AddMessageSoonWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52AAC0); } -WRAPPER void CMessages::ClearMessages() { EAXJMP(0x529CE0); } -WRAPPER void CMessages::Init() { EAXJMP(0x529310); } -WRAPPER void CMessages::Process() { EAXJMP(0x529580); } -tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08; -tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0; -tBigMessage *CMessages::BIGMessages = (tBigMessage *)0x773628; diff --git a/src/core/Messages.h b/src/core/Messages.h deleted file mode 100644 index c584beed..00000000 --- a/src/core/Messages.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -struct tMessage -{ - wchar *m_pText; - uint16 m_nFlag; -private: - int8 _pad6[2]; -public: - uint32 m_nTime; - uint32 m_nStartTime; - int32 m_nNumber[6]; - wchar *m_pString; -}; - -struct tBigMessage -{ - tMessage m_Current; - tMessage m_Stack[3]; -}; - -struct tPreviousBrief -{ - wchar *m_pText; - int32 m_nNumber[6]; - wchar *m_pString; -}; - -class CMessages -{ -public: - static tPreviousBrief *PreviousBriefs; - static tMessage *BriefMessages; - static tBigMessage *BIGMessages; - -public: - static void Display(void); - static void ClearAllMessagesDisplayedByGame(void); - static int WideStringCopy(wchar* dst, wchar* src, unsigned short size); - static char WideStringCompare(wchar* str1, wchar* str2, unsigned short size); - static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst); - static void InsertPlayerControlKeysInString(wchar* src); - static int GetWideStringLength(wchar *src); - static void AddBigMessage(wchar* key, uint32 time, uint16 pos); - static void AddBigMessageQ(wchar* key, uint32 time, uint16 pos); - static void AddBigMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void AddBigMessageWithNumberQ(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void AddMessage(wchar* key, uint32 time, uint16 pos); - static void AddMessageJumpQ(wchar* key, uint32 time, uint16 pos); - static void AddMessageSoon(wchar* key, uint32 time, uint16 pos); - static void AddMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void AddMessageJumpQWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void AddMessageSoonWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void ClearMessages(); - static void Init(); - static void Process(); -}; diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 847fa753..8e66b049 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -1,6 +1,8 @@ #include "common.h" #include "patcher.h" #include "Pools.h" +#include "World.h" +#include "ProjectileInfo.h" CCPtrNodePool *&CPools::ms_pPtrNodePool = *(CCPtrNodePool**)0x943044; CEntryInfoNodePool *&CPools::ms_pEntryInfoNodePool = *(CEntryInfoNodePool**)0x941448; @@ -12,15 +14,9 @@ CObjectPool *&CPools::ms_pObjectPool = *(CObjectPool**)0x880E28; CDummyPool *&CPools::ms_pDummyPool = *(CDummyPool**)0x8F2C18; CAudioScriptObjectPool *&CPools::ms_pAudioScriptObjectPool = *(CAudioScriptObjectPool**)0x8F1B6C; -WRAPPER void CPools::Initialise(void) { EAXJMP(0x4A1770); } -WRAPPER void CPools::MakeSureSlotInObjectPoolIsEmpty(int32 handle) { EAXJMP(0x4A2DB0); } - -#if 0 void CPools::Initialise(void) { - // TODO: unused right now - assert(0); ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES); ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS); ms_pPedPool = new CPedPool(NUMPEDS); @@ -31,7 +27,33 @@ CPools::Initialise(void) ms_pDummyPool = new CDummyPool(NUMDUMMIES); ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS); } -#endif + +void +CPools::ShutDown(void) +{
+ debug("PtrNodes left %d\n", ms_pPtrNodePool->GetNoOfUsedSpaces());
+ debug("EntryInfoNodes left %d\n", ms_pEntryInfoNodePool->GetNoOfUsedSpaces());
+ debug("Peds left %d\n", ms_pPedPool->GetNoOfUsedSpaces());
+ debug("Vehicles left %d\n", ms_pVehiclePool->GetNoOfUsedSpaces());
+ debug("Buildings left %d\n", ms_pBuildingPool->GetNoOfUsedSpaces());
+ debug("Treadables left %d\n", ms_pTreadablePool->GetNoOfUsedSpaces());
+ debug("Objects left %d\n", ms_pObjectPool->GetNoOfUsedSpaces());
+ debug("Dummys left %d\n", ms_pDummyPool->GetNoOfUsedSpaces());
+ debug("AudioScriptObjects left %d\n", ms_pAudioScriptObjectPool->GetNoOfUsedSpaces());
+ printf("Shutdown pool started\n"); + + delete ms_pPtrNodePool; + delete ms_pEntryInfoNodePool; + delete ms_pPedPool; + delete ms_pVehiclePool; + delete ms_pBuildingPool; + delete ms_pTreadablePool; + delete ms_pObjectPool; + delete ms_pDummyPool; + delete ms_pAudioScriptObjectPool; + + printf("Shutdown pool done\n"); +} int32 CPools::GetPedRef(CPed *ped) { return ms_pPedPool->GetIndex(ped); } CPed *CPools::GetPed(int32 handle) { return ms_pPedPool->GetAt(handle); } @@ -39,3 +61,47 @@ int32 CPools::GetVehicleRef(CVehicle *vehicle) { return ms_pVehiclePool->GetInde CVehicle *CPools::GetVehicle(int32 handle) { return ms_pVehiclePool->GetAt(handle); } int32 CPools::GetObjectRef(CObject *object) { return ms_pObjectPool->GetIndex(object); } CObject *CPools::GetObject(int32 handle) { return ms_pObjectPool->GetAt(handle); } + +void
+CPools::CheckPoolsEmpty()
+{
+ assert(ms_pPedPool->GetNoOfUsedSpaces() == 0);
+ assert(ms_pVehiclePool->GetNoOfUsedSpaces() == 0);
+ printf("pools have beem cleared \n");
+} + + +void +CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot) +{ + if (ms_pObjectPool->IsFreeSlot(slot)) return; + + CObject *object = ms_pObjectPool->GetSlot(slot); + if (object->ObjectCreatedBy == TEMP_OBJECT) { + CWorld::Remove(object); + delete object; + } else if (!CProjectileInfo::RemoveIfThisIsAProjectile(object)) { + // relocate to another slot?? + CObject *newObject = new CObject(); + CWorld::Remove(object); + memcpy(newObject, object, ms_pObjectPool->GetMaxEntrySize()); + CWorld::Add(newObject); + object->m_rwObject = nil; + delete object; + newObject->m_pFirstReference = nil; + } +} + + +STARTPATCHES + InjectHook(0x4A1770, CPools::Initialise, PATCH_JUMP); + InjectHook(0x4A1880, CPools::ShutDown, PATCH_JUMP); + InjectHook(0x4A1A50, CPools::CheckPoolsEmpty, PATCH_JUMP); + InjectHook(0x4A1A80, CPools::GetPedRef, PATCH_JUMP); + InjectHook(0x4A1AA0, CPools::GetPed, PATCH_JUMP); + InjectHook(0x4A1AC0, CPools::GetVehicleRef, PATCH_JUMP); + InjectHook(0x4A1AE0, CPools::GetVehicle, PATCH_JUMP); + InjectHook(0x4A1B00, CPools::GetObjectRef, PATCH_JUMP); + InjectHook(0x4A1B20, CPools::GetObject, PATCH_JUMP); + InjectHook(0x4A2DB0, CPools::MakeSureSlotInObjectPoolIsEmpty, PATCH_JUMP); +ENDPATCHES diff --git a/src/core/Pools.h b/src/core/Pools.h index 4e6bd547..770a1de1 100644 --- a/src/core/Pools.h +++ b/src/core/Pools.h @@ -43,11 +43,13 @@ public: static CAudioScriptObjectPool *GetAudioScriptObjectPool(void) { return ms_pAudioScriptObjectPool; } static void Initialise(void); + static void ShutDown(void); static int32 GetPedRef(CPed *ped); static CPed *GetPed(int32 handle); static int32 GetVehicleRef(CVehicle *vehicle); static CVehicle *GetVehicle(int32 handle); static int32 GetObjectRef(CObject *object); static CObject *GetObject(int32 handle); - static void MakeSureSlotInObjectPoolIsEmpty(int32 handle); + static void CheckPoolsEmpty(); + static void MakeSureSlotInObjectPoolIsEmpty(int32 slot); }; diff --git a/src/core/RwTexRead.cpp b/src/core/RwTexRead.cpp index a1a7050a..6b717b34 100644 --- a/src/core/RwTexRead.cpp +++ b/src/core/RwTexRead.cpp @@ -1,5 +1,15 @@ +#pragma warning( push ) +#pragma warning( disable : 4005) +#define DIRECTINPUT_VERSION 0x0800 +#include <dinput.h> +#pragma warning( pop ) #include "common.h" +#include "win.h" #include "patcher.h" +#include "Timer.h" + +float &texLoadTime = *(float*)0x8F1B50; +int32 &texNumLoaded = *(int32*)0x8F252C; RwTexture* RwTextureGtaStreamRead(RwStream *stream) @@ -10,11 +20,15 @@ RwTextureGtaStreamRead(RwStream *stream) if(!RwStreamFindChunk(stream, rwID_TEXTURENATIVE, &size, &version)) return nil; - // TODO: unused timing + float preloadTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); if(!RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, &tex, size))) return nil; - + + if (gGameState == GS_INIT_PLAYING_GAME) { + texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1); + texNumLoaded++; + } return tex; } diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index d9dc8628..69e14869 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -226,7 +226,7 @@ CStreaming::Init(void) CModelInfo::GetModelInfo("IslandLODsubIND", &islandLODsubInd); CModelInfo::GetModelInfo("IslandLODsubCOM", &islandLODsubCom); - for(i = 0; i < CPools::GetBuildingPool()->GetSize(); i++){ + for(i = CPools::GetBuildingPool()->GetSize()-1; i >= 0; i--){ CBuilding *building = CPools::GetBuildingPool()->GetSlot(i); if(building == nil) continue; @@ -682,8 +682,8 @@ CStreaming::RequestBigBuildings(eLevelName level) int i, n; CBuilding *b; - n = CPools::GetBuildingPool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetBuildingPool()->GetSize()-1; + for(i = n; i >= 0; i--){ b = CPools::GetBuildingPool()->GetSlot(i); if(b && b->bIsBIGBuilding && b->m_level == level) RequestModel(b->GetModelIndex(), STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_PRIORITY); @@ -837,8 +837,8 @@ CStreaming::RemoveBuildings(eLevelName level) CEntity *e; CBaseModelInfo *mi; - n = CPools::GetBuildingPool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetBuildingPool()->GetSize()-1; + for(i = n; i >= 0; i--){ e = CPools::GetBuildingPool()->GetSlot(i); if(e && e->m_level == level){ mi = CModelInfo::GetModelInfo(e->GetModelIndex()); @@ -850,8 +850,8 @@ CStreaming::RemoveBuildings(eLevelName level) } } - n = CPools::GetTreadablePool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetTreadablePool()->GetSize()-1; + for(i = n; i >= 0; i--){ e = CPools::GetTreadablePool()->GetSlot(i); if(e && e->m_level == level){ mi = CModelInfo::GetModelInfo(e->GetModelIndex()); @@ -863,8 +863,8 @@ CStreaming::RemoveBuildings(eLevelName level) } } - n = CPools::GetObjectPool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetObjectPool()->GetSize()-1; + for(i = n; i >= 0; i--){ e = CPools::GetObjectPool()->GetSlot(i); if(e && e->m_level == level){ mi = CModelInfo::GetModelInfo(e->GetModelIndex()); @@ -876,8 +876,8 @@ CStreaming::RemoveBuildings(eLevelName level) } } - n = CPools::GetDummyPool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetDummyPool()->GetSize()-1; + for(i = n; i >= 0; i--){ e = CPools::GetDummyPool()->GetSlot(i); if(e && e->m_level == level){ mi = CModelInfo::GetModelInfo(e->GetModelIndex()); @@ -951,8 +951,8 @@ CStreaming::RemoveBigBuildings(eLevelName level) CEntity *e; CBaseModelInfo *mi; - n = CPools::GetBuildingPool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetBuildingPool()->GetSize()-1; + for(i = n; i >= 0; i--){ e = CPools::GetBuildingPool()->GetSlot(i); if(e && e->bIsBIGBuilding && e->m_level == level){ mi = CModelInfo::GetModelInfo(e->GetModelIndex()); @@ -1172,8 +1172,8 @@ CStreaming::HaveAllBigBuildingsLoaded(eLevelName level) return; } - n = CPools::GetBuildingPool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetBuildingPool()->GetSize()-1; + for(i = n; i >= 0; i--){ e = CPools::GetBuildingPool()->GetSlot(i); if(e && e->bIsBIGBuilding && e->m_level == level && ms_aInfoForModel[e->GetModelIndex()].m_loadState != STREAMSTATE_LOADED) diff --git a/src/core/User.cpp b/src/core/User.cpp index 6702b467..600fa443 100644 --- a/src/core/User.cpp +++ b/src/core/User.cpp @@ -13,8 +13,7 @@ COnscreenTimer& CUserDisplay::OnscnTimer = *(COnscreenTimer*)0x862238; CPager& CUserDisplay::Pager = *(CPager*)0x8F2744; CCurrentVehicle& CUserDisplay::CurrentVehicle = *(CCurrentVehicle*)0x8F5FE8; -WRAPPER void CPager::AddMessage(wchar*, uint16, uint16, uint16) { EAXJMP(0x52B940); } -WRAPPER void CPager::AddMessageWithNumber(wchar*, int, int, int, int, int, uint16, uint16, uint16) { EAXJMP(0x52BB50); } +WRAPPER void CUserDisplay::Process(void) { EAXJMP(0x4AD690); } void COnscreenTimer::Init() { m_bDisabled = false; diff --git a/src/core/User.h b/src/core/User.h index ac6d454b..90b2da55 100644 --- a/src/core/User.h +++ b/src/core/User.h @@ -1,5 +1,7 @@ #pragma once +#include "Pager.h" + class COnscreenTimerEntry { public: @@ -50,13 +52,6 @@ class CCurrentVehicle { }; -class CPager -{ -public: - void AddMessage(wchar*, uint16, uint16, uint16); - void AddMessageWithNumber(wchar*, int, int, int, int, int, uint16, uint16, uint16); -}; - class CUserDisplay { public: @@ -64,4 +59,6 @@ public: static COnscreenTimer &OnscnTimer; static CPager &Pager; static CCurrentVehicle &CurrentVehicle; + + static void Process(void); }; diff --git a/src/core/World.cpp b/src/core/World.cpp index fc54caf9..ae0d67cc 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -39,6 +39,8 @@ bool &CWorld::bDoingCarCollisions = *(bool*)0x95CD8C; bool &CWorld::bIncludeCarTyres = *(bool*)0x95CDAA; WRAPPER void CWorld::ShutDown(void) { EAXJMP(0x4AE450); } +WRAPPER void CWorld::RepositionCertainDynamicObjects() { EAXJMP(0x4B42B0); } +WRAPPER void CWorld::RemoveStaticObjects() { EAXJMP(0x4B4D50); } WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); } WRAPPER void CWorld::FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool){ EAXJMP(0x4B2A30); } WRAPPER void CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8) { EAXJMP(0x4B4E70) }; diff --git a/src/core/World.h b/src/core/World.h index c61daccc..3b04403e 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -124,6 +124,8 @@ public: static void Initialise(); static void ShutDown(); + static void RepositionCertainDynamicObjects(); + static void RemoveStaticObjects(); static void Process(); }; diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index dc162147..6d33a1cf 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -169,22 +169,22 @@ CCullZones::MarkSubwayAsInvisible(bool visible) CEntity *e; CVehicle *v; - n = CPools::GetBuildingPool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetBuildingPool()->GetSize()-1; + for(i = n; i >= 0; i--){ e = CPools::GetBuildingPool()->GetSlot(i); if(e && e->bIsSubway) e->bIsVisible = visible; } - n = CPools::GetTreadablePool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetTreadablePool()->GetSize()-1; + for(i = n; i >= 0; i--){ e = CPools::GetTreadablePool()->GetSlot(i); if(e && e->bIsSubway) e->bIsVisible = visible; } - n = CPools::GetVehiclePool()->GetSize(); - for(i = 0; i < n; i++){ + n = CPools::GetVehiclePool()->GetSize()-1; + for(i = n; i >= 0; i--){ v = CPools::GetVehiclePool()->GetSlot(i); if(v && v->IsTrain() && ((CTrain*)v)->m_nTrackId != TRACK_ELTRAIN) v->bIsVisible = visible; diff --git a/src/core/common.h b/src/core/common.h index 920b7108..a538ddb6 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -121,7 +121,7 @@ public: CRGBA(void) { } CRGBA(uint8 r, uint8 g, uint8 b, uint8 a) : r(r), g(g), b(b), a(a) { } - CRGBA &CRGBA::operator =(const CRGBA &right) + CRGBA &operator =(const CRGBA &right) { this->r = right.r; this->g = right.g; @@ -142,7 +142,7 @@ public: return rwRGBA; } - CRGBA &CRGBA::operator =(const RwRGBA &right) + CRGBA &operator =(const RwRGBA &right) { this->r = right.red; this->g = right.green; @@ -197,8 +197,6 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) #define BIT(num) (1<<(num)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) -#define min(a, b) (((a) < (b)) ? (a) : (b)) #define ABS(a) (((a) < 0) ? (-(a)) : (a)) #define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min))))) @@ -337,7 +335,7 @@ inline void SkipSaveBuf(uint8 *&buf, int32 skip) template<typename T> inline const T ReadSaveBuf(uint8 *&buf) -{
+{ T &value = *(T*)buf; SkipSaveBuf(buf, sizeof(T)); return value; @@ -345,8 +343,8 @@ inline const T ReadSaveBuf(uint8 *&buf) template<typename T> inline T *WriteSaveBuf(uint8 *&buf, const T &value) -{
- T *p = (T*)buf;
+{ + T *p = (T*)buf; *p = value; SkipSaveBuf(buf, sizeof(T)); return p; @@ -355,11 +353,11 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value) #define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32)) -#define WriteSaveHeader(buf,a,b,c,d,size) \
- WriteSaveBuf(buf, a);\
- WriteSaveBuf(buf, b);\
- WriteSaveBuf(buf, c);\
- WriteSaveBuf(buf, d);\
+#define WriteSaveHeader(buf,a,b,c,d,size) \ + WriteSaveBuf(buf, a);\ + WriteSaveBuf(buf, b);\ + WriteSaveBuf(buf, c);\ + WriteSaveBuf(buf, d);\ WriteSaveBuf(buf, size); #define CheckSaveHeader(buf,a,b,c,d,size)\ diff --git a/src/core/config.h b/src/core/config.h index 08ddd007..12cb7be8 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -67,6 +67,7 @@ enum Config { NUMANTENNAS = 8, NUMCORONAS = 56, NUMPOINTLIGHTS = 32, + NUM3DMARKERS = 32, NUMMONEYMESSAGES = 16, NUMPICKUPMESSAGES = 16, diff --git a/src/core/re3.cpp b/src/core/re3.cpp index c8b50d55..62e9a040 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -18,6 +18,7 @@ #include "Automobile.h" #include "Ped.h" #include "debugmenu_public.h" +#include "Particle.h" #include <vector> #include <list> @@ -352,6 +353,7 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou); #ifndef MASTER DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil); + DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil); #endif DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start); diff --git a/src/core/templates.h b/src/core/templates.h index ef2db33a..f785d647 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -44,7 +44,20 @@ public: m_flags[i].free = 1; } } - int GetSize(void) { return m_size; } + ~CPool() { + Flush(); + } + void Flush() { + if (m_size > 0) { + free(m_entries); + free(m_flags); + m_entries = nil; + m_flags = nil; + m_size = 0; + m_allocPtr = 0; + } + } + int GetSize(void) const { return m_size; } T *New(void){ bool wrapped = false; do @@ -101,12 +114,14 @@ public: n++; return n; } + bool IsFreeSlot(int i) { return !!m_flags[i].free; } void ClearStorage(uint8 *&flags, U *&entries){ free(flags); free(entries); flags = nil; entries = nil; } + uint32 GetMaxEntrySize() const { return sizeof(U); } void CopyBack(uint8 *&flags, U *&entries){ memcpy(m_flags, flags, sizeof(uint8)*m_size); memcpy(m_entries, entries, sizeof(U)*m_size); diff --git a/src/math/Matrix.h b/src/math/Matrix.h index b4a866a0..96f56a0f 100644 --- a/src/math/Matrix.h +++ b/src/math/Matrix.h @@ -127,20 +127,14 @@ public: } void Scale(float scale) { - // GTA treats this as 4x4 floats - m_matrix.right.x *= scale; - m_matrix.right.y *= scale; - m_matrix.right.z *= scale; - m_matrix.up.x *= scale; - m_matrix.up.y *= scale; - m_matrix.up.z *= scale; - m_matrix.at.x *= scale; - m_matrix.at.y *= scale; - m_matrix.at.z *= scale; - m_matrix.pos.x *= scale; - m_matrix.pos.y *= scale; - m_matrix.pos.z *= scale; - m_matrix.flags = 0; + float *pFloatMatrix = (float*)&m_matrix; + for (int i = 0; i < 3; i++) +#ifdef FIX_BUGS // BUGFIX from VC + for (int j = 0; j < 3; j++) +#else + for (int j = 0; j < 4; j++) +#endif + pFloatMatrix[i * 4 + j] *= scale; } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index b0dc96cf..17c79209 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -45,7 +45,6 @@ #include "CarAI.h" #include "Zones.h" #include "Cranes.h" -#include "MusicManager.h" #include "Timecycle.h" #include "ParticleObject.h" #include "Floater.h" @@ -59,7 +58,6 @@ WRAPPER void CPed::UpdatePosition(void) { EAXJMP(0x4C7A00); } WRAPPER void CPed::WanderPath(void) { EAXJMP(0x4D28D0); } WRAPPER void CPed::SeekCar(void) { EAXJMP(0x4D3F90); } WRAPPER void CPed::UpdateFromLeader(void) { EAXJMP(0x4D8F30); } -WRAPPER int CPed::ScanForThreats(void) { EAXJMP(0x4C5FE0); } WRAPPER void CPed::SetEnterCar_AllClear(CVehicle*, uint32, uint32) { EAXJMP(0x4E0A40); } WRAPPER bool CPed::WarpPedToNearEntityOffScreen(CEntity*) { EAXJMP(0x4E5570); } WRAPPER void CPed::SetObjective(eObjective, CVector) { EAXJMP(0x4D8A90); } @@ -3245,7 +3243,7 @@ CPed::CheckForGunShots(void) int event; if (CEventList::FindClosestEvent(EVENT_GUNSHOT, GetPosition(), &event)) { if (gaEvent[event].entityType == EVENT_ENTITY_PED) { - // Is that a bug?!? (same on VC) + // Probably due to we don't want peds to go gunshot area? (same on VC) m_ped_flagD2 = false; return CPools::GetPed(gaEvent[event].entityRef); } @@ -12357,7 +12355,7 @@ CPed::ProcessObjective(void) SetLookTimer(CGeneral::GetRandomNumberInRange(500, 1500)); // Second condition is pointless and isn't there in Mobile. - if (threatType == 0x100000 || (threatType == 0x800000 && m_threatEntity) || m_threatEntity) { + if (threatType == PED_FLAG_GUN || (threatType == PED_FLAG_EXPLOSION && m_threatEntity) || m_threatEntity) { if (m_threatEntity->IsPed()) SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity); } @@ -15236,6 +15234,346 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) } } +void +CPed::ScanForInterestingStuff(void) +{ + if (!IsPedInControl()) + return; + + if (m_objective != OBJECTIVE_NONE) + return; + + if (CharCreatedBy == MISSION_CHAR) + return; + + LookForSexyPeds(); + LookForSexyCars(); + if (LookForInterestingNodes()) + return; + + if (m_nPedType == PEDTYPE_CRIMINAL && m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) { + if (CGeneral::GetRandomNumber() % 100 >= 10) { + if (m_objective != OBJECTIVE_MUG_CHAR && !(CGeneral::GetRandomNumber() & 7)) { + CPed *charToMug = nil; + for (int i = 0; i < m_numNearPeds; ++i) { + CPed *nearPed = m_nearPeds[i]; + + if ((nearPed->GetPosition() - GetPosition()).MagnitudeSqr() > 49.0f) + break; + + if ((nearPed->m_nPedType == PEDTYPE_CIVFEMALE || nearPed->m_nPedType == PEDTYPE_CIVMALE + || nearPed->m_nPedType == PEDTYPE_CRIMINAL || nearPed->m_nPedType == PEDTYPE_UNUSED1 + || nearPed->m_nPedType == PEDTYPE_PROSTITUTE) + && nearPed->CharCreatedBy != MISSION_CHAR + && nearPed->IsPedShootable() + && nearPed->m_objective != OBJECTIVE_MUG_CHAR) { + charToMug = nearPed; + break; + } + } + if (charToMug) + SetObjective(OBJECTIVE_MUG_CHAR, charToMug); + + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; + } + } else { + int mostExpensiveVehAround = -1; + int bestMonetaryValue = 0; + + CVector pos = GetPosition(); + int16 lastVehicle; + CEntity *vehicles[8]; + CWorld::FindObjectsInRange(pos, 10.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false); + + for (int i = 0; i < lastVehicle; i++) { + CVehicle* veh = (CVehicle*)vehicles[i]; + + if (veh->VehicleCreatedBy != MISSION_VEHICLE) { + if (veh->m_vecMoveSpeed.Magnitude() <= 0.1f && veh->IsVehicleNormal() + && veh->IsCar() && bestMonetaryValue < veh->pHandling->nMonetaryValue) { + mostExpensiveVehAround = i; + bestMonetaryValue = veh->pHandling->nMonetaryValue; + } + } + } + if (bestMonetaryValue > 2000 && mostExpensiveVehAround != -1 && vehicles[mostExpensiveVehAround]) { + SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, vehicles[mostExpensiveVehAround]); + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; + return; + } + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; + } + } + + if (m_nPedState == PEDTYPE_CIVFEMALE) { +#ifndef VC_PED_PORTS + if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { + + // += 2 is weird + for (int i = 0; i < m_numNearPeds; i += 2) { + if (m_nearPeds[i]->m_nPedState == PED_WANDER_PATH && WillChat(m_nearPeds[i])) { + if (CGeneral::GetRandomNumberInRange(0, 100) >= 100) + m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; + else { + if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() >= 1.8f) { + m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; + } else if (CanSeeEntity(m_nearPeds[i], DEGTORAD(60.0f))) { + int time = CGeneral::GetRandomNumber() % 4000 + 10000; + SetChat(m_nearPeds[i], time); + m_nearPeds[i]->SetChat(this, time); + return; + } + } + } + } + } +#else + if (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) >= 0.5f) { + m_standardTimer = CTimer::GetTimeInMilliseconds() + 200; + } else { + if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { + for (int i = 0; i < m_numNearPeds; i ++) { + if (m_nearPeds[i]->m_nPedState == PED_WANDER_PATH) { + if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() < 1.8f + && CanSeeEntity(m_nearPeds[i], DEGTORAD(60.0f) + && m_nearPeds[i]->CanSeeEntity(this, DEGTORAD(60.0f))) + && WillChat(m_nearPeds[i])) { + + int time = CGeneral::GetRandomNumber() % 4000 + 10000; + SetChat(m_nearPeds[i], time); + m_nearPeds[i]->SetChat(this, time); + return; + } + } + } + } + } +#endif + } + + // Parts below aren't there in VC, they're in somewhere else. + if (!CGame::noProstitutes && m_nPedType == PEDTYPE_PROSTITUTE && CharCreatedBy != MISSION_CHAR + && m_objectiveTimer < CTimer::GetTimeInMilliseconds() && !CTheScripts::IsPlayerOnAMission()) { + + CVector pos = GetPosition(); + int16 lastVehicle; + CEntity* vehicles[8]; + CWorld::FindObjectsInRange(pos, 15.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false); + + for (int i = 0; i < lastVehicle; i++) { + CVehicle* veh = (CVehicle*)vehicles[i]; + + if (veh->IsVehicleNormal()) { + if (veh->IsCar()) { + if ((GetPosition() - veh->GetPosition()).Magnitude() < 5.0f && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, nil)) { + SetObjective(OBJECTIVE_SOLICIT, veh); + Say(SOUND_PED_SOLICIT); + return; + } + } + } + } + } + if (m_nPedType == PEDTYPE_CIVMALE || m_nPedType == PEDTYPE_CIVFEMALE) { + CVector pos = GetPosition(); + int16 lastVehicle; + CEntity* vehicles[8]; + CWorld::FindObjectsInRange(pos, 15.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false); + + for (int i = 0; i < lastVehicle; i++) { + CVehicle* veh = (CVehicle*)vehicles[i]; + + if (veh->m_modelIndex == MI_MRWHOOP) { + if (veh->m_status != STATUS_ABANDONED && veh->m_status != STATUS_WRECKED) { + if ((GetPosition() - veh->GetPosition()).Magnitude() < 5.0f) { + SetObjective(OBJECTIVE_BUY_ICE_CREAM, veh); + return; + } + } + } + } + } +} + +uint32 +CPed::ScanForThreats(void) +{ + int fearFlags = m_fearFlags; + CVector ourPos = GetPosition(); + float closestPedDist = 60.0f; + CVector2D explosionPos = GetPosition(); + if (fearFlags & PED_FLAG_EXPLOSION && CheckForExplosions(explosionPos)) { + m_eventOrThreat = explosionPos; + return PED_FLAG_EXPLOSION; + } + + CPed *shooter = nil; + if ((fearFlags & PED_FLAG_GUN) && (shooter = CheckForGunShots()) && (m_nPedType != shooter->m_nPedType || m_nPedType == PEDTYPE_CIVMALE || m_nPedType == PEDTYPE_CIVFEMALE)) { + if (!IsGangMember()) { + m_threatEntity = shooter; + m_threatEntity->RegisterReference((CEntity **) &m_threatEntity); + return PED_FLAG_GUN; + } + + if (CPedType::GetFlag(shooter->m_nPedType) & fearFlags) { + m_threatEntity = shooter; + m_threatEntity->RegisterReference((CEntity **) &m_threatEntity); + return CPedType::GetFlag(shooter->m_nPedType); + } + } + + CPed *deadPed = nil; + if (fearFlags & PED_FLAG_DEADPEDS && CharCreatedBy != MISSION_CHAR + && (deadPed = CheckForDeadPeds()) != nil && (deadPed->GetPosition() - ourPos).MagnitudeSqr() < 400.0f) { + m_pEventEntity = deadPed; + m_pEventEntity->RegisterReference((CEntity **) &m_pEventEntity); + return PED_FLAG_DEADPEDS; + } else { + uint32 flagsOfSomePed = 0; + + CPed *pedToFearFrom = nil; +#ifndef VC_PED_PORTS + for (int i = 0; i < m_numNearPeds; i++) { + if (CharCreatedBy != RANDOM_CHAR || m_nearPeds[i]->CharCreatedBy != MISSION_CHAR || m_nearPeds[i]->IsPlayer()) { + CPed *nearPed = m_nearPeds[i]; + + // BUG: WTF Rockstar?! Putting this here will result in returning the flags of farthest ped to us, since m_nearPeds is sorted by distance. + // Fixed at the bottom of the function. + flagsOfSomePed = CPedType::GetFlag(nearPed->m_nPedType); + + if (CPedType::GetFlag(nearPed->m_nPedType) & fearFlags) { + if (nearPed->m_fHealth > 0.0f && OurPedCanSeeThisOne(m_nearPeds[i])) { + // FIX: Taken from VC +#ifdef FIX_BUGS + float nearPedDistSqr = (nearPed->GetPosition() - ourPos).MagnitudeSqr2D(); +#else + float nearPedDistSqr = (CVector2D(ourPos) - explosionPos).MagnitudeSqr(); +#endif + if (sq(closestPedDist) > nearPedDistSqr) { + closestPedDist = Sqrt(nearPedDistSqr); + pedToFearFrom = m_nearPeds[i]; + } + } + } + } + } +#else + bool weSawOurEnemy = false; + bool weMaySeeOurEnemy = false; + float closestEnemyDist = 60.0f; + if ((CTimer::GetFrameCounter() + (uint8)m_randomSeed + 16) & 4) { + + for (int i = 0; i < m_numNearPeds; ++i) { + if (CharCreatedBy == RANDOM_CHAR && m_nearPeds[i]->CharCreatedBy == MISSION_CHAR && !m_nearPeds[i]->IsPlayer()) { + continue; + } + + // BUG: Explained at the same occurence of this bug above. Fixed at the bottom of the function. + flagsOfSomePed = CPedType::GetFlag(m_nearPeds[i]->m_nPedType); + + if (flagsOfSomePed & fearFlags) { + if (m_nearPeds[i]->m_fHealth > 0.0f) { + + // VC also has ability to include objects to line of sight check here (via last bit of flagsL) + if (OurPedCanSeeThisOne(m_nearPeds[i])) { + if (m_nearPeds[i]->m_nPedState == PED_ATTACK) { + if (m_nearPeds[i]->m_pedInObjective == this) { + + float enemyDistSqr = (m_nearPeds[i]->GetPosition() - ourPos).MagnitudeSqr2D(); + if (sq(closestEnemyDist) > enemyDistSqr) { + float enemyDist = Sqrt(enemyDistSqr); + weSawOurEnemy = true; + closestPedDist = enemyDist; + closestEnemyDist = enemyDist; + pedToFearFrom = m_nearPeds[i]; + } + } + } else { + float nearPedDistSqr = (m_nearPeds[i]->GetPosition() - ourPos).MagnitudeSqr2D(); + if (sq(closestPedDist) > nearPedDistSqr && !weSawOurEnemy) { + closestPedDist = Sqrt(nearPedDistSqr); + pedToFearFrom = m_nearPeds[i]; + } + } + } else if (!weSawOurEnemy) { + CPed *nearPed = m_nearPeds[i]; + if (nearPed->m_nPedState == PED_ATTACK) { + CColPoint foundCol; + CEntity *foundEnt; + + // We don't see him yet but he's behind a ped, vehicle or object + // VC also has ability to include objects to line of sight check here (via last bit of flagsL) + if (!CWorld::ProcessLineOfSight(ourPos, nearPed->GetPosition(), foundCol, foundEnt, + true, false, false, false, false, false, false)) { + + if (nearPed->m_pedInObjective == this) { + float enemyDistSqr = (m_nearPeds[i]->GetPosition() - ourPos).MagnitudeSqr2D(); + if (sq(closestEnemyDist) > enemyDistSqr) { + float enemyDist = Sqrt(enemyDistSqr); + weMaySeeOurEnemy = true; + closestPedDist = enemyDist; + closestEnemyDist = enemyDist; + pedToFearFrom = m_nearPeds[i]; + } + } else if (!nearPed->GetWeapon()->IsTypeMelee() && !weMaySeeOurEnemy) { + float nearPedDistSqr = (m_nearPeds[i]->GetPosition() - ourPos).MagnitudeSqr2D(); + if (sq(closestPedDist) > nearPedDistSqr) { + weMaySeeOurEnemy = true; + closestPedDist = Sqrt(nearPedDistSqr); + pedToFearFrom = m_nearPeds[i]; + } + } + } + } + } + } + } + } + } +#endif + int16 lastVehicle; + CEntity* vehicles[8]; + CWorld::FindObjectsInRange(ourPos, 20.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false); + CVehicle* foundVeh = nil; + for (int i = 0; i < lastVehicle; i++) { + CVehicle* nearVeh = (CVehicle*)vehicles[i]; + + CPed *driver = nearVeh->pDriver; + if (driver) { + + // BUG: Same bug as above. Fixed at the bottom of function. + flagsOfSomePed = CPedType::GetFlag(driver->m_nPedType); + if (CPedType::GetFlag(driver->m_nPedType) & fearFlags) { + if (driver->m_fHealth > 0.0f && OurPedCanSeeThisOne(nearVeh->pDriver)) { + // FIX: Taken from VC +#ifdef FIX_BUGS + float driverDistSqr = (driver->GetPosition() - ourPos).MagnitudeSqr2D(); +#else + float driverDistSqr = (CVector2D(ourPos) - explosionPos).MagnitudeSqr(); +#endif + if (sq(closestPedDist) > driverDistSqr) { + closestPedDist = Sqrt(driverDistSqr); + pedToFearFrom = nearVeh->pDriver; + } + } + } + } + } + m_threatEntity = pedToFearFrom; + if (m_threatEntity) + m_threatEntity->RegisterReference((CEntity **) &m_threatEntity); + +#ifdef FIX_BUGS + if (pedToFearFrom) + flagsOfSomePed = CPedType::GetFlag(((CPed*)m_threatEntity)->m_nPedType); + else + flagsOfSomePed = 0; +#endif + + return flagsOfSomePed; + } +} + class CPed_ : public CPed { public: @@ -15451,4 +15789,6 @@ STARTPATCHES InjectHook(0x4D6620, &CPed::SetSolicit, PATCH_JUMP); InjectHook(0x4D2EA0, &CPed::SetFollowPath, PATCH_JUMP); InjectHook(0x4E1010, &CPed::SetExitCar, PATCH_JUMP); + InjectHook(0x4C5FE0, &CPed::ScanForThreats, PATCH_JUMP); + InjectHook(0x4C6C10, &CPed::ScanForInterestingStuff, PATCH_JUMP); ENDPATCHES
\ No newline at end of file diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 7a0ade14..b3d0f145 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -669,7 +669,7 @@ public: bool PlacePedOnDryLand(void); bool PossiblyFindBetterPosToSeekCar(CVector*, CVehicle*); void UpdateFromLeader(void); - int ScanForThreats(void); + uint32 ScanForThreats(void); void SetEnterCar(CVehicle*, uint32); bool WarpPedToNearEntityOffScreen(CEntity*); void SetExitCar(CVehicle*, uint32); @@ -678,6 +678,7 @@ public: void SetEnterTrain(CVehicle*, uint32); void SetEnterCar_AllClear(CVehicle*, uint32, uint32); void SetSolicit(uint32 time); + void ScanForInterestingStuff(void); // Static methods static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset); diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp index 4912da97..86f1bf1e 100644 --- a/src/peds/PedIK.cpp +++ b/src/peds/PedIK.cpp @@ -10,11 +10,11 @@ WRAPPER void CPedIK::ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*) { EAX WRAPPER void CPedIK::ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED140); } WRAPPER bool CPedIK::RestoreLookAt(void) { EAXJMP(0x4ED810); } -// TODO: These are hardcoded into exe, reverse it. -LimbMovementInfo &CPedIK::ms_torsoInfo = *(LimbMovementInfo*)0x5F9F8C; -LimbMovementInfo &CPedIK::ms_headInfo = *(LimbMovementInfo*)0x5F9F5C; -LimbMovementInfo &CPedIK::ms_upperArmInfo = *(LimbMovementInfo*)0x5F9FA4; -LimbMovementInfo &CPedIK::ms_lowerArmInfo = *(LimbMovementInfo*)0x5F9FBC; +LimbMovementInfo CPedIK::ms_torsoInfo = { DEGTORAD(50.0f), DEGTORAD(-50.0f), DEGTORAD(15.0f), DEGTORAD(45.0f), DEGTORAD(-45.0f), DEGTORAD(7.0f) }; +LimbMovementInfo CPedIK::ms_headInfo = { DEGTORAD(90.0f), DEGTORAD(-90.0f), DEGTORAD(10.0f), DEGTORAD(45.0f), DEGTORAD(-45.0f), DEGTORAD(5.0f) }; +LimbMovementInfo CPedIK::ms_headRestoreInfo = { DEGTORAD(90.0f), DEGTORAD(-90.0f), DEGTORAD(10.0f), DEGTORAD(45.0f), DEGTORAD(-45.0f), DEGTORAD(5.0f) }; +LimbMovementInfo CPedIK::ms_upperArmInfo = { DEGTORAD(20.0f), DEGTORAD(-100.0f), DEGTORAD(20.0f), DEGTORAD(70.0f), DEGTORAD(-70.0f), DEGTORAD(10.0f) }; +LimbMovementInfo CPedIK::ms_lowerArmInfo = { DEGTORAD(80.0f), DEGTORAD(0.0f), DEGTORAD(20.0f), DEGTORAD(90.0f), DEGTORAD(-90.0f), DEGTORAD(5.0f) }; CPedIK::CPedIK(CPed *ped) { diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h index c1600ebb..be063003 100644 --- a/src/peds/PedIK.h +++ b/src/peds/PedIK.h @@ -42,10 +42,11 @@ public: LimbOrientation m_lowerArmOrient; int32 m_flags; - static LimbMovementInfo &ms_torsoInfo; - static LimbMovementInfo &ms_headInfo; - static LimbMovementInfo &ms_upperArmInfo; - static LimbMovementInfo &ms_lowerArmInfo; + static LimbMovementInfo ms_torsoInfo; + static LimbMovementInfo ms_headInfo; + static LimbMovementInfo ms_headRestoreInfo; + static LimbMovementInfo ms_upperArmInfo; + static LimbMovementInfo ms_lowerArmInfo; CPedIK(CPed *ped); bool PointGunInDirection(float phi, float theta); diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp index 9a233584..5d7dcc86 100644 --- a/src/render/Glass.cpp +++ b/src/render/Glass.cpp @@ -17,3 +17,4 @@ CGlass::WindowRespondsToSoftCollision(CEntity *ent, float amount) } WRAPPER void CGlass::Render(void) { EAXJMP(0x502350); } +WRAPPER void CGlass::Update(void) { EAXJMP(0x502050); } diff --git a/src/render/Glass.h b/src/render/Glass.h index 60592c39..b29cf173 100644 --- a/src/render/Glass.h +++ b/src/render/Glass.h @@ -9,4 +9,5 @@ public: static void WindowRespondsToCollision(CEntity *ent, float amount, CVector speed, CVector point, bool foo); static void WindowRespondsToSoftCollision(CEntity *ent, float amount); static void Render(void); + static void Update(void); }; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index a9215cb7..aa728a5e 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -637,6 +637,7 @@ void CHud::Draw() /* DrawOnScreenTimer */ + wchar sTimer[16]; if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed) @@ -697,7 +698,7 @@ void CHud::Draw() if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) { CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_FROM_RIGHT(27.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 80)); - CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_X(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer)) / 2 + SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 255)); + CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_X(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer)) / 2 + SCREEN_SCALE_FROM_RIGHT(27.0f + 50.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 255)); } else { AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer); CFont::SetPropOn(); diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index e2db55c7..56ac9512 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -12,6 +12,10 @@ #include "ParticleObject.h" #include "Particle.h" +#ifndef MASTER +bool CParticle::bEnableBannedParticles = false; +#endif + #define MAX_PARTICLES_ON_SCREEN (1000) @@ -768,7 +772,9 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe { if ( CTimer::GetIsPaused() ) return NULL; - +#ifndef MASTER + if(!bEnableBannedParticles) +#endif if ( ( type == PARTICLE_ENGINE_SMOKE || type == PARTICLE_ENGINE_SMOKE2 || type == PARTICLE_ENGINE_STEAM @@ -781,7 +787,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe { return nil; } - + CParticle *pParticle = m_pUnusedListHead; if ( pParticle == nil ) @@ -1455,7 +1461,10 @@ void CParticle::Render() RwRaster **frames = psystem->m_ppRaster; tParticleType type = psystem->m_Type; - + +#ifndef MASTER + if (!bEnableBannedParticles) +#endif if ( type == PARTICLE_ENGINE_SMOKE || type == PARTICLE_ENGINE_SMOKE2 || type == PARTICLE_ENGINE_STEAM diff --git a/src/render/Particle.h b/src/render/Particle.h index 4e41ea2d..310ef0d4 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -97,6 +97,9 @@ public: static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize); static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix); +#ifndef MASTER + static bool bEnableBannedParticles; +#endif }; VALIDATE_SIZE(CParticle, 0x68);
\ No newline at end of file diff --git a/src/render/Rubbish.cpp b/src/render/Rubbish.cpp index c925df1c..05d6b544 100644 --- a/src/render/Rubbish.cpp +++ b/src/render/Rubbish.cpp @@ -4,3 +4,4 @@ WRAPPER void CRubbish::Render(void) { EAXJMP(0x512190); } WRAPPER void CRubbish::StirUp(CVehicle *veh) { EAXJMP(0x512690); } +WRAPPER void CRubbish::Update(void) { EAXJMP(0x511B90); } diff --git a/src/render/Rubbish.h b/src/render/Rubbish.h index 9f946dc2..0bc7c397 100644 --- a/src/render/Rubbish.h +++ b/src/render/Rubbish.h @@ -7,4 +7,5 @@ class CRubbish public: static void Render(void); static void StirUp(CVehicle *veh); // CAutomobile on PS2 + static void Update(void); }; diff --git a/src/render/Skidmarks.cpp b/src/render/Skidmarks.cpp index bbadd54c..7489f7cd 100644 --- a/src/render/Skidmarks.cpp +++ b/src/render/Skidmarks.cpp @@ -3,6 +3,7 @@ #include "Skidmarks.h" WRAPPER void CSkidmarks::Clear(void) { EAXJMP(0x518130); } +WRAPPER void CSkidmarks::Update() { EAXJMP(0x518200); } WRAPPER void CSkidmarks::Render(void) { EAXJMP(0x5182E0); } WRAPPER void CSkidmarks::RegisterOne(uint32 id, CVector pos, float fwdx, float fwdY, bool *isMuddy, bool *isBloddy) { EAXJMP(0x5185C0); } diff --git a/src/render/Skidmarks.h b/src/render/Skidmarks.h index 280150a7..e5372136 100644 --- a/src/render/Skidmarks.h +++ b/src/render/Skidmarks.h @@ -4,6 +4,7 @@ class CSkidmarks { public: static void Clear(void); + static void Update(void); static void Render(void); static void RegisterOne(uint32 id, CVector pos, float fwdx, float fwdY, bool *isMuddy, bool *isBloddy); }; diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index 44e1e029..f1fd3f09 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -5,8 +5,15 @@ #include "Sprite.h" #include "Font.h" #include "Text.h" +#include "TxdStore.h" +#include "FileMgr.h" +#include "FileLoader.h" +#include "Lights.h" +#include "VisibilityPlugins.h" +#include "World.h" WRAPPER void CSpecialFX::Render(void) { EAXJMP(0x518DC0); } +WRAPPER void CSpecialFX::Update(void) { EAXJMP(0x518D40); } WRAPPER void CMotionBlurStreaks::RegisterStreak(int32 id, uint8 r, uint8 g, uint8 b, CVector p1, CVector p2) { EAXJMP(0x519460); } @@ -17,9 +24,290 @@ WRAPPER void CBulletTraces::Init(void) { EAXJMP(0x518DE0); } WRAPPER void CBrightLights::RegisterOne(CVector pos, CVector up, CVector right, CVector fwd, uint8 type, uint8 unk1, uint8 unk2, uint8 unk3) { EAXJMP(0x51A410); } -WRAPPER void C3dMarkers::PlaceMarkerSet(uint32 id, uint16 type, CVector& pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate) { EAXJMP(0x51BB80); } +RpAtomic *
+MarkerAtomicCB(RpAtomic *atomic, void *data)
+{
+ *(RpAtomic**)data = atomic;
+ return atomic;
+} + +bool
+C3dMarker::AddMarker(uint32 identifier, uint16 type, float fSize, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate)
+{
+ m_nIdentifier = identifier;
+
+ m_Matrix.SetUnity();
+
+ RpAtomic *origAtomic;
+ origAtomic = nil;
+ RpClumpForAllAtomics(C3dMarkers::m_pRpClumpArray[type], MarkerAtomicCB, &origAtomic);
+
+ RpAtomic *atomic = RpAtomicClone(origAtomic);
+ RwFrame *frame = RwFrameCreate();
+ RpAtomicSetFrame(atomic, frame);
+ CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil);
+
+ RpGeometry *geometry = RpAtomicGetGeometry(atomic);
+ RpGeometrySetFlags(geometry, RpGeometryGetFlags(geometry) | rpGEOMETRYMODULATEMATERIALCOLOR);
+
+ m_pAtomic = atomic;
+ m_Matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame(m_pAtomic)));
+ m_pMaterial = RpGeometryGetMaterial(geometry, 0);
+ m_fSize = fSize;
+ m_fStdSize = m_fSize;
+ m_Color.red = r;
+ m_Color.green = g;
+ m_Color.blue = b;
+ m_Color.alpha = a;
+ m_nPulsePeriod = pulsePeriod;
+ m_fPulseFraction = pulseFraction;
+ m_nRotateRate = rotateRate;
+ m_nStartTime = CTimer::GetTimeInMilliseconds();
+ m_nType = type;
+ return m_pAtomic != nil;
+} + +void +C3dMarker::DeleteMarkerObject() +{ + RwFrame *frame; + + m_nIdentifier = 0;
+ m_nStartTime = 0;
+ m_bIsUsed = false;
+ m_nType = MARKERTYPE_INVALID;
+
+ frame = RpAtomicGetFrame(m_pAtomic);
+ RpAtomicDestroy(m_pAtomic);
+ RwFrameDestroy(frame);
+ m_pAtomic = nil; +} + +void
+C3dMarker::Render()
+{
+ if (m_pAtomic == nil) return;
+
+ RwRGBA *color = RpMaterialGetColor(m_pMaterial);
+ *color = m_Color;
+
+ m_Matrix.UpdateRW();
+
+ CMatrix matrix;
+ matrix.Attach(m_Matrix.m_attachment);
+ matrix.Scale(m_fSize);
+ matrix.UpdateRW();
+
+ RwFrameUpdateObjects(RpAtomicGetFrame(m_pAtomic));
+ SetBrightMarkerColours(m_fBrightness);
+ if (m_nType != MARKERTYPE_ARROW)
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RpAtomicRender(m_pAtomic);
+ if (m_nType != MARKERTYPE_ARROW)
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ ReSetAmbientAndDirectionalColours();
+} + +C3dMarker(&C3dMarkers::m_aMarkerArray)[NUM3DMARKERS] = *(C3dMarker(*)[NUM3DMARKERS])*(uintptr*)0x72D408; +int32 &C3dMarkers::NumActiveMarkers = *(int32*)0x8F2A08; +RpClump* (&C3dMarkers::m_pRpClumpArray)[NUMMARKERTYPES] = *(RpClump*(*)[NUMMARKERTYPES])*(uintptr*)0x8E2888; + +void
+C3dMarkers::Init()
+{
+ for (int i = 0; i < NUM3DMARKERS; i++) {
+ m_aMarkerArray[i].m_pAtomic = nil;
+ m_aMarkerArray[i].m_nType = MARKERTYPE_INVALID;
+ m_aMarkerArray[i].m_bIsUsed = false;
+ m_aMarkerArray[i].m_nIdentifier = 0;
+ m_aMarkerArray[i].m_Color.red = 255;
+ m_aMarkerArray[i].m_Color.green = 255;
+ m_aMarkerArray[i].m_Color.blue = 255;
+ m_aMarkerArray[i].m_Color.alpha = 255;
+ m_aMarkerArray[i].m_nPulsePeriod = 1024;
+ m_aMarkerArray[i].m_nRotateRate = 5;
+ m_aMarkerArray[i].m_nStartTime = 0;
+ m_aMarkerArray[i].m_fPulseFraction = 0.25f;
+ m_aMarkerArray[i].m_fStdSize = 1.0f;
+ m_aMarkerArray[i].m_fSize = 1.0f;
+ m_aMarkerArray[i].m_fBrightness = 1.0f;
+ m_aMarkerArray[i].m_fCameraRange = 0.0f;
+ }
+ NumActiveMarkers = 0;
+ int txdSlot = CTxdStore::FindTxdSlot("particle");
+ CTxdStore::PushCurrentTxd();
+ CTxdStore::SetCurrentTxd(txdSlot);
+ CFileMgr::ChangeDir("\\");
+ m_pRpClumpArray[MARKERTYPE_ARROW] = CFileLoader::LoadAtomicFile2Return("models/generic/arrow.dff");
+ m_pRpClumpArray[MARKERTYPE_CYLINDER] = CFileLoader::LoadAtomicFile2Return("models/generic/zonecylb.dff");
+ CTxdStore::PopCurrentTxd();
+} + +void
+C3dMarkers::Shutdown()
+{
+ for (int i = 0; i < NUM3DMARKERS; i++) {
+ if (m_aMarkerArray[i].m_pAtomic != nil)
+ m_aMarkerArray[i].DeleteMarkerObject();
+ }
+
+ for (int i = 0; i < NUMMARKERTYPES; i++) {
+ if (m_pRpClumpArray[i] != nil)
+ RpClumpDestroy(m_pRpClumpArray[i]);
+ }
+} +void
+C3dMarkers::Render()
+{
+ NumActiveMarkers = 0;
+ ActivateDirectional();
+ for (int i = 0; i < NUM3DMARKERS; i++) {
+ if (m_aMarkerArray[i].m_bIsUsed) {
+ if (m_aMarkerArray[i].m_fCameraRange < 120.0f)
+ m_aMarkerArray[i].Render();
+ NumActiveMarkers++;
+ m_aMarkerArray[i].m_bIsUsed = false;
+ } else if (m_aMarkerArray[i].m_pAtomic != nil) {
+ m_aMarkerArray[i].DeleteMarkerObject();
+ }
+ }
+} +C3dMarker *
+C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate) +{ + C3dMarker *pMarker;
+
+ pMarker = nil;
+ float dist = Sqrt((pos.x - FindPlayerCentreOfWorld(0).x) * (pos.x - FindPlayerCentreOfWorld(0).x) + (pos.y - FindPlayerCentreOfWorld(0).y) * (pos.y - FindPlayerCentreOfWorld(0).y));
+
+ if (type != MARKERTYPE_ARROW && type != MARKERTYPE_CYLINDER) return nil;
+
+ for (int i = 0; i < NUM3DMARKERS; i++) {
+ if (!m_aMarkerArray[i].m_bIsUsed && m_aMarkerArray[i].m_nIdentifier == identifier) {
+ pMarker = &m_aMarkerArray[i];
+ break;
+ }
+ }
+
+ if (pMarker == nil) {
+ for (int i = 0; i < NUM3DMARKERS; i++) {
+ if (m_aMarkerArray[i].m_nType == MARKERTYPE_INVALID) {
+ pMarker = &m_aMarkerArray[i];
+ break;
+ }
+ }
+ }
+
+ if (pMarker == nil && type == MARKERTYPE_ARROW) {
+ for (int i = 0; i < NUM3DMARKERS; i++) {
+ if (dist < m_aMarkerArray[i].m_fCameraRange && m_aMarkerArray[i].m_nType == MARKERTYPE_ARROW && (pMarker == nil || m_aMarkerArray[i].m_fCameraRange > pMarker->m_fCameraRange)) {
+ pMarker = &m_aMarkerArray[i];
+ break;
+ }
+ }
+
+ if (pMarker != nil)
+ pMarker->m_nType = MARKERTYPE_INVALID;
+ }
+
+ if (pMarker == nil) return pMarker;
+
+ pMarker->m_fCameraRange = dist;
+ if (pMarker->m_nIdentifier == identifier && pMarker->m_nType == type) {
+ if (type == MARKERTYPE_ARROW) {
+ if (dist < 25.0f) {
+ if (dist > 5.0f)
+ pMarker->m_fStdSize = size - (25.0f - dist) * (0.3f * size) / 20.0f;
+ else
+ pMarker->m_fStdSize = size - 0.3f * size;
+ } else {
+ pMarker->m_fStdSize = size;
+ }
+ } else if (type == MARKERTYPE_CYLINDER) {
+ if (dist < size + 12.0f) {
+ if (dist > size + 1.0f)
+ pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a;
+ else
+ pMarker->m_Color.alpha = (float)a * 0.3f;
+ } else {
+ pMarker->m_Color.alpha = a;
+ }
+ }
+ float someSin = Sin(TWOPI * (float)((pMarker->m_nPulsePeriod - 1) & (CTimer::GetTimeInMilliseconds() - pMarker->m_nStartTime)) / (float)pMarker->m_nPulsePeriod);
+ pMarker->m_fSize = pMarker->m_fStdSize - pulseFraction * pMarker->m_fStdSize * someSin;
+
+ if (type == MARKERTYPE_ARROW) {
+ pos.z += 0.25f * pMarker->m_fStdSize * someSin;
+ } else if (type == MARKERTYPE_0) {
+ if (someSin > 0.0f)
+ pMarker->m_Color.alpha = (float)a * 0.7f * someSin + a;
+ else
+ pMarker->m_Color.alpha = (float)a * 0.4f * someSin + a;
+ }
+ if (pMarker->m_nRotateRate) {
+ RwV3d pos = pMarker->m_Matrix.m_matrix.pos;
+ pMarker->m_Matrix.RotateZ(DEGTORAD(pMarker->m_nRotateRate * CTimer::GetTimeStep()));
+ pMarker->m_Matrix.GetPosition() = pos;
+ }
+ if (type == MARKERTYPE_ARROW)
+ pMarker->m_Matrix.GetPosition() = pos;
+ pMarker->m_bIsUsed = true;
+ return pMarker;
+ }
+
+ if (pMarker->m_nIdentifier != 0)
+ pMarker->DeleteMarkerObject();
+
+ pMarker->AddMarker(identifier, type, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate);
+ if (type == MARKERTYPE_CYLINDER || type == MARKERTYPE_0 || type == MARKERTYPE_2) {
+ float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil);
+ if (z != 0.0f)
+ pos.z = z - 0.05f * size;
+ }
+ pMarker->m_Matrix.SetTranslate(pos.x, pos.y, pos.z);
+ if (type == MARKERTYPE_2) {
+ pMarker->m_Matrix.RotateX(PI);
+ pMarker->m_Matrix.GetPosition() = pos;
+ }
+ pMarker->m_Matrix.UpdateRW();
+ if (type == MARKERTYPE_ARROW) {
+ if (dist < 25.0f) {
+ if (dist > 5.0f)
+ pMarker->m_fStdSize = size - (25.0f - dist) * (0.3f * size) / 20.0f;
+ else
+ pMarker->m_fStdSize = size - 0.3f * size;
+ } else {
+ pMarker->m_fStdSize = size;
+ }
+ } else if (type == MARKERTYPE_CYLINDER) {
+ if (dist < size + 12.0f) {
+ if (dist > size + 1.0f)
+ pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a;
+ else
+ pMarker->m_Color.alpha = (float)a * 0.3f;
+ } else {
+ pMarker->m_Color.alpha = a;
+ }
+ }
+ pMarker->m_bIsUsed = true;
+ return pMarker; +} + +void
+C3dMarkers::PlaceMarkerSet(uint32 id, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate)
+{
+ PlaceMarker(id, type, pos, size, r, g, b, a, pulsePeriod, pulseFraction, 1);
+ PlaceMarker(id, type, pos, size * 0.93f, r, g, b, a, pulsePeriod, pulseFraction, 2);
+ PlaceMarker(id, type, pos, size * 0.86f, r, g, b, a, pulsePeriod, pulseFraction, -1);
+} + +
+void +C3dMarkers::Update() +{ +} #define MONEY_MESSAGE_LIFETIME_MS 2000 @@ -96,6 +384,15 @@ CMoneyMessages::RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8 }
STARTPATCHES + InjectHook(0x51B070, &C3dMarker::AddMarker, PATCH_JUMP); + InjectHook(0x51B170, &C3dMarker::DeleteMarkerObject, PATCH_JUMP); + InjectHook(0x51B1B0, &C3dMarker::Render, PATCH_JUMP); + InjectHook(0x51B2B0, C3dMarkers::Init, PATCH_JUMP); + InjectHook(0x51B480, C3dMarkers::PlaceMarker, PATCH_JUMP); + InjectHook(0x51BB80, C3dMarkers::PlaceMarkerSet, PATCH_JUMP); + InjectHook(0x51B400, C3dMarkers::Render, PATCH_JUMP); + InjectHook(0x51B3B0, C3dMarkers::Shutdown, PATCH_JUMP); + InjectHook(0x51AF70, CMoneyMessages::Init, PATCH_JUMP); InjectHook(0x51B030, CMoneyMessages::Render, PATCH_JUMP); ENDPATCHES diff --git a/src/render/SpecialFX.h b/src/render/SpecialFX.h index bdd74bee..10b22a77 100644 --- a/src/render/SpecialFX.h +++ b/src/render/SpecialFX.h @@ -4,6 +4,7 @@ class CSpecialFX { public: static void Render(void); + static void Update(void); }; class CMotionBlurStreaks @@ -35,10 +36,56 @@ public: static void RegisterOne(CVector pos, CVector up, CVector right, CVector fwd, uint8 type, uint8 unk1 = 0, uint8 unk2 = 0, uint8 unk3 = 0); }; +enum +{ + MARKERTYPE_0 = 0, + MARKERTYPE_ARROW, + MARKERTYPE_2, + MARKERTYPE_3, + MARKERTYPE_CYLINDER, + NUMMARKERTYPES, + + MARKERTYPE_INVALID = 0x101 +}; + + +class C3dMarker +{
+public:
+ CMatrix m_Matrix;
+ RpAtomic *m_pAtomic;
+ RpMaterial *m_pMaterial;
+ uint16 m_nType;
+ bool m_bIsUsed;
+ uint32 m_nIdentifier;
+ RwRGBA m_Color;
+ uint16 m_nPulsePeriod;
+ int16 m_nRotateRate;
+ uint32 m_nStartTime;
+ float m_fPulseFraction;
+ float m_fStdSize;
+ float m_fSize;
+ float m_fBrightness;
+ float m_fCameraRange;
+
+ bool AddMarker(uint32 identifier, uint16 type, float fSize, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate);
+ void DeleteMarkerObject();
+ void Render();
+}; + class C3dMarkers { public: - static void PlaceMarkerSet(uint32 id, uint16 type, CVector& pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate); + static void Init(); + static void Shutdown(); + static C3dMarker *PlaceMarker(uint32 id, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate); + static void PlaceMarkerSet(uint32 id, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate); + static void Render();
+ static void Update(); + + static C3dMarker(&m_aMarkerArray)[NUM3DMARKERS]; + static int32 &NumActiveMarkers; + static RpClump* (&m_pRpClumpArray)[NUMMARKERTYPES]; };
class CMoneyMessage
diff --git a/src/render/VisibilityPlugins.cpp b/src/render/VisibilityPlugins.cpp index 2107813b..6a2f77a1 100644 --- a/src/render/VisibilityPlugins.cpp +++ b/src/render/VisibilityPlugins.cpp @@ -7,6 +7,7 @@ #include "Renderer.h" #include "Camera.h" #include "VisibilityPlugins.h" +#include "World.h" #define FADE_DISTANCE 20.0f @@ -43,7 +44,7 @@ CVisibilityPlugins::Initialise(void) m_alphaList.Init(20); m_alphaList.head.item.sort = 0.0f; m_alphaList.tail.item.sort = 100000000.0f; - m_alphaEntityList.Init(350); // TODO: set back to 150 when things are fixed + m_alphaEntityList.Init(150); m_alphaEntityList.head.item.sort = 0.0f; m_alphaEntityList.tail.item.sort = 100000000.0f; } @@ -498,14 +499,11 @@ CVisibilityPlugins::RenderTrainHiDetailAlphaCB(RpAtomic *atomic) return atomic; } -// TODO: this is part of a struct -static RwTexture *&playerskin = *(RwTexture**)0x941428; - RpAtomic* CVisibilityPlugins::RenderPlayerCB(RpAtomic *atomic) { - if(playerskin) - RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, playerskin); + if(CWorld::Players[0].m_pSkinTexture) + RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, CWorld::Players[0].m_pSkinTexture); AtomicDefaultRenderCallBack(atomic); return atomic; } @@ -607,22 +605,30 @@ CVisibilityPlugins::DefaultVisibilityCB(RpClump *clump) bool CVisibilityPlugins::FrustumSphereCB(RpClump *clump) { - // TODO, but unused - return true; + RwSphere sphere; + RwFrame *frame = RpClumpGetFrame(clump); + + CClumpModelInfo *modelInfo = (CClumpModelInfo*)GetFrameHierarchyId(frame); + sphere.radius = modelInfo->GetColModel()->boundingSphere.radius; + sphere.center.x = modelInfo->GetColModel()->boundingSphere.center.x; + sphere.center.y = modelInfo->GetColModel()->boundingSphere.center.y; + sphere.center.z = modelInfo->GetColModel()->boundingSphere.center.z; + RwV3dTransformPoints(&sphere.center, &sphere.center, 1, RwFrameGetLTM(frame)); + return RwCameraFrustumTestSphere(ms_pCamera, &sphere) != rwSPHEREOUTSIDE; } bool CVisibilityPlugins::VehicleVisibilityCB(RpClump *clump) { - // TODO, but unused - return true; + if (GetDistanceSquaredFromCamera(RpClumpGetFrame(clump)) <= ms_vehicleLod1Dist) + return FrustumSphereCB(clump); + return false; } bool CVisibilityPlugins::VehicleVisibilityCB_BigVehicle(RpClump *clump) { - // TODO, but unused - return true; + return FrustumSphereCB(clump); } diff --git a/src/render/WaterCannon.cpp b/src/render/WaterCannon.cpp index 9398c847..c2af73f0 100644 --- a/src/render/WaterCannon.cpp +++ b/src/render/WaterCannon.cpp @@ -2,5 +2,8 @@ #include "patcher.h" #include "WaterCannon.h" +CWaterCannon* aCannons = (CWaterCannon*)0x8F2CA8; + +WRAPPER void CWaterCannons::Update(void) { EAXJMP(0x522510); } WRAPPER void CWaterCannons::UpdateOne(uint32 id, CVector *pos, CVector *dir) { EAXJMP(0x522470); } WRAPPER void CWaterCannons::Render(void) { EAXJMP(0x522550); } diff --git a/src/render/WaterCannon.h b/src/render/WaterCannon.h index 55949803..16df63db 100644 --- a/src/render/WaterCannon.h +++ b/src/render/WaterCannon.h @@ -1,8 +1,25 @@ #pragma once +class CWaterCannon +{ +public: + int32 m_nId; + int16 m_wIndex; + char gap_6[2]; + int32 m_nTimeCreated; + CVector m_avecPos[16]; + CVector m_avecVelocity[16]; + char m_abUsed[16]; +}; + +static_assert(sizeof(CWaterCannon) == 412, "CWaterCannon: error"); + class CWaterCannons { public: + static void Update(); static void UpdateOne(uint32 id, CVector *pos, CVector *dir); static void Render(void); }; + +extern CWaterCannon *aCannons; diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index f6c30e50..479f3404 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -33,6 +33,7 @@ int16 &CWeather::Stored_NewWeatherType = *(int16*)0x95CCAE; float &CWeather::Stored_Rain = *(float*)0x885B4C; WRAPPER void CWeather::RenderRainStreaks(void) { EAXJMP(0x524550); } +WRAPPER void CWeather::Update(void) { EAXJMP(0x522C10); } void CWeather::ReleaseWeather() { diff --git a/src/render/Weather.h b/src/render/Weather.h index 0b413462..b5704b01 100644 --- a/src/render/Weather.h +++ b/src/render/Weather.h @@ -38,6 +38,7 @@ public: static float &Stored_Rain; static void RenderRainStreaks(void); + static void Update(void); static void ReleaseWeather(); static void ForceWeather(int16); diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index fc82e51e..4da63fe6 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -2162,7 +2162,7 @@ _WinMain(HINSTANCE instance, CPad::ResetCheats(); CPad::StopPadsShaking(); - DMAudio.ChangeMusicMode(_TODOCONST(3)); + DMAudio.ChangeMusicMode(MUSICMODE_OFF); CTimer::Stop(); @@ -2170,7 +2170,7 @@ _WinMain(HINSTANCE instance, { CGame::ShutDownForRestart(); CGame::InitialiseWhenRestarting(); - DMAudio.ChangeMusicMode(_TODOCONST(1)); + DMAudio.ChangeMusicMode(MUSICMODE_GAME); LoadSplash(GetLevelSplashScreen(CGame::currLevel)); FrontEndMenuManager.m_bLoadingSavedGame = false; } diff --git a/src/skel/win/win.h b/src/skel/win/win.h index 8c32e57d..ae2c7eec 100644 --- a/src/skel/win/win.h +++ b/src/skel/win/win.h @@ -90,4 +90,5 @@ void HandleExit(); #endif /* __cplusplus */ +extern DWORD &_dwOperatingSystemVersion; #endif /* (!defined(_PLATFORM_WIN_H)) */ diff --git a/src/text/Messages.cpp b/src/text/Messages.cpp new file mode 100644 index 00000000..0e8f5494 --- /dev/null +++ b/src/text/Messages.cpp @@ -0,0 +1,835 @@ +#define DIRECTINPUT_VERSION 0x0800 +#include "dinput.h" + +#include "common.h" +#include "patcher.h" +#include "Messages.h" +#include "RwHelper.h" +#include "Hud.h" +#include "User.h" +#include "Timer.h" +#include "Text.h" + +#include "ControllerConfig.h" + +tMessage(&CMessages::BriefMessages)[NUMBRIEFMESSAGES] = *(tMessage(*)[NUMBRIEFMESSAGES])*(uintptr*)0x8786E0; +tPreviousBrief(&CMessages::PreviousBriefs)[NUMPREVIOUSBRIEFS] = *(tPreviousBrief(*)[NUMPREVIOUSBRIEFS])*(uintptr*)0x713C08; +tBigMessage(&CMessages::BIGMessages)[NUMBIGMESSAGES] = *(tBigMessage(*)[NUMBIGMESSAGES])*(uintptr*)0x773628; +char CMessages::PreviousMissionTitle[16]; // unused + +void +CMessages::Init() +{
+ ClearMessages();
+
+ for (int32 i = 0; i < NUMPREVIOUSBRIEFS; i++) { + PreviousBriefs[i].m_pText = nil; + PreviousBriefs[i].m_pString = nil; + } +} + +uint16 +CMessages::GetWideStringLength(wchar *src) +{
+ uint16 length = 0;
+ while (*(src++)) length++;
+ return length; +} + +void +CMessages::WideStringCopy(wchar *dst, wchar *src, uint16 size) +{
+ int32 i = 0;
+ if (src) { + while (i < size - 1) {
+ if (!src[i]) break;
+ dst[i] = src[i];
+ i++;
+ } + } else { + while (i < size - 1)
+ dst[i++] = '\0'; + } + dst[i] = '\0'; +} + +bool
+CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
+{
+ uint16 len1 = GetWideStringLength(str1);
+ uint16 len2 = GetWideStringLength(str2);
+ if (len1 != len2 && (len1 < size || len2 < size))
+ return false;
+
+ for (int32 i = 0; i < size; i++) {
+ if (!str1[i])
+ break;
+
+ if (str1[i] != str2[i])
+ return false;
+ }
+ return true;
+}
+
+void
+CMessages::Process()
+{
+ for (int32 style = 0; style < 6; style++) {
+ if (BIGMessages[style].m_Stack[0].m_pText != nil && CTimer::GetTimeInMilliseconds() > BIGMessages[style].m_Stack[0].m_nTime + BIGMessages[style].m_Stack[0].m_nStartTime) {
+ BIGMessages[style].m_Stack[0].m_pText = nil;
+
+ int32 i = 0;
+ while (i < 3) {
+ if (BIGMessages[style].m_Stack[i + 1].m_pText == nil) break;
+ BIGMessages[style].m_Stack[i] = BIGMessages[style].m_Stack[i + 1];
+ i++;
+ }
+
+ BIGMessages[style].m_Stack[i].m_pText = nil;
+ BIGMessages[style].m_Stack[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ }
+ }
+
+ if (BriefMessages[0].m_pText != nil && CTimer::GetTimeInMilliseconds() > BriefMessages[0].m_nTime + BriefMessages[0].m_nStartTime) {
+ BriefMessages[0].m_pText = nil;
+ int32 i = 0;
+ while (i < NUMBRIEFMESSAGES-1) {
+ if (BriefMessages[i + 1].m_pText == nil)
+ break;
+
+ BriefMessages[i] = BriefMessages[i + 1];
+ i++;
+ }
+ CMessages::BriefMessages[i].m_pText = nil;
+ CMessages::BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ if (BriefMessages[0].m_pText != nil)
+ AddToPreviousBriefArray(
+ BriefMessages[0].m_pText,
+ BriefMessages[0].m_nNumber[0],
+ BriefMessages[0].m_nNumber[1],
+ BriefMessages[0].m_nNumber[2],
+ BriefMessages[0].m_nNumber[3],
+ BriefMessages[0].m_nNumber[4],
+ BriefMessages[0].m_nNumber[5],
+ BriefMessages[0].m_pString);
+ }
+}
+
+void
+CMessages::Display()
+{
+ wchar outstr[256];
+
+ DefinedState();
+
+ for (int32 i = 0; i < NUMBIGMESSAGES; i++) {
+ InsertNumberInString(
+ BIGMessages[i].m_Stack[0].m_pText,
+ BIGMessages[i].m_Stack[0].m_nNumber[0],
+ BIGMessages[i].m_Stack[0].m_nNumber[1],
+ BIGMessages[i].m_Stack[0].m_nNumber[2],
+ BIGMessages[i].m_Stack[0].m_nNumber[3],
+ BIGMessages[i].m_Stack[0].m_nNumber[4],
+ BIGMessages[i].m_Stack[0].m_nNumber[5],
+ outstr);
+ InsertStringInString(outstr, BIGMessages[i].m_Stack[0].m_pString);
+ InsertPlayerControlKeysInString(outstr);
+ CHud::SetBigMessage(outstr, i);
+ }
+
+ InsertNumberInString(
+ BriefMessages[0].m_pText,
+ BriefMessages[0].m_nNumber[0],
+ BriefMessages[0].m_nNumber[1],
+ BriefMessages[0].m_nNumber[2],
+ BriefMessages[0].m_nNumber[3],
+ BriefMessages[0].m_nNumber[4],
+ BriefMessages[0].m_nNumber[5],
+ outstr);
+ InsertStringInString(outstr, BriefMessages[0].m_pString);
+ InsertPlayerControlKeysInString(outstr);
+ CHud::SetMessage(outstr);
+}
+
+void
+CMessages::AddMessage(wchar *msg, uint32 time, uint16 flag)
+{
+ wchar outstr[512]; // unused
+ WideStringCopy(outstr, msg, 256);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ int32 i = 0;
+ while (i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText != nil)
+ i++;
+ if (i >= NUMBRIEFMESSAGES) return;
+
+ BriefMessages[i].m_pText = msg;
+ BriefMessages[i].m_nFlag = flag;
+ BriefMessages[i].m_nTime = time;
+ BriefMessages[i].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[i].m_nNumber[0] = -1;
+ BriefMessages[i].m_nNumber[1] = -1;
+ BriefMessages[i].m_nNumber[2] = -1;
+ BriefMessages[i].m_nNumber[3] = -1;
+ BriefMessages[i].m_nNumber[4] = -1;
+ BriefMessages[i].m_nNumber[5] = -1;
+ BriefMessages[i].m_pString = nil;
+ if (i == 0)
+ AddToPreviousBriefArray(
+ BriefMessages[0].m_pText,
+ BriefMessages[0].m_nNumber[0],
+ BriefMessages[0].m_nNumber[1],
+ BriefMessages[0].m_nNumber[2],
+ BriefMessages[0].m_nNumber[3],
+ BriefMessages[0].m_nNumber[4],
+ BriefMessages[0].m_nNumber[5],
+ BriefMessages[0].m_pString);
+}
+
+void
+CMessages::AddMessageJumpQ(wchar *msg, uint32 time, uint16 flag)
+{
+ wchar outstr[512]; // unused
+ WideStringCopy(outstr, msg, 256);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ BriefMessages[0].m_pText = msg;
+ BriefMessages[0].m_nFlag = flag;
+ BriefMessages[0].m_nTime = time;
+ BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[0].m_nNumber[0] = -1;
+ BriefMessages[0].m_nNumber[1] = -1;
+ BriefMessages[0].m_nNumber[2] = -1;
+ BriefMessages[0].m_nNumber[3] = -1;
+ BriefMessages[0].m_nNumber[4] = -1;
+ BriefMessages[0].m_nNumber[5] = -1;
+ BriefMessages[0].m_pString = nil;
+ AddToPreviousBriefArray(msg, -1, -1, -1, -1, -1, -1, 0);
+}
+
+void
+CMessages::AddMessageSoon(wchar *msg, uint32 time, uint16 flag)
+{
+ wchar outstr[512]; // unused
+ WideStringCopy(outstr, msg, 256);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ if (BriefMessages[0].m_pText != nil) {
+ for (int i = NUMBRIEFMESSAGES-1; i > 1; i--)
+ BriefMessages[i] = BriefMessages[i-1];
+
+ BriefMessages[1].m_pText = msg;
+ BriefMessages[1].m_nFlag = flag;
+ BriefMessages[1].m_nTime = time;
+ BriefMessages[1].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[1].m_nNumber[0] = -1;
+ BriefMessages[1].m_nNumber[1] = -1;
+ BriefMessages[1].m_nNumber[2] = -1;
+ BriefMessages[1].m_nNumber[3] = -1;
+ BriefMessages[1].m_nNumber[4] = -1;
+ BriefMessages[1].m_nNumber[5] = -1;
+ BriefMessages[1].m_pString = nil;
+ }else{
+ BriefMessages[0].m_pText = msg;
+ BriefMessages[0].m_nFlag = flag;
+ BriefMessages[0].m_nTime = time;
+ BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[0].m_nNumber[0] = -1;
+ BriefMessages[0].m_nNumber[1] = -1;
+ BriefMessages[0].m_nNumber[2] = -1;
+ BriefMessages[0].m_nNumber[3] = -1;
+ BriefMessages[0].m_nNumber[4] = -1;
+ BriefMessages[0].m_nNumber[5] = -1;
+ BriefMessages[0].m_pString = nil;
+ AddToPreviousBriefArray(msg, -1, -1, -1, -1, -1, -1, nil);
+ }
+}
+
+void
+CMessages::ClearMessages()
+{
+ for (int32 i = 0; i < NUMBIGMESSAGES; i++) { + for (int32 j = 0; j < 4; j++) { + BIGMessages[i].m_Stack[j].m_pText = nil; + BIGMessages[i].m_Stack[j].m_pString = nil; + } + }
+ ClearSmallMessagesOnly();
+}
+
+void
+CMessages::ClearSmallMessagesOnly()
+{
+ for (int32 i = 0; i < NUMBRIEFMESSAGES; i++) {
+ BriefMessages[i].m_pText = nil;
+ BriefMessages[i].m_pString = nil;
+ }
+}
+
+void
+CMessages::AddBigMessage(wchar *msg, uint32 time, uint16 style)
+{
+ wchar outstr[512]; // unused
+ WideStringCopy(outstr, msg, 256);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ BIGMessages[style].m_Stack[0].m_pText = msg;
+ BIGMessages[style].m_Stack[0].m_nFlag = 0;
+ BIGMessages[style].m_Stack[0].m_nTime = time;
+ BIGMessages[style].m_Stack[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BIGMessages[style].m_Stack[0].m_nNumber[0] = -1;
+ BIGMessages[style].m_Stack[0].m_nNumber[1] = -1;
+ BIGMessages[style].m_Stack[0].m_nNumber[2] = -1;
+ BIGMessages[style].m_Stack[0].m_nNumber[3] = -1;
+ BIGMessages[style].m_Stack[0].m_nNumber[4] = -1;
+ BIGMessages[style].m_Stack[0].m_nNumber[5] = -1;
+ BIGMessages[style].m_Stack[0].m_pString = nil;
+}
+void
+CMessages::AddBigMessageQ(wchar *msg, uint32 time, uint16 style)
+{
+ wchar outstr[512]; // unused
+ WideStringCopy(outstr, msg, 256);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ int32 i = 0;
+ while (i < 4 && BIGMessages[style].m_Stack[i].m_pText != nil)
+ i++;
+
+ if (i >= 4) return;
+
+ BIGMessages[style].m_Stack[i].m_pText = msg;
+ BIGMessages[style].m_Stack[i].m_nFlag = 0;
+ BIGMessages[style].m_Stack[i].m_nTime = time;
+ BIGMessages[style].m_Stack[i].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BIGMessages[style].m_Stack[i].m_nNumber[0] = -1;
+ BIGMessages[style].m_Stack[i].m_nNumber[1] = -1;
+ BIGMessages[style].m_Stack[i].m_nNumber[2] = -1;
+ BIGMessages[style].m_Stack[i].m_nNumber[3] = -1;
+ BIGMessages[style].m_Stack[i].m_nNumber[4] = -1;
+ BIGMessages[style].m_Stack[i].m_nNumber[5] = -1;
+ BIGMessages[style].m_Stack[i].m_pString = nil;
+}
+
+void
+CMessages::AddToPreviousBriefArray(wchar *text, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, wchar *string)
+{
+ int32 i = 0;
+ while (i < NUMPREVIOUSBRIEFS) {
+ if (PreviousBriefs[i].m_pText == nil)
+ break;
+ if (PreviousBriefs[i].m_nNumber[0] == n1
+ && PreviousBriefs[i].m_nNumber[1] == n2
+ && PreviousBriefs[i].m_nNumber[2] == n3
+ && PreviousBriefs[i].m_nNumber[3] == n4
+ && PreviousBriefs[i].m_nNumber[4] == n5
+ && PreviousBriefs[i].m_nNumber[5] == n6
+ && PreviousBriefs[i].m_pText == text
+ && PreviousBriefs[i].m_pString == string)
+ return;
+
+ i++;
+ }
+
+ if (i != 0) {
+ if (i == NUMPREVIOUSBRIEFS) i -= 2;
+ else i--;
+
+ while (i >= 0) {
+ PreviousBriefs[i + 1] = PreviousBriefs[i];
+ i--;
+ }
+ }
+ PreviousBriefs[0].m_pText = text;
+ PreviousBriefs[0].m_nNumber[0] = n1;
+ PreviousBriefs[0].m_nNumber[1] = n2;
+ PreviousBriefs[0].m_nNumber[2] = n3;
+ PreviousBriefs[0].m_nNumber[3] = n4;
+ PreviousBriefs[0].m_nNumber[4] = n5;
+ PreviousBriefs[0].m_nNumber[5] = n6;
+ PreviousBriefs[0].m_pString = string;
+}
+
+void
+CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, wchar *outstr)
+{
+ char numStr[10];
+ wchar wNumStr[10];
+
+ if (str == nil) {
+ *outstr = '\0';
+ return;
+ }
+
+ int32 size = GetWideStringLength(str);
+
+ int32 i = 0;
+
+ for (int32 c = 0; c < size;) {
+ if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') {
+ switch (i) {
+ case 0: sprintf(numStr, "%d", n1); break;
+ case 1: sprintf(numStr, "%d", n2); break;
+ case 2: sprintf(numStr, "%d", n3); break;
+ case 3: sprintf(numStr, "%d", n4); break;
+ case 4: sprintf(numStr, "%d", n5); break;
+ case 5: sprintf(numStr, "%d", n6); break;
+ }
+ i++;
+ AsciiToUnicode(numStr, wNumStr);
+
+ int j = 0;
+ while (wNumStr[j] != '\0')
+ *(outstr++) = wNumStr[j++];
+
+ c += 3;
+ } else {
+ *(outstr++) = str[c++];
+ }
+ }
+ *outstr = '\0';
+}
+
+void
+CMessages::InsertStringInString(wchar *str1, wchar *str2)
+{
+ wchar tempstr[256];
+
+ if (!str1 || !str2) return;
+
+ int32 str1_size = GetWideStringLength(str1);
+ int32 str2_size = GetWideStringLength(str2);
+ int32 total_size = str1_size + str2_size;
+
+ wchar *_str1 = str1;
+ uint16 i;
+ for (i = 0; i < total_size; ) {
+ if (*_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~') {
+ _str1 += 3;
+ for (int j = 0; j < str2_size; j++) {
+ tempstr[i++] = str2[j];
+ }
+ } else {
+ tempstr[i++] = *(_str1++);
+ }
+ }
+ tempstr[i] = '\0';
+
+ for (i = 0; i < total_size; i++)
+ str1[i] = tempstr[i];
+
+ while (i < 256)
+ str1[i++] = '\0';
+}
+
+void
+CMessages::InsertPlayerControlKeysInString(wchar *str)
+{
+ uint16 i;
+ wchar outstr[256];
+ wchar keybuf[256];
+
+ if (!str) return;
+ uint16 strSize = GetWideStringLength(str);
+ memset(keybuf, 0, 256*sizeof(wchar));
+
+ wchar *_outstr = outstr;
+ for (i = 0; i < strSize;) {
+ if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') {
+ i += 4;
+ for (int32 cont = 0; cont < TOTAL_CONTROL_ACTIONS; cont++) {
+ uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]);
+ if (contSize != 0) {
+ if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) {
+ ControlsManager.GetWideStringOfCommandKeys(cont, keybuf, 256);
+ uint16 keybuf_size = GetWideStringLength(keybuf);
+ for (uint16 j = 0; j < keybuf_size; j++) {
+ *(_outstr++) = keybuf[j];
+ keybuf[j] = '\0';
+ }
+ i += contSize + 1;
+ }
+ }
+ }
+ } else {
+ *(_outstr++) = str[i++];
+ }
+ }
+ *_outstr = '\0';
+
+ for (i = 0; i < GetWideStringLength(outstr); i++)
+ str[i] = outstr[i];
+
+ while (i < 256)
+ str[i++] = '\0';
+}
+
+void
+CMessages::AddMessageWithNumber(wchar *str, uint32 time, uint16 flag, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6)
+{
+ wchar outstr[512]; // unused
+ InsertNumberInString(str, n1, n2, n3, n4, n5, n6, outstr);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ uint16 i = 0;
+ while (i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText)
+ i++;
+
+ if (i >= NUMBRIEFMESSAGES) return;
+
+ BriefMessages[i].m_pText = str;
+ BriefMessages[i].m_nFlag = flag;
+ BriefMessages[i].m_nTime = time;
+ BriefMessages[i].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[i].m_nNumber[0] = n1;
+ BriefMessages[i].m_nNumber[1] = n2;
+ BriefMessages[i].m_nNumber[2] = n3;
+ BriefMessages[i].m_nNumber[3] = n4;
+ BriefMessages[i].m_nNumber[4] = n5;
+ BriefMessages[i].m_nNumber[5] = n6;
+ BriefMessages[i].m_pString = nil;
+ if (i == 0)
+ AddToPreviousBriefArray(
+ BriefMessages[0].m_pText,
+ BriefMessages[0].m_nNumber[0],
+ BriefMessages[0].m_nNumber[1],
+ BriefMessages[0].m_nNumber[2],
+ BriefMessages[0].m_nNumber[3],
+ BriefMessages[0].m_nNumber[4],
+ BriefMessages[0].m_nNumber[5],
+ BriefMessages[0].m_pString);
+}
+
+void
+CMessages::AddMessageJumpQWithNumber(wchar *str, uint32 time, uint16 flag, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6)
+{
+ wchar outstr[512]; // unused
+ InsertNumberInString(str, n1, n2, n3, n4, n5, n6, outstr);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ BriefMessages[0].m_pText = str;
+ BriefMessages[0].m_nFlag = flag;
+ BriefMessages[0].m_nTime = time;
+ BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[0].m_nNumber[0] = n1;
+ BriefMessages[0].m_nNumber[1] = n2;
+ BriefMessages[0].m_nNumber[2] = n3;
+ BriefMessages[0].m_nNumber[3] = n4;
+ BriefMessages[0].m_nNumber[4] = n5;
+ BriefMessages[0].m_nNumber[5] = n6;
+ BriefMessages[0].m_pString = nil;
+ AddToPreviousBriefArray(str, n1, n2, n3, n4, n5, n6, nil);
+}
+
+void
+CMessages::AddMessageSoonWithNumber(wchar *str, uint32 time, uint16 flag, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6)
+{
+ wchar outstr[512]; // unused
+ InsertNumberInString(str, n1, n2, n3, n4, n5, n6, outstr);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ if (BriefMessages[0].m_pText != nil) {
+ for (int32 i = NUMBRIEFMESSAGES-1; i > 1; i--)
+ BriefMessages[i] = BriefMessages[i-1];
+
+ BriefMessages[1].m_pText = str;
+ BriefMessages[1].m_nFlag = flag;
+ BriefMessages[1].m_nTime = time;
+ BriefMessages[1].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[1].m_nNumber[0] = n1;
+ BriefMessages[1].m_nNumber[1] = n2;
+ BriefMessages[1].m_nNumber[2] = n3;
+ BriefMessages[1].m_nNumber[3] = n4;
+ BriefMessages[1].m_nNumber[4] = n5;
+ BriefMessages[1].m_nNumber[5] = n6;
+ BriefMessages[1].m_pString = nil;
+ } else {
+ BriefMessages[0].m_pText = str;
+ BriefMessages[0].m_nFlag = flag;
+ BriefMessages[0].m_nTime = time;
+ BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[0].m_nNumber[0] = n1;
+ BriefMessages[0].m_nNumber[1] = n2;
+ BriefMessages[0].m_nNumber[2] = n3;
+ BriefMessages[0].m_nNumber[3] = n4;
+ BriefMessages[0].m_nNumber[4] = n5;
+ BriefMessages[0].m_nNumber[5] = n6;
+ BriefMessages[0].m_pString = nil;
+ AddToPreviousBriefArray(str, n1, n2, n3, n4, n5, n6, nil);
+ }
+}
+
+void
+CMessages::AddBigMessageWithNumber(wchar *str, uint32 time, uint16 style, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6)
+{
+ wchar outstr[512]; // unused
+ InsertNumberInString(str, n1, n2, n3, n4, n5, n6, outstr);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ BIGMessages[style].m_Stack[0].m_pText = str;
+ BIGMessages[style].m_Stack[0].m_nFlag = 0;
+ BIGMessages[style].m_Stack[0].m_nTime = time;
+ BIGMessages[style].m_Stack[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BIGMessages[style].m_Stack[0].m_nNumber[0] = n1;
+ BIGMessages[style].m_Stack[0].m_nNumber[1] = n2;
+ BIGMessages[style].m_Stack[0].m_nNumber[2] = n3;
+ BIGMessages[style].m_Stack[0].m_nNumber[3] = n4;
+ BIGMessages[style].m_Stack[0].m_nNumber[4] = n5;
+ BIGMessages[style].m_Stack[0].m_nNumber[5] = n6;
+ BIGMessages[style].m_Stack[0].m_pString = nil;
+}
+
+void
+CMessages::AddBigMessageWithNumberQ(wchar *str, uint32 time, uint16 style, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6)
+{
+ wchar outstr[512]; // unused
+ InsertNumberInString(str, n1, n2, n3, n4, n5, n6, outstr);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ int32 i = 0;
+
+ while (i < 4 && BIGMessages[style].m_Stack[i].m_pText != nil)
+ i++;
+
+ if (i >= 4) return;
+
+ BIGMessages[style].m_Stack[i].m_pText = str;
+ BIGMessages[style].m_Stack[i].m_nFlag = 0;
+ BIGMessages[style].m_Stack[i].m_nTime = time;
+ BIGMessages[style].m_Stack[i].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BIGMessages[style].m_Stack[i].m_nNumber[0] = n1;
+ BIGMessages[style].m_Stack[i].m_nNumber[1] = n2;
+ BIGMessages[style].m_Stack[i].m_nNumber[2] = n3;
+ BIGMessages[style].m_Stack[i].m_nNumber[3] = n4;
+ BIGMessages[style].m_Stack[i].m_nNumber[4] = n5;
+ BIGMessages[style].m_Stack[i].m_nNumber[5] = n6;
+ BIGMessages[style].m_Stack[i].m_pString = nil;
+}
+
+void
+CMessages::AddMessageWithString(wchar *text, uint32 time, uint16 flag, wchar *str)
+{
+ wchar outstr[512]; // unused
+ WideStringCopy(outstr, text, 256);
+ InsertStringInString(outstr, str);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ int32 i = 0;
+ while (i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText != nil)
+ i++;
+
+ if (i >= NUMBRIEFMESSAGES) return;
+
+ BriefMessages[i].m_pText = text;
+ BriefMessages[i].m_nFlag = flag;
+ BriefMessages[i].m_nTime = time;
+ BriefMessages[i].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[i].m_nNumber[0] = -1;
+ BriefMessages[i].m_nNumber[1] = -1;
+ BriefMessages[i].m_nNumber[2] = -1;
+ BriefMessages[i].m_nNumber[3] = -1;
+ BriefMessages[i].m_nNumber[4] = -1;
+ BriefMessages[i].m_nNumber[5] = -1;
+ BriefMessages[i].m_pString = str;
+ if (i == 0)
+ AddToPreviousBriefArray(
+ BriefMessages[0].m_pText,
+ BriefMessages[0].m_nNumber[0],
+ BriefMessages[0].m_nNumber[1],
+ BriefMessages[0].m_nNumber[2],
+ BriefMessages[0].m_nNumber[3],
+ BriefMessages[0].m_nNumber[4],
+ BriefMessages[0].m_nNumber[5],
+ BriefMessages[0].m_pString);
+}
+
+void
+CMessages::AddMessageJumpQWithString(wchar *text, uint32 time, uint16 flag, wchar *str)
+{
+ wchar outstr[512]; // unused
+ WideStringCopy(outstr, text, 256);
+ InsertStringInString(outstr, str);
+ InsertPlayerControlKeysInString(outstr);
+ GetWideStringLength(outstr);
+
+ BriefMessages[0].m_pText = text;
+ BriefMessages[0].m_nFlag = flag;
+ BriefMessages[0].m_nTime = time;
+ BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ BriefMessages[0].m_nNumber[0] = -1;
+ BriefMessages[0].m_nNumber[1] = -1;
+ BriefMessages[0].m_nNumber[2] = -1;
+ BriefMessages[0].m_nNumber[3] = -1;
+ BriefMessages[0].m_nNumber[4] = -1;
+ BriefMessages[0].m_nNumber[5] = -1;
+ BriefMessages[0].m_pString = str;
+ AddToPreviousBriefArray(text, -1, -1, -1, -1, -1, -1, str);
+}
+
+inline bool
+FastWideStringComparison(wchar *str1, wchar *str2)
+{
+ while (*str1 == *str2) {
+ ++str1;
+ ++str2;
+ if (!*str1 && !*str2) return true;
+ }
+ return false;
+}
+
+void
+CMessages::ClearThisPrint(wchar *str)
+{
+ bool equal;
+
+ do {
+ equal = false;
+ uint16 i = 0;
+ while (i < NUMBRIEFMESSAGES) {
+ if (BriefMessages[i].m_pText == nil)
+ break;
+
+ equal = FastWideStringComparison(str, BriefMessages[i].m_pText);
+
+ if (equal) break;
+ i++;
+ }
+
+ if (equal) {
+ if (i != 0) {
+ BriefMessages[i].m_pText = nil;
+ while (i < NUMBRIEFMESSAGES-1) {
+ if (BriefMessages[i + 1].m_pText == nil)
+ break;
+
+ BriefMessages[i] = BriefMessages[i + 1];
+ i++;
+ }
+ BriefMessages[i].m_pText = nil;
+ } else {
+ BriefMessages[0].m_pText = nil;
+ while (i < NUMBRIEFMESSAGES-1) {
+ if (BriefMessages[i + 1].m_pText == nil)
+ break;
+ BriefMessages[i] = BriefMessages[i + 1];
+ i++;
+ }
+ BriefMessages[i].m_pText = nil;
+ BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ if (BriefMessages[0].m_pText == nil)
+ AddToPreviousBriefArray(
+ BriefMessages[0].m_pText,
+ BriefMessages[0].m_nNumber[0],
+ BriefMessages[0].m_nNumber[1],
+ BriefMessages[0].m_nNumber[2],
+ BriefMessages[0].m_nNumber[3],
+ BriefMessages[0].m_nNumber[4],
+ BriefMessages[0].m_nNumber[5],
+ BriefMessages[0].m_pString);
+ }
+ }
+ } while (equal);
+}
+
+void
+CMessages::ClearThisBigPrint(wchar *str)
+{
+ bool equal;
+
+ do {
+ uint16 i = 0;
+ equal = false;
+ uint16 style = 0;
+ while (style < NUMBIGMESSAGES)
+ {
+ if (i >= 4)
+ break;
+
+ if (CMessages::BIGMessages[style].m_Stack[i].m_pText == nil || equal)
+ break;
+
+ equal = FastWideStringComparison(str, BIGMessages[style].m_Stack[i].m_pText);
+
+ if (!equal && ++i == 4) {
+ i = 0;
+ style++;
+ }
+ }
+ if (equal) {
+ if (i != 0) {
+ BIGMessages[style].m_Stack[i].m_pText = nil;
+ while (i < 3) {
+ if (BIGMessages[style].m_Stack[i + 1].m_pText == nil)
+ break;
+ BIGMessages[style].m_Stack[i] = BIGMessages[style].m_Stack[i + 1];
+ i++;
+ }
+ BIGMessages[style].m_Stack[i].m_pText = nil;
+ } else {
+ BIGMessages[style].m_Stack[0].m_pText = 0;
+ i = 0;
+ while (i < 3) {
+ if (BIGMessages[style].m_Stack[i + 1].m_pText == nil)
+ break;
+ BIGMessages[style].m_Stack[i] = BIGMessages[style].m_Stack[i + 1];
+ i++;
+ }
+ BIGMessages[style].m_Stack[i].m_pText = nil;
+ BIGMessages[style].m_Stack[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
+ }
+ }
+ } while (equal);
+}
+
+void
+CMessages::ClearAllMessagesDisplayedByGame()
+{
+ ClearMessages();
+ for (int32 i = 0; i < NUMPREVIOUSBRIEFS; i++) {
+ PreviousBriefs[i].m_pText = nil;
+ PreviousBriefs[i].m_pString = nil;
+ }
+ CHud::GetRidOfAllHudMessages();
+ CUserDisplay::Pager.ClearMessages();
+}
+
+STARTPATCHES
+ InjectHook(0x529310, CMessages::Init, PATCH_JUMP);
+ InjectHook(0x529490, CMessages::GetWideStringLength, PATCH_JUMP);
+ InjectHook(0x5294B0, CMessages::WideStringCopy, PATCH_JUMP);
+ InjectHook(0x529510, CMessages::WideStringCompare, PATCH_JUMP);
+ InjectHook(0x529580, CMessages::Process, PATCH_JUMP);
+ InjectHook(0x529800, CMessages::Display, PATCH_JUMP);
+ InjectHook(0x529900, CMessages::AddMessage, PATCH_JUMP);
+ InjectHook(0x529A10, CMessages::AddMessageJumpQ, PATCH_JUMP);
+ InjectHook(0x529AF0, CMessages::AddMessageSoon, PATCH_JUMP);
+ InjectHook(0x529CE0, CMessages::ClearMessages, PATCH_JUMP);
+ InjectHook(0x529E00, CMessages::ClearSmallMessagesOnly, PATCH_JUMP);
+ InjectHook(0x529EB0, CMessages::AddBigMessage, PATCH_JUMP);
+ InjectHook(0x529F60, CMessages::AddBigMessageQ, PATCH_JUMP);
+ InjectHook(0x52A040, CMessages::AddToPreviousBriefArray, PATCH_JUMP);
+ InjectHook(0x52A1A0, CMessages::InsertNumberInString, PATCH_JUMP);
+ InjectHook(0x52A300, CMessages::InsertStringInString, PATCH_JUMP);
+ InjectHook(0x52A490, CMessages::InsertPlayerControlKeysInString, PATCH_JUMP);
+ InjectHook(0x52A850, CMessages::AddMessageWithNumber, PATCH_JUMP);
+ InjectHook(0x52A9A0, CMessages::AddMessageJumpQWithNumber, PATCH_JUMP);
+ InjectHook(0x52AAC0, CMessages::AddMessageSoonWithNumber, PATCH_JUMP);
+ InjectHook(0x52AD10, CMessages::AddBigMessageWithNumber, PATCH_JUMP);
+ InjectHook(0x52AE00, CMessages::AddBigMessageWithNumberQ, PATCH_JUMP);
+ InjectHook(0x52AF30, CMessages::AddMessageWithString, PATCH_JUMP);
+ InjectHook(0x52B050, CMessages::AddMessageJumpQWithString, PATCH_JUMP);
+ InjectHook(0x52B140, CMessages::ClearThisPrint, PATCH_JUMP);
+ InjectHook(0x52B3C0, CMessages::ClearThisBigPrint, PATCH_JUMP);
+ InjectHook(0x52B670, CMessages::ClearAllMessagesDisplayedByGame, PATCH_JUMP);
+ENDPATCHES
\ No newline at end of file diff --git a/src/text/Messages.h b/src/text/Messages.h new file mode 100644 index 00000000..8044c626 --- /dev/null +++ b/src/text/Messages.h @@ -0,0 +1,69 @@ +#pragma once + +struct tMessage +{ + wchar *m_pText; + uint16 m_nFlag; + uint32 m_nTime; + uint32 m_nStartTime; + int32 m_nNumber[6]; + wchar *m_pString; +}; + +struct tBigMessage +{ + tMessage m_Stack[4]; +}; + +struct tPreviousBrief +{ + wchar *m_pText; + int32 m_nNumber[6]; + wchar *m_pString; +}; + +#define NUMBRIEFMESSAGES 8 +#define NUMBIGMESSAGES 6 +#define NUMPREVIOUSBRIEFS 5 + +class CMessages +{ +public: + static tMessage(&BriefMessages)[NUMBRIEFMESSAGES]; + static tBigMessage(&BIGMessages)[NUMBIGMESSAGES]; + static tPreviousBrief(&PreviousBriefs)[NUMPREVIOUSBRIEFS]; + static char PreviousMissionTitle[16]; // unused +public: + static void Init(void); + static uint16 GetWideStringLength(wchar *src); + static void WideStringCopy(wchar *dst, wchar *src, uint16 size); + static bool WideStringCompare(wchar *str1, wchar *str2, uint16 size); + static void Process(void); + static void Display(void); + static void AddMessage(wchar *key, uint32 time, uint16 pos); + static void AddMessageJumpQ(wchar *key, uint32 time, uint16 pos); + static void AddMessageSoon(wchar *key, uint32 time, uint16 pos); + static void ClearMessages(void); + static void ClearSmallMessagesOnly(void); + static void AddBigMessage(wchar *key, uint32 time, uint16 pos); + static void AddBigMessageQ(wchar *key, uint32 time, uint16 pos); + static void AddToPreviousBriefArray(wchar *text, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, wchar *string); + static void InsertNumberInString(wchar *src, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, wchar *dst); + static void InsertStringInString(wchar *str1, wchar *str2); + static void InsertPlayerControlKeysInString(wchar *src); + static void AddMessageWithNumber(wchar *key, uint32 time, uint16 pos, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6); + static void AddMessageJumpQWithNumber(wchar *key, uint32 time, uint16 pos, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6); + static void AddMessageSoonWithNumber(wchar *key, uint32 time, uint16 pos, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6); + static void AddBigMessageWithNumber(wchar *key, uint32 time, uint16 pos, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6); + static void AddBigMessageWithNumberQ(wchar *key, uint32 time, uint16 pos, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6); + static void AddMessageWithString(wchar *text, uint32 time, uint16 flag, wchar *str); + static void AddMessageJumpQWithString(wchar *text, uint32 time, uint16 flag, wchar *str); + static void ClearThisPrint(wchar *str); + static void ClearThisBigPrint(wchar *str); + static void ClearAllMessagesDisplayedByGame(void); + + // unused or cut + //static void AddMessageSoonWithString(wchar*, uint32, uint16, wchar*); + //static void CutString(int16, char*, char**); + //static void PrintString(char*, int16, int16, int16); +}; diff --git a/src/text/Pager.cpp b/src/text/Pager.cpp new file mode 100644 index 00000000..9e484c29 --- /dev/null +++ b/src/text/Pager.cpp @@ -0,0 +1,194 @@ +#include "common.h"
+#include "patcher.h"
+#include "Pager.h"
+#include "Timer.h"
+#include "Messages.h"
+#include "Hud.h"
+#include "Camera.h"
+
+void
+CPager::Init()
+{
+ ClearMessages();
+ m_nNumDisplayLetters = 8;
+}
+
+void
+CPager::Process()
+{
+ if (m_messages[0].m_pText != nil && m_messages[0].m_nCurrentPosition >= (int32)m_messages[0].m_nStringLength) {
+ m_messages[0].m_pText = nil;
+ uint16 i = 0;
+ while (i < NUMPAGERMESSAGES-1) {
+ if (m_messages[i + 1].m_pText == nil) break;
+ m_messages[i] = m_messages[i + 1];
+ i++;
+ }
+ m_messages[i].m_pText = nil;
+ if (m_messages[0].m_pText != nil)
+ CMessages::AddToPreviousBriefArray(
+ m_messages[0].m_pText,
+ m_messages[0].m_nNumber[0],
+ m_messages[0].m_nNumber[1],
+ m_messages[0].m_nNumber[2],
+ m_messages[0].m_nNumber[3],
+ m_messages[0].m_nNumber[4],
+ m_messages[0].m_nNumber[5],
+ 0);
+ }
+ Display();
+ if (m_messages[0].m_pText != nil) {
+ if (TheCamera.m_WideScreenOn || !CHud::m_Wants_To_Draw_Hud || CHud::m_BigMessage[0][0] || CHud::m_BigMessage[2][0]) {
+ RestartCurrentMessage();
+ } else {
+ if (CTimer::GetTimeInMilliseconds() > m_messages[0].m_nTimeToChangePosition) {
+ m_messages[0].m_nCurrentPosition++;
+ m_messages[0].m_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + m_messages[0].m_nSpeedMs;
+ }
+ }
+ }
+}
+
+void
+CPager::Display()
+{
+ wchar outstr1[256];
+ wchar outstr2[260];
+
+ wchar *pText = m_messages[0].m_pText;
+ uint16 i = 0;
+ if (pText != nil) {
+ CMessages::InsertNumberInString(
+ pText,
+ m_messages[0].m_nNumber[0],
+ m_messages[0].m_nNumber[1],
+ m_messages[0].m_nNumber[2],
+ m_messages[0].m_nNumber[3],
+ m_messages[0].m_nNumber[4],
+ m_messages[0].m_nNumber[5],
+ outstr1);
+ for (; i < m_nNumDisplayLetters; i++) {
+ int pos = m_messages[0].m_nCurrentPosition + i;
+ if (pos >= 0) {
+ if (!outstr1[pos]) break;
+
+ outstr2[i] = outstr1[pos];
+ } else {
+ outstr2[i] = ' ';
+ }
+ }
+ }
+ outstr2[i] = '\0';
+ CHud::SetPagerMessage(outstr2);
+}
+
+void
+CPager::AddMessage(wchar *str, uint16 speed, uint16 priority, uint16 a5)
+{
+ uint16 size = CMessages::GetWideStringLength(str);
+ for (int32 i = 0; i < NUMPAGERMESSAGES; i++) {
+ if (m_messages[i].m_pText) {
+ if (m_messages[i].m_nPriority >= priority)
+ continue;
+
+ for (int j = NUMPAGERMESSAGES-1; j > i; j--)
+ m_messages[j] = m_messages[j-1];
+
+ }
+ m_messages[i].m_pText = str;
+ m_messages[i].m_nSpeedMs = speed;
+ m_messages[i].m_nPriority = priority;
+ m_messages[i].field_10 = a5;
+ m_messages[i].m_nCurrentPosition = -(m_nNumDisplayLetters + 10);
+ m_messages[i].m_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + speed;
+ m_messages[i].m_nStringLength = size;
+ m_messages[i].m_nNumber[0] = -1;
+ m_messages[i].m_nNumber[1] = -1;
+ m_messages[i].m_nNumber[2] = -1;
+ m_messages[i].m_nNumber[3] = -1;
+ m_messages[i].m_nNumber[4] = -1;
+ m_messages[i].m_nNumber[5] = -1;
+
+ if (i == 0)
+ CMessages::AddToPreviousBriefArray(
+ m_messages[0].m_pText,
+ m_messages[0].m_nNumber[0],
+ m_messages[0].m_nNumber[1],
+ m_messages[0].m_nNumber[2],
+ m_messages[0].m_nNumber[3],
+ m_messages[0].m_nNumber[4],
+ m_messages[0].m_nNumber[5],
+ nil);
+ return;
+ }
+}
+
+void
+CPager::AddMessageWithNumber(wchar *str, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, uint16 speed, uint16 priority, uint16 a11)
+{
+ wchar nstr[520];
+
+ CMessages::InsertNumberInString(str, n1, n2, n3, n4, n5, n6, nstr);
+ uint16 size = CMessages::GetWideStringLength(nstr);
+ for (int32 i = 0; i < NUMPAGERMESSAGES; i++) {
+ if (m_messages[i].m_pText) {
+ if (m_messages[i].m_nPriority >= priority)
+ continue;
+
+ for (int j = NUMPAGERMESSAGES-1; j > i; j--)
+ m_messages[j] = m_messages[j - 1];
+
+ }
+ m_messages[i].m_pText = str;
+ m_messages[i].m_nSpeedMs = speed;
+ m_messages[i].m_nPriority = priority;
+ m_messages[i].field_10 = a11;
+ m_messages[i].m_nCurrentPosition = -(m_nNumDisplayLetters + 10);
+ m_messages[i].m_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + speed;
+ m_messages[i].m_nStringLength = size;
+ m_messages[i].m_nNumber[0] = n1;
+ m_messages[i].m_nNumber[1] = n2;
+ m_messages[i].m_nNumber[2] = n3;
+ m_messages[i].m_nNumber[3] = n4;
+ m_messages[i].m_nNumber[4] = n5;
+ m_messages[i].m_nNumber[5] = n6;
+
+ if (i == 0)
+ CMessages::AddToPreviousBriefArray(
+ m_messages[0].m_pText,
+ m_messages[0].m_nNumber[0],
+ m_messages[0].m_nNumber[1],
+ m_messages[0].m_nNumber[2],
+ m_messages[0].m_nNumber[3],
+ m_messages[0].m_nNumber[4],
+ m_messages[0].m_nNumber[5],
+ nil);
+ return;
+ }
+}
+
+void
+CPager::ClearMessages()
+{
+ for (int32 i = 0; i < NUMPAGERMESSAGES; i++)
+ m_messages[i].m_pText = nil;
+}
+
+void
+CPager::RestartCurrentMessage()
+{
+ if (m_messages[0].m_pText != nil) {
+ m_messages[0].m_nCurrentPosition = -(m_nNumDisplayLetters + 10);
+ m_messages[0].m_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + m_messages[0].m_nSpeedMs;
+ }
+}
+
+STARTPATCHES
+ InjectHook(0x52B6F0, &CPager::Init, PATCH_JUMP);
+ InjectHook(0x52B740, &CPager::Process, PATCH_JUMP);
+ InjectHook(0x52B890, &CPager::Display, PATCH_JUMP);
+ InjectHook(0x52B940, &CPager::AddMessage, PATCH_JUMP);
+ InjectHook(0x52BB50, &CPager::AddMessageWithNumber, PATCH_JUMP);
+ InjectHook(0x52BE50, &CPager::RestartCurrentMessage, PATCH_JUMP);
+ InjectHook(0x52BE00, &CPager::ClearMessages, PATCH_JUMP);
+ENDPATCHES
\ No newline at end of file diff --git a/src/text/Pager.h b/src/text/Pager.h new file mode 100644 index 00000000..727eeb24 --- /dev/null +++ b/src/text/Pager.h @@ -0,0 +1,28 @@ +#pragma once
+ +struct PagerMessage {
+ wchar *m_pText;
+ uint16 m_nSpeedMs;
+ int16 m_nCurrentPosition;
+ uint16 m_nStringLength;
+ uint16 m_nPriority;
+ uint32 m_nTimeToChangePosition;
+ int16 field_10;
+ int32 m_nNumber[6];
+}; + +#define NUMPAGERMESSAGES 8 + +class CPager +{ + int16 m_nNumDisplayLetters;
+ PagerMessage m_messages[NUMPAGERMESSAGES]; +public:
+ void Init(); + void Process(); + void Display(); + void AddMessage(wchar*, uint16, uint16, uint16);
+ void AddMessageWithNumber(wchar *str, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, uint16 speed, uint16 priority, uint16 a11); + void ClearMessages(); + void RestartCurrentMessage(); +};
\ No newline at end of file diff --git a/src/core/Text.cpp b/src/text/Text.cpp index dfa9815c..40717ed5 100644 --- a/src/core/Text.cpp +++ b/src/text/Text.cpp @@ -11,20 +11,10 @@ CText &TheText = *(CText*)0x941520; CText::CText(void) { - keyArray.entries = nil; - keyArray.numEntries = 0; - data.chars = nil; - data.numChars = 0; - encoding = 101; + encoding = 'e'; memset(WideErrorString, 0, sizeof(WideErrorString)); } -CText::~CText(void) -{ - data.Unload(); - keyArray.Unload(); -} - void CText::Load(void) { @@ -96,12 +86,64 @@ CText::Get(const char *key) return keyArray.Search(key); } +wchar UpperCaseTable[128] = { + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
+ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
+ 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
+ 149, 173, 173, 175, 176, 177, 178, 179, 180, 181, 182,
+ 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
+ 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
+ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
+ 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226,
+ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
+ 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248,
+ 249, 250, 251, 252, 253, 254, 255 +}; + +wchar FrenchUpperCaseTable[128] = { + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
+ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 65, 65, 65, 65, 132, 133, 69, 69, 69, 69, 73, 73,
+ 73, 73, 79, 79, 79, 79, 85, 85, 85, 85, 173, 173, 175,
+ 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
+ 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
+ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
+ 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
+ 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
+ 253, 254, 255 +}; + wchar CText::GetUpperCase(wchar c) -{ - // TODO: do this depending on encoding - if(islower(c)) - return toupper(c); +{
+ switch (encoding)
+ {
+ case 'e':
+ if (c >= 'a' && c <= 'z')
+ return c - 32;
+ break;
+ case 'f':
+ if (c >= 'a' && c <= 'z')
+ return c - 32;
+
+ if (c >= 128 && c <= 255)
+ return FrenchUpperCaseTable[c-128];
+ break;
+ case 'g':
+ case 'i':
+ case 's':
+ if (c >= 'a' && c <= 'z')
+ return c - 32;
+
+ if (c >= 128 && c <= 255)
+ return UpperCaseTable[c-128];
+ break;
+ default:
+ break;
+ }
return c; } @@ -205,7 +247,7 @@ CData::Unload(void) } void -AsciiToUnicode(const char *src, uint16 *dst) +AsciiToUnicode(const char *src, wchar *dst) { while((*dst++ = *src++) != '\0'); } @@ -215,8 +257,8 @@ UnicodeToAscii(wchar *src) { static char aStr[256]; int len; - for(len = 0; src && *src != 0 && len < 256-1; len++, src++) - if(*src < 256) + for(len = 0; *src != '\0' && len < 256-1; len++, src++) + if(*src < 128) aStr[len] = *src; else aStr[len] = '#'; @@ -227,10 +269,9 @@ UnicodeToAscii(wchar *src) char* UnicodeToAsciiForSaveLoad(wchar *src) { - // exact same code as above static char aStr[256]; int len; - for(len = 0; src && *src != 0 && len < 256-1; len++, src++) + for(len = 0; *src != '\0' && len < 256-1; len++, src++) if(*src < 256) aStr[len] = *src; else @@ -249,7 +290,7 @@ int UnicodeStrlen(const wchar *str) { int len; - for(len = 0; *str != 0; len++, str++); + for(len = 0; *str != '\0'; len++, str++); return len; } @@ -264,6 +305,8 @@ STARTPATCHES InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP); InjectHook(0x52C580, &CText::Unload, PATCH_JUMP); InjectHook(0x52C5A0, &CText::Get, PATCH_JUMP); + InjectHook(0x52C220, &CText::GetUpperCase, PATCH_JUMP); + InjectHook(0x52C2C0, &CText::UpperCase, PATCH_JUMP); InjectHook(0x52BE70, &CKeyArray::Load, PATCH_JUMP); InjectHook(0x52BF60, &CKeyArray::Unload, PATCH_JUMP); diff --git a/src/core/Text.h b/src/text/Text.h index f554628c..6f39ba49 100644 --- a/src/core/Text.h +++ b/src/text/Text.h @@ -21,6 +21,8 @@ public: CKeyEntry *entries; int numEntries; + CKeyArray(void) : entries(nil), numEntries(0) {} + ~CKeyArray(void) { Unload(); } void Load(uint32 length, uint8 *data, int *offset); void Unload(void); void Update(wchar *chars); @@ -34,6 +36,8 @@ public: wchar *chars; int numChars; + CData(void) : chars(nil), numChars(0) {} + ~CData(void) { Unload(); } void Load(uint32 length, uint8 *data, int *offset); void Unload(void); }; @@ -42,10 +46,9 @@ class CText { CKeyArray keyArray; CData data; - int8 encoding; + char encoding; public: CText(void); - ~CText(void); void Load(void); void Unload(void); wchar *Get(const char *key); diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 7229992d..3d02dd25 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -15,7 +15,6 @@ #include "PointLights.h" #include "Renderer.h" #include "DMAudio.h" -#include "MusicManager.h" #include "Radar.h" bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index a30f9842..3046a58f 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -191,7 +191,7 @@ public: uint8 m_bRainAudioCounter; uint8 m_bRainSamplesCounter; uint8 m_nCarHornTimer; - int8 field_22D; + int8 field_22D; // last horn? bool m_bSirenOrAlarm; int8 m_comedyControlState; CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car @@ -286,7 +286,7 @@ class cTransmission; class cVehicleParams { public: - char m_bDistanceCalculated; + uint8 m_bDistancECalculated; char gap_1[3]; float m_fDistance; CVehicle *m_pVehicle; diff --git a/src/weapons/CProjectileInfo.cpp b/src/weapons/CProjectileInfo.cpp new file mode 100644 index 00000000..f3c78ed8 --- /dev/null +++ b/src/weapons/CProjectileInfo.cpp @@ -0,0 +1,10 @@ +#include "CProjectileInfo.h" + +CProjectileInfo *gaProjectileInfo = (CProjectileInfo *)0x64ED50; +CProjectileInfo *CProjectileInfo::ms_apProjectile = (CProjectileInfo *)0x87C748; + +CProjectileInfo * +CProjectileInfo::GetProjectileInfo(int32 id) +{ + return &gaProjectileInfo[id]; +} diff --git a/src/weapons/CProjectileInfo.h b/src/weapons/CProjectileInfo.h new file mode 100644 index 00000000..426d25f1 --- /dev/null +++ b/src/weapons/CProjectileInfo.h @@ -0,0 +1,20 @@ +#pragma once + +#include "Object.h" +#include "Weapon.h" + +struct CProjectileInfo : public CObject { + eWeaponType m_eWeaponType; + CEntity *m_pSource; + int m_nExplosionTime; + char m_bInUse; + char field_13; + char field_14; + char field_15; + CVector m_vecPos; + + static CProjectileInfo *GetProjectileInfo(int32 id); + static CProjectileInfo *ms_apProjectile; +}; + +extern CProjectileInfo *gaProjectileInfo;
\ No newline at end of file diff --git a/src/weapons/ProjectileInfo.cpp b/src/weapons/ProjectileInfo.cpp new file mode 100644 index 00000000..50d75516 --- /dev/null +++ b/src/weapons/ProjectileInfo.cpp @@ -0,0 +1,7 @@ +#include "common.h" +#include "patcher.h" +#include "ProjectileInfo.h" +#include "Projectile.h" + + +WRAPPER bool CProjectileInfo::RemoveIfThisIsAProjectile(CObject *pObject) { EAXJMP(0x55BBD0); }
\ No newline at end of file diff --git a/src/weapons/ProjectileInfo.h b/src/weapons/ProjectileInfo.h new file mode 100644 index 00000000..f4753b28 --- /dev/null +++ b/src/weapons/ProjectileInfo.h @@ -0,0 +1,9 @@ +#pragma once
+
+class CObject;
+
+class CProjectileInfo
+{
+public:
+ static bool RemoveIfThisIsAProjectile(CObject *pObject);
+};
\ No newline at end of file diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 3f511358..860e3ab2 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -6,6 +6,7 @@ #include "Ped.h" #include "World.h" +WRAPPER void CWeapon::UpdateWeapons(void) { EAXJMP(0x55C310); } WRAPPER bool CWeapon::Fire(CEntity*, CVector*) { EAXJMP(0x55C380); } WRAPPER void CWeapon::FireFromCar(CAutomobile *car, bool left) { EAXJMP(0x55C940); } WRAPPER void CWeapon::AddGunshell(CEntity*, CVector const&, CVector2D const&, float) { EAXJMP(0x55F770); } diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h index 2f277c62..1663ee0d 100644 --- a/src/weapons/Weapon.h +++ b/src/weapons/Weapon.h @@ -73,5 +73,6 @@ public: static void DoTankDoomAiming(CEntity *playerVehicle, CEntity *playerPed, CVector *start, CVector *end); bool HitsGround(CEntity* holder, CVector* firePos, CEntity* aimingTo); static void InitialiseWeapons(void); + static void UpdateWeapons(void); }; static_assert(sizeof(CWeapon) == 0x18, "CWeapon: error"); |