From 0d1f42add1abbe729d52292d3e7b06a575b2506b Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Mon, 24 Feb 2020 20:40:39 +0100 Subject: Implement ProcessCrane --- src/control/Cranes.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/control') diff --git a/src/control/Cranes.h b/src/control/Cranes.h index 9f606c9f..b40454ea 100644 --- a/src/control/Cranes.h +++ b/src/control/Cranes.h @@ -2,6 +2,47 @@ #include "common.h" class CVehicle; +class CEntity; +class CObject; + +class CCrane +{ +public: + CEntity *m_pObject; + CObject *m_pMagnet; + int m_nAudioEntity; + float m_fPickupX1; + float m_fPickupX2; + float m_fPickupY1; + float m_fPickupY2; + CVector m_vecDropoffTarget; + float m_fDropoffHeading; + float m_fPickupAngle; + float m_fDropoffAngle; + float m_fPickupDistance; + float m_fDropoffDistance; + float m_fAngle; + float m_fDistance; + float m_fHeight; + float m_fHookOffset; + float m_fHookHeight; + CVector m_vecHookInitPos; + CVector m_vecHookCurPos; + float m_fHookVelocityX; + float m_fHookVelocityY; + CVehicle *m_pVehiclePickedUp; + int m_nUpdateTimer; + char m_bCraneActive; + char m_bCraneStatus; + char m_bVehiclesCollected; + char m_bIsCrusher; + char m_bIsMilitaryCrane; + char field_125; + char m_bNotMilitaryCrane; + char gap_127[1]; +}; + +static_assert(sizeof(CCrane) == 128, "CCrane: error"); class CCranes { -- cgit v1.2.3 From 8f01eab5ab97c498fd308c091ad9c555b2f67b56 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 25 Feb 2020 20:01:56 +0100 Subject: Fixes for Serge's review --- src/animation/RpAnimBlend.cpp | 6 +- src/audio/AudioManager.cpp | 378 ++++++-------------- src/control/Bridge.cpp | 14 +- src/control/PathFind.cpp | 4 +- src/control/Pickups.cpp | 2 +- src/control/Script.cpp | 2 +- src/core/Camera.cpp | 132 +++---- src/core/Timer.cpp | 2 +- src/core/common.h | 1 - src/core/main.cpp | 2 +- src/entities/Physical.cpp | 2 +- src/objects/ObjectData.cpp | 2 +- src/peds/Ped.cpp | 10 +- src/peds/Population.cpp | 2 +- src/render/Coronas.cpp | 2 +- src/render/Font.cpp | 4 +- src/render/Hud.cpp | 58 ++-- src/render/SpecialFX.cpp | 788 +++++++++++++++++++++--------------------- src/skel/win/win.cpp | 4 +- 19 files changed, 624 insertions(+), 791 deletions(-) (limited to 'src/control') diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp index 8108619e..9c847139 100644 --- a/src/animation/RpAnimBlend.cpp +++ b/src/animation/RpAnimBlend.cpp @@ -183,8 +183,8 @@ RpAnimBlendClumpGetMainAssociation(RpClump *clump, CAnimBlendAssociation **assoc CAnimBlendAssociation *mainAssoc = nil; CAnimBlendAssociation *secondAssoc = nil; - float mainBlend = 0.0; - float secondBlend = 0.0; + float mainBlend = 0.0f; + float secondBlend = 0.0f; for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){ CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link); @@ -215,7 +215,7 @@ RpAnimBlendClumpGetMainPartialAssociation(RpClump *clump) if(clumpData == nil) return nil; CAnimBlendAssociation *mainAssoc = nil; - float mainBlend = 0.0; + float mainBlend = 0.0f; for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){ CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link); diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index a2fb0d33..201d8698 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -2394,7 +2394,7 @@ cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automo if(automobile->m_aWheelState[wheel] == 2) { relativeVelChange = min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); } else { - relativeVelChange = 0.0; + relativeVelChange = 0.0f; } return max(relativeVelChange, min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); @@ -2505,7 +2505,7 @@ cAudioManager::PlayOneShot(int32 index, int16 sound, float vol) if(entity.m_bIsUsed) { if(sound < SOUND_TOTAL_SOUNDS) { if(entity.m_nType == AUDIOTYPE_SCRIPTOBJECT) { - if(m_nScriptObjectEntityTotal < 40) { + if(m_nScriptObjectEntityTotal < ARRAY_SIZE(m_anScriptObjectEntityIndices)) { entity.m_awAudioEvent[0] = sound; entity.m_AudioEvents = 1; m_anScriptObjectEntityIndices[m_nScriptObjectEntityTotal++] = @@ -2515,7 +2515,7 @@ cAudioManager::PlayOneShot(int32 index, int16 sound, float vol) int32 i = 0; while(true) { if(i >= entity.m_AudioEvents) { - if(entity.m_AudioEvents < 4) { + if(entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) { entity.m_awAudioEvent[i] = sound; entity.m_afVolume[i] = vol; ++entity.m_AudioEvents; @@ -2535,7 +2535,7 @@ cAudioManager::PlayOneShot(int32 index, int16 sound, float vol) } entity.m_awAudioEvent[i] = sound; entity.m_afVolume[i] = vol; - if(entity.m_AudioEvents < 4) ++entity.m_AudioEvents; + if(entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) ++entity.m_AudioEvents; } } } @@ -3199,8 +3199,8 @@ cAudioManager::ProcessCesna(cVehicleParams *params) if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 52; m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE; - m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 0; m_sQueueSample.m_nFrequency = 12500; m_sQueueSample.m_nLoopCount = 0; @@ -3209,11 +3209,11 @@ cAudioManager::ProcessCesna(cVehicleParams *params) m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 8.0; + m_sQueueSample.field_48 = 8.0f; m_sQueueSample.m_fSoundIntensity = 200.0f; m_sQueueSample.field_56 = 0; - m_sQueueSample.m_bReverbFlag = 1; - m_sQueueSample.m_bRequireReflection = 0; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); } if(params->m_fDistance < 8100.f) { @@ -3221,8 +3221,8 @@ cAudioManager::ProcessCesna(cVehicleParams *params) if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 2; m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV; - m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 0; m_sQueueSample.m_nFrequency = 25000; m_sQueueSample.m_nLoopCount = 0; @@ -3232,11 +3232,11 @@ cAudioManager::ProcessCesna(cVehicleParams *params) SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 8.0; + m_sQueueSample.field_48 = 8.0f; m_sQueueSample.m_fSoundIntensity = 90.0f; m_sQueueSample.field_56 = 0; - m_sQueueSample.m_bReverbFlag = 1; - m_sQueueSample.m_bRequireReflection = 0; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); } } @@ -3313,8 +3313,8 @@ cAudioManager::ProcessCrane() if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 0; m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET; - m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 2; m_sQueueSample.m_nFrequency = 6000; m_sQueueSample.m_nLoopCount = 0; @@ -3327,8 +3327,8 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; - m_sQueueSample.m_bReverbFlag = 1; - m_sQueueSample.m_bRequireReflection = 0; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); } if(m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents) { @@ -3338,7 +3338,7 @@ cAudioManager::ProcessCrane() SampleManager.GetSampleBaseFrequency(SFX_COL_CAR_2); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.field_56 = 1; - m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bRequireReflection = 1; AddSampleToRequestedQueue(); } @@ -3680,7 +3680,7 @@ void cAudioManager::ProcessFires(int32) } } else { maxDist = 2500.f; - m_sQueueSample.m_fSoundIntensity = 50.0; + m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); m_sQueueSample.m_nFrequency += i * ((uint32)m_sQueueSample.m_nFrequency >> 6); @@ -3695,10 +3695,10 @@ void cAudioManager::ProcessFires(int32) m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = i; - m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.field_48 = 2.0; + m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.field_48 = 2.0f; m_sQueueSample.field_76 = 10; - m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_bIsDistant = false; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.field_56 = 0; m_sQueueSample.m_bEmittingVolume = emittingVol; @@ -3706,8 +3706,8 @@ void cAudioManager::ProcessFires(int32) SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = 1; - m_sQueueSample.m_bRequireReflection = 0; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); } } @@ -3886,6 +3886,50 @@ 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::Garages[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.field_16 = 4; \ + m_sQueueSample.m_bEmittingVolume = 60; \ + m_sQueueSample.field_48 = 0.0f; \ + m_sQueueSample.m_fSoundIntensity = 80.0f; \ + m_sQueueSample.field_16 = 4; \ + m_sQueueSample.m_bReverbFlag = true; \ + /*m_sQueueSample.m_bReverbFlag = true;*/ \ + m_sQueueSample.m_bIsDistant = false; \ + m_sQueueSample.field_56 = 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 = 1; \ + AddSampleToRequestedQueue(); \ + } \ + } \ + break; \ + default: continue; \ + } \ + } + for(uint32 i = 0; i < CGarages::NumGarages; ++i) { if(CGarages::Garages[i].m_eGarageType == GARAGE_NONE) continue; entity = CGarages::Garages[i].m_pDoor1; @@ -3902,104 +3946,14 @@ cAudioManager::ProcessGarages() if(CGarages::Garages[i].m_eGarageType == GARAGE_CRUSHER) { if(CGarages::Garages[i].m_eGarageState == GS_AFTERDROPOFF) { if(!(m_FrameCounter & 1)) { - 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::Garages[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 = 0; - m_sQueueSample - .field_16 = 4; - m_sQueueSample - .m_bEmittingVolume = - 60; - m_sQueueSample - .field_48 = 0.0; - m_sQueueSample - .m_fSoundIntensity = - 80.0f; - m_sQueueSample - .field_16 = 4; - m_sQueueSample - .m_bReverbFlag = 1; - //m_sQueueSample - // .m_bReverbFlag = 1; - m_sQueueSample - .m_bIsDistant = 0; - m_sQueueSample - .field_56 = 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 = - 1; - AddSampleToRequestedQueue(); - } - } - break; - default: continue; - } - } + LOOP_HELPER continue; } if(m_anRandomTable[1] & 1) { - sampleIndex = m_anRandomTable[2] % 5u + SFX_COL_CAR_1; + sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_CAR_1; } else { sampleIndex = - m_anRandomTable[2] % 6u + SFX_COL_CAR_PANEL_1; + m_anRandomTable[2] % 6 + SFX_COL_CAR_PANEL_1; } m_sQueueSample.m_nSampleIndex = sampleIndex; m_sQueueSample.m_nFrequency = @@ -4012,8 +3966,8 @@ cAudioManager::ProcessGarages() m_sQueueSample.field_56 = 1; m_sQueueSample.m_counter = iSound++; if(iSound < 32u) iSound = 32; - m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 3; m_sQueueSample.m_bEmittingVolume = 90; m_sQueueSample.m_nLoopStart = @@ -4022,84 +3976,12 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset( m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 2.0; + m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_bReverbFlag = 1; - m_sQueueSample.m_bRequireReflection = 0; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); - 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::Garages[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 = 0; - m_sQueueSample.field_16 = 4; - m_sQueueSample - .m_bEmittingVolume = 60; - m_sQueueSample.field_48 = 0.0; - m_sQueueSample - .m_fSoundIntensity = 80.0f; - m_sQueueSample.field_16 = 4; - m_sQueueSample.m_bReverbFlag = - 1; - //m_sQueueSample.m_bReverbFlag = - // 1; - m_sQueueSample.m_bIsDistant = 0; - m_sQueueSample.field_56 = 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 = 1; - AddSampleToRequestedQueue(); - } - } - break; - default: continue; - } - } + LOOP_HELPER continue; } m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; @@ -4112,73 +3994,25 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.field_76 = 3; m_sQueueSample.field_56 = 0; - m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 3; m_sQueueSample.m_bEmittingVolume = 90; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 2.0; + m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_bReverbFlag = 1; - m_sQueueSample.m_bRequireReflection = 0; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); - 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::Garages[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 = 0; - m_sQueueSample.field_16 = 4; - m_sQueueSample.m_bEmittingVolume = 60; - m_sQueueSample.field_48 = 0.0; - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.field_16 = 4; - m_sQueueSample.m_bReverbFlag = 1; - //m_sQueueSample.m_bReverbFlag = 1; - m_sQueueSample.m_bIsDistant = 0; - m_sQueueSample.field_56 = 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 = 1; - AddSampleToRequestedQueue(); - } - } - break; - default: continue; - } - } + LOOP_HELPER } } } } +#undef LOOP_HELPER } struct tHelicopterSampleData { @@ -5120,7 +4954,7 @@ cAudioManager::ProcessMissionAudio() static uint8 nFramesForPretendPlaying = 0; if(m_bIsInitialised) { - if(m_sMissionAudio.m_nSampleIndex != 3033) { + if(m_sMissionAudio.m_nSampleIndex != NO_SAMPLE) { switch(m_sMissionAudio.m_bLoadingStatus) { case 0: SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1); @@ -5141,7 +4975,7 @@ cAudioManager::ProcessMissionAudio() m_sMissionAudio.m_bPlayStatus = 1; } else { m_sMissionAudio.m_bPlayStatus = 2; - m_sMissionAudio.m_nSampleIndex = 3033; + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; } } } else { @@ -5161,7 +4995,7 @@ cAudioManager::ProcessMissionAudio() 2 || m_sMissionAudio.field_24-- == 0) { m_sMissionAudio.m_bPlayStatus = 2; - m_sMissionAudio.m_nSampleIndex = 3033; + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; SampleManager.StopStreamedFile(1); m_sMissionAudio.field_24 = 0; } @@ -5175,7 +5009,7 @@ cAudioManager::ProcessMissionAudio() SampleManager.PauseStream(0, 1); } else { m_sMissionAudio.m_bPlayStatus = 2; - m_sMissionAudio.m_nSampleIndex = 3033; + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; SampleManager.StopStreamedFile(1); m_sMissionAudio.field_24 = 0; } @@ -6978,7 +6812,7 @@ cAudioManager::ProcessProjectiles() case WEAPONTYPE_ROCKETLAUNCHER: emittingVol = maxVolume; maxDist = 8100.f; - m_sQueueSample.m_fSoundIntensity = 90.0; + m_sQueueSample.m_fSoundIntensity = 90.0f; m_sQueueSample.m_nSampleIndex = 81; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = @@ -6988,7 +6822,7 @@ cAudioManager::ProcessProjectiles() case WEAPONTYPE_MOLOTOV: emittingVol = 50; maxDist = 900.f; - m_sQueueSample.m_fSoundIntensity = 30.0; + m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = @@ -6997,7 +6831,7 @@ cAudioManager::ProcessProjectiles() break; default: return; } - m_sQueueSample.field_48 = 4.0; + m_sQueueSample.field_48 = 4.0f; m_sQueueSample.field_76 = 3; m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition(); float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); @@ -7373,7 +7207,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh) params.m_pVehicle = veh; params.m_pTransmission = nil; params.m_nIndex = 0; - params.m_fVelocityChange = 0.0; + params.m_fVelocityChange = 0.0f; if(handling) params.m_pTransmission = &handling->Transmission; @@ -7534,8 +7368,8 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params) m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 5.0; - m_sQueueSample.m_fSoundIntensity = 40.0; + m_sQueueSample.field_48 = 5.0f; + m_sQueueSample.m_fSoundIntensity = 40.0f; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; m_sQueueSample.m_bReverbFlag = true; @@ -7547,7 +7381,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params) if(automobile->m_nCarHornTimer > 44) automobile->m_nCarHornTimer = 44; if(automobile->m_nCarHornTimer == 44) automobile->field_22D = - (LOBYTE(m_FrameCounter) + LOBYTE(m_sQueueSample.m_nEntityIndex)) & 7; + (uint8(m_FrameCounter) + uint8(m_sQueueSample.m_nEntityIndex)) & 7; if(hornPatternsArray[automobile->field_22D][44 - automobile->m_nCarHornTimer]) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_bVolume = ComputeVolume(80, 40.f, m_sQueueSample.m_fDistance); @@ -7566,8 +7400,8 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params) m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 5.0; - m_sQueueSample.m_fSoundIntensity = 40.0; + m_sQueueSample.field_48 = 5.0f; + m_sQueueSample.m_fSoundIntensity = 40.0f; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; m_sQueueSample.m_bReverbFlag = true; @@ -7812,8 +7646,8 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 3.0; - m_sQueueSample.m_fSoundIntensity = 40.0; + m_sQueueSample.field_48 = 3.0f; + m_sQueueSample.m_fSoundIntensity = 40.0f; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; m_sQueueSample.m_bReverbFlag = true; @@ -8225,27 +8059,27 @@ cAudioManager::SetSpeakerConfig(int32 conf) const bool cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq) { - if(m_sQueueSample.m_fDistance >= 180.f) return 0; + if(m_sQueueSample.m_fDistance >= 180.f) return false; 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_nSampleIndex = SFX_JUMBO_ENGINE; - m_sQueueSample.m_bBankIndex = 0; - m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 1; m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bEmittingVolume = emittingVol; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 4.0; + m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_fSoundIntensity = 180.0f; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 4; - m_sQueueSample.m_bReverbFlag = 1; - m_sQueueSample.m_bRequireReflection = 0; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); } return true; diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp index dacb7aab..31214207 100644 --- a/src/control/Bridge.cpp +++ b/src/control/Bridge.cpp @@ -24,7 +24,7 @@ uint32& CBridge::TimeOfBridgeBecomingOperational = *(uint32*)0x8F2BC0; void CBridge::Init() { FindBridgeEntities(); - OldLift = -1.0; + OldLift = -1.0f; if (pLiftPart && pWeight) { DefaultZLiftPart = pLiftPart->GetPosition().z; @@ -60,32 +60,32 @@ void CBridge::Update() if (timeElapsed < 10000) { State = STATE_LIFT_PART_MOVING_DOWN; - liftHeight = 25.0 - timeElapsed / 10000.0 * 25.0; + liftHeight = 25.0 - timeElapsed / 10000.0 * 25.0f; } else if (timeElapsed < 40000) { - liftHeight = 0.0; + liftHeight = 0.0f; State = STATE_LIFT_PART_IS_DOWN; } else if (timeElapsed < 50000) { - liftHeight = 0.0; + liftHeight = 0.0f; State = STATE_LIFT_PART_ABOUT_TO_MOVE_UP; } else if (timeElapsed < 60000) { State = STATE_LIFT_PART_MOVING_UP; - liftHeight = (timeElapsed - 50000) / 10000.0 * 25.0; + liftHeight = (timeElapsed - 50000) / 10000.0 * 25.0f; } else { - liftHeight = 25.0; + liftHeight = 25.0f; State = STATE_LIFT_PART_IS_UP; } } else { - liftHeight = 25.0; + liftHeight = 25.0f; TimeOfBridgeBecomingOperational = 0; State = STATE_BRIDGE_LOCKED; } diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index 3a959049..daa27e57 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -991,7 +991,7 @@ float CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId) { if(m_pathNodes[nodeId].numLinks == 0) - return 0.0; + return 0.0f; CVector dir = m_pathNodes[m_connections[m_pathNodes[nodeId].firstLink]].pos - m_pathNodes[nodeId].pos; dir.z = 0.0f; dir.Normalise(); @@ -1008,7 +1008,7 @@ CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, flo CVector dir; if(m_pathNodes[nodeId].numLinks == 0) - return 0.0; + return 0.0f; int bestNode = m_connections[m_pathNodes[nodeId].firstLink]; #ifdef FIX_BUGS diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 67c59101..b4ec7a0b 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -704,7 +704,7 @@ CPickups::DoPickUpEffects(CEntity *entity) aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier, 4.0f, 1.0f, 40.0f, false, 0.0f); - float radius = (double)(rand() & 0xF) * 0.1 + 3.0; + float radius = (double)(rand() & 0xF) * 0.1 + 3.0f; CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true); float size = (double)(rand() & 0xF) * 0.0005 + 0.6; CCoronas::RegisterCorona( (uintptr)entity, diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 75c594cf..7c563492 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -174,7 +174,7 @@ void CMissionCleanup::Process() { CPopulation::m_AllRandomPedsThisType = -1; CPopulation::PedDensityMultiplier = 1.0f; - CCarCtrl::CarDensityMultiplier = 1.0; + CCarCtrl::CarDensityMultiplier = 1.0f; FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = 1.0f; TheCamera.Restore(); TheCamera.SetWideScreenOff(); diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 88c87c95..fc056038 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -416,17 +416,17 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl // BUG? is this ever used? // The values seem to be roughly m_fPedZoomValueSmooth + 1.85 if(ResetStatics){ - if(TheCamera.PedZoomIndicator == 1.0) m_fRealGroundDist = 2.090556f; - if(TheCamera.PedZoomIndicator == 2.0) m_fRealGroundDist = 3.34973f; - if(TheCamera.PedZoomIndicator == 3.0) m_fRealGroundDist = 4.704914f; - if(TheCamera.PedZoomIndicator == 4.0) m_fRealGroundDist = 2.090556f; + if(TheCamera.PedZoomIndicator == 1.0f) m_fRealGroundDist = 2.090556f; + if(TheCamera.PedZoomIndicator == 2.0f) m_fRealGroundDist = 3.34973f; + if(TheCamera.PedZoomIndicator == 3.0f) m_fRealGroundDist = 4.704914f; + if(TheCamera.PedZoomIndicator == 4.0f) m_fRealGroundDist = 2.090556f; } // And what is this? It's only used for collision and rotation it seems float RealGroundDist; - if(TheCamera.PedZoomIndicator == 1.0) RealGroundDist = 2.090556f; - if(TheCamera.PedZoomIndicator == 2.0) RealGroundDist = 3.34973f; - if(TheCamera.PedZoomIndicator == 3.0) RealGroundDist = 4.704914f; - if(TheCamera.PedZoomIndicator == 4.0) RealGroundDist = 2.090556f; + if(TheCamera.PedZoomIndicator == 1.0f) RealGroundDist = 2.090556f; + if(TheCamera.PedZoomIndicator == 2.0f) RealGroundDist = 3.34973f; + if(TheCamera.PedZoomIndicator == 3.0f) RealGroundDist = 4.704914f; + if(TheCamera.PedZoomIndicator == 4.0f) RealGroundDist = 2.090556f; if(m_fCloseInPedHeightOffset > 0.00001f) RealGroundDist = 1.7016; @@ -1344,30 +1344,30 @@ CCamera::SetCamCutSceneOffSet(const CVector &pos) void CCamera::TakeControlWithSpline(short nSwitch) { - m_iModeToGoTo = CCam::MODE_FLYBY; - m_bLookingAtPlayer = false; - m_bLookingAtVector = false; - m_bcutsceneFinished = false; - m_iTypeOfSwitch = nSwitch; - m_bStartInterScript = true; - + m_iModeToGoTo = CCam::MODE_FLYBY; + m_bLookingAtPlayer = false; + m_bLookingAtVector = false; + m_bcutsceneFinished = false; + m_iTypeOfSwitch = nSwitch; + m_bStartInterScript = true; + //FindPlayerPed(); // unused }; -void CCamera::SetCameraDirectlyInFrontForFollowPed_CamOnAString() -{ - m_bCamDirectlyInFront = true; - CPlayerPed *player = FindPlayerPed(); - if (player) - m_PedOrientForBehindOrInFront = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y); +void CCamera::SetCameraDirectlyInFrontForFollowPed_CamOnAString() +{ + m_bCamDirectlyInFront = true; + CPlayerPed *player = FindPlayerPed(); + if (player) + m_PedOrientForBehindOrInFront = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y); } -void CCamera::SetCameraDirectlyBehindForFollowPed_CamOnAString() -{ - m_bCamDirectlyBehind = true; - CPlayerPed *player = FindPlayerPed(); - if (player) - m_PedOrientForBehindOrInFront = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y); +void CCamera::SetCameraDirectlyBehindForFollowPed_CamOnAString() +{ + m_bCamDirectlyBehind = true; + CPlayerPed *player = FindPlayerPed(); + if (player) + m_PedOrientForBehindOrInFront = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y); } void @@ -1382,80 +1382,80 @@ CCamera::SetWideScreenOff(void) m_bWantsToSwitchWidescreenOff = m_WideScreenOn; } -void -CCamera::SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom) -{ - PlayerWeaponMode.Mode = mode; - PlayerWeaponMode.MaxZoom = maxZoom; - PlayerWeaponMode.MinZoom = minZoom; - PlayerWeaponMode.Duration = 0.0f; +void +CCamera::SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom) +{ + PlayerWeaponMode.Mode = mode; + PlayerWeaponMode.MaxZoom = maxZoom; + PlayerWeaponMode.MinZoom = minZoom; + PlayerWeaponMode.Duration = 0.0f; } -void -CCamera::UpdateAimingCoors(CVector const &coors) -{ - m_cvecAimingTargetCoors = coors; +void +CCamera::UpdateAimingCoors(CVector const &coors) +{ + m_cvecAimingTargetCoors = coors; } void CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffSet) { - m_vecFixedModeSource = Source; + m_vecFixedModeSource = Source; m_vecFixedModeUpOffSet = UpOffSet; } void CCamera::SetRwCamera(RwCamera *cam) { - m_pRwCamera = cam; - m_viewMatrix.Attach(&m_pRwCamera->viewMatrix, false); + m_pRwCamera = cam; + m_viewMatrix.Attach(&m_pRwCamera->viewMatrix, false); CMBlur::MotionBlurOpen(m_pRwCamera); } uint32 CCamera::GetCutSceneFinishTime(void) { - int cam = ActiveCam; - if (Cams[cam].Mode == CCam::MODE_FLYBY) - return Cams[cam].m_uiFinishTime; - cam = (cam + 1) % 2; - if (Cams[cam].Mode == CCam::MODE_FLYBY) - return Cams[cam].m_uiFinishTime; - + int cam = ActiveCam; + if (Cams[cam].Mode == CCam::MODE_FLYBY) + return Cams[cam].m_uiFinishTime; + cam = (cam + 1) % 2; + if (Cams[cam].Mode == CCam::MODE_FLYBY) + return Cams[cam].m_uiFinishTime; + return 0; } void CCamera::FinishCutscene(void) { - SetPercentAlongCutScene(100.0f); - m_fPositionAlongSpline = 1.0f; + SetPercentAlongCutScene(100.0f); + m_fPositionAlongSpline = 1.0f; m_bcutsceneFinished = true; } void CCamera::SetZoomValueFollowPedScript(int16 mode) -{ - switch (mode) { - case 0: m_fPedZoomValueScript = 0.25f; break; - case 1: m_fPedZoomValueScript = 1.5f; break; - case 2: m_fPedZoomValueScript = 2.9f; break; - default: m_fPedZoomValueScript = m_fPedZoomValueScript; break; - } - +{ + switch (mode) { + case 0: m_fPedZoomValueScript = 0.25f; break; + case 1: m_fPedZoomValueScript = 1.5f; break; + case 2: m_fPedZoomValueScript = 2.9f; break; + default: m_fPedZoomValueScript = m_fPedZoomValueScript; break; + } + m_bUseScriptZoomValuePed = true; } void CCamera::SetZoomValueCamStringScript(int16 mode) -{ - switch (mode) { - case 0: m_fCarZoomValueScript = 0.05f; break; - case 1: m_fCarZoomValueScript = 1.9f; break; - case 2: m_fCarZoomValueScript = 3.9f; break; - default: m_fCarZoomValueScript = m_fCarZoomValueScript; break; - } - +{ + switch (mode) { + case 0: m_fCarZoomValueScript = 0.05f; break; + case 1: m_fCarZoomValueScript = 1.9f; break; + case 2: m_fCarZoomValueScript = 3.9f; break; + default: m_fCarZoomValueScript = m_fCarZoomValueScript; break; + } + m_bUseScriptZoomValueCar = true; } diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp index 8695f64b..bcf84560 100644 --- a/src/core/Timer.cpp +++ b/src/core/Timer.cpp @@ -103,7 +103,7 @@ void CTimer::Update(void) { m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd; m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd; - ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0; + ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0f; } } else diff --git a/src/core/common.h b/src/core/common.h index 562a69b4..3127cb12 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -4,7 +4,6 @@ #define _USE_MATH_DEFINES #pragma warning(disable: 4244) // int to float #pragma warning(disable: 4800) // int to bool -#pragma warning(disable: 4305) // double to float #pragma warning(disable: 4838) // narrowing conversion #pragma warning(disable: 4996) // POSIX names diff --git a/src/core/main.cpp b/src/core/main.cpp index c13d3618..6043074f 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -216,7 +216,7 @@ Idle(void *arg) RenderEffects(); if((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) && - TheCamera.m_ScreenReductionPercentage > 0.0) + TheCamera.m_ScreenReductionPercentage > 0.0f) TheCamera.SetMotionBlurAlpha(150); TheCamera.RenderMotionBlur(); diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index fef5ec7f..faa8a484 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -1831,7 +1831,7 @@ CPhysical::ProcessCollision(void) if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){ if(ped->IsPlayer()) - n = max(NUMSTEPS(0.2f), 2.0); + n = max(NUMSTEPS(0.2f), 2.0f); else n = NUMSTEPS(0.3f); step = savedTimeStep / n; diff --git a/src/objects/ObjectData.cpp b/src/objects/ObjectData.cpp index 92e9d544..aa58a845 100644 --- a/src/objects/ObjectData.cpp +++ b/src/objects/ObjectData.cpp @@ -90,7 +90,7 @@ CObjectData::SetObjectData(int32 modelId, CObject &object) object.m_nCollisionDamageEffect = objinfo->m_nCollisionDamageEffect; object.m_nSpecialCollisionResponseCases = objinfo->m_nSpecialCollisionResponseCases; object.m_bCameraToAvoidThisObject = objinfo->m_bCameraToAvoidThisObject; - if(object.m_fMass >= 99998.0){ + if(object.m_fMass >= 99998.0f){ object.bInfiniteMass = true; object.bAffectedByGravity = false; object.bExplosionProof = true; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index b7dbab82..45590b07 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -7642,21 +7642,21 @@ CPed::Flee(void) else if (PI + angleToFleeEntity < angleToFleeDamagingThing) angleToFleeDamagingThing -= TWOPI; - if (damagingThingPriorityMult <= 1.0) { + if (damagingThingPriorityMult <= 1.0f) { // Range [0.0, 1.0] - double angleToFleeBoth = (angleToFleeDamagingThing + angleToFleeEntity) * 0.5; + float angleToFleeBoth = (angleToFleeDamagingThing + angleToFleeEntity) * 0.5f; if (m_fRotationDest - PI > angleToFleeBoth) angleToFleeBoth += TWOPI; else if (PI + m_fRotationDest < angleToFleeBoth) angleToFleeBoth -= TWOPI; - m_fRotationDest = (1.0 - damagingThingPriorityMult) * m_fRotationDest + damagingThingPriorityMult * angleToFleeBoth; + m_fRotationDest = (1.0f - damagingThingPriorityMult) * m_fRotationDest + damagingThingPriorityMult * angleToFleeBoth; } else { // Range (1.0, 1.5] - double adjustedMult = (damagingThingPriorityMult - 1.0) * 2.0; + double adjustedMult = (damagingThingPriorityMult - 1.0f) * 2.0f; m_fRotationDest = angleToFleeEntity * (1.0 - adjustedMult) + adjustedMult * angleToFleeDamagingThing; } } else { @@ -17676,4 +17676,4 @@ STARTPATCHES InjectHook(0x4E52A0, &CPed::WarpPedToNearLeaderOffScreen, PATCH_JUMP); InjectHook(0x4E0220, &CPed::SetCarJack, PATCH_JUMP); InjectHook(0x4D6780, &CPed::Solicit, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +ENDPATCHES diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index bb5ec475..9876f946 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -1170,4 +1170,4 @@ STARTPATCHES InjectHook(0x4F4690, &CPopulation::TestRoomForDummyObject, PATCH_JUMP); InjectHook(0x4F45A0, &CPopulation::ConvertToDummyObject, PATCH_JUMP); InjectHook(0x4F4410, &CPopulation::ConvertAllObjectsToDummyObjects, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +ENDPATCHES diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index 7d7242e4..b0868d0a 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -457,7 +457,7 @@ CCoronas::RenderReflections(void) continue; // Don't draw if reflection is too high - if(aCoronas[i].heightAboveRoad < 20.0){ + if(aCoronas[i].heightAboveRoad < 20.0f){ // don't draw if camera is below road if(CCoronas::aCoronas[i].coors.z - aCoronas[i].heightAboveRoad > TheCamera.GetPosition().z) continue; diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 2d059516..7a16ad03 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -84,7 +84,7 @@ CFont::Initialise(void) Sprite[2].SetTexture("font1", "font1_mask"); SetScale(1.0f, 1.0f); SetSlantRefPoint(SCREEN_WIDTH, 0.0f); - SetSlant(0.0); + SetSlant(0.0f); SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0)); SetJustifyOff(); SetCentreOff(); @@ -95,7 +95,7 @@ CFont::Initialise(void) SetBackGroundOnlyTextOff(); SetPropOn(); SetFontStyle(0); - SetRightJustifyWrap(0.0); + SetRightJustifyWrap(0.0f); SetAlphaFade(255.0f); SetDropShadowPosition(0); CTxdStore::PopCurrentTxd(); diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index b87f7c71..f0134062 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -611,15 +611,15 @@ void CHud::Draw() /* DrawClock */ - CFont::SetJustifyOff(); - CFont::SetCentreOff(); - CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); - CFont::SetBackGroundOnlyTextOff(); - CFont::SetPropOff(); - CFont::SetFontStyle(FONT_HEADING); - CFont::SetRightJustifyOn(); - CFont::SetRightJustifyWrap(0.0); + CFont::SetJustifyOff(); + CFont::SetCentreOff(); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetPropOff(); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes()); AsciiToUnicode(sTemp, sPrint); @@ -702,21 +702,21 @@ void CHud::Draw() AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer); CFont::SetPropOn(); - CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); - CFont::SetCentreOff(); - CFont::SetRightJustifyOn(); - CFont::SetRightJustifyWrap(0.0f); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); + CFont::SetCentreOff(); + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); CFont::SetFontStyle(FONT_HEADING); - CFont::SetColor(CRGBA(244, 20, 20, 255)); - CFont::SetWrapx(SCREEN_SCALE_X(640.0f)); - CFont::SetPropOff(); + CFont::SetColor(CRGBA(244, 20, 20, 255)); + CFont::SetWrapx(SCREEN_SCALE_X(640.0f)); + CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); - CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), sTimer); - CFont::SetColor(CRGBA(0, 106, 164, 255)); + CFont::SetColor(CRGBA(0, 106, 164, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(132.0f), sTimer); } else { int counter = atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer); @@ -728,7 +728,7 @@ void CHud::Draw() } if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) { - CFont::SetPropOn(); + CFont::SetPropOn(); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); @@ -773,7 +773,7 @@ void CHud::Draw() fStep = 2.0f; PagerXOffset += fStep * CTimer::GetTimeStep(); if (PagerXOffset > 150.0f) { - PagerXOffset = 150.0; + PagerXOffset = 150.0f; PagerOn = 0; } } @@ -934,13 +934,13 @@ void CHud::Draw() BigMessageInUse[0] += CTimer::GetTimeStep(); if (BigMessageInUse[0] >= 120.0f) { - BigMessageInUse[0] = 120.0; + BigMessageInUse[0] = 120.0f; BigMessageAlpha[0] -= (CTimer::GetTimeStepInMilliseconds() * 0.3f); } if (BigMessageAlpha[0] <= 0.0f) { m_BigMessage[0][0] = 0; - BigMessageAlpha[0] = 0.0; + BigMessageAlpha[0] = 0.0f; } } else { @@ -977,7 +977,7 @@ void CHud::Draw() BigMessageAlpha[2] += (CTimer::GetTimeStepInSeconds() * 255.0f); if (BigMessageAlpha[2] > 255.0f) - BigMessageAlpha[2] = 255.0; + BigMessageAlpha[2] = 255.0f; CFont::SetBackgroundOff(); @@ -997,12 +997,12 @@ void CHud::Draw() CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]); } else { - BigMessageAlpha[2] = 0.0; - BigMessageInUse[2] = 1.0; + BigMessageAlpha[2] = 0.0f; + BigMessageInUse[2] = 1.0f; } } else { - BigMessageInUse[2] = 0.0; + BigMessageInUse[2] = 0.0f; } } } @@ -1231,12 +1231,12 @@ void CHud::DrawAfterFade() BigMessageInUse[1] += CTimer::GetTimeStep(); if (BigMessageInUse[1] >= 120.0f) { - BigMessageInUse[1] = 120.0; + BigMessageInUse[1] = 120.0f; BigMessageAlpha[1] -= (CTimer::GetTimeStepInMilliseconds() * 0.3f); } if (BigMessageAlpha[1] <= 0) { m_BigMessage[1][0] = 0; - BigMessageAlpha[1] = 0.0; + BigMessageAlpha[1] = 0.0f; } } else { diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index e0b3313f..18ef0017 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -115,47 +115,47 @@ void CBulletTrace::Update(void) WRAPPER void CBrightLights::RegisterOne(CVector pos, CVector up, CVector right, CVector fwd, uint8 type, uint8 unk1, uint8 unk2, uint8 unk3) { EAXJMP(0x51A410); } -RpAtomic * -MarkerAtomicCB(RpAtomic *atomic, void *data) -{ - *(RpAtomic**)data = atomic; - return atomic; +RpAtomic * +MarkerAtomicCB(RpAtomic *atomic, void *data) +{ + *(RpAtomic**)data = atomic; + return atomic; } -bool -C3dMarker::AddMarker(uint32 identifier, uint16 type, float fSize, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate) -{ - m_nIdentifier = identifier; - - m_Matrix.SetUnity(); - - RpAtomic *origAtomic; - origAtomic = nil; - RpClumpForAllAtomics(C3dMarkers::m_pRpClumpArray[type], MarkerAtomicCB, &origAtomic); - - RpAtomic *atomic = RpAtomicClone(origAtomic); - RwFrame *frame = RwFrameCreate(); - RpAtomicSetFrame(atomic, frame); - CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil); - - RpGeometry *geometry = RpAtomicGetGeometry(atomic); - RpGeometrySetFlags(geometry, RpGeometryGetFlags(geometry) | rpGEOMETRYMODULATEMATERIALCOLOR); - - m_pAtomic = atomic; - m_Matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame(m_pAtomic))); - m_pMaterial = RpGeometryGetMaterial(geometry, 0); - m_fSize = fSize; - m_fStdSize = m_fSize; - m_Color.red = r; - m_Color.green = g; - m_Color.blue = b; - m_Color.alpha = a; - m_nPulsePeriod = pulsePeriod; - m_fPulseFraction = pulseFraction; - m_nRotateRate = rotateRate; - m_nStartTime = CTimer::GetTimeInMilliseconds(); - m_nType = type; - return m_pAtomic != nil; +bool +C3dMarker::AddMarker(uint32 identifier, uint16 type, float fSize, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate) +{ + m_nIdentifier = identifier; + + m_Matrix.SetUnity(); + + RpAtomic *origAtomic; + origAtomic = nil; + RpClumpForAllAtomics(C3dMarkers::m_pRpClumpArray[type], MarkerAtomicCB, &origAtomic); + + RpAtomic *atomic = RpAtomicClone(origAtomic); + RwFrame *frame = RwFrameCreate(); + RpAtomicSetFrame(atomic, frame); + CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil); + + RpGeometry *geometry = RpAtomicGetGeometry(atomic); + RpGeometrySetFlags(geometry, RpGeometryGetFlags(geometry) | rpGEOMETRYMODULATEMATERIALCOLOR); + + m_pAtomic = atomic; + m_Matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame(m_pAtomic))); + m_pMaterial = RpGeometryGetMaterial(geometry, 0); + m_fSize = fSize; + m_fStdSize = m_fSize; + m_Color.red = r; + m_Color.green = g; + m_Color.blue = b; + m_Color.alpha = a; + m_nPulsePeriod = pulsePeriod; + m_fPulseFraction = pulseFraction; + m_nRotateRate = rotateRate; + m_nStartTime = CTimer::GetTimeInMilliseconds(); + m_nType = type; + return m_pAtomic != nil; } void @@ -163,238 +163,238 @@ C3dMarker::DeleteMarkerObject() { RwFrame *frame; - m_nIdentifier = 0; - m_nStartTime = 0; - m_bIsUsed = false; - m_nType = MARKERTYPE_INVALID; - - frame = RpAtomicGetFrame(m_pAtomic); - RpAtomicDestroy(m_pAtomic); - RwFrameDestroy(frame); + m_nIdentifier = 0; + m_nStartTime = 0; + m_bIsUsed = false; + m_nType = MARKERTYPE_INVALID; + + frame = RpAtomicGetFrame(m_pAtomic); + RpAtomicDestroy(m_pAtomic); + RwFrameDestroy(frame); m_pAtomic = nil; } -void -C3dMarker::Render() -{ - if (m_pAtomic == nil) return; - - RwRGBA *color = RpMaterialGetColor(m_pMaterial); - *color = m_Color; - - m_Matrix.UpdateRW(); - - CMatrix matrix; - matrix.Attach(m_Matrix.m_attachment); - matrix.Scale(m_fSize); - matrix.UpdateRW(); - - RwFrameUpdateObjects(RpAtomicGetFrame(m_pAtomic)); - SetBrightMarkerColours(m_fBrightness); - if (m_nType != MARKERTYPE_ARROW) - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); - RpAtomicRender(m_pAtomic); - if (m_nType != MARKERTYPE_ARROW) - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); - ReSetAmbientAndDirectionalColours(); +void +C3dMarker::Render() +{ + if (m_pAtomic == nil) return; + + RwRGBA *color = RpMaterialGetColor(m_pMaterial); + *color = m_Color; + + m_Matrix.UpdateRW(); + + CMatrix matrix; + matrix.Attach(m_Matrix.m_attachment); + matrix.Scale(m_fSize); + matrix.UpdateRW(); + + RwFrameUpdateObjects(RpAtomicGetFrame(m_pAtomic)); + SetBrightMarkerColours(m_fBrightness); + if (m_nType != MARKERTYPE_ARROW) + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + RpAtomicRender(m_pAtomic); + if (m_nType != MARKERTYPE_ARROW) + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); + ReSetAmbientAndDirectionalColours(); } C3dMarker(&C3dMarkers::m_aMarkerArray)[NUM3DMARKERS] = *(C3dMarker(*)[NUM3DMARKERS])*(uintptr*)0x72D408; int32 &C3dMarkers::NumActiveMarkers = *(int32*)0x8F2A08; RpClump* (&C3dMarkers::m_pRpClumpArray)[NUMMARKERTYPES] = *(RpClump*(*)[NUMMARKERTYPES])*(uintptr*)0x8E2888; -void -C3dMarkers::Init() -{ - for (int i = 0; i < NUM3DMARKERS; i++) { - m_aMarkerArray[i].m_pAtomic = nil; - m_aMarkerArray[i].m_nType = MARKERTYPE_INVALID; - m_aMarkerArray[i].m_bIsUsed = false; - m_aMarkerArray[i].m_nIdentifier = 0; - m_aMarkerArray[i].m_Color.red = 255; - m_aMarkerArray[i].m_Color.green = 255; - m_aMarkerArray[i].m_Color.blue = 255; - m_aMarkerArray[i].m_Color.alpha = 255; - m_aMarkerArray[i].m_nPulsePeriod = 1024; - m_aMarkerArray[i].m_nRotateRate = 5; - m_aMarkerArray[i].m_nStartTime = 0; - m_aMarkerArray[i].m_fPulseFraction = 0.25f; - m_aMarkerArray[i].m_fStdSize = 1.0f; - m_aMarkerArray[i].m_fSize = 1.0f; - m_aMarkerArray[i].m_fBrightness = 1.0f; - m_aMarkerArray[i].m_fCameraRange = 0.0f; - } - NumActiveMarkers = 0; - int txdSlot = CTxdStore::FindTxdSlot("particle"); - CTxdStore::PushCurrentTxd(); - CTxdStore::SetCurrentTxd(txdSlot); - CFileMgr::ChangeDir("\\"); - m_pRpClumpArray[MARKERTYPE_ARROW] = CFileLoader::LoadAtomicFile2Return("models/generic/arrow.dff"); - m_pRpClumpArray[MARKERTYPE_CYLINDER] = CFileLoader::LoadAtomicFile2Return("models/generic/zonecylb.dff"); - CTxdStore::PopCurrentTxd(); +void +C3dMarkers::Init() +{ + for (int i = 0; i < NUM3DMARKERS; i++) { + m_aMarkerArray[i].m_pAtomic = nil; + m_aMarkerArray[i].m_nType = MARKERTYPE_INVALID; + m_aMarkerArray[i].m_bIsUsed = false; + m_aMarkerArray[i].m_nIdentifier = 0; + m_aMarkerArray[i].m_Color.red = 255; + m_aMarkerArray[i].m_Color.green = 255; + m_aMarkerArray[i].m_Color.blue = 255; + m_aMarkerArray[i].m_Color.alpha = 255; + m_aMarkerArray[i].m_nPulsePeriod = 1024; + m_aMarkerArray[i].m_nRotateRate = 5; + m_aMarkerArray[i].m_nStartTime = 0; + m_aMarkerArray[i].m_fPulseFraction = 0.25f; + m_aMarkerArray[i].m_fStdSize = 1.0f; + m_aMarkerArray[i].m_fSize = 1.0f; + m_aMarkerArray[i].m_fBrightness = 1.0f; + m_aMarkerArray[i].m_fCameraRange = 0.0f; + } + NumActiveMarkers = 0; + int txdSlot = CTxdStore::FindTxdSlot("particle"); + CTxdStore::PushCurrentTxd(); + CTxdStore::SetCurrentTxd(txdSlot); + CFileMgr::ChangeDir("\\"); + m_pRpClumpArray[MARKERTYPE_ARROW] = CFileLoader::LoadAtomicFile2Return("models/generic/arrow.dff"); + m_pRpClumpArray[MARKERTYPE_CYLINDER] = CFileLoader::LoadAtomicFile2Return("models/generic/zonecylb.dff"); + CTxdStore::PopCurrentTxd(); } -void -C3dMarkers::Shutdown() -{ - for (int i = 0; i < NUM3DMARKERS; i++) { - if (m_aMarkerArray[i].m_pAtomic != nil) - m_aMarkerArray[i].DeleteMarkerObject(); - } - - for (int i = 0; i < NUMMARKERTYPES; i++) { - if (m_pRpClumpArray[i] != nil) - RpClumpDestroy(m_pRpClumpArray[i]); - } +void +C3dMarkers::Shutdown() +{ + for (int i = 0; i < NUM3DMARKERS; i++) { + if (m_aMarkerArray[i].m_pAtomic != nil) + m_aMarkerArray[i].DeleteMarkerObject(); + } + + for (int i = 0; i < NUMMARKERTYPES; i++) { + if (m_pRpClumpArray[i] != nil) + RpClumpDestroy(m_pRpClumpArray[i]); + } } -void -C3dMarkers::Render() -{ - NumActiveMarkers = 0; - ActivateDirectional(); - for (int i = 0; i < NUM3DMARKERS; i++) { - if (m_aMarkerArray[i].m_bIsUsed) { - if (m_aMarkerArray[i].m_fCameraRange < 120.0f) - m_aMarkerArray[i].Render(); - NumActiveMarkers++; - m_aMarkerArray[i].m_bIsUsed = false; - } else if (m_aMarkerArray[i].m_pAtomic != nil) { - m_aMarkerArray[i].DeleteMarkerObject(); - } - } +void +C3dMarkers::Render() +{ + NumActiveMarkers = 0; + ActivateDirectional(); + for (int i = 0; i < NUM3DMARKERS; i++) { + if (m_aMarkerArray[i].m_bIsUsed) { + if (m_aMarkerArray[i].m_fCameraRange < 120.0f) + m_aMarkerArray[i].Render(); + NumActiveMarkers++; + m_aMarkerArray[i].m_bIsUsed = false; + } else if (m_aMarkerArray[i].m_pAtomic != nil) { + m_aMarkerArray[i].DeleteMarkerObject(); + } + } } -C3dMarker * +C3dMarker * C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate) { - C3dMarker *pMarker; - - pMarker = nil; - float dist = Sqrt((pos.x - FindPlayerCentreOfWorld(0).x) * (pos.x - FindPlayerCentreOfWorld(0).x) + (pos.y - FindPlayerCentreOfWorld(0).y) * (pos.y - FindPlayerCentreOfWorld(0).y)); - - if (type != MARKERTYPE_ARROW && type != MARKERTYPE_CYLINDER) return nil; - - for (int i = 0; i < NUM3DMARKERS; i++) { - if (!m_aMarkerArray[i].m_bIsUsed && m_aMarkerArray[i].m_nIdentifier == identifier) { - pMarker = &m_aMarkerArray[i]; - break; - } - } - - if (pMarker == nil) { - for (int i = 0; i < NUM3DMARKERS; i++) { - if (m_aMarkerArray[i].m_nType == MARKERTYPE_INVALID) { - pMarker = &m_aMarkerArray[i]; - break; - } - } - } - - if (pMarker == nil && type == MARKERTYPE_ARROW) { - for (int i = 0; i < NUM3DMARKERS; i++) { - if (dist < m_aMarkerArray[i].m_fCameraRange && m_aMarkerArray[i].m_nType == MARKERTYPE_ARROW && (pMarker == nil || m_aMarkerArray[i].m_fCameraRange > pMarker->m_fCameraRange)) { - pMarker = &m_aMarkerArray[i]; - break; - } - } - - if (pMarker != nil) - pMarker->m_nType = MARKERTYPE_INVALID; - } - - if (pMarker == nil) return pMarker; - - pMarker->m_fCameraRange = dist; - if (pMarker->m_nIdentifier == identifier && pMarker->m_nType == type) { - if (type == MARKERTYPE_ARROW) { - if (dist < 25.0f) { - if (dist > 5.0f) - pMarker->m_fStdSize = size - (25.0f - dist) * (0.3f * size) / 20.0f; - else - pMarker->m_fStdSize = size - 0.3f * size; - } else { - pMarker->m_fStdSize = size; - } - } else if (type == MARKERTYPE_CYLINDER) { - if (dist < size + 12.0f) { - if (dist > size + 1.0f) - pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a; - else - pMarker->m_Color.alpha = (float)a * 0.3f; - } else { - pMarker->m_Color.alpha = a; - } - } - float someSin = Sin(TWOPI * (float)((pMarker->m_nPulsePeriod - 1) & (CTimer::GetTimeInMilliseconds() - pMarker->m_nStartTime)) / (float)pMarker->m_nPulsePeriod); - pMarker->m_fSize = pMarker->m_fStdSize - pulseFraction * pMarker->m_fStdSize * someSin; - - if (type == MARKERTYPE_ARROW) { - pos.z += 0.25f * pMarker->m_fStdSize * someSin; - } else if (type == MARKERTYPE_0) { - if (someSin > 0.0f) - pMarker->m_Color.alpha = (float)a * 0.7f * someSin + a; - else - pMarker->m_Color.alpha = (float)a * 0.4f * someSin + a; - } - if (pMarker->m_nRotateRate) { - RwV3d pos = pMarker->m_Matrix.m_matrix.pos; - pMarker->m_Matrix.RotateZ(DEGTORAD(pMarker->m_nRotateRate * CTimer::GetTimeStep())); - pMarker->m_Matrix.GetPosition() = pos; - } - if (type == MARKERTYPE_ARROW) - pMarker->m_Matrix.GetPosition() = pos; - pMarker->m_bIsUsed = true; - return pMarker; - } - - if (pMarker->m_nIdentifier != 0) - pMarker->DeleteMarkerObject(); - - pMarker->AddMarker(identifier, type, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate); - if (type == MARKERTYPE_CYLINDER || type == MARKERTYPE_0 || type == MARKERTYPE_2) { - float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil); - if (z != 0.0f) - pos.z = z - 0.05f * size; - } - pMarker->m_Matrix.SetTranslate(pos.x, pos.y, pos.z); - if (type == MARKERTYPE_2) { - pMarker->m_Matrix.RotateX(PI); - pMarker->m_Matrix.GetPosition() = pos; - } - pMarker->m_Matrix.UpdateRW(); - if (type == MARKERTYPE_ARROW) { - if (dist < 25.0f) { - if (dist > 5.0f) - pMarker->m_fStdSize = size - (25.0f - dist) * (0.3f * size) / 20.0f; - else - pMarker->m_fStdSize = size - 0.3f * size; - } else { - pMarker->m_fStdSize = size; - } - } else if (type == MARKERTYPE_CYLINDER) { - if (dist < size + 12.0f) { - if (dist > size + 1.0f) - pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a; - else - pMarker->m_Color.alpha = (float)a * 0.3f; - } else { - pMarker->m_Color.alpha = a; - } - } - pMarker->m_bIsUsed = true; + C3dMarker *pMarker; + + pMarker = nil; + float dist = Sqrt((pos.x - FindPlayerCentreOfWorld(0).x) * (pos.x - FindPlayerCentreOfWorld(0).x) + (pos.y - FindPlayerCentreOfWorld(0).y) * (pos.y - FindPlayerCentreOfWorld(0).y)); + + if (type != MARKERTYPE_ARROW && type != MARKERTYPE_CYLINDER) return nil; + + for (int i = 0; i < NUM3DMARKERS; i++) { + if (!m_aMarkerArray[i].m_bIsUsed && m_aMarkerArray[i].m_nIdentifier == identifier) { + pMarker = &m_aMarkerArray[i]; + break; + } + } + + if (pMarker == nil) { + for (int i = 0; i < NUM3DMARKERS; i++) { + if (m_aMarkerArray[i].m_nType == MARKERTYPE_INVALID) { + pMarker = &m_aMarkerArray[i]; + break; + } + } + } + + if (pMarker == nil && type == MARKERTYPE_ARROW) { + for (int i = 0; i < NUM3DMARKERS; i++) { + if (dist < m_aMarkerArray[i].m_fCameraRange && m_aMarkerArray[i].m_nType == MARKERTYPE_ARROW && (pMarker == nil || m_aMarkerArray[i].m_fCameraRange > pMarker->m_fCameraRange)) { + pMarker = &m_aMarkerArray[i]; + break; + } + } + + if (pMarker != nil) + pMarker->m_nType = MARKERTYPE_INVALID; + } + + if (pMarker == nil) return pMarker; + + pMarker->m_fCameraRange = dist; + if (pMarker->m_nIdentifier == identifier && pMarker->m_nType == type) { + if (type == MARKERTYPE_ARROW) { + if (dist < 25.0f) { + if (dist > 5.0f) + pMarker->m_fStdSize = size - (25.0f - dist) * (0.3f * size) / 20.0f; + else + pMarker->m_fStdSize = size - 0.3f * size; + } else { + pMarker->m_fStdSize = size; + } + } else if (type == MARKERTYPE_CYLINDER) { + if (dist < size + 12.0f) { + if (dist > size + 1.0f) + pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a; + else + pMarker->m_Color.alpha = (float)a * 0.3f; + } else { + pMarker->m_Color.alpha = a; + } + } + float someSin = Sin(TWOPI * (float)((pMarker->m_nPulsePeriod - 1) & (CTimer::GetTimeInMilliseconds() - pMarker->m_nStartTime)) / (float)pMarker->m_nPulsePeriod); + pMarker->m_fSize = pMarker->m_fStdSize - pulseFraction * pMarker->m_fStdSize * someSin; + + if (type == MARKERTYPE_ARROW) { + pos.z += 0.25f * pMarker->m_fStdSize * someSin; + } else if (type == MARKERTYPE_0) { + if (someSin > 0.0f) + pMarker->m_Color.alpha = (float)a * 0.7f * someSin + a; + else + pMarker->m_Color.alpha = (float)a * 0.4f * someSin + a; + } + if (pMarker->m_nRotateRate) { + RwV3d pos = pMarker->m_Matrix.m_matrix.pos; + pMarker->m_Matrix.RotateZ(DEGTORAD(pMarker->m_nRotateRate * CTimer::GetTimeStep())); + pMarker->m_Matrix.GetPosition() = pos; + } + if (type == MARKERTYPE_ARROW) + pMarker->m_Matrix.GetPosition() = pos; + pMarker->m_bIsUsed = true; + return pMarker; + } + + if (pMarker->m_nIdentifier != 0) + pMarker->DeleteMarkerObject(); + + pMarker->AddMarker(identifier, type, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate); + if (type == MARKERTYPE_CYLINDER || type == MARKERTYPE_0 || type == MARKERTYPE_2) { + float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil); + if (z != 0.0f) + pos.z = z - 0.05f * size; + } + pMarker->m_Matrix.SetTranslate(pos.x, pos.y, pos.z); + if (type == MARKERTYPE_2) { + pMarker->m_Matrix.RotateX(PI); + pMarker->m_Matrix.GetPosition() = pos; + } + pMarker->m_Matrix.UpdateRW(); + if (type == MARKERTYPE_ARROW) { + if (dist < 25.0f) { + if (dist > 5.0f) + pMarker->m_fStdSize = size - (25.0f - dist) * (0.3f * size) / 20.0f; + else + pMarker->m_fStdSize = size - 0.3f * size; + } else { + pMarker->m_fStdSize = size; + } + } else if (type == MARKERTYPE_CYLINDER) { + if (dist < size + 12.0f) { + if (dist > size + 1.0f) + pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a; + else + pMarker->m_Color.alpha = (float)a * 0.3f; + } else { + pMarker->m_Color.alpha = a; + } + } + pMarker->m_bIsUsed = true; return pMarker; } -void -C3dMarkers::PlaceMarkerSet(uint32 id, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate) -{ - PlaceMarker(id, type, pos, size, r, g, b, a, pulsePeriod, pulseFraction, 1); - PlaceMarker(id, type, pos, size * 0.93f, r, g, b, a, pulsePeriod, pulseFraction, 2); - PlaceMarker(id, type, pos, size * 0.86f, r, g, b, a, pulsePeriod, pulseFraction, -1); +void +C3dMarkers::PlaceMarkerSet(uint32 id, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate) +{ + PlaceMarker(id, type, pos, size, r, g, b, a, pulsePeriod, pulseFraction, 1); + PlaceMarker(id, type, pos, size * 0.93f, r, g, b, a, pulsePeriod, pulseFraction, 2); + PlaceMarker(id, type, pos, size * 0.86f, r, g, b, a, pulsePeriod, pulseFraction, -1); } - + void C3dMarkers::Update() { @@ -402,151 +402,151 @@ C3dMarkers::Update() #define MONEY_MESSAGE_LIFETIME_MS 2000 -CMoneyMessage CMoneyMessages::aMoneyMessages[NUMMONEYMESSAGES]; - -void -CMoneyMessage::Render() -{ - const float MAX_SCALE = 4.0f; - uint32 nLifeTime = CTimer::GetTimeInMilliseconds() - m_nTimeRegistered; - if (nLifeTime >= MONEY_MESSAGE_LIFETIME_MS) m_nTimeRegistered = 0; - else { - float fLifeTime = (float)nLifeTime / MONEY_MESSAGE_LIFETIME_MS; - RwV3d vecOut; - float fDistX, fDistY; - if (CSprite::CalcScreenCoors(m_vecPosition + CVector(0.0f, 0.0f, fLifeTime), &vecOut, &fDistX, &fDistY, true)) { - fDistX *= (0.7 * fLifeTime + 2.0) * m_fSize; - fDistY *= (0.7 * fLifeTime + 2.0) * m_fSize; - CFont::SetPropOn(); - CFont::SetBackgroundOff(); - - float fScaleY = fDistY / 100.0f; - if (fScaleY > MAX_SCALE) fScaleY = MAX_SCALE; - - float fScaleX = fDistX / 100.0f; - if (fScaleX > MAX_SCALE) fScaleX = MAX_SCALE; - - CFont::SetScale(fScaleX, fScaleY); // maybe use SCREEN_SCALE_X and SCREEN_SCALE_Y here? - CFont::SetCentreOn(); - CFont::SetCentreSize(SCREEN_WIDTH); - CFont::SetJustifyOff(); - CFont::SetColor(CRGBA(m_Colour.r, m_Colour.g, m_Colour.b, (255.0f - 255.0f * fLifeTime) * m_fOpacity)); - CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); - CFont::PrintString(vecOut.x, vecOut.y, m_aText); - } - } -} - -void -CMoneyMessages::Init() -{ - for (int32 i = 0; i < NUMMONEYMESSAGES; i++) - aMoneyMessages[i].m_nTimeRegistered = 0; -} - -void -CMoneyMessages::Render() -{ - for (int32 i = 0; i < NUMMONEYMESSAGES; i++) { - if (aMoneyMessages[i].m_nTimeRegistered != 0) - aMoneyMessages[i].Render(); - } -} - -void -CMoneyMessages::RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8 bGreen, uint8 bBlue, float fSize, float fOpacity) -{ - uint32 nIndex = 0; - while (aMoneyMessages[nIndex].m_nTimeRegistered != 0) { - if (++nIndex >= NUMMONEYMESSAGES) return; - } - - // Add data of this money message to the array - AsciiToUnicode(pText, aMoneyMessages[nIndex].m_aText); - - aMoneyMessages[nIndex].m_nTimeRegistered = CTimer::GetTimeInMilliseconds(); - aMoneyMessages[nIndex].m_vecPosition = vecPos; - aMoneyMessages[nIndex].m_Colour.red = bRed; - aMoneyMessages[nIndex].m_Colour.green = bGreen; - aMoneyMessages[nIndex].m_Colour.blue = bBlue; - aMoneyMessages[nIndex].m_fSize = fSize; - aMoneyMessages[nIndex].m_fOpacity = fOpacity; -} - -CRGBA FoamColour(255, 255, 255, 255); -unsigned int CSpecialParticleStuff::BoatFromStart; - -void -CSpecialParticleStuff::CreateFoamAroundObject(CMatrix* pMatrix, float innerFw, float innerRg, float innerUp, int32 particles) -{ - float outerFw = innerFw + 5.0f; - float outerRg = innerRg + 5.0f; - float outerUp = innerUp + 5.0f; - for (int attempts = 0; particles > 0 && attempts < 1000; attempts++) { - CVector pos; - int rnd = CGeneral::GetRandomNumber(); - pos.x = (int8)(rnd - 128) * innerFw / 110.0f; - pos.y = (int8)((rnd >> 8) - 128) * innerFw / 110.0f; - pos.z = 0.0f; - if (DotProduct2D(pos, TheCamera.GetForward()) >= 0) - continue; - // was there any point in adding it here? - pos += pMatrix->GetPosition(); - pos.z = 2.0f; - float fw = Abs(DotProduct(pMatrix->GetForward(), pos - pMatrix->GetPosition())); - if (fw >= outerFw) - continue; - float rg = Abs(DotProduct(pMatrix->GetRight(), pos - pMatrix->GetPosition())); - if (rg >= outerRg) - continue; - float up = Abs(DotProduct(pMatrix->GetUp(), pos - pMatrix->GetPosition())); - if (up >= outerUp) - continue; - if (fw > innerFw || rg > innerRg || up > innerUp) { - CParticle::AddParticle(PARTICLE_STEAM2, pos, CVector(0.0f, 0.0f, 0.0f), nil, 4.0f, FoamColour, 1, 0, 0, 0); - particles--; - } - } -} - -void -CSpecialParticleStuff::StartBoatFoamAnimation() -{ - BoatFromStart = CTimer::GetTimeInMilliseconds(); -} - -void -CSpecialParticleStuff::UpdateBoatFoamAnimation(CMatrix* pMatrix) -{ - static int32 FrameInAnimation = 0; - static float X, Y, Z, dX, dY, dZ; - CreateFoamAroundObject(pMatrix, 107.0f, 24.1f, 30.5f, 2); - uint32 prev = CTimer::GetPreviousTimeInMilliseconds(); - uint32 cur = CTimer::GetTimeInMilliseconds(); - if (FrameInAnimation != 0) { - X += dX; - Y += dY; - Z += dZ; - CVector pos = *pMatrix * CVector(X, Y, Z); - CParticle::AddParticle(PARTICLE_STEAM_NY, pos, CVector(0.0f, 0.0f, 0.0f), - nil, FrameInAnimation * 0.5f + 2.0f, FoamColour, 1, 0, 0, 0); - if (++FrameInAnimation > 15) - FrameInAnimation = 0; - } - if ((cur & 0x3FF) < (prev & 0x3FF)) { - FrameInAnimation = 1; - int rnd = CGeneral::GetRandomNumber(); - X = (int8)(rnd - 128) * 0.2f; - Y = (int8)((rnd >> 8) - 128) * 0.2f; - Z = 10.0f; - rnd = CGeneral::GetRandomNumber(); - dX = (int8)(rnd - 128) * 0.02f; - dY = (int8)((rnd >> 8) - 128) * 0.02f; - dZ = 2.0f; - } -} - +CMoneyMessage CMoneyMessages::aMoneyMessages[NUMMONEYMESSAGES]; + +void +CMoneyMessage::Render() +{ + const float MAX_SCALE = 4.0f; + uint32 nLifeTime = CTimer::GetTimeInMilliseconds() - m_nTimeRegistered; + if (nLifeTime >= MONEY_MESSAGE_LIFETIME_MS) m_nTimeRegistered = 0; + else { + float fLifeTime = (float)nLifeTime / MONEY_MESSAGE_LIFETIME_MS; + RwV3d vecOut; + float fDistX, fDistY; + if (CSprite::CalcScreenCoors(m_vecPosition + CVector(0.0f, 0.0f, fLifeTime), &vecOut, &fDistX, &fDistY, true)) { + fDistX *= (0.7 * fLifeTime + 2.0) * m_fSize; + fDistY *= (0.7 * fLifeTime + 2.0) * m_fSize; + CFont::SetPropOn(); + CFont::SetBackgroundOff(); + + float fScaleY = fDistY / 100.0f; + if (fScaleY > MAX_SCALE) fScaleY = MAX_SCALE; + + float fScaleX = fDistX / 100.0f; + if (fScaleX > MAX_SCALE) fScaleX = MAX_SCALE; + + CFont::SetScale(fScaleX, fScaleY); // maybe use SCREEN_SCALE_X and SCREEN_SCALE_Y here? + CFont::SetCentreOn(); + CFont::SetCentreSize(SCREEN_WIDTH); + CFont::SetJustifyOff(); + CFont::SetColor(CRGBA(m_Colour.r, m_Colour.g, m_Colour.b, (255.0f - 255.0f * fLifeTime) * m_fOpacity)); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(FONT_BANK); + CFont::PrintString(vecOut.x, vecOut.y, m_aText); + } + } +} + +void +CMoneyMessages::Init() +{ + for (int32 i = 0; i < NUMMONEYMESSAGES; i++) + aMoneyMessages[i].m_nTimeRegistered = 0; +} + +void +CMoneyMessages::Render() +{ + for (int32 i = 0; i < NUMMONEYMESSAGES; i++) { + if (aMoneyMessages[i].m_nTimeRegistered != 0) + aMoneyMessages[i].Render(); + } +} + +void +CMoneyMessages::RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8 bGreen, uint8 bBlue, float fSize, float fOpacity) +{ + uint32 nIndex = 0; + while (aMoneyMessages[nIndex].m_nTimeRegistered != 0) { + if (++nIndex >= NUMMONEYMESSAGES) return; + } + + // Add data of this money message to the array + AsciiToUnicode(pText, aMoneyMessages[nIndex].m_aText); + + aMoneyMessages[nIndex].m_nTimeRegistered = CTimer::GetTimeInMilliseconds(); + aMoneyMessages[nIndex].m_vecPosition = vecPos; + aMoneyMessages[nIndex].m_Colour.red = bRed; + aMoneyMessages[nIndex].m_Colour.green = bGreen; + aMoneyMessages[nIndex].m_Colour.blue = bBlue; + aMoneyMessages[nIndex].m_fSize = fSize; + aMoneyMessages[nIndex].m_fOpacity = fOpacity; +} + +CRGBA FoamColour(255, 255, 255, 255); +unsigned int CSpecialParticleStuff::BoatFromStart; + +void +CSpecialParticleStuff::CreateFoamAroundObject(CMatrix* pMatrix, float innerFw, float innerRg, float innerUp, int32 particles) +{ + float outerFw = innerFw + 5.0f; + float outerRg = innerRg + 5.0f; + float outerUp = innerUp + 5.0f; + for (int attempts = 0; particles > 0 && attempts < 1000; attempts++) { + CVector pos; + int rnd = CGeneral::GetRandomNumber(); + pos.x = (int8)(rnd - 128) * innerFw / 110.0f; + pos.y = (int8)((rnd >> 8) - 128) * innerFw / 110.0f; + pos.z = 0.0f; + if (DotProduct2D(pos, TheCamera.GetForward()) >= 0) + continue; + // was there any point in adding it here? + pos += pMatrix->GetPosition(); + pos.z = 2.0f; + float fw = Abs(DotProduct(pMatrix->GetForward(), pos - pMatrix->GetPosition())); + if (fw >= outerFw) + continue; + float rg = Abs(DotProduct(pMatrix->GetRight(), pos - pMatrix->GetPosition())); + if (rg >= outerRg) + continue; + float up = Abs(DotProduct(pMatrix->GetUp(), pos - pMatrix->GetPosition())); + if (up >= outerUp) + continue; + if (fw > innerFw || rg > innerRg || up > innerUp) { + CParticle::AddParticle(PARTICLE_STEAM2, pos, CVector(0.0f, 0.0f, 0.0f), nil, 4.0f, FoamColour, 1, 0, 0, 0); + particles--; + } + } +} + +void +CSpecialParticleStuff::StartBoatFoamAnimation() +{ + BoatFromStart = CTimer::GetTimeInMilliseconds(); +} + +void +CSpecialParticleStuff::UpdateBoatFoamAnimation(CMatrix* pMatrix) +{ + static int32 FrameInAnimation = 0; + static float X, Y, Z, dX, dY, dZ; + CreateFoamAroundObject(pMatrix, 107.0f, 24.1f, 30.5f, 2); + uint32 prev = CTimer::GetPreviousTimeInMilliseconds(); + uint32 cur = CTimer::GetTimeInMilliseconds(); + if (FrameInAnimation != 0) { + X += dX; + Y += dY; + Z += dZ; + CVector pos = *pMatrix * CVector(X, Y, Z); + CParticle::AddParticle(PARTICLE_STEAM_NY, pos, CVector(0.0f, 0.0f, 0.0f), + nil, FrameInAnimation * 0.5f + 2.0f, FoamColour, 1, 0, 0, 0); + if (++FrameInAnimation > 15) + FrameInAnimation = 0; + } + if ((cur & 0x3FF) < (prev & 0x3FF)) { + FrameInAnimation = 1; + int rnd = CGeneral::GetRandomNumber(); + X = (int8)(rnd - 128) * 0.2f; + Y = (int8)((rnd >> 8) - 128) * 0.2f; + Z = 10.0f; + rnd = CGeneral::GetRandomNumber(); + dX = (int8)(rnd - 128) * 0.02f; + dY = (int8)((rnd >> 8) - 128) * 0.02f; + dZ = 2.0f; + } +} + STARTPATCHES InjectHook(0x518DE0, &CBulletTraces::Init, PATCH_JUMP); InjectHook(0x518E90, &CBulletTraces::AddTrace, PATCH_JUMP); diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 337055c5..f05580cd 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -584,7 +584,7 @@ void _psPrintCpuInfo() RwBool psInitialise(void) { - PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0; + PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0f; RsGlobal.ps = &PsGlobal; @@ -3066,4 +3066,4 @@ STARTPATCHES InjectHook(0x583DC0, _InputTranslateShiftKeyUpDown, PATCH_JUMP); InjectHook(0x583E50, _InputTranslateShiftKey, PATCH_JUMP); InjectHook(0x583EE0, _InputIsExtended, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +ENDPATCHES -- cgit v1.2.3 From c88c2115e227ef0dbac6368224f1564159a9e2df Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 25 Feb 2020 20:54:26 +0100 Subject: Remove unneeded double to float casts --- src/control/Bridge.cpp | 6 +- src/control/Pickups.cpp | 6 +- src/core/Camera.cpp | 2 +- src/peds/Ped.cpp | 4 +- src/render/Credits.cpp | 626 ++++++++++++++++++++++++------------------------ src/render/Fluff.cpp | 38 +-- 6 files changed, 341 insertions(+), 341 deletions(-) (limited to 'src/control') diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp index 31214207..6a577449 100644 --- a/src/control/Bridge.cpp +++ b/src/control/Bridge.cpp @@ -60,7 +60,7 @@ void CBridge::Update() if (timeElapsed < 10000) { State = STATE_LIFT_PART_MOVING_DOWN; - liftHeight = 25.0 - timeElapsed / 10000.0 * 25.0f; + liftHeight = 25.0f - timeElapsed / 10000.0f * 25.0f; } else if (timeElapsed < 40000) { @@ -75,7 +75,7 @@ void CBridge::Update() else if (timeElapsed < 60000) { State = STATE_LIFT_PART_MOVING_UP; - liftHeight = (timeElapsed - 50000) / 10000.0 * 25.0f; + liftHeight = (timeElapsed - 50000) / 10000.0f * 25.0f; } else { @@ -151,4 +151,4 @@ STARTPATCHES InjectHook(0x413D10, &CBridge::ShouldLightsBeFlashing, PATCH_JUMP); InjectHook(0x413D20, &CBridge::FindBridgeEntities, PATCH_JUMP); InjectHook(0x413DE0, &CBridge::ThisIsABridgeObjectMovingUp, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +ENDPATCHES diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index b4ec7a0b..c53cab3f 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -704,9 +704,9 @@ CPickups::DoPickUpEffects(CEntity *entity) aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier, 4.0f, 1.0f, 40.0f, false, 0.0f); - float radius = (double)(rand() & 0xF) * 0.1 + 3.0f; + float radius = (rand() & 0xF) * 0.1f + 3.0f; CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true); - float size = (double)(rand() & 0xF) * 0.0005 + 0.6; + float size = (rand() & 0xF) * 0.0005f + 0.6f; CCoronas::RegisterCorona( (uintptr)entity, aWeaponReds[colorId] * modifiedSin / 2.0f, aWeaponGreens[colorId] * modifiedSin / 2.0f, aWeaponBlues[colorId] * modifiedSin / 2.0f, 255, @@ -1044,4 +1044,4 @@ STARTPATCHES InjectHook(0x433E40, CPickups::Save, PATCH_JUMP); InjectHook(0x433BA0, &CPickup::GiveUsAPickUpObject, PATCH_JUMP); InjectHook(0x430860, &CPickup::Update, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +ENDPATCHES diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index fc056038..75e52c5f 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -428,7 +428,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl if(TheCamera.PedZoomIndicator == 3.0f) RealGroundDist = 4.704914f; if(TheCamera.PedZoomIndicator == 4.0f) RealGroundDist = 2.090556f; if(m_fCloseInPedHeightOffset > 0.00001f) - RealGroundDist = 1.7016; + RealGroundDist = 1.7016f; bool Shooting = false; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 45590b07..7fc83be3 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -10169,7 +10169,7 @@ CPed::ProcessControl(void) } if (!bIsStanding && m_vecMoveSpeed.z > 0.25f) { - double airResistance = Pow(0.95, CTimer::GetTimeStep()); + float airResistance = Pow(0.95f, CTimer::GetTimeStep()); m_vecMoveSpeed *= airResistance; } @@ -15048,7 +15048,7 @@ CPed::ProcessBuoyancy(void) m_vecMoveSpeed.y *= speedMult; if (m_vecMoveSpeed.z >= -0.1f) { if (m_vecMoveSpeed.z < -0.04f) - m_vecMoveSpeed.z = -0.02; + m_vecMoveSpeed.z = -0.02f; } else { m_vecMoveSpeed.z = -0.01f; DMAudio.PlayOneShot(m_audioEntityId, SOUND_SPLASH, 0.0f); diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp index 8f4e2270..b423fcc0 100644 --- a/src/render/Credits.cpp +++ b/src/render/Credits.cpp @@ -68,199 +68,199 @@ CCredits::Render(void) CFont::SetColor(CRGBA(220, 220, 220, 220)); CFont::SetFontStyle(FONT_HEADING); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED002"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED003"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED004"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED005"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED006"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED007"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED008"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED009"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED010"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED011"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED012"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED013"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED014"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED015"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED016"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED017"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED018"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED019"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED020"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED021"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED022"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED245"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED023"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED024"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED025"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED026"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED027"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED028"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED257"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED029"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED030"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED031"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED032"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED033"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED244"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED034"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED035"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED247"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED036"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED037"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED038"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED039"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED040"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED041"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED002"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED003"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED004"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED005"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED006"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED007"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED008"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED009"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED010"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED011"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED012"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED013"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED014"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED015"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED016"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED017"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED018"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED019"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED020"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED021"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED022"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED245"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED023"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED024"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED025"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED026"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED027"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED028"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED257"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED029"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED030"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED031"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED032"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED033"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED244"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED034"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED035"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED247"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED036"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED037"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED038"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED039"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED040"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED041"), lineoffset, scrolloffset); if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED042"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED043"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED042"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED043"), lineoffset, scrolloffset); if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED044"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED045"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED046"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED047"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED048"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED049"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED050"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRD050A"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED051"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED052"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED053"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED054"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED055"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED056"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED248"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED249"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED250"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED251"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED252"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED253"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED057"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED058"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED059"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED254"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED255"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED060"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED061"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED044"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED045"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED046"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED047"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED048"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED049"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED050"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRD050A"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED051"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED052"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED053"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED054"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED055"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED056"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED248"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED249"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED250"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED251"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED252"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED253"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED057"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED058"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED059"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED254"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED255"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED060"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED061"), lineoffset, scrolloffset); if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED062"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED063"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED064"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED065"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED062"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED063"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED064"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED065"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED066"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED067"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED068"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED069"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED066"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED067"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED068"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED069"), lineoffset, scrolloffset); if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED070"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED071"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED070"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED071"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED072"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED073"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED072"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED073"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED074"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED075"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED076"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED077"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED078"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED079"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED080"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED081"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED082"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED083"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED084"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED242"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED259"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED260"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED261"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED262"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED085"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED074"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED075"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED076"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED077"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED078"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED079"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED080"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED081"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED082"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED083"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED084"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED242"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED259"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED260"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED261"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED262"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED085"), lineoffset, scrolloffset); if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED086"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED087"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED086"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED087"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED088"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED089"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED088"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED089"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED090"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED091"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED094"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED095"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED096"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED097"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED098"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED099"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED263"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED264"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED265"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED267"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED270"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED266"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED100"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED090"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED091"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED094"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED095"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED096"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED097"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED098"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED099"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED263"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED264"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED265"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED267"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED270"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED266"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED100"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED101"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED102"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED103"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED104"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED105"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED106"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED268"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED269"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED107"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED101"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED102"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED103"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED104"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED105"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED106"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED268"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED269"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED107"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED108"), lineoffset, scrolloffset); PrintCreditSpace(1.0, lineoffset); @@ -268,8 +268,8 @@ CCredits::Render(void) if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) PrintCreditSpace(1.0, lineoffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED110"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED111"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED111"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED112"), lineoffset, scrolloffset); if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) PrintCreditSpace(1.0, lineoffset); @@ -337,152 +337,152 @@ CCredits::Render(void) if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) PrintCreditSpace(1.0, lineoffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED134"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED135"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED136"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD136A"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED137"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD137A"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED138"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD138A"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD138B"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED135"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED136"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD136A"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED137"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD137A"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED138"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD138A"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD138B"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED139"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.7, 1.0, TheText.Get("CRED140"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD140A"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD140B"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD140C"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD140D"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD140E"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED141"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.7f, 1.0f, TheText.Get("CRED140"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD140A"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD140B"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD140C"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD140D"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD140E"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED141"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED142"), lineoffset, scrolloffset); PrintCreditSpace(1.0, lineoffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED143"), lineoffset, scrolloffset); PrintCreditSpace(1.0, lineoffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED144"), lineoffset, scrolloffset); PrintCreditSpace(1.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED145"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED146"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED147"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED148"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED149"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED150"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED151"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED152"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED153"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED154"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED155"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED156"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED157"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED158"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED159"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED160"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED161"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED162"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED163"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED164"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED165"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED166"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED167"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED168"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED169"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED170"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED171"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED172"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED173"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED174"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED175"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED176"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED177"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED178"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED179"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED180"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED181"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED182"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED183"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED184"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED185"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED186"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED187"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED188"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED189"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED190"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED191"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED192"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED193"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED194"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED195"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED196"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED197"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED198"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED199"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED200"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED201"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED202"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED203"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED204"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED205"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED206"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED207"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED208"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED209"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED210"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED211"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED212"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED213"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED214"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED215"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED216"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED241"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED217"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED145"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED146"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED147"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED148"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED149"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED150"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED151"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED152"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED153"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED154"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED155"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED156"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED157"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED158"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED159"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED160"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED161"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED162"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED163"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED164"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED165"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED166"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED167"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED168"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED169"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED170"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED171"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED172"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED173"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED174"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED175"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED176"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED177"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED178"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED179"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED180"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED181"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED182"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED183"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED184"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED185"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED186"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED187"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED188"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED189"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED190"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED191"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED192"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED193"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED194"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED195"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED196"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED197"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED198"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED199"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED200"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED201"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED202"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED203"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED204"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED205"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED206"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED207"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED208"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED209"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED210"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED211"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED212"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED213"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED214"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED215"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED216"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED241"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED217"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED218"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED218"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD218A"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRD218B"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED219"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD218A"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRD218B"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED219"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED220"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED221"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED220"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED221"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED222"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED223"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED224"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED225"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED226"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED227"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED222"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED223"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED224"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED225"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED226"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED227"), lineoffset, scrolloffset); PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED228"), lineoffset, scrolloffset); - PrintCreditText(1.7, 1.7, TheText.Get("CRED229"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditText(1.4, 0.82, TheText.Get("CRED230"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED231"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED232"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED233"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED234"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED235"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED236"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED237"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED238"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED239"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED240"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("LITTLE"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("NICK"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED243"), lineoffset, scrolloffset); - PrintCreditText(1.4, 1.4, TheText.Get("CRED244"), lineoffset, scrolloffset); - PrintCreditSpace(2.0, lineoffset); - PrintCreditSpace(2.0, lineoffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED228"), lineoffset, scrolloffset); + PrintCreditText(1.7f, 1.7f, TheText.Get("CRED229"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditText(1.4f, 0.82f, TheText.Get("CRED230"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED231"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED232"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED233"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED234"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED235"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED236"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED237"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED238"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED239"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED240"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("LITTLE"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("NICK"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED243"), lineoffset, scrolloffset); + PrintCreditText(1.4f, 1.4f, TheText.Get("CRED244"), lineoffset, scrolloffset); + PrintCreditSpace(2.0f, lineoffset); + PrintCreditSpace(2.0f, lineoffset); CFont::DrawFonts(); diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index e0db5732..8d7fad92 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -106,17 +106,17 @@ void CMovingThings::Init() Num = 0; // Initialize scroll bars - aScrollBars[0].Init(CVector( 228.3f, -669.0f, 39.0f ), SCROLL_BUSINESS, 0.0, 0.5, 0.5, 255, 128, 0, 0.3); - aScrollBars[1].Init(CVector( 772.0f, 164.0f, -9.5f ), SCROLL_TRAFFIC, 0.0, 0.5, 0.25, 128, 255, 0, 0.3); - aScrollBars[2].Init(CVector(-1089.61f, -584.224f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 255, 0, 0, 0.11); - aScrollBars[3].Init(CVector(-1089.61f, -602.04602f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 0, 255, 0, 0.11); - aScrollBars[4].Init(CVector(-1089.61f, -619.81702f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 255, 128, 0, 0.11); - aScrollBars[5].Init(CVector(-754.578f, -633.50897f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0, 0.591, 0.52, 100, 100, 255, 0.3); - aScrollBars[6].Init(CVector( -754.578f, -586.672f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0, 0.591, 0.52, 100, 100, 255, 0.3); - aScrollBars[7].Init(CVector( 85.473f, -1069.512f, 30.5f ), SCROLL_STORE, 0.625, -0.3125, 0.727, 100, 100, 255, 0.5); - aScrollBars[8].Init(CVector( 74.823f, -1086.879f, 31.495f), SCROLL_ENTERTAINMENT, -0.2083, 0.1041, 0.5, 255, 255, 128, 0.3); - aScrollBars[9].Init(CVector( -36.459f, -1031.2371f, 32.534f), SCROLL_ENTERTAINMENT, -0.1442, 0.0721, 0.229, 150, 255, 50, 0.3); - aScrollBars[10].Init(CVector( 1208.0f, -62.208f, 19.157f), SCROLL_USED_CARS, 0.0642, -0.20365, 0.229, 255, 128, 0, 0.3); + aScrollBars[0].Init(CVector( 228.3f, -669.0f, 39.0f ), SCROLL_BUSINESS, 0.0f, 0.5f, 0.5f, 255, 128, 0, 0.3f); + aScrollBars[1].Init(CVector( 772.0f, 164.0f, -9.5f ), SCROLL_TRAFFIC, 0.0f, 0.5f, 0.25f, 128, 255, 0, 0.3f); + aScrollBars[2].Init(CVector(-1089.61f, -584.224f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0f, -0.1706f, 0.107f, 255, 0, 0, 0.11f); + aScrollBars[3].Init(CVector(-1089.61f, -602.04602f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0f, -0.1706f, 0.107f, 0, 255, 0, 0.11f); + aScrollBars[4].Init(CVector(-1089.61f, -619.81702f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0f, -0.1706f, 0.107f, 255, 128, 0, 0.11f); + aScrollBars[5].Init(CVector(-754.578f, -633.50897f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0f, 0.591f, 0.52f, 100, 100, 255, 0.3f); + aScrollBars[6].Init(CVector( -754.578f, -586.672f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0f, 0.591f, 0.52f, 100, 100, 255, 0.3f); + aScrollBars[7].Init(CVector( 85.473f, -1069.512f, 30.5f ), SCROLL_STORE, 0.625f, -0.3125f, 0.727f, 100, 100, 255, 0.5f); + aScrollBars[8].Init(CVector( 74.823f, -1086.879f, 31.495f), SCROLL_ENTERTAINMENT, -0.2083f, 0.1041f, 0.5f, 255, 255, 128, 0.3f); + aScrollBars[9].Init(CVector( -36.459f, -1031.2371f, 32.534f), SCROLL_ENTERTAINMENT, -0.1442f, 0.0721f, 0.229f, 150, 255, 50, 0.3f); + aScrollBars[10].Init(CVector( 1208.0f, -62.208f, 19.157f), SCROLL_USED_CARS, 0.0642f, -0.20365f, 0.229f, 255, 128, 0, 0.3f); // Initialize tower clocks aTowerClocks[0].Init(CVector(59.4f, -1081.3f, 54.15f), -1.0f, 0.0f, 0, 0, 0, 80.0f, 2.0f); @@ -406,9 +406,9 @@ void CScrollBar::Update() m_pMessage = "KEEP YOUR EYES ON THE ROAD AND NOT ON THIS SIGN "; break; case 4: - if (CWeather::Foggyness > 0.5) + if (CWeather::Foggyness > 0.5f) m_pMessage = "POOR VISIBILITY ! "; - else if (CWeather::WetRoads > 0.5) + else if (CWeather::WetRoads > 0.5f) m_pMessage = "ROADS ARE SLIPPERY ! "; else m_pMessage = "ENJOY YOUR TRIP "; @@ -562,7 +562,7 @@ void CScrollBar::Update() "ONE FOR ALL THE FAMILY. . . "; break; case 9: - m_pMessage = (char*)FindTimeMessage(); + m_pMessage = FindTimeMessage(); break; } } @@ -686,7 +686,7 @@ void CScrollBar::Render() r / 2, g / 2, b / 2, - 255, 1.0 / screenCoord.z, 255); + 255, 1.0f / screenCoord.z, 255); } } } @@ -849,11 +849,11 @@ void CDigitalClock::Render() { CSprite::RenderBufferedOneXLUSprite( screenCoord.x, screenCoord.y, screenCoord.z, - screenW * m_fScale * 0.12, - screenW * m_fScale * 0.12, + screenW * m_fScale * 0.12f, + screenW * m_fScale * 0.12f, r, g, b, 255, - 1.0 / screenCoord.z, + 1.0f / screenCoord.z, 255); } } @@ -891,4 +891,4 @@ InjectHook(0x5001D0, &CTowerClock::Render, PATCH_JUMP); InjectHook(0x5004F0, &CDigitalClock::Init, PATCH_JUMP); InjectHook(0x500550, &CDigitalClock::Update, PATCH_JUMP); InjectHook(0x5005F0, &CDigitalClock::Render, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +ENDPATCHES -- cgit v1.2.3 From 337924c7944115a9212edfb1097a8f83e7f6daf0 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Fri, 28 Feb 2020 18:34:39 +0100 Subject: Cleanup audio code + fixes for review --- src/audio/AudioCollision.cpp | 22 ++- src/audio/AudioManager.cpp | 439 ++++++++++++++----------------------------- src/audio/AudioManager.h | 30 ++- src/control/Pickups.cpp | 34 ++-- 4 files changed, 196 insertions(+), 329 deletions(-) (limited to 'src/control') diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index 6c998a34..0e4fb748 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -8,6 +8,8 @@ #include "SurfaceTable.h" #include "sampman.h" +constexpr int CollisionSoundIntensity = 60; + void cAudioCollisionManager::AddCollisionToRequestedQueue() { @@ -146,7 +148,8 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter) uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col); if(emittingVol) { m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance); - m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 60.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = counter; m_sQueueSample.m_vecPos = col->m_vecPosition; @@ -160,7 +163,7 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 4.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 5; m_sQueueSample.m_bReverbFlag = true; @@ -212,7 +215,8 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col) emittingVol = 40.f * ratio; if(emittingVol) { m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance); - m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 60.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_nSampleIndex = gOneShotCol[s1]; switch(m_sQueueSample.m_nSampleIndex) { @@ -277,7 +281,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col) m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.field_48 = 4.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; m_sQueueSample.field_56 = 1; m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bRequireReflection = false; @@ -356,7 +360,7 @@ void cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower, float velocity) { - float dist; + float distSquared; CVector v1; CVector v2; @@ -373,8 +377,8 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface v2 = entity2->GetPosition(); } CVector pos = (v1 + v2) * 0.5f; - dist = GetDistanceSquared(&pos); - if(dist < SQR(60.f)) { + distSquared = GetDistanceSquared(&pos); + if(distSquared < SQR(CollisionSoundIntensity)) { m_sCollisionManager.m_sQueue.m_pEntity1 = entity1; m_sCollisionManager.m_sQueue.m_pEntity2 = entity2; m_sCollisionManager.m_sQueue.m_bSurface1 = surface1; @@ -382,7 +386,7 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower; m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity; m_sCollisionManager.m_sQueue.m_vecPosition = pos; - m_sCollisionManager.m_sQueue.m_fDistance = dist; + m_sCollisionManager.m_sQueue.m_fDistance = distSquared; m_sCollisionManager.AddCollisionToRequestedQueue(); } } @@ -396,4 +400,4 @@ InjectHook(0x5686D0, &cAudioManager::ServiceCollisions, PATCH_JUMP); InjectHook(0x568E20, &cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol, PATCH_JUMP); InjectHook(0x568D30, &cAudioManager::SetUpLoopingCollisionSound, PATCH_JUMP); InjectHook(0x5689D0, &cAudioManager::SetUpOneShotCollisionSound, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +ENDPATCHES diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 201d8698..2940be85 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -165,8 +165,8 @@ cPedComments::Add(tPedComment *com) { uint8 index; - if(nrOfCommentsInBank[activeBank] >= 20) { - index = indexMap[activeBank][19]; + if(nrOfCommentsInBank[activeBank] >= pedCommentsSlots) { + index = indexMap[activeBank][pedCommentsSlots - 1]; if(m_asPedComments[activeBank][index].m_bVolume > com->m_bVolume) return; } else { index = nrOfCommentsInBank[activeBank]++; @@ -187,7 +187,7 @@ cPedComments::Add(tPedComment *com) } } - if(i < index) memmove(&indexMap[activeBank][i + 1], &indexMap[activeBank][i], 19 - i); + if(i < index) memmove(&indexMap[activeBank][i + 1], &indexMap[activeBank][i], pedCommentsSlots -1 - i); } indexMap[activeBank][i] = index; @@ -200,6 +200,9 @@ cPedComments::Process() uint8 actualUsedBank; tPedComment *comment; + static constexpr int defaultIntensity = 50; + static constexpr int policeHeliIntensity = 400; + if(!AudioManager.m_bUserPause) { if(nrOfCommentsInBank[activeBank]) { sampleIndex = m_asPedComments[activeBank][indexMap[activeBank][0]].m_nSampleIndex; @@ -224,9 +227,9 @@ cPedComments::Process() case SFX_POLICE_HELI_1: case SFX_POLICE_HELI_2: case SFX_POLICE_HELI_3: - AudioManager.m_sQueueSample.m_fSoundIntensity = 400.0f; + AudioManager.m_sQueueSample.m_fSoundIntensity = policeHeliIntensity; break; - default: AudioManager.m_sQueueSample.m_fSoundIntensity = 50.0f; break; + default: AudioManager.m_sQueueSample.m_fSoundIntensity = defaultIntensity; break; } AudioManager.m_sQueueSample.field_56 = 1; AudioManager.m_sQueueSample.m_vecPos = @@ -265,7 +268,7 @@ cPedComments::Process() } } - for(uint32 i = 0; i < 20; i++) { indexMap[actualUsedBank][i] = 20; } + for(uint32 i = 0; i < pedCommentsSlots; i++) { indexMap[actualUsedBank][i] = pedCommentsSlots; } nrOfCommentsInBank[actualUsedBank] = 0; } } @@ -378,7 +381,7 @@ cAudioManager::AddReleasingSounds() } } if(!toProcess[i]) { - if(sample.m_counter <= 255u || !sample.m_bLoopsRemaining) { + if(sample.m_counter <= 255 || !sample.m_bLoopsRemaining) { if(!sample.field_76) continue; if(!sample.m_nLoopCount) { if(sample.field_88 == -1) { @@ -616,7 +619,7 @@ void cAudioManager::DestroyEntity(int32 id) { if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed) { - m_asAudioEntities[id].m_bIsUsed = 0; + m_asAudioEntities[id].m_bIsUsed = false; for(int32 i = 0; i < m_nAudioEntitiesTotal; ++i) { if(id == m_anAudioEntityIndices[i]) { if(i < totalAudioEntitiesSlots - 1) @@ -2773,28 +2776,22 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params) void cAudioManager::ProcessAirportScriptObject(uint8 sound) { - float dist; - float maxDist; - static uint8 counter = 0; uint32 time = CTimer::GetTimeInMilliseconds(); if(time > gAirportNextTime) { switch(sound) { case SCRIPT_SOUND_AIRPORT_LOOP_S: - maxDist = 900.f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; break; case SCRIPT_SOUND_AIRPORT_LOOP_L: - maxDist = 6400.f; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; break; default: return; } float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { - dist = sqrt(distSquared); - m_sQueueSample.m_fDistance = dist; + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { @@ -2833,7 +2830,9 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) static uint16 LastAccel = 0; static uint8 LastVol = 0; - if(params->m_fDistance < 2500.f) { + static constexpr int intensity = 50; + + if(params->m_fDistance < SQR(intensity)) { boat = (CBoat *)params->m_pVehicle; if(params->m_nIndex == REEFER) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); @@ -2853,7 +2852,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 7; m_sQueueSample.m_bReverbFlag = true; @@ -2896,7 +2895,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 7; m_sQueueSample.m_bReverbFlag = true; @@ -2955,7 +2954,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 7; m_sQueueSample.m_bReverbFlag = true; @@ -3037,8 +3036,8 @@ cAudioManager::ProcessBridge() void cAudioManager::ProcessBridgeMotor() { - if(m_sQueueSample.m_fDistance < 400.f) { - m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, 400.f, m_sQueueSample.m_fDistance); + 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_nSampleIndex = SFX_FISHING_BOAT_IDLE; @@ -3052,7 +3051,7 @@ cAudioManager::ProcessBridgeMotor() SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; - m_sQueueSample.m_fSoundIntensity = 400.0f; + m_sQueueSample.m_fSoundIntensity = bridgeIntensity; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; m_sQueueSample.m_bReverbFlag = false; @@ -3064,32 +3063,26 @@ cAudioManager::ProcessBridgeMotor() void cAudioManager::ProcessBridgeOneShots() { - float maxDist; - if(CBridge::State == STATE_LIFT_PART_IS_UP && CBridge::OldState == STATE_LIFT_PART_MOVING_UP) { - maxDist = 400.f; m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; } else { if(CBridge::State == STATE_LIFT_PART_IS_DOWN && CBridge::OldState == STATE_LIFT_PART_MOVING_DOWN) { - maxDist = 400.f; m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; } else { if(CBridge::State == STATE_LIFT_PART_MOVING_UP && CBridge::OldState == STATE_LIFT_PART_ABOUT_TO_MOVE_UP) { - maxDist = 400.f; m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; } else { if(CBridge::State == STATE_LIFT_PART_MOVING_DOWN && CBridge::OldState == STATE_LIFT_PART_IS_UP) { - maxDist = 400.f; m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; } else return; } } } - if(m_sQueueSample.m_fDistance < maxDist) { - m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, maxDist, m_sQueueSample.m_fDistance); + 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_bBankIndex = SAMPLEBANK_MAIN; @@ -3102,7 +3095,7 @@ cAudioManager::ProcessBridgeOneShots() m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.field_48 = 2.0f; - m_sQueueSample.m_fSoundIntensity = maxDist; + m_sQueueSample.m_fSoundIntensity = bridgeIntensity; m_sQueueSample.field_56 = 1; m_sQueueSample.m_bReverbFlag = false; m_sQueueSample.m_bRequireReflection = false; @@ -3247,7 +3240,6 @@ void cAudioManager::ProcessCinemaScriptObject(uint8 sound) { uint8 rand; - float maxDist; static uint8 counter = 0; @@ -3255,18 +3247,16 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) if(time > gCinemaNextTime) { switch(sound) { case SCRIPT_SOUND_CINEMA_LOOP_S: - maxDist = 900.f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; break; case SCRIPT_SOUND_CINEMA_LOOP_L: - maxDist = 6400.f; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; break; default: return; } float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { - m_sQueueSample.m_fDistance = sqrt(distSquared); + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); rand = m_anRandomTable[0] % 90 + 30; m_sQueueSample.m_bVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -3299,15 +3289,15 @@ cAudioManager::ProcessCrane() { CCrane *crane = (CCrane *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity; float distSquared; - bool distCalculated = false; + static constexpr int intensity = 80; if(crane) { if(crane->m_bCraneActive == 1) { if(crane->m_bCraneStatus) { m_sQueueSample.m_vecPos = crane->m_pObject->GetPosition(); distSquared = GetDistanceSquared(&this->m_sQueueSample.m_vecPos); - if(distSquared < 6400.f) { + if(distSquared < SQR(intensity)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_bVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { @@ -3324,7 +3314,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 4.0f; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; m_sQueueSample.m_bReverbFlag = true; @@ -3339,7 +3329,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.field_56 = 1; m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = 1; + m_sQueueSample.m_bRequireReflection = true; AddSampleToRequestedQueue(); } } @@ -3354,7 +3344,6 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) uint32 time; uint8 rand; float distSquared; - float maxDist; static uint32 counter = 0; @@ -3362,18 +3351,16 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) if(time > gDocksNextTime) { switch(sound) { case SCRIPT_SOUND_DOCKS_LOOP_S: - maxDist = 900.f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; break; case SCRIPT_SOUND_DOCKS_LOOP_L: - maxDist = 6400.f; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; break; default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { - m_sQueueSample.m_fDistance = sqrt(distSquared); + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); rand = m_anRandomTable[0] % 60 + 40; m_sQueueSample.m_bVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -3529,7 +3516,6 @@ cAudioManager::ProcessExplosions(int32 explosion) { uint8 type; CVector *pos; - float maxDist; float distSquared; for(uint8 i = 0; i < 48; i++) { @@ -3541,7 +3527,6 @@ cAudioManager::ProcessExplosions(int32 explosion) case EXPLOSION_ROCKET: case EXPLOSION_BARREL: case EXPLOSION_TANK_GRENADE: - maxDist = 160000.f; m_sQueueSample.m_fSoundIntensity = 400.0f; m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2; m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; @@ -3549,7 +3534,6 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; break; case EXPLOSION_MOLOTOV: - maxDist = 40000.f; m_sQueueSample.m_fSoundIntensity = 200.0f; m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_3; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; @@ -3558,7 +3542,6 @@ cAudioManager::ProcessExplosions(int32 explosion) break; case EXPLOSION_MINE: case EXPLOSION_HELI_BOMB: - maxDist = 90000.f; m_sQueueSample.m_fSoundIntensity = 300.0f; m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347; @@ -3566,7 +3549,6 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; break; default: - maxDist = 160000.f; m_sQueueSample.m_fSoundIntensity = 400.0f; m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; @@ -3579,7 +3561,7 @@ cAudioManager::ProcessExplosions(int32 explosion) pos = CExplosion::GetExplosionPosition(i); m_sQueueSample.m_vecPos = *pos; distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -3607,10 +3589,11 @@ cAudioManager::ProcessFireHydrant() { float distSquared; bool distCalculated = false; + static constexpr int intensity = 35; m_sQueueSample.m_vecPos = ((CEntity*)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition(); distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < 1225.f) { + if(distSquared < SQR(intensity)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_bVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { @@ -3626,7 +3609,7 @@ cAudioManager::ProcessFireHydrant() SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; - m_sQueueSample.m_fSoundIntensity = 35.0f; + m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; m_sQueueSample.m_bReverbFlag = true; @@ -3640,7 +3623,6 @@ void cAudioManager::ProcessFires(int32) { CEntity *entity; uint8 emittingVol; - float maxDist; float distSquared; for(uint8 i = 0; i < NUM_FIRES; i++) { @@ -3649,7 +3631,6 @@ void cAudioManager::ProcessFires(int32) if(entity) { switch(entity->m_type & 7) { case ENTITY_TYPE_BUILDING: - maxDist = 2500.f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; emittingVol = 100; @@ -3659,7 +3640,6 @@ void cAudioManager::ProcessFires(int32) m_sQueueSample.field_16 = 6; break; case ENTITY_TYPE_PED: - maxDist = 625.f; m_sQueueSample.m_fSoundIntensity = 25.0f; m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; m_sQueueSample.m_nFrequency = @@ -3669,7 +3649,6 @@ void cAudioManager::ProcessFires(int32) m_sQueueSample.field_16 = 10; break; default: - maxDist = 2500.f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nFrequency = @@ -3679,7 +3658,6 @@ void cAudioManager::ProcessFires(int32) m_sQueueSample.field_16 = 8; } } else { - maxDist = 2500.f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); @@ -3689,7 +3667,7 @@ void cAudioManager::ProcessFires(int32) } m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos; distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -3859,7 +3837,7 @@ cAudioManager::ProcessFrontEnd() m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; if(stereo) - m_sQueueSample.m_bOffset = m_anRandomTable[0] & 0x1F; + m_sQueueSample.m_bOffset = m_anRandomTable[0] & 31; else m_sQueueSample.m_bOffset = 63; m_sQueueSample.m_bReverbFlag = false; @@ -4079,7 +4057,6 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) uint32 time; uint8 rand; float dist; - float maxDist; static uint8 counter = 0; @@ -4087,18 +4064,16 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) if(time > gHomeNextTime) { switch(sound) { case SCRIPT_SOUND_HOME_LOOP_S: - maxDist = 900.f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; break; case SCRIPT_SOUND_HOME_LOOP_L: - maxDist = 6400.f; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; break; default: return; } dist = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(dist < maxDist) { - m_sQueueSample.m_fDistance = sqrt(dist); + if(dist < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(dist); rand = m_anRandomTable[0] % 30 + 40; m_sQueueSample.m_bVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -4241,19 +4216,16 @@ cAudioManager::ProcessJumboTaxi() void cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) { - float maxDist; - switch(sound) { case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; break; default: return; } float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { - m_sQueueSample.m_fDistance = sqrt(distSquared); + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { @@ -4301,12 +4273,10 @@ void cAudioManager::ProcessLoopingScriptObject(uint8 sound) { uint8 emittingVolume; - float maxDist; float distSquared; switch(sound) { case SCRIPT_SOUND_PARTY_1_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4317,7 +4287,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_1_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4328,7 +4297,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_2_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4339,7 +4307,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_2_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4350,7 +4317,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_3_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4361,7 +4327,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_3_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4372,7 +4337,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_4_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4383,7 +4347,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_4_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4394,7 +4357,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_5_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4405,7 +4367,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_5_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4416,7 +4377,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_6_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4427,7 +4387,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_6_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4438,7 +4397,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_7_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4449,7 +4407,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_7_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4460,7 +4417,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_8_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4471,7 +4427,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_8_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4482,7 +4437,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_9_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4493,7 +4447,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_9_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4504,7 +4457,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_10_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4515,7 +4467,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_10_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4526,7 +4477,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_11_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4537,7 +4487,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_11_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4548,7 +4497,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_12_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4559,7 +4507,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_12_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4570,7 +4517,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_13_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4581,7 +4527,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_13_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4592,7 +4537,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4603,7 +4547,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4614,7 +4557,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4625,7 +4567,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4640,7 +4581,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_SAWMILL_LOOP_S: case SCRIPT_SOUND_SAWMILL_LOOP_L: ProcessSawMillScriptObject(sound); return; case SCRIPT_SOUND_38: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4651,7 +4591,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_39: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4664,7 +4603,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: ProcessLaunderetteScriptObject(sound); return; case SCRIPT_SOUND_CHINATOWN_RESTAURANT_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4675,7 +4613,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_CHINATOWN_RESTAURANT_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4686,7 +4623,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_CIPRIANI_RESAURANT_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4697,7 +4633,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_CIPRIANI_RESAURANT_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4707,8 +4642,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; break; - case SCRIPT_SOUND_46: - maxDist = 900.f; + case SCRIPT_SOUND_46_S: m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4718,8 +4652,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_76 = 3; m_sQueueSample.field_48 = 2.0f; break; - case SCRIPT_SOUND_47: - maxDist = 6400.f; + case SCRIPT_SOUND_47_L: m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4730,7 +4663,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_MARCO_BISTRO_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4741,7 +4673,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_MARCO_BISTRO_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4762,7 +4693,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_HOME_LOOP_S: case SCRIPT_SOUND_HOME_LOOP_L: ProcessHomeScriptObject(sound); return; case SCRIPT_SOUND_FRANKIE_PIANO: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_PIANO_BAR_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4773,7 +4703,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PARTY_1_LOOP: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4792,7 +4721,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_MISTY_SEX_S: case SCRIPT_SOUND_MISTY_SEX_L: ProcessPornCinema(sound); return; case SCRIPT_SOUND_BANK_ALARM_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4803,7 +4731,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_BANK_ALARM_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4814,7 +4741,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_POLICE_BALL_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4825,7 +4751,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_POLICE_BALL_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4836,7 +4761,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4847,7 +4771,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4861,7 +4784,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: ProcessPoliceCellBeatingScriptObject(sound); return; case SCRIPT_SOUND_RAVE_1_LOOP_S: case SCRIPT_SOUND_RAVE_2_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4873,7 +4795,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) break; case SCRIPT_SOUND_RAVE_1_LOOP_L: case SCRIPT_SOUND_RAVE_2_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4884,7 +4805,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_RAVE_3_LOOP_S: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4895,7 +4815,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_RAVE_3_LOOP_L: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4906,7 +4825,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.field_48 = 2.0f; break; case SCRIPT_SOUND_PRETEND_FIRE_LOOP: - maxDist = 2500.f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -4920,7 +4838,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -5130,7 +5048,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) { CPlayerPed *playerPed; uint8 emittingVolume; - float maxDist; float distSquared; cPedParams male; @@ -5155,7 +5072,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) return; case SCRIPT_SOUND_GATE_START_CLUNK: case SCRIPT_SOUND_GATE_STOP_CLUNK: - maxDist = 1600.f; m_sQueueSample.m_fSoundIntensity = 40.0f; m_sQueueSample.m_nSampleIndex = SFX_COL_GATE; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5172,7 +5088,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) case SCRIPT_SOUND_BULLET_HIT_GROUND_1: case SCRIPT_SOUND_BULLET_HIT_GROUND_2: case SCRIPT_SOUND_BULLET_HIT_GROUND_3: - maxDist = 2500.f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_nSampleIndex = m_anRandomTable[iSound % 5] % 3 + SFX_BULLET_WALL_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5186,7 +5101,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) case SCRIPT_SOUND_110: case SCRIPT_SOUND_111: if(SampleManager.IsSampleBankLoaded(0) != 1) return; - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5197,7 +5111,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bIsDistant = false; break; case SCRIPT_SOUND_PAYPHONE_RINGING: - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_PHONE_RING; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5209,7 +5122,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bRequireReflection = false; break; case SCRIPT_SOUND_GLASS_BREAK_L: - maxDist = 3600.f; m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5220,7 +5132,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bIsDistant = false; break; case SCRIPT_SOUND_GLASS_BREAK_S: - maxDist = 3600.f; m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5231,7 +5142,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bIsDistant = false; break; case SCRIPT_SOUND_GLASS_CRACK: - maxDist = 3600.f; m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5243,7 +5153,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bRequireReflection = true; break; case SCRIPT_SOUND_GLASS_LIGHT_BREAK: - maxDist = 3025.f; m_sQueueSample.m_fSoundIntensity = 55.0f; m_sQueueSample.m_nSampleIndex = (m_anRandomTable[4] & 3) + SFX_GLASS_SHARD_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5254,7 +5163,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = RandomDisplacement(11) + 25; break; case SCRIPT_SOUND_BOX_DESTROYED_1: - maxDist = 3600.f; m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_WOODEN_BOX_SMASH; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5266,7 +5174,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_BOX_DESTROYED_2: - maxDist = 3600.f; m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_CARDBOARD_BOX_SMASH; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5278,7 +5185,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_METAL_COLLISION: - maxDist = 3600.f; m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 5 + SFX_COL_CAR_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5291,7 +5197,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = m_anRandomTable[2] % 30 + 70; break; case SCRIPT_SOUND_TIRE_COLLISION: - maxDist = 3600.f; m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -5318,14 +5223,13 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2; m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; m_sQueueSample.field_16 = 18; - maxDist = 400.f; m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_bIsDistant = false; emittingVolume = m_anRandomTable[2] % 20 + 30; distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, @@ -5349,7 +5253,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_1; m_sQueueSample.m_nFrequency = RandomDisplacement(750) + 18000; m_sQueueSample.field_16 = 15; - maxDist = 400.f; m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.field_48 = 0.0f; @@ -5360,7 +5263,6 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2; m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; m_sQueueSample.field_16 = 18; - maxDist = 400.f; m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.field_48 = 0.0f; @@ -5371,7 +5273,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -5571,7 +5473,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) case SOUND_FALL_LAND: case SOUND_FALL_COLLAPSE: if(!ped->bIsLooking) { - maxDist = 900.f; + maxDist = SQR(30); emittingVol = m_anRandomTable[3] % 20 + 80; if(ped->m_nSurfaceTouched == SURFACE_PUDDLE) { m_sQueueSample.m_nSampleIndex = @@ -5609,7 +5511,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5629,7 +5531,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5649,7 +5551,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5669,7 +5571,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5689,7 +5591,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5709,7 +5611,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5729,7 +5631,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5749,7 +5651,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5769,7 +5671,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5789,7 +5691,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5809,7 +5711,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5829,7 +5731,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 26 + 100; @@ -5848,7 +5750,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -5875,7 +5777,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; - maxDist = 2500.f; + maxDist = SQR(50); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -5899,7 +5801,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; - maxDist = 6400.f; + maxDist = SQR(80); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[3] % 15 + 70; @@ -5943,7 +5845,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; - maxDist = 6400.f; + maxDist = SQR(80); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[1] % 15 + 70; @@ -5963,7 +5865,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; - maxDist = 6400.f; + maxDist = SQR(80); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[4] % 15 + 70; @@ -6066,7 +5968,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -6086,7 +5988,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -6106,7 +6008,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -6127,7 +6029,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -6148,7 +6050,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -6169,7 +6071,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -6190,7 +6092,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 5; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -6214,7 +6116,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 3; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 80.0f; - maxDist = 6400.f; + maxDist = SQR(80); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -6256,7 +6158,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.field_16 = 7; m_sQueueSample.field_48 = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = 900.f; + maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[0] % 20 + 90; @@ -6635,7 +6537,6 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) int32 sampleIndex; uint8 emittingVol; float distSquared; - float maxDist; cPedParams params; static uint8 counter = 0; @@ -6643,18 +6544,16 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) if(time > gCellNextTime) { switch(sound) { case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S: - maxDist = 900.f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; break; case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: - maxDist = 6400.f; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; break; default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { - m_sQueueSample.m_fDistance = sqrt(distSquared); + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); if(m_FrameCounter & 1) sampleIndex = (m_anRandomTable[1] & 3) + SFX_FIGHT_1; else @@ -6682,7 +6581,7 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) AddSampleToRequestedQueue(); params.m_bDistanceCalculated = 1; params.m_fDistance = distSquared; - params.m_pPed = 0; + params.m_pPed = nil; SetupPedComments(¶ms, SOUND_8A); } gCellNextTime = time + 500 + m_anRandomTable[3] % 1500; @@ -6698,14 +6597,12 @@ cAudioManager::ProcessPornCinema(uint8 sound) uint32 time; int32 rand; float distSquared; - float maxDist; switch(sound) { case SCRIPT_SOUND_PORN_CINEMA_1_S: case SCRIPT_SOUND_MISTY_SEX_S: m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; - maxDist = 400.f; sample = SFX_PORN_1_GROAN_1; m_sQueueSample.m_fSoundIntensity = 20.0f; break; @@ -6713,43 +6610,38 @@ cAudioManager::ProcessPornCinema(uint8 sound) case SCRIPT_SOUND_MISTY_SEX_L: m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; - maxDist = 6400.f; sample = SFX_PORN_1_GROAN_1; m_sQueueSample.m_fSoundIntensity = 80.0f; break; case SCRIPT_SOUND_PORN_CINEMA_2_S: m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; - maxDist = 400.f; sample = SFX_PORN_2_GROAN_1; m_sQueueSample.m_fSoundIntensity = 20.0f; break; case SCRIPT_SOUND_PORN_CINEMA_2_L: m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; - maxDist = 6400.f; sample = SFX_PORN_2_GROAN_1; m_sQueueSample.m_fSoundIntensity = 80.0f; break; case SCRIPT_SOUND_PORN_CINEMA_3_S: m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; - maxDist = 400.f; m_sQueueSample.m_fSoundIntensity = 20.0f; sample = SFX_PORN_3_GROAN_1; break; case SCRIPT_SOUND_PORN_CINEMA_3_L: m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; - maxDist = 6400.f; m_sQueueSample.m_fSoundIntensity = 80.0f; sample = SFX_PORN_3_GROAN_1; break; default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { - m_sQueueSample.m_fDistance = sqrt(distSquared); + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); if(sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) { m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -6804,25 +6696,22 @@ void cAudioManager::ProcessProjectiles() { uint8 emittingVol; - float maxDist; for(int32 i = 0; i < NUM_PROJECTILES; i++) { if(CProjectileInfo::GetProjectileInfo(i)->m_bInUse) { switch(CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) { case WEAPONTYPE_ROCKETLAUNCHER: emittingVol = maxVolume; - maxDist = 8100.f; - m_sQueueSample.m_fSoundIntensity = 90.0f; - m_sQueueSample.m_nSampleIndex = 81; + m_sQueueSample.m_fSoundIntensity = rocketLauncherIntensity; + m_sQueueSample.m_nSampleIndex = SFX_ROCKET_FLY; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_FLY); m_sQueueSample.field_16 = 3; break; case WEAPONTYPE_MOLOTOV: - emittingVol = 50; - maxDist = 900.f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + emittingVol = molotovVolume; + m_sQueueSample.m_fSoundIntensity = molotovIntensity; m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = @@ -6835,7 +6724,7 @@ cAudioManager::ProcessProjectiles() m_sQueueSample.field_76 = 3; m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition(); float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -6864,7 +6753,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params) float emittingVol; CVehicle *veh; - if(params->m_fDistance < 484.f && CWeather::Rain > 0.01f && + if(params->m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { ++params->m_pVehicle->m_bRainAudioCounter; veh = params->m_pVehicle; @@ -6872,13 +6761,13 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params) veh->m_bRainAudioCounter = 0; CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); emittingVol = 30.f * CWeather::Rain; - m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 22.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = + ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 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; + m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_CAR_RAIN_1; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 9; @@ -6888,7 +6777,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params) m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.field_48 = 0.0f; - m_sQueueSample.m_fSoundIntensity = 22.0f; + m_sQueueSample.m_fSoundIntensity = rainOnVehicleIntensity; m_sQueueSample.field_56 = 1; m_sQueueSample.m_bReverbFlag = false; m_sQueueSample.m_bRequireReflection = false; @@ -6916,7 +6805,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params) int32 emittingVol; float modificator; - if(params->m_fDistance >= 900.f) return false; + if(params->m_fDistance >= SQR(reverseGearIntensity)) return false; veh = params->m_pVehicle; if(veh->bEngineOn && (veh->m_fGasPedal < 0.0f || !veh->m_nCurrentGear)) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); @@ -6930,7 +6819,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params) } modificator = Abs(modificator); emittingVol = (24.f * modificator); - m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); + 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; @@ -6949,7 +6838,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params) SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 3.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = reverseGearIntensity; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 5; m_sQueueSample.m_bReverbFlag = true; @@ -6965,19 +6854,17 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) { uint32 time; float distSquared; - float maxDist; switch(sound) { case SCRIPT_SOUND_SAWMILL_LOOP_S: case SCRIPT_SOUND_SAWMILL_LOOP_L: - maxDist = 900.f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; break; default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { - m_sQueueSample.m_fDistance = sqrt(distSquared); + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { @@ -7043,18 +6930,16 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) uint32 time; int32 rand; float distSquared; - float maxDist; switch(sound) { case SCRIPT_SOUND_SHOP_LOOP_S: case SCRIPT_SOUND_SHOP_LOOP_L: - maxDist = 900.f; m_sQueueSample.m_fSoundIntensity = 30.0f; break; default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -7350,64 +7235,36 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params) if((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->m_modelIndex != MI_MRWHOOP) { if(automobile->m_nCarHornTimer) { - if(!params->m_pVehicle->m_status) { - 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_nSampleIndex = - CarSounds[params->m_nIndex].m_nHornSample; - m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIsDistant = false; - m_sQueueSample.field_16 = 2; - m_sQueueSample.m_nFrequency = - CarSounds[params->m_nIndex].m_nHornFrequency; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 5.0f; - m_sQueueSample.m_fSoundIntensity = 40.0f; - m_sQueueSample.field_56 = 0; - m_sQueueSample.field_76 = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - return; + if(params->m_pVehicle->m_status) { + if(automobile->m_nCarHornTimer > 44) automobile->m_nCarHornTimer = 44; + if(automobile->m_nCarHornTimer == 44) + automobile->field_22D = + (uint8(m_FrameCounter) + uint8(m_sQueueSample.m_nEntityIndex)) & 7; } - if(automobile->m_nCarHornTimer > 44) automobile->m_nCarHornTimer = 44; - if(automobile->m_nCarHornTimer == 44) - automobile->field_22D = - (uint8(m_FrameCounter) + uint8(m_sQueueSample.m_nEntityIndex)) & 7; - if(hornPatternsArray[automobile->field_22D][44 - automobile->m_nCarHornTimer]) { - 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_nSampleIndex = - CarSounds[params->m_nIndex].m_nHornSample; - m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIsDistant = false; - m_sQueueSample.field_16 = 2; - m_sQueueSample.m_nFrequency = - CarSounds[params->m_nIndex].m_nHornFrequency; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset( - m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 5.0f; - m_sQueueSample.m_fSoundIntensity = 40.0f; - m_sQueueSample.field_56 = 0; - m_sQueueSample.field_76 = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } + if(!hornPatternsArray[automobile->field_22D][44 - automobile->m_nCarHornTimer]) return; + + 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_nSampleIndex = CarSounds[params->m_nIndex].m_nHornSample; + m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIsDistant = false; + m_sQueueSample.field_16 = 2; + m_sQueueSample.m_nFrequency = CarSounds[params->m_nIndex].m_nHornFrequency; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bEmittingVolume = 80; + m_sQueueSample.m_nLoopStart = + SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.field_48 = 5.0f; + m_sQueueSample.m_fSoundIntensity = 40.0f; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_76 = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); } } } @@ -7621,7 +7478,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) case SURFACE_HEDGE: m_sQueueSample.m_nSampleIndex = SFX_RAIN; emittingVol /= 4; - m_sQueueSample.m_nFrequency = (signed __int64)(13000.f * skidVal + 35000.f); + m_sQueueSample.m_nFrequency = 13000.f * skidVal + 35000.f; m_sQueueSample.m_bVolume /= 4; break; case SURFACE_DIRT: @@ -7731,7 +7588,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nSampleIndex = SFX_RAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAIN); - m_sQueueSample.m_bVolume = (uint8)(25.f * CWeather::Rain); + m_sQueueSample.m_bVolume = (int32)(25.f * CWeather::Rain); m_sQueueSample.m_counter = 4; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.field_16 = 0; @@ -7801,19 +7658,17 @@ void cAudioManager::ProcessWorkShopScriptObject(uint8 sound) { float distSquared; - float maxDist; switch(sound) { case SCRIPT_SOUND_WORK_SHOP_LOOP_S: case SCRIPT_SOUND_WORK_SHOP_LOOP_L: - maxDist = 400.f; m_sQueueSample.m_fSoundIntensity = 20.0f; break; default: return; } distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); - if(distSquared < maxDist) { - m_sQueueSample.m_fDistance = sqrt(distSquared); + if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_bVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { @@ -8214,7 +8069,6 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) { CPed *ped = params->m_pPed; uint8 emittingVol; - float maxDist; float soundIntensity; tPedComment pedComment; @@ -8229,10 +8083,9 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) break; } - maxDist = 2500.f; soundIntensity = 50.f; - if(params->m_fDistance < maxDist) { + if(params->m_fDistance < SQR(soundIntensity)) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); if(sound != SOUND_PAGER) { switch(sound) { @@ -8264,14 +8117,12 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) } else { switch(sound) { case SOUND_PED_HELI_PLAYER_FOUND: - maxDist = 160000.f; soundIntensity = 400.f; pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 29 + SFX_POLICE_HELI_1; break; case SOUND_PED_BODYCAST_HIT: if(CTimer::GetTimeInMilliseconds() <= gNextCryTime) return; - maxDist = 2500.f; soundIntensity = 50.f; gNextCryTime = CTimer::GetTimeInMilliseconds() + 500; pedComment.m_nSampleIndex = @@ -8279,13 +8130,11 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) break; case SOUND_INJURED_PED_MALE_OUCH: case SOUND_8A: - maxDist = 2500.f; soundIntensity = 50.f; pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 15 + SFX_GENERIC_MALE_GRUNT_1; break; case SOUND_INJURED_PED_FEMALE: - maxDist = 2500.f; soundIntensity = 50.f; pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 11 + SFX_GENERIC_FEMALE_GRUNT_1; @@ -8293,7 +8142,7 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) default: return; } - if(params->m_fDistance < maxDist) { + if(params->m_fDistance < SQR(soundIntensity)) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); if(sound != SOUND_PAGER) { switch(sound) { @@ -8332,8 +8181,8 @@ cAudioManager::Terminate() MusicManager.Terminate(); for(uint32 i = 0; i < totalAudioEntitiesSlots; i++) { - m_asAudioEntities[i].m_bIsUsed = 0; - m_anAudioEntityIndices[i] = 200; + m_asAudioEntities[i].m_bIsUsed = false; + m_anAudioEntityIndices[i] = ARRAY_SIZE(m_anAudioEntityIndices); } m_nAudioEntitiesTotal = 0; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index cac3ea65..81e5c89d 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -53,8 +53,8 @@ enum eScriptSounds : int16 SCRIPT_SOUND_CHINATOWN_RESTAURANT_L = 43, SCRIPT_SOUND_CIPRIANI_RESAURANT_S = 44, SCRIPT_SOUND_CIPRIANI_RESAURANT_L = 45, - SCRIPT_SOUND_46 = 46, - SCRIPT_SOUND_47 = 47, + SCRIPT_SOUND_46_S = 46, + SCRIPT_SOUND_47_L = 47, SCRIPT_SOUND_MARCO_BISTRO_S = 48, SCRIPT_SOUND_MARCO_BISTRO_L = 49, SCRIPT_SOUND_AIRPORT_LOOP_S = 50, @@ -224,9 +224,11 @@ static_assert(sizeof(tPedComment) == 28, "tPedComment: error"); class cPedComments { public: - tPedComment m_asPedComments[2][20]; - uint8 indexMap[2][20]; - uint8 nrOfCommentsInBank[2]; + static constexpr int pedCommentsBanks = 2; + static constexpr int pedCommentsSlots = 20; + tPedComment m_asPedComments[pedCommentsBanks][pedCommentsSlots]; + uint8 indexMap[pedCommentsBanks][pedCommentsSlots]; + uint8 nrOfCommentsInBank[pedCommentsBanks]; uint8 activeBank; uint8 gap_1163[1]; @@ -607,10 +609,20 @@ public: uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist); /// ok public: - static const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); - static const int policeChannel = channels + 1; - static const int allChannels = channels + 2; - static const int maxVolume = 127; + static constexpr int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); + static constexpr int policeChannel = channels + 1; + static constexpr int allChannels = channels + 2; + static constexpr int maxVolume = 127; + + static constexpr int scriptObjectIntensityS = 30; + static constexpr int scriptObjectIntensityL = 80; + static constexpr int bridgeIntensity = 400; + static constexpr int rocketLauncherIntensity = 90; + static constexpr int molotovIntensity = 30; + static constexpr int molotovVolume = 50; + + static constexpr int rainOnVehicleIntensity = 22; + static constexpr int reverseGearIntensity = 30; }; static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error"); diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index c53cab3f..53da89f4 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1,27 +1,29 @@ #include "common.h" #include "patcher.h" #include "main.h" -#include "Pickups.h" + #include "Camera.h" -#include "Entity.h" -#include "Timer.h" -#include "Shadows.h" #include "Coronas.h" -#include "World.h" +#include "Darkel.h" +#include "Entity.h" +#include "Explosion.h" +#include "Font.h" +#include "Garages.h" +#include "General.h" #include "ModelIndices.h" -#include "PlayerPed.h" #include "Object.h" -#include "Pools.h" #include "Pad.h" +#include "Pickups.h" +#include "PlayerPed.h" +#include "PointLights.h" +#include "Pools.h" #include "Script.h" -#include "Darkel.h" -#include "Garages.h" -#include "Explosion.h" -#include "WaterLevel.h" +#include "Shadows.h" #include "SpecialFX.h" -#include "PointLights.h" #include "Sprite.h" -#include "Font.h" +#include "Timer.h" +#include "WaterLevel.h" +#include "World.h" CPickup(&CPickups::aPickUps)[NUMPICKUPS] = *(CPickup(*)[NUMPICKUPS])*(uintptr*)0x878C98; int16 CPickups::NumMessages;// = *(int16*)0x95CC98; @@ -693,7 +695,7 @@ CPickups::DoPickUpEffects(CEntity *entity) CVector &pos = entity->GetPosition(); - float colorModifier = ((double)(rand() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f; + float colorModifier = ((CGeneral::GetRandomNumber() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f; CShadows::StoreStaticShadow( (uintptr)entity, SHADOWTYPE_ADDITIVE, @@ -704,9 +706,9 @@ CPickups::DoPickUpEffects(CEntity *entity) aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier, 4.0f, 1.0f, 40.0f, false, 0.0f); - float radius = (rand() & 0xF) * 0.1f + 3.0f; + float radius = (CGeneral::GetRandomNumber() & 0xF) * 0.1f + 3.0f; CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true); - float size = (rand() & 0xF) * 0.0005f + 0.6f; + float size = (CGeneral::GetRandomNumber() & 0xF) * 0.0005f + 0.6f; CCoronas::RegisterCorona( (uintptr)entity, aWeaponReds[colorId] * modifiedSin / 2.0f, aWeaponGreens[colorId] * modifiedSin / 2.0f, aWeaponBlues[colorId] * modifiedSin / 2.0f, 255, -- cgit v1.2.3