|
|
@ -236,7 +236,7 @@ int CHudHealth::Draw( float flTime ) |
|
|
|
|
|
|
|
|
|
|
|
rc = *m_prc2; |
|
|
|
rc = *m_prc2; |
|
|
|
|
|
|
|
|
|
|
|
rc.bottom -= m_iHeight * ( (float)( 100 - ( min( 100, m_iHealth ) ) ) * 0.01 ); // health can go from 0 to 100 so * 0.01 goes from 0 to 1
|
|
|
|
rc.bottom -= m_iHeight * ( (float)( 100 - ( Q_min( 100, m_iHealth ) ) ) * 0.01 ); // health can go from 0 to 100 so * 0.01 goes from 0 to 1
|
|
|
|
|
|
|
|
|
|
|
|
UnpackRGB( r, g, b, RGB_WHITEISH ); |
|
|
|
UnpackRGB( r, g, b, RGB_WHITEISH ); |
|
|
|
|
|
|
|
|
|
|
@ -337,25 +337,25 @@ void CHudHealth::CalcDamageDirection( vec3_t vecFrom ) |
|
|
|
if( side > 0 ) |
|
|
|
if( side > 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( side > 0.3 ) |
|
|
|
if( side > 0.3 ) |
|
|
|
m_fAttackFront = max( m_fAttackFront, side ); |
|
|
|
m_fAttackFront = Q_max( m_fAttackFront, side ); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
float f = fabs( side ); |
|
|
|
float f = fabs( side ); |
|
|
|
if( f > 0.3 ) |
|
|
|
if( f > 0.3 ) |
|
|
|
m_fAttackRear = max( m_fAttackRear, f ); |
|
|
|
m_fAttackRear = Q_max( m_fAttackRear, f ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( front > 0 ) |
|
|
|
if( front > 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( front > 0.3 ) |
|
|
|
if( front > 0.3 ) |
|
|
|
m_fAttackRight = max( m_fAttackRight, front ); |
|
|
|
m_fAttackRight = Q_max( m_fAttackRight, front ); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
float f = fabs( front ); |
|
|
|
float f = fabs( front ); |
|
|
|
if( f > 0.3 ) |
|
|
|
if( f > 0.3 ) |
|
|
|
m_fAttackLeft = max( m_fAttackLeft, f ); |
|
|
|
m_fAttackLeft = Q_max( m_fAttackLeft, f ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -377,28 +377,28 @@ int CHudHealth::DrawPain( float flTime ) |
|
|
|
if( m_fAttackFront > 0.4 ) |
|
|
|
if( m_fAttackFront > 0.4 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
GetPainColor( r, g, b ); |
|
|
|
GetPainColor( r, g, b ); |
|
|
|
shade = a * max( m_fAttackFront, 0.5 ); |
|
|
|
shade = a * Q_max( m_fAttackFront, 0.5 ); |
|
|
|
ScaleColors( r, g, b, shade ); |
|
|
|
ScaleColors( r, g, b, shade ); |
|
|
|
SPR_Set( m_hSprite, r, g, b ); |
|
|
|
SPR_Set( m_hSprite, r, g, b ); |
|
|
|
|
|
|
|
|
|
|
|
x = ScreenWidth / 2 - SPR_Width( m_hSprite, 0 ) / 2; |
|
|
|
x = ScreenWidth / 2 - SPR_Width( m_hSprite, 0 ) / 2; |
|
|
|
y = ScreenHeight / 2 - SPR_Height( m_hSprite, 0 ) * 3; |
|
|
|
y = ScreenHeight / 2 - SPR_Height( m_hSprite, 0 ) * 3; |
|
|
|
SPR_DrawAdditive( 0, x, y, NULL ); |
|
|
|
SPR_DrawAdditive( 0, x, y, NULL ); |
|
|
|
m_fAttackFront = max( 0, m_fAttackFront - fFade ); |
|
|
|
m_fAttackFront = Q_max( 0, m_fAttackFront - fFade ); |
|
|
|
} else |
|
|
|
} else |
|
|
|
m_fAttackFront = 0; |
|
|
|
m_fAttackFront = 0; |
|
|
|
|
|
|
|
|
|
|
|
if( m_fAttackRight > 0.4 ) |
|
|
|
if( m_fAttackRight > 0.4 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
GetPainColor( r, g, b ); |
|
|
|
GetPainColor( r, g, b ); |
|
|
|
shade = a * max( m_fAttackRight, 0.5 ); |
|
|
|
shade = a * Q_max( m_fAttackRight, 0.5 ); |
|
|
|
ScaleColors( r, g, b, shade ); |
|
|
|
ScaleColors( r, g, b, shade ); |
|
|
|
SPR_Set( m_hSprite, r, g, b ); |
|
|
|
SPR_Set( m_hSprite, r, g, b ); |
|
|
|
|
|
|
|
|
|
|
|
x = ScreenWidth / 2 + SPR_Width( m_hSprite, 1 ) * 2; |
|
|
|
x = ScreenWidth / 2 + SPR_Width( m_hSprite, 1 ) * 2; |
|
|
|
y = ScreenHeight / 2 - SPR_Height( m_hSprite,1 ) / 2; |
|
|
|
y = ScreenHeight / 2 - SPR_Height( m_hSprite,1 ) / 2; |
|
|
|
SPR_DrawAdditive( 1, x, y, NULL ); |
|
|
|
SPR_DrawAdditive( 1, x, y, NULL ); |
|
|
|
m_fAttackRight = max( 0, m_fAttackRight - fFade ); |
|
|
|
m_fAttackRight = Q_max( 0, m_fAttackRight - fFade ); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
m_fAttackRight = 0; |
|
|
|
m_fAttackRight = 0; |
|
|
@ -406,14 +406,14 @@ int CHudHealth::DrawPain( float flTime ) |
|
|
|
if( m_fAttackRear > 0.4 ) |
|
|
|
if( m_fAttackRear > 0.4 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
GetPainColor( r, g, b ); |
|
|
|
GetPainColor( r, g, b ); |
|
|
|
shade = a * max( m_fAttackRear, 0.5 ); |
|
|
|
shade = a * Q_max( m_fAttackRear, 0.5 ); |
|
|
|
ScaleColors( r, g, b, shade ); |
|
|
|
ScaleColors( r, g, b, shade ); |
|
|
|
SPR_Set( m_hSprite, r, g, b ); |
|
|
|
SPR_Set( m_hSprite, r, g, b ); |
|
|
|
|
|
|
|
|
|
|
|
x = ScreenWidth / 2 - SPR_Width( m_hSprite, 2 ) / 2; |
|
|
|
x = ScreenWidth / 2 - SPR_Width( m_hSprite, 2 ) / 2; |
|
|
|
y = ScreenHeight / 2 + SPR_Height( m_hSprite, 2 ) * 2; |
|
|
|
y = ScreenHeight / 2 + SPR_Height( m_hSprite, 2 ) * 2; |
|
|
|
SPR_DrawAdditive( 2, x, y, NULL ); |
|
|
|
SPR_DrawAdditive( 2, x, y, NULL ); |
|
|
|
m_fAttackRear = max( 0, m_fAttackRear - fFade ); |
|
|
|
m_fAttackRear = Q_max( 0, m_fAttackRear - fFade ); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
m_fAttackRear = 0; |
|
|
|
m_fAttackRear = 0; |
|
|
@ -421,7 +421,7 @@ int CHudHealth::DrawPain( float flTime ) |
|
|
|
if( m_fAttackLeft > 0.4 ) |
|
|
|
if( m_fAttackLeft > 0.4 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
GetPainColor( r, g, b ); |
|
|
|
GetPainColor( r, g, b ); |
|
|
|
shade = a * max( m_fAttackLeft, 0.5 ); |
|
|
|
shade = a * Q_max( m_fAttackLeft, 0.5 ); |
|
|
|
ScaleColors( r, g, b, shade ); |
|
|
|
ScaleColors( r, g, b, shade ); |
|
|
|
SPR_Set( m_hSprite, r, g, b ); |
|
|
|
SPR_Set( m_hSprite, r, g, b ); |
|
|
|
|
|
|
|
|
|
|
@ -429,7 +429,7 @@ int CHudHealth::DrawPain( float flTime ) |
|
|
|
y = ScreenHeight / 2 - SPR_Height( m_hSprite,3 ) / 2; |
|
|
|
y = ScreenHeight / 2 - SPR_Height( m_hSprite,3 ) / 2; |
|
|
|
SPR_DrawAdditive( 3, x, y, NULL ); |
|
|
|
SPR_DrawAdditive( 3, x, y, NULL ); |
|
|
|
|
|
|
|
|
|
|
|
m_fAttackLeft = max( 0, m_fAttackLeft - fFade ); |
|
|
|
m_fAttackLeft = Q_max( 0, m_fAttackLeft - fFade ); |
|
|
|
} else |
|
|
|
} else |
|
|
|
m_fAttackLeft = 0; |
|
|
|
m_fAttackLeft = 0; |
|
|
|
|
|
|
|
|
|
|
@ -461,7 +461,7 @@ int CHudHealth::DrawDamage( float flTime ) |
|
|
|
SPR_Set( gHUD.GetSprite( m_HUD_dmg_bio + i ), r, g, b ); |
|
|
|
SPR_Set( gHUD.GetSprite( m_HUD_dmg_bio + i ), r, g, b ); |
|
|
|
SPR_DrawAdditive( 0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect( m_HUD_dmg_bio + i ) ); |
|
|
|
SPR_DrawAdditive( 0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect( m_HUD_dmg_bio + i ) ); |
|
|
|
|
|
|
|
|
|
|
|
pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire ); |
|
|
|
pdmg->fExpire = Q_min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire ); |
|
|
|
|
|
|
|
|
|
|
|
if( pdmg->fExpire <= flTime // when the time has expired
|
|
|
|
if( pdmg->fExpire <= flTime // when the time has expired
|
|
|
|
&& a < 40 ) // and the flash is at the low point of the cycle
|
|
|
|
&& a < 40 ) // and the flash is at the low point of the cycle
|
|
|
|