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