From 52b26313419c2fef2bc6cbf9f7078b4d24506224 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 21 Dec 2009 12:36:12 +0000 Subject: [PATCH] sanitize con_width and con_height handling. con_height cvar was being ignored. --- libs/video/targets/vid.c | 8 +++++--- libs/video/targets/vid_glx.c | 6 ------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index 2d2df8349..f8c9d1605 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -119,13 +119,13 @@ VID_GetWindowSize (int def_w, int def_h) if (pnum >= com_argc - 1) Sys_Error ("VID: -conwidth "); Cvar_Set (con_width, com_argv[pnum + 1]); - if (!vid_height->int_val) - Sys_Error ("VID: Bad console width"); } + // make con_width a multiple of 8 and >= 320 + Cvar_Set (con_width, va ("%d", max (con_width->int_val & ~7, 320))); Cvar_SetFlags (con_width, con_width->flags | CVAR_ROM); vid.conwidth = con_width->int_val; - conheight = ((vid.conwidth & 0xFFF8) * 3) / 4; + conheight = (vid.conwidth * 3) / 4; con_height = Cvar_Get ("con_height", va ("%d", conheight), CVAR_NONE, NULL, "console effective height (GL only)"); if ((pnum = COM_CheckParm ("-conheight"))) { @@ -133,6 +133,8 @@ VID_GetWindowSize (int def_w, int def_h) Sys_Error ("VID: -conheight "); Cvar_Set (con_height, com_argv[pnum + 1]); } + // make con_height >= 200 + Cvar_Set (con_height, va ("%d", max (con_height->int_val, 200))); Cvar_SetFlags (con_height, con_height->flags | CVAR_ROM); vid.conheight = con_height->int_val; } diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index 81e70ff84..6e1c39ed1 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -209,12 +209,6 @@ VID_Init (unsigned char *palette) vid.colormap8 = vid_colormap; vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048)); - vid.conwidth &= 0xfff8; // make it a multiple of eight - vid.conwidth = max (vid.conwidth, 320); - - // pick a conheight that matches with correct aspect - vid.conheight = (vid.conwidth * 3) / 4; - if ((i = COM_CheckParm ("-conheight"))) // conheight no smaller than 200p vid.conheight = atoi (com_argv[i + 1]); vid.conheight = max (vid.conheight, 200);