From 44124ddaf9a8bd3a0b551e7ff016fa4547780f5a Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 3 May 2021 06:23:06 +0200 Subject: [PATCH] q3map2/help: list supported games --- tools/quake3/q3map2/help.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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"}, -- 2.39.2