From a9c396a8ce2037eb660360c7ee4c69187dcf418e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 3 May 2009 21:12:52 +0000 Subject: [PATCH] - fixed: The CHECKSWITCHRANGE line flag was ignored for one sided lines. SVN r1570 (trunk) --- docs/rh-log.txt | 1 + src/p_switch.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 465929870..47c641c18 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ May 3, 2009 (Changes by Graf Zahl) +- fixed: The CHECKSWITCHRANGE line flag was ignored for one sided lines. - Added more compatibility settings, submitted by Gez. May 2, 2009 (Changes by Graf Zahl) diff --git a/src/p_switch.cpp b/src/p_switch.cpp index 9eb0ec6a2..1d31e8c38 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -464,8 +464,7 @@ static int TryFindSwitch (side_t *side, int Where) // bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno) { - // if this line is one sided this function must always return success. - if (line->sidenum[0] == NO_SIDE || line->sidenum[1] == NO_SIDE) return true; + if (line->sidenum[0] == NO_SIDE) return true; fixed_t checktop; fixed_t checkbot; @@ -492,9 +491,18 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno) checkx = dll.x + FixedMul(dll.dx, inter); checky = dll.y + FixedMul(dll.dy, inter); + // one sided line + if (line->sidenum[1] == NO_SIDE) + { + onesided: + fixed_t sectorc = line->frontsector->ceilingplane.ZatPoint(checkx, checky); + fixed_t sectorf = line->frontsector->floorplane.ZatPoint(checkx, checky); + return (user->z + user->height >= sectorf && user->z <= sectorc); + } + // Now get the information from the line. P_LineOpening(open, NULL, line, checkx, checky, user->x, user->y); - if (open.range <= 0) return true; + if (open.range <= 0) goto onesided; if ((TryFindSwitch (side, side_t::top)) != -1) {