mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
screen: auto-scale the HUD when gl_hudscale < 0.
This commit is contained in:
parent
9be6a7ec46
commit
1d81f2e2b6
4 changed files with 36 additions and 13 deletions
|
@ -59,9 +59,6 @@ SetStringHighBit(char *s)
|
|||
|
||||
#define DISPLAY_ITEMS 17
|
||||
|
||||
// from r_main.c
|
||||
extern cvar_t *gl_hudscale;
|
||||
|
||||
void
|
||||
CL_DrawInventory(void)
|
||||
{
|
||||
|
@ -80,7 +77,7 @@ CL_DrawInventory(void)
|
|||
num = 0;
|
||||
selected_num = 0;
|
||||
|
||||
float scale = gl_hudscale->value;
|
||||
float scale = SCR_GetHUDScale();
|
||||
|
||||
for (i = 0; i < MAX_ITEMS; i++)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,8 @@ cvar_t *scr_graphscale;
|
|||
cvar_t *scr_graphshift;
|
||||
cvar_t *scr_drawall;
|
||||
|
||||
cvar_t *gl_hudscale; /* named for consistency with R1Q2 */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
|
@ -423,9 +425,9 @@ SCR_Init(void)
|
|||
{
|
||||
scr_viewsize = Cvar_Get("viewsize", "100", CVAR_ARCHIVE);
|
||||
scr_conspeed = Cvar_Get("scr_conspeed", "3", 0);
|
||||
scr_centertime = Cvar_Get("scr_centertime", "2.5", 0);
|
||||
scr_showturtle = Cvar_Get("scr_showturtle", "0", 0);
|
||||
scr_showpause = Cvar_Get("scr_showpause", "1", 0);
|
||||
scr_centertime = Cvar_Get("scr_centertime", "2.5", 0);
|
||||
scr_netgraph = Cvar_Get("netgraph", "0", 0);
|
||||
scr_timegraph = Cvar_Get("timegraph", "0", 0);
|
||||
scr_debuggraph = Cvar_Get("debuggraph", "0", 0);
|
||||
|
@ -433,6 +435,7 @@ SCR_Init(void)
|
|||
scr_graphscale = Cvar_Get("graphscale", "1", 0);
|
||||
scr_graphshift = Cvar_Get("graphshift", "0", 0);
|
||||
scr_drawall = Cvar_Get("scr_drawall", "0", 0);
|
||||
gl_hudscale = Cvar_Get("gl_hudscale", "1", CVAR_ARCHIVE);
|
||||
|
||||
/* register our commands */
|
||||
Cmd_AddCommand("timerefresh", SCR_TimeRefresh_f);
|
||||
|
@ -1012,9 +1015,6 @@ SCR_TouchPics(void)
|
|||
}
|
||||
}
|
||||
|
||||
// from r_main.c
|
||||
extern cvar_t *gl_hudscale;
|
||||
|
||||
void
|
||||
SCR_ExecuteLayoutString(char *s)
|
||||
{
|
||||
|
@ -1025,7 +1025,7 @@ SCR_ExecuteLayoutString(char *s)
|
|||
int index;
|
||||
clientinfo_t *ci;
|
||||
|
||||
float scale = gl_hudscale->value;
|
||||
float scale = SCR_GetHUDScale();
|
||||
|
||||
if ((cls.state != ca_active) || !cl.refresh_prepped)
|
||||
{
|
||||
|
@ -1585,3 +1585,31 @@ SCR_DrawCrosshair(void)
|
|||
crosshair_pic);
|
||||
}
|
||||
|
||||
float
|
||||
SCR_GetHUDScale(void)
|
||||
{
|
||||
float scale;
|
||||
|
||||
if (gl_hudscale->value < 0)
|
||||
{
|
||||
int i = viddef.width / 640;
|
||||
|
||||
while (i > viddef.height / 240)
|
||||
{
|
||||
i--;
|
||||
}
|
||||
if (i < 1)
|
||||
{
|
||||
i = 1;
|
||||
}
|
||||
|
||||
scale = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = gl_hudscale->value;
|
||||
}
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,4 +65,6 @@ void SCR_RunCinematic(void);
|
|||
void SCR_StopCinematic(void);
|
||||
void SCR_FinishCinematic(void);
|
||||
|
||||
float SCR_GetHUDScale(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -141,8 +141,6 @@ cvar_t *gl_anisotropic_avail;
|
|||
cvar_t *gl_lockpvs;
|
||||
cvar_t *gl_msaa_samples;
|
||||
|
||||
cvar_t *gl_hudscale;
|
||||
|
||||
cvar_t *vid_fullscreen;
|
||||
cvar_t *vid_gamma;
|
||||
|
||||
|
@ -1020,8 +1018,6 @@ R_Register(void)
|
|||
gl_customheight = Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE);
|
||||
gl_msaa_samples = Cvar_Get ( "gl_msaa_samples", "0", CVAR_ARCHIVE );
|
||||
|
||||
gl_hudscale = Cvar_Get ("gl_hudscale", "1", CVAR_ARCHIVE);
|
||||
|
||||
#ifdef RETEXTURE
|
||||
gl_retexturing = Cvar_Get("gl_retexturing", "1", CVAR_ARCHIVE);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue