]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/help.c
Merge branch 'master' into master-merge
[xonotic/netradiant.git] / tools / quake3 / q3map2 / help.c
index fc77050a1025dfa68fff11161678993b13ac16fa..a1fb1eaf45d517f67d58e6ba654948caa5ddac7f 100644 (file)
 /* dependencies */
 #include "q3map2.h"
 
+#if GDEF_OS_POSIX
+#include <sys/ioctl.h>
+#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 <F>", "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 <F>", "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 <termcap.h>
-
 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));