1 /* -------------------------------------------------------------------------------
3 Copyright (C) 1999-2007 id Software, Inc. and contributors.
4 For a list of contributors, see the accompanying CONTRIBUTORS file.
6 This file is part of GtkRadiant.
8 GtkRadiant is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 GtkRadiant is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GtkRadiant; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 ----------------------------------------------------------------------------------
24 This code has been altered significantly from its original form, to support
25 several games based on the Quake III Arena engine, in the form of "Q3Map2."
27 ------------------------------------------------------------------------------- */
42 void PlaneFromWinding (fixedWinding_t *w, visPlane_t *plane)
47 VectorSubtract (w->points[2], w->points[1], v1);
48 VectorSubtract (w->points[0], w->points[1], v2);
49 CrossProduct (v2, v1, plane->normal);
50 VectorNormalize (plane->normal, plane->normal);
51 plane->dist = DotProduct (w->points[0], plane->normal);
57 returns a new fixed winding
58 ydnar: altered this a bit to reconcile multiply-defined winding_t
61 fixedWinding_t *NewFixedWinding( int points )
66 if (points > MAX_POINTS_ON_WINDING)
67 Error ("NewWinding: %i points", points);
69 size = (int)((size_t)((fixedWinding_t *)0)->points[points]);
70 w = safe_malloc (size);
84 for (i=0 ; i<l->numportals ; i++)
88 Sys_Printf ("portal %4i to leaf %4i : %7.1f : (%4.1f, %4.1f, %4.1f)\n",(int)(p-portals),p->leaf,pl.dist, pl.normal[0], pl.normal[1], pl.normal[2]);
93 //=============================================================================
99 Sorts the portals from the least complex, so the later ones can reuse
100 the earlier information.
103 int PComp (const void *a, const void *b)
105 if ( (*(vportal_t **)a)->nummightsee == (*(vportal_t **)b)->nummightsee)
107 if ( (*(vportal_t **)a)->nummightsee < (*(vportal_t **)b)->nummightsee)
111 void SortPortals (void)
115 for (i=0 ; i<numportals*2 ; i++)
116 sorted_portals[i] = &portals[i];
120 qsort (sorted_portals, numportals*2, sizeof(sorted_portals[0]), PComp);
126 LeafVectorFromPortalVector
129 int LeafVectorFromPortalVector (byte *portalbits, byte *leafbits)
136 for (i=0 ; i<numportals*2 ; i++)
138 if (portalbits[i>>3] & (1<<(i&7)) )
141 leafbits[p->leaf>>3] |= (1<<(p->leaf&7));
145 for (j = 0; j < portalclusters; j++)
148 while (leafs[leafnum].merged >= 0)
149 leafnum = leafs[leafnum].merged;
150 //if the merged leaf is visible then the original leaf is visible
151 if (leafbits[leafnum>>3] & (1<<(leafnum&7)))
153 leafbits[j>>3] |= (1<<(j&7));
157 c_leafs = CountBits (leafbits, portalclusters);
167 Merges the portal visibility for a leaf
170 void ClusterMerge (int leafnum)
173 byte portalvector[MAX_PORTALS/8];
174 byte uncompressed[MAX_MAP_LEAFS/8];
176 int numvis, mergedleafnum;
180 // OR together all the portalvis bits
182 mergedleafnum = leafnum;
183 while(leafs[mergedleafnum].merged >= 0)
184 mergedleafnum = leafs[mergedleafnum].merged;
186 memset (portalvector, 0, portalbytes);
187 leaf = &leafs[mergedleafnum];
188 for (i = 0; i < leaf->numportals; i++)
190 p = leaf->portals[i];
194 if (p->status != stat_done)
195 Error ("portal not done");
196 for (j=0 ; j<portallongs ; j++)
197 ((long *)portalvector)[j] |= ((long *)p->portalvis)[j];
199 portalvector[pnum>>3] |= 1<<(pnum&7);
202 memset (uncompressed, 0, leafbytes);
204 uncompressed[mergedleafnum>>3] |= (1<<(mergedleafnum&7));
205 // convert portal bits to leaf bits
206 numvis = LeafVectorFromPortalVector (portalvector, uncompressed);
208 // if (uncompressed[leafnum>>3] & (1<<(leafnum&7)))
209 // Sys_Printf ("WARNING: Leaf portals saw into leaf\n");
211 // uncompressed[leafnum>>3] |= (1<<(leafnum&7));
213 numvis++; // count the leaf itself
217 Sys_FPrintf (SYS_VRB,"cluster %4i : %4i visible\n", leafnum, numvis);
219 memcpy (bspVisBytes + VIS_HEADER_SIZE + leafnum*leafbytes, uncompressed, leafbytes);
227 void CalcPortalVis (void)
230 Sys_Printf("%6d portals out of %d", 0, numportals*2);
231 //get rid of the counter
232 RunThreadsOnIndividual (numportals*2, qfalse, PortalFlow);
234 RunThreadsOnIndividual (numportals*2, qtrue, PortalFlow);
244 void CalcPassageVis(void)
249 _printf("%6d portals out of %d", 0, numportals*2);
250 RunThreadsOnIndividual (numportals*2, qfalse, CreatePassages);
252 _printf("%6d portals out of %d", 0, numportals*2);
253 RunThreadsOnIndividual (numportals*2, qfalse, PassageFlow);
256 Sys_Printf( "\n--- CreatePassages (%d) ---\n", numportals * 2 );
257 RunThreadsOnIndividual( numportals*2, qtrue, CreatePassages );
259 Sys_Printf( "\n--- PassageFlow (%d) ---\n", numportals * 2 );
260 RunThreadsOnIndividual( numportals * 2, qtrue, PassageFlow );
269 void CalcPassagePortalVis(void)
274 Sys_Printf("%6d portals out of %d", 0, numportals*2);
275 RunThreadsOnIndividual (numportals*2, qfalse, CreatePassages);
277 Sys_Printf("%6d portals out of %d", 0, numportals*2);
278 RunThreadsOnIndividual (numportals*2, qfalse, PassagePortalFlow);
281 Sys_Printf( "\n--- CreatePassages (%d) ---\n", numportals * 2 );
282 RunThreadsOnIndividual( numportals * 2, qtrue, CreatePassages);
284 Sys_Printf( "\n--- PassagePortalFlow (%d) ---\n", numportals * 2 );
285 RunThreadsOnIndividual( numportals * 2, qtrue, PassagePortalFlow );
294 void CalcFastVis(void)
298 // fastvis just uses mightsee for a very loose bound
299 for (i=0 ; i<numportals*2 ; i++)
301 portals[i].portalvis = portals[i].portalflood;
302 portals[i].status = stat_done;
317 /* ydnar: rr2do2's farplane code */
319 value = ValueForKey( &entities[ 0 ], "_farplanedist" ); /* proper '_' prefixed key */
320 if( value[ 0 ] == '\0' )
321 value = ValueForKey( &entities[ 0 ], "fogclip" ); /* wolf compatibility */
322 if( value[ 0 ] == '\0' )
323 value = ValueForKey( &entities[ 0 ], "distancecull" ); /* sof2 compatibility */
324 if( value[ 0 ] != '\0' )
326 farPlaneDist = atof( value );
327 if( farPlaneDist > 0.0f )
328 Sys_Printf( "farplane distance = %.1f\n", farPlaneDist );
335 Sys_Printf( "\n--- BasePortalVis (%d) ---\n", numportals * 2 );
336 RunThreadsOnIndividual( numportals * 2, qtrue, BasePortalVis );
338 // RunThreadsOnIndividual (numportals*2, qtrue, BetterPortalVis);
345 else if ( noPassageVis ) {
348 else if ( passageVisOnly ) {
352 CalcPassagePortalVis();
355 // assemble the leaf vis lists by oring and compressing the portal lists
357 Sys_Printf("creating leaf vis...\n");
358 for (i=0 ; i<portalclusters ; i++)
361 Sys_Printf( "Total visible clusters: %i\n", totalvis );
362 Sys_Printf( "Average clusters visible: %i\n", totalvis / portalclusters );
370 void SetPortalSphere (vportal_t *p)
378 VectorCopy (vec3_origin, total);
379 for (i=0 ; i<w->numpoints ; i++)
381 VectorAdd (total, w->points[i], total);
384 for (i=0 ; i<3 ; i++)
385 total[i] /= w->numpoints;
388 for (i=0 ; i<w->numpoints ; i++)
390 VectorSubtract (w->points[i], total, dist);
391 r = VectorLength (dist);
395 VectorCopy (total, p->origin);
401 Winding_PlanesConcave
404 #define WCONVEX_EPSILON 0.2
406 int Winding_PlanesConcave(fixedWinding_t *w1, fixedWinding_t *w2,
407 vec3_t normal1, vec3_t normal2,
408 float dist1, float dist2)
412 if (!w1 || !w2) return qfalse;
414 // check if one of the points of winding 1 is at the front of the plane of winding 2
415 for (i = 0; i < w1->numpoints; i++)
417 if (DotProduct(normal2, w1->points[i]) - dist2 > WCONVEX_EPSILON) return qtrue;
419 // check if one of the points of winding 2 is at the front of the plane of winding 1
420 for (i = 0; i < w2->numpoints; i++)
422 if (DotProduct(normal1, w2->points[i]) - dist1 > WCONVEX_EPSILON) return qtrue;
433 int TryMergeLeaves(int l1num, int l2num)
435 int i, j, k, n, numportals;
436 visPlane_t plane1, plane2;
439 vportal_t *portals[MAX_PORTALS_ON_LEAF];
441 for (k = 0; k < 2; k++)
443 if (k) l1 = &leafs[l1num];
444 else l1 = &faceleafs[l1num];
445 for (i = 0; i < l1->numportals; i++)
448 if (p1->leaf == l2num) continue;
449 for (n = 0; n < 2; n++)
451 if (n) l2 = &leafs[l2num];
452 else l2 = &faceleafs[l2num];
453 for (j = 0; j < l2->numportals; j++)
456 if (p2->leaf == l1num) continue;
460 if (Winding_PlanesConcave(p1->winding, p2->winding, plane1.normal, plane2.normal, plane1.dist, plane2.dist))
466 for (k = 0; k < 2; k++)
475 l1 = &faceleafs[l1num];
476 l2 = &faceleafs[l2num];
479 //the leaves can be merged now
480 for (i = 0; i < l1->numportals; i++)
483 if (p1->leaf == l2num)
488 portals[numportals++] = p1;
490 for (j = 0; j < l2->numportals; j++)
493 if (p2->leaf == l1num)
498 portals[numportals++] = p2;
500 for (i = 0; i < numportals; i++)
502 l2->portals[i] = portals[i];
504 l2->numportals = numportals;
515 void UpdatePortals(void)
520 for (i = 0; i < numportals * 2; i++)
525 while(leafs[p->leaf].merged >= 0)
526 p->leaf = leafs[p->leaf].merged;
534 try to merge leaves but don't merge through hint splitters
537 void MergeLeaves(void)
539 int i, j, nummerges, totalnummerges;
547 for (i = 0; i < portalclusters; i++)
550 //if this leaf is merged already
552 /* ydnar: vmods: merge all non-hint portals */
553 if( leaf->merged >= 0 && hint == qfalse )
557 for (j = 0; j < leaf->numportals; j++)
559 p = leaf->portals[j];
563 //never merge through hint portals
566 if (TryMergeLeaves(i, p->leaf))
574 totalnummerges += nummerges;
576 Sys_Printf("%6d leaves merged\n", totalnummerges);
584 #define CONTINUOUS_EPSILON 0.005
586 fixedWinding_t *TryMergeWinding (fixedWinding_t *f1, fixedWinding_t *f2, vec3_t planenormal)
588 vec_t *p1, *p2, *p3, *p4, *back;
589 fixedWinding_t *newf;
591 vec3_t normal, delta;
593 qboolean keep1, keep2;
597 // find a common edge
599 p1 = p2 = NULL; // stop compiler warning
602 for (i = 0; i < f1->numpoints; i++)
605 p2 = f1->points[(i+1) % f1->numpoints];
606 for (j = 0; j < f2->numpoints; j++)
609 p4 = f2->points[(j+1) % f2->numpoints];
610 for (k = 0; k < 3; k++)
612 if (fabs(p1[k] - p4[k]) > 0.1)//EQUAL_EPSILON) //ME
614 if (fabs(p2[k] - p3[k]) > 0.1)//EQUAL_EPSILON) //ME
620 if (j < f2->numpoints)
624 if (i == f1->numpoints)
625 return NULL; // no matching edges
628 // check slope of connected lines
629 // if the slopes are colinear, the point can be removed
631 back = f1->points[(i+f1->numpoints-1)%f1->numpoints];
632 VectorSubtract (p1, back, delta);
633 CrossProduct (planenormal, delta, normal);
634 VectorNormalize (normal, normal);
636 back = f2->points[(j+2)%f2->numpoints];
637 VectorSubtract (back, p1, delta);
638 dot = DotProduct (delta, normal);
639 if (dot > CONTINUOUS_EPSILON)
640 return NULL; // not a convex polygon
641 keep1 = (qboolean)(dot < -CONTINUOUS_EPSILON);
643 back = f1->points[(i+2)%f1->numpoints];
644 VectorSubtract (back, p2, delta);
645 CrossProduct (planenormal, delta, normal);
646 VectorNormalize (normal, normal);
648 back = f2->points[(j+f2->numpoints-1)%f2->numpoints];
649 VectorSubtract (back, p2, delta);
650 dot = DotProduct (delta, normal);
651 if (dot > CONTINUOUS_EPSILON)
652 return NULL; // not a convex polygon
653 keep2 = (qboolean)(dot < -CONTINUOUS_EPSILON);
656 // build the new polygon
658 newf = NewFixedWinding (f1->numpoints + f2->numpoints);
660 // copy first polygon
661 for (k=(i+1)%f1->numpoints ; k != i ; k=(k+1)%f1->numpoints)
663 if (k==(i+1)%f1->numpoints && !keep2)
666 VectorCopy (f1->points[k], newf->points[newf->numpoints]);
670 // copy second polygon
671 for (l= (j+1)%f2->numpoints ; l != j ; l=(l+1)%f2->numpoints)
673 if (l==(j+1)%f2->numpoints && !keep1)
675 VectorCopy (f2->points[l], newf->points[newf->numpoints]);
687 void MergeLeafPortals(void)
689 int i, j, k, nummerges, hintsmerged;
696 for (i = 0; i < portalclusters; i++)
699 if (leaf->merged >= 0) continue;
700 for (j = 0; j < leaf->numportals; j++)
702 p1 = leaf->portals[j];
705 for (k = j+1; k < leaf->numportals; k++)
707 p2 = leaf->portals[k];
710 if (p1->leaf == p2->leaf)
712 w = TryMergeWinding(p1->winding, p2->winding, p1->plane.normal);
715 free( p1->winding ); //% FreeWinding(p1->winding);
717 if (p1->hint && p2->hint)
719 p1->hint |= p2->hint;
728 if (k < leaf->numportals)
732 Sys_Printf("%6d portals merged\n", nummerges);
733 Sys_Printf("%6d hint portals merged\n", hintsmerged);
742 int CountActivePortals(void)
749 for (j = 0; j < numportals * 2; j++)
758 Sys_Printf("%6d active portals\n", num);
759 Sys_Printf("%6d hint portals\n", hints);
768 void WriteFloat (FILE *f, vec_t v);
770 void WritePortals(char *filename)
778 pf = fopen (filename, "w");
780 Error ("Error opening %s", filename);
783 for (j = 0; j < numportals * 2; j++)
793 fprintf (pf, "%s\n", PORTALFILE);
794 fprintf (pf, "%i\n", 0);
795 fprintf (pf, "%i\n", num);// + numfaces);
796 fprintf (pf, "%i\n", 0);
798 for (j = 0; j < numportals * 2; j++)
806 fprintf (pf,"%i %i %i ",w->numpoints, 0, 0);
807 fprintf (pf, "%d ", p->hint);
808 for (i=0 ; i<w->numpoints ; i++)
811 WriteFloat (pf, w->points[i][0]);
812 WriteFloat (pf, w->points[i][1]);
813 WriteFloat (pf, w->points[i][2]);
820 for (j = 0; j < numfaces; j++)
824 fprintf (pf,"%i %i %i ",w->numpoints, 0, 0);
826 for (i=0 ; i<w->numpoints ; i++)
829 WriteFloat (pf, w->points[i][0]);
830 WriteFloat (pf, w->points[i][1]);
831 WriteFloat (pf, w->points[i][2]);
845 void LoadPortals (char *name)
857 if (!strcmp(name,"-"))
861 f = fopen(name, "r");
863 Error ("LoadPortals: couldn't read %s\n",name);
866 if (fscanf (f,"%79s\n%i\n%i\n%i\n",magic, &portalclusters, &numportals, &numfaces) != 4)
867 Error ("LoadPortals: failed to read header");
868 if (strcmp(magic,PORTALFILE))
869 Error ("LoadPortals: not a portal file");
871 Sys_Printf ("%6i portalclusters\n", portalclusters);
872 Sys_Printf ("%6i numportals\n", numportals);
873 Sys_Printf ("%6i numfaces\n", numfaces);
875 // these counts should take advantage of 64 bit systems automatically
876 leafbytes = ((portalclusters+63)&~63)>>3;
877 leaflongs = leafbytes/sizeof(long);
879 portalbytes = ((numportals*2+63)&~63)>>3;
880 portallongs = portalbytes/sizeof(long);
882 // each file portal is split into two memory portals
883 portals = safe_malloc(2*numportals*sizeof(vportal_t));
884 memset (portals, 0, 2*numportals*sizeof(vportal_t));
886 leafs = safe_malloc(portalclusters*sizeof(leaf_t));
887 memset (leafs, 0, portalclusters*sizeof(leaf_t));
889 for (i = 0; i < portalclusters; i++)
890 leafs[i].merged = -1;
892 numBSPVisBytes = VIS_HEADER_SIZE + portalclusters*leafbytes;
894 if (numBSPVisBytes > MAX_MAP_VISIBILITY)
895 Error("MAX_MAP_VISIBILITY exceeded");
897 ((int *)bspVisBytes)[0] = portalclusters;
898 ((int *)bspVisBytes)[1] = leafbytes;
900 for (i=0, p=portals ; i<numportals ; i++)
902 if (fscanf (f, "%i %i %i ", &numpoints, &leafnums[0], &leafnums[1]) != 3)
903 Error ("LoadPortals: reading portal %i", i);
904 if (numpoints > MAX_POINTS_ON_WINDING)
905 Error ("LoadPortals: portal %i has too many points", i);
906 if ( (unsigned)leafnums[0] > portalclusters
907 || (unsigned)leafnums[1] > portalclusters)
908 Error ("LoadPortals: reading portal %i", i);
909 if (fscanf (f, "%i ", &hint) != 1)
910 Error ("LoadPortals: reading hint state");
912 w = p->winding = NewFixedWinding (numpoints);
913 w->numpoints = numpoints;
915 for (j=0 ; j<numpoints ; j++)
920 // scanf into double, then assign to vec_t
921 // so we don't care what size vec_t is
922 if (fscanf (f, "(%lf %lf %lf ) "
923 , &v[0], &v[1], &v[2]) != 3)
924 Error ("LoadPortals: reading portal %i", i);
925 for (k=0 ; k<3 ; k++)
926 w->points[j][k] = v[k];
931 PlaneFromWinding (w, &plane);
933 // create forward portal
934 l = &leafs[leafnums[0]];
935 if (l->numportals == MAX_PORTALS_ON_LEAF)
936 Error ("Leaf with too many portals");
937 l->portals[l->numportals] = p;
943 VectorSubtract (vec3_origin, plane.normal, p->plane.normal);
944 p->plane.dist = -plane.dist;
945 p->leaf = leafnums[1];
949 // create backwards portal
950 l = &leafs[leafnums[1]];
951 if (l->numportals == MAX_PORTALS_ON_LEAF)
952 Error ("Leaf with too many portals");
953 l->portals[l->numportals] = p;
958 p->winding = NewFixedWinding(w->numpoints);
959 p->winding->numpoints = w->numpoints;
960 for (j=0 ; j<w->numpoints ; j++)
962 VectorCopy (w->points[w->numpoints-1-j], p->winding->points[j]);
966 p->leaf = leafnums[0];
972 faces = safe_malloc(2*numfaces*sizeof(vportal_t));
973 memset (faces, 0, 2*numfaces*sizeof(vportal_t));
975 faceleafs = safe_malloc(portalclusters*sizeof(leaf_t));
976 memset(faceleafs, 0, portalclusters*sizeof(leaf_t));
978 for (i = 0, p = faces; i < numfaces; i++)
980 if (fscanf (f, "%i %i ", &numpoints, &leafnums[0]) != 2)
981 Error ("LoadPortals: reading portal %i", i);
983 w = p->winding = NewFixedWinding (numpoints);
984 w->numpoints = numpoints;
986 for (j=0 ; j<numpoints ; j++)
991 // scanf into double, then assign to vec_t
992 // so we don't care what size vec_t is
993 if (fscanf (f, "(%lf %lf %lf ) "
994 , &v[0], &v[1], &v[2]) != 3)
995 Error ("LoadPortals: reading portal %i", i);
996 for (k=0 ; k<3 ; k++)
997 w->points[j][k] = v[k];
1002 PlaneFromWinding (w, &plane);
1004 l = &faceleafs[leafnums[0]];
1006 if (l->numportals == MAX_PORTALS_ON_LEAF)
1007 Error ("Leaf with too many faces");
1008 l->portals[l->numportals] = p;
1013 // normal pointing out of the leaf
1014 VectorSubtract (vec3_origin, plane.normal, p->plane.normal);
1015 p->plane.dist = -plane.dist;
1017 SetPortalSphere (p);
1031 int VisMain (int argc, char **argv)
1033 char portalfile[1024];
1038 Sys_Printf( "--- Vis ---\n" );
1040 /* process arguments */
1041 for (i=1 ; i < (argc - 1) ; i++)
1043 if (!strcmp(argv[i], "-fast")) {
1044 Sys_Printf ("fastvis = true\n");
1046 } else if (!strcmp(argv[i], "-merge")) {
1047 Sys_Printf ("merge = true\n");
1049 } else if (!strcmp(argv[i], "-nopassage")) {
1050 Sys_Printf ("nopassage = true\n");
1051 noPassageVis = qtrue;
1052 } else if (!strcmp(argv[i], "-passageOnly")) {
1053 Sys_Printf ("passageOnly = true\n");
1054 passageVisOnly = qtrue;
1055 } else if (!strcmp (argv[i],"-nosort")) {
1056 Sys_Printf ("nosort = true\n");
1058 } else if (!strcmp (argv[i],"-saveprt")) {
1059 Sys_Printf ("saveprt = true\n");
1061 } else if (!strcmp (argv[i],"-tmpin")) {
1062 strcpy (inbase, "/tmp");
1063 } else if (!strcmp (argv[i],"-tmpout")) {
1064 strcpy (outbase, "/tmp");
1068 /* ydnar: -hint to merge all but hint portals */
1069 else if( !strcmp( argv[ i ], "-hint" ) )
1071 Sys_Printf( "hint = true\n" );
1078 Sys_Printf( "WARNING: Unknown option \"%s\"\n", argv[ i ] );
1083 Error( "usage: vis [-threads #] [-level 0-4] [-fast] [-v] bspfile" );
1087 sprintf( source, "%s%s", inbase, ExpandArg( argv[ i ] ) );
1088 StripExtension( source );
1089 strcat( source, ".bsp" );
1090 Sys_Printf( "Loading %s\n", source );
1091 LoadBSPFile( source );
1093 /* load the portal file */
1094 sprintf( portalfile, "%s%s", inbase, ExpandArg( argv[ i ] ) );
1095 StripExtension( portalfile );
1096 strcat( portalfile, ".prt" );
1097 Sys_Printf( "Loading %s\n", portalfile );
1098 LoadPortals( portalfile );
1100 /* ydnar: exit if no portals, hence no vis */
1101 if( numportals == 0 )
1103 Sys_Printf( "No portals means no vis, exiting.\n" );
1107 /* ydnar: for getting far plane */
1110 /* inject command line parameters */
1111 InjectCommandLine(argv, 0, argc - 1);
1120 CountActivePortals();
1121 /* WritePortals( "maps/hints.prs" );*/
1123 Sys_Printf( "visdatasize:%i\n", numBSPVisBytes );
1127 /* delete the prt file */
1129 remove( portalfile );
1131 /* write the bsp file */
1132 Sys_Printf( "Writing %s\n", source );
1133 WriteBSPFile( source );