From 0b104a59fe91ce7bf6d1e0fb131eff509aea9307 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Wed, 6 May 2020 01:11:06 +0300 Subject: script colstore stuff --- src/control/Script.cpp | 15 +++++++++++++++ src/control/Script.h | 2 ++ src/core/ColStore.cpp | 11 +++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index bd64db43..8e522203 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -249,6 +249,21 @@ void CMissionCleanup::CheckIfCollisionHasLoadedForMissionObject() } } +CPhysical* CMissionCleanup::DoesThisEntityWaitForCollision(int i) +{ + if (m_sEntities[i].type == CLEANUP_CAR) { + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(m_sEntities[i].id); + if (pVehicle && pVehicle->GetStatus() != STATUS_WRECKED) + return pVehicle; + } + else if (m_sEntities[i].type == CLEANUP_CHAR) { + CPed* pPed = CPools::GetPedPool()->GetAt(m_sEntities[i].id); + if (pPed && !pPed->DyingOrDead()) + return pPed; + } + return nil; +} + void CMissionCleanup::Process() { CPopulation::m_AllRandomPedsThisType = -1; diff --git a/src/control/Script.h b/src/control/Script.h index 85e36cbd..46c6ae20 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -6,6 +6,7 @@ class CEntity; class CBuilding; +class CPhysical; class CVehicle; class CPed; class CObject; @@ -132,6 +133,7 @@ public: void RemoveEntityFromList(int32, uint8); void Process(); void CheckIfCollisionHasLoadedForMissionObject(); + CPhysical* DoesThisEntityWaitForCollision(int i); }; struct CUpsideDownCarCheckEntry diff --git a/src/core/ColStore.cpp b/src/core/ColStore.cpp index 0715ae6e..feaf08c7 100644 --- a/src/core/ColStore.cpp +++ b/src/core/ColStore.cpp @@ -9,6 +9,7 @@ #include "Timer.h" #include "Camera.h" #include "Frontend.h" +#include "Physical.h" #include "ColStore.h" CPool *CColStore::ms_pColPool; @@ -174,7 +175,13 @@ CColStore::LoadCollision(const CVector2D &pos) CGeneral::faststrcmp(GetColName(i), "yacht") == 0){ wantThisOne = true; }else{ - // TODO: check mission cleanup list + for (int j = 0; j < MAX_CLEANUP; j++) { + CPhysical* pEntity = CTheScripts::MissionCleanup.DoesThisEntityWaitForCollision(j); + if (pEntity /* !pEntity->bDontLoadCollision && !pEntity->bIsFrozen */) { + if (GetBoundingBox(i).IsPointInside(pEntity->GetPosition(), -80.0f)) + wantThisOne = true; + } + } } if(wantThisOne) @@ -221,7 +228,7 @@ CColStore::HasCollisionLoaded(const CVector2D &pos) int i; for(i = 1; i < COLSTORESIZE; i++) - if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -110.0f) && + if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -115.0f) && !GetSlot(i)->isLoaded) return false; return true; -- cgit v1.2.3