Skip to content

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 tiles V_DrawStretchyFixedPatch(...) across the entire display, from left to right and/or from top to bottom depending on the arguments used. Has a V_DrawTiled*Patch(...,tilex,tiley) definition for every V_Draw*Patch(...) definition. Has both software and OpenGL renderer support.

  • New internal GUI-scale-fetching functions: V_GetGuiDup(vflags) and V_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, and V_PERPLAYER all come into play here).

  • New internal GUI-scale-calculating function: SCR_CalculateGuiDup(), which is run by SCR_Startup(), by SCR_Recalc(), and when changing any of the "gui_maxscale*" convars.

  • New constant: MAXGUISCALE, calculated at compile-time based on MAXVIDWIDTH/BASEVIDWIDTH and MAXVIDHEIGHT/BASEVIDHEIGHT. With MAXVID... at 1920x1200 and BASEVID... at 320x200, this makes MAXGUISCALE be set to 6.

  • vid.dupx and vid.dupy have been merged into a single vid.dup, as the "x" and "y" variants were set to be equal to each other anyway. This also applies to other vid.*dup* things, however functions that use these may still have separate "dupx" and "dupy" variables themselves, both set to vid.dup.

  • vid.fsmalldupx, vid.fsmalldupy, vid.fmeddupx, and vid.fmeddupy have been removed, as they were pretty unused and were always equivalent to vid.smalldup*FRACUNIT and vid.meddup*FRACUNIT (which can be easily calculated if needed). vid.fdup still exists, however.

  • vid.*dup takes the "gui_maxscale" variable into account. New vid.*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() and v.dupy() have been deprecated in favour of v.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, and V_MEDSCALEPATCH) to use.

  • V_DrawCroppedPatch(...) has been given V_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() and HU_DrawCrosshair2() no longer use V_DrawScaledPatch(...), but instead use V_DrawFixedPatch (along with V_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.

Edited by Zwip-Zwap Zapony

Merge request reports