Merge pull request #797 from theR4K/master

Make code in master same like in audio PR for miami
This commit is contained in:
Sergeanur 2020-11-15 14:55:40 +02:00 committed by GitHub
commit be205d9602
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 229 additions and 219 deletions

View File

@ -599,78 +599,78 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
case VEHICLE_TYPE_CAR: case VEHICLE_TYPE_CAR:
UpdateGasPedalAudio((CAutomobile *)veh); UpdateGasPedalAudio((CAutomobile *)veh);
if (params.m_nIndex == RCBANDIT) { if (params.m_nIndex == RCBANDIT) {
ProcessModelCarEngine(&params); ProcessModelCarEngine(params);
ProcessVehicleOneShots(&params); ProcessVehicleOneShots(params);
((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
break; break;
} }
if (params.m_nIndex == DODO) { if (params.m_nIndex == DODO) {
if (!ProcessVehicleRoadNoise(&params)) { if (!ProcessVehicleRoadNoise(params)) {
ProcessVehicleOneShots(&params); ProcessVehicleOneShots(params);
((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
break; break;
} }
if (CWeather::WetRoads > 0.f) if (CWeather::WetRoads > 0.f)
ProcessWetRoadNoise(&params); ProcessWetRoadNoise(params);
ProcessVehicleSkidding(&params); ProcessVehicleSkidding(params);
} else { } else {
if (!ProcessVehicleRoadNoise(&params)) { if (!ProcessVehicleRoadNoise(params)) {
ProcessVehicleOneShots(&params); ProcessVehicleOneShots(params);
((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
break; break;
} }
ProcessReverseGear(&params); ProcessReverseGear(params);
if (CWeather::WetRoads > 0.f) if (CWeather::WetRoads > 0.f)
ProcessWetRoadNoise(&params); ProcessWetRoadNoise(params);
ProcessVehicleSkidding(&params); ProcessVehicleSkidding(params);
ProcessVehicleHorn(&params); ProcessVehicleHorn(params);
ProcessVehicleSirenOrAlarm(&params); ProcessVehicleSirenOrAlarm(params);
if (UsesReverseWarning(params.m_nIndex)) if (UsesReverseWarning(params.m_nIndex))
ProcessVehicleReverseWarning(&params); ProcessVehicleReverseWarning(params);
if (HasAirBrakes(params.m_nIndex)) if (HasAirBrakes(params.m_nIndex))
ProcessAirBrakes(&params); ProcessAirBrakes(params);
} }
ProcessCarBombTick(&params); ProcessCarBombTick(params);
ProcessVehicleEngine(&params); ProcessVehicleEngine(params);
ProcessEngineDamage(&params); ProcessEngineDamage(params);
ProcessVehicleDoors(&params); ProcessVehicleDoors(params);
ProcessVehicleOneShots(&params); ProcessVehicleOneShots(params);
((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
break; break;
case VEHICLE_TYPE_BOAT: case VEHICLE_TYPE_BOAT:
ProcessBoatEngine(&params); ProcessBoatEngine(params);
ProcessBoatMovingOverWater(&params); ProcessBoatMovingOverWater(params);
ProcessVehicleOneShots(&params); ProcessVehicleOneShots(params);
break; break;
case VEHICLE_TYPE_TRAIN: case VEHICLE_TYPE_TRAIN:
ProcessTrainNoise(&params); ProcessTrainNoise(params);
ProcessVehicleOneShots(&params); ProcessVehicleOneShots(params);
break; break;
case VEHICLE_TYPE_HELI: case VEHICLE_TYPE_HELI:
ProcessHelicopter(&params); ProcessHelicopter(params);
ProcessVehicleOneShots(&params); ProcessVehicleOneShots(params);
break; break;
case VEHICLE_TYPE_PLANE: case VEHICLE_TYPE_PLANE:
ProcessPlane(&params); ProcessPlane(params);
ProcessVehicleOneShots(&params); ProcessVehicleOneShots(params);
break; break;
default: default:
break; break;
} }
ProcessRainOnVehicle(&params); ProcessRainOnVehicle(params);
} }
void void
cAudioManager::ProcessRainOnVehicle(cVehicleParams *params) cAudioManager::ProcessRainOnVehicle(cVehicleParams& params)
{ {
const int rainOnVehicleIntensity = 22; const int rainOnVehicleIntensity = 22;
if (params->m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { if (params.m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
CVehicle *veh = params->m_pVehicle; CVehicle *veh = params.m_pVehicle;
++veh->m_bRainAudioCounter; ++veh->m_bRainAudioCounter;
if (veh->m_bRainAudioCounter >= 2) { if (veh->m_bRainAudioCounter >= 2) {
veh->m_bRainAudioCounter = 0; veh->m_bRainAudioCounter = 0;
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
float emittingVol = 30.f * CWeather::Rain; float emittingVol = 30.f * CWeather::Rain;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
@ -698,7 +698,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params)
} }
bool bool
cAudioManager::ProcessReverseGear(cVehicleParams *params) cAudioManager::ProcessReverseGear(cVehicleParams& params)
{ {
const int reverseGearIntensity = 30; const int reverseGearIntensity = 30;
@ -707,14 +707,14 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
int32 emittingVol; int32 emittingVol;
float modificator; float modificator;
if (params->m_fDistance >= SQR(reverseGearIntensity)) if (params.m_fDistance >= SQR(reverseGearIntensity))
return false; return false;
veh = params->m_pVehicle; veh = params.m_pVehicle;
if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || veh->m_nCurrentGear == 0)) { if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || veh->m_nCurrentGear == 0)) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
automobile = (CAutomobile *)params->m_pVehicle; automobile = (CAutomobile *)params.m_pVehicle;
if (automobile->m_nWheelsOnGround != 0) { if (automobile->m_nWheelsOnGround != 0) {
modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity; modificator = params.m_fVelocityChange / params.m_pTransmission->fMaxReverseVelocity;
} else { } else {
if (automobile->m_nDriveWheelsOnGround != 0) if (automobile->m_nDriveWheelsOnGround != 0)
automobile->m_fGasPedalAudio *= 0.4f; automobile->m_fGasPedalAudio *= 0.4f;
@ -724,7 +724,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
emittingVol = (24.f * modificator); emittingVol = (24.f * modificator);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
if (params->m_pVehicle->m_fGasPedal >= 0.0f) { if (params.m_pVehicle->m_fGasPedal >= 0.0f) {
m_sQueueSample.m_nCounter = 62; m_sQueueSample.m_nCounter = 62;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2; m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2;
} else { } else {
@ -752,7 +752,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
} }
void void
cAudioManager::ProcessModelCarEngine(cVehicleParams *params) cAudioManager::ProcessModelCarEngine(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 30.0f; const float SOUND_INTENSITY = 30.0f;
CAutomobile *automobile; CAutomobile *automobile;
@ -760,24 +760,24 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
int32 emittingVol; int32 emittingVol;
float velocityChange; float velocityChange;
if (params->m_fDistance < SQR(SOUND_INTENSITY)) { if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
automobile = (CAutomobile *)params->m_pVehicle; automobile = (CAutomobile *)params.m_pVehicle;
if (automobile->bEngineOn) { if (automobile->bEngineOn) {
if (automobile->m_nWheelsOnGround == 0) { if (automobile->m_nWheelsOnGround == 0) {
if (automobile->m_nDriveWheelsOnGround != 0) if (automobile->m_nDriveWheelsOnGround != 0)
automobile->m_fGasPedalAudio *= 0.4f; automobile->m_fGasPedalAudio *= 0.4f;
velocityChange = automobile->m_fGasPedalAudio * params->m_pTransmission->fMaxVelocity; velocityChange = automobile->m_fGasPedalAudio * params.m_pTransmission->fMaxVelocity;
} else { } else {
velocityChange = Abs(params->m_fVelocityChange); velocityChange = Abs(params.m_fVelocityChange);
} }
if (velocityChange > 0.001f) { if (velocityChange > 0.001f) {
allowedVelocity = 0.5f * params->m_pTransmission->fMaxVelocity; allowedVelocity = 0.5f * params.m_pTransmission->fMaxVelocity;
if (velocityChange < allowedVelocity) if (velocityChange < allowedVelocity)
emittingVol = (90.f * velocityChange / allowedVelocity); emittingVol = (90.f * velocityChange / allowedVelocity);
else else
emittingVol = 90; emittingVol = 90;
if (emittingVol) { if (emittingVol) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nCounter = 2;
@ -785,7 +785,7 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = (11025.f * velocityChange / params->m_pTransmission->fMaxVelocity + 11025.f); m_sQueueSample.m_nFrequency = (11025.f * velocityChange / params.m_pTransmission->fMaxVelocity + 11025.f);
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@ -807,7 +807,7 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
bool bool
cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params) cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 95.0f; const float SOUND_INTENSITY = 95.0f;
@ -817,21 +817,21 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
int sampleFreq; int sampleFreq;
float velocity; float velocity;
if (params->m_fDistance >= SQR(SOUND_INTENSITY)) if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false; return false;
if (params->m_pTransmission != nil) { if (params.m_pTransmission != nil) {
if (((CAutomobile*)params->m_pVehicle)->m_nDriveWheelsOnGround != 0) { if (((CAutomobile*)params.m_pVehicle)->m_nDriveWheelsOnGround != 0) {
velocity = Abs(params->m_fVelocityChange); velocity = Abs(params.m_fVelocityChange);
if (velocity > 0.0f) { if (velocity > 0.0f) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
emittingVol = 30.f * Min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity)); emittingVol = 30.f * Min(1.f, velocity / (0.5f * params.m_pTransmission->fMaxVelocity));
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeModificator = 3;
if (params->m_pVehicle->m_nSurfaceTouched == SURFACE_WATER) { if (params.m_pVehicle->m_nSurfaceTouched == SURFACE_WATER) {
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
freq = 6050 * emittingVol / 30 + 16000; freq = 6050 * emittingVol / 30 + 16000;
} else { } else {
@ -860,7 +860,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
} }
bool bool
cAudioManager::ProcessWetRoadNoise(cVehicleParams *params) cAudioManager::ProcessWetRoadNoise(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 30.0f; const float SOUND_INTENSITY = 30.0f;
@ -870,14 +870,14 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
int freq; int freq;
float velChange; float velChange;
if (params->m_fDistance >= SQR(SOUND_INTENSITY)) if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false; return false;
if (params->m_pTransmission != nil) { if (params.m_pTransmission != nil) {
if (((CAutomobile *)params->m_pVehicle)->m_nDriveWheelsOnGround != 0) { if (((CAutomobile *)params.m_pVehicle)->m_nDriveWheelsOnGround != 0) {
velChange = Abs(params->m_fVelocityChange); velChange = Abs(params.m_fVelocityChange);
if (velChange > 0.f) { if (velChange > 0.f) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
relativeVelocity = Min(1.0f, velChange / (0.5f * params->m_pTransmission->fMaxVelocity)); relativeVelocity = Min(1.0f, velChange / (0.5f * params.m_pTransmission->fMaxVelocity));
emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads; emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
@ -912,7 +912,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
} }
void void
cAudioManager::ProcessVehicleEngine(cVehicleParams *params) cAudioManager::ProcessVehicleEngine(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 50.0f; const float SOUND_INTENSITY = 50.0f;
@ -929,17 +929,17 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
float modificator; float modificator;
float traction = 0.f; float traction = 0.f;
if (params->m_fDistance < SQR(SOUND_INTENSITY)) { if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
playerVeh = FindPlayerVehicle(); playerVeh = FindPlayerVehicle();
veh = params->m_pVehicle; veh = params.m_pVehicle;
if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) { if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) {
SampleManager.StopChannel(m_nActiveSamples); SampleManager.StopChannel(m_nActiveSamples);
return; return;
} }
if (veh->bEngineOn) { if (veh->bEngineOn) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
automobile = (CAutomobile *)params->m_pVehicle; automobile = (CAutomobile *)params.m_pVehicle;
if (params->m_nIndex == DODO) { if (params.m_nIndex == DODO) {
ProcessCesna(params); ProcessCesna(params);
return; return;
} }
@ -947,14 +947,14 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
ProcessPlayersVehicleEngine(params, automobile); ProcessPlayersVehicleEngine(params, automobile);
return; return;
} }
transmission = params->m_pTransmission; transmission = params.m_pTransmission;
if (transmission != nil) { if (transmission != nil) {
currentGear = params->m_pVehicle->m_nCurrentGear; currentGear = params.m_pVehicle->m_nCurrentGear;
if (automobile->m_nWheelsOnGround != 0) { if (automobile->m_nWheelsOnGround != 0) {
if (automobile->bIsHandbrakeOn) { if (automobile->bIsHandbrakeOn) {
if (params->m_fVelocityChange == 0.0f) if (params.m_fVelocityChange == 0.0f)
traction = 0.9f; traction = 0.9f;
} else if (params->m_pVehicle->GetStatus() == STATUS_SIMPLE) { } else if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE) {
traction = 0.0f; traction = 0.0f;
} else { } else {
switch (transmission->nDriveType) { switch (transmission->nDriveType) {
@ -982,15 +982,15 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
relativeChange = 0.f; relativeChange = 0.f;
} else if (currentGear != 0) { } else if (currentGear != 0) {
relativeGearChange = relativeGearChange =
Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f); Min(1.0f, (params.m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f);
if (traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE && if (traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE &&
params->m_fVelocityChange < transmission->Gears[1].fShiftUpVelocity) { params.m_fVelocityChange < transmission->Gears[1].fShiftUpVelocity) {
traction = 0.7f; traction = 0.7f;
} }
relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange; relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange;
} else } else
relativeChange = relativeChange =
Min(1.0f, 1.0f - Abs((params->m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity)); Min(1.0f, 1.0f - Abs((params.m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity));
} else { } else {
if (automobile->m_nDriveWheelsOnGround != 0) if (automobile->m_nDriveWheelsOnGround != 0)
automobile->m_fGasPedalAudio *= 0.4f; automobile->m_fGasPedalAudio *= 0.4f;
@ -1017,20 +1017,20 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
if (automobile->GetStatus() == STATUS_SIMPLE) { if (automobile->GetStatus() == STATUS_SIMPLE) {
if (modificator < 0.02f) { if (modificator < 0.02f) {
m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1;
freq = modificator * 10000 + 22050; freq = modificator * 10000 + 22050;
m_sQueueSample.m_nCounter = 52; m_sQueueSample.m_nCounter = 52;
} else { } else {
m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nAccelerationSampleIndex;
m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nCounter = 2;
} }
} else { } else {
if (automobile->m_fGasPedal < 0.05f) { if (automobile->m_fGasPedal < 0.05f) {
m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1;
freq = modificator * 10000 + 22050; freq = modificator * 10000 + 22050;
m_sQueueSample.m_nCounter = 52; m_sQueueSample.m_nCounter = 52;
} else { } else {
m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nAccelerationSampleIndex;
m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nCounter = 2;
} }
} }
@ -1115,14 +1115,14 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl
} }
void void
cAudioManager::ProcessCesna(cVehicleParams *params) cAudioManager::ProcessCesna(cVehicleParams& params)
{ {
static uint8 nAccel = 0; static uint8 nAccel = 0;
//((CAutomobile *)params->m_pVehicle)->Damage.GetEngineStatus(); //((CAutomobile *)params.m_pVehicle)->Damage.GetEngineStatus();
if (FindPlayerVehicle() == params->m_pVehicle) { if (FindPlayerVehicle() == params.m_pVehicle) {
if (params->m_nIndex == DODO) { if (params.m_nIndex == DODO) {
if (Pads[0].GetAccelerate() <= 0) { if (Pads[0].GetAccelerate() <= 0) {
if (nAccel != 0) if (nAccel != 0)
--nAccel; --nAccel;
@ -1132,10 +1132,10 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, SFX_BANK_0, 52, true); AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, SFX_BANK_0, 52, true);
AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, SFX_BANK_0, 2, true); AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, SFX_BANK_0, 2, true);
} }
} else if (params->m_nIndex == DODO) { } else if (params.m_nIndex == DODO) {
AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, SFX_BANK_0, 52, true); AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, SFX_BANK_0, 52, true);
} else if (params->m_fDistance < SQR(200)) { } else if (params.m_fDistance < SQR(200)) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 52; m_sQueueSample.m_nCounter = 52;
@ -1156,7 +1156,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
} }
if (params->m_fDistance < SQR(90)) { if (params.m_fDistance < SQR(90)) {
m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nCounter = 2;
@ -1182,7 +1182,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
} }
void void
cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile) cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *automobile)
{ {
static int32 GearFreqAdj[] = {6000, 6000, 3400, 1200, 0, -1000}; static int32 GearFreqAdj[] = {6000, 6000, 3400, 1200, 0, -1000};
@ -1234,13 +1234,13 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
accelerateState = Pads[0].GetAccelerate(); accelerateState = Pads[0].GetAccelerate();
channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples); channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples);
transmission = params->m_pTransmission; transmission = params.m_pTransmission;
velocityChange = params->m_fVelocityChange; velocityChange = params.m_fVelocityChange;
relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity; relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity;
accelerationMultipler = clamp(relativeVelocityChange, 0.0f, 1.0f); accelerationMultipler = clamp(relativeVelocityChange, 0.0f, 1.0f);
gasPedalAudio = accelerationMultipler; gasPedalAudio = accelerationMultipler;
currentGear = params->m_pVehicle->m_nCurrentGear; currentGear = params.m_pVehicle->m_nCurrentGear;
switch (transmission->nDriveType) switch (transmission->nDriveType)
{ {
@ -1265,20 +1265,20 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
} }
if (velocityChange != 0.0f) { if (velocityChange != 0.0f) {
time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange; time = params.m_pVehicle->m_vecMoveSpeed.z / velocityChange;
if (time > 0.0f) if (time > 0.0f)
freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f); freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f);
else else
freqModifier = -(Max(-0.2f, time) * 3000.0f * 5.0f); freqModifier = -(Max(-0.2f, time) * 3000.0f * 5.0f);
if (params->m_fVelocityChange < -0.001f) if (params.m_fVelocityChange < -0.001f)
freqModifier = -freqModifier; freqModifier = -freqModifier;
} else } else
freqModifier = 0; freqModifier = 0;
engineSoundType = aVehicleSettings[params->m_nIndex].m_nBank; engineSoundType = aVehicleSettings[params.m_nIndex].m_nBank;
soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET); soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET);
if (accelerateState <= 0) { if (accelerateState <= 0) {
if (params->m_fVelocityChange < -0.001f) { if (params.m_fVelocityChange < -0.001f) {
if (channelUsed) { if (channelUsed) {
SampleManager.StopChannel(m_nActiveSamples); SampleManager.StopChannel(m_nActiveSamples);
bAccelSampleStopped = true; bAccelSampleStopped = true;
@ -1286,7 +1286,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction) if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction)
gasPedalAudio = automobile->m_fGasPedalAudio; gasPedalAudio = automobile->m_fGasPedalAudio;
else else
gasPedalAudio = Min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity); gasPedalAudio = Min(1.0f, params.m_fVelocityChange / params.m_pTransmission->fMaxReverseVelocity);
gasPedalAudio = Max(0.0f, gasPedalAudio); gasPedalAudio = Max(0.0f, gasPedalAudio);
automobile->m_fGasPedalAudio = gasPedalAudio; automobile->m_fGasPedalAudio = gasPedalAudio;
@ -1297,7 +1297,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
} }
nCruising = 0; nCruising = 0;
if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction || if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction ||
params->m_fVelocityChange < 0.01f && automobile->m_fGasPedalAudio > 0.2f) { params.m_fVelocityChange < 0.01f && automobile->m_fGasPedalAudio > 0.2f) {
automobile->m_fGasPedalAudio *= 0.6f; automobile->m_fGasPedalAudio *= 0.6f;
gasPedalAudio = automobile->m_fGasPedalAudio; gasPedalAudio = automobile->m_fGasPedalAudio;
} }
@ -1355,7 +1355,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
if (!channelUsed) { if (!channelUsed) {
if (!processedAccelSampleStopped) { if (!processedAccelSampleStopped) {
if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) if (CurrentPretendGear < params.m_pTransmission->nNumberOfGears - 1)
++CurrentPretendGear; ++CurrentPretendGear;
else { else {
nCruising = 1; nCruising = 1;
@ -1386,10 +1386,10 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
if (nCruising != 0) { if (nCruising != 0) {
bAccelSampleStopped = true; bAccelSampleStopped = true;
if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction || if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction ||
currentGear < params->m_pTransmission->nNumberOfGears - 1) { currentGear < params.m_pTransmission->nNumberOfGears - 1) {
nCruising = 0; nCruising = 0;
} else { } else {
if (accelerateState >= 220 && params->m_fVelocityChange + 0.001f < automobile->m_fVelocityChangeForAudio) { if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f < automobile->m_fVelocityChangeForAudio) {
if (nCruising < 800) if (nCruising < 800)
++nCruising; ++nCruising;
} else if (nCruising > 3) { } else if (nCruising > 3) {
@ -1409,7 +1409,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
} }
bool bool
cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) cAudioManager::ProcessVehicleSkidding(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 40.0f; const float SOUND_INTENSITY = 40.0f;
@ -1419,31 +1419,31 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
float newSkidVal = 0.0f; float newSkidVal = 0.0f;
float skidVal = 0.0f; float skidVal = 0.0f;
if (params->m_fDistance >= SQR(SOUND_INTENSITY)) if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false; return false;
automobile = (CAutomobile *)params->m_pVehicle; automobile = (CAutomobile *)params.m_pVehicle;
if (automobile->m_nWheelsOnGround == 0) if (automobile->m_nWheelsOnGround == 0)
return true; return true;
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
if (automobile->m_aWheelState[i] == WHEEL_STATE_NORMAL || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING) if (automobile->m_aWheelState[i] == WHEEL_STATE_NORMAL || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING)
continue; continue;
transmission = params->m_pTransmission; transmission = params.m_pTransmission;
switch (transmission->nDriveType) { switch (transmission->nDriveType) {
case '4': case '4':
newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
break; break;
case 'F': case 'F':
if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT) if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT)
newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
else else
newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
break; break;
case 'R': case 'R':
if (i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT) if (i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT)
newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
else else
newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
break; break;
default: default:
break; break;
@ -1456,7 +1456,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 3; m_sQueueSample.m_nCounter = 3;
switch (params->m_pVehicle->m_nSurfaceTouched) { switch (params.m_pVehicle->m_nSurfaceTouched) {
case SURFACE_GRASS: case SURFACE_GRASS:
case SURFACE_HEDGE: case SURFACE_HEDGE:
m_sQueueSample.m_nSampleIndex = SFX_RAIN; m_sQueueSample.m_nSampleIndex = SFX_RAIN;
@ -1547,17 +1547,17 @@ cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automo
} }
void void
cAudioManager::ProcessVehicleHorn(cVehicleParams *params) cAudioManager::ProcessVehicleHorn(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 40.0f; const float SOUND_INTENSITY = 40.0f;
CAutomobile *automobile; CAutomobile *automobile;
if (params->m_fDistance < SQR(SOUND_INTENSITY)) { if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
automobile = (CAutomobile *)params->m_pVehicle; automobile = (CAutomobile *)params.m_pVehicle;
if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->GetModelIndex() != MI_MRWHOOP) { if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params.m_nIndex)) && automobile->GetModelIndex() != MI_MRWHOOP) {
if (automobile->m_nCarHornTimer) { if (automobile->m_nCarHornTimer) {
if (params->m_pVehicle->GetStatus() != STATUS_PLAYER) { if (params.m_pVehicle->GetStatus() != STATUS_PLAYER) {
automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer); automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer);
if (automobile->m_nCarHornTimer == 44) if (automobile->m_nCarHornTimer == 44)
automobile->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7; automobile->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7;
@ -1565,15 +1565,15 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
return; return;
} }
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 4; m_sQueueSample.m_nCounter = 4;
m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nHornSample; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nHornSample;
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nHornFrequency; m_sQueueSample.m_nFrequency = aVehicleSettings[params.m_nIndex].m_nHornFrequency;
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = 80; m_sQueueSample.m_nEmittingVolume = 80;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@ -1622,36 +1622,36 @@ cAudioManager::UsesSirenSwitching(int32 model) const
} }
bool bool
cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 110.0f; const float SOUND_INTENSITY = 110.0f;
if (params->m_fDistance < SQR(SOUND_INTENSITY)) { if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
CVehicle *veh = params->m_pVehicle; CVehicle *veh = params.m_pVehicle;
if (veh->m_bSirenOrAlarm == false && !veh->IsAlarmOn()) if (veh->m_bSirenOrAlarm == false && !veh->IsAlarmOn())
return true; return true;
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 5; m_sQueueSample.m_nCounter = 5;
if (UsesSiren(params->m_nIndex)) { if (UsesSiren(params.m_nIndex)) {
if (params->m_pVehicle->GetStatus() == STATUS_ABANDONED) if (params.m_pVehicle->GetStatus() == STATUS_ABANDONED)
return true; return true;
if (veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) { if (veh->m_nCarHornTimer && params.m_nIndex != FIRETRUK) {
m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST; m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST;
if (params->m_nIndex == FBICAR) if (params.m_nIndex == FBICAR)
m_sQueueSample.m_nFrequency = 16113; m_sQueueSample.m_nFrequency = 16113;
else else
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SIREN_FAST); m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SIREN_FAST);
m_sQueueSample.m_nCounter = 60; m_sQueueSample.m_nCounter = 60;
} else { } else {
m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nSirenOrAlarmSample;
m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency; m_sQueueSample.m_nFrequency = aVehicleSettings[params.m_nIndex].m_nSirenOrAlarmFrequency;
} }
} else { } else {
m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nSirenOrAlarmSample;
m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency; m_sQueueSample.m_nFrequency = aVehicleSettings[params.m_nIndex].m_nSirenOrAlarmFrequency;
} }
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
@ -1681,17 +1681,17 @@ cAudioManager::UsesReverseWarning(int32 model) const
} }
bool bool
cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params) cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 50.0f; const float SOUND_INTENSITY = 50.0f;
CVehicle *veh = params->m_pVehicle; CVehicle *veh = params.m_pVehicle;
if (params->m_fDistance >= SQR(SOUND_INTENSITY)) if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false; return false;
if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) { if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 12; m_sQueueSample.m_nCounter = 12;
@ -1717,7 +1717,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
} }
bool bool
cAudioManager::ProcessVehicleDoors(cVehicleParams *params) cAudioManager::ProcessVehicleDoors(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 40.0f; const float SOUND_INTENSITY = 40.0f;
@ -1726,11 +1726,11 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
int32 emittingVol; int32 emittingVol;
float velocity; float velocity;
if (params->m_fDistance >= SQR(SOUND_INTENSITY)) if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false; return false;
automobile = (CAutomobile *)params->m_pVehicle; automobile = (CAutomobile *)params.m_pVehicle;
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) { for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) {
if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) { if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) {
doorState = automobile->Doors[i].m_nDoorState; doorState = automobile->Doors[i].m_nDoorState;
@ -1765,22 +1765,22 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
} }
bool bool
cAudioManager::ProcessAirBrakes(cVehicleParams *params) cAudioManager::ProcessAirBrakes(cVehicleParams& params)
{ {
CAutomobile *automobile; CAutomobile *automobile;
uint8 rand; uint8 rand;
if (params->m_fDistance > SQR(30)) if (params.m_fDistance > SQR(30))
return false; return false;
automobile = (CAutomobile *)params->m_pVehicle; automobile = (CAutomobile *)params.m_pVehicle;
if (!automobile->bEngineOn) if (!automobile->bEngineOn)
return true; return true;
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)) (automobile->m_fVelocityChangeForAudio > -0.025f || params.m_fVelocityChange <= 0.025f))
return true; return true;
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
rand = m_anRandomTable[0] % 10 + 70; rand = m_anRandomTable[0] % 10 + 70;
m_sQueueSample.m_nVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
@ -1813,7 +1813,7 @@ cAudioManager::HasAirBrakes(int32 model) const
} }
bool bool
cAudioManager::ProcessEngineDamage(cVehicleParams *params) cAudioManager::ProcessEngineDamage(cVehicleParams& params)
{ {
const int engineDamageIntensity = 40; const int engineDamageIntensity = 40;
@ -1821,9 +1821,9 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
uint8 engineStatus; uint8 engineStatus;
uint8 emittingVolume; uint8 emittingVolume;
if (params->m_fDistance >= SQR(engineDamageIntensity)) if (params.m_fDistance >= SQR(engineDamageIntensity))
return false; return false;
veh = (CAutomobile *)params->m_pVehicle; veh = (CAutomobile *)params.m_pVehicle;
if (veh->bEngineOn) { if (veh->bEngineOn) {
engineStatus = veh->Damage.GetEngineStatus(); engineStatus = veh->Damage.GetEngineStatus();
if (engineStatus > 250 || engineStatus < 100) if (engineStatus > 250 || engineStatus < 100)
@ -1839,7 +1839,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
m_sQueueSample.m_nReleasingVolumeModificator = 7; m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
} }
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 28; m_sQueueSample.m_nCounter = 28;
@ -1862,15 +1862,15 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
} }
bool bool
cAudioManager::ProcessCarBombTick(cVehicleParams *params) cAudioManager::ProcessCarBombTick(cVehicleParams& params)
{ {
CAutomobile *automobile; CAutomobile *automobile;
if (params->m_fDistance >= SQR(40.f)) if (params.m_fDistance >= SQR(40.f))
return false; return false;
automobile = (CAutomobile *)params->m_pVehicle; automobile = (CAutomobile *)params.m_pVehicle;
if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) { if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 35; m_sQueueSample.m_nCounter = 35;
@ -1896,7 +1896,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params)
} }
void void
cAudioManager::ProcessVehicleOneShots(cVehicleParams *params) cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
{ {
int16 event; int16 event;
uint8 emittingVol; uint8 emittingVol;
@ -1925,12 +1925,11 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
const float SOUND_INTENSITY = 50.0f; const float SOUND_INTENSITY = 50.0f;
maxDist = SQR(SOUND_INTENSITY); maxDist = SQR(SOUND_INTENSITY);
emittingVol = m_anRandomTable[2] % 5 + 122; emittingVol = m_anRandomTable[2] % 5 + 122;
switch (aVehicleSettings[params->m_nIndex].m_bDoorType) { switch (aVehicleSettings[params.m_nIndex].m_bDoorType) {
case OLD_DOOR: case OLD_DOOR:
m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_CLOSE; m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_CLOSE;
break; break;
case NEW_DOOR: case NEW_DOOR:
default:
m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE; m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE;
break; break;
case TRUCK_DOOR: case TRUCK_DOOR:
@ -1939,9 +1938,16 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
case BUS_DOOR: case BUS_DOOR:
m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
break; break;
default:
m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE;
break;
} }
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
#ifdef THIS_IS_STUPID
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 22; m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 22;
#else
m_sQueueSample.m_nCounter = event + 22;
#endif
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 / 32); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeModificator = 3;
@ -1959,7 +1965,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
const float SOUND_INTENSITY = 50.0f; const float SOUND_INTENSITY = 50.0f;
maxDist = SQR(SOUND_INTENSITY); maxDist = SQR(SOUND_INTENSITY);
emittingVol = m_anRandomTable[1] % 10 + 117; emittingVol = m_anRandomTable[1] % 10 + 117;
switch (aVehicleSettings[params->m_nIndex].m_bDoorType) { switch (aVehicleSettings[params.m_nIndex].m_bDoorType) {
case OLD_DOOR: case OLD_DOOR:
m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_OPEN; m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_OPEN;
break; break;
@ -1975,7 +1981,11 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
break; break;
} }
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
#ifdef THIS_IS_STUPID
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 10; m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 10;
#else
m_sQueueSample.m_nCounter = event + 10;
#endif
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 / 32); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeModificator = 3;
@ -2007,7 +2017,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
iWheelIndex = 82; iWheelIndex = 82;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TYRE_BUMP); m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TYRE_BUMP);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
if (params->m_nIndex == RCBANDIT) { if (params.m_nIndex == RCBANDIT) {
m_sQueueSample.m_nFrequency *= 2; m_sQueueSample.m_nFrequency *= 2;
emittingVol /= 2; emittingVol /= 2;
} }
@ -2236,16 +2246,16 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
pedParams.m_pPed = nil; pedParams.m_pPed = nil;
pedParams.m_bDistanceCalculated = false; pedParams.m_bDistanceCalculated = false;
pedParams.m_fDistance = 0.0f; pedParams.m_fDistance = 0.0f;
pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated; pedParams.m_bDistanceCalculated = params.m_bDistanceCalculated;
pedParams.m_fDistance = params->m_fDistance; pedParams.m_fDistance = params.m_fDistance;
SetupPedComments(&pedParams, SOUND_PED_HELI_PLAYER_FOUND); SetupPedComments(&pedParams, SOUND_PED_HELI_PLAYER_FOUND);
continue; continue;
case SOUND_PED_BODYCAST_HIT: case SOUND_PED_BODYCAST_HIT:
pedParams.m_pPed = nil; pedParams.m_pPed = nil;
pedParams.m_bDistanceCalculated = false; pedParams.m_bDistanceCalculated = false;
pedParams.m_fDistance = 0.0f; pedParams.m_fDistance = 0.0f;
pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated; pedParams.m_bDistanceCalculated = params.m_bDistanceCalculated;
pedParams.m_fDistance = params->m_fDistance; pedParams.m_fDistance = params.m_fDistance;
SetupPedComments(&pedParams, SOUND_PED_BODYCAST_HIT); SetupPedComments(&pedParams, SOUND_PED_BODYCAST_HIT);
continue; continue;
case SOUND_WATER_FALL: { case SOUND_WATER_FALL: {
@ -2298,8 +2308,8 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
default: default:
continue; continue;
} }
if (params->m_fDistance < maxDist) { if (params.m_fDistance < maxDist) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
if (noReflections) { if (noReflections) {
@ -2321,7 +2331,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
} }
bool bool
cAudioManager::ProcessTrainNoise(cVehicleParams *params) cAudioManager::ProcessTrainNoise(cVehicleParams& params)
{ {
const float SOUND_INTENSITY = 300.0f; const float SOUND_INTENSITY = 300.0f;
@ -2329,12 +2339,12 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
uint8 emittingVol; uint8 emittingVol;
float speedMultipler; float speedMultipler;
if (params->m_fDistance >= SQR(SOUND_INTENSITY)) if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false; return false;
if (params->m_fVelocityChange > 0.0f) { if (params.m_fVelocityChange > 0.0f) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
train = (CTrain *)params->m_pVehicle; train = (CTrain *)params.m_pVehicle;
speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f); speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f);
emittingVol = (75.f * speedMultipler); emittingVol = (75.f * speedMultipler);
if (train->m_fWagonPosition == 0.0f) { if (train->m_fWagonPosition == 0.0f) {
@ -2360,7 +2370,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
} }
} }
const float SOUND_INTENSITY = 70.0f; const float SOUND_INTENSITY = 70.0f;
if (params->m_fDistance < SQR(SOUND_INTENSITY)) { if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 33; m_sQueueSample.m_nCounter = 33;
@ -2387,7 +2397,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
} }
bool bool
cAudioManager::ProcessBoatEngine(cVehicleParams *params) cAudioManager::ProcessBoatEngine(cVehicleParams& params)
{ {
CBoat *boat; CBoat *boat;
float padRelativeAccerate; float padRelativeAccerate;
@ -2401,10 +2411,10 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
static const int intensity = 50; static const int intensity = 50;
if (params->m_fDistance < SQR(intensity)) { if (params.m_fDistance < SQR(intensity)) {
boat = (CBoat *)params->m_pVehicle; boat = (CBoat *)params.m_pVehicle;
if (params->m_nIndex == REEFER) { if (params.m_nIndex == REEFER) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 39; m_sQueueSample.m_nCounter = 39;
@ -2426,7 +2436,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
} }
if (FindPlayerVehicle() == params->m_pVehicle) { if (FindPlayerVehicle() == params.m_pVehicle) {
padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake()); padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake());
padRelativeAccerate = padAccelerate / 255; padRelativeAccerate = padAccelerate / 255;
emittingVol = (100.f * padRelativeAccerate) + 15; emittingVol = (100.f * padRelativeAccerate) + 15;
@ -2465,7 +2475,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
} else { } else {
if (FindPlayerVehicle() == params->m_pVehicle) { if (FindPlayerVehicle() == params.m_pVehicle) {
padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake()); padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake());
if (padAccelerate <= 20) { if (padAccelerate <= 20) {
emittingVol = 45 - 45 * padAccelerate / 40; emittingVol = 45 - 45 * padAccelerate / 40;
@ -2502,7 +2512,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
} }
} }
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
if (!m_sQueueSample.m_nVolume) if (!m_sQueueSample.m_nVolume)
return true; return true;
@ -2528,22 +2538,22 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
} }
bool bool
cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params) cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params)
{ {
float velocityChange; float velocityChange;
int32 vol; int32 vol;
float multiplier; float multiplier;
if (params->m_fDistance > SQR(50)) if (params.m_fDistance > SQR(50))
return false; return false;
velocityChange = Abs(params->m_fVelocityChange); velocityChange = Abs(params.m_fVelocityChange);
if (velocityChange <= 0.0005f && ((CBoat*)params->m_pVehicle)->bBoatInWater) if (velocityChange <= 0.0005f && ((CBoat*)params.m_pVehicle)->bBoatInWater)
return true; return true;
velocityChange = Min(0.75f, velocityChange); velocityChange = Min(0.75f, velocityChange);
multiplier = (velocityChange - 0.0005f) / (1499.0f / 2000.0f); multiplier = (velocityChange - 0.0005f) / (1499.0f / 2000.0f);
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
vol = (30.f * multiplier); vol = (30.f * multiplier);
m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
@ -2576,7 +2586,7 @@ struct tHelicopterSampleData {
}; };
bool bool
cAudioManager::ProcessHelicopter(cVehicleParams *params) cAudioManager::ProcessHelicopter(cVehicleParams& params)
{ {
CHeli *heli; CHeli *heli;
float MaxDist; float MaxDist;
@ -2585,11 +2595,11 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
int32 emittingVol; int32 emittingVol;
static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, MAX_VOLUME}, {60.f, 30.f, MAX_VOLUME}}; static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, MAX_VOLUME}, {60.f, 30.f, MAX_VOLUME}};
if (SQR(gHeliSfxRanges[0].m_fMaxDistance) <= params->m_fDistance) if (SQR(gHeliSfxRanges[0].m_fMaxDistance) <= params.m_fDistance)
return false; return false;
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
heli = (CHeli *)params->m_pVehicle; heli = (CHeli *)params.m_pVehicle;
for (uint32 i = 0; i < ARRAY_SIZE(gHeliSfxRanges); i++) { for (uint32 i = 0; i < ARRAY_SIZE(gHeliSfxRanges); i++) {
MaxDist = gHeliSfxRanges[i].m_fMaxDistance; MaxDist = gHeliSfxRanges[i].m_fMaxDistance;
dist = m_sQueueSample.m_fDistance; dist = m_sQueueSample.m_fDistance;
@ -2626,9 +2636,9 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
} }
void void
cAudioManager::ProcessPlane(cVehicleParams *params) cAudioManager::ProcessPlane(cVehicleParams& params)
{ {
switch (params->m_nIndex) { switch (params.m_nIndex) {
case AIRTRAIN: case AIRTRAIN:
ProcessJumbo(params); ProcessJumbo(params);
break; break;
@ -2636,7 +2646,7 @@ cAudioManager::ProcessPlane(cVehicleParams *params)
ProcessCesna(params); ProcessCesna(params);
break; break;
default: default:
debug("Plane Model Id is %d\n, ", params->m_pVehicle->GetModelIndex()); debug("Plane Model Id is %d\n, ", params.m_pVehicle->GetModelIndex());
break; break;
} }
} }
@ -2652,14 +2662,14 @@ DoJumboVolOffset()
} }
void void
cAudioManager::ProcessJumbo(cVehicleParams *params) cAudioManager::ProcessJumbo(cVehicleParams& params)
{ {
CPlane *plane; CPlane *plane;
float position; float position;
if (params->m_fDistance < SQR(440)) { if (params.m_fDistance < SQR(440)) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
plane = (CPlane *)params->m_pVehicle; plane = (CPlane *)params.m_pVehicle;
DoJumboVolOffset(); DoJumboVolOffset();
position = PlanePathPosition[plane->m_nPlaneId]; position = PlanePathPosition[plane->m_nPlaneId];
if (position <= TakeOffPoint) { if (position <= TakeOffPoint) {

View File

@ -362,29 +362,29 @@ public:
void PreTerminateGameSpecificShutdown(); void PreTerminateGameSpecificShutdown();
/// processX - main logic of adding new sounds /// processX - main logic of adding new sounds
void ProcessActiveQueues(); void ProcessActiveQueues();
bool ProcessAirBrakes(cVehicleParams *params); bool ProcessAirBrakes(cVehicleParams& params);
void ProcessAirportScriptObject(uint8 sound); void ProcessAirportScriptObject(uint8 sound);
bool ProcessBoatEngine(cVehicleParams *params); bool ProcessBoatEngine(cVehicleParams& params);
bool ProcessBoatMovingOverWater(cVehicleParams *params); bool ProcessBoatMovingOverWater(cVehicleParams& params);
void ProcessBridge(); void ProcessBridge();
void ProcessBridgeMotor(); void ProcessBridgeMotor();
void ProcessBridgeOneShots(); void ProcessBridgeOneShots();
void ProcessBridgeWarning(); void ProcessBridgeWarning();
bool ProcessCarBombTick(cVehicleParams *params); bool ProcessCarBombTick(cVehicleParams& params);
void ProcessCesna(cVehicleParams *params); void ProcessCesna(cVehicleParams& params);
void ProcessCinemaScriptObject(uint8 sound); void ProcessCinemaScriptObject(uint8 sound);
void ProcessCrane(); void ProcessCrane();
void ProcessDocksScriptObject(uint8 sound); void ProcessDocksScriptObject(uint8 sound);
bool ProcessEngineDamage(cVehicleParams *params); bool ProcessEngineDamage(cVehicleParams& params);
void ProcessEntity(int32 sound); void ProcessEntity(int32 sound);
void ProcessExplosions(int32 explosion); void ProcessExplosions(int32 explosion);
void ProcessFireHydrant(); void ProcessFireHydrant();
void ProcessFires(int32 entity); void ProcessFires(int32 entity);
void ProcessFrontEnd(); void ProcessFrontEnd();
void ProcessGarages(); void ProcessGarages();
bool ProcessHelicopter(cVehicleParams *params); bool ProcessHelicopter(cVehicleParams& params);
void ProcessHomeScriptObject(uint8 sound); void ProcessHomeScriptObject(uint8 sound);
void ProcessJumbo(cVehicleParams *); void ProcessJumbo(cVehicleParams& params);
void ProcessJumboAccel(CPlane *plane); void ProcessJumboAccel(CPlane *plane);
void ProcessJumboDecel(CPlane *plane); void ProcessJumboDecel(CPlane *plane);
void ProcessJumboFlying(); void ProcessJumboFlying();
@ -394,37 +394,37 @@ public:
void ProcessLaunderetteScriptObject(uint8 sound); void ProcessLaunderetteScriptObject(uint8 sound);
void ProcessLoopingScriptObject(uint8 sound); void ProcessLoopingScriptObject(uint8 sound);
void ProcessMissionAudio(); void ProcessMissionAudio();
void ProcessModelCarEngine(cVehicleParams *params); void ProcessModelCarEngine(cVehicleParams& params);
void ProcessOneShotScriptObject(uint8 sound); void ProcessOneShotScriptObject(uint8 sound);
void ProcessPed(CPhysical *ped); void ProcessPed(CPhysical *ped);
void ProcessPedHeadphones(cPedParams *params); void ProcessPedHeadphones(cPedParams *params);
void ProcessPedOneShots(cPedParams *params); void ProcessPedOneShots(cPedParams *params);
void ProcessPhysical(int32 id); void ProcessPhysical(int32 id);
void ProcessPlane(cVehicleParams *params); void ProcessPlane(cVehicleParams& params);
void ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile); void ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *automobile);
void ProcessPoliceCellBeatingScriptObject(uint8 sound); void ProcessPoliceCellBeatingScriptObject(uint8 sound);
void ProcessPornCinema(uint8 sound); void ProcessPornCinema(uint8 sound);
void ProcessProjectiles(); void ProcessProjectiles();
void ProcessRainOnVehicle(cVehicleParams *params); void ProcessRainOnVehicle(cVehicleParams& params);
void ProcessReverb() const; void ProcessReverb() const;
bool ProcessReverseGear(cVehicleParams *params); bool ProcessReverseGear(cVehicleParams& params);
void ProcessSawMillScriptObject(uint8 sound); void ProcessSawMillScriptObject(uint8 sound);
void ProcessScriptObject(int32 id); void ProcessScriptObject(int32 id);
void ProcessShopScriptObject(uint8 sound); void ProcessShopScriptObject(uint8 sound);
void ProcessSpecial(); void ProcessSpecial();
bool ProcessTrainNoise(cVehicleParams *params); bool ProcessTrainNoise(cVehicleParams& params);
void ProcessVehicle(CVehicle *vehicle); void ProcessVehicle(CVehicle *vehicle);
bool ProcessVehicleDoors(cVehicleParams *params); bool ProcessVehicleDoors(cVehicleParams& params);
void ProcessVehicleEngine(cVehicleParams *params); void ProcessVehicleEngine(cVehicleParams& params);
void ProcessVehicleHorn(cVehicleParams *params); void ProcessVehicleHorn(cVehicleParams& params);
void ProcessVehicleOneShots(cVehicleParams *params); void ProcessVehicleOneShots(cVehicleParams& params);
bool ProcessVehicleReverseWarning(cVehicleParams *params); bool ProcessVehicleReverseWarning(cVehicleParams& params);
bool ProcessVehicleRoadNoise(cVehicleParams *params); bool ProcessVehicleRoadNoise(cVehicleParams& params);
bool ProcessVehicleSirenOrAlarm(cVehicleParams *params); bool ProcessVehicleSirenOrAlarm(cVehicleParams& params);
bool ProcessVehicleSkidding(cVehicleParams *params); bool ProcessVehicleSkidding(cVehicleParams& params);
void ProcessWaterCannon(int32); void ProcessWaterCannon(int32);
void ProcessWeather(int32 id); void ProcessWeather(int32 id);
bool ProcessWetRoadNoise(cVehicleParams *params); bool ProcessWetRoadNoise(cVehicleParams& params);
void ProcessWorkShopScriptObject(uint8 sound); void ProcessWorkShopScriptObject(uint8 sound);
int32 RandomDisplacement(uint32 seed) const; int32 RandomDisplacement(uint32 seed) const;