return -1;
// COMMANDLINEOPTION: Sound: -nocdaudio disables CD audio support
- if (COM_CheckParm("-nocdaudio"))
+ if (Sys_CheckParm("-nocdaudio"))
return -1;
#ifdef MAXTRACKS
int CDAudio_Startup (void)
{
- if (COM_CheckParm("-nocdaudio"))
+ if (Sys_CheckParm("-nocdaudio"))
return -1;
initialized = true;
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);
}
// 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;
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) \
{
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;
if (cls.state == ca_dedicated)
return;
- if (COM_CheckParm("-profilegameonly"))
+ if (Sys_CheckParm("-profilegameonly"))
Sys_AllowProfiling(false);
Curl_Clear_forthismap();
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
S_PurgeUnused();
Con_ClearNotify();
- if (COM_CheckParm("-profilegameonly"))
+ if (Sys_CheckParm("-profilegameonly"))
Sys_AllowProfiling(true);
break;
}
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)");
Host_StartVideo();
- if (COM_CheckParm("-benchmark"))
+ if (Sys_CheckParm("-benchmark"))
return;
if (Cmd_Argc(cmd) < 2)
int errorcode;
// COMMANDLINEOPTION: Video: -nolibavw disables libavcodec wrapper support
- if (COM_CheckParm("-nolibavw"))
+ if (Sys_CheckParm("-nolibavw"))
return false;
// load DLL's
if (!strcmp(filename, "config.cfg"))
{
filename = CONFIGFILENAME;
- if (COM_CheckParm("-noconfig"))
+ if (Sys_CheckParm("-noconfig"))
return; // don't execute config.cfg
}
// 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;
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];
}
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
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);
*/
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
// 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
static void FS_mkdir (const char *path)
{
- if(COM_CheckParm("-readonly"))
+ if(Sys_CheckParm("-readonly"))
return;
#if WIN32
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
// -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));
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
{
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++)
{
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)
#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)
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
// 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);
{
// 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
// 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)
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]);
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);
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));
// 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";
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
// 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)
{
// 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)
{
#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)
{
}
#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");
return;
}
- if (COM_CheckParm ("-noconsole"))
+ if (Sys_CheckParm ("-noconsole"))
return; // only allow the key bind to turn off console
Key_Console (cmd, key, ascii);
// 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);
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)
{
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)
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);
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();
}
// 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;
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");
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)");
return true;
// COMMANDLINEOPTION: Sound: -novorbis disables ogg vorbis sound support
- if (COM_CheckParm("-novorbis"))
+ if (Sys_CheckParm("-novorbis"))
return false;
// Load the DLLs
return true;
// COMMANDLINEOPTION: Sound: -noxmp disables xmp module sound support
- if (COM_CheckParm("-noxmp"))
+ if (Sys_CheckParm("-noxmp"))
return false;
// Load the DLL
#endif
// COMMANDLINEOPTION: Sound: -noxmp disables xmp module sound support
- if (COM_CheckParm("-noxmp"))
+ if (Sys_CheckParm("-noxmp"))
return false;
// Return if already loaded
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
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;
SV_UnlockThreadMutex();
TaskQueue_Frame(true);
- if (COM_CheckParm("-profilegameonly"))
+ if (Sys_CheckParm("-profilegameonly"))
Sys_AllowProfiling(false);
host.state = host_shutdown;
Host_Shutdown();
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);
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;
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;
{
struct rlimit lim;
sys.nicepossible = false;
- if(COM_CheckParm("-nonice"))
+ if(Sys_CheckParm("-nonice"))
return;
errno = 0;
sys.nicelevel = getpriority(PRIO_PROCESS, 0);
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;
// 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
{
#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]);
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)
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;
// 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;
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]);
}