check for arguments to several command line options. patch from Sander van Dijk.

git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@446 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2011-04-19 18:29:41 +00:00
parent c2583f35d3
commit 88d6f8f1ef
4 changed files with 56 additions and 32 deletions

View file

@ -329,9 +329,12 @@ Con_Init
*/
void Con_Init (void)
{
int i;
//johnfitz -- user settable console buffer size
if (COM_CheckParm("-consize"))
con_buffersize = q_max(CON_MINSIZE,Q_atoi(com_argv[COM_CheckParm("-consize")+1])*1024);
i = COM_CheckParm("-consize");
if (i && i < com_argc-1)
con_buffersize = q_max(CON_MINSIZE,Q_atoi(com_argv[i+1])*1024);
else
con_buffersize = CON_TEXTSIZE;
//johnfitz

View file

@ -1825,6 +1825,7 @@ VID_InitDIB
*/
void VID_InitDIB (HINSTANCE hInstance)
{
int i;
DEVMODE devmode; //johnfitz
WNDCLASS wc;
HDC hdc;
@ -1846,16 +1847,18 @@ void VID_InitDIB (HINSTANCE hInstance)
modelist[0].type = MS_WINDOWED;
if (COM_CheckParm("-width"))
modelist[0].width = Q_atoi(com_argv[COM_CheckParm("-width")+1]);
i = COM_CheckParm("-width");
if (i && i < com_argc-1)
modelist[0].width = Q_atoi(com_argv[i+1]);
else
modelist[0].width = 640;
if (modelist[0].width < 320)
modelist[0].width = 320;
if (COM_CheckParm("-height"))
modelist[0].height= Q_atoi(com_argv[COM_CheckParm("-height")+1]);
i = COM_CheckParm("-height");
if (i && i < com_argc-1)
modelist[0].height= Q_atoi(com_argv[i+1]);
else
modelist[0].height = modelist[0].width * 240/320;
@ -2055,6 +2058,7 @@ void VID_Init (void)
{
int i, existingmode;
int width, height, bpp, findbpp, done;
int p;
HGLRC baseRC; //johnfitz -- moved here from global scope, since it was only used in this
HDC hdc;
DEVMODE devmode;
@ -2110,9 +2114,10 @@ void VID_Init (void)
windowed = false;
if (COM_CheckParm("-mode"))
p = COM_CheckParm("-mode");
if (p && p < com_argc-1)
{
vid_default = Q_atoi(com_argv[COM_CheckParm("-mode")+1]);
vid_default = Q_atoi(com_argv[p+1]);
}
else
{
@ -2125,18 +2130,20 @@ void VID_Init (void)
}
else
{
if (COM_CheckParm("-width"))
p = COM_CheckParm("-width");
if (p && p < com_argc-1)
{
width = Q_atoi(com_argv[COM_CheckParm("-width")+1]);
width = Q_atoi(com_argv[p+1]);
}
else
{
width = 640;
}
if (COM_CheckParm("-bpp"))
p = COM_CheckParm("-bpp");
if (p && p < com_argc-1)
{
bpp = Q_atoi(com_argv[COM_CheckParm("-bpp")+1]);
bpp = Q_atoi(com_argv[p+1]);
findbpp = 0;
}
else
@ -2145,8 +2152,9 @@ void VID_Init (void)
findbpp = 1;
}
if (COM_CheckParm("-height"))
height = Q_atoi(com_argv[COM_CheckParm("-height")+1]);
p = COM_CheckParm("-height");
if (p && p < com_argc-1)
height = Q_atoi(com_argv[p+1]);
else
height = width * 3 / 4; // assume 4:3 aspect ratio
@ -2189,9 +2197,10 @@ void VID_Init (void)
do
{
if (COM_CheckParm("-height"))
p = COM_CheckParm("-height");
if (p && p < com_argc-1)
{
height = Q_atoi(com_argv[COM_CheckParm("-height")+1]);
height = Q_atoi(com_argv[p+1]);
for (i=1, vid_default=0 ; i<nummodes ; i++)
{

View file

@ -1028,19 +1028,22 @@ VID_InitDIB
void VID_InitDIB (void)
{
const SDL_VideoInfo *info;
int i;
modelist[0].type = MODE_WINDOWED;
if (COM_CheckParm("-width"))
modelist[0].width = Q_atoi(com_argv[COM_CheckParm("-width")+1]);
i = COM_CheckParm("-width");
if (i && i < com_argc-1)
modelist[0].width = Q_atoi(com_argv[i+1]);
else
modelist[0].width = 800; // QuakeSpasm, was 640
if (modelist[0].width < 320)
modelist[0].width = 320;
if (COM_CheckParm("-height"))
modelist[0].height= Q_atoi(com_argv[COM_CheckParm("-height")+1]);
i = COM_CheckParm("-height");
if (i && i < com_argc-1)
modelist[0].height= Q_atoi(com_argv[i+1]);
else
modelist[0].height = modelist[0].width * 240/320;
@ -1161,6 +1164,7 @@ void VID_Init (void)
const SDL_VideoInfo *info;
int i, existingmode;
int width, height, bpp, findbpp, done;
int p;
//johnfitz -- clean up init readouts
//Con_Printf("------------- Init Video -------------\n");
@ -1206,9 +1210,10 @@ void VID_Init (void)
windowed = false;
if (COM_CheckParm("-mode"))
p = COM_CheckParm("-mode");
if (p && p < com_argc-1)
{
vid_default = Q_atoi(com_argv[COM_CheckParm("-mode")+1]);
vid_default = Q_atoi(com_argv[p+1]);
}
else
{
@ -1222,18 +1227,20 @@ void VID_Init (void)
}
else
{
if (COM_CheckParm("-width"))
p = COM_CheckParm("-width");
if (p && p < com_argc-1)
{
width = Q_atoi(com_argv[COM_CheckParm("-width")+1]);
width = Q_atoi(com_argv[p+1]);
}
else
{
width = 640;
}
if (COM_CheckParm("-bpp"))
p = COM_CheckParm("-bpp");
if (p && p < com_argc-1)
{
bpp = Q_atoi(com_argv[COM_CheckParm("-bpp")+1]);
bpp = Q_atoi(com_argv[p+1]);
findbpp = 0;
}
else
@ -1242,8 +1249,9 @@ void VID_Init (void)
findbpp = 1;
}
if (COM_CheckParm("-height"))
height = Q_atoi(com_argv[COM_CheckParm("-height")+1]);
p = COM_CheckParm("-height");
if (p && p < com_argc-1)
height = Q_atoi(com_argv[p+1]);
else
height = width * 3 / 4; // assume 4:3 aspect ratio
@ -1284,9 +1292,10 @@ void VID_Init (void)
do
{
if (COM_CheckParm("-height"))
p = COM_CheckParm("-height");
if (p && p < com_argc-1)
{
height = Q_atoi(com_argv[COM_CheckParm("-height")+1]);
height = Q_atoi(com_argv[p+1]);
for (i=1, vid_default=0 ; i<nummodes ; i++)
{

View file

@ -137,6 +137,8 @@ S_Init
*/
void S_Init (void)
{
int i;
if (snd_initialized)
{
Con_Printf("Sound is already initialized\n");
@ -166,9 +168,10 @@ void S_Init (void)
Cmd_AddCommand("soundlist", S_SoundList);
Cmd_AddCommand("soundinfo", S_SoundInfo_f);
if (COM_CheckParm("-sndspeed"))
i = COM_CheckParm("-sndspeed");
if (i && i < com_argc-1)
{
sndspeed.value = Q_atoi(com_argv[COM_CheckParm("-sndspeed")+1]);
sndspeed.value = Q_atoi(com_argv[i+1]);
}
if (host_parms->memsize < 0x800000)