Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.4 KiB

5 years ago
//========= 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;
}