From b5fba778c4a307f0a5721c9b3b0efb38be96634b Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 17 Jun 2019 10:30:02 +0200 Subject: first part of CFileLoader --- src/control/CarCtrl.cpp | 3 ++- src/control/CarCtrl.h | 1 + src/control/Garages.cpp | 1 + src/control/HandlingDataMgr.cpp | 7 +++++++ src/control/HandlingDataMgr.h | 8 ++++++++ src/control/PathFind.cpp | 35 +++++++++++++++++++++++++++++++++-- src/control/PathFind.h | 4 +++- src/control/PedStats.cpp | 5 +++++ src/control/PedStats.h | 23 +++++++++++++++++++++++ src/control/PedType.cpp | 5 +++++ src/control/PedType.h | 7 +++++++ 11 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 src/control/HandlingDataMgr.cpp create mode 100644 src/control/HandlingDataMgr.h create mode 100644 src/control/PedStats.cpp create mode 100644 src/control/PedStats.h create mode 100644 src/control/PedType.cpp create mode 100644 src/control/PedType.h (limited to 'src/control') 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/PathFind.cpp b/src/control/PathFind.cpp index 8857f8c9..8cfc17e7 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -45,6 +45,37 @@ CPathInfoForObject *&InfoForTilePeds = *(CPathInfoForObject**)0x8F1AE4; 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::PreparePathData(void) { @@ -457,8 +488,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..ed3c7e9f 100644 --- a/src/control/PathFind.h +++ b/src/control/PathFind.h @@ -65,7 +65,7 @@ struct CPathInfoForObject int8 next; int8 numLeftLanes; int8 numRightLanes; - uint8 flag; + uint8 crossing : 1; }; struct CTempNode @@ -123,6 +123,8 @@ 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); }; 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); +}; -- cgit v1.2.3