Skip to content

Commit

Permalink
Make pain sprite color not depend on the HUD color
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeSlave committed Dec 11, 2023
1 parent 599d9ef commit 5a255d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cl_dll/health.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ int CHudHealth::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )

// Returns back a color from the
// Green <-> Yellow <-> Red ramp
void CHudHealth::GetHealthColor( int &r, int &g, int &b )
{
if( m_iHealth > 25 )
{
UnpackRGB( r, g, b, gHUD.HUDColor() );
}
else
{
UnpackRGB( r, g, b, gHUD.HUDColorCritical() );
}
}

void CHudHealth::GetPainColor( int &r, int &g, int &b )
{
#if 0
Expand All @@ -166,11 +178,11 @@ void CHudHealth::GetPainColor( int &r, int &g, int &b )
#else
if( m_iHealth > 25 )
{
UnpackRGB( r, g, b, gHUD.HUDColor() );
UnpackRGB( r, g, b, RGB_YELLOWISH );
}
else
{
UnpackRGB( r, g, b, gHUD.HUDColorCritical() );
UnpackRGB( r, g, b, RGB_REDISH );
}
#endif
}
Expand Down Expand Up @@ -207,7 +219,7 @@ int CHudHealth::Draw( float flTime )
if( m_iHealth <= 15 )
a = 255;

GetPainColor( r, g, b );
GetHealthColor( r, g, b );
ScaleColors( r, g, b, a );

// Only draw health if we have the suit.
Expand Down
1 change: 1 addition & 0 deletions cl_dll/health.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class CHudHealth : public CHudBase
int m_HUD_dmg_bio;
int m_HUD_cross;
float m_fAttackFront, m_fAttackRear, m_fAttackLeft, m_fAttackRight;
void GetHealthColor( int &r, int &g, int &b );
void GetPainColor( int &r, int &g, int &b );
float m_fFade;

Expand Down

0 comments on commit 5a255d8

Please sign in to comment.