mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Enhanced pathing for floaters
Their checks are now 2D instead of 3D.
This commit is contained in:
parent
0d9855cfe7
commit
f081ef1850
2 changed files with 26 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in a new issue