From a8a8792a765f74c60c326e974f9113a9963fe7a4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 17 Mar 2003 05:17:58 +0000 Subject: [PATCH] support vid_conwidth cvar (for -conwidth). while present in all targets, it will only work in gl --- libs/video/targets/vid.c | 13 +++++++++++++ libs/video/targets/vid_3dfxsvga.c | 5 ----- libs/video/targets/vid_glx.c | 8 -------- libs/video/targets/vid_sgl.c | 8 -------- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index 82e15f364..928c9af73 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -53,6 +53,7 @@ static __attribute__ ((unused)) const char rcsid[] = byte gammatable[256]; cvar_t *vid_gamma; cvar_t *vid_system_gamma; +cvar_t *vid_conwidth; qboolean vid_gamma_avail; // hardware gamma availability unsigned int d_8to24table[256]; @@ -111,6 +112,18 @@ VID_GetWindowSize (int def_w, int def_h) scr_width = vid.width = vid_width->int_val; scr_height = vid.height = vid_height->int_val; + + vid_conwidth = Cvar_Get ("vid_conwidth", va ("%d", def_w), CVAR_NONE, NULL, + "console effective width (GL only)"); + if ((pnum = COM_CheckParm ("-conwidth"))) { + if (pnum >= com_argc - 1) + Sys_Error ("VID: -conwidth "); + Cvar_Set (vid_conwidth, com_argv[pnum + 1]); + if (!vid_height->int_val) + Sys_Error ("VID: Bad console width"); + } + Cvar_SetFlags (vid_conwidth, vid_conwidth->flags | CVAR_ROM); + vid.conwidth = vid_conwidth->int_val; } /* GAMMA FUNCTIONS */ diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index f29d2288c..06a713f74 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -303,11 +303,6 @@ VID_Init (unsigned char *palette) attribs[4] = 1; attribs[5] = FXMESA_NONE; - if ((i = COM_CheckParm ("-conwidth"))) - vid.conwidth = atoi (com_argv[i + 1]); - else - vid.conwidth = 640; - vid.conwidth &= 0xfff8; // make it a multiple of eight vid.conwidth = max (vid.conwidth, 320); diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index 465984400..5aa98257a 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -210,14 +210,6 @@ VID_Init (unsigned char *palette) vid.colormap8 = vid_colormap; vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048)); - // Interpret command-line params - - // Set vid parameters - if ((i = COM_CheckParm ("-conwidth"))) - vid.conwidth = atoi (com_argv[i + 1]); - else - vid.conwidth = scr_width; - vid.conwidth &= 0xfff8; // make it a multiple of eight vid.conwidth = max (vid.conwidth, 320); diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c index cec81d922..5f8068db9 100644 --- a/libs/video/targets/vid_sgl.c +++ b/libs/video/targets/vid_sgl.c @@ -117,14 +117,6 @@ VID_Init (unsigned char *palette) vid.colormap8 = vid_colormap; vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048)); - // Interpret command-line params - - // Set vid parameters - if ((i = COM_CheckParm ("-conwidth")) != 0) - vid.conwidth = atoi (com_argv[i + 1]); - else - vid.conwidth = scr_width; - vid.conwidth &= 0xfff8; // make it a multiple of eight if (vid.conwidth < 320) vid.conwidth = 320;