diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/cstrike/hud_account.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/cstrike/hud_account.cpp')
| -rw-r--r-- | game/client/cstrike/hud_account.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/game/client/cstrike/hud_account.cpp b/game/client/cstrike/hud_account.cpp new file mode 100644 index 0000000..abd9f57 --- /dev/null +++ b/game/client/cstrike/hud_account.cpp @@ -0,0 +1,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; +}
\ No newline at end of file |