summaryrefslogtreecommitdiff
path: root/game/shared/tf2/weapon_shield.h
blob: 9d6bb212ef7cc41b0c29d596d6f84cc19172d141 (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
81
82
83
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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

//#include "tf_player.h"
#include "basetfcombatweapon_shared.h"
#include "tf_shieldshared.h"


#if defined( CLIENT_DLL )
#define CWeaponShield C_WeaponShield
#define CShield C_Shield
#endif

class CShield;

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class CWeaponShield : public CBaseTFCombatWeapon
{
	DECLARE_CLASS( CWeaponShield, CBaseTFCombatWeapon );

public:
	DECLARE_NETWORKCLASS();
	DECLARE_PREDICTABLE();

	CWeaponShield();
	
	virtual void UpdateOnRemove( void );

	// Firing
	virtual void	ItemPostFrame( void );
	virtual float	GetFireRate( void );
	virtual float	GetDamage( float flDistance, int iLocation );

	virtual bool	Deploy( void );
	virtual bool	Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
	virtual void	WeaponIdle( void );
	virtual bool	VisibleInWeaponSelection( void ) { return false; }

	// All predicted weapons need to implement and return true
	virtual bool IsPredicted( void ) const
	{ 
		return true;
	}

#if defined( CLIENT_DLL )
	virtual bool	ShouldPredict( void )
	{
		if ( GetOwner() == C_BasePlayer::GetLocalPlayer() )
			return true;

		return BaseClass::ShouldPredict();
	}
#endif

private:
	CWeaponShield( const CWeaponShield & );

	// Lock the projected shield
	void SetShieldPositionLocked( bool bLocked );

	// Input
	void PrimaryAttack( void );

private:
	// Data
	CNetworkVar( CHandle<CShield>, m_hDeployedShield );
	bool m_bShieldPositionLocked;
	bool m_bIsDeployed;
};

#endif // WEAPON_SHIELD_H