From dff390e197f251e13cae8f7b222bdef15a0ad4dc Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 14 Jan 2024 21:07:45 +0100 Subject: [PATCH] Fix final edge cases in sector points Co-authored-by: Zwip-Zwap Zapony --- src/r_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 940104d7d..000c5f091 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1024,10 +1024,14 @@ boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y) for (i = 0; i < sector->linecount; i++) { + line_t *line = sector->lines[i]; vertex_t *v1, *v2; - v1 = sector->lines[i]->v1; - v2 = sector->lines[i]->v2; + if (line->frontsector == line->backsector) + continue; + + v1 = line->v1; + v2 = line->v2; // make sure v1 is below v2 if (v1->y > v2->y) @@ -1040,7 +1044,7 @@ boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y) // horizontal line, we can't match this continue; - if (v1->y <= y && y < v2->y) + if (v1->y < y && y <= v2->y) { // if the y axis in inside the line, find the point where we intersect on the x axis... fixed_t vx = v1->x + (INT64)(v2->x - v1->x) * (y - v1->y) / (v2->y - v1->y);