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 ------------------------------------------------------------------------------- */
43 returns a pseudorandom number between 0 and 1
47 return (vec_t) rand() / RAND_MAX;
51 char *Q_strncpyz( char *dst, const char *src, size_t len ) {
56 strncpy( dst, src, len );
57 dst[ len - 1 ] = '\0';
62 char *Q_strcat( char *dst, size_t dlen, const char *src ) {
63 size_t n = strlen( dst );
66 abort(); /* buffer overflow */
69 return Q_strncpyz( dst + n, src, dlen - n );
73 char *Q_strncat( char *dst, size_t dlen, const char *src, size_t slen ) {
74 size_t n = strlen( dst );
77 abort(); /* buffer overflow */
80 return Q_strncpyz( dst + n, src, MIN( slen, dlen - n ) );
88 static void ExitQ3Map( void ){
90 if ( mapDrawSurfs != NULL ) {
97 calculates an md4 checksum for a block of data
100 static int MD4BlockChecksum( void *buffer, int length ){
101 return Com_BlockChecksum( buffer, length );
106 resets an aas checksum to match the given BSP
109 int FixAAS( int argc, char **argv ){
110 int length, checksum;
113 char aas[ 1024 ], **ext;
125 Sys_Printf( "Usage: q3map -fixaas [-v] <mapname>\n" );
129 /* do some path mangling */
130 strcpy( source, ExpandArg( argv[ argc - 1 ] ) );
131 StripExtension( source );
132 DefaultExtension( source, ".bsp" );
135 Sys_Printf( "--- FixAAS ---\n" );
138 Sys_Printf( "Loading %s\n", source );
139 length = LoadFile( source, &buffer );
141 /* create bsp checksum */
142 Sys_Printf( "Creating checksum...\n" );
143 checksum = LittleLong( MD4BlockChecksum( buffer, length ) );
145 /* write checksum to aas */
150 strcpy( aas, source );
151 StripExtension( aas );
153 Sys_Printf( "Trying %s\n", aas );
157 file = fopen( aas, "r+b" );
161 if ( fwrite( &checksum, 4, 1, file ) != 1 ) {
162 Error( "Error writing checksum to %s", aas );
167 /* return to sender */
174 const char* description;
177 void HelpOptions(const char* group_name, int indentation, int width, struct HelpOption* options, int count)
180 char* indent = malloc(indentation+1);
181 memset(indent, ' ', indentation);
182 indent[indentation] = 0;
183 printf("%s%s:\n", indent, group_name);
185 indent = realloc(indent, indentation+1);
186 memset(indent, ' ', indentation);
187 indent[indentation] = 0;
190 for ( i = 0; i < count; i++ )
192 int printed = printf("%s%-24s ", indent, options[i].name);
193 int descsz = strlen(options[i].description);
195 while ( j < descsz && descsz-j > width - printed )
198 printf("%s%26c",indent,' ');
199 int fragment = width - printed;
200 while ( fragment > 0 && options[i].description[j+fragment-1] != ' ')
202 j += fwrite(options[i].description+j, sizeof(char), fragment, stdout);
204 printed = indentation+26;
208 printf("%s\n",options[i].description+j);
210 else if ( j < descsz )
212 printf("%s%26c%s\n",indent,' ',options[i].description+j);
223 struct HelpOption bsp[] = {
224 {"-bsp <filename.map>", "Switch that enters this stage"},
225 {"-altsplit", "Alternate BSP tree splitting weights (should give more fps)"},
226 {"-celshader <shadername>", "Sets a global cel shader name"},
227 {"-custinfoparms", "Read scripts/custinfoparms.txt"},
228 {"-debuginset", "Push all triangle vertexes towards the triangle center"},
229 {"-debugportals", "Make BSP portals visible in the map"},
230 {"-debugsurfaces", "Color the vertexes according to the index of the surface"},
231 {"-deep", "Use detail brushes in the BSP tree, but at lowest priority (should give more fps)"},
232 {"-de <F>", "Distance epsilon for plane snapping etc."},
233 {"-fakemap", "Write fakemap.map containing all world brushes"},
234 {"-flares", "Turn on support for flares (TEST?)"},
235 {"-flat", "Enable flat shading (good for combining with -celshader)"},
236 {"-fulldetail", "Treat detail brushes as structural ones"},
237 {"-leaktest", "Abort if a leak was found"},
238 {"-meta", "Combine adjacent triangles of the same texture to surfaces (ALWAYS USE THIS)"},
239 {"-minsamplesize <N>", "Sets minimum lightmap resolution in luxels/qu"},
240 {"-mi <N>", "Sets the maximum number of indexes per surface"},
241 {"-mv <N>", "Sets the maximum number of vertices of a lightmapped surface"},
242 {"-ne <F>", "Normal epsilon for plane snapping etc."},
243 {"-nocurves", "Turn off support for patches"},
244 {"-nodetail", "Leave out detail brushes"},
245 {"-noflares", "Turn off support for flares"},
246 {"-nofog", "Turn off support for fog volumes"},
247 {"-nohint", "Turn off support for hint brushes"},
248 {"-nosubdivide", "Turn off support for `q3map_tessSize` (breaks water vertex deforms)"},
249 {"-notjunc", "Do not fix T-junctions (causes cracks between triangles, do not use)"},
250 {"-nowater", "Turn off support for water, slime or lava (Stef, this is for you)"},
251 {"-np <A>", "Force all surfaces to be nonplanar with a given shade angle"},
252 {"-onlyents", "Only update entities in the BSP"},
253 {"-patchmeta", "Turn patches into triangle meshes for display"},
254 {"-rename", "Append “bspâ€
\9d suffix to miscmodel shaders (needed for SoF2)"},
255 {"-samplesize <N>", "Sets default lightmap resolution in luxels/qu"},
256 {"-skyfix", "Turn sky box into six surfaces to work around ATI problems"},
257 {"-snap <N>", "Snap brush bevel planes to the given number of units"},
258 {"-tempname <filename.map>", "Read the MAP file from the given file name"},
259 {"-texrange <N>", "Limit per-surface texture range to the given number of units, and subdivide surfaces like with `q3map_tessSize` if this is not met"},
260 {"-tmpout", "Write the BSP file to /tmp"},
261 {"-verboseentities", "Enable `-v` only for map entities, not for the world"},
263 HelpOptions("BSP Stage", 0, 80, bsp, sizeof(bsp)/sizeof(struct HelpOption));
267 struct HelpOption vis[] = {
268 {"-vis <filename.map>", "Switch that enters this stage"},
269 {"-fast", "Very fast and crude vis calculation"},
270 {"-mergeportals", "The less crude half of `-merge`, makes vis sometimes much faster but doesn't hurt fps usually"},
271 {"-merge", "Faster but still okay vis calculation"},
272 {"-nopassage", "Just use PortalFlow vis (usually less fps)"},
273 {"-nosort", "Do not sort the portals before calculating vis (usually slower)"},
274 {"-passageOnly", "Just use PassageFlow vis (usually less fps)"},
275 {"-saveprt", "Keep the PRT file after running vis (so you can run vis again)"},
276 {"-tmpin", "Use /tmp folder for input"},
277 {"-tmpout", "Use /tmp folder for output"},
279 HelpOptions("VIS Stage", 0, 80, vis, sizeof(vis)/sizeof(struct HelpOption));
283 struct HelpOption light[] = {
284 {"-light <filename.map>", "Switch that enters this stage"},
285 {"-vlight <filename.map>", "Deprecated alias for `-light -fast` ... filename.map"},
286 {"-approx <N>", "Vertex light approximation tolerance (never use in conjunction with deluxemapping)"},
287 {"-areascale <F, `-area` F>", "Scaling factor for area lights (surfacelight)"},
288 {"-border", "Add a red border to lightmaps for debugging"},
289 {"-bouncegrid", "Also compute radiosity on the light grid"},
290 {"-bounceonly", "Only compute radiosity"},
291 {"-bouncescale <F>", "Scaling factor for radiosity"},
292 {"-bounce <N>", "Number of bounces for radiosity"},
293 {"-cheapgrid", "Use `-cheap` style lighting for radiosity"},
294 {"-cheap", "Abort vertex light calculations when white is reached"},
295 {"-compensate <F>", "Lightmap compensate (darkening factor applied after everything else)"},
296 {"-cpma", "CPMA vertex lighting mode"},
297 {"-custinfoparms", "Read scripts/custinfoparms.txt"},
298 {"-dark", "Darken lightmap seams"},
299 {"-debugaxis", "Color the lightmaps according to the lightmap axis"},
300 {"-debugcluster", "Color the lightmaps according to the index of the cluster"},
301 {"-debugdeluxe", "Show deluxemaps on the lightmap"},
302 {"-debugnormals", "Color the lightmaps according to the direction of the surface normal"},
303 {"-debugorigin", "Color the lightmaps according to the origin of the luxels"},
304 {"-debugsurfaces, -debugsurface", "Color the lightmaps according to the index of the surface"},
305 {"-debugunused", "This option does nothing"},
306 {"-debug", "Mark the lightmaps according to the cluster: unmapped clusters get yellow, occluded ones get pink, flooded ones get blue overlay color, otherwise red"},
307 {"-deluxemode 0", "Use modelspace deluxemaps (DarkPlaces)"},
308 {"-deluxemode 1", "Use tangentspace deluxemaps"},
309 {"-deluxe, -deluxemap", "Enable deluxemapping (light direction maps)"},
310 {"-dirtdebug, -debugdirt", "Store the dirtmaps as lightmaps for debugging"},
311 {"-dirtdepth", "Dirtmapping depth"},
312 {"-dirtgain", "Dirtmapping exponent"},
313 {"-dirtmode 0", "Ordered direction dirtmapping"},
314 {"-dirtmode 1", "Randomized direction dirtmapping"},
315 {"-dirtscale", "Dirtmapping scaling factor"},
316 {"-dirty", "Enable dirtmapping"},
317 {"-dump", "Dump radiosity from `-bounce` into numbered MAP file prefabs"},
318 {"-export", "Export lightmaps when compile finished (like `-export` mode)"},
319 {"-exposure <F>", "Lightmap exposure to better support overbright spots"},
320 {"-external", "Force external lightmaps even if at size of internal lightmaps"},
321 {"-extravisnudge", "Broken feature to nudge the luxel origin to a better vis cluster"},
322 {"-extrawide", "Deprecated alias for `-super 2 -filter`"},
323 {"-extra", "Deprecated alias for `-super 2`"},
324 {"-fastbounce", "Use `-fast` style lighting for radiosity"},
325 {"-faster", "Use a faster falloff curve for lighting; also implies `-fast`"},
326 {"-fastgrid", "Use `-fast` style lighting for the light grid"},
327 {"-fast", "Ignore tiny light contributions"},
328 {"-filter", "Lightmap filtering"},
329 {"-floodlight", "Enable floodlight (zero-effort somewhat decent lighting)"},
330 {"-gamma <F>", "Lightmap gamma"},
331 {"-gridambientscale <F>", "Scaling factor for the light grid ambient components only"},
332 {"-gridscale <F>", "Scaling factor for the light grid only"},
333 {"-keeplights", "Keep light entities in the BSP file after compile"},
334 {"-lightmapdir <directory>", "Directory to store external lightmaps (default: same as map name without extension)"},
335 {"-lightmapsize <N>", "Size of lightmaps to generate (must be a power of two)"},
336 {"-lomem", "Low memory but slower lighting mode"},
337 {"-lowquality", "Low quality floodlight (appears to currently break floodlight)"},
338 {"-minsamplesize <N>", "Sets minimum lightmap resolution in luxels/qu"},
339 {"-nocollapse", "Do not collapse identical lightmaps"},
340 {"-nodeluxe, -nodeluxemap", "Disable deluxemapping"},
341 {"-nogrid", "Disable grid light calculation (makes all entities fullbright)"},
342 {"-nolightmapsearch", "Do not optimize lightmap packing for GPU memory usage (as doing so costs fps)"},
343 {"-normalmap", "Color the lightmaps according to the direction of the surface normal (TODO is this identical to `-debugnormals`?)"},
344 {"-nostyle, -nostyles", "Disable support for light styles"},
345 {"-nosurf", "Disable tracing against surfaces (only uses BSP nodes then)"},
346 {"-notrace", "Disable shadow occlusion"},
347 {"-novertex", "Disable vertex lighting"},
348 {"-patchshadows", "Cast shadows from patches"},
349 {"-pointscale <F, `-point` F>", "Scaling factor for point lights (light entities)"},
350 {"-q3", "Use nonlinear falloff curve by default (like Q3A)"},
351 {"-samplescale <F>", "Scales all lightmap resolutions"},
352 {"-samplesize <N>", "Sets default lightmap resolution in luxels/qu"},
353 {"-samples <N>", "Adaptive supersampling quality"},
354 {"-scale <F>", "Scaling factor for all light types"},
355 {"-shadeangle <A>", "Angle for phong shading"},
356 {"-shade", "Enable phong shading at default shade angle"},
357 {"-skyscale <F, `-sky` F>", "Scaling factor for sky and sun light"},
358 {"-smooth", "Deprecated alias for `-samples 2`"},
359 {"-style, -styles", "Enable support for light styles"},
360 {"-sunonly", "Only compute sun light"},
361 {"-super <N, `-supersample` N>", "Ordered grid supersampling quality"},
362 {"-thresh <F>", "Triangle subdivision threshold"},
363 {"-trianglecheck", "Broken check that should ensure luxels apply to the right triangle"},
364 {"-trisoup", "Convert brush faces to triangle soup"},
365 {"-wolf", "Use linear falloff curve by default (like W:ET)"},
368 HelpOptions("Light Stage", 0, 80, light, sizeof(light)/sizeof(struct HelpOption));
373 struct HelpOption analize[] = {
374 {"-analyze <filename.bsp>", "Switch that enters this mode"},
375 {"-lumpswap", "Swap byte order in the lumps"},
378 HelpOptions("Analyzing BSP-like file structure", 0, 80, analize, sizeof(analize)/sizeof(struct HelpOption));
382 struct HelpOption scale[] = {
383 {"-scale <S filename.bsp>", "Scale uniformly"},
384 {"-scale <SX SY SZ filename.bsp>", "Scale non-uniformly"},
385 {"-scale -tex <S filename.bsp>", "Scale uniformly without texture lock"},
386 {"-scale -tex <SX SY SZ filename.bsp>", "Scale non-uniformly without texture lock"},
388 HelpOptions("Scaling", 0, 80, scale, sizeof(scale)/sizeof(struct HelpOption));
392 struct HelpOption convert[] = {
393 {"-convert <filename.bsp>", "Switch that enters this mode"},
394 {"-de <number>", "Distance epsilon for the conversion"},
395 {"-format <converter>", "Select the converter (available: map, ase, or game names)"},
396 {"-ne <F>", "Normal epsilon for the conversion"},
397 {"-shadersasbitmap", "(only for ase) use the shader names as \\*BITMAP key so they work as prefabs"},
400 HelpOptions("Converting & Decompiling", 0, 80, convert, sizeof(convert)/sizeof(struct HelpOption));
405 struct HelpOption exportl[] = {
406 {"-export <filename.bsp>", "Copies lightmaps from the BSP to `filename/lightmap_0000.tga` ff"}
409 HelpOptions("Exporting lightmaps", 0, 80, exportl, sizeof(exportl)/sizeof(struct HelpOption));
414 struct HelpOption fixaas[] = {
415 {"-fixaas <filename.bsp>", "Switch that enters this mode"},
418 HelpOptions("Fixing AAS checksum", 0, 80, fixaas, sizeof(fixaas)/sizeof(struct HelpOption));
423 struct HelpOption info[] = {
424 {"-info <filename.bsp>", "Switch that enters this mode"},
427 HelpOptions("Get info about BSP file", 0, 80, info, sizeof(info)/sizeof(struct HelpOption));
432 struct HelpOption import[] = {
433 {"-import <filename.bsp>", "Copies lightmaps from `filename/lightmap_0000.tga` ff into the BSP"},
436 HelpOptions("Importing lightmaps", 0, 80, import, sizeof(import)/sizeof(struct HelpOption));
441 struct HelpOption minimap[] = {
442 {"-minimap <filename.bsp>", "Creates a minimap of the BSP, by default writes to `../gfx/filename_mini.tga`"},
443 {"-black", "Write the minimap as a black-on-transparency RGBA32 image"},
444 {"-boost <F>", "Sets the contrast boost value (higher values make a brighter image); contrast boost is somewhat similar to gamma, but continuous even at zero"},
445 {"-border <F>", "Sets the amount of border pixels relative to the total image size"},
446 {"-gray", "Write the minimap as a white-on-black GRAY8 image"},
447 {"-keepaspect", "Ensure the aspect ratio is kept (the minimap is then letterboxed to keep aspect)"},
448 {"-minmax <xmin ymin zmin xmax ymax zmax>", "Forces specific map dimensions (note: the minimap actually uses these dimensions, scaled to the target size while keeping aspect with centering, and 1/64 of border appended to all sides)"},
449 {"-nokeepaspect", "Do not ensure the aspect ratio is kept (makes it easier to use the image in your code, but looks bad together with sharpening)"},
450 {"-o <filename.tga>", "Sets the output file name"},
451 {"-random <N>", "Sets the randomized supersampling count (cannot be combined with `-samples`)"},
452 {"-samples <N>", "Sets the ordered supersampling count (cannot be combined with `-random`)"},
453 {"-sharpen <F>", "Sets the sharpening coefficient"},
454 {"-size <N>", "Sets the width and height of the output image"},
455 {"-white", "Write the minimap as a white-on-transparency RGBA32 image"},
458 HelpOptions("MiniMap", 0, 80, minimap, sizeof(minimap)/sizeof(struct HelpOption));
463 struct HelpOption common[] = {
464 {"-connect <address>", "Talk to a NetRadiant instance using a specific XML based protocol"},
465 {"-force", "Allow reading some broken/unsupported BSP files e.g. when decompiling, may also crash"},
466 {"-fs_basepath <path>", "Sets the given path as main directory of the game (can be used more than once to look in multiple paths)"},
467 {"-fs_game <gamename>", "Sets a different game directory name (default for Q3A: baseq3)"},
468 {"-fs_homebase <dir>", "Specifies where the user home directory name is on Linux (default for Q3A: .q3a)"},
469 {"-game <gamename>", "Load settings for the given game (default: quake3)"},
470 {"-subdivisions <F>", "multiplier for patch subdivisions quality"},
471 {"-threads <N>", "number of threads to use"},
472 {"-v", "Verbose mode"}
475 HelpOptions("Common Options", 0, 80, common, sizeof(common)/sizeof(struct HelpOption));
479 void Help(const char* arg)
481 printf("Usage: q3map2 [stage] [common options...] [stage options...] [stage source file]\n");
482 printf(" q3map2 -help [stage]\n\n");
486 struct HelpOption stages[] = {
487 {"-bsp", "BSP Stage"},
488 {"-vis", "VIS Stage"},
489 {"-light", "Light Stage"},
490 {"-analize", "Analyzing BSP-like file structure"},
491 {"-scale", "Scaling"},
492 {"-convert", "Converting & Decompiling"},
493 {"-export", "Exporting lightmaps"},
494 {"-fixaas", "Fixing AAS checksum"},
495 {"-info", "Get info about BSP file"},
496 {"-import", "Importing lightmaps"},
497 {"-minimap", "MiniMap"},
499 void(*help_funcs[])() = {
513 if ( arg && strlen(arg) > 0 )
519 for ( i = 0; i < sizeof(stages)/sizeof(struct HelpOption); i++ )
520 if ( strcmp(arg, stages[i].name+1) == 0 )
527 HelpOptions("Stages", 0, 80, stages, sizeof(stages)/sizeof(struct HelpOption));
535 int main( int argc, char **argv ){
540 /* we want consistent 'randomness' */
544 start = I_FloatTime();
546 /* this was changed to emit version number over the network */
547 printf( Q3MAP_VERSION "\n" );
552 /* read general options first */
553 for ( i = 1; i < argc; i++ )
556 if ( !strcmp( argv[ i ], "-h" ) || !strcmp( argv[ i ], "--help" )
557 || !strcmp( argv[ i ], "-help" ) ) {
563 if ( !strcmp( argv[ i ], "-connect" ) ) {
566 Broadcast_Setup( argv[ i ] );
571 else if ( !strcmp( argv[ i ], "-v" ) ) {
579 else if ( !strcmp( argv[ i ], "-force" ) ) {
584 /* patch subdivisions */
585 else if ( !strcmp( argv[ i ], "-subdivisions" ) ) {
588 patchSubdivisions = atoi( argv[ i ] );
590 if ( patchSubdivisions <= 0 ) {
591 patchSubdivisions = 1;
596 else if ( !strcmp( argv[ i ], "-threads" ) ) {
599 numthreads = atoi( argv[ i ] );
604 /* init model library */
606 PicoSetMallocFunc( safe_malloc );
607 PicoSetFreeFunc( free );
608 PicoSetPrintFunc( PicoPrintFunc );
609 PicoSetLoadFileFunc( PicoLoadFileFunc );
610 PicoSetFreeFileFunc( free );
612 /* set number of threads */
615 /* generate sinusoid jitter table */
616 for ( i = 0; i < MAX_JITTERS; i++ )
618 jitters[ i ] = sin( i * 139.54152147 );
619 //% Sys_Printf( "Jitter %4d: %f\n", i, jitters[ i ] );
622 /* we print out two versions, q3map's main version (since it evolves a bit out of GtkRadiant)
623 and we put the GtkRadiant version to make it easy to track with what version of Radiant it was built with */
625 Sys_Printf( "Q3Map - v1.0r (c) 1999 Id Software Inc.\n" );
626 Sys_Printf( "Q3Map (ydnar) - v" Q3MAP_VERSION "\n" );
627 Sys_Printf( "NetRadiant - v" RADIANT_VERSION " " __DATE__ " " __TIME__ "\n" );
628 Sys_Printf( "%s\n", Q3MAP_MOTD );
630 /* ydnar: new path initialization */
631 InitPaths( &argc, argv );
633 /* set game options */
634 if ( !patchSubdivisions ) {
635 patchSubdivisions = game->patchSubdivisions;
638 /* check if we have enough options left to attempt something */
640 Error( "Usage: %s [general options] [options] mapfile", argv[ 0 ] );
644 if ( !strcmp( argv[ 1 ], "-fixaas" ) ) {
645 r = FixAAS( argc - 1, argv + 1 );
649 else if ( !strcmp( argv[ 1 ], "-analyze" ) ) {
650 r = AnalyzeBSP( argc - 1, argv + 1 );
654 else if ( !strcmp( argv[ 1 ], "-info" ) ) {
655 r = BSPInfo( argc - 2, argv + 2 );
659 else if ( !strcmp( argv[ 1 ], "-vis" ) ) {
660 r = VisMain( argc - 1, argv + 1 );
664 else if ( !strcmp( argv[ 1 ], "-light" ) ) {
665 r = LightMain( argc - 1, argv + 1 );
669 else if ( !strcmp( argv[ 1 ], "-vlight" ) ) {
670 Sys_Printf( "WARNING: VLight is no longer supported, defaulting to -light -fast instead\n\n" );
671 argv[ 1 ] = "-fast"; /* eek a hack */
672 r = LightMain( argc, argv );
675 /* ydnar: lightmap export */
676 else if ( !strcmp( argv[ 1 ], "-export" ) ) {
677 r = ExportLightmapsMain( argc - 1, argv + 1 );
680 /* ydnar: lightmap import */
681 else if ( !strcmp( argv[ 1 ], "-import" ) ) {
682 r = ImportLightmapsMain( argc - 1, argv + 1 );
685 /* ydnar: bsp scaling */
686 else if ( !strcmp( argv[ 1 ], "-scale" ) ) {
687 r = ScaleBSPMain( argc - 1, argv + 1 );
690 /* ydnar: bsp conversion */
691 else if ( !strcmp( argv[ 1 ], "-convert" ) ) {
692 r = ConvertBSPMain( argc - 1, argv + 1 );
696 else if ( !strcmp( argv[ 1 ], "-minimap" ) ) {
697 r = MiniMapBSPMain( argc - 1, argv + 1 );
700 /* ydnar: otherwise create a bsp */
702 r = BSPMain( argc, argv );
707 Sys_Printf( "%9.0f seconds elapsed\n", end - start );
709 /* shut down connection */
710 Broadcast_Shutdown();
712 /* return any error code */