mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-24 02:40:35 +01:00
client: apply HL25 HUD style if hud_allow_hd is set to 1 and there are HD spritesheets are available
This commit is contained in:
parent
5a315a05ea
commit
cd80a6b4bb
@ -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 )
|
||||
{
|
||||
|
@ -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 )
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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:
|
||||
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:
|
||||
{
|
||||
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
|
||||
|
||||
|
@ -153,6 +153,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…
Reference in New Issue
Block a user