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