From d9453138f91cb0dc7633bd8b3592519984f45eb8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 8 Oct 2022 18:14:51 +0200 Subject: [PATCH] - fixed FAFcansee not working in some edge cases where one actor is very small and poorly placed. Instead of directly going to the alternative, let's just do a regular cansee anyway and only run the fallback if this fails. hitscan is not good enough to perform sight checks. --- source/games/sw/src/rooms.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index d44312a7f..44859b9cf 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -256,10 +256,17 @@ bool FAFcansee(const DVector3& start, sectortype* sects, const DVector3& end, se bool plax_found = false; // ASSERT(sects >= 0 && secte >= 0); + // luckily we do not have portal setups with otherwise connected sectors, so let's go to the original routine for all cases. + // The hack job below won't always cut it. + if (cansee(start, sects, end, secte)) + { + return true; + } + // early out to regular routine if ((!sects || !FAF_Sector(sects)) && (!secte || !FAF_Sector(secte))) { - return !!cansee(start, sects, end, secte); + return false; } // get angle