X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fq3map2%2Fvis.c;h=5e3bf7efeb64b320f6d31b0be1fde93c94b63c3a;hb=HEAD;hp=df398c3ec5d4fd5b02967d4f62946bffa0b7eeae;hpb=84881a66140ad93d0b6cd4d55efbbb459bd91f48;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3map2/vis.c b/tools/quake3/q3map2/vis.c index df398c3e..5e3bf7ef 100644 --- a/tools/quake3/q3map2/vis.c +++ b/tools/quake3/q3map2/vis.c @@ -66,8 +66,7 @@ fixedWinding_t *NewFixedWinding( int points ){ } size = (int)( (size_t)( (fixedWinding_t *)0 )->points[points] ); - w = safe_malloc( size ); - memset( w, 0, size ); + w = safe_malloc0( size ); return w; } @@ -945,11 +944,9 @@ void LoadPortals( char *name ){ 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; @@ -1045,11 +1042,9 @@ void LoadPortals( char *name ){ } - 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++ ) { @@ -1151,7 +1146,7 @@ int VisMain( int argc, char **argv ){ } 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" ); @@ -1169,7 +1164,9 @@ int VisMain( int argc, char **argv ){ 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 ); } @@ -1190,6 +1187,16 @@ int VisMain( int argc, char **argv ){ 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 ] ) ); @@ -1232,6 +1239,14 @@ int VisMain( int argc, char **argv ){ 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 );