CPed fixes and needed functions for further commits

Signed-off-by: eray orçunus <erayorcunus@gmail.com>
This commit is contained in:
eray orçunus 2019-06-16 21:39:48 +03:00
parent 2f4fc5aaf0
commit c1bd90c7dd
6 changed files with 330 additions and 69 deletions

20
src/PedStat.h Normal file
View File

@ -0,0 +1,20 @@
#pragma once
#include "common.h"
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;
uint8 unknown1;
uint8 unknown2;
};
static_assert(sizeof(PedStat) == 0x34, "PedStat: error");

174
src/Sounds.h Normal file
View File

@ -0,0 +1,174 @@
#pragma once
#include "common.h"
enum eSound : int16
{
SOUND_CAR_DOOR_CLOSE_BONNET = 0,
SOUND_CAR_DOOR_CLOSE_BUMPER = 1,
SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2,
SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT = 3,
SOUND_CAR_DOOR_CLOSE_BACK_LEFT = 4,
SOUND_CAR_DOOR_CLOSE_BACK_RIGHT = 5,
SOUND_CAR_DOOR_OPEN_BONNET = 6,
SOUND_CAR_DOOR_OPEN_BUMPER = 7,
SOUND_CAR_DOOR_OPEN_FRONT_LEFT = 8,
SOUND_CAR_DOOR_OPEN_FRONT_RIGHT = 9,
SOUND_CAR_DOOR_OPEN_BACK_LEFT = 10,
SOUND_CAR_DOOR_OPEN_BACK_RIGHT = 11,
SOUND_CAR_WINDSHIELD_CRACK = 12,
SOUND_CAR_JUMP = 13,
SOUND_E = 14,
SOUND_F = 15,
SOUND_CAR_ENGINE_START = 16,
SOUND_CAR_LIGHT_BREAK = 17,
SOUND_CAR_HYDRAULIC_1 = 18,
SOUND_CAR_HYDRAULIC_2 = 19,
SOUND_CAR_HYDRAULIC_3 = 20,
SOUND_CAR_JERK = 21,
SOUND_CAR_SPLASH = 22,
SOUND_17 = 23,
SOUND_18 = 24,
SOUND_19 = 25,
SOUND_CAR_TANK_TURRET_ROTATE = 26,
SOUND_CAR_BOMB_TICK = 27,
SOUND_PLANE_ON_GROUND = 28,
SOUND_STEP_START = 29,
SOUND_STEP_END = 30,
SOUND_FALL_LAND = 31,
SOUND_FALL_COLLAPSE = 32,
SOUND_21 = 33,
SOUND_22 = 34,
SOUND_23 = 35,
SOUND_24 = 36,
SOUND_25 = 37,
SOUND_26 = 38,
SOUND_WEAPON_PUNCH_ATTACK = 39,
SOUND_28 = 40,
SOUND_29 = 41,
SOUND_2A = 42,
SOUND_2B = 43,
SOUND_2C = 44,
SOUND_2D = 45,
SOUND_WEAPON_BAT_ATTACK = 46,
SOUND_WEAPON_SHOT_FIRED = 47,
SOUND_WEAPON_RELOAD = 48,
SOUND_31 = 49,
SOUND_32 = 50,
SOUND_33 = 51,
SOUND_WEAPON_FLAMETHROWER_FIRE = 52,
SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM = 53,
SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM = 54,
SOUND_WEAPON_HIT_PED = 55,
SOUND_WEAPON_HIT_VEHICLE = 56,
SOUND_GARAGE_NO_MONEY = 57,
SOUND_GARAGE_BAD_VEHICLE = 58,
SOUND_GARAGE_OPENING = 59,
SOUND_3C = 60,
SOUND_GARAGE_BOMB1_SET = 61,
SOUND_GARAGE_BOMB2_SET = 62,
SOUND_GARAGE_BOMB3_SET = 63,
SOUND_40 = 64,
SOUND_41 = 65,
SOUND_GARAGE_VEHICLE_DECLINED = 66,
SOUND_GARAGE_VEHICLE_ACCEPTED = 67,
SOUND_GARAGE_DOOR_CLOSED = 68,
SOUND_GARAGE_DOOR_OPENED = 69,
SOUND_CRANE_PICKUP = 70,
SOUND_PICKUP_WEAPON_BOUGHT = 71,
SOUND_PICKUP_WEAPON = 72,
SOUND_PICKUP_HEALTH = 73,
SOUND_4A = 74,
SOUND_4B = 75,
SOUND_PICKUP_ADRENALINE = 76,
SOUND_PICKUP_ARMOUR = 77,
SOUND_PICKUP_BONUS = 78,
SOUND_PICKUP_MONEY = 79,
SOUND_PICKUP_HIDDEN_PACKAGE = 80,
SOUND_PICKUP_PACMAN_PILL = 81,
SOUND_PICKUP_PACMAN_PACKAGE = 82,
SOUND_PICKUP_FLOAT_PACKAGE = 83,
SOUND_BOMB_TIMED_ACTIVATED = 84,
SOUND_55 = 85,
SOUND_BOMB_ONIGNITION_ACTIVATED = 86,
SOUND_BOMB_TICK = 87,
SOUND_RAMPAGE_START = 88,
SOUND_RAMPAGE_ONGOING = 89,
SOUND_RAMPAGE_PASSED = 90,
SOUND_RAMPAGE_FAILED = 91,
SOUND_RAMPAGE_KILL = 92,
SOUND_RAMPAGE_CAR_BLOWN = 93,
SOUND_EVIDENCE_PICKUP = 94,
SOUND_UNLOAD_GOLD = 95,
SOUND_PAGER = 96,
SOUND_PED_DEATH = 97,
SOUND_PED_DAMAGE = 98,
SOUND_PED_63 = 99,
SOUND_PED_LAND = 100,
SOUND_PED_BULLET_HIT = 101,
SOUND_PED_BOMBER = 102,
SOUND_PED_BURNING = 103,
SOUND_PED_ARREST_FBI = 104,
SOUND_PED_ARREST_SWAT = 105,
SOUND_PED_ARREST_COP = 106,
SOUND_PED_HELI_PLAYER_FOUND = 107,
SOUND_PED_HANDS_UP = 108,
SOUND_PED_HANDS_COWER = 109,
SOUND_PED_FLEE_SPRINT = 110,
SOUND_PED_CAR_JACKING = 111,
SOUND_PED_MUGGING = 112,
SOUND_PED_CAR_JACKED = 113,
SOUND_PED_ROBBED = 114,
SOUND_PED_TAXI_WAIT = 115,
SOUND_PED_ATTACK = 116,
SOUND_PED_DEFEND = 117,
SOUND_PED_PURSUIT_ARMY = 118,
SOUND_PED_PURSUIT_FBI = 119,
SOUND_PED_PURSUIT_SWAT = 120,
SOUND_PED_PURSUIT_COP = 121,
SOUND_PED_HEALING = 122,
SOUND_PED_7B = 123,
SOUND_PED_LEAVE_VEHICLE = 124,
SOUND_PED_EVADE = 125,
SOUND_PED_FLEE_RUN = 126,
SOUND_PED_CAR_COLLISION = 127,
SOUND_PED_SOLICIT = 128,
SOUND_PED_EXTINGUISHING_FIRE = 129,
SOUND_PED_WAIT_DOUBLEBACK = 130,
SOUND_PED_CHAT_SEXY = 131,
SOUND_PED_CHAT_EVENT = 132,
SOUND_PED_CHAT = 133,
SOUND_PED_BODYCAST_HIT = 134,
SOUND_PED_TAXI_CALL = 135,
SOUND_INJURED_PED_MALE_OUCH = 136,
SOUND_INJURED_PED_FEMALE = 137,
SOUND_8A = 138,
SOUND_RACE_START_3 = 139,
SOUND_RACE_START_2 = 140,
SOUND_RACE_START_1 = 141,
SOUND_RACE_START_GO = 142,
SOUND_SPLASH = 143,
SOUND_WATER_FALL = 144,
SOUND_SPLATTER = 145,
SOUND_CAR_PED_COLLISION = 146,
SOUND_CLOCK_TICK = 147,
SOUND_PART_MISSION_COMPLETE = 148,
SOUND_FRONTEND_MENU_STARTING = 149,
SOUND_FRONTEND_MENU_COMPLETED = 150,
SOUND_FRONTEND_MENU_DENIED = 151,
SOUND_FRONTEND_MENU_SUCCESS = 152,
SOUND_FRONTEND_EXIT = 153,
SOUND_9A = 154,
SOUND_9B = 155,
SOUND_FRONTEND_AUDIO_TEST = 156,
SOUND_FRONTEND_FAIL = 157,
SOUND_FRONTEND_NO_RADIO = 158,
SOUND_FRONTEND_RADIO_CHANGE = 159,
SOUND_A0 = 160,
SOUND_AMMUNATION_WELCOME_1 = 161,
SOUND_AMMUNATION_WELCOME_2 = 162,
SOUND_AMMUNATION_WELCOME_3 = 163,
SOUND_LIGHTNING = 164,
SOUND_A5 = 165,
SOUND_TOTAL_SOUNDS = 166,
SOUND_TOTAL_PED_SOUNDS = 167,
};

View File

@ -2,9 +2,9 @@
#include "patcher.h" #include "patcher.h"
#include "Ped.h" #include "Ped.h"
#include "Pools.h" #include "Pools.h"
#include <render\Particle.h> #include "Particle.h"
#include <render\ParticleMgr.h> #include "Stats.h"
#include <Stats.h> #include "World.h"
Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44; Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44;
Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A; Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A;
@ -14,7 +14,7 @@ void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); } WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); }
WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); } WRAPPER void CPed::Say(eSound audio) { EAXJMP(0x4E5A10); }
WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); } WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); }
WRAPPER void CPed::SpawnFlyingComponent(int, signed char) { EAXJMP(0x4EB060); } WRAPPER void CPed::SpawnFlyingComponent(int, signed char) { EAXJMP(0x4EB060); }
@ -201,7 +201,6 @@ CPed::AimGun()
{ {
RwV3d pos; RwV3d pos;
CVector vector; CVector vector;
uint8 newFlag;
if (m_pSeekTarget) { if (m_pSeekTarget) {
if (m_pSeekTarget->m_status == STATUS_PHYSICS) { if (m_pSeekTarget->m_status == STATUS_PHYSICS) {
@ -210,9 +209,9 @@ CPed::AimGun()
vector.y = pos.y; vector.y = pos.y;
vector.z = pos.z; vector.z = pos.z;
} else { } else {
vector = *(m_pSeekTarget->GetMatrix().GetPosition()); vector = *(m_pSeekTarget->GetPosition());
} }
CPed::Say(0x74); CPed::Say(SOUND_PED_ATTACK);
m_ped_flagB2 = m_pedIK.PointGunAtPosition(&vector); m_ped_flagB2 = m_pedIK.PointGunAtPosition(&vector);
if (m_pPedFight != m_pSeekTarget) { if (m_pPedFight != m_pSeekTarget) {
@ -221,12 +220,10 @@ CPed::AimGun()
} else { } else {
if (CPed::IsPlayer()) { if (CPed::IsPlayer()) {
newFlag = m_pedIK.PointGunInDirection(m_fLookDirection, m_vecMoveSpeedAvg.y); m_ped_flagB2 = m_pedIK.PointGunInDirection(m_fLookDirection, ((CPlayerPed*)this)->m_fFPSMoveHeading);
} else { } else {
newFlag = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0); m_ped_flagB2 = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0f);
} }
m_ped_flagB2 = newFlag;
} }
} }
@ -238,16 +235,15 @@ CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer)
CVector pos2 = CVector( CVector pos2 = CVector(
pos.x, pos.x,
pos.y, pos.y,
pos.z + 0.1 pos.z + 0.1f
); );
if (!CPed::IsPlayer() || evenOnPlayer) if (!CPed::IsPlayer() || evenOnPlayer) {
{
++CStats::HeadShots; ++CStats::HeadShots;
// yes. decompiled by hand. // BUG: This condition will always return true.
if (m_nPedState != PED_PASSENGER || m_nPedState != PED_TAXI_PASSENGER) { if (m_nPedState != PED_PASSENGER || m_nPedState != PED_TAXI_PASSENGER) {
CPed::SetDie(ANIM_KO_SHOT_FRONT1, 4.0, 0.0); CPed::SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
} }
m_ped_flagC20 = 1; m_ped_flagC20 = 1;
@ -255,30 +251,29 @@ CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer)
CParticle::AddParticle(PARTICLE_TEST, pos2, CParticle::AddParticle(PARTICLE_TEST, pos2,
CVector( CVector(
0.0, 0.0f,
0.0, 0.0f,
0.0 0.0f
), NULL, 0.2f, 0, 0, 0, 0); ), NULL, 0.2f, 0, 0, 0, 0);
if (CEntity::GetIsOnScreen()) if (CEntity::GetIsOnScreen()) {
{ for(int i=0; i < 32; i++) {
for(int i=0; i<0x20; i++) {
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, CParticle::AddParticle(PARTICLE_BLOOD_SMALL,
pos2, pos2,
CVector( CVector(
0.0, 0.0f,
0.0, 0.0f,
0.03 0.03f
), NULL, 0.0f, 0, 0, 0, 0); ), NULL, 0.0f, 0, 0, 0, 0);
} }
for (int i = 0; i < 0x10; i++) { for (int i = 0; i < 16; i++) {
CParticle::AddParticle(PARTICLE_DEBRIS2, CParticle::AddParticle(PARTICLE_DEBRIS2,
pos2, pos2,
CVector( CVector(
0.0, 0.0f,
0.0, 0.0f,
0.0099999998 0.01f
), NULL, 0.0f, 0, 0, 0, 0); ), NULL, 0.0f, 0, 0, 0, 0);
} }
} }
@ -293,45 +288,40 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4)
RwV3d zero; RwV3d zero;
frame = GetNodeFrame(nodeId); frame = GetNodeFrame(nodeId);
if (frame) if (frame) {
{ if (CGame::nastyGame) {
if (CGame::nastyGame)
{
if (nodeId != PED_HEAD) if (nodeId != PED_HEAD)
CPed::SpawnFlyingComponent(nodeId, arg4); CPed::SpawnFlyingComponent(nodeId, arg4);
RecurseFrameChildrenVisibilityCB(frame, 0); RecurseFrameChildrenVisibilityCB(frame, 0);
zero.x = 0.0; zero.x = 0.0f;
zero.z = 0.0; zero.z = 0.0f;
zero.y = 0.0; zero.y = 0.0f;
for (fp = RwFrameGetParent(frame); fp; fp = RwFrameGetParent(frame)) for (fp = RwFrameGetParent(frame); fp; fp = RwFrameGetParent(frame))
RwV3dTransformPoints(&zero, &zero, 1, &fp->modelling); RwV3dTransformPoints(&zero, &zero, 1, &fp->modelling);
if (CEntity::GetIsOnScreen()) if (CEntity::GetIsOnScreen()) {
{
CParticle::AddParticle(PARTICLE_TEST, zero, CParticle::AddParticle(PARTICLE_TEST, zero,
CVector( CVector(
0.0, 0.0f,
0.0, 0.0f,
0.0 0.0f
), NULL, 0.2f, 0, 0, 0, 0); ), NULL, 0.2f, 0, 0, 0, 0);
for (int i = 0; i < 0x10; i++) { for (int i = 0; i < 16; i++) {
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, CParticle::AddParticle(PARTICLE_BLOOD_SMALL,
zero, zero,
CVector( CVector(
0.0, 0.0f,
0.0, 0.0f,
0.03 0.03f
), NULL, 0.0f, 0, 0, 0, 0); ), NULL, 0.0f, 0, 0, 0, 0);
} }
} }
m_ped_flagC20 = 1; m_ped_flagC20 = 1;
m_bodyPartBleeding = nodeId; m_bodyPartBleeding = nodeId;
} }
} } else {
else
{
printf("Trying to remove ped component"); printf("Trying to remove ped component");
} }
} }
@ -341,7 +331,7 @@ CPed::SetPedAtomicVisibilityCB(RwObject *object, void *data)
{ {
RwObject *result = object; RwObject *result = object;
if (!data) if (!data)
object->flags = 0; RpAtomicSetFlags(object, 0);
return result; return result;
} }
@ -357,18 +347,16 @@ CPed::RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data)
void void
CPed::SetLookFlag(CPed *to, bool set) CPed::SetLookFlag(CPed *to, bool set)
{ {
if (m_lookTimer < CTimer::GetTimeInMilliseconds()) if (m_lookTimer < CTimer::GetTimeInMilliseconds()) {
{
m_ped_flagA10 = 1; m_ped_flagA10 = 1;
m_ped_flagA40 = 0; m_ped_flagA40 = 0;
m_pPedFight = to; m_pPedFight = to;
m_pPedFight->RegisterReference((CEntity**)&m_pPedFight); m_pPedFight->RegisterReference((CEntity**)&m_pPedFight);
m_fLookDirection = 999999; m_fLookDirection = 999999.0f;
m_lookTimer = 0; m_lookTimer = 0;
m_ped_flagA20_look = set; m_ped_flagA20_look = set;
if (m_nPedState != PED_DRIVING) { if (m_nPedState != PED_DRIVING) {
// Resets second right most bit m_pedIK.m_flags &= ~(1 << 2);
m_pedIK.m_flags &= 0xFFFFFFFD;
} }
} }
} }
@ -376,8 +364,7 @@ CPed::SetLookFlag(CPed *to, bool set)
void void
CPed::SetLookFlag(float angle, bool set) CPed::SetLookFlag(float angle, bool set)
{ {
if (m_lookTimer < CTimer::GetTimeInMilliseconds()) if (m_lookTimer < CTimer::GetTimeInMilliseconds()) {
{
m_ped_flagA10 = 1; m_ped_flagA10 = 1;
m_ped_flagA40 = 0; m_ped_flagA40 = 0;
m_pPedFight = 0; m_pPedFight = 0;
@ -385,12 +372,47 @@ CPed::SetLookFlag(float angle, bool set)
m_lookTimer = 0; m_lookTimer = 0;
m_ped_flagA20_look = set; m_ped_flagA20_look = set;
if (m_nPedState != PED_DRIVING) { if (m_nPedState != PED_DRIVING) {
// Resets second right most bit m_pedIK.m_flags &= ~(1 << 2);
m_pedIK.m_flags &= 0xFFFFFFFD;
} }
} }
} }
void
CPed::SetLookTimer(int time)
{
if (CTimer::GetTimeInMilliseconds() > m_lookTimer) {
m_lookTimer = CTimer::GetTimeInMilliseconds() + time;
}
}
bool
CPed::OurPedCanSeeThisOne(CEntity* who)
{
float xDiff;
float yDiff;
float distance;
CColPoint colpoint;
CEntity* ent;
CVector ourPos;
CVector itsPos;
ourPos = this->GetPosition();
itsPos = who->GetPosition();
xDiff = itsPos.x - ourPos.x;
yDiff = itsPos.y - ourPos.y;
if ((yDiff * this->GetUp().y) + (xDiff * this->GetUp().x) < 0.0f)
return 0;
distance = sqrt(yDiff * yDiff + xDiff * xDiff);
if (distance < 40.0f)
return 0;
ourPos.z += 1.0f;
return CWorld::ProcessLineOfSight(ourPos, itsPos, colpoint, ent, 1, 0, 0, 0, 0, 0, 0) == 0;
}
STARTPATCHES STARTPATCHES
InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP); InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP);
@ -399,4 +421,6 @@ STARTPATCHES
InjectHook(0x4EAEE0, &CPed::RemoveBodyPart, PATCH_JUMP); InjectHook(0x4EAEE0, &CPed::RemoveBodyPart, PATCH_JUMP);
InjectHook(0x4C6460, (void (CPed::*)(CPed*, bool)) &CPed::SetLookFlag, PATCH_JUMP); InjectHook(0x4C6460, (void (CPed::*)(CPed*, bool)) &CPed::SetLookFlag, PATCH_JUMP);
InjectHook(0x4C63E0, (void (CPed::*)(float, bool)) &CPed::SetLookFlag, PATCH_JUMP); InjectHook(0x4C63E0, (void (CPed::*)(float, bool)) &CPed::SetLookFlag, PATCH_JUMP);
InjectHook(0x4D12E0, &CPed::SetLookTimer, PATCH_JUMP);
InjectHook(0x4C5700, &CPed::OurPedCanSeeThisOne, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -2,9 +2,12 @@
#include "Physical.h" #include "Physical.h"
#include "Weapon.h" #include "Weapon.h"
#include "PathFind.h"
#include "PedIK.h" #include "PedIK.h"
#include <animation\AnimManager.h> #include "AnimManager.h"
#include <animation\AnimBlendClumpData.h> #include "AnimBlendClumpData.h"
#include "PedStat.h"
#include "Sounds.h"
enum { enum {
PED_MAX_WEAPONS = 13 PED_MAX_WEAPONS = 13
@ -162,7 +165,9 @@ public:
uint8 m_ped_flagI20 : 1; uint8 m_ped_flagI20 : 1;
uint8 m_ped_flagI40 : 1; uint8 m_ped_flagI40 : 1;
uint8 m_ped_flagI80 : 1; uint8 m_ped_flagI80 : 1;
uint8 stuff10[60]; uint8 stuff10[15];
int32 m_field_16C;
uint8 stuff12[44];
int32 m_pEventEntity; int32 m_pEventEntity;
float m_fAngleToEvent; float m_fAngleToEvent;
AnimBlendFrameData *m_pFrames[PED_NODE_MAX]; AnimBlendFrameData *m_pFrames[PED_NODE_MAX];
@ -172,7 +177,7 @@ public:
CVector m_vecOffsetSeek; CVector m_vecOffsetSeek;
CPedIK m_pedIK; CPedIK m_pedIK;
uint8 stuff1[8]; uint8 stuff1[8];
int32 m_nPedStateTimer; uint32 m_nPedStateTimer;
int32 m_nPedState; int32 m_nPedState;
int32 m_nLastPedState; int32 m_nLastPedState;
int32 m_nMoveState; int32 m_nMoveState;
@ -186,8 +191,8 @@ public:
bool bInVehicle; bool bInVehicle;
uint8 stuff4[23]; uint8 stuff4[23];
int32 m_nPedType; int32 m_nPedType;
PedStat *m_pedStats;
uint8 stuff5[28]; uint8 stuff5[24];
CEntity *m_pCollidingEntity; CEntity *m_pCollidingEntity;
uint8 stuff6[12]; uint8 stuff6[12];
CWeapon m_weapons[PED_MAX_WEAPONS]; CWeapon m_weapons[PED_MAX_WEAPONS];
@ -205,7 +210,9 @@ public:
uint32 m_lookTimer; uint32 m_lookTimer;
uint8 stuff9[34]; uint8 stuff9[34];
uint8 m_bodyPartBleeding; 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 new(size_t);
static void operator delete(void*, size_t); static void operator delete(void*, size_t);
@ -215,19 +222,21 @@ public:
void AddWeaponModel(int id); void AddWeaponModel(int id);
void AimGun(); void AimGun();
void KillPedWithCar(CVehicle *veh, float impulse); void KillPedWithCar(CVehicle *veh, float impulse);
void Say(uint16 audio); void Say(eSound audio);
void SetLookFlag(CPed *to, bool set); void SetLookFlag(CPed *to, bool set);
void SetLookFlag(float angle, bool set); void SetLookFlag(float angle, bool set);
void SetLookTimer(int time);
void SetDie(AnimationId anim, float arg1, float arg2); void SetDie(AnimationId anim, float arg1, float arg2);
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer); void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
void RemoveBodyPart(PedNode nodeId, char arg4); void RemoveBodyPart(PedNode nodeId, char arg4);
void SpawnFlyingComponent(int, signed char); void SpawnFlyingComponent(int, signed char);
bool OurPedCanSeeThisOne(CEntity* who);
static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data); static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data);
static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data); static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data);
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
RwFrame* GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } RwFrame* GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; }
static Bool &bNastyLimbsCheat; static Bool &bNastyLimbsCheat;
static Bool &bPedCheat2; static Bool &bPedCheat2;
static Bool &bPedCheat3; 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_currentWeapon) == 0x498, "CPed: error");
static_assert(offsetof(CPed, m_lookTimer) == 0x4CC, "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_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"); static_assert(sizeof(CPed) == 0x53C, "CPed: error");

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include <common.h> #include "common.h"
struct LimbOrientation struct LimbOrientation
{ {

View File

@ -5,7 +5,39 @@
class CPlayerPed : public CPed class CPlayerPed : public CPed
{ {
public: public:
// All credits goes to DK22Pac
// 0x53C // 0x53C
uint8 stuff[180]; int *m_pWanted; // CWanted *
int *m_pArrestingCop; // CCopPed *m_pArrestingCop;
float m_fMoveSpeed;
float m_fCurrentStamina;
float m_fMaxStamina;
float m_fStaminaProgress;
char m_bWeaponSlot;
uint8 m_bSpeedTimerFlag;
bool m_bShouldEvade;
char field_1367;
uint32 m_nSpeedTimer;
uint32 m_nShotDelay;
float field_1376;
char field_1380;
char field_1381;
char field_1382;
char field_1383;
CEntity *m_pEvadingFrom;
int m_nTargettableObjects[4];
bool m_bAdrenalineActive;
bool m_bHasLockOnTarget;
char field_1406;
char field_1407;
uint32 m_bAdrenalineTime;
bool m_bCanBeDamaged;
char field_1413;
char field_1414;
char field_1415;
CVector field_1416[6];
int field_1488[6];
float field_1512;
float m_fFPSMoveHeading;
}; };
static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error"); static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error");