summaryrefslogtreecommitdiff
path: root/game/client/tf/tf_hud_base_build_menu.h
blob: f9b79d215a88635818a68cfb9b06f8000f095555 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef TF_HUD_BASE_BUILD_MENU
#define TF_HUD_BASE_BUILD_MENU
#ifdef _WIN32
#pragma once
#endif

#include <vgui_controls/EditablePanel.h>
#include "hudelement.h"
#include "c_tf_player.h"
#include "tf_weaponbase.h"

using namespace vgui;


class CHudBaseBuildMenu : public CHudElement, public EditablePanel
{
	DECLARE_CLASS_SIMPLE( CHudBaseBuildMenu, EditablePanel );

public:

	CHudBaseBuildMenu( const char *pElementName, const char *pMenuName )
		: CHudElement( pElementName )
		, BaseClass( NULL, pMenuName )
	{
		m_bBuilderEquipped = false;
	}

	virtual bool ShouldDraw( void ) OVERRIDE
	{
		CTFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
		if ( !pPlayer )
			return false;

		CTFWeaponBase *pWpn = pPlayer->GetActiveTFWeapon();

		if ( !pWpn )
			return false;

		// Don't show the menu for first person spectator
		if ( pPlayer != pWpn->GetOwner() )
			return false;

		if ( !CHudElement::ShouldDraw() )
			return false;

		return m_bBuilderEquipped;
	}

	void SetBuilderEquipped( bool bEquipped )
	{
		m_bBuilderEquipped = bEquipped;
	}

private:

	bool m_bBuilderEquipped;
};


#endif	// TF_HUD_BASE_BUILD_MENU