diff options
author | aap <aap@papnet.eu> | 2019-06-19 14:06:13 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-06-19 14:06:13 +0200 |
commit | 78e33785ecfd176616b1a1b1588c771b978a4c19 (patch) | |
tree | 6abde4ca51c0f477ce63288215b510a462e52e50 /src/control | |
parent | Merge pull request #22 from erorcun/master (diff) | |
download | re3-78e33785ecfd176616b1a1b1588c771b978a4c19.tar re3-78e33785ecfd176616b1a1b1588c771b978a4c19.tar.gz re3-78e33785ecfd176616b1a1b1588c771b978a4c19.tar.bz2 re3-78e33785ecfd176616b1a1b1588c771b978a4c19.tar.lz re3-78e33785ecfd176616b1a1b1588c771b978a4c19.tar.xz re3-78e33785ecfd176616b1a1b1588c771b978a4c19.tar.zst re3-78e33785ecfd176616b1a1b1588c771b978a4c19.zip |
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/PedType.cpp | 18 | ||||
-rw-r--r-- | src/control/PedType.h | 122 |
2 files changed, 85 insertions, 55 deletions
diff --git a/src/control/PedType.cpp b/src/control/PedType.cpp index b6d77cb0..645ab15c 100644 --- a/src/control/PedType.cpp +++ b/src/control/PedType.cpp @@ -2,25 +2,27 @@ #include "patcher.h" #include "PedType.h" -CPedType* (&CPedType::ms_apPedType)[23] = *(CPedType * (*)[23]) * (int*)0x941594; +CPedType *(&CPedType::ms_apPedType)[NUM_PEDTYPES] = *(CPedType *(*)[NUM_PEDTYPES]) *(int*)0x941594; WRAPPER void CPedType::LoadPedData(void) { EAXJMP(0x4EE8D0); } -WRAPPER int32 CPedType::FindPedType(char* type) { EAXJMP(0x4EEC10); } +WRAPPER int32 CPedType::FindPedType(char *type) { EAXJMP(0x4EEC10); } void -CPedType::Initialise() +CPedType::Initialise(void) { + int i; + debug("Initialising CPedType...\n"); - for (int i = 0; i < 23; i++) { + for(i = 0; i < NUM_PEDTYPES; i++){ ms_apPedType[i] = new CPedType; - ms_apPedType[i]->m_Type.IntValue = 1; + ms_apPedType[i]->m_flag = PED_FLAG_PLAYER1; 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; + ms_apPedType[i]->m_threats = 0; + ms_apPedType[i]->m_avoid = 0; } debug("Loading ped data...\n"); LoadPedData(); @@ -29,4 +31,4 @@ CPedType::Initialise() STARTPATCHES InjectHook(0x4EE7E0, &CPedType::Initialise, PATCH_JUMP); -ENDPATCHES
\ No newline at end of file +ENDPATCHES diff --git a/src/control/PedType.h b/src/control/PedType.h index 1d1057d7..a681ff13 100644 --- a/src/control/PedType.h +++ b/src/control/PedType.h @@ -4,59 +4,87 @@ #include "templates.h" #include "Lists.h" -class CPedType { -public: - 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; +// Index into the PedType array +enum +{ + PEDTYPE_PLAYER1, + PEDTYPE_PLAYER2, + PEDTYPE_PLAYER3, + PEDTYPE_PLAYER4, + PEDTYPE_CIVMALE, + PEDTYPE_CIVFEMALE, + PEDTYPE_COP, + PEDTYPE_GANG1, + PEDTYPE_GANG2, + PEDTYPE_GANG3, + PEDTYPE_GANG4, + PEDTYPE_GANG5, + PEDTYPE_GANG6, + PEDTYPE_GANG7, + PEDTYPE_GANG8, + PEDTYPE_GANG9, + PEDTYPE_EMERGENCY, + PEDTYPE_FIREMAN, + PEDTYPE_CRIMINAL, + PEDTYPE_SPECIAL, + PEDTYPE_PROSTITUE, + PEDTYPE_UNUSED1, + PEDTYPE_UNUSED2, + + NUM_PEDTYPES +}; + +enum +{ + PED_FLAG_PLAYER1 = 1 << 0, + PED_FLAG_PLAYER2 = 1 << 1, + PED_FLAG_PLAYER3 = 1 << 2, + PED_FLAG_PLAYER4 = 1 << 3, + PED_FLAG_CIVMALE = 1 << 4, + PED_FLAG_CIVFEMALE = 1 << 5, + PED_FLAG_COP = 1 << 6, + PED_FLAG_GANG1 = 1 << 7, + PED_FLAG_GANG2 = 1 << 8, + PED_FLAG_GANG3 = 1 << 9, + PED_FLAG_GANG4 = 1 << 10, + PED_FLAG_GANG5 = 1 << 11, + PED_FLAG_GANG6 = 1 << 12, + PED_FLAG_GANG7 = 1 << 13, + PED_FLAG_GANG8 = 1 << 14, + PED_FLAG_GANG9 = 1 << 15, + PED_FLAG_EMERGENCY = 1 << 16, + PED_FLAG_PROSTITUTE = 1 << 17, + PED_FLAG_CRIMINAL = 1 << 18, + PED_FLAG_SPECIAL = 1 << 19, + PED_FLAG_GUN = 1 << 20, + PED_FLAG_COPCAR = 1 << 21, + PED_FLAG_FASTCAR = 1 << 22, + PED_FLAG_EXPLOSION = 1 << 23, + PED_FLAG_FIREMAN = 1 << 24, + PED_FLAG_DEADPEDS = 1 << 25, +}; + +class CPedType +{ + uint32 m_flag; float field_4; float field_8; float field_C; float field_10; float field_14; - tPedTypeFlags m_Threat; - tPedTypeFlags m_Avoid; + uint32 m_threats; + uint32 m_avoid; + + static CPedType *(&ms_apPedType)[NUM_PEDTYPES]; +public: - static CPedType* (&ms_apPedType)[23]; + static void Initialise(void); + static void LoadPedData(void); + static int32 FindPedType(char *type); - static void Initialise(); - static void LoadPedData(); - static int32 FindPedType(char* type); + static uint32 GetFlag(int type) { return ms_apPedType[type]->m_flag; } + static uint32 GetAvoid(int type) { return ms_apPedType[type]->m_avoid; } + static uint32 GetThreats(int type) { return ms_apPedType[type]->m_threats; } }; -static_assert(sizeof(CPedType) == 0x20, "CPedType: error");
\ No newline at end of file +static_assert(sizeof(CPedType) == 0x20, "CPedType: error"); |