-
Notifications
You must be signed in to change notification settings - Fork 18
/
c_ff_player.h
638 lines (515 loc) · 18.5 KB
/
c_ff_player.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
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
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef C_FF_PLAYER_H
#define C_FF_PLAYER_H
#ifdef _WIN32
#pragma once
#endif
#include "ff_playeranimstate.h"
#include "c_baseplayer.h"
#include "ff_shareddefs.h"
#include "baseparticleentity.h"
#include "ff_esp_shared.h"
#include "ff_mapguide.h"
#include "ff_weapon_base.h"
#include "ff_grenade_base.h"
#include "iviewrender_beams.h"
#include "Sprite.h"
#include "ff_fx_infection.h"
#include "ff_fx_immunity.h"
#include "ff_fx_jetpack.h"
#include "ff_buildableobjects_shared.h"
#include "ff_radiotagdata.h"
#include "model_types.h"
#include "IEffects.h"
class C_FFBuildableObject;
class C_FFDetpack;
class C_FFDispenser;
class C_FFSentryGun;
class C_FFManCannon;
#define FF_BUILD_NONE 0
#define FF_BUILD_DISPENSER 1
#define FF_BUILD_SENTRYGUN 2
#define FF_BUILD_DETPACK 3
#define FF_BUILD_MANCANNON 4
// BEG: Added by Mulchman for team junk
#define FF_TEAM_UNASSIGNED 0
#define FF_TEAM_SPEC 1
#define FF_TEAM_BLUE 2
#define FF_TEAM_RED 3
#define FF_TEAM_YELLOW 4
#define FF_TEAM_GREEN 5
// END: Added by Mulchman for team junk
// moved this here from ff_shareddefs.h, because it's client-only and needs to stop wasting server compile time
#define FF_CLOAK_MATERIAL "effects/cloak"
#define FF_CLOAK_TEXTURE_GROUP TEXTURE_GROUP_CLIENT_EFFECTS
extern ConVar r_selfshadows;
void SetStealMouseForAimSentry( bool bValue );
bool CanStealMouseForAimSentry( void );
//void SetStealMouseForCloak( bool bValue );
//bool CanStealMouseForCloak( void );
bool CC_PrimeOne(void);
bool CC_PrimeTwo(void);
bool CC_ThrowGren(void);
// --> Mirv: More gren priming functions
bool CC_ToggleOne( void );
bool CC_ToggleTwo( void );
// <-- Mirv: More gren priming functions
bool CC_SpyCloak( void );
bool CC_SpySilentCloak( void );
bool CC_SpySmartCloak( void );
bool CC_EngyMe( void );
bool CC_SaveMe( void );
bool CC_AmmoMe( void );
// Moved here from ff_shareddefs.h
typedef struct SpyInfo_s
{
char m_szName[ MAX_PLAYER_NAME_LENGTH ]; // Name we're using
char m_szNameLastSeen[ MAX_PLAYER_NAME_LENGTH ]; // Name we're using
int m_iTeam; // Disguised team
int m_iClass; // Disguised class
void Set( const char *pszName, int iTeam, int iClass )
{
if(pszName[0])
Q_strcpy( m_szNameLastSeen, pszName );
Q_strcpy( m_szName, pszName );
m_iTeam = iTeam;
m_iClass = iClass;
}
void SetTeam( int iTeam ) { m_iTeam = iTeam; }
void SetClass( int iClass ) { m_iClass = iClass; }
void SetName( const char *pszName )
{
if(pszName[0])
Q_strcpy( m_szNameLastSeen, pszName );
Q_strcpy( m_szName, pszName );
}
bool SameGuy( int iTeam, int iClass ) const
{
return( ( m_iTeam == iTeam ) && ( m_iClass == iClass ) );
}
} CrosshairInfo_s;
//=============================================================================
//
// Class CFFPipebombCounter
//
//=============================================================================
//-----------------------------------------------------------------------------
// Purpose: Silly class to encapsulate how many pipes a player has out currently
//-----------------------------------------------------------------------------
class CFFPipebombCounter
{
public:
CFFPipebombCounter( void )
{
m_iPipes = -1;
}
void Increment( void )
{
m_iPipes = clamp( m_iPipes + 1, 0, 8 );
}
// Call this when the player dies
void CFFPipebombCounter::Reset( void )
{
m_iPipes = -1;
}
// Get the number of pipes out
int CFFPipebombCounter::GetPipes( void ) const
{
return m_iPipes;
}
private:
int m_iPipes;
};
class C_FFPlayer : public C_BasePlayer, public IFFPlayerAnimStateHelpers
{
public:
DECLARE_CLASS( C_FFPlayer, C_BasePlayer );
DECLARE_CLIENTCLASS();
DECLARE_PREDICTABLE();
DECLARE_INTERPOLATION();
C_FFPlayer();
~C_FFPlayer();
static C_FFPlayer* GetLocalFFPlayer();
static C_FFPlayer* GetLocalFFPlayerOrObserverTarget();
static C_FFPlayer* GetLocalFFPlayerOrAnyObserverTarget();
virtual void UpdateClientSideAnimation();
virtual void PostDataUpdate( DataUpdateType_t updateType );
virtual void OnPreDataChanged( DataUpdateType_t updateType );
virtual void OnDataChanged( DataUpdateType_t updateType );
virtual int DrawModel( int flags );
virtual bool IsOverridingViewmodel( void ) { return IsCloaked(); };
virtual int DrawOverriddenViewmodel( C_BaseViewModel *pViewmodel, int flags ) { return pViewmodel ? pViewmodel->DrawOverriddenViewmodel( flags ) : 0; }
virtual const QAngle& GetRenderAngles( void );
virtual void PlayerUse( void );
virtual RenderGroup_t GetRenderGroup();
void DrawPlayerIcons();
//--- Added by L0ki ---
virtual void Simulate();
//---------------------
// --> hlstriker: Pushes players out of team entities
void AvoidPlayers( CUserCmd *pCmd );
bool IsEntIntersectingBox( C_BaseEntity *pEnt, const Vector& boxMin, const Vector& boxMax );
C_BaseEntity* FindTeamIntersect( C_Team *pTeam, const Vector& boxMin, const Vector& boxMax );
// <-- hlstriker
// client version of CBasePlayer::IsOnLadder
virtual bool IsOnLadder( void ) { return GetMoveType() == MOVETYPE_LADDER; }
protected:
// For render origin
Vector m_vecFeetOrigin;
// Beg: Added by Mulchman for building objects and such
CNetworkHandle( C_FFDispenser, m_hDispenser );
CNetworkHandle( C_FFSentryGun, m_hSentryGun );
CNetworkHandle( C_FFDetpack, m_hDetpack );
CNetworkHandle( C_FFManCannon, m_hManCannon );
// Used for seeing if a player is currently
// trying to build a detpack, dispenser, or sentry gun
CNetworkVar( bool, m_bStaticBuilding );
CNetworkVar( bool, m_bBuilding );
// Tells us what we are currently trying to build
CNetworkVar( int, m_iCurBuild );
public:
bool AnyActiveDispenserSabotages() { return (m_iActiveSabotages & 1); }
bool AnyActiveSentrySabotages() { return (m_iActiveSabotages & 2); }
bool IsBuilding( void ) const;
bool IsStaticBuilding( void ) const;
int GetCurrentBuild( void ) const;
C_FFDetpack *GetDetpack( void ) const;
C_FFDispenser *GetDispenser( void ) const;
C_FFSentryGun *GetSentryGun( void ) const;
C_FFManCannon *GetManCannon( void ) const;
C_FFBuildableObject *GetBuildable( int iBuildable ) const;
// End: Added by Mulchman for building objects and such
// Gets the entity at player's current objective (set by Lua)
CBaseEntity *GetCurrObjectiveEntity( void ) { return dynamic_cast< CBaseEntity * >( m_hObjectiveEntity.Get() ); }
// Gets the origin of player's current objective (set by Lua)
Vector GetCurrObjectiveOrigin( void ) { return m_vecObjectiveOrigin.Get(); }
bool IsInfected( void ) const { return m_bInfected; }
// Two girls for every boy?
CSmartPtr< CInfectionEmitter > m_pInfectionEmitter1;
CSmartPtr< CInfectionEmitter > m_pInfectionEmitter2;
int m_iInfectTick;
bool IsImmune( void ) const { return m_bImmune; }
CSmartPtr< CImmunityEmitter > m_pImmunityEmitter1;
CSmartPtr< CImmunityEmitter > m_pImmunityEmitter2;
bool IsJetpacking( void ) const { return m_bJetpacking; }
CSmartPtr< CJetpackEmitter > m_pJetpackEmitter;
private:
bool m_bInfected;
bool m_bImmune;
int m_iActiveSabotages;
int m_iSpyDisguising;
bool m_bJetpacking;
// Called by shared code.
// for HUD ammo pickup history
int m_iOldPrimary;
int m_iOldSecondary;
public:
// IFFPlayerAnimState overrides.
virtual CFFWeaponBase* FFAnim_GetActiveWeapon();
virtual bool FFAnim_CanMove();
virtual CFFPlayer* FFAnim_GetPlayer();
virtual char const *DamageDecal( int bitsDamageType, int gameMaterial );
void DoAnimationEvent( PlayerAnimEvent_t event );
bool ShouldDraw();
IFFPlayerAnimState *m_PlayerAnimState;
QAngle m_angEyeAngles;
CInterpolatedVar< QAngle > m_iv_angEyeAngles;
CNetworkVar( int, m_iShotsFired ); // number of shots fired recently
EHANDLE m_hRagdoll;
CFFWeaponBase *GetActiveFFWeapon() const;
C_BaseAnimating *BecomeRagdollOnClient( bool bCopyEntity);
IRagdoll* C_FFPlayer::GetRepresentativeRagdoll() const;
void FireBullet(
Vector vecSrc,
const QAngle &shootAngles,
float vecSpread,
float flDamage, // |-- Mirv: Float
int iBulletType,
CBaseEntity *pevAttacker,
bool bDoEffects,
float x,
float y,
float flSniperRifleCharge = 0.0f ); // added by Mulchman 9/20/2005
// |-- Mirv: Modified a bit
// --> Mirv: Proper sound effects
void PlayJumpSound( Vector &vecOrigin, surfacedata_t *psurface, float fvol );
void PlayFallSound( Vector &vecOrigin, surfacedata_t *psurface, float fvol );
void PlayStepSound( Vector &vecOrigin, surfacedata_t *psurface, float fvol, bool force );
virtual void Precache();
float m_flJumpTime;
float m_flFallTime;
// <-- Mirv: Proper sound effects
// ---> added by billdoor
public:
CNetworkVar( bool, m_fRandomPC );
int NeedsArmor( void ) const { return GetMaxArmor() - GetArmor(); }
// ---> end
// ---> Jiggles: Tracks priming times for hint logic
float m_flGrenPrimeTime;
int m_iUnprimedGrenCount;
int m_iUnthrownGrenCount;
bool m_bLastPrimed;
// ---> end
// --> mulch
int GetHealthPercentage( void ) const;
int GetArmorPercentage( void ) const;
// This is so when we ID a disguised spy we use the same
// player name until that spy disguises as something else
SpyInfo_s m_hSpyTracking[ MAX_PLAYERS + 1 ];
// The current guy you're ID'ing
// This is mainly for if you want to
// add %i lookup in messages
CrosshairInfo_s m_hCrosshairInfo;
virtual ShadowType_t ShadowCastType( void );
public:
SpyDisguiseWeapon m_DisguisedWeapons[CLASS_CIVILIAN+1][MAX_WEAPON_SLOTS];
void MapDisguisedWeaponSlot(int classId, int spyWeaponSlot, CFFWeaponInfo *disguisedWeaponInfo);
int GetDisguisedClass( void ) const;
int GetDisguisedTeam( void ) const;
bool IsDisguised( void ) const;
// Client-side only -- the return value is positive while disguising (and it changes every time the disguise command is issued)
// However, it DOESN'T match up with the actual class (b/c it needs to change if the same class disguise is picked again)
int IsDisguising( void ) const { return m_iSpyDisguising; }
CNetworkVar( int, m_iSpyDisguise );
int GetLastDisguisedClass( void ) const;
int GetLastDisguisedTeam( void ) const;
bool HasLastDisguise( void ) const;
CNetworkVar( int, m_iLastSpyDisguise );
public:
// Returns true if the player can disguise
bool IsDisguisable( void ) const { return m_bDisguisable; }
private:
bool m_bDisguisable;
// <-- mulch
private:
// ---> FF movecode stuff (billdoor)
friend CFFGameMovement;
void StartSkiing(void) { if(m_iSkiState == 0) m_iSkiState = 1; m_iLocalSkiState = 1; };
void StopSkiing(void) { if(m_iSkiState == 1) m_iSkiState = 0; m_iLocalSkiState = 0; };
int GetSkiState(void) { return m_iSkiState.Get(); };
CNetworkVar(int, m_iSkiState);
// this version of the ski state is not sent over the network, but is altered only by the movecode for the local player
int m_iLocalSkiState;
// ---> end
//private:
// This isn't velocity.Length() so only use it for cloak stuffs
//float m_flCloakSpeed;
//public:
//float GetCloakSpeed( void ) const { return m_flCloakSpeed; }
public:
float GetMovementSpeed() const;
// Beg: Added by L0ki for grenade stuff
public:
CNetworkVar(int, m_iGrenadeState);
CNetworkVar(float, m_flServerPrimeTime);
CNetworkVar(int, m_iPrimary);
CNetworkVar(int, m_iSecondary);
float m_flPrimeTime;
float m_flLatency;
// End: Added by L0ki for grenade stuff
// squeek: If the player has been detected as attempting to mathack
bool m_bMathackDetected;
// 0000818: Grenade timer not playing on second of double primes
float m_flLastServerPrimeTime;
// --> Mirv: Map guide stuff
CNetworkHandle( CFFMapGuide, m_hNextMapGuide );
CNetworkHandle( CFFMapGuide, m_hLastMapGuide );
float m_flNextMapGuideTime;
// <-- Mirv: Map guide stuff
// --> Mirv: Conc stuff
float m_flConcTime;
QAngle m_angConced, m_angConcedTest;
CNetworkVar( float, m_flTrueAimTime );
CNetworkVar( float, m_flHitTime );
virtual const QAngle &EyeAngles();
virtual void CalcViewModelView( const Vector& eyeOrigin, const QAngle& eyeAngles);
virtual void CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov );
virtual void ClientThink( void );
virtual void PreThink( void );
virtual void PostThink( void );
// <-- Mirv: Conc stuff
// --> Mirv: Hold some class info on the player side
int m_iClassStatus;
int GetClassSlot( void ) const;
void ClassSpecificSkill();
void ClassSpecificSkillHold();
void ClassSpecificSkill_Post();
// <-- Mirv: Hold some class info on the player side
CNetworkVar( float, m_flNextClassSpecificSkill );
CNetworkVar( int, m_iJetpackFuel );
float m_flJetpackNextFuelRechargeTime;
int m_iSpawnInterpCounter;
int m_iSpawnInterpCounterCache;
void SwapToWeapon(FFWeaponID);
void SwapToWeaponSlot(int iSlot);
bool m_bFirstSpawn;
virtual void Spawn( void );
virtual void CreateMove(float flInputSampleTime, CUserCmd *pCmd);
virtual void Death();
// Mirv: In TFC the AbsOrigin is midway up the model. We need to take this into
// account for various things.
Vector GetFeetOrigin( void );
virtual void FireBullets(const FireBulletsInfo_t &info);
virtual bool HandleShotImpactingWater(const FireBulletsInfo_t &info, const Vector &vecEnd, ITraceFilter *pTraceFilter, Vector *pVecTracerDest);
virtual void AddEntity();
void ReleaseFlashlight();
virtual void NotifyShouldTransmit(ShouldTransmitState_t state);
virtual bool ShouldReceiveProjectedTextures(int flags);
Beam_t *m_pFlashlightBeam;
float m_flIdleTime;
bool Weapon_Switch(CBaseCombatWeapon *pWeapon, int viewmodelindex = 0);
CBaseCombatWeapon *m_pOldActiveWeapon;
float m_flNextJumpTimeForDouble;
bool m_bCanDoubleJump;
virtual float GetFOV();
float m_flSpeedModifier;
int m_iHallucinationIndex;
float m_flHallucinationFinish;
// Defrag -> Needed to stop flashlight conc-hax!
void UpdateFlashlight( void );
// ----------------------------------
public:
Color GetTeamColor( void ) const { return m_clrTeamColor; }
protected:
Color m_clrTeamColor;
// ----------------------------------
// ----------------------------------
// SaveMe stuffs
public:
bool IsInSaveMe( void ) const { return m_bSaveMe; }
protected:
bool m_bSaveMe;
float m_flSaveMeTime; //Also used for EngyMe and AmmoMe
// ----------------------------------
// ----------------------------------
// EngyMe stuffs
public:
bool IsInEngyMe( void ) const { return m_bEngyMe; }
protected:
bool m_bEngyMe;
// ----------------------------------
// ----------------------------------
// AmmoMe stuffs
public:
bool IsInAmmoMe( void ) const { return m_bAmmoMe; }
protected:
bool m_bAmmoMe;
// ----------------------------------
// ELMO ***
// ----------------------------------
// Concussion
public:
bool IsConcussed( void ) const { return m_bConcussed; }
protected:
bool m_bConcussed;
// ----------------------------------
// *** ELMO
// ----------------------------------
// ELMO ***
// ----------------------------------
// Concussion
public:
bool IsTranqed( void ) const { return m_bTranqed; }
protected:
bool m_bTranqed;
// ----------------------------------
// *** ELMO
// SQUEEK ***
// ----------------------------------
// Sliding
public:
bool IsSliding( void ) const { return m_bSliding; }
float m_flSlidingTime;
protected:
bool m_bSliding;
// ----------------------------------
// *** SQUEEK
public:
bool IsRampsliding( void ) const { return m_bIsRampsliding; }
void SetRampsliding( bool bIsRampsliding ) { m_bIsRampsliding = bIsRampsliding; }
protected:
bool m_bIsRampsliding;
float m_flNextRampslideFX;
// ----------------------------------
// Cloak stuff
public:
void Command_SpyCloak( void );
void Command_SpySilentCloak( void );
void Command_SpySmartCloak( void );
void Command_AmmoMe( void );
void Command_SaveMe( void );
void Command_EngyMe( void );
bool IsCloaked( void ) const { return m_iCloaked != 0; }
private:
void Cloak( void );
unsigned int m_iCloaked;
float m_flNextCloak;
public:
// Returns true if the player can cloak
bool IsCloakable( void ) const { return m_bCloakable; }
private:
bool m_bCloakable;
// ----------------------------------
// ----------------------------------
// Overpressure stuff
public:
void Overpressure( void );
bool CanJetpack( void );
void JetpackHold( void );
void JetpackRechargeThink( void );
void SharedPreThink( void );
// ----------------------------------
// ----------------------------------
// Local slowfield
public:
C_FFGrenadeBase *GetActiveSlowfield( void ) { return m_hActiveSlowfield.Get(); }
bool IsInSlowfield( void ) { return (m_hActiveSlowfield != NULL); }
private:
CNetworkHandle( C_FFGrenadeBase, m_hActiveSlowfield );
// ----------------------------------
private:
C_FFPlayer( const C_FFPlayer & );
// ----------------------------------
// Local radio tag data
public:
C_FFRadioTagData *GetRadioTagData( void ) { return m_hRadioTagData.Get(); }
private:
CNetworkHandle( C_FFRadioTagData, m_hRadioTagData );
// ----------------------------------
// ----------------------------------
// Pipebomb stuff
public:
CFFPipebombCounter *GetPipebombCounter( void ) { return &m_hPipebombCounter; }
private:
CFFPipebombCounter m_hPipebombCounter;
// ----------------------------------
// ----------------------------------
// info_intermission angles
private:
QAngle m_vecInfoIntermission;
// ----------------------------------
// Entity at player's current objective (set by Lua)
CNetworkHandle( CBaseEntity, m_hObjectiveEntity );
// Location of player's current objective (also set by Lua)
CNetworkVector( m_vecObjectiveOrigin );
// Dexter: grenade timer killin' shit
static void C_FFPlayer::StopGrenTimersListener(bf_read &msg);
//public:
// void C_FFPlayer::GrenadeTimerExpired(C_FFTimer *pTimer);
};
// Just straight up copying the server version. Tired
// of this nonsense.
inline C_FFPlayer *ToFFPlayer( CBaseEntity *pEntity )
{
if( !pEntity || !pEntity->IsPlayer() )
return NULL;
#ifdef _DEBUG
Assert( dynamic_cast< C_FFPlayer * >( pEntity ) != 0 );
#endif
return static_cast< C_FFPlayer * >( pEntity );
}
#endif // C_FF_PLAYER_H