Browse Source

client: add hud_allow_hd cvar that increases available HUD spritesheet resolutions up to 1280 and 2560

hl25hud
Alibek Omarov 11 months ago
parent
commit
ed88ebf6d5
  1. 5
      cl_dll/ammo.cpp
  2. 21
      cl_dll/cl_util.h
  3. 6
      cl_dll/hud.cpp
  4. 1
      cl_dll/hud.h
  5. 7
      cl_dll/util.cpp

5
cl_dll/ammo.cpp

@ -75,10 +75,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) @@ -75,10 +75,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
{
int i, iRes;
if( ScreenWidth < 640 )
iRes = 320;
else
iRes = 640;
iRes = GetSpriteRes( ScreenWidth, ScreenHeight );
char sz[256];

21
cl_dll/cl_util.h

@ -153,6 +153,27 @@ inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( @@ -153,6 +153,27 @@ inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex(
#define Q_min(a, b) (((a) < (b)) ? (a) : (b))
#define fabs(x) ((x) > 0 ? (x) : 0 - (x))
inline int GetSpriteRes( int width, int height )
{
int i;
if( width < 640 )
i = 320;
else if( width < 1280 || !gHUD.m_pAllowHD->value )
i = 640;
else
{
if( height <= 720 )
i = 640;
else if( width <= 2560 || height <= 1600 )
i = 1280;
else
i = 2560;
}
return i;
}
void ScaleColors( int &r, int &g, int &b, int a );
#define DotProduct(x, y) ((x)[0] * (y)[0] + (x)[1] * (y)[1] + (x)[2] * (y)[2])

6
cl_dll/hud.cpp

@ -379,6 +379,7 @@ void CHud::Init( void ) @@ -379,6 +379,7 @@ void CHud::Init( void )
default_fov = CVAR_CREATE( "default_fov", "90", FCVAR_ARCHIVE );
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
m_pAllowHD = CVAR_CREATE ( "hud_allow_hd", "1", FCVAR_ARCHIVE );
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
cl_viewbob = CVAR_CREATE( "cl_viewbob", "0", FCVAR_ARCHIVE );
@ -481,10 +482,7 @@ void CHud::VidInit( void ) @@ -481,10 +482,7 @@ void CHud::VidInit( void )
m_hsprLogo = 0;
m_hsprCursor = 0;
if( ScreenWidth < 640 )
m_iRes = 320;
else
m_iRes = 640;
m_iRes = GetSpriteRes( ScreenWidth, ScreenHeight );
// Only load this once
if( !m_pSpriteList )

1
cl_dll/hud.h

@ -557,6 +557,7 @@ public: @@ -557,6 +557,7 @@ public:
int m_iRes;
cvar_t *m_pCvarStealMouse;
cvar_t *m_pCvarDraw;
cvar_t *m_pAllowHD;
int m_iFontHeight;
int DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b );

7
cl_dll/util.cpp

@ -123,14 +123,9 @@ void VectorMA( const float *veca, float scale, const float *vecb, float *vecc ) @@ -123,14 +123,9 @@ void VectorMA( const float *veca, float scale, const float *vecb, float *vecc )
HSPRITE LoadSprite( const char *pszName )
{
int i;
int i = GetSpriteRes( ScreenWidth, ScreenHeight );
char sz[256];
if( ScreenWidth < 640 )
i = 320;
else
i = 640;
sprintf( sz, pszName, i );
return SPR_Load( sz );

Loading…
Cancel
Save