From 72ccf9a0db8a1429da7a0da041f97b993cfc3622 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 May 2020 14:21:09 +0200 Subject: revert accidental commit; also update librw --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 631ca436..357436c6 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -506,7 +506,7 @@ void CRunningScript::Init() #ifdef USE_DEBUG_SCRIPT_LOADER int open_script() { - static int scriptToLoad = 1; + static int scriptToLoad = 0; #ifdef _WIN32 if (GetAsyncKeyState('G') & 0x8000) -- cgit v1.2.3 From 964acba08382cd0748cd46f4676a7b4e9025957a Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 May 2020 15:16:12 +0200 Subject: fix head/hand atomics --- src/modelinfo/PedModelInfo.cpp | 3 +++ src/modelinfo/PedModelInfo.h | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index 0cb0fc36..473e8b63 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -21,16 +21,19 @@ CPedModelInfo::DeleteRwObject(void) frame = RpAtomicGetFrame(m_head); RpAtomicDestroy(m_head); RwFrameDestroy(frame); + m_head = nil; } if(m_lhand){ frame = RpAtomicGetFrame(m_lhand); RpAtomicDestroy(m_lhand); RwFrameDestroy(frame); + m_lhand = nil; } if(m_rhand){ frame = RpAtomicGetFrame(m_rhand); RpAtomicDestroy(m_rhand); RwFrameDestroy(frame); + m_rhand = nil; } #endif CClumpModelInfo::DeleteRwObject(); // PC calls this first diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h index 52f75894..d73d3646 100644 --- a/src/modelinfo/PedModelInfo.h +++ b/src/modelinfo/PedModelInfo.h @@ -36,7 +36,14 @@ public: static RwObjectNameIdAssocation m_pPedIds[PED_NODE_MAX]; - CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { m_hitColModel = nil; } + CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { + m_hitColModel = nil; +#ifdef PED_SKIN + m_head = nil; + m_lhand = nil; + m_rhand = nil; +#endif + } ~CPedModelInfo(void) { delete m_hitColModel; } void DeleteRwObject(void); void SetClump(RpClump *); -- cgit v1.2.3 From 4ab49780b52a78da981136f849862d3bb2b0e577 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 May 2020 15:33:44 +0200 Subject: collect HUD colors at top of file --- src/render/Hud.cpp | 62 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index c3fcb7bf..8c7904ef 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -21,6 +21,26 @@ #include "User.h" #include "World.h" +// Game has colors inlined in code. +// For easier modification we collect them here: +CRGBA MONEY_COLOR(89, 115, 150, 255); +CRGBA AMMO_COLOR(0, 0, 0, 255); +CRGBA HEALTH_COLOR(186, 101, 50, 255); +CRGBA ARMOUR_COLOR(124, 140, 95, 255); +CRGBA WANTED_COLOR(193, 164, 120, 255); +CRGBA ZONE_COLOR(152, 154, 82, 255); +CRGBA VEHICLE_COLOR(194, 165, 120, 255); +CRGBA CLOCK_COLOR(194, 165, 120, 255); +CRGBA TIMER_COLOR(186, 101, 50, 255); +CRGBA COUNTER_COLOR(0, 106, 164, 255); +CRGBA PAGER_COLOR(32, 162, 66, 205); +CRGBA RADARDISC_COLOR(0, 0, 0, 255); +CRGBA BIGMESSAGE_COLOR(85, 119, 133, 255); +CRGBA WASTEDBUSTED_COLOR(170, 123, 87, 255); +CRGBA ODDJOB_COLOR(89, 115, 150, 255); +CRGBA ODDJOB2_COLOR(156, 91, 40, 255); +CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255); + wchar CHud::m_HelpMessage[256]; wchar CHud::m_LastHelpMessage[256]; uint32 CHud::m_HelpMessageState; @@ -252,7 +272,7 @@ void CHud::Draw() CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(43.0f + 2.0f), sPrint); - CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::SetColor(MONEY_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint); /* @@ -312,7 +332,7 @@ void CHud::Draw() CFont::SetFontStyle(FONT_BANK); if (!CDarkel::FrenzyOnGoing() && WeaponType != WEAPONTYPE_UNARMED && WeaponType != WEAPONTYPE_BASEBALLBAT) { - CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::SetColor(AMMO_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(66.0f), SCREEN_SCALE_Y(73.0f), sPrint); } @@ -349,7 +369,7 @@ void CHud::Draw() if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); } - CFont::SetColor(CRGBA(186, 101, 50, 255)); + CFont::SetColor(HEALTH_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(65.0f), sPrint); @@ -380,7 +400,7 @@ void CHud::Draw() CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); } - CFont::SetColor(CRGBA(124, 140, 95, 255)); + CFont::SetColor(ARMOUR_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint); @@ -410,7 +430,7 @@ void CHud::Draw() && (CTimer::GetTimeInMilliseconds() > FindPlayerPed()->m_pWanted->m_nLastWantedLevelChange + 2000 || CTimer::GetFrameCounter() & 4)) { - CFont::SetColor(CRGBA(193, 164, 120, 255)); + CFont::SetColor(WANTED_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(60.0f + 24.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon); } } @@ -504,7 +524,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint); - CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha)); + CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), m_ZoneToPrint); } } @@ -598,7 +618,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint); - CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha)); + CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), m_pVehicleNameToPrint); } } @@ -630,7 +650,7 @@ void CHud::Draw() CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), sPrint); - CFont::SetColor(CRGBA(194, 165, 120, 255)); + CFont::SetColor(CLOCK_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint); /* @@ -674,7 +694,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), sTimer); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); - CFont::SetColor(CRGBA(186, 101, 50, 255)); + CFont::SetColor(TIMER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(110.0f), sTimer); if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) { @@ -683,7 +703,7 @@ void CHud::Draw() CFont::SetScale(SCREEN_SCALE_X(0.64f), SCREEN_SCALE_Y(1.35f)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); - CFont::SetColor(CRGBA(186, 101, 50, 255)); + CFont::SetColor(TIMER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f), SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); } } @@ -718,7 +738,7 @@ void CHud::Draw() 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(COUNTER_COLOR); 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); @@ -735,7 +755,7 @@ void CHud::Draw() 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)); - CFont::SetColor(CRGBA(0, 106, 164, 255)); + CFont::SetColor(COUNTER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f), SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); } } @@ -782,7 +802,7 @@ void CHud::Draw() CFont::SetBackgroundOff(); CFont::SetScale(SCREEN_SCALE_X(0.84f), SCREEN_SCALE_Y(1.0f)); - CFont::SetColor(CRGBA(32, 162, 66, 205)); + CFont::SetColor(PAGER_COLOR); CFont::SetRightJustifyOff(); CFont::SetBackgroundOff(); CFont::SetCentreOff(); @@ -804,7 +824,7 @@ void CHud::Draw() rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); #endif rect.Grow(4.0f); - Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); + Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR); CRadar::DrawBlips(); } } @@ -959,7 +979,7 @@ void CHud::Draw() CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[0]); #endif - CFont::SetColor(CRGBA(85, 119, 133, BigMessageAlpha[0])); + CFont::SetColor(CRGBA(BIGMESSAGE_COLOR.r, BIGMESSAGE_COLOR.g, BIGMESSAGE_COLOR.b, BigMessageAlpha[0])); CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(18.0f), m_BigMessage[0]); } else { @@ -994,7 +1014,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]); - CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2])); + CFont::SetColor(CRGBA(WASTEDBUSTED_COLOR.r, WASTEDBUSTED_COLOR.g, WASTEDBUSTED_COLOR.b, BigMessageAlpha[2])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]); } else { @@ -1186,7 +1206,7 @@ void CHud::DrawAfterFade() CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]); - CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::SetColor(ODDJOB_COLOR); CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[3]); } @@ -1202,7 +1222,7 @@ void CHud::DrawAfterFade() CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]); - CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::SetColor(ODDJOB_COLOR); CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[4]); } @@ -1260,12 +1280,12 @@ void CHud::DrawAfterFade() #ifdef BETA_SLIDING_TEXT CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); - CFont::SetColor(CRGBA(156, 91, 40, 255)); + CFont::SetColor(ODDJOB2_COLOR); CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]); #else CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); - CFont::SetColor(CRGBA(156, 91, 40, 255)); + CFont::SetColor(ODDJOB2_COLOR); CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]); #endif } @@ -1310,7 +1330,7 @@ void CHud::DrawAfterFade() CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]); - CFont::SetColor(CRGBA(220, 172, 2, BigMessageAlpha[1])); + CFont::SetColor(CRGBA(MISSIONTITLE_COLOR.r, MISSIONTITLE_COLOR.g, MISSIONTITLE_COLOR.b, BigMessageAlpha[1])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]); } else { -- cgit v1.2.3 From 91fbfc1d2352f985dfd926c22ffa0938133103c8 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sun, 17 May 2020 21:13:25 +0300 Subject: nullsampman --- src/audio/sampman_null.cpp | 368 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 src/audio/sampman_null.cpp (limited to 'src') diff --git a/src/audio/sampman_null.cpp b/src/audio/sampman_null.cpp new file mode 100644 index 00000000..6ec8a521 --- /dev/null +++ b/src/audio/sampman_null.cpp @@ -0,0 +1,368 @@ +#include "common.h" +#if !defined(AUDIO_OAL) && !defined(AUDIO_MSS) +#include "sampman.h" +#include "AudioManager.h" + +cSampleManager SampleManager; +bool _bSampmanInitialised = false; + +uint32 BankStartOffset[MAX_SAMPLEBANKS]; +uint32 nNumMP3s; + +cSampleManager::cSampleManager(void) +{ + ; +} + +cSampleManager::~cSampleManager(void) +{ + +} + +void cSampleManager::SetSpeakerConfig(int32 nConfig) +{ + +} + +uint32 cSampleManager::GetMaximumSupportedChannels(void) +{ + return MAXCHANNELS; +} + +uint32 cSampleManager::GetNum3DProvidersAvailable() +{ + return 1; +} + +void cSampleManager::SetNum3DProvidersAvailable(uint32 num) +{ + +} + +char *cSampleManager::Get3DProviderName(uint8 id) +{ + static char name[64] = "NULL"; + return name; +} + +void cSampleManager::Set3DProviderName(uint8 id, char *name) +{ + +} + +int8 cSampleManager::GetCurrent3DProviderIndex(void) +{ + return 0; +} + +int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider) +{ + return 0; +} + +bool +cSampleManager::IsMP3RadioChannelAvailable(void) +{ + return nNumMP3s != 0; +} + + +void cSampleManager::ReleaseDigitalHandle(void) +{ +} + +void cSampleManager::ReacquireDigitalHandle(void) +{ +} + +bool +cSampleManager::Initialise(void) +{ + return true; +} + +void +cSampleManager::Terminate(void) +{ + +} + +bool cSampleManager::CheckForAnAudioFileOnCD(void) +{ + return true; +} + +char cSampleManager::GetCDAudioDriveLetter(void) +{ + return '\0'; +} + +void +cSampleManager::UpdateEffectsVolume(void) +{ + +} + +void +cSampleManager::SetEffectsMasterVolume(uint8 nVolume) +{ +} + +void +cSampleManager::SetMusicMasterVolume(uint8 nVolume) +{ +} + +void +cSampleManager::SetEffectsFadeVolume(uint8 nVolume) +{ +} + +void +cSampleManager::SetMusicFadeVolume(uint8 nVolume) +{ +} + +void +cSampleManager::SetMonoMode(uint8 nMode) +{ +} + +bool +cSampleManager::LoadSampleBank(uint8 nBank) +{ + ASSERT( nBank < MAX_SAMPLEBANKS ); + return false; +} + +void +cSampleManager::UnloadSampleBank(uint8 nBank) +{ + ASSERT( nBank < MAX_SAMPLEBANKS ); +} + +bool +cSampleManager::IsSampleBankLoaded(uint8 nBank) +{ + ASSERT( nBank < MAX_SAMPLEBANKS ); + + return false; +} + +bool +cSampleManager::IsPedCommentLoaded(uint32 nComment) +{ + ASSERT( nComment < TOTAL_AUDIO_SAMPLES ); + + return false; +} + + +int32 +cSampleManager::_GetPedCommentSlot(uint32 nComment) +{ + return -1; +} + +bool +cSampleManager::LoadPedComment(uint32 nComment) +{ + ASSERT( nComment < TOTAL_AUDIO_SAMPLES ); + return false; +} + +int32 +cSampleManager::GetBankContainingSound(uint32 offset) +{ + return SAMPLEBANK_INVALID; +} + +int32 +cSampleManager::GetSampleBaseFrequency(uint32 nSample) +{ + ASSERT( nSample < TOTAL_AUDIO_SAMPLES ); + return 0; +} + +int32 +cSampleManager::GetSampleLoopStartOffset(uint32 nSample) +{ + ASSERT( nSample < TOTAL_AUDIO_SAMPLES ); + return 0; +} + +int32 +cSampleManager::GetSampleLoopEndOffset(uint32 nSample) +{ + ASSERT( nSample < TOTAL_AUDIO_SAMPLES ); + return 0; +} + +uint32 +cSampleManager::GetSampleLength(uint32 nSample) +{ + ASSERT( nSample < TOTAL_AUDIO_SAMPLES ); + return 0; +} + +bool cSampleManager::UpdateReverb(void) +{ + return false; +} + +void +cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag) +{ + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +bool +cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) +{ + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + return false; +} + +void +cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume) +{ + ASSERT( nChannel != CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +void +cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ) +{ + ASSERT( nChannel != CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +void +cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin) +{ + ASSERT( nChannel != CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +void +cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) +{ + ASSERT( nChannel == CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +void +cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan) +{ + ASSERT(nChannel == CHANNEL2D); + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +void +cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq) +{ + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +void +cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd) +{ + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +void +cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount) +{ + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +bool +cSampleManager::GetChannelUsedFlag(uint32 nChannel) +{ + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + + return false; +} + +void +cSampleManager::StartChannel(uint32 nChannel) +{ + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +void +cSampleManager::StopChannel(uint32 nChannel) +{ + ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); +} + +void +cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream) +{ + ASSERT( nStream < MAX_STREAMS ); +} + +void +cSampleManager::PauseStream(uint8 nPauseFlag, uint8 nStream) +{ + ASSERT( nStream < MAX_STREAMS ); +} + +void +cSampleManager::StartPreloadedStreamedFile(uint8 nStream) +{ + ASSERT( nStream < MAX_STREAMS ); +} + +bool +cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) +{ + ASSERT( nStream < MAX_STREAMS ); + + return false; +} + +void +cSampleManager::StopStreamedFile(uint8 nStream) +{ + ASSERT( nStream < MAX_STREAMS ); +} + +int32 +cSampleManager::GetStreamedFilePosition(uint8 nStream) +{ + ASSERT( nStream < MAX_STREAMS ); + + return 0; +} + +void +cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream) +{ + ASSERT( nStream < MAX_STREAMS ); +} + +int32 +cSampleManager::GetStreamedFileLength(uint8 nStream) +{ + ASSERT( nStream < TOTAL_STREAMED_SOUNDS ); + + return 1; +} + +bool +cSampleManager::IsStreamPlaying(uint8 nStream) +{ + ASSERT( nStream < MAX_STREAMS ); + + return false; +} + +bool +cSampleManager::InitialiseSampleBanks(void) +{ + + return true; +} + +#endif -- cgit v1.2.3 From d4a429d986908a36618fc58b52db87d5752fde20 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 May 2020 22:24:23 +0200 Subject: little cleanup on radar --- src/core/Radar.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/core/Radar.h b/src/core/Radar.h index 7d07671d..ec2bacd0 100644 --- a/src/core/Radar.h +++ b/src/core/Radar.h @@ -26,27 +26,27 @@ enum eRadarSprite RADAR_SPRITE_COORD_BLIP = -1, #endif RADAR_SPRITE_NONE = 0, - RADAR_SPRITE_ASUKA = 1, - RADAR_SPRITE_BOMB = 2, - RADAR_SPRITE_CAT = 3, - RADAR_SPRITE_CENTRE = 4, - RADAR_SPRITE_COPCAR = 5, - RADAR_SPRITE_DON = 6, - RADAR_SPRITE_EIGHT = 7, - RADAR_SPRITE_EL = 8, - RADAR_SPRITE_ICE = 9, - RADAR_SPRITE_JOEY = 10, - RADAR_SPRITE_KENJI = 11, - RADAR_SPRITE_LIZ = 12, - RADAR_SPRITE_LUIGI = 13, - RADAR_SPRITE_NORTH = 14, - RADAR_SPRITE_RAY = 15, - RADAR_SPRITE_SAL = 16, - RADAR_SPRITE_SAVE = 17, - RADAR_SPRITE_SPRAY = 18, - RADAR_SPRITE_TONY = 19, - RADAR_SPRITE_WEAPON = 20, - RADAR_SPRITE_COUNT = 21, + RADAR_SPRITE_ASUKA, + RADAR_SPRITE_BOMB, + RADAR_SPRITE_CAT, + RADAR_SPRITE_CENTRE, + RADAR_SPRITE_COPCAR, + RADAR_SPRITE_DON, + RADAR_SPRITE_EIGHT, + RADAR_SPRITE_EL, + RADAR_SPRITE_ICE, + RADAR_SPRITE_JOEY, + RADAR_SPRITE_KENJI, + RADAR_SPRITE_LIZ, + RADAR_SPRITE_LUIGI, + RADAR_SPRITE_NORTH, + RADAR_SPRITE_RAY, + RADAR_SPRITE_SAL, + RADAR_SPRITE_SAVE, + RADAR_SPRITE_SPRAY, + RADAR_SPRITE_TONY, + RADAR_SPRITE_WEAPON, + RADAR_SPRITE_COUNT }; enum @@ -104,7 +104,7 @@ public: static CSprite2d SpraySprite; static CSprite2d TonySprite; static CSprite2d WeaponSprite; - static CSprite2d *RadarSprites[21]; + static CSprite2d *RadarSprites[RADAR_SPRITE_COUNT]; static float cachedCos; static float cachedSin; #ifdef MENU_MAP -- cgit v1.2.3 From 9b09aa3384213dab45db023d95487096e64ad5c6 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 18 May 2020 16:40:30 +0200 Subject: fixes for braking and cloud rotation at high fps --- src/render/Clouds.cpp | 5 +++++ src/vehicles/Vehicle.cpp | 3 +++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp index 9c0fde0f..60450213 100644 --- a/src/render/Clouds.cpp +++ b/src/render/Clouds.cpp @@ -69,8 +69,13 @@ void CClouds::Update(void) { float s = Sin(TheCamera.Orientation - 0.85f); +#ifdef FIX_BUGS + CloudRotation += CWeather::Wind*s*0.0025f*CTimer::GetTimeStepFix(); + IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f*CTimer::GetTimeStepFix()) * 60.0f; +#else CloudRotation += CWeather::Wind*s*0.0025f; IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f) * 60.0f; +#endif } void diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 5dc7bc72..f85f0d50 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -514,6 +514,9 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon brake = 0.2f * mod_HandlingManager.field_4 / m_fMass; else brake = mod_HandlingManager.field_4 / m_fMass; +#ifdef FIX_BUGS + brake *= CTimer::GetTimeStepFix(); +#endif } } -- cgit v1.2.3 From 2588e69849c3a0e4d8c234a3a0e425fceb973d97 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 18 May 2020 16:55:38 +0200 Subject: some less certainly fps fixes --- src/vehicles/Automobile.cpp | 6 ++++++ src/vehicles/Vehicle.cpp | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 83fe44d5..2212ddff 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -871,8 +871,14 @@ CAutomobile::ProcessControl(void) CVector wheelFwd = GetForward(); CVector wheelRight = GetRight(); +#ifdef FIX_BUGS + // Not sure if this is needed, but brake usually has timestep as a factor + if(bIsHandbrakeOn) + brake = 20000.0f * CTimer::GetTimeStepFix(); +#else if(bIsHandbrakeOn) brake = 20000.0f; +#endif if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f){ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index f85f0d50..6646f7f3 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -487,6 +487,11 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon if(contactSpeedRight != 0.0f){ // exert opposing force right = -contactSpeedRight/wheelsOnGround; +#ifdef FIX_BUGS + // contactSpeedRight is independent of framerate but right has timestep as a factor + // so we probably have to fix this + right *= CTimer::GetTimeStepFix(); +#endif if(wheelStatus == WHEEL_STATUS_BURST){ float fwdspeed = Min(contactSpeedFwd, 0.3f); @@ -507,6 +512,11 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon } }else if(contactSpeedFwd != 0.0f){ fwd = -contactSpeedFwd/wheelsOnGround; +#ifdef FIX_BUGS + // contactSpeedFwd is independent of framerate but fwd has timestep as a factor + // so we probably have to fix this + fwd *= CTimer::GetTimeStepFix(); +#endif if(!bBraking){ if(m_fGasPedal < 0.01f){ -- cgit v1.2.3 From e891cf858f7d2a7c5bbb4ff46400508ffbe3c8b9 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 18 May 2020 20:17:24 +0300 Subject: Remove MAX_VOLUME dups --- src/audio/AudioLogic.cpp | 133 ++++++++++++++++++++++----------------------- src/audio/AudioManager.cpp | 5 +- src/audio/MusicManager.cpp | 6 +- src/audio/PoliceRadio.cpp | 3 +- 4 files changed, 71 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 2a6581ee..6f1a3432 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -41,7 +41,6 @@ const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int policeChannel = channels + 1; const int allChannels = channels + 2; -const int maxVolume = 127; uint32 gPornNextTime; uint32 gSawMillNextTime; @@ -207,8 +206,8 @@ cAudioManager::ProcessSpecial() if (m_nUserPause) { if (!m_nPreviousUserPause) { MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND); - SampleManager.SetEffectsFadeVolume(maxVolume); - SampleManager.SetMusicFadeVolume(maxVolume); + SampleManager.SetEffectsFadeVolume(MAX_VOLUME); + SampleManager.SetMusicFadeVolume(MAX_VOLUME); } } else { if (m_nPreviousUserPause) { @@ -2566,7 +2565,7 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params) float dist; float baseDist; int32 emittingVol; - static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, maxVolume}, {60.f, 30.f, maxVolume}}; + static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, MAX_VOLUME}, {60.f, 30.f, MAX_VOLUME}}; if (gHeliSfxRanges[0].m_fMaxDistance * gHeliSfxRanges[0].m_fMaxDistance <= params->m_fDistance) return false; @@ -2691,15 +2690,15 @@ cAudioManager::ProcessJumboAccel(CPlane *plane) modificator = (plane->m_fSpeed - 0.10334f) * 1.676f; if (modificator > 1.0f) modificator = 1.0f; - if (SetupJumboRumbleSound(maxVolume * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { + if (SetupJumboRumbleSound(MAX_VOLUME * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { if (modificator < 0.2f) { whineSoundFreq = modificator * 5.f * 14600.0f + 29500; - vol = modificator * 5.f * maxVolume; + vol = modificator * 5.f * MAX_VOLUME; engineFreq = modificator * 5.f * 6050.f + 16000; } else { whineSoundFreq = 44100; engineFreq = 22050; - vol = maxVolume; + vol = MAX_VOLUME; } SetupJumboEngineSound(vol, engineFreq); SetupJumboWhineSound(18, whineSoundFreq); @@ -2712,8 +2711,8 @@ cAudioManager::ProcessJumboTakeOff(CPlane *plane) { const float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f; - if (SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(maxVolume * (1.f - modificator))) { - if (SetupJumboEngineSound(maxVolume, 22050)) + if (SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(MAX_VOLUME * (1.f - modificator))) { + if (SetupJumboEngineSound(MAX_VOLUME, 22050)) SetupJumboWhineSound(18.f * (1.f - modificator), 44100); } } @@ -2721,7 +2720,7 @@ cAudioManager::ProcessJumboTakeOff(CPlane *plane) void cAudioManager::ProcessJumboFlying() { - if (SetupJumboFlySound(maxVolume)) + if (SetupJumboFlySound(MAX_VOLUME)) SetupJumboEngineSound(63, 22050); } @@ -2731,7 +2730,7 @@ cAudioManager::ProcessJumboLanding(CPlane *plane) const float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f; if (SetupJumboFlySound(107.f * modificator + 20)) { if (SetupJumboTaxiSound(75.f * (1.f - modificator))) { - SetupJumboEngineSound(maxVolume, 22050); + SetupJumboEngineSound(MAX_VOLUME, 22050); SetupJumboWhineSound(18.f * (1.f - modificator), 14600.f * modificator + 29500); } } @@ -2742,7 +2741,7 @@ cAudioManager::ProcessJumboDecel(CPlane *plane) { if (SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) { const float modificator = Min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f); - SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000); + SetupJumboEngineSound(MAX_VOLUME * modificator, 6050.f * modificator + 16000); SetupJumboWhineSound(18, 29500); } } @@ -2906,7 +2905,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nCounter = 6; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; m_sQueueSample.m_nFrequency += 200; - m_sQueueSample.m_nOffset = maxVolume; + m_sQueueSample.m_nOffset = MAX_VOLUME; AddSampleToRequestedQueue(); } return true; @@ -3795,11 +3794,11 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) case SOUND_AMMUNATION_WELCOME_1: case SOUND_AMMUNATION_WELCOME_2: case SOUND_AMMUNATION_WELCOME_3: - emittingVol = maxVolume; + emittingVol = MAX_VOLUME; break; default: if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, true, false, false, false, false, false)) - emittingVol = maxVolume; + emittingVol = MAX_VOLUME; else emittingVol = 31; break; @@ -6265,7 +6264,7 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_nLoopCount = 1; AudioManager.m_sQueueSample.m_nLoopStart = 0; AudioManager.m_sQueueSample.m_nLoopEnd = -1; - AudioManager.m_sQueueSample.m_nEmittingVolume = maxVolume; + AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; switch (sampleIndex) { case SFX_POLICE_HELI_1: @@ -6376,7 +6375,7 @@ cAudioManager::ProcessExplosions(int32 explosion) distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -6384,7 +6383,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_bReverbFlag = true; @@ -6580,7 +6579,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_STATION_ANNOUNCE); m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -6777,7 +6776,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6787,7 +6786,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6797,7 +6796,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6807,7 +6806,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6817,7 +6816,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6827,7 +6826,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6837,7 +6836,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6847,7 +6846,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6857,7 +6856,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6867,7 +6866,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6877,7 +6876,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6887,7 +6886,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6897,7 +6896,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6907,7 +6906,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6917,7 +6916,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6927,7 +6926,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6937,7 +6936,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6947,7 +6946,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6957,7 +6956,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6967,7 +6966,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6977,7 +6976,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6987,7 +6986,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6997,7 +6996,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7007,7 +7006,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7017,7 +7016,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7027,7 +7026,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7037,7 +7036,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7047,7 +7046,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7057,7 +7056,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7067,7 +7066,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7209,7 +7208,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_PIANO_BAR_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PIANO_BAR_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7219,7 +7218,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7259,7 +7258,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7269,7 +7268,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7279,7 +7278,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7289,7 +7288,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7304,7 +7303,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7315,7 +7314,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7325,7 +7324,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7335,7 +7334,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7429,7 +7428,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) 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_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nCounter = 0; @@ -7438,7 +7437,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) m_sQueueSample.m_bReleasingSoundFlag = false; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_bReverbFlag = true; @@ -8155,7 +8154,7 @@ cAudioManager::ProcessFrontEnd() if (stereo) { ++m_sQueueSample.m_nSampleIndex; m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_nOffset = maxVolume - m_sQueueSample.m_nOffset; + m_sQueueSample.m_nOffset = MAX_VOLUME - m_sQueueSample.m_nOffset; AddSampleToRequestedQueue(); } } @@ -8224,7 +8223,7 @@ cAudioManager::ProcessProjectiles() if (CProjectileInfo::GetProjectileInfo(i)->m_bInUse) { switch (CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) { case WEAPONTYPE_ROCKETLAUNCHER: - emittingVol = maxVolume; + emittingVol = MAX_VOLUME; m_sQueueSample.m_fSoundIntensity = rocketLauncherIntensity; m_sQueueSample.m_nSampleIndex = SFX_ROCKET_FLY; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -8498,7 +8497,7 @@ void cAudioManager::ProcessBridgeMotor() { if (m_sQueueSample.m_fDistance < bridgeIntensity) { - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name @@ -8507,7 +8506,7 @@ cAudioManager::ProcessBridgeMotor() m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = 5500; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -8540,7 +8539,7 @@ cAudioManager::ProcessBridgeOneShots() } } if (m_sQueueSample.m_fDistance < bridgeIntensity) { - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -8548,7 +8547,7 @@ cAudioManager::ProcessBridgeOneShots() m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 458341b9..bd1ac84b 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -16,7 +16,6 @@ cAudioManager AudioManager; const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int policeChannel = channels + 1; const int allChannels = channels + 2; -const int maxVolume = 127; cAudioManager::cAudioManager() { @@ -548,7 +547,7 @@ cAudioManager::AddSampleToRequestedQueue() bool bReflections; if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) { - calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (maxVolume - m_sQueueSample.m_nVolume); + calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (MAX_VOLUME - m_sQueueSample.m_nVolume); sampleIndex = m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; if (sampleIndex >= m_nActiveSamples) { sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1]; @@ -942,7 +941,7 @@ void cAudioManager::GenerateIntegerRandomNumberTable() { for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) { - m_anRandomTable[i] = rand(); + m_anRandomTable[i] = myrand(); } } diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index fd02691e..8e8e9c24 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -21,8 +21,6 @@ int32 gNumRetunePresses; int32 gRetuneCounter; bool bHasStarted; -const int maxVolume = 127; - cMusicManager::cMusicManager() { m_bIsInitialised = false; @@ -375,7 +373,7 @@ cMusicManager::Service() if (!m_bIsInitialised || m_bDisabled) return; if (m_nMusicMode == MUSICMODE_CUTSCENE) { - SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0); return; } @@ -676,7 +674,7 @@ cMusicManager::PreloadCutSceneMusic(uint8 track) while (SampleManager.IsStreamPlaying(0)) SampleManager.StopStreamedFile(0); SampleManager.PreloadStreamedFile(track, 0); - SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0); m_nCurrentStreamedSound = track; } } diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index ec02368e..af346479 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -14,7 +14,6 @@ #include "Zones.h" #include "sampman.h" -const int maxVolume = 127; const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int policeChannel = channels + 1; @@ -225,7 +224,7 @@ cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel) } } else if (!SampleManager.GetChannelUsedFlag(policeChannel)) { SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1); - SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 1); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 1); SampleManager.StartPreloadedStreamedFile(1); g_nMissionAudioPlayingStatus = 1; bMissionAudioPhysicalPlayingStatus = 0; -- cgit v1.2.3 From 6bf79120dcd535dc6a63c4d0da858444facb0d8d Mon Sep 17 00:00:00 2001 From: shfil Date: Mon, 18 May 2020 21:08:01 +0200 Subject: Fix string assignment (aldlist.cpp) --- src/audio/oal/aldlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/audio/oal/aldlist.cpp b/src/audio/oal/aldlist.cpp index 458b7c80..7401e036 100644 --- a/src/audio/oal/aldlist.cpp +++ b/src/audio/oal/aldlist.cpp @@ -73,7 +73,7 @@ ALDeviceList::ALDeviceList() if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) { memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); ALDeviceInfo.bSelected = true; - ALDeviceInfo.strDeviceName.assign(actualDeviceName, strlen(actualDeviceName)); + ALDeviceInfo.strDeviceName = actualDeviceName; alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); -- cgit v1.2.3 From 746f2aa47903d6aaeaa8046d8397458617460876 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 18 May 2020 22:43:06 +0300 Subject: script FPS fix --- src/control/Script.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 357436c6..844b1858 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -6862,7 +6862,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) float heading = LimitAngleOnCircle( RADTODEG(Atan2(-pObject->GetForward().x, pObject->GetForward().y))); float headingTarget = *(float*)&ScriptParams[1]; +#ifdef FIX_BUGS + float rotateBy = *(float*)&ScriptParams[2] * CTimer::GetTimeStepFix(); +#else float rotateBy = *(float*)&ScriptParams[2]; +#endif if (headingTarget == heading) { // using direct comparasion here is fine UpdateCompareFlag(true); return 0; @@ -6911,7 +6915,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) assert(pObject); CVector pos = pObject->GetPosition(); CVector posTarget = *(CVector*)&ScriptParams[1]; +#ifdef FIX_BUGS + CVector slideBy = *(CVector*)&ScriptParams[4] * CTimer::GetTimeStepFix(); +#else CVector slideBy = *(CVector*)&ScriptParams[4]; +#endif if (posTarget == pos) { // using direct comparasion here is fine UpdateCompareFlag(true); return 0; -- cgit v1.2.3 From c47292b518724c003a5c4b3f79e24de9fdf56f99 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 19 May 2020 00:10:45 +0300 Subject: script fix --- src/control/Script.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 844b1858..864799f8 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -759,6 +759,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) case COMMAND_WAIT: CollectParameters(&m_nIp, 1); m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0]; + m_bSkipWakeTime = false; return 1; case COMMAND_GOTO: CollectParameters(&m_nIp, 1); -- cgit v1.2.3 From 0d0f4da27ad982c5281f5949c22cb62593e2aab9 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 19 May 2020 13:09:20 +0200 Subject: little cleanup of handlingmgr --- src/core/config.h | 2 -- src/vehicles/HandlingMgr.cpp | 2 +- src/vehicles/HandlingMgr.h | 6 ++++-- src/vehicles/Vehicle.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/core/config.h b/src/core/config.h index d9f892a6..40882128 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -65,8 +65,6 @@ enum Config { NUMATTRIBZONES = 288, NUMZONEINDICES = 55000, - NUMHANDLINGS = 57, - PATHNODESIZE = 4500, NUMWEATHERS = 4, diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 3ac0da38..5beed29e 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -78,7 +78,7 @@ cHandlingDataMgr::Initialise(void) { LoadHandlingData(); field_0 = 0.1f; - field_4 = 0.9f; + fWheelFriction = 0.9f; field_8 = 1.0f; field_C = 0.8f; field_10 = 0.98f; diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 398a415f..10e25573 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -60,7 +60,9 @@ enum eHandlingId HANDLING_PANLANT, HANDLING_FLATBED, HANDLING_YANKEE, - HANDLING_BORGNINE + HANDLING_BORGNINE, + + NUMHANDLINGS }; enum @@ -120,7 +122,7 @@ class cHandlingDataMgr { float field_0; // unused it seems public: - float field_4; // wheel related + float fWheelFriction; // wheel related private: float field_8; // float field_C; // unused it seems diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 6646f7f3..0dd95faf 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -521,9 +521,9 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon if(!bBraking){ if(m_fGasPedal < 0.01f){ if(GetModelIndex() == MI_RCBANDIT) - brake = 0.2f * mod_HandlingManager.field_4 / m_fMass; + brake = 0.2f * mod_HandlingManager.fWheelFriction / m_fMass; else - brake = mod_HandlingManager.field_4 / m_fMass; + brake = mod_HandlingManager.fWheelFriction / m_fMass; #ifdef FIX_BUGS brake *= CTimer::GetTimeStepFix(); #endif -- cgit v1.2.3 From bdbe5d1080066073f063d653e80df6dbf4b326a2 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 19 May 2020 20:56:42 +0200 Subject: CEntity and friends --- src/control/Pickups.cpp | 73 ------ src/control/Script.cpp | 17 +- src/control/TrafficLights.cpp | 5 +- src/core/Camera.cpp | 11 +- src/core/Camera.h | 1 - src/core/Placeable.cpp | 2 - src/core/Placeable.h | 1 - src/core/World.cpp | 24 +- src/entities/Entity.cpp | 517 +++++++++++++++++++++++++---------------- src/entities/Entity.h | 11 +- src/entities/Physical.cpp | 12 +- src/modelinfo/ModelIndices.cpp | 6 +- src/modelinfo/ModelIndices.h | 452 +++++++++++++---------------------- src/objects/Object.cpp | 10 +- src/objects/Object.h | 4 +- src/peds/Population.cpp | 22 +- src/render/2dEffect.h | 5 +- src/render/Clouds.cpp | 2 - src/render/Coronas.cpp | 11 +- src/render/Coronas.h | 6 +- src/render/Renderer.cpp | 12 +- src/render/WindModifiers.cpp | 8 + src/render/WindModifiers.h | 7 + src/vehicles/Automobile.cpp | 2 + src/vehicles/Cranes.cpp | 2 + src/vehicles/HandlingMgr.cpp | 2 + 26 files changed, 578 insertions(+), 647 deletions(-) create mode 100644 src/render/WindModifiers.cpp create mode 100644 src/render/WindModifiers.h (limited to 'src') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 01a28193..86ae4440 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1148,45 +1148,6 @@ CPacManPickups::Update() void CPacManPickups::GeneratePMPickUps(CVector pos, float scrambleMult, int16 count, uint8 type) { - int i = 0; - while (count > 0) { - while (aPMPickUps[i].m_eType != PACMAN_NONE) - i++; - - bool bPickupCreated = false; - while (!bPickupCreated) { - CVector newPos = pos; - CColPoint colPoint; - CEntity *pRoad; - uint16 nRand = CGeneral::GetRandomNumber(); - newPos.x += ((nRand & 0xFF) - 128) * scrambleMult / 128.0f; - newPos.y += (((nRand >> 8) & 0xFF) - 128) * scrambleMult / 128.0f; - newPos.z = 1000.0f; - if (CWorld::ProcessVerticalLine(newPos, -1000.0f, colPoint, pRoad, true, false, false, false, true, false, nil) && pRoad->IsBuilding() && ((CBuilding*)pRoad)->GetIsATreadable()) { - newPos.z = 0.7f + colPoint.point.z; - aPMPickUps[i].m_eType = type; - aPMPickUps[i].m_vecPosn = newPos; - CObject *obj = new CObject(MI_BULLION, true); - if (obj != nil) { - obj->ObjectCreatedBy = MISSION_OBJECT; - obj->SetPosition(aPMPickUps[i].m_vecPosn); - obj->SetOrientation(0.0f, 0.0f, -HALFPI); - obj->GetMatrix().UpdateRW(); - obj->UpdateRwFrame(); - - obj->bAffectedByGravity = false; - obj->bExplosionProof = true; - obj->bUsesCollision = false; - obj->bIsPickup = false; - CWorld::Add(obj); - } - aPMPickUps[i].m_pObject = obj; - bPickupCreated = true; - } - } - count--; - } - bPMActive = true; } // diablo porn mission pickups @@ -1303,40 +1264,6 @@ static const CVector aRacePoints1[] = { void CPacManPickups::GeneratePMPickUpsForRace(int32 race) { - const CVector *pPos = nil; - int i = 0; - - if (race == 0) pPos = aRacePoints1; // there's only one available - assert(pPos != nil); - - while (!pPos->IsZero()) { - while (aPMPickUps[i].m_eType != PACMAN_NONE) - i++; - - aPMPickUps[i].m_eType = PACMAN_RACE; - aPMPickUps[i].m_vecPosn = *(pPos++); - if (race == 0) { - CObject* obj = new CObject(MI_DONKEYMAG, true); - if (obj != nil) { - obj->ObjectCreatedBy = MISSION_OBJECT; - - obj->SetPosition(aPMPickUps[i].m_vecPosn); - obj->SetOrientation(0.0f, 0.0f, -HALFPI); - obj->GetMatrix().UpdateRW(); - obj->UpdateRwFrame(); - - obj->bAffectedByGravity = false; - obj->bExplosionProof = true; - obj->bUsesCollision = false; - obj->bIsPickup = false; - - CWorld::Add(obj); - } - aPMPickUps[i].m_pObject = obj; - } else - aPMPickUps[i].m_pObject = nil; - } - bPMActive = true; } void diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 2ad1e9de..cc5c698b 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -7167,12 +7167,13 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) } case COMMAND_CREATE_FLOATING_PACKAGE: { - CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; - if (pos.z <= MAP_Z_LOW_LIMIT) - pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; - ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_FLOATPACKAGE1, PICKUP_FLOATINGPACKAGE, 0); - StoreParameters(&m_nIp, 1); +// removed in MIAMI +// CollectParameters(&m_nIp, 3); +// CVector pos = *(CVector*)&ScriptParams[0]; +// if (pos.z <= MAP_Z_LOW_LIMIT) +// pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; +// ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_FLOATPACKAGE1, PICKUP_FLOATINGPACKAGE, 0); +// StoreParameters(&m_nIp, 1); return 0; } case COMMAND_PLACE_OBJECT_RELATIVE_TO_CAR: @@ -8626,8 +8627,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) return 0; } case COMMAND_GET_BODY_CAST_HEALTH: - ScriptParams[0] = CObject::nBodyCastHealth; - StoreParameters(&m_nIp, 1); + // ScriptParams[0] = CObject::nBodyCastHealth; + // StoreParameters(&m_nIp, 1); return 0; case COMMAND_SET_CHARS_CHATTING: { diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp index 500d6af2..b1816936 100644 --- a/src/control/TrafficLights.cpp +++ b/src/control/TrafficLights.cpp @@ -145,7 +145,10 @@ CTrafficLights::ScanForLightsOnMap(void) CPtrList &list = CWorld::GetSector(x, y)->m_lists[ENTITYLIST_DUMMIES]; for(node = list.first; node; node = node->next){ CEntity *light = (CEntity*)node->item; - if(light->GetModelIndex() != MI_TRAFFICLIGHTS) + if(light->GetModelIndex() != MI_TRAFFICLIGHTS && + light->GetModelIndex() != MI_TRAFFICLIGHTS_VERTICAL && + light->GetModelIndex() != MI_TRAFFICLIGHTS_MIAMI && + light->GetModelIndex() != MI_TRAFFICLIGHTS_TWOVERTICAL) continue; // Check cars diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 1efe6bae..fa5e44bb 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -82,10 +82,6 @@ CCamera::CCamera(void) Init(); } -CCamera::CCamera(float) -{ -} - void CCamera::Init(void) { @@ -93,12 +89,7 @@ CCamera::Init(void) float fMouseAccelHorzntl = m_fMouseAccelHorzntl; float fMouseAccelVertical = m_fMouseAccelVertical; #endif -#ifdef FIX_BUGS - static const CCamera DummyCamera = CCamera(0.f); - *this = DummyCamera; -#else - memset(this, 0, sizeof(CCamera)); // getting rid of vtable, eh? -#endif + memset(this, 0, sizeof(CCamera)); // this is fine, no vtable #ifdef GTA3_1_1_PATCH m_fMouseAccelHorzntl = fMouseAccelHorzntl; m_fMouseAccelVertical = fMouseAccelVertical; diff --git a/src/core/Camera.h b/src/core/Camera.h index 8f2b6c51..135f9d8f 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -549,7 +549,6 @@ public: // High level and misc CCamera(void); - CCamera(float); void Init(void); void Process(void); void CamControl(void); diff --git a/src/core/Placeable.cpp b/src/core/Placeable.cpp index 69b3d3ea..6efc1540 100644 --- a/src/core/Placeable.cpp +++ b/src/core/Placeable.cpp @@ -7,8 +7,6 @@ CPlaceable::CPlaceable(void) m_matrix.SetScale(1.0f); } -CPlaceable::~CPlaceable(void) = default; - void CPlaceable::SetHeading(float angle) { diff --git a/src/core/Placeable.h b/src/core/Placeable.h index 970c0d48..22f7583c 100644 --- a/src/core/Placeable.h +++ b/src/core/Placeable.h @@ -9,7 +9,6 @@ public: CMatrix m_matrix; CPlaceable(void); - virtual ~CPlaceable(void); const CVector &GetPosition(void) { return m_matrix.GetPosition(); } void SetPosition(float x, float y, float z) { m_matrix.GetPosition().x = x; diff --git a/src/core/World.cpp b/src/core/World.cpp index f6817f8b..16e5e80d 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1813,18 +1813,22 @@ void CWorld::RepositionOneObject(CEntity *pEntity) { int16 modelId = pEntity->GetModelIndex(); - if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || - modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || - modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || - modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || - modelId == MI_PHONESIGN || modelId == MI_TAXISIGN || modelId == MI_FISHSTALL01 || - modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 || - modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT || - modelId == MI_PARKTABLE) { + if (modelId == MI_PARKINGMETER || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || + modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || + modelId == MI_DUMP1 || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || + modelId == MI_PHONESIGN || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT || + modelId == MI_PARKTABLE || modelId == MI_PARKINGMETER2 || modelId == MI_TELPOLE02 || + modelId == MI_PARKBENCH || modelId == MI_BARRIER1 || IsTreeModel(modelId) +// TODO(MIAMI): this is actually a different case +|| IsStreetLight(modelId) + ) { CVector &position = pEntity->GetMatrix().GetPosition(); - float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z; + CColModel *pColModel = pEntity->GetColModel(); + float fBoundingBoxMinZ = pColModel->boundingBox.min.z; + float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; + if(fHeight < OBJECT_REPOSITION_OFFSET_Z) fHeight = OBJECT_REPOSITION_OFFSET_Z; position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, - position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - + position.z + fHeight, nil) - fBoundingBoxMinZ; pEntity->m_matrix.UpdateRW(); pEntity->UpdateRwFrame(); diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index e83df204..efa67f36 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -30,6 +30,9 @@ #include "Renderer.h" #include "Ped.h" #include "Dummy.h" +#include "WindModifiers.h" + +//--MIAMI: file almost done (see TODO) int gBuildings; @@ -80,7 +83,7 @@ CEntity::CEntity(void) bIsStaticWaitingForCollision = false; m_flagE10 = false; bUnderwater = false; - m_flagE40 = false; + bHasPreRenderEffects = false; m_scanCode = 0; m_modelIndex = -1; @@ -276,6 +279,21 @@ CEntity::Remove(void) } } +void +CEntity::SetModelIndex(uint32 id) +{ + m_modelIndex = id; + bHasPreRenderEffects = HasPreRenderEffects(); + CreateRwObject(); +} + +void +CEntity::SetModelIndexNoCreate(uint32 id) +{ + m_modelIndex = id; + bHasPreRenderEffects = HasPreRenderEffects(); +} + void CEntity::CreateRwObject(void) { @@ -306,10 +324,8 @@ CEntity::DeleteRwObject(void) RpAtomicDestroy((RpAtomic*)m_rwObject); RwFrameDestroy(f); }else if(RwObjectGetType(m_rwObject) == rpCLUMP){ -#ifdef PED_SKIN if(IsClumpSkinned((RpClump*)m_rwObject)) RpClumpForAllAtomics((RpClump*)m_rwObject, AtomicRemoveAnimFromSkinCB, nil); -#endif RpClumpDestroy((RpClump*)m_rwObject); } m_rwObject = nil; @@ -330,7 +346,6 @@ CEntity::UpdateRwFrame(void) } } -//--MIAMI: done void CEntity::SetupBigBuilding(void) { @@ -370,19 +385,39 @@ CEntity::GetBoundRect(void) return rect; } +bool +CEntity::HasPreRenderEffects(void) +{ + return IsTreeModel(GetModelIndex()) || + GetModelIndex() == MI_COLLECTABLE1 || + GetModelIndex() == MI_MONEY || + GetModelIndex() == MI_CARMINE || + GetModelIndex() == MI_NAUTICALMINE || + GetModelIndex() == MI_BRIEFCASE || + GetModelIndex() == MI_GRENADE || + GetModelIndex() == MI_MOLOTOV || + GetModelIndex() == MI_MISSILE || + GetModelIndex() == MI_BEACHBALL || + IsGlass(GetModelIndex()) || + IsObject() && ((CObject*)this)->bIsPickup; + IsStreetLight(GetModelIndex()); +} + void CEntity::PreRender(void) { + if (CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects() != 0) + ProcessLightsForEntity(); + + if(!bHasPreRenderEffects) + return; + switch(m_type){ case ENTITY_TYPE_BUILDING: - if(GetModelIndex() == MI_RAILTRACKS){ - CShadows::StoreShadowForPole(this, 0.0f, -10.949f, 5.0f, 8.0f, 1.0f, 0); - CShadows::StoreShadowForPole(this, 0.0f, 10.949f, 5.0f, 8.0f, 1.0f, 1); - }else if(IsTreeModel(GetModelIndex())){ - CShadows::StoreShadowForTree(this); + if(IsTreeModel(GetModelIndex())){ + float dist = (TheCamera.GetPosition() - GetPosition()).Magnitude2D(); + CObject::fDistToNearestTree = Min(CObject::fDistToNearestTree, dist); ModifyMatrixForTreeInWind(); - }else if(IsBannerModel(GetModelIndex())){ - ModifyMatrixForBannerInWind(); } break; case ENTITY_TYPE_OBJECT: @@ -423,12 +458,11 @@ CEntity::PreRender(void) CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); }else if(IsGlass(GetModelIndex())){ - if(!((CSimpleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()))->m_isArtistGlass) - PreRenderForGlassWindow(); + PreRenderForGlassWindow(); }else if (((CObject*)this)->bIsPickup) { - CPickups::DoPickUpEffects(this); - GetMatrix().UpdateRW(); - UpdateRwFrame(); + CPickups::DoPickUpEffects(this); + GetMatrix().UpdateRW(); + UpdateRwFrame(); } else if (GetModelIndex() == MI_GRENADE) { CMotionBlurStreaks::RegisterStreak((uintptr)this, 100, 100, 100, @@ -439,12 +473,30 @@ CEntity::PreRender(void) 0, 100, 0, GetPosition() - 0.07f * TheCamera.GetRight(), GetPosition() + 0.07f * TheCamera.GetRight()); + }else if(GetModelIndex() == MI_BEACHBALL){ + CVector pos = GetPosition(); + CShadows::StoreShadowToBeRendered(SHADOWTYPE_DARK, + gpShadowPedTex, &pos, + 0.4f, 0.0f, 0.0f, -0.4f, + CTimeCycle::GetShadowStrength(), + CTimeCycle::GetShadowStrength(), + CTimeCycle::GetShadowStrength(), + CTimeCycle::GetShadowStrength(), + 20.0f, false, 1.0f); } // fall through case ENTITY_TYPE_DUMMY: if(GetModelIndex() == MI_TRAFFICLIGHTS){ CTrafficLights::DisplayActualLight(this); CShadows::StoreShadowForPole(this, 2.957f, 0.147f, 0.0f, 16.0f, 0.4f, 0); + }else if(GetModelIndex() == MI_TRAFFICLIGHTS_VERTICAL){ + CTrafficLights::DisplayActualLight(this); + }else if(GetModelIndex() == MI_TRAFFICLIGHTS_MIAMI){ + CTrafficLights::DisplayActualLight(this); + CShadows::StoreShadowForPole(this, 4.819f, 1.315f, 0.0f, 16.0f, 0.4f, 0); + }else if(GetModelIndex() == MI_TRAFFICLIGHTS_TWOVERTICAL){ + CTrafficLights::DisplayActualLight(this); + CShadows::StoreShadowForPole(this, 7.503f, 0.0f, 0.0f, 16.0f, 0.4f, 0); }else if(GetModelIndex() == MI_SINGLESTREETLIGHTS1) CShadows::StoreShadowForPole(this, 0.744f, 0.0f, 0.0f, 16.0f, 0.4f, 0); else if(GetModelIndex() == MI_SINGLESTREETLIGHTS2) @@ -453,19 +505,15 @@ CEntity::PreRender(void) CShadows::StoreShadowForPole(this, 1.143f, 0.145f, 0.0f, 16.0f, 0.4f, 0); else if(GetModelIndex() == MI_DOUBLESTREETLIGHTS) CShadows::StoreShadowForPole(this, 0.0f, -0.048f, 0.0f, 16.0f, 0.4f, 0); - else if(GetModelIndex() == MI_STREETLAMP1 || - GetModelIndex() == MI_STREETLAMP2) - CShadows::StoreShadowForPole(this, 0.0f, 0.0f, 0.0f, 16.0f, 0.4f, 0); break; } - - if (CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects() != 0) - ProcessLightsForEntity(); } void CEntity::PreRenderForGlassWindow(void) { + if(((CSimpleModelInfo*)CModelInfo::GetModelInfo(m_modelIndex))->m_isArtistGlass) + return; CGlass::AskForObjectToBeRenderedInGlass(this); bIsVisible = false; } @@ -486,8 +534,6 @@ CEntity::Render(void) bool CEntity::SetupLighting(void) { - DeActivateDirectional(); - SetAmbientColours(); return false; } @@ -573,13 +619,12 @@ CEntity::PruneReferences(void) } } -#ifdef PED_SKIN void CEntity::UpdateRpHAnim(void) { - RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump()); - RpHAnimHierarchyUpdateMatrices(hier); - + if(IsClumpSkinned(GetClump())){ + RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump()); + RpHAnimHierarchyUpdateMatrices(hier); #if 0 int i; char buf[256]; @@ -608,8 +653,8 @@ CEntity::UpdateRpHAnim(void) void RenderSkeleton(RpHAnimHierarchy *hier); RenderSkeleton(hier); #endif + } } -#endif void CEntity::AddSteamsFromGround(CVector *unused) @@ -641,6 +686,15 @@ CEntity::AddSteamsFromGround(CVector *unused) case 4: CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, effect->particle.dir, effect->particle.scale, false); break; +// TODO(MIAMI): enable this once we have the particle objects +/* + case 5: + CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_VERT, pos, effect->particle.dir, effect->particle.scale, false); + break; + case 6: + CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_HORIZ, pos, effect->particle.dir, effect->particle.scale, false); + break; +*/ } } } @@ -665,80 +719,66 @@ CEntity::ProcessLightsForEntity(void) for(i = 0; i < n; i++, flashTimer1 += 0x80, flashTimer2 += 0x100, flashTimer3 += 0x200){ effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i); - if(effect->type != EFFECT_LIGHT) - continue; - - pos = GetMatrix() * effect->pos; + switch(effect->type){ + case EFFECT_LIGHT: + pos = GetMatrix() * effect->pos; - lightOn = false; - lightFlickering = false; - switch(effect->light.lightType){ - case LIGHT_ON: - lightOn = true; - break; - case LIGHT_ON_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7) - lightOn = true; - break; - case LIGHT_FLICKER: - if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) + lightOn = false; + lightFlickering = false; + switch(effect->light.lightType){ + case LIGHT_ON: lightOn = true; - else - lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3) - lightOn = true; - break; - case LIGHT_FLICKER_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7){ + break; + case LIGHT_ON_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + lightOn = true; + break; + case LIGHT_FLICKER: if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) lightOn = true; else lightFlickering = true; if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3) lightOn = true; - } - break; - case LIGHT_FLASH1: - if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200) - lightOn = true; - break; - case LIGHT_FLASH1_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + break; + case LIGHT_FLICKER_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){ + if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) + lightOn = true; + else + lightFlickering = true; + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3) + lightOn = true; + } + break; + case LIGHT_FLASH1: if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200) lightOn = true; - break; - case LIGHT_FLASH2: - if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400) - lightOn = true; - break; - case LIGHT_FLASH2_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + break; + case LIGHT_FLASH1_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200) + lightOn = true; + break; + case LIGHT_FLASH2: if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400) lightOn = true; - break; - case LIGHT_FLASH3: - if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800) - lightOn = true; - break; - case LIGHT_FLASH3_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + break; + case LIGHT_FLASH2_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400) + lightOn = true; + break; + case LIGHT_FLASH3: if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800) lightOn = true; - break; - case LIGHT_RANDOM_FLICKER: - if(m_randomSeed > 16) - lightOn = true; - else{ - if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60) - lightOn = true; - else - lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3) - lightOn = true; - } - break; - case LIGHT_RANDOM_FLICKER_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7){ + break; + case LIGHT_FLASH3_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800) + lightOn = true; + break; + case LIGHT_RANDOM_FLICKER: if(m_randomSeed > 16) lightOn = true; else{ @@ -749,85 +789,143 @@ CEntity::ProcessLightsForEntity(void) if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3) lightOn = true; } + break; + case LIGHT_RANDOM_FLICKER_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7){ + if(m_randomSeed > 16) + lightOn = true; + else{ + if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60) + lightOn = true; + else + lightFlickering = true; + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3) + lightOn = true; + } + } + break; + case LIGHT_BRIDGE_FLASH1: + if(CBridge::ShouldLightsBeFlashing() && CTimer::GetTimeInMilliseconds() & 0x200) + lightOn = true; + break; + case LIGHT_BRIDGE_FLASH2: + if(CBridge::ShouldLightsBeFlashing() && (CTimer::GetTimeInMilliseconds() & 0x1FF) < 60) + lightOn = true; + break; } - break; - case LIGHT_BRIDGE_FLASH1: - if(CBridge::ShouldLightsBeFlashing() && CTimer::GetTimeInMilliseconds() & 0x200) - lightOn = true; - break; - case LIGHT_BRIDGE_FLASH2: - if(CBridge::ShouldLightsBeFlashing() && (CTimer::GetTimeInMilliseconds() & 0x1FF) < 60) - lightOn = true; - break; - } - // Corona - if(lightOn) - CCoronas::RegisterCorona((uintptr)this + i, - effect->col.r, effect->col.g, effect->col.b, 255, - pos, effect->light.size, effect->light.dist, - effect->light.corona, effect->light.flareType, effect->light.roadReflection, - effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f); - else if(lightFlickering) - CCoronas::RegisterCorona((uintptr)this + i, - 0, 0, 0, 255, - pos, effect->light.size, effect->light.dist, - effect->light.corona, effect->light.flareType, effect->light.roadReflection, - effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f); - - // Pointlight - if(effect->light.flags & LIGHTFLAG_FOG_ALWAYS){ - CPointLights::AddLight(CPointLights::LIGHT_FOGONLY_ALWAYS, - pos, CVector(0.0f, 0.0f, 0.0f), - effect->light.range, - effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f, - CPointLights::FOG_ALWAYS, true); - }else if(effect->light.flags & LIGHTFLAG_FOG_NORMAL && lightOn && effect->light.range == 0.0f){ - CPointLights::AddLight(CPointLights::LIGHT_FOGONLY, - pos, CVector(0.0f, 0.0f, 0.0f), - effect->light.range, - effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f, - CPointLights::FOG_NORMAL, true); - }else if(lightOn && effect->light.range != 0.0f){ - if(effect->col.r == 0 && effect->col.g == 0 && effect->col.b == 0){ - CPointLights::AddLight(CPointLights::LIGHT_POINT, - pos, CVector(0.0f, 0.0f, 0.0f), - effect->light.range, - 0.0f, 0.0f, 0.0f, - CPointLights::FOG_NONE, true); - }else{ - CPointLights::AddLight(CPointLights::LIGHT_POINT, - pos, CVector(0.0f, 0.0f, 0.0f), - effect->light.range, - effect->col.r*CTimeCycle::GetSpriteBrightness()/255.0f, - effect->col.g*CTimeCycle::GetSpriteBrightness()/255.0f, - effect->col.b*CTimeCycle::GetSpriteBrightness()/255.0f, - // half-useless because LIGHTFLAG_FOG_ALWAYS can't be on - (effect->light.flags & LIGHTFLAG_FOG) >> 1, - true); + if(effect->light.flags & LIGHTFLAG_HIDE_OBJECT){ + if(lightOn) + bDoNotRender = false; + else + bDoNotRender = true; + return; + } + + // Corona + if(lightOn) + CCoronas::RegisterCorona((uintptr)this + i, + effect->col.r, effect->col.g, effect->col.b, 255, + pos, effect->light.size, effect->light.dist, + effect->light.corona, effect->light.flareType, effect->light.roadReflection, + effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f, + !!(effect->light.flags&LIGHTFLAG_LONG_DIST)); + else if(lightFlickering) + CCoronas::RegisterCorona((uintptr)this + i, + 0, 0, 0, 255, + pos, effect->light.size, effect->light.dist, + effect->light.corona, effect->light.flareType, effect->light.roadReflection, + effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f, + !!(effect->light.flags&LIGHTFLAG_LONG_DIST)); + + // Pointlight + bool alreadyProcessedFog; + alreadyProcessedFog = false; + if(effect->light.range != 0.0f && lightOn){ + if(effect->col.r == 0 && effect->col.g == 0 && effect->col.b == 0){ + CPointLights::AddLight(CPointLights::LIGHT_POINT, + pos, CVector(0.0f, 0.0f, 0.0f), + effect->light.range, + 0.0f, 0.0f, 0.0f, + CPointLights::FOG_NONE, true); + }else{ + CPointLights::AddLight(CPointLights::LIGHT_POINT, + pos, CVector(0.0f, 0.0f, 0.0f), + effect->light.range, + effect->col.r*CTimeCycle::GetSpriteBrightness()/255.0f, + effect->col.g*CTimeCycle::GetSpriteBrightness()/255.0f, + effect->col.b*CTimeCycle::GetSpriteBrightness()/255.0f, + (effect->light.flags & LIGHTFLAG_FOG) >> 1, + true); + alreadyProcessedFog = true; + } + } + + if(!alreadyProcessedFog){ + if(effect->light.flags & LIGHTFLAG_FOG_ALWAYS){ + CPointLights::AddLight(CPointLights::LIGHT_FOGONLY_ALWAYS, + pos, CVector(0.0f, 0.0f, 0.0f), + 0.0f, + effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f, + CPointLights::FOG_ALWAYS, true); + }else if(effect->light.flags & LIGHTFLAG_FOG_NORMAL && lightOn && effect->light.range == 0.0f){ + CPointLights::AddLight(CPointLights::LIGHT_FOGONLY, + pos, CVector(0.0f, 0.0f, 0.0f), + 0.0f, + effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f, + CPointLights::FOG_NORMAL, true); + } } - } - // Light shadow - if(effect->light.shadowRange != 0.0f){ - if(lightOn){ - CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, - effect->light.shadow, &pos, - effect->light.shadowRange, 0.0f, - 0.0f, -effect->light.shadowRange, - 128, - effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, - effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, - effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, - 15.0f, 1.0f, 40.0f, false, 0.0f); - }else if(lightFlickering){ - CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, - effect->light.shadow, &pos, - effect->light.shadowRange, 0.0f, - 0.0f, -effect->light.shadowRange, - 0, 0.0f, 0.0f, 0.0f, - 15.0f, 1.0f, 40.0f, false, 0.0f); + // Light shadow + if(effect->light.shadowRange != 0.0f){ + if(lightOn){ + CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, + effect->light.shadow, &pos, + effect->light.shadowRange, 0.0f, + 0.0f, -effect->light.shadowRange, + 128, + effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, + effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, + effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, + 15.0f, 1.0f, 40.0f, false, 0.0f); + }else if(lightFlickering){ + CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, + effect->light.shadow, &pos, + effect->light.shadowRange, 0.0f, + 0.0f, -effect->light.shadowRange, + 0, 0.0f, 0.0f, 0.0f, + 15.0f, 1.0f, 40.0f, false, 0.0f); + } } + break; + + case EFFECT_SUNGLARE: + if(CWeather::SunGlare >= 0.0f){ + CVector pos = GetMatrix() * effect->pos; + CVector glareDir = pos - GetPosition(); + glareDir.Normalise(); + CVector camDir = TheCamera.GetPosition() - pos; + float dist = camDir.Magnitude(); + camDir *= 2.0f/dist; + glareDir += camDir; + glareDir.Normalise(); + float camAngle = -DotProduct(glareDir, CTimeCycle::GetSunPosition()); + if(camAngle > 0.0f){ + float intens = Sqrt(camAngle) * CWeather::SunGlare; + pos += camDir; + CCoronas::RegisterCorona((uintptr)this + 33 + i, + intens * (CTimeCycle::GetSunCoreRed() + 2*255)/3.0f, + intens * (CTimeCycle::GetSunCoreGreen() + 2*255)/3.0f, + intens * (CTimeCycle::GetSunCoreBlue() + 2*255)/3.0f, + 255, + pos, 0.5f*CWeather::SunGlare*Sqrt(dist), 120.0f, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, + CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, + CCoronas::STREAK_OFF, 0.0f); + } + } + break; } } } @@ -850,27 +948,31 @@ CEntity::ModifyMatrixForTreeInWind(void) CMatrix mat(GetMatrix().m_attachment); if(CWeather::Wind >= 0.5){ - t = m_randomSeed + 16*CTimer::GetTimeInMilliseconds(); + t = m_randomSeed + 8*CTimer::GetTimeInMilliseconds(); f = (t & 0xFFF)/(float)0x1000; flutter = f * WindTabel[(t>>12)+1 & 0xF] + (1.0f - f) * WindTabel[(t>>12) & 0xF] + 1.0f; - strength = CWeather::Wind < 0.8f ? 0.008f : 0.014f; + strength = -0.015f*CWeather::Wind; }else if(CWeather::Wind >= 0.2){ t = (uintptr)this + CTimer::GetTimeInMilliseconds(); f = (t & 0xFFF)/(float)0x1000; flutter = Sin(f * 6.28f); - strength = 0.008f; + strength = -0.008f; }else{ t = (uintptr)this + CTimer::GetTimeInMilliseconds(); f = (t & 0xFFF)/(float)0x1000; flutter = Sin(f * 6.28f); - strength = 0.005f; + strength = -0.005f; } mat.GetUp().x = strength * flutter; + if(IsPalmTreeModel(GetModelIndex())) + mat.GetUp().x += -0.07f*CWeather::Wind; mat.GetUp().y = mat.GetUp().x; + CWindModifiers::FindWindModifier(GetPosition(), &mat.GetUp().x, &mat.GetUp().y); + mat.UpdateRW(); UpdateRwFrame(); } @@ -882,6 +984,7 @@ float BannerWindTabel[] = { 0.28f, 0.28f, 0.22f, 0.1f, 0.0f, -0.1f, -0.17f, -0.12f }; +//--MIAMI: unused void CEntity::ModifyMatrixForBannerInWind(void) { @@ -929,7 +1032,6 @@ CEntity::AddSteamsFromGround(CPtrList& list) } #ifdef COMPATIBLE_SAVES -// TODO(MIAMI) void CEntity::SaveEntityFlags(uint8*& buf) { @@ -953,35 +1055,41 @@ CEntity::SaveEntityFlags(uint8*& buf) if (bRenderScorched) tmp |= BIT(20); if (bHasBlip) tmp |= BIT(21); if (bIsBIGBuilding) tmp |= BIT(22); - if (bRenderDamaged) tmp |= BIT(23); + if (bStreamBIGBuilding) tmp |= BIT(23); - if (bBulletProof) tmp |= BIT(24); - if (bFireProof) tmp |= BIT(25); - if (bCollisionProof) tmp |= BIT(26); - if (bMeleeProof) tmp |= BIT(27); - if (bOnlyDamagedByPlayer) tmp |= BIT(28); - if (bStreamingDontDelete) tmp |= BIT(29); - if (bRemoveFromWorld) tmp |= BIT(0); - if (bHasHitWall) tmp |= BIT(1); + if (bRenderDamaged) tmp |= BIT(24); + if (bBulletProof) tmp |= BIT(25); + if (bFireProof) tmp |= BIT(26); + if (bCollisionProof) tmp |= BIT(27); + if (bMeleeProof) tmp |= BIT(28); + if (bOnlyDamagedByPlayer) tmp |= BIT(29); + if (bStreamingDontDelete) tmp |= BIT(30); + if (bRemoveFromWorld) tmp |= BIT(31); WriteSaveBuf(buf, tmp); tmp = 0; - if (bImBeingRendered) tmp |= BIT(2); - if (bTouchingWater) tmp |= BIT(3); - if (bIsSubway) tmp |= BIT(4); - if (bDrawLast) tmp |= BIT(5); - if (bNoBrightHeadLights) tmp |= BIT(6); - if (bDoNotRender) tmp |= BIT(7); - if (bDistanceFade) tmp |= BIT(8); + if (bHasHitWall) tmp |= BIT(0); + if (bImBeingRendered) tmp |= BIT(1); + if (bTouchingWater) tmp |= BIT(2); + if (bIsSubway) tmp |= BIT(3); + if (bDrawLast) tmp |= BIT(4); + if (bNoBrightHeadLights) tmp |= BIT(5); + if (bDoNotRender) tmp |= BIT(6); + if (bDistanceFade) tmp |= BIT(7); + if (m_flagE1) tmp |= BIT(8); if (m_flagE2) tmp |= BIT(9); + if (bOffscreen) tmp |= BIT(10); + if (bIsStaticWaitingForCollision) tmp |= BIT(11); + if (m_flagE10) tmp |= BIT(12); + if (bUnderwater) tmp |= BIT(13); + if (bHasPreRenderEffects) tmp |= BIT(14); WriteSaveBuf(buf, tmp); } -// TODO(MIAMI) void CEntity::LoadEntityFlags(uint8*& buf) { @@ -1005,28 +1113,35 @@ CEntity::LoadEntityFlags(uint8*& buf) bRenderScorched = !!(tmp & BIT(20)); bHasBlip = !!(tmp & BIT(21)); bIsBIGBuilding = !!(tmp & BIT(22)); - bRenderDamaged = !!(tmp & BIT(23)); + bStreamBIGBuilding = !!(tmp & BIT(23)); - bBulletProof = !!(tmp & BIT(24)); - bFireProof = !!(tmp & BIT(25)); - bCollisionProof = !!(tmp & BIT(26)); - bMeleeProof = !!(tmp & BIT(27)); - bOnlyDamagedByPlayer = !!(tmp & BIT(28)); - bStreamingDontDelete = !!(tmp & BIT(29)); - bRemoveFromWorld = !!(tmp & BIT(0)); - bHasHitWall = !!(tmp & BIT(1)); + bRenderDamaged = !!(tmp & BIT(24)); + bBulletProof = !!(tmp & BIT(25)); + bFireProof = !!(tmp & BIT(26)); + bCollisionProof = !!(tmp & BIT(27)); + bMeleeProof = !!(tmp & BIT(28)); + bOnlyDamagedByPlayer = !!(tmp & BIT(29)); + bStreamingDontDelete = !!(tmp & BIT(30)); + bRemoveFromWorld = !!(tmp & BIT(31)); tmp = ReadSaveBuf(buf); - bImBeingRendered = !!(tmp & BIT(2)); - bTouchingWater = !!(tmp & BIT(3)); - bIsSubway = !!(tmp & BIT(4)); - bDrawLast = !!(tmp & BIT(5)); - bNoBrightHeadLights = !!(tmp & BIT(6)); - bDoNotRender = !!(tmp & BIT(7)); - bDistanceFade = !!(tmp & BIT(8)); + bHasHitWall = !!(tmp & BIT(0)); + bImBeingRendered = !!(tmp & BIT(1)); + bTouchingWater = !!(tmp & BIT(2)); + bIsSubway = !!(tmp & BIT(3)); + bDrawLast = !!(tmp & BIT(4)); + bNoBrightHeadLights = !!(tmp & BIT(5)); + bDoNotRender = !!(tmp & BIT(6)); + bDistanceFade = !!(tmp & BIT(7)); + m_flagE1 = !!(tmp & BIT(8)); m_flagE2 = !!(tmp & BIT(9)); + bOffscreen = !!(tmp & BIT(10)); + bIsStaticWaitingForCollision = !!(tmp & BIT(11)); + m_flagE10 = !!(tmp & BIT(12)); + bUnderwater = !!(tmp & BIT(13)); + bHasPreRenderEffects = !!(tmp & BIT(14)); } #endif diff --git a/src/entities/Entity.h b/src/entities/Entity.h index dc5378a5..ab7b6203 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -78,7 +78,7 @@ public: uint32 bIsSubway : 1; // set when subway, but maybe different meaning? uint32 bDrawLast : 1; // draw object last uint32 bNoBrightHeadLights : 1; - uint32 bDoNotRender : 1; + uint32 bDoNotRender : 1; //-- only applies to CObjects apparently uint32 bDistanceFade : 1; // Fade entity because it is far away // flagsE @@ -88,7 +88,7 @@ public: uint32 bIsStaticWaitingForCollision : 1; // this is used by script created entities - they are static until the collision is loaded below them uint32 m_flagE10 : 1; // probably bDontStream uint32 bUnderwater : 1; // this object is underwater change drawing order - uint32 m_flagE40 : 1; + uint32 bHasPreRenderEffects : 1; // Object has a prerender effects attached to it uint16 m_scanCode; uint16 m_randomSeed; @@ -112,12 +112,12 @@ public: #endif CEntity(void); - ~CEntity(void); + virtual ~CEntity(void); virtual void Add(void); virtual void Remove(void); - virtual void SetModelIndex(uint32 id) { m_modelIndex = id; CreateRwObject(); } - virtual void SetModelIndexNoCreate(uint32 id) { m_modelIndex = id; } + virtual void SetModelIndex(uint32 id); + virtual void SetModelIndexNoCreate(uint32 id); virtual void CreateRwObject(void); virtual void DeleteRwObject(void); virtual CRect GetBoundRect(void); @@ -160,6 +160,7 @@ public: int16 GetModelIndex(void) const { return m_modelIndex; } void UpdateRwFrame(void); void SetupBigBuilding(void); + bool HasPreRenderEffects(void); void AttachToRwObject(RwObject *obj); void DetachFromRwObject(void); diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 22b391e8..423662f7 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -1067,13 +1067,13 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists) if(B->IsBuilding()) skipShift = false; - else if(IsTrafficLight(A->GetModelIndex()) && + else if(IsStreetLight(A->GetModelIndex()) && (B->IsVehicle() || B->IsPed()) && A->GetUp().z < 0.66f) skipShift = true; else if((A->IsVehicle() || A->IsPed()) && B->GetUp().z < 0.66f && - IsTrafficLight(B->GetModelIndex())) + IsStreetLight(B->GetModelIndex())) skipShift = true; // TODO: maybe flip some ifs here else if(A->IsObject() && B->IsVehicle()){ @@ -1398,7 +1398,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) if(B->IsBuilding()) skipCollision = false; - else if(IsTrafficLight(A->GetModelIndex()) && + else if(IsStreetLight(A->GetModelIndex()) && (B->IsVehicle() || B->IsPed()) && A->GetUp().z < 0.66f){ skipCollision = true; @@ -1406,12 +1406,12 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) Aobj->m_pCollidingEntity = B; }else if((A->IsVehicle() || A->IsPed()) && B->GetUp().z < 0.66f && - IsTrafficLight(B->GetModelIndex())){ + IsStreetLight(B->GetModelIndex())){ skipCollision = true; A->bSkipLineCol = true; Bobj->m_pCollidingEntity = A; }else if(A->IsObject() && B->IsVehicle()){ - if(A->GetModelIndex() == MI_CAR_BUMPER || A->GetModelIndex() == MI_FILES) + if(A->GetModelIndex() == MI_CAR_BUMPER)// || A->GetModelIndex() == MI_FILES) skipCollision = true; else if(Aobj->ObjectCreatedBy == TEMP_OBJECT || Aobj->bHasBeenDamaged || @@ -1430,7 +1430,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) } } }else if(B->IsObject() && A->IsVehicle()){ - if(B->GetModelIndex() == MI_CAR_BUMPER || B->GetModelIndex() == MI_FILES) + if(B->GetModelIndex() == MI_CAR_BUMPER)// || B->GetModelIndex() == MI_FILES) skipCollision = true; else if(Bobj->ObjectCreatedBy == TEMP_OBJECT || Bobj->bHasBeenDamaged || diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp index 9a6a74d0..056c3733 100644 --- a/src/modelinfo/ModelIndices.cpp +++ b/src/modelinfo/ModelIndices.cpp @@ -3,14 +3,14 @@ #include "General.h" #include "ModelIndices.h" -#define X(name, var, addr) int16 var; +#define X(name, var) int16 var; MODELINDICES #undef X void InitModelIndices(void) { -#define X(name, var, addr) var = -1; +#define X(name, var) var = -1; MODELINDICES #undef X } @@ -18,7 +18,7 @@ InitModelIndices(void) void MatchModelString(const char *modelname, int16 id) { -#define X(name, var, addr) \ +#define X(name, var) \ if(!CGeneral::faststrcmp(name, modelname)){ \ var = id; \ return; \ diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 25ba0b7b..fc1eb62b 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -3,168 +3,144 @@ #include "ModelInfo.h" #define MODELINDICES \ - X("fire_hydrant", MI_FIRE_HYDRANT, 0x5F5A00) \ - X("bagelstnd02", MI_BAGELSTAND2, 0x5F59FC) \ - X("fish01", MI_FISHSTALL01, 0x5F59EC) \ - X("fishstall02", MI_FISHSTALL02, 0x5F59F0) \ - X("fishstall03", MI_FISHSTALL03, 0x5F59F4) \ - X("fishstall04", MI_FISHSTALL04, 0x5F59F8) \ - X("taxisign", MI_TAXISIGN, 0x5F59E8) \ - X("phonesign", MI_PHONESIGN, 0x5F59E4) \ - X("noparkingsign1", MI_NOPARKINGSIGN1, 0x5F59E0) \ - X("bussign1", MI_BUSSIGN1, 0x5F59DC) \ - X("roadworkbarrier1", MI_ROADWORKBARRIER1, 0x5F59D8) \ - X("dump1", MI_DUMP1, 0x5F59D4) \ - X("trafficcone", MI_TRAFFICCONE, 0x5F59D0) \ - X("newsstand1", MI_NEWSSTAND, 0x5F59CC) \ - X("postbox1", MI_POSTBOX1, 0x5F59C8) \ - X("bin1", MI_BIN, 0x5F59C4) \ - X("wastebin", MI_WASTEBIN, 0x5F59C0) \ - X("phonebooth1", MI_PHONEBOOTH1, 0x5F59BC) \ - X("parkingmeter", MI_PARKINGMETER, 0x5F59B8) \ - X("trafficlight1", MI_TRAFFICLIGHTS, 0x5F5958) \ - X("lamppost1", MI_SINGLESTREETLIGHTS1, 0x5F595C) \ - X("lamppost2", MI_SINGLESTREETLIGHTS2, 0x5F5960) \ - X("lamppost3", MI_SINGLESTREETLIGHTS3, 0x5F5964) \ - X("doublestreetlght1", MI_DOUBLESTREETLIGHTS, 0x5F5968) \ - X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART, 0x5F596C) \ - X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND, 0x5F5970) \ - X("veg_tree1", MI_TREE1, 0x5F5974) \ - X("veg_tree3", MI_TREE2, 0x5F5978) \ - X("veg_treea1", MI_TREE3, 0x5F597C) \ - X("veg_treenew01", MI_TREE4, 0x5F5980) \ - X("veg_treenew05", MI_TREE5, 0x5F5984) \ - X("veg_treeb1", MI_TREE6, 0x5F5988) \ - X("veg_treenew10", MI_TREE7, 0x5F598C) \ - X("veg_treea3", MI_TREE8, 0x5F5990) \ - X("veg_treenew09", MI_TREE9, 0x5F5994) \ - X("veg_treenew08", MI_TREE10, 0x5F5998) \ - X("veg_treenew03", MI_TREE11, 0x5F599C) \ - X("veg_treenew16", MI_TREE12, 0x5F59A0) \ - X("veg_treenew17", MI_TREE13, 0x5F59A4) \ - X("veg_treenew06", MI_TREE14, 0x5F59A8) \ - X("doc_crane_cab", MODELID_CRANE_1, 0x5F59AC) \ - X("cranetopb", MODELID_CRANE_2, 0x5F59B0) \ - X("cranetopa", MODELID_CRANE_3, 0x5F59B4) \ - X("package1", MI_COLLECTABLE1, 0x5F5A04) \ - X("Money", MI_MONEY, 0x5F5A08) \ - X("barrel1", MI_CARMINE, 0x5F5A0C) \ - /*X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10)*/ \ - X("dk_paynspraydoor", MI_GARAGEDOOR2, 0x5F5A14) \ - X("dk_waretankdoor1", MI_GARAGEDOOR3, 0x5F5A18) \ - X("hav_garagedoor1", MI_GARAGEDOOR4, 0x5F5A1C) \ - X("hav_garagedoor02", MI_GARAGEDOOR5, 0x5F5A20) \ - X("hav_garagedoor03", MI_GARAGEDOOR6, 0x5F5A24) \ - X("hav_garagedoor04", MI_GARAGEDOOR7, 0x5F5A28) \ - X("lh_showdoor03", MI_GARAGEDOOR9, 0x5F5A2C) \ - X("lh_showdoor1", MI_GARAGEDOOR10, 0x5F5A30) \ - X("lhtankdoor", MI_GARAGEDOOR11, 0x5F5A34) \ - X("nbtgardoor", MI_GARAGEDOOR12, 0x5F5A38) \ - X("dk_camjonesdoor", MI_GARAGEDOOR13, 0x5F5A3C) \ - X("nbtgardoor02", MI_GARAGEDOOR14, 0x5F5A40) \ - X("dt_savedra", MI_GARAGEDOOR15, 0x5F5A44) \ - X("dt_savedrb", MI_GARAGEDOOR16, 0x5F5A48) \ - /*X("dk_bombdoor", MI_GARAGEDOOR17, 0x5F5A4C)*/ \ - X("dk_bombdoor", MI_GARAGEDOOR18, 0x5F5A50) \ - X("haiwshpnsdoor", MI_GARAGEDOOR19, 0x5F5A54) \ - X("wshpnsdoor", MI_GARAGEDOOR20, 0x5F5A58) \ - X("nbecpnsdoor", MI_GARAGEDOOR21, 0x5F5A5C) \ - X("nbtgardoor03", MI_GARAGEDOOR22, 0x5F5A60) \ - X("dt_savedrc", MI_GARAGEDOOR23, 0x5F5A64) \ - X("dt_savedrd", MI_GARAGEDOOR24, 0x5F5A68) \ - X("man_frntstepGD", MI_GARAGEDOOR25, 0x5F5A6C) \ - X("svegrgedoor", MI_GARAGEDOOR26, 0x5F5A70) \ - /*X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74)*/ \ - /*X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78)*/ \ - /*X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C)*/ \ - /*X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80)*/ \ - /*X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84)*/ \ - /*X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88)*/ \ - X("barrel2", MI_NAUTICALMINE, 0x5F5A8C) \ - X("crushercrush", MI_CRUSHERBODY, 0x5F5A90) \ - X("crushertop", MI_CRUSHERLID, 0x5F5A94) \ - X("donkeymag", MI_DONKEYMAG, 0x5F5A98) \ - X("bullion", MI_BULLION, 0x5F5A9C) \ - X("floatpackge1", MI_FLOATPACKAGE1, 0x5F5AA0) \ - X("briefcase", MI_BRIEFCASE, 0x5F5AA4) \ - X("chinabanner1", MI_CHINABANNER1, 0x5F5AA8) \ - X("chinabanner2", MI_CHINABANNER2, 0x5F5AAC) \ - X("chinabanner3", MI_CHINABANNER3, 0x5F5AB0) \ - X("chinabanner4", MI_CHINABANNER4, 0x5F5AB4) \ - X("iten_chinatown5", MI_CHINABANNER5, 0x5F5AB8) \ - X("iten_chinatown7", MI_CHINABANNER6, 0x5F5ABC) \ - X("iten_chinatown3", MI_CHINABANNER7, 0x5F5AC0) \ - X("iten_chinatown2", MI_CHINABANNER8, 0x5F5AC4) \ - X("iten_chinatown4", MI_CHINABANNER9, 0x5F5AC8) \ - X("iten_washline01", MI_CHINABANNER10, 0x5F5ACC) \ - X("iten_washline02", MI_CHINABANNER11, 0x5F5AD0) \ - X("iten_washline03", MI_CHINABANNER12, 0x5F5AD4) \ - X("chinalanterns", MI_CHINALANTERN, 0x5F5AD8) \ - X("glassfx1", MI_GLASS1, 0x5F5ADC) \ - X("glassfx2", MI_GLASS2, 0x5F5AE0) \ - X("glassfx3", MI_GLASS3, 0x5F5AE4) \ - X("glassfx4", MI_GLASS4, 0x5F5AE8) \ - X("glassfx55", MI_GLASS5, 0x5F5AEC) \ - X("glassfxsub1", MI_GLASS6, 0x5F5AF0) \ - X("glassfxsub2", MI_GLASS7, 0x5F5AF4) \ - X("glassfx_composh", MI_GLASS8, 0x5F5AF8) \ - X("bridge_liftsec", MI_BRIDGELIFT, 0x5F5AFC) \ - X("bridge_liftweight", MI_BRIDGEWEIGHT, 0x5F5B00) \ - X("subbridge_lift", MI_BRIDGEROADSEGMENT, 0x5F5B04) \ - X("barrel4", MI_EXPLODINGBARREL, 0x5F5B08) \ - X("flagsitaly", MI_ITALYBANNER1, 0x5F5B0C) \ - X("adrenaline", MI_PICKUP_ADRENALINE, 0x5F5B10) \ - X("bodyarmour", MI_PICKUP_BODYARMOUR, 0x5F5B14) \ - X("info", MI_PICKUP_INFO, 0x5F5B18) \ - X("health", MI_PICKUP_HEALTH, 0x5F5B1C) \ - X("bonus", MI_PICKUP_BONUS, 0x5F5B20) \ - X("bribe", MI_PICKUP_BRIBE, 0x5F5B24) \ - X("killfrenzy", MI_PICKUP_KILLFRENZY, 0x5F5B28) \ - X("camerapickup", MI_PICKUP_CAMERA, 0x5F5B2C) \ - X("bollardlight", MI_BOLLARDLIGHT, 0x5F5B30) \ - X("magnet", MI_MAGNET, 0x5F5B34) \ - X("streetlamp1", MI_STREETLAMP1, 0x5F5B38) \ - X("streetlamp2", MI_STREETLAMP2, 0x5F5B3C) \ - X("railtrax_lo4b", MI_RAILTRACKS, 0x5F5B40) \ - X("bar_barrier10", MI_FENCE, 0x5F5B44) \ - X("bar_barrier12", MI_FENCE2, 0x5F5B48) \ - X("petrolpump", MI_PETROLPUMP, 0x5F5B4C) \ - X("bodycast", MI_BODYCAST, 0x5F5B50) \ - X("backdoor", MI_BACKDOOR, 0x5F5B54) \ - X("coffee", MI_COFFEE, 0x5F5B58) \ - X("bouy", MI_BUOY, 0x5F5B5C) \ - X("parktable1", MI_PARKTABLE, 0x5F5B60) \ - X("sbwy_tunl_start", MI_SUBWAY1, 0x5F5B64) \ - X("sbwy_tunl_bit", MI_SUBWAY2, 0x5F5B68) \ - X("sbwy_tunl_bend", MI_SUBWAY3, 0x5F5B6C) \ - X("sbwy_tunl_cstm6", MI_SUBWAY4, 0x5F5B70) \ - X("sbwy_tunl_cstm7", MI_SUBWAY5, 0x5F5B74) \ - X("sbwy_tunl_cstm8", MI_SUBWAY6, 0x5F5B78) \ - X("sbwy_tunl_cstm10", MI_SUBWAY7, 0x5F5B7C) \ - X("sbwy_tunl_cstm9", MI_SUBWAY8, 0x5F5B80) \ - X("sbwy_tunl_cstm11", MI_SUBWAY9, 0x5F5B84) \ - X("sbwy_tunl_cstm1", MI_SUBWAY10, 0x5F5B88) \ - X("sbwy_tunl_cstm2", MI_SUBWAY11, 0x5F5B8C) \ - X("sbwy_tunl_cstm4", MI_SUBWAY12, 0x5F5B90) \ - X("sbwy_tunl_cstm3", MI_SUBWAY13, 0x5F5B94) \ - X("sbwy_tunl_cstm5", MI_SUBWAY14, 0x5F5B98) \ - X("subplatform_n2", MI_SUBWAY15, 0x5F5B9C) \ - X("suby_tunl_start", MI_SUBWAY16, 0x5F5BA0) \ - X("sbwy_tunl_start2", MI_SUBWAY17, 0x5F5BA4) \ - X("indy_tunl_start", MI_SUBWAY18, 0x5F5BA8) \ - X("indsubway03", MI_SUBPLATFORM_IND, 0x5F5BAC) \ - X("comerside_subway", MI_SUBPLATFORM_COMS, 0x5F5BB0) \ - X("subplatform", MI_SUBPLATFORM_COMS2, 0x5F5BB4) \ - X("subplatform_n", MI_SUBPLATFORM_COMN, 0x5F5BB8) \ - X("Otherside_subway", MI_SUBPLATFORM_SUB, 0x5F5BBC) \ - X("subplatform_sub", MI_SUBPLATFORM_SUB2, 0x5F5BC0) \ - X("files", MI_FILES, 0x5F5BC4) \ - X("property_locked", MI_PICKUP_PROPERTY, 0x0) \ - X("property_fsale", MI_PICKUP_PROPERTY_FORSALE, 0x0) \ - X("clothesp", MI_PICKUP_CLOTHES, 0x0) \ - X("bigdollar", MI_PICKUP_REVENUE, 0x0) + X("fire_hydrant", MI_FIRE_HYDRANT) \ + X("phonesign", MI_PHONESIGN) \ + X("noparkingsign1", MI_NOPARKINGSIGN1) \ + X("bussign1", MI_BUSSIGN1) \ + X("roadworkbarrier1", MI_ROADWORKBARRIER1) \ + X("dump1", MI_DUMP1) \ + X("trafficcone", MI_TRAFFICCONE) \ + X("newsstand1", MI_NEWSSTAND) \ + X("postbox1", MI_POSTBOX1) \ + X("bin1", MI_BIN) \ + X("wastebin", MI_WASTEBIN) \ + X("phonebooth1", MI_PHONEBOOTH1) \ + X("parkingmeter", MI_PARKINGMETER) \ + X("parkingmeterg", MI_PARKINGMETER2) \ + X("mall_fans", MI_MALLFAN) \ + X("htl_fan_rotate_nt", MI_HOTELFAN_NIGHT) \ + X("htl_fan_rotate_dy", MI_HOTELFAN_DAY) \ + X("hotroomfan", MI_HOTROOMFAN) \ + X("trafficlight1", MI_TRAFFICLIGHTS) \ + X("MTraffic4", MI_TRAFFICLIGHTS_VERTICAL) \ + X("MTraffic1", MI_TRAFFICLIGHTS_MIAMI) \ + X("MTraffic2", MI_TRAFFICLIGHTS_TWOVERTICAL) \ + X("lamppost1", MI_SINGLESTREETLIGHTS1) \ + X("lamppost2", MI_SINGLESTREETLIGHTS2) \ + X("lamppost3", MI_SINGLESTREETLIGHTS3) \ + X("doublestreetlght1", MI_DOUBLESTREETLIGHTS) \ + X("Streetlamp1", MI_STREETLAMP1) \ + X("Streetlamp2", MI_STREETLAMP2) \ + X("veg_tree3", MI_TREE2) \ + X("veg_treea1", MI_TREE3) \ + X("veg_treeb1", MI_TREE6) \ + X("veg_treea3", MI_TREE8) \ + X("doc_crane_cab", MODELID_CRANE_1) \ + X("doc_crane_cab01", MODELID_CRANE_2) \ + X("doc_crane_cab02", MODELID_CRANE_3) \ + X("doc_crane_cab03", MODELID_CRANE_4) \ + X("boatcranelg0", MODELID_CRANE_5) \ + X("LODnetopa0", MODELID_CRANE_6) \ + X("package1", MI_COLLECTABLE1) \ + X("Money", MI_MONEY) \ + X("barrel1", MI_CARMINE) \ + X("dk_paynspraydoor", MI_GARAGEDOOR2) \ + X("dk_waretankdoor1", MI_GARAGEDOOR3) \ + X("hav_garagedoor1", MI_GARAGEDOOR4) \ + X("hav_garagedoor02", MI_GARAGEDOOR5) \ + X("hav_garagedoor03", MI_GARAGEDOOR6) \ + X("hav_garagedoor04", MI_GARAGEDOOR7) \ + X("lh_showdoor03", MI_GARAGEDOOR9) \ + X("lh_showdoor1", MI_GARAGEDOOR10) \ + X("lhtankdoor", MI_GARAGEDOOR11) \ + X("nbtgardoor", MI_GARAGEDOOR12) \ + X("dk_camjonesdoor", MI_GARAGEDOOR13) \ + X("nbtgardoor02", MI_GARAGEDOOR14) \ + X("dt_savedra", MI_GARAGEDOOR15) \ + X("dt_savedrb", MI_GARAGEDOOR16) \ + X("dk_bombdoor", MI_GARAGEDOOR18) \ + X("haiwshpnsdoor", MI_GARAGEDOOR19) \ + X("wshpnsdoor", MI_GARAGEDOOR20) \ + X("nbecpnsdoor", MI_GARAGEDOOR21) \ + X("nbtgardoor03", MI_GARAGEDOOR22) \ + X("dt_savedrc", MI_GARAGEDOOR23) \ + X("dt_savedrd", MI_GARAGEDOOR24) \ + X("man_frntstepGD", MI_GARAGEDOOR25) \ + X("svegrgedoor", MI_GARAGEDOOR26) \ + X("barrel2", MI_NAUTICALMINE) \ + X("briefcase", MI_BRIEFCASE) \ + X("wglasssmash", MI_GLASS1) \ + X("glassfx_composh", MI_GLASS8) \ + X("barrel4", MI_EXPLODINGBARREL) \ + X("adrenaline", MI_PICKUP_ADRENALINE) \ + X("bodyarmour", MI_PICKUP_BODYARMOUR) \ + X("info", MI_PICKUP_INFO) \ + X("health", MI_PICKUP_HEALTH) \ + X("bonus", MI_PICKUP_BONUS) \ + X("bribe", MI_PICKUP_BRIBE) \ + X("killfrenzy", MI_PICKUP_KILLFRENZY) \ + X("camerapickup", MI_PICKUP_CAMERA) \ + X("bigdollar", MI_PICKUP_REVENUE) \ + X("pickupsave", MI_PICKUP_SAVEGAME) \ + X("property_locked", MI_PICKUP_PROPERTY) \ + X("property_fsale", MI_PICKUP_PROPERTY_FORSALE) \ + X("clothesp", MI_PICKUP_CLOTHES) \ + X("bollardlight", MI_BOLLARDLIGHT) \ + X("bar_barrier10", MI_FENCE) \ + X("bar_barrier12", MI_FENCE2) \ + X("petrolpump", MI_PETROLPUMP) \ + X("washgaspump", MI_PETROLPUMP2) \ + X("bouy", MI_BUOY) \ + X("parktable1", MI_PARKTABLE) \ + X("lamppost1", MI_LAMPPOST1) \ + X("veg_palm04", MI_VEG_PALM01) \ + X("veg_palwee02", MI_VEG_PALM02) \ + X("veg_palmkbb11", MI_VEG_PALM03) \ + X("veg_palmkb4", MI_VEG_PALM04) \ + X("veg_palm02", MI_VEG_PALM05) \ + X("veg_palmkb3", MI_VEG_PALM06) \ + X("veg_palmbig14", MI_VEG_PALM07) \ + X("veg_palm01", MI_VEG_PALM08) \ + X("mlamppost", MI_MLAMPPOST) \ + X("roadworkbarrier1", MI_BARRIER1) \ + X("littleha_police", MI_LITTLEHA_POLICE) \ + X("telgrphpole02", MI_TELPOLE02) \ + X("trafficlight1", MI_TRAFFICLIGHT01) \ + X("parkbench1", MI_PARKBENCH) \ + X("plc_stinger", MI_PLC_STINGER) \ + X("od_lightbeam", MI_LIGHTBEAM) \ + X("ap_radar1_01", MI_AIRPORTRADAR) \ + X("rcbomb", MI_RCBOMB) \ + X("beachball", MI_BEACHBALL) \ + X("sandcastle1", MI_SANDCASTLE1) \ + X("sandcastle2", MI_SANDCASTLE2) \ + X("jellyfish", MI_JELLYFISH) \ + X("jellyfish01", MI_JELLYFISH01) \ + X("fish1single", MI_FISH1SINGLE) \ + X("fish1s", MI_FISH1S) \ + X("fish2single", MI_FISH2SINGLE) \ + X("fish2s", MI_FISH2S) \ + X("fish3single", MI_FISH3SINGLE) \ + X("fish3s", MI_FISH3S) \ + X("turtle", MI_TURTLE) \ + X("dolphin", MI_DOLPHIN) \ + X("shark", MI_SHARK) \ + X("submarine", MI_SUBMARINE) \ + X("Esc_step", MI_ESCALATORSTEP) \ + X("lounge_wood_up", MI_LOUNGE_WOOD_UP) \ + X("lounge_towel_up", MI_LOUNGE_TOWEL_UP) \ + X("lounge_wood_dn", MI_LOUNGE_WOOD_DN) \ + X("lotion", MI_LOTION) \ + X("beachtowel01", MI_BEACHTOWEL01) \ + X("beachtowel02", MI_BEACHTOWEL02) \ + X("beachtowel03", MI_BEACHTOWEL03) \ + X("beachtowel04", MI_BEACHTOWEL04) \ + X("blimp_night", MI_BLIMP_NIGHT) \ + X("blimp_day", MI_BLIMP_DAY) \ + X("yt_main_body", MI_YT_MAIN_BODY) \ + X("yt_main_body2", MI_YT_MAIN_BODY2) -#define X(name, var, addr) extern int16 var; +#define X(name, var) extern int16 var; MODELINDICES #undef X @@ -211,90 +187,10 @@ enum MI_WFYG2 = 106, // last regular ped MI_SPECIAL01 = 109, MI_SPECIAL21 = 129, -/* - MI_TAXI_D, - MI_PIMP, - MI_GANG01, - MI_GANG02, - MI_GANG03, - MI_GANG04, - MI_GANG05, - MI_GANG06, - MI_GANG07, - MI_GANG08, - MI_GANG09, - MI_GANG10, - MI_GANG11, - MI_GANG12, - MI_GANG13, - MI_GANG14, - MI_CRIMINAL01, - MI_CRIMINAL02, - MI_SPECIAL01, - MI_SPECIAL02, - MI_SPECIAL03, - MI_SPECIAL04, - MI_MALE02, - MI_MALE03, - MI_FATMALE01, - MI_FATMALE02, - MI_FEMALE01, - MI_FEMALE02, - MI_FEMALE03, - MI_FATFEMALE01, - MI_FATFEMALE02, - MI_PROSTITUTE, - MI_PROSTITUTE2, - MI_P_MAN1, - MI_P_MAN2, - MI_P_WOM1, - MI_P_WOM2, - MI_CT_MAN1, - MI_CT_MAN2, - MI_CT_WOM1, - MI_CT_WOM2, - MI_LI_MAN1, - MI_LI_MAN2, - MI_LI_WOM1, - MI_LI_WOM2, - MI_DOCKER1, - MI_DOCKER2, - MI_SCUM_MAN, - MI_SCUM_WOM, - MI_WORKER1, - MI_WORKER2, - MI_B_MAN1, - MI_B_MAN2, - MI_B_MAN3, - MI_B_WOM1, - MI_B_WOM2, - MI_B_WOM3, - MI_MOD_MAN, - MI_MOD_WOM, - MI_ST_MAN, - MI_ST_WOM, - MI_FAN_MAN1, - MI_FAN_MAN2, - MI_FAN_WOM, - MI_HOS_MAN, - MI_HOS_WOM, - MI_CONST1, - MI_CONST2, - MI_SHOPPER1, - MI_SHOPPER2, - MI_SHOPPER3, - MI_STUD_MAN, - MI_STUD_WOM, - MI_CAS_MAN, - MI_CAS_WOM, - MI_BUSKER1, - MI_BUSKER2, - MI_BUSKER3, - MI_BUSKER4, - // three more peds possible -*/ - MI_FIRST_VEHICLE = 130, + MI_LAST_PED = MI_SPECIAL21, + MI_FIRST_VEHICLE, + MI_LANDSTAL = MI_FIRST_VEHICLE, MI_IDAHO, MI_STINGER, @@ -440,9 +336,8 @@ enum MI_BODYPARTB, MI_AIRTRAIN_VLO = 257, -// MI_LOPOLYGUY, - NUM_DEFAULT_MODELS = 300 // MIAMI + NUM_DEFAULT_MODELS = 300 }; enum{ @@ -462,13 +357,16 @@ IsGlass(int16 id) } inline bool -IsTrafficLight(int16 id) +IsStreetLight(int16 id) { - return id == MI_TRAFFICLIGHTS || - id == MI_SINGLESTREETLIGHTS1 || + return id == MI_SINGLESTREETLIGHTS1 || id == MI_SINGLESTREETLIGHTS2 || id == MI_SINGLESTREETLIGHTS3 || - id == MI_DOUBLESTREETLIGHTS; + id == MI_TRAFFICLIGHTS_MIAMI || + id == MI_TRAFFICLIGHTS_TWOVERTICAL || + id == MI_MLAMPPOST || + id == MI_STREETLAMP1 || + id == MI_STREETLAMP2; } inline bool @@ -477,60 +375,32 @@ IsBodyPart(int16 id) return id == MI_BODYPARTA || id == MI_BODYPARTB; } -// This is bad and should perhaps not be used -/* inline bool -IsBoatModel(int16 id) +IsPedModel(int16 id) { - return id == MI_PREDATOR || - id == MI_REEFER || - id == MI_SPEEDER || - id == MI_GHOST; + return id >= MI_PLAYER && id <= MI_LAST_PED; } -*/ - inline bool -IsPedModel(int16 id) +IsPalmTreeModel(int16 id) { - return id >= 0 && id <= 89; + return id == MI_VEG_PALM01 || + id == MI_VEG_PALM02 || + id == MI_VEG_PALM03 || + id == MI_VEG_PALM04 || + id == MI_VEG_PALM05 || + id == MI_VEG_PALM06 || + id == MI_VEG_PALM07 || + id == MI_VEG_PALM08; } inline bool IsTreeModel(int16 id) { - return id == MI_TREE1 || - id == MI_TREE2 || + return id == MI_TREE2 || id == MI_TREE3 || - id == MI_TREE4 || - id == MI_TREE5 || id == MI_TREE6 || - id == MI_TREE7 || id == MI_TREE8 || - id == MI_TREE9 || - id == MI_TREE10 || - id == MI_TREE11 || - id == MI_TREE12 || - id == MI_TREE13 || - id == MI_TREE14; -} - -inline bool -IsBannerModel(int16 id) -{ - return id == MI_CHINABANNER1 || - id == MI_CHINABANNER2 || - id == MI_CHINABANNER3 || - id == MI_CHINABANNER4 || - id == MI_CHINABANNER5 || - id == MI_CHINABANNER6 || - id == MI_CHINABANNER7 || - id == MI_CHINABANNER8 || - id == MI_CHINABANNER9 || - id == MI_CHINABANNER10 || - id == MI_CHINABANNER11 || - id == MI_CHINABANNER12 || - id == MI_ITALYBANNER1 || - id == MI_CHINALANTERN; + IsPalmTreeModel(id); } inline bool diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index 4a45050c..e6bb7aee 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -14,7 +14,8 @@ #include "soundlist.h" int16 CObject::nNoTempObjects; -int16 CObject::nBodyCastHealth = 1000; +//int16 CObject::nBodyCastHealth = 1000; +float CObject::fDistToNearestTree; void *CObject::operator new(size_t sz) { return CPools::GetObjectPool()->New(); } void *CObject::operator new(size_t sz, int handle) { return CPools::GetObjectPool()->New(handle);}; @@ -161,6 +162,7 @@ CObject::ObjectDamage(float amount) return; static int8 nFrameGen = 0; bool bBodyCastDamageEffect = false; +#if 0 if (GetModelIndex() == MI_BODYCAST) { if (amount > 50.0f) nBodyCastHealth = (int16)(nBodyCastHealth - 0.5f * amount); @@ -170,6 +172,7 @@ CObject::ObjectDamage(float amount) bBodyCastDamageEffect = true; amount = 0.0f; } +#endif if ((amount * m_fCollisionDamageMultiplier > 150.0f || bBodyCastDamageEffect) && m_nCollisionDamageEffect) { const CVector& vecPos = m_matrix.GetPosition(); const float fDirectionZ = 0.0002f * amount; @@ -335,9 +338,12 @@ CObject::Init(void) m_pCurSurface = outEntity; else m_pCurSurface = nil; +#if 0 if (GetModelIndex() == MI_BODYCAST) nBodyCastHealth = 1000; - else if (GetModelIndex() == MI_BUOY) + else +#endif + if (GetModelIndex() == MI_BUOY) bTouchingWater = true; } diff --git a/src/objects/Object.h b/src/objects/Object.h index 73f710f0..9ceffb2f 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -86,7 +86,9 @@ public: int8 m_colour1, m_colour2; static int16 nNoTempObjects; - static int16 nBodyCastHealth; +// static int16 nBodyCastHealth; + + static float fDistToNearestTree; static void *operator new(size_t); static void *operator new(size_t, int); diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 44bedab9..42abc2ab 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -853,18 +853,12 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy) if (!obj) return; - bool makeInvisible; CWorld::Remove(dummy); delete dummy; CWorld::Add(obj); - int16 mi = obj->GetModelIndex(); - if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 || - mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8) - makeInvisible = true; - else - makeInvisible = false; - if (makeInvisible) { + CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(obj->GetModelIndex()); + if (IsGlass(obj->GetModelIndex()) && !mi->m_isArtistGlass) { obj->bIsVisible = false; } else if (obj->GetModelIndex() == MI_BUOY) { obj->bIsStatic = false; @@ -883,17 +877,9 @@ CPopulation::ConvertToDummyObject(CObject *obj) dummy->GetMatrix().UpdateRW(); dummy->UpdateRwFrame(); - bool makeInvisible; - int16 mi = obj->GetModelIndex(); - if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 || - mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8) - makeInvisible = true; - else - makeInvisible = false; - - if (makeInvisible) { + CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(obj->GetModelIndex()); + if (IsGlass(obj->GetModelIndex()) && !mi->m_isArtistGlass) dummy->bIsVisible = false; - } CWorld::Remove(obj); delete obj; diff --git a/src/render/2dEffect.h b/src/render/2dEffect.h index ed5ce5ba..504824c5 100644 --- a/src/render/2dEffect.h +++ b/src/render/2dEffect.h @@ -4,7 +4,8 @@ enum { EFFECT_LIGHT, EFFECT_PARTICLE, EFFECT_ATTRACTOR, - EFFECT_PED_ATTRACTOR + EFFECT_PED_ATTRACTOR, + EFFECT_SUNGLARE }; enum { @@ -35,6 +36,8 @@ enum { // same order as CPointLights flags, must start at 2 LIGHTFLAG_FOG_NORMAL = 2, // can have light and fog LIGHTFLAG_FOG_ALWAYS = 4, // fog only + LIGHTFLAG_HIDE_OBJECT = 8, // hide the object instead of rendering light (???) + LIGHTFLAG_LONG_DIST = 16, LIGHTFLAG_FOG = (LIGHTFLAG_FOG_NORMAL|LIGHTFLAG_FOG_ALWAYS) }; diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp index 05210c77..c6ba0f10 100644 --- a/src/render/Clouds.cpp +++ b/src/render/Clouds.cpp @@ -62,8 +62,6 @@ void CClouds::Update(void) { float s = Sin(TheCamera.Orientation - 0.85f); - CloudRotation += CWeather::Wind*s*0.001f; - IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep()*0.5f + 0.3f) * 60.0f; #ifdef FIX_BUGS CloudRotation += CWeather::Wind*s*0.001f*CTimer::GetTimeStepFix(); IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep()*0.5f + 0.3f*CTimer::GetTimeStepFix()) * 60.0f; diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index e36bdf3d..8e832ab1 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -129,7 +129,8 @@ CCoronas::Update(void) void CCoronas::RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 alpha, const CVector &coors, float size, float drawDist, RwTexture *tex, - int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle) + int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle, + bool longDist, float nearDist) { int i; @@ -192,11 +193,13 @@ CCoronas::RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 al void CCoronas::RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 alpha, - const CVector &coors, float size, float drawDist, uint8 type, - int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle) + const CVector &coors, float size, float drawDist, uint8 type, + int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle, + bool longDist, float nearDist) { RegisterCorona(id, red, green, blue, alpha, coors, size, drawDist, - gpCoronaTexture[type], flareType, reflection, LOScheck, drawStreak, someAngle); + gpCoronaTexture[type], flareType, reflection, LOScheck, drawStreak, someAngle, + longDist, nearDist); } void diff --git a/src/render/Coronas.h b/src/render/Coronas.h index 70e9ccd5..cb4e8583 100644 --- a/src/render/Coronas.h +++ b/src/render/Coronas.h @@ -90,10 +90,12 @@ public: static void Update(void); static void RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 alpha, const CVector &coors, float size, float drawDist, RwTexture *tex, - int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle); + int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle, + bool longDist = false, float nearClip = 1.5f); static void RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 alpha, const CVector &coors, float size, float drawDist, uint8 type, - int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle); + int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle, + bool longDist = false, float nearClip = 1.5f); static void UpdateCoronaCoors(uint32 id, const CVector &coors, float drawDist, float someAngle); static void Render(void); static void RenderReflections(void); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 803f4cc1..f149c6fb 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1245,9 +1245,11 @@ CRenderer::ShouldModelBeStreamed(CEntity *ent, const CVector &campos) void CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset) { - if(ent->bRenderScorched) - return; - CPointLights::RemoveLightsAffectingObject(); - if(reset) - ReSetAmbientAndDirectionalColours(); + if(!ent->bRenderScorched){ + CPointLights::RemoveLightsAffectingObject(); + if(reset) + ReSetAmbientAndDirectionalColours(); + } + SetAmbientColours(); + DeActivateDirectional(); } diff --git a/src/render/WindModifiers.cpp b/src/render/WindModifiers.cpp new file mode 100644 index 00000000..d7405c7a --- /dev/null +++ b/src/render/WindModifiers.cpp @@ -0,0 +1,8 @@ +#include "common.h" +#include "WindModifiers.h" + +int32 +CWindModifiers::FindWindModifier(CVector pos, float *x, float *y) +{ + return 0; +} diff --git a/src/render/WindModifiers.h b/src/render/WindModifiers.h new file mode 100644 index 00000000..b4024343 --- /dev/null +++ b/src/render/WindModifiers.h @@ -0,0 +1,7 @@ +#pragma once + +class CWindModifiers +{ +public: + static int32 FindWindModifier(CVector pos, float *x, float *y); +}; diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index e0ee0296..654feb5f 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -2192,6 +2192,7 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) phys->RegisterReference((CEntity**)&m_aGroundPhysical[i]); m_aGroundOffset[i] = m_aWheelColPoints[i].point - phys->GetPosition(); +#if 0 if(phys->GetModelIndex() == MI_BODYCAST && GetStatus() == STATUS_PLAYER){ // damage body cast float speed = m_vecMoveSpeed.MagnitudeSqr(); @@ -2208,6 +2209,7 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) phys->AddToMovingList(); } } +#endif } m_nSurfaceTouched = m_aWheelColPoints[i].surfaceB; diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index 043f1c73..5a165c00 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -88,6 +88,7 @@ void CCranes::AddThisOneCrane(CEntity* pEntity) if (pCrane->m_nAudioEntity >= 0) DMAudio.SetEntityStatus(pCrane->m_nAudioEntity, 1); pCrane->m_bIsTop = (MODELID_CRANE_1 != pEntity->GetModelIndex()); +#if 0 // Is this used to avoid military crane? if (pCrane->m_bIsTop || pEntity->GetPosition().y > 0.0f) { CObject* pHook = new CObject(MI_MAGNET, false); @@ -100,6 +101,7 @@ void CCranes::AddThisOneCrane(CEntity* pEntity) pCrane->SetHookMatrix(); } else +#endif pCrane->m_pHook = nil; NumCranes++; } diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 51e2604c..3d5d4e77 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -4,6 +4,8 @@ #include "FileMgr.h" #include "HandlingMgr.h" +//--MIAMI: done + cHandlingDataMgr mod_HandlingManager; const char *HandlingFilename = "HANDLING.CFG"; -- cgit v1.2.3 From 0b0ba49abc34315f532f9adcdbc277d5275723c7 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 19 May 2020 21:42:55 +0200 Subject: small fixes --- src/core/World.cpp | 2 +- src/entities/Entity.cpp | 2 +- src/entities/Physical.cpp | 8 +- src/modelinfo/ModelIndices.cpp | 6 +- src/modelinfo/ModelIndices.h | 322 +++++++++++++++++++++-------------------- src/peds/Population.cpp | 20 +-- 6 files changed, 173 insertions(+), 187 deletions(-) (limited to 'src') diff --git a/src/core/World.cpp b/src/core/World.cpp index c15c134d..edcfd865 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1823,7 +1823,7 @@ void CWorld::RepositionOneObject(CEntity *pEntity) { int16 modelId = pEntity->GetModelIndex(); - if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || + if (IsStreetLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index ec50dd30..683a3571 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -683,7 +683,7 @@ CEntity::ProcessLightsForEntity(void) lightOn = true; break; case LIGHT_FLICKER_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7){ + if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){){ if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) lightOn = true; else diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 64358cbf..31f8fcbc 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -1076,13 +1076,13 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists) if(B->IsBuilding()) skipShift = false; - else if(IsTrafficLight(A->GetModelIndex()) && + else if(IsStreetLight(A->GetModelIndex()) && (B->IsVehicle() || B->IsPed()) && A->GetUp().z < 0.66f) skipShift = true; else if((A->IsVehicle() || A->IsPed()) && B->GetUp().z < 0.66f && - IsTrafficLight(B->GetModelIndex())) + IsStreetLight(B->GetModelIndex())) skipShift = true; // TODO: maybe flip some ifs here else if(A->IsObject() && B->IsVehicle()){ @@ -1407,7 +1407,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) if(B->IsBuilding()) skipCollision = false; - else if(IsTrafficLight(A->GetModelIndex()) && + else if(IsStreetLight(A->GetModelIndex()) && (B->IsVehicle() || B->IsPed()) && A->GetUp().z < 0.66f){ skipCollision = true; @@ -1415,7 +1415,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) Aobj->m_pCollidingEntity = B; }else if((A->IsVehicle() || A->IsPed()) && B->GetUp().z < 0.66f && - IsTrafficLight(B->GetModelIndex())){ + IsStreetLight(B->GetModelIndex())){ skipCollision = true; A->bSkipLineCol = true; Bobj->m_pCollidingEntity = A; diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp index 9a6a74d0..056c3733 100644 --- a/src/modelinfo/ModelIndices.cpp +++ b/src/modelinfo/ModelIndices.cpp @@ -3,14 +3,14 @@ #include "General.h" #include "ModelIndices.h" -#define X(name, var, addr) int16 var; +#define X(name, var) int16 var; MODELINDICES #undef X void InitModelIndices(void) { -#define X(name, var, addr) var = -1; +#define X(name, var) var = -1; MODELINDICES #undef X } @@ -18,7 +18,7 @@ InitModelIndices(void) void MatchModelString(const char *modelname, int16 id) { -#define X(name, var, addr) \ +#define X(name, var) \ if(!CGeneral::faststrcmp(name, modelname)){ \ var = id; \ return; \ diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index cc6ed25c..c0f01929 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -1,164 +1,164 @@ #pragma once #define MODELINDICES \ - X("fire_hydrant", MI_FIRE_HYDRANT, 0x5F5A00) \ - X("bagelstnd02", MI_BAGELSTAND2, 0x5F59FC) \ - X("fish01", MI_FISHSTALL01, 0x5F59EC) \ - X("fishstall02", MI_FISHSTALL02, 0x5F59F0) \ - X("fishstall03", MI_FISHSTALL03, 0x5F59F4) \ - X("fishstall04", MI_FISHSTALL04, 0x5F59F8) \ - X("taxisign", MI_TAXISIGN, 0x5F59E8) \ - X("phonesign", MI_PHONESIGN, 0x5F59E4) \ - X("noparkingsign1", MI_NOPARKINGSIGN1, 0x5F59E0) \ - X("bussign1", MI_BUSSIGN1, 0x5F59DC) \ - X("roadworkbarrier1", MI_ROADWORKBARRIER1, 0x5F59D8) \ - X("dump1", MI_DUMP1, 0x5F59D4) \ - X("trafficcone", MI_TRAFFICCONE, 0x5F59D0) \ - X("newsstand1", MI_NEWSSTAND, 0x5F59CC) \ - X("postbox1", MI_POSTBOX1, 0x5F59C8) \ - X("bin1", MI_BIN, 0x5F59C4) \ - X("wastebin", MI_WASTEBIN, 0x5F59C0) \ - X("phonebooth1", MI_PHONEBOOTH1, 0x5F59BC) \ - X("parkingmeter", MI_PARKINGMETER, 0x5F59B8) \ - X("trafficlight1", MI_TRAFFICLIGHTS, 0x5F5958) \ - X("lamppost1", MI_SINGLESTREETLIGHTS1, 0x5F595C) \ - X("lamppost2", MI_SINGLESTREETLIGHTS2, 0x5F5960) \ - X("lamppost3", MI_SINGLESTREETLIGHTS3, 0x5F5964) \ - X("doublestreetlght1", MI_DOUBLESTREETLIGHTS, 0x5F5968) \ - X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART, 0x5F596C) \ - X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND, 0x5F5970) \ - X("veg_tree1", MI_TREE1, 0x5F5974) \ - X("veg_tree3", MI_TREE2, 0x5F5978) \ - X("veg_treea1", MI_TREE3, 0x5F597C) \ - X("veg_treenew01", MI_TREE4, 0x5F5980) \ - X("veg_treenew05", MI_TREE5, 0x5F5984) \ - X("veg_treeb1", MI_TREE6, 0x5F5988) \ - X("veg_treenew10", MI_TREE7, 0x5F598C) \ - X("veg_treea3", MI_TREE8, 0x5F5990) \ - X("veg_treenew09", MI_TREE9, 0x5F5994) \ - X("veg_treenew08", MI_TREE10, 0x5F5998) \ - X("veg_treenew03", MI_TREE11, 0x5F599C) \ - X("veg_treenew16", MI_TREE12, 0x5F59A0) \ - X("veg_treenew17", MI_TREE13, 0x5F59A4) \ - X("veg_treenew06", MI_TREE14, 0x5F59A8) \ - X("doc_crane_cab", MODELID_CRANE_1, 0x5F59AC) \ - X("cranetopb", MODELID_CRANE_2, 0x5F59B0) \ - X("cranetopa", MODELID_CRANE_3, 0x5F59B4) \ - X("package1", MI_COLLECTABLE1, 0x5F5A04) \ - X("Money", MI_MONEY, 0x5F5A08) \ - X("barrel1", MI_CARMINE, 0x5F5A0C) \ - X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10) \ - X("bombdoor", MI_GARAGEDOOR2, 0x5F5A14) \ - X("door_bombshop", MI_GARAGEDOOR3, 0x5F5A18) \ - X("vheistlocdoor", MI_GARAGEDOOR4, 0x5F5A1C) \ - X("door2_garage", MI_GARAGEDOOR5, 0x5F5A20) \ - X("ind_slidedoor", MI_GARAGEDOOR6, 0x5F5A24) \ - X("bankjobdoor", MI_GARAGEDOOR7, 0x5F5A28) \ - X("door_jmsgrage", MI_GARAGEDOOR9, 0x5F5A2C) \ - X("jamesgrge_kb", MI_GARAGEDOOR10, 0x5F5A30) \ - X("door_sfehousegrge", MI_GARAGEDOOR11, 0x5F5A34) \ - X("shedgaragedoor", MI_GARAGEDOOR12, 0x5F5A38) \ - X("door4_garage", MI_GARAGEDOOR13, 0x5F5A3C) \ - X("door_col_compnd_01", MI_GARAGEDOOR14, 0x5F5A40) \ - X("door_col_compnd_02", MI_GARAGEDOOR15, 0x5F5A44) \ - X("door_col_compnd_03", MI_GARAGEDOOR16, 0x5F5A48) \ - X("door_col_compnd_04", MI_GARAGEDOOR17, 0x5F5A4C) \ - X("door_col_compnd_05", MI_GARAGEDOOR18, 0x5F5A50) \ - X("impex_door", MI_GARAGEDOOR19, 0x5F5A54) \ - X("SalvGarage", MI_GARAGEDOOR20, 0x5F5A58) \ - X("door3_garage", MI_GARAGEDOOR21, 0x5F5A5C) \ - X("leveldoor2", MI_GARAGEDOOR22, 0x5F5A60) \ - X("double_garage_dr", MI_GARAGEDOOR23, 0x5F5A64) \ - X("amcogaragedoor", MI_GARAGEDOOR24, 0x5F5A68) \ - X("towergaragedoor1", MI_GARAGEDOOR25, 0x5F5A6C) \ - X("towergaragedoor2", MI_GARAGEDOOR26, 0x5F5A70) \ - X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74) \ - X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78) \ - X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C) \ - X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80) \ - X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84) \ - X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88) \ - X("barrel2", MI_NAUTICALMINE, 0x5F5A8C) \ - X("crushercrush", MI_CRUSHERBODY, 0x5F5A90) \ - X("crushertop", MI_CRUSHERLID, 0x5F5A94) \ - X("donkeymag", MI_DONKEYMAG, 0x5F5A98) \ - X("bullion", MI_BULLION, 0x5F5A9C) \ - X("floatpackge1", MI_FLOATPACKAGE1, 0x5F5AA0) \ - X("briefcase", MI_BRIEFCASE, 0x5F5AA4) \ - X("chinabanner1", MI_CHINABANNER1, 0x5F5AA8) \ - X("chinabanner2", MI_CHINABANNER2, 0x5F5AAC) \ - X("chinabanner3", MI_CHINABANNER3, 0x5F5AB0) \ - X("chinabanner4", MI_CHINABANNER4, 0x5F5AB4) \ - X("iten_chinatown5", MI_CHINABANNER5, 0x5F5AB8) \ - X("iten_chinatown7", MI_CHINABANNER6, 0x5F5ABC) \ - X("iten_chinatown3", MI_CHINABANNER7, 0x5F5AC0) \ - X("iten_chinatown2", MI_CHINABANNER8, 0x5F5AC4) \ - X("iten_chinatown4", MI_CHINABANNER9, 0x5F5AC8) \ - X("iten_washline01", MI_CHINABANNER10, 0x5F5ACC) \ - X("iten_washline02", MI_CHINABANNER11, 0x5F5AD0) \ - X("iten_washline03", MI_CHINABANNER12, 0x5F5AD4) \ - X("chinalanterns", MI_CHINALANTERN, 0x5F5AD8) \ - X("glassfx1", MI_GLASS1, 0x5F5ADC) \ - X("glassfx2", MI_GLASS2, 0x5F5AE0) \ - X("glassfx3", MI_GLASS3, 0x5F5AE4) \ - X("glassfx4", MI_GLASS4, 0x5F5AE8) \ - X("glassfx55", MI_GLASS5, 0x5F5AEC) \ - X("glassfxsub1", MI_GLASS6, 0x5F5AF0) \ - X("glassfxsub2", MI_GLASS7, 0x5F5AF4) \ - X("glassfx_composh", MI_GLASS8, 0x5F5AF8) \ - X("bridge_liftsec", MI_BRIDGELIFT, 0x5F5AFC) \ - X("bridge_liftweight", MI_BRIDGEWEIGHT, 0x5F5B00) \ - X("subbridge_lift", MI_BRIDGEROADSEGMENT, 0x5F5B04) \ - X("barrel4", MI_EXPLODINGBARREL, 0x5F5B08) \ - X("flagsitaly", MI_ITALYBANNER1, 0x5F5B0C) \ - X("adrenaline", MI_PICKUP_ADRENALINE, 0x5F5B10) \ - X("bodyarmour", MI_PICKUP_BODYARMOUR, 0x5F5B14) \ - X("info", MI_PICKUP_INFO, 0x5F5B18) \ - X("health", MI_PICKUP_HEALTH, 0x5F5B1C) \ - X("bonus", MI_PICKUP_BONUS, 0x5F5B20) \ - X("bribe", MI_PICKUP_BRIBE, 0x5F5B24) \ - X("killfrenzy", MI_PICKUP_KILLFRENZY, 0x5F5B28) \ - X("camerapickup", MI_PICKUP_CAMERA, 0x5F5B2C) \ - X("bollardlight", MI_BOLLARDLIGHT, 0x5F5B30) \ - X("magnet", MI_MAGNET, 0x5F5B34) \ - X("streetlamp1", MI_STREETLAMP1, 0x5F5B38) \ - X("streetlamp2", MI_STREETLAMP2, 0x5F5B3C) \ - X("railtrax_lo4b", MI_RAILTRACKS, 0x5F5B40) \ - X("bar_barrier10", MI_FENCE, 0x5F5B44) \ - X("bar_barrier12", MI_FENCE2, 0x5F5B48) \ - X("petrolpump", MI_PETROLPUMP, 0x5F5B4C) \ - X("bodycast", MI_BODYCAST, 0x5F5B50) \ - X("backdoor", MI_BACKDOOR, 0x5F5B54) \ - X("coffee", MI_COFFEE, 0x5F5B58) \ - X("bouy", MI_BUOY, 0x5F5B5C) \ - X("parktable1", MI_PARKTABLE, 0x5F5B60) \ - X("sbwy_tunl_start", MI_SUBWAY1, 0x5F5B64) \ - X("sbwy_tunl_bit", MI_SUBWAY2, 0x5F5B68) \ - X("sbwy_tunl_bend", MI_SUBWAY3, 0x5F5B6C) \ - X("sbwy_tunl_cstm6", MI_SUBWAY4, 0x5F5B70) \ - X("sbwy_tunl_cstm7", MI_SUBWAY5, 0x5F5B74) \ - X("sbwy_tunl_cstm8", MI_SUBWAY6, 0x5F5B78) \ - X("sbwy_tunl_cstm10", MI_SUBWAY7, 0x5F5B7C) \ - X("sbwy_tunl_cstm9", MI_SUBWAY8, 0x5F5B80) \ - X("sbwy_tunl_cstm11", MI_SUBWAY9, 0x5F5B84) \ - X("sbwy_tunl_cstm1", MI_SUBWAY10, 0x5F5B88) \ - X("sbwy_tunl_cstm2", MI_SUBWAY11, 0x5F5B8C) \ - X("sbwy_tunl_cstm4", MI_SUBWAY12, 0x5F5B90) \ - X("sbwy_tunl_cstm3", MI_SUBWAY13, 0x5F5B94) \ - X("sbwy_tunl_cstm5", MI_SUBWAY14, 0x5F5B98) \ - X("subplatform_n2", MI_SUBWAY15, 0x5F5B9C) \ - X("suby_tunl_start", MI_SUBWAY16, 0x5F5BA0) \ - X("sbwy_tunl_start2", MI_SUBWAY17, 0x5F5BA4) \ - X("indy_tunl_start", MI_SUBWAY18, 0x5F5BA8) \ - X("indsubway03", MI_SUBPLATFORM_IND, 0x5F5BAC) \ - X("comerside_subway", MI_SUBPLATFORM_COMS, 0x5F5BB0) \ - X("subplatform", MI_SUBPLATFORM_COMS2, 0x5F5BB4) \ - X("subplatform_n", MI_SUBPLATFORM_COMN, 0x5F5BB8) \ - X("Otherside_subway", MI_SUBPLATFORM_SUB, 0x5F5BBC) \ - X("subplatform_sub", MI_SUBPLATFORM_SUB2, 0x5F5BC0) \ - X("files", MI_FILES, 0x5F5BC4) + X("fire_hydrant", MI_FIRE_HYDRANT) \ + X("bagelstnd02", MI_BAGELSTAND2) \ + X("fish01", MI_FISHSTALL01) \ + X("fishstall02", MI_FISHSTALL02) \ + X("fishstall03", MI_FISHSTALL03) \ + X("fishstall04", MI_FISHSTALL04) \ + X("taxisign", MI_TAXISIGN) \ + X("phonesign", MI_PHONESIGN) \ + X("noparkingsign1", MI_NOPARKINGSIGN1) \ + X("bussign1", MI_BUSSIGN1) \ + X("roadworkbarrier1", MI_ROADWORKBARRIER1) \ + X("dump1", MI_DUMP1) \ + X("trafficcone", MI_TRAFFICCONE) \ + X("newsstand1", MI_NEWSSTAND) \ + X("postbox1", MI_POSTBOX1) \ + X("bin1", MI_BIN) \ + X("wastebin", MI_WASTEBIN) \ + X("phonebooth1", MI_PHONEBOOTH1) \ + X("parkingmeter", MI_PARKINGMETER) \ + X("trafficlight1", MI_TRAFFICLIGHTS) \ + X("lamppost1", MI_SINGLESTREETLIGHTS1) \ + X("lamppost2", MI_SINGLESTREETLIGHTS2) \ + X("lamppost3", MI_SINGLESTREETLIGHTS3) \ + X("doublestreetlght1", MI_DOUBLESTREETLIGHTS) \ + X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART) \ + X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND) \ + X("veg_tree1", MI_TREE1) \ + X("veg_tree3", MI_TREE2) \ + X("veg_treea1", MI_TREE3) \ + X("veg_treenew01", MI_TREE4) \ + X("veg_treenew05", MI_TREE5) \ + X("veg_treeb1", MI_TREE6) \ + X("veg_treenew10", MI_TREE7) \ + X("veg_treea3", MI_TREE8) \ + X("veg_treenew09", MI_TREE9) \ + X("veg_treenew08", MI_TREE10) \ + X("veg_treenew03", MI_TREE11) \ + X("veg_treenew16", MI_TREE12) \ + X("veg_treenew17", MI_TREE13) \ + X("veg_treenew06", MI_TREE14) \ + X("doc_crane_cab", MODELID_CRANE_1) \ + X("cranetopb", MODELID_CRANE_2) \ + X("cranetopa", MODELID_CRANE_3) \ + X("package1", MI_COLLECTABLE1) \ + X("Money", MI_MONEY) \ + X("barrel1", MI_CARMINE) \ + X("oddjgaragdoor", MI_GARAGEDOOR1) \ + X("bombdoor", MI_GARAGEDOOR2) \ + X("door_bombshop", MI_GARAGEDOOR3) \ + X("vheistlocdoor", MI_GARAGEDOOR4) \ + X("door2_garage", MI_GARAGEDOOR5) \ + X("ind_slidedoor", MI_GARAGEDOOR6) \ + X("bankjobdoor", MI_GARAGEDOOR7) \ + X("door_jmsgrage", MI_GARAGEDOOR9) \ + X("jamesgrge_kb", MI_GARAGEDOOR10) \ + X("door_sfehousegrge", MI_GARAGEDOOR11) \ + X("shedgaragedoor", MI_GARAGEDOOR12) \ + X("door4_garage", MI_GARAGEDOOR13) \ + X("door_col_compnd_01", MI_GARAGEDOOR14) \ + X("door_col_compnd_02", MI_GARAGEDOOR15) \ + X("door_col_compnd_03", MI_GARAGEDOOR16) \ + X("door_col_compnd_04", MI_GARAGEDOOR17) \ + X("door_col_compnd_05", MI_GARAGEDOOR18) \ + X("impex_door", MI_GARAGEDOOR19) \ + X("SalvGarage", MI_GARAGEDOOR20) \ + X("door3_garage", MI_GARAGEDOOR21) \ + X("leveldoor2", MI_GARAGEDOOR22) \ + X("double_garage_dr", MI_GARAGEDOOR23) \ + X("amcogaragedoor", MI_GARAGEDOOR24) \ + X("towergaragedoor1", MI_GARAGEDOOR25) \ + X("towergaragedoor2", MI_GARAGEDOOR26) \ + X("towergaragedoor3", MI_GARAGEDOOR27) \ + X("plysve_gragedoor", MI_GARAGEDOOR28) \ + X("impexpsubgrgdoor", MI_GARAGEDOOR29) \ + X("Sub_sprayshopdoor", MI_GARAGEDOOR30) \ + X("ind_plyrwoor", MI_GARAGEDOOR31) \ + X("8ballsuburbandoor", MI_GARAGEDOOR32) \ + X("barrel2", MI_NAUTICALMINE) \ + X("crushercrush", MI_CRUSHERBODY) \ + X("crushertop", MI_CRUSHERLID) \ + X("donkeymag", MI_DONKEYMAG) \ + X("bullion", MI_BULLION) \ + X("floatpackge1", MI_FLOATPACKAGE1) \ + X("briefcase", MI_BRIEFCASE) \ + X("chinabanner1", MI_CHINABANNER1) \ + X("chinabanner2", MI_CHINABANNER2) \ + X("chinabanner3", MI_CHINABANNER3) \ + X("chinabanner4", MI_CHINABANNER4) \ + X("iten_chinatown5", MI_CHINABANNER5) \ + X("iten_chinatown7", MI_CHINABANNER6) \ + X("iten_chinatown3", MI_CHINABANNER7) \ + X("iten_chinatown2", MI_CHINABANNER8) \ + X("iten_chinatown4", MI_CHINABANNER9) \ + X("iten_washline01", MI_CHINABANNER10) \ + X("iten_washline02", MI_CHINABANNER11) \ + X("iten_washline03", MI_CHINABANNER12) \ + X("chinalanterns", MI_CHINALANTERN) \ + X("glassfx1", MI_GLASS1) \ + X("glassfx2", MI_GLASS2) \ + X("glassfx3", MI_GLASS3) \ + X("glassfx4", MI_GLASS4) \ + X("glassfx55", MI_GLASS5) \ + X("glassfxsub1", MI_GLASS6) \ + X("glassfxsub2", MI_GLASS7) \ + X("glassfx_composh", MI_GLASS8) \ + X("bridge_liftsec", MI_BRIDGELIFT) \ + X("bridge_liftweight", MI_BRIDGEWEIGHT) \ + X("subbridge_lift", MI_BRIDGEROADSEGMENT) \ + X("barrel4", MI_EXPLODINGBARREL) \ + X("flagsitaly", MI_ITALYBANNER1) \ + X("adrenaline", MI_PICKUP_ADRENALINE) \ + X("bodyarmour", MI_PICKUP_BODYARMOUR) \ + X("info", MI_PICKUP_INFO) \ + X("health", MI_PICKUP_HEALTH) \ + X("bonus", MI_PICKUP_BONUS) \ + X("bribe", MI_PICKUP_BRIBE) \ + X("killfrenzy", MI_PICKUP_KILLFRENZY) \ + X("camerapickup", MI_PICKUP_CAMERA) \ + X("bollardlight", MI_BOLLARDLIGHT) \ + X("magnet", MI_MAGNET) \ + X("streetlamp1", MI_STREETLAMP1) \ + X("streetlamp2", MI_STREETLAMP2) \ + X("railtrax_lo4b", MI_RAILTRACKS) \ + X("bar_barrier10", MI_FENCE) \ + X("bar_barrier12", MI_FENCE2) \ + X("petrolpump", MI_PETROLPUMP) \ + X("bodycast", MI_BODYCAST) \ + X("backdoor", MI_BACKDOOR) \ + X("coffee", MI_COFFEE) \ + X("bouy", MI_BUOY) \ + X("parktable1", MI_PARKTABLE) \ + X("sbwy_tunl_start", MI_SUBWAY1) \ + X("sbwy_tunl_bit", MI_SUBWAY2) \ + X("sbwy_tunl_bend", MI_SUBWAY3) \ + X("sbwy_tunl_cstm6", MI_SUBWAY4) \ + X("sbwy_tunl_cstm7", MI_SUBWAY5) \ + X("sbwy_tunl_cstm8", MI_SUBWAY6) \ + X("sbwy_tunl_cstm10", MI_SUBWAY7) \ + X("sbwy_tunl_cstm9", MI_SUBWAY8) \ + X("sbwy_tunl_cstm11", MI_SUBWAY9) \ + X("sbwy_tunl_cstm1", MI_SUBWAY10) \ + X("sbwy_tunl_cstm2", MI_SUBWAY11) \ + X("sbwy_tunl_cstm4", MI_SUBWAY12) \ + X("sbwy_tunl_cstm3", MI_SUBWAY13) \ + X("sbwy_tunl_cstm5", MI_SUBWAY14) \ + X("subplatform_n2", MI_SUBWAY15) \ + X("suby_tunl_start", MI_SUBWAY16) \ + X("sbwy_tunl_start2", MI_SUBWAY17) \ + X("indy_tunl_start", MI_SUBWAY18) \ + X("indsubway03", MI_SUBPLATFORM_IND) \ + X("comerside_subway", MI_SUBPLATFORM_COMS) \ + X("subplatform", MI_SUBPLATFORM_COMS2) \ + X("subplatform_n", MI_SUBPLATFORM_COMN) \ + X("Otherside_subway", MI_SUBPLATFORM_SUB) \ + X("subplatform_sub", MI_SUBPLATFORM_SUB2) \ + X("files", MI_FILES) -#define X(name, var, addr) extern int16 var; +#define X(name, var) extern int16 var; MODELINDICES #undef X @@ -255,7 +255,9 @@ enum MI_BUSKER4, // three more peds possible - MI_FIRST_VEHICLE = 90, + MI_LAST_PED = 89, + MI_FIRST_VEHICLE, + MI_LANDSTAL = MI_FIRST_VEHICLE, MI_IDAHO, MI_STINGER, @@ -382,7 +384,7 @@ IsGlass(int16 id) } inline bool -IsTrafficLight(int16 id) +IsStreetLight(int16 id) { return id == MI_TRAFFICLIGHTS || id == MI_SINGLESTREETLIGHTS1 || @@ -410,7 +412,7 @@ IsBoatModel(int16 id) inline bool IsPedModel(int16 id) { - return id >= 0 && id <= 89; + return id >= MI_PLAYER && id <= MI_LAST_PED; } inline bool diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 1566ba3d..e2257a28 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -966,18 +966,11 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy) if (!obj) return; - bool makeInvisible; CWorld::Remove(dummy); delete dummy; CWorld::Add(obj); - int16 mi = obj->GetModelIndex(); - if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 || - mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8) - makeInvisible = true; - else - makeInvisible = false; - if (makeInvisible) { + if (IsGlass(obj->GetModelIndex())) { obj->bIsVisible = false; } else if (obj->GetModelIndex() == MI_BUOY) { obj->bIsStatic = false; @@ -996,17 +989,8 @@ CPopulation::ConvertToDummyObject(CObject *obj) dummy->GetMatrix().UpdateRW(); dummy->UpdateRwFrame(); - bool makeInvisible; - int16 mi = obj->GetModelIndex(); - if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 || - mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8) - makeInvisible = true; - else - makeInvisible = false; - - if (makeInvisible) { + if (IsGlass(obj->GetModelIndex())) dummy->bIsVisible = false; - } CWorld::Remove(obj); delete obj; -- cgit v1.2.3 From 50f0c7a1dcad33ac3d38d6e37faca3d16d222aaa Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 19 May 2020 22:01:28 +0200 Subject: bla --- src/entities/Entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index 683a3571..a9b6b2b8 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -683,7 +683,7 @@ CEntity::ProcessLightsForEntity(void) lightOn = true; break; case LIGHT_FLICKER_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){){ + if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){ if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) lightOn = true; else -- cgit v1.2.3 From 1b96e6c378b3e827c27444c38d207350ec0af66c Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 19 May 2020 23:49:28 +0300 Subject: fixed script bug --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 864799f8..e8aa3266 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2998,9 +2998,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) pCarGen->SwitchOff(); }else if (ScriptParams[1] <= 100){ pCarGen->SwitchOn(); + pCarGen->SetUsesRemaining(ScriptParams[1]); }else{ pCarGen->SwitchOn(); - pCarGen->SetUsesRemaining(ScriptParams[1]); } return 0; } -- cgit v1.2.3