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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: TF Pipebomb Grenade.
//
//=============================================================================//
#ifndef TF_WEAPON_GRENADE_PIPEBOMB_H
#define TF_WEAPON_GRENADE_PIPEBOMB_H
#ifdef _WIN32
#pragma once
#endif
#include "tf_weaponbase_grenadeproj.h"
// Client specific.
#ifdef CLIENT_DLL
#define CTFGrenadePipebombProjectile C_TFGrenadePipebombProjectile
#endif
//-----------------------------------------------------------------------------
// Grenade Launcher mode (for pipebombs).
//-----------------------------------------------------------------------------
enum
{
TF_GL_MODE_REGULAR = 0,
TF_GL_MODE_REMOTE_DETONATE,
TF_GL_MODE_REMOTE_DETONATE_PRACTICE,
TF_GL_MODE_CANNONBALL,
//
// ADD NEW ITEMS HERE TO AVOID BREAKING DEMOS
//
};
//=============================================================================
//
// TF Pipebomb Grenade
//
class CTFGrenadePipebombProjectile : public CTFWeaponBaseGrenadeProj
{
public:
DECLARE_CLASS( CTFGrenadePipebombProjectile, CTFWeaponBaseGrenadeProj );
DECLARE_NETWORKCLASS();
CTFGrenadePipebombProjectile();
~CTFGrenadePipebombProjectile();
// Unique identifier.
virtual int GetWeaponID( void ) const;
int GetType( void ) const { return m_iType; }
virtual int GetDamageType();
bool HasStickyEffects() const { return m_iType == TF_GL_MODE_REMOTE_DETONATE || m_iType == TF_GL_MODE_REMOTE_DETONATE_PRACTICE; }
bool ShouldMiniCritOnReflect() const;
void SetChargeTime( float flChargeTime ) { m_flChargeTime = flChargeTime; }
CNetworkVar( bool, m_bTouched );
CNetworkVar( int, m_iType ); // TF_GL_MODE_REGULAR or TF_GL_MODE_REMOTE_DETONATE
float m_flCreationTime;
float m_flChargeTime;
bool m_bPulsed;
float m_flFullDamage;
void SetFullDamage( float flFullDamage ) { m_flFullDamage = flFullDamage; }
CNetworkVar( bool, m_bDefensiveBomb );
virtual void UpdateOnRemove( void );
virtual void SetCustomPipebombModel() {}
virtual float GetLiveTime( void );
virtual float GetDamageRadius() OVERRIDE;
void SetDetonateOnPulse( bool bDet ) { m_bDetonateOnPulse = bDet; }
#ifdef CLIENT_DLL
virtual void OnDataChanged( DataUpdateType_t updateType );
virtual const char *GetTrailParticleName( void );
virtual int DrawModel( int flags );
virtual void Simulate( void );
virtual void CreateTrailParticles( void );
void SetHighlight( bool bHighlight ) { if ( m_bPulsed ) m_bHighlight = bHighlight; }
bool IsHighlighted( void ) { return m_bHighlight; }
int m_iCachedDeflect;
CNewParticleEffect *pEffectTrail;
CNewParticleEffect *pEffectCrit;
bool m_bHighlight;
bool m_bDetonateOnPulse;
CGlowObject *m_pGlowEffect;
#else
DECLARE_DATADESC();
// Creation.
static CTFGrenadePipebombProjectile *Create( const Vector &position, const QAngle &angles, const Vector &velocity,
const AngularImpulse &angVelocity, CBaseCombatCharacter *pOwner, const CTFWeaponInfo &weaponInfo, int iPipeBombType, float flMultDmg );
static const char* GetPipebombClass( int iPipeBombType );
// Overrides.
virtual void Spawn();
virtual void Precache();
virtual void BounceSound( void );
virtual void Detonate();
virtual void Fizzle();
virtual bool DetonateStickies( void );
bool CanTakeDamage() const { return m_bCanTakeDamage; }
void SetCanTakeDamage( bool bCanTakeDamage ) { m_bCanTakeDamage = bCanTakeDamage; }
virtual void SetPipebombMode( int iPipebombMode = TF_GL_MODE_REGULAR );
bool IsFizzle() { return m_bFizzle; }
virtual void PipebombTouch( CBaseEntity *pOther );
virtual void StickybombTouch( CBaseEntity *pOther );
virtual void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent );
virtual int OnTakeDamage( const CTakeDamageInfo &info );
virtual void IncrementDeflected( void );
virtual void DetonateThink( void );
virtual void PreArmThink( void );
virtual void ArmThink( void );
void CreatePipebombGibs( void );
virtual bool IsDeflectable( void ) { return true; }
virtual void Deflected( CBaseEntity *pDeflectedBy, Vector& vecDir );
virtual int GetDamageCustom();
float GetTouchedTime() { return m_flTouchedTime; }
bool IsTouched() { return m_bTouched; }
public:
bool m_bFizzle;
bool m_bWallShatter;
private:
float m_flMinSleepTime;
float m_flDeflectedTime;
bool m_bSendPlayerDestroyedEvent;
bool m_bDetonateOnPulse;
bool m_bCanTakeDamage;
float m_flTouchedTime;
float GetDamageScaleOnWorldContact();
CUtlVector < CHandle <CTFPlayer> > m_CritMedics;
CUtlVector < CHandle <CBaseEntity> > m_penetratedEntities;
#endif
};
#endif // TF_WEAPON_GRENADE_PIPEBOMB_H
|