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

@ -213,7 +213,7 @@ CCamera::Init(void)
m_iModeToGoTo = CCam::MODE_FOLLOWPED;
m_bJust_Switched = false;
m_bUseTransitionBeta = false;
m_matrix.SetScale(1.0f);
GetMatrix().SetScale(1.0f);
m_bTargetJustBeenOnTrain = false;
m_bInitialNoNodeStaticsSet = false;
m_uiLongestTimeInMill = 5000;
@ -4017,7 +4017,7 @@ CCamera::SetRwCamera(RwCamera *cam)
void
CCamera::CalculateDerivedValues(void)
{
m_cameraMatrix = Invert(m_matrix);
m_cameraMatrix = Invert(GetMatrix());
float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f);
float c = Cos(hfov);

View file

@ -2,12 +2,13 @@
class CPlaceable
{
protected:
CMatrix m_matrix;
public:
// disable allocation
static void *operator new(size_t);
CMatrix m_matrix;
CPlaceable(void);
const CVector &GetPosition(void) { return m_matrix.GetPosition(); }
void SetPosition(float x, float y, float z) {
@ -20,6 +21,7 @@ public:
CVector &GetForward(void) { return m_matrix.GetForward(); }
CVector &GetUp(void) { return m_matrix.GetUp(); }
CMatrix &GetMatrix(void) { return m_matrix; }
void SetMatrix(CMatrix &newMatrix) { m_matrix = newMatrix; }
void SetTransform(RwMatrix *m) { m_matrix = CMatrix(m, false); }
void SetHeading(float angle);
void SetOrientation(float x, float y, float z){

View file

@ -1486,7 +1486,7 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList &list, float x1, float y1
CColModel *pColModel = pVehicle->GetColModel();
bool bInsideSphere = false;
for(int32 i = 0; i < pColModel->numSpheres; i++) {
CVector pos = pVehicle->m_matrix * pColModel->spheres[i].center;
CVector pos = pVehicle->GetMatrix() * pColModel->spheres[i].center;
float fRadius = pColModel->spheres[i].radius;
if(pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 &&
pos.y - fRadius < y2)
@ -1803,7 +1803,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
position.z = FindGroundZFor3DCoord(position.x, position.y,
position.z + fHeight, nil) -
fBoundingBoxMinZ;
pEntity->m_matrix.UpdateRW();
pEntity->GetMatrix().UpdateRW();
pEntity->UpdateRwFrame();
} else if(IsLightThatNeedsRepositioning(modelId)) {
CVector position = pEntity->GetMatrix().GetPosition();