ref: e97e03450cf94ad8b5e3fdef06a9a51f0cfe4ed6
parent: d7a9dc101661c8077bcdb17cf6534b90ca22dd4f
author: Andrew Apted <ajapted@gmail.com>
date: Fri Dec 15 10:58:06 EST 2023
removed `sector` field of nanode_t, not needed anymore.
--- a/nano_bsp.c
+++ b/nano_bsp.c
@@ -61,10 +61,8 @@
struct Nanode
{- // when non-NULL, this is actually a leaf of the BSP tree.
- // TODO : probably remove sector
- sector_t * sector;
- seg_t * segs;
+ // when non-NULL, this is actually a leaf of the BSP tree
+ seg_t * segs;
// final index number of this node / leaf
int index;
@@ -122,7 +120,7 @@
N->bbox[BOXLEFT] >> 16, N->bbox[BOXBOTTOM] >> 16,
N->bbox[BOXRIGHT] >> 16, N->bbox[BOXTOP] >> 16);
- if (N->sector == NULL)
+ if (N->segs == NULL)
{ printf ("%spartition (%d %d) --> (%d %d)\n", spaces,N->x >> 16, N->y >> 16,
@@ -140,7 +138,7 @@
}
else
{- printf ("%ssector #%d\n", spaces, (int)(N->sector - sectors));+ printf ("%ssector #%d\n", spaces, (int)(N->segs->frontsector - sectors));seg_t * S;
for (S = N->segs ; S != NULL ; S = S->next)
@@ -250,22 +248,6 @@
node->segs = soup;
- // 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)
- {- node->sector = S->frontsector;
- break;
- }
- }
-
- if (node->sector == NULL)
- node->sector = soup->frontsector;
-
BSP_BoundingBox (soup, node->bbox);
return node;
@@ -724,7 +706,7 @@
void BSP_CountStuff (nanode_t * N)
{- if (N->sector == NULL)
+ if (N->segs == NULL)
{// must recurse first, to ensure root node gets highest index
BSP_CountStuff (N->left);
@@ -776,7 +758,7 @@
unsigned int BSP_WriteNode (nanode_t * N)
{- if (N->sector != NULL)
+ if (N->segs != NULL)
{BSP_WriteSubsector (N);
}
@@ -804,7 +786,7 @@
unsigned int index = N->index;
- if (N->sector != NULL)
+ if (N->segs != NULL)
index |= NF_SUBSECTOR;
Z_Free (N);
--
⑨