summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-05 03:45:18 +0200
committerSergeanur <s.anureev@yandex.ua>2020-05-05 03:45:18 +0200
commit84c9484e55874c57c1c017cb2394e0c6b2f32303 (patch)
treebcd2cbc38055ee38aa1aa2b35dd46d0f5e2e0772 /src
parentMerge pull request #508 from Nick007J/master (diff)
downloadre3-84c9484e55874c57c1c017cb2394e0c6b2f32303.tar
re3-84c9484e55874c57c1c017cb2394e0c6b2f32303.tar.gz
re3-84c9484e55874c57c1c017cb2394e0c6b2f32303.tar.bz2
re3-84c9484e55874c57c1c017cb2394e0c6b2f32303.tar.lz
re3-84c9484e55874c57c1c017cb2394e0c6b2f32303.tar.xz
re3-84c9484e55874c57c1c017cb2394e0c6b2f32303.tar.zst
re3-84c9484e55874c57c1c017cb2394e0c6b2f32303.zip
Diffstat (limited to '')
-rw-r--r--src/control/Replay.cpp8
-rw-r--r--src/control/Script.cpp18
-rw-r--r--src/core/AnimViewer.cpp6
-rw-r--r--src/core/Camera.cpp38
-rw-r--r--src/core/Placeable.cpp4
-rw-r--r--src/core/Placeable.h2
-rw-r--r--src/core/PlayerInfo.cpp6
-rw-r--r--src/core/PlayerInfo.h2
-rw-r--r--src/core/Radar.cpp12
-rw-r--r--src/core/World.cpp15
-rw-r--r--src/core/World.h4
-rw-r--r--src/entities/Physical.cpp8
-rw-r--r--src/math/Vector.h9
-rw-r--r--src/peds/Ped.cpp66
-rw-r--r--src/peds/PedPlacement.cpp2
-rw-r--r--src/peds/PedPlacement.h2
-rw-r--r--src/peds/Population.cpp28
-rw-r--r--src/save/GenericGameStorage.cpp12
-rw-r--r--src/vehicles/Automobile.cpp10
-rw-r--r--src/vehicles/Plane.cpp20
20 files changed, 129 insertions, 143 deletions
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 49f5462f..fd5448cc 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -900,10 +900,10 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
TheCamera.GetMatrix().GetPosition() *= split;
TheCamera.GetMatrix() += CMatrix(interpolation) * pg->camera_pos;
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
- pm->pos = *(RwV3d*)TheCamera.GetPosition();
- pm->at = *(RwV3d*)TheCamera.GetForward();
- pm->up = *(RwV3d*)TheCamera.GetUp();
- pm->right = *(RwV3d*)TheCamera.GetRight();
+ pm->pos = TheCamera.GetPosition();
+ pm->at = TheCamera.GetForward();
+ pm->up = TheCamera.GetUp();
+ pm->right = TheCamera.GetRight();
CameraFocusX = split * CameraFocusX + interpolation * pg->player_pos.x;
CameraFocusY = split * CameraFocusY + interpolation * pg->player_pos.y;
CameraFocusZ = split * CameraFocusZ + interpolation * pg->player_pos.z;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 255499ca..7906b3e7 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1725,7 +1725,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += 1.0f;
- ped->GetPosition() = pos;
+ ped->SetPosition(pos);
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CTheScripts::ClearSpaceForMissionEntity(pos, ped);
CWorld::Add(ped);
@@ -1939,7 +1939,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel();
- boat->GetPosition() = pos;
+ boat->SetPosition(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, boat);
boat->SetStatus(STATUS_ABANDONED);
boat->bIsLocked = true;
@@ -1957,7 +1957,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
- car->GetPosition() = pos;
+ car->SetPosition(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, car);
car->SetStatus(STATUS_ABANDONED);
car->bIsLocked = true;
@@ -2531,7 +2531,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += pObj->GetDistanceFromCentreOfMassToBaseOfModel();
- pObj->GetPosition() = pos;
+ pObj->SetPosition(pos);
pObj->SetOrientation(0.0f, 0.0f, 0.0f);
pObj->GetMatrix().UpdateRW();
pObj->UpdateRwFrame();
@@ -2751,7 +2751,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPed->CharCreatedBy = MISSION_CHAR;
pPed->bRespondsToThreats = false;
pPed->bAllowMedicsToReviveMe = false;
- pPed->GetPosition() = pVehicle->GetPosition();
+ pPed->SetPosition(pVehicle->GetPosition());
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
pPed->SetPedState(PED_DRIVING);
CPopulation::ms_nTotalMissionPeds++;
@@ -3943,7 +3943,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
pPed->CharCreatedBy = MISSION_CHAR;
pPed->bRespondsToThreats = false;
pPed->bAllowMedicsToReviveMe = false;
- pPed->GetPosition() = pVehicle->GetPosition();
+ pPed->SetPosition(pVehicle->GetPosition());
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
pPed->SetPedState(PED_DRIVING);
CPopulation::ms_nTotalMissionPeds++;
@@ -5319,7 +5319,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- pObj->GetPosition() = pos;
+ pObj->SetPosition(pos);
pObj->SetOrientation(0.0f, 0.0f, 0.0f);
pObj->GetMatrix().UpdateRW();
pObj->UpdateRwFrame();
@@ -7343,7 +7343,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += 1.0f;
- ped->GetPosition() = pos;
+ ped->SetPosition(pos);
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CTheScripts::ClearSpaceForMissionEntity(pos, ped);
CWorld::Add(ped);
@@ -8165,7 +8165,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
car = new CAutomobile(model, MISSION_VEHICLE);
CVector pos = *(CVector*)&ScriptParams[0];
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
- car->GetPosition() = pos;
+ car->SetPosition(pos);
car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3]));
CTheScripts::ClearSpaceForMissionEntity(pos, car);
car->SetStatus(STATUS_ABANDONED);
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp
index 7afda509..b4763627 100644
--- a/src/core/AnimViewer.cpp
+++ b/src/core/AnimViewer.cpp
@@ -108,7 +108,7 @@ CAnimViewer::Initialise(void) {
CTimeCycle::Initialise();
CCarCtrl::Init();
CPlayerPed *player = new CPlayerPed();
- player->GetPosition() = CVector(0.0f, 0.0f, 0.0f);
+ player->SetPosition(0.0f, 0.0f, 0.0f);
CWorld::Players[0].m_pPed = player;
CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f;
@@ -292,14 +292,14 @@ CAnimViewer::Update(void)
}
newEntity->bIsStuck = true;
}
- newEntity->GetPosition() = CVector(0.0f, 0.0f, 0.0f);
+ newEntity->SetPosition(0.0f, 0.0f, 0.0f);
CWorld::Add(newEntity);
TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT);
}
if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) {
((CPhysical*)pTarget)->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
}
- pTarget->GetPosition().z = 0.0f;
+ pTarget->GetMatrix().GetPosition().z = 0.0f;
if (modelInfo->m_type != MITYPE_PED) {
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 379b9c36..3f4684e7 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -470,19 +470,19 @@ CCamera::Process(void)
}
}
- GetRight() = CrossProduct(CamUp, CamFront); // actually Left
- GetForward() = CamFront;
- GetUp() = CamUp;
- GetPosition() = CamSource;
+ GetMatrix().GetRight() = CrossProduct(CamUp, CamFront); // actually Left
+ GetMatrix().GetForward() = CamFront;
+ GetMatrix().GetUp() = CamUp;
+ GetMatrix().GetPosition() = CamSource;
// Process Shake
float shakeStrength = m_fCamShakeForce - 0.28f*(CTimer::GetTimeInMilliseconds()-m_uiCamShakeStart)/1000.0f;
shakeStrength = clamp(shakeStrength, 0.0f, 2.0f);
int shakeRand = CGeneral::GetRandomNumber();
float shakeOffset = shakeStrength*0.1f;
- GetPosition().x += shakeOffset*((shakeRand&0xF)-7);
- GetPosition().y += shakeOffset*(((shakeRand&0xF0)>>4)-7);
- GetPosition().z += shakeOffset*(((shakeRand&0xF00)>>8)-7);
+ GetMatrix().GetPosition().x += shakeOffset * ((shakeRand & 0xF) - 7);
+ GetMatrix().GetPosition().y += shakeOffset * (((shakeRand & 0xF0) >> 4) - 7);
+ GetMatrix().GetPosition().z += shakeOffset * (((shakeRand & 0xF00) >> 8) - 7);
if(shakeOffset > 0.0f && m_BlurType != MBLUR_SNIPER)
SetMotionBlurAlpha(Min((int)(shakeStrength*255.0f) + 25, 150));
@@ -499,27 +499,27 @@ CCamera::Process(void)
CVector Front = Cams[2].Front;
CVector Up = Cams[2].Up;
- GetRight() = CrossProduct(Up, Front);
- GetForward() = Front;
- GetUp() = Up;
- GetPosition() = Source;
+ GetMatrix().GetRight() = CrossProduct(Up, Front);
+ GetMatrix().GetForward() = Front;
+ GetMatrix().GetUp() = Up;
+ GetMatrix().GetPosition() = Source;
CDraw::SetFOV(Cams[2].FOV);
m_vecGameCamPos = Cams[ActiveCam].Source;
- *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d();
- *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d();
- *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d();
- *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d();
+ *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition();
+ *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward();
+ *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp();
+ *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight();
RwMatrixUpdate(RwFrameGetMatrix(frame));
RwFrameUpdateObjects(frame);
}else{
RwFrame *frame = RwCameraGetFrame(m_pRwCamera);
m_vecGameCamPos = GetPosition();
- *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d();
- *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d();
- *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d();
- *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d();
+ *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition();
+ *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward();
+ *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp();
+ *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight();
RwMatrixUpdate(RwFrameGetMatrix(frame));
RwFrameUpdateObjects(frame);
}
diff --git a/src/core/Placeable.cpp b/src/core/Placeable.cpp
index 99ca5659..69b3d3ea 100644
--- a/src/core/Placeable.cpp
+++ b/src/core/Placeable.cpp
@@ -12,9 +12,9 @@ CPlaceable::~CPlaceable(void) = default;
void
CPlaceable::SetHeading(float angle)
{
- CVector pos = GetPosition();
+ CVector pos = GetMatrix().GetPosition();
m_matrix.SetRotateZ(angle);
- GetPosition() += pos;
+ GetMatrix().Translate(pos);
}
bool
diff --git a/src/core/Placeable.h b/src/core/Placeable.h
index d39bb0d9..7e858283 100644
--- a/src/core/Placeable.h
+++ b/src/core/Placeable.h
@@ -10,7 +10,7 @@ public:
CPlaceable(void);
virtual ~CPlaceable(void);
- CVector &GetPosition(void) { return m_matrix.GetPosition(); }
+ const CVector &GetPosition(void) { return m_matrix.GetPosition(); }
void SetPosition(float x, float y, float z) {
m_matrix.GetPosition().x = x;
m_matrix.GetPosition().y = y;
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index 7dadbf28..0cd69119 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -38,7 +38,7 @@ CPlayerInfo::SetPlayerSkin(char *skin)
LoadPlayerSkin();
}
-CVector&
+const CVector &
CPlayerInfo::GetPos()
{
#ifdef FIX_BUGS
@@ -430,7 +430,7 @@ CPlayerInfo::Process(void)
CPed::PedSetOutCarCB(0, m_pPed);
CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
CAnimManager::BlendAnimation(m_pPed->GetClump(), ASSOCGRP_STD, ANIM_FALL_LAND, 100.0f);
- m_pPed->GetPosition() = sth;
+ m_pPed->SetPosition(sth);
m_pPed->SetMoveState(PEDMOVE_STILL);
m_pPed->m_vecMoveSpeed = veh->m_vecMoveSpeed;
}
@@ -456,7 +456,7 @@ CPlayerInfo::Process(void)
#ifdef VC_PED_PORTS
if (carBelow->GetStatus() != STATUS_WRECKED && carBelow->GetUp().z > 0.3f)
#else
- if (carBelow->m_status != STATUS_WRECKED)
+ if (carBelow->GetStatus() != STATUS_WRECKED)
#endif
m_pPed->SetSeekBoatPosition(carBelow);
}
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index ff31418c..8d0a27b6 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -62,7 +62,7 @@ public:
void DeletePlayerSkin();
void AwardMoneyForExplosion(CVehicle *vehicle);
void SetPlayerSkin(char* skin);
- CVector& GetPos();
+ const CVector &GetPos();
void Process(void);
void KillPlayer(void);
void ArrestPlayer(void);
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index b4c22068..ca28620e 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -523,7 +523,7 @@ void CRadar::DrawBlips()
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else {
#ifdef TRIANGULAR_BLIPS
- CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
+ const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
@@ -562,8 +562,8 @@ void CRadar::DrawBlips()
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else {
#ifdef TRIANGULAR_BLIPS
- CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
- CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
+ const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
+ const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
@@ -629,7 +629,7 @@ void CRadar::DrawBlips()
else
#ifdef TRIANGULAR_BLIPS
{
- CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
+ const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
@@ -678,8 +678,8 @@ void CRadar::DrawBlips()
else
#ifdef TRIANGULAR_BLIPS
{
- CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
- CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
+ const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
+ const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 2833c59c..e87d23f2 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -1417,7 +1417,7 @@ FindPlayerSpeed(void)
return ped->m_vecMoveSpeed;
}
-CVector &
+const CVector &
FindPlayerCentreOfWorld(int32 player)
{
#ifdef FIX_BUGS
@@ -1429,7 +1429,7 @@ FindPlayerCentreOfWorld(int32 player)
return CWorld::Players[player].m_pPed->GetPosition();
}
-CVector &
+const CVector &
FindPlayerCentreOfWorld_NoSniperShift(void)
{
#ifdef FIX_BUGS
@@ -1824,12 +1824,7 @@ void
CWorld::RepositionOneObject(CEntity *pEntity)
{
int16 modelId = pEntity->m_modelIndex;
- if(modelId == MI_SINGLESTREETLIGHTS1 || modelId == MI_SINGLESTREETLIGHTS2 ||
- modelId == MI_SINGLESTREETLIGHTS3 || modelId == MI_DOUBLESTREETLIGHTS || modelId == MI_TREE1 ||
- modelId == MI_TREE2 || modelId == MI_TREE3 || modelId == MI_TREE4 || modelId == MI_TREE5 ||
- modelId == MI_TREE6 || modelId == MI_TREE7 || modelId == MI_TREE8 || modelId == MI_TREE9 ||
- modelId == MI_TREE10 || modelId == MI_TREE11 || modelId == MI_TREE12 || modelId == MI_TREE13 ||
- modelId == MI_TREE14 || modelId == MI_TRAFFICLIGHTS || modelId == MI_PARKINGMETER ||
+ if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
@@ -1837,7 +1832,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 ||
modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT ||
modelId == MI_PARKTABLE) {
- CVector &position = pEntity->GetPosition();
+ CVector &position = pEntity->GetMatrix().GetPosition();
float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z;
position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
@@ -1855,7 +1850,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
if(!bFound || fWaterLevel > fGroundZ) {
CColModel *pColModel = pEntity->GetColModel();
float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
- pEntity->GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight;
+ pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight;
}
}
}
diff --git a/src/core/World.h b/src/core/World.h
index 991180af..ab3f0192 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -164,6 +164,6 @@ CVehicle *FindPlayerTrain(void);
CEntity *FindPlayerEntity(void);
CVector FindPlayerCoors(void);
CVector &FindPlayerSpeed(void);
-CVector &FindPlayerCentreOfWorld(int32 player);
-CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
+const CVector &FindPlayerCentreOfWorld(int32 player);
+const CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
float FindPlayerHeading(void);
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index af08ced6..a61aaa78 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -317,7 +317,7 @@ CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phy
CWorld::Remove(phys);
phys->GetMatrix() = other->GetMatrix();
- phys->GetPosition() = pos;
+ phys->SetPosition(pos);
phys->m_vecMoveSpeed = other->m_vecMoveSpeed;
phys->GetMatrix().UpdateRW();
phys->UpdateRwFrame();
@@ -412,7 +412,7 @@ CPhysical::GetSpeed(const CVector &r)
void
CPhysical::ApplyMoveSpeed(void)
{
- GetPosition() += m_vecMoveSpeed * CTimer::GetTimeStep();
+ GetMatrix().Translate(m_vecMoveSpeed * CTimer::GetTimeStep());
}
void
@@ -1167,7 +1167,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
float f = Min(Abs(dir.z), 0.9f);
dir.z = 0.0f;
dir.Normalise();
- B->GetPosition() += dir * colpoints[mostColliding].depth / (1.0f - f);
+ B->GetMatrix().Translate(dir * colpoints[mostColliding].depth / (1.0f - f));
// BUG? how can that ever happen? A is a Ped
if(B->IsVehicle())
B->ProcessEntityCollision(A, colpoints);
@@ -1184,7 +1184,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
if(!doShift)
return false;
- GetPosition() += shift;
+ GetMatrix().Translate(shift);
if(boat)
ProcessEntityCollision(boat, colpoints);
return true;
diff --git a/src/math/Vector.h b/src/math/Vector.h
index 5a6efcb3..5918a5d1 100644
--- a/src/math/Vector.h
+++ b/src/math/Vector.h
@@ -9,11 +9,6 @@ public:
#ifdef RWCORE_H
CVector(const RwV3d &v) : x(v.x), y(v.y), z(v.z) {}
- RwV3d toRwV3d(void) const {
- RwV3d vecRw = { this->x, this->y, this->z };
- return vecRw;
- }
-
operator RwV3d (void) const {
RwV3d vecRw = { this->x, this->y, this->z };
return vecRw;
@@ -22,10 +17,6 @@ public:
operator RwV3d *(void) {
return (RwV3d*)this;
}
-
- operator RwV3d &(void) {
- return *((RwV3d*)this);
- }
#endif
// (0,1,0) means no rotation. So get right vector and its atan
float Heading(void) const { return Atan2(-x, y); }
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index cfd50a5d..b1609094 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -2019,7 +2019,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
}
if (seatPosMult > 0.2f || vehIsUpsideDown) {
- GetPosition() = neededPos;
+ SetPosition(neededPos);
SetHeading(m_fRotationCur);
} else {
@@ -6504,7 +6504,7 @@ CPed::LineUpPedWithTrain(void)
lineUpPos += (GetPosition() - lineUpPos) * percentageLeft;
}
- GetPosition() = lineUpPos;
+ SetPosition(lineUpPos);
SetHeading(m_fRotationCur);
}
@@ -8684,7 +8684,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
carHighestZ = (car->GetMatrix() * CVector(0.0f, vehColMaxY, vehColMaxZ)).z;
float highestZDist = carHighestZ - GetPosition().z;
if (highestZDist > 0.0f) {
- GetPosition().z += 0.5f * highestZDist;
+ GetMatrix().GetPosition().z += 0.5f * highestZDist;
carHighestZ += highestZDist * 0.25f;
}
carLength = vehColMaxY;
@@ -9959,7 +9959,7 @@ CPed::ProcessControl(void)
}
} else if (!bVehEnterDoorIsBlocked) {
- if (collidingVeh->m_status != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) {
+ if (collidingVeh->GetStatus() != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) {
SetDirectionToWalkAroundObject(collidingVeh);
@@ -10169,8 +10169,8 @@ CPed::ProcessControl(void)
}
if (flyDir != 0 && !bSomeVCflag1) {
- GetPosition() = (flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point);
- GetPosition().z += FEET_OFFSET;
+ SetPosition((flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point));
+ GetMatrix().GetPosition().z += FEET_OFFSET;
GetMatrix().UpdateRW();
SetLanding();
bIsStanding = true;
@@ -10184,7 +10184,7 @@ CPed::ProcessControl(void)
forceDir.z = 4.0f;
ApplyMoveForce(forceDir);
- GetPosition() += 0.25f * offsetToCheck;
+ GetMatrix().GetPosition() += 0.25f * offsetToCheck;
m_fRotationCur = CGeneral::GetRadianAngleBetweenPoints(offsetToCheck.x, offsetToCheck.y, 0.0f, 0.0f);
m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur);
@@ -10276,13 +10276,13 @@ CPed::ProcessControl(void)
if (CWorld::ProcessVerticalLine(offsetToCheck, GetPosition().z - FEET_OFFSET, foundCol, foundEnt, true, true, false, true, false, false, nil)) {
#ifdef VC_PED_PORTS
if (!bSomeVCflag1 || FEET_OFFSET + foundCol.point.z < GetPosition().z) {
- GetPosition().z = FEET_OFFSET + foundCol.point.z;
+ GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
GetMatrix().UpdateRW();
if (bSomeVCflag1)
bSomeVCflag1 = false;
}
#else
- GetPosition().z = FEET_OFFSET + foundCol.point.z;
+ GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
GetMatrix().UpdateRW();
#endif
SetLanding();
@@ -11562,7 +11562,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
#endif
CPedPlacement::FindZCoorForPed(&posAfterBeingDragged);
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
- ped->GetPosition() = posAfterBeingDragged;
+ ped->SetPosition(posAfterBeingDragged);
if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedDraggedOutCarAnimOffset)) {
ped->PositionPedOutOfCollision();
@@ -12187,7 +12187,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
CVector posFromZ = ped->GetPosition();
CPedPlacement::FindZCoorForPed(&posFromZ);
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
- ped->GetPosition() = posFromZ;
+ ped->SetPosition(posFromZ);
veh = ped->m_pMyVehicle;
if (veh) {
if (ped->m_nPedType == PEDTYPE_PROSTITUTE) {
@@ -12310,7 +12310,7 @@ CPed::PedSetOutTrainCB(CAnimBlendAssociation *animAssoc, void *arg)
posAfterExit += ped->GetPosition();
CPedPlacement::FindZCoorForPed(&posAfterExit);
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
- ped->GetPosition() = posAfterExit;
+ ped->SetPosition(posAfterExit);
ped->SetHeading(ped->m_fRotationCur);
veh->RemovePassenger(ped);
}
@@ -12342,7 +12342,7 @@ CPed::PlacePedOnDryLand(void)
foundColZ = foundCol.point.z;
if (foundColZ >= waterLevel) {
posToCheck.z = 0.8f + foundColZ;
- GetPosition() = posToCheck;
+ SetPosition(posToCheck);
bIsStanding = true;
bWasStanding = true;
return true;
@@ -12360,7 +12360,7 @@ CPed::PlacePedOnDryLand(void)
return false;
posToCheck.z = 0.8f + foundColZ;
- GetPosition() = posToCheck;
+ SetPosition(posToCheck);
bIsStanding = true;
bWasStanding = true;
return true;
@@ -12388,7 +12388,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void
finalPos = finalLocalPos + ped->GetPosition();
CPedPlacement::FindZCoorForPed(&finalPos);
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
- ped->GetPosition() = finalPos;
+ ped->SetPosition(finalPos);
if (veh) {
ped->m_fRotationDest = veh->GetForward().Heading() - HALFPI;
@@ -12524,11 +12524,11 @@ CPed::PositionPedOutOfCollision(void)
// We refrain from using posNearVeh, probably because of it may be top of the vehicle.
if (putSomewhereClose) {
- GetPosition() = posSomewhereClose;
+ SetPosition(posSomewhereClose);
} else {
CVector vehSize = veh->GetModelInfo()->GetColModel()->boundingBox.max;
- GetPosition() = posNearVeh;
- GetPosition().z += vehSize.z;
+ posNearVeh.z += vehSize.z;
+ SetPosition(posNearVeh);
}
return true;
}
@@ -12912,8 +12912,8 @@ CPed::ProcessObjective(void)
int chosenModel = CCarCtrl::ChooseModel(&zoneInfo, &ourPos, &chosenCarClass);
CAutomobile *newVeh = new CAutomobile(chosenModel, RANDOM_VEHICLE);
if (newVeh) {
- newVeh->GetPosition() = ThePaths.m_pathNodes[closestNode].GetPosition();
- newVeh->GetPosition().z += 4.0f;
+ newVeh->GetMatrix().GetPosition() = ThePaths.m_pathNodes[closestNode].GetPosition();
+ newVeh->GetMatrix().GetPosition().z += 4.0f;
newVeh->SetHeading(DEGTORAD(200.0f));
newVeh->SetStatus(STATUS_ABANDONED);
newVeh->m_nDoorLock = CARLOCK_UNLOCKED;
@@ -13424,7 +13424,7 @@ CPed::ProcessObjective(void)
}
}
if (foundSeat) {
- GetPosition() = GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType);
+ SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType));
SetEnterCar(m_carInObjective, m_vehEnterType);
}
}
@@ -14692,12 +14692,12 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
bStillOnValidPoly = true;
#ifdef VC_PED_PORTS
if(!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
- GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
+ GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
if (bSomeVCflag1)
bSomeVCflag1 = false;
}
#else
- GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
+ GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
#endif
m_vecMoveSpeed.z = 0.0f;
@@ -14770,12 +14770,12 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
}
#ifdef VC_PED_PORTS
if (!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
- GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
+ GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
if (bSomeVCflag1)
bSomeVCflag1 = false;
}
#else
- GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
+ GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
#endif
m_nSurfaceTouched = intersectionPoint.surfaceB;
if (m_nSurfaceTouched == SURFACE_STONE) {
@@ -14880,7 +14880,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
float speed = m_vecMoveSpeed.Magnitude2D();
sphereNormal.x = -m_vecMoveSpeed.x / Max(0.001f, speed);
sphereNormal.y = -m_vecMoveSpeed.y / Max(0.001f, speed);
- GetPosition().z -= 0.05f;
+ GetMatrix().GetPosition().z -= 0.05f;
bSomeVCflag1 = true;
}
#endif
@@ -15669,7 +15669,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
zForPed = Max(foundColZ, foundColZ2);
if (zForPed > -99.0f)
- GetPosition().z = FEET_OFFSET + zForPed;
+ GetMatrix().GetPosition().z = FEET_OFFSET + zForPed;
} else {
if (veh->GetUp().z > -0.8f) {
bool addDoorSmoke = false;
@@ -17002,7 +17002,7 @@ CPed::WarpPedIntoCar(CVehicle *car)
}
CWorld::Remove(this);
- GetPosition() = car->GetPosition();
+ SetPosition(car->GetPosition());
CWorld::Add(this);
if (car->bIsAmbulanceOnDuty) {
@@ -17670,7 +17670,7 @@ CPed::SetExitBoat(CVehicle *boat)
m_pCurSurface = boat;
m_pCurSurface->RegisterReference((CEntity**)&m_pCurSurface);
}
- GetPosition() = firstPos;
+ SetPosition(firstPos);
SetMoveState(PEDMOVE_STILL);
m_vecMoveSpeed = boat->m_vecMoveSpeed;
bTryingToReachDryLand = true;
@@ -17725,7 +17725,7 @@ CPed::SetExitBoat(CVehicle *boat)
return;
}
*/ }
- GetPosition() = newPos;
+ SetPosition(newPos);
SetMoveState(PEDMOVE_STILL);
m_vecMoveSpeed = boat->m_vecMoveSpeed;
#endif
@@ -17758,9 +17758,9 @@ void
CPed::Load(uint8*& buf)
{
SkipSaveBuf(buf, 52);
- GetPosition().x = ReadSaveBuf<float>(buf);
- GetPosition().y = ReadSaveBuf<float>(buf);
- GetPosition().z = ReadSaveBuf<float>(buf);
+ GetMatrix().GetPosition().x = ReadSaveBuf<float>(buf);
+ GetMatrix().GetPosition().y = ReadSaveBuf<float>(buf);
+ GetMatrix().GetPosition().z = ReadSaveBuf<float>(buf);
SkipSaveBuf(buf, 288);
CharCreatedBy = ReadSaveBuf<uint8>(buf);
SkipSaveBuf(buf, 351);
diff --git a/src/peds/PedPlacement.cpp b/src/peds/PedPlacement.cpp
index 8b8b3dfa..2d4a92fa 100644
--- a/src/peds/PedPlacement.cpp
+++ b/src/peds/PedPlacement.cpp
@@ -37,7 +37,7 @@ CPedPlacement::FindZCoorForPed(CVector* pos)
}
CEntity*
-CPedPlacement::IsPositionClearOfCars(CVector* pos)
+CPedPlacement::IsPositionClearOfCars(Const CVector *pos)
{
return CWorld::TestSphereAgainstWorld(*pos, 0.25f, nil, true, true, false, false, false, false);
}
diff --git a/src/peds/PedPlacement.h b/src/peds/PedPlacement.h
index 6ba4ae71..b51e2aad 100644
--- a/src/peds/PedPlacement.h
+++ b/src/peds/PedPlacement.h
@@ -3,6 +3,6 @@
class CPedPlacement {
public:
static void FindZCoorForPed(CVector* pos);
- static CEntity* IsPositionClearOfCars(CVector*);
+ static CEntity* IsPositionClearOfCars(Const CVector*);
static bool IsPositionClearForPed(CVector*);
}; \ No newline at end of file
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index d5d0d78a..8dd9d23d 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -495,7 +495,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_CIVFEMALE:
{
CCivilianPed *ped = new CCivilianPed(pedType, miOrCopType);
- ped->GetPosition() = coors;
+ ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped);
if (ms_bGivePedsWeapons) {
@@ -509,7 +509,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_COP:
{
CCopPed *ped = new CCopPed((eCopType)miOrCopType);
- ped->GetPosition() = coors;
+ ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped);
return ped;
@@ -525,7 +525,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_GANG9:
{
CCivilianPed *ped = new CCivilianPed(pedType, miOrCopType);
- ped->GetPosition() = coors;
+ ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped);
@@ -540,7 +540,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_EMERGENCY:
{
CEmergencyPed *ped = new CEmergencyPed(PEDTYPE_EMERGENCY);
- ped->GetPosition() = coors;
+ ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped);
return ped;
@@ -548,7 +548,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_FIREMAN:
{
CEmergencyPed *ped = new CEmergencyPed(PEDTYPE_FIREMAN);
- ped->GetPosition() = coors;
+ ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped);
return ped;
@@ -557,7 +557,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_PROSTITUTE:
{
CCivilianPed *ped = new CCivilianPed(pedType, miOrCopType);
- ped->GetPosition() = coors;
+ ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped);
return ped;
@@ -880,22 +880,22 @@ CPopulation::MoveCarsAndPedsOutOfAbandonedZones()
if (veh->bIsLocked || !veh->CanBeDeleted()) {
switch (movedVehicleCount & 3) {
case 0:
- veh->GetPosition() = RegenerationPoint_a;
+ veh->SetPosition(RegenerationPoint_a);
break;
case 1:
- veh->GetPosition() = RegenerationPoint_b;
+ veh->SetPosition(RegenerationPoint_b);
break;
case 2:
- veh->GetPosition() = CVector(RegenerationPoint_a.x, RegenerationPoint_b.y, RegenerationPoint_a.z);
+ veh->SetPosition(RegenerationPoint_a.x, RegenerationPoint_b.y, RegenerationPoint_a.z);
break;
case 3:
- veh->GetPosition() = CVector(RegenerationPoint_b.x, RegenerationPoint_a.y, RegenerationPoint_a.z);
+ veh->SetPosition(RegenerationPoint_b.x, RegenerationPoint_a.y, RegenerationPoint_a.z);
break;
default:
break;
}
- veh->GetPosition().z += (movedVehicleCount / 4) * 7.0f;
- veh->GetForward() = RegenerationForward;
+ veh->GetMatrix().GetPosition().z += (movedVehicleCount / 4) * 7.0f;
+ veh->GetMatrix().GetForward() = RegenerationForward;
((CAutomobile*)veh)->PlaceOnRoadProperly();
CCarCtrl::JoinCarWithRoadSystem(veh);
CTheScripts::ClearSpaceForMissionEntity(veh->GetPosition(), veh);
@@ -924,14 +924,14 @@ CPopulation::MoveCarsAndPedsOutOfAbandonedZones()
CWorld::Remove(ped);
delete ped;
} else if (ped->m_nPedType != PEDTYPE_PLAYER1 && ped->m_nPedType != PEDTYPE_PLAYER2) {
- ped->GetPosition() = RegenerationPoint_a;
+ ped->SetPosition(RegenerationPoint_a);
bool foundGround;
float groundZ = CWorld::FindGroundZFor3DCoord(ped->GetPosition().x, ped->GetPosition().y,
ped->GetPosition().z + 2.0f, &foundGround);
if (foundGround) {
- ped->GetPosition().z = 1.0f + groundZ;
+ ped->GetMatrix().GetPosition().z = 1.0f + groundZ;
//ped->GetPosition().z += 0.0f;
CTheScripts::ClearSpaceForMissionEntity(ped->GetPosition(), ped);
}
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index df34b3b5..bb074042 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -255,9 +255,9 @@ GenericLoad()
buf = (work_buff + 0x40);
ReadDataFromBufferPointer(buf, saveSize);
ReadDataFromBufferPointer(buf, CGame::currLevel);
- ReadDataFromBufferPointer(buf, TheCamera.GetPosition().x);
- ReadDataFromBufferPointer(buf, TheCamera.GetPosition().y);
- ReadDataFromBufferPointer(buf, TheCamera.GetPosition().z);
+ ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().x);
+ ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().y);
+ ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().z);
ReadDataFromBufferPointer(buf, CClock::ms_nMillisecondsPerGameMinute);
ReadDataFromBufferPointer(buf, CClock::ms_nLastClockTick);
ReadDataFromBufferPointer(buf, CClock::ms_nGameClockHours);
@@ -538,9 +538,9 @@ RestoreForStartLoad()
} else {
uint8 *_buf = buf + sizeof(int32) + sizeof(wchar[24]) + sizeof(SYSTEMTIME) + sizeof(SIZE_OF_ONE_GAME_IN_BYTES);
ReadDataFromBufferPointer(_buf, CGame::currLevel);
- ReadDataFromBufferPointer(_buf, TheCamera.GetPosition().x);
- ReadDataFromBufferPointer(_buf, TheCamera.GetPosition().y);
- ReadDataFromBufferPointer(_buf, TheCamera.GetPosition().z);
+ ReadDataFromBufferPointer(_buf, TheCamera.GetMatrix().GetPosition().x);
+ ReadDataFromBufferPointer(_buf, TheCamera.GetMatrix().GetPosition().y);
+ ReadDataFromBufferPointer(_buf, TheCamera.GetMatrix().GetPosition().z);
CStreaming::RemoveUnusedBigBuildings(CGame::currLevel);
CStreaming::RemoveUnusedBuildings(CGame::currLevel);
CCollision::SortOutCollisionAfterLoad();
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 58971786..9db60da0 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -3186,10 +3186,10 @@ CAutomobile::PlaceOnRoadProperly(void)
float c = Cos(angle);
float s = Sin(angle);
- GetRight() = CVector((front.y - rear.y)/len, -(front.x - rear.x)/len, 0.0f);
- GetForward() = CVector(-c*GetRight().y, c*GetRight().x, s);
- GetUp() = CrossProduct(GetRight(), GetForward());
- GetPosition() = CVector((front.x + rear.x)/2.0f, (front.y + rear.y)/2.0f, (frontZ + rearZ)/2.0f + GetHeightAboveRoad());
+ GetMatrix().GetRight() = CVector((front.y - rear.y) / len, -(front.x - rear.x) / len, 0.0f);
+ GetMatrix().GetForward() = CVector(-c * GetRight().y, c * GetRight().x, s);
+ GetMatrix().GetUp() = CrossProduct(GetRight(), GetForward());
+ GetMatrix().GetPosition() = CVector((front.x + rear.x) / 2.0f, (front.y + rear.y) / 2.0f, (frontZ + rearZ) / 2.0f + GetHeightAboveRoad());
}
void
@@ -4408,7 +4408,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
if(GetUp().z > 0.0f){
// simulate fast upward movement if going fast
float speed = CVector2D(m_vecMoveSpeed).MagnitudeSqr();
- obj->GetPosition() += GetUp()*speed;
+ obj->GetMatrix().Translate(GetUp()*speed);
}
}
obj->ApplyMoveForce(dist);
diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp
index 10ce225a..71189d84 100644
--- a/src/vehicles/Plane.cpp
+++ b/src/vehicles/Plane.cpp
@@ -359,8 +359,8 @@ CPlane::ProcessControl(void)
CVector posFront2 = (1.0f - f)*pPathNodes[curPathNodeFront2].p + f*pPathNodes[nextPathNodeFront2].p;
// Now set matrix
- GetPosition() = (posRear + posFront)/2.0f;
- GetPosition().z += 4.3f;
+ GetMatrix().GetPosition() = (posRear + posFront) / 2.0f;
+ GetMatrix().GetPosition().z += 4.3f;
CVector fwd = posFront - posRear;
fwd.Normalise();
if(pitch != 0.0f){
@@ -375,9 +375,9 @@ CPlane::ProcessControl(void)
right.z += 3.0f*roll.z;
right.Normalise();
CVector up = CrossProduct(right, fwd);
- GetRight() = right;
- GetUp() = up;
- GetForward() = fwd;
+ GetMatrix().GetRight() = right;
+ GetMatrix().GetUp() = up;
+ GetMatrix().GetForward() = fwd;
// Set speed
m_vecMoveSpeed = fwd*PlanePathSpeed[m_nPlaneId]/60.0f;
@@ -511,8 +511,8 @@ CPlane::ProcessControl(void)
CVector posFront2 = (1.0f - f)*pathNodes[curPathNodeFront2].p + f*pathNodes[nextPathNodeFront2].p;
// Now set matrix
- GetPosition() = (posRear + posFront)/2.0f;
- GetPosition().z += 1.0f;
+ GetMatrix().GetPosition() = (posRear + posFront) / 2.0f;
+ GetMatrix().GetPosition().z += 1.0f;
CVector fwd = posFront - posRear;
fwd.Normalise();
CVector fwd2 = posFront2 - posRear;
@@ -522,9 +522,9 @@ CPlane::ProcessControl(void)
right.z += 3.0f*roll.z;
right.Normalise();
CVector up = CrossProduct(right, fwd);
- GetRight() = right;
- GetUp() = up;
- GetForward() = fwd;
+ GetMatrix().GetRight() = right;
+ GetMatrix().GetUp() = up;
+ GetMatrix().GetForward() = fwd;
// Set speed
m_vecMoveSpeed = fwd*planePathSpeed/60.0f;