summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_weapon_sword.h
blob: 1ea60dd9c65eb1a1f239e9010589d37154d2d047 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================

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

#include "tf_weaponbase_melee.h"
#ifdef GAME_DLL
#include "GameEventListener.h"
#else
#include "tf_viewmodel.h"
#include "bone_setup.h"
#include "tf_wearable_item_demoshield.h"
#endif

#ifdef CLIENT_DLL
#define CTFSword C_TFSword
#define CTFKatana C_TFKatana
#endif

//=============================================================================
//
// Decapitation melee weapon base class.
//

#ifdef GAME_DLL
class CTFDecapitationMeleeWeaponBase : public CTFWeaponBaseMelee, public CGameEventListener
#else
class CTFDecapitationMeleeWeaponBase : public CTFWeaponBaseMelee
#endif
{
public:

	DECLARE_CLASS( CTFDecapitationMeleeWeaponBase, CTFWeaponBaseMelee );
	
	CTFDecapitationMeleeWeaponBase();

	virtual void		Precache( void );
	virtual int			GetWeaponID( void ) const			{ return TF_WEAPON_SWORD; }
	virtual int			GetCustomDamageType() const			{ return TF_DMG_CUSTOM_DECAPITATION; }
	virtual float		GetMeleeDamage( CBaseEntity *pTarget, int* piDamageType, int* piCustomDamage );
	virtual Activity	TranslateViewmodelHandActivityInternal( Activity actBase );

	virtual bool		CanDecapitate( void );
	virtual void		SetupGameEventListeners( void );
	virtual void		OnDecapitation( CTFPlayer *pDeadPlayer ) {}

#ifdef GAME_DLL
	virtual bool		Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
	virtual void		FireGameEvent( IGameEvent *event );
#endif

#ifdef CLIENT_DLL
	virtual void		UpdateAttachmentModels( void );
	virtual int			DrawOverriddenViewmodel( C_BaseViewModel *pViewmodel, int flags );
#endif // CLIENT_DLL

protected:
	bool				m_bHolstering;

private:
#ifdef CLIENT_DLL
	EHANDLE				m_hShield;
#endif // CLIENT_DLL
};

//=============================================================================
//
// Sword class. (Consumes heads for speed/health bonus.)
//
class CTFSword : public CTFDecapitationMeleeWeaponBase
{
public:

	DECLARE_CLASS( CTFSword, CTFDecapitationMeleeWeaponBase );
	DECLARE_NETWORKCLASS(); 
	DECLARE_PREDICTABLE();

	CTFSword() {}
	virtual ~CTFSword() {}

	virtual void		WeaponReset( void );
	virtual float		GetSwordSpeedMod( void );
	virtual int			GetSwordHealthMod();
	virtual int			GetSwingRange( void );
	virtual void		OnDecapitation( CTFPlayer *pDeadPlayer );
	
	virtual bool		Deploy( void );

	float				GetProgress( void ) { return 0.f; }
	int					GetCount( void );
	const char*			GetEffectLabelText( void ) { return "#TF_BERZERK"; }

#ifdef CLIENT_DLL
	virtual void		WeaponIdle( void );
#endif

private:

	CTFSword( const CTFSword& ) {}

#ifdef CLIENT_DLL
	float				m_flNextIdleWavRoll;
	int					m_iPrevWavDecap;
#endif
};

//=============================================================================
//
// Sword class. (On head-take causes short-term soldier buff effects.)
//
class CTFKatana : public CTFDecapitationMeleeWeaponBase
{
public:

	DECLARE_CLASS( CTFKatana, CTFDecapitationMeleeWeaponBase );
	DECLARE_NETWORKCLASS(); 
	DECLARE_PREDICTABLE();

	CTFKatana();
	virtual ~CTFKatana() {}

	virtual bool	Deploy( void );
	virtual float	GetMeleeDamage( CBaseEntity *pTarget, int* piDamageType, int* piCustomDamage );
	virtual void	OnDecapitation( CTFPlayer *pDeadPlayer );

	virtual int		GetActivityWeaponRole() const OVERRIDE;

protected:
	virtual int		GetSkinOverride() const;
	
private:
	CNetworkVar( bool, m_bIsBloody );
};


#endif // TF_WEAPON_SWORD_H