]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/visflow.c
Merge branch 'NateEag-master-patch-12920' into 'master'
[xonotic/netradiant.git] / tools / quake3 / q3map2 / visflow.c
index 6c48e2da867dea8cdd62bc7ea74adf7eeeb5bbfe..adc0676110c942e492a094d17d6ddc5592d5bc36 100644 (file)
@@ -72,8 +72,6 @@ int CountBits( byte *bits, int numbits ){
 }
 
 int c_fullskip;
-int c_portalskip, c_leafskip;
-int c_vistest, c_mighttest;
 
 int c_chop, c_nochop;
 
@@ -1364,8 +1362,7 @@ void CreatePassages( int portalnum ){
                        continue;
                }
 
-               passage = (passage_t *) safe_malloc( sizeof( passage_t ) + portalbytes );
-               memset( passage, 0, sizeof( passage_t ) + portalbytes );
+               passage = (passage_t *) safe_malloc0( sizeof( passage_t ) + portalbytes );
                numseperators = AddSeperators( portal->winding, target->winding, qfalse, seperators, MAX_SEPERATORS * 2 );
                numseperators += AddSeperators( target->winding, portal->winding, qtrue, &seperators[numseperators], MAX_SEPERATORS * 2 - numseperators );
 
@@ -1585,14 +1582,11 @@ void BasePortalVis( int portalnum ){
                return;
        }
 
-       p->portalfront = safe_malloc( portalbytes );
-       memset( p->portalfront, 0, portalbytes );
+       p->portalfront = safe_malloc0( portalbytes );
 
-       p->portalflood = safe_malloc( portalbytes );
-       memset( p->portalflood, 0, portalbytes );
+       p->portalflood = safe_malloc0( portalbytes );
 
-       p->portalvis = safe_malloc( portalbytes );
-       memset( p->portalvis, 0, portalbytes );
+       p->portalvis = safe_malloc0( portalbytes );
 
        for ( j = 0, tp = portals ; j < numportals * 2 ; j++, tp++ )
        {
@@ -1614,8 +1608,28 @@ void BasePortalVis( int portalnum ){
                   }
                 */
 
+               if( !p->sky && !tp->sky && farPlaneDist != 0.0f && farPlaneDistMode == 'o' )
+               {
+                       VectorSubtract( p->origin, tp->origin, dir );
+                       if( VectorLength( dir ) > farPlaneDist )
+                               continue;
+               }
+
+               if( !p->sky && !tp->sky && farPlaneDist != 0.0f && farPlaneDistMode == 'e' )
+               {
+                       VectorSubtract( p->origin, tp->origin, dir );
+                       if( VectorLength( dir ) + p->radius + tp->radius > 2.0f * farPlaneDist )
+                               continue;
+               }
+
+               if( !p->sky && !tp->sky && farPlaneDist != 0.0f && farPlaneDistMode == 'r' )
+               {
+                       if( p->radius + tp->radius > farPlaneDist )
+                               continue;
+               }
+
                /* ydnar: this is known-to-be-working farplane code */
-               if ( farPlaneDist > 0.0f ) {
+               if ( !p->sky && !tp->sky && farPlaneDist != 0.0f ) {
                        VectorSubtract( p->origin, tp->origin, dir );
                        if ( VectorLength( dir ) - p->radius - tp->radius > farPlaneDist ) {
                                continue;