diff options
author | majestic <majesticcoding@gmail.com> | 2020-07-05 22:45:09 +0200 |
---|---|---|
committer | majestic <majesticcoding@gmail.com> | 2020-07-20 18:49:39 +0200 |
commit | 1ff27e3363c4deb027619375ac289a6148cda529 (patch) | |
tree | 3b39a423fff3d683dea4b16fc36308a46118286f /src/vehicles | |
parent | fixes from master, menu helper text (diff) | |
download | re3-1ff27e3363c4deb027619375ac289a6148cda529.tar re3-1ff27e3363c4deb027619375ac289a6148cda529.tar.gz re3-1ff27e3363c4deb027619375ac289a6148cda529.tar.bz2 re3-1ff27e3363c4deb027619375ac289a6148cda529.tar.lz re3-1ff27e3363c4deb027619375ac289a6148cda529.tar.xz re3-1ff27e3363c4deb027619375ac289a6148cda529.tar.zst re3-1ff27e3363c4deb027619375ac289a6148cda529.zip |
Diffstat (limited to 'src/vehicles')
-rw-r--r-- | src/vehicles/CarGen.cpp | 7 | ||||
-rw-r--r-- | src/vehicles/CarGen.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp index 2a048881..4b83cc81 100644 --- a/src/vehicles/CarGen.cpp +++ b/src/vehicles/CarGen.cpp @@ -16,6 +16,7 @@ #include "VisibilityPlugins.h" #include "World.h" #include "Zones.h" +#include "Occlusion.h" uint8 CTheCarGenerators::ProcessCounter; uint32 CTheCarGenerators::NumOfCarGenerators; @@ -151,7 +152,7 @@ void CCarGenerator::Process() { if (m_nVehicleHandle == -1 && (CTheCarGenerators::GenerateEvenIfPlayerIsCloseCounter || CTimer::GetTimeInMilliseconds() >= m_nTimer) && - m_nUsesRemaining != 0 && CheckIfWithinRangeOfAnyPlayer()) + m_nUsesRemaining != 0 && CheckIfWithinRangeOfAnyPlayers()) DoInternalProcessing(); if (m_nVehicleHandle == -1) return; @@ -203,14 +204,14 @@ bool CCarGenerator::CheckForBlockage(int32 mi) return false; } -bool CCarGenerator::CheckIfWithinRangeOfAnyPlayer() +bool CCarGenerator::CheckIfWithinRangeOfAnyPlayers() { CVector2D direction = FindPlayerCentreOfWorld(CWorld::PlayerInFocus) - m_vecPos; float distance = direction.Magnitude(); float farclip = 110.0f * TheCamera.GenerationDistMultiplier; float nearclip = farclip - 20.0f; bool canBeRemoved = (m_nModelIndex > 0 && CModelInfo::IsBoatModel(m_nModelIndex) && 165.0f * TheCamera.GenerationDistMultiplier > distance && - TheCamera.IsSphereVisible(m_vecPos, 0.0f)); // TODO(MIAMI) COcclision::IsPositionOccluded(m_vecPos, 0.0f) + TheCamera.IsSphereVisible(m_vecPos, 0.0f) && COcclusion::IsPositionOccluded(m_vecPos, 0.0f)); if (distance >= farclip || canBeRemoved){ if (m_bIsBlocking) m_bIsBlocking = false; diff --git a/src/vehicles/CarGen.h b/src/vehicles/CarGen.h index 684f93ee..fccbee96 100644 --- a/src/vehicles/CarGen.h +++ b/src/vehicles/CarGen.h @@ -30,7 +30,7 @@ public: void Process(); void Setup(float x, float y, float z, float angle, int32 mi, int16 color1, int16 color2, uint8 force, uint8 alarm, uint8 lock, uint16 min_delay, uint16 max_delay); bool CheckForBlockage(int32 mi); - bool CheckIfWithinRangeOfAnyPlayer(); + bool CheckIfWithinRangeOfAnyPlayers(); void SetUsesRemaining(uint16 uses) { m_nUsesRemaining = uses; } }; |