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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef WEAPON_C4_H
#define WEAPON_C4_H
#ifdef _WIN32
#pragma once
#endif
#include "weapon_csbase.h"
#include "utlvector.h"
#define NUM_BEEPS 7
#if defined( CLIENT_DLL )
#define CC4 C_C4
#else
// ------------------------------------------------------------------------------------------ //
// CPlantedC4 class.
// ------------------------------------------------------------------------------------------ //
class CPlantedC4 : public CBaseAnimating
{
public:
DECLARE_CLASS( CPlantedC4, CBaseAnimating );
DECLARE_DATADESC();
DECLARE_SERVERCLASS();
DECLARE_PREDICTABLE();
CPlantedC4();
virtual ~CPlantedC4();
virtual int UpdateTransmitState();
virtual void SetTransmit( CCheckTransmitInfo *pInfo, bool bAlways );
virtual int ShouldTransmit( const CCheckTransmitInfo *pInfo );
static CPlantedC4* ShootSatchelCharge( CCSPlayer *pevOwner, Vector vecStart, QAngle vecAngles );
virtual void Precache();
// Set these flags so CTs can use the C4 to disarm it.
virtual int ObjectCaps() { return BaseClass::ObjectCaps() | (FCAP_CONTINUOUS_USE | FCAP_USE_IN_RADIUS); }
void SetBombSiteIndex( int iIndex ){ m_iBombSiteIndex = iIndex; }
inline bool IsBombActive( void ) { return m_bBombTicking; }
//=============================================================================
// HPE_BEGIN:
// [tj] Accessors related to planting of the bomb
//=============================================================================
CCSPlayer* GetPlanter() { return m_pPlanter; }
void SetPlanter(CCSPlayer* player) { m_pPlanter = player; }
void SetPlantedAfterPickup (bool plantedAfterPickup) { m_bPlantedAfterPickup = plantedAfterPickup; }
//=============================================================================
// HPE_END
//=============================================================================
public:
CNetworkVar( bool, m_bBombTicking );
CNetworkVar( float, m_flC4Blow );
private:
void Init( CCSPlayer *pevOwner, Vector vecStart, QAngle vecAngles );
void C4Think();
// This becomes the think function when the timer has expired and it is about to explode.
void DetonateThink();
void Explode( trace_t *pTrace, int bitsDamageType );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
// Replicate timer length to the client for effects
CNetworkVar( float, m_flTimerLength );
// Info for defusing.
CHandle<CCSPlayer> m_pBombDefuser;
float m_flNextDefuse;
bool m_bStartDefuse;
int m_iBombSiteIndex;
CNetworkVar( float, m_flDefuseLength ); //How long does the defuse take? Depends on if a defuser was used
CNetworkVar( float, m_flDefuseCountDown ); //What time does the defuse complete?
// Control panel
void GetControlPanelInfo( int nPanelIndex, const char *&pPanelName );
void GetControlPanelClassName( int nPanelIndex, const char *&pPanelName );
void SpawnControlPanels();
typedef CHandle<CVGuiScreen> ScreenHandle_t;
CUtlVector<ScreenHandle_t> m_hScreens;
int m_iProgressBarTime;
//=============================================================================
// HPE_BEGIN:
//=============================================================================
// [tj] We need to store who planted the bomb so we can track who deserves credits for the kills
CHandle<CCSPlayer> m_pPlanter;
// [tj] We need to know if this was planted by a player who recovered the bomb
bool m_bPlantedAfterPickup;
//=============================================================================
// HPE_END
//=============================================================================
};
extern CUtlVector< CPlantedC4* > g_PlantedC4s;
#endif
#define WEAPON_C4_CLASSNAME "weapon_c4"
#define PLANTED_C4_CLASSNAME "planted_c4"
class CC4 : public CWeaponCSBase
{
public:
DECLARE_CLASS( CC4, CWeaponCSBase );
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
CC4();
virtual ~CC4();
virtual void Spawn();
bool IsPistol() const;
void ItemPostFrame();
virtual void PrimaryAttack();
virtual void WeaponIdle();
virtual void UpdateShieldState( void );
virtual float GetMaxSpeed() const;
// virtual float GetSpread() const;
virtual CSWeaponID GetWeaponID( void ) const { return WEAPON_C4; }
#ifdef CLIENT_DLL
virtual bool OnFireEvent( C_BaseViewModel *pViewModel, const Vector& origin, const QAngle& angles, int event, const char *options );
char *GetScreenText( void );
char m_szScreenText[32];
#else
virtual void Precache();
virtual void GetControlPanelInfo( int nPanelIndex, const char *&pPanelName );
virtual unsigned int PhysicsSolidMaskForEntity( void ) const;
virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
virtual bool ShouldRemoveOnRoundRestart();
//=============================================================================
// HPE_BEGIN:
// [tj] Simple Setter
//=============================================================================
void SetDroppedFromDeath(bool droppedFromDeath) { m_bDroppedFromDeath = droppedFromDeath; }
//=============================================================================
// HPE_END
//=============================================================================
#endif
void AbortBombPlant();
void PlayArmingBeeps( void );
virtual void OnPickedUp( CBaseCombatCharacter *pNewOwner );
virtual void Drop( const Vector &vecVelocity );
CNetworkVar( bool, m_bStartedArming );
CNetworkVar( float, m_fArmedTime );
CNetworkVar( bool, m_bBombPlacedAnimation );
virtual bool IsRemoveable( void ) { return false; }
private:
bool m_bPlayedArmingBeeps[NUM_BEEPS];
bool m_bBombPlanted;
//=============================================================================
// HPE_BEGIN:
// [tj] we want to store if this bomb was dropped because the original owner was killed
//=============================================================================
bool m_bDroppedFromDeath;
//=============================================================================
// HPE_END
//=============================================================================
private:
CC4( const CC4 & );
};
// All the currently-active C4 grenades.
extern CUtlVector< CC4* > g_C4s;
#endif // WEAPON_C4_H
|