]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
.lin files: find optimal path from leak entity
authorRudolf Polzer <divverent@xonotic.org>
Tue, 14 Feb 2012 12:19:44 +0000 (13:19 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 14 Feb 2012 12:19:44 +0000 (13:19 +0100)
tools/quake3/q3map2/portals.c

index 944b6d8272ed29a3cc9a7c4339ffa809d4560eae..bb70e1ac348c9d682178c48ed302298c63276a7f 100644 (file)
@@ -585,9 +585,26 @@ void FloodPortals_r( node_t *node, int dist, qboolean skybox )
        
        if( skybox )
                node->skybox = skybox;
-       
-       if( node->occupied || node->opaque )
+
+       if( node->opaque)
+               return;
+
+       if( node->occupied )
+       {
+               if( node->occupied > dist )
+               {
+                       /* reduce distance! */
+                       /* for better leak line */
+                       /* note: node->occupied will also be true for all further nodes, then */
+                       node->occupied = dist;
+                       for( p = node->portals; p; p = p->next[ s ] )
+                       {
+                               s = (p->nodes[ 1 ] == node);
+                               FloodPortals_r( p->nodes[ !s ], dist + 1, skybox );
+                       }
+               }
                return;
+       }
        
        c_floodedleafs++;
        node->occupied = dist;