diff --git a/src/p_things.cpp b/src/p_things.cpp index 94dc1df1d..06a0252ab 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -756,6 +756,16 @@ int P_Thing_CheckProximity(AActor *self, PClass *classname, double distance, int if ((flags & CPXF_CHECKSIGHT) && !(P_CheckSight(mo, ref, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY))) continue; + if (mo->flags6 & MF6_KILLED) + { + if (!(flags & (CPXF_COUNTDEAD | CPXF_DEADONLY))) + continue; + } + else + { + if (flags & CPXF_DEADONLY) + continue; + } if (ptrWillChange) { current = ref->Distance2D(mo); @@ -773,16 +783,6 @@ int P_Thing_CheckProximity(AActor *self, PClass *classname, double distance, int else if (!dist) dist = mo; // Just get the first one and call it quits if there's nothing selected. } - if (mo->flags6 & MF6_KILLED) - { - if (!(flags & (CPXF_COUNTDEAD | CPXF_DEADONLY))) - continue; - } - else - { - if (flags & CPXF_DEADONLY) - continue; - } counter++; // Abort if the number of matching classes nearby is greater, we have obviously succeeded in our goal.