Browse Source

client: hud: detect the availability of HD spritesheets

hl25hud
Alibek Omarov 11 months ago
parent
commit
9119ab812f
  1. 2
      cl_dll/cl_util.h
  2. 17
      cl_dll/hud.cpp
  3. 1
      cl_dll/hud.h

2
cl_dll/cl_util.h

@ -171,7 +171,7 @@ inline int GetSpriteRes( int width, int height ) @@ -171,7 +171,7 @@ inline int GetSpriteRes( int width, int height )
i = 2560;
}
return i;
return Q_min( i, gHUD.m_iMaxRes );
}
void ScaleColors( int &r, int &g, int &b, int a );

17
cl_dll/hud.cpp

@ -482,13 +482,28 @@ void CHud::VidInit( void ) @@ -482,13 +482,28 @@ void CHud::VidInit( void )
m_hsprLogo = 0;
m_hsprCursor = 0;
// a1ba: don't break the loading order here and
// don't cause memory leak but check
// maximum HUD sprite resolution we have
m_iMaxRes = 640;
client_sprite_t *pSpriteList = m_pSpriteList ? m_pSpriteList :
SPR_GetList( "sprites/hud.txt", &m_iSpriteCountAllRes );
if( pSpriteList )
{
for( int i = 0; i < m_iSpriteCountAllRes; i++ )
{
if( m_iMaxRes < pSpriteList[i].iRes )
m_iMaxRes = pSpriteList[i].iRes;
}
}
m_iRes = GetSpriteRes( ScreenWidth, ScreenHeight );
// Only load this once
if( !m_pSpriteList )
{
// we need to load the hud.txt, and all sprites within
m_pSpriteList = SPR_GetList( "sprites/hud.txt", &m_iSpriteCountAllRes );
m_pSpriteList = pSpriteList;
if( m_pSpriteList )
{

1
cl_dll/hud.h

@ -555,6 +555,7 @@ public: @@ -555,6 +555,7 @@ public:
int m_iFOV;
int m_Teamplay;
int m_iRes;
int m_iMaxRes;
cvar_t *m_pCvarStealMouse;
cvar_t *m_pCvarDraw;
cvar_t *m_pAllowHD;

Loading…
Cancel
Save