Use some GetMatrix/SetMatrix logic based on SA

# Conflicts:
#	src/control/Pickups.cpp
#	src/control/RoadBlocks.cpp
#	src/core/World.cpp
#	src/entities/Entity.cpp
#	src/objects/CutsceneHead.cpp
#	src/objects/Object.cpp
This commit is contained in:
Sergeanur 2021-05-10 02:34:21 +03:00
parent 1817727a66
commit 3dda658e42
12 changed files with 54 additions and 56 deletions

View file

@ -121,9 +121,9 @@ CEntity::CreateRwObject(void)
if(IsBuilding())
gBuildings++;
if(RwObjectGetType(m_rwObject) == rpATOMIC)
m_matrix.AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false);
GetMatrix().AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic *)m_rwObject)), false);
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
m_matrix.AttachRW(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false);
GetMatrix().AttachRW(RwFrameGetMatrix(RpClumpGetFrame((RpClump *)m_rwObject)), false);
mi->AddRef();
}
@ -135,9 +135,9 @@ CEntity::AttachToRwObject(RwObject *obj)
m_rwObject = obj;
if(m_rwObject){
if(RwObjectGetType(m_rwObject) == rpATOMIC)
m_matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false);
GetMatrix().Attach(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic *)m_rwObject)), false);
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
m_matrix.Attach(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false);
GetMatrix().Attach(RwFrameGetMatrix(RpClumpGetFrame((RpClump *)m_rwObject)), false);
CModelInfo::GetModelInfo(m_modelIndex)->AddRef();
}
@ -149,7 +149,7 @@ CEntity::DetachFromRwObject(void)
if(m_rwObject)
CModelInfo::GetModelInfo(m_modelIndex)->RemoveRef();
m_rwObject = nil;
m_matrix.Detach();
GetMatrix().Detach();
}
RpAtomic*
@ -177,7 +177,7 @@ CEntity::DeleteRwObject(void)
{
RwFrame *f;
m_matrix.Detach();
GetMatrix().Detach();
if(m_rwObject){
if(RwObjectGetType(m_rwObject) == rpATOMIC){
f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
@ -202,16 +202,16 @@ CEntity::GetBoundRect(void)
CVector v;
CColModel *col = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel();
rect.ContainPoint(m_matrix * col->boundingBox.min);
rect.ContainPoint(m_matrix * col->boundingBox.max);
rect.ContainPoint(GetMatrix() * col->boundingBox.min);
rect.ContainPoint(GetMatrix() * col->boundingBox.max);
v = col->boundingBox.min;
v.x = col->boundingBox.max.x;
rect.ContainPoint(m_matrix * v);
rect.ContainPoint(GetMatrix() * v);
v = col->boundingBox.max;
v.x = col->boundingBox.min.x;
rect.ContainPoint(m_matrix * v);
rect.ContainPoint(GetMatrix() * v);
return rect;
}
@ -227,7 +227,7 @@ CEntity::GetBoundCentre(void)
void
CEntity::GetBoundCentre(CVector &out)
{
out = m_matrix * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center;
out = GetMatrix() * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center;
}
float