summaryrefslogtreecommitdiff
path: root/game/shared/tfc/weapon_tfc_super_shotgun.cpp
blob: 1b4a89e35417bfc834662f20fbb27f0f4aa249b0 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#include "cbase.h"
#include "util.h"
#include "weapon_tfc_super_shotgun.h"
#include "decals.h"
#include "in_buttons.h"

#if defined( CLIENT_DLL )
	#include "c_tfc_player.h"
#else
	#include "tfc_player.h"
#endif


// ----------------------------------------------------------------------------- //
// CTFCSuperShotgun tables.
// ----------------------------------------------------------------------------- //

IMPLEMENT_NETWORKCLASS_ALIASED( TFCSuperShotgun, DT_WeaponSuperShotgun )

BEGIN_NETWORK_TABLE( CTFCSuperShotgun, DT_WeaponSuperShotgun )
END_NETWORK_TABLE()

BEGIN_PREDICTION_DATA( CTFCSuperShotgun )
END_PREDICTION_DATA()

LINK_ENTITY_TO_CLASS( weapon_super_shotgun, CTFCSuperShotgun );
PRECACHE_WEAPON_REGISTER( weapon_super_shotgun );

#ifndef CLIENT_DLL

	BEGIN_DATADESC( CTFCSuperShotgun )
	END_DATADESC()

#endif

// ----------------------------------------------------------------------------- //
// CTFCSuperShotgun implementation.
// ----------------------------------------------------------------------------- //

CTFCSuperShotgun::CTFCSuperShotgun()
{
	m_iShellsReloaded = 2;
}


TFCWeaponID CTFCSuperShotgun::GetWeaponID() const
{
	return WEAPON_SUPER_SHOTGUN;
}


void CTFCSuperShotgun::PrimaryAttack()
{
	CTFCPlayer *pOwner = GetPlayerOwner();
	if ( !pOwner )
		return;

	Assert( Clip1() > 0 );

	// If we've only 1 shell left, fire a single shot
	if ( Clip1() == 1 )
	{
		BaseClass::PrimaryAttack();
		return;
	}

	WeaponSound( SINGLE );
	SendWeaponAnim( ACT_VM_PRIMARYATTACK );
	pOwner->DoAnimationEvent( PLAYERANIMEVENT_FIRE_GUN );

	
	// Shoot!	
	FireBulletsInfo_t info;
	info.m_vecSrc = pOwner->Weapon_ShootPosition();
	info.m_vecDirShooting = pOwner->GetAutoaimVector( AUTOAIM_5DEGREES );
	info.m_iShots = 14;
	info.m_flDistance = 2048;
	info.m_iAmmoType = GetPrimaryAmmoType();
	info.m_vecSpread = VECTOR_CONE_TF_SHOTGUN;
	info.m_iTracerFreq = 4;
	info.m_flDamage = 4;
	pOwner->FireBullets( info );

	m_iClip1 -= 2;
	m_flTimeWeaponIdle = gpGlobals->curtime + 5.0;
	m_fInSpecialReload = 0;

	// Setup fire delays
	if ( Clip1() != 0 )
		m_flPumpTime = gpGlobals->curtime + 0.7;
	
	m_flNextPrimaryAttack = gpGlobals->curtime + 0.7;
}


#ifdef CLIENT_DLL
	
	// ------------------------------------------------------------------------------------------------ //
	// ------------------------------------------------------------------------------------------------ //
	// CLIENT DLL SPECIFIC CODE
	// ------------------------------------------------------------------------------------------------ //
	// ------------------------------------------------------------------------------------------------ //


#else

	// ------------------------------------------------------------------------------------------------ //
	// ------------------------------------------------------------------------------------------------ //
	// GAME DLL SPECIFIC CODE
	// ------------------------------------------------------------------------------------------------ //
	// ------------------------------------------------------------------------------------------------ //

#endif