Max GUI scale convars, internal GUI scale cleanup, and more
Added convars: "gui_maxscale", "gui_maxscale_crosshair", "gui_maxscale_singlescreen", "gui_maxscale_splitscreen", and "gui_squish_splitscreen".
- "gui_maxscale" sets a maximum integer scale multiplier for HUD/GUI elements without the
V_PERPLAYER
video flag. (This is not a fraction of the default GUI scale for the current window size, but rather just a direct upper cap.) - "gui_maxscale_crosshair" affects only the Ringslinger crosshair. This can be set to be bigger than "gui_maxscale", but if unset, it inherits "gui_maxscale". (Note that this affects both players in splitscreen; I didn't particularly find it worth it to make a second convar for the second player just for this.)
- "gui_maxscale_singlescreen" affects HUD elements with
V_PERPLAYER
while not in splitscreen mode. This can be set to be bigger than "gui_maxscale", but if unset, it inherits "gui_maxscale". - "gui_maxscale_splitscreen" affects HUD elements with
V_PERPLAYER
while in splitscreen mode. This cannot be set to be bigger than "gui_maxscale_singlescreen", but you shouldn't want the HUD to be BIGGER in splitscreen mode, so that's probably fine. - "gui_squish_splitscreen" chooses whether or not to vertically squish
V_PERPLAYER
elements to half height while in splitscreen mode. Disabling this pairs well with setting a smaller-than-default "gui_maxscale_splitscreen" value.
The "maxscale" convars can be "Default" (0) or any integer from 1 up to and including 6 (or rather, MAXGUISCALE
, which is 6). The "squish" convar can be "Yes" or "No", defaulting to "Yes".
The default values of these convars match how SRB2 currently looks as of v2.2.6.
Internal GUI scale cleanup:
-
New internal GUI-drawing function:
V_DrawTiledStretchyFixedPatch(...,tilex,tiley)
, automatically tilesV_DrawStretchyFixedPatch(...)
across the entire display, from left to right and/or from top to bottom depending on the arguments used. Has aV_DrawTiled*Patch(...,tilex,tiley)
definition for everyV_Draw*Patch(...)
definition. Has both software and OpenGL renderer support. -
New internal GUI-scale-fetching functions:
V_GetGuiDup(vflags)
andV_GetGuiFDup(vflags)
, return the appropriate GUI scale, based on the "gui_maxscale*" convar settings, for the video flags given (V_NOSCALEPATCH
,V_SMALLSCALEPATCH
,V_MEDSCALEPATCH
, andV_PERPLAYER
all come into play here). -
New internal GUI-scale-calculating function:
SCR_CalculateGuiDup()
, which is run bySCR_Startup()
, bySCR_Recalc()
, and when changing any of the "gui_maxscale*" convars. -
New constant:
MAXGUISCALE
, calculated at compile-time based onMAXVIDWIDTH/BASEVIDWIDTH
andMAXVIDHEIGHT/BASEVIDHEIGHT
. WithMAXVID...
at 1920x1200 andBASEVID...
at 320x200, this makesMAXGUISCALE
be set to 6. -
vid.dupx
andvid.dupy
have been merged into a singlevid.dup
, as the "x" and "y" variants were set to be equal to each other anyway. This also applies to othervid.*dup*
things, however functions that use these may still have separate "dupx" and "dupy" variables themselves, both set tovid.dup
. -
vid.fsmalldupx
,vid.fsmalldupy
,vid.fmeddupx
, andvid.fmeddupy
have been removed, as they were pretty unused and were always equivalent tovid.smalldup*FRACUNIT
andvid.meddup*FRACUNIT
(which can be easily calculated if needed).vid.fdup
still exists, however. -
vid.*dup
takes the "gui_maxscale" variable into account. Newvid.*dup_full
things have been in made in the source code, for cases where one doesn't want "gui_maxscale*" taken into account at all, however there's currently no video flag for GUI-drawing functions to make use of this. (I do not plan on adding such a video flag myself, but it should be easy to implement if it's made at some point by deprecating other video flags.)
Miscellaneous things:
-
For Lua,
v.dupx()
andv.dupy()
have been deprecated in favour ofv.getGuiDup([vflags])
. This can be used to get the GUI scale based on the new convars (except for "gui_maxscale_crosshair"), using the optional "vflags" argument to choose which scale convar (V_PERPLAYER
) and scale variant (V_NOSCALEPATCH
,V_SMALLSCALEPATCH
, andV_MEDSCALEPATCH
) to use. -
V_DrawCroppedPatch(...)
has been givenV_PERPLAYER
support in OpenGL (it was already supported with the software renderer), and given a "vscale" argument to allow separate X and Y scales, however neither of those things currently mean anything important as it's only used in menus and isn't exposed to Lua yet. -
V_DrawFill(...)
has received proper splitscreen mode support for fullscreen fills (e.g. the Hide & Seek blindfold) regardless of the aspect ratio, resolution, and GUI scale, now working even with non-"green" resolutions. -
HU_DrawCrosshair()
andHU_DrawCrosshair2()
no longer useV_DrawScaledPatch(...)
, but instead useV_DrawFixedPatch
(along withV_NOSCALE
) to allow crosshairs to be scaled by "gui_maxscale_crosshair". -
Several tweaks and the like to make some things play more nicely with different GUI scales
-
Plenty of the code done here has support for potential future 4-player quadscreen, locked behind
#ifdef QUADS
, because that there were already a (very few) things locked behind that as well.
TL;DR:
For players: Added "gui_maxscale", "gui_maxscale_crosshair", "gui_maxscale_singlescreen", "gui_maxscale_splitscreen", and "gui_squish_splitscreen" convars.
For modders: In Lua HUD stuff, deprecated v.dupx()
and v.dupy()
in favour of v.getGuiDup([vflags])
.
For hardcoders: vid.dupx
and vid.dupy
are now just vid.dup
. vid.dup
takes "gui_maxscale" into account, vid.dup_full
ignores "gui_maxscale*". V_DrawTiled*Patch(...)
is to be used for tiled drawing. V_GetGuiDup(vflags)
is to be used to fetch the appropriate vid.*dup*
value when you want to get the appropriate one based on video flags.