Skip to content

Commit

Permalink
Fix invisibility affect on enemies
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
scottdstanfield authored and coelckers committed May 22, 2024
1 parent cf8a04c commit 3bc54d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/playsim/shadowinlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3bc54d3

Please sign in to comment.