Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2020-09-30 15:19:55 +03:00
commit 4c582b19eb
23 changed files with 806 additions and 232 deletions

View File

@ -14,7 +14,7 @@ such that we have a working game at all times.
## How can I try it?
- re3 requires game assets to work, so you **must** own a copy of GTA III.
- re3 requires game assets to work, so you **must** own [a copy of GTA III](https://store.steampowered.com/app/12100/Grand_Theft_Auto_III/).
- Build re3 or download it from one of the above links (Debug or Release).
- (Optional) If you want to use optional features like Russian language or menu map, copy the files in /gamefiles folder to your game root folder.
- Move re3.exe to GTA 3 directory and run it.

View File

@ -47,6 +47,8 @@ function getarch(a)
return 'amd64'
elseif a == 'ARM' then
return 'arm'
elseif a == 'ARM64' then
return 'arm64'
end
return a
end
@ -75,6 +77,7 @@ workspace "reVC"
"linux-x86-librw_gl3_glfw-oal",
"linux-amd64-librw_gl3_glfw-oal",
"linux-arm-librw_gl3_glfw-oal",
"linux-arm64-librw_gl3_glfw-oal",
}
filter { "system:bsd" }

View File

@ -38,6 +38,8 @@
#include "ZoneCull.h"
#include "sampman.h"
#include "Bike.h"
#include "WindModifiers.h"
#include "Fluff.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
@ -292,7 +294,6 @@ cAudioManager::CalculateDistance(bool &distCalculated, float dist)
if (!distCalculated) {
if (dist > 0.0f)
m_sQueueSample.m_fDistance = Sqrt(dist);
else
m_sQueueSample.m_fDistance = 0.0f;
distCalculated = true;
@ -337,7 +338,7 @@ cAudioManager::ProcessSpecial()
void
cAudioManager::ProcessEntity(int32 id)
{
if (m_asAudioEntities[id].m_nStatus) {
if (m_asAudioEntities[id].m_nStatus != STATUS_PLAYER) {
m_sQueueSample.m_nEntityIndex = id;
switch (m_asAudioEntities[id].m_nType) {
case AUDIOTYPE_PHYSICAL:
@ -361,6 +362,7 @@ cAudioManager::ProcessEntity(int32 id)
case AUDIOTYPE_WEATHER:
if (!m_nUserPause) {
m_sQueueSample.m_bReverbFlag = true;
if(CGame::currArea == AREA_MAIN_MAP || CGame::currArea == AREA_EVERYWHERE)
ProcessWeather(id);
}
break;
@ -410,6 +412,18 @@ cAudioManager::ProcessEntity(int32 id)
ProcessWaterCannon(id);
}
break;
case AUDIOTYPE_ESCALATOR:
if (!m_nUserPause) {
m_sQueueSample.m_bReverbFlag = true;
ProcessEscalators();
}
break;
case AUDIOTYPE_EXTRA_SOUNDS:
if (!m_nUserPause) {
m_sQueueSample.m_bReverbFlag = true;
ProcessExtraSounds();
}
break;
default:
return;
}
@ -753,8 +767,8 @@ void cAudioManager::ProcessVehicle(CVehicle* veh)
} else {
switch (veh->GetVehicleAppearance()) {
case VEHICLE_APPEARANCE_HELI:
ProcessHelicopter(&params);
//ProcessVehicleFlatTyre(&params);
ProcessCarHeli(&params);
ProcessVehicleFlatTyre(&params);
ProcessEngineDamage(&params);
break;
case VEHICLE_APPEARANCE_BOAT:
@ -766,7 +780,7 @@ void cAudioManager::ProcessVehicle(CVehicle* veh)
if (CWeather::WetRoads > 0.0)
ProcessWetRoadNoise(&params);
ProcessVehicleSkidding(&params);
//ProcessVehicleFlatTyre(params);
ProcessVehicleFlatTyre(&params);
ProcessVehicleHorn(&params);
ProcessVehicleSirenOrAlarm(&params);
if (UsesReverseWarning(params.m_nIndex))
@ -786,29 +800,20 @@ void cAudioManager::ProcessVehicle(CVehicle* veh)
break;
case VEHICLE_TYPE_BOAT:
if (veh->m_modelIndex == MI_SKIMMER)
ProcessHelicopter(&params);
ProcessCarHeli(&params);
else
ProcessBoatEngine(&params);
ProcessBoatMovingOverWater(&params);
ProcessVehicleOneShots(&params);
break;
case VEHICLE_TYPE_HELI:
ProcessHelicopter(&params);
ProcessCarHeli(&params);
ProcessVehicleOneShots(&params);
break;
case VEHICLE_TYPE_PLANE:
switch (params.m_nIndex) {
case AIRTRAIN:
ProcessJumbo(&params);
break;
case DEADDODO:
ProcessCesna(&params);
break;
default:
break;
}
ProcessPlane(&params);
ProcessVehicleOneShots(&params);
//ProcessVehicleFlatType(&params);
ProcessVehicleFlatTyre(&params);
break;
case VEHICLE_TYPE_BIKE:
bike = (CBike*)veh;
@ -822,7 +827,7 @@ void cAudioManager::ProcessVehicle(CVehicle* veh)
ProcessCarBombTick(&params);
ProcessEngineDamage(&params);
ProcessVehicleEngine(&params);
//ProcessVehicleFlatTyre();
ProcessVehicleFlatTyre(&params);
}
ProcessVehicleOneShots(&params);
bike->m_fVelocityChangeForAudio = params.m_fVelocityChange;
@ -875,27 +880,28 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
{
const int reverseGearIntensity = 30;
CVehicle *veh;
CAutomobile* automobile;
int32 emittingVol;
float modificator;
uint8 emittingVolume;
if (params->m_fDistance >= SQR(reverseGearIntensity))
return false;
veh = params->m_pVehicle;
if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || veh->m_nCurrentGear == 0)) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
automobile = (CAutomobile*)params->m_pVehicle;
if (automobile->m_nWheelsOnGround != 0) {
if (automobile->m_modelIndex == MI_CADDY)
return true;
if (automobile->bEngineOn && (automobile->m_fGasPedal < 0.0f || automobile->m_nCurrentGear == 0)) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
if (automobile->m_nDriveWheelsOnGround != 0) {
modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity;
} else {
if (automobile->m_nDriveWheelsOnGround != 0)
if (automobile->m_nDriveWheelsOnGroundPrev != 0)
automobile->m_fGasPedalAudio *= 0.4f;
modificator = automobile->m_fGasPedalAudio;
}
modificator = Abs(modificator);
emittingVol = (24.f * modificator);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance);
emittingVolume = modificator * 24.0f;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, reverseGearIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
if (params->m_pVehicle->m_fGasPedal >= 0.0f) {
m_sQueueSample.m_nCounter = 62;
@ -907,9 +913,9 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nFrequency = (6000.f * modificator) + 7000;
m_sQueueSample.m_nFrequency = (6000.0f * modificator) + 7000;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
@ -1203,7 +1209,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
break;
}
}
} else if (0.0f == params->m_fVelocityChange) {
} else if (params->m_fVelocityChange == 0.0f) {
traction = 0.9f;
}
if (transmission->fMaxVelocity <= 0.0) {
@ -2189,7 +2195,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
if (doorState == DOORST_OPEN || doorState == DOORST_CLOSED) {
velocity = Min(0.3f, Abs(automobile->Doors[i].m_fAngVel));
if (velocity > 0.0035f) {
emittingVol = (100.f * velocity * 10.f / 3.f);
emittingVol = (100.0f * velocity * 10.0f / 3.0f);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = i + 6;
@ -2268,32 +2274,34 @@ cAudioManager::HasAirBrakes(int32 model) const
bool
cAudioManager::ProcessEngineDamage(cVehicleParams *params)
{
const int engineDamageIntensity = 40;
const float SOUND_INTENSITY = 40.0f;
CAutomobile *veh;
uint8 engineStatus;
float health;
uint8 emittingVolume;
if (params->m_fDistance >= SQR(engineDamageIntensity))
if (params->m_fDistance >= SQR(SOUND_INTENSITY))
return false;
veh = (CAutomobile *)params->m_pVehicle;
if (veh->bEngineOn) {
engineStatus = veh->Damage.GetEngineStatus();
if (engineStatus > 250 || engineStatus < 100)
if (params->m_pVehicle->m_modelIndex == MI_CADDY)
return true;
if (engineStatus < 225) {
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
emittingVolume = 6;
m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nFrequency = 40000;
} else {
if (params->m_pVehicle->GetStatus() == STATUS_WRECKED)
return true;
health = params->m_pVehicle->m_fHealth;
if (health < 390.0f) {
if (health < 250.0f) {
emittingVolume = 60;
m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
} else {
emittingVolume = 30;
m_sQueueSample.m_nSampleIndex = SFX_PALM_TREE_LO;
m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nFrequency = 27000;
}
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance);
if (params->m_pVehicle->bIsDrowning)
emittingVolume /= 2;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 28;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@ -2303,7 +2311,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = engineDamageIntensity;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
@ -2317,14 +2325,29 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
bool
cAudioManager::ProcessCarBombTick(cVehicleParams *params)
{
CAutomobile *automobile;
const float SOUND_INTENSITY = 40.0f;
const uint8 EMITTING_VOLUME = 60;
if (params->m_fDistance >= SQR(40.f))
uint8 bombType;
if (params->m_fDistance >= SQR(SOUND_INTENSITY))
return false;
automobile = (CAutomobile *)params->m_pVehicle;
if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) {
if (params->m_pVehicle->bEngineOn) {
switch (params->m_VehicleType) {
case VEHICLE_TYPE_CAR:
bombType = params->m_pVehicle->m_bombType;
break;
case VEHICLE_TYPE_BIKE:
bombType = params->m_pVehicle->m_bombType;
break;
default:
debug("\n * AUDIOLOG: ProcessCarBombTick() Unsupported vehicle type %d * \n", params->m_VehicleType);
return true;
break;
}
if (bombType == CARBOMB_TIMEDACTIVE) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 35;
m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN;
@ -2333,11 +2356,11 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params)
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN);
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = 60;
m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = 40.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
@ -2345,6 +2368,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params)
AddSampleToRequestedQueue();
}
}
}
return true;
}
@ -2359,11 +2383,6 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
float maxDist;
cPedParams pedParams;
static uint8 WaveIndex = 41;
static uint8 GunIndex = 53;
static uint8 iWheelIndex = 82;
static uint8 CrunchOffset = 0;
for (int i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
noReflections = 0;
m_sQueueSample.m_bRequireReflection = false;
@ -2451,13 +2470,14 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
} break;
case SOUND_CAR_JUMP: {
const float SOUND_INTENSITY = 35.0f;
static uint8 WheelIndex = 82;
emittingVol = Max(80.f, 2 * (100.f * m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]));
maxDist = SQR(SOUND_INTENSITY);
m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = iWheelIndex++;
if (iWheelIndex > 85)
iWheelIndex = 82;
m_sQueueSample.m_nCounter = WheelIndex++;
if (WheelIndex > 85)
WheelIndex = 82;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TYRE_BUMP);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
if (params->m_nIndex == RCBANDIT) {
@ -2546,6 +2566,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
}
case SOUND_CAR_SPLASH: {
const float SOUND_INTENSITY = 40.0f;
static uint8 WaveIndex = 41;
vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
if (vol <= 300.f)
continue;
@ -2637,8 +2658,28 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
emittingVol = m_anRandomTable[4] % 25 + 75;
break;
}
case SOUND_31:{
const float SOUND_INTENSITY = 35.0f;
static uint8 HeliIndex = 0;
relVol = ((CAutomobile*)params->m_pVehicle)->m_aWheelSpeed[1] * 50.0f / 11.0f;
if (relVol < 0.2f || relVol == 1.0f)
continue;
emittingVol = (1.0f - relVol) * 70.0f;
maxDist = SQR(SOUND_INTENSITY);
m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_ROT;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = HeliIndex + 89;
HeliIndex = HeliIndex != 1 ? HeliIndex + 1 : 0; //maybe better use 1 and 0, to avoid extreme values
m_sQueueSample.m_nFrequency = (8000.0f * relVol) + 16000;
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
break;
}
case SOUND_WEAPON_SHOT_FIRED: {
const float SOUND_INTENSITY = 120.0f;
static uint8 GunIndex = 53;
emittingVol = m_anRandomTable[2];
maxDist = SQR(SOUND_INTENSITY);
m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT;
@ -2717,6 +2758,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
}
case SOUND_SPLATTER: {
const float SOUND_INTENSITY = 40.0f;
static uint8 CrunchOffset = 0;
m_sQueueSample.m_nSampleIndex = CrunchOffset + SFX_PED_CRUNCH_1;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = 48;
@ -3022,52 +3064,404 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
return true;
}
struct tHelicopterSampleData {
float m_fMaxDistance;
float m_fBaseDistance;
uint8 m_bBaseVolume;
};
bool
cAudioManager::ProcessHelicopter(cVehicleParams *params)
void
cAudioManager::ProcessCarHeli(cVehicleParams* params)
{
CHeli *heli;
float MaxDist;
float dist;
float baseDist;
int32 emittingVol;
static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, MAX_VOLUME}, {60.f, 30.f, MAX_VOLUME}};
const float SOUND_INTENSITY = 250.0f;
if (SQR(gHeliSfxRanges[0].m_fMaxDistance) <= params->m_fDistance)
return false;
CVehicle* playerVeh;
CVehicle* veh;
CAutomobile* automobile;
CBoat* boat;
uint8 emittingVol;
int16 brakeState;
int16 accelerateState;
uint32 freq;
float propellerSpeed;
float freqModifier; //may be relate to angle with horison
float cameraAngle;
bool distanceCalculatedOld;
float distanceOld;
CVector vecPosOld;
float volumeModifier;//TODO find better name
bool hunterBool;
static uint32 freqFrontPrev = 14287;
static uint32 freqPropellerPrev = 7143;
static uint32 freqSkimmerPrev = 14287;
boat = nil;
automobile = nil;
hunterBool = false;
if (params->m_fDistance >= SQR(SOUND_INTENSITY))
return;
playerVeh = FindPlayerVehicle();
veh = params->m_pVehicle;
if (playerVeh == veh) {
accelerateState = Pads[0].GetAccelerate();
brakeState = Pads[0].GetBrake();
} else {
accelerateState = veh->m_fGasPedal * 255.0f;
brakeState = veh->m_fBrakePedal * 255.0f;
}
freqModifier = Abs(veh->GetUp().y);
cameraAngle = (DotProduct(veh->m_matrix.GetForward(), TheCamera.GetForward()) + 1.0f) / 2.0f;
if (veh->m_modelIndex == MI_SKIMMER) {
boat = (CBoat*)veh;
propellerSpeed = boat->m_fMovingSpeed * 50.0f / 11.0f;
} else if (params->m_VehicleType == VEHICLE_TYPE_HELI) {
propellerSpeed = 1.0f;
} else {
automobile = (CAutomobile*)veh;
propellerSpeed = automobile->m_aWheelSpeed[1] * 50.0f / 11.0f;
}
if (propellerSpeed == 0.0f)
return;
propellerSpeed = Min(1.0f, propellerSpeed);
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
heli = (CHeli *)params->m_pVehicle;
for (uint32 i = 0; i < ARRAY_SIZE(gHeliSfxRanges); i++) {
MaxDist = gHeliSfxRanges[i].m_fMaxDistance;
dist = m_sQueueSample.m_fDistance;
if (dist >= MaxDist)
return true;
baseDist = gHeliSfxRanges[i].m_fBaseDistance;
if (dist < baseDist)
emittingVol = (gHeliSfxRanges[i].m_bBaseVolume * ((MaxDist - dist) / (MaxDist - baseDist)));
else
emittingVol = gHeliSfxRanges[i].m_bBaseVolume;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance);
//sound on long distances
if (m_sQueueSample.m_fDistance >= 40.0f)
emittingVol = propellerSpeed * 75.0f;
else if (m_sQueueSample.m_fDistance >= 25.0f)
emittingVol = (m_sQueueSample.m_fDistance - 25.0f) * (75.0f * propellerSpeed) / 15.0f;
else
emittingVol = 0;
if (emittingVol != 0) {
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = i + 65;
m_sQueueSample.m_nSampleIndex = i + SFX_HELI_1;
m_sQueueSample.m_nCounter = 88;
if (boat != nil) {
m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO3;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
if (accelerateState > 0 || brakeState > 0)
m_sQueueSample.m_nFrequency = 4600 + Min(1.0f, (Max(accelerateState, brakeState) / 255.0f) * freqModifier) * 563;
else
m_sQueueSample.m_nFrequency = 3651 + Min(1.0f, freqModifier) * 949;
} else {
m_sQueueSample.m_nSampleIndex = SFX_HELI_1;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
}
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_nFrequency = 1200 * heli->m_nHeliId + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = gHeliSfxRanges[i].m_fMaxDistance;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
}
if (params->m_fDistance >= SQR(140.0f))
return;
if (propellerSpeed >= 0.4f)
volumeModifier = (propellerSpeed - 0.4f) * 5.0f / 3.0f;
else
volumeModifier = 0.0f;
if (!boat) {
freq = Min(1300, 7000.0f * freqModifier);
if (playerVeh == veh && (accelerateState > 0 || brakeState > 0) && freq < 1300)//unnesesary freqModifier alredy <= 1300
freq = 1300;
if (veh->m_modelIndex == MI_HUNTER)
hunterBool = true;
}
//sound from front of helicopter
emittingVol = (1.0f - cameraAngle) * volumeModifier * 127.0f;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 140.0f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 3;
if (hunterBool) {
m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_1;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = (volumeModifier + 1.0f) * 16000 + freq;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 140.0f;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
} else if (boat != nil) {
m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO1;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
if (accelerateState > 0 || brakeState > 0)
m_sQueueSample.m_nFrequency = 18000 + Min(1.0f, freqModifier * (Max(accelerateState, brakeState) / 255.0f)) * 2204;
else
m_sQueueSample.m_nFrequency = 14287 + Min(1.0f, freqModifier) * 3713;
if (propellerSpeed < 1.0f)
m_sQueueSample.m_nFrequency = (propellerSpeed + 1.0f) * (m_sQueueSample.m_nFrequency / 2.0f);
m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqFrontPrev, 197);
freqFrontPrev = m_sQueueSample.m_nFrequency;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 140.0f;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
} else {
m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_MAI;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = (volumeModifier + 1) * 16000 + freq;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 140.0f;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
}
//after accel rotor sound
emittingVol = ((cameraAngle + 1.0f) * volumeModifier * 127.0f) / 2.0f;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 140.0, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 1;
if (hunterBool) {
m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_2;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = (volumeModifier + 1) * 16000 + freq;
} else if (boat) {
m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO2;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
if (accelerateState > 0 || brakeState > 0)
m_sQueueSample.m_nFrequency = 9000 + Min(1.0f, (Max(accelerateState, brakeState) / 255) * freqModifier) * 1102;
else
m_sQueueSample.m_nFrequency = 7143 + Min(1.0f, freqModifier) * 1857;
if (propellerSpeed < 1.0f)
m_sQueueSample.m_nFrequency = (propellerSpeed + 1) * (m_sQueueSample.m_nFrequency / 2);
m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqPropellerPrev, 98);
freqPropellerPrev = m_sQueueSample.m_nFrequency;
} else {
m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_MAI2;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = (volumeModifier + 1) * 16000 + freq;
}
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 140.0f;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
//engine starting sound
if (boat == nil && params->m_VehicleType != VEHICLE_TYPE_HELI && m_sQueueSample.m_fDistance < 30.0f) { //strange way to check if automobile != nil
if (automobile->bEngineOn) {
if (propellerSpeed < 1.0f) {
emittingVol = (1.0f - propellerSpeed / 2.0f) * 70.0f;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.0, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume) {
if (hunterBool) {
m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_4;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
freq = 3000.0f * propellerSpeed + 30000;
} else {
m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_STA;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
freq = 3000.0f * propellerSpeed + 6000;
}
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nCounter = 12;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 30;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
}
}
}
if (boat) {
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FIXED && m_sQueueSample.m_fDistance < 20.0f && propellerSpeed > 0.0f) {
m_sQueueSample.m_nVolume = ComputeVolume(propellerSpeed * 100.0f, 20.0f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume) {
if (accelerateState > 0 || brakeState > 0)
m_sQueueSample.m_nFrequency = 18000 + Min(1.0f, (Max(accelerateState, brakeState) / 255.0f) * freqModifier) * 2204;
else
m_sQueueSample.m_nFrequency = 14287 + Min(1.0f, freqModifier) * 3713;
if (propellerSpeed < 1.0)
m_sQueueSample.m_nFrequency = (propellerSpeed + 1) * (m_sQueueSample.m_nFrequency / 2.0f);
m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqSkimmerPrev, 197);
freqSkimmerPrev = m_sQueueSample.m_nFrequency;
m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO4;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = 12;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = propellerSpeed * 100.0f;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_SEAPLANE_PRO4);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_SEAPLANE_PRO4);
m_sQueueSample.m_fSpeedMultiplier = 5.0f;
m_sQueueSample.m_fSoundIntensity = 20.0f;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
}
} else {
//vacuum cleaner sound
vecPosOld = m_sQueueSample.m_vecPos;
distanceCalculatedOld = params->m_bDistanceCalculated;
distanceOld = params->m_fDistance;
if (automobile != nil)
automobile->GetComponentWorldPosition(CAR_BOOT, m_sQueueSample.m_vecPos);
else if (params->m_VehicleType == VEHICLE_TYPE_HELI)
m_sQueueSample.m_vecPos = CVector(0.0f, -10.0f, 0.0f); //this is from android, but for real it's not used
params->m_bDistanceCalculated = false;
params->m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (params->m_fDistance < SQR(27.0f)) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(volumeModifier * 25.0f, 27.0f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume) {
m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = hunterBool ? SFX_HELI_APACHE_3 : SFX_CAR_HELI_REA;
m_sQueueSample.m_nBankIndex = 0;
m_sQueueSample.m_bIs2D = 0;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = (volumeModifier + 1.0f) * 16000;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = volumeModifier * 25.0f;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 27.0f;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
}
m_sQueueSample.m_vecPos = vecPosOld;
params->m_bDistanceCalculated = distanceCalculatedOld;
params->m_fDistance = distanceOld;
}
}
void
cAudioManager::ProcessVehicleFlatTyre(cVehicleParams* params)
{
const float SOUND_INTENSITY = 60.0f;
CAutomobile* automobile;
CBike* bike;
bool wheelBurst;
uint8 emittingVol;
float modifier;
if (params->m_fDistance >= SQR(SOUND_INTENSITY))
return;
switch (params->m_VehicleType) {
case VEHICLE_TYPE_CAR:
automobile = (CAutomobile*)params->m_pVehicle;
wheelBurst = false;
for (int i = 0; i < 4; i++)
if (automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_BURST && automobile->m_aWheelTimer[i] > 0.0f)
wheelBurst = true;
if (!wheelBurst)
return;
break;
case VEHICLE_TYPE_BIKE:
bike = (CBike*)params->m_pVehicle;
wheelBurst = false;
for(int i = 0; i < 2; i++)
if (bike->m_wheelStatus[i] == WHEEL_STATUS_BURST && bike->m_aWheelTimer[i] > 0.0f)
wheelBurst = true;
if (!wheelBurst)
return;
break;
default:
return;
}
modifier = Min(1.0f, Abs(params->m_fVelocityChange) / (0.3f * params->m_pTransmission->fMaxVelocity));
if (modifier > 0.01f) { //mb can be replaced by (emittingVol > 1)
emittingVol = (100.0f * modifier);
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume) {
m_sQueueSample.m_nCounter = 95;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_nSampleIndex = SFX_TYRE_BURST_L;
m_sQueueSample.m_nFrequency = (5500.0f * modifier) + 8000;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_TYRE_BURST_L);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_TYRE_BURST_L);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
@ -3075,9 +3469,9 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
AddSampleToRequestedQueue();
}
}
return true;
}
//TODO use it in ProcessVehicle
void
cAudioManager::ProcessPlane(cVehicleParams *params)
{
@ -3252,7 +3646,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
}
bool
cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq)
{
const float SOUND_INTENSITY = 170.0f;
@ -3284,7 +3678,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
}
bool
cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq)
cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq)
{
const float SOUND_INTENSITY = 180.0f;
if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
@ -4192,7 +4586,6 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
return;
break;
}
soundIntensity = 50.0f;
} else {
switch (sound) {
@ -4564,6 +4957,91 @@ cAudioManager::ProcessWaterCannon(int32)
}
}
//positon of arcade machines
CVector aVecExtraSoundPosition[] = { {-1042.546f, 88.794f, 11.324f}, {-1004.476f, 181.697f, 11.324f} };
void
cAudioManager::ProcessExtraSounds()
{
const float SOUND_INTENSITY = 18.0f;
const uint8 EMITTING_VOLUME = 50;
float distance;
for (int i = 0; i < ARRAY_SIZE(aVecExtraSoundPosition); i++) {
m_sQueueSample.m_vecPos = aVecExtraSoundPosition[i];
distance = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distance < SQR(SOUND_INTENSITY)) {
if (distance > 0.0f)
m_sQueueSample.m_fDistance = Sqrt(distance);
else
m_sQueueSample.m_fDistance = 0.0f;
m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_nSampleIndex = SFX_ARCADE;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARCADE);
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 4;
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_ARCADE);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_ARCADE);
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bRequireReflection = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
AddSampleToRequestedQueue();
}
}
}
}
void
cAudioManager::ProcessEscalators()
{
const float SOUND_INTENSITY = 30.0f;
const uint8 EMITTING_VOLUME = 26;
float distance;
for (int i = 0; i < CEscalators::NumEscalators; i++) {
if (!CEscalators::GetEscalator(i).IsActive())
continue;
m_sQueueSample.m_vecPos = CEscalators::GetEscalator(i).GetPosition();
distance = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distance < SQR(SOUND_INTENSITY)) {
if (distance > 0.0f)
m_sQueueSample.m_fDistance = Sqrt(distance);
else
m_sQueueSample.m_fDistance = 0.0f;
m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nSampleIndex = SFX_BOAT_V12_LOOP;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = i * 50 % 250 + 3973;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_BOAT_V12_LOOP);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_BOAT_V12_LOOP);
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
}
}
}
#pragma region SCRIPT_OBJECTS
const int SCRIPT_OBJECT_INTENSITY_S = 30;
const int SCRIPT_OBJECT_INTENSITY_L = 80;
@ -4571,6 +5049,7 @@ const int SCRIPT_OBJECT_INTENSITY_L = 80;
void
cAudioManager::ProcessScriptObject(int32 id)
{
if (MusicManager.m_nMusicMode == MUSICMODE_GAME) {
cAudioScriptObject* entity = (cAudioScriptObject*)m_asAudioEntities[id].m_pEntity;
if (entity != nil) {
m_sQueueSample.m_vecPos = entity->Posn;
@ -4580,6 +5059,7 @@ cAudioManager::ProcessScriptObject(int32 id)
ProcessLoopingScriptObject(entity->AudioId);
}
}
}
void
cAudioManager::ProcessOneShotScriptObject(uint8 sound)
@ -4965,14 +5445,19 @@ void
cAudioManager::ProcessWeather(int32 id)
{
uint8 vol;
float x;
float y;
float modifier;
float wind;
static uint8 iSound = 0;
if (m_asAudioEntities[id].m_AudioEvents && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) {
if (m_asAudioEntities[id].m_AudioEvents != 0 && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) {
if (m_asAudioEntities[id].m_afVolume[0] >= 10.f) {
m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1;
m_sQueueSample.m_nBankIndex = SFX_BANK_GENERIC_EXTRA;
m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000;
vol = (m_asAudioEntities[id].m_afVolume[0] - 10.f) + 40;
vol = (m_asAudioEntities[id].m_afVolume[0] - 10.0f) + 40;
} else {
m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@ -4980,7 +5465,7 @@ cAudioManager::ProcessWeather(int32 id)
vol = (m_asAudioEntities[id].m_afVolume[0]) + 35;
}
m_sQueueSample.m_nVolume = vol;
if (TheCamera.SoundDistUp < 20.f)
if (TheCamera.SoundDistUp < 20.0f)
m_sQueueSample.m_nVolume /= 2;
if (iSound == 4)
iSound = 0;
@ -5000,7 +5485,7 @@ cAudioManager::ProcessWeather(int32 id)
if (CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAIN);
m_sQueueSample.m_nVolume = (int32)(25.f * CWeather::Rain);
m_sQueueSample.m_nVolume = (uint8)(25.0f * CWeather::Rain);
m_sQueueSample.m_nCounter = 4;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
@ -5016,6 +5501,32 @@ cAudioManager::ProcessWeather(int32 id)
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
x = 0.0f;
y = 0.0f;
CWindModifiers::FindWindModifier(TheCamera.GetPosition(), &x, &y);
modifier = Max(Abs(x), Abs(y)) * 10.0f;
modifier = Min(1.0f, modifier);
wind = Max(CWeather::Wind, modifier);
if (wind > 0.0f && CObject::fDistToNearestTree < 75.0) {
m_sQueueSample.m_nSampleIndex = SFX_PALM_TREE_LO;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PALM_TREE_LO);
m_sQueueSample.m_nVolume = (m_anRandomTable[1] % 10 + 45.0f) * (75.0f - CObject::fDistToNearestTree) * (4.0f / 300.0f) * wind;
m_sQueueSample.m_nCounter = 5;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nOffset = 63;
m_sQueueSample.m_bIs2D = true;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
CObject::fDistToNearestTree = 999999.9f;
}
}
void

View File

@ -811,7 +811,11 @@ cAudioManager::ProcessActiveQueues()
if (sample.m_nFrequency != m_asActiveSamples[j].m_nFrequency) {
int32 freq;
if (sample.m_nFrequency <= m_asActiveSamples[j].m_nFrequency) {
freq = Max(sample.m_nFrequency, m_asActiveSamples[j].m_nFrequency - 6000);
#ifdef FIX_BUGS
freq = Max((int32)sample.m_nFrequency, (int32)m_asActiveSamples[j].m_nFrequency - 6000);
#else
freq = Max((int32)sample.m_nFrequency, int32(m_asActiveSamples[j].m_nFrequency - 6000));
#endif
} else {
freq = Min(sample.m_nFrequency, m_asActiveSamples[j].m_nFrequency + 6000);
}

View File

@ -241,13 +241,13 @@ public:
// "Should" be in alphabetic order, except "getXTalkSfx"
void AddDetailsToRequestedOrderList(uint8 sample);
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank,
uint8 counter, bool notLooping);
uint8 counter, bool notLooping); //done
void AddReflectionsToRequestedQueue();
void AddReleasingSounds();
void AddSampleToRequestedQueue();
void AgeCrimes();
void CalculateDistance(bool &condition, float dist);
void CalculateDistance(bool &condition, float dist); //done
bool CheckForAnAudioFileOnCD() const;
void ClearActiveSamples();
void ClearMissionAudio(uint8 slot);
@ -275,7 +275,7 @@ public:
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
float GetCollisionOneShotRatio(int32 a, float b) const;
float GetCollisionRatio(float a, float b, float c, float d) const;
float GetDistanceSquared(const CVector &v) const;
float GetDistanceSquared(const CVector &v) const; //done
int32 GetJumboTaxiFreq() const;
uint8 GetMissionAudioLoadingStatus(uint8 slot) const;
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
@ -287,7 +287,7 @@ public:
float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
cTransmission *transmission, float velocityChange);
bool HasAirBrakes(int32 model) const;
bool HasAirBrakes(int32 model) const; //done
void Initialise();
void InitialisePoliceRadio();
@ -302,13 +302,13 @@ public:
void PlayLoadedMissionAudio(uint8 slot);
void PlayOneShot(int32 index, int16 sound, float vol);
void PlaySuspectLastSeen(float x, float y, float z);
void PlayerJustGotInCar() const;
void PlayerJustLeftCar() const;
void PlayerJustGotInCar() const; //done
void PlayerJustLeftCar() const; //done
void PostInitialiseGameSpecificSetup();
void PostTerminateGameSpecificShutdown();
void PreInitialiseGameSpecificSetup() const;
void PostTerminateGameSpecificShutdown(); //done
void PreInitialiseGameSpecificSetup() const; //done
void PreloadMissionAudio(uint8 slot, Const char *name);
void PreTerminateGameSpecificShutdown();
void PreTerminateGameSpecificShutdown(); //done
/// processX - main logic of adding new sounds
void ProcessActiveQueues();
bool ProcessAirBrakes(cVehicleParams *params);
@ -320,17 +320,18 @@ public:
void ProcessBridgeOneShots();
void ProcessBridgeWarning();
#endif
bool ProcessCarBombTick(cVehicleParams *params);
bool ProcessCarBombTick(cVehicleParams *params); //done
void ProcessCesna(cVehicleParams *params);
//void ProcessCrane();
bool ProcessEngineDamage(cVehicleParams *params);
void ProcessEntity(int32 sound);
bool ProcessEngineDamage(cVehicleParams *params); //done
void ProcessEntity(int32 sound); //done
void ProcessExplosions(int32 explosion);
void ProcessFireHydrant();
void ProcessFires(int32 entity);
void ProcessFrontEnd();
void ProcessGarages();
bool ProcessHelicopter(cVehicleParams *params);
void ProcessCarHeli(cVehicleParams* params); //done
void ProcessVehicleFlatTyre(cVehicleParams* params); //done
void ProcessJumbo(cVehicleParams *);
void ProcessJumboAccel(CPlane *plane);
void ProcessJumboDecel(CPlane *plane);
@ -345,22 +346,22 @@ public:
void ProcessOneShotScriptObject(uint8 sound);
void ProcessPed(CPhysical *ped);
void ProcessPedOneShots(cPedParams *params);
void ProcessPhysical(int32 id);
void ProcessPlane(cVehicleParams *params);
void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh);
void ProcessPhysical(int32 id); //done
void ProcessPlane(cVehicleParams *params); //done
void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh); //done
void ProcessProjectiles();
void ProcessRainOnVehicle(cVehicleParams *params);
void ProcessReverb() const;
bool ProcessReverseGear(cVehicleParams *params);
void ProcessScriptObject(int32 id);
bool ProcessReverseGear(cVehicleParams *params); //done
void ProcessScriptObject(int32 id); //done
void ProcessSpecial();
#ifdef GTA_TRAIN
bool ProcessTrainNoise(cVehicleParams *params);
#endif
void ProcessVehicle(CVehicle *vehicle);
bool ProcessVehicleDoors(cVehicleParams *params);
void ProcessVehicleEngine(cVehicleParams *params);
void UpdateGasPedalAudio(CVehicle* veh, int vehType);
void ProcessVehicle(CVehicle *vehicle); //done, but need add model functions
bool ProcessVehicleDoors(cVehicleParams *params); //done
void ProcessVehicleEngine(cVehicleParams *params); //done
void UpdateGasPedalAudio(CVehicle* veh, int vehType); //done
void ProcessVehicleHorn(cVehicleParams *params);
void ProcessVehicleOneShots(cVehicleParams *params);
bool ProcessVehicleReverseWarning(cVehicleParams *params);
@ -368,8 +369,10 @@ public:
bool ProcessVehicleSirenOrAlarm(cVehicleParams *params);
bool ProcessVehicleSkidding(cVehicleParams *params);
void ProcessWaterCannon(int32);
void ProcessWeather(int32 id);
void ProcessWeather(int32 id); //done
bool ProcessWetRoadNoise(cVehicleParams *params);
void ProcessEscalators(); //done
void ProcessExtraSounds(); //done
int32 RandomDisplacement(uint32 seed) const;
void ReacquireDigitalHandle() const;
@ -402,11 +405,11 @@ public:
void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
void SetUpOneShotCollisionSound(const cAudioCollision &col);
bool SetupCrimeReport();
bool SetupJumboEngineSound(uint8 vol, int32 freq);
bool SetupJumboEngineSound(uint8 vol, uint32 freq);
bool SetupJumboFlySound(uint8 emittingVol);
bool SetupJumboRumbleSound(uint8 emittingVol);
bool SetupJumboTaxiSound(uint8 vol);
bool SetupJumboWhineSound(uint8 emittingVol, int32 freq);
bool SetupJumboWhineSound(uint8 emittingVol, uint32 freq);
void SetupPedComments(cPedParams *params, uint32 sound);
void SetupSuspectLastSeenReport();
@ -414,11 +417,11 @@ public:
void TranslateEntity(Const CVector *v1, CVector *v2) const;
void UpdateReflections();
bool UsesReverseWarning(int32 model) const;
bool UsesReverseWarning(int32 model) const; //done
bool UsesSiren(int32 model) const;
bool UsesSirenSwitching(int32 model) const;
CVehicle *FindVehicleOfPlayer();
CVehicle *FindVehicleOfPlayer(); //done
void SetPedTalkingStatus(CPed *ped, uint8 status);
void SetPlayersMood(uint8 mood, int32 time);

View File

@ -6,7 +6,7 @@
cSampleManager SampleManager;
bool _bSampmanInitialised = false;
uint32 BankStartOffset[MAX_SAMPLEBANKS];
uint32 BankStartOffset[MAX_SFX_BANKS];
uint32 nNumMP3s;
cSampleManager::cSampleManager(void)
@ -136,20 +136,20 @@ cSampleManager::SetMonoMode(uint8 nMode)
bool
cSampleManager::LoadSampleBank(uint8 nBank)
{
ASSERT( nBank < MAX_SAMPLEBANKS );
ASSERT( nBank < MAX_SFX_BANKS );
return false;
}
void
cSampleManager::UnloadSampleBank(uint8 nBank)
{
ASSERT( nBank < MAX_SAMPLEBANKS );
ASSERT( nBank < MAX_SFX_BANKS );
}
bool
cSampleManager::IsSampleBankLoaded(uint8 nBank)
{
ASSERT( nBank < MAX_SAMPLEBANKS );
ASSERT( nBank < MAX_SFX_BANKS );
return false;
}
@ -179,7 +179,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
int32
cSampleManager::GetBankContainingSound(uint32 offset)
{
return SAMPLEBANK_INVALID;
return INVALID_SFX_BANK;
}
int32

View File

@ -1819,7 +1819,13 @@ CVehicle* CStoredCar::RestoreCar()
#ifdef FIX_BUGS
if (pVehicle->IsCar())
#endif
{
((CAutomobile*)pVehicle)->m_bombType = m_nCarBombType;
#ifdef FIX_BUGS
if (m_nCarBombType != CARBOMB_NONE)
((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed();
#endif
}
pVehicle->bHasBeenOwnedByPlayer = true;
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
pVehicle->bBulletProof = m_bBulletproof;

View File

@ -107,11 +107,13 @@ CdStreamInit(int32 numChannels)
_gdwCdStreamFlags = 0;
#ifndef FIX_BUGS // this just slows down streaming
if ( BytesPerSector <= CDSTREAM_SECTOR_SIZE )
{
_gdwCdStreamFlags |= FILE_FLAG_NO_BUFFERING;
debug("Using no buffered loading for streaming\n");
}
#endif
_gbCdStreamOverlapped = TRUE;

View File

@ -733,9 +733,6 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown_Driving(int32
FindPlayerVehicle()->GetModelIndex() == MI_DODO
#ifdef FIX_BUGS
|| (CVehicle::bAllDodosCheat && !FindPlayerVehicle()->IsRealHeli())
#ifdef ALLCARSHELI_CHEAT
|| bAllCarCheat
#endif
#endif
)))
{

View File

@ -526,7 +526,7 @@ void KangarooCheat()
}
#endif
#ifdef ALLCARSHELI_CHEAT
#ifdef RESTORE_ALLCARSHELI_CHEAT
void AllCarsHeliCheat(void)
{
wchar* string;
@ -1438,7 +1438,7 @@ void CPad::AddToPCCheatString(char c)
CPed::SwitchDebugDisplay();
#endif
#ifdef ALLCARSHELI_CHEAT
#ifdef RESTORE_ALLCARSHELI_CHEAT
// "CARSAREHELI"
if (!_CHEATCMP("ILEHERASRAC"))
AllCarsHeliCheat();

View File

@ -286,6 +286,8 @@ public:
bool GetMiddleMouseJustUp() { return !!(!NewMouseControllerState.MMB && OldMouseControllerState.MMB); }
bool GetMouseWheelUpJustUp() { return !!(!NewMouseControllerState.WHEELUP && OldMouseControllerState.WHEELUP); }
bool GetMouseWheelDownJustUp() { return !!(!NewMouseControllerState.WHEELDN && OldMouseControllerState.WHEELDN); }
bool GetMouseX1JustUp() { return !!(!NewMouseControllerState.MXB1 && OldMouseControllerState.MXB1); }
bool GetMouseX2JustUp() { return !!(!NewMouseControllerState.MXB2 && OldMouseControllerState.MXB2); }
bool GetLeftMouse() { return NewMouseControllerState.LMB; }
bool GetRightMouse() { return NewMouseControllerState.RMB; }
@ -470,7 +472,3 @@ public:
VALIDATE_SIZE(CPad, 0xFC);
extern CPad Pads[MAX_PADS];
#ifdef ALLCARSHELI_CHEAT
extern bool bAllCarCheat;
#endif

View File

@ -1151,6 +1151,10 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay
if (!ms_RadarTrace[nextBlip].m_bInUse)
break;
}
#ifdef FIX_BUGS
if (nextBlip == NUMRADARBLIPS)
return -1;
#endif
ms_RadarTrace[nextBlip].m_eBlipType = type;
ms_RadarTrace[nextBlip].m_nColor = color;
ms_RadarTrace[nextBlip].m_bDim = true;
@ -1182,6 +1186,10 @@ int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDispla
if (!ms_RadarTrace[nextBlip].m_bInUse)
break;
}
#ifdef FIX_BUGS
if (nextBlip == NUMRADARBLIPS)
return -1;
#endif
ms_RadarTrace[nextBlip].m_eBlipType = type;
ms_RadarTrace[nextBlip].m_nColor = color;
ms_RadarTrace[nextBlip].m_bDim = true;
@ -1526,6 +1534,10 @@ CRadar::ToggleTargetMarker(float x, float y)
if (!ms_RadarTrace[nextBlip].m_bInUse)
break;
}
#ifdef FIX_BUGS
if (nextBlip == NUMRADARBLIPS)
return;
#endif
ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
ms_RadarTrace[nextBlip].m_nColor = 0x333333FF;
ms_RadarTrace[nextBlip].m_bDim = 1;

View File

@ -219,6 +219,8 @@ extern int strncasecmp(const char *str1, const char *str2, size_t len);
#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
#define clamp2(v, center, radius) ((v) < (center) ? Max(v, center - radius) : Min(v, center + radius))
inline float sq(float x) { return x*x; }
#define SQR(x) ((x) * (x))

View File

@ -250,7 +250,7 @@ enum Config {
#endif
#define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m
#define KANGAROO_CHEAT
#define ALLCARSHELI_CHEAT
#define RESTORE_ALLCARSHELI_CHEAT
#define ALT_DODO_CHEAT
#define WALLCLIMB_CHEAT
#define REGISTER_START_BUTTON
@ -258,14 +258,13 @@ enum Config {
// Hud, frontend and radar
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
#define BETA_SLIDING_TEXT
//#define BETA_SLIDING_TEXT
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PC_MENU
#ifndef PC_MENU
# define PS2_MENU
//# define PS2_MENU_USEALLPAGEICONS
//# define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
#else
# define MAP_ENHANCEMENTS // Adding waypoint etc.
# define TRIANGLE_BACK_BUTTON

View File

@ -50,7 +50,7 @@ void tbInit()
#endif
}
void tbStartTimer(int32 unk, char *name)
void tbStartTimer(int32 unk, Const char *name)
{
strcpy(TimerBar.Timers[TimerBar.count].name, name);
TimerBar.Timers[TimerBar.count].unk = unk;
@ -58,7 +58,7 @@ void tbStartTimer(int32 unk, char *name)
TimerBar.count++;
}
void tbEndTimer(char* name)
void tbEndTimer(Const char* name)
{
uint32 n = 1500;
for (uint32 i = 0; i < TimerBar.count; i++) {

View File

@ -1,6 +1,6 @@
#pragma once
void tbInit();
void tbStartTimer(int32, char*);
void tbEndTimer(char*);
void tbStartTimer(int32, Const char*);
void tbEndTimer(Const char*);
void tbDisplay();

View File

@ -103,6 +103,8 @@ public:
void Update(void);
void SwitchOff(void);
void AddThisOne(CVector pos0, CVector pos1, CVector pos2, CVector pos3, bool b_isMovingDown);
bool IsActive() const { return m_bIsActive; };
const CVector& GetPosition() const { return m_midPoint; };
};
class CEscalators
@ -114,6 +116,7 @@ public:
static void Update(void);
static void AddOne(CVector pos0, CVector pos1, CVector pos2, CVector pos3, bool b_isMovingDown);
static void Shutdown(void);
static const CEscalator& GetEscalator(int ind) { return aEscalators[ind]; };
};
class CMovingThing

View File

@ -1099,8 +1099,11 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
if ( wParam == VK_SHIFT )
_InputTranslateShiftKeyUpDown(&ks);
#ifdef FIX_BUGS
break;
#else
return 0L;
#endif
}
case WM_KEYUP:
@ -1113,7 +1116,11 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
if ( wParam == VK_SHIFT )
_InputTranslateShiftKeyUpDown(&ks);
#ifdef FIX_BUGS
break;
#else
return 0L;
#endif
}
case WM_SYSKEYDOWN:
@ -1126,7 +1133,11 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
if ( wParam == VK_SHIFT )
_InputTranslateShiftKeyUpDown(&ks);
#ifdef FIX_BUGS
break;
#else
return 0L;
#endif
}
case WM_SYSKEYUP:
@ -1139,7 +1150,11 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
if ( wParam == VK_SHIFT )
_InputTranslateShiftKeyUpDown(&ks);
#ifdef FIX_BUGS
break;
#else
return 0L;
#endif
}
case WM_ACTIVATEAPP:
@ -2508,8 +2523,10 @@ WinMain(HINSTANCE instance,
{
if ( gGameState == GS_PLAYING_GAME )
CGame::ShutDown();
#ifndef MASTER
else if ( gGameState == GS_ANIMVIEWER )
CAnimViewer::Shutdown();
#endif
CTimer::Stop();
@ -2533,8 +2550,10 @@ WinMain(HINSTANCE instance,
if ( gGameState == GS_PLAYING_GAME )
CGame::ShutDown();
#ifndef MASTER
else if ( gGameState == GS_ANIMVIEWER )
CAnimViewer::Shutdown();
#endif
DMAudio.Terminate();

View File

@ -1400,6 +1400,12 @@ CAutomobile::ProcessControl(void)
}else if(GetModelIndex() == MI_RCBARON){
FlyingControl(FLIGHT_MODEL_RCPLANE);
}else if(IsRealHeli() || bAllCarCheat){
#ifdef RESTORE_ALLCARSHELI_CHEAT
if (bAllCarCheat)
FlyingControl(FLIGHT_MODEL_HELI);
else
#endif
{
// Speed up rotor
if (m_aWheelSpeed[1] < 0.22f && !bIsInWater) {
if (GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_RCGOBLIN)
@ -1419,6 +1425,7 @@ CAutomobile::ProcessControl(void)
Abs(m_vecMoveSpeed.z) > 0.02f)
FlyingControl(FLIGHT_MODEL_HELI);
}
}
// Blade collision
if(m_aWheelSpeed[1] > 0.015f && m_aCarNodes[CAR_BONNET]){
@ -1489,7 +1496,7 @@ CAutomobile::ProcessControl(void)
CMatrix mat;
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_BONNET]));
CVector blade = mat.GetRight();
blade = GetMatrix() * blade;
blade = Multiply3x3(blade, GetMatrix());
camDist /= Max(Sqrt(distSq), 0.01f);
if(Abs(DotProduct(camDist, blade)) > 0.95f){
DMAudio.PlayOneShot(m_audioEntityId, SOUND_31, 0.0f);

View File

@ -168,3 +168,4 @@ public:
};
extern CVector vecHunterGunPos;
extern bool bAllCarCheat;

View File

@ -32,7 +32,7 @@ void CCarGenerator::SwitchOff()
void CCarGenerator::SwitchOn()
{
m_nUsesRemaining = 255;
m_nUsesRemaining = UINT16_MAX;
m_nTimer = CalcNextGen();
++CTheCarGenerators::CurrentActiveCount;
}
@ -143,10 +143,10 @@ void CCarGenerator::DoInternalProcessing()
m_nVehicleHandle = CPools::GetVehiclePool()->GetIndex(pVehicle);
/* I don't think this is a correct comparasion */
#ifdef FIX_BUGS
if (m_nUsesRemaining != 0)
if (m_nUsesRemaining < UINT16_MAX)
--m_nUsesRemaining;
#else
if (m_nUsesRemaining < -1)
if (m_nUsesRemaining < ~0)
--m_nUsesRemaining;
#endif
m_nTimer = CalcNextGen();

View File

@ -48,8 +48,10 @@ CDamageManager::FuckCarCompletely(void)
#endif
}
// Why set to no damage?
#ifndef FIX_BUGS
m_lightStatus = 0;
m_panelStatus = 0;
#endif
SetEngineStatus(250);
}

View File

@ -432,7 +432,12 @@ CVehicle::FlyingControl(eFlightModel flightModel)
case FLIGHT_MODEL_RCHELI:
case FLIGHT_MODEL_HELI:
{
float rm = Pow(pFlyingHandling->fMoveRes, CTimer::GetTimeStep());
#ifdef RESTORE_ALLCARSHELI_CHEAT
tFlyingHandlingData* flyingHandling = bAllCarCheat && GetStatus() == STATUS_PLAYER && !IsRealHeli() ? mod_HandlingManager.GetFlyingPointer(HANDLING_MAVERICK) : pFlyingHandling;
#else
tFlyingHandlingData* flyingHandling = pFlyingHandling;
#endif
float rm = Pow(flyingHandling->fMoveRes, CTimer::GetTimeStep());
m_vecMoveSpeed *= rm;
if (GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE)
return;
@ -441,11 +446,11 @@ CVehicle::FlyingControl(eFlightModel flightModel)
if(fThrust < 0.0f)
fThrust *= 2.0f;
if(flightModel == FLIGHT_MODEL_RCHELI){
fThrust = pFlyingHandling->fThrust * fThrust + 0.45f;
fThrust = flyingHandling->fThrust * fThrust + 0.45f;
ApplyMoveForce(GRAVITY * CVector(0.0f, 0.0f, 0.5f) * m_fMass * CTimer::GetTimeStep());
}else
fThrust = pFlyingHandling->fThrust * fThrust + 0.95f;
fThrust -= pFlyingHandling->fThrustFallOff * fUpSpeed;
fThrust = flyingHandling->fThrust * fThrust + 0.95f;
fThrust -= flyingHandling->fThrustFallOff * fUpSpeed;
if(flightModel == FLIGHT_MODEL_RCHELI && GetPosition().z > 40.0f)
fThrust *= 10.0f/(GetPosition().z - 30.0f);
else if(GetPosition().z > 80.0f)
@ -453,20 +458,20 @@ CVehicle::FlyingControl(eFlightModel flightModel)
ApplyMoveForce(GRAVITY * GetUp() * fThrust * m_fMass * CTimer::GetTimeStep());
if (GetUp().z > 0.0f){
float upRight = clamp(GetRight().z, -pFlyingHandling->fFormLift, pFlyingHandling->fFormLift);
float upImpulseRight = -upRight * pFlyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep();
float upRight = clamp(GetRight().z, -flyingHandling->fFormLift, flyingHandling->fFormLift);
float upImpulseRight = -upRight * flyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep();
ApplyTurnForce(upImpulseRight * GetUp(), GetRight());
float upFwd = clamp(GetForward().z, -pFlyingHandling->fFormLift, pFlyingHandling->fFormLift);
float upImpulseFwd = -upFwd * pFlyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep();
float upFwd = clamp(GetForward().z, -flyingHandling->fFormLift, flyingHandling->fFormLift);
float upImpulseFwd = -upFwd * flyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep();
ApplyTurnForce(upImpulseFwd * GetUp(), GetForward());
}else{
float upRight = GetRight().z < 0.0f ? -pFlyingHandling->fFormLift : pFlyingHandling->fFormLift;
float upImpulseRight = -upRight * pFlyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep();
float upRight = GetRight().z < 0.0f ? -flyingHandling->fFormLift : flyingHandling->fFormLift;
float upImpulseRight = -upRight * flyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep();
ApplyTurnForce(upImpulseRight * GetUp(), GetRight());
float upFwd = GetForward().z < 0.0f ? -pFlyingHandling->fFormLift : pFlyingHandling->fFormLift;
float upImpulseFwd = -upFwd * pFlyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep();
float upFwd = GetForward().z < 0.0f ? -flyingHandling->fFormLift : flyingHandling->fFormLift;
float upImpulseFwd = -upFwd * flyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep();
ApplyTurnForce(upImpulseFwd * GetUp(), GetForward());
}
@ -490,25 +495,25 @@ CVehicle::FlyingControl(eFlightModel flightModel)
fPitch = -CPad::GetPad(0)->GetCarGunUpDown() / 128.0f;
if (CPad::GetPad(0)->GetHorn()) {
fYaw = 0.0f;
fPitch = clamp(pFlyingHandling->fPitchStab * DotProduct(m_vecMoveSpeed, GetForward()), -200.0f, 1.3f);
fRoll = clamp(pFlyingHandling->fRollStab * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f);
fPitch = clamp(flyingHandling->fPitchStab * DotProduct(m_vecMoveSpeed, GetForward()), -200.0f, 1.3f);
fRoll = clamp(flyingHandling->fRollStab * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f);
}
ApplyTurnForce(fPitch * GetUp() * pFlyingHandling->fPitch * m_fTurnMass * CTimer::GetTimeStep(), GetForward());
ApplyTurnForce(fRoll * GetUp() * pFlyingHandling->fRoll * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
ApplyTurnForce(fPitch * GetUp() * flyingHandling->fPitch * m_fTurnMass * CTimer::GetTimeStep(), GetForward());
ApplyTurnForce(fRoll * GetUp() * flyingHandling->fRoll * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
float fSideSpeed = -DotProduct(GetMoveSpeed(), GetRight());
float fSideSlipAccel = pFlyingHandling->fSideSlip * fSideSpeed * Abs(fSideSpeed);
float fSideSlipAccel = flyingHandling->fSideSlip * fSideSpeed * Abs(fSideSpeed);
ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep());
float fYawAccel = pFlyingHandling->fYawStab * fSideSpeed * Abs(fSideSpeed) + pFlyingHandling->fYaw * fYaw;
float fYawAccel = flyingHandling->fYawStab * fSideSpeed * Abs(fSideSpeed) + flyingHandling->fYaw * fYaw;
ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), -GetForward());
ApplyTurnForce(fYaw * GetForward() * pFlyingHandling->fYaw * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
ApplyTurnForce(fYaw * GetForward() * flyingHandling->fYaw * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
float rX = Pow(pFlyingHandling->vecTurnRes.x, CTimer::GetTimeStep());
float rY = Pow(pFlyingHandling->vecTurnRes.y, CTimer::GetTimeStep());
float rZ = Pow(pFlyingHandling->vecTurnRes.z, CTimer::GetTimeStep());
float rX = Pow(flyingHandling->vecTurnRes.x, CTimer::GetTimeStep());
float rY = Pow(flyingHandling->vecTurnRes.y, CTimer::GetTimeStep());
float rZ = Pow(flyingHandling->vecTurnRes.z, CTimer::GetTimeStep());
CVector vecTurnSpeed = Multiply3x3(m_vecTurnSpeed, GetMatrix());
float fResistanceMultiplier = Pow(1.0f / (pFlyingHandling->vecSpeedRes.z * SQR(vecTurnSpeed.z) + 1.0f) * rZ, CTimer::GetTimeStep());
float fResistanceMultiplier = Pow(1.0f / (flyingHandling->vecSpeedRes.z * SQR(vecTurnSpeed.z) + 1.0f) * rZ, CTimer::GetTimeStep());
float fResistance = vecTurnSpeed.z * fResistanceMultiplier - vecTurnSpeed.z;
vecTurnSpeed.x *= rX;
vecTurnSpeed.y *= rY;