static void VID_UpdateConRes(void) { // Default if (r_conwidth.integer == 0 || r_conheight.integer == 0) { vid.width = vid.conwidth = bound(320, (int)(glConfig.vidWidth/r_conscale.value), glConfig.vidWidth); vid.height = vid.conheight = bound(200, (int)(glConfig.vidHeight/r_conscale.value), glConfig.vidHeight);; } else { // User specified, use that but check boundaries vid.width = vid.conwidth = bound(320, r_conwidth.integer, glConfig.vidWidth); vid.height = vid.conheight = bound(200, r_conheight.integer, glConfig.vidHeight); Cvar_SetValue(&r_conwidth, vid.conwidth); Cvar_SetValue(&r_conheight, vid.conheight); } vid.numpages = 2; // ?? Draw_AdjustConback(); vid.recalc_refdef = 1; }
void VID_zzz (void) { extern int nonwideconheight; vid.width = vid.conwidth = min(vid.conwidth, glConfig.vidWidth); vid.height = vid.conheight = min(vid.conheight, glConfig.vidHeight); // we need cap cvars, after resolution changed, here may be conwidth > width, so set cvars right Cvar_SetValue(&r_conwidth, r_conwidth.value); // must trigger callback which validate value Cvar_SetValue(&r_conheight, nonwideconheight); // must trigger callback which validate value vid.numpages = 2; Draw_AdjustConback (); #ifdef _WIN32 //fix the leftover Alt from any Alt-Tab or the like that switched us away ClearAllStates (); #endif vid.recalc_refdef = 1; }
void OnChange_r_con_xxx (cvar_t *var, char *string, qbool *cancel) { float scale = 1; if (var == &r_conwidth) { int width = Q_atoi(string); int height; width = max(320, width); //width &= 0xfff8; // make it a multiple of eight if (glConfig.vidWidth) vid.width = vid.conwidth = width = min(glConfig.vidWidth, width); else vid.conwidth = width; // issued from cmd line ? then do not set vid.width because code may relay what it 0 Cvar_SetValue(var, (float)width); if (VID_r_con_height_adjust(width, &height)) { VID_r_con_height_apply(height); } } else if (var == &r_conheight) { int height = Q_atoi(string); if (nonwideconheight==0) nonwideconheight=height; // save original conheight if (host_everything_loaded) { if (vid_wideaspect.integer) { nonwideconheight=height; scale = (4.0/3) / (16.0/10); //widescreen } else { scale = 1; } height = floor(height * scale + 0.5); //height &= 0xfff8; // make it a multiple of eight if (vid_wideaspect.value != 0 && vid_wideaspect_verbose.integer > 0) Com_Printf("vid_wideaspect enabled - conheight recalculated to %i\n", height); } else if (host_initialized && vid_wideaspect.integer) { scale = (16.0/10) / (4.0/3); // standard nonwideconheight = floor( height * scale + 0.5); } height = max(200, height); VID_r_con_height_apply(height); } else { *cancel = true; // hrm? return; } Draw_AdjustConback (); vid.recalc_refdef = 1; *cancel = true; }