From: Thomas Debesse Date: Mon, 3 May 2021 04:23:06 +0000 (+0200) Subject: q3map2/help: list supported games X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=44124ddaf9a8bd3a0b551e7ff016fa4547780f5a;p=xonotic%2Fnetradiant.git q3map2/help: list supported games --- diff --git a/tools/quake3/q3map2/help.c b/tools/quake3/q3map2/help.c index 96409f42..5f5664d7 100644 --- a/tools/quake3/q3map2/help.c +++ b/tools/quake3/q3map2/help.c @@ -423,6 +423,38 @@ void HelpCommon() HelpOptions("Common Options", 0, 80, common, sizeof(common)/sizeof(struct HelpOption)); } +void HelpGames() +{ + printf("Games:\n"); + qboolean begin = qtrue; + + // TODO: sort alphabetically + for ( unsigned i = 0, length = 0; games[ i ].arg != NULL; i++ ) + { + // 3 for two whitespaces at the beginning and one (optional) comma a the end + if ( length + 3 + strlen( games[ i ].arg ) > 80 ) + { + printf(",\n"); + length = 0; + begin = qtrue; + } + + if ( begin ) + { + printf(" %s", games[ i ].arg ); + begin = qfalse; + } + else + { + printf(", %s", games[ i ].arg ); + } + + length += 2 + strlen( games[ i ].arg ); + } + + printf("\n\n"); +} + void HelpMain(const char* arg) { printf("Usage: q3map2 [stage] [common options...] [stage options...] [stage source file]\n"); @@ -430,6 +462,8 @@ void HelpMain(const char* arg) HelpCommon(); + HelpGames(); + struct HelpOption stages[] = { {"-bsp", "BSP Stage"}, {"-vis", "VIS Stage"},