summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_weapon_compound_bow.h
blob: 2af5d6111fe8b83fcdcdd2a4b4e92fce11b479ca (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================
#ifndef TF_WEAPON_COMPOUND_BOW_H
#define TF_WEAPON_COMPOUND_BOW_H
#ifdef _WIN32
#pragma once
#endif

#include "tf_weaponbase_gun.h"
#include "tf_weapon_pipebomblauncher.h"

// Client specific.
#ifdef CLIENT_DLL
#define CTFCompoundBow C_TFCompoundBow
#else
class CTFProjectile_Arrow;
#endif

//=============================================================================
//
// TF Weapon Bow
//
class CTFCompoundBow : public CTFPipebombLauncher
{
public:

	DECLARE_CLASS( CTFCompoundBow, CTFPipebombLauncher );
	DECLARE_NETWORKCLASS(); 
	DECLARE_PREDICTABLE();

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

	CTFCompoundBow();
	~CTFCompoundBow() {}

	virtual void	Precache( void );

	virtual void	WeaponReset( void );

	virtual int		GetWeaponID( void ) const			{ return TF_WEAPON_COMPOUND_BOW; }

	virtual void	PrimaryAttack();
	virtual void	LaunchGrenade( void );

	virtual bool	CalcIsAttackCriticalHelper();

	virtual float	GetChargeMaxTime( void );
	virtual float	GetCurrentCharge( void );
	virtual float	GetProjectileDamage( void );
	virtual float	GetProjectileSpeed( void );
	virtual float	GetProjectileGravity( void );

	virtual void	AddPipeBomb( CTFGrenadePipebombProjectile *pBomb );
	virtual bool	DetonateRemotePipebombs( bool bFizzle );
	virtual void	SecondaryAttack( void );
	virtual void	LowerBow( void );

	virtual bool	Reload( void );

	virtual bool	OwnerCanJump( void );
	virtual bool	Holster( CBaseCombatWeapon *pSwitchingTo );

	virtual bool	SendWeaponAnim( int iActivity );
	virtual void	ItemPostFrame( void );

	virtual float	GetChargeForceReleaseTime( void ) { return 5.0f; }
	virtual void	ForceLaunchGrenade( void );
	virtual bool	ShouldDoMuzzleFlash( void ) { return false; }

	virtual void	GetProjectileFireSetup( CTFPlayer *pPlayer, Vector vecOffset, Vector *vecSrc, QAngle *angForward, bool bHitTeammates = true, float flEndDist = 2000.f );
	void			ApplyRefireSpeedModifications( float &flBaseRef );

	// The bow doesn't actually reload, it instead uses the AE_WPN_INCREMENTAMMO anim event in the fire to reload the clip.
	virtual bool	CanReload( void ){ return false; }

	virtual bool	CanPickupOtherWeapon() const { return m_flChargeBeginTime == 0.f; }
	
#ifdef CLIENT_DLL
	virtual void	OnDataChanged( DataUpdateType_t type );
	virtual void	UpdateOnRemove( void );
#endif

	void			SetArrowAlight( bool bAlight );

private:
#ifdef CLIENT_DLL
	virtual void	StartBurningEffect( void );
	virtual void	StopBurningEffect( void );
#else

#ifdef STAGING_ONLY
	void CreateExtraArrow( CTFProjectile_Arrow* pMainArrow, const QAngle& qSpreadAngles, float flSpeed );
	float GetRandomSpreadOffset( int iArrowMasteryLevel );
#endif // STAGING_ONLY

#endif

private:
	float		m_flLastDenySoundTime;
	CNetworkVar( bool, m_bNoFire );
	CNetworkVar( bool, m_bArrowAlight );

#ifdef CLIENT_DLL
	EHANDLE		   m_hParticleEffectOwner;
	HPARTICLEFFECT m_pBurningArrowEffect;
#endif 

	CTFCompoundBow( const CTFCompoundBow & ) {}
};

#endif // TF_WEAPON_COMPOUND_BOW_H