Skip to content

Commit

Permalink
Fixed: A_LookEx did not account for the +LOOKALLAROUND flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ru5tK1ng authored and coelckers committed Mar 17, 2024
1 parent caa4728 commit e62651e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/playsim/p_enemy.cpp
Expand Up @@ -1271,7 +1271,7 @@ int P_IsVisible(AActor *lookee, AActor *other, INTBOOL allaround, FLookExParams
{
maxdist = params->maxDist;
mindist = params->minDist;
fov = params->Fov;
fov = allaround ? 0 : params->Fov; // [RK] Account for LOOKALLAROUND flag.
}
else
{
Expand Down Expand Up @@ -2086,7 +2086,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LookEx)
{
// If we find a valid target here, the wandering logic should *not*
// be activated! If would cause the seestate to be set twice.
if (P_LookForPlayers(self, true, &params))
if (P_LookForPlayers(self, (self->flags4 & MF4_LOOKALLAROUND), &params)) // [RK] Passing true for allround should only occur if the flag is actually set.
goto seeyou;
}

Expand Down

1 comment on commit e62651e

@AFADoomer
Copy link
Contributor

@AFADoomer AFADoomer commented on e62651e Apr 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this check also need to be fixed on line 2142 (and possible in other places where P_IsVisible gets called downstream) as well?

Otherwise enemies always default to calling P_LookForPlayers with the allaround flag as true if they didn't have a hated TID or soundtarget available. Since you've fixed P_IsVisible to now properly account for the flag, this causes enemies to behave as if they were flagged as LOOKALLAROUND when they are not.

It looks like this check was added properly to A_Look (See line 1965) a long time ago, but not to A_LookEx.

Please sign in to comment.