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.
This commit is contained in:
Kartinea 2024-05-06 16:08:41 -07:00 committed by Christoph Oelckers
parent cf8a04c457
commit 3bc54d3757

View file

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