}
size = (int)( (size_t)( (fixedWinding_t *)0 )->points[points] );
- w = safe_malloc( size );
- memset( w, 0, size );
+ w = safe_malloc0( size );
return w;
}
Merges the portal visibility for a leaf
===============
*/
+
static int clustersizehistogram[MAX_MAP_LEAFS] = {0};
+
void ClusterMerge( int leafnum ){
leaf_t *leaf;
byte portalvector[MAX_PORTALS / 8];
numvis = LeafVectorFromPortalVector( portalvector, uncompressed );
// if (uncompressed[leafnum>>3] & (1<<(leafnum&7)))
-// Sys_Printf ("WARNING: Leaf portals saw into leaf\n");
+// Sys_FPrintf (SYS_WRN, "WARNING: Leaf portals saw into leaf\n");
// uncompressed[leafnum>>3] |= (1<<(leafnum&7));
numvis++; // count the leaf itself
- //Sys_FPrintf (SYS_VRB,"cluster %4i : %4i visible\n", leafnum, numvis);
+ //Sys_FPrintf( SYS_VRB,"cluster %4i : %4i visible\n", leafnum, numvis );
++clustersizehistogram[numvis];
memcpy( bspVisBytes + VIS_HEADER_SIZE + leafnum * leafbytes, uncompressed, leafbytes );
}
if ( value[ 0 ] != '\0' ) {
farPlaneDist = atof( value );
- if ( farPlaneDist > 0.0f ) {
+ farPlaneDistMode = value[strlen(value) - 1 ];
+ if ( farPlaneDist != 0.0f ) {
Sys_Printf( "farplane distance = %.1f\n", farPlaneDist );
}
- else{
- farPlaneDist = 0.0f;
+ if ( farPlaneDist != 0.0f && farPlaneDistMode == 'o' ) {
+ Sys_Printf( "farplane Origin2Origin mode on\n" );
+ }
+ if ( farPlaneDist != 0.0f && farPlaneDistMode == 'r' ) {
+ Sys_Printf( "farplane Radius+Radius mode on\n" );
}
+ if ( farPlaneDist != 0.0f && farPlaneDistMode == 'e' ) {
+ Sys_Printf( "farplane Exact distance mode on\n" );
+ }
+
}
+
Sys_Printf( "\n--- BasePortalVis (%d) ---\n", numportals * 2 );
RunThreadsOnIndividual( numportals * 2, qtrue, BasePortalVis );
portallongs = portalbytes / sizeof( long );
// each file portal is split into two memory portals
- portals = safe_malloc( 2 * numportals * sizeof( vportal_t ) );
- memset( portals, 0, 2 * numportals * sizeof( vportal_t ) );
+ portals = safe_malloc0( 2 * numportals * sizeof( vportal_t ) );
- leafs = safe_malloc( portalclusters * sizeof( leaf_t ) );
- memset( leafs, 0, portalclusters * sizeof( leaf_t ) );
+ leafs = safe_malloc0( portalclusters * sizeof( leaf_t ) );
for ( i = 0; i < portalclusters; i++ )
leafs[i].merged = -1;
}
- faces = safe_malloc( 2 * numfaces * sizeof( vportal_t ) );
- memset( faces, 0, 2 * numfaces * sizeof( vportal_t ) );
+ faces = safe_malloc0( 2 * numfaces * sizeof( vportal_t ) );
- faceleafs = safe_malloc( portalclusters * sizeof( leaf_t ) );
- memset( faceleafs, 0, portalclusters * sizeof( leaf_t ) );
+ faceleafs = safe_malloc0( portalclusters * sizeof( leaf_t ) );
for ( i = 0, p = faces; i < numfaces; i++ )
{
}
else if ( !strcmp( argv[ i ], "-v" ) ) {
debugCluster = qtrue;
- Sys_Printf( "Extra verbous mode enabled\n" );
+ Sys_Printf( "Extra verbose mode enabled\n" );
}
else if ( !strcmp( argv[i],"-tmpin" ) ) {
strcpy( inbase, "/tmp" );
else if ( !strcmp( argv[ i ], "-prtfile" ) )
{
strcpy( portalFilePath, argv[i + 1] );
+ argv[ i ] = NULL;
i++;
+ argv[ i ] = NULL;
Sys_Printf( "Use %s as portal file\n", portalFilePath );
}
- else
- {
- Sys_Printf( "WARNING: Unknown option \"%s\"\n", argv[ i ] );
+ else{
+ Sys_FPrintf( SYS_WRN, "WARNING: Unknown option \"%s\"\n", argv[ i ] );
}
}
if ( i != argc - 1 ) {
- Error( "usage: vis [-threads #] [-level 0-4] [-fast] [-v] BSPFilePath" );
+ Error( "usage: vis [-threads #] [-fast] [-v] BSPFilePath" );
}
Sys_Printf( "Loading %s\n", source );
LoadBSPFile( source );
+ if ( game->texFile )
+ {
+ // smokinguns-like tex file
+ StripExtension( source );
+ strcat( source, ".tex" );
+ LoadSurfaceFlags( source );
+ StripExtension( source );
+ strcat( source, ".bsp" );
+ }
+
/* load the portal file */
if (!portalFilePath[0]) {
sprintf( portalFilePath, "%s%s", inbase, ExpandArg( argv[ i ] ) );
StripExtension( portalFilePath );
strcat( portalFilePath, ".prt" );
- Sys_Printf( "Loading %s\n", portalFilePath );
- LoadPortals( portalFilePath );
}
+ Sys_Printf( "Loading %s\n", portalFilePath );
+ LoadPortals( portalFilePath );
/* ydnar: exit if no portals, hence no vis */
if ( numportals == 0 ) {
remove( portalFilePath );
}
+ if ( game->texFile )
+ {
+ // smokinguns-like tex file
+ StripExtension( source );
+ WriteTexFile( source );
+ DefaultExtension( source, ".bsp" );
+ }
+
/* write the bsp file */
Sys_Printf( "Writing %s\n", source );
WriteBSPFile( source );