From ded428230d4d29fcd9aa8d547c7c163ff242883f Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 31 May 2008 03:39:57 +0000 Subject: [PATCH] - If an actor's current target temporarily goes unshootable, its threshold is now reset to 0, so it will more readily switch back to it. SVN r1006 (trunk) --- docs/rh-log.txt | 2 ++ src/p_enemy.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 146c77a68..9c3193502 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ May 30, 2008 +- If an actor's current target temporarily goes unshootable, its threshold + is now reset to 0, so it will more readily switch back to it. - Fixed: Deactivating the game no longer allows reverb effects to continue playing while the sound is paused. - Fixed: S_StartNamedSound() looked for SECF_SILENT in MoreFlags instead of diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index a61b87266..b00cebda2 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -1852,6 +1852,14 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi } if (!actor->target || !(actor->target->flags & MF_SHOOTABLE)) { // look for a new target + if (actor->target != NULL && (actor->target->flags2 & MF2_NONSHOOTABLE)) + { + // Target is only temporarily unshootable, so remember it. + actor->lastenemy = actor->target; + // Switch targets faster, since we're only changing because we can't + // hurt our old one temporarily. + actor->threshold = 0; + } if (P_LookForPlayers (actor, true) && actor->target != actor->goal) { // got a new target actor->flags &= ~MF_INCHASE;