]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/portals.c
another experimental change: better handle leaky maps
[xonotic/netradiant.git] / tools / quake3 / q3map2 / portals.c
index 2efc1db47c0ea1bcad12fa27bcae6d214038cf92..944b6d8272ed29a3cc9a7c4339ffa809d4560eae 100644 (file)
@@ -410,7 +410,7 @@ void SplitNodePortals (node_t *node)
 // cut the portal into two portals, one on each side of the cut plane
 //
                ClipWindingEpsilon (p->winding, plane->normal, plane->dist,
-                       SPLIT_WINDING_EPSILON, &frontwinding, &backwinding);
+                       SPLIT_WINDING_EPSILON, &frontwinding, &backwinding); /* not strict, we want to always keep one of them even if coplanar */
 
                if (frontwinding && WindingIsTiny(frontwinding))
                {
@@ -644,7 +644,7 @@ Marks all nodes that can be reached by entites
 =============
 */
 
-qboolean FloodEntities( tree_t *tree )
+int FloodEntities( tree_t *tree )
 {
        int                     i, s;
        vec3_t          origin, offset, scale, angles;
@@ -739,11 +739,17 @@ qboolean FloodEntities( tree_t *tree )
        Sys_FPrintf( SYS_VRB, "%9d flooded leafs\n", c_floodedleafs );
        
        if( !inside )
+       {
                Sys_FPrintf( SYS_VRB, "no entities in open -- no filling\n" );
-       else if( tree->outside_node.occupied )
-               Sys_FPrintf( SYS_VRB, "entity reached from outside -- no filling\n" );
+               return FLOODENTITIES_EMPTY;
+       }
+       if( tree->outside_node.occupied )
+       {
+               Sys_FPrintf( SYS_VRB, "entity reached from outside -- leak detected\n" );
+               return FLOODENTITIES_LEAKED;
+       }
        
-       return (qboolean) (inside && !tree->outside_node.occupied);
+       return FLOODENTITIES_GOOD;
 }
 
 /*