Several little mistakes in CPed

Signed-off-by: eray orçunus <erayorcunus@gmail.com>
This commit is contained in:
eray orçunus 2019-06-27 15:01:55 +03:00
parent d74b8fa952
commit 86ecf6523d
2 changed files with 11 additions and 13 deletions

View file

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

View file

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