mirror of https://github.com/FWGS/hlsdk-xash3d
Do not draw battery indicator and delimiter.
This commit is contained in:
parent
e5a1902661
commit
9f381a7e28
|
@ -71,63 +71,5 @@ int CHudBattery::MsgFunc_Battery( const char *pszName, int iSize, void *pbuf )
|
||||||
|
|
||||||
int CHudBattery::Draw( float flTime )
|
int CHudBattery::Draw( float flTime )
|
||||||
{
|
{
|
||||||
if( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
int r, g, b, x, y, a;
|
|
||||||
wrect_t rc;
|
|
||||||
|
|
||||||
rc = *m_prc2;
|
|
||||||
rc.top += m_iHeight * ( (float)( 100 - ( Q_min( 100, m_iBat ) ) ) * 0.01f ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
|
|
||||||
|
|
||||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
|
||||||
|
|
||||||
if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
// Has health changed? Flash the health #
|
|
||||||
if( m_fFade )
|
|
||||||
{
|
|
||||||
if( m_fFade > FADE_TIME )
|
|
||||||
m_fFade = FADE_TIME;
|
|
||||||
|
|
||||||
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f );
|
|
||||||
if( m_fFade <= 0 )
|
|
||||||
{
|
|
||||||
a = 128;
|
|
||||||
m_fFade = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fade the health number back to dim
|
|
||||||
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
a = MIN_ALPHA;
|
|
||||||
|
|
||||||
ScaleColors( r, g, b, a );
|
|
||||||
|
|
||||||
int iOffset = ( m_prc1->bottom - m_prc1->top ) / 6;
|
|
||||||
|
|
||||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
|
|
||||||
x = ScreenWidth / 5;
|
|
||||||
|
|
||||||
// make sure we have the right sprite handles
|
|
||||||
if( !m_hSprite1 )
|
|
||||||
m_hSprite1 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_empty" ) );
|
|
||||||
if( !m_hSprite2 )
|
|
||||||
m_hSprite2 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_full" ) );
|
|
||||||
|
|
||||||
SPR_Set( m_hSprite1, r, g, b );
|
|
||||||
SPR_DrawAdditive( 0, x, y - iOffset, m_prc1 );
|
|
||||||
|
|
||||||
if( rc.bottom > rc.top )
|
|
||||||
{
|
|
||||||
SPR_Set( m_hSprite2, r, g, b );
|
|
||||||
SPR_DrawAdditive( 0, x, y - iOffset + ( rc.top - m_prc2->top ), &rc );
|
|
||||||
}
|
|
||||||
|
|
||||||
x += ( m_prc1->right - m_prc1->left );
|
|
||||||
x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b );
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,13 +227,6 @@ int CHudHealth::Draw( float flTime )
|
||||||
x = CrossWidth + HealthWidth / 2;
|
x = CrossWidth + HealthWidth / 2;
|
||||||
|
|
||||||
x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b );
|
x = gHUD.DrawHudNumber( x, y, 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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawDamage( flTime );
|
DrawDamage( flTime );
|
||||||
|
|
Loading…
Reference in New Issue