reduce more diff noise
[xonotic/netradiant.git] / tools / quake3 / q3map2 / facebsp.c
index 2e4ffff..e5390ed 100644 (file)
@@ -1,30 +1,30 @@
 /* -------------------------------------------------------------------------------
 
 /* -------------------------------------------------------------------------------
 
-Copyright (C) 1999-2007 id Software, Inc. and contributors.
-For a list of contributors, see the accompanying CONTRIBUTORS file.
+   Copyright (C) 1999-2007 id Software, Inc. and contributors.
+   For a list of contributors, see the accompanying CONTRIBUTORS file.
 
 
-This file is part of GtkRadiant.
+   This file is part of GtkRadiant.
 
 
-GtkRadiant is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   GtkRadiant is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
 
-GtkRadiant is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   GtkRadiant is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
 
-You should have received a copy of the GNU General Public License
-along with GtkRadiant; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+   You should have received a copy of the GNU General Public License
+   along with GtkRadiant; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 
-----------------------------------------------------------------------------------
+   ----------------------------------------------------------------------------------
 
 
-This code has been altered significantly from its original form, to support
-several games based on the Quake III Arena engine, in the form of "Q3Map2."
+   This code has been altered significantly from its original form, to support
+   several games based on the Quake III Arena engine, in the form of "Q3Map2."
 
 
-------------------------------------------------------------------------------- */
+   ------------------------------------------------------------------------------- */
 
 
 
 
 
 
@@ -38,19 +38,19 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2."
 
 
 
 
 
 
-int                    c_faceLeafs;
+int c_faceLeafs;
 
 
 /*
 
 
 /*
-================
-AllocBspFace
-================
-*/
-face_t *AllocBspFace( void ) {
-       face_t  *f;
+   ================
+   AllocBspFace
+   ================
+ */
+face_t  *AllocBspFace( void ) {
+       face_t  *f;
 
 
-       f = safe_malloc(sizeof(*f));
-       memset( f, 0, sizeof(*f) );
+       f = safe_malloc( sizeof( *f ) );
+       memset( f, 0, sizeof( *f ) );
 
        return f;
 }
 
        return f;
 }
@@ -58,11 +58,11 @@ face_t      *AllocBspFace( void ) {
 
 
 /*
 
 
 /*
-================
-FreeBspFace
-================
-*/
-void   FreeBspFace( face_t *f ) {
+   ================
+   FreeBspFace
+   ================
+ */
+void    FreeBspFace( face_t *f ) {
        if ( f->w ) {
                FreeWinding( f->w );
        }
        if ( f->w ) {
                FreeWinding( f->w );
        }
@@ -72,43 +72,39 @@ void        FreeBspFace( face_t *f ) {
 
 
 /*
 
 
 /*
-SelectSplitPlaneNum()
-finds the best split plane for this node
-*/
-
-static void SelectSplitPlaneNum( node_t *node, face_t *list, int *splitPlaneNum, int *compileFlags )
-{
-       face_t          *split;
-       face_t          *check;
-       face_t          *bestSplit;
-       int                     splits, facing, front, back;
-       int                     side;
-       plane_t         *plane;
-       int                     value, bestValue;
-       int                     i;
-       vec3_t          normal;
-       float           dist;
-       int                     planenum;
-       float       sizeBias;
-
-       //int frontC,backC,splitsC,facingC;
-
-       
+   SelectSplitPlaneNum()
+   finds the best split plane for this node
+ */
+
+static void SelectSplitPlaneNum( node_t *node, face_t *list, int *splitPlaneNum, int *compileFlags ){
+       face_t *split;
+       face_t *check;
+       face_t *bestSplit;
+       int splits, facing, front, back;
+       int side;
+       plane_t *plane;
+       int value, bestValue;
+       int i;
+       vec3_t normal;
+       float dist;
+       int planenum;
+       float sizeBias;
+
        /* ydnar: set some defaults */
        *splitPlaneNum = -1; /* leaf */
        *compileFlags = 0;
        /* ydnar: set some defaults */
        *splitPlaneNum = -1; /* leaf */
        *compileFlags = 0;
-       
+
        /* ydnar 2002-06-24: changed this to split on z-axis as well */
        /* ydnar 2002-09-21: changed blocksize to be a vector, so mappers can specify a 3 element value */
        /* ydnar 2002-06-24: changed this to split on z-axis as well */
        /* ydnar 2002-09-21: changed blocksize to be a vector, so mappers can specify a 3 element value */
-       
+
        /* if it is crossing a block boundary, force a split */
        /* if it is crossing a block boundary, force a split */
-       for( i = 0; i < 3; i++ )
+       for ( i = 0; i < 3; i++ )
        {
        {
-               if( blockSize[ i ] <= 0 )
+               if ( blockSize[ i ] <= 0 ) {
                        continue;
                        continue;
-               dist = blockSize[ i ] * (floor( node->mins[ i ] / blockSize[ i ] ) + 1);
-               if( node->maxs[ i ] > dist )
-               {
+               }
+               dist = blockSize[ i ] * ( floor( node->mins[ i ] / blockSize[ i ] ) + 1 );
+               if ( node->maxs[ i ] > dist ) {
                        VectorClear( normal );
                        normal[ i ] = 1;
                        planenum = FindFloatPlane( normal, dist, 0, NULL );
                        VectorClear( normal );
                        normal[ i ] = 1;
                        planenum = FindFloatPlane( normal, dist, 0, NULL );
@@ -116,17 +112,17 @@ static void SelectSplitPlaneNum( node_t *node, face_t *list, int *splitPlaneNum,
                        return;
                }
        }
                        return;
                }
        }
-       
+
        /* pick one of the face planes */
        bestValue = -99999;
        bestSplit = list;
        /* pick one of the face planes */
        bestValue = -99999;
        bestSplit = list;
-       
+
 
        // div0: this check causes detail/structural mixes
        //for( split = list; split; split = split->next )
        //      split->checked = qfalse;
 
        // div0: this check causes detail/structural mixes
        //for( split = list; split; split = split->next )
        //      split->checked = qfalse;
-       
-       for( split = list; split; split = split->next )
+
+       for ( split = list; split; split = split->next )
        {
                //if ( split->checked )
                //      continue;
        {
                //if ( split->checked )
                //      continue;
@@ -145,83 +141,71 @@ static void SelectSplitPlaneNum( node_t *node, face_t *list, int *splitPlaneNum,
                        side = WindingOnPlaneSide( check->w, plane->normal, plane->dist );
                        if ( side == SIDE_CROSS ) {
                                splits++;
                        side = WindingOnPlaneSide( check->w, plane->normal, plane->dist );
                        if ( side == SIDE_CROSS ) {
                                splits++;
-                       } else if ( side == SIDE_FRONT ) {
+                       }
+                       else if ( side == SIDE_FRONT ) {
                                front++;
                                front++;
-                       } else if ( side == SIDE_BACK ) {
+                       }
+                       else if ( side == SIDE_BACK ) {
                                back++;
                        }
                }
 
                                back++;
                        }
                }
 
-               if(bspAlternateSplitWeights)
-               {
+               if ( bspAlternateSplitWeights ) {
                        // from 27
 
                        //Bigger is better
                        // from 27
 
                        //Bigger is better
-                       sizeBias=WindingArea(split->w);
+                       sizeBias = WindingArea( split->w );
 
 
-                       //Base score = 20000 perfectly balanced 
-                       value = 20000-(abs(front-back));
-                       value -= plane->counter;// If we've already used this plane sometime in the past try not to use it again 
+                       //Base score = 20000 perfectly balanced
+                       value = 20000 - ( abs( front - back ) );
+                       value -= plane->counter; // If we've already used this plane sometime in the past try not to use it again
                        value -= facing ;       // if we're going to have alot of other surfs use this plane, we want to get it in quickly.
                        value -= facing ;       // if we're going to have alot of other surfs use this plane, we want to get it in quickly.
-                       value -= splits*5;        //more splits = bad
-                       value +=  sizeBias*10; //We want a huge score bias based on plane size
+                       value -= splits * 5;        //more splits = bad
+                       value +=  sizeBias * 10; //We want a huge score bias based on plane size
                }
                else
                {
                }
                else
                {
-                       value =  5*facing - 5*splits; // - abs(front-back);
+                       value =  5 * facing - 5 * splits; // - abs(front-back);
                        if ( plane->type < 3 ) {
                        if ( plane->type < 3 ) {
-                               value+=5;               // axial is better
+                               value += 5;       // axial is better
                        }
                }
 
                        }
                }
 
-               value += split->priority;               // prioritize hints higher
+               value += split->priority;       // prioritize hints higher
 
                if ( value > bestValue ) {
                        bestValue = value;
                        bestSplit = split;
 
                if ( value > bestValue ) {
                        bestValue = value;
                        bestSplit = split;
-                       //frontC=front;
-                       //backC=back;
-                       //splitsC=splits;
-                       //facingC=facing;
                }
        }
                }
        }
-       
+
        /* nothing, we have a leaf */
        /* nothing, we have a leaf */
-       if( bestValue == -99999 )
+       if ( bestValue == -99999 ) {
                return;
                return;
-       
-       //Sys_FPrintf (SYS_VRB, "F: %d B:%d S:%d FA:%ds\n",frontC,backC,splitsC,facingC );
+       }
 
        /* set best split data */
        *splitPlaneNum = bestSplit->planenum;
        *compileFlags = bestSplit->compileFlags;
 
 
        /* set best split data */
        *splitPlaneNum = bestSplit->planenum;
        *compileFlags = bestSplit->compileFlags;
 
-#if 0
-       if(bestSplit->compileFlags & C_DETAIL)
-               for( split = list; split; split = split->next )
-                       if(!(split->compileFlags & C_DETAIL))
-                               Sys_FPrintf(SYS_ERR, "DON'T DO SUCH SPLITS (1)\n");
-       if((node->compileFlags & C_DETAIL) && !(bestSplit->compileFlags & C_DETAIL))
-               Sys_FPrintf(SYS_ERR, "DON'T DO SUCH SPLITS (2)\n");
-#endif
-
-   if (*splitPlaneNum>-1) mapplanes[ *splitPlaneNum ].counter++;
+       if ( *splitPlaneNum > -1 ) {
+               mapplanes[ *splitPlaneNum ].counter++;
+       }
 }
 
 
 
 /*
 }
 
 
 
 /*
-CountFaceList()
-counts bsp faces in the linked list
-*/
+   CountFaceList()
+   counts bsp faces in the linked list
+ */
+
+int CountFaceList( face_t *list ){
+       int c;
 
 
-int    CountFaceList( face_t *list )
-{
-       int             c;
-       
 
        c = 0;
 
        c = 0;
-       for( ; list != NULL; list = list->next )
+       for ( ; list != NULL; list = list->next )
                c++;
        return c;
 }
                c++;
        return c;
 }
@@ -229,75 +213,64 @@ int       CountFaceList( face_t *list )
 
 
 /*
 
 
 /*
-BuildFaceTree_r()
-recursively builds the bsp, splitting on face planes
-*/
-
-void BuildFaceTree_r( node_t *node, face_t *list )
-{
-       face_t          *split;
-       face_t          *next;
-       int                     side;
-       plane_t         *plane;
-       face_t          *newFace;
-       face_t          *childLists[2];
-       winding_t       *frontWinding, *backWinding;
-       int                     i;
-       int                     splitPlaneNum, compileFlags;
-#if 0
-       qboolean isstruct = qfalse;
-#endif
-       
-       
+   BuildFaceTree_r()
+   recursively builds the bsp, splitting on face planes
+ */
+
+void BuildFaceTree_r( node_t *node, face_t *list ){
+       face_t      *split;
+       face_t      *next;
+       int side;
+       plane_t     *plane;
+       face_t      *newFace;
+       face_t      *childLists[2];
+       winding_t   *frontWinding, *backWinding;
+       int i;
+       int splitPlaneNum, compileFlags;
+
+
        /* count faces left */
        i = CountFaceList( list );
        /* count faces left */
        i = CountFaceList( list );
-       
+
        /* select the best split plane */
        SelectSplitPlaneNum( node, list, &splitPlaneNum, &compileFlags );
        /* select the best split plane */
        SelectSplitPlaneNum( node, list, &splitPlaneNum, &compileFlags );
-       
+
        /* if we don't have any more faces, this is a node */
        /* if we don't have any more faces, this is a node */
-       if ( splitPlaneNum == -1 )
-       {
+       if ( splitPlaneNum == -1 ) {
                node->planenum = PLANENUM_LEAF;
                node->has_structural_children = qfalse;
                c_faceLeafs++;
                return;
        }
                node->planenum = PLANENUM_LEAF;
                node->has_structural_children = qfalse;
                c_faceLeafs++;
                return;
        }
-       
+
        /* partition the list */
        node->planenum = splitPlaneNum;
        node->compileFlags = compileFlags;
        /* partition the list */
        node->planenum = splitPlaneNum;
        node->compileFlags = compileFlags;
-       node->has_structural_children = !(compileFlags & C_DETAIL) && !node->opaque;
+       node->has_structural_children = !( compileFlags & C_DETAIL ) && !node->opaque;
        plane = &mapplanes[ splitPlaneNum ];
        childLists[0] = NULL;
        childLists[1] = NULL;
 
        plane = &mapplanes[ splitPlaneNum ];
        childLists[0] = NULL;
        childLists[1] = NULL;
 
-       for( split = list; split; split = next )
+       for ( split = list; split; split = next )
        {
                /* set next */
                next = split->next;
        {
                /* set next */
                next = split->next;
-               
+
                /* don't split by identical plane */
                /* don't split by identical plane */
-               if( split->planenum == node->planenum )
-               {
+               if ( split->planenum == node->planenum ) {
                        FreeBspFace( split );
                        continue;
                }
 
                        FreeBspFace( split );
                        continue;
                }
 
-#if 0
-               if(!(split->compileFlags & C_DETAIL))
-                       isstruct = 1;
-#endif
-               
                /* determine which side the face falls on */
                side = WindingOnPlaneSide( split->w, plane->normal, plane->dist );
                /* determine which side the face falls on */
                side = WindingOnPlaneSide( split->w, plane->normal, plane->dist );
-               
+
                /* switch on side */
                /* switch on side */
-               if( side == SIDE_CROSS )
-               {
+               if ( side == SIDE_CROSS ) {
+                       /* strict; if no winding is left, we have a "virtually identical" plane and don't want to split by it */
                        ClipWindingEpsilonStrict( split->w, plane->normal, plane->dist, CLIP_EPSILON * 2,
                        ClipWindingEpsilonStrict( split->w, plane->normal, plane->dist, CLIP_EPSILON * 2,
-                               &frontWinding, &backWinding ); /* strict; if no winding is left, we have a "virtually identical" plane and don't want to split by it */
-                       if( frontWinding ) {
+                                                               &frontWinding, &backWinding );
+                       if ( frontWinding ) {
                                newFace = AllocBspFace();
                                newFace->w = frontWinding;
                                newFace->next = childLists[0];
                                newFace = AllocBspFace();
                                newFace->w = frontWinding;
                                newFace->next = childLists[0];
@@ -306,7 +279,7 @@ void BuildFaceTree_r( node_t *node, face_t *list )
                                newFace->compileFlags = split->compileFlags;
                                childLists[0] = newFace;
                        }
                                newFace->compileFlags = split->compileFlags;
                                childLists[0] = newFace;
                        }
-                       if( backWinding ) {
+                       if ( backWinding ) {
                                newFace = AllocBspFace();
                                newFace->w = backWinding;
                                newFace->next = childLists[1];
                                newFace = AllocBspFace();
                                newFace->w = backWinding;
                                newFace->next = childLists[1];
@@ -316,10 +289,12 @@ void BuildFaceTree_r( node_t *node, face_t *list )
                                childLists[1] = newFace;
                        }
                        FreeBspFace( split );
                                childLists[1] = newFace;
                        }
                        FreeBspFace( split );
-               } else if ( side == SIDE_FRONT ) {
+               }
+               else if ( side == SIDE_FRONT ) {
                        split->next = childLists[0];
                        childLists[0] = split;
                        split->next = childLists[0];
                        childLists[0] = split;
-               } else if ( side == SIDE_BACK ) {
+               }
+               else if ( side == SIDE_BACK ) {
                        split->next = childLists[1];
                        childLists[1] = split;
                }
                        split->next = childLists[1];
                        childLists[1] = split;
                }
@@ -347,64 +322,52 @@ void BuildFaceTree_r( node_t *node, face_t *list )
                }
        }
 
                }
        }
 
-#if 0
-       if((node->compileFlags & C_DETAIL) && isstruct)
-               Sys_FPrintf(SYS_ERR, "I am detail, my child is structural, this is a wtf1\n", node->has_structural_children);
-#endif
-
        for ( i = 0 ; i < 2 ; i++ ) {
        for ( i = 0 ; i < 2 ; i++ ) {
-               BuildFaceTree_r ( node->children[i], childLists[i]);
+               BuildFaceTree_r( node->children[i], childLists[i] );
                node->has_structural_children |= node->children[i]->has_structural_children;
        }
                node->has_structural_children |= node->children[i]->has_structural_children;
        }
-
-#if 0
-       if((node->compileFlags & C_DETAIL) && !(node->children[0]->compileFlags & C_DETAIL) && node->children[0]->planenum != PLANENUM_LEAF)
-               Sys_FPrintf(SYS_ERR, "I am detail, my child is structural\n", node->has_structural_children);
-       if((node->compileFlags & C_DETAIL) && isstruct)
-               Sys_FPrintf(SYS_ERR, "I am detail, my child is structural, this is a wtf2\n", node->has_structural_children);
-#endif
 }
 
 
 /*
 }
 
 
 /*
-================
-FaceBSP
+   ================
+   FaceBSP
 
 
-List will be freed before returning
-================
-*/
+   List will be freed before returning
+   ================
+ */
 tree_t *FaceBSP( face_t *list ) {
 tree_t *FaceBSP( face_t *list ) {
-       tree_t          *tree;
-       face_t  *face;
-       int                     i;
-       int                     count;
+       tree_t      *tree;
+       face_t  *face;
+       int i;
+       int count;
 
 
-       Sys_FPrintf (SYS_VRB, "--- FaceBSP ---\n" );
+       Sys_FPrintfSYS_VRB, "--- FaceBSP ---\n" );
 
 
-       tree = AllocTree ();
+       tree = AllocTree();
 
        count = 0;
 
        count = 0;
-       for( face = list; face != NULL; face = face->next )
+       for ( face = list; face != NULL; face = face->next )
        {
                count++;
        {
                count++;
-               for( i = 0; i < face->w->numpoints; i++ )
+               for ( i = 0; i < face->w->numpoints; i++ )
                {
                        AddPointToBounds( face->w->p[ i ], tree->mins, tree->maxs );
                }
        }
        Sys_FPrintf( SYS_VRB, "%9d faces\n", count );
 
                {
                        AddPointToBounds( face->w->p[ i ], tree->mins, tree->maxs );
                }
        }
        Sys_FPrintf( SYS_VRB, "%9d faces\n", count );
 
-   for( i = 0; i < nummapplanes; i++)
-   {
-      mapplanes[ i ].counter=0;
-   }
+       for ( i = 0; i < nummapplanes; i++ )
+       {
+               mapplanes[ i ].counter = 0;
+       }
 
        tree->headnode = AllocNode();
        VectorCopy( tree->mins, tree->headnode->mins );
        VectorCopy( tree->maxs, tree->headnode->maxs );
        c_faceLeafs = 0;
 
 
        tree->headnode = AllocNode();
        VectorCopy( tree->mins, tree->headnode->mins );
        VectorCopy( tree->maxs, tree->headnode->maxs );
        c_faceLeafs = 0;
 
-       BuildFaceTree_r ( tree->headnode, list );
+       BuildFaceTree_r( tree->headnode, list );
 
        Sys_FPrintf( SYS_VRB, "%9d leafs\n", c_faceLeafs );
 
 
        Sys_FPrintf( SYS_VRB, "%9d leafs\n", c_faceLeafs );
 
@@ -414,124 +377,137 @@ tree_t *FaceBSP( face_t *list ) {
 
 
 /*
 
 
 /*
-MakeStructuralBSPFaceList()
-get structural brush faces
-*/
-
-face_t *MakeStructuralBSPFaceList( brush_t *list )
-{
-       brush_t         *b;
-       int                     i;
-       side_t          *s;
-       winding_t       *w;
-       face_t          *f, *flist;
-       
-       
+   MakeStructuralBSPFaceList()
+   get structural brush faces
+ */
+
+face_t *MakeStructuralBSPFaceList( brush_t *list ){
+       brush_t     *b;
+       int i;
+       side_t      *s;
+       winding_t   *w;
+       face_t      *f, *flist;
+
+
        flist = NULL;
        flist = NULL;
-       for( b = list; b != NULL; b = b->next )
+       for ( b = list; b != NULL; b = b->next )
        {
        {
-               if( !deepBSP && b->detail )
+               if ( !deepBSP && b->detail ) {
                        continue;
                        continue;
-               
-               for( i = 0; i < b->numsides; i++ )
+               }
+
+               for ( i = 0; i < b->numsides; i++ )
                {
                        /* get side and winding */
                        s = &b->sides[ i ];
                        w = s->winding;
                {
                        /* get side and winding */
                        s = &b->sides[ i ];
                        w = s->winding;
-                       if( w == NULL )
+                       if ( w == NULL ) {
                                continue;
                                continue;
-                       
+                       }
+
                        /* ydnar: skip certain faces */
                        /* ydnar: skip certain faces */
-                       if( s->compileFlags & C_SKIP )
+                       if ( s->compileFlags & C_SKIP ) {
                                continue;
                                continue;
-                       
+                       }
+
                        /* allocate a face */
                        f = AllocBspFace();
                        f->w = CopyWinding( w );
                        f->planenum = s->planenum & ~1;
                        /* allocate a face */
                        f = AllocBspFace();
                        f->w = CopyWinding( w );
                        f->planenum = s->planenum & ~1;
-                       f->compileFlags = s->compileFlags;      /* ydnar */
-                       if(b->detail)
+                       f->compileFlags = s->compileFlags;  /* ydnar */
+                       if ( b->detail ) {
                                f->compileFlags |= C_DETAIL;
                                f->compileFlags |= C_DETAIL;
-                       
+                       }
+
                        /* ydnar: set priority */
                        f->priority = 0;
                        /* ydnar: set priority */
                        f->priority = 0;
-                       if( f->compileFlags & C_HINT )
+                       if ( f->compileFlags & C_HINT ) {
                                f->priority += HINT_PRIORITY;
                                f->priority += HINT_PRIORITY;
-                       if( f->compileFlags & C_ANTIPORTAL )
+                       }
+                       if ( f->compileFlags & C_ANTIPORTAL ) {
                                f->priority += ANTIPORTAL_PRIORITY;
                                f->priority += ANTIPORTAL_PRIORITY;
-                       if( f->compileFlags & C_AREAPORTAL )
+                       }
+                       if ( f->compileFlags & C_AREAPORTAL ) {
                                f->priority += AREAPORTAL_PRIORITY;
                                f->priority += AREAPORTAL_PRIORITY;
-                       if( f->compileFlags & C_DETAIL )
+                       }
+                       if ( f->compileFlags & C_DETAIL ) {
                                f->priority += DETAIL_PRIORITY;
                                f->priority += DETAIL_PRIORITY;
-                       
+                       }
+
                        /* get next face */
                        f->next = flist;
                        flist = f;
                }
        }
                        /* get next face */
                        f->next = flist;
                        flist = f;
                }
        }
-       
+
        return flist;
 }
 
 
 
 /*
        return flist;
 }
 
 
 
 /*
-MakeVisibleBSPFaceList()
-get visible brush faces
-*/
-
-face_t *MakeVisibleBSPFaceList( brush_t *list )
-{
-       brush_t         *b;
-       int                     i;
-       side_t          *s;
-       winding_t       *w;
-       face_t          *f, *flist;
-       
-       
+   MakeVisibleBSPFaceList()
+   get visible brush faces
+ */
+
+face_t *MakeVisibleBSPFaceList( brush_t *list ){
+       brush_t     *b;
+       int i;
+       side_t      *s;
+       winding_t   *w;
+       face_t      *f, *flist;
+
+
        flist = NULL;
        flist = NULL;
-       for( b = list; b != NULL; b = b->next )
+       for ( b = list; b != NULL; b = b->next )
        {
        {
-               if( !deepBSP && b->detail )
+               if ( !deepBSP && b->detail ) {
                        continue;
                        continue;
-               
-               for( i = 0; i < b->numsides; i++ )
+               }
+
+               for ( i = 0; i < b->numsides; i++ )
                {
                        /* get side and winding */
                        s = &b->sides[ i ];
                        w = s->visibleHull;
                {
                        /* get side and winding */
                        s = &b->sides[ i ];
                        w = s->visibleHull;
-                       if( w == NULL )
+                       if ( w == NULL ) {
                                continue;
                                continue;
-                       
+                       }
+
                        /* ydnar: skip certain faces */
                        /* ydnar: skip certain faces */
-                       if( s->compileFlags & C_SKIP )
+                       if ( s->compileFlags & C_SKIP ) {
                                continue;
                                continue;
-                       
+                       }
+
                        /* allocate a face */
                        f = AllocBspFace();
                        f->w = CopyWinding( w );
                        f->planenum = s->planenum & ~1;
                        /* allocate a face */
                        f = AllocBspFace();
                        f->w = CopyWinding( w );
                        f->planenum = s->planenum & ~1;
-                       f->compileFlags = s->compileFlags;      /* ydnar */
-                       if(b->detail)
+                       f->compileFlags = s->compileFlags;  /* ydnar */
+                       if ( b->detail ) {
                                f->compileFlags |= C_DETAIL;
                                f->compileFlags |= C_DETAIL;
-                       
+                       }
+
                        /* ydnar: set priority */
                        f->priority = 0;
                        /* ydnar: set priority */
                        f->priority = 0;
-                       if( f->compileFlags & C_HINT )
+                       if ( f->compileFlags & C_HINT ) {
                                f->priority += HINT_PRIORITY;
                                f->priority += HINT_PRIORITY;
-                       if( f->compileFlags & C_ANTIPORTAL )
+                       }
+                       if ( f->compileFlags & C_ANTIPORTAL ) {
                                f->priority += ANTIPORTAL_PRIORITY;
                                f->priority += ANTIPORTAL_PRIORITY;
-                       if( f->compileFlags & C_AREAPORTAL )
+                       }
+                       if ( f->compileFlags & C_AREAPORTAL ) {
                                f->priority += AREAPORTAL_PRIORITY;
                                f->priority += AREAPORTAL_PRIORITY;
-                       if( f->compileFlags & C_DETAIL )
+                       }
+                       if ( f->compileFlags & C_DETAIL ) {
                                f->priority += DETAIL_PRIORITY;
                                f->priority += DETAIL_PRIORITY;
-                       
+                       }
+
                        /* get next face */
                        f->next = flist;
                        flist = f;
                }
        }
                        /* get next face */
                        f->next = flist;
                        flist = f;
                }
        }
-       
+
        return flist;
 }
        return flist;
 }
-