Rework hud_scale. Now it's detects maximum scale factor for user's screen.

This commit is contained in:
a1batross 2016-10-26 15:39:09 +03:00
parent 916568dee1
commit 59be663e5d
1 changed files with 8 additions and 6 deletions

View File

@ -250,8 +250,8 @@ CHud :: ~CHud()
void CHud :: VidInit( void )
{
m_scrinfo.iSize = sizeof(m_scrinfo);
GetScreenInfo(&m_scrinfo);
m_scrinfo.iSize = sizeof( m_scrinfo );
GetScreenInfo( &m_scrinfo );
m_truescrinfo.iWidth = CVAR_GET_FLOAT("width");
m_truescrinfo.iHeight = CVAR_GET_FLOAT("height");
@ -263,19 +263,21 @@ void CHud :: VidInit( void )
m_hsprLogo = 0;
if( TrueWidth < 640 )
float maxScale = (float)TrueWidth / 640.0f;
if( CVAR_GET_FLOAT("hud_scale") > maxScale )
{
gEngfuncs.Cvar_SetValue("hud_scale", TrueWidth / 640.0f );
gEngfuncs.Cvar_SetValue( "hud_scale", maxScale );
gEngfuncs.Con_Printf("^3Maximum scale factor reached. Reset: %f\n", maxScale );
GetScreenInfo( &m_scrinfo );
}
GetScreenInfo(&m_scrinfo);
m_flScale = CVAR_GET_FLOAT( "hud_scale" );
// give a real values to other code. It's not anymore an actual CVar value
if( m_flScale == 0.0f )
m_flScale = 1.0f;
m_iRes = 640;
// Only load this once