first part of CFileLoader

This commit is contained in:
aap
2019-06-17 10:30:02 +02:00
parent fcc6a8bc55
commit b5fba778c4
41 changed files with 1182 additions and 45 deletions

View File

@ -2,4 +2,5 @@
#include "patcher.h"
#include "CarCtrl.h"
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
WRAPPER void CCarCtrl::AddToCarArray(int id, int vehclass) { EAXJMP(0x4182F0); }

View File

@ -6,4 +6,5 @@ class CCarCtrl
{
public:
static void SwitchVehicleToRealPhysics(CVehicle*);
static void AddToCarArray(int id, int vehclass);
};

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "main.h"
#include "ModelIndices.h"
#include "Garages.h"
#include "Timer.h"

View File

@ -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); }

View File

@ -0,0 +1,8 @@
#pragma once
class cHandlingDataMgr
{
public:
int32 GetHandlingId(const char *name);
};
extern cHandlingDataMgr &mod_HandlingManager;

View File

@ -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;

View File

@ -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");

5
src/control/PedStats.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "PedStats.h"
WRAPPER int32 CPedStats::GetPedStatType(char *type) { EAXJMP(0x4EF780); }

23
src/control/PedStats.h Normal file
View File

@ -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);
};

5
src/control/PedType.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "PedType.h"
WRAPPER int32 CPedType::FindPedType(char *type) { EAXJMP(0x4EEC10); }

7
src/control/PedType.h Normal file
View File

@ -0,0 +1,7 @@
#pragma once
class CPedType
{
public:
static int32 FindPedType(char *type);
};