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

View File

@ -141,7 +141,7 @@ void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool he
}
#endif
void CDarkel::RegisterKillNotByPlayer()
void CDarkel::RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype)
{
++CStats::NumberKillFrenziesPassed;
}

View File

@ -42,7 +42,7 @@ public:
static eKillFrenzyStatus ReadStatus();
static void RegisterCarBlownUpByPlayer(CVehicle *vehicle);
static void RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot = false);
static void RegisterKillNotByPlayer();
static void RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype);
static void ResetModelsKilledByPlayer();
static void ResetOnPlayerDeath();
static void StartFrenzy(eWeaponType weaponType, int32 time, int16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot);

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "Ped.h"
#include "NodeName.h"
#include "VisibilityPlugins.h"
#include "ModelInfo.h"
@ -14,7 +15,7 @@ CPedModelInfo::DeleteRwObject(void)
}
RwObjectNameIdAssocation CPedModelInfo::m_pPedIds[12] = {
{ "Smid", PED_TORSO, 0, }, // that is strange...
{ "Smid", PED_MID, 0, }, // that is strange...
{ "Shead", PED_HEAD, 0, },
{ "Supperarml", PED_UPPERARML, 0, },
{ "Supperarmr", PED_UPPERARMR, 0, },
@ -109,17 +110,16 @@ struct ColNodeInfo
float radius;
};
// TODO: find out piece types
#define NUMPEDINFONODES 8
ColNodeInfo m_pColNodeInfos[NUMPEDINFONODES] = {
{ nil, PED_HEAD, 6, 0.0f, 0.05f, 0.2f },
{ "Storso", 0, 0, 0.0f, 0.15f, 0.2f },
{ "Storso", 0, 0, 0.0f, -0.05f, 0.3f },
{ nil, PED_TORSO, 1, 0.0f, -0.07f, 0.3f },
{ nil, PED_UPPERARML, 2, 0.07f, -0.1f, 0.2f },
{ nil, PED_UPPERARMR, 3, -0.07f, -0.1f, 0.2f },
{ "Slowerlegl", 0, 4, 0.0f, 0.07f, 0.25f },
{ nil, PED_LOWERLEGR, 5, 0.0f, 0.07f, 0.25f },
{ nil, PED_HEAD, PEDPIECE_HEAD, 0.0f, 0.05f, 0.2f },
{ "Storso", PED_TORSO, PEDPIECE_NONE, 0.0f, 0.15f, 0.2f },
{ "Storso", PED_TORSO, PEDPIECE_NONE, 0.0f, -0.05f, 0.3f },
{ nil, PED_MID, PEDPIECE_BODY, 0.0f, -0.07f, 0.3f },
{ nil, PED_UPPERARML, PEDPIECE_LEFTARM, 0.07f, -0.1f, 0.2f },
{ nil, PED_UPPERARMR, PEDPIECE_RIGHTARM, -0.07f, -0.1f, 0.2f },
{ "Slowerlegl", 0, PEDPIECE_LEFTLEG, 0.0f, 0.07f, 0.25f },
{ nil, PED_LOWERLEGR, PEDPIECE_RIGHTLEG, 0.0f, 0.07f, 0.25f },
};
RwObject*

View File

@ -3,8 +3,8 @@
#include "ClumpModelInfo.h"
enum PedNode {
PED_WAIST,
PED_TORSO, // Smid on PS2/PC, Storso on mobile/xbox
PED_TORSO,
PED_MID, // Smid on PS2/PC, Storso on mobile/xbox
PED_HEAD,
PED_UPPERARML,
PED_UPPERARMR,

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);

View File

@ -603,7 +603,7 @@ CVehicle::SetUpDriver(void)
pDriver->bInVehicle = true;
pDriver->SetPedState(PED_DRIVING);
if(bIsBus)
pDriver->m_ped_flagC4 = false;
pDriver->bRenderPedInCar = false;
return pDriver;
}
@ -619,7 +619,7 @@ CVehicle::SetupPassenger(int n)
pPassengers[n]->bInVehicle = true;
pPassengers[n]->SetPedState(PED_DRIVING);
if(bIsBus)
pPassengers[n]->m_ped_flagC4 = false;
pPassengers[n]->bRenderPedInCar = false;
return pPassengers[n];
}