From: Rudolf Polzer Date: Tue, 14 Feb 2012 12:19:44 +0000 (+0100) Subject: .lin files: find optimal path from leak entity X-Git-Tag: xonotic-v0.6.0~10^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=11fdc6f6d0acfeb9ace93beef75fc2f123221a01;p=xonotic%2Fnetradiant.git .lin files: find optimal path from leak entity --- diff --git a/tools/quake3/q3map2/portals.c b/tools/quake3/q3map2/portals.c index 944b6d82..bb70e1ac 100644 --- a/tools/quake3/q3map2/portals.c +++ b/tools/quake3/q3map2/portals.c @@ -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;