summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_weapon_flaregun.h
blob: 8aedef2c1b415c1f56dac52f63b978080876d721 (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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================
#ifndef TF_WEAPON_FLAREGUN_H
#define TF_WEAPON_FLAREGUN_H
#ifdef _WIN32
#pragma once
#endif

#include "tf_weaponbase_gun.h"
#ifdef GAME_DLL
#include "tf_projectile_flare.h"
#endif

// Client specific.
#ifdef CLIENT_DLL
#define CTFFlareGun C_TFFlareGun
#define CTFFlareGun_Revenge C_TFFlareGun_Revenge
#endif

enum FlareGunTypes_t
{
	FLAREGUN_NORMAL = 0,
	FLAREGUN_DETONATE,
	FLAREGUN_GRORDBORT,
	FLAREGUN_SCORCHSHOT
};

//=============================================================================
//
// TF Weapon Flare gun.
//
class CTFFlareGun : public CTFWeaponBaseGun
{
public:

	DECLARE_CLASS( CTFFlareGun, CTFWeaponBaseGun );
	DECLARE_NETWORKCLASS(); 
	DECLARE_PREDICTABLE();

// Server specific.
#ifdef GAME_DLL
	DECLARE_DATADESC();
#endif

	CTFFlareGun();
	~CTFFlareGun();

	virtual void	Precache();
	virtual void	DestroySounds( void );

	virtual int		GetWeaponID( void ) const			{ return TF_WEAPON_FLAREGUN; }
	virtual void	PrimaryAttack();
	virtual void	SecondaryAttack();

	virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
	virtual bool Deploy( void );
	virtual void ItemPostFrame( void );
	virtual void WeaponReset( void );

	int				GetFlareGunType( void ) const	{ int iMode = 0; CALL_ATTRIB_HOOK_INT( iMode, set_weapon_mode ); return iMode; }

#ifdef GAME_DLL
	void			AddFlare( CTFProjectile_Flare *pFlare );
	void			DeathNotice( CBaseEntity *pVictim );
	void			DetonateFlare( void );
#endif

	virtual void StartCharge( void );
	virtual void StopCharge( void );
	virtual void ChargePostFrame( void ) {}	// Derived weapons can figure out what to do with this
	virtual const char* GetChargeEffect( void ) const { return "drg_cowmangler_muzzleflash_chargeup"; }

	float GetChargeBeginTime( void ) const { return m_flChargeBeginTime; }

protected:

#ifdef GAME_DLL
	typedef CHandle<CTFProjectile_Flare>	FlareHandle;
	CUtlVector <FlareHandle>				m_Flares;
	int										m_iFlareCount;
#endif

protected:
	void StartChargeStartTime() { m_flChargeBeginTime = gpGlobals->curtime; }

#ifdef CLIENT_DLL
	virtual void DispatchMuzzleFlash( const char* effectName, C_BaseEntity* pAttachEnt );
	void ClientEffectsThink( void );
	void StartChargeEffects();
	void StopChargeEffects();
	virtual bool ShouldPlayClientReloadSound() { return true; }
#endif

private:

	CNetworkVar( float, m_flChargeBeginTime );

	bool m_bEffectsThinking;
	float m_flLastDenySoundTime;

#if defined( CLIENT_DLL )
	CSoundPatch	*m_pChargeLoop;
	bool m_bReadyToFire;
#endif

	CTFFlareGun( const CTFFlareGun & ) {}
};


//---------------------------------------------------------
class CTFFlareGun_Revenge : public CTFFlareGun
{
public:
	DECLARE_CLASS( CTFFlareGun_Revenge, CTFFlareGun );
	DECLARE_NETWORKCLASS(); 
	DECLARE_PREDICTABLE();

	CTFFlareGun_Revenge();

	virtual void Precache();

	virtual int GetWeaponID( void ) const			{ return TF_WEAPON_FLAREGUN_REVENGE; }
	virtual bool IsEnergyWeapon( void ) const { return true; }

	virtual int GetCustomDamageType() const;

	virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
	virtual bool Deploy( void );

#ifdef GAME_DLL
	virtual void Detach();
#endif

	int GetCount( void );
	float GetProgress( void ) { return 0.0f; }
	const char* GetEffectLabelText( void )			{ return "#TF_CRITS"; }

	const char* GetMuzzleFlashParticleEffect( void ) { return "drg_manmelter_muzzleflash"; }

	virtual void PrimaryAttack();
	virtual void SecondaryAttack( void );
	virtual void ChargePostFrame( void );
	virtual const char* GetChargeEffect( void ) const { return "drg_manmelter_vacuum"; }
	virtual const char* ReadyToFireSound( void ) const { return "Weapon_SniperRailgun.NonScoped"; }

#ifdef CLIENT_DLL
	virtual void OnDataChanged( DataUpdateType_t type );
	void DoAbsorbEffect( void );
#endif

private:
	bool ExtinguishPlayerInternal( CTFPlayer *pTarget, CTFPlayer *pOwner );

	CNetworkVar( float, m_fLastExtinguishTime );

#ifdef CLIENT_DLL
	int m_nOldRevengeCrits;
#endif

};

#endif // TF_WEAPON_FLAREGUN_H