summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-27 14:18:54 +0200
committerGitHub <noreply@github.com>2019-06-27 14:18:54 +0200
commit9f07569bd6a4b67c5a1427da773d679247bb73d1 (patch)
treef3d2f30a302638506cf2e3c37aa0cfce198cd45e
parentCStreaming almost done (diff)
parentSeveral little mistakes in CPed (diff)
downloadre3-9f07569bd6a4b67c5a1427da773d679247bb73d1.tar
re3-9f07569bd6a4b67c5a1427da773d679247bb73d1.tar.gz
re3-9f07569bd6a4b67c5a1427da773d679247bb73d1.tar.bz2
re3-9f07569bd6a4b67c5a1427da773d679247bb73d1.tar.lz
re3-9f07569bd6a4b67c5a1427da773d679247bb73d1.tar.xz
re3-9f07569bd6a4b67c5a1427da773d679247bb73d1.tar.zst
re3-9f07569bd6a4b67c5a1427da773d679247bb73d1.zip
-rw-r--r--src/entities/Ped.cpp20
-rw-r--r--src/entities/Ped.h4
2 files changed, 11 insertions, 13 deletions
diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp
index 4f5147b9..0dedacad 100644
--- a/src/entities/Ped.cpp
+++ b/src/entities/Ped.cpp
@@ -313,10 +313,9 @@ bool
CPed::CanSetPedState(void)
{
return m_nPedState != PED_DIE && m_nPedState != PED_ARRESTED &&
- m_nPedState != PED_ENTER_CAR && m_nPedState != PED_CARJACK && m_nPedState != PED_DRAG_FROM_CAR && m_nPedState != PED_STEAL_CAR;
+ m_nPedState != PED_ENTER_CAR && m_nPedState != PED_DEAD && m_nPedState != PED_CARJACK && m_nPedState != PED_STEAL_CAR;
}
-
void
CPed::AddWeaponModel(int id)
{
@@ -338,23 +337,23 @@ CPed::AimGun(void)
CVector vector;
if (m_pSeekTarget) {
- if (m_pSeekTarget->m_status == STATUS_PHYSICS) {
- m_pSeekTarget->m_pedIK.GetComponentPosition(&pos, PED_TORSO);
+ if (m_pSeekTarget->IsPed()) {
+ ((CPed*)m_pSeekTarget)->m_pedIK.GetComponentPosition(&pos, PED_TORSO);
vector.x = pos.x;
vector.y = pos.y;
vector.z = pos.z;
} else {
vector = *(m_pSeekTarget->GetPosition());
}
- CPed::Say(SOUND_PED_ATTACK);
+ Say(SOUND_PED_ATTACK);
bCanPointGunAtTarget = m_pedIK.PointGunAtPosition(&vector);
if (m_pLookTarget != m_pSeekTarget) {
- CPed::SetLookFlag(m_pSeekTarget, 1);
+ SetLookFlag(m_pSeekTarget, 1);
}
} else {
- if (CPed::IsPlayer()) {
+ if (IsPlayer()) {
bCanPointGunAtTarget = m_pedIK.PointGunInDirection(m_fLookDirection, ((CPlayerPed*)this)->m_fFPSMoveHeading);
} else {
bCanPointGunAtTarget = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0f);
@@ -459,7 +458,7 @@ CPed::RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data)
}
void
-CPed::SetLookFlag(CPed *target, bool unknown)
+CPed::SetLookFlag(CEntity *target, bool unknown)
{
if (m_lookTimer < CTimer::GetTimeInMilliseconds()) {
bIsLooking = true;
@@ -621,8 +620,7 @@ CPed::FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg)
if (attackAssoc) {
switch (attackAssoc->animId) {
case ANIM_WEAPON_START_THROW:
- if ((!ped->IsPlayer() || ((CPlayerPed*)ped)->field_1380) && ped->IsPlayer())
- {
+ if ((!ped->IsPlayer() || ((CPlayerPed*)ped)->field_1380) && ped->IsPlayer()) {
attackAssoc->blendDelta = -1000.0f;
newAnim = CAnimManager::AddAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_WEAPON_THROWU);
} else {
@@ -1492,7 +1490,7 @@ STARTPATCHES
InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP);
InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP);
InjectHook(0x4EAEE0, &CPed::RemoveBodyPart, PATCH_JUMP);
- InjectHook(0x4C6460, (void (CPed::*)(CPed*, bool)) &CPed::SetLookFlag, PATCH_JUMP);
+ InjectHook(0x4C6460, (void (CPed::*)(CEntity*, bool)) &CPed::SetLookFlag, PATCH_JUMP);
InjectHook(0x4C63E0, (void (CPed::*)(float, bool)) &CPed::SetLookFlag, PATCH_JUMP);
InjectHook(0x4D12E0, &CPed::SetLookTimer, PATCH_JUMP);
InjectHook(0x4C5700, &CPed::OurPedCanSeeThisOne, PATCH_JUMP);
diff --git a/src/entities/Ped.h b/src/entities/Ped.h
index 34c7a485..37a1cd3d 100644
--- a/src/entities/Ped.h
+++ b/src/entities/Ped.h
@@ -227,7 +227,7 @@ public:
CVector m_vecOffsetFromPhysSurface;
CEntity *m_pCurSurface;
uint8 stuff3[12];
- CPed *m_pSeekTarget;
+ CEntity *m_pSeekTarget;
CVehicle *m_pMyVehicle;
bool bInVehicle;
uint8 stuff4[23];
@@ -273,7 +273,7 @@ public:
void AimGun(void);
void KillPedWithCar(CVehicle *veh, float impulse);
void Say(uint16 audio);
- void SetLookFlag(CPed *target, bool unknown);
+ void SetLookFlag(CEntity *target, bool unknown);
void SetLookFlag(float direction, bool unknown);
void SetLookTimer(int time);
void SetDie(AnimationId anim, float arg1, float arg2);