diff --git a/src/common/cmdparser.c b/src/common/cmdparser.c index 4f9cafcf..8d41989d 100644 --- a/src/common/cmdparser.c +++ b/src/common/cmdparser.c @@ -257,7 +257,7 @@ Cbuf_AddEarlyCommands(qboolean clear) { s = COM_Argv(i); - if (strcmp(s, "+set")) + if (strcmp(s, "+set") != 0) { continue; } diff --git a/src/common/frame.c b/src/common/frame.c index ca53cc26..9c168ea0 100644 --- a/src/common/frame.c +++ b/src/common/frame.c @@ -195,6 +195,59 @@ void Qcommon_ExecConfigs(qboolean gameStartUp) Cbuf_Execute(); } +static qboolean checkForHelp(int argc, char **argv) +{ + const char* helpArgs[] = { "--help", "-h", "-help", "-?", "/?" }; + const int numHelpArgs = sizeof(helpArgs)/sizeof(helpArgs[0]); + + for (int i=1; i\n"); + printf(" set path to your Quake2 game data (the directory baseq2/ is in)\n"); + printf("-portable\n"); + printf(" Only write (savegames, configs, ...) in current directory\n"); + printf("+exec \n"); + printf(" execute the given config (mainly relevant for dedicated servers)\n"); + printf("+set \n"); + printf(" Set the given cvar to the given value, e.g. +set vid_fullscreen 0\n"); + + printf("\nSome interesting cvars:\n"); + printf("+set game \n"); + printf(" start the given addon/mod, e.g. +set game xatrix\n"); +#ifndef DEDICATED_ONLY + printf("+set vid_fullscreen <0 or 1>\n"); + printf(" start game in windowed (0) or desktop fullscreen (1)\n"); + printf(" or classic fullscreen (2) mode\n"); + printf("+set r_mode \n"); + printf(" start game in resolution belonging to ,\n"); + printf(" use -1 for custom resolutions:\n"); + printf("+set r_customwidth \n"); + printf("+set r_customheight \n"); + printf(" if r_mode is set to -1, these cvars allow you to specify the\n"); + printf(" width/height of your custom resolution\n"); + printf("+set vid_renderer \n"); + printf(" Selects the render backend. Currently available:\n"); + printf(" 'gl1' (old OpenGL 1.x renderer),\n"); + printf(" 'gl3' (the shiny new OpenGL 3.2 renderer),\n"); + printf(" 'soft' (the experimental software renderer)\n"); +#endif // DEDICATED_ONLY + printf("\nSee https://github.com/yquake2/yquake2/blob/master/stuff/cvarlist.md\nfor some more cvars\n"); + + return true; + } + } + } + return false; +} + void Qcommon_Init(int argc, char **argv) { @@ -204,6 +257,13 @@ Qcommon_Init(int argc, char **argv) Sys_Error("Error during initialization"); } + if (checkForHelp(argc, argv)) + { + // ok, --help or similar commandline option was given + // and info was printed, exit the game now + exit(1); + } + // Print the build and version string Qcommon_Buildstring();