re3-wiiu/src/peds/Ped.h

1120 lines
32 KiB
C
Raw Normal View History

2019-05-15 16:52:37 +02:00
#pragma once
#include "RwHelper.h"
2020-04-19 18:34:08 +02:00
#include "AnimManager.h"
#include "Crime.h"
#include "EventList.h"
#include "PedIK.h"
#include "PedStats.h"
2019-05-15 16:52:37 +02:00
#include "Physical.h"
#include "Weapon.h"
#include "WeaponInfo.h"
2020-06-05 22:13:31 +02:00
#include "AnimationId.h"
2020-06-13 22:39:14 +02:00
#include "PathFind.h"
2019-06-16 23:12:14 +02:00
2020-03-07 20:22:43 +01:00
#define FEET_OFFSET 1.04f
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
2019-09-16 19:32:58 +02:00
class CAccident;
2019-11-05 00:04:26 +01:00
class CObject;
2020-03-28 15:47:52 +01:00
class CFire;
struct AnimBlendFrameData;
class CAnimBlendAssociation;
2020-05-13 10:38:05 +02:00
class CPedAttractor;
2020-03-07 20:22:43 +01:00
struct PedAudioData
2019-07-28 19:39:39 +02:00
{
int m_nFixedDelayTime;
int m_nOverrideFixedDelayTime;
int m_nOverrideMaxRandomDelayTime;
int m_nMaxRandomDelayTime;
};
2019-10-06 23:39:25 +02:00
enum eFormation
{
2019-10-07 00:13:18 +02:00
FORMATION_UNDEFINED,
2019-10-06 23:39:25 +02:00
FORMATION_REAR,
FORMATION_REAR_LEFT,
FORMATION_REAR_RIGHT,
FORMATION_FRONT_LEFT,
FORMATION_FRONT_RIGHT,
FORMATION_LEFT,
FORMATION_RIGHT,
FORMATION_FRONT
};
2019-09-03 18:53:04 +02:00
enum FightState : int8 {
FIGHTSTATE_MOVE_FINISHED = -2,
FIGHTSTATE_JUST_ATTACKED,
FIGHTSTATE_NO_MOVE,
FIGHTSTATE_1
};
2019-08-05 15:07:10 +02:00
enum
{
ENDFIGHT_NORMAL,
ENDFIGHT_WITH_A_STEP,
ENDFIGHT_FAST
};
2019-08-13 00:30:31 +02:00
enum PedRouteType
{
PEDROUTE_STOP_WHEN_DONE = 1,
PEDROUTE_GO_BACKWARD_WHEN_DONE,
PEDROUTE_GO_TO_START_WHEN_DONE
};
2019-10-30 00:37:05 +01:00
enum FightMoveHitLevel
{
HITLEVEL_NULL,
HITLEVEL_GROUND,
HITLEVEL_LOW,
HITLEVEL_MEDIUM,
HITLEVEL_HIGH
};
struct FightMove
{
AnimationId animId;
float startFireTime;
float endFireTime;
float comboFollowOnTime;
float strikeRadius;
float extendReachMultiplier;
2019-10-30 00:37:05 +01:00
uint8 hitLevel; // FightMoveHitLevel
uint8 damage;
uint8 flags;
};
2020-03-07 20:22:43 +01:00
// TODO: This is eFightState on mobile.
enum PedFightMoves
{
FIGHTMOVE_NULL,
2019-07-28 19:39:39 +02:00
// Attacker
FIGHTMOVE_STDPUNCH,
FIGHTMOVE_IDLE,
FIGHTMOVE_SHUFFLE_F,
FIGHTMOVE_KNEE,
FIGHTMOVE_PUNCHHOOK,
FIGHTMOVE_PUNCHJAB,
FIGHTMOVE_PUNCH,
FIGHTMOVE_BODYBLOW = FIGHTMOVE_PUNCH,
FIGHTMOVE_LONGKICK,
FIGHTMOVE_ROUNDHOUSE,
// Directionals
FIGHTMOVE_FWDLEFT,
FIGHTMOVE_FWDRIGHT,
FIGHTMOVE_BACKKICK,
FIGHTMOVE_BACKFLIP,
FIGHTMOVE_BACKLEFT,
FIGHTMOVE_BACKRIGHT,
FIGHTMOVE_RIGHTSWEEP,
// Special
FIGHTMOVE_GROUNDKICK,
2019-07-28 19:39:39 +02:00
// Opponent
FIGHTMOVE_HITFRONT,
FIGHTMOVE_HITBACK,
FIGHTMOVE_HITRIGHT,
FIGHTMOVE_HITLEFT,
FIGHTMOVE_HITBODY,
FIGHTMOVE_HITCHEST,
FIGHTMOVE_HITHEAD,
FIGHTMOVE_HITBIGSTEP,
FIGHTMOVE_HITONFLOOR,
FIGHTMOVE_HITBEHIND,
FIGHTMOVE_MELEE1,
FIGHTMOVE_MELEE2,
FIGHTMOVE_MELEE3,
2019-10-30 00:37:05 +01:00
FIGHTMOVE_IDLE2NORM,
NUM_FIGHTMOVES
};
enum ePedPieceTypes
{
PEDPIECE_TORSO,
PEDPIECE_MID,
PEDPIECE_LEFTARM,
PEDPIECE_RIGHTARM,
PEDPIECE_LEFTLEG,
PEDPIECE_RIGHTLEG,
PEDPIECE_HEAD,
};
enum eWaitState {
WAITSTATE_FALSE,
WAITSTATE_TRAFFIC_LIGHTS,
WAITSTATE_CROSS_ROAD,
WAITSTATE_CROSS_ROAD_LOOK,
WAITSTATE_LOOK_PED,
WAITSTATE_LOOK_SHOP,
WAITSTATE_LOOK_ACCIDENT,
WAITSTATE_FACEOFF_GANG,
WAITSTATE_DOUBLEBACK,
WAITSTATE_HITWALL,
WAITSTATE_TURN180,
WAITSTATE_SURPRISE,
WAITSTATE_STUCK,
WAITSTATE_LOOK_ABOUT,
WAITSTATE_PLAYANIM_DUCK,
WAITSTATE_PLAYANIM_COWER,
WAITSTATE_PLAYANIM_TAXI,
WAITSTATE_PLAYANIM_HANDSUP,
WAITSTATE_PLAYANIM_HANDSCOWER,
WAITSTATE_PLAYANIM_CHAT,
2020-05-14 12:46:11 +02:00
WAITSTATE_FINISH_FLEE,
WAITSTATE_SIT_DOWN,
WAITSTATE_SIT_DOWN_RVRS,
WAITSTATE_SIT_UP,
WAITSTATE_SIT_IDLE,
WAITSTATE_USE_ATM,
WAITSTATE_SUN_BATHE_PRE,
WAITSTATE_SUN_BATHE_DOWN,
WAITSTATE_SUN_BATHE_IDLE,
WAITSTATE_RIOT,
WAITSTATE_FAST_FALL,
WAITSTATE_BOMBER,
WAITSTATE_STRIPPER,
WAITSTATE_GROUND_ATTACK,
WAITSTATE_LANCESITTING,
WAITSTATE_PLAYANIM_HANDSUP_SIMPLE,
};
enum eObjective : uint32 {
OBJECTIVE_NONE,
OBJECTIVE_WAIT_ON_FOOT,
OBJECTIVE_WAIT_ON_FOOT_FOR_COP,
OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE,
OBJECTIVE_GUARD_SPOT,
OBJECTIVE_GUARD_AREA,
OBJECTIVE_WAIT_IN_CAR,
OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT,
OBJECTIVE_KILL_CHAR_ON_FOOT,
OBJECTIVE_KILL_CHAR_ANY_MEANS,
OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE,
OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS,
OBJECTIVE_GOTO_CHAR_ON_FOOT,
2020-06-07 11:45:53 +02:00
OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING,
OBJECTIVE_HASSLE_CHAR,
OBJECTIVE_FOLLOW_CHAR_IN_FORMATION,
OBJECTIVE_LEAVE_CAR,
OBJECTIVE_ENTER_CAR_AS_PASSENGER,
OBJECTIVE_ENTER_CAR_AS_DRIVER,
OBJECTIVE_FOLLOW_CAR_IN_CAR,
OBJECTIVE_FIRE_AT_OBJECT_FROM_VEHICLE,
OBJECTIVE_DESTROY_OBJECT,
OBJECTIVE_DESTROY_CAR,
OBJECTIVE_GOTO_AREA_ANY_MEANS,
OBJECTIVE_GOTO_AREA_ON_FOOT,
OBJECTIVE_RUN_TO_AREA,
OBJECTIVE_GOTO_AREA_IN_CAR,
OBJECTIVE_FOLLOW_CAR_ON_FOOT_WITH_OFFSET,
OBJECTIVE_GUARD_ATTACK,
OBJECTIVE_SET_LEADER,
OBJECTIVE_FOLLOW_ROUTE,
OBJECTIVE_SOLICIT_VEHICLE,
OBJECTIVE_HAIL_TAXI,
OBJECTIVE_CATCH_TRAIN,
OBJECTIVE_BUY_ICE_CREAM,
OBJECTIVE_STEAL_ANY_CAR,
2020-06-07 11:45:53 +02:00
OBJECTIVE_STEAL_ANY_MISSION_CAR,
OBJECTIVE_MUG_CHAR,
2020-05-13 10:38:05 +02:00
OBJECTIVE_LEAVE_CAR_AND_DIE,
OBJECTIVE_GOTO_SEAT_ON_FOOT,
OBJECTIVE_GOTO_ATM_ON_FOOT,
2020-05-17 20:43:11 +02:00
OBJECTIVE_FLEE_CAR,
2020-06-07 11:45:53 +02:00
OBJECTIVE_SUN_BATHE,
OBJECTIVE_GOTO_BUS_STOP_ON_FOOT,
OBJECTIVE_GOTO_PIZZA_ON_FOOT,
OBJECTIVE_GOTO_SHELTER_ON_FOOT,
OBJECTIVE_AIM_GUN_AT,
2020-06-07 11:45:53 +02:00
OBJECTIVE_WANDER,
OBJECTIVE_WAIT_ON_FOOT_AT_SHELTER,
OBJECTIVE_SPRINT_TO_AREA,
2020-06-07 11:45:53 +02:00
OBJECTIVE_KILL_CHAR_ON_BOAT,
OBJECTIVE_SOLICIT_FOOT,
OBJECTIVE_WAIT_ON_FOOT_AT_BUS_STOP,
OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT,
OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN,
2020-05-13 10:38:05 +02:00
OBJ_55,
OBJ_56,
OBJ_57,
OBJ_58,
OBJ_59
};
enum {
2019-07-05 14:23:39 +02:00
RANDOM_CHAR = 1,
MISSION_CHAR,
2020-06-03 15:16:31 +02:00
TODO_CHAR, // TODO(Miami)
};
enum PedLineUpPhase {
LINE_UP_TO_CAR_START,
LINE_UP_TO_CAR_END,
2020-06-05 22:13:31 +02:00
LINE_UP_TO_CAR_2, // Buggy. Used for cops arresting you from passenger door
LINE_UP_TO_CAR_FALL
};
enum PedOnGroundState {
NO_PED,
2019-08-05 15:07:10 +02:00
PED_IN_FRONT_OF_ATTACKER,
PED_ON_THE_FLOOR,
PED_DEAD_ON_THE_FLOOR
};
2020-03-02 01:03:39 +01:00
enum PointBlankNecessity : uint8 {
NO_POINT_BLANK_PED,
POINT_BLANK_FOR_WANTED_PED,
POINT_BLANK_FOR_SOMEONE_ELSE
};
2019-05-28 08:39:36 +02:00
enum PedState
2019-05-15 16:52:37 +02:00
{
2019-05-30 14:50:54 +02:00
PED_NONE,
2019-05-28 08:39:36 +02:00
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,
2020-06-03 15:16:31 +02:00
PED_ROCKET_MODE,
2019-05-28 08:39:36 +02:00
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,
2020-06-03 15:16:31 +02:00
PED_SUN_BATHE,
PED_FLASH,
PED_JOG,
PED_ANSWER_MOBILE,
2019-05-30 14:50:54 +02:00
2019-12-02 21:02:32 +01:00
PED_UNKNOWN, // Same with IDLE, but also infects up to 5 peds with same pedType and WANDER_PATH, so they become stone too. HANG_OUT in Fire_Head's idb
2019-05-30 14:50:54 +02:00
PED_STATES_NO_AI,
2020-06-03 15:16:31 +02:00
PED_ABSEIL,
PED_SIT,
2019-05-28 08:39:36 +02:00
PED_JUMP,
PED_FALL,
PED_GETUP,
PED_STAGGER,
PED_DIVE_AWAY,
2019-05-30 14:50:54 +02:00
2019-05-28 08:39:36 +02:00
PED_STATES_NO_ST,
PED_ENTER_TRAIN,
PED_EXIT_TRAIN,
PED_ARREST_PLAYER,
2019-05-28 08:39:36 +02:00
PED_DRIVING,
PED_PASSENGER,
PED_TAXI_PASSENGER,
PED_OPEN_DOOR,
2019-07-05 14:23:39 +02:00
PED_DIE,
PED_DEAD,
2019-05-28 08:39:36 +02:00
PED_CARJACK,
PED_DRAG_FROM_CAR,
PED_ENTER_CAR,
PED_STEAL_CAR,
PED_EXIT_CAR,
PED_HANDS_UP,
2019-07-05 14:23:39 +02:00
PED_ARRESTED,
2020-06-03 15:16:31 +02:00
PED_DEPLOY_STINGER
2019-05-15 16:52:37 +02:00
};
enum eMoveState {
PEDMOVE_NONE,
PEDMOVE_STILL,
PEDMOVE_WALK,
2020-06-17 20:24:59 +02:00
PEDMOVE_JOG,
PEDMOVE_RUN,
PEDMOVE_SPRINT,
PEDMOVE_THROWN
};
2019-05-15 16:52:37 +02:00
class CVehicle;
class CPed : public CPhysical
{
public:
// 0x128
2019-05-19 21:28:10 +02:00
CStoredCollPoly m_collPoly;
float m_fCollisionSpeed;
2019-07-05 14:23:39 +02:00
// cf. https://github.com/DK22Pac/plugin-sdk/blob/master/plugin_sa/game_sa/CPed.h from R*
2020-04-18 10:31:53 +02:00
uint32 bIsStanding : 1;
2020-04-30 17:13:38 +02:00
uint32 bWasStanding : 1;
2020-04-18 10:31:53 +02:00
uint32 bIsAttacking : 1; // doesn't reset after fist fight
uint32 bIsPointingGunAt : 1;
uint32 bIsLooking : 1;
uint32 bKeepTryingToLook : 1; // if we can't look somewhere due to unreachable angles
uint32 bIsRestoringLook : 1;
uint32 bIsAimingGun : 1;
uint32 bIsRestoringGun : 1;
uint32 bCanPointGunAtTarget : 1;
uint32 bIsTalking : 1;
uint32 bIsInTheAir : 1;
uint32 bIsLanding : 1;
uint32 bIsRunning : 1; // on some conditions
uint32 bHitSomethingLastFrame : 1;
uint32 bVehEnterDoorIsBlocked : 1; // because someone else enters/exits from there
uint32 bCanPedEnterSeekedCar : 1;
uint32 bRespondsToThreats : 1;
uint32 bRenderPedInCar : 1;
uint32 bChangedSeat : 1;
uint32 bUpdateAnimHeading : 1;
uint32 bBodyPartJustCameOff : 1;
uint32 bIsShooting : 1;
uint32 bFindNewNodeAfterStateRestore : 1;
uint32 bHasACamera : 1; // does ped possess a camera to document accidents involves fire/explosion
uint32 bGonnaInvestigateEvent : 1;
uint32 bPedIsBleeding : 1;
uint32 bStopAndShoot : 1; // Ped cannot reach target to attack with fist, need to use gun
uint32 bIsPedDieAnimPlaying : 1;
uint32 bUsePedNodeSeek : 1;
uint32 bObjectiveCompleted : 1;
uint32 bScriptObjectiveCompleted : 1;
uint32 bKindaStayInSamePlace : 1;
2020-06-17 20:24:59 +02:00
uint32 bBeingChasedByPolice : 1;
2020-04-18 10:31:53 +02:00
uint32 bNotAllowedToDuck : 1;
uint32 bCrouchWhenShooting : 1;
uint32 bIsDucking : 1;
uint32 bGetUpAnimStarted : 1;
uint32 bDoBloodyFootprints : 1;
uint32 bFleeAfterExitingCar : 1;
uint32 bWanderPathAfterExitingCar : 1;
uint32 bIsLeader : 1;
uint32 bDontDragMeOutCar : 1; // unfinished feature
uint32 m_ped_flagF8 : 1;
uint32 bWillBeQuickJacked : 1;
uint32 bCancelEnteringCar : 1; // after door is opened or couldn't be opened due to it's locked
uint32 bObstacleShowedUpDuringKillObjective : 1;
uint32 bDuckAndCover : 1;
uint32 bStillOnValidPoly : 1; // set if the polygon the ped is on is still valid for collision
uint32 bAllowMedicsToReviveMe : 1;
uint32 bResetWalkAnims : 1;
uint32 bStartWanderPathOnFoot : 1; // exits the car if he's in it, reset after path found
uint32 bOnBoat : 1; // not just driver, may be just standing
uint32 bBusJacked : 1;
uint32 bGonnaKillTheCarJacker : 1; // only set when car is jacked from right door and when arrested by police
uint32 bFadeOut : 1;
uint32 bKnockedUpIntoAir : 1; // has ped been knocked up into the air by a car collision
uint32 bHitSteepSlope : 1; // has ped collided/is standing on a steep slope (surface type)
uint32 bCullExtraFarAway : 1; // special ped only gets culled if it's extra far away (for roadblocks)
uint32 bClearObjective : 1;
uint32 bTryingToReachDryLand : 1; // has ped just exited boat and trying to get to dry land
uint32 bCollidedWithMyVehicle : 1;
uint32 bRichFromMugging : 1; // ped has lots of cash cause they've been mugging people
uint32 bChrisCriminal : 1; // Is a criminal as killed during Chris' police mission (should be counted as such)
uint32 bShakeFist : 1; // test shake hand at look entity
uint32 bNoCriticalHits : 1; // if set, limbs won't came off
uint32 bVehExitWillBeInstant : 1;
uint32 bHasAlreadyBeenRecorded : 1;
uint32 bFallenDown : 1;
#ifdef PED_SKIN
uint32 bDontAcceptIKLookAts : 1; // TODO: find uses of this
#endif
uint32 bReachedAttractorHeadingTarget : 1;
uint32 bTurnedAroundOnAttractor : 1;
uint32 bHasAlreadyUsedAttractor : 1;
//uint32 b155_2
uint32 bCarPassenger : 1;
//uint32 b155_8
//uint32 b155_10
uint32 bMiamiViceCop : 1;
2020-05-21 10:22:25 +02:00
uint32 bMoneyHasBeenGivenByScript : 1; //
2020-05-22 01:42:04 +02:00
uint32 bHasBeenPhotographed : 1; //
2020-05-20 19:10:05 +02:00
uint32 bIsDrowning : 1;
2020-05-22 01:42:04 +02:00
uint32 bDrownsInWater : 1;
//uint32 b156_4
2020-05-24 15:14:27 +02:00
uint32 b156_8 : 1;
uint32 bIsPlayerFriend : 1;
#ifdef VC_PED_PORTS
uint32 bHeadStuckInCollision : 1;
#endif
uint32 bDeadPedInFrontOfCar : 1;
2020-05-22 01:42:04 +02:00
uint32 bStayInCarOnJack : 1;
2020-05-22 01:42:04 +02:00
uint32 bDontFight : 1;
uint32 bDoomAim : 1;
uint32 bCanBeShotInVehicle : 1;
//uint32 b157_8
//uint32 b157_10
//uint32 b157_20
uint32 b157_40 : 1;
2020-05-22 01:42:04 +02:00
uint32 bIgnoreThreatsBehindObjects : 1;
2020-05-22 01:42:04 +02:00
uint32 bNeverEverTargetThisPed : 1;
2020-06-07 14:49:25 +02:00
uint32 bCrouchWhenScared : 1;
uint32 bKnockedOffBike : 1;
//uint32 b158_8
uint32 b158_10 : 1;
2020-05-22 01:42:04 +02:00
uint32 bBoughtIceCream : 1;
//uint32 b158_40
//uint32 b158_80
// our own flags
2020-04-18 10:31:53 +02:00
uint32 m_ped_flagI40 : 1; // bMakePedsRunToPhonesToReportCrimes makes use of this as runover by car indicator
uint32 m_ped_flagI80 : 1; // KANGAROO_CHEAT define makes use of this as cheat toggle
2019-07-05 14:23:39 +02:00
uint8 m_gangFlags;
2019-07-05 14:23:39 +02:00
uint8 CharCreatedBy;
eObjective m_objective;
eObjective m_prevObjective;
CPed *m_pedInObjective;
CVehicle *m_carInObjective;
2019-08-13 00:30:31 +02:00
CVector m_nextRoutePointPos;
2020-05-14 12:46:11 +02:00
float m_attractorHeading;
CPed *m_leader;
2019-10-06 23:39:25 +02:00
eFormation m_pedFormation;
uint32 m_fearFlags;
CEntity *m_threatEntity;
2019-07-29 14:01:44 +02:00
CVector2D m_eventOrThreat;
uint32 m_eventType;
CEntity* m_pEventEntity;
float m_fAngleToEvent;
AnimBlendFrameData *m_pFrames[PED_NODE_MAX];
#ifdef PED_SKIN
// stored inside the clump with non-skin ped
RpAtomic *m_pWeaponModel;
#endif
AssocGroupId m_animGroup;
CAnimBlendAssociation *m_pVehicleAnim;
CVector2D m_vecAnimMoveDelta;
CVector m_vecOffsetSeek;
CPedIK m_pedIK;
float m_actionX;
float m_actionY;
uint32 m_nPedStateTimer;
PedState m_nPedState;
PedState m_nLastPedState;
eMoveState m_nMoveState;
int32 m_nStoredMoveState;
int32 m_nPrevMoveState;
eWaitState m_nWaitState;
uint32 m_nWaitTimer;
2020-06-13 22:39:14 +02:00
CPathNode* m_pathNodesToGo[8];
int16 m_nNumPathNodes;
int16 m_nCurPathNodeId;
CEntity* m_followPathWalkAroundEnt;
CEntity* m_followPathTargetEnt;
uint32 m_pathNodeTimer;
CPathNode m_pathNodeObjPool[8];
CPathNode* m_pCurPathNode;
char m_nPathDir;
CPathNode* m_pLastPathNode;
CPathNode* m_pNextPathNode;
CVector m_followPathDestPos;
float m_followPathAbortDist;
eMoveState m_followPathMoveState;
2019-06-17 00:16:38 +02:00
float m_fHealth;
float m_fArmour;
2020-05-23 19:06:52 +02:00
uint32 m_nExtendedRangeTimer;
int16 m_routeLastPoint;
2019-08-13 00:30:31 +02:00
uint16 m_routeStartPoint;
int16 m_routePointsPassed;
2019-10-06 23:39:25 +02:00
int16 m_routeType; // See PedRouteType
2019-08-13 00:30:31 +02:00
int16 m_routePointsBeingPassed;
CVector2D m_moved;
float m_fRotationCur;
float m_fRotationDest;
float m_headingRate;
uint16 m_vehEnterType;
2019-09-29 18:44:51 +02:00
int16 m_walkAroundType;
2019-11-05 00:04:26 +01:00
CPhysical *m_pCurrentPhysSurface;
2019-05-15 16:52:37 +02:00
CVector m_vecOffsetFromPhysSurface;
CEntity *m_pCurSurface;
2019-08-10 17:15:22 +02:00
CVector m_vecSeekPos;
CEntity *m_pSeekTarget;
2019-05-15 16:52:37 +02:00
CVehicle *m_pMyVehicle;
2019-06-17 00:16:38 +02:00
bool bInVehicle;
2019-08-10 17:15:22 +02:00
float m_distanceToCountSeekDone;
2020-05-14 12:46:11 +02:00
float m_acceptableHeadingOffset;
2020-05-13 10:38:05 +02:00
CPedAttractor* m_attractor;
int32 m_positionInQueue;
2020-05-08 22:29:43 +02:00
CVehicle* m_vehicleInAccident;
2019-07-29 14:01:44 +02:00
bool bRunningToPhone;
int16 m_phoneId;
2019-09-16 19:32:58 +02:00
eCrimeType m_crimeToReportOnPhone;
uint32 m_phoneTalkTimer;
2019-09-16 19:32:58 +02:00
CAccident *m_lastAccident;
2020-02-16 03:15:58 +01:00
uint32 m_nPedType;
2019-06-19 18:35:51 +02:00
CPedStats *m_pedStats;
float m_fleeFromPosX;
float m_fleeFromPosY;
CEntity *m_fleeFrom;
uint32 m_fleeTimer;
2020-06-03 15:16:31 +02:00
CEntity* pThreatEx; // TODO(Miami): What is this?
2019-08-10 17:15:22 +02:00
CEntity* m_collidingEntityWhileFleeing;
uint32 m_collidingThingTimer;
2019-05-19 21:28:10 +02:00
CEntity *m_pCollidingEntity;
uint8 m_stateUnused;
uint32 m_timerUnused;
class CRange2D *m_wanderRangeBounds;
2020-05-15 16:30:25 +02:00
CWeapon m_weapons[TOTAL_WEAPON_SLOTS];
eWeaponType m_storedWeapon;
2020-05-17 19:36:48 +02:00
eWeaponType m_delayedWeapon;
uint32 m_delayedWeaponAmmo;
uint8 m_currentWeapon; // eWeaponType
uint8 m_maxWeaponTypeAllowed; // eWeaponType
uint8 m_wepSkills;
uint8 m_wepAccuracy;
CEntity *m_pPointGunAt;
CVector m_vecHitLastPos;
2020-03-02 01:03:39 +01:00
uint32 m_lastFightMove;
2020-06-15 22:43:20 +02:00
uint32 m_lastHitState; // TODO(Miami): What's this?
uint8 m_fightButtonPressure;
2019-09-03 18:53:04 +02:00
FightState m_fightState;
2019-08-05 15:07:10 +02:00
bool m_takeAStepAfterAttack;
2020-05-20 19:10:05 +02:00
uint8 m_bleedCounter;
2019-07-29 14:01:44 +02:00
CFire *m_pFire;
2019-06-19 14:06:13 +02:00
CEntity *m_pLookTarget;
float m_fLookDirection;
int32 m_wepModelID;
uint32 m_leaveCarTimer;
uint32 m_getUpTimer;
uint32 m_lookTimer;
uint32 m_standardTimer;
uint32 m_attackTimer;
2019-09-03 18:53:04 +02:00
uint32 m_shootTimer; // shooting is a part of attack
uint32 m_hitRecoverTimer;
uint32 m_objectiveTimer;
uint32 m_duckTimer;
2019-08-02 00:04:30 +02:00
uint32 m_duckAndCoverTimer;
2020-03-07 20:22:43 +01:00
uint32 m_bloodyFootprintCountOrDeathTime; // Death time when bDoBloodyFootprints is false. Weird decision
2020-05-15 16:30:25 +02:00
uint32 m_shotTime;
2020-05-17 20:43:11 +02:00
uint32 m_ceaseAttackTimer;
2019-07-29 14:01:44 +02:00
uint8 m_panicCounter;
2019-09-03 18:53:04 +02:00
bool m_deadBleeding;
2019-10-13 06:05:08 +02:00
int8 m_bodyPartBleeding; // PedNode, but -1 if there isn't
CPed *m_nearPeds[10];
uint16 m_numNearPeds;
uint16 m_nPedMoney;
2020-05-15 16:30:25 +02:00
int8 m_lastWepDam;
CEntity *m_lastDamEntity;
CEntity *m_attachedTo;
CVector m_vecAttachOffset;
uint16 m_attachType;
float m_attachRotStep;
2020-05-15 16:30:25 +02:00
uint32 m_attachWepAmmo;
uint32 m_threatFlags;
uint32 m_threatCheck;
uint32 m_lastThreatCheck;
uint32 m_sayType;
uint32 m_sayTimer;
2019-07-29 14:01:44 +02:00
uint32 m_lastSoundStart;
uint32 m_soundStart;
2019-07-28 19:39:39 +02:00
uint16 m_lastQueuedSound;
uint16 m_queuedSound;
CVector m_vecSeekPosEx; // used for OBJECTIVE_GUARD_SPOT
float m_distanceToCountSeekDoneEx; // used for OBJECTIVE_GUARD_SPOT
2019-05-15 16:52:37 +02:00
2019-06-02 17:13:56 +02:00
static void *operator new(size_t);
static void *operator new(size_t, int);
2019-06-02 17:13:56 +02:00
static void operator delete(void*, size_t);
static void operator delete(void*, int);
2019-05-19 21:28:10 +02:00
CPed(uint32 pedType);
~CPed(void);
void SetModelIndex(uint32 mi);
void ProcessControl(void);
void Teleport(CVector);
void PreRender(void);
void Render(void);
bool SetupLighting(void);
void RemoveLighting(bool);
void FlagToDestroyWhenNextProcessed(void);
int32 ProcessEntityCollision(CEntity*, CColPoint*);
virtual void SetMoveAnim(void);
void AddWeaponModel(int id);
void AimGun(void);
2019-05-19 21:28:10 +02:00
void KillPedWithCar(CVehicle *veh, float impulse);
2019-06-16 23:12:14 +02:00
void Say(uint16 audio);
void SetLookFlag(CEntity* target, bool keepTryingToLook, bool cancelPrevious = false);
void SetLookFlag(float direction, bool keepTryingToLook, bool cancelPrevious = false);
void SetLookTimer(int time);
2020-06-05 22:13:31 +02:00
void SetDie(AnimationId anim = ANIM_KO_SHOT_FRONT1, float arg1 = 4.0f, float arg2 = 0.0f);
2019-07-09 18:50:35 +02:00
void SetDead(void);
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
void RemoveBodyPart(PedNode nodeId, int8 direction);
bool OurPedCanSeeThisOne(CEntity *target, bool shootablesDoBlock = false);
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);
2020-05-15 16:30:25 +02:00
void SetCurrentWeapon(eWeaponType weaponType);
void SetCurrentWeapon(int weapon);
void Duck(void);
void ClearDuck(bool = false);
void ClearPointGunAt(void);
void BeingDraggedFromCar(void);
void RestartNonPartialAnims(void);
void LineUpPedWithCar(PedLineUpPhase phase);
void SetPedPositionInCar(void);
void PlayFootSteps(void);
void QuitEnteringCar(void);
void BuildPedLists(void);
2020-05-15 16:30:25 +02:00
int32 GiveWeapon(eWeaponType weaponType, uint32 ammo, bool unused = false);
void CalculateNewOrientation(void);
float WorkOutHeadingForMovingFirstPerson(float);
void CalculateNewVelocity(void);
bool CanSeeEntity(CEntity*, float);
void RestorePreviousObjective(void);
void SetIdle(void);
2020-04-27 00:55:06 +02:00
#ifdef _MSC_VER
__declspec(noinline) // workaround for a compiler bug, hooray MS :P
#endif
void SetObjective(eObjective, void*);
void SetObjective(eObjective);
void SetObjective(eObjective, int16, int16);
2019-10-12 21:00:31 +02:00
void SetObjective(eObjective, CVector);
2020-05-14 12:46:11 +02:00
void SetObjective(eObjective, float, const CVector&);
void ClearChat(void);
void InformMyGangOfAttack(CEntity*);
void ReactToAttack(CEntity*);
void SetDuck(uint32, bool = false);
void RegisterThreatWithGangPeds(CEntity*);
bool TurnBody(void);
void Chat(void);
void CheckAroundForPossibleCollisions(void);
2019-07-15 14:11:40 +02:00
void SetSeek(CVector, float);
2019-08-02 00:04:30 +02:00
void SetSeek(CEntity*, float);
2019-07-15 14:11:40 +02:00
bool MakePhonecall(void);
bool FacePhone(void);
CPed *CheckForDeadPeds(void);
bool CheckForExplosions(CVector2D &area);
CPed *CheckForGunShots(void);
2020-03-02 01:03:39 +01:00
PointBlankNecessity CheckForPointBlankPeds(CPed*);
2019-07-15 14:11:40 +02:00
bool CheckIfInTheAir(void);
void ClearAll(void);
void SetPointGunAt(CEntity*);
2019-07-16 18:31:18 +02:00
bool Seek(void);
2019-07-20 23:29:58 +02:00
bool SetWanderPath(int8);
2020-05-19 19:54:05 +02:00
bool SetFollowPath(CVector dest, float radius, eMoveState state, CEntity*, CEntity*, int);
bool SetFollowPathStatic(void);
bool SetFollowPathDynamic(void);
void ClearAttackByRemovingAnim(void);
void SetStoredState(void);
void StopNonPartialAnims(void);
bool InflictDamage(CEntity*, eWeaponType, float, ePedPieceTypes, uint8);
void ClearFlee(void);
void ClearFall(void);
void SetGetUp(void);
2019-07-20 23:29:58 +02:00
void ClearInvestigateEvent(void);
void ClearLeader(void);
void ClearLook(void);
void ClearObjective(void);
void ClearPause(void);
void ClearSeek(void);
void ClearWeapons(void);
void RestoreGunPosition(void);
void RestoreHeadingRate(void);
void SetAimFlag(CEntity* to);
void SetAimFlag(float angle);
void SetAmmo(eWeaponType weaponType, uint32 ammo);
void SetEvasiveStep(CEntity*, uint8);
2019-07-25 22:34:29 +02:00
void GrantAmmo(eWeaponType, uint32);
void SetEvasiveDive(CPhysical*, uint8);
void SetAttack(CEntity*);
void StartFightAttack(uint8);
void SetWaitState(eWaitState, void*);
2020-06-15 22:43:20 +02:00
bool FightStrike(CVector&, bool);
void FightHitPed(CPed*, CVector&, CVector&, int16);
2019-08-16 20:17:15 +02:00
int GetLocalDirection(const CVector2D &);
void StartFightDefend(uint8, uint8, uint8);
void PlayHitSound(CPed*);
void SetFall(int, AnimationId, uint8);
2019-07-28 19:39:39 +02:00
void SetFlee(CEntity*, int);
2019-08-16 18:25:02 +02:00
void SetFlee(CVector2D const &, int);
2019-07-29 14:01:44 +02:00
void RemoveInCarAnims(void);
void CollideWithPed(CPed*);
void SetDirectionToWalkAroundObject(CEntity*);
2020-06-13 22:39:14 +02:00
bool SetDirectionToWalkAroundVehicle(CVehicle*);
2020-05-15 16:30:25 +02:00
void RemoveWeaponAnims(int, float);
2019-08-02 00:04:30 +02:00
void CreateDeadPedMoney(void);
void CreateDeadPedWeaponPickups(void);
2020-05-17 19:36:48 +02:00
void CreateDeadPedPickupCoors(float *x, float *y, float *z);
2019-08-02 00:04:30 +02:00
void SetAttackTimer(uint32);
void SetBeingDraggedFromCar(CVehicle*, uint32, bool);
void SetRadioStation(void);
void SetBuyIceCream(void);
void SetChat(CEntity*, uint32);
void DeadPedMakesTyresBloody(void);
void MakeTyresMuddySectorList(CPtrList&);
bool DuckAndCover(void);
2019-08-03 19:14:45 +02:00
void EndFight(uint8);
2019-08-05 15:07:10 +02:00
void EnterCar(void);
uint8 GetNearestTrainPedPosition(CVehicle*, CVector&);
uint8 GetNearestTrainDoor(CVehicle*, CVector&);
void ExitCar(void);
void Fight(void);
2019-08-23 00:44:38 +02:00
bool FindBestCoordsFromNodes(CVector, CVector*);
2019-08-08 02:21:38 +02:00
void Wait(void);
void ProcessObjective(void);
2020-06-13 22:39:14 +02:00
CVector *SeekFollowingPath(void);
2019-08-10 17:15:22 +02:00
void Flee(void);
void FollowPath(void);
CVector GetFormationPosition(void);
void GetNearestDoor(CVehicle*, CVector&);
2019-08-13 00:30:31 +02:00
bool GetNearestPassengerDoor(CVehicle*, CVector&);
int GetNextPointOnRoute(void);
uint8 GetPedRadioCategory(uint32);
int GetWeaponSlot(eWeaponType);
2020-06-19 00:10:41 +02:00
bool CanWeRunAndFireWithWeapon(void);
2019-08-13 00:30:31 +02:00
void GoToNearestDoor(CVehicle*);
2019-08-23 00:44:38 +02:00
bool HaveReachedNextPointOnRoute(float);
2019-08-13 00:30:31 +02:00
void Idle(void);
void InTheAir(void);
void SetLanding(void);
void InvestigateEvent(void);
bool IsPedDoingDriveByShooting(void);
bool IsRoomToBeCarJacked(void);
2019-08-23 00:44:38 +02:00
void SetInvestigateEvent(eEventType, CVector2D, float, uint16, float);
bool LookForInterestingNodes(void);
void LookForSexyCars(void);
void LookForSexyPeds(void);
void Mug(void);
void MoveHeadToLook(void);
void Pause(void);
2019-09-03 18:53:04 +02:00
void ProcessBuoyancy(void);
void ServiceTalking(void);
void SetJump(void);
void WanderPath(void);
void ReactToPointGun(CEntity*);
void SeekCar(void);
2019-09-13 21:04:55 +02:00
bool PositionPedOutOfCollision(void);
2019-09-16 19:32:58 +02:00
bool RunToReportCrime(eCrimeType);
bool PlacePedOnDryLand(void);
2019-09-20 21:40:33 +02:00
bool PossiblyFindBetterPosToSeekCar(CVector*, CVehicle*);
2019-09-26 23:01:50 +02:00
void UpdateFromLeader(void);
2019-10-25 01:25:11 +02:00
uint32 ScanForThreats(void);
2019-09-26 23:01:50 +02:00
void SetEnterCar(CVehicle*, uint32);
bool WarpPedToNearEntityOffScreen(CEntity*);
void SetExitCar(CVehicle*, uint32);
2019-10-06 23:39:25 +02:00
void SetFormation(eFormation);
bool WillChat(CPed*);
void SetEnterCar_AllClear(CVehicle*, uint32, uint32);
2019-10-13 06:05:08 +02:00
void SetSolicit(uint32 time);
2019-10-25 01:25:11 +02:00
void ScanForInterestingStuff(void);
2019-10-26 17:41:04 +02:00
void WarpPedIntoCar(CVehicle*);
void SetCarJack(CVehicle*);
2019-11-19 23:15:45 +01:00
bool WarpPedToNearLeaderOffScreen(void);
void Solicit(void);
2019-12-10 00:02:02 +01:00
void SetExitBoat(CVehicle*);
2020-05-15 16:30:25 +02:00
void ClearFollowPath();
void GiveDelayedWeapon(eWeaponType weapon, uint32 ammo);
void RequestDelayedWeapon();
2020-05-17 19:36:48 +02:00
void AddInCarAnims(CVehicle* car, bool isDriver);
bool CanBeDamagedByThisGangMember(CPed*);
2020-06-03 15:16:31 +02:00
void AnswerMobile(void);
void BuyIceCream(void);
void CheckThreatValidity(void);
void ClearAnswerMobile(void);
void SetAnswerMobile(void);
void AttachPedToEntity(CEntity*, CVector, uint16, float, eWeaponType);
void DettachPedFromEntity();
void PedShuffle();
void DriveVehicle();
void PositionAttachedPed();
bool CanUseTorsoWhenLooking();
// Static methods
2019-07-26 18:48:14 +02:00
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
static CVector GetPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatPosMult);
static CVector GetPositionToOpenCarDoor(CVehicle* veh, uint32 component);
2019-08-13 00:30:31 +02:00
static void Initialise(void);
static void SetAnimOffsetForEnterOrExitVehicle(void);
static void LoadFightData(void);
// Callbacks
2019-06-25 00:42:23 +02:00
static void PedGetupCB(CAnimBlendAssociation *assoc, void *arg);
static void PedStaggerCB(CAnimBlendAssociation *assoc, void *arg);
static void PedEvadeCB(CAnimBlendAssociation *assoc, void *arg);
static void FinishDieAnimCB(CAnimBlendAssociation *assoc, void *arg);
static void FinishedWaitCB(CAnimBlendAssociation *assoc, void *arg);
static void FinishLaunchCB(CAnimBlendAssociation *assoc, void *arg);
static void FinishHitHeadCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimGetInCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimDoorOpenCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimPullPedOutCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimDoorCloseCB(CAnimBlendAssociation *assoc, void *arg);
2019-09-07 00:27:07 +02:00
static void PedSetInCarCB(CAnimBlendAssociation *assoc, void *arg);
2019-06-25 00:42:23 +02:00
static void PedSetOutCarCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimAlignCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetDraggedOutCarCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimStepOutCarCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetInTrainCB(CAnimBlendAssociation *assoc, void *arg);
2020-06-17 20:24:59 +02:00
#ifdef GTA_TRAIN
static void PedSetOutTrainCB(CAnimBlendAssociation *assoc, void *arg);
#endif
2019-06-25 00:42:23 +02:00
static void FinishedAttackCB(CAnimBlendAssociation *assoc, void *arg);
2020-05-15 16:30:25 +02:00
static void FinishedReloadCB(CAnimBlendAssociation *assoc, void *arg);
2019-06-25 00:42:23 +02:00
static void FinishFightMoveCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimDoorCloseRollingCB(CAnimBlendAssociation *assoc, void *arg);
static void FinishJumpCB(CAnimBlendAssociation *assoc, void *arg);
static void PedLandCB(CAnimBlendAssociation *assoc, void *arg);
static void RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetDraggedOutCarPositionCB(CAnimBlendAssociation *assoc, void *arg);
bool IsPlayer(void);
2020-05-24 15:14:27 +02:00
bool IsFemale(void) { return m_nPedType == PEDTYPE_CIVFEMALE || m_nPedType == PEDTYPE_PROSTITUTE; }
bool UseGroundColModel(void);
bool CanSetPedState(void);
bool IsPedInControl(void);
bool CanPedDriveOff(void);
bool CanBeDeleted(void);
bool CanStrafeOrMouseControl(void);
bool CanPedReturnToState(void);
void SetMoveState(eMoveState);
bool IsTemporaryObjective(eObjective objective);
void SetObjectiveTimer(int);
bool SelectGunIfArmed(void);
bool IsPointerValid(void);
void SortPeds(CPed**, int, int);
void ForceStoredObjective(eObjective);
void SetStoredObjective(void);
void SetLeader(CEntity* leader);
void SetPedStats(ePedStats);
bool IsGangMember(void);
2019-08-02 00:04:30 +02:00
void Die(void);
2020-05-15 16:30:25 +02:00
#ifdef GTA_TRAIN
2019-08-05 15:07:10 +02:00
void EnterTrain(void);
void ExitTrain(void);
2020-05-15 16:30:25 +02:00
void SetExitTrain(CVehicle*);
void SetPedPositionInTrain(void);
void LineUpPedWithTrain(void);
void SetEnterTrain(CVehicle*, uint32);
#endif
2019-08-05 15:07:10 +02:00
void Fall(void);
bool IsPedShootable(void);
void Look(void);
2019-09-03 18:53:04 +02:00
void SetInTheAir(void);
void RestoreHeadPosition(void);
void PointGunAt(void);
2019-09-07 00:27:07 +02:00
bool ServiceTalkingWhenDead(void);
2019-09-26 23:01:50 +02:00
void SetShootTimer(uint32);
void SetSeekCar(CVehicle*, uint32);
void SetSeekBoatPosition(CVehicle*);
2019-10-06 23:39:25 +02:00
void WanderRange(void);
void SetFollowRoute(int16, int16);
void SeekBoatPosition(void);
2019-11-05 00:04:26 +01:00
void UpdatePosition(void);
CObject *SpawnFlyingComponent(int, int8);
2019-11-19 23:15:45 +01:00
void SetCarJack_AllClear(CVehicle*, uint32, uint32);
2019-09-29 18:44:51 +02:00
bool CanPedJumpThis(CEntity*, CVector*);
2020-05-13 10:38:05 +02:00
void SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float, float, int);
2020-05-14 12:46:11 +02:00
void ClearWaitState(void);
2020-05-31 19:59:01 +02:00
void Undress(const char*);
void Dress(void);
2020-05-13 10:38:05 +02:00
2020-05-16 01:10:23 +02:00
bool HasWeaponSlot(uint8 slot) { return m_weapons[slot].m_eWeaponType != WEAPONTYPE_UNARMED; }
CWeapon& GetWeapon(uint8 slot) { return m_weapons[slot]; }
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
2020-03-07 20:22:43 +01:00
2019-07-05 14:23:39 +02:00
PedState GetPedState(void) { return m_nPedState; }
2020-05-19 19:54:05 +02:00
void SetPedState(PedState state)
{
if (GetPedState() == PED_FOLLOW_PATH)
ClearFollowPath();
m_nPedState = state;
}
2020-04-15 07:03:53 +02:00
bool Dead(void) { return m_nPedState == PED_DEAD; }
bool Dying(void) { return m_nPedState == PED_DIE; }
2019-09-13 21:04:55 +02:00
bool DyingOrDead(void) { return m_nPedState == PED_DIE || m_nPedState == PED_DEAD; }
bool OnGround(void) { return m_nPedState == PED_FALL || m_nPedState == PED_DIE || m_nPedState == PED_DEAD; }
2020-04-15 07:03:53 +02:00
bool Driving(void) { return m_nPedState == PED_DRIVING; }
2019-12-02 21:02:32 +01:00
bool InVehicle(void) { return bInVehicle && m_pMyVehicle; } // True when ped is sitting/standing in vehicle, not in enter/exit state.
2020-03-07 20:22:43 +01:00
bool EnteringCar(void) { return m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK; }
2020-05-14 12:46:11 +02:00
bool HasAttractor(void) { return m_attractor != nil; }
bool IsUseAttractorObjective(eObjective obj) {
return obj == OBJECTIVE_GOTO_ATM_ON_FOOT || obj == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT ||
obj == OBJECTIVE_GOTO_PIZZA_ON_FOOT || obj == OBJECTIVE_GOTO_SEAT_ON_FOOT ||
obj == OBJECTIVE_GOTO_SHELTER_ON_FOOT || obj == OBJECTIVE_GOTO_BUS_STOP_ON_FOOT;
2020-05-14 12:46:11 +02:00
}
2020-03-07 20:22:43 +01:00
2019-09-20 21:40:33 +02:00
void ReplaceWeaponWhenExitingVehicle(void);
2019-11-19 23:15:45 +01:00
void RemoveWeaponWhenEnteringVehicle(void);
bool IsNotInWreckedVehicle();
2020-05-15 16:30:25 +02:00
2020-05-17 19:36:48 +02:00
// My names. Inlined in VC
2020-05-15 16:30:25 +02:00
AnimationId GetFireAnimNotDucking(CWeaponInfo* weapon) {
if (m_nPedType == PEDTYPE_COP && !!weapon->m_bCop3rd)
return ANIM_WEAPON_FIRE_3RD;
else
2020-05-16 14:07:09 +02:00
return GetPrimaryFireAnim(weapon);
2020-05-15 16:30:25 +02:00
}
static AnimationId GetFireAnimGround(CWeaponInfo* weapon, bool kickFloorIfNone = true) {
if (!!weapon->m_bGround2nd)
return ANIM_WEAPON_CROUCHFIRE;
else if (!!weapon->m_bGround3rd)
return ANIM_WEAPON_FIRE_3RD;
2020-05-15 16:30:25 +02:00
else if (kickFloorIfNone)
return ANIM_KICK_FLOOR;
else
return (AnimationId)0;
}
2020-05-16 14:07:09 +02:00
static AnimationId GetPrimaryFireAnim(CWeaponInfo* weapon) {
if (weapon->m_bAnimDetonate)
return ANIM_BOMBER;
else
return ANIM_WEAPON_FIRE;
}
2020-05-17 19:36:48 +02:00
static AnimationId GetCrouchReloadAnim(CWeaponInfo* weapon) {
if (!!weapon->m_bReload)
return ANIM_WEAPON_CROUCHRELOAD;
else
return (AnimationId)0;
}
static AnimationId GetCrouchFireAnim(CWeaponInfo* weapon) {
if (!!weapon->m_bCrouchFire)
return ANIM_WEAPON_CROUCHFIRE;
else
return (AnimationId)0;
}
2020-05-17 19:36:48 +02:00
static AnimationId GetReloadAnim(CWeaponInfo* weapon) {
if (!!weapon->m_bReload)
return ANIM_WEAPON_RELOAD;
else
return (AnimationId)0;
}
2020-06-15 22:43:20 +02:00
static AnimationId GetFightIdleWithMeleeAnim(CWeaponInfo* weapon) {
if (!!weapon->m_bFightMode)
return ANIM_MELEE_IDLE_FIGHTMODE;
else
return (AnimationId)0;
}
2020-05-15 16:30:25 +02:00
// --
2020-01-23 21:21:50 +01:00
// My additions, because there were many, many instances of that.
inline void SetFindPathAndFlee(CEntity *fleeFrom, int time, bool walk = false)
{
SetFlee(fleeFrom, time);
bUsePedNodeSeek = true;
m_pNextPathNode = nil;
if (walk)
SetMoveState(PEDMOVE_WALK);
}
inline void SetFindPathAndFlee(CVector2D const &from, int time, bool walk = false)
{
SetFlee(from, time);
bUsePedNodeSeek = true;
m_pNextPathNode = nil;
if (walk)
SetMoveState(PEDMOVE_WALK);
}
2020-05-15 16:30:25 +02:00
// --
// Using this to abstract nodes of skinned and non-skinned meshes
CVector GetNodePosition(int32 node)
{
2020-05-15 19:41:44 +02:00
RwV3d pos = { 0.0f, 0.0f, 0.0f };
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
int32 idx = RpHAnimIDGetIndex(hier, m_pFrames[node]->nodeID);
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
pos = mats[idx].pos;
return pos;
}
void TransformToNode(CVector &pos, int32 node)
{
2020-05-15 19:41:44 +02:00
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
int32 idx = RpHAnimIDGetIndex(hier, m_pFrames[node]->nodeID);
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
RwV3dTransformPoints((RwV3d*)&pos, (RwV3d*)&pos, 1, &mats[idx]);
}
// set by 0482:set_threat_reaction_range_multiplier opcode
2020-04-15 18:19:45 +02:00
static uint16 nThreatReactionRangeMultiplier;
2019-09-26 23:01:50 +02:00
// set by 0481:set_enter_car_range_multiplier opcode
2020-04-15 18:19:45 +02:00
static uint16 nEnterCarRangeMultiplier;
2019-09-26 23:01:50 +02:00
2020-04-15 18:19:45 +02:00
static bool bNastyLimbsCheat;
static bool bFannyMagnetCheat;
2020-04-15 18:19:45 +02:00
static bool bPedCheat2;
static bool bPedCheat3;
2019-09-03 18:53:04 +02:00
static CVector2D ms_vec2DFleePosition;
2019-08-05 15:07:10 +02:00
#ifndef MASTER
2019-11-05 00:04:26 +01:00
// Mobile things
2020-06-04 04:04:00 +02:00
void DebugDrawPedDestination(CPed *, int, int);
void DebugDrawPedDesiredHeading(CPed *, int, int);
void DebugDrawCollisionRadius(float, float, float, float, int);
void DebugDrawVisionRange(CVector, float);
void DebugDrawVisionSimple(CVector, float);
void DebugDrawLook();
void DebugDrawPedPsyche();
void DebugDrawDebugLines();
2019-08-16 18:25:02 +02:00
static void SwitchDebugDisplay(void);
2020-06-04 04:04:00 +02:00
static int GetDebugDisplay(void);
void DebugDrawLookAtPoints();
2019-08-16 18:25:02 +02:00
void DebugRenderOnePedText(void);
2020-06-04 04:04:00 +02:00
void DebugRenderClosePedText();
#endif
2020-05-02 17:02:17 +02:00
#ifdef COMPATIBLE_SAVES
virtual void Save(uint8*& buf);
virtual void Load(uint8*& buf);
#endif
2019-05-15 16:52:37 +02:00
};
2020-06-03 15:16:31 +02:00
void FinishTalkingOnMobileCB(CAnimBlendAssociation* assoc, void* arg);
void StartTalkingOnMobileCB(CAnimBlendAssociation* assoc, void* arg);
2020-06-06 21:16:59 +02:00
void PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 first, uint32 amount);
2019-06-25 00:42:23 +02:00
2020-05-15 16:30:25 +02:00
// TODO(Miami): Change those when Ped struct is done
#ifndef PED_SKIN
VALIDATE_SIZE(CPed, 0x53C);
#endif
2020-05-19 00:49:09 +02:00
bool IsPedPointerValid(CPed*);
bool IsPedPointerValid_NotInWorld(CPed*);