CPed merge fixes

Signed-off-by: eray orçunus <erayorcunus@gmail.com>
This commit is contained in:
eray orçunus
2019-06-18 15:55:39 +03:00
parent 886db44936
commit c9f6e7bf83
6 changed files with 96 additions and 108 deletions

View File

@ -2,4 +2,31 @@
#include "patcher.h"
#include "PedType.h"
WRAPPER int32 CPedType::FindPedType(char *type) { EAXJMP(0x4EEC10); }
CPedType* (&CPedType::ms_apPedType)[23] = *(CPedType * (*)[23]) * (int*)0x941594;
WRAPPER void CPedType::LoadPedData(void) { EAXJMP(0x4EE8D0); }
WRAPPER int32 CPedType::FindPedType(char* type) { EAXJMP(0x4EEC10); }
void
CPedType::Initialise()
{
debug("Initialising CPedType...\n");
for (int i = 0; i < 23; i++) {
ms_apPedType[i] = new CPedType;
ms_apPedType[i]->m_Type.IntValue = 1;
ms_apPedType[i]->field_4 = 0;
ms_apPedType[i]->field_8 = 0;
// Why field_C not initialized?
ms_apPedType[i]->field_10 = 0;
ms_apPedType[i]->field_14 = 0;
ms_apPedType[i]->m_Threat.IntValue = 0;
ms_apPedType[i]->m_Avoid.IntValue = 0;
}
debug("Loading ped data...\n");
LoadPedData();
debug("CPedType ready\n");
}
STARTPATCHES
InjectHook(0x4EE7E0, &CPedType::Initialise, PATCH_JUMP);
ENDPATCHES

View File

@ -1,7 +1,62 @@
#pragma once
class CPedType
{
#include "common.h"
#include "templates.h"
#include "Lists.h"
class CPedType {
public:
static int32 FindPedType(char *type);
union tPedTypeFlags
{
uint32 IntValue;
struct
{
uint8 bPlayer1 : 1;
uint8 bPlayer2 : 1;
uint8 bPlayer3 : 1;
uint8 bPlayer4 : 1;
uint8 bCivmale : 1;
uint8 bCivfemale : 1;
uint8 bCop : 1;
uint8 bGang1 : 1;
uint8 bGang2 : 1;
uint8 bGang3 : 1;
uint8 bGang4 : 1;
uint8 bGang5 : 1;
uint8 bGang6 : 1;
uint8 bGang7 : 1;
uint8 bGang8 : 1;
uint8 bGang9 : 1;
uint8 bEmergency : 1;
uint8 bProstitute : 1;
uint8 bCriminal : 1;
uint8 bSpecial : 1;
uint8 bGun : 1;
uint8 bCop_car : 1;
uint8 bFast_car : 1;
uint8 bExplosion : 1;
uint8 bFireman : 1;
uint8 bDeadpeds : 1;
};
};
tPedTypeFlags m_Type;
float field_4;
float field_8;
float field_C;
float field_10;
float field_14;
tPedTypeFlags m_Threat;
tPedTypeFlags m_Avoid;
static CPedType* (&ms_apPedType)[23];
static void Initialise();
static void LoadPedData();
static int32 FindPedType(char* type);
};
static_assert(sizeof(CPedType) == 0x20, "CPedType: error");