From 11fdc6f6d0acfeb9ace93beef75fc2f123221a01 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 14 Feb 2012 13:19:44 +0100 Subject: [PATCH] .lin files: find optimal path from leak entity --- tools/quake3/q3map2/portals.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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; -- 2.39.2