summaryrefslogtreecommitdiff
path: root/game/client/cstrike/hud_hostagerescue.cpp
blob: 64556ece493b24ad2d1dff4ae98385ba3fcd4c87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#include "cbase.h"
#include "hudelement.h"
#include <vgui_controls/Panel.h>
#include <vgui/ISurface.h>
#include "clientmode_csnormal.h"
#include "c_cs_player.h"

class CHudHostageRescueZone : public CHudElement, public vgui::Panel
{
public:
	DECLARE_CLASS_SIMPLE( CHudHostageRescueZone, vgui::Panel );

	CHudHostageRescueZone( const char *name );

	virtual bool ShouldDraw();	
	virtual void Paint();

private:
	CPanelAnimationVar( Color, m_clrIcon, "IconColor", "IconColor" );

	CHudTexture *m_pIcon;
};


DECLARE_HUDELEMENT( CHudHostageRescueZone );


CHudHostageRescueZone::CHudHostageRescueZone( const char *pName ) :
	vgui::Panel( NULL, "HudHostageRescueZone" ), CHudElement( pName )
{
	SetParent( g_pClientMode->GetViewport() );
	m_pIcon = NULL;

	SetHiddenBits( HIDEHUD_PLAYERDEAD );

	//=============================================================================
	// HPE_BEGIN:
	// [tj] Add this to the render group that disappears when the scoreboard is up
	//=============================================================================
	RegisterForRenderGroup( "hide_for_scoreboard" );
	//=============================================================================
	// HPE_END
	//=============================================================================
}

bool CHudHostageRescueZone::ShouldDraw()
{
	C_CSPlayer *pPlayer = C_CSPlayer::GetLocalCSPlayer();
	//=============================================================================
	// HPE_BEGIN:
	// [tj] Added base class call
	//=============================================================================
	return ( pPlayer &&	pPlayer->IsInHostageRescueZone() && CHudElement::ShouldDraw());
	//=============================================================================
	// HPE_END
	//=============================================================================
}

void CHudHostageRescueZone::Paint()
{
	if ( !m_pIcon )
	{
		m_pIcon = gHUD.GetIcon( "hostage_rescue" );
	}
	
	if ( m_pIcon )
	{
		int x, y, w, h;
		GetBounds( x, y, w, h );

		m_pIcon->DrawSelf( 0, 0, w, h, m_clrIcon );
	}
}