ref: 3bda65bfe8bc9583d30d9096d19b54c17d55ce94
parent: 4ca3d741525333c8c5fa8b023c0b2f9c04e7f8f6
author: Andrew Apted <ajapted@gmail.com>
date: Mon Dec 11 10:45:38 EST 2023
when determining sector for a subsector, try to avoid self-ref lines.
--- a/nano_bsp.c
+++ b/nano_bsp.c
@@ -236,8 +236,21 @@
sub->segs = soup;
- // TODO: better method, try to avoid self-ref lines
- sub->sector = soup->frontsector;
+ // to determine the sector, avoid self-referencing lines
+ // since they are often used for special effects.
+
+ seg_t * S;
+ for (S = soup ; S != NULL ; S = S->next)
+ {+ if (S->frontsector != S->backsector)
+ {+ sub->sector = S->frontsector;
+ break;
+ }
+ }
+
+ if (sub->sector == NULL)
+ sub->sector = soup->frontsector;
node->sub = sub;
BSP_BoundingBox (soup, node->bbox);
--
⑨