summaryrefslogtreecommitdiffstats
path: root/src/peds/PedAI.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-01-11 00:35:03 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2021-01-11 00:35:03 +0100
commit53a99cb9ee8514438a64960a54adb4e1b2cbd349 (patch)
tree780fcf41a5b5e3c06161e54a9ac8e2195e6cc9d7 /src/peds/PedAI.cpp
parentMerge branch 'lcs-dev' into lcs (diff)
downloadre3-53a99cb9ee8514438a64960a54adb4e1b2cbd349.tar
re3-53a99cb9ee8514438a64960a54adb4e1b2cbd349.tar.gz
re3-53a99cb9ee8514438a64960a54adb4e1b2cbd349.tar.bz2
re3-53a99cb9ee8514438a64960a54adb4e1b2cbd349.tar.lz
re3-53a99cb9ee8514438a64960a54adb4e1b2cbd349.tar.xz
re3-53a99cb9ee8514438a64960a54adb4e1b2cbd349.tar.zst
re3-53a99cb9ee8514438a64960a54adb4e1b2cbd349.zip
Diffstat (limited to '')
-rw-r--r--src/peds/PedAI.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp
index de82524d..244c7b84 100644
--- a/src/peds/PedAI.cpp
+++ b/src/peds/PedAI.cpp
@@ -370,6 +370,51 @@ CPed::SetObjective(eObjective newObj, void *entity)
}
}
+void
+CPed::SetObjective(eObjective newObj, CVector dest, float safeDist)
+{
+ if (DyingOrDead())
+ return;
+
+ if (m_prevObjective != OBJECTIVE_NONE && m_prevObjective == newObj)
+ return;
+
+ if (m_objective == newObj) {
+ if (newObj == OBJECTIVE_GOTO_AREA_ANY_MEANS || newObj == OBJECTIVE_GOTO_AREA_ON_FOOT || newObj == OBJECTIVE_RUN_TO_AREA || newObj == OBJECTIVE_SPRINT_TO_AREA) {
+ if (m_nextRoutePointPos == dest && m_distanceToCountSeekDone == safeDist)
+ return;
+ }
+ else if (newObj == OBJECTIVE_GUARD_SPOT) {
+ if (m_vecSpotToGuard == dest && m_radiusToGuard == safeDist)
+ return;
+ }
+ }
+
+ ClearPointGunAt();
+ SetObjectiveTimer(0);
+ bObjectiveCompleted = false;
+ if (IsTemporaryObjective(m_objective)) {
+ m_prevObjective = newObj;
+ }
+ else {
+ if (m_objective != newObj)
+ SetStoredObjective();
+
+ m_objective = newObj;
+ }
+
+ if (newObj == OBJECTIVE_GUARD_SPOT) {
+ m_vecSpotToGuard = dest;
+ m_radiusToGuard = safeDist;
+ }
+ else if (newObj == OBJECTIVE_GOTO_AREA_ANY_MEANS || newObj == OBJECTIVE_GOTO_AREA_ON_FOOT || newObj == OBJECTIVE_RUN_TO_AREA || newObj == OBJECTIVE_SPRINT_TO_AREA) {
+ m_pNextPathNode = nil;
+ m_nextRoutePointPos = dest;
+ m_vecSeekPos = m_nextRoutePointPos;
+ bUsePedNodeSeek = true;
+ }
+}
+
// --MIAMI: Done
// Only used in 01E1: SET_CHAR_OBJ_FOLLOW_ROUTE opcode
// IDA fails very badly in here, puts a fake loop and ignores SetFollowRoute call...