X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fq3map2%2Fhelp.c;h=a1fb1eaf45d517f67d58e6ba654948caa5ddac7f;hb=5e59debc73568be635d299791fa15831df605106;hp=fc77050a1025dfa68fff11161678993b13ac16fa;hpb=510c8c16498bc1784bc38d0c33184c0174e71e81;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3map2/help.c b/tools/quake3/q3map2/help.c index fc77050a..a1fb1eaf 100644 --- a/tools/quake3/q3map2/help.c +++ b/tools/quake3/q3map2/help.c @@ -31,9 +31,11 @@ /* dependencies */ #include "q3map2.h" +#if GDEF_OS_POSIX +#include +#endif // GDEF_OS_POSIX - -unsigned terminalColumns = 80; +static unsigned terminalColumns = 80; struct HelpOption { @@ -41,6 +43,7 @@ struct HelpOption const char* description; }; +// FIXME: low column width cause an endless loop void HelpOptions(const char* group_name, int indentation, int width, struct HelpOption* options, int count) { indentation *= 2; @@ -212,11 +215,13 @@ void HelpLight() {"-export", "Export lightmaps when compile finished (like `-export` mode)"}, {"-exposure ", "Lightmap exposure to better support overbright spots"}, {"-external", "Force external lightmaps even if at size of internal lightmaps"}, + {"-externalnames", "Write lightstyle shader using external lightmap names"}, {"-extradist ", "Extra distance for lights in map units"}, {"-extravisnudge", "Broken feature to nudge the luxel origin to a better vis cluster"}, {"-extrawide", "Deprecated alias for `-super 2 -filter`"}, {"-extra", "Deprecated alias for `-super 2`"}, {"-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)"}, + {"-slowallocate", "Use old (a bit more careful, but much slower) lightmaps packing algorithm (default)"}, {"-fastbounce", "Use `-fast` style lighting for radiosity"}, {"-faster", "Use a faster falloff curve for lighting; also implies `-fast`"}, {"-fastgrid", "Use `-fast` style lighting for the light grid"}, @@ -457,19 +462,19 @@ void HelpGames() printf("\n\n"); } -#include - void HelpMain(const char* arg) { printf("Usage: q3map2 [stage] [common options...] [stage options...] [stage source file]\n"); printf(" q3map2 -help [stage]\n"); printf(" q3map2 -help all\n\n"); - static char termbuf[2048]; - char *termtype = getenv("TERM"); - if (tgetent(termbuf, termtype) >= 0) { - terminalColumns = tgetnum("co"); +#if GDEF_OS_POSIX + struct winsize ws; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); + if (ws.ws_col > 60) { + terminalColumns = ws.ws_col; } +#endif // GDEF_OS_POSIX HelpCommon(); @@ -530,7 +535,7 @@ void HelpMain(const char* arg) help_funcs[i](); return; } - } + } } HelpOptions("Stages", 0, terminalColumns, stages, sizeof(stages)/sizeof(struct HelpOption));