From 81ea6f0258895e9087e0cb89cbd8bd30346974e2 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Wed, 13 May 2020 11:38:05 +0300 Subject: ped attractor: start --- src/peds/Ped.h | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) (limited to 'src/peds/Ped.h') diff --git a/src/peds/Ped.h b/src/peds/Ped.h index ccffc3cb..d8df1f49 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -19,6 +19,7 @@ class CObject; class CFire; struct AnimBlendFrameData; class CAnimBlendAssociation; +class CPedAttractor; struct PedAudioData { @@ -154,6 +155,7 @@ enum eWaitState { enum eObjective : uint32 { OBJECTIVE_NONE, OBJECTIVE_IDLE, + OBJ_2, OBJECTIVE_FLEE_TILL_SAFE, OBJECTIVE_GUARD_SPOT, OBJECTIVE_GUARD_AREA, // not implemented @@ -165,6 +167,8 @@ enum eObjective : uint32 { OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, OBJECTIVE_GOTO_CHAR_ON_FOOT, OBJECTIVE_FOLLOW_PED_IN_FORMATION, + OBJ_14, + OBJ_15, OBJECTIVE_LEAVE_VEHICLE, OBJECTIVE_ENTER_CAR_AS_PASSENGER, OBJECTIVE_ENTER_CAR_AS_DRIVER, @@ -175,8 +179,8 @@ enum eObjective : uint32 { OBJECTIVE_GOTO_AREA_ANY_MEANS, OBJECTIVE_GOTO_AREA_ON_FOOT, OBJECTIVE_RUN_TO_AREA, - OBJECTIVE_23, // not implemented - OBJECTIVE_24, // not implemented + OBJECTIVE_26, // not implemented + OBJECTIVE_27, // not implemented OBJECTIVE_FIGHT_CHAR, OBJECTIVE_SET_LEADER, OBJECTIVE_FOLLOW_ROUTE, @@ -185,11 +189,32 @@ enum eObjective : uint32 { OBJECTIVE_CATCH_TRAIN, OBJECTIVE_BUY_ICE_CREAM, OBJECTIVE_STEAL_ANY_CAR, + OBJ_36, OBJECTIVE_MUG_CHAR, - OBJECTIVE_FLEE_CAR, -#ifdef VC_PED_PORTS - OBJECTIVE_LEAVE_CAR_AND_DIE -#endif + OBJECTIVE_LEAVE_CAR_AND_DIE, + OBJECTIVE_USE_SEAT_ATTRACTOR, + OBJECTIVE_USE_ATM_ATTRACTOR, + OBJECTIVE_FLEE_CAR, // is it 41? + OBJ_42, + OBJECTIVE_USE_STOP_ATTRACTOR, + OBJECTIVE_USE_PIZZA_ATTRACTOR, + OBJECTIVE_USE_SHELTER_ATTRACTOR, + OBJ_46, + OBJ_47, + OBJ_48, + OBJ_49, + OBJ_50, + OBJ_51, + OBJ_52, + OBJECTIVE_USE_ICECREAM_ATTRACTOR, + OBJ_53, + OBJ_54, + OBJ_55, + OBJ_56, + OBJ_57, + OBJ_58, + OBJ_59 + }; enum { @@ -389,9 +414,10 @@ public: 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 - uint32 bCarPassenger : 1; - uint32 bMiamiViceCop : 1; // - uint32 bDeadPedInFrontOfCar : 1; + uint32 bHasAlreadyUsedAttractor : 1; // 0x155 0x1 + uint32 bCarPassenger : 1; // 0x155 0x4 + uint32 bMiamiViceCop : 1; // 0x155 0x20 + uint32 bDeadPedInFrontOfCar : 1; // 0x156 0x40 uint8 CharCreatedBy; eObjective m_objective; @@ -457,6 +483,8 @@ public: bool bInVehicle; float m_distanceToCountSeekDone; + CPedAttractor* m_attractor; + int32 m_positionInQueue; CVehicle* m_vehicleInAccident; bool bRunningToPhone; @@ -793,6 +821,8 @@ public: bool CanPedJumpThis(CEntity*); #endif + void SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float, float, int); + bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; } CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; } CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } -- cgit v1.2.3 From d031943f2ab25e36422285ec9d544beff03e1492 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Thu, 14 May 2020 13:46:11 +0300 Subject: more pedattractor --- src/peds/Ped.h | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'src/peds/Ped.h') diff --git a/src/peds/Ped.h b/src/peds/Ped.h index d8df1f49..60325812 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -149,7 +149,22 @@ enum eWaitState { WAITSTATE_PLAYANIM_HANDSUP, WAITSTATE_PLAYANIM_HANDSCOWER, WAITSTATE_PLAYANIM_CHAT, - WAITSTATE_FINISH_FLEE + 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 { @@ -201,14 +216,13 @@ enum eObjective : uint32 { OBJECTIVE_USE_SHELTER_ATTRACTOR, OBJ_46, OBJ_47, - OBJ_48, + OBJECTIVE_WAIT_FOR_RAIN_TO_END, OBJ_49, OBJ_50, OBJ_51, - OBJ_52, + OBJECTIVE_WAIT_FOR_BUS, OBJECTIVE_USE_ICECREAM_ATTRACTOR, - OBJ_53, - OBJ_54, + OBJECTIVE_PURCHASE_ICECREAM, OBJ_55, OBJ_56, OBJ_57, @@ -414,6 +428,8 @@ public: 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 + uint32 bReachedAttractorHeadingTarget : 1; // 0x154 0x40 + uint32 bTurnedAroundOnAttractor : 1; // 0x154 0x80 uint32 bHasAlreadyUsedAttractor : 1; // 0x155 0x1 uint32 bCarPassenger : 1; // 0x155 0x4 uint32 bMiamiViceCop : 1; // 0x155 0x20 @@ -425,6 +441,7 @@ public: CPed *m_pedInObjective; CVehicle *m_carInObjective; CVector m_nextRoutePointPos; + float m_attractorHeading; CPed *m_leader; eFormation m_pedFormation; uint32 m_fearFlags; @@ -482,7 +499,7 @@ public: CVehicle *m_pMyVehicle; bool bInVehicle; float m_distanceToCountSeekDone; - + float m_acceptableHeadingOffset; CPedAttractor* m_attractor; int32 m_positionInQueue; CVehicle* m_vehicleInAccident; @@ -610,6 +627,7 @@ public: void SetObjective(eObjective, int16, int16); void SetObjective(eObjective, CVector); void SetObjective(eObjective, CVector, float); + void SetObjective(eObjective, float, const CVector&); void ClearChat(void); void InformMyGangOfAttack(CEntity*); void ReactToAttack(CEntity*); @@ -822,6 +840,7 @@ public: #endif void SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float, float, int); + void ClearWaitState(void); bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; } CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; } @@ -837,6 +856,12 @@ public: bool Driving(void) { return m_nPedState == PED_DRIVING; } bool InVehicle(void) { return bInVehicle && m_pMyVehicle; } // True when ped is sitting/standing in vehicle, not in enter/exit state. bool EnteringCar(void) { return m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK; } + bool HasAttractor(void) { return m_attractor != nil; } + bool IsUseAttractorObjective(eObjective obj) { + return obj == OBJECTIVE_USE_ATM_ATTRACTOR || obj == OBJECTIVE_USE_ICECREAM_ATTRACTOR || + obj == OBJECTIVE_USE_PIZZA_ATTRACTOR || obj == OBJECTIVE_USE_SEAT_ATTRACTOR || + obj == OBJECTIVE_USE_SHELTER_ATTRACTOR || obj == OBJECTIVE_USE_STOP_ATTRACTOR; + } void ReplaceWeaponWhenExitingVehicle(void); void RemoveWeaponWhenEnteringVehicle(void); -- cgit v1.2.3 From f864698696fc5451372dffbc37255d4be0fa08ee Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 16 May 2020 02:10:23 +0300 Subject: ped attractors --- src/peds/Ped.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/peds/Ped.h') diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 4efad358..f86f23d3 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -865,8 +865,8 @@ public: void SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float, float, int); void ClearWaitState(void); - bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; } - CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; } + 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]; } PedState GetPedState(void) { return m_nPedState; } -- cgit v1.2.3