summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_weapon_pipebomblauncher.h
blob: 56f70fcb4a5f67e317eeff4bcf847f9ddaaf1d45 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================

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

#include "tf_weaponbase_gun.h"
#include "tf_weapon_grenade_pipebomb.h"

// Client specific.
#ifdef CLIENT_DLL
#define CTFPipebombLauncher C_TFPipebombLauncher
#endif

#define TF_PIPEBOMB_MAX_CHARGE_TIME	 4.0f

#define TF_DETONATE_MODE_STANDARD	0
#define TF_DETONATE_MODE_DOT		1
#define TF_DETONATE_MODE_AIR		2

// hard code these eventually
#define TF_PIPEBOMB_MIN_CHARGE_VEL 900
#define TF_PIPEBOMB_MAX_CHARGE_VEL 2400


//=============================================================================
//
// TF Weapon Pipebomb Launcher.
//
#ifdef GAME_DLL
	class CTFPipebombLauncher : public CTFWeaponBaseGun, public ITFChargeUpWeapon, public IEntityListener
#else
	class CTFPipebombLauncher : public CTFWeaponBaseGun, public ITFChargeUpWeapon
#endif
{
public:

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

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

	CTFPipebombLauncher();
	~CTFPipebombLauncher();

	virtual void	Spawn( void );
	virtual int		GetWeaponID( void ) const			{ return TF_WEAPON_PIPEBOMBLAUNCHER; }
	virtual CBaseEntity *FireProjectile( CTFPlayer *pPlayer );
	virtual void	ItemBusyFrame( void );
	virtual void	ItemPostFrame( void );
	virtual void	SecondaryAttack();

	virtual bool	Holster( CBaseCombatWeapon *pSwitchingTo );
	virtual bool	Deploy( void );
	virtual void	PrimaryAttack( void );
	virtual void	WeaponIdle( void );
	virtual float	GetProjectileSpeed( void );
	virtual bool	Reload( void );
	virtual void	WeaponReset( void );

public:
	// ITFChargeUpWeapon
	virtual bool CanCharge() { return true; }
	virtual float GetChargeBeginTime( void ) { return m_flChargeBeginTime; }
	virtual float GetChargeMaxTime( void ) { float flChargeTime = TF_PIPEBOMB_MAX_CHARGE_TIME;	CALL_ATTRIB_HOOK_FLOAT( flChargeTime, stickybomb_charge_rate )	return flChargeTime; }
	virtual float GetChargeForceReleaseTime( void ) { return GetChargeMaxTime(); }
	int	GetPipeBombCount( void ) { return m_iPipebombCount; }
	const CUtlVector< CHandle< CTFGrenadePipebombProjectile > > &GetPipeBombVector( void ) const;
	int			  GetDetonateMode( void ) const { int iMode = 0; CALL_ATTRIB_HOOK_INT( iMode, set_detonate_mode ); return iMode; };
	bool		  CanDestroyStickies( void ) const { int iMode = 0; CALL_ATTRIB_HOOK_INT( iMode, stickies_detonate_stickies ); return (iMode == 1); };

	virtual void LaunchGrenade( void );
	virtual void ForceLaunchGrenade( void ) { LaunchGrenade(); }
	virtual bool DetonateRemotePipebombs( bool bFizzle );
	virtual bool ModifyPipebombsInView( int iEffect );
	virtual void AddPipeBomb( CTFGrenadePipebombProjectile *pBomb );
	void			DeathNotice( CBaseEntity *pVictim );


#ifdef CLIENT_DLL
	void		BombHighlightThink( void );
#endif

#ifdef GAME_DLL
	void			UpdateOnRemove( void );
	virtual void	ApplyPostHitEffects( const CTakeDamageInfo &inputInfo, CTFPlayer *pPlayer );

protected:

	// This is here so we can network the pipebomb count for prediction purposes
	CNetworkVar( int,				m_iPipebombCount );	
#endif

#ifdef CLIENT_DLL
	int				m_iPipebombCount;
	float			m_flNextBombCheckTime;
	bool			m_bBombThinking;
#endif

	// List of active pipebombs
	typedef CHandle<CTFGrenadePipebombProjectile>	PipebombHandle;
	CUtlVector<PipebombHandle>		m_Pipebombs;

	CNetworkVar( float, m_flChargeBeginTime );
	float	m_flLastDenySoundTime;
	bool	m_bNoAutoRelease;
	bool	m_bWantsToShoot;

private:

	CTFPipebombLauncher( const CTFPipebombLauncher & ) {}
};


inline const CUtlVector< CHandle< CTFGrenadePipebombProjectile > > &CTFPipebombLauncher::GetPipeBombVector( void ) const
{
	return m_Pipebombs;
}


#endif // TF_WEAPON_PIPEBOMBLAUNCHER_H