summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_weaponbase_grenade.h
blob: cd1c273c2c734321cc6e28c35d6f3513b2893d78 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: TF Base Grenade.
//
//=============================================================================//
#ifndef TF_WEAPONBASE_GRENADE_H
#define TF_WEAPONBASE_GRENADE_H
#ifdef _WIN32
#pragma once
#endif

#include "tf_shareddefs.h"
#include "tf_weaponbase.h"
#include "npcevent.h"

#ifdef CLIENT_DLL
#define CTFWeaponBaseGrenade C_TFWeaponBaseGrenade
#endif

//=============================================================================//
//
// TF Base Grenade
//
class CTFWeaponBaseGrenade : public CTFWeaponBase
{
public:

	DECLARE_CLASS( CTFWeaponBaseGrenade, CTFWeaponBase );
	DECLARE_NETWORKCLASS();
	DECLARE_PREDICTABLE();

	CTFWeaponBaseGrenade();

	virtual void			Spawn();
	virtual void			Precache();

	bool					Deploy( void );
	bool					IsPrimed( void );
	void					Prime( void );

	void					Throw( void );

	bool					ShouldDetonate( void );

	virtual void			ItemPostFrame();

	virtual void			HideThink( void )	{ SetWeaponVisible( false ); }

	bool					ShouldLowerMainWeapon( void );

// Client specific.
#ifdef CLIENT_DLL

	bool					ShouldDraw( void );
// Server specific.
#else

	DECLARE_DATADESC();

	virtual void			HandleAnimEvent( animevent_t *pEvent );

	// Each derived grenade class implements this.
	virtual CTFWeaponBaseGrenadeProj *EmitGrenade( Vector vecSrc, QAngle vecAngles, Vector vecVel, AngularImpulse angImpulse, CBasePlayer *pPlayer, float flTime, int iflags = 0 );

#endif

protected:

	CNetworkVar( bool, m_bPrimed );			// Set to true when the pin has been pulled but the grenade hasn't been thrown yet.
	CNetworkVar( float, m_flThrowTime );	// the time at which the grenade will be thrown.  If this value is 0 then the time hasn't been set yet.
	CNetworkVar( bool, m_bThrow );			// True when the player is throwing the grenade

private:

	CTFWeaponBaseGrenade( const CTFWeaponBaseGrenade & ) {}
};

#endif // TF_WEAPONBASE_GRENADE_H