From 869ce24922b6bc9b317610ab3f3e7ba7850880ac Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Sat, 21 Jun 2014 18:54:57 +0200 Subject: [PATCH] Hide console scaling behin gl_consolescale With this change it's possible to scale the HUD but not the console. And vice versa. --- README | 9 +++++++-- src/client/cl_console.c | 6 +++--- src/client/cl_screen.c | 39 ++++++++++++++++++++++++++++++++++++-- src/client/header/screen.h | 1 + 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/README b/README index 71c8f080..24a7f49c 100644 --- a/README +++ b/README @@ -530,8 +530,13 @@ the most common questions are answered. followd by a vid_restart. Please note that very old graphic cards may not support antialiasing at all. -- If you want to scale the HUD (e.g. for high resoltutions), set the - gl_hudscale cvar to a value > 1 (2.0 works well). +- If you want to scale the HUD (e.g. for high resolutions), set the + gl_hudscale cvar to -1. To specify the scale factor by hand, set the + cvar to a value > 0. + +- If you want to scale the console (e.g. for high resolutions), set the + gl_consolescale cvar to -1. To specify the scale factor by hand, set the + cvar to a value > 0. 5.2 Input --------- diff --git a/src/client/cl_console.c b/src/client/cl_console.c index 5f97e1c9..e69338c5 100644 --- a/src/client/cl_console.c +++ b/src/client/cl_console.c @@ -487,7 +487,7 @@ Con_DrawInput(void) return; } - scale = SCR_GetHUDScale(); + scale = SCR_GetConsoleScale(); text = key_lines[edit_line]; /* add the cursor frame */ @@ -529,7 +529,7 @@ Con_DrawNotify(void) float scale; v = 0; - scale = SCR_GetHUDScale(); + scale = SCR_GetConsoleScale(); for (i = con.current - NUM_CON_TIMES + 1; i <= con.current; i++) { @@ -621,7 +621,7 @@ Con_DrawConsole(float frac) time_t t; struct tm *today; - scale = SCR_GetHUDScale(); + scale = SCR_GetConsoleScale(); lines = viddef.height * frac; if (lines <= 0) diff --git a/src/client/cl_screen.c b/src/client/cl_screen.c index efae8b19..9de17e44 100644 --- a/src/client/cl_screen.c +++ b/src/client/cl_screen.c @@ -51,6 +51,7 @@ cvar_t *scr_graphshift; cvar_t *scr_drawall; cvar_t *gl_hudscale; /* named for consistency with R1Q2 */ +cvar_t *gl_consolescale; typedef struct { @@ -257,7 +258,7 @@ SCR_DrawCenterString(void) scr_erase_center = 0; start = scr_centerstring; - scale = SCR_GetHUDScale(); + scale = SCR_GetConsoleScale(); if (scr_center_lines <= 4) { @@ -431,6 +432,7 @@ SCR_Init(void) scr_graphshift = Cvar_Get("graphshift", "0", 0); scr_drawall = Cvar_Get("scr_drawall", "0", 0); gl_hudscale = Cvar_Get("gl_hudscale", "1", CVAR_ARCHIVE); + gl_consolescale = Cvar_Get("gl_consolescale", "1", CVAR_ARCHIVE); /* register our commands */ Cmd_AddCommand("timerefresh", SCR_TimeRefresh_f); @@ -1581,7 +1583,7 @@ SCR_DrawCrosshair(void) } float -SCR_GetHUDScale(void) +SCR_GetScale(void) { float scale; @@ -1609,3 +1611,36 @@ SCR_GetHUDScale(void) return scale; } +float +SCR_GetHUDScale(void) +{ + float scale; + + if (gl_hudscale->value < 0) + { + scale = SCR_GetScale(); + } + else + { + scale = gl_hudscale->value; + } + + return scale; +} + +float +SCR_GetConsoleScale(void) +{ + float scale; + + if (gl_consolescale->value < 0) + { + scale = SCR_GetScale(); + } + else + { + scale = gl_consolescale->value; + } + + return scale; +} diff --git a/src/client/header/screen.h b/src/client/header/screen.h index a31b6116..f4aa4658 100644 --- a/src/client/header/screen.h +++ b/src/client/header/screen.h @@ -68,5 +68,6 @@ void SCR_FinishCinematic(void); void SCR_DrawCrosshair(void); float SCR_GetHUDScale(void); +float SCR_GetConsoleScale(void); #endif