Enhanced pathing for floaters

Their checks are now 2D instead of 3D.
This commit is contained in:
Major Cooke 2024-03-09 13:02:35 -06:00 committed by Rachael Alexanderson
parent 0d9855cfe7
commit f081ef1850
2 changed files with 26 additions and 2 deletions

View file

@ -2733,14 +2733,24 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
sight = P_CheckSight(actor, actor->target, SF_SEEPASTBLOCKEVERYTHING);
}
else sight = 0;
// Out of sight, so keep pathfinding
if (sight == 0)
{
if (pnode && !(actor->goal->flags & MF_AMBUSH))
{
AActor* temp = actor->target;
actor->target = actor->goal;
bool reached = (P_CheckMeleeRange(actor));
bool reached = false;
// 2D checks for floaters, 3D otherwise
if (actor->flags & MF_FLOAT)
{
bool vrange = !!(actor->flags5 & MF5_NOVERTICALMELEERANGE);
actor->flags5 |= MF5_NOVERTICALMELEERANGE;
P_CheckMeleeRange(actor);
if (!vrange) actor->flags5 &= ~(MF5_NOVERTICALMELEERANGE);
}
else reached = (P_CheckMeleeRange(actor));
actor->target = temp;
if (reached)

View file

@ -829,6 +829,20 @@ class Actor : Thinker native
if (!next || next == node)
continue;
// 2D checks for floaters, 3D for ground
Actor tar = target;
bool vrange = bNOVERTICALMELEERANGE;
bNOVERTICALMELEERANGE = bFLOAT;
target = next;
bool inrange = CheckMeleeRange();
target = tar;
bNOVERTICALMELEERANGE = vrange;
if (inrange)
continue;
// Monsters will never 'reach' AMBUSH flagged nodes. Instead, the engine
// indicates they're reached the moment they tele/portal.