summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/AudioCollision.cpp8
-rw-r--r--src/audio/AudioManager.cpp473
-rw-r--r--src/audio/AudioManager.h12
-rw-r--r--src/audio/PoliceRadio.cpp19
-rw-r--r--src/control/Cranes.cpp4
-rw-r--r--src/control/Pickups.cpp10
-rw-r--r--src/control/Record.cpp527
-rw-r--r--src/control/Record.h90
-rw-r--r--src/core/Pad.cpp13
-rw-r--r--src/core/Streaming.cpp4
-rw-r--r--src/core/Timer.cpp4
-rw-r--r--src/entities/Entity.cpp4
-rw-r--r--src/entities/Entity.h4
-rw-r--r--src/objects/Object.cpp285
-rw-r--r--src/objects/Object.h37
-rw-r--r--src/peds/Ped.cpp4
-rw-r--r--src/peds/Population.cpp2
-rw-r--r--src/vehicles/Automobile.cpp6
-rw-r--r--src/vehicles/Boat.cpp2
-rw-r--r--src/vehicles/Floater.cpp2
20 files changed, 1203 insertions, 307 deletions
diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp
index 4039bd75..99c87a6a 100644
--- a/src/audio/AudioCollision.cpp
+++ b/src/audio/AudioCollision.cpp
@@ -151,7 +151,7 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = counter;
+ m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -164,7 +164,7 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -270,7 +270,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
break;
}
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
if(counter >= 255) counter = 28;
m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
@@ -282,7 +282,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index b73cf3ca..2453e066 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -216,7 +216,9 @@ cPedComments::Add(tPedComment *com)
}
}
- if(i < index) memmove(&m_nIndexMap[m_nActiveBank][i + 1], &m_nIndexMap[m_nActiveBank][i], NUM_PED_COMMENTS_SLOTS -1 - i);
+ if(i < index)
+ memmove(&m_nIndexMap[m_nActiveBank][i + 1], &m_nIndexMap[m_nActiveBank][i],
+ NUM_PED_COMMENTS_SLOTS - 1 - i);
}
m_nIndexMap[m_nActiveBank][i] = index;
@@ -239,7 +241,7 @@ cPedComments::Process()
AudioManager.m_sQueueSample.m_nEntityIndex =
m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex;
- AudioManager.m_sQueueSample.m_counter = 0;
+ AudioManager.m_sQueueSample.m_nCounter = 0;
AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex;
AudioManager.m_sQueueSample.m_bBankIndex = SAMPLEBANK_PED;
AudioManager.m_sQueueSample.m_nReleasingVolumeModificator = 3;
@@ -260,7 +262,7 @@ cPedComments::Process()
break;
default: AudioManager.m_sQueueSample.m_fSoundIntensity = defaultIntensity; break;
}
- AudioManager.m_sQueueSample.m_bReleasingSoundFlag = 1;
+ AudioManager.m_sQueueSample.m_bReleasingSoundFlag = true;
AudioManager.m_sQueueSample.m_vecPos =
m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos;
@@ -326,7 +328,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl
{
m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = counter;
+ m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_nSampleIndex = sample;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -343,7 +345,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -368,7 +370,7 @@ cAudioManager::AddReflectionsToRequestedQueue()
m_sQueueSample.m_bVolume = ComputeVolume(
emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume > emittingVolume >> 4) {
- m_sQueueSample.m_counter += ((i + 1) << 8);
+ m_sQueueSample.m_nCounter += ((i + 1) << 8);
if(m_sQueueSample.m_nLoopCount) {
noise = RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
if(noise <= 0)
@@ -402,15 +404,15 @@ cAudioManager::AddReleasingSounds()
m_asSamples[m_bActiveSampleQueue]
[m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]]
.m_nEntityIndex &&
- sample.m_counter == m_asSamples[m_bActiveSampleQueue]
+ sample.m_nCounter == m_asSamples[m_bActiveSampleQueue]
[m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]]
- .m_counter) {
+ .m_nCounter) {
toProcess[i] = true;
break;
}
}
if(!toProcess[i]) {
- if(sample.m_counter <= 255 || !sample.m_bLoopsRemaining) {
+ if(sample.m_nCounter <= 255 || !sample.m_bLoopsRemaining) {
if(!sample.m_nReleasingVolumeDivider) continue;
if(!sample.m_nLoopCount) {
if(sample.m_nVolumeChange == -1) {
@@ -453,7 +455,7 @@ cAudioManager::AddSampleToRequestedQueue()
++m_bSampleRequestQueuesStatus[m_bActiveSampleQueue];
}
m_sQueueSample.calculatedVolume = calculatedVolume;
- m_sQueueSample.m_bLoopEnded = 0;
+ m_sQueueSample.m_bLoopEnded = false;
if(m_sQueueSample.m_bIs2D) {
m_sQueueSample.m_bRequireReflection = false;
m_sQueueSample.m_bLoopsRemaining = 0;
@@ -495,7 +497,7 @@ cAudioManager::ClearActiveSamples()
{
for(int32 i = 0; i < m_bActiveSamples; i++) {
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
- m_asActiveSamples[i].m_counter = 0;
+ m_asActiveSamples[i].m_nCounter = 0;
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[i].m_bBankIndex = SAMPLEBANK_INVALID;
m_asActiveSamples[i].m_bIs2D = false;
@@ -504,8 +506,8 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_bVolume = 0;
m_asActiveSamples[i].m_bEmittingVolume = 0;
m_asActiveSamples[i].m_fDistance = 0.0f;
- m_asActiveSamples[i].m_bIsProcessed = 0;
- m_asActiveSamples[i].m_bLoopEnded = 0;
+ m_asActiveSamples[i].m_bIsProcessed = false;
+ m_asActiveSamples[i].m_bLoopEnded = false;
m_asActiveSamples[i].m_nLoopCount = 1;
m_asActiveSamples[i].m_nLoopStart = 0;
m_asActiveSamples[i].m_nLoopEnd = -1;
@@ -532,8 +534,8 @@ cAudioManager::ClearMissionAudio()
m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22 = 0;
m_sMissionAudio.m_bIsPlayed = false;
- m_sMissionAudio.field_12 = 1;
- m_sMissionAudio.field_24 = 0;
+ m_sMissionAudio.m_bPredefinedProperties = 1;
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
}
}
@@ -554,7 +556,7 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
if(!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) {
float dist = position2 - position1;
if(dist != 0.0f) {
- float speedOfSource = (dist / field_19192) * speedMultiplier;
+ float speedOfSource = (dist / m_bTimeSpent) * speedMultiplier;
if(m_fSpeedOfSound > Abs(speedOfSource)) {
if(speedOfSource < 0.0f) {
speedOfSource = max(speedOfSource, -1.5f);
@@ -654,7 +656,7 @@ cAudioManager::DestroyEntity(int32 id)
if(id == m_anAudioEntityIndices[i]) {
if(i < totalAudioEntitiesSlots - 1)
memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1],
- 4 * (m_nAudioEntitiesTotal - (i + 1)));
+ NUM_AUDIOENTITY_EVENTS * (m_nAudioEntitiesTotal - (i + 1)));
m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = totalAudioEntitiesSlots;
return;
}
@@ -720,7 +722,7 @@ cAudioManager::GetSwatTalkSfx(int16 sound)
GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6);
}
- return (SFX_SWAT_VOICE_2_CHASE_1 - SFX_SWAT_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx;
+ return (SFX_SWAT_VOICE_2_CHASE_1 - SFX_SWAT_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 4) + sfx;
}
uint32
@@ -2164,7 +2166,13 @@ cAudioManager::GetSecurityGuardTalkSfx(int16 sound)
case SOUND_PED_CAR_JACKED:
case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 6); break;
case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_FIGHT_1, 2); break;
- case SOUND_PED_FLEE_RUN: GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 12); break;
+ case SOUND_PED_FLEE_RUN:
+#ifdef FIX_BUGS
+ sfx = SFX_SECURITY_GUARD_VOICE_1_RUN_FROM_FIGHT_1;
+#else
+ GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 12);
+#endif
+ break;
default: return GetGenericMaleTalkSfx(sound);
}
return sfx;
@@ -2560,11 +2568,15 @@ cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
break;
++i;
}
- if(i < 3) {
+ if(i < NUM_AUDIOENTITY_EVENTS - 1) {
memmove(&entity.m_awAudioEvent[i + 1],
- &entity.m_awAudioEvent[i], (3 - i) * 2);
- memmove(&entity.m_afVolume[i + 1], &entity.m_afVolume[i],
- (3 - i) * 4);
+ &entity.m_awAudioEvent[i],
+ (NUM_AUDIOENTITY_EVENTS - 1 - i) *
+ NUM_AUDIOENTITY_EVENTS / 2);
+ memmove(&entity.m_afVolume[i + 1],
+ &entity.m_afVolume[i],
+ (NUM_AUDIOENTITY_EVENTS - 1 - i) *
+ NUM_AUDIOENTITY_EVENTS);
}
entity.m_awAudioEvent[i] = sound;
entity.m_afVolume[i] = vol;
@@ -2617,8 +2629,8 @@ cAudioManager::PostInitialiseGameSpecificSetup()
m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22 = 0;
m_sMissionAudio.m_bIsPlayed = false;
- m_sMissionAudio.field_12 = 1;
- m_sMissionAudio.field_24 = 0;
+ m_sMissionAudio.m_bPredefinedProperties = 1;
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds());
}
@@ -2713,11 +2725,11 @@ cAudioManager::PreloadMissionAudio(const char *name)
m_sMissionAudio.m_bLoadingStatus = LOADING_STATUS_NOT_LOADED;
m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22 = 0;
- m_sMissionAudio.field_24 =
- field_19192 * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000;
- m_sMissionAudio.field_24 *= 4;
+ m_sMissionAudio.m_nMissionAudioCounter =
+ m_bTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000;
+ m_sMissionAudio.m_nMissionAudioCounter *= 4;
m_sMissionAudio.m_bIsPlayed = false;
- m_sMissionAudio.field_12 = 1;
+ m_sMissionAudio.m_bPredefinedProperties = 1;
g_bMissionAudioLoadFailed = 0;
}
}
@@ -2775,8 +2787,8 @@ cAudioManager::ProcessActiveQueues()
CVector position;
for (int32 i = 0; i < m_bActiveSamples; i++) {
- m_asSamples[m_bActiveSampleQueue][i].m_bIsProcessed = 0;
- m_asActiveSamples[i].m_bIsProcessed = 0;
+ m_asSamples[m_bActiveSampleQueue][i].m_bIsProcessed = false;
+ m_asActiveSamples[i].m_bIsProcessed = false;
}
for (int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) {
@@ -2784,7 +2796,7 @@ cAudioManager::ProcessActiveQueues()
if (sample.m_nSampleIndex != NO_SAMPLE) {
for (int32 j = 0; j < m_bActiveSamples; ++j) {
if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex &&
- sample.m_counter == m_asActiveSamples[j].m_counter &&
+ sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
if (sample.m_nLoopCount) {
if (m_FrameCounter & 1) {
@@ -2794,15 +2806,15 @@ cAudioManager::ProcessActiveQueues()
flag = !(j & 1);
}
if (flag && !SampleManager.GetChannelUsedFlag(j)) {
- sample.m_bLoopEnded = 1;
- m_asActiveSamples[j].m_bLoopEnded = 1;
+ sample.m_bLoopEnded = true;
+ m_asActiveSamples[j].m_bLoopEnded = true;
m_asActiveSamples[j].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[j].m_nEntityIndex = AEHANDLE_NONE;
continue;
}
}
- sample.m_bIsProcessed = 1;
- m_asActiveSamples[j].m_bIsProcessed = 1;
+ sample.m_bIsProcessed = true;
+ m_asActiveSamples[j].m_bIsProcessed = true;
sample.m_nVolumeChange = -1;
if (!sample.m_bReleasingSoundFlag) {
if (sample.m_bIs2D) {
@@ -2872,8 +2884,8 @@ cAudioManager::ProcessActiveQueues()
SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag);
continue;
}
- sample.m_bIsProcessed = 0;
- m_asActiveSamples[j].m_bIsProcessed = 0;
+ sample.m_bIsProcessed = false;
+ m_asActiveSamples[j].m_bIsProcessed = false;
break;
}
}
@@ -2890,7 +2902,7 @@ cAudioManager::ProcessActiveQueues()
tSound& sample = m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]];
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded &&
m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
- if (sample.m_counter > 255 && sample.m_nLoopCount && sample.m_bLoopsRemaining) {
+ if (sample.m_nCounter > 255 && sample.m_nLoopCount && sample.m_bLoopsRemaining) {
--sample.m_bLoopsRemaining;
sample.m_nReleasingVolumeDivider = 1;
}
@@ -2898,7 +2910,7 @@ cAudioManager::ProcessActiveQueues()
for (int32 j = 0; j < m_bActiveSamples; ++j) {
if (!m_asActiveSamples[j].m_bIsProcessed) {
if (sample.m_nLoopCount) {
- v28 = sample.m_nFrequency / field_19192;
+ v28 = sample.m_nFrequency / m_bTimeSpent;
v29 = sample.m_nLoopCount *
SampleManager.GetSampleLength(sample.m_nSampleIndex);
if (v28 == 0) continue;
@@ -2954,8 +2966,8 @@ cAudioManager::ProcessActiveQueues()
0.25f * m_asActiveSamples[j].m_fSoundIntensity);
SampleManager.StartChannel(j);
}
- m_asActiveSamples[j].m_bIsProcessed = 1;
- sample.m_bIsProcessed = 1;
+ m_asActiveSamples[j].m_bIsProcessed = true;
+ sample.m_bIsProcessed = true;
sample.m_nVolumeChange = -1;
break;
}
@@ -2983,7 +2995,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params)
rand = m_anRandomTable[0] % 10 + 70;
m_sQueueSample.m_bVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 13;
+ m_sQueueSample.m_nCounter = 13;
m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
@@ -2996,7 +3008,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -3031,10 +3043,10 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 110;
@@ -3070,7 +3082,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 39;
+ m_sQueueSample.m_nCounter = 39;
m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE;
m_sQueueSample.m_nFrequency = 10386;
m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex << 16) % 1000;
@@ -3085,7 +3097,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3115,7 +3127,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
}
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
if(!m_sQueueSample.m_bVolume) return 1;
- m_sQueueSample.m_counter = 40;
+ m_sQueueSample.m_nCounter = 40;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex << 16) % 1000;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
@@ -3128,7 +3140,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3141,7 +3153,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
if(padAccelerate <= 20) {
emittingVol = 45 - 45 * padAccelerate / 40;
m_sQueueSample.m_nFrequency = 100 * padAccelerate + 11025;
- m_sQueueSample.m_counter = 39;
+ m_sQueueSample.m_nCounter = 39;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE;
if(LastAccel > 20) {
oneShotVol = LastVol;
@@ -3152,7 +3164,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_nFrequency = 4000 * padAccelerate / 255 + 8000;
if(!boat->m_bIsAnchored)
m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
- m_sQueueSample.m_counter = 40;
+ m_sQueueSample.m_nCounter = 40;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
}
LastVol = emittingVol;
@@ -3162,14 +3174,14 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
if(gasPedal > 0.0f) {
m_sQueueSample.m_nFrequency = 11025;
emittingVol = 45;
- m_sQueueSample.m_counter = 39;
+ m_sQueueSample.m_nCounter = 39;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE;
} else {
emittingVol = (105.f * gasPedal) + 15;
m_sQueueSample.m_nFrequency = (4000.f * gasPedal) + 8000;
if(!boat->m_bIsAnchored)
m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
- m_sQueueSample.m_counter = 40;
+ m_sQueueSample.m_nCounter = 40;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
}
}
@@ -3187,7 +3199,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3216,7 +3228,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
vol = (30.f * multiplier);
m_sQueueSample.m_bVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 38;
+ m_sQueueSample.m_nCounter = 38;
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3228,7 +3240,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3271,7 +3283,7 @@ cAudioManager::ProcessBridgeMotor()
if(m_sQueueSample.m_fDistance < bridgeIntensity) {
m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 1;
+ m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3284,7 +3296,7 @@ cAudioManager::ProcessBridgeMotor()
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = bridgeIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = false;
AddSampleToRequestedQueue();
@@ -3316,7 +3328,7 @@ cAudioManager::ProcessBridgeOneShots()
if(m_sQueueSample.m_fDistance < bridgeIntensity) {
m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
@@ -3328,7 +3340,7 @@ cAudioManager::ProcessBridgeOneShots()
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = bridgeIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -3342,7 +3354,7 @@ cAudioManager::ProcessBridgeWarning()
if(CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) {
m_sQueueSample.m_bVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3355,7 +3367,7 @@ cAudioManager::ProcessBridgeWarning()
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = 450.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bRequireReflection = false;
@@ -3375,7 +3387,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 35;
+ m_sQueueSample.m_nCounter = 35;
m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3388,7 +3400,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params)
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_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3422,7 +3434,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 52;
+ m_sQueueSample.m_nCounter = 52;
m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3436,7 +3448,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 8.0f;
m_sQueueSample.m_fSoundIntensity = 200.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -3444,7 +3456,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
if(params->m_fDistance < 8100.f) {
m_sQueueSample.m_bVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3459,7 +3471,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 8.0f;
m_sQueueSample.m_fSoundIntensity = 90.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -3498,10 +3510,10 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound)
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 4);
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = rand;
@@ -3533,7 +3545,7 @@ cAudioManager::ProcessCrane()
CalculateDistance(distCalculated, distSquared);
m_sQueueSample.m_bVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3547,19 +3559,19 @@ cAudioManager::ProcessCrane()
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
if(m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents) {
- m_sQueueSample.m_counter = 1;
+ m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_2;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_COL_CAR_2);
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = true;
AddSampleToRequestedQueue();
@@ -3601,10 +3613,10 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 3);
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = rand;
@@ -3645,7 +3657,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 28;
+ m_sQueueSample.m_nCounter = 28;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
@@ -3655,7 +3667,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = engineDamageIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3798,11 +3810,11 @@ cAudioManager::ProcessExplosions(int32 explosion)
m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity,
m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i;
+ m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bEmittingVolume = maxVolume;
m_sQueueSample.m_nLoopStart = 0;
@@ -3829,7 +3841,7 @@ cAudioManager::ProcessFireHydrant()
CalculateDistance(distCalculated, distSquared);
m_sQueueSample.m_bVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3842,7 +3854,7 @@ cAudioManager::ProcessFireHydrant()
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3904,13 +3916,13 @@ void cAudioManager::ProcessFires(int32)
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i;
+ m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_nReleasingVolumeDivider = 10;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@@ -4059,9 +4071,9 @@ cAudioManager::ProcessFrontEnd()
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
}
m_sQueueSample.m_bVolume = 110;
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_bIs2D = true;
@@ -4077,7 +4089,7 @@ cAudioManager::ProcessFrontEnd()
AddSampleToRequestedQueue();
if(stereo) {
++m_sQueueSample.m_nSampleIndex;
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_bOffset = maxVolume - m_sQueueSample.m_bOffset;
AddSampleToRequestedQueue();
}
@@ -4096,48 +4108,53 @@ cAudioManager::ProcessGarages()
static uint8 iSound = 32;
-#define LOOP_HELPER \
- for(j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) { \
- switch(m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) { \
- case SOUND_GARAGE_DOOR_CLOSED: \
- case SOUND_GARAGE_DOOR_OPENED: \
- if(distSquared < 6400.f) { \
- CalculateDistance(distCalculated, distSquared); \
- m_sQueueSample.m_bVolume = ComputeVolume(60, 80.f, m_sQueueSample.m_fDistance); \
- if(m_sQueueSample.m_bVolume) { \
- if(CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { \
- m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \
- m_sQueueSample.m_nFrequency = 6735; \
- } else if(m_asAudioEntities[m_sQueueSample.m_nEntityIndex] \
- .m_awAudioEvent[j] == 69) { \
- m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \
- m_sQueueSample.m_nFrequency = 22000; \
- } else { \
- m_sQueueSample.m_nSampleIndex = SFX_COL_GARAGE_DOOR_1; \
- m_sQueueSample.m_nFrequency = 18000; \
- } \
- m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; \
- m_sQueueSample.m_nReleasingVolumeModificator = 4; \
- m_sQueueSample.m_bEmittingVolume = 60; \
- m_sQueueSample.m_fSpeedMultiplier = 0.0f; \
- m_sQueueSample.m_fSoundIntensity = 80.0f; \
- /*m_sQueueSample.m_nReleasingVolumeModificator = 4;*/ \
- m_sQueueSample.m_bReverbFlag = true; \
- /*m_sQueueSample.m_bReverbFlag = true;*/ \
- m_sQueueSample.m_bIs2D = false; \
- m_sQueueSample.m_bReleasingSoundFlag = 1; \
- m_sQueueSample.m_nLoopCount = 1; \
- m_sQueueSample.m_nLoopStart = 0; \
- m_sQueueSample.m_nLoopEnd = -1; \
- m_sQueueSample.m_counter = iSound++; \
- if(iSound < 32) iSound = 32; \
- m_sQueueSample.m_bRequireReflection = true; \
- AddSampleToRequestedQueue(); \
- } \
- } \
- break; \
- default: continue; \
- } \
+#define LOOP_HELPER \
+ for(j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) { \
+ switch(m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) { \
+ case SOUND_GARAGE_DOOR_CLOSED: \
+ case SOUND_GARAGE_DOOR_OPENED: \
+ if(distSquared < 6400.f) { \
+ CalculateDistance(distCalculated, distSquared); \
+ m_sQueueSample.m_bVolume = \
+ ComputeVolume(60, 80.f, m_sQueueSample.m_fDistance); \
+ if(m_sQueueSample.m_bVolume) { \
+ if(CGarages::aGarages[i].m_eGarageType == \
+ GARAGE_CRUSHER) { \
+ m_sQueueSample.m_nSampleIndex = \
+ SFX_COL_CAR_PANEL_2; \
+ m_sQueueSample.m_nFrequency = 6735; \
+ } else if(m_asAudioEntities[m_sQueueSample.m_nEntityIndex] \
+ .m_awAudioEvent[j] == 69) { \
+ m_sQueueSample.m_nSampleIndex = \
+ SFX_COL_CAR_PANEL_2; \
+ m_sQueueSample.m_nFrequency = 22000; \
+ } else { \
+ m_sQueueSample.m_nSampleIndex = \
+ SFX_COL_GARAGE_DOOR_1; \
+ m_sQueueSample.m_nFrequency = 18000; \
+ } \
+ m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; \
+ m_sQueueSample.m_nReleasingVolumeModificator = 4; \
+ m_sQueueSample.m_bEmittingVolume = 60; \
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f; \
+ m_sQueueSample.m_fSoundIntensity = 80.0f; \
+ /*m_sQueueSample.m_nReleasingVolumeModificator = 4;*/ \
+ m_sQueueSample.m_bReverbFlag = true; \
+ /*m_sQueueSample.m_bReverbFlag = true;*/ \
+ m_sQueueSample.m_bIs2D = false; \
+ m_sQueueSample.m_bReleasingSoundFlag = true; \
+ m_sQueueSample.m_nLoopCount = 1; \
+ m_sQueueSample.m_nLoopStart = 0; \
+ m_sQueueSample.m_nLoopEnd = -1; \
+ m_sQueueSample.m_nCounter = iSound++; \
+ if(iSound < 32) iSound = 32; \
+ m_sQueueSample.m_bRequireReflection = true; \
+ AddSampleToRequestedQueue(); \
+ } \
+ } \
+ break; \
+ default: continue; \
+ } \
}
for(uint32 i = 0; i < CGarages::NumGarages; ++i) {
@@ -4173,8 +4190,8 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_nFrequency +=
RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nCounter = iSound++;
if(iSound < 32) iSound = 32;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -4200,10 +4217,10 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_nSampleIndex = SFX_GARAGE_DOOR_LOOP;
m_sQueueSample.m_nFrequency = 13961;
}
- m_sQueueSample.m_counter = i;
+ m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
@@ -4259,7 +4276,7 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i + 65;
+ m_sQueueSample.m_nCounter = i + 65;
m_sQueueSample.m_nSampleIndex = i + SFX_HELI_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -4273,7 +4290,7 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
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_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -4315,10 +4332,10 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound)
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bEmittingVolume = rand;
@@ -4461,10 +4478,10 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_LOOP);
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 45;
@@ -4481,10 +4498,10 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_SONG_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_SONG_LOOP);
- m_sQueueSample.m_counter = 1;
+ m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 110;
@@ -5072,10 +5089,10 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart =
@@ -5140,12 +5157,12 @@ cAudioManager::ProcessMissionAudio()
--nCheckPlayingDelay;
} else if(GetMissionScriptPoliceAudioPlayingStatus() ==
PLAY_STATUS_FINISHED ||
- m_sMissionAudio.field_24-- == 0) {
+ m_sMissionAudio.m_nMissionAudioCounter-- == 0) {
m_sMissionAudio.m_bPlayStatus =
PLAY_STATUS_FINISHED;
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
SampleManager.StopStreamedFile(1);
- m_sMissionAudio.field_24 = 0;
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
}
}
} else if(m_sMissionAudio.field_22) {
@@ -5159,7 +5176,7 @@ cAudioManager::ProcessMissionAudio()
m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_FINISHED;
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
SampleManager.StopStreamedFile(1);
- m_sMissionAudio.field_24 = 0;
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
}
} else {
if(m_bUserPause) return;
@@ -5175,7 +5192,7 @@ cAudioManager::ProcessMissionAudio()
SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex);
} else {
if(m_bUserPause) SampleManager.PauseStream(1, 1);
- if(m_sMissionAudio.field_12) {
+ if(m_sMissionAudio.m_bPredefinedProperties) {
SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1);
} else {
distSquared =
@@ -5243,7 +5260,7 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = SFX_REMOTE_CONTROLLED_CAR;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -5259,7 +5276,7 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -5463,9 +5480,9 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity,
m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
@@ -5506,9 +5523,9 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
@@ -5564,7 +5581,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params)
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 64;
+ m_sQueueSample.m_nCounter = 64;
m_sQueueSample.m_nSampleIndex = SFX_HEADPHONES;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -5579,7 +5596,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = 7.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -6795,10 +6812,10 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound)
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bEmittingVolume = emittingVol;
@@ -6876,10 +6893,10 @@ cAudioManager::ProcessPornCinema(uint8 sound)
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = maxVolume;
@@ -6903,10 +6920,10 @@ cAudioManager::ProcessPornCinema(uint8 sound)
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
- m_sQueueSample.m_counter = rand + 1;
+ m_sQueueSample.m_nCounter = rand + 1;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 6;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_nLoopStart = 0;
@@ -6957,7 +6974,7 @@ cAudioManager::ProcessProjectiles()
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i;
+ m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
@@ -6965,7 +6982,7 @@ cAudioManager::ProcessProjectiles()
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -6992,7 +7009,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params)
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = veh->m_bRainSamplesCounter++;
+ m_sQueueSample.m_nCounter = veh->m_bRainSamplesCounter++;
veh = params->m_pVehicle;
if(veh->m_bRainSamplesCounter > 4) veh->m_bRainSamplesCounter = 68;
m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_CAR_RAIN_1;
@@ -7006,7 +7023,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = rainOnVehicleIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -7019,8 +7036,16 @@ void
cAudioManager::ProcessReverb() const
{
if(SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
- for(uint32 i = 0; i < channels; i++) { // bug?
- if(m_asActiveSamples[i].m_bReverbFlag) SampleManager.SetChannelReverbFlag(i, 1);
+ for(uint32 i = 0; i <
+#ifdef FIX_BUGS
+ channels
+#else
+ 28
+#endif
+ ;
+ i++) {
+ if(m_asActiveSamples[i].m_bReverbFlag)
+ SampleManager.SetChannelReverbFlag(i, 1);
}
}
}
@@ -7050,10 +7075,10 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
if(params->m_pVehicle->m_fGasPedal >= 0.0f) {
- m_sQueueSample.m_counter = 62;
+ m_sQueueSample.m_nCounter = 62;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2;
} else {
- m_sQueueSample.m_counter = 61;
+ m_sQueueSample.m_nCounter = 61;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR;
}
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
@@ -7067,7 +7092,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = reverseGearIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7099,10 +7124,10 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SAWMILL_LOOP);
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 30;
@@ -7122,10 +7147,10 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_counter = 1;
+ m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_nLoopStart = 0;
@@ -7175,10 +7200,10 @@ cAudioManager::ProcessShopScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_SHOP_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOP_LOOP);
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 30;
@@ -7199,10 +7224,10 @@ cAudioManager::ProcessShopScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_counter = rand + 1;
+ m_sQueueSample.m_nCounter = rand + 1;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 70;
@@ -7257,7 +7282,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
if(train->m_fWagonPosition == 0.0f) {
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 300.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 32;
+ m_sQueueSample.m_nCounter = 32;
m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -7272,7 +7297,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = 300.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7282,7 +7307,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
if(params->m_fDistance < 4900.f) {
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 70.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 33;
+ m_sQueueSample.m_nCounter = 33;
m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -7296,7 +7321,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 70.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7419,7 +7444,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVol, 40.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i + 6;
+ m_sQueueSample.m_nCounter = i + 6;
m_sQueueSample.m_nSampleIndex =
m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(
@@ -7434,7 +7459,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 1.0f;
m_sQueueSample.m_fSoundIntensity = 40.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = true;
AddSampleToRequestedQueue();
@@ -7580,7 +7605,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
m_sQueueSample.m_nSampleIndex =
CarSounds[params->m_nIndex].m_bEngineSoundType + SFX_CAR_REV_10;
freq = 10000.f * modificator + 22050;
- m_sQueueSample.m_counter = 52;
+ m_sQueueSample.m_nCounter = 52;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIs2D = 0;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
@@ -7597,7 +7622,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
@@ -7612,7 +7637,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
CarSounds[params->m_nIndex].m_bEngineSoundType +
SFX_CAR_REV_10; // to recheck idle sounds start 1 postion later
freq = 10000.f * modificator + 22050;
- m_sQueueSample.m_counter = 52;
+ m_sQueueSample.m_nCounter = 52;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIs2D = 0;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
@@ -7629,7 +7654,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
@@ -7639,7 +7664,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
accelerationSample = CarSounds[params->m_nIndex].m_nAccelerationSampleIndex;
}
m_sQueueSample.m_nSampleIndex = accelerationSample;
- m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIs2D = 0;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
@@ -7655,7 +7680,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7687,7 +7712,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(80, 40.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 4;
+ m_sQueueSample.m_nCounter = 4;
m_sQueueSample.m_nSampleIndex = CarSounds[params->m_nIndex].m_nHornSample;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -7701,7 +7726,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 5.0f;
m_sQueueSample.m_fSoundIntensity = 40.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7730,7 +7755,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(60, 50.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 12;
+ m_sQueueSample.m_nCounter = 12;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -7745,7 +7770,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7774,7 +7799,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
30.f * min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity));
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 95.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
@@ -7797,7 +7822,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 95.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7819,7 +7844,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(80, 110.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 5;
+ m_sQueueSample.m_nCounter = 5;
if(UsesSiren(params->m_nIndex)) {
if(params->m_pVehicle->m_status == STATUS_ABANDONED) return;
if(veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) {
@@ -7829,7 +7854,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
else
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_SIREN_FAST);
- m_sQueueSample.m_counter = 60;
+ m_sQueueSample.m_nCounter = 60;
} else {
m_sQueueSample.m_nSampleIndex =
CarSounds[params->m_nIndex].m_nSirenOrAlarmSample;
@@ -7850,7 +7875,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 7.0f;
m_sQueueSample.m_fSoundIntensity = 110.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7913,7 +7938,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
emittingVol = 50.f * skidVal;
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 40.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 3;
+ m_sQueueSample.m_nCounter = 3;
switch(params->m_pVehicle->m_nSurfaceTouched) {
case SURFACE_GRASS:
case SURFACE_HEDGE:
@@ -7946,7 +7971,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = 40.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7971,12 +7996,12 @@ void cAudioManager::ProcessWaterCannon(int32)
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency = 15591;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_counter = i;
+ m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bEmittingVolume = 50;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@@ -8012,12 +8037,12 @@ cAudioManager::ProcessWeather(int32 id)
m_sQueueSample.m_bVolume = vol;
if(TheCamera.SoundDistUp < 20.f) m_sQueueSample.m_bVolume >>= 1;
if(counter == 4) counter = 0;
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_bOffset = (m_anRandomTable[2] & 15) + 55;
m_sQueueSample.m_bIs2D = true;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
@@ -8030,13 +8055,13 @@ cAudioManager::ProcessWeather(int32 id)
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_RAIN);
m_sQueueSample.m_bVolume = (int32)(25.f * CWeather::Rain);
- m_sQueueSample.m_counter = 4;
+ m_sQueueSample.m_nCounter = 4;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_bOffset = 63;
m_sQueueSample.m_bIs2D = true;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 30;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
@@ -8067,7 +8092,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 1;
+ m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -8083,7 +8108,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -8116,10 +8141,10 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_WORKSHOP_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_WORKSHOP_1);
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 30;
@@ -8325,7 +8350,7 @@ void
cAudioManager::SetMissionAudioLocation(float x, float y, float z)
{
if(m_bIsInitialised) {
- m_sMissionAudio.field_12 = 0;
+ m_sMissionAudio.m_bPredefinedProperties = 0;
m_sMissionAudio.m_vecPos = {x, y, z};
}
}
@@ -8356,7 +8381,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq)
uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100;
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 3;
+ m_sQueueSample.m_nCounter = 3;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -8368,7 +8393,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = 180.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -8386,7 +8411,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol)
m_sQueueSample.m_bVolume = vol;
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY;
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
@@ -8395,7 +8420,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol)
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY);
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSoundIntensity = 440.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
@@ -8413,7 +8438,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 240.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 5;
+ m_sQueueSample.m_nCounter = 5;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = true;
@@ -8425,13 +8450,13 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = 240.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 12;
m_sQueueSample.m_bOffset = 0;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
- m_sQueueSample.m_counter = 6;
+ m_sQueueSample.m_nCounter = 6;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
m_sQueueSample.m_nFrequency += 200;
m_sQueueSample.m_bOffset = maxVolume;
@@ -8451,7 +8476,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 1;
+ m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -8463,7 +8488,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = 180.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -8480,7 +8505,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 170.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -8492,7 +8517,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = 170.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 910ffcaf..c5350e10 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -138,7 +138,7 @@ class tSound
{
public:
int32 m_nEntityIndex;
- int32 m_counter;
+ int32 m_nCounter;
int32 m_nSampleIndex;
uint8 m_bBankIndex;
bool m_bIs2D;
@@ -170,8 +170,8 @@ public:
bool m_bRequireReflection; // Used for oneshots
uint8 m_bOffset;
int32 m_nReleasingVolumeDivider;
- uint8 m_bIsProcessed;
- uint8 m_bLoopEnded;
+ bool m_bIsProcessed;
+ bool m_bLoopEnded;
uint8 field_82;
uint8 field_83;
int32 calculatedVolume;
@@ -244,14 +244,14 @@ class cMissionAudio
{
public:
CVector m_vecPos;
- uint8 field_12;
+ bool m_bPredefinedProperties;
uint8 gap_13[3];
int m_nSampleIndex;
uint8 m_bLoadingStatus;
uint8 m_bPlayStatus;
uint8 field_22;
uint8 field_23;
- int field_24;
+ int32 m_nMissionAudioCounter;
bool m_bIsPlayed;
uint8 field_29;
uint8 field_30;
@@ -328,7 +328,7 @@ public:
int32 m_nBridgeEntity;
cMissionAudio m_sMissionAudio;
int32 m_anRandomTable[5];
- uint8 field_19192; // time?
+ uint8 m_bTimeSpent;
uint8 m_bUserPause;
uint8 m_bPreviousUserPause;
uint8 field_19195; // unused
diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp
index 3ba16ef3..255d7026 100644
--- a/src/audio/PoliceRadio.cpp
+++ b/src/audio/PoliceRadio.cpp
@@ -125,7 +125,7 @@ void
cAudioManager::DoPoliceRadioCrackle()
{
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = true;
@@ -136,7 +136,7 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE);
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bOffset = 63;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
@@ -147,17 +147,20 @@ cAudioManager::DoPoliceRadioCrackle()
void
cAudioManager::ServicePoliceRadio()
{
- int32 wantedLevel = 0; // bug?;
+ int32 wantedLevel = 0; // uninitialized variable
static uint32 nLastSeen = 300;
- if (!m_bIsInitialised) return;
+ if(!m_bIsInitialised) return;
- if (!m_bUserPause) {
+ if(!m_bUserPause) {
bool crimeReport = SetupCrimeReport();
+#ifdef FIX_BUGS // Crash at 0x5fe6ef
+ if(!FindPlayerPed() || !FindPlayerPed()->m_pWanted) return;
+#endif
wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel;
- if (!crimeReport) {
- if (wantedLevel) {
- if (nLastSeen) {
+ if(!crimeReport) {
+ if(wantedLevel) {
+ if(nLastSeen) {
--nLastSeen;
} else {
nLastSeen = m_anRandomTable[1] % 1000 + 2000;
diff --git a/src/control/Cranes.cpp b/src/control/Cranes.cpp
index 021a5c19..33385dae 100644
--- a/src/control/Cranes.cpp
+++ b/src/control/Cranes.cpp
@@ -410,6 +410,8 @@ void CCrane::FindCarInSectorList(CPtrList* pList)
if (pVehicle->GetPosition().x < m_fPickupX1 || pVehicle->GetPosition().x > m_fPickupX2 ||
pVehicle->GetPosition().y < m_fPickupY1 || pVehicle->GetPosition().y > m_fPickupY2)
continue;
+ if (pVehicle->pDriver)
+ continue;
if (Abs(pVehicle->GetMoveSpeed().x) >= CAR_MOVING_SPEED_THRESHOLD ||
Abs(pVehicle->GetMoveSpeed().y) >= CAR_MOVING_SPEED_THRESHOLD ||
Abs(pVehicle->GetMoveSpeed().z) >= CAR_MOVING_SPEED_THRESHOLD)
@@ -674,4 +676,4 @@ void CranesLoad(uint8* buf, uint32 size)
STARTPATCHES
InjectHook(0x5454D0, CranesLoad, PATCH_JUMP); // GenericLoad
-ENDPATCHES \ No newline at end of file
+ENDPATCHES
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 774abd8c..16123c63 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -111,7 +111,7 @@ CPickup::GiveUsAPickUpObject(int32 handle)
object->bUsesCollision = false;
object->bIsPickup = true;
- object->field_172 = m_eModelIndex == MI_PICKUP_BONUS ? m_nQuantity : 0;
+ object->m_nBonusValue = m_eModelIndex == MI_PICKUP_BONUS ? m_nQuantity : 0;
switch (m_eType)
{
@@ -671,9 +671,9 @@ void
CPickups::DoPickUpEffects(CEntity *entity)
{
if (entity->GetModelIndex() == MI_PICKUP_KILLFRENZY)
- entity->m_flagD80 = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
+ entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
- if (!entity->m_flagD80) {
+ if (!entity->bDoNotRender) {
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800));
float modifiedSin = 0.3f * (s + 1.0f);
@@ -716,7 +716,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
size, 65.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
CObject *object = (CObject*)entity;
- if (object->m_obj_flag2 || object->bOutOfStock || object->field_172) {
+ if (object->m_obj_flag2 || object->bOutOfStock || object->m_nBonusValue) {
float dist = (TheCamera.GetPosition() - pos).Magnitude();
const float MAXDIST = 12.0f;
@@ -734,7 +734,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
aMessages[NumMessages].m_color.blue = aWeaponBlues[colorId];
aMessages[NumMessages].m_color.alpha = (1.0f - dist / MAXDIST) * 128.0f;
aMessages[NumMessages].m_bOutOfStock = object->bOutOfStock;
- aMessages[NumMessages].m_quantity = object->field_172;
+ aMessages[NumMessages].m_quantity = object->m_nBonusValue;
NumMessages++;
}
}
diff --git a/src/control/Record.cpp b/src/control/Record.cpp
index 7c330311..aead1720 100644
--- a/src/control/Record.cpp
+++ b/src/control/Record.cpp
@@ -2,18 +2,523 @@
#include "patcher.h"
#include "Record.h"
+#include "FileMgr.h"
+#include "Pad.h"
+#include "Pools.h"
+#include "Streaming.h"
+#include "Timer.h"
+#include "VehicleModelInfo.h"
+#include "World.h"
+
uint16 &CRecordDataForGame::RecordingState = *(uint16*)0x95CC24;
+uint8*& CRecordDataForGame::pDataBuffer = *(uint8**)0x8F1B70;
+uint8*& CRecordDataForGame::pDataBufferPointer = *(uint8**)0x8F1AB0;
+int& CRecordDataForGame::FId = *(int*)0x885BA4;
+tGameBuffer& CRecordDataForGame::pDataBufferForFrame = *(tGameBuffer*)0x72CED0;
+
+#define MEMORY_FOR_GAME_RECORD (150000)
+
+void CRecordDataForGame::Init(void)
+{
+ RecordingState = STATE_NONE;
+ if (pDataBuffer)
+ delete[] pDataBuffer;
+ pDataBufferPointer = nil;
+ pDataBuffer = nil;
+#ifndef GTA_PS2 // this stuff is not present on PS2
+ FId = CFileMgr::OpenFile("playback.dat", "r");
+ if (FId <= 0) {
+ if ((FId = CFileMgr::OpenFile("record.dat", "r")) <= 0)
+ RecordingState = STATE_NONE;
+ else {
+ CFileMgr::CloseFile(FId);
+ FId = CFileMgr::OpenFileForWriting("record.dat");
+ RecordingState = STATE_RECORD;
+ }
+ }
+ else {
+ RecordingState = STATE_PLAYBACK;
+ }
+ if (RecordingState == STATE_PLAYBACK) {
+ pDataBufferPointer = new uint8[MEMORY_FOR_GAME_RECORD];
+ pDataBuffer = pDataBufferPointer;
+ pDataBuffer[CFileMgr::Read(FId, (char*)pDataBufferPointer, MEMORY_FOR_GAME_RECORD) + 8] = -1;
+ CFileMgr::CloseFile(FId);
+ }
+#else
+ RecordingState = STATE_NONE; // second time to make sure
+#endif
+}
+
+void CRecordDataForGame::SaveOrRetrieveDataForThisFrame(void)
+{
+ switch (RecordingState) {
+ case STATE_RECORD:
+ {
+ pDataBufferForFrame.m_fTimeStep = CTimer::GetTimeStep();
+ pDataBufferForFrame.m_nTimeInMilliseconds = CTimer::GetTimeInMilliseconds();
+ pDataBufferForFrame.m_nSizeOfPads[0] = 0;
+ pDataBufferForFrame.m_nSizeOfPads[1] = 0;
+ pDataBufferForFrame.m_nChecksum = CalcGameChecksum();
+ uint8* pController1 = PackCurrentPadValues(pDataBufferForFrame.m_ControllerBuffer, &CPad::GetPad(0)->OldState, &CPad::GetPad(0)->NewState);
+ pDataBufferForFrame.m_nSizeOfPads[0] = (pController1 - pDataBufferForFrame.m_ControllerBuffer) / 2;
+ uint8* pController2 = PackCurrentPadValues(pController1, &CPad::GetPad(1)->OldState, &CPad::GetPad(1)->NewState);
+ pDataBufferForFrame.m_nSizeOfPads[1] = (pController2 - pController1) / 2;
+ uint8* pEndPtr = pController2;
+ if ((pDataBufferForFrame.m_nSizeOfPads[0] + pDataBufferForFrame.m_nSizeOfPads[1]) & 1)
+ pEndPtr += 2;
+ CFileMgr::Write(FId, (char*)&pDataBufferForFrame, pEndPtr - (uint8*)&pDataBufferForFrame);
+ break;
+ }
+ case STATE_PLAYBACK:
+ if (pDataBufferPointer[8] == -1)
+ CPad::GetPad(0)->NewState.Clear();
+ else {
+ tGameBuffer* pData = (tGameBuffer*)pDataBufferPointer;
+ CTimer::SetTimeInMilliseconds(pData->m_nTimeInMilliseconds);
+ CTimer::SetTimeStep(pData->m_fTimeStep);
+ uint8 size1 = pData->m_nSizeOfPads[0];
+ uint8 size2 = pData->m_nSizeOfPads[1];
+ pDataBufferPointer = (uint8*)&pData->m_ControllerBuffer;
+ pDataBufferPointer = UnPackCurrentPadValues(pDataBufferPointer, size1, &CPad::GetPad(0)->NewState);
+ pDataBufferPointer = UnPackCurrentPadValues(pDataBufferPointer, size2, &CPad::GetPad(1)->NewState);
+ if ((size1 + size2) & 1)
+ pDataBufferPointer += 2;
+ if (pData->m_nChecksum != CalcGameChecksum())
+ printf("Playback out of sync\n");
+ }
+ }
+}
+
+#define PROCESS_BUTTON_STATE_STORE(buf, os, ns, field, id) \
+ do { \
+ if (os->field != os->field){ \
+ *buf++ = id; \
+ *buf++ = ns->field; \
+ } \
+ } while (0);
+
+uint8* CRecordDataForGame::PackCurrentPadValues(uint8* buf, CControllerState* os, CControllerState* ns)
+{
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftStickX, 0);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftStickY, 1);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShoulder1, 2);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightStickY, 3);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShoulder1, 4);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShoulder2, 5);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightShoulder1, 6);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightShoulder2, 7);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadUp, 8);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadDown, 9);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadLeft, 10);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadRight, 11);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Start, 12);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Select, 13);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Square, 14);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Triangle, 15);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Cross, 16);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Circle, 17);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShock, 18);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightShock, 19);
+ return buf;
+}
+#undef PROCESS_BUTTON_STATE_STORE
+
+#define PROCESS_BUTTON_STATE_RESTORE(buf, state, field, id) case id: state->field = *buf++; break;
+
+uint8* CRecordDataForGame::UnPackCurrentPadValues(uint8* buf, uint8 total, CControllerState* state)
+{
+ for (uint8 i = 0; i < total; i++) {
+ switch (*buf++) {
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftStickX, 0);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftStickY, 1);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShoulder1, 2);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, RightStickY, 3);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShoulder1, 4);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShoulder2, 5);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, RightShoulder1, 6);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, RightShoulder2, 7);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadUp, 8);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadDown, 9);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadLeft, 10);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadRight, 11);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Start, 12);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Select, 13);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Square, 14);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Triangle, 15);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Cross, 16);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Circle, 17);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShock, 18);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, RightShock, 19);
+ }
+ }
+ return buf;
+}
+
+#undef PROCESS_BUTTON_STATE_RESTORE
+
+uint16 CRecordDataForGame::CalcGameChecksum(void)
+{
+ uint32 checksum = 0;
+ int i = CPools::GetPedPool()->GetSize();
+ while (i--) {
+ CPed* pPed = CPools::GetPedPool()->GetSlot(i);
+ if (!pPed)
+ continue;
+ checksum ^= pPed->GetModelIndex() ^ *(uint32*)&pPed->GetPosition().z ^ *(uint32*)&pPed->GetPosition().y ^ *(uint32*)&pPed->GetPosition().x;
+ }
+ i = CPools::GetVehiclePool()->GetSize();
+ while (i--) {
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
+ if (!pVehicle)
+ continue;
+ checksum ^= pVehicle->GetModelIndex() ^ *(uint32*)&pVehicle->GetPosition().z ^ *(uint32*)&pVehicle->GetPosition().y ^ *(uint32*)&pVehicle->GetPosition().x;
+ }
+ return checksum ^ checksum >> 16;
+}
+
+uint8& CRecordDataForChase::Status = *(uint8*)0x95CDCE;
+int& CRecordDataForChase::PositionChanges = *(int*)0x8F59C8;
+uint8& CRecordDataForChase::CurrentCar = *(uint8*)0x95CDC9;
+CAutomobile* (&CRecordDataForChase::pChaseCars)[NUM_CHASE_CARS] = *(CAutomobile * (*)[NUM_CHASE_CARS])*(uintptr*)0x6F46A8;
+uint32& CRecordDataForChase::AnimStartTime = *(uint32*)0x8F1AEC;
+float& CRecordDataForChase::AnimTime = *(float*)0x880F88;
+CCarStateEachFrame* (&CRecordDataForChase::pBaseMemForCar)[NUM_CHASE_CARS] = *(CCarStateEachFrame * (*)[NUM_CHASE_CARS])*(uintptr*)0x70EA18;
+float& CRecordDataForChase::TimeMultiplier = *(float*)0x8E2A94;
+int& CRecordDataForChase::FId2 = *(int*)0x8E2C18;
+
+#define CHASE_SCENE_LENGTH_IN_SECONDS (80)
+#define CHASE_SCENE_FRAMES_PER_SECOND (15) // skipping every second frame
+#define CHASE_SCENE_FRAMES_IN_RECORDING (CHASE_SCENE_LENGTH_IN_SECONDS * CHASE_SCENE_FRAMES_PER_SECOND)
+#define CHASE_SCENE_LENGTH_IN_FRAMES (CHASE_SCENE_FRAMES_IN_RECORDING * 2)
+
+void CRecordDataForChase::Init(void)
+{
+ Status = STATE_NONE;
+ PositionChanges = 0;
+ CurrentCar = 0;
+ for (int i = 0; i < NUM_CHASE_CARS; i++)
+ pChaseCars[i] = nil;
+ AnimStartTime = 0;
+}
+
+void CRecordDataForChase::SaveOrRetrieveDataForThisFrame(void)
+{
+ switch (Status) {
+ case STATE_NONE:
+ return;
+ case STATE_RECORD:
+ {
+ if ((CTimer::GetFrameCounter() & 1) == 0)
+ StoreInfoForCar(pChaseCars[CurrentCar], &pBaseMemForCar[CurrentCar][CTimer::GetFrameCounter() / 2]);
+ if (CTimer::GetFrameCounter() < CHASE_SCENE_LENGTH_IN_FRAMES * 2)
+ return;
+ CFileMgr::SetDir("data\\paths");
+ sprintf(gString, "chase%d.dat", CurrentCar);
+ int fid = CFileMgr::OpenFileForWriting(gString);
+ uint32 fs = CHASE_SCENE_LENGTH_IN_FRAMES * sizeof(CCarStateEachFrame);
+ printf("FileSize:%d\n", fs);
+ CFileMgr::Write(fid, (char*)pBaseMemForCar[CurrentCar], fs);
+ CFileMgr::CloseFile(fid);
+ CFileMgr::SetDir("");
+ sprintf(gString, "car%d.max", CurrentCar);
+ int fid2 = CFileMgr::OpenFileForWriting(gString);
+ for (int i = 0; i < CHASE_SCENE_FRAMES_IN_RECORDING; i++) {
+ // WTF? Was it ever used?
+#ifdef FIX_BUGS
+ CCarStateEachFrame* pState = pBaseMemForCar[CurrentCar];
+#else
+ CCarStateEachFrame* pState = (CCarStateEachFrame*)pChaseCars[CurrentCar];
+#endif
+ CVector right = CVector(pState->rightX, pState->rightY, pState->rightZ) / INT8_MAX;
+ CVector forward = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / INT8_MAX;
+ CVector up = CrossProduct(right, forward);
+ sprintf(gString, "%f %f %f\n", pState->pos.x, pState->pos.y, pState->pos.z);
+ CFileMgr::Write(fid2, gString, strlen(gString) - 1);
+ sprintf(gString, "%f %f %f\n", right.x, right.y, right.z);
+ CFileMgr::Write(fid2, gString, strlen(gString) - 1);
+ sprintf(gString, "%f %f %f\n", forward.x, forward.y, forward.z);
+ CFileMgr::Write(fid2, gString, strlen(gString) - 1);
+ sprintf(gString, "%f %f %f\n", up.x, up.y, up.z);
+ CFileMgr::Write(fid2, gString, strlen(gString) - 1);
+ }
+ CFileMgr::CloseFile(fid2);
+ }
+ case STATE_PLAYBACK:
+ case STATE_PLAYBACK_BEFORE_RECORDING:
+ case STATE_PLAYBACK_INIT:
+ break;
+ }
+}
+
+struct tCoors {
+ CVector pos;
+ float angle;
+};
+
+// I guess developer was filling this with actual data before running the game
+tCoors NewCoorsForRecordedCars[7];
+
+void CRecordDataForChase::SaveOrRetrieveCarPositions(void)
+{
+ switch (Status) {
+ case STATE_NONE:
+ return;
+ case STATE_RECORD:
+ case STATE_PLAYBACK_BEFORE_RECORDING:
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (i != CurrentCar && CTimer::GetFrameCounter()) {
+ RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][CTimer::GetFrameCounter() / 2], false);
+ pChaseCars[i]->GetMatrix().UpdateRW();
+ pChaseCars[i]->UpdateRwFrame();
+ }
+ }
+ if (Status == STATE_PLAYBACK_BEFORE_RECORDING && CTimer::GetFrameCounter()) {
+ RestoreInfoForCar(pChaseCars[CurrentCar], &pBaseMemForCar[CurrentCar][CTimer::GetFrameCounter() / 2], false);
+ pChaseCars[CurrentCar]->GetMatrix().UpdateRW();
+ pChaseCars[CurrentCar]->UpdateRwFrame();
+ }
+ if (CPad::GetPad(0)->GetLeftShockJustDown() && CPad::GetPad(0)->GetRightShockJustDown()) {
+ if (!CPad::GetPad(0)->GetRightShockJustDown()) {
+ pChaseCars[CurrentCar]->GetPosition() = NewCoorsForRecordedCars[PositionChanges].pos;
+ pChaseCars[CurrentCar]->SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ pChaseCars[CurrentCar]->GetMatrix().SetRotateZOnly(DEGTORAD(NewCoorsForRecordedCars[PositionChanges].angle));
+ ++PositionChanges;
+ }
+ if (Status == STATE_PLAYBACK_BEFORE_RECORDING) {
+ Status = STATE_RECORD;
+ pChaseCars[CurrentCar]->m_status = STATUS_PLAYER;
+ }
+ }
+ break;
+ case STATE_PLAYBACK_INIT:
+ Status = STATE_PLAYBACK;
+ break;
+ case STATE_PLAYBACK:
+ {
+ TimeMultiplier += CTimer::GetTimeStepNonClippedInSeconds();
+ float EndOfFrameTime = CHASE_SCENE_FRAMES_PER_SECOND * min(CHASE_SCENE_LENGTH_IN_SECONDS, TimeMultiplier);
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (!pBaseMemForCar[i])
+ continue;
+ if (!pChaseCars[i])
+ continue;
+ if (EndOfFrameTime < CHASE_SCENE_FRAMES_IN_RECORDING - 1) {
+ int FlooredEOFTime = EndOfFrameTime;
+ RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][FlooredEOFTime], false);
+ CMatrix tmp;
+ float dp = EndOfFrameTime - FlooredEOFTime;
+ RestoreInfoForMatrix(tmp, &pBaseMemForCar[i][FlooredEOFTime + 1]);
+ pChaseCars[i]->GetRight() += (tmp.GetRight() - pChaseCars[i]->GetRight()) * dp;
+ pChaseCars[i]->GetForward() += (tmp.GetForward() - pChaseCars[i]->GetForward()) * dp;
+ pChaseCars[i]->GetUp() += (tmp.GetUp() - pChaseCars[i]->GetUp()) * dp;
+ pChaseCars[i]->GetPosition() += (tmp.GetPosition() - pChaseCars[i]->GetPosition()) * dp;
+ }
+ else{
+ RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][CHASE_SCENE_FRAMES_IN_RECORDING - 1], true);
+ if (i == 0)
+ pChaseCars[i]->GetPosition().z += 0.2f;
+ }
+ pChaseCars[i]->GetMatrix().UpdateRW();
+ pChaseCars[i]->UpdateRwFrame();
+ pChaseCars[i]->RemoveAndAdd();
+ }
+ break;
+ }
+ }
+}
+
+void CRecordDataForChase::StoreInfoForCar(CAutomobile* pCar, CCarStateEachFrame* pState)
+{
+ pState->rightX = INT8_MAX * pCar->GetRight().x;
+ pState->rightY = INT8_MAX * pCar->GetRight().y;
+ pState->rightZ = INT8_MAX * pCar->GetRight().z;
+ pState->forwardX = INT8_MAX * pCar->GetForward().x;
+ pState->forwardY = INT8_MAX * pCar->GetForward().y;
+ pState->forwardZ = INT8_MAX * pCar->GetForward().z;
+ pState->pos = pCar->GetPosition();
+ pState->velX = 0.5f * INT16_MAX * pCar->GetMoveSpeed().x;
+ pState->velY = 0.5f * INT16_MAX * pCar->GetMoveSpeed().y;
+ pState->velZ = 0.5f * INT16_MAX * pCar->GetMoveSpeed().z;
+ pState->wheel = 20 * pCar->m_fSteerAngle;
+ pState->gas = 100 * pCar->m_fGasPedal;
+ pState->brake = 100 * pCar->m_fBrakePedal;
+ pState->handbrake = pCar->bIsHandbrakeOn;
+}
+
+void CRecordDataForChase::RestoreInfoForMatrix(CMatrix& matrix, CCarStateEachFrame* pState)
+{
+ matrix.GetRight() = CVector(pState->rightX, pState->rightY, pState->rightZ) / INT8_MAX;
+ matrix.GetForward() = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / INT8_MAX;
+ matrix.GetUp() = CrossProduct(matrix.GetRight(), matrix.GetForward());
+ matrix.GetPosition() = pState->pos;
+}
+
+void CRecordDataForChase::RestoreInfoForCar(CAutomobile* pCar, CCarStateEachFrame* pState, bool stop)
+{
+ CVector oldPos = pCar->GetPosition();
+ RestoreInfoForMatrix(pCar->GetMatrix(), pState);
+ pCar->SetMoveSpeed(CVector(pState->velX, pState->velY, pState->velZ) / INT16_MAX / 0.5f);
+ pCar->SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ pCar->m_fSteerAngle = pState->wheel / 20.0f;
+ pCar->m_fGasPedal = pState->gas / 100.0f;
+ pCar->m_fBrakePedal = pState->brake / 100.0f;
+ pCar->bIsHandbrakeOn = pState->handbrake;
+ if ((oldPos - pCar->GetPosition()).Magnitude() > 15.0f) {
+ if (pCar == pChaseCars[14]) {
+ pCar->m_currentColour1 = 58;
+ pCar->m_currentColour2 = 1;
+ }
+ else
+ pCar->GetModelInfo()->ChooseVehicleColour(pCar->m_currentColour1, pCar->m_currentColour2);
+ }
+ pCar->m_fHealth = min(pCar->m_fHealth, 500.0f);
+ if (stop) {
+ pCar->m_fGasPedal = 0.0f;
+ pCar->m_fBrakePedal = 0.0f;
+ pCar->SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ pCar->bIsHandbrakeOn = false;
+ }
+}
+
+void CRecordDataForChase::ProcessControlCars(void)
+{
+ if (Status != STATE_PLAYBACK)
+ return;
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (pChaseCars[i])
+ pChaseCars[i]->ProcessControl();
+ }
+}
+
+#if (defined(GTA_PS2) || defined(FIX_BUGS))
+bool CRecordDataForChase::ShouldThisPadBeLeftAlone(uint8 pad)
+{
+ // may be wrong
+ if (Status == STATE_NONE || Status == STATE_PLAYBACK)
+ return false;
+ return pad != 0;
+}
+#endif
+
+void CRecordDataForChase::GiveUsACar(int32 mi, CVector pos, float angle, CAutomobile** ppCar, uint8 colour1, uint8 colour2)
+{
+ CStreaming::RequestModel(mi, STREAMFLAGS_DEPENDENCY);
+ CStreaming::LoadAllRequestedModels(false);
+ if (!CStreaming::HasModelLoaded(mi))
+ return;
+ CAutomobile* pCar = new CAutomobile(mi, MISSION_VEHICLE);
+ pCar->GetPosition() = pos;
+ pCar->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER;
+ pCar->GetMatrix().SetRotateZOnly(DEGTORAD(angle));
+ pCar->pDriver = nil;
+ pCar->m_currentColour1 = colour1;
+ pCar->m_currentColour2 = colour2;
+ CWorld::Add(pCar);
+ *ppCar = pCar;
+}
+
+void RemoveUnusedCollision(void)
+{
+ static const char* dontDeleteArray[] = {
+ "rd_SrRoad2A50", "rd_SrRoad2A20", "rd_CrossRda1w22", "rd_CrossRda1rw22",
+ "road_broadway02", "road_broadway01", "com_21way5", "com_21way50",
+ "cm1waycrosscom", "com_21way20", "com_21way10", "road_broadway04",
+ "com_rvroads52", "com_roadsrv", "com_roadkb23", "com_roadkb22"
+ };
+ for (int i = 0; i < ARRAY_SIZE(dontDeleteArray); i++)
+ CModelInfo::GetModelInfo(dontDeleteArray[i], nil)->GetColModel()->level = LEVEL_NONE;
+ CModelInfo::RemoveColModelsFromOtherLevels(LEVEL_NONE);
+ for (int i = 0; i < ARRAY_SIZE(dontDeleteArray); i++)
+ CModelInfo::GetModelInfo(dontDeleteArray[i], nil)->GetColModel()->level = LEVEL_COMMERCIAL;
+}
+
+void CRecordDataForChase::StartChaseScene(float startTime)
+{
+ char filename[28];
+ SetUpCarsForChaseScene();
+ Status = STATE_PLAYBACK;
+ AnimTime = startTime;
+ AnimStartTime = CTimer::GetTimeInMilliseconds();
+ RemoveUnusedCollision();
+ CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN);
+ CGame::TidyUpMemory(true, true);
+ CStreaming::ImGonnaUseStreamingMemory();
+ CFileMgr::SetDir("data\\paths");
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (!pChaseCars[i]) {
+ pBaseMemForCar[i] = nil;
+ continue;
+ }
+ sprintf(filename, "chase%d.dat", i);
+ FId2 = CFileMgr::OpenFile(filename, "rb");
+ if (FId2 <= 0) {
+ pBaseMemForCar[i] = nil;
+ continue;
+ }
+ pBaseMemForCar[i] = new CCarStateEachFrame[CHASE_SCENE_FRAMES_IN_RECORDING];
+ for (int j = 0; j < CHASE_SCENE_FRAMES_IN_RECORDING; j++) {
+ CFileMgr::Read(FId2, (char*)&pBaseMemForCar[i][j], sizeof(CCarStateEachFrame));
+ CFileMgr::Seek(FId2, sizeof(CCarStateEachFrame), 1);
+ }
+ CFileMgr::CloseFile(FId2);
+ }
+ CFileMgr::SetDir("");
+ CStreaming::IHaveUsedStreamingMemory();
+ TimeMultiplier = 0.0f;
+}
+
+void CRecordDataForChase::CleanUpChaseScene(void)
+{
+ if (Status != STATE_PLAYBACK_INIT && Status != STATE_PLAYBACK)
+ return;
+ Status = STATE_NONE;
+ CleanUpCarsForChaseScene();
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (pBaseMemForCar[i]) {
+ delete[] pBaseMemForCar[i];
+ pBaseMemForCar[i] = nil;
+ }
+ }
+}
+
+void CRecordDataForChase::SetUpCarsForChaseScene(void)
+{
+ GiveUsACar(MI_POLICE, CVector(273.54221f, -1167.1907f, 24.880601f), 63.0f, &pChaseCars[0], 2, 1);
+ GiveUsACar(MI_ENFORCER, CVector(231.1783f, -1388.8322f, 25.978201f), 90.0f, &pChaseCars[1], 2, 1);
+ GiveUsACar(MI_TAXI, CVector(184.3156f, -1473.251f, 25.978201f), 0.0f, &pChaseCars[4], 6, 6);
+ GiveUsACar(MI_CHEETAH, CVector(173.8868f, -1377.6514f, 25.978201f), 0.0f, &pChaseCars[6], 4, 5);
+ GiveUsACar(MI_STINGER, CVector(102.5946f, -943.93628f, 25.9781f), 270.0f, &pChaseCars[7], 53, 53);
+ GiveUsACar(MI_CHEETAH, CVector(-177.7157f, -862.18652f, 25.978201f), 155.0f, &pChaseCars[10], 41, 1);
+ GiveUsACar(MI_STINGER, CVector(-170.56979f, -889.02362f, 25.978201f), 154.0f, &pChaseCars[11], 10, 10);
+ GiveUsACar(MI_KURUMA, CVector(402.60809f, -917.49628f, 37.381001f), 90.0f, &pChaseCars[14], 34, 1);
+ GiveUsACar(MI_TAXI, CVector(-33.496201f, -938.4563f, 25.9781f), 266.0f, &pChaseCars[16], 6, 6);
+ GiveUsACar(MI_KURUMA, CVector(49.363098f, -987.60498f, 25.9781f), 0.0f, &pChaseCars[18], 51, 1);
+ GiveUsACar(MI_TAXI, CVector(179.0049f, -1154.6686f, 25.9781f), 0.0f, &pChaseCars[19], 6, 76);
+ GiveUsACar(MI_RUMPO, CVector(-28.9762f, -1031.3367f, 25.990601f), 242.0f, &pChaseCars[2], 1, 75);
+ GiveUsACar(MI_PATRIOT, CVector(114.1564f, -796.69379f, 24.978201f), 180.0f, &pChaseCars[3], 0, 0);
+}
+
+void CRecordDataForChase::CleanUpCarsForChaseScene(void)
+{
+ for (int i = 0; i < NUM_CHASE_CARS; i++)
+ RemoveCarFromChase(i);
+}
-uint8 &CRecordDataForChase::Status = *(uint8*)0x95CDCE;
+void CRecordDataForChase::RemoveCarFromChase(int32 i)
+{
+ if (!pChaseCars[i])
+ return;
+ CWorld::Remove(pChaseCars[i]);
+ delete pChaseCars[i];
+ pChaseCars[i] = nil;
+}
-WRAPPER void CRecordDataForGame::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0x4341F0); }
-WRAPPER void CRecordDataForGame::Init(void) { EAXJMP(0x4340F0); }
+CVehicle* CRecordDataForChase::TurnChaseCarIntoScriptCar(int32 i)
+{
+ CVehicle* pVehicle = pChaseCars[i];
+ pChaseCars[i] = nil;
+ pVehicle->m_status = STATUS_PHYSICS;
+ return pVehicle;
+}
-WRAPPER void CRecordDataForChase::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0x4347F0); }
-WRAPPER void CRecordDataForChase::ProcessControlCars(void) { EAXJMP(0x435540); }
-WRAPPER void CRecordDataForChase::SaveOrRetrieveCarPositions(void) { EAXJMP(0x434B20); }
-WRAPPER void CRecordDataForChase::StartChaseScene(float) { EAXJMP(0x435690); }
-WRAPPER void CRecordDataForChase::CleanUpChaseScene() { EAXJMP(0x4357C0); }
-WRAPPER void CRecordDataForChase::RemoveCarFromChase(int32) { EAXJMP(0x435BC0); }
-WRAPPER CVehicle* CRecordDataForChase::TurnChaseCarIntoScriptCar(int32) { EAXJMP(0x435C00); }
-WRAPPER void CRecordDataForChase::Init(void) { EAXJMP(0x434780); }
diff --git a/src/control/Record.h b/src/control/Record.h
index e52a623e..4abeb68a 100644
--- a/src/control/Record.h
+++ b/src/control/Record.h
@@ -1,34 +1,106 @@
#pragma once
+class CAutomobile;
class CVehicle;
+class CControllerState;
-enum {
- RECORDSTATE_0,
- RECORDSTATE_1,
- RECORDSTATE_2,
+class CCarStateEachFrame
+{
+public:
+ int16 velX;
+ int16 velY;
+ int16 velZ;
+ int8 rightX;
+ int8 rightY;
+ int8 rightZ;
+ int8 forwardX;
+ int8 forwardY;
+ int8 forwardZ;
+ int8 wheel;
+ uint8 gas;
+ uint8 brake;
+ bool handbrake;
+ CVector pos;
};
+extern char* gString;
+
class CRecordDataForChase
{
-public:
+ enum {
+ NUM_CHASE_CARS = 20
+ };
+ enum {
+ STATE_NONE = 0,
+ STATE_RECORD = 1,
+ STATE_PLAYBACK_INIT = 2,
+ STATE_PLAYBACK = 3,
+ STATE_PLAYBACK_BEFORE_RECORDING = 4
+ };
static uint8 &Status;
+ static int &PositionChanges;
+ static uint8 &CurrentCar;
+ static CAutomobile*(&pChaseCars)[NUM_CHASE_CARS];
+ static float &AnimTime;
+ static uint32 &AnimStartTime;
+ static CCarStateEachFrame* (&pBaseMemForCar)[NUM_CHASE_CARS];
+ static float &TimeMultiplier;
+ static int &FId2;
+public:
+
+ static bool IsRecording(void) { return Status == STATE_RECORD; }
+ static void Init(void);
static void SaveOrRetrieveDataForThisFrame(void);
- static void ProcessControlCars(void);
static void SaveOrRetrieveCarPositions(void);
+ static void StoreInfoForCar(CAutomobile*, CCarStateEachFrame*);
+ static void RestoreInfoForMatrix(CMatrix&, CCarStateEachFrame*);
+ static void RestoreInfoForCar(CAutomobile*, CCarStateEachFrame*, bool);
+ static void ProcessControlCars(void);
+#if (defined(GTA_PS2) || defined(FIX_BUGS))
+ static bool ShouldThisPadBeLeftAlone(uint8 pad);
+#endif
+ static void GiveUsACar(int32, CVector, float, CAutomobile**, uint8, uint8);
static void StartChaseScene(float);
- static void CleanUpChaseScene();
+ static void CleanUpChaseScene(void);
+ static void SetUpCarsForChaseScene(void);
+ static void CleanUpCarsForChaseScene(void);
static void RemoveCarFromChase(int32);
static CVehicle* TurnChaseCarIntoScriptCar(int32);
- static void Init(void);
+
};
+struct tGameBuffer
+{
+ float m_fTimeStep;
+ uint32 m_nTimeInMilliseconds;
+ uint8 m_nSizeOfPads[2];
+ uint16 m_nChecksum;
+ uint8 m_ControllerBuffer[116];
+};
class CRecordDataForGame
{
+ enum {
+ STATE_NONE = 0,
+ STATE_RECORD = 1,
+ STATE_PLAYBACK = 2,
+ };
+ static uint16& RecordingState;
+ static uint8* &pDataBuffer;
+ static uint8* &pDataBufferPointer;
+ static int &FId;
+ static tGameBuffer &pDataBufferForFrame;
+
public:
- static uint16 &RecordingState;
+ static bool IsRecording() { return RecordingState == STATE_RECORD; }
+ static bool IsPlayingBack() { return RecordingState == STATE_PLAYBACK; }
static void SaveOrRetrieveDataForThisFrame(void);
static void Init(void);
+
+private:
+ static uint16 CalcGameChecksum(void);
+ static uint8* PackCurrentPadValues(uint8*, CControllerState*, CControllerState*);
+ static uint8* UnPackCurrentPadValues(uint8*, uint8, CControllerState*);
};
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 6efbeb8e..f83998b8 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -21,10 +21,12 @@
#include "Hud.h"
#include "Text.h"
#include "Timer.h"
+#include "Record.h"
#include "World.h"
#include "Vehicle.h"
#include "Ped.h"
#include "Population.h"
+#include "Record.h"
#include "Replay.h"
#include "Weather.h"
#include "win.h"
@@ -967,9 +969,14 @@ void CPad::Update(int16 unk)
{
OldState = NewState;
- NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
- NewState = ReconcileTwoControllersInput(PCTempMouseState, NewState);
-
+#if (defined GTA_PS2 || defined FIX_BUGS)
+ if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(unk))
+#endif
+ {
+ NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
+ NewState = ReconcileTwoControllersInput(PCTempMouseState, NewState);
+ }
+
PCTempJoyState.Clear();
PCTempKeyState.Clear();
PCTempMouseState.Clear();
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 3dcb767a..d00edf51 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1247,8 +1247,8 @@ CStreaming::StreamVehiclesAndPeds(void)
static int timeBeforeNextLoad = 0;
static int modelQualityClass = 0;
- if(CRecordDataForGame::RecordingState == RECORDSTATE_1 ||
- CRecordDataForGame::RecordingState == RECORDSTATE_2)
+ if(CRecordDataForGame::IsRecording() ||
+ CRecordDataForGame::IsPlayingBack())
return;
if(FindPlayerPed()->m_pWanted->AreSwatRequired()){
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp
index b5e031ed..fda862f1 100644
--- a/src/core/Timer.cpp
+++ b/src/core/Timer.cpp
@@ -142,7 +142,7 @@ void CTimer::Update(void)
ms_fTimeStepNonClipped = ms_fTimeStep;
- if ( CRecordDataForGame::RecordingState != RECORDSTATE_2 )
+ if ( !CRecordDataForGame::IsPlayingBack() )
{
ms_fTimeStep = min(3.0f, ms_fTimeStep);
@@ -150,7 +150,7 @@ void CTimer::Update(void)
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 60;
}
- if ( CRecordDataForChase::Status == RECORDSTATE_1 )
+ if ( CRecordDataForChase::IsRecording() )
{
ms_fTimeStep = 1.0f;
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 16;
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 07d70394..25e5db48 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -62,11 +62,11 @@ CEntity::CEntity(void)
bRemoveFromWorld = false;
bHasHitWall = false;
bImBeingRendered = false;
- m_flagD8 = false;
+ bTouchingWater = false;
bIsSubway = false;
bDrawLast = false;
bNoBrightHeadLights = false;
- m_flagD80 = false;
+ bDoNotRender = false;
bDistanceFade = false;
m_flagE2 = false;
diff --git a/src/entities/Entity.h b/src/entities/Entity.h
index 99cc7f17..17a219c3 100644
--- a/src/entities/Entity.h
+++ b/src/entities/Entity.h
@@ -73,11 +73,11 @@ public:
uint32 bRemoveFromWorld : 1;
uint32 bHasHitWall : 1;
uint32 bImBeingRendered : 1;
- uint32 m_flagD8 : 1; // used by cBuoyancy::ProcessBuoyancy
+ uint32 bTouchingWater : 1; // used by cBuoyancy::ProcessBuoyancy
uint32 bIsSubway : 1; // set when subway, but maybe different meaning?
uint32 bDrawLast : 1;
uint32 bNoBrightHeadLights : 1;
- uint32 m_flagD80 : 1; // CObject visibility?
+ uint32 bDoNotRender : 1;
// flagsE
uint32 bDistanceFade : 1;
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp
index aa366aa0..867624c7 100644
--- a/src/objects/Object.cpp
+++ b/src/objects/Object.cpp
@@ -6,12 +6,11 @@
#include "Radar.h"
#include "Object.h"
#include "DummyObject.h"
-
-WRAPPER void CObject::ObjectDamage(float amount) { EAXJMP(0x4BB240); }
-WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
-WRAPPER void CObject::Init(void) { EAXJMP(0x4BAEC0); }
-WRAPPER void CObject::ProcessControl(void) { EAXJMP(0x4BB040); }
-WRAPPER void CObject::Teleport(CVector) { EAXJMP(0x4BBDA0); }
+#include "Particle.h"
+#include "General.h"
+#include "ObjectData.h"
+#include "World.h"
+#include "Floater.h"
int16 &CObject::nNoTempObjects = *(int16*)0x95CCA2;
int16 &CObject::nBodyCastHealth = *(int16*)0x5F7D4C; // 1000
@@ -28,13 +27,13 @@ CObject::CObject(void)
m_nCollisionDamageEffect = 0;
m_nSpecialCollisionResponseCases = COLLRESPONSE_NONE;
m_bCameraToAvoidThisObject = false;
- ObjectCreatedBy = 0;
+ ObjectCreatedBy = UNKNOWN_OBJECT;
m_nEndOfLifeTime = 0;
// m_nRefModelIndex = -1; // duplicate
// bUseVehicleColours = false; // duplicate
m_colour2 = 0;
m_colour1 = m_colour2;
- field_172 = 0;
+ m_nBonusValue = 0;
bIsPickup = false;
m_obj_flag2 = false;
bOutOfStock = false;
@@ -82,10 +81,46 @@ CObject::~CObject(void)
nNoTempObjects--;
}
+void
+CObject::ProcessControl(void)
+{
+ CVector point, impulse;
+ if (m_nCollisionDamageEffect)
+ ObjectDamage(m_fDamageImpulse);
+ CPhysical::ProcessControl();
+ if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) {
+ bIsInWater = true;
+ bIsStatic = false;
+ ApplyMoveForce(impulse);
+ ApplyTurnForce(impulse, point);
+ float fTimeStep = Pow(0.97f, CTimer::GetTimeStep());
+ m_vecMoveSpeed *= fTimeStep;
+ m_vecTurnSpeed *= fTimeStep;
+ }
+ if ((m_modelIndex == MI_EXPLODINGBARREL || m_modelIndex == MI_PETROLPUMP) && bHasBeenDamaged && bIsVisible
+ && (CGeneral::GetRandomNumber() & 0x1F) == 10) {
+ bExplosionProof = true;
+ bIsVisible = false;
+ bUsesCollision = false;
+ bAffectedByGravity = false;
+ m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
+ }
+}
+
+void
+CObject::Teleport(CVector vecPos)
+{
+ CWorld::Remove(this);
+ m_matrix.GetPosition() = vecPos;
+ m_matrix.UpdateRW();
+ UpdateRwFrame();
+ CWorld::Add(this);
+}
+
void
CObject::Render(void)
{
- if(m_flagD80)
+ if(bDoNotRender)
return;
if(m_nRefModelIndex != -1 && ObjectCreatedBy == TEMP_OBJECT && bUseVehicleColours){
@@ -117,6 +152,152 @@ CObject::RemoveLighting(bool reset)
WorldReplaceScorchedLightsWithNormal(Scene.world);
}
+void
+CObject::ObjectDamage(float amount)
+{
+ if (!m_nCollisionDamageEffect || !bUsesCollision)
+ return;
+ static int8 nFrameGen = 0;
+ bool bBodyCastDamageEffect = false;
+ if (m_modelIndex == MI_BODYCAST){
+ if (amount > 50.0f)
+ nBodyCastHealth = (int16)(nBodyCastHealth - 0.5f * amount);
+ if (nBodyCastHealth < 0)
+ nBodyCastHealth = 0;
+ if (nBodyCastHealth < 200)
+ bBodyCastDamageEffect = true;
+ amount = 0.0f;
+ }
+ if ((amount * m_fCollisionDamageMultiplier > 150.0f || bBodyCastDamageEffect) && m_nCollisionDamageEffect) {
+ const CVector& vecPos = m_matrix.GetPosition();
+ const float fDirectionZ = 0.0002f * amount;
+ switch (m_nCollisionDamageEffect)
+ {
+ case COLDAMAGE_EFFECT_CHANGE_MODEL:
+ bRenderDamaged = true;
+ break;
+ case COLDAMAGE_EFFECT_SPLIT_MODEL:
+ break;
+ case COLDAMAGE_EFFECT_SMASH_COMPLETELY:
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ break;
+ case COLDAMAGE_EFFECT_CHANGE_THEN_SMASH:
+ if (!bRenderDamaged) {
+ bRenderDamaged = true;
+ }
+ else {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ }
+ break;
+ case COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY: {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ const RwRGBA color = { 96, 48, 0, 255 };
+ for (int32 i = 0; i < 25; i++) {
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ ++nFrameGen;
+ int32 currentFrame = nFrameGen & 3;
+ float fRandom = CGeneral::GetRandomNumberInRange(0.01f, 1.0f);
+ RwRGBA randomColor = { color.red * fRandom, color.green * fRandom , color.blue, color.alpha };
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
+ int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
+ CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
+ }
+ PlayOneShotScriptObject(_SCRSOUND_CARDBOARD_BOX_SMASH, vecPos);
+ break;
+ }
+ case COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ const RwRGBA color = { 128, 128, 128, 255 };
+ for (int32 i = 0; i < 45; i++) {
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ ++nFrameGen;
+ int32 currentFrame = nFrameGen & 3;
+ float fRandom = CGeneral::GetRandomNumberInRange(0.5f, 0.5f);
+ RwRGBA randomColor = { color.red * fRandom, color.green * fRandom , color.blue * fRandom, color.alpha };
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
+ int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
+ CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
+ }
+ PlayOneShotScriptObject(_SCRSOUND_WOODEN_BOX_SMASH, vecPos);
+ break;
+ }
+ case COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ const RwRGBA color1 = { 200, 0, 0, 255 };
+ const RwRGBA color2 = { 200, 200, 200, 255 };
+ for (int32 i = 0; i < 10; i++) {
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ ++nFrameGen;
+ int32 currentFrame = nFrameGen & 3;
+ RwRGBA color = color2;
+ if (nFrameGen & 1)
+ color = color1;
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
+ int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
+ CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
+ }
+ PlayOneShotScriptObject(_SCRSOUND_TYRE_BUMP, vecPos);
+ break;
+ }
+ case COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ const RwRGBA color1 = { 200, 0, 0, 255 };
+ const RwRGBA color2 = { 200, 200, 200, 255 };
+ for (int32 i = 0; i < 32; i++) {
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ ++nFrameGen;
+ int32 currentFrame = nFrameGen & 3;
+ RwRGBA color = color2;
+ if (nFrameGen & 1)
+ color = color1;
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
+ int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
+ CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
+ }
+ PlayOneShotScriptObject(_SCRSOUND_COL_CAR, vecPos);
+ break;
+ }
+ }
+ }
+}
void
CObject::RefModelInfo(int32 modelId)
@@ -125,6 +306,39 @@ CObject::RefModelInfo(int32 modelId)
CModelInfo::GetModelInfo(modelId)->AddRef();
}
+void
+CObject::Init(void)
+{
+ m_type = ENTITY_TYPE_OBJECT;;
+ CObjectData::SetObjectData(m_modelIndex, *this);
+ m_nEndOfLifeTime = 0;
+ ObjectCreatedBy = GAME_OBJECT;
+ bIsStatic = true;
+ bIsPickup = false;
+ m_obj_flag2 = false;
+ bOutOfStock = false;
+ bGlassCracked = false;
+ bGlassBroken = false;
+ bHasBeenDamaged = false;
+ bUseVehicleColours = false;
+ m_nRefModelIndex = -1;
+ m_colour1 = 0;
+ m_colour2 = 0;
+ m_nBonusValue = 0;
+ m_pCollidingEntity = nil;
+ CColPoint point;
+ CEntity* outEntity = nil;
+ const CVector& vecPos = m_matrix.GetPosition();
+ if (CWorld::ProcessVerticalLine(vecPos, vecPos.z - 10.0f, point, outEntity, true, false, false, false, false, false, nil))
+ m_pCurSurface = outEntity;
+ else
+ m_pCurSurface = nil;
+ if (m_modelIndex == MI_BODYCAST)
+ nBodyCastHealth = 1000;
+ else if (m_modelIndex == MI_BUOY)
+ bTouchingWater = true;
+}
+
bool
CObject::CanBeDeleted(void)
{
@@ -142,6 +356,45 @@ CObject::CanBeDeleted(void)
}
}
+void
+CObject::DeleteAllMissionObjects()
+{
+ CObjectPool* objectPool = CPools::GetObjectPool();
+ for (int32 i = 0; i < objectPool->GetSize(); i++) {
+ CObject* pObject = objectPool->GetSlot(i);
+ if (pObject && pObject->ObjectCreatedBy == MISSION_OBJECT) {
+ CWorld::Remove(pObject);
+ delete pObject;
+ }
+ }
+}
+
+void
+CObject::DeleteAllTempObjects()
+{
+ CObjectPool* objectPool = CPools::GetObjectPool();
+ for (int32 i = 0; i < objectPool->GetSize(); i++) {
+ CObject* pObject = objectPool->GetSlot(i);
+ if (pObject && pObject->ObjectCreatedBy == TEMP_OBJECT) {
+ CWorld::Remove(pObject);
+ delete pObject;
+ }
+ }
+}
+
+void
+CObject::DeleteAllTempObjectInArea(CVector point, float fRadius)
+{
+ CObjectPool *objectPool = CPools::GetObjectPool();
+ for (int32 i = 0; i < objectPool->GetSize(); i++) {
+ CObject *pObject = objectPool->GetSlot(i);
+ if (pObject && pObject->ObjectCreatedBy == TEMP_OBJECT && fRadius * fRadius > pObject->GetPosition().MagnitudeSqr()) {
+ CWorld::Remove(pObject);
+ delete pObject;
+ }
+ }
+}
+
#include <new>
class CObject_ : public CObject
@@ -152,6 +405,9 @@ public:
CObject *ctor(CDummyObject *dummy) { return ::new (this) CObject(dummy); }
void dtor(void) { CObject::~CObject(); }
void Render_(void) { CObject::Render(); }
+ void ProcessControl_(void) { CObject::ProcessControl(); }
+ bool SetupLighting_(void) { return CObject::SetupLighting(); }
+ void RemoveLighting_(bool reset) { CObject::RemoveLighting(reset); }
};
STARTPATCHES
@@ -159,5 +415,16 @@ STARTPATCHES
InjectHook(0x4BACE0, (CObject* (CObject::*)(int32, bool)) &CObject_::ctor, PATCH_JUMP);
InjectHook(0x4BAD50, (CObject* (CObject::*)(CDummyObject*)) &CObject_::ctor, PATCH_JUMP);
InjectHook(0x4BAE00, &CObject_::dtor, PATCH_JUMP);
+ InjectHook(0x4BB040, &CObject_::ProcessControl_, PATCH_JUMP);
+ InjectHook(0x4BBDA0, &CObject::Teleport, PATCH_JUMP);
InjectHook(0x4BB1E0, &CObject_::Render_, PATCH_JUMP);
+ InjectHook(0x4A7C90, &CObject_::SetupLighting_, PATCH_JUMP);
+ InjectHook(0x4A7CD0, &CObject_::RemoveLighting_, PATCH_JUMP);
+ InjectHook(0x4BB240, &CObject::ObjectDamage, PATCH_JUMP);
+ InjectHook(0x4BBD80, &CObject::RefModelInfo, PATCH_JUMP);
+ InjectHook(0x4BAEC0, &CObject::Init, PATCH_JUMP);
+ InjectHook(0x4BB010, &CObject::CanBeDeleted, PATCH_JUMP);
+ InjectHook(0x4BBE60, &CObject::DeleteAllMissionObjects, PATCH_JUMP);
+ InjectHook(0x4BBDF0, &CObject::DeleteAllTempObjects, PATCH_JUMP);
+ InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectInArea, PATCH_JUMP);
ENDPATCHES
diff --git a/src/objects/Object.h b/src/objects/Object.h
index 27346e23..6d04c78a 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -3,6 +3,7 @@
#include "Physical.h"
enum {
+ UNKNOWN_OBJECT = 0,
GAME_OBJECT = 1,
MISSION_OBJECT = 2,
TEMP_OBJECT = 3,
@@ -10,6 +11,18 @@ enum {
};
enum {
+ COLDAMAGE_EFFECT_NONE = 0,
+ COLDAMAGE_EFFECT_CHANGE_MODEL = 1,
+ COLDAMAGE_EFFECT_SPLIT_MODEL = 2,
+ COLDAMAGE_EFFECT_SMASH_COMPLETELY = 3,
+ COLDAMAGE_EFFECT_CHANGE_THEN_SMASH = 4,
+ COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY = 50,
+ COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY = 60,
+ COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY = 70,
+ COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY = 80,
+};
+
+enum {
COLLRESPONSE_NONE,
COLLRESPONSE_CHANGE_MODEL,
COLLRESPONSE_SPLIT_MODEL,
@@ -41,21 +54,21 @@ public:
int8 bHasBeenDamaged : 1;
int8 bUseVehicleColours : 1;
int8 m_obj_flag80 : 1;
- int8 field_172; // car for a bonus pickup?
- int8 field_173;
+ int8 m_nBonusValue;
+ int8 field_173;
float m_fCollisionDamageMultiplier;
uint8 m_nCollisionDamageEffect;
uint8 m_nSpecialCollisionResponseCases;
bool m_bCameraToAvoidThisObject;
- int8 field_17B;
- int8 field_17C;
- int8 field_17D;
- int8 field_17E;
- int8 field_17F;
+ int8 field_17B;
+ int8 field_17C;
+ int8 field_17D;
+ int8 field_17E;
+ int8 field_17F;
uint32 m_nEndOfLifeTime;
int16 m_nRefModelIndex;
- int8 field_186;
- int8 field_187;
+ int8 field_186;
+ int8 field_187;
CEntity *m_pCurSurface;
CEntity *m_pCollidingEntity;
int8 m_colour1, m_colour2;
@@ -74,7 +87,7 @@ public:
~CObject(void);
void ProcessControl(void);
- void Teleport(CVector);
+ void Teleport(CVector vecPos);
void Render(void);
bool SetupLighting(void);
void RemoveLighting(bool reset);
@@ -84,6 +97,8 @@ public:
void Init(void);
bool CanBeDeleted(void);
- static void DeleteAllTempObjectInArea(CVector, float);
+ static void DeleteAllMissionObjects();
+ static void DeleteAllTempObjects();
+ static void DeleteAllTempObjectInArea(CVector point, float fRadius);
};
static_assert(sizeof(CObject) == 0x198, "CObject: error");
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index a1450ade..cee2b323 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -15026,7 +15026,7 @@ CPed::ProcessBuoyancy(void)
#endif
if (mod_Buoyancy.ProcessBuoyancy(this, GRAVITY * m_fMass * buoyancyLevel, &buoyancyPoint, &buoyancyImpulse)) {
- m_flagD8 = true;
+ bTouchingWater = true;
CEntity *entity;
CColPoint point;
if (CWorld::ProcessVerticalLine(GetPosition(), GetPosition().z - 3.0f, point, entity, false, true, false, false, false, false, false)
@@ -15092,7 +15092,7 @@ CPed::ProcessBuoyancy(void)
} else
return;
} else
- m_flagD8 = false;
+ bTouchingWater = false;
if (nGenerateWaterCircles && CTimer::GetTimeInMilliseconds() >= nGenerateWaterCircles) {
CVector pos = GetPosition();
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index dbfd40c6..dfa61584 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -967,7 +967,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
} else if (obj->m_modelIndex == MI_BUOY) {
obj->bIsStatic = false;
obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f);
- obj->m_flagD8 = true;
+ obj->bTouchingWater = true;
obj->AddToMovingList();
}
}
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 1c0d673e..d94428e5 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -356,7 +356,7 @@ CAutomobile::ProcessControl(void)
PruneReferences();
- if(m_status == STATUS_PLAYER && CRecordDataForChase::Status != RECORDSTATE_1)
+ if(m_status == STATUS_PLAYER && CRecordDataForChase::IsRecording())
DoDriveByShootings();
}
break;
@@ -2814,7 +2814,7 @@ CAutomobile::ProcessBuoyancy(void)
CVector impulse, point;
if(mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)){
- m_flagD8 = true;
+ bTouchingWater = true;
ApplyMoveForce(impulse);
ApplyTurnForce(impulse, point);
@@ -2899,7 +2899,7 @@ CAutomobile::ProcessBuoyancy(void)
}
}else{
bIsInWater = false;
- m_flagD8 = false;
+ bTouchingWater = false;
static RwRGBA splashCol = {155, 155, 185, 196};
static RwRGBA smokeCol = {255, 255, 255, 255};
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 9c7cbb4f..0b3dab3d 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -70,7 +70,7 @@ CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner)
unk1 = 0.0f;
m_bIsAnchored = true;
field_2C4 = -9999.99f;
- m_flagD8 = true;
+ bTouchingWater = true;
field_2CC = 0.0f;
field_2D0 = 0;
m_nNumWakePoints = 0;
diff --git a/src/vehicles/Floater.cpp b/src/vehicles/Floater.cpp
index 6b8bf755..62d55925 100644
--- a/src/vehicles/Floater.cpp
+++ b/src/vehicles/Floater.cpp
@@ -26,7 +26,7 @@ cBuoyancy::ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *point, CVec
{
m_numSteps = 2.0f;
- if(!CWaterLevel::GetWaterLevel(phys->GetPosition(), &m_waterlevel, phys->m_flagD8))
+ if(!CWaterLevel::GetWaterLevel(phys->GetPosition(), &m_waterlevel, phys->bTouchingWater))
return false;
m_matrix = phys->GetMatrix();