The Peds, mainly dying/injuring

There is also some reorganization
This commit is contained in:
eray orçunus
2019-07-18 05:26:46 +03:00
parent 06ed308bb1
commit 59671fab03
11 changed files with 863 additions and 212 deletions

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,17 @@
struct CPathNode;
enum ePedPieceTypes
{
PEDPIECE_NONE,
PEDPIECE_BODY,
PEDPIECE_LEFTARM,
PEDPIECE_RIGHTARM,
PEDPIECE_LEFTLEG,
PEDPIECE_RIGHTLEG,
PEDPIECE_HEAD,
};
enum eWaitState {
WAITSTATE_FALSE,
WAITSTATE_TRAFFIC_LIGHTS,
@ -196,10 +207,10 @@ public:
uint8 m_ped_flagC1 : 1;
uint8 bRespondsToThreats : 1;
uint8 m_ped_flagC4 : 1; // false when in bus, bRenderPedInCar?
uint8 m_ped_flagC8 : 1;
uint8 bRenderPedInCar : 1;
uint8 bChangedSeat : 1;
uint8 m_ped_flagC10 : 1; // related with phone
uint8 m_ped_flagC20 : 1; // just left some body part?
uint8 bBodyPartJustCameOff : 1;
uint8 m_ped_flagC40 : 1;
uint8 m_ped_flagC80 : 1;
@ -207,7 +218,7 @@ public:
uint8 m_ped_flagD2 : 1; // seen an event
uint8 m_ped_flagD4 : 1;
uint8 m_ped_flagD8 : 1;
uint8 m_ped_flagD10 : 1;
uint8 bIsPedDieAnimPlaying : 1;
uint8 m_ped_flagD20 : 1;
uint8 m_ped_flagD40 : 1; // reset when objective changes
uint8 m_bScriptObjectiveCompleted : 1;
@ -225,7 +236,7 @@ public:
uint8 m_ped_flagF2 : 1;
uint8 m_ped_flagF4 : 1;
uint8 m_ped_flagF8 : 1;
uint8 m_ped_flagF10 : 1;
uint8 m_ped_flagF10 : 1; // set before "quickjack"
uint8 m_ped_flagF20 : 1;
uint8 m_ped_flagF40 : 1;
uint8 m_ped_flagF80 : 1;
@ -249,7 +260,7 @@ public:
uint8 m_ped_flagH80 : 1;
uint8 m_ped_flagI1 : 1;
uint8 m_ped_flagI2 : 1;
uint8 m_ped_flagI2 : 1; // limbs won't be removed if set
uint8 m_ped_flagI4 : 1;
uint8 bHasAlreadyBeenRecorded : 1;
uint8 m_ped_flagI10 : 1;
@ -416,8 +427,8 @@ public:
void SetDie(AnimationId anim, float arg1, float arg2);
void SetDead(void);
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
void RemoveBodyPart(PedNode nodeId, int8 unknown);
void SpawnFlyingComponent(int, int8 unknown);
void RemoveBodyPart(PedNode nodeId, int8 direction);
void SpawnFlyingComponent(int, int8);
bool OurPedCanSeeThisOne(CEntity *target);
void Avoid(void);
void Attack(void);
@ -472,6 +483,13 @@ public:
bool Seek(void);
void SetWanderPath(int8);
void SetFollowPath(CVector);
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);
// Static methods
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
@ -545,6 +563,7 @@ public:
static bool &bNastyLimbsCheat;
static bool &bPedCheat2;
static bool &bPedCheat3;
static CColPoint &ms_tempColPoint;
};
void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg);

View File

@ -35,6 +35,13 @@ CPedPlacement::FindZCoorForPed(CVector* pos)
pos->z = 1.04f + zForPed;
}
CEntity*
CPedPlacement::IsPositionClearOfCars(CVector* pos)
{
return CWorld::TestSphereAgainstWorld(*pos, 0.25f, false, true, true, false, false, false, false);
}
STARTPATCHES
InjectHook(0x4EE340, &CPedPlacement::FindZCoorForPed, PATCH_JUMP);
InjectHook(0x4EE310, &CPedPlacement::IsPositionClearOfCars, PATCH_JUMP);
ENDPATCHES

View File

@ -1,8 +1,10 @@
#pragma once
class CVector;
class CEntity;
class CPedPlacement {
public:
static void FindZCoorForPed(CVector* pos);
static CEntity* IsPositionClearOfCars(CVector*);
};

View File

@ -38,6 +38,24 @@ CPlayerPed::SetWantedLevelNoDrop(int32 level)
m_pWanted->SetWantedLevelNoDrop(level);
}
// I don't know actual purpose of parameter
void
CPlayerPed::AnnoyPlayerPed(bool itsPolice)
{
int8 *temper = &m_pedStats->m_temper;
if (*temper >= 52) {
if (itsPolice) {
if (*temper < 55) {
(*temper)++;
} else {
(*temper) = 46;
}
}
} else {
(*temper)++;
}
}
class CPlayerPed_ : public CPlayerPed
{
@ -48,4 +66,5 @@ public:
STARTPATCHES
InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP);
InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
InjectHook(0x4F3700, &CPlayerPed::AnnoyPlayerPed, PATCH_JUMP);
ENDPATCHES

View File

@ -29,7 +29,7 @@ public:
bool m_bHasLockOnTarget;
int8 field_1406;
int8 field_1407;
bool m_bAdrenalineTime;
uint32 m_bAdrenalineTime;
bool m_bCanBeDamaged;
int8 field_1413;
int8 field_1414;
@ -46,6 +46,7 @@ public:
void SetWantedLevel(int32 level);
void SetWantedLevelNoDrop(int32 level);
void KeepAreaAroundPlayerClear(void);
void AnnoyPlayerPed(bool);
static void SetupPlayerPed(int32);
static void DeactivatePlayerPed(int32);