diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 991d7216..90fca13b 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -1618,24 +1618,16 @@ get actual screen info */ int CL_GetScreenInfo( SCREENINFO *pscrinfo ) { + float scale_factor = hud_scale->value; + // setup screen info clgame.scrInfo.iSize = sizeof( clgame.scrInfo ); clgame.scrInfo.iFlags = SCRINFO_SCREENFLASH; - if( Cvar_VariableInteger( "hud_scale" )) + if( scale_factor && scale_factor != 1.0f) { - if( glState.width < 640 ) - { - // virtual screen space 320x200 - clgame.scrInfo.iWidth = 320; - clgame.scrInfo.iHeight = 200; - } - else - { - // virtual screen space 640x480 - clgame.scrInfo.iWidth = 640; - clgame.scrInfo.iHeight = 480; - } + clgame.scrInfo.iWidth = (float)glState.width / scale_factor; + clgame.scrInfo.iHeight = (float)glState.height / scale_factor; clgame.scrInfo.iFlags |= SCRINFO_STRETCHED; } else diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 1f7f53fa..6cc538e5 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -57,6 +57,7 @@ convar_t *cl_nosmooth; convar_t *cl_smoothtime; convar_t *cl_clockreset; convar_t *cl_fixtimerate; +convar_t *hud_scale; convar_t *cl_solid_players; convar_t *cl_draw_beams; convar_t *cl_updaterate; @@ -2560,7 +2561,7 @@ void CL_InitLocal( void ) cl_bmodelinterp = Cvar_Get( "cl_bmodelinterp", "1", FCVAR_ARCHIVE, "enable bmodel interpolation" ); cl_clockreset = Cvar_Get( "cl_clockreset", "0.1", FCVAR_ARCHIVE, "frametime delta maximum value before reset" ); cl_fixtimerate = Cvar_Get( "cl_fixtimerate", "7.5", FCVAR_ARCHIVE, "time in msec to client clock adjusting" ); - Cvar_Get( "hud_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" ); + hud_scale = Cvar_Get( "hud_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" ); Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" ); cl_showevents = Cvar_Get( "cl_showevents", "0", FCVAR_ARCHIVE, "show events playback" ); diff --git a/engine/client/client.h b/engine/client/client.h index c5f1068e..930d60ed 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -695,6 +695,7 @@ extern convar_t *cl_levelshot_name; extern convar_t *cl_draw_beams; extern convar_t *cl_clockreset; extern convar_t *cl_fixtimerate; +extern convar_t *hud_scale; extern convar_t *gl_showtextures; extern convar_t *cl_bmodelinterp; extern convar_t *cl_righthand;