script colstore stuff

This commit is contained in:
Nikolay Korolev 2020-05-06 01:11:06 +03:00
parent 35bf340401
commit 0b104a59fe
3 changed files with 26 additions and 2 deletions

View File

@ -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() void CMissionCleanup::Process()
{ {
CPopulation::m_AllRandomPedsThisType = -1; CPopulation::m_AllRandomPedsThisType = -1;

View File

@ -6,6 +6,7 @@
class CEntity; class CEntity;
class CBuilding; class CBuilding;
class CPhysical;
class CVehicle; class CVehicle;
class CPed; class CPed;
class CObject; class CObject;
@ -132,6 +133,7 @@ public:
void RemoveEntityFromList(int32, uint8); void RemoveEntityFromList(int32, uint8);
void Process(); void Process();
void CheckIfCollisionHasLoadedForMissionObject(); void CheckIfCollisionHasLoadedForMissionObject();
CPhysical* DoesThisEntityWaitForCollision(int i);
}; };
struct CUpsideDownCarCheckEntry struct CUpsideDownCarCheckEntry

View File

@ -9,6 +9,7 @@
#include "Timer.h" #include "Timer.h"
#include "Camera.h" #include "Camera.h"
#include "Frontend.h" #include "Frontend.h"
#include "Physical.h"
#include "ColStore.h" #include "ColStore.h"
CPool<ColDef,ColDef> *CColStore::ms_pColPool; CPool<ColDef,ColDef> *CColStore::ms_pColPool;
@ -174,7 +175,13 @@ CColStore::LoadCollision(const CVector2D &pos)
CGeneral::faststrcmp(GetColName(i), "yacht") == 0){ CGeneral::faststrcmp(GetColName(i), "yacht") == 0){
wantThisOne = true; wantThisOne = true;
}else{ }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) if(wantThisOne)
@ -221,7 +228,7 @@ CColStore::HasCollisionLoaded(const CVector2D &pos)
int i; int i;
for(i = 1; i < COLSTORESIZE; 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) !GetSlot(i)->isLoaded)
return false; return false;
return true; return true;