mirror of
https://github.com/halpz/re3.git
synced 2025-07-25 15:22:47 +00:00
CEntity and C(Vu)Vector fixes and cleanup
This commit is contained in:
@ -191,7 +191,7 @@ CEntity::GetBoundRect(void)
|
||||
{
|
||||
CRect rect;
|
||||
CVector v;
|
||||
CColModel *col = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel();
|
||||
CColModel *col = CModelInfo::GetColModel(m_modelIndex);
|
||||
|
||||
rect.ContainPoint(GetMatrix() * col->boundingBox.min);
|
||||
rect.ContainPoint(GetMatrix() * col->boundingBox.max);
|
||||
@ -210,21 +210,27 @@ CEntity::GetBoundRect(void)
|
||||
CVector
|
||||
CEntity::GetBoundCentre(void)
|
||||
{
|
||||
CVector v;
|
||||
GetBoundCentre(v);
|
||||
return v;
|
||||
return GetMatrix() * CModelInfo::GetColModel(m_modelIndex)->boundingSphere.center;
|
||||
}
|
||||
|
||||
#ifdef GTA_PS2
|
||||
void
|
||||
CEntity::GetBoundCentre(CVuVector &out)
|
||||
{
|
||||
TransformPoint(out, GetMatrix(), CModelInfo::GetColModel(m_modelIndex)->boundingSphere.center);
|
||||
}
|
||||
#else
|
||||
void
|
||||
CEntity::GetBoundCentre(CVector &out)
|
||||
{
|
||||
out = GetMatrix() * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center;
|
||||
out = GetMatrix() * CModelInfo::GetColModel(m_modelIndex)->boundingSphere.center;
|
||||
}
|
||||
#endif
|
||||
|
||||
float
|
||||
CEntity::GetBoundRadius(void)
|
||||
{
|
||||
return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.radius;
|
||||
return CModelInfo::GetColModel(m_modelIndex)->boundingSphere.radius;
|
||||
}
|
||||
|
||||
void
|
||||
@ -379,10 +385,13 @@ CEntity::Render(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
CEntity::GetIsTouching(CVector const ¢er, float radius)
|
||||
CEntity::GetIsTouching(CVUVECTOR const ¢er, float radius)
|
||||
{
|
||||
return sq(GetBoundRadius()+radius) > (GetBoundCentre()-center).MagnitudeSqr();
|
||||
CVUVECTOR boundCenter;
|
||||
GetBoundCentre(boundCenter);
|
||||
return sq(GetBoundRadius()+radius) > (boundCenter-center).MagnitudeSqr();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -400,8 +409,7 @@ CEntity::IsVisibleComplex(void)
|
||||
bool
|
||||
CEntity::GetIsOnScreen(void)
|
||||
{
|
||||
return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius(),
|
||||
&TheCamera.GetCameraMatrix());
|
||||
return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -417,7 +425,7 @@ CEntity::GetIsOnScreenComplex(void)
|
||||
return true;
|
||||
|
||||
CRect rect = GetBoundRect();
|
||||
CColModel *colmodel = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel();
|
||||
CColModel *colmodel = CModelInfo::GetColModel(m_modelIndex);
|
||||
float z = GetPosition().z;
|
||||
float minz = z + colmodel->boundingBox.min.z;
|
||||
float maxz = z + colmodel->boundingBox.max.z;
|
||||
@ -572,7 +580,7 @@ CEntity::Remove(void)
|
||||
float
|
||||
CEntity::GetDistanceFromCentreOfMassToBaseOfModel(void)
|
||||
{
|
||||
return -CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingBox.min.z;
|
||||
return -CModelInfo::GetColModel(m_modelIndex)->boundingBox.min.z;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -141,11 +141,11 @@ public:
|
||||
return (RpClump*)m_rwObject;
|
||||
}
|
||||
|
||||
void GetBoundCentre(CVector &out);
|
||||
void GetBoundCentre(CVUVECTOR &out);
|
||||
CVector GetBoundCentre(void);
|
||||
float GetBoundRadius(void);
|
||||
float GetDistanceFromCentreOfMassToBaseOfModel(void);
|
||||
bool GetIsTouching(CVector const ¢er, float r);
|
||||
bool GetIsTouching(CVUVECTOR const ¢er, float r);
|
||||
bool GetIsOnScreen(void);
|
||||
bool GetIsOnScreenComplex(void);
|
||||
bool IsVisible(void);
|
||||
|
@ -216,7 +216,7 @@ CPhysical::RemoveAndAdd(void)
|
||||
CRect
|
||||
CPhysical::GetBoundRect(void)
|
||||
{
|
||||
CVector center;
|
||||
CVUVECTOR center;
|
||||
float radius;
|
||||
GetBoundCentre(center);
|
||||
radius = GetBoundRadius();
|
||||
@ -1086,7 +1086,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
||||
CPhysical *A, *B;
|
||||
CObject *Bobj;
|
||||
bool canshift;
|
||||
CVector center;
|
||||
CVUVECTOR center;
|
||||
float radius;
|
||||
|
||||
int numCollisions;
|
||||
@ -1244,7 +1244,7 @@ CPhysical::ProcessCollisionSectorList_SimpleCar(CPtrList *lists)
|
||||
{
|
||||
static CColPoint aColPoints[MAX_COLLISION_POINTS];
|
||||
float radius;
|
||||
CVector center;
|
||||
CVUVECTOR center;
|
||||
int listtype;
|
||||
CPhysical *A, *B;
|
||||
int numCollisions;
|
||||
@ -1406,7 +1406,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
||||
{
|
||||
static CColPoint aColPoints[MAX_COLLISION_POINTS];
|
||||
float radius;
|
||||
CVector center;
|
||||
CVUVECTOR center;
|
||||
CPtrList *list;
|
||||
CPhysical *A, *B;
|
||||
CObject *Aobj, *Bobj;
|
||||
|
Reference in New Issue
Block a user