diff options
author | aap <aap@papnet.eu> | 2020-07-20 19:56:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-20 19:56:18 +0200 |
commit | ee2d0ffc145ae3443584b20f3bba11fa596e775f (patch) | |
tree | edd47c08cadd57fdb40d4e70ee7fc410e107631a /src/vehicles | |
parent | Merge pull request #655 from aap/miami (diff) | |
parent | cosmetic fixes (diff) | |
download | re3-ee2d0ffc145ae3443584b20f3bba11fa596e775f.tar re3-ee2d0ffc145ae3443584b20f3bba11fa596e775f.tar.gz re3-ee2d0ffc145ae3443584b20f3bba11fa596e775f.tar.bz2 re3-ee2d0ffc145ae3443584b20f3bba11fa596e775f.tar.lz re3-ee2d0ffc145ae3443584b20f3bba11fa596e775f.tar.xz re3-ee2d0ffc145ae3443584b20f3bba11fa596e775f.tar.zst re3-ee2d0ffc145ae3443584b20f3bba11fa596e775f.zip |
Diffstat (limited to '')
-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; } }; |