/
tf_weapon_flamethrower.h
160 lines (128 loc) · 4.33 KB
/
tf_weapon_flamethrower.h
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
//
//=============================================================================
#ifndef TF_WEAPON_FLAMETHROWER_H
#define TF_WEAPON_FLAMETHROWER_H
#ifdef _WIN32
#pragma once
#endif
#include "tf_weaponbase_gun.h"
#include "tf_weaponbase_rocket.h"
// Client specific.
#ifdef CLIENT_DLL
#include "particlemgr.h"
#include "particle_util.h"
#include "particles_simple.h"
#include "c_tf_projectile_rocket.h"
#define CTFFlameThrower C_TFFlameThrower
#define CTFFlameRocket C_TFFlameRocket
#else
#include "tf_projectile_rocket.h"
#include "baseentity.h"
#endif
enum FlameThrowerState_t
{
// Firing states.
FT_STATE_IDLE = 0,
FT_STATE_STARTFIRING,
FT_STATE_FIRING
};
//=========================================================
// Flamethrower Weapon
//=========================================================
class CTFFlameThrower : public CTFWeaponBaseGun
{
DECLARE_CLASS( CTFFlameThrower, CTFWeaponBaseGun );
public:
DECLARE_DATADESC();
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
CTFFlameThrower();
~CTFFlameThrower();
virtual void Spawn( void );
virtual int GetWeaponID( void ) const { return TF_WEAPON_FLAMETHROWER; }
virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
virtual void ItemPostFrame( void );
virtual void PrimaryAttack();
virtual void SecondaryAttack();
virtual bool Lower( void );
virtual void WeaponReset( void );
virtual void DestroySounds( void );
Vector GetVisualMuzzlePos();
Vector GetFlameOriginPos();
#if defined( CLIENT_DLL )
virtual bool Deploy( void );
virtual void OnDataChanged(DataUpdateType_t updateType);
virtual void UpdateOnRemove( void );
virtual void SetDormant( bool bDormant );
// Start/stop flame sound and particle effects
void StartFlame();
void StopFlame( bool bAbrupt = false );
void RestartParticleEffect();
// constant pilot light sound
void StartPilotLight();
void StopPilotLight();
#endif
private:
Vector GetMuzzlePosHelper( bool bVisualPos );
CNetworkVar( int, m_iWeaponState );
CNetworkVar( bool, m_bCritFire );
float m_flStartFiringTime;
float m_flNextPrimaryAttackAnim;
int m_iParticleWaterLevel;
float m_flAmmoUseRemainder;
#if defined( CLIENT_DLL )
CSoundPatch *m_pFiringStartSound;
CSoundPatch *m_pFiringLoop;
bool m_bFiringLoopCritical;
bool m_bFlameEffects;
CSoundPatch *m_pPilotLightSound;
#endif
CTFFlameThrower( const CTFFlameThrower & );
};
//=============================================================================
#define TF_FLAMETHROWER_ROCKET_DAMAGE 15
#define TF_FLAMETHROWER_ROCKET_BURN_RADIUS 198
// Generic flame rocket.
class CTFFlameRocket : public CTFProjectile_Rocket
{
DECLARE_CLASS( CTFFlameRocket, CTFProjectile_Rocket );
public:
DECLARE_NETWORKCLASS();
virtual int GetWeaponID( void ) const { return TF_WEAPON_FLAMETHROWER_ROCKET; }
virtual float GetRadius() { return TF_FLAMETHROWER_ROCKET_BURN_RADIUS; }
#ifdef GAME_DLL
// Creation.
static CTFFlameRocket *Create( const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity *pOwner = NULL );
virtual void Spawn();
virtual void Precache();
#else
virtual const char *GetTrailParticleName( void ) { return "incendiaryrockettrail"; }
#endif
};
#ifdef GAME_DLL
class CTFFlameEntity : public CBaseEntity
{
DECLARE_CLASS( CTFFlameEntity, CBaseEntity );
public:
virtual void Spawn( void );
public:
static CTFFlameEntity *Create( const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity *pOwner, int iDmgType, float m_flDmgAmount );
void FlameThink( void );
void CheckCollision( CBaseEntity *pOther, bool *pbHitWorld );
private:
void OnCollide( CBaseEntity *pOther );
Vector m_vecInitialPos; // position the flame was fired from
Vector m_vecPrevPos; // position from previous frame
Vector m_vecBaseVelocity; // base velocity vector of the flame (ignoring rise effect)
Vector m_vecAttackerVelocity; // velocity of attacking player at time flame was fired
float m_flTimeRemove; // time at which the flame should be removed
int m_iDmgType; // damage type
float m_flDmgAmount; // amount of base damage
CUtlVector<EHANDLE> m_hEntitiesBurnt; // list of entities this flame has burnt
EHANDLE m_hAttacker; // attacking player
int m_iAttackerTeam; // team of attacking player
};
#endif // GAME_DLL
#endif // TF_WEAPON_FLAMETHROWER_H