From 6db48e1506e533550dd635bad2e7fd5beb8e2cae Mon Sep 17 00:00:00 2001 From: Jack Li Date: Tue, 8 Apr 2025 15:01:51 -0700 Subject: [PATCH] Prevent P_LookForPlayers from retrying sighting a player who failed (#528) Mitigates the poor performance in Necromantic Thirst MAP25. From Eternity Engine: https://github.com/team-eternity/eternity/commit/857826ba3e39041b072c50e911850000f8b17d8c --- src/p_enemy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 7da3ee21..6d366dae 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -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);