Add vid_baseheight and vid_minsize cvars for TCs unhappy with vid_conheight to put in their default.cfg, instead of them feeling a need to force user settings.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6266 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2022-06-19 15:17:48 +00:00
parent c39c4d0255
commit 1068a62d75
3 changed files with 39 additions and 6 deletions

View file

@ -58,7 +58,9 @@ extern cvar_t gl_conback;
extern cvar_t gl_font, con_textfont; extern cvar_t gl_font, con_textfont;
extern cvar_t r_font_postprocess_outline; extern cvar_t r_font_postprocess_outline;
extern cvar_t gl_screenangle; extern cvar_t gl_screenangle;
extern cvar_t vid_minsize;
extern cvar_t vid_conautoscale; extern cvar_t vid_conautoscale;
extern cvar_t vid_baseheight;
extern cvar_t vid_conheight; extern cvar_t vid_conheight;
extern cvar_t vid_conwidth; extern cvar_t vid_conwidth;
extern cvar_t con_textsize; extern cvar_t con_textsize;
@ -169,6 +171,8 @@ void R2D_Shutdown(void)
Cvar_Unhook(&gl_screenangle); Cvar_Unhook(&gl_screenangle);
Cvar_Unhook(&vid_conheight); Cvar_Unhook(&vid_conheight);
Cvar_Unhook(&vid_conwidth); Cvar_Unhook(&vid_conwidth);
Cvar_Unhook(&vid_baseheight);
Cvar_Unhook(&vid_minsize);
Cvar_Unhook(&crosshair); Cvar_Unhook(&crosshair);
Cvar_Unhook(&crosshairimage); Cvar_Unhook(&crosshairimage);
@ -444,6 +448,8 @@ void R2D_Init(void)
Cvar_Hook(&gl_screenangle, R2D_ScreenAngle_Callback); Cvar_Hook(&gl_screenangle, R2D_ScreenAngle_Callback);
Cvar_Hook(&vid_conheight, R2D_Conheight_Callback); Cvar_Hook(&vid_conheight, R2D_Conheight_Callback);
Cvar_Hook(&vid_conwidth, R2D_Conwidth_Callback); Cvar_Hook(&vid_conwidth, R2D_Conwidth_Callback);
Cvar_Hook(&vid_baseheight, R2D_Conautoscale_Callback);
Cvar_Hook(&vid_minsize, R2D_Conautoscale_Callback);
Cvar_Hook(&crosshair, R2D_Crosshair_Callback); Cvar_Hook(&crosshair, R2D_Crosshair_Callback);
Cvar_Hook(&crosshairimage, R2D_CrosshairImage_Callback); Cvar_Hook(&crosshairimage, R2D_CrosshairImage_Callback);
@ -1317,12 +1323,28 @@ void R2D_Console_Resize(void)
} }
if (!cwidth && !cheight) if (!cwidth && !cheight)
{
int i = 0, nh;
int biggest = 0;
//find the biggest artwork size that won't get minified
for (i = 0; i < countof(vid_baseheight.vec4); i++)
if (biggest < vid_baseheight.vec4[i] && vid_baseheight.vec4[i] < vid.rotpixelheight && vid_baseheight.vec4[i] >= vid_minsize.vec4[1])
biggest = vid_baseheight.vec4[i];
if (biggest)
{
nh = vid.rotpixelheight;
while ((nh>>1) >= biggest)
nh >>= 1;
cheight = nh;
}
else
{ {
if (vid.dpi_y) if (vid.dpi_y)
cheight = (480 * 96) / vid.dpi_y; cheight = (480 * 96) / vid.dpi_y;
else else
cheight = 480; cheight = 480;
} }
}
if (cheight && !cwidth && vid.rotpixelheight) if (cheight && !cwidth && vid.rotpixelheight)
cwidth = (cheight*vid.rotpixelwidth)/vid.rotpixelheight; cwidth = (cheight*vid.rotpixelwidth)/vid.rotpixelheight;
if (cwidth && !cheight && vid.rotpixelwidth) if (cwidth && !cheight && vid.rotpixelwidth)
@ -1336,6 +1358,12 @@ void R2D_Console_Resize(void)
cwidth*=xratio; cwidth*=xratio;
cheight*=yratio; cheight*=yratio;
//never go lower than the mod's minimum, UI elements would end up off-screen.
if (cwidth < vid_minsize.vec4[0])
cwidth = vid_minsize.vec4[0];
if (cheight < vid_minsize.vec4[1])
cheight = vid_minsize.vec4[1];
//the engine has its own requirements too, sorry, though its unlikely for mods go lower.
if (cwidth < 320) if (cwidth < 320)
cwidth = 320; cwidth = 320;
if (cheight < 200) if (cheight < 200)

View file

@ -277,6 +277,9 @@ cvar_t vid_conautoscale = CVARAF ("vid_conautoscale", "2",
cvar_t vid_conautoscale = CVARAFD ("vid_conautoscale", "0", cvar_t vid_conautoscale = CVARAFD ("vid_conautoscale", "0",
"scr_conscale"/*qs*/ /*"vid_conscale"ez*/, CVAR_ARCHIVE | CVAR_RENDERERCALLBACK, "Changes the 2d scale, including hud, console, and fonts. To specify an explicit font size, divide the desired 'point' size by 8 to get the scale. High values will be clamped to maintain at least a 320*200 virtual size."); "scr_conscale"/*qs*/ /*"vid_conscale"ez*/, CVAR_ARCHIVE | CVAR_RENDERERCALLBACK, "Changes the 2d scale, including hud, console, and fonts. To specify an explicit font size, divide the desired 'point' size by 8 to get the scale. High values will be clamped to maintain at least a 320*200 virtual size.");
#endif #endif
cvar_t vid_baseheight = CVARD ("vid_baseheight", "", "Specifies a mod's target height and used only when the 2d scale is not otherwise forced. Unlike vid_conheight the size is not fixed and will be padded to avoid inconsistent filtering.");
cvar_t vid_minsize = CVARFD ("vid_minsize", "320 200",
CVAR_NOTFROMSERVER, "Specifies a mod's minimum virtual size.");
cvar_t vid_conheight = CVARF ("vid_conheight", "0", cvar_t vid_conheight = CVARF ("vid_conheight", "0",
CVAR_ARCHIVE); CVAR_ARCHIVE);
cvar_t vid_conwidth = CVARF ("vid_conwidth", "0", cvar_t vid_conwidth = CVARF ("vid_conwidth", "0",
@ -791,9 +794,11 @@ void Renderer_Init(void)
Cvar_Register (&vid_bpp, VIDCOMMANDGROUP); Cvar_Register (&vid_bpp, VIDCOMMANDGROUP);
Cvar_Register (&vid_depthbits, VIDCOMMANDGROUP); Cvar_Register (&vid_depthbits, VIDCOMMANDGROUP);
Cvar_Register (&vid_baseheight, VIDCOMMANDGROUP);
Cvar_Register (&vid_conwidth, VIDCOMMANDGROUP); Cvar_Register (&vid_conwidth, VIDCOMMANDGROUP);
Cvar_Register (&vid_conheight, VIDCOMMANDGROUP); Cvar_Register (&vid_conheight, VIDCOMMANDGROUP);
Cvar_Register (&vid_conautoscale, VIDCOMMANDGROUP); Cvar_Register (&vid_conautoscale, VIDCOMMANDGROUP);
Cvar_Register (&vid_minsize, VIDCOMMANDGROUP);
Cvar_Register (&vid_triplebuffer, VIDCOMMANDGROUP); Cvar_Register (&vid_triplebuffer, VIDCOMMANDGROUP);
Cvar_Register (&vid_width, VIDCOMMANDGROUP); Cvar_Register (&vid_width, VIDCOMMANDGROUP);

View file

@ -7606,11 +7606,11 @@ void InfoBuf_Print(infobuf_t *info, const char *lineprefix)
val = info->keys[k].value; val = info->keys[k].value;
if (info->keys[k].size != strlen(info->keys[k].value)) if (info->keys[k].size != strlen(info->keys[k].value))
Con_Printf ("%s%-20s%s<BINARY %u BYTES>\n", lineprefix, key, partial, (unsigned int)info->keys[k].size); Con_Printf ("%s"S_COLOR_GREEN"%-20s"S_COLOR_RED"%s<BINARY %u BYTES>\n", lineprefix, key, partial, (unsigned int)info->keys[k].size);
else if (info->keys[k].size > 64 || strchr(val, '\n') || strchr(val, '\r') || strchr(val, '\t')) else if (info->keys[k].size > 64 || strchr(val, '\n') || strchr(val, '\r') || strchr(val, '\t'))
Con_Printf ("%s%-20s%s<%u BYTES>\n", lineprefix, key, partial, (unsigned int)info->keys[k].size); Con_Printf ("%s"S_COLOR_GREEN"%-20s"S_COLOR_RED"%s<%u BYTES>\n", lineprefix, key, partial, (unsigned int)info->keys[k].size);
else else
Con_Printf ("%s%-20s%s%s\n", lineprefix, key, partial, val); Con_Printf ("%s"S_COLOR_GREEN"%-20s"S_COLOR_WHITE"%s%s\n", lineprefix, key, partial, val);
} }
} }
void InfoBuf_Enumerate (infobuf_t *info, void *ctx, void(*cb)(void *ctx, const char *key, const char *value)) void InfoBuf_Enumerate (infobuf_t *info, void *ctx, void(*cb)(void *ctx, const char *key, const char *value))