2000-10-21 07:15:30 +00:00
|
|
|
/*
|
|
|
|
vid.c
|
|
|
|
|
|
|
|
general video driver functions
|
|
|
|
|
2000-10-27 10:17:38 +00:00
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
2000-10-21 07:15:30 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
2000-10-27 10:17:38 +00:00
|
|
|
|
2000-10-21 07:20:57 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2000-10-27 10:17:38 +00:00
|
|
|
# include "config.h"
|
2000-10-21 07:15:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "cvar.h"
|
2000-10-21 07:20:57 +00:00
|
|
|
#include "vid.h"
|
|
|
|
#include "va.h"
|
|
|
|
#include "qargs.h"
|
2000-10-21 07:15:30 +00:00
|
|
|
#include "sys.h"
|
|
|
|
|
2000-10-27 10:17:38 +00:00
|
|
|
extern viddef_t vid; // global video state
|
2000-10-21 07:15:30 +00:00
|
|
|
|
|
|
|
int scr_width, scr_height;
|
|
|
|
cvar_t *vid_width;
|
|
|
|
cvar_t *vid_height;
|
|
|
|
|
2000-10-27 10:17:38 +00:00
|
|
|
void
|
|
|
|
VID_GetWindowSize (int def_w, int def_h)
|
2000-10-21 07:15:30 +00:00
|
|
|
{
|
|
|
|
int pnum;
|
|
|
|
|
2000-11-04 07:42:43 +00:00
|
|
|
if ((pnum=COM_CheckParm("-winsize"))) {
|
|
|
|
if (pnum >= com_argc-2)
|
|
|
|
Sys_Error("VID: -winsize <width> <height>\n");
|
|
|
|
vid_width = Cvar_Get ("vid_width", com_argv[pnum+1], CVAR_ROM, "screen width");
|
|
|
|
vid_height = Cvar_Get ("vid_height", com_argv[pnum+2], CVAR_ROM, "screen height");
|
|
|
|
if (!vid_width->int_val || !vid_height->int_val)
|
|
|
|
Sys_Error("VID: Bad window width/height\n");
|
|
|
|
}
|
2000-10-21 07:15:30 +00:00
|
|
|
|
|
|
|
if ((pnum=COM_CheckParm("-width"))) {
|
|
|
|
if (pnum >= com_argc-1)
|
|
|
|
Sys_Error("VID: -width <width>\n");
|
2000-11-04 07:42:43 +00:00
|
|
|
vid_width = Cvar_Get ("vid_width", com_argv[pnum+1], CVAR_ROM, "screen width");
|
2000-10-21 07:15:30 +00:00
|
|
|
if (!vid_width->int_val)
|
|
|
|
Sys_Error("VID: Bad window width\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((pnum=COM_CheckParm("-height"))) {
|
|
|
|
if (pnum >= com_argc-1)
|
|
|
|
Sys_Error("VID: -height <height>\n");
|
2000-11-04 07:42:43 +00:00
|
|
|
vid_height = Cvar_Get ("vid_height", com_argv[pnum+1], CVAR_ROM, "screen height");
|
2000-10-21 07:15:30 +00:00
|
|
|
if (!vid_height->int_val)
|
|
|
|
Sys_Error("VID: Bad window height\n");
|
|
|
|
}
|
|
|
|
|
2000-11-04 07:42:43 +00:00
|
|
|
vid_width = Cvar_Get ("vid_width", va("%d",def_w), CVAR_ROM, "screen width");
|
|
|
|
vid_height = Cvar_Get ("vid_height", va("%d",def_h), CVAR_ROM, "screen height");
|
2000-10-21 07:15:30 +00:00
|
|
|
|
|
|
|
scr_width = vid.width = vid_width->int_val;
|
|
|
|
scr_height = vid.height = vid_height->int_val;
|
|
|
|
}
|