Use some GetMatrix/SetMatrix logic based on SA + CutsceneHead fix

This commit is contained in:
Sergeanur 2021-05-10 02:34:21 +03:00
parent f2b59f5097
commit 6537dfe7f1
13 changed files with 57 additions and 60 deletions

View File

@ -201,8 +201,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
const float fBoundMaxY = boundingBox.max.y + 0.3f; const float fBoundMaxY = boundingBox.max.y + 0.3f;
const float fBoundMinY = boundingBox.min.y - 0.3f; const float fBoundMinY = boundingBox.min.y - 0.3f;
const float fBoundMaxX = boundingBox.max.x + 0.3f; const float fBoundMaxX = boundingBox.max.x + 0.3f;
const float fDistanceX = pPosition->x - pEntity->m_matrix.GetPosition().x; const float fDistanceX = pPosition->x - pEntity->GetMatrix().GetPosition().x;
const float fDistanceY = pPosition->y - pEntity->m_matrix.GetPosition().y; const float fDistanceY = pPosition->y - pEntity->GetMatrix().GetPosition().y;
const float fBoundRadius = pEntity->GetBoundRadius(); const float fBoundRadius = pEntity->GetBoundRadius();
CVector vecBoundCentre; CVector vecBoundCentre;
pEntity->GetBoundCentre(vecBoundCentre); pEntity->GetBoundCentre(vecBoundCentre);
@ -216,8 +216,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
if (!pathNodes[x][y].bBlockade) { if (!pathNodes[x][y].bBlockade) {
const float pointY = y * 0.7f + fDistanceY; const float pointY = y * 0.7f + fDistanceY;
CVector2D point(pointX, pointY); CVector2D point(pointX, pointY);
if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->m_matrix.GetRight()))) { if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->GetMatrix().GetRight()))) {
float fDotProduct = DotProduct2D(point, pEntity->m_matrix.GetForward()); float fDotProduct = DotProduct2D(point, pEntity->GetMatrix().GetForward());
if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct) if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct)
pathNodes[x][y].bBlockade = true; pathNodes[x][y].bBlockade = true;
} }

View File

@ -689,8 +689,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame; entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
if (!entity->bDoNotRender) { if (!entity->bDoNotRender) {
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800)); float modifiedSin = 0.3f * (Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800)) + 1.0f);
float modifiedSin = 0.3f * (s + 1.0f);
int16 colorId; int16 colorId;
@ -749,7 +748,20 @@ CPickups::DoPickUpEffects(CEntity *entity)
} }
} }
entity->GetMatrix().SetRotateZOnlyScaled((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800), aWeaponScale[colorId]); float angle = (float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800);
float c = Cos(angle) * aWeaponScale[colorId];
float s = Sin(angle) * aWeaponScale[colorId];
// we know from SA they were setting each field manually like this
entity->GetMatrix().rx = c;
entity->GetMatrix().ry = s;
entity->GetMatrix().rz = 0.0f;
entity->GetMatrix().fx = -s;
entity->GetMatrix().fy = c;
entity->GetMatrix().fz = 0.0f;
entity->GetMatrix().ux = 0.0f;
entity->GetMatrix().uy = 0.0f;
entity->GetMatrix().uz = aWeaponScale[colorId];
} }
} }

View File

@ -55,7 +55,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius; float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
for (int32 i = 0; i < 2; i++) { for (int32 i = 0; i < 2; i++) {
const int32 roadBlockIndex = i + 2 * roadBlockType; const int32 roadBlockIndex = i + 2 * roadBlockType;
CVector posForZ = pVehicle->m_matrix * (fRadius * vecRoadBlockOffets[roadBlockIndex]); CVector posForZ = pVehicle->GetMatrix() * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
int32 modelInfoId = MI_COP; int32 modelInfoId = MI_COP;
eCopType copType = COP_STREET; eCopType copType = COP_STREET;
switch (pVehicle->GetModelIndex()) switch (pVehicle->GetModelIndex())
@ -81,8 +81,8 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
CPedPlacement::FindZCoorForPed(&posForZ); CPedPlacement::FindZCoorForPed(&posForZ);
pCopPed->SetPosition(posForZ); pCopPed->SetPosition(posForZ);
CVector vecSavedPos = pCopPed->GetPosition(); CVector vecSavedPos = pCopPed->GetPosition();
pCopPed->m_matrix.SetRotate(0.0f, 0.0f, -HALFPI); pCopPed->GetMatrix().SetRotate(0.0f, 0.0f, -HALFPI);
pCopPed->m_matrix.GetPosition() += vecSavedPos; pCopPed->GetMatrix().GetPosition() += vecSavedPos;
pCopPed->m_bIsDisabledCop = true; pCopPed->m_bIsDisabledCop = true;
pCopPed->SetIdle(); pCopPed->SetIdle();
pCopPed->bKindaStayInSamePlace = true; pCopPed->bKindaStayInSamePlace = true;
@ -153,7 +153,7 @@ CRoadBlocks::GenerateRoadBlocks(void)
offsetMatrix.GetPosition() = CVector(0.0f, i * fModelRadius - fOffset, 0.6f); offsetMatrix.GetPosition() = CVector(0.0f, i * fModelRadius - fOffset, 0.6f);
else else
offsetMatrix.GetPosition() = CVector(i * fModelRadius - fOffset, 0.0f, 0.6f); offsetMatrix.GetPosition() = CVector(i * fModelRadius - fOffset, 0.0f, 0.6f);
CMatrix vehicleMatrix = mapObject->m_matrix * offsetMatrix; CMatrix vehicleMatrix = mapObject->GetMatrix() * offsetMatrix;
float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f; float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f;
int16 colliding = 0; int16 colliding = 0;
CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false); CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
@ -162,10 +162,10 @@ CRoadBlocks::GenerateRoadBlocks(void)
pVehicle->SetStatus(STATUS_ABANDONED); pVehicle->SetStatus(STATUS_ABANDONED);
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored? // pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
vehicleMatrix.GetPosition().z += fModelRadius - 0.6f; vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
pVehicle->m_matrix = vehicleMatrix; pVehicle->SetMatrix(vehicleMatrix);
pVehicle->PlaceOnRoadProperly(); pVehicle->PlaceOnRoadProperly();
pVehicle->SetIsStatic(false); pVehicle->SetIsStatic(false);
pVehicle->m_matrix.UpdateRW(); pVehicle->GetMatrix().UpdateRW();
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CCarCtrl::JoinCarWithRoadSystem(pVehicle); CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->bIsLocked = false; pVehicle->bIsLocked = false;

View File

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

View File

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

View File

@ -1445,7 +1445,7 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList &list, float x1, float y1
CColModel *pColModel = pVehicle->GetColModel(); CColModel *pColModel = pVehicle->GetColModel();
bool bInsideSphere = false; bool bInsideSphere = false;
for(int32 i = 0; i < pColModel->numSpheres; i++) { 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; float fRadius = pColModel->spheres[i].radius;
if(pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 && if(pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 &&
pos.y - fRadius < y2) pos.y - fRadius < y2)
@ -1763,7 +1763,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
position.z = FindGroundZFor3DCoord(position.x, position.y, position.z = FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
fBoundingBoxMinZ; fBoundingBoxMinZ;
pEntity->m_matrix.UpdateRW(); pEntity->GetMatrix().UpdateRW();
pEntity->UpdateRwFrame(); pEntity->UpdateRwFrame();
} else if(modelId == MI_BUOY) { } else if(modelId == MI_BUOY) {
float fWaterLevel = 0.0f; float fWaterLevel = 0.0f;

View File

@ -110,9 +110,9 @@ CEntity::CreateRwObject(void)
if(IsBuilding()) if(IsBuilding())
gBuildings++; gBuildings++;
if(RwObjectGetType(m_rwObject) == rpATOMIC) 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) 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(); mi->AddRef();
} }
} }
@ -123,9 +123,9 @@ CEntity::AttachToRwObject(RwObject *obj)
m_rwObject = obj; m_rwObject = obj;
if(m_rwObject){ if(m_rwObject){
if(RwObjectGetType(m_rwObject) == rpATOMIC) 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) 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(); CModelInfo::GetModelInfo(m_modelIndex)->AddRef();
} }
} }
@ -136,7 +136,7 @@ CEntity::DetachFromRwObject(void)
if(m_rwObject) if(m_rwObject)
CModelInfo::GetModelInfo(m_modelIndex)->RemoveRef(); CModelInfo::GetModelInfo(m_modelIndex)->RemoveRef();
m_rwObject = nil; m_rwObject = nil;
m_matrix.Detach(); GetMatrix().Detach();
} }
#ifdef PED_SKIN #ifdef PED_SKIN
@ -166,7 +166,7 @@ CEntity::DeleteRwObject(void)
{ {
RwFrame *f; RwFrame *f;
m_matrix.Detach(); GetMatrix().Detach();
if(m_rwObject){ if(m_rwObject){
if(RwObjectGetType(m_rwObject) == rpATOMIC){ if(RwObjectGetType(m_rwObject) == rpATOMIC){
f = RpAtomicGetFrame((RpAtomic*)m_rwObject); f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
@ -193,16 +193,16 @@ CEntity::GetBoundRect(void)
CVector v; CVector v;
CColModel *col = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); CColModel *col = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel();
rect.ContainPoint(m_matrix * col->boundingBox.min); rect.ContainPoint(GetMatrix() * col->boundingBox.min);
rect.ContainPoint(m_matrix * col->boundingBox.max); rect.ContainPoint(GetMatrix() * col->boundingBox.max);
v = col->boundingBox.min; v = col->boundingBox.min;
v.x = col->boundingBox.max.x; v.x = col->boundingBox.max.x;
rect.ContainPoint(m_matrix * v); rect.ContainPoint(GetMatrix() * v);
v = col->boundingBox.max; v = col->boundingBox.max;
v.x = col->boundingBox.min.x; v.x = col->boundingBox.min.x;
rect.ContainPoint(m_matrix * v); rect.ContainPoint(GetMatrix() * v);
return rect; return rect;
} }
@ -218,7 +218,7 @@ CEntity::GetBoundCentre(void)
void void
CEntity::GetBoundCentre(CVector &out) CEntity::GetBoundCentre(CVector &out)
{ {
out = m_matrix * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center; out = GetMatrix() * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center;
} }
float float

View File

@ -442,7 +442,7 @@ CPhysical::ApplyMoveForce(float jx, float jy, float jz)
void void
CPhysical::ApplyTurnForce(float jx, float jy, float jz, float px, float py, float pz) CPhysical::ApplyTurnForce(float jx, float jy, float jz, float px, float py, float pz)
{ {
CVector com = Multiply3x3(m_matrix, m_vecCentreOfMass); CVector com = Multiply3x3(GetMatrix(), m_vecCentreOfMass);
CVector turnimpulse = CrossProduct(CVector(px, py, pz)-com, CVector(jx, jy, jz)); CVector turnimpulse = CrossProduct(CVector(px, py, pz)-com, CVector(jx, jy, jz));
m_vecTurnSpeed += turnimpulse*(1.0f/m_fTurnMass); m_vecTurnSpeed += turnimpulse*(1.0f/m_fTurnMass);
} }
@ -456,7 +456,7 @@ CPhysical::ApplyFrictionMoveForce(float jx, float jy, float jz)
void void
CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float py, float pz) CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float py, float pz)
{ {
CVector com = Multiply3x3(m_matrix, m_vecCentreOfMass); CVector com = Multiply3x3(GetMatrix(), m_vecCentreOfMass);
CVector turnimpulse = CrossProduct(CVector(px, py, pz)-com, CVector(jx, jy, jz)); CVector turnimpulse = CrossProduct(CVector(px, py, pz)-com, CVector(jx, jy, jz));
m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass); m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass);
} }
@ -853,7 +853,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV
moveSpeed += vImpulse * (1.0f/m_fMass); moveSpeed += vImpulse * (1.0f/m_fMass);
// ApplyTurnForce // ApplyTurnForce
CVector com = Multiply3x3(m_matrix, m_vecCentreOfMass); CVector com = Multiply3x3(GetMatrix(), m_vecCentreOfMass);
CVector turnimpulse = CrossProduct(pointpos-com, vImpulse); CVector turnimpulse = CrossProduct(pointpos-com, vImpulse);
turnSpeed += turnimpulse*(1.0f/m_fTurnMass); turnSpeed += turnimpulse*(1.0f/m_fTurnMass);

View File

@ -72,22 +72,6 @@ public:
void SetRotateXOnly(float angle); void SetRotateXOnly(float angle);
void SetRotateYOnly(float angle); void SetRotateYOnly(float angle);
void SetRotateZOnly(float angle); void SetRotateZOnly(float angle);
void SetRotateZOnlyScaled(float angle, float scale) {
float c = Cos(angle);
float s = Sin(angle);
rx = c * scale;
ry = s * scale;
rz = 0.0f;
fx = -s * scale;
fy = c * scale;
fz = 0.0f;
ux = 0.0f;
uy = 0.0f;
uz = scale;
}
void SetRotateX(float angle); void SetRotateX(float angle);
void SetRotateY(float angle); void SetRotateY(float angle);
void SetRotateZ(float angle); void SetRotateZ(float angle);

View File

@ -85,7 +85,6 @@ CCutsceneHead::ProcessControl(void)
{ {
m_matrix.SetRotateY(PI/2); m_matrix.SetRotateY(PI/2);
m_matrix = CMatrix(RwFrameGetLTM(m_pHeadNode)) * m_matrix; m_matrix = CMatrix(RwFrameGetLTM(m_pHeadNode)) * m_matrix;
UpdateRwFrame(); // android/xbox don't call this
} }
assert(RwObjectGetType(m_rwObject) == rpCLUMP); assert(RwObjectGetType(m_rwObject) == rpCLUMP);
@ -95,7 +94,7 @@ CCutsceneHead::ProcessControl(void)
// PS2 only plays anims in cutscene, PC always plays anims // PS2 only plays anims in cutscene, PC always plays anims
if(!lastLoadedSKA || CCutsceneMgr::IsRunning()) if(!lastLoadedSKA || CCutsceneMgr::IsRunning())
#endif #endif
RpHAnimHierarchyAddAnimTime(hier, CTimer::GetTimeStepNonClipped()/50.0f); RpHAnimHierarchyAddAnimTime(hier, CTimer::GetTimeStepNonClippedInSeconds());
} }
void void

View File

@ -63,7 +63,7 @@ CObject::CObject(CDummyObject *dummy)
if (dummy->m_rwObject) if (dummy->m_rwObject)
AttachToRwObject(dummy->m_rwObject); AttachToRwObject(dummy->m_rwObject);
else else
GetMatrix() = dummy->GetMatrix(); SetMatrix(dummy->GetMatrix());
m_objectMatrix = dummy->GetMatrix(); m_objectMatrix = dummy->GetMatrix();
dummy->DetachFromRwObject(); dummy->DetachFromRwObject();
@ -112,8 +112,8 @@ void
CObject::Teleport(CVector vecPos) CObject::Teleport(CVector vecPos)
{ {
CWorld::Remove(this); CWorld::Remove(this);
m_matrix.GetPosition() = vecPos; GetMatrix().GetPosition() = vecPos;
m_matrix.UpdateRW(); GetMatrix().UpdateRW();
UpdateRwFrame(); UpdateRwFrame();
CWorld::Add(this); CWorld::Add(this);
} }
@ -170,7 +170,7 @@ CObject::ObjectDamage(float amount)
amount = 0.0f; amount = 0.0f;
} }
if ((amount * m_fCollisionDamageMultiplier > 150.0f || bBodyCastDamageEffect) && m_nCollisionDamageEffect) { if ((amount * m_fCollisionDamageMultiplier > 150.0f || bBodyCastDamageEffect) && m_nCollisionDamageEffect) {
const CVector& vecPos = m_matrix.GetPosition(); const CVector& vecPos = GetMatrix().GetPosition();
const float fDirectionZ = 0.0002f * amount; const float fDirectionZ = 0.0002f * amount;
switch (m_nCollisionDamageEffect) switch (m_nCollisionDamageEffect)
{ {
@ -329,7 +329,7 @@ CObject::Init(void)
m_pCollidingEntity = nil; m_pCollidingEntity = nil;
CColPoint point; CColPoint point;
CEntity* outEntity = nil; CEntity* outEntity = nil;
const CVector& vecPos = m_matrix.GetPosition(); const CVector& vecPos = GetMatrix().GetPosition();
if (CWorld::ProcessVerticalLine(vecPos, vecPos.z - 10.0f, point, outEntity, true, false, false, false, false, false, nil)) if (CWorld::ProcessVerticalLine(vecPos, vecPos.z - 10.0f, point, outEntity, true, false, false, false, false, false, nil))
m_pCurSurface = outEntity; m_pCurSurface = outEntity;
else else

View File

@ -6983,7 +6983,7 @@ CPed::SetPedPositionInCar(void)
} else { } else {
m_fRotationCur = m_pMyVehicle->GetForward().Heading(); m_fRotationCur = m_pMyVehicle->GetForward().Heading();
} }
GetMatrix() = newMat; SetMatrix(newMat);
} }
void void

View File

@ -106,7 +106,7 @@ void
CPlane::DeleteRwObject(void) CPlane::DeleteRwObject(void)
{ {
if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){ if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){
m_matrix.Detach(); GetMatrix().Detach();
if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check
RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject); RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
RpAtomicDestroy((RpAtomic*)m_rwObject); RpAtomicDestroy((RpAtomic*)m_rwObject);
@ -556,13 +556,13 @@ CPlane::ProcessControl(void)
m_rwObject = CModelInfo::GetModelInfo(mi->m_planeLodId)->CreateInstance(); m_rwObject = CModelInfo::GetModelInfo(mi->m_planeLodId)->CreateInstance();
POP_MEMID(); POP_MEMID();
if(m_rwObject) if(m_rwObject)
m_matrix.AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject))); GetMatrix().AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)));
} }
} }
}else if(CStreaming::HasModelLoaded(GetModelIndex())){ }else if(CStreaming::HasModelLoaded(GetModelIndex())){
if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){ if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){
// Get rid of LOD model // Get rid of LOD model
m_matrix.Detach(); GetMatrix().Detach();
if(m_rwObject){ // useless check if(m_rwObject){ // useless check
if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check
RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject); RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject);