sanitize con_width and con_height handling. con_height cvar was being ignored.

This commit is contained in:
Bill Currie 2009-12-21 12:36:12 +00:00 committed by Jeff Teunissen
parent b6a4fc1b58
commit 52b2631341
2 changed files with 5 additions and 9 deletions

View file

@ -119,13 +119,13 @@ VID_GetWindowSize (int def_w, int def_h)
if (pnum >= com_argc - 1)
Sys_Error ("VID: -conwidth <width>");
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 <width>");
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;
}

View file

@ -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);