diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Camera.cpp | 9 | ||||
-rw-r--r-- | src/core/Camera.h | 6 | ||||
-rw-r--r-- | src/core/References.cpp | 2 | ||||
-rw-r--r-- | src/core/World.cpp | 47 | ||||
-rw-r--r-- | src/core/World.h | 1 | ||||
-rw-r--r-- | src/core/common.h | 6 |
6 files changed, 36 insertions, 35 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 373ede7d..35d4ea7d 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -4103,16 +4103,11 @@ CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat bool CCamera::IsSphereVisible(const CVector ¢er, float radius) { - CMatrix mat = m_cameraMatrix; - return IsSphereVisible(center, radius, &mat); + return IsSphereVisible(center, radius, &m_cameraMatrix); } bool -#ifdef GTA_PS2 -CCamera::IsBoxVisible(CVuVector *box, const CMatrix *mat) -#else -CCamera::IsBoxVisible(CVector *box, const CMatrix *mat) -#endif +CCamera::IsBoxVisible(CVUVECTOR *box, const CMatrix *mat) { int i; int frustumTests[6] = { 0 }; diff --git a/src/core/Camera.h b/src/core/Camera.h index 9354e8ed..66a89f21 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -634,11 +634,7 @@ public: bool IsPointVisible(const CVector ¢er, const CMatrix *mat); bool IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat); bool IsSphereVisible(const CVector ¢er, float radius); -#ifdef GTA_PS2 - bool IsBoxVisible(CVuVector *box, const CMatrix *mat); -#else - bool IsBoxVisible(CVector *box, const CMatrix *mat); -#endif + bool IsBoxVisible(CVUVECTOR *box, const CMatrix *mat); }; VALIDATE_SIZE(CCamera, 0xE9D8); diff --git a/src/core/References.cpp b/src/core/References.cpp index dc83d96d..09913817 100644 --- a/src/core/References.cpp +++ b/src/core/References.cpp @@ -39,9 +39,7 @@ CEntity::RegisterReference(CEntity **pent) ref->pentity = pent; ref->next = m_pFirstReference; m_pFirstReference = ref; - return; } - return; } // Clean up the reference from *pent -> 'this' diff --git a/src/core/World.cpp b/src/core/World.cpp index 9e7a6fc4..9e2c4345 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1906,16 +1906,7 @@ CWorld::Process(void) for(int i = 0; i < NUMCUTSCENEOBJECTS; i++) { CCutsceneObject *csObj = CCutsceneMgr::GetCutsceneObject(i); if(csObj && csObj->m_entryInfoList.first) { - if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP && - RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) { - if (csObj->IsObject()) - RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepNonClippedInSeconds()); - else { - if (!csObj->bOffscreen) - csObj->bOffscreen = !csObj->GetIsOnScreen(); - RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepInSeconds(), !csObj->bOffscreen); - } - } + csObj->UpdateAnim(); csObj->ProcessControl(); csObj->ProcessCollision(); csObj->GetMatrix().UpdateRW(); @@ -1927,26 +1918,40 @@ CWorld::Process(void) } else { for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { CEntity *movingEnt = (CEntity *)node->item; - if(!movingEnt->bRemoveFromWorld && movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP && - RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) { - if (movingEnt->IsObject()) - RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepNonClippedInSeconds()); - else { - if (!movingEnt->bOffscreen) - movingEnt->bOffscreen = !movingEnt->GetIsOnScreen(); - RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepInSeconds(), !movingEnt->bOffscreen); - } - } + if(!movingEnt->bRemoveFromWorld) + movingEnt->UpdateAnim(); } for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { CPhysical *movingEnt = (CPhysical *)node->item; if(movingEnt->bRemoveFromWorld) { RemoveEntityInsteadOfProcessingIt(movingEnt); } else { - movingEnt->ProcessControl(); + if(!CCutsceneMgr::IsCutsceneProcessing() || movingEnt->UpdatesInCutscene()) + movingEnt->ProcessControl(); if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); } } } + for(int y = 0; y < NUMSECTORS_Y; y++) + for(int x = 0; x < NUMSECTORS_X; x++){ + CPtrNode *node; + CSector *sect = CWorld::GetSector(x, y); + for(node = sect->m_lists[ENTITYLIST_PEDS].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_PEDS_OVERLAP].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_VEHICLES].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_OBJECTS].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_DUMMIES].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + } bForceProcessControl = true; for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { CPhysical *movingEnt = (CPhysical *)node->item; diff --git a/src/core/World.h b/src/core/World.h index b75b6a6c..c90bb3a1 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -29,6 +29,7 @@ enum { ENTITYLIST_BUILDINGS, ENTITYLIST_BUILDINGS_OVERLAP, + ENTITYLIST_UNKNOWN, ENTITYLIST_OBJECTS, ENTITYLIST_OBJECTS_OVERLAP, ENTITYLIST_VEHICLES, diff --git a/src/core/common.h b/src/core/common.h index 268bc836..51170986 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -228,6 +228,12 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w) #include "maths.h" #include "Vector.h" +#ifdef GTA_PS2 +#include "VuVector.h" +#define CVUVECTOR CVuVector +#else +#define CVUVECTOR CVector +#endif #include "Vector2D.h" #include "Matrix.h" #include "Rect.h" |