1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-24 15:50:01 +00:00

removed some goto

This commit is contained in:
Roman Masanin 2020-09-25 02:17:58 +03:00
parent 1d22c78f9f
commit b3cbe3d338

View file

@ -3072,9 +3072,8 @@ void cAudioManager::ProcessCarHeli(cVehicleParams* params)
CBoat* boat; // [esp+1Ch] [ebp-C0h] CBoat* boat; // [esp+1Ch] [ebp-C0h]
signed int volume; // ebx signed int volume; // ebx
float volumeTmp; // st5
unsigned int freqModifier; // eax unsigned int freqModifier; // eax
signed int v30; // ebx signed int volume; // ebx
uint32 freq_6; // eax uint32 freq_6; // eax
signed int volume_3; // ebx signed int volume_3; // ebx
@ -3104,13 +3103,16 @@ void cAudioManager::ProcessCarHeli(cVehicleParams* params)
const float CarHeliDistance = 250.0f; const float CarHeliDistance = 250.0f;
boat = 0; boat = nil;
hunterBool = 0; hunterBool = false;
automobile = 0; automobile = nil;
cameraMatrix.m_attachment = 0; cameraMatrix.m_attachment = 0;
cameraMatrix.m_hasRwMatrix = 0; cameraMatrix.m_hasRwMatrix = 0;
if (params->m_fDistance < SQR(CarHeliDistance)) {//!! if (params->m_fDistance >= SQR(CarHeliDistance)) {//!!
cameraMatrix.~CMatrix();
return;
}
playerVeh = FindPlayerVehicle(); playerVeh = FindPlayerVehicle();
veh = params->m_pVehicle; veh = params->m_pVehicle;
if (playerVeh == veh) { if (playerVeh == veh) {
@ -3123,31 +3125,33 @@ void cAudioManager::ProcessCarHeli(cVehicleParams* params)
cameraMatrix = TheCamera.m_matrix; cameraMatrix = TheCamera.m_matrix;
vehAtYAbs = Abs(veh->m_matrix.GetUp().y); vehAtYAbs = Abs(veh->m_matrix.GetUp().y);
vehCameraDot = (DotProduct(veh->m_matrix.GetForward(), cameraMatrix.GetForward()) + 1.0f) / 2.0f; vehCameraDot = (DotProduct(veh->m_matrix.GetForward(), cameraMatrix.GetForward()) + 1.0f) / 2.0f;
//123-139
if (veh->m_modelIndex == MI_SKIMMER) {//!! if (veh->m_modelIndex == MI_SKIMMER) {//!!
boat = (CBoat*)params->m_pVehicle; boat = (CBoat*)params->m_pVehicle;
speedMultiplied = boat->m_fMovingSpeed * 50.0f / 11.0f; speedMultiplied = boat->m_fMovingSpeed * 50.0f / 11.0f;
} else if (params->m_VehicleType == VEHICLE_TYPE_HELI) {//!! } else if (params->m_VehicleType == VEHICLE_TYPE_HELI) {//!!
speedMultiplied = 1.0; speedMultiplied = 1.0f;
} else { } else {
automobile = (CAutomobile*)params->m_pVehicle; automobile = (CAutomobile*)params->m_pVehicle;
speedMultiplied = automobile->m_aWheelSpeed[1] * 50.0f / 11.0f; speedMultiplied = automobile->m_aWheelSpeed[1] * 50.0f / 11.0f;
} }
//140-162 if (speedMultiplied == 0.0f) {//??
if (0.0 == speedMultiplied) {//??
cameraMatrix.~CMatrix(); cameraMatrix.~CMatrix();
return; return;
} }
speedMultiplied = Min(1.0f, speedMultiplied); speedMultiplied = Min(1.0f, speedMultiplied);
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
//163-
if (m_sQueueSample.m_fDistance >= 40.0f) {//??
volumeTmp = speedMultiplied * 75.0f; if (m_sQueueSample.m_fDistance >= 40.0f)
} else { volume = speedMultiplied * 75.0f;
if (m_sQueueSample.m_fDistance >= 25.0f) {//!! else if (m_sQueueSample.m_fDistance >= 25.0f)
volume = 0; volume = 0;
LABEL_34: else
volume = (m_sQueueSample.m_fDistance - 25.0f) * 0.06666667f * (75.0f * speedMultiplied);
//173-243 //173-243
if (volume != 0) {//!! if (volume != 0) {//!!
m_sQueueSample.m_nVolume = cAudioManager::ComputeVolume(volume, 250.0f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = cAudioManager::ComputeVolume(volume, 250.0f, m_sQueueSample.m_fDistance);
@ -3194,9 +3198,14 @@ void cAudioManager::ProcessCarHeli(cVehicleParams* params)
} else { } else {
pos = m_sQueueSample.m_vecPos; pos = m_sQueueSample.m_vecPos;
} }
//263-270 //263-270
if (params->m_fDistance >= 19600.0f) //?? if (params->m_fDistance >= 19600.0f) { //??
goto LABEL_EXIT; cameraMatrix.~CMatrix();
return;
}
if (speedMultiplied >= 0.4f) //?? if (speedMultiplied >= 0.4f) //??
volumeModifier = (speedMultiplied - 0.4f) * 5.0f / 3.0f; volumeModifier = (speedMultiplied - 0.4f) * 5.0f / 3.0f;
else else
@ -3209,7 +3218,6 @@ void cAudioManager::ProcessCarHeli(cVehicleParams* params)
if (veh->m_modelIndex == MI_HUNTER) //!! if (veh->m_modelIndex == MI_HUNTER) //!!
hunterBool = true; hunterBool = true;
} }
volume_1 = (1.0f - vehCameraDot) * volumeModifier * 127.0f; volume_1 = (1.0f - vehCameraDot) * volumeModifier * 127.0f;
//288-339 //288-339
if (boat) { //!! if (boat) { //!!
@ -3239,35 +3247,35 @@ void cAudioManager::ProcessCarHeli(cVehicleParams* params)
m_sQueueSample.m_nVolume = ComputeVolume(volume_1, 140.0f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(volume_1, 140.0f, m_sQueueSample.m_fDistance);
if (!m_sQueueSample.m_nVolume) { //!! if (!m_sQueueSample.m_nVolume) { //!!
LABEL_105: LABEL_105:
if (!boat && params->m_VehicleType != VEHICLE_TYPE_HELI && m_sQueueSample.m_fDistance >= 30.0) { //!! if (!boat && params->m_VehicleType != VEHICLE_TYPE_HELI && m_sQueueSample.m_fDistance >= 30.0f) { //!!
if (automobile->bEngineOn) { if (automobile->bEngineOn) {
if (speedMultiplied >= 1.0) { if (speedMultiplied >= 1.0f) {
v30 = (signed int)((1.0 - 0.5 * speedMultiplied) * 70.0f); volume = (1.0f - 0.5f * speedMultiplied) * 70.0f;
m_sQueueSample.m_nVolume = ComputeVolume(v30, 30.0, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(volume, 30.0, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume) { if (m_sQueueSample.m_nVolume) {
if (hunterBool) { if (hunterBool) {
m_sQueueSample.m_nSampleIndex = 456; m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_4;
m_sQueueSample.m_nBankIndex = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
freq_6 = 3000.0 * speedMultiplied + 30000; freq_6 = 3000.0f * speedMultiplied + 30000;
} else { } else {
m_sQueueSample.m_nSampleIndex = 11; m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_STA;
m_sQueueSample.m_nBankIndex = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
freq_6 = 3000.0 * speedMultiplied + 6000; freq_6 = 3000.0f * speedMultiplied + 6000;
} }
m_sQueueSample.m_nFrequency = freq_6; m_sQueueSample.m_nFrequency = freq_6;
m_sQueueSample.m_nCounter = 12; m_sQueueSample.m_nCounter = 12;
m_sQueueSample.m_bIs2D = 0; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = v30; m_sQueueSample.m_nEmittingVolume = volume;
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); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0; m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 30.0; m_sQueueSample.m_fSoundIntensity = 30.0f;
m_sQueueSample.m_bReleasingSoundFlag = 0; m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 30; m_sQueueSample.m_nReleasingVolumeDivider = 30;
m_sQueueSample.m_bReverbFlag = 1; m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = 0; m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
} }
} }
@ -3384,16 +3392,13 @@ void cAudioManager::ProcessCarHeli(cVehicleParams* params)
params->m_bDistanceCalculated = distCalcBool; params->m_bDistanceCalculated = distCalcBool;
params->m_fDistance = distance_3; params->m_fDistance = distance_3;
} }
LABEL_EXIT:
cameraMatrix.~CMatrix(); cameraMatrix.~CMatrix();
return; return;
} }
m_sQueueSample.m_nSampleIndex = 9; m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_MAI2;
} }
m_sQueueSample.m_nBankIndex = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = (unsigned __int64)(signed __int64)(16000.0 * volumeModifier) m_sQueueSample.m_nFrequency = (volumeModifier + 1) * 16000 + freqModifier_2;
+ 16000;
m_sQueueSample.m_nFrequency += freqModifier_2;
goto LABEL_146; goto LABEL_146;
} }
@ -3426,8 +3431,7 @@ void cAudioManager::ProcessCarHeli(cVehicleParams* params)
m_sQueueSample.m_nSampleIndex = 8; m_sQueueSample.m_nSampleIndex = 8;
} }
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = (16000.0 * volumeModifier) + 16000; m_sQueueSample.m_nFrequency = (volumeModifier + 1) * 16000 + freqModifier_2;
m_sQueueSample.m_nFrequency += freqModifier_2;
//goto LABEL_104; //goto LABEL_104;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nReleasingVolumeModificator = 1;
@ -3443,13 +3447,8 @@ void cAudioManager::ProcessCarHeli(cVehicleParams* params)
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
goto LABEL_105; goto LABEL_105;
}
volumeTmp = (m_sQueueSample.m_fDistance - 25.0) * 0.06666667 * (75.0 * speedMultiplied);
}
volume = (signed int)volumeTmp;
goto LABEL_34;
}
cameraMatrix.~CMatrix();
} }
//TODO use it in ProcessVehicle //TODO use it in ProcessVehicle