|
|
@ -30,8 +30,6 @@ |
|
|
|
#include "com_model.h" |
|
|
|
#include "com_model.h" |
|
|
|
#include "studio_util.h" |
|
|
|
#include "studio_util.h" |
|
|
|
|
|
|
|
|
|
|
|
#include "parsemsg.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ==========================================
|
|
|
|
// ==========================================
|
|
|
|
// Code changes for- Night at the Office:
|
|
|
|
// Code changes for- Night at the Office:
|
|
|
|
// ==========================================
|
|
|
|
// ==========================================
|
|
|
@ -40,157 +38,47 @@ |
|
|
|
// the side of the screen will be white. If shot from the right,
|
|
|
|
// the side of the screen will be white. If shot from the right,
|
|
|
|
// the right side of the screen will flash white. etc.
|
|
|
|
// the right side of the screen will flash white. etc.
|
|
|
|
|
|
|
|
|
|
|
|
void CHudHealth::DrawPain2(void) |
|
|
|
void CHudHealth::DrawPainFront() |
|
|
|
{ |
|
|
|
|
|
|
|
if (!(m_fAttackFront || m_fAttackRear || m_fAttackLeft || m_fAttackRight)) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int a, shade; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: get the shift value of the health
|
|
|
|
|
|
|
|
a = 255; // max brightness until then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float fFade = gHUD.m_flTimeDelta * 2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->CullFace(TRI_NONE); //no culling
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SPR_Draw top
|
|
|
|
|
|
|
|
if (m_fAttackFront > 0.4) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if( !m_hPainFront ) |
|
|
|
if( !m_hPainFront ) |
|
|
|
|
|
|
|
{ |
|
|
|
m_hPainFront = SPR_Load( "sprites/pain_front.spr" ); |
|
|
|
m_hPainFront = SPR_Load( "sprites/pain_front.spr" ); |
|
|
|
|
|
|
|
m_hPainFrontModel = (struct model_s *)gEngfuncs.GetSpritePointer( m_hPainFront ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
shade = a * Q_max(m_fAttackFront, 0.5); |
|
|
|
HUD_DrawRectangle( m_hPainFrontModel, kRenderTransAdd ); |
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->SpriteTexture((struct model_s *) gEngfuncs.GetSpritePointer(m_hPainFront), 0); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Color4f(1, 1, 1, shade); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Begin(TRI_QUADS); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//top left
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(0, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bottom left
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(0, ScreenHeight, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bottom right
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, ScreenHeight, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//top right
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->End(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_fAttackFront = Q_max(0, m_fAttackFront - fFade); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
m_fAttackFront = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_fAttackRight > 0.4) |
|
|
|
void CHudHealth::DrawPainRight() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( !m_hPainRight ) |
|
|
|
if( !m_hPainRight ) |
|
|
|
|
|
|
|
{ |
|
|
|
m_hPainRight = SPR_Load( "sprites/pain_right.spr" ); |
|
|
|
m_hPainRight = SPR_Load( "sprites/pain_right.spr" ); |
|
|
|
|
|
|
|
m_hPainRightModel = (struct model_s *)gEngfuncs.GetSpritePointer( m_hPainRight ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
shade = a * Q_max(m_fAttackRight, 0.5); |
|
|
|
HUD_DrawRectangle( m_hPainRightModel, kRenderTransAdd ); |
|
|
|
|
|
|
|
} |
|
|
|
gEngfuncs.pTriAPI->SpriteTexture((struct model_s *) gEngfuncs.GetSpritePointer(m_hPainRight), 0); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Color4f(1, 1, 1, shade); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Begin(TRI_QUADS); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//top left
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(0, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bottom left
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(0, ScreenHeight, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bottom right
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, ScreenHeight, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//top right
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->End(); |
|
|
|
void CHudHealth::DrawPainLeft() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( !m_hPainLeft ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_hPainLeft = SPR_Load( "sprites/pain_front.spr" ); |
|
|
|
|
|
|
|
m_hPainLeftModel = (struct model_s *)gEngfuncs.GetSpritePointer( m_hPainLeft ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_fAttackRight = Q_max(0, m_fAttackRight - fFade); |
|
|
|
HUD_DrawRectangle( m_hPainLeftModel, kRenderTransAdd ); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
m_fAttackRight = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_fAttackRear > 0.4) |
|
|
|
void CHudHealth::DrawPainRear() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( !m_hPainRear ) |
|
|
|
if( !m_hPainRear ) |
|
|
|
|
|
|
|
{ |
|
|
|
m_hPainRear = SPR_Load( "sprites/pain_rear.spr" ); |
|
|
|
m_hPainRear = SPR_Load( "sprites/pain_rear.spr" ); |
|
|
|
|
|
|
|
m_hPainRearModel = (struct model_s *)gEngfuncs.GetSpritePointer( m_hPainRear ); |
|
|
|
shade = a * Q_max(m_fAttackRear, 0.5); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->SpriteTexture((struct model_s *) gEngfuncs.GetSpritePointer(m_hPainRear), 0); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Color4f(1, 1, 1, shade); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Begin(TRI_QUADS); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//top left
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(0, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bottom left
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(0, ScreenHeight, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bottom right
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, ScreenHeight, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//top right
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->End(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_fAttackRear = Q_max(0, m_fAttackRear - fFade); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
m_fAttackRear = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_fAttackLeft > 0.4) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!m_hPainLeft) |
|
|
|
|
|
|
|
m_hPainLeft = SPR_Load("sprites/pain_left.spr"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shade = a * Q_max(m_fAttackLeft, 0.5); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->SpriteTexture((struct model_s *) gEngfuncs.GetSpritePointer(m_hPainLeft), 0); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Color4f(1, 1, 1, shade); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Begin(TRI_QUADS); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//top left
|
|
|
|
HUD_DrawRectangle( m_hPainRearModel, kRenderTransAdd ); |
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(0, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bottom left
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(0, ScreenHeight, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bottom right
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, ScreenHeight, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//top right
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f); |
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->End(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_fAttackLeft = Q_max(0, m_fAttackLeft - fFade); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
m_fAttackLeft = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.pTriAPI->RenderMode(kRenderNormal); //return to normal
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|