summaryrefslogtreecommitdiff
path: root/game/client/cstrike/hud_account.cpp
blob: abd9f570196e5c072b40ca7641ee724c2c7f2750 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#include "cbase.h"
#include "hud_base_account.h"
#include "c_cs_player.h"
#include "clientmode_csnormal.h"

using namespace vgui;

class CHudAccount : public CHudBaseAccount
{
public:
	DECLARE_CLASS_SIMPLE( CHudAccount, CHudBaseAccount );

	CHudAccount( const char *name );

	virtual bool ShouldDraw();
	virtual int	GetPlayerAccount( void );
	virtual vgui::AnimationController *GetAnimationController( void );
};

DECLARE_HUDELEMENT( CHudAccount );

CHudAccount::CHudAccount( const char *pName ) :
CHudBaseAccount( "HudAccount" )
{
	SetHiddenBits( HIDEHUD_PLAYERDEAD );
	SetIndent( false ); // don't indent small numbers in the drawing code - we're doing it manually
}

bool CHudAccount::ShouldDraw()
{
	C_CSPlayer *pPlayer = C_CSPlayer::GetLocalCSPlayer();
	if ( pPlayer )
	{
		return !pPlayer->IsObserver();
	}
	else
	{
		return false;
	}
}

// How much money does the player have
int	CHudAccount::GetPlayerAccount( void )
{
	C_CSPlayer *pPlayer = C_CSPlayer::GetLocalCSPlayer();

	if( !pPlayer )
		return 0;

	return (int)pPlayer->GetAccount();
}

vgui::AnimationController *CHudAccount::GetAnimationController( void )
{
	vgui::AnimationController *pController = g_pClientMode->GetViewportAnimationController();

	Assert( pController );

	return pController;
}