summaryrefslogtreecommitdiff
path: root/game/shared/dod/weapon_dodbasegun.h
blob: 8ff215d71b72b9c5231a61437c5325e98fa98fff (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

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


#include "weapon_dodbase.h"

// This is the base class for pistols and rifles.
#if defined( CLIENT_DLL )

	//#include "particles_simple.h"
	//#include "particles_localspace.h"
	#include "fx.h"
	#include "fx_dod_muzzleflash.h"

	#define CWeaponDODBaseGun C_WeaponDODBaseGun

#else
#endif

class CWeaponDODBaseGun : public CWeaponDODBase
{
public:
	
	DECLARE_CLASS( CWeaponDODBaseGun, CWeaponDODBase );
	DECLARE_NETWORKCLASS(); 
	DECLARE_PREDICTABLE();
	
	CWeaponDODBaseGun();

	virtual void Spawn();
	virtual void Precache();
	virtual void PrimaryAttack();
	virtual bool Reload();

	// Derived classes must call this from inside their Spawn() function instead of 
	// just chaining the Spawn() call down.
	void DODBaseGunSpawn( void );
	
	// Derived classes call this to fire a bullet.
	bool DODBaseGunFire( void );

	// Usually plays the shot sound. Guns with silencers can play different sounds.
	virtual void DoFireEffects();
	virtual float GetFireDelay( void );

	virtual float GetWeaponAccuracy( float flPlayerSpeed );

	//Pure animation calls - inheriting classes can override with specific
	//logic, eg if the idle changes depending on the gun being empty or not
	virtual Activity GetPrimaryAttackActivity( void );
	virtual Activity GetReloadActivity( void );
	virtual Activity GetDrawActivity( void );

	virtual bool CanDrop( void ) { return m_pWeaponInfo->m_bCanDrop; }
	
	void SetZoomed( bool bZoomed ) { m_bZoomed = bZoomed; }
	bool IsSniperZoomed( void ) { return m_bZoomed; }
	CNetworkVar( bool, m_bZoomed );

protected:
	CDODWeaponInfo *m_pWeaponInfo;

private:
	CWeaponDODBaseGun( const CWeaponDODBaseGun & );

#ifndef CLIENT_DLL

	DECLARE_DATADESC();

#endif
};


#endif // WEAPON_DODBASE_GUN_H