diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-07-04 15:24:54 +0300 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-07-04 15:24:54 +0300 |
commit | 62425b586631f95d67f2c9ba8c9a4f202e03bda4 (patch) | |
tree | 418a28a718cfe01cc0b8a224e0c1bab6a75de26a /src/control | |
parent | 10cc444482b52d6e82b624bbbb7d87c48dcf48e2 (diff) | |
parent | 5d5e0f62e8b677e122cbdceef8badcbaae7c0235 (diff) |
Merge remote-tracking branch 'upstream/lcs' into lcs
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/GameLogic.cpp | 16 | ||||
-rw-r--r-- | src/control/OnscreenTimer.cpp | 98 |
2 files changed, 60 insertions, 54 deletions
diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index 72e84897..595845c1 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -159,7 +159,7 @@ CGameLogic::Update() #endif CMessages::ClearMessages(); CCarCtrl::ClearInterestingVehicleList(); - CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1); + CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, true); CRestart::FindClosestHospitalRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat); CRestart::OverrideHospitalLevel = LEVEL_GENERIC; CRestart::OverridePoliceStationLevel = LEVEL_GENERIC; @@ -192,7 +192,7 @@ CGameLogic::Update() } - if (!CTheScripts::IsPlayerOnAMission() && pPlayerInfo.m_nBustedAudioStatus == 0) { + if (!CTheScripts::IsPlayerOnAMission() && pPlayerInfo.m_nBustedAudioStatus == BUSTEDAUDIO_NONE) { if (CGeneral::GetRandomNumberInRange(0, 4) == 0) pPlayerInfo.m_nBustedAudioStatus = BUSTEDAUDIO_DONE; else { @@ -268,7 +268,7 @@ CGameLogic::Update() #endif CMessages::ClearMessages(); CCarCtrl::ClearInterestingVehicleList(); - CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1); + CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, true); CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat); CRestart::OverrideHospitalLevel = LEVEL_GENERIC; CRestart::OverridePoliceStationLevel = LEVEL_GENERIC; @@ -323,7 +323,7 @@ CGameLogic::Update() #endif CMessages::ClearMessages(); CCarCtrl::ClearInterestingVehicleList(); - CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1); + CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, true); CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat); CRestart::OverridePoliceStationLevel = LEVEL_GENERIC; CRestart::OverrideHospitalLevel = LEVEL_GENERIC; @@ -380,10 +380,10 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector pPlayerPed->m_fRotationDest = pPlayerPed->m_fRotationCur; pPlayerPed->SetHeading(pPlayerPed->m_fRotationCur); CTheScripts::ClearSpaceForMissionEntity(pos, pPlayerPed); - CWorld::ClearExcitingStuffFromArea(pos, 4000.0, 1); + CWorld::ClearExcitingStuffFromArea(pos, 4000.0f, true); pPlayerPed->RestoreHeadingRate(); CGame::currArea = AREA_MAIN_MAP; - CStreaming::RemoveBuildingsNotInArea(0); + CStreaming::RemoveBuildingsNotInArea(AREA_MAIN_MAP); TheCamera.SetCameraDirectlyInFrontForFollowPed_CamOnAString(); TheCamera.Restore(); CReferences::RemoveReferencesToPlayer(); @@ -490,7 +490,7 @@ CGameLogic::UpdateShortCut() pShortCutTaxi->AutoPilot.m_nTempAction = TEMPACT_GOFORWARD; pShortCutTaxi->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2500; TheCamera.SetFadeColour(0, 0, 0); - TheCamera.Fade(2.5f, 0); + TheCamera.Fade(2.5f, FADE_OUT); ShortCutState = SHORTCUT_TRANSITION; ShortCutTimer = CTimer::GetTimeInMilliseconds() + 3000; CMessages::AddBigMessage(TheText.Get("TAXI"), 4500, 1); @@ -510,7 +510,7 @@ CGameLogic::UpdateShortCut() pShortCutTaxi->SetMoveSpeed(pShortCutTaxi->GetForward() * 0.4f); ShortCutTimer = CTimer::GetTimeInMilliseconds() + 1500; TheCamera.SetFadeColour(0, 0, 0); - TheCamera.Fade(1.0f, 1); + TheCamera.Fade(1.0f, FADE_IN); ShortCutState = SHORTCUT_ARRIVING; CTimer::Resume(); } diff --git a/src/control/OnscreenTimer.cpp b/src/control/OnscreenTimer.cpp index 53ed14c7..5045c1e0 100644 --- a/src/control/OnscreenTimer.cpp +++ b/src/control/OnscreenTimer.cpp @@ -9,14 +9,15 @@ #include "OnscreenTimer.h" #include "Camera.h" -void COnscreenTimer::Init() { +void +COnscreenTimer::Init() +{ m_bDisabled = false; for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) { m_sCounters[i].m_nCounterOffset = 0; - for(uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText); j++) { - m_sCounters[i].m_aCounterText[j] = 0; - } + for(uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText); j++) + m_sCounters[i].m_aCounterText[j] = '\0'; m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER; m_sCounters[i].m_bCounterProcessed = false; @@ -24,24 +25,25 @@ void COnscreenTimer::Init() { for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) { m_sClocks[i].m_nClockOffset = 0; - for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++) { - m_sClocks[i].m_aClockText[j] = 0; - } + for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++) + m_sClocks[i].m_aClockText[j] = '\0'; m_sClocks[i].m_bClockProcessed = false; m_sClocks[i].m_bClockGoingDown = true; } } -void COnscreenTimer::Process() { - if(!CReplay::IsPlayingBack() && !m_bDisabled) { - for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) { +void +COnscreenTimer::Process() +{ + if(!CReplay::IsPlayingBack() && !m_bDisabled) + for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) m_sClocks[i].Process(); - } - } } -void COnscreenTimer::ProcessForDisplay() { +void +COnscreenTimer::ProcessForDisplay() +{ if(CHud::m_Wants_To_Draw_Hud) { m_bProcessed = false; for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) { @@ -63,67 +65,67 @@ void COnscreenTimer::ProcessForDisplay() { } } -void COnscreenTimer::ClearCounter(uint32 offset) { +void +COnscreenTimer::ClearCounter(uint32 offset) +{ for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) { if(offset == m_sCounters[i].m_nCounterOffset) { m_sCounters[i].m_nCounterOffset = 0; - m_sCounters[i].m_aCounterText[0] = 0; + m_sCounters[i].m_aCounterText[0] = '\0'; m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER; - m_sCounters[i].m_bCounterProcessed = 0; + m_sCounters[i].m_bCounterProcessed = false; } } } -void COnscreenTimer::ClearClock(uint32 offset) { - for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) { +void +COnscreenTimer::ClearClock(uint32 offset) +{ + for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) if(offset == m_sClocks[i].m_nClockOffset) { m_sClocks[i].m_nClockOffset = 0; - m_sClocks[i].m_aClockText[0] = 0; - m_sClocks[i].m_bClockProcessed = 0; + m_sClocks[i].m_aClockText[0] = '\0'; + m_sClocks[i].m_bClockProcessed = false; m_sClocks[i].m_bClockGoingDown = true; } - } } -void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 pos) { - +void +COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 pos) +{ if (m_sCounters[pos].m_aCounterText[0] != '\0') return; m_sCounters[pos].m_nCounterOffset = offset; - if(text) { + if(text) strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(m_sCounters[0].m_aCounterText)); - } else { - m_sCounters[pos].m_aCounterText[0] = 0; - } + else + m_sCounters[pos].m_aCounterText[0] = '\0'; m_sCounters[pos].m_nType = type; } -void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) { - - // dead code in here - uint32 i; - for(i = 0; i < NUMONSCREENCLOCKS; i++) { +void +COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) +{ + for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) { if(m_sClocks[i].m_nClockOffset == 0) { + m_sClocks[i].m_nClockOffset = offset; + m_sClocks[i].m_bClockGoingDown = bGoingDown; + if(text) + strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText)); + else + m_sClocks[i].m_aClockText[0] = '\0'; break; } - return; - } - - m_sClocks[i].m_nClockOffset = offset; - m_sClocks[i].m_bClockGoingDown = bGoingDown; - if(text) { - strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText)); - } else { - m_sClocks[i].m_aClockText[0] = 0; } } -void COnscreenTimerEntry::Process() { - if(m_nClockOffset == 0) { +void +COnscreenTimerEntry::Process() +{ + if(m_nClockOffset == 0) return; - } int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nClockOffset); int32 oldTime = *timerPtr; @@ -147,13 +149,17 @@ void COnscreenTimerEntry::Process() { *timerPtr = oldTime + int32(CTimer::GetTimeStepInMilliseconds()); } -void COnscreenTimerEntry::ProcessForDisplayClock() { +void +COnscreenTimerEntry::ProcessForDisplayClock() +{ uint32 time = *CTheScripts::GetPointerToScriptVariable(m_nClockOffset); sprintf(m_aClockBuffer, "%02d:%02d", time / 1000 / 60 % 100, time / 1000 % 60); } -void COnscreenCounterEntry::ProcessForDisplayCounter() { +void +COnscreenCounterEntry::ProcessForDisplayCounter() +{ uint32 counter = *CTheScripts::GetPointerToScriptVariable(m_nCounterOffset); sprintf(m_aCounterBuffer, "%d", counter); } |