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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#if !defined( C_BASETFPLAYER_H )
#define C_BASETFPLAYER_H
#ifdef _WIN32
#pragma once
#endif
#include "tf_vehicleshared.h"
#include "c_baseplayer.h"
#include "CommanderOverlay.h"
#include "hud_minimap.h"
#include "hud_targetreticle.h"
#include "c_tfplayerlocaldata.h"
#include "particlemgr.h"
#include "particle_prototype.h"
#include "particle_util.h"
#include "tf_playeranimstate.h"
class C_VehicleTeleportStation;
class CViewSetup;
class IMaterial;
class C_Order;
class C_BaseObject;
class C_PlayerClass;
class CPersonalShieldEffect;
class CBasePredictedWeapon;
class C_BaseViewModel;
class CUserCmd;
class C_WeaponCombatShield;
//-----------------------------------------------------------------------------
// Purpose: Client Side TF Player entity
//-----------------------------------------------------------------------------
class C_BaseTFPlayer : public C_BasePlayer
{
public:
DECLARE_CLASS( C_BaseTFPlayer, C_BasePlayer );
DECLARE_CLIENTCLASS();
DECLARE_ENTITY_PANEL();
DECLARE_MINIMAP_PANEL();
DECLARE_PREDICTABLE();
C_BaseTFPlayer();
virtual ~C_BaseTFPlayer();
private:
void Clear(); // Clear all elements.
public:
bool IsHidden() const;
bool IsDamageBoosted() const;
bool HasNamedTechnology( const char *name );
float LastAttackTime() const { return m_flLastAttackTime; }
void SetLastAttackTime( float flTime ) { m_flLastAttackTime = flTime; }
// Return this client's C_BaseTFPlayer pointer
static C_BaseTFPlayer* GetLocalPlayer( void )
{
return ( static_cast< C_BaseTFPlayer * >( C_BasePlayer::GetLocalPlayer() ) );
}
virtual void ClientThink( void );
virtual void OnPreDataChanged( DataUpdateType_t updateType );
virtual void OnDataChanged( DataUpdateType_t updateType );
virtual void PreDataUpdate( DataUpdateType_t updateType );
virtual void PostDataUpdate( DataUpdateType_t updateType );
virtual void ReceiveMessage( int classID, bf_read &msg );
virtual void Release( void );
virtual void ItemPostFrame( void );
virtual bool ShouldDraw();
virtual int DrawModel( int flags );
virtual void SetDormant( bool bDormant );
virtual void GetBoneControllers(float controllers[MAXSTUDIOBONES]);
virtual int GetRenderTeamNumber( void );
virtual void ComputeFxBlend( void );
virtual bool IsTransparent( void );
// Called by the view model if its rendering is being overridden.
virtual bool ViewModel_IsTransparent( void );
virtual bool IsOverridingViewmodel( void );
virtual int DrawOverriddenViewmodel( C_BaseViewModel *pViewmodel, int flags );
virtual void CreateMove( float flInputSampleTime, CUserCmd *pCmd );
virtual float GetDefaultAnimSpeed( void );
int GetClass( void );
// Called when not in tactical mode. Allows view to be overriden for things like driving a tank.
void OverrideView( CViewSetup *pSetup );
// Called when not in tactical mode. Allows view model drawing to be disabled for things like driving a tank.
bool ShouldDrawViewModel();
void GetTargetDescription( char *pDest, int bufferSize );
// Orders
void SetPersonalOrder( C_Order *pOrder );
void RemoveOrderTarget();
// Resources
int GetBankResources( void );
// Objects
void SetSelectedObject( C_BaseObject *pObject );
C_BaseObject *GetSelectedObject( void );
int GetNumObjects( int iObjectType );
int GetObjectCount( void );
C_BaseObject *GetObject( int index );
// Targets
void Add_Target( C_BaseEntity *pTarget, const char *sName );
void Remove_Target( C_BaseEntity *pTarget );
void Remove_Target( CTargetReticle *pTargetReticle );
void UpdateTargetReticles( void );
bool IsUsingThermalVision( void ) const;
// Weapon handling
virtual bool IsAllowedToSwitchWeapons( void );
virtual bool Weapon_ShouldSetLast( CBaseCombatWeapon *pOldWeapon, CBaseCombatWeapon *pNewWeapon );
virtual bool Weapon_ShouldSelectItem( CBaseCombatWeapon *pWeapon );
virtual C_BaseCombatWeapon *GetActiveWeaponForSelection( void );
virtual C_BaseCombatWeapon *GetLastWeaponBeforeObject( void ) { return m_hLastWeaponBeforeObject; }
virtual C_BaseAnimating* GetRenderedWeaponModel();
// ID Target
void SetIDEnt( C_BaseEntity *pEntity );
int GetIDTarget( void ) const;
void UpdateIDTarget( void );
bool IsKnockedDown( void ) const;
void CheckKnockdownState( void );
bool CheckKnockdownAngleOverride( void ) const;
void SetKnockdownAngles( const QAngle& ang );
void GetKnockdownAngles( QAngle& outAngles );
float GetKnockdownViewheightAdjust( void ) const;
// Team handling
virtual void TeamChange( int iNewTeam );
// Camouflage effect
virtual bool IsCamouflaged( void );
virtual float GetCamouflageAmount( void );
virtual float ComputeCamoEffectAmount( void ); // 0 - visible, 1 = invisible
virtual int ComputeCamoAlpha( void );
virtual void CheckCamoDampening( void );
virtual void SetCamoDampening( float amount );
virtual float GetDampeningAmount( void );
virtual void CheckCameraMovement( void );
IMaterial *GetCamoMaterial( void );
virtual float GetMovementCamoSuppression( void );
virtual void CheckMovementCamoSuppression( void );
virtual void SetMovementCamoSuppression( float amount );
// Adrenalin
void CheckAdrenalin( void );
void CheckLastMovement( void );
float GetLastMoveTime( void );
float GetOverlayAlpha( void );
float GetLastDamageTime( void ) const;
float GetLastGainHealthTime( void ) const;
// Powerups
virtual void PowerupStart( int iPowerup, bool bInitial );
virtual void PowerupEnd( int iPowerup );
// Sniper
bool IsDeployed( void );
bool IsDeploying( void );
bool IsUnDeploying( void );
virtual void AddEntity( void );
// Vertification
inline bool HasClass( void ) { return GetPlayerClass() != NULL; }
bool IsClass( TFClass iClass );
virtual int GetMaxHealth() const { return m_iMaxHealth; }
bool ClassProxyUpdate( int nClassID );
// Should this object cast shadows?
virtual ShadowType_t ShadowCastType();
// Prediction stuff
virtual void PreThink( void );
virtual void PostThink( void );
// Combat prototyping
bool IsBlocking( void ) const { return m_bIsBlocking; }
bool IsParrying( void ) const { return m_bIsParrying; }
void SetBlocking( bool bBlocking ) { m_bIsBlocking = bBlocking; }
void SetParrying( bool bParrying ) { m_bIsParrying = bParrying; }
// Vehicles
void SetVehicleRole( int nRole );
bool CanGetInVehicle( void );
// Returns true if we're in a vehicle and it's mounted on another vehicle
// (ie: are we in a manned gun that's mounted on a tank).
bool IsVehicleMounted() const;
virtual bool IsUseableEntity( CBaseEntity *pEntity );
// Shared Client / Server code
public:
bool IsHittingShield( const Vector &vecVelocity, float *flDamage );
C_WeaponCombatShield *GetCombatShield( void );
virtual void PainSound( void );
public:
// Data for only the local player
CTFPlayerLocalData m_TFLocal;
// Accessors...
const QAngle& DeployedAngles() const { return m_vecDeployedAngles; }
int ZoneState() const { return m_iCurrentZoneState; }
float CamouflageAmount() const { return m_flCamouflageAmount; }
int PlayerClass() const { return m_iPlayerClass; }
C_PlayerClass *GetPlayerClass();
C_Order *PersonalOrder() { return m_hPersonalOrder; }
C_BaseEntity *SpawnPoint() { return m_hSpawnPoint.Get(); }
C_VehicleTeleportStation* GetSelectedMCV() const;
// Object sapper placement handling
//float m_flSapperAttachmentFinishTime;
//float m_flSapperAttachmentStartTime;
//CHandle< CGrenadeObjectSapper > m_hSapper;
//CHandle< CBaseObject > m_hSappedObject;
CHealthBarPanel *m_pSapperAttachmentStatus;
private:
C_BaseTFPlayer( const C_BaseTFPlayer & );
// Client-side obstacle avoidance
void PerformClientSideObstacleAvoidance( float flFrameTime, CUserCmd *pCmd );
float m_flLastAttackTime;
EHANDLE m_hSelectedMCV;
// Weapon used before switching to an object placement
CHandle<C_BaseCombatWeapon> m_hLastWeaponBeforeObject;
float m_flCamouflageAmount;
// Movement.
Vector m_vecPosDelta;
enum { MOMENTUM_MAXSIZE = 10 };
float m_aMomentum[MOMENTUM_MAXSIZE];
int m_iMomentumHead;
// Player Class
int m_iPlayerClass;
C_AllPlayerClasses m_PlayerClasses;
// Spawn location...
EHANDLE m_hSpawnPoint;
// Orders
CHandle< C_Order > m_hSelectedOrder;
CHandle< C_Order > m_hPersonalOrder;
int m_iSelectedTarget;
int m_iPersonalTarget;
CUtlVector< CTargetReticle * > m_aTargetReticles; // A list of entities to show target reticles for
// Objects
CHandle< C_BaseObject > m_hSelectedObject;
int m_iLastHealth;
bool m_bIsBlocking;
bool m_bIsParrying;
bool m_bUnderAttack;
int m_iMaxHealth;
bool m_bDeployed;
bool m_bDeploying;
bool m_bUnDeploying;
QAngle m_vecDeployedAngles;
int m_iCurrentZoneState;
int m_TFPlayerFlags;
int m_nOldTacticalView;
int m_nOldPlayerClass;
float m_flNextUseCheck;
bool m_bOldThermalVision;
bool m_bOldAttachingSapper;
bool m_bOldKnockDownState;
float m_flStartKnockdown;
float m_flEndKnockdown;
QAngle m_vecOriginalViewAngles;
QAngle m_vecCurrentKnockdownAngles;
QAngle m_vecKnockDownGoalAngles;
bool m_bKnockdownOverrideAngles;
float m_flKnockdownViewheightAdjust;
CPlayerAnimState m_PlayerAnimState;
// For sniper hiding
float m_flLastMoveTime;
Vector m_vecLastOrigin;
// For material proxies
float m_flLastDamageTime;
float m_flLastGainHealthTime;
IMaterial *m_pThermalMaterial;
IMaterial *m_pCamoEffectMaterial;
// Camouflage
float m_flDampeningAmount;
float m_flGoalDampeningAmount;
float m_flDampeningStayoutTime;
// Suppression of camo based on movement
float m_flMovementCamoSuppression;
float m_flGoalMovementCamoSuppressionAmount;
float m_flMovementCamoSuppressionStayoutTime;
// Adrenalin
float m_flNextAdrenalinEffect;
bool m_bFadingIn;
// ID Target
int m_iIDEntIndex;
CMaterialReference m_BoostMaterial;
CMaterialReference m_EMPMaterial;
float m_BoostModelAngles[3];
// Personal shield effects.
CUtlLinkedList<CPersonalShieldEffect*, int> m_PersonalShieldEffects;
CHandle< C_WeaponCombatShield > m_hWeaponCombatShield;
// No one should call this
C_BaseTFPlayer& operator=( const C_BaseTFPlayer& src );
friend void RecvProxy_PlayerClass( const CRecvProxyData *pData, void *pStruct, void *pOut );
friend class CTFPrediction;
};
int GetLocalPlayerClass( void );
bool IsLocalPlayerClass( int iClass );
bool IsLocalPlayerInTactical( );
inline C_BaseTFPlayer *ToBaseTFPlayer( C_BaseEntity *pEntity )
{
if ( !pEntity || !pEntity->IsPlayer() )
return NULL;
#if _DEBUG
return dynamic_cast<C_BaseTFPlayer *>( pEntity );
#else
return static_cast<C_BaseTFPlayer *>( pEntity );
#endif
}
#endif // C_BASETFPLAYER_H
|