summaryrefslogtreecommitdiffstats
path: root/src/entities/Entity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities/Entity.cpp')
-rw-r--r--src/entities/Entity.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 208e6deb..9d5bf73c 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -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 &center, float radius)
+CEntity::GetIsTouching(CVUVECTOR const &center, 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