Browse Source

client: apply HL25 HUD style if hud_allow_hd is set to 1 and there are HD spritesheets are available

hl25hud
Alibek Omarov 11 months ago
parent
commit
de43a7bb9e
  1. 2
      cl_dll/ammohistory.cpp
  2. 8
      cl_dll/battery.cpp
  3. 4
      cl_dll/health.cpp
  4. 9
      cl_dll/hud.h
  5. 2
      cl_dll/hud_redraw.cpp

2
cl_dll/ammohistory.cpp

@ -142,7 +142,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) @@ -142,7 +142,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
// do not draw black console string
if( !( ( hud_textmode->value == 2 ) && ( scale < 200 ) ) )
// Draw the number
gHUD.DrawHudNumberString( xpos - 10, ypos, xpos - 100, rgAmmoHistory[i].iCount, r, g, b );
gHUD.DrawHudNumberString( xpos - 14, ypos, xpos - 104, rgAmmoHistory[i].iCount, r, g, b );
}
else if( rgAmmoHistory[i].type == HISTSLOT_WEAP )
{

8
cl_dll/battery.cpp

@ -109,7 +109,11 @@ int CHudBattery::Draw( float flTime ) @@ -109,7 +109,11 @@ int CHudBattery::Draw( float flTime )
int iOffset = ( m_prc1->bottom - m_prc1->top ) / 6;
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
x = ScreenWidth / 5;
if( gHUD.IsHL25( )) // a1ba: HL25 style
x = ( m_prc1->right - m_prc1->left ) * 3;
else
x = ScreenWidth / 5;
// make sure we have the right sprite handles
if( !m_hSprite1 )
@ -127,7 +131,7 @@ int CHudBattery::Draw( float flTime ) @@ -127,7 +131,7 @@ int CHudBattery::Draw( float flTime )
}
x += ( m_prc1->right - m_prc1->left );
x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b );
x = gHUD.DrawHudNumber( x, y + gHUD.m_iHudNumbersYOffset, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b );
return 1;
}

4
cl_dll/health.cpp

@ -226,14 +226,14 @@ int CHudHealth::Draw( float flTime ) @@ -226,14 +226,14 @@ int CHudHealth::Draw( float flTime )
x = CrossWidth + HealthWidth / 2;
x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b );
x = gHUD.DrawHudNumber( x, y + gHUD.m_iHudNumbersYOffset, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b );
x += HealthWidth / 2;
int iHeight = gHUD.m_iFontHeight;
int iWidth = HealthWidth / 10;
UnpackRGB( r, g, b, RGB_YELLOWISH );
FillRGBA( x, y, iWidth, iHeight, r, g, b, a );
FillRGBA( x, y + gHUD.m_iHudNumbersYOffset, iWidth, iHeight, r, g, b, a );
}
DrawDamage( flTime );

9
cl_dll/hud.h

@ -29,6 +29,7 @@ @@ -29,6 +29,7 @@
#include "wrect.h"
#include "cl_dll.h"
#include "ammo.h"
#include "cvardef.h"
#define DHN_DRAWZERO 1
#define DHN_2DIGITS 2
@ -556,6 +557,7 @@ public: @@ -556,6 +557,7 @@ public:
int m_Teamplay;
int m_iRes;
int m_iMaxRes;
int m_iHudNumbersYOffset;
cvar_t *m_pCvarStealMouse;
cvar_t *m_pCvarDraw;
cvar_t *m_pAllowHD;
@ -587,6 +589,13 @@ public: @@ -587,6 +589,13 @@ public:
{
return m_rgrcRects[index];
}
inline bool IsHL25( void )
{
// a1ba: only HL25 have higher resolution HUD spritesheets
// and only accept HUD style changes if user has allowed HD sprites
return m_iMaxRes > 640 && m_pAllowHD->value;
}
int GetSpriteIndex( const char *SpriteName ); // gets a sprite index, for use in the m_rghSprites[] array

2
cl_dll/hud_redraw.cpp

@ -148,6 +148,8 @@ int CHud::Redraw( float flTime, int intermission ) @@ -148,6 +148,8 @@ int CHud::Redraw( float flTime, int intermission )
// if no redrawing is necessary
// return 0;
m_iHudNumbersYOffset = IsHL25() ? m_iFontHeight * 0.2 : 0;
if( m_pCvarDraw->value )
{
HUDLIST *pList = m_pHudList;

Loading…
Cancel
Save