summaryrefslogtreecommitdiff
path: root/src/control/CarCtrl.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-04-30 13:48:01 +0300
committerSergeanur <s.anureev@yandex.ua>2020-05-02 15:13:09 +0300
commitd23b2c423e5811cf6e9de28cbf8490de32ea4fb5 (patch)
tree0240b530a05679dc6d629c414f59bf56588a93b2 /src/control/CarCtrl.cpp
parenta1c1be7af9f5ecee8f89db35b802a7874afc5c41 (diff)
SetPosition, part 1
Diffstat (limited to 'src/control/CarCtrl.cpp')
-rw-r--r--src/control/CarCtrl.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index bb70be8c..2d946145 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -461,7 +461,7 @@ CCarCtrl::GenerateOneRandomCar()
return;
}
finalPosition.z = groundZ + pCar->GetHeightAboveRoad();
- pCar->GetPosition() = finalPosition;
+ pCar->SetPosition(finalPosition);
pCar->SetMoveSpeed(directionIncludingCurve / GAME_SPEED_TO_CARAI_SPEED);
CVector2D speedDifferenceWithTarget = (CVector2D)pCar->GetMoveSpeed() - vecPlayerSpeed;
CVector2D distanceToTarget = positionIncludingCurve - vecTargetPos;
@@ -1964,9 +1964,8 @@ void CCarCtrl::DragCarToPoint(CVehicle* pVehicle, CVector* pPoint)
pVehicle->GetRight() = CVector(posTarget.y - midPos.y, -(posTarget.x - midPos.x), 0.0f) / 3;
pVehicle->GetForward() = CVector(-cosZ * pVehicle->GetRight().y, cosZ * pVehicle->GetRight().x, sinZ);
pVehicle->GetUp() = CrossProduct(pVehicle->GetRight(), pVehicle->GetForward());
- pVehicle->GetPosition() = (CVector(midPos.x, midPos.y, actualBehindZ)
- + CVector(posTarget.x, posTarget.y, actualAheadZ)) / 2;
- pVehicle->GetPosition().z += pVehicle->GetHeightAboveRoad();
+ pVehicle->SetPosition((CVector(midPos.x, midPos.y, actualBehindZ) + CVector(posTarget.x, posTarget.y, actualAheadZ)) / 2);
+ pVehicle->GetMatrix().GetPosition().z += pVehicle->GetHeightAboveRoad();
}
float CCarCtrl::FindSpeedMultiplier(float angleChange, float minAngle, float maxAngle, float coef)
@@ -2647,7 +2646,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
return nil;
CAutomobile* pVehicle = new CAutomobile(mi, RANDOM_VEHICLE);
pVehicle->AutoPilot.m_vecDestinationCoors = vecPos;
- pVehicle->GetPosition() = spawnPos;
+ pVehicle->SetPosition(spawnPos);
pVehicle->AutoPilot.m_nCarMission = (JoinCarWithRoadSystemGotoCoors(pVehicle, vecPos, false)) ? MISSION_GOTOCOORDS_STRAIGHT : MISSION_GOTOCOORDS;
pVehicle->AutoPilot.m_fMaxTrafficSpeed = pVehicle->AutoPilot.m_nCruiseSpeed = 25;
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
@@ -2672,7 +2671,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
return false;
}
spawnPos.z = groundZ + pVehicle->GetDistanceFromCentreOfMassToBaseOfModel();
- pVehicle->GetPosition() = spawnPos;
+ pVehicle->SetPosition(spawnPos);
pVehicle->SetMoveSpeed(CVector(0.0f, 0.0f, 0.0f));
pVehicle->SetStatus(STATUS_PHYSICS);
switch (mi){