mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-23 16:21:50 +01:00
CPed::SetWeaponLockOnTarget
This commit is contained in:
parent
c0652b8203
commit
f42a01f653
@ -90,8 +90,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
|
|||||||
pCopPed->m_nRoadblockNode = roadBlockNode;
|
pCopPed->m_nRoadblockNode = roadBlockNode;
|
||||||
pCopPed->bCrouchWhenShooting = roadBlockType != 2;
|
pCopPed->bCrouchWhenShooting = roadBlockType != 2;
|
||||||
if (pEntityToAttack) {
|
if (pEntityToAttack) {
|
||||||
pCopPed->m_pPointGunAt = pEntityToAttack;
|
pCopPed->SetWeaponLockOnTarget(pEntityToAttack);
|
||||||
pEntityToAttack->RegisterReference(&pCopPed->m_pPointGunAt);
|
|
||||||
pCopPed->SetAttack(pEntityToAttack);
|
pCopPed->SetAttack(pEntityToAttack);
|
||||||
}
|
}
|
||||||
pCopPed->m_pMyVehicle = pVehicle;
|
pCopPed->m_pMyVehicle = pVehicle;
|
||||||
|
@ -69,7 +69,7 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
|
|||||||
m_bStopAndShootDisabledZone = false;
|
m_bStopAndShootDisabledZone = false;
|
||||||
m_bZoneDisabled = false;
|
m_bZoneDisabled = false;
|
||||||
field_1364 = -1;
|
field_1364 = -1;
|
||||||
m_pPointGunAt = nil;
|
SetWeaponLockOnTarget(nil);
|
||||||
|
|
||||||
// VC also initializes in here, but as nil
|
// VC also initializes in here, but as nil
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
@ -472,10 +472,7 @@ CCopPed::CopAI(void)
|
|||||||
if (!CWorld::ProcessLineOfSight(gunPos, playerOrHisVeh->GetPosition(), foundCol, foundEnt,
|
if (!CWorld::ProcessLineOfSight(gunPos, playerOrHisVeh->GetPosition(), foundCol, foundEnt,
|
||||||
false, true, false, false, true, false, false)
|
false, true, false, false, true, false, false)
|
||||||
|| foundEnt && foundEnt == playerOrHisVeh) {
|
|| foundEnt && foundEnt == playerOrHisVeh) {
|
||||||
m_pPointGunAt = playerOrHisVeh;
|
SetWeaponLockOnTarget(playerOrHisVeh);
|
||||||
if (playerOrHisVeh)
|
|
||||||
playerOrHisVeh->RegisterReference((CEntity**) &m_pPointGunAt);
|
|
||||||
|
|
||||||
SetAttack(playerOrHisVeh);
|
SetAttack(playerOrHisVeh);
|
||||||
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 1000));
|
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 1000));
|
||||||
}
|
}
|
||||||
|
@ -863,6 +863,13 @@ public:
|
|||||||
SetMoveState(PEDMOVE_WALK);
|
SetMoveState(PEDMOVE_WALK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void SetWeaponLockOnTarget(CEntity *target)
|
||||||
|
{
|
||||||
|
m_pPointGunAt = (CPed *)target;
|
||||||
|
if(target)
|
||||||
|
((CEntity *)target)->RegisterReference(&m_pPointGunAt);
|
||||||
|
}
|
||||||
|
|
||||||
// Using this to abstract nodes of skinned and non-skinned meshes
|
// Using this to abstract nodes of skinned and non-skinned meshes
|
||||||
CVector GetNodePosition(int32 node)
|
CVector GetNodePosition(int32 node)
|
||||||
{
|
{
|
||||||
|
@ -620,9 +620,7 @@ CPed::UpdateFromLeader(void)
|
|||||||
m_pLookTarget->RegisterReference((CEntity **) &m_pLookTarget);
|
m_pLookTarget->RegisterReference((CEntity **) &m_pLookTarget);
|
||||||
TurnBody();
|
TurnBody();
|
||||||
if (m_attackTimer < CTimer::GetTimeInMilliseconds() && !GetWeapon()->IsTypeMelee()) {
|
if (m_attackTimer < CTimer::GetTimeInMilliseconds() && !GetWeapon()->IsTypeMelee()) {
|
||||||
m_pPointGunAt = m_threatEntity;
|
SetWeaponLockOnTarget(m_threatEntity);
|
||||||
if (m_threatEntity)
|
|
||||||
m_threatEntity->RegisterReference((CEntity **) &m_pPointGunAt);
|
|
||||||
SetAttack(m_threatEntity);
|
SetAttack(m_threatEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1026,10 +1024,7 @@ CPed::ProcessObjective(void)
|
|||||||
CWorld::bIncludeDeadPeds = false;
|
CWorld::bIncludeDeadPeds = false;
|
||||||
if (foundEnt == vehOfTarget) {
|
if (foundEnt == vehOfTarget) {
|
||||||
SetAttack(vehOfTarget);
|
SetAttack(vehOfTarget);
|
||||||
m_pPointGunAt = vehOfTarget;
|
SetWeaponLockOnTarget(vehOfTarget);
|
||||||
if (vehOfTarget)
|
|
||||||
vehOfTarget->RegisterReference((CEntity **) &m_pPointGunAt);
|
|
||||||
|
|
||||||
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 2000));
|
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 2000));
|
||||||
if (distWithTargetSc <= m_distanceToCountSeekDone) {
|
if (distWithTargetSc <= m_distanceToCountSeekDone) {
|
||||||
SetAttackTimer(CGeneral::GetRandomNumberInRange(200, 500));
|
SetAttackTimer(CGeneral::GetRandomNumberInRange(200, 500));
|
||||||
@ -1162,10 +1157,7 @@ CPed::ProcessObjective(void)
|
|||||||
CWorld::bIncludeDeadPeds = false;
|
CWorld::bIncludeDeadPeds = false;
|
||||||
if (foundEnt == m_pedInObjective) {
|
if (foundEnt == m_pedInObjective) {
|
||||||
SetAttack(m_pedInObjective);
|
SetAttack(m_pedInObjective);
|
||||||
m_pPointGunAt = m_pedInObjective;
|
SetWeaponLockOnTarget(m_pedInObjective);
|
||||||
if (m_pedInObjective)
|
|
||||||
m_pedInObjective->RegisterReference((CEntity **) &m_pPointGunAt);
|
|
||||||
|
|
||||||
SetShootTimer(CGeneral::GetRandomNumberInRange(500.0f, 2000.0f));
|
SetShootTimer(CGeneral::GetRandomNumberInRange(500.0f, 2000.0f));
|
||||||
|
|
||||||
int time;
|
int time;
|
||||||
@ -1551,10 +1543,7 @@ CPed::ProcessObjective(void)
|
|||||||
CWorld::bIncludeDeadPeds = false;
|
CWorld::bIncludeDeadPeds = false;
|
||||||
if (foundEnt == m_carInObjective) {
|
if (foundEnt == m_carInObjective) {
|
||||||
SetAttack(m_carInObjective);
|
SetAttack(m_carInObjective);
|
||||||
m_pPointGunAt = m_carInObjective;
|
SetWeaponLockOnTarget(m_carInObjective);
|
||||||
if (m_pPointGunAt)
|
|
||||||
m_pPointGunAt->RegisterReference((CEntity **) &m_pPointGunAt);
|
|
||||||
|
|
||||||
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 2000));
|
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 2000));
|
||||||
if (distWithTargetSc > 10.0f && !bKindaStayInSamePlace) {
|
if (distWithTargetSc > 10.0f && !bKindaStayInSamePlace) {
|
||||||
SetAttackTimer(CGeneral::GetRandomNumberInRange(2000, 5000));
|
SetAttackTimer(CGeneral::GetRandomNumberInRange(2000, 5000));
|
||||||
|
@ -47,8 +47,8 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
|||||||
m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
|
m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
|
||||||
m_nSpeedTimer = 0;
|
m_nSpeedTimer = 0;
|
||||||
m_bSpeedTimerFlag = false;
|
m_bSpeedTimerFlag = false;
|
||||||
m_pPointGunAt = nil;
|
SetWeaponLockOnTarget(nil);
|
||||||
m_nPedState = PED_IDLE;
|
SetPedState(PED_IDLE);
|
||||||
#ifndef FIX_BUGS
|
#ifndef FIX_BUGS
|
||||||
m_fCurrentStamina = m_fMaxStamina = 150.0f;
|
m_fCurrentStamina = m_fMaxStamina = 150.0f;
|
||||||
#endif
|
#endif
|
||||||
@ -73,7 +73,7 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
|||||||
void CPlayerPed::ClearWeaponTarget()
|
void CPlayerPed::ClearWeaponTarget()
|
||||||
{
|
{
|
||||||
if (m_nPedType == PEDTYPE_PLAYER1) {
|
if (m_nPedType == PEDTYPE_PLAYER1) {
|
||||||
m_pPointGunAt = nil;
|
SetWeaponLockOnTarget(nil);
|
||||||
TheCamera.ClearPlayerWeaponMode();
|
TheCamera.ClearPlayerWeaponMode();
|
||||||
CWeaponEffects::ClearCrossHair();
|
CWeaponEffects::ClearCrossHair();
|
||||||
}
|
}
|
||||||
@ -875,9 +875,7 @@ CPlayerPed::FindNextWeaponLockOnTarget(CEntity *previousTarget, bool lookToLeft)
|
|||||||
if (!nextTarget)
|
if (!nextTarget)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_pPointGunAt = nextTarget;
|
SetWeaponLockOnTarget(nextTarget);
|
||||||
if (nextTarget)
|
|
||||||
nextTarget->RegisterReference((CEntity**)&m_pPointGunAt);
|
|
||||||
SetPointGunAt(nextTarget);
|
SetPointGunAt(nextTarget);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -891,7 +889,7 @@ CPlayerPed::FindWeaponLockOnTarget(void)
|
|||||||
if (m_pPointGunAt) {
|
if (m_pPointGunAt) {
|
||||||
CVector distVec = m_pPointGunAt->GetPosition() - GetPosition();
|
CVector distVec = m_pPointGunAt->GetPosition() - GetPosition();
|
||||||
if (distVec.Magnitude2D() > weaponRange) {
|
if (distVec.Magnitude2D() > weaponRange) {
|
||||||
m_pPointGunAt = nil;
|
SetWeaponLockOnTarget(nil);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -922,9 +920,7 @@ CPlayerPed::FindWeaponLockOnTarget(void)
|
|||||||
if (!nextTarget)
|
if (!nextTarget)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_pPointGunAt = nextTarget;
|
SetWeaponLockOnTarget(nextTarget);
|
||||||
if (nextTarget)
|
|
||||||
nextTarget->RegisterReference((CEntity**)&m_pPointGunAt);
|
|
||||||
SetPointGunAt(nextTarget);
|
SetPointGunAt(nextTarget);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user