]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Rename COM_CheckParm to Sys_CheckParm and move it to sys_shared.c
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 8 Sep 2020 13:19:25 +0000 (13:19 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 8 Sep 2020 13:19:25 +0000 (13:19 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12912 d7cf8633-e32d-0410-b094-e92efae38249

29 files changed:
cd_shared.c
cl_demo.c
cl_main.c
cl_parse.c
cl_screen.c
cl_video.c
cl_video_libavw.c
cmd.c
com_game.c
common.c
common.h
console.c
fs.c
host.c
keys.c
menu.c
netconn.c
palette.c
prvm_edict.c
snd_main.c
snd_ogg.c
snd_xmp.c
sys.h
sys_sdl.c
sys_shared.c
sys_unix.c
sys_win.c
vid_sdl.c
vid_shared.c

index 3eee8510b7884ff247eef2f5e533abde2084f283..8c4566c454d98927d191baef8701621e2fcc1cd2 100644 (file)
@@ -549,7 +549,7 @@ int CDAudio_Init (void)
                return -1;
 
 // COMMANDLINEOPTION: Sound: -nocdaudio disables CD audio support
-       if (COM_CheckParm("-nocdaudio"))
+       if (Sys_CheckParm("-nocdaudio"))
                return -1;
 
 #ifdef MAXTRACKS
@@ -577,7 +577,7 @@ int CDAudio_Init (void)
 
 int CDAudio_Startup (void)
 {
-       if (COM_CheckParm("-nocdaudio"))
+       if (Sys_CheckParm("-nocdaudio"))
                return -1;
 
        initialized = true;
index 31a1f470b2a9898915a85c998e211ccbd11ce761..bc8fd7e9214bb0e9a4a51590f23eb9ae09bbe106 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -97,7 +97,7 @@ void CL_StopPlayback (void)
                CL_FinishTimeDemo ();
 
        if (!cls.demostarting) // only quit if not starting another demo
-               if (COM_CheckParm("-demo") || COM_CheckParm("-capturedemo"))
+               if (Sys_CheckParm("-demo") || Sys_CheckParm("-capturedemo"))
                        Host_Quit_f(&cmd_client);
 
 }
@@ -510,10 +510,10 @@ static void CL_FinishTimeDemo (void)
        // LadyHavoc: timedemo now prints out 7 digits of fraction, and min/avg/max
        Con_Printf("%i frames %5.7f seconds %5.7f fps, one-second fps min/avg/max: %.0f %.0f %.0f (%i seconds)\n", frames, time, totalfpsavg, fpsmin, fpsavg, fpsmax, cls.td_onesecondavgcount);
        Log_Printf("benchmark.log", "date %s | enginedate %s | demo %s | commandline %s | run %d | result %i frames %5.7f seconds %5.7f fps, one-second fps min/avg/max: %.0f %.0f %.0f (%i seconds)\n", Sys_TimeString("%Y-%m-%d %H:%M:%S"), buildstring, cls.demoname, cmdline.string, benchmark_runs + 1, frames, time, totalfpsavg, fpsmin, fpsavg, fpsmax, cls.td_onesecondavgcount);
-       if (COM_CheckParm("-benchmark"))
+       if (Sys_CheckParm("-benchmark"))
        {
                ++benchmark_runs;
-               i = COM_CheckParm("-benchmarkruns");
+               i = Sys_CheckParm("-benchmarkruns");
                if(i && i + 1 < sys.argc)
                {
                        static benchmarkhistory_t *history = NULL;
@@ -536,7 +536,7 @@ static void CL_FinishTimeDemo (void)
                        else
                        {
                                // print statistics
-                               int first = COM_CheckParm("-benchmarkruns_skipfirst") ? 1 : 0;
+                               int first = Sys_CheckParm("-benchmarkruns_skipfirst") ? 1 : 0;
                                if(benchmark_runs > first)
                                {
 #define DO_MIN(f) \
@@ -637,7 +637,7 @@ static void CL_Startdemos_f(cmd_state_t *cmd)
 {
        int             i, c;
 
-       if (cls.state == ca_dedicated || COM_CheckParm("-listen") || COM_CheckParm("-benchmark") || COM_CheckParm("-demo") || COM_CheckParm("-capturedemo"))
+       if (cls.state == ca_dedicated || Sys_CheckParm("-listen") || Sys_CheckParm("-benchmark") || Sys_CheckParm("-demo") || Sys_CheckParm("-capturedemo"))
                return;
 
        c = Cmd_Argc(cmd) - 1;
index de454ffe22369a9ab33d10d30ea1f41724665793..73fb69861d9e76cf193cfa97d3b7a348ebb8a62f 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -355,7 +355,7 @@ void CL_Disconnect(void)
        if (cls.state == ca_dedicated)
                return;
 
-       if (COM_CheckParm("-profilegameonly"))
+       if (Sys_CheckParm("-profilegameonly"))
                Sys_AllowProfiling(false);
 
        Curl_Clear_forthismap();
@@ -521,7 +521,7 @@ void CL_EstablishConnection(const char *address, int firstarg)
                return;
 
        // don't connect to a server if we're benchmarking a demo
-       if (COM_CheckParm("-benchmark"))
+       if (Sys_CheckParm("-benchmark"))
                return;
 
        // clear menu's connect error message
index 45a2b9899c7b5664f77a577c27c653edfd563184..bc79dd0f12ddf80a678078e771134de4de093563 100644 (file)
@@ -1657,7 +1657,7 @@ static void CL_SignonReply (void)
                S_PurgeUnused();
 
                Con_ClearNotify();
-               if (COM_CheckParm("-profilegameonly"))
+               if (Sys_CheckParm("-profilegameonly"))
                        Sys_AllowProfiling(true);
                break;
        }
index 67a9609d328aa7cb09f64ab4051233eb4969a516..8238ff6240f6e59f0b504351870bbe0922f0452c 100644 (file)
@@ -1368,7 +1368,7 @@ void CL_Screen_Init(void)
        Cvar_RegisterVariable(&r_speeds_graph_maxdefault);
 
        // if we want no console, turn it off here too
-       if (COM_CheckParm ("-noconsole"))
+       if (Sys_CheckParm ("-noconsole"))
                Cvar_SetQuick(&scr_conforcewhiledisconnected, "0");
 
        Cmd_AddCommand(CMD_CLIENT, "sizeup",SCR_SizeUp_f, "increase view size (increases viewsize cvar)");
index e9d5e21b59faa381e0597ce64c7533a7780172de..db97d1cd3ab69cc1255d589470a3eb724ef84dcc 100644 (file)
@@ -617,7 +617,7 @@ static void CL_PlayVideo_f(cmd_state_t *cmd)
 
        Host_StartVideo();
 
-       if (COM_CheckParm("-benchmark"))
+       if (Sys_CheckParm("-benchmark"))
                return;
 
        if (Cmd_Argc(cmd) < 2)
index abdc2e2cd46623b24bea02bc17fb86508bab598d..c36622134a905b8725bfa90584ff7f2203611461 100644 (file)
@@ -360,7 +360,7 @@ qboolean LibAvW_OpenLibrary(void)
        int errorcode;
 
        // COMMANDLINEOPTION: Video: -nolibavw disables libavcodec wrapper support
-       if (COM_CheckParm("-nolibavw"))
+       if (Sys_CheckParm("-nolibavw"))
                return false;
 
        // load DLL's
diff --git a/cmd.c b/cmd.c
index a62d05a8f1a12f808677b33a6eda9e17eae312e7..bc0f465d4e28947b06e9c188f270fafbdc5dd786 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -576,7 +576,7 @@ static void Cmd_Exec(cmd_state_t *cmd, const char *filename)
        if (!strcmp(filename, "config.cfg"))
        {
                filename = CONFIGFILENAME;
-               if (COM_CheckParm("-noconfig"))
+               if (Sys_CheckParm("-noconfig"))
                        return; // don't execute config.cfg
        }
 
index a40f5c401353e6227d642c69c9c612bac708672c..29446b9cf6384a1ae1209317806a4ccc7ff216c9 100644 (file)
@@ -109,7 +109,7 @@ void COM_InitGameType (void)
 
        // check commandline options for keywords
        for (i = 0;i < (int)(sizeof (gamemode_info) / sizeof (gamemode_info[0]));i++)
-               if (COM_CheckParm (gamemode_info[i].cmdline))
+               if (Sys_CheckParm (gamemode_info[i].cmdline))
                        index = i;
 
        com_startupgamemode = gamemode_info[index].mode;
@@ -164,17 +164,17 @@ static void COM_SetGameType(int index)
 
        if (gamemode == com_startupgamemode)
        {
-               if((t = COM_CheckParm("-customgamename")) && t + 1 < sys.argc)
+               if((t = Sys_CheckParm("-customgamename")) && t + 1 < sys.argc)
                        gamename = gamenetworkfiltername = sys.argv[t+1];
-               if((t = COM_CheckParm("-customgamenetworkfiltername")) && t + 1 < sys.argc)
+               if((t = Sys_CheckParm("-customgamenetworkfiltername")) && t + 1 < sys.argc)
                        gamenetworkfiltername = sys.argv[t+1];
-               if((t = COM_CheckParm("-customgamedirname1")) && t + 1 < sys.argc)
+               if((t = Sys_CheckParm("-customgamedirname1")) && t + 1 < sys.argc)
                        gamedirname1 = sys.argv[t+1];
-               if((t = COM_CheckParm("-customgamedirname2")) && t + 1 < sys.argc)
+               if((t = Sys_CheckParm("-customgamedirname2")) && t + 1 < sys.argc)
                        gamedirname2 = *sys.argv[t+1] ? sys.argv[t+1] : NULL;
-               if((t = COM_CheckParm("-customgamescreenshotname")) && t + 1 < sys.argc)
+               if((t = Sys_CheckParm("-customgamescreenshotname")) && t + 1 < sys.argc)
                        gamescreenshotname = sys.argv[t+1];
-               if((t = COM_CheckParm("-customgameuserdirname")) && t + 1 < sys.argc)
+               if((t = Sys_CheckParm("-customgameuserdirname")) && t + 1 < sys.argc)
                        gameuserdirname = sys.argv[t+1];
        }
 
index 03b7087ef9016182582d45267bbab4abdb3b7471..7271384055629971b660ffbca44ca1ea8f25bf3f 100644 (file)
--- a/common.c
+++ b/common.c
@@ -860,30 +860,6 @@ skipwhite:
        return true;
 }
 
-
-/*
-================
-COM_CheckParm
-
-Returns the position (1 to argc-1) in the program's argument list
-where the given parameter apears, or 0 if not present
-================
-*/
-int COM_CheckParm (const char *parm)
-{
-       int i;
-
-       for (i=1 ; i<sys.argc ; i++)
-       {
-               if (!sys.argv[i])
-                       continue;               // NEXTSTEP sometimes clears appkit vars.
-               if (!strcmp (parm,sys.argv[i]))
-                       return i;
-       }
-
-       return 0;
-}
-
 /*
 ===============
 Com_CalcRoll
index b92ca9aa1c36cb19d3aa9ab9b84b3934c68c1cc6..9d73bc548681b248465ccaf2928624305d5ce781 100644 (file)
--- a/common.h
+++ b/common.h
@@ -205,7 +205,6 @@ int COM_ParseToken_QuakeC(const char **datapointer, qboolean returnnewline);
 int COM_ParseToken_VM_Tokenize(const char **datapointer, qboolean returnnewline);
 int COM_ParseToken_Console(const char **datapointer);
 
-int COM_CheckParm (const char *parm);
 void COM_Init (void);
 void COM_Shutdown (void);
 void COM_InitGameType (void);
index 7a523605bbf63aa063cf83975e40501681d0a2b6..44560dd64a2b35476b550ce08939ea76a6c5d9e8 100644 (file)
--- a/console.c
+++ b/console.c
@@ -686,7 +686,7 @@ Con_ToggleConsole_f
 */
 void Con_ToggleConsole_f(cmd_state_t *cmd)
 {
-       if (COM_CheckParm ("-noconsole"))
+       if (Sys_CheckParm ("-noconsole"))
                if (!(key_consoleactive & KEY_CONSOLEACTIVE_USER))
                        return; // only allow the key bind to turn off console
 
@@ -882,7 +882,7 @@ void Con_Init (void)
 
        // support for the classic Quake option
 // COMMANDLINEOPTION: Console: -condebug logs console messages to qconsole.log, see also log_file
-       if (COM_CheckParm ("-condebug") != 0)
+       if (Sys_CheckParm ("-condebug") != 0)
                Cvar_SetQuick (&log_file, "qconsole.log");
 
        // register our cvars
diff --git a/fs.c b/fs.c
index 3bedf6b042721c0c07c59838981e5c1c97901b97..18c79c184cda69945982b45b4c7f7973c45d8a96 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -928,7 +928,7 @@ static packfile_t* FS_AddFileToPack (const char* name, pack_t* pack,
 
 static void FS_mkdir (const char *path)
 {
-       if(COM_CheckParm("-readonly"))
+       if(Sys_CheckParm("-readonly"))
                return;
 
 #if WIN32
@@ -1474,11 +1474,11 @@ void FS_Rescan (void)
        else
                Cvar_SetQuick (&scr_screenshot_name, gamescreenshotname);
        
-       if((i = COM_CheckParm("-modname")) && i < sys.argc - 1)
+       if((i = Sys_CheckParm("-modname")) && i < sys.argc - 1)
                strlcpy(com_modname, sys.argv[i+1], sizeof(com_modname));
 
        // If "-condebug" is in the command line, remove the previous log file
-       if (COM_CheckParm ("-condebug") != 0)
+       if (Sys_CheckParm ("-condebug") != 0)
                unlink (va(vabuf, sizeof(vabuf), "%s/qconsole.log", fs_gamedir));
 
        // look for the pop.lmp file and set registered to true if it is found
@@ -1987,7 +1987,7 @@ static void FS_Init_Dir (void)
        // -basedir <path>
        // Overrides the system supplied base directory (under GAMENAME)
 // COMMANDLINEOPTION: Filesystem: -basedir <path> chooses what base directory the game data is in, inside this there should be a data directory for the game (for example id1)
-       i = COM_CheckParm ("-basedir");
+       i = Sys_CheckParm ("-basedir");
        if (i && i < sys.argc-1)
        {
                strlcpy (fs_basedir, sys.argv[i+1], sizeof (fs_basedir));
@@ -2041,9 +2041,9 @@ static void FS_Init_Dir (void)
                strlcat(fs_basedir, "/", sizeof(fs_basedir));
 
        // Add the personal game directory
-       if((i = COM_CheckParm("-userdir")) && i < sys.argc - 1)
+       if((i = Sys_CheckParm("-userdir")) && i < sys.argc - 1)
                dpsnprintf(fs_userdir, sizeof(fs_userdir), "%s/", sys.argv[i+1]);
-       else if (COM_CheckParm("-nohome"))
+       else if (Sys_CheckParm("-nohome"))
                *fs_userdir = 0; // user wants roaming installation, no userdir
        else
        {
@@ -2060,9 +2060,9 @@ static void FS_Init_Dir (void)
                        preferreduserdirmode = USERDIRMODE_NOHOME;
 # endif
                // check what limitations the user wants to impose
-               if (COM_CheckParm("-home")) preferreduserdirmode = USERDIRMODE_HOME;
-               if (COM_CheckParm("-mygames")) preferreduserdirmode = USERDIRMODE_MYGAMES;
-               if (COM_CheckParm("-savedgames")) preferreduserdirmode = USERDIRMODE_SAVEDGAMES;
+               if (Sys_CheckParm("-home")) preferreduserdirmode = USERDIRMODE_HOME;
+               if (Sys_CheckParm("-mygames")) preferreduserdirmode = USERDIRMODE_MYGAMES;
+               if (Sys_CheckParm("-savedgames")) preferreduserdirmode = USERDIRMODE_SAVEDGAMES;
                // gather the status of the possible userdirs
                for (dirmode = 0;dirmode < USERDIRMODE_COUNT;dirmode++)
                {
@@ -2148,7 +2148,7 @@ void FS_Init_SelfPack (void)
        char *buf;
 
        // Load darkplaces.opt from the FS.
-       if (!COM_CheckParm("-noopt"))
+       if (!Sys_CheckParm("-noopt"))
        {
                buf = (char *) FS_SysLoadFile("darkplaces.opt", tempmempool, true, NULL);
                if(buf)
@@ -2160,13 +2160,13 @@ void FS_Init_SelfPack (void)
 
 #ifndef USE_RWOPS
        // Provide the SelfPack.
-       if (!COM_CheckParm("-noselfpack") && sys.selffd >= 0)
+       if (!Sys_CheckParm("-noselfpack") && sys.selffd >= 0)
        {
                fs_selfpack = FS_LoadPackPK3FromFD(sys.argv[0], sys.selffd, true);
                if(fs_selfpack)
                {
                        FS_AddSelfPack();
-                       if (!COM_CheckParm("-noopt"))
+                       if (!Sys_CheckParm("-noopt"))
                        {
                                buf = (char *) FS_LoadFile("darkplaces.opt", tempmempool, true, NULL);
                                if(buf)
@@ -2275,7 +2275,7 @@ static filedesc_t FS_SysOpenFiledesc(const char *filepath, const char *mode, qbo
        if (nonblocking)
                opt |= O_NONBLOCK;
 
-       if(COM_CheckParm("-readonly") && mod != O_RDONLY)
+       if(Sys_CheckParm("-readonly") && mod != O_RDONLY)
                return FILEDESC_INVALID;
 
 #if USE_RWOPS
diff --git a/host.c b/host.c
index 793fd0eb747a2bef5c1ddcb488d8d2f6a85f56f3..55b0c5f3161c835c3a0697018609cf13bdc687bd 100644 (file)
--- a/host.c
+++ b/host.c
@@ -160,14 +160,14 @@ static void Host_ServerOptions (void)
 // COMMANDLINEOPTION: Server: -listen [playerlimit] starts a multiplayer server with graphical client, like singleplayer but other players can connect, default playerlimit is 8
        // if no client is in the executable or -dedicated is specified on
        // commandline, start a dedicated server
-       i = COM_CheckParm ("-dedicated");
+       i = Sys_CheckParm ("-dedicated");
        if (i || !cl_available)
        {
                cls.state = ca_dedicated;
                // check for -dedicated specifying how many players
                if (i && i + 1 < sys.argc && atoi (sys.argv[i+1]) >= 1)
                        svs.maxclients = atoi (sys.argv[i+1]);
-               if (COM_CheckParm ("-listen"))
+               if (Sys_CheckParm ("-listen"))
                        Con_Printf ("Only one of -dedicated or -listen can be specified\n");
                // default sv_public on for dedicated servers (often hosted by serious administrators), off for listen servers (often hosted by clueless users)
                Cvar_SetValue(&cvars_all, "sv_public", 1);
@@ -176,7 +176,7 @@ static void Host_ServerOptions (void)
        {
                // client exists and not dedicated, check if -listen is specified
                cls.state = ca_disconnected;
-               i = COM_CheckParm ("-listen");
+               i = Sys_CheckParm ("-listen");
                if (i)
                {
                        // default players unless specified
@@ -273,7 +273,7 @@ static void Host_SaveConfig_to(const char *file)
 // dedicated servers initialize the host but don't parse and set the
 // config.cfg cvars
        // LadyHavoc: don't save a config if it crashed in startup
-       if (host.framecount >= 3 && cls.state != ca_dedicated && !COM_CheckParm("-benchmark") && !COM_CheckParm("-capturedemo"))
+       if (host.framecount >= 3 && cls.state != ca_dedicated && !Sys_CheckParm("-benchmark") && !Sys_CheckParm("-capturedemo"))
        {
                f = FS_OpenRealFile(file, "wb", false);
                if (!f)
@@ -549,7 +549,7 @@ static void Host_InitSession(void)
        Cvar_RegisterVariable(&locksession);
 
        // load the session ID into the read-only cvar
-       if ((i = COM_CheckParm("-sessionid")) && (i + 1 < sys.argc))
+       if ((i = Sys_CheckParm("-sessionid")) && (i + 1 < sys.argc))
        {
                if(sys.argv[i+1][0] == '.')
                        Cvar_SetQuick(&sessionid, sys.argv[i+1]);
@@ -566,7 +566,7 @@ void Host_LockSession(void)
        if(locksession_run)
                return;
        locksession_run = true;
-       if(locksession.integer != 0 && !COM_CheckParm("-readonly"))
+       if(locksession.integer != 0 && !Sys_CheckParm("-readonly"))
        {
                char vabuf[1024];
                char *p = va(vabuf, sizeof(vabuf), "%slock%s", *fs_userdir ? fs_userdir : fs_basedir, sessionid.string);
@@ -616,11 +616,11 @@ static void Host_Init (void)
 
        host.state = host_init;
 
-       if (COM_CheckParm("-profilegameonly"))
+       if (Sys_CheckParm("-profilegameonly"))
                Sys_AllowProfiling(false);
 
        // LadyHavoc: quake never seeded the random number generator before... heh
-       if (COM_CheckParm("-benchmark"))
+       if (Sys_CheckParm("-benchmark"))
                srand(0); // predictable random sequence for -benchmark
        else
                srand((unsigned int)time(NULL));
@@ -629,13 +629,13 @@ static void Host_Init (void)
        // LadyHavoc: doesn't seem very temporary...
        // LadyHavoc: made this a saved cvar
 // COMMANDLINEOPTION: Console: -developer enables warnings and other notices (RECOMMENDED for mod developers)
-       if (COM_CheckParm("-developer"))
+       if (Sys_CheckParm("-developer"))
        {
                developer.value = developer.integer = 1;
                developer.string = "1";
        }
 
-       if (COM_CheckParm("-developer2") || COM_CheckParm("-developer3"))
+       if (Sys_CheckParm("-developer2") || Sys_CheckParm("-developer3"))
        {
                developer.value = developer.integer = 1;
                developer.string = "1";
@@ -649,14 +649,14 @@ static void Host_Init (void)
                developer_memorydebug.string = "1";
        }
 
-       if (COM_CheckParm("-developer3"))
+       if (Sys_CheckParm("-developer3"))
        {
                gl_paranoid.integer = 1;gl_paranoid.string = "1";
                gl_printcheckerror.integer = 1;gl_printcheckerror.string = "1";
        }
 
 // COMMANDLINEOPTION: Console: -nostdout disables text output to the terminal the game was launched from
-       if (COM_CheckParm("-nostdout"))
+       if (Sys_CheckParm("-nostdout"))
                sys_nostdout = 1;
 
        // initialize console command/cvar/alias/command execution systems
@@ -745,7 +745,7 @@ static void Host_Init (void)
 
        // check for special benchmark mode
 // COMMANDLINEOPTION: Client: -benchmark <demoname> runs a timedemo and quits, results of any timedemo can be found in gamedir/benchmark.log (for example id1/benchmark.log)
-       i = COM_CheckParm("-benchmark");
+       i = Sys_CheckParm("-benchmark");
        if (i && i + 1 < sys.argc)
        if (!sv.active && !cls.demoplayback && !cls.connect_trying)
        {
@@ -755,7 +755,7 @@ static void Host_Init (void)
 
        // check for special demo mode
 // COMMANDLINEOPTION: Client: -demo <demoname> runs a playdemo and quits
-       i = COM_CheckParm("-demo");
+       i = Sys_CheckParm("-demo");
        if (i && i + 1 < sys.argc)
        if (!sv.active && !cls.demoplayback && !cls.connect_trying)
        {
@@ -765,7 +765,7 @@ static void Host_Init (void)
 
 #ifdef CONFIG_VIDEO_CAPTURE
 // COMMANDLINEOPTION: Client: -capturedemo <demoname> captures a playdemo and quits
-       i = COM_CheckParm("-capturedemo");
+       i = Sys_CheckParm("-capturedemo");
        if (i && i + 1 < sys.argc)
        if (!sv.active && !cls.demoplayback && !cls.connect_trying)
        {
@@ -774,7 +774,7 @@ static void Host_Init (void)
        }
 #endif
 
-       if (cls.state == ca_dedicated || COM_CheckParm("-listen"))
+       if (cls.state == ca_dedicated || Sys_CheckParm("-listen"))
        if (!sv.active && !cls.demoplayback && !cls.connect_trying)
        {
                Cbuf_AddText(&cmd_client, "startmap_dm\n");
diff --git a/keys.c b/keys.c
index 5a67502ffe147595386a07cba05ff18563b3a804..cceec5199b6f60c3a2b6a85fc13687a6a6a0c2cd 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -1996,7 +1996,7 @@ Key_Event (int key, int ascii, qboolean down)
                        return;
                }
 
-               if (COM_CheckParm ("-noconsole"))
+               if (Sys_CheckParm ("-noconsole"))
                        return; // only allow the key bind to turn off console
 
                Key_Console (cmd, key, ascii);
diff --git a/menu.c b/menu.c
index 6308f480b6ea93675234288520fcd5d8539cc402..6c4830d032a2b6bd35b47296e3465c597489626c 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -5620,12 +5620,12 @@ void MR_Init(void)
 
        // use -forceqmenu to use always the normal quake menu (it sets forceqmenu to 1)
 // COMMANDLINEOPTION: Client: -forceqmenu disables menu.dat (same as +forceqmenu 1)
-       if(COM_CheckParm("-forceqmenu"))
+       if(Sys_CheckParm("-forceqmenu"))
                Cvar_SetValueQuick(&forceqmenu,1);
        // use -useqmenu for debugging proposes, cause it starts
        // the normal quake menu only the first time
 // COMMANDLINEOPTION: Client: -useqmenu causes the first time you open the menu to use the quake menu, then reverts to menu.dat (if forceqmenu is 0)
-       if(COM_CheckParm("-useqmenu"))
+       if(Sys_CheckParm("-useqmenu"))
                MR_SetRouting (true);
        else
                MR_SetRouting (false);
index 867c6162772807e3e2eb991fd742a81b60d6c6f0..b53877d7d7808b0aa50281a66d665f1ac2f3f8e9 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -3921,7 +3921,7 @@ void NetConn_Init(void)
        Cvar_RegisterVariable(&gameversion_min);
        Cvar_RegisterVariable(&gameversion_max);
 // COMMANDLINEOPTION: Server: -ip <ipaddress> sets the ip address of this machine for purposes of networking (default 0.0.0.0 also known as INADDR_ANY), use only if you have multiple network adapters and need to choose one specifically.
-       if ((i = COM_CheckParm("-ip")) && i + 1 < sys.argc)
+       if ((i = Sys_CheckParm("-ip")) && i + 1 < sys.argc)
        {
                if (LHNETADDRESS_FromString(&tempaddress, sys.argv[i + 1], 0) == 1)
                {
@@ -3932,7 +3932,7 @@ void NetConn_Init(void)
                        Con_Printf(CON_ERROR "-ip option used, but unable to parse the address \"%s\"\n", sys.argv[i + 1]);
        }
 // COMMANDLINEOPTION: Server: -port <portnumber> sets the port to use for a server (default 26000, the same port as QUAKE itself), useful if you host multiple servers on your machine
-       if (((i = COM_CheckParm("-port")) || (i = COM_CheckParm("-ipport")) || (i = COM_CheckParm("-udpport"))) && i + 1 < sys.argc)
+       if (((i = Sys_CheckParm("-port")) || (i = Sys_CheckParm("-ipport")) || (i = Sys_CheckParm("-udpport"))) && i + 1 < sys.argc)
        {
                i = atoi(sys.argv[i + 1]);
                if (i >= 0 && i < 65536)
index 5b8743423eb53201554ecd4d3e7141a6a560bca9..9e348b1922449384a089ea2cf1ca187974eaeb4a 100644 (file)
--- a/palette.c
+++ b/palette.c
@@ -281,15 +281,15 @@ static void Palette_Load(void)
        scale = 1;
        base = 0;
 // COMMANDLINEOPTION: Client: -texgamma <number> sets the quake palette gamma, allowing you to make quake textures brighter/darker, not recommended
-       i = COM_CheckParm("-texgamma");
+       i = Sys_CheckParm("-texgamma");
        if (i)
                gamma = atof(sys.argv[i + 1]);
 // COMMANDLINEOPTION: Client: -texcontrast <number> sets the quake palette contrast, allowing you to make quake textures brighter/darker, not recommended
-       i = COM_CheckParm("-texcontrast");
+       i = Sys_CheckParm("-texcontrast");
        if (i)
                scale = atof(sys.argv[i + 1]);
 // COMMANDLINEOPTION: Client: -texbrightness <number> sets the quake palette brightness (brightness of black), allowing you to make quake textures brighter/darker, not recommended
-       i = COM_CheckParm("-texbrightness");
+       i = Sys_CheckParm("-texbrightness");
        if (i)
                base = atof(sys.argv[i + 1]);
        gamma = bound(0.01, gamma, 10.0);
index 8b3a645e20732deb92e073ed2db9acb986e5538b..cccc66dfdc4bbd09d0fe0754bfbde0cd810c65da 100644 (file)
@@ -3179,7 +3179,7 @@ void PRVM_Init (void)
        Cvar_RegisterVariable (&prvm_stringdebug);
 
        // COMMANDLINEOPTION: PRVM: -norunaway disables the runaway loop check (it might be impossible to exit DarkPlaces if used!)
-       prvm_runawaycheck = !COM_CheckParm("-norunaway");
+       prvm_runawaycheck = !Sys_CheckParm("-norunaway");
 
        //VM_Cmd_Init();
 }
index 33c3a08bd1e958c665294288fb1883002c68cc59..c76e503d211d59f5662903fb06fea0d3243d58a8 100644 (file)
@@ -530,28 +530,28 @@ void S_Startup (void)
 
        // Parse the command line to see if the player wants a particular sound format
 // COMMANDLINEOPTION: Sound: -sndquad sets sound output to 4 channel surround
-       if (COM_CheckParm ("-sndquad") != 0)
+       if (Sys_CheckParm ("-sndquad") != 0)
        {
                chosen_fmt.channels = 4;
        }
 // COMMANDLINEOPTION: Sound: -sndstereo sets sound output to stereo
-       else if (COM_CheckParm ("-sndstereo") != 0)
+       else if (Sys_CheckParm ("-sndstereo") != 0)
        {
                chosen_fmt.channels = 2;
        }
 // COMMANDLINEOPTION: Sound: -sndmono sets sound output to mono
-       else if (COM_CheckParm ("-sndmono") != 0)
+       else if (Sys_CheckParm ("-sndmono") != 0)
        {
                chosen_fmt.channels = 1;
        }
 // COMMANDLINEOPTION: Sound: -sndspeed <hz> chooses sound output rate (supported values are 48000, 44100, 32000, 24000, 22050, 16000, 11025 (quake), 8000)
-       i = COM_CheckParm ("-sndspeed");
+       i = Sys_CheckParm ("-sndspeed");
        if (0 < i && i < sys.argc - 1)
        {
                chosen_fmt.speed = atoi (sys.argv[i + 1]);
        }
 // COMMANDLINEOPTION: Sound: -sndbits <bits> chooses 8 bit or 16 bit or 32bit float sound output
-       i = COM_CheckParm ("-sndbits");
+       i = Sys_CheckParm ("-sndbits");
        if (0 < i && i < sys.argc - 1)
        {
                chosen_fmt.width = atoi (sys.argv[i + 1]) / 8;
@@ -775,7 +775,7 @@ void S_Init(void)
        Cvar_RegisterVariable(&snd_identicalsoundrandomization_tics);
 
 // COMMANDLINEOPTION: Sound: -nosound disables sound (including CD audio)
-       if (COM_CheckParm("-nosound"))
+       if (Sys_CheckParm("-nosound"))
        {
                // dummy out Play and Play2 because mods stuffcmd that
                Cmd_AddCommand(CMD_CLIENT, "play", Host_NoOperation_f, "does nothing because -nosound was specified");
@@ -786,7 +786,7 @@ void S_Init(void)
        snd_mempool = Mem_AllocPool("sound", 0, NULL);
 
 // COMMANDLINEOPTION: Sound: -simsound runs sound mixing but with no output
-       if (COM_CheckParm("-simsound"))
+       if (Sys_CheckParm("-simsound"))
                simsound = true;
 
        Cmd_AddCommand(CMD_CLIENT, "play", S_Play_f, "play a sound at your current location (not heard by anyone else)");
index 2a1cb1482a1815a3ff306c7659cb692d51406feb..d91b82329effea1a7107d478b41f8a132991559f 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -305,7 +305,7 @@ qboolean OGG_OpenLibrary (void)
                return true;
 
 // COMMANDLINEOPTION: Sound: -novorbis disables ogg vorbis sound support
-       if (COM_CheckParm("-novorbis"))
+       if (Sys_CheckParm("-novorbis"))
                return false;
 
        // Load the DLLs
index e963e18e5afb0dc45ceaefbc044e9d36399fd101..2985112b639c4f1afbfa28552122bc21c17b290b 100644 (file)
--- a/snd_xmp.c
+++ b/snd_xmp.c
@@ -366,7 +366,7 @@ qboolean XMP_OpenLibrary (void)
                return true;
 
 // COMMANDLINEOPTION: Sound: -noxmp disables xmp module sound support
-       if (COM_CheckParm("-noxmp"))
+       if (Sys_CheckParm("-noxmp"))
                return false;
 
        // Load the DLL
@@ -606,7 +606,7 @@ qboolean XMP_LoadModFile(const char *filename, sfx_t *sfx)
 #endif
 
 // COMMANDLINEOPTION: Sound: -noxmp disables xmp module sound support
-       if (COM_CheckParm("-noxmp"))
+       if (Sys_CheckParm("-noxmp"))
                return false;
 
        // Return if already loaded
diff --git a/sys.h b/sys.h
index ee3b777360380cd5376d7e2382fcecce210ea607..1dd5ae76e4c7e56810dc1fb07ae5b8dcb3a62f85 100644 (file)
--- a/sys.h
+++ b/sys.h
@@ -67,6 +67,8 @@ qboolean Sys_LoadLibrary (const char** dllnames, dllhandle_t* handle, const dllf
 void Sys_UnloadLibrary (dllhandle_t* handle);
 void* Sys_GetProcAddress (dllhandle_t handle, const char* name);
 
+int Sys_CheckParm (const char *parm);
+
 /// called early in Host_Init
 void Sys_InitConsole (void);
 /// called after command system is initialized but before first Con_Print
index 50186991e47ee30bfa67daf1fc66bef22286f879..3adfb98001cd86a685905093c36d645187ee8f74 100644 (file)
--- a/sys_sdl.c
+++ b/sys_sdl.c
@@ -202,13 +202,13 @@ int main (int argc, char *argv[])
        Sys_ProvideSelfFD();
 
        // COMMANDLINEOPTION: -nocrashdialog disables "Engine Error" crash dialog boxes
-       if(!COM_CheckParm("-nocrashdialog"))
+       if(!Sys_CheckParm("-nocrashdialog"))
                nocrashdialog = false;
        // COMMANDLINEOPTION: sdl: -noterminal disables console output on stdout
-       if(COM_CheckParm("-noterminal"))
+       if(Sys_CheckParm("-noterminal"))
                sys.outfd = -1;
        // COMMANDLINEOPTION: sdl: -stderr moves console output to stderr
-       else if(COM_CheckParm("-stderr"))
+       else if(Sys_CheckParm("-stderr"))
                sys.outfd = 2;
        else
                sys.outfd = 1;
index 468037be84637c4b25839242658f505dba6fd8ce..b7ea5d5a084a620010c934f228d4ec3e9bad70ef 100644 (file)
@@ -55,7 +55,7 @@ void Sys_Quit (int returnvalue)
        SV_UnlockThreadMutex();
        TaskQueue_Frame(true);
 
-       if (COM_CheckParm("-profilegameonly"))
+       if (Sys_CheckParm("-profilegameonly"))
                Sys_AllowProfiling(false);
        host.state = host_shutdown;
        Host_Shutdown();
@@ -283,6 +283,29 @@ static cvar_t sys_useclockgettime = {CVAR_CLIENT | CVAR_SERVER | CVAR_SAVE, "sys
 
 static double benchmark_time; // actually always contains an integer amount of milliseconds, will eventually "overflow"
 
+/*
+================
+Sys_CheckParm
+
+Returns the position (1 to argc-1) in the program's argument list
+where the given parameter apears, or 0 if not present
+================
+*/
+int Sys_CheckParm (const char *parm)
+{
+       int i;
+
+       for (i=1 ; i<sys.argc ; i++)
+       {
+               if (!sys.argv[i])
+                       continue;               // NEXTSTEP sometimes clears appkit vars.
+               if (!strcmp (parm,sys.argv[i]))
+                       return i;
+       }
+
+       return 0;
+}
+
 void Sys_Init_Commands (void)
 {
        Cvar_RegisterVariable(&sys_debugsleep);
@@ -560,13 +583,13 @@ static int CPUID_Features(void)
 qboolean Sys_HaveSSE(void)
 {
        // COMMANDLINEOPTION: SSE: -nosse disables SSE support and detection
-       if(COM_CheckParm("-nosse"))
+       if(Sys_CheckParm("-nosse"))
                return false;
 #ifdef SSE_PRESENT
        return true;
 #else
        // COMMANDLINEOPTION: SSE: -forcesse enables SSE support and disables detection
-       if(COM_CheckParm("-forcesse") || COM_CheckParm("-forcesse2"))
+       if(Sys_CheckParm("-forcesse") || Sys_CheckParm("-forcesse2"))
                return true;
        if(CPUID_Features() & (1 << 25))
                return true;
@@ -577,13 +600,13 @@ qboolean Sys_HaveSSE(void)
 qboolean Sys_HaveSSE2(void)
 {
        // COMMANDLINEOPTION: SSE2: -nosse2 disables SSE2 support and detection
-       if(COM_CheckParm("-nosse") || COM_CheckParm("-nosse2"))
+       if(Sys_CheckParm("-nosse") || Sys_CheckParm("-nosse2"))
                return false;
 #ifdef SSE2_PRESENT
        return true;
 #else
        // COMMANDLINEOPTION: SSE2: -forcesse2 enables SSE2 support and disables detection
-       if(COM_CheckParm("-forcesse2"))
+       if(Sys_CheckParm("-forcesse2"))
                return true;
        if((CPUID_Features() & (3 << 25)) == (3 << 25)) // SSE is 1<<25, SSE2 is 1<<26
                return true;
@@ -601,7 +624,7 @@ void Sys_InitProcessNice (void)
 {
        struct rlimit lim;
        sys.nicepossible = false;
-       if(COM_CheckParm("-nonice"))
+       if(Sys_CheckParm("-nonice"))
                return;
        errno = 0;
        sys.nicelevel = getpriority(PRIO_PROCESS, 0);
index 7fdd1df970917562f9aefa0b08cc39b875626d30..56bdd883217080c5ea9fc1520aead4823ab8d2e9 100644 (file)
@@ -154,10 +154,10 @@ int main (int argc, char **argv)
        Sys_ProvideSelfFD();
 
        // COMMANDLINEOPTION: sdl: -noterminal disables console output on stdout
-       if(COM_CheckParm("-noterminal"))
+       if(Sys_CheckParm("-noterminal"))
                sys.outfd = -1;
        // COMMANDLINEOPTION: sdl: -stderr moves console output to stderr
-       else if(COM_CheckParm("-stderr"))
+       else if(Sys_CheckParm("-stderr"))
                sys.outfd = 2;
        else
                sys.outfd = 1;
index 8ddf7e90b8c0651fe4f760bfb6bcd8b6fd474475..34609b0d1c4abfc7cd667c7f0e2f25f0d83d3763 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -243,7 +243,7 @@ void Sys_InitConsole (void)
 
        // LadyHavoc: can't check cls.state because it hasn't been initialized yet
        // if (cls.state == ca_dedicated)
-       if (COM_CheckParm("-dedicated"))
+       if (Sys_CheckParm("-dedicated"))
        {
                //if ((houtput == 0) || (houtput == INVALID_HANDLE_VALUE)) // LadyHavoc: on Windows XP this is never 0 or invalid, but hinput is invalid
                {
@@ -261,19 +261,19 @@ void Sys_InitConsole (void)
 #define atoi _atoi64
 #endif
        // give QHOST a chance to hook into the console
-               if ((t = COM_CheckParm ("-HFILE")) > 0)
+               if ((t = Sys_CheckParm ("-HFILE")) > 0)
                {
                        if (t < sys.argc)
                                hFile = (HANDLE)atoi (sys.argv[t+1]);
                }
 
-               if ((t = COM_CheckParm ("-HPARENT")) > 0)
+               if ((t = Sys_CheckParm ("-HPARENT")) > 0)
                {
                        if (t < sys.argc)
                                heventParent = (HANDLE)atoi (sys.argv[t+1]);
                }
 
-               if ((t = COM_CheckParm ("-HCHILD")) > 0)
+               if ((t = Sys_CheckParm ("-HCHILD")) > 0)
                {
                        if (t < sys.argc)
                                heventChild = (HANDLE)atoi (sys.argv[t+1]);
index 9b25807965a9f0889022c5b175d31816574008e4..de693c42fe1f973b971940d36ad0127d9c83cfb3 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -1493,7 +1493,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode)
        drivername = NULL;
 
 // COMMANDLINEOPTION: SDL GL: -gl_driver <drivername> selects a GL driver library, default is whatever SDL recommends, useful only for 3dfxogl.dll/3dfxvgl.dll or fxmesa or similar, if you don't know what this is for, you don't need it
-       i = COM_CheckParm("-gl_driver");
+       i = Sys_CheckParm("-gl_driver");
        if (i && i < sys.argc - 1)
                drivername = sys.argv[i + 1];
        if (SDL_GL_LoadLibrary(drivername) < 0)
index 0e523ed55229ad137553b5fe90e4e3a231caf7cf..661fb0a697ad68949225eba370c5b2eaee14ed96 100644 (file)
@@ -643,7 +643,7 @@ qboolean GL_CheckExtension(const char *name, const char *disableparm, int silent
 
        Con_DPrintf("checking for %s...  ", name);
 
-       if (disableparm && (COM_CheckParm(disableparm) || COM_CheckParm("-safe")))
+       if (disableparm && (Sys_CheckParm(disableparm) || Sys_CheckParm("-safe")))
        {
                Con_DPrint("disabled by commandline\n");
                return false;
@@ -1511,24 +1511,24 @@ void VID_Start(void)
                // interpret command-line parameters
                vid_commandlinecheck = false;
 // COMMANDLINEOPTION: Video: -window performs +vid_fullscreen 0
-               if (COM_CheckParm("-window") || COM_CheckParm("-safe") || ((i = COM_CheckParm("+vid_fullscreen")) != 0 && atoi(sys.argv[i+1]) == 0))
+               if (Sys_CheckParm("-window") || Sys_CheckParm("-safe") || ((i = Sys_CheckParm("+vid_fullscreen")) != 0 && atoi(sys.argv[i+1]) == 0))
                        Cvar_SetValueQuick(&vid_fullscreen, false);
 // COMMANDLINEOPTION: Video: -borderless performs +vid_borderless 1
-               if (COM_CheckParm("-borderless") || ((i = COM_CheckParm("+vid_borderless")) != 0 && atoi(sys.argv[i+1]) == 1))
+               if (Sys_CheckParm("-borderless") || ((i = Sys_CheckParm("+vid_borderless")) != 0 && atoi(sys.argv[i+1]) == 1))
                {
                        Cvar_SetValueQuick(&vid_borderless, true);
                        Cvar_SetValueQuick(&vid_fullscreen, false);
                }
 // COMMANDLINEOPTION: Video: -fullscreen performs +vid_fullscreen 1
-               if (COM_CheckParm("-fullscreen") || ((i = COM_CheckParm("+vid_fullscreen")) != 0 && atoi(sys.argv[i+1]) == 1))
+               if (Sys_CheckParm("-fullscreen") || ((i = Sys_CheckParm("+vid_fullscreen")) != 0 && atoi(sys.argv[i+1]) == 1))
                        Cvar_SetValueQuick(&vid_fullscreen, true);
                width = 0;
                height = 0;
 // COMMANDLINEOPTION: Video: -width <pixels> performs +vid_width <pixels> and also +vid_height <pixels*3/4> if only -width is specified (example: -width 1024 sets 1024x768 mode)
-               if ((i = COM_CheckParm("-width")) != 0 || ((i = COM_CheckParm("+vid_width")) != 0))
+               if ((i = Sys_CheckParm("-width")) != 0 || ((i = Sys_CheckParm("+vid_width")) != 0))
                        width = atoi(sys.argv[i+1]);
 // COMMANDLINEOPTION: Video: -height <pixels> performs +vid_height <pixels> and also +vid_width <pixels*4/3> if only -height is specified (example: -height 768 sets 1024x768 mode)
-               if ((i = COM_CheckParm("-height")) != 0 || ((i = COM_CheckParm("+vid_height")) != 0))
+               if ((i = Sys_CheckParm("-height")) != 0 || ((i = Sys_CheckParm("+vid_height")) != 0))
                        height = atoi(sys.argv[i+1]);
                if (width == 0)
                        width = height * 4 / 3;
@@ -1539,13 +1539,13 @@ void VID_Start(void)
                if (height)
                        Cvar_SetValueQuick(&vid_height, height);
 // COMMANDLINEOPTION: Video: -density <multiplier> performs +vid_touchscreen_density <multiplier> (example -density 1 or -density 1.5)
-               if ((i = COM_CheckParm("-density")) != 0)
+               if ((i = Sys_CheckParm("-density")) != 0)
                        Cvar_SetQuick(&vid_touchscreen_density, sys.argv[i+1]);
 // COMMANDLINEOPTION: Video: -xdpi <dpi> performs +vid_touchscreen_xdpi <dpi> (example -xdpi 160 or -xdpi 320)
-               if ((i = COM_CheckParm("-touchscreen_xdpi")) != 0)
+               if ((i = Sys_CheckParm("-touchscreen_xdpi")) != 0)
                        Cvar_SetQuick(&vid_touchscreen_xdpi, sys.argv[i+1]);
 // COMMANDLINEOPTION: Video: -ydpi <dpi> performs +vid_touchscreen_ydpi <dpi> (example -ydpi 160 or -ydpi 320)
-               if ((i = COM_CheckParm("-touchscreen_ydpi")) != 0)
+               if ((i = Sys_CheckParm("-touchscreen_ydpi")) != 0)
                        Cvar_SetQuick(&vid_touchscreen_ydpi, sys.argv[i+1]);
        }