/* 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
{
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;
{"-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"},
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();
help_funcs[i]();
return;
}
- }
+ }
}
HelpOptions("Stages", 0, terminalColumns, stages, sizeof(stages)/sizeof(struct HelpOption));