]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - tools/quake3/q3map2/help.c
q3map2: add missing help for q3map2 stage arguments
[xonotic/netradiant.git] / tools / quake3 / q3map2 / help.c
1 /* -------------------------------------------------------------------------------
2
3    Copyright (C) 1999-2007 id Software, Inc. and contributors.
4    For a list of contributors, see the accompanying CONTRIBUTORS file.
5
6    This file is part of GtkRadiant.
7
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.
12
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.
17
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
21
22    -------------------------------------------------------------------------------
23
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."
26
27    ------------------------------------------------------------------------------- */
28
29
30
31 /* dependencies */
32 #include "q3map2.h"
33
34
35
36 struct HelpOption
37 {
38         const char* name;
39         const char* description;
40 };
41
42 void HelpOptions(const char* group_name, int indentation, int width, struct HelpOption* options, int count)
43 {
44         indentation *= 2;
45         char* indent = malloc(indentation+1);
46         memset(indent, ' ', indentation);
47         indent[indentation] = 0;
48         printf("%s%s:\n", indent, group_name);
49         indentation += 2;
50         indent = realloc(indent, indentation+1);
51         memset(indent, ' ', indentation);
52         indent[indentation] = 0;
53
54         int i;
55         for ( i = 0; i < count; i++ )
56         {
57                 int printed = printf("%s%-24s  ", indent, options[i].name);
58                 int descsz = strlen(options[i].description);
59                 int j = 0;
60                 while ( j < descsz && descsz-j > width - printed )
61                 {
62                         if ( j != 0 )
63                                 printf("%s%26c",indent,' ');
64                         int fragment = width - printed;
65                         while ( fragment > 0 && options[i].description[j+fragment-1] != ' ')
66                                         fragment--;
67                         j += fwrite(options[i].description+j, sizeof(char), fragment, stdout);
68                         putchar('\n');
69                         printed = indentation+26;
70                 }
71                 if ( j == 0 )
72                 {
73                         printf("%s\n",options[i].description+j);
74                 }
75                 else if ( j < descsz )
76                 {
77                         printf("%s%26c%s\n",indent,' ',options[i].description+j);
78                 }
79         }
80
81         putchar('\n');
82
83         free(indent);
84 }
85
86 void HelpBsp()
87 {
88         struct HelpOption bsp[] = {
89                 {"-bsp [options] <filename.map>", "Switch that enters this stage"},
90                 {"-altsplit", "Alternate BSP tree splitting weights (should give more fps)"},
91                 {"-bspfile <filename.bsp>", "BSP file to write"},
92                 {"-celshader <shadername>", "Sets a global cel shader name"},
93                 {"-custinfoparms", "Read scripts/custinfoparms.txt"},
94                 {"-debuginset", "Push all triangle vertexes towards the triangle center"},
95                 {"-debugportals", "Make BSP portals visible in the map"},
96                 {"-debugsurfaces", "Color the vertexes according to the index of the surface"},
97                 {"-deep", "Use detail brushes in the BSP tree, but at lowest priority (should give more fps)"},
98                 {"-de <F>", "Distance epsilon for plane snapping etc."},
99                 {"-fakemap", "Write fakemap.map containing all world brushes"},
100                 {"-flares", "Turn on support for flares"},
101                 {"-flat", "Enable flat shading (good for combining with -celshader)"},
102                 {"-fulldetail", "Treat detail brushes as structural ones"},
103                 {"-keeplights", "Keep light entities in the BSP file after compile"},
104                 {"-leaktest", "Abort if a leak was found"},
105                 {"-linfile <filename.lin>", "Line file to write"},
106                 {"-maxarea", "Use Max Area face surface generation"},
107                 {"-meta", "Combine adjacent triangles of the same texture to surfaces (ALWAYS USE THIS)"},
108                 {"-metaadequatescore <N>", "Adequate score for adding triangles to meta surfaces"},
109                 {"-metagoodscore <N>", "Good score for adding triangles to meta surfaces"},
110                 {"-metamaxbboxdistance <F>", "Maximum bounding box distance for meta surfaces"},
111                 {"-minsamplesize <N>", "Sets minimum lightmap resolution in luxels/qu"},
112                 {"-mi <N>", "Sets the maximum number of indexes per surface"},
113                 {"-mv <N>", "Sets the maximum number of vertices of a lightmapped surface"},
114                 {"-ne <F>", "Normal epsilon for plane snapping etc."},
115                 {"-nocurves", "Turn off support for patches"},
116                 {"-nodetail", "Leave out detail brushes"},
117                 {"-noflares", "Turn off support for flares"},
118                 {"-nofog", "Turn off support for fog volumes"},
119                 {"-nohint", "Turn off support for hint brushes"},
120                 {"-nosRGB", "Treat colors and textures as linear colorspace"},
121                 {"-nosRGBcolor", "Treat shader and light entity colors as linear colorspace"},
122                 {"-nosRGBtex", "Treat textures as linear colorspace"},
123                 {"-nosubdivide", "Turn off support for `q3map_tessSize` (breaks water vertex deforms)"},
124                 {"-notjunc", "Do not fix T-junctions (causes cracks between triangles, do not use)"},
125                 {"-nowater", "Turn off support for water, slime or lava (Stef, this is for you)"},
126                 {"-np <A>", "Force all surfaces to be nonplanar with a given shade angle"},
127                 {"-onlyents", "Only update entities in the BSP"},
128                 {"-patchmeta", "Turn patches into triangle meshes for display"},
129                 {"-prtfile <filename.prt>", "Portal file to write"},
130                 {"-rename", "Append suffix to miscmodel shaders (needed for SoF2)"},
131                 {"-samplesize <N>", "Sets default lightmap resolution in luxels/qu"},
132                 {"-skyfix", "Turn sky box into six surfaces to work around ATI problems"},
133                 {"-snap <N>", "Snap brush bevel planes to the given number of units"},
134                 {"-srffile <filename.srf>", "Surface file to write"},
135                 {"-sRGBcolor", "Treat shader and light entity colors as sRGB colorspace"},
136                 {"-sRGBtex", "Treat textures as sRGB colorspace"},
137                 {"-tempname <filename.map>", "Read the MAP file from the given file name"},
138                 {"-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"},
139                 {"-tmpout", "Write the BSP file to /tmp"},
140                 {"-verboseentities", "Enable `-v` only for map entities, not for the world"},
141         };
142         HelpOptions("BSP Stage", 0, 80, bsp, sizeof(bsp)/sizeof(struct HelpOption));
143 }
144
145 void HelpVis()
146 {
147         struct HelpOption vis[] = {
148                 {"-vis [options] <filename.map>", "Switch that enters this stage"},
149                 {"-fast", "Very fast and crude vis calculation"},
150                 {"-hint", "Merge all but hint portals"},
151                 {"-mergeportals", "The less crude half of `-merge`, makes vis sometimes much faster but doesn't hurt fps usually"},
152                 {"-merge", "Faster but still okay vis calculation"},
153                 {"-nopassage", "Just use PortalFlow vis (usually less fps)"},
154                 {"-nosort", "Do not sort the portals before calculating vis (usually slower)"},
155                 {"-passageOnly", "Just use PassageFlow vis (usually less fps)"},
156                 {"-prtfile <filename.prt>", "Portal file to read"},
157                 {"-saveprt", "Keep the Portal file after running vis (so you can run vis again)"},
158                 {"-tmpin", "Use /tmp folder for input"},
159                 {"-tmpout", "Use /tmp folder for output"},
160                 {"-v -v", "Extra verbose mode for cluster debug"}, // q3map2 common takes first -v
161         };
162         HelpOptions("VIS Stage", 0, 80, vis, sizeof(vis)/sizeof(struct HelpOption));
163 }
164
165 void HelpLight()
166 {
167         struct HelpOption light[] = {
168                 {"-light [options] <filename.map>", "Switch that enters this stage"},
169                 {"-vlight [options] <filename.map>", "Deprecated alias for `-light -fast` ... filename.map"},
170                 {"-approx <N>", "Vertex light approximation tolerance (never use in conjunction with deluxemapping)"},
171                 {"-areascale <F, `-area` F>", "Scaling factor for area lights (surfacelight)"},
172                 {"-border", "Add a red border to lightmaps for debugging"},
173                 {"-bouncegrid", "Also compute radiosity on the light grid"},
174                 {"-bounceonly", "Only compute radiosity"},
175                 {"-bouncescale <F>", "Scaling factor for radiosity"},
176                 {"-bounce <N>", "Number of bounces for radiosity"},
177                 {"-bspfile <filename.bsp>", "BSP file to write"},
178                 {"-cheapgrid", "Use `-cheap` style lighting for radiosity"},
179                 {"-cheap", "Abort vertex light calculations when white is reached"},
180                 {"-compensate <F>", "Lightmap compensate (darkening factor applied after everything else)"},
181                 {"-cpma", "CPMA vertex lighting mode"},
182                 {"-custinfoparms", "Read scripts/custinfoparms.txt"},
183                 {"-dark", "Darken lightmap seams"},
184                 {"-debugaxis", "Color the lightmaps according to the lightmap axis"},
185                 {"-debugcluster", "Color the lightmaps according to the index of the cluster"},
186                 {"-debugdeluxe", "Show deluxemaps on the lightmap"},
187                 {"-debugnormals", "Color the lightmaps according to the direction of the surface normal"},
188                 {"-debugorigin", "Color the lightmaps according to the origin of the luxels"},
189                 {"-debugsurfaces, -debugsurface", "Color the lightmaps according to the index of the surface"},
190                 {"-debugunused", "This option does nothing"},
191                 {"-debug", "Mark the lightmaps according to the cluster: unmapped clusters get yellow, occluded ones get pink, flooded ones get blue overlay color, otherwise red"},
192                 {"-deluxemode 0", "Use modelspace deluxemaps (DarkPlaces)"},
193                 {"-deluxemode 1", "Use tangentspace deluxemaps"},
194                 {"-deluxe, -deluxemap", "Enable deluxemapping (light direction maps)"},
195                 {"-dirtdebug, -debugdirt", "Store the dirtmaps as lightmaps for debugging"},
196                 {"-dirtdepth", "Dirtmapping depth"},
197                 {"-dirtgain", "Dirtmapping exponent"},
198                 {"-dirtmode 0", "Ordered direction dirtmapping"},
199                 {"-dirtmode 1", "Randomized direction dirtmapping"},
200                 {"-dirtscale", "Dirtmapping scaling factor"},
201                 {"-dirty", "Enable dirtmapping"},
202                 {"-dump", "Dump radiosity from `-bounce` into numbered MAP file prefabs"},
203                 {"-export", "Export lightmaps when compile finished (like `-export` mode)"},
204                 {"-exposure <F>", "Lightmap exposure to better support overbright spots"},
205                 {"-external", "Force external lightmaps even if at size of internal lightmaps"},
206                 {"-extradist <F>", "Extra distance for lights in map units"},
207                 {"-extravisnudge", "Broken feature to nudge the luxel origin to a better vis cluster"},
208                 {"-extrawide", "Deprecated alias for `-super 2 -filter`"},
209                 {"-extra", "Deprecated alias for `-super 2`"},
210                 {"-fastallocate", "Use `-fastallocate` to trade lightmap size against allocation time (useful with hi res lightmaps on large maps: reduce allocation time from days to minutes for only some extra bytes)"},
211                 {"-fastbounce", "Use `-fast` style lighting for radiosity"},
212                 {"-faster", "Use a faster falloff curve for lighting; also implies `-fast`"},
213                 {"-fastgrid", "Use `-fast` style lighting for the light grid"},
214                 {"-fast", "Ignore tiny light contributions"},
215                 {"-fill", "Fill lightmap colors from surrounding pixels to improve JPEG compression"},
216                 {"-filter", "Lightmap filtering"},
217                 {"-floodlight", "Enable floodlight (zero-effort somewhat decent lighting)"},
218                 {"-gamma <F>", "Lightmap gamma"},
219                 {"-gridambientdirectionality <F>", "Ambient directional lighting received (default: 0.0)"},
220                 {"-gridambientscale <F>", "Scaling factor for the light grid ambient components only"},
221                 {"-griddirectionality <F>", "Directional lighting received (default: 1.0)"},
222                 {"-gridscale <F>", "Scaling factor for the light grid only"},
223                 {"-lightanglehl 0", "Disable half lambert light angle attenuation"},
224                 {"-lightanglehl 1", "Enable half lambert light angle attenuation"},
225                 {"-lightmapdir <directory>", "Directory to store external lightmaps (default: same as map name without extension)"},
226                 {"-lightmapsearchblocksize <N>", "Restrict lightmap search to block size <N>"},
227                 {"-lightmapsearchpower <N>", "Optimize for lightmap merge power <N>"},
228                 {"-lightmapsize <N>", "Size of lightmaps to generate (must be a power of two)"},
229                 {"-lightsubdiv <N>", "Size of light emitting shader subdivision"},
230                 {"-lomem", "Low memory but slower lighting mode"},
231                 {"-lowquality", "Low quality floodlight (appears to currently break floodlight)"},
232                 {"-minsamplesize <N>", "Sets minimum lightmap resolution in luxels/qu"},
233                 {"-nocollapse", "Do not collapse identical lightmaps"},
234                 {"-nodeluxe, -nodeluxemap", "Disable deluxemapping"},
235                 {"-nofastpoint", "Disable fast point light calculation"},
236                 {"-nogrid", "Disable grid light calculation (makes all entities fullbright)"},
237                 {"-nolightmapsearch", "Do not optimize lightmap packing for GPU memory usage (as doing so costs fps)"},
238                 {"-normalmap", "Color the lightmaps according to the direction of the surface normal (TODO is this identical to `-debugnormals`?)"},
239                 {"-nosRGB", "Treat colors, textures, and lightmaps as linear colorspace"},
240                 {"-nosRGBcolor", "Treat shader and light entity colors as linear colorspace"},
241                 {"-nosRGBlight", "Write lightmaps as linear colorspace"},
242                 {"-nosRGBtex", "Treat textures as linear colorspace"},
243                 {"-nostyle, -nostyles", "Disable support for light styles"},
244                 {"-nosurf", "Disable tracing against surfaces (only uses BSP nodes then)"},
245                 {"-notrace", "Disable shadow occlusion"},
246                 {"-novertex", "Disable vertex lighting"},
247                 {"-patchshadows", "Cast shadows from patches"},
248                 {"-pointscale <F, `-point` F>", "Scaling factor for spherical and spot point lights (light entities)"},
249                 {"-q3", "Use nonlinear falloff curve by default (like Q3A)"},
250                 {"-randomsamples", "Use random sampling for lightmaps"},
251                 {"-rawlightmapsizelimit <N>", "Sets maximum lightmap resolution in luxels/qu (only affects patches if used -patchmeta in BSP stage)"},
252                 {"-samplescale <F>", "Scales all lightmap resolutions"},
253                 {"-samplesize <N>", "Sets default lightmap resolution in luxels/qu"},
254                 {"-samplessearchboxsize <N>", "Search box size (1 to 4) for lightmap adaptive supersampling"},
255                 {"-samples <N>", "Adaptive supersampling quality"},
256                 {"-scale <F>", "Scaling factor for all light types"},
257                 {"-shadeangle <A>", "Angle for phong shading"},
258                 {"-shade", "Enable phong shading at default shade angle"},
259                 {"-skyscale <F, `-sky` F>", "Scaling factor for sky and sun light"},
260                 {"-smooth", "Deprecated alias for `-samples 2`"},
261                 {"-sphericalscale <F, `-spherical` F>", "Scaling factor for spherical point light entities"},
262                 {"-spotscale <F, `-spot` F>", "Scaling factor for spot point light entities"},
263                 {"-srffile <filename.srf>", "Surface file to read"},
264                 {"-sRGB", "Treat colors, textures, and lightmaps as sRGB colorspace"},
265                 {"-sRGBcolor", "Treat shader and light entity colors as sRGB colorspace"},
266                 {"-sRGBlight", "Write lightmaps as sRGB colorspace"},
267                 {"-sRGBtex", "Treat textures as sRGB colorspace"},
268                 {"-style, -styles", "Enable support for light styles"},
269                 {"-sunonly", "Only compute sun light"},
270                 {"-super <N, `-supersample` N>", "Ordered grid supersampling quality"},
271                 {"-thresh <F>", "Triangle subdivision threshold"},
272                 {"-trianglecheck", "Broken check that should ensure luxels apply to the right triangle"},
273                 {"-trisoup", "Convert brush faces to triangle soup"},
274                 {"-wolf", "Use linear falloff curve by default (like W:ET)"},
275         };
276
277         HelpOptions("Light Stage", 0, 80, light, sizeof(light)/sizeof(struct HelpOption));
278 }
279
280 void HelpAnalyze()
281 {
282         struct HelpOption analyze[] = {
283                 {"-analyze [options] <filename.bsp>", "Switch that enters this mode"},
284                 {"-lumpswap", "Swap byte order in the lumps"},
285         };
286
287         HelpOptions("Analyzing BSP-like file structure", 0, 80, analyze, sizeof(analyze)/sizeof(struct HelpOption));
288 }
289
290 void HelpScale()
291 {
292         struct HelpOption scale[] = {
293                 {"-scale [options] <S filename.bsp>", "Scale uniformly"},
294                 {"-scale [options] <SX SY SZ filename.bsp>", "Scale non-uniformly"},
295                 {"-tex", "Scale without texture lock"},
296                 {"-spawn_ref <F>", "Vertical offset for info_player_* entities (adds spawn_ref, scales, subtracts spawn_ref)"},
297         };
298         HelpOptions("Scaling", 0, 80, scale, sizeof(scale)/sizeof(struct HelpOption));
299 }
300
301 void HelpConvert()
302 {
303         struct HelpOption convert[] = {
304                 {"-convert [options] <filename.bsp>", "Switch that enters this mode"},
305                 {"-deluxemapsastexcoord", "Save deluxemap names and texcoords instead of textures (only when writing ase and obj)"},
306                 {"-de <F>", "Distance epsilon for the conversion (only when reading map)"},
307                 {"-format <converter>", "Select the converter, default ase (available: map, map_bp, ase, obj, or game names)"},
308                 {"-lightmapsastexcoord", "Save lightmap names and texcoords instead of textures (only when writing ase and obj)"},
309                 {"-meta", "Combine adjacent triangles of the same texture to surfaces (only when reading map)"},
310                 {"-ne <F>", "Normal epsilon for the conversion (only when reading map)"},
311                 {"-patchmeta", "Turn patches into triangle meshes for display (only when reading map)"},
312                 {"-readbsp", "Force converting bsp to selected format"},
313                 {"-readmap", "Force converting map to selected format"},
314                 {"-shadersasbitmap", "Save shader names as bitmap names in the model so it works as a prefab (only when writing ase and obj)"},
315         };
316
317         HelpOptions("Converting & Decompiling", 0, 80, convert, sizeof(convert)/sizeof(struct HelpOption));
318 }
319
320 void HelpExport()
321 {
322         struct HelpOption exportl[] = {
323                 {"-export <filename.bsp>", "Copies lightmaps from the BSP to `filename/lightmap_0000.tga` ff"}
324         };
325
326         HelpOptions("Exporting lightmaps", 0, 80, exportl, sizeof(exportl)/sizeof(struct HelpOption));
327 }
328
329 void HelpExportEnts()
330 {
331         struct HelpOption exportents[] = {
332                 {"-exportents <filename.bsp>", "Exports the entities to a text file (.ent)"},
333         };
334         HelpOptions("ExportEnts Stage", 0, 80, exportents, sizeof(exportents)/sizeof(struct HelpOption));
335 }
336
337 void HelpFixaas()
338 {
339         struct HelpOption fixaas[] = {
340                 {"-fixaas <filename.bsp>", "Switch that enters this mode"},
341         };
342
343         HelpOptions("Fixing AAS checksum", 0, 80, fixaas, sizeof(fixaas)/sizeof(struct HelpOption));
344 }
345
346 void HelpInfo()
347 {
348         struct HelpOption info[] = {
349                 {"-info <filename.bsp>", "Switch that enters this mode"},
350         };
351
352         HelpOptions("Get info about BSP file", 0, 80, info, sizeof(info)/sizeof(struct HelpOption));
353 }
354
355 void HelpImport()
356 {
357         struct HelpOption import[] = {
358                 {"-import <filename.bsp>", "Copies lightmaps from `filename/lightmap_0000.tga` ff into the BSP"},
359         };
360
361         HelpOptions("Importing lightmaps", 0, 80, import, sizeof(import)/sizeof(struct HelpOption));
362 }
363
364 void HelpMinimap()
365 {
366         struct HelpOption minimap[] = {
367                 {"-minimap [options] <filename.bsp>", "Creates a minimap of the BSP, by default writes to `../gfx/filename_mini.tga`"},
368                 {"-autolevel", "Automatically level brightness and contrast"},
369                 {"-black", "Write the minimap as a black-on-transparency RGBA32 image"},
370                 {"-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"},
371                 {"-border <F>", "Sets the amount of border pixels relative to the total image size"},
372                 {"-brightness <F>", "Sets brightness value to add to minimap values"},
373                 {"-contrast <F>", "Sets contrast value to scale minimap values (doesn't affect brightness)"},
374                 {"-gray", "Write the minimap as a white-on-black GRAY8 image"},
375                 {"-keepaspect", "Ensure the aspect ratio is kept (the minimap is then letterboxed to keep aspect)"},
376                 {"-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)"},
377                 {"-noautolevel", "Do not automatically level brightness and contrast"},
378                 {"-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)"},
379                 {"-o <filename.tga>", "Sets the output file name"},
380                 {"-random <N>", "Sets the randomized supersampling count (cannot be combined with `-samples`)"},
381                 {"-samples <N>", "Sets the ordered supersampling count (cannot be combined with `-random`)"},
382                 {"-sharpen <F>", "Sets the sharpening coefficient"},
383                 {"-size <N>", "Sets the width and height of the output image"},
384                 {"-white", "Write the minimap as a white-on-transparency RGBA32 image"},
385         };
386
387         HelpOptions("MiniMap", 0, 80, minimap, sizeof(minimap)/sizeof(struct HelpOption));
388 }
389
390 void HelpCommon()
391 {
392         struct HelpOption common[] = {
393                 {"-connect <address>", "Talk to a " RADIANT_NAME " instance using a specific XML based protocol"},
394                 {"-force", "Allow reading some broken/unsupported BSP files e.g. when decompiling, may also crash"},
395                 {"-fs_basepath <path>", "Sets the given path as main directory of the game (can be used more than once to look in multiple paths)"},
396                 {"-fs_forbiddenpath <pattern>", "Pattern to ignore directories, pk3, and pk3dir; example pak?.pk3 (can be used more than once to look for multiple patterns)"},
397                 {"-fs_game <gamename>", "Sets a different game directory name (default for Q3A: baseq3, can be used more than once)"},
398                 {"-fs_home <dir>", "Specifies where the user home directory is on Linux"},
399                 {"-fs_homebase <dir>", "Specifies game home directory relative to user home directory on Linux (default for Q3A: .q3a)"},
400                 {"-fs_homepath <path>", "Sets the given path as the game home directory name (fs_home + fs_homebase)"},
401                 {"-fs_nobasepath", "Do not load base paths in VFS, imply -fs_nomagicpath"},
402                 {"-fs_nomagicpath", "Do not try to guess base path magically"},
403                 {"-fs_nohomepath", "Do not load home path in VFS"},
404                 {"-fs_pakpath <path>", "Specify a package directory (can be used more than once to look in multiple paths)"},
405                 {"-game <gamename>", "Load settings for the given game (default: quake3)"},
406                 {"-subdivisions <F>", "multiplier for patch subdivisions quality"},
407                 {"-threads <N>", "number of threads to use"},
408                 {"-v", "Verbose mode"},
409                 {"-werror", "Make all warnings into errors"}
410         };
411
412         HelpOptions("Common Options", 0, 80, common, sizeof(common)/sizeof(struct HelpOption));
413
414 }
415
416 void HelpMain(const char* arg)
417 {
418         printf("Usage: q3map2 [stage] [common options...] [stage options...] [stage source file]\n");
419         printf("       q3map2 -help [stage]\n\n");
420
421         HelpCommon();
422
423         struct HelpOption stages[] = {
424                 {"-bsp", "BSP Stage"},
425                 {"-vis", "VIS Stage"},
426                 {"-light", "Light Stage"},
427                 {"-analyze", "Analyzing BSP-like file structure"},
428                 {"-scale", "Scaling"},
429                 {"-convert", "Converting & Decompiling"},
430                 {"-export", "Exporting lightmaps"},
431                 {"-exportents", "Exporting entities"},
432                 {"-fixaas", "Fixing AAS checksum"},
433                 {"-info", "Get info about BSP file"},
434                 {"-import", "Importing lightmaps"},
435                 {"-minimap", "MiniMap"},
436         };
437         void(*help_funcs[])() = {
438                 HelpBsp,
439                 HelpVis,
440                 HelpLight,
441                 HelpAnalyze,
442                 HelpScale,
443                 HelpConvert,
444                 HelpExport,
445                 HelpExportEnts,
446                 HelpFixaas,
447                 HelpInfo,
448                 HelpImport,
449                 HelpMinimap,
450         };
451
452         if ( arg && strlen(arg) > 0 )
453         {
454                 if ( arg[0] == '-' )
455                         arg++;
456
457                 unsigned i;
458                 for ( i = 0; i < sizeof(stages)/sizeof(struct HelpOption); i++ )
459                         if ( strcmp(arg, stages[i].name+1) == 0 )
460                         {
461                                 help_funcs[i]();
462                                 return;
463                         }
464         }
465
466         HelpOptions("Stages", 0, 80, stages, sizeof(stages)/sizeof(struct HelpOption));
467 }