summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/CarCtrl.cpp3
-rw-r--r--src/control/CarCtrl.h1
-rw-r--r--src/control/Garages.cpp1
-rw-r--r--src/control/HandlingDataMgr.cpp7
-rw-r--r--src/control/HandlingDataMgr.h8
-rw-r--r--src/control/ObjectData.cpp5
-rw-r--r--src/control/ObjectData.h7
-rw-r--r--src/control/PathFind.cpp41
-rw-r--r--src/control/PathFind.h9
-rw-r--r--src/control/PedStats.cpp5
-rw-r--r--src/control/PedStats.h23
-rw-r--r--src/control/PedType.cpp5
-rw-r--r--src/control/PedType.h7
13 files changed, 118 insertions, 4 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 54491cd2..d59ae2d0 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -2,4 +2,5 @@
#include "patcher.h"
#include "CarCtrl.h"
-WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); } \ No newline at end of file
+WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
+WRAPPER void CCarCtrl::AddToCarArray(int id, int vehclass) { EAXJMP(0x4182F0); }
diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h
index fbe36f28..1f468475 100644
--- a/src/control/CarCtrl.h
+++ b/src/control/CarCtrl.h
@@ -6,4 +6,5 @@ class CCarCtrl
{
public:
static void SwitchVehicleToRealPhysics(CVehicle*);
+ static void AddToCarArray(int id, int vehclass);
};
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 2994eb49..b8469e5f 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -1,5 +1,6 @@
#include "common.h"
#include "patcher.h"
+#include "main.h"
#include "ModelIndices.h"
#include "Garages.h"
#include "Timer.h"
diff --git a/src/control/HandlingDataMgr.cpp b/src/control/HandlingDataMgr.cpp
new file mode 100644
index 00000000..94824358
--- /dev/null
+++ b/src/control/HandlingDataMgr.cpp
@@ -0,0 +1,7 @@
+#include "common.h"
+#include "patcher.h"
+#include "HandlingDatamgr.h"
+
+cHandlingDataMgr &mod_HandlingManager = *(cHandlingDataMgr*)0x728060;
+
+WRAPPER int32 cHandlingDataMgr::GetHandlingId(const char *name){ EAXJMP(0x546B70); }
diff --git a/src/control/HandlingDataMgr.h b/src/control/HandlingDataMgr.h
new file mode 100644
index 00000000..00e62b59
--- /dev/null
+++ b/src/control/HandlingDataMgr.h
@@ -0,0 +1,8 @@
+#pragma once
+
+class cHandlingDataMgr
+{
+public:
+ int32 GetHandlingId(const char *name);
+};
+extern cHandlingDataMgr &mod_HandlingManager;
diff --git a/src/control/ObjectData.cpp b/src/control/ObjectData.cpp
new file mode 100644
index 00000000..28c34658
--- /dev/null
+++ b/src/control/ObjectData.cpp
@@ -0,0 +1,5 @@
+#include "common.h"
+#include "patcher.h"
+#include "ObjectData.h"
+
+WRAPPER void CObjectData::Initialise(const char *filename) { EAXJMP(0x4BC0E0); }
diff --git a/src/control/ObjectData.h b/src/control/ObjectData.h
new file mode 100644
index 00000000..7df1c845
--- /dev/null
+++ b/src/control/ObjectData.h
@@ -0,0 +1,7 @@
+#pragma once
+
+class CObjectData
+{
+public:
+ static void Initialise(const char *filename);
+};
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index 8857f8c9..c3af2e30 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -46,6 +46,43 @@ CTempDetachedNode *&DetachedNodesCars = *(CTempDetachedNode**)0x8E2824;
CTempDetachedNode *&DetachedNodesPeds = *(CTempDetachedNode**)0x8E28A0;
void
+CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, int16 width, bool crossing)
+{
+ int i;
+
+ i = id*12 + node;
+ InfoForTilePeds[i].type = type;
+ InfoForTilePeds[i].next = next;
+ InfoForTilePeds[i].x = x;
+ InfoForTilePeds[i].y = y;
+ InfoForTilePeds[i].z = z;
+ InfoForTilePeds[i].numLeftLanes = 0;
+ InfoForTilePeds[i].numRightLanes = 0;
+ InfoForTilePeds[i].crossing = crossing;
+}
+
+void
+CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, int16 width, int8 numLeft, int8 numRight)
+{
+ int i;
+
+ i = id*12 + node;
+ InfoForTileCars[i].type = type;
+ InfoForTileCars[i].next = next;
+ InfoForTileCars[i].x = x;
+ InfoForTileCars[i].y = y;
+ InfoForTileCars[i].z = z;
+ InfoForTileCars[i].numLeftLanes = numLeft;
+ InfoForTileCars[i].numRightLanes = numRight;
+}
+
+void
+CPathFind::RegisterMapObject(CTreadable *mapObject)
+{
+ m_mapObjects[m_numMapObjects++] = mapObject;
+}
+
+void
CPathFind::PreparePathData(void)
{
int i, j, k;
@@ -457,8 +494,8 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
}
}else{
// Crosses road
- if(objectpathinfo[istart + iseg].next == jseg && objectpathinfo[istart + iseg].flag & 1 ||
- objectpathinfo[jstart + jseg].next == iseg && objectpathinfo[jstart + jseg].flag & 1)
+ if(objectpathinfo[istart + iseg].next == jseg && objectpathinfo[istart + iseg].crossing ||
+ objectpathinfo[jstart + jseg].next == iseg && objectpathinfo[jstart + jseg].crossing)
m_connectionFlags[m_numConnections] |= ConnectionCrossRoad;
else
m_connectionFlags[m_numConnections] &= ~ConnectionCrossRoad;
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index 495c4a73..83b89953 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -65,8 +65,10 @@ struct CPathInfoForObject
int8 next;
int8 numLeftLanes;
int8 numRightLanes;
- uint8 flag;
+ uint8 crossing : 1;
};
+extern CPathInfoForObject *&InfoForTileCars;
+extern CPathInfoForObject *&InfoForTilePeds;
struct CTempNode
{
@@ -123,6 +125,11 @@ public:
void PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoForObject *objectpathinfo,
float unk, CTempDetachedNode *detachednodes, int unused);
void CalcNodeCoors(int16 x, int16 y, int16 z, int32 id, CVector *out);
+ void StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, int16 width, bool crossing);
+ void StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, int16 width, int8 numLeft, int8 numRight);
+ void RegisterMapObject(CTreadable *mapObject);
+
+ bool IsPathObject(int id) { return id < PATHNODESIZE && (InfoForTileCars[id*12].type != 0 || InfoForTilePeds[id*12].type != 0); }
};
static_assert(sizeof(CPathFind) == 0x4c8f4, "CPathFind: error");
diff --git a/src/control/PedStats.cpp b/src/control/PedStats.cpp
new file mode 100644
index 00000000..3cb40d76
--- /dev/null
+++ b/src/control/PedStats.cpp
@@ -0,0 +1,5 @@
+#include "common.h"
+#include "patcher.h"
+#include "PedStats.h"
+
+WRAPPER int32 CPedStats::GetPedStatType(char *type) { EAXJMP(0x4EF780); }
diff --git a/src/control/PedStats.h b/src/control/PedStats.h
new file mode 100644
index 00000000..12ebdbc2
--- /dev/null
+++ b/src/control/PedStats.h
@@ -0,0 +1,23 @@
+#pragma once
+
+struct PedStat
+{
+ uint32 m_id;
+ char m_name[24];
+ int32 m_fleeDistance;
+ int32 m_headingChangeRate;
+ int8 m_fear;
+ int8 m_temper;
+ int8 m_lawfulness;
+ int8 m_sexiness;
+ int32 m_attackStrength;
+ int32 m_defendWeakness;
+ int16 m_flags;
+};
+static_assert(sizeof(PedStat) == 0x34, "PedStat: error");
+
+class CPedStats
+{
+public:
+ static int32 GetPedStatType(char *type);
+};
diff --git a/src/control/PedType.cpp b/src/control/PedType.cpp
new file mode 100644
index 00000000..587aa815
--- /dev/null
+++ b/src/control/PedType.cpp
@@ -0,0 +1,5 @@
+#include "common.h"
+#include "patcher.h"
+#include "PedType.h"
+
+WRAPPER int32 CPedType::FindPedType(char *type) { EAXJMP(0x4EEC10); }
diff --git a/src/control/PedType.h b/src/control/PedType.h
new file mode 100644
index 00000000..563dc294
--- /dev/null
+++ b/src/control/PedType.h
@@ -0,0 +1,7 @@
+#pragma once
+
+class CPedType
+{
+public:
+ static int32 FindPedType(char *type);
+};