summaryrefslogtreecommitdiff
path: root/game/shared/tf2/weapon_limpetmine.h
blob: 3040e146131164e386f7b80d52266f3cf2d449a6 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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

class CBeam;

#if defined( CLIENT_DLL )
#define CWeaponLimpetmine C_WeaponLimpetmine
#else
#include "env_laserdesignation.h"
#endif

//-----------------------------------------------------------------------------
// Purpose: Combination limpet mine & laser designator weapon
//-----------------------------------------------------------------------------
class CWeaponLimpetmine : public CBaseTFCombatWeapon
{
	DECLARE_CLASS( CWeaponLimpetmine, CBaseTFCombatWeapon );
public:
	DECLARE_NETWORKCLASS();
	DECLARE_PREDICTABLE();

	CWeaponLimpetmine( void );

	virtual void	UpdateOnRemove( void );

	virtual void	Precache( void );
	virtual float	GetFireRate( void );
	virtual bool	Holster( CBaseCombatWeapon *pSwitchingTo );
	virtual void	ItemPostFrame( void );
	virtual void	PrimaryAttack( void );
	virtual void	WeaponIdle( void );
	virtual bool	HasAnyAmmo( void );
	virtual void	CleanupOnActStart( void );

	// Designation
	void			StartDesignating( void );
	void			StopDesignating( void );
	void			UpdateBeamTarget( );

	// Limpet counting
	void			DecrementLimpets( void );

	// All predicted weapons need to implement and return true
	virtual bool	IsPredicted( void ) const
	{ 
		return true;
	}

// Server DLL only
#if !defined( CLIENT_DLL )
	void			DetonateDeployedLimpets( void );
	void			RemoveDeployedLimpets( void );
	void			ThrowLimpet( CBasePlayer *pPlayer, Vector vecSrc, Vector vecAiming );
	void			ActivateBeam();
	void			DesignateSentriesToAttack( CBaseEntity *pEntity );
	bool			ValidDesignationTarget( CBaseEntity *pEntity );
	CBaseEntity		*GetDesignatedEntity( CBaseTFPlayer *pPlayer );	// Visually highlight those limpets in player's view cone

public:
	CHandle<CEnvLaserDesignation>	m_hLaserDesignation;
#endif

// Client DLL only
#if defined( CLIENT_DLL )
public:
	virtual bool	ShouldPredict( void )
	{
		if ( GetOwner() == C_BasePlayer::GetLocalPlayer() )
			return true;

		return BaseClass::ShouldPredict();
	}

	virtual bool CanBeSelected( void );
	virtual void PreDataUpdate( DataUpdateType_t updateType );
	virtual void PostDataUpdate( DataUpdateType_t updateType );
#endif

protected:
	// Designation
	bool		m_bDesignating;
	CNetworkHandle( CBaseEntity, m_hDesignatedEntity );
	EHANDLE		m_hOldDesignatedEntity;
	int			m_eDesignatedEntityOriginalRenderFx;
	int			m_eDesignatedEntityOriginalRenderMode;

	// Beam
	CBeam		*m_pBeam;

	// Limpets
	float		m_flStartedLaunchingAt;
	CNetworkVar( int, m_iDeployedLimpets );
	int			m_flNextBuzzTime;

private:
	CWeaponLimpetmine( const CWeaponLimpetmine & );
};

#endif // WEAPON_LIMPETMINE_H