Short circuit friend list error (#1805)

Co-authored-by: kraflab <kraflab@gmail.com>
This commit is contained in:
Fabian Greffrath 2024-07-30 11:49:29 +02:00 committed by GitHub
parent 296198196c
commit b7f1eba406
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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))