summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-04-30 12:48:01 +0200
committerSergeanur <s.anureev@yandex.ua>2020-05-02 14:13:09 +0200
commitd23b2c423e5811cf6e9de28cbf8490de32ea4fb5 (patch)
tree0240b530a05679dc6d629c414f59bf56588a93b2 /src/control
parentMerge pull request #502 from rollschuh2282/patch-1 (diff)
downloadre3-d23b2c423e5811cf6e9de28cbf8490de32ea4fb5.tar
re3-d23b2c423e5811cf6e9de28cbf8490de32ea4fb5.tar.gz
re3-d23b2c423e5811cf6e9de28cbf8490de32ea4fb5.tar.bz2
re3-d23b2c423e5811cf6e9de28cbf8490de32ea4fb5.tar.lz
re3-d23b2c423e5811cf6e9de28cbf8490de32ea4fb5.tar.xz
re3-d23b2c423e5811cf6e9de28cbf8490de32ea4fb5.tar.zst
re3-d23b2c423e5811cf6e9de28cbf8490de32ea4fb5.zip
Diffstat (limited to '')
-rw-r--r--src/control/Bridge.cpp6
-rw-r--r--src/control/CarCtrl.cpp11
-rw-r--r--src/control/Garages.cpp4
-rw-r--r--src/control/Garages.h4
-rw-r--r--src/control/Phones.cpp2
-rw-r--r--src/control/Pickups.cpp14
-rw-r--r--src/control/Record.cpp8
-rw-r--r--src/control/Remote.cpp2
-rw-r--r--src/control/Replay.cpp4
-rw-r--r--src/control/SceneEdit.cpp16
-rw-r--r--src/control/Script.cpp4
11 files changed, 37 insertions, 38 deletions
diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp
index 8514ef9e..98c74bbe 100644
--- a/src/control/Bridge.cpp
+++ b/src/control/Bridge.cpp
@@ -93,16 +93,16 @@ void CBridge::Update()
// Move bridge part
if (liftHeight != OldLift)
{
- pLiftPart->GetPosition().z = DefaultZLiftPart + liftHeight;
+ pLiftPart->GetMatrix().GetPosition().z = DefaultZLiftPart + liftHeight;
pLiftPart->GetMatrix().UpdateRW();
pLiftPart->UpdateRwFrame();
if (pLiftRoad)
{
- pLiftRoad->GetPosition().z = DefaultZLiftRoad + liftHeight;
+ pLiftRoad->GetMatrix().GetPosition().z = DefaultZLiftRoad + liftHeight;
pLiftRoad->GetMatrix().UpdateRW();
pLiftRoad->UpdateRwFrame();
}
- pWeight->GetPosition().z = DefaultZLiftWeight - liftHeight;
+ pWeight->GetMatrix().GetPosition().z = DefaultZLiftWeight - liftHeight;
pWeight->GetMatrix().UpdateRW();
pWeight->UpdateRwFrame();
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){
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index fd18f4cf..97cb8303 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -2164,7 +2164,7 @@ int32 CGarages::FindMaxNumStoredCarsForGarage(eGarageType type)
return 0;
}
-bool CGarages::IsPointWithinHideOutGarage(CVector& point)
+bool CGarages::IsPointWithinHideOutGarage(Const CVector& point)
{
for (int i = 0; i < NUM_GARAGES; i++) {
switch (aGarages[i].m_eGarageType) {
@@ -2180,7 +2180,7 @@ bool CGarages::IsPointWithinHideOutGarage(CVector& point)
return false;
}
-bool CGarages::IsPointWithinAnyGarage(CVector& point)
+bool CGarages::IsPointWithinAnyGarage(Const CVector& point)
{
for (int i = 0; i < NUM_GARAGES; i++) {
switch (aGarages[i].m_eGarageType) {
diff --git a/src/control/Garages.h b/src/control/Garages.h
index 65193b32..3105f72d 100644
--- a/src/control/Garages.h
+++ b/src/control/Garages.h
@@ -232,8 +232,8 @@ public:
static bool CameraShouldBeOutside(void);
static void GivePlayerDetonator(void);
static void PlayerArrestedOrDied(void);
- static bool IsPointWithinHideOutGarage(CVector&);
- static bool IsPointWithinAnyGarage(CVector&);
+ static bool IsPointWithinHideOutGarage(Const CVector&);
+ static bool IsPointWithinAnyGarage(Const CVector&);
static void SetAllDoorsBackToOriginalHeight(void);
static void Save(uint8* buf, uint32* size);
static void Load(uint8* buf, uint32 size);
diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp
index 15e9f9f1..27bdc010 100644
--- a/src/control/Phones.cpp
+++ b/src/control/Phones.cpp
@@ -301,7 +301,7 @@ CPhoneInfo::Initialise(void)
if (building->m_modelIndex == MI_PHONEBOOTH1) {
CPhone *maxPhone = &m_aPhones[m_nMax];
maxPhone->m_nState = PHONE_STATE_FREE;
- maxPhone->m_vecPos = *(building->GetPosition());
+ maxPhone->m_vecPos = building->GetPosition();
maxPhone->m_pEntity = building;
m_nMax++;
}
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index d5db4ad8..08ce9418 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -84,7 +84,7 @@ CPickup::GiveUsAPickUpObject(int32 handle)
if (object == nil) return nil;
object->ObjectCreatedBy = MISSION_OBJECT;
- object->GetPosition() = m_vecPos;
+ object->SetPosition(m_vecPos);
object->SetOrientation(0.0f, 0.0f, -HALFPI);
object->GetMatrix().UpdateRW();
object->UpdateRwFrame();
@@ -695,7 +695,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
assert(colorId >= 0);
- CVector &pos = entity->GetPosition();
+ const CVector &pos = entity->GetPosition();
float colorModifier = ((CGeneral::GetRandomNumber() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f;
CShadows::StoreStaticShadow(
@@ -749,7 +749,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
void
CPickups::DoMineEffects(CEntity *entity)
{
- CVector &pos = entity->GetPosition();
+ const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude();
const float MAXDIST = 20.0f;
@@ -771,7 +771,7 @@ CPickups::DoMineEffects(CEntity *entity)
void
CPickups::DoMoneyEffects(CEntity *entity)
{
- CVector &pos = entity->GetPosition();
+ const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude();
const float MAXDIST = 20.0f;
@@ -793,7 +793,7 @@ CPickups::DoMoneyEffects(CEntity *entity)
void
CPickups::DoCollectableEffects(CEntity *entity)
{
- CVector &pos = entity->GetPosition();
+ const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude();
const float MAXDIST = 14.0f;
@@ -1145,7 +1145,7 @@ CPacManPickups::GeneratePMPickUps(CVector pos, float scrambleMult, int16 count,
CObject *obj = new CObject(MI_BULLION, true);
if (obj != nil) {
obj->ObjectCreatedBy = MISSION_OBJECT;
- obj->GetPosition() = aPMPickUps[i].m_vecPosn;
+ obj->SetPosition(aPMPickUps[i].m_vecPosn);
obj->SetOrientation(0.0f, 0.0f, -HALFPI);
obj->GetMatrix().UpdateRW();
obj->UpdateRwFrame();
@@ -1296,7 +1296,7 @@ CPacManPickups::GeneratePMPickUpsForRace(int32 race)
if (obj != nil) {
obj->ObjectCreatedBy = MISSION_OBJECT;
- obj->GetPosition() = aPMPickUps[i].m_vecPosn;
+ obj->SetPosition(aPMPickUps[i].m_vecPosn);
obj->SetOrientation(0.0f, 0.0f, -HALFPI);
obj->GetMatrix().UpdateRW();
obj->UpdateRwFrame();
diff --git a/src/control/Record.cpp b/src/control/Record.cpp
index bba9a45d..d086543f 100644
--- a/src/control/Record.cpp
+++ b/src/control/Record.cpp
@@ -279,7 +279,7 @@ void CRecordDataForChase::SaveOrRetrieveCarPositions(void)
}
if (CPad::GetPad(0)->GetLeftShockJustDown() && CPad::GetPad(0)->GetRightShockJustDown()) {
if (!CPad::GetPad(0)->GetRightShockJustDown()) {
- pChaseCars[CurrentCar]->GetPosition() = NewCoorsForRecordedCars[PositionChanges].pos;
+ pChaseCars[CurrentCar]->SetPosition(NewCoorsForRecordedCars[PositionChanges].pos);
pChaseCars[CurrentCar]->SetMoveSpeed(0.0f, 0.0f, 0.0f);
pChaseCars[CurrentCar]->GetMatrix().SetRotateZOnly(DEGTORAD(NewCoorsForRecordedCars[PositionChanges].angle));
++PositionChanges;
@@ -311,12 +311,12 @@ void CRecordDataForChase::SaveOrRetrieveCarPositions(void)
pChaseCars[i]->GetRight() += (tmp.GetRight() - pChaseCars[i]->GetRight()) * dp;
pChaseCars[i]->GetForward() += (tmp.GetForward() - pChaseCars[i]->GetForward()) * dp;
pChaseCars[i]->GetUp() += (tmp.GetUp() - pChaseCars[i]->GetUp()) * dp;
- pChaseCars[i]->GetPosition() += (tmp.GetPosition() - pChaseCars[i]->GetPosition()) * dp;
+ pChaseCars[i]->GetMatrix().GetPosition() += (tmp.GetPosition() - pChaseCars[i]->GetPosition()) * dp;
}
else{
RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][CHASE_SCENE_FRAMES_IN_RECORDING - 1], true);
if (i == 0)
- pChaseCars[i]->GetPosition().z += 0.2f;
+ pChaseCars[i]->GetMatrix().GetPosition().z += 0.2f;
}
pChaseCars[i]->GetMatrix().UpdateRW();
pChaseCars[i]->UpdateRwFrame();
@@ -407,7 +407,7 @@ void CRecordDataForChase::GiveUsACar(int32 mi, CVector pos, float angle, CAutomo
if (!CStreaming::HasModelLoaded(mi))
return;
CAutomobile* pCar = new CAutomobile(mi, MISSION_VEHICLE);
- pCar->GetPosition() = pos;
+ pCar->SetPosition(pos);
pCar->SetStatus(STATUS_PLAYER_PLAYBACKFROMBUFFER);
pCar->GetMatrix().SetRotateZOnly(DEGTORAD(angle));
pCar->pDriver = nil;
diff --git a/src/control/Remote.cpp b/src/control/Remote.cpp
index ee729d7e..904e9023 100644
--- a/src/control/Remote.cpp
+++ b/src/control/Remote.cpp
@@ -18,7 +18,7 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin
z = car->GetDistanceFromCentreOfMassToBaseOfModel() + CWorld::FindGroundZFor3DCoord(x, y, z + 2.0f, &found);
car->GetMatrix().SetRotateZOnly(rot);
- car->GetPosition() = CVector(x, y, z);
+ car->SetPosition(x, y, z);
car->SetStatus(STATUS_PLAYER_REMOTE);
car->bIsLocked = true;
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index f9e894b6..49f5462f 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -1020,7 +1020,7 @@ void CReplay::ProcessReplayCamera(void)
switch (CameraMode) {
case REPLAYCAMMODE_TOPDOWN:
{
- TheCamera.GetPosition() = CVector(CameraFocusX, CameraFocusY, CameraFocusZ + 15.0f);
+ TheCamera.SetPosition(CameraFocusX, CameraFocusY, CameraFocusZ + 15.0f);
TheCamera.GetForward() = CVector(0.0f, 0.0f, -1.0f);
TheCamera.GetUp() = CVector(0.0f, 1.0f, 0.0f);
TheCamera.GetRight() = CVector(1.0f, 0.0f, 0.0f);
@@ -1539,7 +1539,7 @@ void CReplay::ProcessLookAroundCam(void)
TheCamera.GetForward() = forward;
TheCamera.GetUp() = up;
TheCamera.GetRight() = right;
- TheCamera.GetPosition() = camera_pt;
+ TheCamera.SetPosition(camera_pt);
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
pm->pos = *(RwV3d*)&TheCamera.GetPosition();
pm->at = *(RwV3d*)&TheCamera.GetForward();
diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp
index 8e9fc754..cf6cc4f6 100644
--- a/src/control/SceneEdit.cpp
+++ b/src/control/SceneEdit.cpp
@@ -349,7 +349,7 @@ void CSceneEdit::ProcessCommand(void)
}
CPed* pPed = new CCivilianPed(PEDTYPE_SPECIAL, m_nPedmodelId);
pPed->CharCreatedBy = MISSION_CHAR;
- pPed->GetPosition() = m_vecCurrentPosition;
+ pPed->SetPosition(m_vecCurrentPosition);
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(pPed);
pPed->bUsesCollision = false;
@@ -363,7 +363,7 @@ void CSceneEdit::ProcessCommand(void)
}
}
else {
- pActors[m_nActor]->GetPosition() = m_vecCurrentPosition;
+ pActors[m_nActor]->SetPosition(m_vecCurrentPosition);
pActors[m_nActor]->SetOrientation(0.0f, 0.0f, 0.0f);
int32 mi = m_nPedmodelId;
if (CPad::GetPad(1)->GetLeftShoulder1JustDown())
@@ -405,7 +405,7 @@ void CSceneEdit::ProcessCommand(void)
SelectActor();
if (m_bCommandActive)
break;
- pActors[m_nActor]->GetPosition() = m_vecCurrentPosition;
+ pActors[m_nActor]->SetPosition(m_vecCurrentPosition);
if (CPad::GetPad(1)->GetTriangleJustDown()) {
m_bCommandActive = false;
#ifndef FIX_BUGS // why? it crashes, also makes no sense
@@ -451,7 +451,7 @@ void CSceneEdit::ProcessCommand(void)
}
CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE);
pVehicle->SetStatus(STATUS_PHYSICS);
- pVehicle->GetPosition() = m_vecCurrentPosition;
+ pVehicle->SetPosition(m_vecCurrentPosition);
pVehicle->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(pVehicle);
pVehicle->bUsesCollision = false;
@@ -465,7 +465,7 @@ void CSceneEdit::ProcessCommand(void)
}
}
else {
- pVehicles[m_nVehicle]->GetPosition() = m_vecCurrentPosition;
+ pVehicles[m_nVehicle]->SetPosition(m_vecCurrentPosition);
pVehicles[m_nVehicle]->SetOrientation(0.0f, 0.0f, 0.0f);
int32 mi = m_nVehiclemodelId;
if (CPad::GetPad(1)->GetLeftShoulder1JustDown())
@@ -507,7 +507,7 @@ void CSceneEdit::ProcessCommand(void)
SelectVehicle();
if (m_bCommandActive)
break;
- pVehicles[m_nVehicle]->GetPosition() = m_vecCurrentPosition;
+ pVehicles[m_nVehicle]->SetPosition(m_vecCurrentPosition);
if (CPad::GetPad(1)->GetTriangleJustDown()) {
m_bCommandActive = false;
#ifndef FIX_BUGS // again, why? works wrong
@@ -785,7 +785,7 @@ void CSceneEdit::PlayBack(void)
CPed* pPed = new CCivilianPed(PEDTYPE_SPECIAL, m_nPedmodelId);
pPed->CharCreatedBy = MISSION_CHAR;
CWorld::Add(pPed);
- pPed->GetPosition() = m_vecCurrentPosition;
+ pPed->SetPosition(m_vecCurrentPosition);
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
for (int i = 0; i < NUM_ACTORS_IN_MOVIE; i++) {
if (pActors[i] == nil) {
@@ -811,7 +811,7 @@ void CSceneEdit::PlayBack(void)
}
CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE);
pVehicle->SetStatus(STATUS_PHYSICS);
- pVehicle->GetPosition() = m_vecCurrentPosition;
+ pVehicle->SetPosition(m_vecCurrentPosition);
pVehicle->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(pVehicle);
for (int i = 0; i < NUM_VEHICLES_IN_MOVIE; i++) {
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 4b3ed3bd..b63a5d87 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1293,7 +1293,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += CWorld::Players[index].m_pPed->GetDistanceFromCentreOfMassToBaseOfModel();
- CWorld::Players[index].m_pPed->GetPosition() = pos;
+ CWorld::Players[index].m_pPed->SetPosition(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, CWorld::Players[index].m_pPed);
CPlayerPed::ReactivatePlayerPed(index);
ScriptParams[0] = index;
@@ -5153,7 +5153,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CRestart::OverrideNextRestart(pos, *(float*)&ScriptParams[3]);
- if (CWorld::Players[CWorld::PlayerInFocus].m_WBState != WBSTATE_PLAYING) //TODO: enum
+ if (CWorld::Players[CWorld::PlayerInFocus].m_WBState != WBSTATE_PLAYING)
printf("RESTART_CRITICAL_MISSION - Player state is not PLAYING\n");
CWorld::Players[CWorld::PlayerInFocus].PlayerFailedCriticalMission();
return 0;