summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2020-12-12 18:35:54 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2020-12-12 18:36:58 +0100
commitc74f03b180c99b92ab68f999ab63a5e70b4b3ae0 (patch)
treee02445d8221f51cc1e3c76ccf0558422364754de
parentSync Frontend, Peds with miami 2 (diff)
downloadre3-c74f03b180c99b92ab68f999ab63a5e70b4b3ae0.tar
re3-c74f03b180c99b92ab68f999ab63a5e70b4b3ae0.tar.gz
re3-c74f03b180c99b92ab68f999ab63a5e70b4b3ae0.tar.bz2
re3-c74f03b180c99b92ab68f999ab63a5e70b4b3ae0.tar.lz
re3-c74f03b180c99b92ab68f999ab63a5e70b4b3ae0.tar.xz
re3-c74f03b180c99b92ab68f999ab63a5e70b4b3ae0.tar.zst
re3-c74f03b180c99b92ab68f999ab63a5e70b4b3ae0.zip
-rw-r--r--src/peds/PedAI.cpp71
1 files changed, 35 insertions, 36 deletions
diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp
index 62b27134..8c066b8f 100644
--- a/src/peds/PedAI.cpp
+++ b/src/peds/PedAI.cpp
@@ -1015,14 +1015,14 @@ CPed::ProcessObjective(void)
// I hope so
CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f);
CVector maxShotPos = vehOfTarget->GetPosition() - ourHead;
- maxShotPos.Normalise();
- maxShotPos = maxShotPos * wepInfo->m_fRange + ourHead;
+ maxShotPos *= wepInfo->m_fRange / maxShotPos.Magnitude();
+ maxShotPos += ourHead;
- CWorld::bIncludeDeadPeds = true;
CColPoint foundCol;
CEntity *foundEnt;
- CWorld::ProcessLineOfSight(ourHead, maxShotPos, foundCol, foundEnt,
- true, true, true, true, false, true, false);
+
+ CWorld::bIncludeDeadPeds = true;
+ CWorld::ProcessLineOfSight(ourHead, maxShotPos, foundCol, foundEnt, true, true, true, true, false, true, false);
CWorld::bIncludeDeadPeds = false;
if (foundEnt == vehOfTarget) {
SetAttack(vehOfTarget);
@@ -1038,8 +1038,7 @@ CPed::ProcessObjective(void)
SetAttackTimer(CGeneral::GetRandomNumberInRange(2000, 5000));
}
}
- }
- else if (m_nPedState != PED_ATTACK && !bKindaStayInSamePlace && !killPlayerInNoPoliceZone) {
+ } else if (m_nPedState != PED_ATTACK && !bKindaStayInSamePlace && !killPlayerInNoPoliceZone) {
if (vehOfTarget) {
if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) {
GoToNearestDoor(vehOfTarget);
@@ -1152,17 +1151,15 @@ CPed::ProcessObjective(void)
target = m_pedInObjective->GetPosition();
target -= ourHead;
- target.Normalise();
- target = target * wepInfo->m_fRange + ourHead;
+ target *= wepInfo->m_fRange / target.Magnitude();
+ target += ourHead;
- CWorld::bIncludeDeadPeds = true;
- CEntity *foundEnt = nil;
CColPoint foundCol;
+ CEntity *foundEnt = nil;
- CWorld::ProcessLineOfSight(
- ourHead, target, foundCol, foundEnt,
- true, true, true, false, true, false);
- CWorld::bIncludeDeadPeds = 0;
+ CWorld::bIncludeDeadPeds = true;
+ CWorld::ProcessLineOfSight(ourHead, target, foundCol, foundEnt, true, true, true, true, false, true, false);
+ CWorld::bIncludeDeadPeds = false;
if (foundEnt == m_pedInObjective) {
SetAttack(m_pedInObjective);
m_pPointGunAt = m_pedInObjective;
@@ -1180,25 +1177,27 @@ CPed::ProcessObjective(void)
SetAttackTimer(time);
bObstacleShowedUpDuringKillObjective = false;
- } else if (foundEnt) {
- if (foundEnt->IsPed()) {
- SetAttackTimer(CGeneral::GetRandomNumberInRange(500.0f, 1000.0f));
- bObstacleShowedUpDuringKillObjective = false;
- } else {
- if (foundEnt->IsObject()) {
- SetAttackTimer(CGeneral::GetRandomNumberInRange(200.0f, 400.0f));
- bObstacleShowedUpDuringKillObjective = true;
- } else if (foundEnt->IsVehicle()) {
- SetAttackTimer(CGeneral::GetRandomNumberInRange(400.0f, 600.0f));
- bObstacleShowedUpDuringKillObjective = true;
+ } else {
+ if (foundEnt) {
+ if (foundEnt->IsPed()) {
+ SetAttackTimer(CGeneral::GetRandomNumberInRange(500.0f, 1000.0f));
+ bObstacleShowedUpDuringKillObjective = false;
} else {
- SetAttackTimer(CGeneral::GetRandomNumberInRange(700.0f, 1200.0f));
- bObstacleShowedUpDuringKillObjective = true;
+ if (foundEnt->IsObject()) {
+ SetAttackTimer(CGeneral::GetRandomNumberInRange(200.0f, 400.0f));
+ bObstacleShowedUpDuringKillObjective = true;
+ } else if (foundEnt->IsVehicle()) {
+ SetAttackTimer(CGeneral::GetRandomNumberInRange(400.0f, 600.0f));
+ bObstacleShowedUpDuringKillObjective = true;
+ } else {
+ SetAttackTimer(CGeneral::GetRandomNumberInRange(700.0f, 1200.0f));
+ bObstacleShowedUpDuringKillObjective = true;
+ }
}
- }
- m_fleeFrom = foundEnt;
- m_fleeFrom->RegisterReference((CEntity**) &m_fleeFrom);
+ m_fleeFrom = foundEnt;
+ m_fleeFrom->RegisterReference((CEntity**) &m_fleeFrom);
+ }
SetPointGunAt(m_pedInObjective);
}
}
@@ -1541,14 +1540,14 @@ CPed::ProcessObjective(void)
// I hope so
CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f);
CVector maxShotPos = m_carInObjective->GetPosition() - ourHead;
- maxShotPos.Normalise();
- maxShotPos = maxShotPos * wepInfo->m_fRange + ourHead;
+ maxShotPos *= wepInfo->m_fRange / maxShotPos.Magnitude();
+ maxShotPos += ourHead;
- CWorld::bIncludeDeadPeds = true;
CColPoint foundCol;
CEntity *foundEnt;
- CWorld::ProcessLineOfSight(ourHead, maxShotPos, foundCol, foundEnt,
- true, true, true, true, false, true, false);
+
+ CWorld::bIncludeDeadPeds = true;
+ CWorld::ProcessLineOfSight(ourHead, maxShotPos, foundCol, foundEnt, true, true, true, true, false, true, false);
CWorld::bIncludeDeadPeds = false;
if (foundEnt == m_carInObjective) {
SetAttack(m_carInObjective);