Fixes for nitpicks

This commit is contained in:
Filip Gawin 2019-10-13 00:35:01 +02:00
parent 43866a4f70
commit d822417cfc
8 changed files with 129 additions and 131 deletions

View file

@ -1,5 +1,5 @@
version: 1.0.{build} version: 1.0.{build}
image: Visual Studio 2017 image: Visual Studio 2019
configuration: configuration:
- Debug - Debug
- Release - Release
@ -10,7 +10,7 @@ install:
- cmd: >- - cmd: >-
git submodule update --init --recursive git submodule update --init --recursive
premake-vs2017.cmd premake-vs2019.cmd
build: build:
project: build/re3.sln project: build/re3.sln
verbosity: minimal verbosity: minimal

View file

@ -283,7 +283,7 @@ cAudioScriptObject::Reset()
{ {
AudioId = 125; AudioId = 125;
Posn = {0.0f, 0.0f, 0.0f}; Posn = {0.0f, 0.0f, 0.0f};
AudioEntity = -5; AudioEntity = AEHANDLE_NONE;
} }
void * void *
@ -409,7 +409,7 @@ cAudioManager::AddReleasingSounds()
if(!m_asSamples[!m_bActiveSampleQueue] if(!m_asSamples[!m_bActiveSampleQueue]
[m_abSampleQueueIndexTable[!m_bActiveSampleQueue][i]] [m_abSampleQueueIndexTable[!m_bActiveSampleQueue][i]]
.m_bLoopEnded) { .m_bLoopEnded) {
toProcess[i] = 0; toProcess[i] = false;
for(int32 j = 0; j < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; for(int32 j = 0; j < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue];
j++) { j++) {
if(sample.m_nEntityIndex == if(sample.m_nEntityIndex ==
@ -422,7 +422,7 @@ cAudioManager::AddReleasingSounds()
[m_abSampleQueueIndexTable[m_bActiveSampleQueue] [m_abSampleQueueIndexTable[m_bActiveSampleQueue]
[j]] [j]]
.m_counter) { .m_counter) {
toProcess[i] = 1; toProcess[i] = true;
break; break;
} }
} }
@ -526,7 +526,7 @@ void
cAudioManager::ClearActiveSamples() cAudioManager::ClearActiveSamples()
{ {
for(int32 i = 0; i < m_bActiveSamples; i++) { for(int32 i = 0; i < m_bActiveSamples; i++) {
m_asActiveSamples[i].m_nEntityIndex = -5; m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
m_asActiveSamples[i].m_counter = 0; m_asActiveSamples[i].m_counter = 0;
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE; m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[i].m_bBankIndex = 3; m_asActiveSamples[i].m_bBankIndex = 3;
@ -3070,7 +3070,7 @@ float
cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
cTransmission *transmission, float velocityChange) cTransmission *transmission, float velocityChange)
{ {
int wheelState; tWheelState wheelState;
float relativeVelChange; float relativeVelChange;
float gasPedalAudio = automobile->m_fGasPedalAudio; float gasPedalAudio = automobile->m_fGasPedalAudio;
float modificator; float modificator;
@ -3078,12 +3078,12 @@ cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobil
float relativeVel; float relativeVel;
wheelState = automobile->m_aWheelState[wheel]; wheelState = automobile->m_aWheelState[wheel];
if(wheelState == 1 && gasPedalAudio > 0.4f) { if(wheelState == WHEEL_STATE_SPINNING && gasPedalAudio > 0.4f) {
relativeVelChange = (gasPedalAudio + -0.4f) * 1.25f; relativeVelChange = (gasPedalAudio - 0.4f) * 1.25f;
} else if(wheelState == 2) { } else if(wheelState == WHEEL_STATE_SKIDDING) {
relativeVelChange = min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); relativeVelChange = min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
} else if(wheelState == 3) { } else if(wheelState == WHEEL_STATE_FIXED) {
modificator = 0.4f; modificator = 0.4f;
relativeVelChange = gasPedalAudio; relativeVelChange = gasPedalAudio;
if(relativeVelChange > 0.4f) { if(relativeVelChange > 0.4f) {
@ -3174,77 +3174,79 @@ char *SubZo3Label = (char *)0x6E9870;
void void
cAudioManager::InitialisePoliceRadioZones() cAudioManager::InitialisePoliceRadioZones()
{ {
for(int32 i = 0; i < 36; i++) { ZoneSfx[i].m_aName[0] = 0; } for(int32 i = 0; i < 36; i++) {
for(int32 j = 0; j < 8; j++) { ZoneSfx[i].m_aName[j] = 0; }
}
strcpy((char *)ZoneSfx, "HOSPI_2"); strcpy(ZoneSfx[0].m_aName, "HOSPI_2");
ZoneSfx[0].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; ZoneSfx[0].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD;
strcpy((char *)&ZoneSfx[1], "CONSTRU"); strcpy(ZoneSfx[1].m_aName, "CONSTRU");
ZoneSfx[1].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_FORT_STAUNTON; ZoneSfx[1].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_FORT_STAUNTON;
strcpy((char *)&ZoneSfx[2], "STADIUM"); strcpy(ZoneSfx[2].m_aName, "STADIUM");
ZoneSfx[2].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ASPATRIA; ZoneSfx[2].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ASPATRIA;
strcpy((char *)&ZoneSfx[3], "YAKUSA"); strcpy(ZoneSfx[3].m_aName, "YAKUSA");
ZoneSfx[3].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_TORRINGTON; ZoneSfx[3].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_TORRINGTON;
strcpy((char *)&ZoneSfx[4], "SHOPING"); strcpy(ZoneSfx[4].m_aName, "SHOPING");
ZoneSfx[4].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_BEDFORD_POINT; ZoneSfx[4].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_BEDFORD_POINT;
strcpy((char *)&ZoneSfx[5], "COM_EAS"); strcpy(ZoneSfx[5].m_aName, "COM_EAS");
ZoneSfx[5].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_NEWPORT; ZoneSfx[5].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_NEWPORT;
strcpy((char *)&ZoneSfx[6], "PARK"); strcpy(ZoneSfx[6].m_aName, "PARK");
ZoneSfx[6].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_BELLEVILLE; ZoneSfx[6].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_BELLEVILLE;
strcpy((char *)&ZoneSfx[7], "UNIVERS"); strcpy(ZoneSfx[7].m_aName, "UNIVERS");
ZoneSfx[7].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_LIBERTY_CAMPUS; ZoneSfx[7].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_LIBERTY_CAMPUS;
strcpy((char *)&ZoneSfx[8], "BIG_DAM"); strcpy(ZoneSfx[8].m_aName, "BIG_DAM");
ZoneSfx[8].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_COCHRANE; ZoneSfx[8].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_COCHRANE;
strcpy((char *)&ZoneSfx[9], "SUB_IND"); strcpy(ZoneSfx[9].m_aName, "SUB_IND");
ZoneSfx[9].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PIKE_CREEK; ZoneSfx[9].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PIKE_CREEK;
strcpy((char *)&ZoneSfx[10], "SWANKS"); strcpy(ZoneSfx[10].m_aName, "SWANKS");
ZoneSfx[10].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_CEDAR_GROVE; ZoneSfx[10].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_CEDAR_GROVE;
strcpy((char *)&ZoneSfx[11], "PROJECT"); strcpy(ZoneSfx[11].m_aName, "PROJECT");
ZoneSfx[11].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_WICHITA_GARDEN; ZoneSfx[11].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_WICHITA_GARDEN;
strcpy((char *)&ZoneSfx[12], "AIRPORT"); strcpy(ZoneSfx[12].m_aName, "AIRPORT");
ZoneSfx[12].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_FRANCIS_INTNL; ZoneSfx[12].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_FRANCIS_INTNL;
strcpy((char *)&ZoneSfx[13], "PORT_W"); strcpy(ZoneSfx[13].m_aName, "PORT_W");
ZoneSfx[13].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_CALLAHAN_POINT; ZoneSfx[13].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_CALLAHAN_POINT;
strcpy((char *)&ZoneSfx[14], "PORT_S"); strcpy(ZoneSfx[14].m_aName, "PORT_S");
ZoneSfx[14].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ATLANTIC_QUAYS; ZoneSfx[14].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ATLANTIC_QUAYS;
strcpy((char *)&ZoneSfx[15], "PORT_E"); strcpy(ZoneSfx[15].m_aName, "PORT_E");
ZoneSfx[15].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND_HARBOUR; ZoneSfx[15].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND_HARBOUR;
strcpy((char *)&ZoneSfx[16], "PORT_I"); strcpy(ZoneSfx[16].m_aName, "PORT_I");
ZoneSfx[16].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_TRENTON; ZoneSfx[16].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_TRENTON;
strcpy((char *)&ZoneSfx[17], "CHINA"); strcpy(ZoneSfx[17].m_aName, "CHINA");
ZoneSfx[17].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_CHINATOWN; ZoneSfx[17].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_CHINATOWN;
strcpy((char *)&ZoneSfx[18], "REDLIGH"); strcpy(ZoneSfx[18].m_aName, "REDLIGH");
ZoneSfx[18].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_REDLIGHT; ZoneSfx[18].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_REDLIGHT;
strcpy((char *)&ZoneSfx[19], "TOWERS"); strcpy(ZoneSfx[19].m_aName, "TOWERS");
ZoneSfx[19].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_HEPBURN_HEIGHTS; ZoneSfx[19].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_HEPBURN_HEIGHTS;
strcpy((char *)&ZoneSfx[20], "LITTLEI"); strcpy(ZoneSfx[20].m_aName, "LITTLEI");
ZoneSfx[20].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ST_MARKS; ZoneSfx[20].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ST_MARKS;
strcpy((char *)&ZoneSfx[21], "HARWOOD"); strcpy(ZoneSfx[21].m_aName, "HARWOOD");
ZoneSfx[21].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_HARWOOD; ZoneSfx[21].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_HARWOOD;
strcpy((char *)&ZoneSfx[22], "EASTBAY"); strcpy(ZoneSfx[22].m_aName, "EASTBAY");
ZoneSfx[22].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND_BEACH; ZoneSfx[22].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND_BEACH;
strcpy((char *)&ZoneSfx[23], "S_VIEW"); strcpy(ZoneSfx[23].m_aName, "S_VIEW");
ZoneSfx[23].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND_VIEW; ZoneSfx[23].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND_VIEW;
strcpy((char *)&ZoneSfx[24], "CITYZON"); strcpy(ZoneSfx[24].m_aName, "CITYZON");
ZoneSfx[24].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_LIBERTY_CITY; ZoneSfx[24].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_LIBERTY_CITY;
strcpy((char *)&ZoneSfx[25], "IND_ZON"); strcpy(ZoneSfx[25].m_aName, "IND_ZON");
ZoneSfx[25].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND; ZoneSfx[25].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_PORTLAND;
strcpy((char *)&ZoneSfx[26], "COM_ZON"); strcpy(ZoneSfx[26].m_aName, "COM_ZON");
ZoneSfx[26].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_STAUNTON; ZoneSfx[26].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_STAUNTON;
strcpy((char *)&ZoneSfx[27], "SUB_ZON"); strcpy(ZoneSfx[27].m_aName, "SUB_ZON");
ZoneSfx[27].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE; ZoneSfx[27].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE;
strcpy((char *)&ZoneSfx[28], "SUB_ZO2"); strcpy(ZoneSfx[28].m_aName, "SUB_ZO2");
ZoneSfx[28].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE; ZoneSfx[28].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE;
strcpy((char *)&ZoneSfx[29], "SUB_ZO3"); strcpy(ZoneSfx[29].m_aName, "SUB_ZO3");
ZoneSfx[29].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE; ZoneSfx[29].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_SHORESIDE;
strcpy((char *)&ZoneSfx[30], "A"); strcpy(ZoneSfx[30].m_aName, "A");
ZoneSfx[30].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; ZoneSfx[30].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD;
strcpy((char *)&ZoneSfx[31], "A"); strcpy(ZoneSfx[31].m_aName, "A");
ZoneSfx[31].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; ZoneSfx[31].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD;
strcpy((char *)&ZoneSfx[32], "A"); strcpy(ZoneSfx[32].m_aName, "A");
ZoneSfx[32].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; ZoneSfx[32].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD;
strcpy((char *)&ZoneSfx[33], "A"); strcpy(ZoneSfx[33].m_aName, "A");
ZoneSfx[33].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; ZoneSfx[33].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD;
strcpy((char *)&ZoneSfx[34], "A"); strcpy(ZoneSfx[34].m_aName, "A");
ZoneSfx[34].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD; ZoneSfx[34].m_nSampleIndex = AUDIO_SAMPLE_POLICE_SCANNER_ZONE_ROCKFORD;
strcpy(SubZo2Label, "SUB_ZO2"); strcpy(SubZo2Label, "SUB_ZO2");
strcpy(SubZo3Label, "SUB_ZO3"); strcpy(SubZo3Label, "SUB_ZO3");
@ -3315,7 +3317,7 @@ cAudioManager::PlayLoadedMissionAudio()
void void
cAudioManager::PlayOneShot(int32 index, int16 sound, float vol) cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
{ {
static constexpr uint8 byte_60ABD0[168] = { static constexpr uint8 byte_60ABD0[] = {
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1,
1, 4, 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6, 1, 4, 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6,
6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -3678,31 +3680,31 @@ cAudioManager::PreTerminateGameSpecificShutdown()
{ {
if(m_nBridgeEntity >= 0) { if(m_nBridgeEntity >= 0) {
DestroyEntity(m_nBridgeEntity); DestroyEntity(m_nBridgeEntity);
m_nBridgeEntity = -5; m_nBridgeEntity = AEHANDLE_NONE;
} }
if(m_nPoliceChannelEntity >= 0) { if(m_nPoliceChannelEntity >= 0) {
DestroyEntity(m_nPoliceChannelEntity); DestroyEntity(m_nPoliceChannelEntity);
m_nPoliceChannelEntity = -5; m_nPoliceChannelEntity = AEHANDLE_NONE;
} }
if(m_nWaterCannonEntity >= 0) { if(m_nWaterCannonEntity >= 0) {
DestroyEntity(m_nWaterCannonEntity); DestroyEntity(m_nWaterCannonEntity);
m_nWaterCannonEntity = -5; m_nWaterCannonEntity = AEHANDLE_NONE;
} }
if(m_nFireAudioEntity >= 0) { if(m_nFireAudioEntity >= 0) {
DestroyEntity(m_nFireAudioEntity); DestroyEntity(m_nFireAudioEntity);
m_nFireAudioEntity = -5; m_nFireAudioEntity = AEHANDLE_NONE;
} }
if(m_nCollisionEntity >= 0) { if(m_nCollisionEntity >= 0) {
DestroyEntity(m_nCollisionEntity); DestroyEntity(m_nCollisionEntity);
m_nCollisionEntity = -5; m_nCollisionEntity = AEHANDLE_NONE;
} }
if(m_nFrontEndEntity >= 0) { if(m_nFrontEndEntity >= 0) {
DestroyEntity(m_nFrontEndEntity); DestroyEntity(m_nFrontEndEntity);
m_nFrontEndEntity = -5; m_nFrontEndEntity = AEHANDLE_NONE;
} }
if(m_nProjectileEntity >= 0) { if(m_nProjectileEntity >= 0) {
DestroyEntity(m_nProjectileEntity); DestroyEntity(m_nProjectileEntity);
m_nProjectileEntity = -5; m_nProjectileEntity = AEHANDLE_NONE;
} }
} }
@ -3981,7 +3983,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
if(velocityChange <= 0.0005f && params->m_pVehicle->GetPosition().y) return 1; if(velocityChange <= 0.0005f && params->m_pVehicle->GetPosition().y) return 1;
velocityChange = min(0.75f, velocityChange); velocityChange = min(0.75f, velocityChange);
multiplier = (velocityChange - 0.0005f) * 4 / 3; multiplier = (velocityChange - 0.0005f) * 1.3342f;
CalculateDistance((bool *)params, params->m_fDistance); CalculateDistance((bool *)params, params->m_fDistance);
vol = (30.f * multiplier); vol = (30.f * multiplier);
m_sQueueSample.m_bVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_bVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance);
@ -8354,7 +8356,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
m_sQueueSample.m_bIsDistant = 0; m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.field_16 = 2; m_sQueueSample.field_16 = 2;
m_sQueueSample.m_nFrequency = m_sQueueSample.m_nFrequency =
(100 * m_sQueueSample.m_nEntityIndex & 0x3FF) + (100 * m_sQueueSample.m_nEntityIndex & 1023) +
SampleManager.GetSampleBaseFrequency( SampleManager.GetSampleBaseFrequency(
AUDIO_SAMPLE_VEHICLE_REVERSE_WARNING); AUDIO_SAMPLE_VEHICLE_REVERSE_WARNING);
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
@ -8779,29 +8781,30 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface
CVector v1; CVector v1;
CVector v2; CVector v2;
if(m_bIsInitialised && m_nCollisionEntity >= 0 && !m_bUserPause && if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_bUserPause ||
(velocity >= 0.0016f || collisionPower >= 0.01f)) { (velocity < 0.0016f && collisionPower < 0.01f))
if((entity1->m_status & 7) == ENTITY_TYPE_BUILDING) { return;
v1 = v2 = entity2->GetPosition();
} else if((entity2->m_status & 7) == ENTITY_TYPE_BUILDING) { if(entity1->IsBuilding()) {
v1 = v2 = entity1->GetPosition(); v1 = v2 = entity2->GetPosition();
} else { } else if(entity2->IsBuilding()) {
v1 = entity1->GetPosition(); v1 = v2 = entity1->GetPosition();
v2 = entity2->GetPosition(); } else {
} v1 = entity1->GetPosition();
CVector pos = (v1 + v2) * 0.5f; v2 = entity2->GetPosition();
dist = GetDistanceSquared(&pos); }
if(dist < 3600.f) { CVector pos = (v1 + v2) * 0.5f;
m_sCollisionManager.m_sQueue.m_pEntity1 = entity1; dist = GetDistanceSquared(&pos);
m_sCollisionManager.m_sQueue.m_pEntity2 = entity2; if(dist < SQR(60.f)) {
m_sCollisionManager.m_sQueue.m_bSurface1 = surface1; m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
m_sCollisionManager.m_sQueue.m_bSurface2 = surface2; m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;
m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower; m_sCollisionManager.m_sQueue.m_bSurface1 = surface1;
m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity; m_sCollisionManager.m_sQueue.m_bSurface2 = surface2;
m_sCollisionManager.m_sQueue.m_vecPosition = pos; m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower;
m_sCollisionManager.m_sQueue.m_fDistance = dist; m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity;
m_sCollisionManager.AddCollisionToRequestedQueue(); m_sCollisionManager.m_sQueue.m_vecPosition = pos;
} m_sCollisionManager.m_sQueue.m_fDistance = dist;
m_sCollisionManager.AddCollisionToRequestedQueue();
} }
} }
@ -9692,7 +9695,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
{ {
if(m_sQueueSample.m_fDistance >= 180.f) return 0; if(m_sQueueSample.m_fDistance >= 180.f) return 0;
uint8 emittingVol = (vol + (vol * m_sQueueSample.m_fDistance / 180)) / 2; uint8 emittingVol = (vol >> 1) + ((vol >> 1) * m_sQueueSample.m_fDistance / 180);
if(m_sQueueSample.m_fDistance / 180 < 0.7f) if(m_sQueueSample.m_fDistance / 180 < 0.7f)
emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100; emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;

View file

@ -1278,50 +1278,38 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
targetNode = FindNodeClosestToCoors(target, type, distLimit); targetNode = FindNodeClosestToCoors(target, type, distLimit);
else else
targetNode = forcedTargetNode; targetNode = forcedTargetNode;
if(targetNode < 0) { if(targetNode < 0)
*pNumNodes = 0; goto fail;
if(pDist) *pDist = 100000.0f;
return;
}
// Find start // Find start
int numPathsToTry; int numPathsToTry;
CTreadable *startObj; CTreadable *startObj;
if(startNodeId < 0) { if(startNodeId < 0){
if(vehicle == nil || (startObj = vehicle->m_treadable[type]) == nil) if(vehicle == nil || (startObj = vehicle->m_treadable[type]) == nil)
startObj = FindRoadObjectClosestToCoors(start, type); startObj = FindRoadObjectClosestToCoors(start, type);
numPathsToTry = 0; numPathsToTry = 0;
for(i = 0; i < 12; i++) { for(i = 0; i < 12; i++){
if(startObj->m_nodeIndices[type][i] < 0) break; if(startObj->m_nodeIndices[type][i] < 0)
if(m_pathNodes[startObj->m_nodeIndices[type][i]].group == break;
m_pathNodes[targetNode].group) if(m_pathNodes[startObj->m_nodeIndices[type][i]].group == m_pathNodes[targetNode].group)
numPathsToTry++; numPathsToTry++;
} }
} else { }else{
numPathsToTry = 1; numPathsToTry = 1;
startObj = m_mapObjects[m_pathNodes[startNodeId].objectIndex]; startObj = m_mapObjects[m_pathNodes[startNodeId].objectIndex];
} }
if(numPathsToTry == 0) { if(numPathsToTry == 0)
*pNumNodes = 0; goto fail;
if(pDist) *pDist = 100000.0f;
return; if(startNodeId < 0){
// why only check node 0?
if(m_pathNodes[startObj->m_nodeIndices[type][0]].group != m_pathNodes[targetNode].group)
goto fail;
}else{
if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group)
goto fail;
} }
if(startNodeId < 0) {
// why only check node 0?
if(m_pathNodes[startObj->m_nodeIndices[type][0]].group !=
m_pathNodes[targetNode].group) {
*pNumNodes = 0;
if(pDist) *pDist = 100000.0f;
return;
}
} else {
if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group) {
*pNumNodes = 0;
if(pDist) *pDist = 100000.0f;
return;
}
}
for(i = 0; i < 512; i++) for(i = 0; i < 512; i++)
m_searchNodes[i].next = nil; m_searchNodes[i].next = nil;
@ -1400,6 +1388,11 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
for(i = 0; i < numNodesToBeCleared; i++) for(i = 0; i < numNodesToBeCleared; i++)
apNodesToBeCleared[i]->distance = MAX_DIST; apNodesToBeCleared[i]->distance = MAX_DIST;
return; return;
fail:
*pNumNodes = 0;
if(pDist)
*pDist = 100000.0f;
} }
static CPathNode *pNodeList[32]; static CPathNode *pNodeList[32];

View file

@ -197,8 +197,6 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
#define BIT(num) (1<<(num)) #define BIT(num) (1<<(num))
//auto max = [](auto a, auto b) { return ((a) > (b)) ? (a) : (b); };
//auto min = [](auto a, auto b) { return ((a) < (b)) ? (a) : (b); };
#define ABS(a) (((a) < 0) ? (-(a)) : (a)) #define ABS(a) (((a) < 0) ? (-(a)) : (a))
#define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min))))) #define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min)))))
@ -337,7 +335,7 @@ inline void SkipSaveBuf(uint8 *&buf, int32 skip)
template<typename T> template<typename T>
inline const T ReadSaveBuf(uint8 *&buf) inline const T ReadSaveBuf(uint8 *&buf)
{ {
T &value = *(T*)buf; T &value = *(T*)buf;
SkipSaveBuf(buf, sizeof(T)); SkipSaveBuf(buf, sizeof(T));
return value; return value;
@ -345,8 +343,8 @@ inline const T ReadSaveBuf(uint8 *&buf)
template<typename T> template<typename T>
inline T *WriteSaveBuf(uint8 *&buf, const T &value) inline T *WriteSaveBuf(uint8 *&buf, const T &value)
{ {
T *p = (T*)buf; T *p = (T*)buf;
*p = value; *p = value;
SkipSaveBuf(buf, sizeof(T)); SkipSaveBuf(buf, sizeof(T));
return p; return p;
@ -355,11 +353,11 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
#define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32)) #define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32))
#define WriteSaveHeader(buf,a,b,c,d,size) \ #define WriteSaveHeader(buf,a,b,c,d,size) \
WriteSaveBuf(buf, a);\ WriteSaveBuf(buf, a);\
WriteSaveBuf(buf, b);\ WriteSaveBuf(buf, b);\
WriteSaveBuf(buf, c);\ WriteSaveBuf(buf, c);\
WriteSaveBuf(buf, d);\ WriteSaveBuf(buf, d);\
WriteSaveBuf(buf, size); WriteSaveBuf(buf, size);
#define CheckSaveHeader(buf,a,b,c,d,size)\ #define CheckSaveHeader(buf,a,b,c,d,size)\

View file

@ -339,7 +339,7 @@ void
RenderEffects(void) RenderEffects(void)
{ {
CGlass::Render(); CGlass::Render();
CWaterCannon::Render(); CWaterCannons::Render();
CSpecialFX::Render(); CSpecialFX::Render();
CShadows::RenderStaticShadows(); CShadows::RenderStaticShadows();
CShadows::RenderStoredShadows(); CShadows::RenderStoredShadows();

View file

@ -5,5 +5,5 @@
CWaterCannon* aCannons = (CWaterCannon*)0x8F2CA8; CWaterCannon* aCannons = (CWaterCannon*)0x8F2CA8;
WRAPPER void CWaterCannons::Update(void) { EAXJMP(0x522510); } WRAPPER void CWaterCannons::Update(void) { EAXJMP(0x522510); }
WRAPPER void CWaterCannon::UpdateOne(uint32 id, CVector *pos, CVector *dir) { EAXJMP(0x522470); } WRAPPER void CWaterCannons::UpdateOne(uint32 id, CVector *pos, CVector *dir) { EAXJMP(0x522470); }
WRAPPER void CWaterCannon::Render(void) { EAXJMP(0x522550); } WRAPPER void CWaterCannons::Render(void) { EAXJMP(0x522550); }

View file

@ -10,12 +10,16 @@ public:
CVector m_avecPos[16]; CVector m_avecPos[16];
CVector m_avecVelocity[16]; CVector m_avecVelocity[16];
char m_abUsed[16]; char m_abUsed[16];
static void Update(void);
static void UpdateOne(uint32 id, CVector *pos, CVector *dir);
static void Render(void);
}; };
static_assert(sizeof(CWaterCannon) == 412, "CWaterCannon: error"); static_assert(sizeof(CWaterCannon) == 412, "CWaterCannon: error");
extern CWaterCannon* aCannons; class CWaterCannons
{
public:
static void Update();
static void UpdateOne(uint32 id, CVector *pos, CVector *dir);
static void Render(void);
};
extern CWaterCannon *aCannons;

View file

@ -2350,7 +2350,7 @@ CAutomobile::FireTruckControl(void)
Sin(m_fCarGunUD)); Sin(m_fCarGunUD));
cannonDir = Multiply3x3(GetMatrix(), cannonDir); cannonDir = Multiply3x3(GetMatrix(), cannonDir);
cannonDir.z += (CGeneral::GetRandomNumber()&0xF)/1000.0f; cannonDir.z += (CGeneral::GetRandomNumber()&0xF)/1000.0f;
CWaterCannon::UpdateOne((uintptr)this, &cannonPos, &cannonDir); CWaterCannons::UpdateOne((uintptr)this, &cannonPos, &cannonDir);
}else if(m_status == STATUS_PHYSICS){ }else if(m_status == STATUS_PHYSICS){
CFire *fire = gFireManager.FindFurthestFire_NeverMindFireMen(GetPosition(), 10.0f, 35.0f); CFire *fire = gFireManager.FindFurthestFire_NeverMindFireMen(GetPosition(), 10.0f, 35.0f);
if(fire == nil) if(fire == nil)
@ -2385,7 +2385,7 @@ CAutomobile::FireTruckControl(void)
Sin(m_fCarGunUD)); Sin(m_fCarGunUD));
cannonDir = Multiply3x3(GetMatrix(), cannonDir); cannonDir = Multiply3x3(GetMatrix(), cannonDir);
cannonDir.z += (CGeneral::GetRandomNumber()&0xF)/1000.0f; cannonDir.z += (CGeneral::GetRandomNumber()&0xF)/1000.0f;
CWaterCannon::UpdateOne((uintptr)this, &cannonPos, &cannonDir); CWaterCannons::UpdateOne((uintptr)this, &cannonPos, &cannonDir);
} }
} }
} }