Skip to content

Commit

Permalink
Short circuit friend list error (#1805)
Browse files Browse the repository at this point in the history
Co-authored-by: kraflab <[email protected]>
  • Loading branch information
fabiangreffrath and kraflab authored Jul 30, 2024
1 parent 2961981 commit b7f1eba
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/p_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,17 @@ static boolean P_LookForMonsters(mobj_t *actor, boolean allaround)
current_actor = actor;
current_allaround = allaround;

// There is a bug in cl11+ that causes the player to get added
// to the monster friend list when damaged to below 50% health.
// This causes all monsters to believe friend monsters exist.
// The search algorithm is expensive and massively so on maps with many monsters.
// We still need to match rng calls for demo sync, but PIT_FindTarget is a no op.
if (((mobj_t *) cap->cnext)->player && cap->cnext == cap->cprev)
{
P_Random(pr_friends);
return false;
}

// Search first in the immediate vicinity.

if (!P_BlockThingsIterator(x, y, PIT_FindTarget))
Expand Down

0 comments on commit b7f1eba

Please sign in to comment.