Merge pull request #62 from erorcun/erorcun

Several little mistakes in CPed
This commit is contained in:
aap 2019-06-27 14:18:54 +02:00 committed by GitHub
commit 9f07569bd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 13 deletions

View File

@ -313,10 +313,9 @@ bool
CPed::CanSetPedState(void) CPed::CanSetPedState(void)
{ {
return m_nPedState != PED_DIE && m_nPedState != PED_ARRESTED && 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 void
CPed::AddWeaponModel(int id) CPed::AddWeaponModel(int id)
{ {
@ -338,23 +337,23 @@ CPed::AimGun(void)
CVector vector; CVector vector;
if (m_pSeekTarget) { if (m_pSeekTarget) {
if (m_pSeekTarget->m_status == STATUS_PHYSICS) { if (m_pSeekTarget->IsPed()) {
m_pSeekTarget->m_pedIK.GetComponentPosition(&pos, PED_TORSO); ((CPed*)m_pSeekTarget)->m_pedIK.GetComponentPosition(&pos, PED_TORSO);
vector.x = pos.x; vector.x = pos.x;
vector.y = pos.y; vector.y = pos.y;
vector.z = pos.z; vector.z = pos.z;
} else { } else {
vector = *(m_pSeekTarget->GetPosition()); vector = *(m_pSeekTarget->GetPosition());
} }
CPed::Say(SOUND_PED_ATTACK); Say(SOUND_PED_ATTACK);
bCanPointGunAtTarget = m_pedIK.PointGunAtPosition(&vector); bCanPointGunAtTarget = m_pedIK.PointGunAtPosition(&vector);
if (m_pLookTarget != m_pSeekTarget) { if (m_pLookTarget != m_pSeekTarget) {
CPed::SetLookFlag(m_pSeekTarget, 1); SetLookFlag(m_pSeekTarget, 1);
} }
} else { } else {
if (CPed::IsPlayer()) { if (IsPlayer()) {
bCanPointGunAtTarget = m_pedIK.PointGunInDirection(m_fLookDirection, ((CPlayerPed*)this)->m_fFPSMoveHeading); bCanPointGunAtTarget = m_pedIK.PointGunInDirection(m_fLookDirection, ((CPlayerPed*)this)->m_fFPSMoveHeading);
} else { } else {
bCanPointGunAtTarget = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0f); bCanPointGunAtTarget = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0f);
@ -459,7 +458,7 @@ CPed::RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data)
} }
void void
CPed::SetLookFlag(CPed *target, bool unknown) CPed::SetLookFlag(CEntity *target, bool unknown)
{ {
if (m_lookTimer < CTimer::GetTimeInMilliseconds()) { if (m_lookTimer < CTimer::GetTimeInMilliseconds()) {
bIsLooking = true; bIsLooking = true;
@ -621,8 +620,7 @@ CPed::FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg)
if (attackAssoc) { if (attackAssoc) {
switch (attackAssoc->animId) { switch (attackAssoc->animId) {
case ANIM_WEAPON_START_THROW: 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; attackAssoc->blendDelta = -1000.0f;
newAnim = CAnimManager::AddAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_WEAPON_THROWU); newAnim = CAnimManager::AddAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_WEAPON_THROWU);
} else { } else {
@ -1492,7 +1490,7 @@ STARTPATCHES
InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP); InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP);
InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP); InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP);
InjectHook(0x4EAEE0, &CPed::RemoveBodyPart, 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(0x4C63E0, (void (CPed::*)(float, bool)) &CPed::SetLookFlag, PATCH_JUMP);
InjectHook(0x4D12E0, &CPed::SetLookTimer, PATCH_JUMP); InjectHook(0x4D12E0, &CPed::SetLookTimer, PATCH_JUMP);
InjectHook(0x4C5700, &CPed::OurPedCanSeeThisOne, PATCH_JUMP); InjectHook(0x4C5700, &CPed::OurPedCanSeeThisOne, PATCH_JUMP);

View File

@ -227,7 +227,7 @@ public:
CVector m_vecOffsetFromPhysSurface; CVector m_vecOffsetFromPhysSurface;
CEntity *m_pCurSurface; CEntity *m_pCurSurface;
uint8 stuff3[12]; uint8 stuff3[12];
CPed *m_pSeekTarget; CEntity *m_pSeekTarget;
CVehicle *m_pMyVehicle; CVehicle *m_pMyVehicle;
bool bInVehicle; bool bInVehicle;
uint8 stuff4[23]; uint8 stuff4[23];
@ -273,7 +273,7 @@ public:
void AimGun(void); void AimGun(void);
void KillPedWithCar(CVehicle *veh, float impulse); void KillPedWithCar(CVehicle *veh, float impulse);
void Say(uint16 audio); void Say(uint16 audio);
void SetLookFlag(CPed *target, bool unknown); void SetLookFlag(CEntity *target, bool unknown);
void SetLookFlag(float direction, bool unknown); void SetLookFlag(float direction, bool unknown);
void SetLookTimer(int time); void SetLookTimer(int time);
void SetDie(AnimationId anim, float arg1, float arg2); void SetDie(AnimationId anim, float arg1, float arg2);