mirror of
https://github.com/halpz/re3.git
synced 2024-12-22 17:35:29 +00: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->bCrouchWhenShooting = roadBlockType != 2;
|
||||
if (pEntityToAttack) {
|
||||
pCopPed->m_pPointGunAt = pEntityToAttack;
|
||||
pEntityToAttack->RegisterReference(&pCopPed->m_pPointGunAt);
|
||||
pCopPed->SetWeaponLockOnTarget(pEntityToAttack);
|
||||
pCopPed->SetAttack(pEntityToAttack);
|
||||
}
|
||||
pCopPed->m_pMyVehicle = pVehicle;
|
||||
|
|
|
@ -69,7 +69,7 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
|
|||
m_bStopAndShootDisabledZone = false;
|
||||
m_bZoneDisabled = false;
|
||||
field_1364 = -1;
|
||||
m_pPointGunAt = nil;
|
||||
SetWeaponLockOnTarget(nil);
|
||||
|
||||
// VC also initializes in here, but as nil
|
||||
#ifdef FIX_BUGS
|
||||
|
@ -472,10 +472,7 @@ CCopPed::CopAI(void)
|
|||
if (!CWorld::ProcessLineOfSight(gunPos, playerOrHisVeh->GetPosition(), foundCol, foundEnt,
|
||||
false, true, false, false, true, false, false)
|
||||
|| foundEnt && foundEnt == playerOrHisVeh) {
|
||||
m_pPointGunAt = playerOrHisVeh;
|
||||
if (playerOrHisVeh)
|
||||
playerOrHisVeh->RegisterReference((CEntity**) &m_pPointGunAt);
|
||||
|
||||
SetWeaponLockOnTarget(playerOrHisVeh);
|
||||
SetAttack(playerOrHisVeh);
|
||||
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 1000));
|
||||
}
|
||||
|
|
|
@ -863,6 +863,13 @@ public:
|
|||
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
|
||||
CVector GetNodePosition(int32 node)
|
||||
{
|
||||
|
|
|
@ -620,9 +620,7 @@ CPed::UpdateFromLeader(void)
|
|||
m_pLookTarget->RegisterReference((CEntity **) &m_pLookTarget);
|
||||
TurnBody();
|
||||
if (m_attackTimer < CTimer::GetTimeInMilliseconds() && !GetWeapon()->IsTypeMelee()) {
|
||||
m_pPointGunAt = m_threatEntity;
|
||||
if (m_threatEntity)
|
||||
m_threatEntity->RegisterReference((CEntity **) &m_pPointGunAt);
|
||||
SetWeaponLockOnTarget(m_threatEntity);
|
||||
SetAttack(m_threatEntity);
|
||||
}
|
||||
}
|
||||
|
@ -1026,10 +1024,7 @@ CPed::ProcessObjective(void)
|
|||
CWorld::bIncludeDeadPeds = false;
|
||||
if (foundEnt == vehOfTarget) {
|
||||
SetAttack(vehOfTarget);
|
||||
m_pPointGunAt = vehOfTarget;
|
||||
if (vehOfTarget)
|
||||
vehOfTarget->RegisterReference((CEntity **) &m_pPointGunAt);
|
||||
|
||||
SetWeaponLockOnTarget(vehOfTarget);
|
||||
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 2000));
|
||||
if (distWithTargetSc <= m_distanceToCountSeekDone) {
|
||||
SetAttackTimer(CGeneral::GetRandomNumberInRange(200, 500));
|
||||
|
@ -1162,10 +1157,7 @@ CPed::ProcessObjective(void)
|
|||
CWorld::bIncludeDeadPeds = false;
|
||||
if (foundEnt == m_pedInObjective) {
|
||||
SetAttack(m_pedInObjective);
|
||||
m_pPointGunAt = m_pedInObjective;
|
||||
if (m_pedInObjective)
|
||||
m_pedInObjective->RegisterReference((CEntity **) &m_pPointGunAt);
|
||||
|
||||
SetWeaponLockOnTarget(m_pedInObjective);
|
||||
SetShootTimer(CGeneral::GetRandomNumberInRange(500.0f, 2000.0f));
|
||||
|
||||
int time;
|
||||
|
@ -1551,10 +1543,7 @@ CPed::ProcessObjective(void)
|
|||
CWorld::bIncludeDeadPeds = false;
|
||||
if (foundEnt == m_carInObjective) {
|
||||
SetAttack(m_carInObjective);
|
||||
m_pPointGunAt = m_carInObjective;
|
||||
if (m_pPointGunAt)
|
||||
m_pPointGunAt->RegisterReference((CEntity **) &m_pPointGunAt);
|
||||
|
||||
SetWeaponLockOnTarget(m_carInObjective);
|
||||
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 2000));
|
||||
if (distWithTargetSc > 10.0f && !bKindaStayInSamePlace) {
|
||||
SetAttackTimer(CGeneral::GetRandomNumberInRange(2000, 5000));
|
||||
|
|
|
@ -47,8 +47,8 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
|||
m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
|
||||
m_nSpeedTimer = 0;
|
||||
m_bSpeedTimerFlag = false;
|
||||
m_pPointGunAt = nil;
|
||||
m_nPedState = PED_IDLE;
|
||||
SetWeaponLockOnTarget(nil);
|
||||
SetPedState(PED_IDLE);
|
||||
#ifndef FIX_BUGS
|
||||
m_fCurrentStamina = m_fMaxStamina = 150.0f;
|
||||
#endif
|
||||
|
@ -73,7 +73,7 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
|||
void CPlayerPed::ClearWeaponTarget()
|
||||
{
|
||||
if (m_nPedType == PEDTYPE_PLAYER1) {
|
||||
m_pPointGunAt = nil;
|
||||
SetWeaponLockOnTarget(nil);
|
||||
TheCamera.ClearPlayerWeaponMode();
|
||||
CWeaponEffects::ClearCrossHair();
|
||||
}
|
||||
|
@ -875,9 +875,7 @@ CPlayerPed::FindNextWeaponLockOnTarget(CEntity *previousTarget, bool lookToLeft)
|
|||
if (!nextTarget)
|
||||
return false;
|
||||
|
||||
m_pPointGunAt = nextTarget;
|
||||
if (nextTarget)
|
||||
nextTarget->RegisterReference((CEntity**)&m_pPointGunAt);
|
||||
SetWeaponLockOnTarget(nextTarget);
|
||||
SetPointGunAt(nextTarget);
|
||||
return true;
|
||||
}
|
||||
|
@ -891,7 +889,7 @@ CPlayerPed::FindWeaponLockOnTarget(void)
|
|||
if (m_pPointGunAt) {
|
||||
CVector distVec = m_pPointGunAt->GetPosition() - GetPosition();
|
||||
if (distVec.Magnitude2D() > weaponRange) {
|
||||
m_pPointGunAt = nil;
|
||||
SetWeaponLockOnTarget(nil);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -922,9 +920,7 @@ CPlayerPed::FindWeaponLockOnTarget(void)
|
|||
if (!nextTarget)
|
||||
return false;
|
||||
|
||||
m_pPointGunAt = nextTarget;
|
||||
if (nextTarget)
|
||||
nextTarget->RegisterReference((CEntity**)&m_pPointGunAt);
|
||||
SetWeaponLockOnTarget(nextTarget);
|
||||
SetPointGunAt(nextTarget);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue