summaryrefslogtreecommitdiff
path: root/game/shared/tfc/weapon_tfcbase.h
blob: 274abc41b0110b78ef43e1652089231c21e31774 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

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

#include "tfc_playeranimstate.h"
#include "tfc_weapon_parse.h"

#if defined( CLIENT_DLL )
	#define CWeaponTFCBase C_WeaponTFCBase
#endif

class CTFCPlayer;


// Given an ammo type (like from a weapon's GetPrimaryAmmoType()), this compares it
// against the ammo name you specify.
// MIKETODO: this should use indexing instead of searching and strcmp()'ing all the time.
bool IsAmmoType( int iAmmoType, const char *pAmmoName );


typedef enum
{
	WEAPON_NONE = 0,

	// Melee
	WEAPON_CROWBAR,
	WEAPON_SPANNER,		// Engineer's wrench.
	WEAPON_KNIFE,
	WEAPON_MEDIKIT,

	// Vector weapons
	WEAPON_MINIGUN,

	// Shotguns
	WEAPON_SHOTGUN,
	WEAPON_SUPER_SHOTGUN,

	WEAPON_NAILGUN,
	WEAPON_SUPER_NAILGUN,

	WEAPON_MAX,			// number of weapons weapon index

} TFCWeaponID;


//Class Heirarchy for tfc weapons

/*

  CWeaponTFCBase
	|
	|--> CTFCCrowbar
	|		|
	|		|--> CTFCKnife
	|		|--> CTFCMedikit
	|		|--> CTFCSpanner
	|		|--> CTFCMedikit
	|
	|--> CTFCMinigun
	|
	|--> CTFCShotgun
	|		|
	|		|--> CTFCSuperShotgun
	|
	|--> CTFCNailgun
	|		|
	|		|--> CTFCSuperNailgun
					
*/
class CWeaponTFCBase : public CBaseCombatWeapon
{
public:
	DECLARE_CLASS( CWeaponTFCBase, CBaseCombatWeapon );
	DECLARE_NETWORKCLASS(); 
	DECLARE_PREDICTABLE();

	CWeaponTFCBase();

	virtual void Precache();
	virtual bool IsPredicted() const;

	CTFCPlayer* GetPlayerOwner() const;

	// Get TFC-specific weapon data.
	CTFCWeaponInfo const	&GetTFCWpnData() const;

	// Get specific TFC weapon ID (ie: WEAPON_AK47, etc)
	virtual TFCWeaponID GetWeaponID( void ) const;

	// return true if this weapon is an instance of the given weapon type (ie: "IsA" WEAPON_GLOCK)
	bool IsA( TFCWeaponID id ) const;

	// return true if this weapon has a silencer equipped
	virtual bool IsSilenced( void ) const;


#ifdef CLIENT_DLL

#else

	DECLARE_DATADESC();

	virtual void Spawn();
	virtual bool DefaultReload( int iClipSize1, int iClipSize2, int iActivity );
	void SendReloadSoundEvent();
	
	virtual Vector GetSoundEmissionOrigin() const;

#endif


private:
	
	CWeaponTFCBase( const CWeaponTFCBase & );
};


#endif // WEAPON_TFCBASE_H