summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Cam.cpp4
-rw-r--r--src/core/Pad.cpp2
-rw-r--r--src/core/Pad.h1
-rw-r--r--src/core/Placeable.h6
-rw-r--r--src/core/Radar.cpp4
-rw-r--r--src/core/World.cpp4
-rw-r--r--src/core/World.h4
-rw-r--r--src/core/ZoneCull.cpp2
-rw-r--r--src/core/common.h3
-rw-r--r--src/core/re3.cpp6
10 files changed, 23 insertions, 13 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 43d817b7..b760ae28 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -3794,7 +3794,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source;
+ CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
// stay inside sectors
@@ -3941,7 +3941,7 @@ CCam::Process_Editor(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source;
+ CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 7dbadd74..f4b81cb4 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -104,7 +104,7 @@ void TankCheat()
if (tank != nil) {
CVector pos = ThePaths.m_pathNodes[node].pos;
pos.z += 4.0f;
- tank->GetPosition() = pos;
+ tank->SetPosition(pos);
tank->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f));
tank->SetStatus(STATUS_ABANDONED);
diff --git a/src/core/Pad.h b/src/core/Pad.h
index b8228444..b24edf4a 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -418,6 +418,7 @@ public:
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
bool GetTriangleJustUp() { return !!(!NewState.Triangle && OldState.Triangle); }
+ bool GetCircleJustUp() { return !!(!NewState.Circle && OldState.Circle); }
bool GetCrossJustUp() { return !!(!NewState.Cross && OldState.Cross); }
bool GetSquareJustUp() { return !!(!NewState.Square && OldState.Square); }
bool GetDPadUpJustUp() { return !!(!NewState.DPadUp && OldState.DPadUp); }
diff --git a/src/core/Placeable.h b/src/core/Placeable.h
index 2df26a7c..d39bb0d9 100644
--- a/src/core/Placeable.h
+++ b/src/core/Placeable.h
@@ -11,6 +11,12 @@ public:
CPlaceable(void);
virtual ~CPlaceable(void);
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;
+ m_matrix.GetPosition().z = z;
+ }
+ void SetPosition(const CVector &pos) { m_matrix.GetPosition() = pos; }
CVector &GetRight(void) { return m_matrix.GetRight(); }
CVector &GetForward(void) { return m_matrix.GetForward(); }
CVector &GetUp(void) { return m_matrix.GetUp(); }
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 3d1429bd..b4c22068 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -524,7 +524,7 @@ void CRadar::DrawBlips()
} else {
#ifdef TRIANGULAR_BLIPS
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
- CVector &blipPos = blipEntity->GetPosition();
+ const CVector &blipPos = blipEntity->GetPosition();
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;
@@ -630,7 +630,7 @@ void CRadar::DrawBlips()
#ifdef TRIANGULAR_BLIPS
{
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
- CVector &blipPos = blipEntity->GetPosition();
+ const CVector &blipPos = blipEntity->GetPosition();
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 4b2ca76e..30d086df 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -659,7 +659,7 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
}
void
-CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float radius, bool ignoreZ, short *nextObject,
+CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, short *nextObject,
short lastObject, CEntity **objects)
{
float radiusSqr = radius * radius;
@@ -685,7 +685,7 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float radi
}
void
-CWorld::FindObjectsInRange(CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject,
+CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject,
CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds,
bool checkObjects, bool checkDummies)
{
diff --git a/src/core/World.h b/src/core/World.h
index 25c76531..991180af 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -101,8 +101,8 @@ public:
static CEntity *TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects);
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
- static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**);
- static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
+ static void FindObjectsInRangeSectorList(CPtrList&, Const CVector&, float, bool, short*, short, CEntity**);
+ static void FindObjectsInRange(Const CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities);
static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies);
static float FindGroundZForCoord(float x, float y);
diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp
index 7a221f39..5ce18a4d 100644
--- a/src/core/ZoneCull.cpp
+++ b/src/core/ZoneCull.cpp
@@ -522,7 +522,7 @@ CCullZone::CalcDistToCullZoneSquared(float x, float y)
bool
CCullZone::IsEntityCloseEnoughToZone(CEntity *entity, bool checkLevel)
{
- CVector &pos = entity->GetPosition();
+ const CVector &pos = entity->GetPosition();
CSimpleModelInfo *minfo = (CSimpleModelInfo*)CModelInfo::GetModelInfo(entity->GetModelIndex());
float distToZone = CalcDistToCullZone(pos.x, pos.y);
diff --git a/src/core/common.h b/src/core/common.h
index 18f4715c..ff8580a1 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -58,6 +58,9 @@
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define Min(a,b) ((a) < (b) ? (a) : (b))
+// Use this to add const that wasn't there in the original code
+#define Const const
+
typedef uint8_t uint8;
typedef int8_t int8;
typedef uint16_t uint16;
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 5ef3c036..e6409523 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -116,11 +116,11 @@ SpawnCar(int id)
DebugMenuEntrySetAddress(carCol2, &v->m_currentColour2);
if(CModelInfo::IsBoatModel(id))
- v->GetPosition() = TheCamera.GetPosition() + TheCamera.GetForward()*15.0f;
+ v->SetPosition(TheCamera.GetPosition() + TheCamera.GetForward()*15.0f);
else
- v->GetPosition() = ThePaths.m_pathNodes[node].pos;
+ v->SetPosition(ThePaths.m_pathNodes[node].pos);
- v->GetPosition().z += 4.0f;
+ v->GetMatrix().GetPosition().z += 4.0f;
v->SetOrientation(0.0f, 0.0f, 3.49f);
v->SetStatus(STATUS_ABANDONED);
v->m_nDoorLock = CARLOCK_UNLOCKED;