From ed69be36cc30609100f0c75ac18aa5b4c15b22b4 Mon Sep 17 00:00:00 2001 From: erorcun Date: Fri, 14 Jun 2019 15:33:08 +0300 Subject: Some CPed functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/entities/Ped.h | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'src/entities/Ped.h') diff --git a/src/entities/Ped.h b/src/entities/Ped.h index adf24c88..4a616e22 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -2,6 +2,8 @@ #include "Physical.h" #include "Weapon.h" +#include "PedIK.h" +#include enum { PED_MAX_WEAPONS = 13 @@ -79,6 +81,22 @@ enum { PEDMOVE_SPRINT, }; +enum PedNode { + PED_WAIST = 0, + PED_TORSO, // Smid on PS2/PC, Storso on mobile/xbox. We follow mobile/xbox (makes kicking on ground look better) + PED_HEAD, + PED_UPPERARML, + PED_UPPERARMR, + PED_HANDL, + PED_HANDR, + PED_UPPERLEGL, + PED_UPPERLEGR, + PED_FOOTL, + PED_FOOTR, + PED_NODE_11, + PED_NODE_MAX +}; + class CVehicle; class CPed : public CPhysical @@ -159,7 +177,16 @@ public: uint8 m_ped_flagI20 : 1; uint8 m_ped_flagI40 : 1; uint8 m_ped_flagI80 : 1; - uint8 stuff1[199]; + uint8 stuff10[60]; + int32 m_pEventEntity; + int32 m_fAngleToEvent; + AnimBlendFrameData *m_pFrames[PED_FRAME_MAX]; + int32 m_animGroup; + int32 m_pVehicleAnim; + CVector2D m_vecAnimMoveDelta; + CVector m_vecOffsetSeek; + CPedIK m_pedIK; + uint8 stuff1[12]; int32 m_nPedState; int32 m_nLastPedState; int32 m_nMoveState; @@ -167,7 +194,8 @@ public: CEntity *m_pCurrentPhysSurface; CVector m_vecOffsetFromPhysSurface; CEntity *m_pCurSurface; - uint8 stuff3[16]; + uint8 stuff3[12]; + CPed* m_pSeekTarget; CVehicle *m_pMyVehicle; bool bInVehicle; uint8 stuff4[23]; @@ -179,14 +207,25 @@ public: CWeapon m_weapons[PED_MAX_WEAPONS]; int32 stuff7; uint8 m_currentWeapon; - uint8 stuff[163]; + uint8 stuff[3]; + int32 m_pPointGunAt; + CVector m_vecHitLastPos; + uint8 stuff8[12]; + CPed *m_pPedFight; + float m_fLookDirection; + int32 m_wepModelID; + uint8 stuff9[120]; static void *operator new(size_t); static void operator delete(void*, size_t); bool IsPlayer(void) { return m_nPedType == 0 || m_nPedType== 1 || m_nPedType == 2 || m_nPedType == 3; } bool UseGroundColModel(void); + void AddWeaponModel(int id); + void AimGun(); void KillPedWithCar(CVehicle *veh, float impulse); + void Say(uint16 audio); + void SetLookFlag(CEntity *to, bool set); CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } static Bool &bNastyLimbsCheat; @@ -200,4 +239,4 @@ static_assert(offsetof(CPed, m_nPedType) == 0x32C, "CPed: error"); static_assert(offsetof(CPed, m_pCollidingEntity) == 0x34C, "CPed: error"); static_assert(offsetof(CPed, m_weapons) == 0x35C, "CPed: error"); static_assert(offsetof(CPed, m_currentWeapon) == 0x498, "CPed: error"); -static_assert(sizeof(CPed) == 0x53C, "CPed: error"); +static_assert(sizeof(CPed) == 0x53C, "CPed: error"); \ No newline at end of file -- cgit v1.2.3 From 8db50cea6c5e7d93d7e7fe102ca465a615ab86de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 14 Jun 2019 17:14:22 +0300 Subject: Fix duplicate code for PedNode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/entities/Ped.h | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'src/entities/Ped.h') diff --git a/src/entities/Ped.h b/src/entities/Ped.h index 4a616e22..b7db77dc 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -81,22 +81,6 @@ enum { PEDMOVE_SPRINT, }; -enum PedNode { - PED_WAIST = 0, - PED_TORSO, // Smid on PS2/PC, Storso on mobile/xbox. We follow mobile/xbox (makes kicking on ground look better) - PED_HEAD, - PED_UPPERARML, - PED_UPPERARMR, - PED_HANDL, - PED_HANDR, - PED_UPPERLEGL, - PED_UPPERLEGR, - PED_FOOTL, - PED_FOOTR, - PED_NODE_11, - PED_NODE_MAX -}; - class CVehicle; class CPed : public CPhysical @@ -180,7 +164,7 @@ public: uint8 stuff10[60]; int32 m_pEventEntity; int32 m_fAngleToEvent; - AnimBlendFrameData *m_pFrames[PED_FRAME_MAX]; + AnimBlendFrameData *m_pFrames[PED_NODE_MAX]; int32 m_animGroup; int32 m_pVehicleAnim; CVector2D m_vecAnimMoveDelta; -- cgit v1.2.3 From 2f4fc5aaf07aedecf3796bae5a63734f133e19a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sat, 15 Jun 2019 18:53:25 +0300 Subject: More CPed functions and minor fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/entities/Ped.h | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/entities/Ped.h') diff --git a/src/entities/Ped.h b/src/entities/Ped.h index b7db77dc..2f0f67f0 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -3,6 +3,7 @@ #include "Physical.h" #include "Weapon.h" #include "PedIK.h" +#include #include enum { @@ -94,7 +95,7 @@ public: uint8 m_ped_flagA4 : 1; uint8 m_ped_flagA8 : 1; uint8 m_ped_flagA10 : 1; - uint8 m_ped_flagA20 : 1; + uint8 m_ped_flagA20_look : 1; uint8 m_ped_flagA40 : 1; uint8 m_ped_flagA80 : 1; uint8 m_ped_flagB1 : 1; @@ -163,14 +164,15 @@ public: uint8 m_ped_flagI80 : 1; uint8 stuff10[60]; int32 m_pEventEntity; - int32 m_fAngleToEvent; + float m_fAngleToEvent; AnimBlendFrameData *m_pFrames[PED_NODE_MAX]; int32 m_animGroup; int32 m_pVehicleAnim; CVector2D m_vecAnimMoveDelta; CVector m_vecOffsetSeek; CPedIK m_pedIK; - uint8 stuff1[12]; + uint8 stuff1[8]; + int32 m_nPedStateTimer; int32 m_nPedState; int32 m_nLastPedState; int32 m_nMoveState; @@ -198,7 +200,12 @@ public: CPed *m_pPedFight; float m_fLookDirection; int32 m_wepModelID; - uint8 stuff9[120]; + uint32 m_leaveCarTimer; + uint32 m_getUpTimer; + uint32 m_lookTimer; + uint8 stuff9[34]; + uint8 m_bodyPartBleeding; + uint8 stuff11[73]; static void *operator new(size_t); static void operator delete(void*, size_t); @@ -209,8 +216,17 @@ public: void AimGun(); void KillPedWithCar(CVehicle *veh, float impulse); void Say(uint16 audio); - void SetLookFlag(CEntity *to, bool set); + void SetLookFlag(CPed *to, bool set); + void SetLookFlag(float angle, bool set); + void SetDie(AnimationId anim, float arg1, float arg2); + void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer); + void RemoveBodyPart(PedNode nodeId, char arg4); + void SpawnFlyingComponent(int, signed char); + static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data); + static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data); + CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } + RwFrame* GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } static Bool &bNastyLimbsCheat; static Bool &bPedCheat2; @@ -223,4 +239,6 @@ static_assert(offsetof(CPed, m_nPedType) == 0x32C, "CPed: error"); static_assert(offsetof(CPed, m_pCollidingEntity) == 0x34C, "CPed: error"); static_assert(offsetof(CPed, m_weapons) == 0x35C, "CPed: error"); static_assert(offsetof(CPed, m_currentWeapon) == 0x498, "CPed: error"); +static_assert(offsetof(CPed, m_lookTimer) == 0x4CC, "CPed: error"); +static_assert(offsetof(CPed, m_bodyPartBleeding) == 0x4F2, "CPed: error"); static_assert(sizeof(CPed) == 0x53C, "CPed: error"); \ No newline at end of file -- cgit v1.2.3 From c1bd90c7ddcb28c0ba5ebe66ab90319ffeee6d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 16 Jun 2019 21:39:48 +0300 Subject: CPed fixes and needed functions for further commits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/entities/Ped.h | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src/entities/Ped.h') diff --git a/src/entities/Ped.h b/src/entities/Ped.h index 2f0f67f0..dfefeddf 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -2,9 +2,12 @@ #include "Physical.h" #include "Weapon.h" +#include "PathFind.h" #include "PedIK.h" -#include -#include +#include "AnimManager.h" +#include "AnimBlendClumpData.h" +#include "PedStat.h" +#include "Sounds.h" enum { PED_MAX_WEAPONS = 13 @@ -162,7 +165,9 @@ public: uint8 m_ped_flagI20 : 1; uint8 m_ped_flagI40 : 1; uint8 m_ped_flagI80 : 1; - uint8 stuff10[60]; + uint8 stuff10[15]; + int32 m_field_16C; + uint8 stuff12[44]; int32 m_pEventEntity; float m_fAngleToEvent; AnimBlendFrameData *m_pFrames[PED_NODE_MAX]; @@ -172,7 +177,7 @@ public: CVector m_vecOffsetSeek; CPedIK m_pedIK; uint8 stuff1[8]; - int32 m_nPedStateTimer; + uint32 m_nPedStateTimer; int32 m_nPedState; int32 m_nLastPedState; int32 m_nMoveState; @@ -186,8 +191,8 @@ public: bool bInVehicle; uint8 stuff4[23]; int32 m_nPedType; - - uint8 stuff5[28]; + PedStat *m_pedStats; + uint8 stuff5[24]; CEntity *m_pCollidingEntity; uint8 stuff6[12]; CWeapon m_weapons[PED_MAX_WEAPONS]; @@ -205,7 +210,9 @@ public: uint32 m_lookTimer; uint8 stuff9[34]; uint8 m_bodyPartBleeding; - uint8 stuff11[73]; + uint8 m_field_4F3; + CPed *m_nearPeds[10]; + uint8 stuff11[32]; static void *operator new(size_t); static void operator delete(void*, size_t); @@ -215,19 +222,21 @@ public: void AddWeaponModel(int id); void AimGun(); void KillPedWithCar(CVehicle *veh, float impulse); - void Say(uint16 audio); + void Say(eSound audio); void SetLookFlag(CPed *to, bool set); void SetLookFlag(float angle, bool set); + void SetLookTimer(int time); void SetDie(AnimationId anim, float arg1, float arg2); void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer); void RemoveBodyPart(PedNode nodeId, char arg4); void SpawnFlyingComponent(int, signed char); + bool OurPedCanSeeThisOne(CEntity* who); static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data); static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data); CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } RwFrame* GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } - + static Bool &bNastyLimbsCheat; static Bool &bPedCheat2; static Bool &bPedCheat3; @@ -241,4 +250,6 @@ static_assert(offsetof(CPed, m_weapons) == 0x35C, "CPed: error"); static_assert(offsetof(CPed, m_currentWeapon) == 0x498, "CPed: error"); static_assert(offsetof(CPed, m_lookTimer) == 0x4CC, "CPed: error"); static_assert(offsetof(CPed, m_bodyPartBleeding) == 0x4F2, "CPed: error"); +static_assert(offsetof(CPed, m_field_16C) == 0x16C, "CPed: error"); +static_assert(offsetof(CPed, m_pEventEntity) == 0x19C, "CPed: error"); static_assert(sizeof(CPed) == 0x53C, "CPed: error"); \ No newline at end of file -- cgit v1.2.3 From 18cdf53723a4455c292bb32a34a52a03f26ff675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 16 Jun 2019 23:26:39 +0300 Subject: Delete duplicate enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/entities/Ped.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/entities/Ped.h') diff --git a/src/entities/Ped.h b/src/entities/Ped.h index a1f14afb..2143fa93 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -7,7 +7,7 @@ #include "AnimManager.h" #include "AnimBlendClumpData.h" #include "PedStat.h" -#include "Sounds.h" +#include "DMAudio.h" enum { PED_MAX_WEAPONS = 13 -- cgit v1.2.3