Prevent P_LookForPlayers from retrying sighting a player who failed (#528)

Mitigates the poor performance in Necromantic Thirst MAP25.

From Eternity Engine: 857826ba3e
This commit is contained in:
Jack Li 2025-04-08 15:01:51 -07:00 committed by Fabian Greffrath
parent 4a057a6deb
commit 6db48e1506

View File

@ -816,6 +816,7 @@ static boolean P_LookForPlayers(mobj_t *actor, boolean allaround)
{
player_t *player;
int stop, stopc, c;
boolean unseen[MAXPLAYERS] = {0};
if (actor->flags & MF_FRIEND)
{ // killough 9/9/98: friendly monsters go about players differently
@ -891,8 +892,11 @@ static boolean P_LookForPlayers(mobj_t *actor, boolean allaround)
if (player->health <= 0)
continue; // dead
if (!P_IsVisible(actor, player->mo, allaround))
if (unseen[actor->lastlook] || !P_IsVisible(actor, player->mo, allaround))
{
unseen[actor->lastlook] = true;
continue;
}
P_SetTarget(&actor->target, player->mo);