1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
#pragma once
#include "Physical.h"
#include "Weapon.h"
#include "PedStats.h"
#include "PedType.h"
#include "PedIK.h"
#include "AnimManager.h"
#include "AnimBlendClumpData.h"
#include "AnimBlendAssociation.h"
#include "WeaponInfo.h"
struct CPathNode;
enum {
VEHICLE_ENTER_FRONT_RIGHT = 11,
VEHICLE_ENTER_REAR_RIGHT = 12,
VEHICLE_ENTER_FRONT_LEFT = 15,
VEHICLE_ENTER_REAR_LEFT = 16,
};
enum PedLineUpPhase {
LINE_UP_TO_CAR_START,
LINE_UP_TO_CAR_END,
LINE_UP_TO_CAR_2
};
enum PedOnGroundState {
NO_PED,
PED_BELOW_PLAYER,
PED_ON_THE_FLOOR,
PED_DEAD_ON_THE_FLOOR
};
enum PedState
{
PED_NONE,
PED_IDLE,
PED_LOOK_ENTITY,
PED_LOOK_HEADING,
PED_WANDER_RANGE,
PED_WANDER_PATH,
PED_SEEK_POS,
PED_SEEK_ENTITY,
PED_FLEE_POS,
PED_FLEE_ENTITY,
PED_PURSUE,
PED_FOLLOW_PATH,
PED_SNIPER_MODE,
PED_ROCKET_ODE,
PED_DUMMY,
PED_PAUSE,
PED_ATTACK,
PED_FIGHT,
PED_FACE_PHONE,
PED_MAKE_CALL,
PED_CHAT,
PED_MUG,
PED_AIM_GUN,
PED_AI_CONTROL,
PED_SEEK_CAR,
PED_SEEK_IN_BOAT,
PED_FOLLOW_ROUTE,
PED_CPR,
PED_SOLICIT,
PED_BUY_ICECREAM,
PED_INVESTIGATE,
PED_STEP_AWAY,
PED_ON_FIRE,
PED_UNKNOWN, // HANG_OUT in Fire_Head's idb
PED_STATES_NO_AI,
PED_JUMP,
PED_FALL,
PED_GETUP,
PED_STAGGER,
PED_DIVE_AWAY,
PED_STATES_NO_ST,
PED_ENTER_TRAIN,
PED_EXIT_TRAIN,
PED_ARREST_PLAYER,
PED_DRIVING,
PED_PASSENGER,
PED_TAXI_PASSENGER,
PED_OPEN_DOOR,
PED_DIE,
PED_DEAD,
PED_CARJACK,
PED_DRAG_FROM_CAR,
PED_ENTER_CAR,
PED_STEAL_CAR,
PED_EXIT_CAR,
PED_HANDS_UP,
PED_ARRESTED,
};
enum {
PEDMOVE_NONE,
PEDMOVE_STILL,
PEDMOVE_WALK,
PEDMOVE_RUN,
PEDMOVE_SPRINT,
};
class CVehicle;
class CPed : public CPhysical
{
public:
// 0x128
CStoredCollPoly m_collPoly;
float m_fCollisionSpeed;
uint8 m_ped_flagA1 : 1;
uint8 m_ped_flagA2 : 1;
uint8 m_ped_flagA4 : 1; // stores (CTimer::GetTimeInMilliseconds() < m_lastHitTime)
uint8 bIsPointingGunAt : 1;
uint8 bIsLooking : 1;
uint8 m_ped_flagA20 : 1; // "look" method? - probably missing in SA
uint8 bIsRestoringLook : 1;
uint8 bIsAimingGun : 1;
uint8 bIsRestoringGun : 1;
uint8 bCanPointGunAtTarget : 1;
uint8 m_ped_flagB4 : 1;
uint8 m_ped_flagB8 : 1;
uint8 m_ped_flagB10 : 1;
uint8 m_ped_flagB20 : 1;
uint8 m_ped_flagB40 : 1;
uint8 m_ped_flagB80 : 1;
uint8 m_ped_flagC1 : 1;
uint8 m_ped_flagC2 : 1;
uint8 m_ped_flagC4 : 1;
uint8 m_ped_flagC8 : 1;
uint8 m_ped_flagC10 : 1;
uint8 m_ped_flagC20 : 1; // just left some body part?
uint8 m_ped_flagC40 : 1;
uint8 m_ped_flagC80 : 1;
uint8 m_ped_flagD1 : 1;
uint8 m_ped_flagD2 : 1;
uint8 m_ped_flagD4 : 1;
uint8 m_ped_flagD8 : 1;
uint8 m_ped_flagD10 : 1;
uint8 m_ped_flagD20 : 1;
uint8 m_ped_flagD40 : 1;
uint8 m_ped_flagD80 : 1;
uint8 m_ped_flagE1 : 1;
uint8 m_ped_flagE2 : 1;
uint8 m_ped_flagE4 : 1;
uint8 m_ped_flagE8 : 1; // can duck?
uint8 m_ped_flagE10 : 1; // can't attack if it's set
uint8 m_ped_flagE20 : 1;
uint8 m_ped_flagE40 : 1;
uint8 m_ped_flagE80 : 1;
uint8 m_ped_flagF1 : 1;
uint8 m_ped_flagF2 : 1;
uint8 m_ped_flagF4 : 1;
uint8 m_ped_flagF8 : 1;
uint8 m_ped_flagF10 : 1;
uint8 m_ped_flagF20 : 1;
uint8 m_ped_flagF40 : 1;
uint8 m_ped_flagF80 : 1;
uint8 m_ped_flagG1 : 1;
uint8 m_ped_flagG2 : 1;
uint8 m_ped_flagG4 : 1;
uint8 m_ped_flagG8 : 1;
uint8 m_ped_flagG10 : 1;
uint8 m_ped_flagG20 : 1;
uint8 m_ped_flagG40 : 1;
uint8 m_ped_flagG80 : 1;
uint8 m_ped_flagH1 : 1;
uint8 m_ped_flagH2 : 1;
uint8 m_ped_flagH4 : 1;
uint8 m_ped_flagH8 : 1;
uint8 m_ped_flagH10 : 1;
uint8 m_ped_flagH20 : 1;
uint8 m_ped_flagH40 : 1;
uint8 m_ped_flagH80 : 1;
uint8 m_ped_flagI1 : 1;
uint8 m_ped_flagI2 : 1;
uint8 m_ped_flagI4 : 1;
uint8 bRecordedForReplay : 1;
uint8 m_ped_flagI10 : 1;
uint8 m_ped_flagI20 : 1;
uint8 m_ped_flagI40 : 1;
uint8 m_ped_flagI80 : 1;
uint8 stuff10[15];
CPed *m_field_16C;
uint8 stuff12[44];
int32 m_pEventEntity;
float m_fAngleToEvent;
AnimBlendFrameData *m_pFrames[PED_NODE_MAX];
AssocGroupId m_animGroup;
CAnimBlendAssociation *m_pVehicleAnim;
CVector2D m_vecAnimMoveDelta;
CVector m_vecOffsetSeek;
CPedIK m_pedIK;
uint8 stuff1[8];
uint32 m_nPedStateTimer;
PedState m_nPedState;
PedState m_nLastPedState;
int32 m_nMoveState;
int32 m_nStoredActionState;
int32 m_nPrevActionState;
int32 m_nWaitState;
int32 m_nWaitTimer;
private:
uint32 stuff0[28];
public:
uint16 m_nPathNodes;
uint8 m_nCurPathNode;
int8 m_nPathState;
private:
int8 _pad2B5[3];
public:
CPathNode *m_pNextPathNode;
CPathNode *m_pLastPathNode;
float m_fHealth;
float m_fArmour;
uint8 stuff2[20];
float m_fRotationCur;
float m_fRotationDest;
uint32 m_headingRate;
uint16 m_vehEnterType;
uint16 m_walkAroundType;
CEntity *m_pCurrentPhysSurface;
CVector m_vecOffsetFromPhysSurface;
CEntity *m_pCurSurface;
uint8 stuff3[12];
CPed *m_pSeekTarget;
CVehicle *m_pMyVehicle;
bool bInVehicle;
uint8 stuff4[23];
int32 m_nPedType;
CPedStats *m_pedStats;
uint8 stuff5[24];
CEntity *m_pCollidingEntity;
uint8 stuff6[12];
CWeapon m_weapons[NUM_PED_WEAPONTYPES];
eWeaponType m_storedWeapon;
uint8 m_currentWeapon; // eWeaponType
uint8 m_maxWeaponTypeAllowed; // eWeaponType
uint8 stuff[2];
int32 m_pPointGunAt;
CVector m_vecHitLastPos;
uint8 stuff8[12];
CEntity *m_pLookTarget;
float m_fLookDirection;
int32 m_wepModelID;
uint32 m_leaveCarTimer;
uint32 m_getUpTimer;
uint32 m_lookTimer;
uint32 m_standardTimer;
uint32 m_attackTimer;
uint32 m_lastHitTime;
uint32 m_hitRecoverTimer;
uint32 field_4E0;
uint32 m_duckTimer;
uint8 stuff9[10];
uint8 m_bodyPartBleeding; // PedNode
uint8 m_field_4F3;
CPed *m_nearPeds[10];
uint16 m_numNearPeds;
uint8 stuff11[30];
static void *operator new(size_t);
static void operator delete(void*, size_t);
bool IsPlayer(void);
bool UseGroundColModel(void);
bool CanSetPedState(void);
void AddWeaponModel(int id);
void AimGun(void);
void KillPedWithCar(CVehicle *veh, float impulse);
void Say(uint16 audio);
void SetLookFlag(CPed *target, bool unknown);
void SetLookFlag(float direction, bool unknown);
void SetLookTimer(int time);
void SetDie(AnimationId anim, float arg1, float arg2);
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
void RemoveBodyPart(PedNode nodeId, int8 unknown);
void SpawnFlyingComponent(int, int8 unknown);
bool OurPedCanSeeThisOne(CEntity *target);
void Avoid(void);
void Attack(void);
void ClearAimFlag(void);
void ClearLookFlag(void);
void RestorePreviousState(void);
void ClearAttack(void);
bool IsPedHeadAbovePos(float zOffset);
void RemoveWeaponModel(int modelId);
void SetCurrentWeapon(eWeaponType weaponType);
bool SelectGunIfArmed(void);
void Duck(void);
void ClearDuck(void);
void ClearPointGunAt(void);
void BeingDraggedFromCar(void);
void RestartNonPartialAnims(void);
void LineUpPedWithCar(PedLineUpPhase phase);
void SetPedPositionInCar(void);
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
static void GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float seatPosMult);
static void GetPositionToOpenCarDoor(CVector* output, CVehicle* veh, uint32 enterType);
static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data);
static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data);
static void FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg);
static void PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg);
static void PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *dragAssoc, void *arg);
static void PedSetDraggedOutCarPositionCB(CAnimBlendAssociation *dragAssoc, void *arg);
bool HasWeapon(eWeaponType weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; }
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; }
static CVector &offsetToOpenRegularCarDoor;
static CVector &offsetToOpenLowCarDoor;
static CVector &offsetToOpenVanDoor;
static bool &bNastyLimbsCheat;
static bool &bPedCheat2;
static bool &bPedCheat3;
};
static_assert(offsetof(CPed, m_nPedState) == 0x224, "CPed: error");
static_assert(offsetof(CPed, m_pCurSurface) == 0x2FC, "CPed: error");
static_assert(offsetof(CPed, m_pMyVehicle) == 0x310, "CPed: error");
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(offsetof(CPed, m_field_16C) == 0x16C, "CPed: error");
static_assert(offsetof(CPed, m_pEventEntity) == 0x19C, "CPed: error");
static_assert(sizeof(CPed) == 0x53C, "CPed: error");
|