shithub: nanobsp

Download patch

ref: cdd1296e6dc80a6514c9b5626c8e96ed75b0e127
parent: b4c6d06e42fcee35b9e673358ca00e7748c52faf
author: Andrew Apted <ajapted@gmail.com>
date: Mon Dec 11 08:15:32 EST 2023

misc code tidying in nano_bsp.c

--- a/nano_bsp.c
+++ b/nano_bsp.c
@@ -375,12 +375,9 @@
 	}
 
 	// a viable partition either splits something, or has other segs
-	// lying on both the left and right sides.
+	// lying on *both* the left and right sides.
 
-	if (eval->split == 0 && (eval->left == 0 || eval->right == 0))
-		return false;
-
-	return true;
+	return (eval->split > 0 || (eval->left > 0 && eval->right > 0));
 }
 
 //
@@ -399,7 +396,7 @@
 	if (count < FAST_THRESHOLD)
 		return NULL;
 
-	// determine bounding box of segs
+	// determine bounding box of the segs
 	fixed_t bbox[4];
 
 	BSP_BoundingBox (soup, bbox);
@@ -413,7 +410,7 @@
 	seg_t * horiz_part = NULL;
 	fixed_t horiz_dist = (1 << 30);
 
-	// find the segs closest to middle of bbox
+	// find the seg closest to the middle of the bbox
 	seg_t * part;
 	for (part = soup ; part != NULL ; part = part->next)
 	{
@@ -584,7 +581,7 @@
 //
 // For segs not intersecting the partition, just move them into the
 // correct output list (`lefts` or `rights`).  otherwise split the seg
-// at the intersection point, one pieces goes left, the other right.
+// at the intersection point, one piece goes left, the other right.
 //
 void BSP_SplitSegs (seg_t * part, seg_t * soup, seg_t ** lefts, seg_t ** rights)
 {
@@ -673,7 +670,7 @@
 	N->dy = part->v2->y - N->y;
 
 	// ensure partitions are a minimum length, since the engine's
-	// R_PointOnSide() functions have very poor accuracy when the
+	// R_PointOnSide() function has very poor accuracy when the
 	// delta is too small, and that WILL BREAK a map.
 
 	fixed_t min_size = 64 * FRACUNIT;
--