diff --git a/doomsday/engine/portable/src/audiodriver.c b/doomsday/engine/portable/src/audiodriver.c index bf3b19e8c7..58c27dc896 100644 --- a/doomsday/engine/portable/src/audiodriver.c +++ b/doomsday/engine/portable/src/audiodriver.c @@ -256,27 +256,27 @@ static boolean initDriver(audiodriver_e id) static audiodriver_e chooseAudioDriver(void) { // No audio output? - if(isDedicated || ArgExists("-dummy")) + if(isDedicated || CommandLine_Exists("-dummy")) return AUDIOD_DUMMY; - if(ArgExists("-fmod")) + if(CommandLine_Exists("-fmod")) return AUDIOD_FMOD; - if(ArgExists("-oal")) + if(CommandLine_Exists("-oal")) return AUDIOD_OPENAL; #ifdef WIN32 // DirectSound with 3D sound support, EAX effects? - if(ArgExists("-dsound")) + if(CommandLine_Exists("-dsound")) return AUDIOD_DSOUND; // Windows Multimedia? - if(ArgExists("-winmm")) + if(CommandLine_Exists("-winmm")) return AUDIOD_WINMM; #endif #ifndef DENG_DISABLE_SDLMIXER - if(ArgExists("-sdlmixer")) + if(CommandLine_Exists("-sdlmixer")) return AUDIOD_SDL_MIXER; #endif @@ -310,9 +310,9 @@ static void selectInterfaces(audiodriver_e defaultDriverId) if(defaultDriver->cd.gen.Init) iCD = &defaultDriver->cd; // Check for SFX override. - if((p = ArgCheckWith("-isfx", 1)) > 0) + if((p = CommandLine_CheckWith("-isfx", 1)) > 0) { - drvId = initDriverIfNeeded(Argv(p + 1)); + drvId = initDriverIfNeeded(CommandLine_At(p + 1)); if(!drivers[drvId].sfx.gen.Init) { Con_Error("Audio driver '%s' does not provide an SFX interface.\n", @@ -322,9 +322,9 @@ static void selectInterfaces(audiodriver_e defaultDriverId) } // Check for Music override. - if((p = ArgCheckWith("-imusic", 1)) > 0) + if((p = CommandLine_CheckWith("-imusic", 1)) > 0) { - drvId = initDriverIfNeeded(Argv(p + 1)); + drvId = initDriverIfNeeded(CommandLine_At(p + 1)); if(!drivers[drvId].music.gen.Init) { Con_Error("Audio driver '%s' does not provide a Music interface.\n", @@ -334,9 +334,9 @@ static void selectInterfaces(audiodriver_e defaultDriverId) } // Check for Music override. - if((p = ArgCheckWith("-icd", 1)) > 0) + if((p = CommandLine_CheckWith("-icd", 1)) > 0) { - drvId = initDriverIfNeeded(Argv(p + 1)); + drvId = initDriverIfNeeded(CommandLine_At(p + 1)); if(!drivers[drvId].cd.gen.Init) { Con_Error("Audio driver '%s' does not provide a CD interface.\n", @@ -369,7 +369,7 @@ boolean AudioDriver_Init(void) audiodriver_e defaultDriverId; boolean ok = false; - if(ArgExists("-nosound")) return false; + if(CommandLine_Exists("-nosound")) return false; defaultDriverId = chooseAudioDriver(); ok = initDriver(defaultDriverId); diff --git a/doomsday/engine/portable/src/canvaswindow.cpp b/doomsday/engine/portable/src/canvaswindow.cpp index 4a4b26574f..517f4718b6 100644 --- a/doomsday/engine/portable/src/canvaswindow.cpp +++ b/doomsday/engine/portable/src/canvaswindow.cpp @@ -186,7 +186,7 @@ void CanvasWindow::setDefaultGLFormat() // static fmt.setStencilBufferSize(8); fmt.setDoubleBuffer(true); - if(ArgExists("-novsync") || !Con_GetByte("vid-vsync")) + if(CommandLine_Exists("-novsync") || !Con_GetByte("vid-vsync")) { fmt.setSwapInterval(0); // vsync off } @@ -195,7 +195,7 @@ void CanvasWindow::setDefaultGLFormat() // static fmt.setSwapInterval(1); } - if(ArgExists("-nofsaa") || !Con_GetByte("vid-fsaa")) + if(CommandLine_Exists("-nofsaa") || !Con_GetByte("vid-fsaa")) { fmt.setSampleBuffers(false); } diff --git a/doomsday/engine/portable/src/cl_main.c b/doomsday/engine/portable/src/cl_main.c index 77c4c6cf58..1fe4ec382e 100644 --- a/doomsday/engine/portable/src/cl_main.c +++ b/doomsday/engine/portable/src/cl_main.c @@ -75,9 +75,9 @@ void Cl_InitID(void) FILE* file; size_t result; - if((i = ArgCheckWith("-id", 1)) != 0) + if((i = CommandLine_CheckWith("-id", 1)) != 0) { - clientID = strtoul(Argv(i + 1), 0, 0); + clientID = strtoul(CommandLine_At(i + 1), 0, 0); Con_Message("Cl_InitID: Using custom id 0x%08x.\n", clientID); return; } diff --git a/doomsday/engine/portable/src/dd_input.c b/doomsday/engine/portable/src/dd_input.c index 2bbf269aa5..ac16f93023 100644 --- a/doomsday/engine/portable/src/dd_input.c +++ b/doomsday/engine/portable/src/dd_input.c @@ -826,7 +826,7 @@ void DD_InitInput(void) { int i; - inputDisabledFully = ArgExists("-noinput"); + inputDisabledFully = CommandLine_Exists("-noinput"); for(i = 0; i < 256; ++i) { diff --git a/doomsday/engine/portable/src/dd_loop.c b/doomsday/engine/portable/src/dd_loop.c index ca041f29d0..116b56af51 100644 --- a/doomsday/engine/portable/src/dd_loop.c +++ b/doomsday/engine/portable/src/dd_loop.c @@ -111,7 +111,7 @@ int DD_GameLoopExitCode(void) int DD_GameLoop(void) { - noninteractive = ArgExists("-noinput"); + noninteractive = CommandLine_Exists("-noinput"); // Start the deng2 event loop. return LegacyCore_RunEventLoop(de2LegacyCore); diff --git a/doomsday/engine/portable/src/dd_main.c b/doomsday/engine/portable/src/dd_main.c index 2f5a945a15..7fec303774 100644 --- a/doomsday/engine/portable/src/dd_main.c +++ b/doomsday/engine/portable/src/dd_main.c @@ -986,9 +986,9 @@ static int DD_ActivateGameWorker(void* paramaters) */ { const ddstring_t* configFileName = 0; ddstring_t tmp; - if(ArgCheckWith("-config", 1)) + if(CommandLine_CheckWith("-config", 1)) { - Str_Init(&tmp); Str_Set(&tmp, ArgNext()); + Str_Init(&tmp); Str_Set(&tmp, CommandLine_Next()); F_FixSlashes(&tmp, &tmp); configFileName = &tmp; } @@ -1349,9 +1349,9 @@ static Game* findFirstPlayableGame(void) */ Game* DD_AutoselectGame(void) { - if(ArgCheckWith("-game", 1)) + if(CommandLine_CheckWith("-game", 1)) { - const char* identityKey = ArgNext(); + const char* identityKey = CommandLine_Next(); Game* game = findGameForIdentityKey(identityKey); if(game && allGameStartupResourcesFound(game)) @@ -1377,7 +1377,7 @@ int DD_EarlyInit(void) Sys_MarkAsMainThread(); // Determine the requested degree of verbosity. - verbose = ArgExists("-verbose"); + verbose = CommandLine_Exists("-verbose"); // The memory zone must be online before the console module. Z_Init(); @@ -1557,14 +1557,14 @@ boolean DD_Init(void) { resourcenamespaceid_t rnId = F_DefaultResourceNamespaceForClass(RC_PACKAGE); int p; - for(p = 0; p < Argc(); ++p) + for(p = 0; p < CommandLine_Count(); ++p) { - if(!ArgRecognize("-iwad", Argv(p))) + if(!CommandLine_IsMatchingAlias("-iwad", CommandLine_At(p))) continue; - while(++p != Argc() && !ArgIsOption(p)) + while(++p != CommandLine_Count() && !CommandLine_IsOption(p)) { - const char* filePath = Argv(p); + const char* filePath = CommandLine_At(p); directory_t* dir; Uri* searchPath; @@ -1598,7 +1598,7 @@ boolean DD_Init(void) */ // Attempt automatic game selection. - if(!ArgExists("-noautoselect")) + if(!CommandLine_Exists("-noautoselect")) { Game* game = DD_AutoselectGame(); @@ -1609,13 +1609,13 @@ boolean DD_Init(void) // Add all resources specified using -file options on the command line // to the list for this session. - for(p = 0; p < Argc(); ++p) + for(p = 0; p < CommandLine_Count(); ++p) { - if(!ArgRecognize("-file", Argv(p))) continue; + if(!CommandLine_IsMatchingAlias("-file", CommandLine_At(p))) continue; - while(++p != Argc() && !ArgIsOption(p)) + while(++p != CommandLine_Count() && !CommandLine_IsOption(p)) { - addToPathList(&gameResourceFileList, &numGameResourceFileList, Argv(p)); + addToPathList(&gameResourceFileList, &numGameResourceFileList, CommandLine_At(p)); } p--;/* For ArgIsOption(p) necessary, for p==Argc() harmless */ @@ -1635,9 +1635,9 @@ boolean DD_Init(void) F_ResetAllResourceNamespaces(); // One-time execution of various command line features available during startup. - if(ArgCheckWith("-dumplump", 1)) + if(CommandLine_CheckWith("-dumplump", 1)) { - const char* name = ArgNext(); + const char* name = CommandLine_Next(); lumpnum_t absoluteLumpNum = F_CheckLumpNumForName(name); if(absoluteLumpNum >= 0) { @@ -1645,7 +1645,7 @@ boolean DD_Init(void) } } - if(ArgCheck("-dumpwaddir")) + if(CommandLine_Check("-dumpwaddir")) { F_PrintLumpDirectory(); } @@ -1656,14 +1656,14 @@ boolean DD_Init(void) Con_ParseCommands("autoexec.cfg"); // Read additional config files that should be processed post engine init. - if(ArgCheckWith("-parse", 1)) + if(CommandLine_CheckWith("-parse", 1)) { uint startTime; Con_Message("Parsing additional (pre-init) config files:\n"); startTime = Sys_GetRealTime(); for(;;) { - const char* arg = ArgNext(); + const char* arg = CommandLine_Next(); if(!arg || arg[0] == '-') break; Con_Message(" Processing \"%s\"...\n", F_PrettyPath(arg)); @@ -1674,14 +1674,14 @@ boolean DD_Init(void) // A console command on the command line? { int p; - for(p = 1; p < Argc() - 1; p++) + for(p = 1; p < CommandLine_Count() - 1; p++) { - if(stricmp(Argv(p), "-command") && stricmp(Argv(p), "-cmd")) + if(stricmp(CommandLine_At(p), "-command") && stricmp(CommandLine_At(p), "-cmd")) continue; - for(++p; p < Argc(); p++) + for(++p; p < CommandLine_Count(); p++) { - const char* arg = Argv(p); + const char* arg = CommandLine_At(p); if(arg[0] == '-') { @@ -1699,16 +1699,16 @@ boolean DD_Init(void) if(DD_GameLoaded()) { // Client connection command. - if(ArgCheckWith("-connect", 1)) - Con_Executef(CMDS_CMDLINE, false, "connect %s", ArgNext()); + if(CommandLine_CheckWith("-connect", 1)) + Con_Executef(CMDS_CMDLINE, false, "connect %s", CommandLine_Next()); // Incoming TCP port. - if(ArgCheckWith("-port", 1)) - Con_Executef(CMDS_CMDLINE, false, "net-ip-port %s", ArgNext()); + if(CommandLine_CheckWith("-port", 1)) + Con_Executef(CMDS_CMDLINE, false, "net-ip-port %s", CommandLine_Next()); // Server start command. // (shortcut for -command "net init tcpip; net server start"). - if(ArgExists("-server")) + if(CommandLine_Exists("-server")) { if(!N_InitService(true)) Con_Message("Can't start server: network init failed.\n"); @@ -1742,7 +1742,7 @@ boolean DD_Init(void) // We'll open the console and print a list of the known games too. Con_Execute(CMDS_DDAY, "conopen", true, false); - if(!ArgExists("-noautoselect")) + if(!CommandLine_Exists("-noautoselect")) Con_Message("Automatic game selection failed.\n"); Con_Execute(CMDS_DDAY, "listgames", false, false); } @@ -1778,7 +1778,7 @@ static int DD_StartupWorker(void* parm) Con_SetProgress(20); // Was the change to userdir OK? - if(ArgCheckWith("-userdir", 1) && !app.usingUserDir) + if(CommandLine_CheckWith("-userdir", 1) && !app.usingUserDir) Con_Message("--(!)-- User directory not found (check -userdir).\n"); bamsInit(); // Binary angle calculations. @@ -1792,14 +1792,14 @@ static int DD_StartupWorker(void* parm) Sys_HideMouse(); // Read config files that should be read BEFORE engine init. - if(ArgCheckWith("-cparse", 1)) + if(CommandLine_CheckWith("-cparse", 1)) { uint startTime; Con_Message("Parsing additional (pre-init) config files:\n"); startTime = Sys_GetRealTime(); for(;;) { - const char* arg = ArgNext(); + const char* arg = CommandLine_Next(); if(!arg || arg[0] == '-') break; Con_Message(" Processing \"%s\"...\n", F_PrettyPath(arg)); @@ -1896,12 +1896,12 @@ void DD_CheckTimeDemo(void) if(!checked) { checked = true; - if(ArgCheckWith("-timedemo", 1) || // Timedemo mode. - ArgCheckWith("-playdemo", 1)) // Play-once mode. + if(CommandLine_CheckWith("-timedemo", 1) || // Timedemo mode. + CommandLine_CheckWith("-playdemo", 1)) // Play-once mode. { char buf[200]; - sprintf(buf, "playdemo %s", ArgNext()); + sprintf(buf, "playdemo %s", CommandLine_Next()); Con_Execute(CMDS_CMDLINE, buf, false, false); } } diff --git a/doomsday/engine/portable/src/dd_pinit.c b/doomsday/engine/portable/src/dd_pinit.c index 909997a50e..ab15667ae7 100644 --- a/doomsday/engine/portable/src/dd_pinit.c +++ b/doomsday/engine/portable/src/dd_pinit.c @@ -73,8 +73,8 @@ game_export_t __gx; int DD_CheckArg(char* tag, const char** value) { - int i = ArgCheck(tag); - const char* next = ArgNext(); + int i = CommandLine_Check(tag); + const char* next = CommandLine_Next(); if(!i) return 0; @@ -132,33 +132,29 @@ void DD_InitAPI(void) void DD_InitCommandLine(void) { -#if 0 - ArgInit(cmdLine); -#endif - // Register some abbreviations for command line options. - ArgAbbreviate("-game", "-g"); - ArgAbbreviate("-defs", "-d"); - ArgAbbreviate("-width", "-w"); - ArgAbbreviate("-height", "-h"); - ArgAbbreviate("-winsize", "-wh"); - ArgAbbreviate("-bpp", "-b"); - ArgAbbreviate("-window", "-wnd"); - ArgAbbreviate("-nocenter", "-noc"); - ArgAbbreviate("-file", "-f"); - ArgAbbreviate("-config", "-cfg"); - ArgAbbreviate("-parse", "-p"); - ArgAbbreviate("-cparse", "-cp"); - ArgAbbreviate("-command", "-cmd"); - ArgAbbreviate("-fontdir", "-fd"); - ArgAbbreviate("-modeldir", "-md"); - ArgAbbreviate("-basedir", "-bd"); - ArgAbbreviate("-stdbasedir", "-sbd"); - ArgAbbreviate("-userdir", "-ud"); - ArgAbbreviate("-texdir", "-td"); - ArgAbbreviate("-texdir2", "-td2"); - ArgAbbreviate("-anifilter", "-ani"); - ArgAbbreviate("-verbose", "-v"); + CommandLine_Alias("-game", "-g"); + CommandLine_Alias("-defs", "-d"); + CommandLine_Alias("-width", "-w"); + CommandLine_Alias("-height", "-h"); + CommandLine_Alias("-winsize", "-wh"); + CommandLine_Alias("-bpp", "-b"); + CommandLine_Alias("-window", "-wnd"); + CommandLine_Alias("-nocenter", "-noc"); + CommandLine_Alias("-file", "-f"); + CommandLine_Alias("-config", "-cfg"); + CommandLine_Alias("-parse", "-p"); + CommandLine_Alias("-cparse", "-cp"); + CommandLine_Alias("-command", "-cmd"); + CommandLine_Alias("-fontdir", "-fd"); + CommandLine_Alias("-modeldir", "-md"); + CommandLine_Alias("-basedir", "-bd"); + CommandLine_Alias("-stdbasedir", "-sbd"); + CommandLine_Alias("-userdir", "-ud"); + CommandLine_Alias("-texdir", "-td"); + CommandLine_Alias("-texdir2", "-td2"); + CommandLine_Alias("-anifilter", "-ani"); + CommandLine_Alias("-verbose", "-v"); } /** @@ -195,9 +191,9 @@ void DD_ConsoleInit(void) if(verbose) { int p; - Con_Message("Command line (%i strings):\n", Argc()); - for(p = 0; p < Argc(); ++p) - Con_Message(" %i: %s\n", p, Argv(p)); + Con_Message("Command line (%i strings):\n", CommandLine_Count()); + for(p = 0; p < CommandLine_Count(); ++p) + Con_Message(" %i: %s\n", p, CommandLine_At(p)); } } diff --git a/doomsday/engine/portable/src/dd_zone.c b/doomsday/engine/portable/src/dd_zone.c index 8fcbac6b06..f0b4f4d393 100644 --- a/doomsday/engine/portable/src/dd_zone.c +++ b/doomsday/engine/portable/src/dd_zone.c @@ -1265,7 +1265,7 @@ void Z_DebugDrawer(void) memvolume_t* volume; int i, volCount, h; - if(!ArgExists("-zonedebug")) return; + if(!CommandLine_Exists("-zonedebug")) return; LIBDENG_ASSERT_IN_MAIN_THREAD(); LIBDENG_ASSERT_GL_CONTEXT_ACTIVE(); diff --git a/doomsday/engine/portable/src/def_main.c b/doomsday/engine/portable/src/def_main.c index 7ab341e5a1..0d17151c78 100644 --- a/doomsday/engine/portable/src/def_main.c +++ b/doomsday/engine/portable/src/def_main.c @@ -855,7 +855,7 @@ static void readAllDefinitions(void) } // Next up are definition files in the /auto directory. - if(!ArgExists("-noauto")) + if(!CommandLine_Exists("-noauto")) { ddstring_t pattern; Str_Init(&pattern); @@ -866,14 +866,14 @@ static void readAllDefinitions(void) // Any definition files on the command line? Str_Init(&buf); - for(p = 0; p < Argc(); ++p) + for(p = 0; p < CommandLine_Count(); ++p) { - const char* arg = Argv(p); - if(!ArgRecognize("-def", arg) && !ArgRecognize("-defs", arg)) continue; + const char* arg = CommandLine_At(p); + if(!CommandLine_IsMatchingAlias("-def", arg) && !CommandLine_IsMatchingAlias("-defs", arg)) continue; - while(++p != Argc() && !ArgIsOption(p)) + while(++p != CommandLine_Count() && !CommandLine_IsOption(p)) { - const char* searchPath = Argv(p); + const char* searchPath = CommandLine_At(p); Con_Message(" Processing '%s'...\n", F_PrettyPath(searchPath)); diff --git a/doomsday/engine/portable/src/def_read.c b/doomsday/engine/portable/src/def_read.c index c6752d3591..a0fe52536b 100644 --- a/doomsday/engine/portable/src/def_read.c +++ b/doomsday/engine/portable/src/def_read.c @@ -693,7 +693,7 @@ static boolean DED_CheckCondition(const char* cond, boolean expected) if(cond[0] == '-') { // A command line option. - value = (ArgCheck(token) != 0); + value = (CommandLine_Check(token) != 0); } else if(isalnum(cond[0])) { // A game mode. diff --git a/doomsday/engine/portable/src/fs_main.c b/doomsday/engine/portable/src/fs_main.c index 5b265d3c6d..4e3189232f 100644 --- a/doomsday/engine/portable/src/fs_main.c +++ b/doomsday/engine/portable/src/fs_main.c @@ -2268,7 +2268,7 @@ void F_AddVirtualDirectoryMapping(const char* source, const char* destination) void F_InitVirtualDirectoryMappings(void) { - int i, argC = Argc(); + int i, argC = CommandLine_Count(); clearVDMappings(); @@ -2277,12 +2277,12 @@ void F_InitVirtualDirectoryMappings(void) // Create virtual directory mappings by processing all -vdmap options. for(i = 0; i < argC; ++i) { - if(strnicmp("-vdmap", Argv(i), 6)) + if(strnicmp("-vdmap", CommandLine_At(i), 6)) continue; // This is not the option we're looking for. - if(i < argC - 1 && !ArgIsOption(i + 1) && !ArgIsOption(i + 2)) + if(i < argC - 1 && !CommandLine_IsOption(i + 1) && !CommandLine_IsOption(i + 2)) { - F_AddVirtualDirectoryMapping(Argv(i + 1), Argv(i + 2)); + F_AddVirtualDirectoryMapping(CommandLine_At(i + 1), CommandLine_At(i + 2)); i += 2; } } diff --git a/doomsday/engine/portable/src/gl_main.c b/doomsday/engine/portable/src/gl_main.c index 575c3f0de8..ff83b71f5e 100644 --- a/doomsday/engine/portable/src/gl_main.c +++ b/doomsday/engine/portable/src/gl_main.c @@ -368,7 +368,7 @@ boolean GL_EarlyInit(void) Con_Message("Initializing Render subsystem...\n"); - gamma_support = !ArgCheck("-noramp"); + gamma_support = !CommandLine_Check("-noramp"); // We are simple people; two texture units is enough. numTexUnits = MIN_OF(GL_state.maxTexUnits, MAX_TEX_UNITS); @@ -387,22 +387,22 @@ boolean GL_EarlyInit(void) ratioLimit = 8; } // Set a custom maximum size? - if(ArgCheckWith("-maxtex", 1)) + if(CommandLine_CheckWith("-maxtex", 1)) { - int customSize = M_CeilPow2(strtol(ArgNext(), 0, 0)); + int customSize = M_CeilPow2(strtol(CommandLine_Next(), 0, 0)); if(GL_state.maxTexSize < customSize) customSize = GL_state.maxTexSize; GL_state.maxTexSize = customSize; Con_Message("Using maximum texture size of %i x %i.\n", GL_state.maxTexSize, GL_state.maxTexSize); } - if(ArgCheck("-outlines")) + if(CommandLine_Check("-outlines")) { fillOutlines = false; Con_Message("Textures have outlines.\n"); } - renderTextures = !ArgExists("-notex"); + renderTextures = !CommandLine_Exists("-notex"); VERBOSE( printConfiguration() ); @@ -495,7 +495,7 @@ void GL_Shutdown(void) /* // Restore original gamma. - if(!ArgExists("-leaveramp")) + if(!CommandLine_Exists("-leaveramp")) { GL_SetGammaRamp(original_gamma_ramp); } diff --git a/doomsday/engine/portable/src/gl_texmanager.c b/doomsday/engine/portable/src/gl_texmanager.c index c4a45d2ba8..e40b603143 100644 --- a/doomsday/engine/portable/src/gl_texmanager.c +++ b/doomsday/engine/portable/src/gl_texmanager.c @@ -1134,11 +1134,11 @@ void GL_InitTextureManager(void) } // Disable the use of 'high resolution' textures and/or patches? - noHighResTex = ArgExists("-nohightex"); - noHighResPatches = ArgExists("-nohighpat"); + noHighResTex = CommandLine_Exists("-nohightex"); + noHighResPatches = CommandLine_Exists("-nohighpat"); // Should we allow using external resources with PWAD textures? - highResWithPWAD = ArgExists("-pwadtex"); + highResWithPWAD = CommandLine_Exists("-pwadtex"); // System textures loaded in GL_LoadSystemTextures. memset(sysFlareTextures, 0, sizeof(sysFlareTextures)); diff --git a/doomsday/engine/portable/src/library.c b/doomsday/engine/portable/src/library.c index f866a92dd2..5f937eea4b 100644 --- a/doomsday/engine/portable/src/library.c +++ b/doomsday/engine/portable/src/library.c @@ -62,15 +62,15 @@ static Library* loadedLibs[MAX_LIBRARIES]; #ifdef UNIX static void getBundlePath(char* path, size_t len) { - if(ArgCheckWith("-libdir", 1)) + if(CommandLine_CheckWith("-libdir", 1)) { - strncpy(path, ArgNext(), len); + strncpy(path, CommandLine_Next(), len); return; } - if(ArgCheckWith("-appdir", 1)) + if(CommandLine_CheckWith("-appdir", 1)) { - dd_snprintf(path, len, "%s/%s", appDir, ArgNext()); + dd_snprintf(path, len, "%s/%s", appDir, CommandLine_Next()); return; } diff --git a/doomsday/engine/portable/src/net_demo.c b/doomsday/engine/portable/src/net_demo.c index 8d501def0d..a2736b7e9b 100644 --- a/doomsday/engine/portable/src/net_demo.c +++ b/doomsday/engine/portable/src/net_demo.c @@ -393,7 +393,7 @@ void Demo_StopPlayback(void) */ // "Play demo once" mode? - if(ArgCheck("-playdemo")) + if(CommandLine_Check("-playdemo")) Sys_Quit(); } diff --git a/doomsday/engine/portable/src/net_main.c b/doomsday/engine/portable/src/net_main.c index 67cef1d7e5..c4ed91135d 100644 --- a/doomsday/engine/portable/src/net_main.c +++ b/doomsday/engine/portable/src/net_main.c @@ -527,7 +527,7 @@ void Net_InitGame(void) clients[0].lastTransmit = -1; // Are we timing a demo here? - if(ArgCheck("-timedemo")) + if(CommandLine_Check("-timedemo")) netTicSync = false; } diff --git a/doomsday/engine/portable/src/r_model.c b/doomsday/engine/portable/src/r_model.c index 2225c07aeb..2c6e3ee6eb 100644 --- a/doomsday/engine/portable/src/r_model.c +++ b/doomsday/engine/portable/src/r_model.c @@ -136,7 +136,7 @@ static void R_VertexNormals(model_t *mdl) dmd_triangle_t *tri; // Renormalizing? - if(!ArgCheck("-renorm")) + if(!CommandLine_Check("-renorm")) return; normals = Z_Malloc(sizeof(vector_t) * tris, PU_APPSTATIC, 0); @@ -1201,7 +1201,7 @@ void R_InitModels(void) uint usedTime; // Dedicated servers do nothing with models. - if(isDedicated || ArgCheck("-nomd2")) + if(isDedicated || CommandLine_Check("-nomd2")) return; modelRepository = StringPool_New(); diff --git a/doomsday/engine/portable/src/s_main.c b/doomsday/engine/portable/src/s_main.c index 0faccc6b8c..2d01ba9b12 100644 --- a/doomsday/engine/portable/src/s_main.c +++ b/doomsday/engine/portable/src/s_main.c @@ -112,7 +112,7 @@ boolean S_Init(void) { boolean ok = false, sfxOK, musOK; - if(ArgExists("-nosound") || ArgExists("-noaudio")) + if(CommandLine_Exists("-nosound") || CommandLine_Exists("-noaudio")) return true; // Try to load the audio driver plugin(s). @@ -123,7 +123,7 @@ boolean S_Init(void) } // Disable random pitch changes? - noRndPitch = ArgExists("-norndpitch"); + noRndPitch = CommandLine_Exists("-norndpitch"); sfxOK = Sfx_Init(); musOK = Mus_Init(); diff --git a/doomsday/engine/portable/src/s_mus.c b/doomsday/engine/portable/src/s_mus.c index 9dcbf726ce..7b8b39f21a 100644 --- a/doomsday/engine/portable/src/s_mus.c +++ b/doomsday/engine/portable/src/s_mus.c @@ -111,7 +111,7 @@ boolean Mus_Init(void) if(musAvail) return true; // Already initialized. - if(isDedicated || ArgExists("-nomusic")) + if(isDedicated || CommandLine_Exists("-nomusic")) { Con_Message("Music disabled.\n"); return true; diff --git a/doomsday/engine/portable/src/s_sfx.c b/doomsday/engine/portable/src/s_sfx.c index 8a4fd9b32a..09bbd4e1c0 100644 --- a/doomsday/engine/portable/src/s_sfx.c +++ b/doomsday/engine/portable/src/s_sfx.c @@ -1026,9 +1026,9 @@ void Sfx_InitChannels(void) numChannels = sfxMaxChannels; // The -sfxchan option can be used to change the number of channels. - if(ArgCheckWith("-sfxchan", 1)) + if(CommandLine_CheckWith("-sfxchan", 1)) { - numChannels = strtol(ArgNext(), 0, 0); + numChannels = strtol(CommandLine_Next(), 0, 0); if(numChannels < 1) numChannels = 1; if(numChannels > SFX_MAX_CHANNELS) @@ -1097,7 +1097,7 @@ boolean Sfx_Init(void) return true; // Already initialized. // Check if sound has been disabled with a command line option. - if(ArgExists("-nosfx")) + if(CommandLine_Exists("-nosfx")) { Con_Message("Sound Effects disabled.\n"); return true; diff --git a/doomsday/engine/portable/src/sys_input.c b/doomsday/engine/portable/src/sys_input.c index 55860b11a6..4ed0891bbf 100644 --- a/doomsday/engine/portable/src/sys_input.c +++ b/doomsday/engine/portable/src/sys_input.c @@ -128,7 +128,7 @@ void I_PollEvents(void) static void Mouse_Init(void) { - if(ArgCheck("-nomouse") || novideo) + if(CommandLine_Check("-nomouse") || novideo) return; assert(iMouse); diff --git a/doomsday/engine/portable/src/sys_opengl.c b/doomsday/engine/portable/src/sys_opengl.c index c3d12f325f..86e71af5c0 100644 --- a/doomsday/engine/portable/src/sys_opengl.c +++ b/doomsday/engine/portable/src/sys_opengl.c @@ -115,18 +115,18 @@ static void initialize(void) GL_state.features.elementArrays = false; #endif } - if(ArgExists("-vtxar") && !ArgExists("-novtxar")) + if(CommandLine_Exists("-vtxar") && !CommandLine_Exists("-novtxar")) GL_state.features.elementArrays = true; if(0 != (GL_state.extensions.texFilterAniso = query("GL_EXT_texture_filter_anisotropic"))) { glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint*) &GL_state.maxTexFilterAniso); } - if(ArgExists("-noanifilter")) + if(CommandLine_Exists("-noanifilter")) GL_state.features.texFilterAniso = false; GL_state.extensions.texNonPowTwo = query("GL_ARB_texture_non_power_of_two"); - if(!GL_state.extensions.texNonPowTwo || ArgExists("-notexnonpow2") || ArgExists("-notexnonpowtwo")) + if(!GL_state.extensions.texNonPowTwo || CommandLine_Exists("-notexnonpow2") || CommandLine_Exists("-notexnonpowtwo")) GL_state.features.texNonPowTwo = false; if(0 != (GL_state.extensions.blendSub = query("GL_EXT_blend_subtract"))) @@ -164,7 +164,7 @@ static void initialize(void) #else GL_state.features.texCompression = false; #endif - if(ArgExists("-notexcomp")) + if(CommandLine_Exists("-notexcomp")) GL_state.features.texCompression = false; #ifdef WIN32 @@ -177,7 +177,7 @@ static void initialize(void) // Automatic mipmap generation. GL_state.extensions.genMipmapSGIS = query("GL_SGIS_generate_mipmap"); - if(0 == GL_state.extensions.genMipmapSGIS || ArgExists("-nosgm")) + if(0 == GL_state.extensions.genMipmapSGIS || CommandLine_Exists("-nosgm")) GL_state.features.genMipmap = false; #ifdef WIN32 @@ -424,7 +424,7 @@ boolean Sys_GLPreInit(void) memset(&GL_state.extensions, 0, sizeof(GL_state.extensions)); // Init assuming ideal configuration. - GL_state.forceFinishBeforeSwap = ArgExists("-glfinish"); + GL_state.forceFinishBeforeSwap = CommandLine_Exists("-glfinish"); GL_state.maxTexFilterAniso = 4; GL_state.maxTexSize = 4096; GL_state.maxTexUnits = 1; @@ -478,7 +478,7 @@ boolean Sys_GLInitialize(void) } else if(version < 1.4) { - if(!ArgExists("-noglcheck")) + if(!CommandLine_Exists("-noglcheck")) { Sys_CriticalMessagef("OpenGL implementation is too old!\n" " Driver version: %s\n" diff --git a/doomsday/engine/portable/src/sys_reslocator.c b/doomsday/engine/portable/src/sys_reslocator.c index 65cc5aafb2..e5a4ed54e0 100644 --- a/doomsday/engine/portable/src/sys_reslocator.c +++ b/doomsday/engine/portable/src/sys_reslocator.c @@ -597,7 +597,7 @@ static void createPackagesResourceNamespace(void) #endif // Is the DOOMWADPATH environment variable in use? - if(!ArgCheck("-nodoomwadpath") && getenv("DOOMWADPATH")) + if(!CommandLine_Check("-nodoomwadpath") && getenv("DOOMWADPATH")) { #if WIN32 # define PATH_DELIMITER_CHAR ';' @@ -656,7 +656,7 @@ static void createPackagesResourceNamespace(void) } // Is the DOOMWADDIR environment variable in use? - if(!doomWadDir && !ArgCheck("-nodoomwaddir") && getenv("DOOMWADDIR")) + if(!doomWadDir && !CommandLine_Check("-nodoomwaddir") && getenv("DOOMWADDIR")) { doomWadDir = Str_New(); Str_Set(doomWadDir, getenv("DOOMWADDIR")); Str_Strip(doomWadDir); @@ -791,9 +791,9 @@ void F_CreateNamespacesForFileResourcePaths(void) ResourceNamespace_AddSearchPath(rnamespace, def->searchPathFlags, uri, SPG_DEFAULT); } - if(def->optOverridePath && ArgCheckWith(def->optOverridePath, 1)) + if(def->optOverridePath && CommandLine_CheckWith(def->optOverridePath, 1)) { - const char* path = ArgNext(); + const char* path = CommandLine_Next(); ddstring_t path2; // Override paths are added in reverse order. @@ -808,9 +808,9 @@ void F_CreateNamespacesForFileResourcePaths(void) Str_Free(&path2); } - if(def->optFallbackPath && ArgCheckWith(def->optFallbackPath, 1)) + if(def->optFallbackPath && CommandLine_CheckWith(def->optFallbackPath, 1)) { - Uri_SetUri3(uri, ArgNext(), RC_NULL); + Uri_SetUri3(uri, CommandLine_Next(), RC_NULL); ResourceNamespace_AddSearchPath(rnamespace, def->searchPathFlags, uri, SPG_FALLBACK); } }} diff --git a/doomsday/engine/portable/src/ui_main.c b/doomsday/engine/portable/src/ui_main.c index c3df013e26..27efdd02b7 100644 --- a/doomsday/engine/portable/src/ui_main.c +++ b/doomsday/engine/portable/src/ui_main.c @@ -166,7 +166,7 @@ void UI_PageInit(boolean halttime, boolean tckui, boolean tckframe, boolean drwg uiFontHgt = FR_SingleLineHeight("UI"); // Should the mouse cursor be visible? - uiShowMouse = !ArgExists("-nomouse"); + uiShowMouse = !CommandLine_Exists("-nomouse"); // Allow use of the escape key to exit the ui? allowEscape = !noescape; diff --git a/doomsday/engine/portable/src/window.cpp b/doomsday/engine/portable/src/window.cpp index 1614a83643..ae3b4636f8 100644 --- a/doomsday/engine/portable/src/window.cpp +++ b/doomsday/engine/portable/src/window.cpp @@ -111,65 +111,65 @@ struct ddwindow_s */ void modifyAccordingToOptions() { - if(ArgCheckWith("-width", 1)) + if(CommandLine_CheckWith("-width", 1)) { - geometry.size.width = qMax(WINDOW_MIN_WIDTH, atoi(ArgNext())); + geometry.size.width = qMax(WINDOW_MIN_WIDTH, atoi(CommandLine_Next())); } - if(ArgCheckWith("-height", 1)) + if(CommandLine_CheckWith("-height", 1)) { - geometry.size.height = qMax(WINDOW_MIN_HEIGHT, atoi(ArgNext())); + geometry.size.height = qMax(WINDOW_MIN_HEIGHT, atoi(CommandLine_Next())); } - if(ArgCheckWith("-winsize", 2)) + if(CommandLine_CheckWith("-winsize", 2)) { - geometry.size.width = qMax(WINDOW_MIN_WIDTH, atoi(ArgNext())); - geometry.size.height = qMax(WINDOW_MIN_HEIGHT, atoi(ArgNext())); + geometry.size.width = qMax(WINDOW_MIN_WIDTH, atoi(CommandLine_Next())); + geometry.size.height = qMax(WINDOW_MIN_HEIGHT, atoi(CommandLine_Next())); } - if(ArgCheckWith("-colordepth", 1) || ArgCheckWith("-bpp", 1)) + if(CommandLine_CheckWith("-colordepth", 1) || CommandLine_CheckWith("-bpp", 1)) { - colorDepthBits = qBound(8, atoi(ArgNext()), 32); + colorDepthBits = qBound(8, atoi(CommandLine_Next()), 32); } - if(ArgCheck("-nocenter")) + if(CommandLine_Check("-nocenter")) { setFlag(DDWF_CENTER, false); } - if(ArgCheckWith("-xpos", 1)) + if(CommandLine_CheckWith("-xpos", 1)) { - geometry.origin.x = atoi(ArgNext()); + geometry.origin.x = atoi(CommandLine_Next()); setFlag(DDWF_CENTER | DDWF_MAXIMIZE, false); } - if(ArgCheckWith("-ypos", 1)) + if(CommandLine_CheckWith("-ypos", 1)) { - geometry.origin.y = atoi(ArgNext()); + geometry.origin.y = atoi(CommandLine_Next()); setFlag(DDWF_CENTER | DDWF_MAXIMIZE, false); } - if(ArgCheck("-center")) + if(CommandLine_Check("-center")) { setFlag(DDWF_CENTER); } - if(ArgCheck("-maximize")) + if(CommandLine_Check("-maximize")) { setFlag(DDWF_MAXIMIZE); } - if(ArgCheck("-nomaximize")) + if(CommandLine_Check("-nomaximize")) { setFlag(DDWF_MAXIMIZE, false); } - if(ArgExists("-nofullscreen") || ArgExists("-window")) + if(CommandLine_Exists("-nofullscreen") || CommandLine_Exists("-window")) { setFlag(DDWF_FULLSCREEN, false); } - if(ArgExists("-fullscreen") || ArgExists("-nowindow")) + if(CommandLine_Exists("-fullscreen") || CommandLine_Exists("-nowindow")) { setFlag(DDWF_FULLSCREEN); } diff --git a/doomsday/engine/unix/src/dd_uinit.c b/doomsday/engine/unix/src/dd_uinit.c index d92d188546..8b84e813d6 100644 --- a/doomsday/engine/unix/src/dd_uinit.c +++ b/doomsday/engine/unix/src/dd_uinit.c @@ -262,12 +262,12 @@ static void determineGlobalPaths(application_t* app) #endif // The -userdir option sets the working directory. - if(ArgCheckWith("-userdir", 1)) + if(CommandLine_CheckWith("-userdir", 1)) { filename_t runtimePath; directory_t* temp; - strncpy(runtimePath, ArgNext(), FILENAME_T_MAXLEN); + strncpy(runtimePath, CommandLine_Next(), FILENAME_T_MAXLEN); Dir_CleanPath(runtimePath, FILENAME_T_MAXLEN); // Ensure the path is closed with a directory separator. F_AppendMissingSlashCString(runtimePath, FILENAME_T_MAXLEN); @@ -301,9 +301,9 @@ static void determineGlobalPaths(application_t* app) * determined according to the the build configuration. * Usually this is something like "/usr/share/deng/". */ - if(ArgCheckWith("-basedir", 1)) + if(CommandLine_CheckWith("-basedir", 1)) { - strncpy(ddBasePath, ArgNext(), FILENAME_T_MAXLEN); + strncpy(ddBasePath, CommandLine_Next(), FILENAME_T_MAXLEN); } else { @@ -384,8 +384,8 @@ boolean DD_Unix_Init(int argc, char** argv) DD_InitCommandLine(); // First order of business: are we running in dedicated mode? - isDedicated = ArgCheck("-dedicated"); - novideo = ArgCheck("-novideo") || isDedicated; + isDedicated = CommandLine_Check("-dedicated"); + novideo = CommandLine_Check("-novideo") || isDedicated; Library_Init(); diff --git a/doomsday/engine/unix/src/joystick.c b/doomsday/engine/unix/src/joystick.c index 8f11341737..2c14e60fc4 100644 --- a/doomsday/engine/unix/src/joystick.c +++ b/doomsday/engine/unix/src/joystick.c @@ -60,7 +60,7 @@ static void initialize(void) { int joycount; - if(isDedicated || ArgCheck("-nojoy")) + if(isDedicated || CommandLine_Check("-nojoy")) return; #ifdef SOLARIS diff --git a/doomsday/engine/unix/src/sys_console.c b/doomsday/engine/unix/src/sys_console.c index 6c02eee0b7..712a80de74 100644 --- a/doomsday/engine/unix/src/sys_console.c +++ b/doomsday/engine/unix/src/sys_console.c @@ -259,7 +259,7 @@ static void Sys_ConInputInit(void) Window* Sys_ConInit(const char* title) { - if(!ArgExists("-daemon")) + if(!CommandLine_Exists("-daemon")) { int maxPos[2]; diff --git a/doomsday/engine/win32/src/dd_winit.c b/doomsday/engine/win32/src/dd_winit.c index d6b6c3d4f8..d4a426b59f 100644 --- a/doomsday/engine/win32/src/dd_winit.c +++ b/doomsday/engine/win32/src/dd_winit.c @@ -365,12 +365,12 @@ static void determineGlobalPaths(application_t* app) #endif // The -userdir option sets the working directory. - if(ArgCheckWith("-userdir", 1)) + if(CommandLine_CheckWith("-userdir", 1)) { filename_t runtimePath; directory_t* temp; - strncpy(runtimePath, ArgNext(), FILENAME_T_MAXLEN); + strncpy(runtimePath, CommandLine_Next(), FILENAME_T_MAXLEN); Dir_CleanPath(runtimePath, FILENAME_T_MAXLEN); // Ensure the path is closed with a directory separator. F_AppendMissingSlashCString(runtimePath, FILENAME_T_MAXLEN); @@ -393,9 +393,9 @@ static void determineGlobalPaths(application_t* app) Dir_Delete(temp); } - if(ArgCheckWith("-basedir", 1)) + if(CommandLine_CheckWith("-basedir", 1)) { - strncpy(ddBasePath, ArgNext(), FILENAME_T_MAXLEN); + strncpy(ddBasePath, CommandLine_Next(), FILENAME_T_MAXLEN); } else { @@ -440,8 +440,8 @@ boolean DD_Win32_Init(void) DD_InitCommandLine(/*UTF_STRING(GetCommandLine())*/); // First order of business: are we running in dedicated mode? - isDedicated = ArgCheck("-dedicated"); - novideo = ArgCheck("-novideo") || isDedicated; + isDedicated = CommandLine_Check("-dedicated"); + novideo = CommandLine_Check("-novideo") || isDedicated; Library_Init(); @@ -475,7 +475,7 @@ boolean DD_Win32_Init(void) } // No Windows system keys? - if(ArgCheck("-nowsk")) + if(CommandLine_Check("-nowsk")) { // Disable Alt-Tab, Alt-Esc, Ctrl-Alt-Del. A bit of a hack... SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, 0, 0); diff --git a/doomsday/engine/win32/src/joystick_win32.cpp b/doomsday/engine/win32/src/joystick_win32.cpp index ffed2ca266..e861d3f19e 100644 --- a/doomsday/engine/win32/src/joystick_win32.cpp +++ b/doomsday/engine/win32/src/joystick_win32.cpp @@ -72,7 +72,7 @@ boolean Joystick_Init(void) "X", "Y", "Z", "RX", "RY", "RZ", "Slider 1", "Slider 2" }; - if(isDedicated || ArgCheck("-nojoy")) return false; + if(isDedicated || CommandLine_Check("-nojoy")) return false; HWND hWnd = (HWND) Window_NativeHandle(Window_Main()); if(!hWnd) diff --git a/doomsday/engine/win32/src/mouse_win32.cpp b/doomsday/engine/win32/src/mouse_win32.cpp index 8781f126df..2b8a4b08a1 100644 --- a/doomsday/engine/win32/src/mouse_win32.cpp +++ b/doomsday/engine/win32/src/mouse_win32.cpp @@ -34,7 +34,7 @@ static DIMOUSESTATE2 mstate; ///< Polled state. static int Mouse_Win32_Init(void) { - if(ArgCheck("-nomouse") || novideo) return false; + if(CommandLine_Check("-nomouse") || novideo) return false; // We'll need a window handle for this. HWND hWnd = (HWND) Window_NativeHandle(Window_Main()); diff --git a/doomsday/libdeng2/include/de/c_wrapper.h b/doomsday/libdeng2/include/de/c_wrapper.h index 66b8d90487..903df65038 100644 --- a/doomsday/libdeng2/include/de/c_wrapper.h +++ b/doomsday/libdeng2/include/de/c_wrapper.h @@ -75,15 +75,15 @@ DENG2_PUBLIC void LegacyCore_SetTerminateFunc(LegacyCore* lc, void (*func)(const /* * CommandLine */ -DENG2_PUBLIC void ArgAbbreviate(const char* longname, const char* shortname); -DENG2_PUBLIC int Argc(void); -DENG2_PUBLIC const char* Argv(int i); -DENG2_PUBLIC const char* ArgNext(void); -DENG2_PUBLIC int ArgCheck(const char* check); -DENG2_PUBLIC int ArgCheckWith(const char* check, int num); -DENG2_PUBLIC int ArgExists(const char* check); -DENG2_PUBLIC int ArgIsOption(int i); -DENG2_PUBLIC int ArgRecognize(const char* first, const char* second); +DENG2_PUBLIC void CommandLine_Alias(const char* longname, const char* shortname); +DENG2_PUBLIC int CommandLine_Count(void); +DENG2_PUBLIC const char* CommandLine_At(int i); +DENG2_PUBLIC const char* CommandLine_Next(void); +DENG2_PUBLIC int CommandLine_Check(const char* check); +DENG2_PUBLIC int CommandLine_CheckWith(const char* check, int num); +DENG2_PUBLIC int CommandLine_Exists(const char* check); +DENG2_PUBLIC int CommandLine_IsOption(int i); +DENG2_PUBLIC int CommandLine_IsMatchingAlias(const char* original, const char* originalOrAlias); /* * LogBuffer diff --git a/doomsday/libdeng2/include/de/core/commandline.h b/doomsday/libdeng2/include/de/core/commandline.h index 52d94f6b4f..f40f8af489 100644 --- a/doomsday/libdeng2/include/de/core/commandline.h +++ b/doomsday/libdeng2/include/de/core/commandline.h @@ -105,7 +105,8 @@ namespace de /** * Gets the parameter for an argument. * - * @param arg Argument to look for. Don't use aliases here. + * @param arg Argument to look for. Don't use aliases here. Defines + * aliases will be checked for matches. * @param param The parameter is returned here, if found. * * @return @c true, if parameter was successfully returned. diff --git a/doomsday/libdeng2/src/c_wrapper.cpp b/doomsday/libdeng2/src/c_wrapper.cpp index 42a051eab1..124e150ff0 100644 --- a/doomsday/libdeng2/src/c_wrapper.cpp +++ b/doomsday/libdeng2/src/c_wrapper.cpp @@ -154,17 +154,17 @@ void LegacyCore_SetTerminateFunc(LegacyCore* lc, void (*func)(const char*)) self->setTerminateFunc(func); } -void ArgAbbreviate(const char* longname, const char* shortname) +void CommandLine_Alias(const char* longname, const char* shortname) { DENG2_COMMANDLINE().alias(longname, shortname); } -int Argc(void) +int CommandLine_Count(void) { return DENG2_COMMANDLINE().count(); } -const char* Argv(int i) +const char* CommandLine_At(int i) { DENG2_ASSERT(i >= 0); DENG2_ASSERT(i < DENG2_COMMANDLINE().count()); @@ -173,39 +173,39 @@ const char* Argv(int i) static int argLastMatch = 0; // used only in ArgCheck/ArgNext (not thread-safe) -const char* ArgNext(void) +const char* CommandLine_Next(void) { - if(!argLastMatch || argLastMatch >= Argc() - 1) + if(!argLastMatch || argLastMatch >= CommandLine_Count() - 1) { // No more arguments following the last match. return 0; } - return Argv(++argLastMatch); + return CommandLine_At(++argLastMatch); } -int ArgCheck(const char* check) +int CommandLine_Check(const char* check) { return argLastMatch = DENG2_COMMANDLINE().check(check); } -int ArgCheckWith(const char* check, int num) +int CommandLine_CheckWith(const char* check, int num) { return argLastMatch = DENG2_COMMANDLINE().check(check, num); } -int ArgExists(const char* check) +int CommandLine_Exists(const char* check) { return DENG2_COMMANDLINE().has(check); } -int ArgIsOption(int i) +int CommandLine_IsOption(int i) { return DENG2_COMMANDLINE().isOption(i); } -int ArgRecognize(const char* first, const char* second) +int CommandLine_IsMatchingAlias(const char* original, const char* originalOrAlias) { - return DENG2_COMMANDLINE().matches(first, second); + return DENG2_COMMANDLINE().matches(original, originalOrAlias); } void LogBuffer_Flush(void) diff --git a/doomsday/plugins/common/include/m_argv.h b/doomsday/plugins/common/include/m_argv.h index 56a5a92450..86f606d6ca 100644 --- a/doomsday/plugins/common/include/m_argv.h +++ b/doomsday/plugins/common/include/m_argv.h @@ -28,7 +28,7 @@ #ifndef __M_ARGV__ #define __M_ARGV__ -#define myargc Argc() +#define myargc CommandLine_Count() #define M_CheckParm gi.CheckParm diff --git a/doomsday/plugins/common/src/g_game.c b/doomsday/plugins/common/src/g_game.c index 3b87252983..8ab8386499 100644 --- a/doomsday/plugins/common/src/g_game.c +++ b/doomsday/plugins/common/src/g_game.c @@ -487,7 +487,7 @@ void G_CommonPreInit(void) int i, j; quitInProgress = false; - verbose = ArgExists("-verbose"); + verbose = CommandLine_Exists("-verbose"); // Register hooks. Plug_AddHook(HOOK_DEMO_STOP, Hook_DemoStop); @@ -2558,7 +2558,7 @@ void G_DoNewGame(void) { deathmatch = false; respawnMonsters = false; - noMonstersParm = ArgExists("-nomonsters")? true : false; + noMonstersParm = CommandLine_Exists("-nomonsters")? true : false; } G_InitNew(dSkill, dEpisode, dMap); #else diff --git a/doomsday/plugins/common/src/p_mapsetup.c b/doomsday/plugins/common/src/p_mapsetup.c index 5fdcd11d2a..7cab7cfe5a 100644 --- a/doomsday/plugins/common/src/p_mapsetup.c +++ b/doomsday/plugins/common/src/p_mapsetup.c @@ -944,10 +944,10 @@ static void P_ResetWorldState(void) timerGame = 0; if(deathmatch) { - parm = ArgCheck("-timer"); - if(parm && parm < Argc() - 1) + parm = CommandLine_Check("-timer"); + if(parm && parm < CommandLine_Count() - 1) { - timerGame = atoi(Argv(parm + 1)) * 35 * 60; + timerGame = atoi(CommandLine_At(parm + 1)) * 35 * 60; } } diff --git a/doomsday/plugins/common/src/p_saveio.c b/doomsday/plugins/common/src/p_saveio.c index cf378d5275..81054e44c4 100644 --- a/doomsday/plugins/common/src/p_saveio.c +++ b/doomsday/plugins/common/src/p_saveio.c @@ -113,9 +113,9 @@ const char* SV_ClientSavePath(void) static ddstring_t* composeSaveDir(void) { ddstring_t* dir = Str_New(); - if(ArgCheckWith("-savedir", 1)) + if(CommandLine_CheckWith("-savedir", 1)) { - Str_Set(dir, ArgNext()); + Str_Set(dir, CommandLine_Next()); // Add a trailing backslash is necessary. if(Str_RAt(dir, 0) != '/') Str_AppendChar(dir, '/'); diff --git a/doomsday/plugins/dehread/src/dehmain.c b/doomsday/plugins/dehread/src/dehmain.c index a1845ac109..b1207bbcab 100644 --- a/doomsday/plugins/dehread/src/dehmain.c +++ b/doomsday/plugins/dehread/src/dehmain.c @@ -2446,7 +2446,7 @@ int DefsHook(int hook_type, int parm, void* data) { int i; - verbose = ArgExists("-verbose"); + verbose = CommandLine_Exists("-verbose"); ded = (ded_t*) data; // Check for a DEHACKED lumps. @@ -2456,19 +2456,19 @@ int DefsHook(int hook_type, int parm, void* data) { ReadDehackedLump(i); // We'll only continue this if the -alldehs option is given. - if(!ArgCheck("-alldehs")) break; + if(!CommandLine_Check("-alldehs")) break; } } // How about the -deh option? - if(ArgCheckWith("-deh", 1)) + if(CommandLine_CheckWith("-deh", 1)) { ddstring_t buf; const char* fn; // Aha! At least one DEH specified. Let's read all of 'em. Str_Init(&buf); - while(NULL != (fn = ArgNext()) && '-' != fn[0]) + while(NULL != (fn = CommandLine_Next()) && '-' != fn[0]) { Str_Set(&buf, fn); Str_Strip(&buf); diff --git a/doomsday/plugins/directsound/src/driver_directsound.cpp b/doomsday/plugins/directsound/src/driver_directsound.cpp index a2e4d7e6f4..f089d95534 100644 --- a/doomsday/plugins/directsound/src/driver_directsound.cpp +++ b/doomsday/plugins/directsound/src/driver_directsound.cpp @@ -217,14 +217,14 @@ int DS_Init(void) return true; // Already initialized? // Are we in verbose mode? - verbose = ArgExists("-verbose"); + verbose = CommandLine_Exists("-verbose"); if(verbose) Con_Message("dsDirectSound::DS_Init: Initializing Direct Sound...\n"); // Can we set the Primary Sound Format? - canSetPSF = !ArgExists("-nopsf"); - useEAX = !ArgExists("-noeax"); + canSetPSF = !CommandLine_Exists("-nopsf"); + useEAX = !CommandLine_Exists("-noeax"); if(!(hWnd = (HWND) DD_GetVariable(DD_WINDOW_HANDLE))) { @@ -359,7 +359,7 @@ int DS_Init(void) memset(failedProps, ~0, sizeof(failedProps)); propertySet = NULL; - if(ArgExists("-eaxignore")) + if(CommandLine_Exists("-eaxignore")) ignoreEAXErrors = true; // Configure the temporary buffer. diff --git a/doomsday/plugins/jdoom/src/d_main.c b/doomsday/plugins/jdoom/src/d_main.c index 0ceb7ef8ee..a7d7bc32c2 100644 --- a/doomsday/plugins/jdoom/src/d_main.c +++ b/doomsday/plugins/jdoom/src/d_main.c @@ -470,20 +470,20 @@ void D_PostInit(void) autoStart = false; // Command line options. - noMonstersParm = ArgCheck("-nomonsters")? true : false; - respawnParm = ArgCheck("-respawn")? true : false; - fastParm = ArgCheck("-fast")? true : false; - devParm = ArgCheck("-devparm")? true : false; + noMonstersParm = CommandLine_Check("-nomonsters")? true : false; + respawnParm = CommandLine_Check("-respawn")? true : false; + fastParm = CommandLine_Check("-fast")? true : false; + devParm = CommandLine_Check("-devparm")? true : false; - if(ArgCheck("-altdeath")) + if(CommandLine_Check("-altdeath")) cfg.netDeathmatch = 2; - else if(ArgCheck("-deathmatch")) + else if(CommandLine_Check("-deathmatch")) cfg.netDeathmatch = 1; - p = ArgCheck("-timer"); + p = CommandLine_Check("-timer"); if(p && p < myargc - 1 && deathmatch) { - int time = atoi(Argv(p + 1)); + int time = atoi(CommandLine_At(p + 1)); Con_Message("Maps will end after %d minute", time); if(time > 1) Con_Message("s"); @@ -491,7 +491,7 @@ void D_PostInit(void) } // Turbo option. - p = ArgCheck("-turbo"); + p = CommandLine_Check("-turbo"); turboMul = 1.0f; if(p) { @@ -499,7 +499,7 @@ void D_PostInit(void) turboParm = true; if(p < myargc - 1) - scale = atoi(Argv(p + 1)); + scale = atoi(CommandLine_At(p + 1)); if(scale < 10) scale = 10; if(scale > 400) @@ -510,10 +510,10 @@ void D_PostInit(void) } // Load a saved game? - p = ArgCheck("-loadgame"); + p = CommandLine_Check("-loadgame"); if(p && p < myargc - 1) { - const int saveSlot = Argv(p + 1)[0] - '0'; + const int saveSlot = CommandLine_At(p + 1)[0] - '0'; if(G_LoadGame(saveSlot)) { // No further initialization is to be done. @@ -521,33 +521,33 @@ void D_PostInit(void) } } - p = ArgCheck("-skill"); + p = CommandLine_Check("-skill"); if(p && p < myargc - 1) { - startSkill = Argv(p + 1)[0] - '1'; + startSkill = CommandLine_At(p + 1)[0] - '1'; autoStart = true; } - p = ArgCheck("-episode"); + p = CommandLine_Check("-episode"); if(p && p < myargc - 1) { - startEpisode = Argv(p + 1)[0] - '1'; + startEpisode = CommandLine_At(p + 1)[0] - '1'; startMap = 0; autoStart = true; } - p = ArgCheck("-warp"); + p = CommandLine_Check("-warp"); if(p && p < myargc - 1) { if(gameModeBits & (GM_ANY_DOOM2|GM_DOOM_CHEX)) { - startMap = atoi(Argv(p + 1)) - 1; + startMap = atoi(CommandLine_At(p + 1)) - 1; autoStart = true; } else if(p < myargc - 2) { - startEpisode = Argv(p + 1)[0] - '1'; - startMap = Argv(p + 2)[0] - '1'; + startEpisode = CommandLine_At(p + 1)[0] - '1'; + startMap = CommandLine_At(p + 2)[0] - '1'; autoStart = true; } } diff --git a/doomsday/plugins/jdoom64/src/d_main.c b/doomsday/plugins/jdoom64/src/d_main.c index cc0cee4fc4..507e2ac4ec 100644 --- a/doomsday/plugins/jdoom64/src/d_main.c +++ b/doomsday/plugins/jdoom64/src/d_main.c @@ -382,20 +382,20 @@ void D_PostInit(void) // None. // Command line options - noMonstersParm = ArgCheck("-nomonsters"); - respawnParm = ArgCheck("-respawn"); - fastParm = ArgCheck("-fast"); - devParm = ArgCheck("-devparm"); + noMonstersParm = CommandLine_Check("-nomonsters"); + respawnParm = CommandLine_Check("-respawn"); + fastParm = CommandLine_Check("-fast"); + devParm = CommandLine_Check("-devparm"); - if(ArgCheck("-altdeath")) + if(CommandLine_Check("-altdeath")) cfg.netDeathmatch = 2; - else if(ArgCheck("-deathmatch")) + else if(CommandLine_Check("-deathmatch")) cfg.netDeathmatch = 1; - p = ArgCheck("-timer"); + p = CommandLine_Check("-timer"); if(p && p < myargc - 1 && deathmatch) { - int time = atoi(Argv(p + 1)); + int time = atoi(CommandLine_At(p + 1)); Con_Message("Levels will end after %d minute", time); if(time > 1) Con_Message("s"); @@ -403,7 +403,7 @@ void D_PostInit(void) } // Turbo option. - p = ArgCheck("-turbo"); + p = CommandLine_Check("-turbo"); turboMul = 1.0f; if(p) { @@ -411,7 +411,7 @@ void D_PostInit(void) turboParm = true; if(p < myargc - 1) - scale = atoi(Argv(p + 1)); + scale = atoi(CommandLine_At(p + 1)); if(scale < 10) scale = 10; if(scale > 400) @@ -422,10 +422,10 @@ void D_PostInit(void) } // Load a saved game? - p = ArgCheck("-loadgame"); + p = CommandLine_Check("-loadgame"); if(p && p < myargc - 1) { - const int saveSlot = Argv(p + 1)[0] - '0'; + const int saveSlot = CommandLine_At(p + 1)[0] - '0'; if(G_LoadGame(saveSlot)) { // No further initialization is to be done. @@ -433,17 +433,17 @@ void D_PostInit(void) } } - p = ArgCheck("-skill"); + p = CommandLine_Check("-skill"); if(p && p < myargc - 1) { - startSkill = Argv(p + 1)[0] - '1'; + startSkill = CommandLine_At(p + 1)[0] - '1'; autoStart = true; } - p = ArgCheck("-warp"); + p = CommandLine_Check("-warp"); if(p && p < myargc - 1) { - startMap = atoi(Argv(p + 1)) - '1'; + startMap = atoi(CommandLine_At(p + 1)) - '1'; autoStart = true; } diff --git a/doomsday/plugins/jheretic/src/h_main.c b/doomsday/plugins/jheretic/src/h_main.c index 2203364368..6c8249bd04 100644 --- a/doomsday/plugins/jheretic/src/h_main.c +++ b/doomsday/plugins/jheretic/src/h_main.c @@ -405,17 +405,17 @@ void H_PostInit(void) /* None */ // Command line options. - noMonstersParm = ArgCheck("-nomonsters"); - respawnParm = ArgCheck("-respawn"); - devParm = ArgCheck("-devparm"); + noMonstersParm = CommandLine_Check("-nomonsters"); + respawnParm = CommandLine_Check("-respawn"); + devParm = CommandLine_Check("-devparm"); - if(ArgCheck("-deathmatch")) + if(CommandLine_Check("-deathmatch")) { cfg.netDeathmatch = true; } // turbo option. - p = ArgCheck("-turbo"); + p = CommandLine_Check("-turbo"); turboMul = 1.0f; if(p) { @@ -423,7 +423,7 @@ void H_PostInit(void) turboParm = true; if(p < myargc - 1) - scale = atoi(Argv(p + 1)); + scale = atoi(CommandLine_At(p + 1)); if(scale < 10) scale = 10; if(scale > 400) @@ -434,10 +434,10 @@ void H_PostInit(void) } // Load a saved game? - p = ArgCheck("-loadgame"); + p = CommandLine_Check("-loadgame"); if(p && p < myargc - 1) { - const int saveSlot = Argv(p + 1)[0] - '0'; + const int saveSlot = CommandLine_At(p + 1)[0] - '0'; if(G_LoadGame(saveSlot)) { // No further initialization is to be done. @@ -445,26 +445,26 @@ void H_PostInit(void) } } - p = ArgCheck("-skill"); + p = CommandLine_Check("-skill"); if(p && p < myargc - 1) { - startSkill = Argv(p + 1)[0] - '1'; + startSkill = CommandLine_At(p + 1)[0] - '1'; autoStart = true; } - p = ArgCheck("-episode"); + p = CommandLine_Check("-episode"); if(p && p < myargc - 1) { - startEpisode = Argv(p + 1)[0] - '1'; + startEpisode = CommandLine_At(p + 1)[0] - '1'; startMap = 0; autoStart = true; } - p = ArgCheck("-warp"); + p = CommandLine_Check("-warp"); if(p && p < myargc - 2) { - startEpisode = Argv(p + 1)[0] - '1'; - startMap = Argv(p + 2)[0] - '1'; + startEpisode = CommandLine_At(p + 1)[0] - '1'; + startMap = CommandLine_At(p + 2)[0] - '1'; autoStart = true; } diff --git a/doomsday/plugins/jhexen/src/h2_main.c b/doomsday/plugins/jhexen/src/h2_main.c index 5e8fbc37ff..beabc1aae7 100644 --- a/doomsday/plugins/jhexen/src/h2_main.c +++ b/doomsday/plugins/jhexen/src/h2_main.c @@ -368,23 +368,23 @@ void X_PostInit(void) /* None */ // Command line options. - noMonstersParm = ArgExists("-nomonsters"); - respawnParm = ArgExists("-respawn"); - randomClassParm = ArgExists("-randclass"); - devParm = ArgExists("-devparm"); + noMonstersParm = CommandLine_Exists("-nomonsters"); + respawnParm = CommandLine_Exists("-respawn"); + randomClassParm = CommandLine_Exists("-randclass"); + devParm = CommandLine_Exists("-devparm"); - cfg.netDeathmatch = ArgExists("-deathmatch"); + cfg.netDeathmatch = CommandLine_Exists("-deathmatch"); // Turbo movement option. - p = ArgCheck("-turbo"); + p = CommandLine_Check("-turbo"); turboMul = 1.0f; if(p) { int scale = 200; turboParm = true; - if(p < Argc() - 1) - scale = atoi(Argv(p + 1)); + if(p < CommandLine_Count() - 1) + scale = atoi(CommandLine_At(p + 1)); if(scale < 10) scale = 10; if(scale > 400) @@ -394,10 +394,10 @@ void X_PostInit(void) turboMul = scale / 100.f; } - if((p = ArgCheckWith("-scripts", 1)) != 0) + if((p = CommandLine_CheckWith("-scripts", 1)) != 0) { sc_FileScripts = true; - sc_ScriptsDir = Argv(p + 1); + sc_ScriptsDir = CommandLine_At(p + 1); } P_InitMapMusicInfo(); // Init music fields in mapinfo. @@ -409,25 +409,25 @@ void X_PostInit(void) SN_InitSequenceScript(); // Load a saved game? - p = ArgCheckWith("-loadgame", 1); + p = CommandLine_CheckWith("-loadgame", 1); if(p != 0) { - if(G_LoadGame(atoi(Argv(p + 1)))) + if(G_LoadGame(atoi(CommandLine_At(p + 1)))) { // No further initialization is to be done. return; } } - if((p = ArgCheckWith("-skill", 1)) != 0) + if((p = CommandLine_CheckWith("-skill", 1)) != 0) { - startSkill = (skillmode_t)(Argv(p + 1)[0] - '1'); + startSkill = (skillmode_t)(CommandLine_At(p + 1)[0] - '1'); autoStart = true; } - if((p = ArgCheck("-class")) != 0) + if((p = CommandLine_Check("-class")) != 0) { - playerclass_t pClass = (playerclass_t)atoi(Argv(p + 1)); + playerclass_t pClass = (playerclass_t)atoi(CommandLine_At(p + 1)); if(!VALID_PLAYER_CLASS(pClass)) { Con_Message("Warning: Invalid player class id=%d specified with -class, ignoring.\n", (int)pClass); @@ -450,10 +450,10 @@ void X_PostInit(void) } // Check for command line warping. - p = ArgCheck("-warp"); - if(p && p < Argc() - 1) + p = CommandLine_Check("-warp"); + if(p && p < CommandLine_Count() - 1) { - warpMap = atoi(Argv(p + 1)) - 1; + warpMap = atoi(CommandLine_At(p + 1)) - 1; startMap = P_TranslateMap(warpMap); autoStart = true; } diff --git a/doomsday/plugins/wadmapconverter/src/wadmapconverter.c b/doomsday/plugins/wadmapconverter/src/wadmapconverter.c index bcfb5c5de5..0b865c1090 100644 --- a/doomsday/plugins/wadmapconverter/src/wadmapconverter.c +++ b/doomsday/plugins/wadmapconverter/src/wadmapconverter.c @@ -54,7 +54,7 @@ int ConvertMapHook(int hookType, int param, void *data) { lumpnum_t* lumpList = (int*) data; - DENG_PLUGIN_GLOBAL(verbose) = ArgExists("-verbose"); + DENG_PLUGIN_GLOBAL(verbose) = CommandLine_Exists("-verbose"); memset(DENG_PLUGIN_GLOBAL(map), 0, sizeof(*DENG_PLUGIN_GLOBAL(map))); diff --git a/doomsday/plugins/winmm/src/dswinmm.cpp b/doomsday/plugins/winmm/src/dswinmm.cpp index a160638fce..dd52d7436b 100644 --- a/doomsday/plugins/winmm/src/dswinmm.cpp +++ b/doomsday/plugins/winmm/src/dswinmm.cpp @@ -222,7 +222,7 @@ static int initMixer(void) MIXERCAPS mixerCaps; int num = mixerGetNumDevs(); // Number of mixer devices. - if(initMixerOk || ArgCheck("-nomixer")) + if(initMixerOk || CommandLine_Check("-nomixer")) return true; if(verbose) @@ -284,7 +284,7 @@ static void shutdownMixer(void) int DS_Init(void) { // Are we in verbose mode? - verbose = ArgExists("-verbose"); + verbose = CommandLine_Exists("-verbose"); initMixer(); @@ -333,7 +333,7 @@ int DM_Music_Init(void) return false; // Double output volume? - MIDIStreamer->volumeShift = ArgExists("-mdvol") ? 1 : 0; + MIDIStreamer->volumeShift = CommandLine_Exists("-mdvol") ? 1 : 0; // Now the MIDI is available. Con_Message("DM_WinMusInit: MIDI initialized.\n");