From 6432e4f6a835d96ad8b1a708786739fec09e4d70 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Fri, 24 Dec 2021 14:26:29 -0600 Subject: [PATCH] Optimized P_TestMobjZ by not running the iterator if `actor` also has THRUACTORS. --- src/playsim/p_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index 55d41e3f0d..1dd5d55781 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -1993,7 +1993,7 @@ int P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj) { AActor *onmobj = nullptr; if (pOnmobj) *pOnmobj = nullptr; - if (actor->flags & MF_NOCLIP) + if ((actor->flags & MF_NOCLIP) || (actor->flags2 & MF2_THRUACTORS)) { return true; } @@ -2011,7 +2011,7 @@ int P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj) { continue; } - if ((actor->flags2 | thing->flags2) & MF2_THRUACTORS) + if (thing->flags2 & MF2_THRUACTORS) { continue; }