From 3bc54d3757dc866d1509f29dd4bc3e4614441d53 Mon Sep 17 00:00:00 2001 From: Kartinea Date: Mon, 6 May 2024 16:08:41 -0700 Subject: [PATCH] Fix invisibility affect on enemies When performing the ShadowBlock check, we previously would return a nullptr actor if nothing was between the monster and the player. This resulted in the monster aiming as if you didn't have invisibility. Fall back to returning the target actor if it is shadowed but nothing is in between the two. --- src/playsim/shadowinlines.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/playsim/shadowinlines.h b/src/playsim/shadowinlines.h index 60caa9506..574abd251 100644 --- a/src/playsim/shadowinlines.h +++ b/src/playsim/shadowinlines.h @@ -85,7 +85,12 @@ inline bool AffectedByShadows(AActor* self) inline AActor* CheckForShadows(AActor* self, AActor* other, DVector3 pos, double& penaltyFactor) { - return ((other && (other->flags & MF_SHADOW)) || (self->flags9 & MF9_DOSHADOWBLOCK)) ? P_CheckForShadowBlock(self, other, pos, penaltyFactor) : nullptr; + if ((other && (other->flags & MF_SHADOW)) || (self->flags9 & MF9_DOSHADOWBLOCK)) + { + AActor* shadowBlock = P_CheckForShadowBlock(self, other, pos, penaltyFactor); + return shadowBlock ? shadowBlock : other; + } + return nullptr; } inline AActor* PerformShadowChecks(AActor* self, AActor* other, DVector3 pos, double& penaltyFactor)