Kill obj. fix & style change

This commit is contained in:
erorcun 2020-12-12 20:35:54 +03:00
parent 3038fba9ca
commit c74f03b180

View File

@ -1015,14 +1015,14 @@ CPed::ProcessObjective(void)
// I hope so // I hope so
CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f); CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f);
CVector maxShotPos = vehOfTarget->GetPosition() - ourHead; CVector maxShotPos = vehOfTarget->GetPosition() - ourHead;
maxShotPos.Normalise(); maxShotPos *= wepInfo->m_fRange / maxShotPos.Magnitude();
maxShotPos = maxShotPos * wepInfo->m_fRange + ourHead; maxShotPos += ourHead;
CWorld::bIncludeDeadPeds = true;
CColPoint foundCol; CColPoint foundCol;
CEntity *foundEnt; 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; CWorld::bIncludeDeadPeds = false;
if (foundEnt == vehOfTarget) { if (foundEnt == vehOfTarget) {
SetAttack(vehOfTarget); SetAttack(vehOfTarget);
@ -1038,8 +1038,7 @@ CPed::ProcessObjective(void)
SetAttackTimer(CGeneral::GetRandomNumberInRange(2000, 5000)); SetAttackTimer(CGeneral::GetRandomNumberInRange(2000, 5000));
} }
} }
} } else if (m_nPedState != PED_ATTACK && !bKindaStayInSamePlace && !killPlayerInNoPoliceZone) {
else if (m_nPedState != PED_ATTACK && !bKindaStayInSamePlace && !killPlayerInNoPoliceZone) {
if (vehOfTarget) { if (vehOfTarget) {
if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) { if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) {
GoToNearestDoor(vehOfTarget); GoToNearestDoor(vehOfTarget);
@ -1152,17 +1151,15 @@ CPed::ProcessObjective(void)
target = m_pedInObjective->GetPosition(); target = m_pedInObjective->GetPosition();
target -= ourHead; target -= ourHead;
target.Normalise(); target *= wepInfo->m_fRange / target.Magnitude();
target = target * wepInfo->m_fRange + ourHead; target += ourHead;
CColPoint foundCol;
CEntity *foundEnt = nil;
CWorld::bIncludeDeadPeds = true; CWorld::bIncludeDeadPeds = true;
CEntity *foundEnt = nil; CWorld::ProcessLineOfSight(ourHead, target, foundCol, foundEnt, true, true, true, true, false, true, false);
CColPoint foundCol; CWorld::bIncludeDeadPeds = false;
CWorld::ProcessLineOfSight(
ourHead, target, foundCol, foundEnt,
true, true, true, false, true, false);
CWorld::bIncludeDeadPeds = 0;
if (foundEnt == m_pedInObjective) { if (foundEnt == m_pedInObjective) {
SetAttack(m_pedInObjective); SetAttack(m_pedInObjective);
m_pPointGunAt = m_pedInObjective; m_pPointGunAt = m_pedInObjective;
@ -1180,7 +1177,8 @@ CPed::ProcessObjective(void)
SetAttackTimer(time); SetAttackTimer(time);
bObstacleShowedUpDuringKillObjective = false; bObstacleShowedUpDuringKillObjective = false;
} else if (foundEnt) { } else {
if (foundEnt) {
if (foundEnt->IsPed()) { if (foundEnt->IsPed()) {
SetAttackTimer(CGeneral::GetRandomNumberInRange(500.0f, 1000.0f)); SetAttackTimer(CGeneral::GetRandomNumberInRange(500.0f, 1000.0f));
bObstacleShowedUpDuringKillObjective = false; bObstacleShowedUpDuringKillObjective = false;
@ -1199,6 +1197,7 @@ CPed::ProcessObjective(void)
m_fleeFrom = foundEnt; m_fleeFrom = foundEnt;
m_fleeFrom->RegisterReference((CEntity**) &m_fleeFrom); m_fleeFrom->RegisterReference((CEntity**) &m_fleeFrom);
}
SetPointGunAt(m_pedInObjective); SetPointGunAt(m_pedInObjective);
} }
} }
@ -1541,14 +1540,14 @@ CPed::ProcessObjective(void)
// I hope so // I hope so
CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f); CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f);
CVector maxShotPos = m_carInObjective->GetPosition() - ourHead; CVector maxShotPos = m_carInObjective->GetPosition() - ourHead;
maxShotPos.Normalise(); maxShotPos *= wepInfo->m_fRange / maxShotPos.Magnitude();
maxShotPos = maxShotPos * wepInfo->m_fRange + ourHead; maxShotPos += ourHead;
CWorld::bIncludeDeadPeds = true;
CColPoint foundCol; CColPoint foundCol;
CEntity *foundEnt; 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; CWorld::bIncludeDeadPeds = false;
if (foundEnt == m_carInObjective) { if (foundEnt == m_carInObjective) {
SetAttack(m_carInObjective); SetAttack(m_carInObjective);