Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1297 lines
42 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Shared player code.
  4. //
  5. //=============================================================================
  6. #ifndef TF_PLAYER_SHARED_H
  7. #define TF_PLAYER_SHARED_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "networkvar.h"
  12. #include "tf_shareddefs.h"
  13. #include "tf_weaponbase.h"
  14. #include "basegrenade_shared.h"
  15. #include "SpriteTrail.h"
  16. #include "tf_condition.h"
  17. // Client specific.
  18. #ifdef CLIENT_DLL
  19. #include "baseobject_shared.h"
  20. #include "c_tf_weapon_builder.h"
  21. class C_TFPlayer;
  22. // Server specific.
  23. #else
  24. #include "entity_currencypack.h"
  25. #include "tf_weapon_builder.h"
  26. class CTFPlayer;
  27. #endif
  28. //=============================================================================
  29. //
  30. // Tables.
  31. //
  32. // Client specific.
  33. #ifdef CLIENT_DLL
  34. EXTERN_RECV_TABLE( DT_TFPlayerShared );
  35. // Server specific.
  36. #else
  37. EXTERN_SEND_TABLE( DT_TFPlayerShared );
  38. #endif
  39. enum
  40. {
  41. MELEE_NOCRIT = 0,
  42. MELEE_MINICRIT = 1,
  43. MELEE_CRIT = 2,
  44. };
  45. struct stun_struct_t
  46. {
  47. CHandle<CTFPlayer> hPlayer;
  48. float flDuration;
  49. float flExpireTime;
  50. float flStartFadeTime;
  51. float flStunAmount;
  52. int iStunFlags;
  53. };
  54. //=============================================================================
  55. #define PERMANENT_CONDITION -1
  56. #define MOVEMENTSTUN_PARITY_BITS 2
  57. // Damage storage for crit multiplier calculation
  58. class CTFDamageEvent
  59. {
  60. #ifdef CLIENT_DLL
  61. // This redundantly declares friendship which leads to gcc warnings.
  62. //DECLARE_CLIENTCLASS_NOBASE();
  63. #else
  64. public:
  65. // This redundantly declares friendship which leads to gcc warnings.
  66. //DECLARE_SERVERCLASS_NOBASE();
  67. #endif
  68. DECLARE_EMBEDDED_NETWORKVAR();
  69. public:
  70. float flDamage;
  71. float flDamageCritScaleMultiplier; // scale the damage by this amount when taking it into consideration for "should I crit?" calculations
  72. float flTime;
  73. int nDamageType;
  74. byte nKills;
  75. };
  76. #ifdef CLIENT_DLL
  77. struct WheelEffect_t
  78. {
  79. WheelEffect_t( float flTriggerSpeed, const char *pszRedParticleName, const char *pszBlueParticleName )
  80. : m_flMinTriggerSpeed( flTriggerSpeed )
  81. {
  82. memset( m_pszParticleName, NULL, sizeof( m_pszParticleName ) );
  83. m_pszParticleName[ TF_TEAM_RED ] = pszRedParticleName;
  84. m_pszParticleName[ TF_TEAM_BLUE ] = pszBlueParticleName;
  85. }
  86. float m_flMinTriggerSpeed;
  87. const char *m_pszParticleName[ TF_TEAM_COUNT ];
  88. };
  89. #endif
  90. //=============================================================================
  91. // Scoring data for the local player
  92. struct RoundStats_t;
  93. struct localplayerscoring_t
  94. {
  95. DECLARE_EMBEDDED_NETWORKVAR();
  96. DECLARE_CLASS_NOBASE( localplayerscoring_t );
  97. localplayerscoring_t()
  98. {
  99. Reset();
  100. }
  101. void Reset( void )
  102. {
  103. m_iCaptures = 0;
  104. m_iDefenses = 0;
  105. m_iKills = 0;
  106. m_iDeaths = 0;
  107. m_iSuicides = 0;
  108. m_iKillAssists = 0;
  109. m_iBuildingsBuilt = 0;
  110. m_iBuildingsDestroyed = 0;
  111. m_iHeadshots = 0;
  112. m_iDominations = 0;
  113. m_iRevenge = 0;
  114. m_iInvulns = 0;
  115. m_iTeleports = 0;
  116. m_iDamageDone = 0;
  117. m_iCrits = 0;
  118. m_iBackstabs = 0;
  119. m_iHealPoints = 0;
  120. m_iResupplyPoints = 0;
  121. m_iBonusPoints = 0;
  122. m_iPoints = 0;
  123. }
  124. void UpdateStats( RoundStats_t& roundStats, CTFPlayer *pPlayer, bool bIsRoundData );
  125. CNetworkVar( int, m_iCaptures );
  126. CNetworkVar( int, m_iDefenses );
  127. CNetworkVar( int, m_iKills );
  128. CNetworkVar( int, m_iDeaths );
  129. CNetworkVar( int, m_iSuicides );
  130. CNetworkVar( int, m_iDominations );
  131. CNetworkVar( int, m_iRevenge );
  132. CNetworkVar( int, m_iBuildingsBuilt );
  133. CNetworkVar( int, m_iBuildingsDestroyed );
  134. CNetworkVar( int, m_iHeadshots );
  135. CNetworkVar( int, m_iBackstabs );
  136. CNetworkVar( int, m_iHealPoints );
  137. CNetworkVar( int, m_iInvulns );
  138. CNetworkVar( int, m_iTeleports );
  139. CNetworkVar( int, m_iDamageDone );
  140. CNetworkVar( int, m_iCrits );
  141. CNetworkVar( int, m_iResupplyPoints );
  142. CNetworkVar( int, m_iKillAssists );
  143. CNetworkVar( int, m_iBonusPoints );
  144. CNetworkVar( int, m_iPoints );
  145. };
  146. // Condition Provider
  147. struct condition_source_t
  148. {
  149. DECLARE_EMBEDDED_NETWORKVAR();
  150. DECLARE_CLASS_NOBASE( condition_source_t );
  151. condition_source_t()
  152. {
  153. m_nPreventedDamageFromCondition = 0;
  154. m_flExpireTime = 0.f;
  155. m_pProvider = NULL;
  156. m_bPrevActive = false;
  157. }
  158. int m_nPreventedDamageFromCondition;
  159. float m_flExpireTime;
  160. CNetworkHandle( CBaseEntity, m_pProvider );
  161. bool m_bPrevActive;
  162. };
  163. //=============================================================================
  164. // For checkpointing upgrades Players have purchased in Mann Vs Machine
  165. class CUpgradeInfo
  166. {
  167. public:
  168. int m_iPlayerClass; // the character class this upgrade is being applied too
  169. item_definition_index_t m_itemDefIndex; // item that was upgraded (or INVALID_ITEM_DEF_INDEX for the player itself)
  170. int m_upgrade; // the upgrade that was applied
  171. int m_nCost; // price of the upgrade
  172. };
  173. //=============================================================================
  174. //
  175. // Shared player class.
  176. //
  177. class CTFPlayerShared : public CGameEventListener
  178. {
  179. public:
  180. // Client specific.
  181. #ifdef CLIENT_DLL
  182. friend class C_TFPlayer;
  183. typedef C_TFPlayer OuterClass;
  184. DECLARE_PREDICTABLE();
  185. // Server specific.
  186. #else
  187. friend class CTFPlayer;
  188. typedef CTFPlayer OuterClass;
  189. #endif
  190. DECLARE_EMBEDDED_NETWORKVAR()
  191. DECLARE_CLASS_NOBASE( CTFPlayerShared );
  192. private:
  193. struct RageBuff
  194. {
  195. int m_iBuffTypeActive;
  196. int m_iBuffPulseCount;
  197. float m_flNextBuffPulseTime;
  198. };
  199. // Condition Provider tracking
  200. CUtlVector< condition_source_t > m_ConditionData;
  201. public:
  202. enum ERageBuffSlot
  203. {
  204. kBuffSlot_Rage,
  205. kBuffSlot_Decapitation,
  206. kBuffSlot_MAX,
  207. };
  208. enum ETFStreak
  209. {
  210. kTFStreak_Kills = 0,
  211. kTFStreak_KillsAll = 1, // Counts all kills not just attr based killstreak. For Data collection purposes
  212. kTFStreak_Ducks = 2,
  213. kTFStreak_Duck_levelup = 3,
  214. kTFStreak_COUNT = 4,
  215. };
  216. enum EKartStateFlags
  217. {
  218. kKartState_Driving = 1 << 0,
  219. kKartState_Braking = 1 << 1,
  220. kKartState_Reversing = 1 << 2,
  221. kKartState_Stopped = 1 << 3,
  222. kKartState_SteerLeft = 1 << 4,
  223. kKartState_SteerRight = 1 << 5
  224. };
  225. // Initialization.
  226. CTFPlayerShared();
  227. void Init( OuterClass *pOuter );
  228. void Spawn( void );
  229. // State (TF_STATE_*).
  230. int GetState() const { return m_nPlayerState; }
  231. void SetState( int nState ) { m_nPlayerState = nState; }
  232. bool InState( int nState ) { return ( m_nPlayerState == nState ); }
  233. // Condition (TF_COND_*).
  234. void AddCond( ETFCond eCond, float flDuration = PERMANENT_CONDITION, CBaseEntity *pProvider = NULL );
  235. void RemoveCond( ETFCond eCond, bool ignore_duration=false );
  236. bool InCond( ETFCond eCond ) const;
  237. bool WasInCond( ETFCond eCond ) const;
  238. void ForceRecondNextSync( ETFCond eCond );
  239. void RemoveAllCond();
  240. void OnConditionAdded( ETFCond eCond );
  241. void OnConditionRemoved( ETFCond eCond );
  242. void ConditionThink( void );
  243. float GetConditionDuration( ETFCond eCond ) const;
  244. void SetConditionDuration( ETFCond eCond, float flNewDur )
  245. {
  246. Assert( eCond < m_ConditionData.Count() );
  247. m_ConditionData[eCond].m_flExpireTime = flNewDur;
  248. }
  249. CBaseEntity *GetConditionProvider( ETFCond eCond ) const;
  250. CBaseEntity *GetConditionAssistFromVictim( void );
  251. CBaseEntity *GetConditionAssistFromAttacker( void );
  252. void ConditionGameRulesThink( void );
  253. void InvisibilityThink( void );
  254. void CheckDisguiseTimer( void );
  255. int GetMaxBuffedHealth( bool bIgnoreAttributes = false, bool bIgnoreHealthOverMax = false );
  256. bool IsAiming( void );
  257. void SetCarryingRuneType( RuneTypes_t rt );
  258. RuneTypes_t GetCarryingRuneType( void ) const;
  259. bool IsCarryingRune( void ) const { return GetCarryingRuneType() != RUNE_NONE; }
  260. float m_flRuneAcquireTime;
  261. #ifdef CLIENT_DLL
  262. // This class only receives calls for these from C_TFPlayer, not
  263. // natively from the networking system
  264. virtual void OnPreDataChanged( void );
  265. virtual void OnDataChanged( void );
  266. // check the newly networked conditions for changes
  267. void SyncConditions( int nPreviousConditions, int nNewConditions, int nForceConditionBits, int nBaseCondBit );
  268. enum ECritBoostUpdateType { kCritBoost_Ignore, kCritBoost_ForceRefresh };
  269. void UpdateCritBoostEffect( ECritBoostUpdateType eUpdateType = kCritBoost_Ignore );
  270. bool ShouldShowRecentlyTeleported( void );
  271. void EndRadiusHealEffect( void );
  272. void EndKingBuffRadiusEffect( void );
  273. #endif
  274. bool IsCritBoosted( void ) const;
  275. bool IsInvulnerable( void ) const;
  276. bool IsStealthed( void ) const;
  277. bool CanBeDebuffed( void ) const;
  278. void Disguise( int nTeam, int nClass, CTFPlayer* pDesiredTarget=NULL, bool bOnKill = false );
  279. void CompleteDisguise( void );
  280. void RemoveDisguise( void );
  281. void RemoveDisguiseWeapon( void );
  282. void FindDisguiseTarget( void );
  283. int GetDisguiseTeam( void ) const;
  284. int GetDisguiseClass( void ) const { return InCond( TF_COND_DISGUISED_AS_DISPENSER ) ? (int)TF_CLASS_ENGINEER : m_nDisguiseClass; }
  285. int GetDisguisedSkinOverride( void ) const { return m_nDisguiseSkinOverride; }
  286. int GetDisguiseMask( void ) const { return InCond( TF_COND_DISGUISED_AS_DISPENSER ) ? (int)TF_CLASS_ENGINEER : m_nMaskClass; }
  287. int GetDesiredDisguiseClass( void ) const { return m_nDesiredDisguiseClass; }
  288. int GetDesiredDisguiseTeam( void ) const { return m_nDesiredDisguiseTeam; }
  289. bool WasLastDisguiseAsOwnTeam( void ) const { return m_bLastDisguisedAsOwnTeam; }
  290. int GetDisguiseTargetIndex( void ) const { return m_iDisguiseTargetIndex; }
  291. EHANDLE GetDisguiseTarget( void ) const
  292. {
  293. #ifdef CLIENT_DLL
  294. if ( m_iDisguiseTargetIndex == TF_DISGUISE_TARGET_INDEX_NONE )
  295. return NULL;
  296. return cl_entitylist->GetNetworkableHandle( m_iDisguiseTargetIndex );
  297. #else
  298. return m_hDisguiseTarget.Get();
  299. #endif
  300. }
  301. CTFWeaponBase *GetDisguiseWeapon( void ) { return m_hDisguiseWeapon; }
  302. int GetDisguiseHealth( void ) { return m_iDisguiseHealth; }
  303. void SetDisguiseHealth( int iDisguiseHealth );
  304. int GetDisguiseMaxHealth( void );
  305. int GetDisguiseMaxBuffedHealth( bool bIgnoreAttributes = false, bool bIgnoreHealthOverMax = false );
  306. void ProcessDisguiseImpulse( CTFPlayer *pPlayer );
  307. int GetDisguiseAmmoCount( void ) { return m_iDisguiseAmmo; }
  308. void SetDisguiseAmmoCount( int nValue ) { m_iDisguiseAmmo = nValue; }
  309. bool CanRecieveMedigunChargeEffect( medigun_charge_types eType ) const;
  310. #ifdef CLIENT_DLL
  311. int GetDisplayedTeam( void ) const;
  312. void OnDisguiseChanged( void );
  313. float GetTimeTeleEffectAdded( void ) { return m_flGotTeleEffectAt; }
  314. int GetTeamTeleporterUsed( void ) { return m_nTeamTeleporterUsed; }
  315. void ClientDemoBuffThink( void );
  316. void ClientKillStreakBuffThink( void );
  317. #endif
  318. int CalculateObjectCost( CTFPlayer* pBuilder, int iObjectType );
  319. // Pickup effects, including putting out fires, updating HUD, etc.
  320. void HealthKitPickupEffects( int iHealthGiven = 0 );
  321. #ifdef GAME_DLL
  322. void DetermineDisguiseWeapon( bool bForcePrimary = false );
  323. void DetermineDisguiseWearables();
  324. void RemoveDisguiseWearables();
  325. void Heal( CBaseEntity *pHealer, float flAmount, float flOverhealBonus, float flOverhealDecayMult, bool bDispenserHeal = false, CTFPlayer *pHealScorer = NULL );
  326. float StopHealing( CBaseEntity *pHealer );
  327. void TestAndExpireChargeEffect( medigun_charge_types iCharge );
  328. void RecalculateChargeEffects( bool bInstantRemove = false );
  329. int FindHealerIndex( CBaseEntity *pPlayer );
  330. EHANDLE GetFirstHealer();
  331. void CheckForAchievement( int iAchievement );
  332. void IncrementArenaNumChanges( void ) { m_nArenaNumChanges++; }
  333. void ResetArenaNumChanges( void ) { m_nArenaNumChanges = 0; }
  334. bool AddToSpyCloakMeter( float val, bool bForce=false );
  335. void AddTmpDamageBonus( float flBonus, float flExpiration );
  336. float GetTmpDamageBonus( void ) { return (InCond(TF_COND_TMPDAMAGEBONUS)) ? m_flTmpDamageBonusAmount : 1.0; }
  337. void SetTeamTeleporterUsed( int nTeam ){ m_nTeamTeleporterUsed.Set( nTeam ); }
  338. void SetBiteEffectWasApplied() { m_bBiteEffectWasApplied = true; }
  339. #endif // GAME_DLL
  340. int GetArenaNumChanges( void ) { return m_nArenaNumChanges; }
  341. CBaseEntity *GetHealerByIndex( int index );
  342. bool HealerIsDispenser( int index );
  343. int GetNumHealers( void ) { return m_nNumHealers; }
  344. void Burn( CTFPlayer *pPlayer, CTFWeaponBase *pWeapon, float flBurningTime = -1.0f );
  345. void SelfBurn( float flBurningTime ); // Boss Burn
  346. void MakeBleed( CTFPlayer *pPlayer, CTFWeaponBase *pWeapon, float flBleedingTime, int nBleedDmg = TF_BLEEDING_DMG, bool bPermanentBleeding = false );
  347. #ifdef GAME_DLL
  348. void StopBleed( CTFPlayer *pPlayer, CTFWeaponBase *pWeapon );
  349. #endif // GAME_DLL
  350. // Weapons.
  351. CTFWeaponBase *GetActiveTFWeapon() const;
  352. // Utility.
  353. bool IsAlly( CBaseEntity *pEntity );
  354. // Separation force
  355. bool IsSeparationEnabled( void ) const { return m_bEnableSeparation; }
  356. void SetSeparation( bool bEnable ) { m_bEnableSeparation = bEnable; }
  357. const Vector &GetSeparationVelocity( void ) const { return m_vSeparationVelocity; }
  358. void SetSeparationVelocity( const Vector &vSeparationVelocity ) { m_vSeparationVelocity = vSeparationVelocity; }
  359. void FadeInvis( float fAdditionalRateScale );
  360. float GetPercentInvisible( void ) const;
  361. float GetPercentInvisiblePrevious( void ) { return m_flPrevInvisibility; }
  362. void NoteLastDamageTime( int nDamage );
  363. void OnSpyTouchedByEnemy( void );
  364. float GetLastStealthExposedTime( void ) { return m_flLastStealthExposeTime; }
  365. void SetNextStealthTime( float flTime ) { m_flStealthNextChangeTime = flTime; }
  366. #ifdef STAGING_ONLY
  367. bool IsFullyInvisible( void ) { return GetPercentInvisible() == 1.f || InCond( TF_COND_STEALTHED_PHASE ); }
  368. #else
  369. bool IsFullyInvisible( void ) { return ( GetPercentInvisible() == 1.f ); }
  370. #endif
  371. bool IsEnteringOrExitingFullyInvisible( void );
  372. bool CanRuneCharge() const;
  373. float GetRuneCharge() const { return m_flRuneCharge; }
  374. void SetRuneCharge( float flVal ) { m_flRuneCharge = Clamp( flVal, 0.f, 100.f ); }
  375. bool IsRuneCharged() const { return m_flRuneCharge == 100.f; }
  376. #ifdef STAGING_ONLY
  377. bool HasPhaseCloakAbility( void );
  378. float GetSpaceJumpChargeMeter() const { return m_flSpaceJumpCharge; }
  379. void SetSpaceJumpChargeMeter( float val ) { m_flSpaceJumpCharge = Min( val, 100.0f); }
  380. #endif // STAGING_ONLY
  381. int GetDesiredPlayerClassIndex( void );
  382. bool IsInUpgradeZone( void ) { return m_bInUpgradeZone; }
  383. void SetInUpgradeZone( bool bInZone ) { m_bInUpgradeZone = bInZone; }
  384. // Cloak, rage, phase, team juice...this should really all be done with composition?
  385. void UpdateCloakMeter( void );
  386. float GetSpyCloakMeter() const { return m_flCloakMeter; }
  387. void SetSpyCloakMeter( float val ) { m_flCloakMeter = val; }
  388. void UpdateRageBuffsAndRage();
  389. bool IsRageDraining() const { return m_bRageDraining; }
  390. float GetRageMeter() const { return m_flRageMeter; }
  391. void SetRageMeter( float val );
  392. void ModifyRage( float fDelta );
  393. void ResetRageMeter( void );
  394. void PulseRageBuff( ERageBuffSlot eBuffSlot );
  395. void StartRageDrain( void ) { m_bRageDraining = true; }
  396. void ResetRageSystem( void );
  397. void ActivateRageBuff( CBaseEntity *pBuffItem, int iBuffType );
  398. void SetupRageBuffTimer( int iBuffType, int iPulseCount, ERageBuffSlot eBuffSlot );
  399. void ResetRageBuffs( void );
  400. void UpdatePhaseEffects( void );
  401. void AddPhaseEffects( void );
  402. void RemovePhaseEffects( void );
  403. void PulseMedicRadiusHeal( void );
  404. float GetScoutEnergyDrinkMeter() const{ return m_flEnergyDrinkMeter; }
  405. void SetScoutEnergyDrinkMeter( float val ) { m_flEnergyDrinkMeter = val; }
  406. void UpdateEnergyDrinkMeter( void );
  407. float GetScoutHypeMeter() const { return m_flHypeMeter; }
  408. void SetScoutHypeMeter( float val );
  409. void StopScoutHypeDrain( void ) { RemoveCond( TF_COND_SODAPOPPER_HYPE ); }
  410. bool IsHypeBuffed( void ) const { return InCond( TF_COND_SODAPOPPER_HYPE ); }
  411. void DemoShieldChargeThink( void );
  412. void UpdateChargeMeter( void );
  413. float GetDemomanChargeMeter() const { return m_flChargeMeter; }
  414. void EndCharge( void );
  415. float CalculateChargeCap( void ) const;
  416. void SetDemomanChargeMeter( float val ) { m_flChargeMeter = Clamp( val, 0.0f, 100.0f); }
  417. void CalcChargeCrit( bool bForceCrit=false );
  418. bool HasDemoShieldEquipped() const;
  419. bool IsJumping( void ) const { return m_bJumping; }
  420. void SetJumping( bool bJumping );
  421. bool IsAirDashing( void ) const { return (m_iAirDash > 0); }
  422. int GetAirDash( void ) const { return m_iAirDash; }
  423. void SetAirDash( int iAirDash );
  424. void SetAirDucked( int nAirDucked ) { m_nAirDucked = nAirDucked; }
  425. int AirDuckedCount( void ) { return m_nAirDucked; }
  426. void SetDuckTimer( float flTime ) { m_flDuckTimer = flTime; }
  427. float GetDuckTimer( void ) const { return m_flDuckTimer; }
  428. void DebugPrintConditions( void );
  429. void InstantlySniperUnzoom( void );
  430. float GetStealthNoAttackExpireTime( void );
  431. void SetPlayerDominated( CTFPlayer *pPlayer, bool bDominated );
  432. bool IsPlayerDominated( int iPlayerIndex );
  433. bool IsPlayerDominatingMe( int iPlayerIndex );
  434. void SetPlayerDominatingMe( CTFPlayer *pPlayer, bool bDominated );
  435. float GetDisguiseCompleteTime( void ) { return m_flDisguiseCompleteTime; }
  436. bool IsSpyDisguisedAsMyTeam( CTFPlayer *pPlayer );
  437. // Stuns
  438. stun_struct_t *GetActiveStunInfo( void ) const;
  439. #ifdef GAME_DLL
  440. void StunPlayer( float flTime, float flReductionAmount, int iStunFlags = TF_STUN_MOVEMENT, CTFPlayer* pAttacker = NULL );
  441. #endif // GAME_DLL
  442. float GetAmountStunned( int iStunFlags );
  443. bool IsLoserStateStunned( void ) const;
  444. bool IsControlStunned( void );
  445. bool IsSnared( void );
  446. CTFPlayer *GetStunner( void );
  447. void ControlStunFading( void );
  448. int GetStunFlags( void ) const { return GetActiveStunInfo() ? GetActiveStunInfo()->iStunFlags : 0; }
  449. float GetStunExpireTime( void ) const { return GetActiveStunInfo() ? GetActiveStunInfo()->flExpireTime : 0; }
  450. void SetStunExpireTime( float flTime );
  451. void UpdateLegacyStunSystem( void );
  452. bool IsFirstBloodBoosted( void ) const { return m_bArenaFirstBloodBoost; }
  453. void SetFirstBloodBoosted( bool bBoost ) { m_bArenaFirstBloodBoost = bBoost; }
  454. CTFPlayer *GetAssist( void ) const { return m_hAssist; }
  455. void SetAssist( CTFPlayer* newAssist ) { m_hAssist = newAssist; }
  456. CTFPlayer *GetBurnAttacker( void ) const { return m_hBurnAttacker; }
  457. CTFPlayer *GetOriginalBurnAttacker( void ) const { return m_hOriginalBurnAttacker; }
  458. void SetCloakConsumeRate( float newCloakConsumeRate ) { m_fCloakConsumeRate = newCloakConsumeRate; }
  459. void SetCloakRegenRate( float newCloakRegenRate ) { m_fCloakRegenRate = newCloakRegenRate; }
  460. int GetWeaponKnockbackID( void ) const { return m_iWeaponKnockbackID; }
  461. void SetWeaponKnockbackID( int iID ) { m_iWeaponKnockbackID = iID; }
  462. bool IsLoadoutUnavailable( void ) { return m_bLoadoutUnavailable; }
  463. void SetLoadoutUnavailable( bool bUnavailable ) { m_bLoadoutUnavailable = bUnavailable; }
  464. float GetInvulOffTime( void ) { return m_flInvulnerabilityRemoveTime; }
  465. int GetDisguiseBody( void ) const { return m_iDisguiseBody; }
  466. void SetDisguiseBody( int iVal ) { m_iDisguiseBody = iVal; }
  467. bool IsCarryingObject( void ) const { return m_bCarryingObject; }
  468. CBaseObject* GetCarriedObject( void ) const { return m_hCarriedObject.Get(); }
  469. void SetCarriedObject( CBaseObject* pObj );
  470. void StartBuildingObjectOfType( int iType, int iObjectMode=0 );
  471. void InterruptCharge( void );
  472. void PulseKingRuneBuff();
  473. public:
  474. // Scoring
  475. int GetCaptures( int iIndex ) const { return m_ScoreData.m_iCaptures; }
  476. int GetDefenses( int iIndex ) const { return m_ScoreData.m_iDefenses; }
  477. int GetDominations( int iIndex ) const { return m_ScoreData.m_iDominations; }
  478. int GetRevenge( int iIndex ) const { return m_ScoreData.m_iRevenge; }
  479. int GetBuildingsDestroyed( int iIndex ) const { return m_ScoreData.m_iBuildingsDestroyed; }
  480. int GetHeadshots( int iIndex ) const { return m_ScoreData.m_iHeadshots; }
  481. int GetBackstabs( int iIndex ) const { return m_ScoreData.m_iBackstabs; }
  482. int GetHealPoints( int iIndex ) const { return m_ScoreData.m_iHealPoints; }
  483. int GetInvulns( int iIndex ) const { return m_ScoreData.m_iInvulns; }
  484. int GetTeleports( int iIndex ) const { return m_ScoreData.m_iTeleports; }
  485. int GetResupplyPoints( int iIndex ) const { return m_ScoreData.m_iResupplyPoints; }
  486. int GetKillAssists( int iIndex ) const { return m_ScoreData.m_iKillAssists; }
  487. int GetBonusPoints( int iIndex ) const { return m_ScoreData.m_iBonusPoints; }
  488. void ResetScores( void ) { m_ScoreData.Reset(); }
  489. localplayerscoring_t *GetScoringData( void ) { return &m_ScoreData; }
  490. // Per-round scoring data utilized by the steamworks stats system.
  491. void ResetRoundScores( void ) { m_RoundScoreData.Reset(); }
  492. localplayerscoring_t *GetRoundScoringData( void ) { return &m_RoundScoreData; }
  493. void SetFeignDeathReady( bool bVal ) { m_bFeignDeathReady = bVal; }
  494. bool IsFeignDeathReady( void ) const { return m_bFeignDeathReady; }
  495. void ReduceFeignDeathDuration( float flAmount ) { m_flFeignDeathEnd -= flAmount; }
  496. void SetShieldEquipped( bool bVal ) { m_bShieldEquipped = bVal; }
  497. bool IsShieldEquipped() const { return m_bShieldEquipped; }
  498. void SetParachuteEquipped( bool bVal ) { m_bParachuteEquipped = bVal; }
  499. bool IsParachuteEquipped() const { return m_bParachuteEquipped; }
  500. void SetNextMeleeCrit( int iVal ) { m_iNextMeleeCrit = iVal; }
  501. int GetNextMeleeCrit( void ) const { return m_iNextMeleeCrit; }
  502. void SetDecapitations( int iVal ) { m_iDecapitations = iVal; }
  503. int GetDecapitations( void ) const { return m_iDecapitations; }
  504. void SetStreak( ETFStreak streak_type, int iVal ) { m_nStreaks.Set( streak_type, iVal ); }
  505. int GetStreak( ETFStreak streak_type ) const { return m_nStreaks[streak_type]; }
  506. int IncrementStreak( ETFStreak streak_type, int iVal )
  507. {
  508. // Track duck streak steps so we can put deltas in the event
  509. if ( streak_type == kTFStreak_Ducks )
  510. m_nLastDuckStreakIncrement = iVal;
  511. m_nStreaks.Set( streak_type, m_nStreaks[streak_type] + iVal );
  512. return m_nStreaks[streak_type];
  513. }
  514. void ResetStreaks( void ) { for ( int streak_type = 0; streak_type < kTFStreak_COUNT; streak_type++ ) { m_nStreaks.Set( streak_type, 0 ); } }
  515. int GetLastDuckStreakIncrement( void ) const { return m_nLastDuckStreakIncrement; }
  516. void SetRevengeCrits( int iVal );
  517. int GetRevengeCrits( void ) const { return m_iRevengeCrits; }
  518. void IncrementRevengeCrits( void );
  519. int GetSequenceForDeath( CBaseAnimating* pRagdoll, bool bBurning, int nCustomDeath );
  520. float GetNextNoiseMakerTime() const { return m_flNextNoiseMakerTime; }
  521. void SetNextNoiseMakerTime( float time ) { m_flNextNoiseMakerTime = time; }
  522. void Heal_Radius ( bool bActive );
  523. void IncrementRespawnTouchCount() { ++m_iSpawnRoomTouchCount; }
  524. void DecrementRespawnTouchCount() { m_iSpawnRoomTouchCount = Max( m_iSpawnRoomTouchCount - 1, 0 ); }
  525. int GetRespawnTouchCount() const { return m_iSpawnRoomTouchCount; }
  526. #ifdef CLIENT_DLL
  527. void SetVehicleMoveAngles( const QAngle& angVehicleMoveAngles ) { m_angVehicleMovePitchLast = angVehicleMoveAngles[PITCH]; m_angVehicleMoveAngles = angVehicleMoveAngles; }
  528. #endif
  529. #ifdef STAGING_ONLY
  530. void DoRocketPack();
  531. #endif // STAGING_ONLY
  532. #ifdef GAME_DLL
  533. void SetBestOverhealDecayMult( float fValue ) { m_flBestOverhealDecayMult = fValue; }
  534. float GetBestOverhealDecayMult() const { return m_flBestOverhealDecayMult; }
  535. void SetPeeAttacker( CTFPlayer *pPlayer ) { m_hPeeAttacker = pPlayer; }
  536. CTFPlayer *GetPeeAttacker() const { return m_hPeeAttacker; }
  537. void SetChargeEffectOffTime( int iCondition, float flTime ) { m_flChargeEffectOffTime[iCondition] = flTime; }
  538. void GetSpeedWatchersList( CUtlVector<CTFPlayer *> *out_pVecSpeedWatchers ) const;
  539. #endif
  540. int GetTauntIndex( void ) const { return m_iTauntIndex; }
  541. int GetTauntConcept( void ) const { return m_iTauntConcept; }
  542. itemid_t GetTauntSourceItemID( void ) const { return ((uint64)m_unTauntSourceItemID_High << 32) | (uint64)m_unTauntSourceItemID_Low; }
  543. void CreateVehicleMove( float flInputSampleTime, CUserCmd *pCmd );
  544. void SetVehicleTurnAmount( float flTurnSpeed ) { m_flCurrentTauntTurnSpeed = flTurnSpeed; }
  545. float GetVehicleTurnPoseAmount( void ) const { return m_flCurrentTauntTurnSpeed; }
  546. void VehicleThink( void );
  547. bool IsLoser( void );
  548. int GetItemFindBonus( void ) //{ return m_iItemFindBonus; }
  549. {
  550. #ifdef GAME_DLL
  551. if ( !m_iItemFindBonus )
  552. {
  553. m_iItemFindBonus = RandomInt( 1, 300 );
  554. }
  555. #endif
  556. return m_iItemFindBonus;
  557. }
  558. void RecalculatePlayerBodygroups( void );
  559. void FireGameEvent( IGameEvent *event );
  560. float GetFlameBurnTime( void ) const { return m_flFlameBurnTime; }
  561. void GetConditionsBits( CBitVec< TF_COND_LAST >& vbConditions ) const;
  562. #ifdef STAGING_ONLY
  563. void UpdateRocketPack( void );
  564. void ApplyRocketPackStun( float flStunDuration );
  565. bool CanBuildSpyTraps( void );
  566. #endif // STAGING_ONLY
  567. private:
  568. CNetworkVarEmbedded( localplayerscoring_t, m_ScoreData );
  569. CNetworkVarEmbedded( localplayerscoring_t, m_RoundScoreData );
  570. private:
  571. #ifdef CLIENT_DLL
  572. typedef std::pair<const char *, float> taunt_particle_state_t;
  573. taunt_particle_state_t GetClientTauntParticleDesiredState() const;
  574. void FireClientTauntParticleEffects();
  575. #endif // CLIENT_DLL
  576. void ImpactWaterTrace( trace_t &trace, const Vector &vecStart );
  577. void OnAddZoomed( void );
  578. void OnAddStealthed( void );
  579. void OnAddInvulnerable( void );
  580. void OnAddTeleported( void );
  581. void OnAddBurning( void );
  582. void OnAddDisguising( void );
  583. void OnAddDisguised( void );
  584. void OnAddDemoCharge( void );
  585. void OnAddCritBoost( void );
  586. void OnAddSodaPopperHype( void );
  587. void OnAddOverhealed( void );
  588. void OnAddFeignDeath( void );
  589. void OnAddStunned( void );
  590. void OnAddPhase( void );
  591. void OnAddUrine( void );
  592. void OnAddMarkedForDeath( void );
  593. void OnAddBleeding( void );
  594. void OnAddDefenseBuff( void );
  595. void OnAddOffenseBuff( void );
  596. void OnAddOffenseHealthRegenBuff( void );
  597. const char* GetSoldierBuffEffectName( void );
  598. void OnAddSoldierOffensiveBuff( void );
  599. void OnAddSoldierDefensiveBuff( void );
  600. void OnAddSoldierOffensiveHealthRegenBuff( void );
  601. void OnAddSoldierNoHealingDamageBuff( void );
  602. void OnAddShieldCharge( void );
  603. void OnAddDemoBuff( void );
  604. void OnAddEnergyDrinkBuff( void );
  605. void OnAddRadiusHeal( void );
  606. void OnAddMegaHeal( void );
  607. void OnAddMadMilk( void );
  608. void OnAddTaunting( void );
  609. void OnAddNoHealingDamageBuff( void );
  610. void OnAddSpeedBoost( bool IsNonCombat );
  611. void OnAddSapped( void );
  612. void OnAddReprogrammed( void );
  613. void OnAddMarkedForDeathSilent( void );
  614. void OnAddDisguisedAsDispenser( void );
  615. void OnAddHalloweenBombHead( void );
  616. void OnAddHalloweenThriller( void );
  617. void OnAddRadiusHealOnDamage( void );
  618. void OnAddMedEffectUberBulletResist( void );
  619. void OnAddMedEffectUberBlastResist( void );
  620. void OnAddMedEffectUberFireResist( void );
  621. void OnAddMedEffectSmallBulletResist( void );
  622. void OnAddMedEffectSmallBlastResist( void );
  623. void OnAddMedEffectSmallFireResist( void );
  624. void OnAddStealthedUserBuffFade( void );
  625. void OnAddBulletImmune( void );
  626. void OnAddBlastImmune( void );
  627. void OnAddFireImmune( void );
  628. void OnAddMVMBotRadiowave( void );
  629. void OnAddHalloweenSpeedBoost( void );
  630. void OnAddHalloweenQuickHeal( void );
  631. void OnAddHalloweenGiant( void );
  632. void OnAddHalloweenTiny( void );
  633. void OnAddHalloweenGhostMode( void );
  634. void OnAddHalloweenKartDash( void );
  635. void OnAddHalloweenKart( void );
  636. void OnAddBalloonHead( void );
  637. void OnAddMeleeOnly( void );
  638. void OnAddSwimmingCurse( void );
  639. void OnAddHalloweenKartCage( void );
  640. void OnAddRuneResist( void );
  641. void OnAddGrapplingHookLatched( void );
  642. void OnAddPasstimeInterception( void );
  643. void OnAddRunePlague( void );
  644. void OnAddPlague( void );
  645. void OnAddKingBuff( void );
  646. void OnAddInPurgatory( void );
  647. void OnAddCompetitiveWinner( void );
  648. void OnAddCompetitiveLoser( void );
  649. #ifdef STAGING_ONLY
  650. void OnAddTranqMark( void );
  651. void OnAddSpaceGravity( void );
  652. void OnAddSelfConc( void );
  653. void OnAddRocketPack( void );
  654. void OnAddStealthedPhase( void );
  655. void OnAddClipOverload( void );
  656. void OnAddCondSpyClassSteal( void );
  657. #endif // STAGING_ONLY
  658. void OnRemoveZoomed( void );
  659. void OnRemoveBurning( void );
  660. void OnRemoveStealthed( void );
  661. void OnRemoveDisguised( void );
  662. void OnRemoveDisguising( void );
  663. void OnRemoveInvulnerable( void );
  664. void OnRemoveTeleported( void );
  665. void OnRemoveDemoCharge( void );
  666. void OnRemoveCritBoost( void );
  667. void OnRemoveSodaPopperHype( void );
  668. void OnRemoveTmpDamageBonus( void );
  669. void OnRemoveOverhealed( void );
  670. void OnRemoveFeignDeath( void );
  671. void OnRemoveStunned( void );
  672. void OnRemovePhase( void );
  673. void OnRemoveUrine( void );
  674. void OnRemoveMarkedForDeath( void );
  675. void OnRemoveBleeding( void );
  676. void OnRemoveInvulnerableWearingOff( void );
  677. void OnRemoveDefenseBuff( void );
  678. void OnRemoveOffenseBuff( void );
  679. void OnRemoveOffenseHealthRegenBuff( void );
  680. void OnRemoveSoldierOffensiveBuff( void );
  681. void OnRemoveSoldierDefensiveBuff( void );
  682. void OnRemoveSoldierOffensiveHealthRegenBuff( void );
  683. void OnRemoveSoldierNoHealingDamageBuff( void );
  684. void OnRemoveShieldCharge( void );
  685. void OnRemoveDemoBuff( void );
  686. void OnRemoveEnergyDrinkBuff( void );
  687. void OnRemoveRadiusHeal( void );
  688. void OnRemoveMegaHeal( void );
  689. void OnRemoveMadMilk( void );
  690. void OnRemoveTaunting( void );
  691. void OnRemoveNoHealingDamageBuff( void );
  692. void OnRemoveSpeedBoost( bool IsNonCombat );
  693. void OnRemoveSapped( void );
  694. void OnRemoveReprogrammed( void );
  695. void OnRemoveMarkedForDeathSilent( void );
  696. void OnRemoveDisguisedAsDispenser( void );
  697. void OnRemoveHalloweenBombHead( void );
  698. void OnRemoveHalloweenThriller( void );
  699. void OnRemoveRadiusHealOnDamage( void );
  700. void OnRemoveMedEffectUberBulletResist( void );
  701. void OnRemoveMedEffectUberBlastResist( void );
  702. void OnRemoveMedEffectUberFireResist( void );
  703. void OnRemoveMedEffectSmallBulletResist( void );
  704. void OnRemoveMedEffectSmallBlastResist( void );
  705. void OnRemoveMedEffectSmallFireResist( void );
  706. void OnRemoveStealthedUserBuffFade( void );
  707. void OnRemoveBulletImmune( void );
  708. void OnRemoveBlastImmune( void );
  709. void OnRemoveFireImmune( void );
  710. void OnRemoveMVMBotRadiowave( void );
  711. void OnRemoveHalloweenSpeedBoost( void );
  712. void OnRemoveHalloweenQuickHeal( void );
  713. void OnRemoveHalloweenGiant( void );
  714. void OnRemoveHalloweenTiny( void );
  715. void OnRemoveHalloweenGhostMode( void );
  716. void OnRemoveHalloweenKartDash( void );
  717. void OnRemoveHalloweenKart( void );
  718. void OnRemoveBalloonHead( void );
  719. void OnRemoveMeleeOnly( void );
  720. void OnRemoveSwimmingCurse( void );
  721. void OnRemoveHalloweenKartCage( void );
  722. void OnRemoveRuneResist( void );
  723. void OnRemoveGrapplingHookLatched( void );
  724. void OnRemovePasstimeInterception( void );
  725. void OnRemoveRunePlague( void );
  726. void OnRemovePlague( void );
  727. void OnRemoveRuneKing( void );
  728. void OnRemoveKingBuff( void );
  729. void OnRemoveRuneSupernova( void );
  730. void OnRemoveInPurgatory( void );
  731. void OnRemoveCompetitiveWinner( void );
  732. void OnRemoveCompetitiveLoser( void );
  733. #ifdef STAGING_ONLY
  734. void OnRemoveTranqMark( void );
  735. void OnRemoveSpaceGravity( void );
  736. void OnRemoveSelfConc( void );
  737. void OnRemoveRocketPack( void );
  738. void OnRemoveStealthedPhase( void );
  739. void OnRemoveClipOverload( void );
  740. void OnRemoveCondSpyClassSteal( void );
  741. #endif // STAGING_ONLY
  742. // Starting a new trend, putting Add and Remove next to each other
  743. void OnAddCondParachute( void );
  744. void OnRemoveCondParachute( void );
  745. float GetCritMult( void );
  746. #ifdef GAME_DLL
  747. void UpdateCritMult( void );
  748. void RecordDamageEvent( const CTakeDamageInfo &info, bool bKill, int nVictimPrevHealth );
  749. void AddTempCritBonus( float flAmount );
  750. void ClearDamageEvents( void ) { m_DamageEvents.Purge(); }
  751. int GetNumKillsInTime( float flTime );
  752. // Invulnerable.
  753. void SendNewInvulnGameEvent( void );
  754. void SetChargeEffect( medigun_charge_types iCharge, bool bState, bool bInstant, const struct MedigunEffects_t& effects, float flWearOffTime, CTFPlayer *pProvider = NULL );
  755. void SetCritBoosted( bool bState );
  756. void RadiusCurrencyCollectionCheck( void );
  757. void RadiusHealthkitCollectionCheck( void );
  758. void RadiusSpyScan( void );
  759. // Attr for Conditions
  760. void ApplyAttributeToPlayer( const char* pszAttribName, float flValue );
  761. void RemoveAttributeFromPlayer( const char* pszAttribName );
  762. #endif // GAME_DLL
  763. private:
  764. // Vars that are networked.
  765. CNetworkVar( int, m_nPlayerState ); // Player state.
  766. CNetworkVar( int, m_nPlayerCond ); // Player condition flags.
  767. CNetworkVar( int, m_nPlayerCondEx ); // Player condition flags (extended -- we overflowed 32 bits).
  768. CNetworkVar( int, m_nPlayerCondEx2 ); // Player condition flags (extended -- we overflowed 64 bits).
  769. CNetworkVar( int, m_nPlayerCondEx3 ); // Player condition flags (extended -- we overflowed 96 bits).
  770. CNetworkVarEmbedded( CTFConditionList, m_ConditionList );
  771. //TFTODO: What if the player we're disguised as leaves the server?
  772. //...maybe store the name instead of the index?
  773. CNetworkVar( int, m_nDisguiseTeam ); // Team spy is disguised as.
  774. CNetworkVar( int, m_nDisguiseClass ); // Class spy is disguised as.
  775. CNetworkVar( int, m_nDisguiseSkinOverride ); // skin override value of the player spy disguised as.
  776. CNetworkVar( int, m_nMaskClass );
  777. #ifdef GAME_DLL
  778. EHANDLE m_hDisguiseTarget; // Playing the spy is using for name disguise.
  779. #endif // GAME_DLL
  780. CNetworkVar( int, m_iDisguiseTargetIndex );
  781. CNetworkVar( int, m_iDisguiseHealth ); // Health to show our enemies in player id
  782. CNetworkVar( int, m_nDesiredDisguiseClass );
  783. CNetworkVar( int, m_nDesiredDisguiseTeam );
  784. CNetworkHandle( CTFWeaponBase, m_hDisguiseWeapon );
  785. CNetworkVar( int, m_nTeamTeleporterUsed ); // for disguised spies using enemy teleporters
  786. CHandle<CTFPlayer> m_hDesiredDisguiseTarget;
  787. int m_iDisguiseAmmo;
  788. bool m_bEnableSeparation; // Keeps separation forces on when player stops moving, but still penetrating
  789. Vector m_vSeparationVelocity; // Velocity used to keep player seperate from teammates
  790. float m_flInvisibility;
  791. float m_flPrevInvisibility;
  792. CNetworkVar( float, m_flInvisChangeCompleteTime ); // when uncloaking, must be done by this time
  793. float m_flLastStealthExposeTime;
  794. float m_fCloakConsumeRate;
  795. float m_fCloakRegenRate;
  796. bool m_bMotionCloak;
  797. #ifdef GAME_DLL
  798. // Cloak Strange Tracking
  799. float m_flCloakStartTime;
  800. #endif
  801. float m_fEnergyDrinkConsumeRate;
  802. float m_fEnergyDrinkRegenRate;
  803. EHANDLE m_pPhaseTrail[TF_SCOUT_NUMBEROFPHASEATTACHMENTS];
  804. bool m_bPhaseFXOn;
  805. float m_fPhaseAlpha;
  806. CNetworkVar( int, m_nNumHealers );
  807. // Halloween silliness.
  808. CNetworkVar( int, m_nHalloweenBombHeadStage );
  809. // Vars that are not networked.
  810. OuterClass *m_pOuter; // C_TFPlayer or CTFPlayer (client/server).
  811. #ifdef GAME_DLL
  812. // Healer handling
  813. struct healers_t
  814. {
  815. EHANDLE pHealer;
  816. float flAmount;
  817. float flHealAccum;
  818. float flOverhealBonus;
  819. float flOverhealDecayMult;
  820. bool bDispenserHeal;
  821. EHANDLE pHealScorer;
  822. int iKillsWhileBeingHealed; // for engineer achievement ACHIEVEMENT_TF_ENGINEER_TANK_DAMAGE
  823. float flHealedLastSecond;
  824. };
  825. CUtlVector< healers_t > m_aHealers;
  826. float m_flHealFraction; // Store fractional health amounts
  827. float m_flDisguiseHealFraction; // Same for disguised healing
  828. float m_flBestOverhealDecayMult;
  829. float m_flHealedPerSecondTimer;
  830. float m_flChargeEffectOffTime[MEDIGUN_NUM_CHARGE_TYPES];
  831. bool m_bChargeSoundEffectsOn[MEDIGUN_NUM_CHARGE_TYPES];
  832. // Heal_Radius handling
  833. CUtlVector< int > m_iRadiusHealTargets;
  834. float m_flRadiusHealCheckTime;
  835. #endif
  836. // King Rune buff
  837. float m_flKingRuneBuffCheckTime;
  838. CNetworkVar( bool, m_bKingRuneBuffActive );
  839. bool m_bPulseRadiusHeal;
  840. CNetworkVar( bool, m_bLastDisguisedAsOwnTeam );
  841. // Burn handling
  842. CHandle<CTFPlayer> m_hBurnAttacker;
  843. CHandle<CTFPlayer> m_hOriginalBurnAttacker; // Player who originally ignited this target
  844. CHandle<CTFWeaponBase> m_hBurnWeapon;
  845. CNetworkVar( int, m_nNumFlames );
  846. float m_flFlameBurnTime;
  847. float m_flFlameRemoveTime;
  848. // Bleeding
  849. #ifdef GAME_DLL
  850. struct bleed_struct_t
  851. {
  852. CHandle<CTFPlayer> hBleedingAttacker;
  853. CHandle<CTFWeaponBase> hBleedingWeapon;
  854. float flBleedingTime;
  855. float flBleedingRemoveTime;
  856. int nBleedDmg;
  857. bool bPermanentBleeding;
  858. };
  859. CUtlVector <bleed_struct_t> m_PlayerBleeds;
  860. #endif // GAME_DLL
  861. CNetworkVar( int, m_iTauntIndex );
  862. CNetworkVar( int, m_iTauntConcept );
  863. CNetworkVar( uint32, m_unTauntSourceItemID_Low );
  864. CNetworkVar( uint32, m_unTauntSourceItemID_High );
  865. #ifdef CLIENT_DLL
  866. float m_flTauntParticleRefireTime;
  867. #endif // CLIENT_DLL
  868. float m_flDisguiseCompleteTime;
  869. float m_flTmpDamageBonusAmount;
  870. #ifdef CLIENT_DLL
  871. bool m_bSyncingConditions;
  872. #endif
  873. int m_nOldConditions;
  874. int m_nOldConditionsEx;
  875. int m_nOldConditionsEx2;
  876. int m_nOldConditionsEx3;
  877. int m_nOldDisguiseClass;
  878. int m_nOldDisguiseTeam;
  879. int m_nForceConditions;
  880. int m_nForceConditionsEx;
  881. int m_nForceConditionsEx2;
  882. int m_nForceConditionsEx3;
  883. // Feign Death
  884. float m_flFeignDeathEnd;
  885. CNetworkVar( bool, m_bFeignDeathReady );
  886. CNetworkVar( int, m_iDesiredPlayerClass );
  887. float m_flNextBurningSound;
  888. CNetworkVar( float, m_flCloakMeter ); // [0,100]
  889. CNetworkVar( bool, m_bInUpgradeZone );
  890. // Scout
  891. CNetworkVar( float, m_flEnergyDrinkMeter ); // [0,100]
  892. CNetworkVar( float, m_flHypeMeter );
  893. // Demoman
  894. CNetworkVar( float, m_flChargeMeter );
  895. // Rage (Soldier, Pyro, Sniper)
  896. CNetworkVar( float, m_flRageMeter );
  897. CNetworkVar( bool, m_bRageDraining );
  898. CNetworkVar( float, m_flNextRageEarnTime );
  899. RageBuff m_RageBuffSlots[kBuffSlot_MAX];
  900. // Movement.
  901. CNetworkVar( bool, m_bJumping );
  902. CNetworkVar( int, m_iAirDash );
  903. CNetworkVar( int, m_nAirDucked );
  904. CNetworkVar( float, m_flDuckTimer );
  905. CNetworkVar( float, m_flStealthNoAttackExpire );
  906. CNetworkVar( float, m_flStealthNextChangeTime );
  907. CNetworkVar( float, m_flRuneCharge );
  908. #ifdef STAGING_ONLY
  909. // Space
  910. CNetworkVar( float, m_flSpaceJumpCharge );
  911. #endif
  912. CNetworkVar( int, m_iCritMult );
  913. CNetworkArray( bool, m_bPlayerDominated, MAX_PLAYERS+1 ); // array of state per other player whether player is dominating other players
  914. CNetworkArray( bool, m_bPlayerDominatingMe, MAX_PLAYERS+1 ); // array of state per other player whether other players are dominating this player
  915. CNetworkVar( float, m_flMovementStunTime );
  916. CNetworkVar( int, m_iMovementStunAmount );
  917. CNetworkVar( unsigned char, m_iMovementStunParity );
  918. CNetworkHandle( CTFPlayer, m_hStunner );
  919. CNetworkVar( int, m_iStunFlags );
  920. CNetworkVar( int, m_iStunIndex );
  921. CNetworkHandle( CBaseObject, m_hCarriedObject );
  922. CNetworkVar( bool, m_bCarryingObject );
  923. CHandle<CTFPlayer> m_hAssist;
  924. CNetworkVar( int, m_nArenaNumChanges ); // number of times a player has re-rolled their class
  925. CNetworkVar( int, m_iWeaponKnockbackID );
  926. CNetworkVar( bool, m_bLoadoutUnavailable );
  927. CNetworkVar( int, m_iItemFindBonus );
  928. CNetworkVar( bool, m_bShieldEquipped );
  929. CNetworkVar( bool, m_bParachuteEquipped );
  930. CNetworkVar( int, m_iDecapitations );
  931. int m_iOldDecapitations;
  932. CNetworkArray( int, m_nStreaks, kTFStreak_COUNT );
  933. int m_nLastDuckStreakIncrement;
  934. int m_iOldKillStreak;
  935. int m_iOldKillStreakWepSlot;
  936. CNetworkVar( int, m_iRevengeCrits );
  937. CNetworkVar( int, m_iNextMeleeCrit );
  938. bool m_bPostShieldCharge;
  939. float m_flChargeEndTime;
  940. CNetworkVar( int, m_iDisguiseBody );
  941. CNetworkVar( int, m_iSpawnRoomTouchCount );
  942. CNetworkVar( float, m_flNextNoiseMakerTime );
  943. float m_flCurrentTauntTurnSpeed;
  944. #ifdef CLIENT_DLL
  945. const WheelEffect_t *m_pWheelEffect;
  946. QAngle m_angVehicleMoveAngles;
  947. bool m_bPreKartPredictionState;
  948. float m_angVehicleMovePitchLast;
  949. CHandle<CBaseAnimating> m_hKartParachuteEntity;
  950. #endif
  951. public:
  952. CNetworkVar( int, m_iKillCountSinceLastDeploy );
  953. CNetworkVar( float, m_flFirstPrimaryAttack );
  954. CNetworkVar( float, m_flSpyTranqBuffDuration );
  955. private:
  956. #ifdef GAME_DLL
  957. float m_flNextCritUpdate;
  958. CUtlVector<CTFDamageEvent> m_DamageEvents;
  959. CHandle<CTFPlayer> m_hPeeAttacker;
  960. float m_flRadiusCurrencyCollectionTime;
  961. float m_flRadiusSpyScanTime;
  962. struct pulledcurrencypacks_t
  963. {
  964. CHandle<CCurrencyPack> hPack;
  965. float flTime;
  966. };
  967. CUtlVector <pulledcurrencypacks_t> m_CurrencyPacks;
  968. #else
  969. float m_flGotTeleEffectAt;
  970. unsigned char m_iOldMovementStunParity;
  971. CSoundPatch *m_pCritBoostSoundLoop;
  972. #endif
  973. public:
  974. float m_flStunFade;
  975. float m_flStunEnd;
  976. float m_flStunMid;
  977. int m_iStunAnimState;
  978. int m_iPhaseDamage;
  979. // Movement stun state.
  980. bool m_bStunNeedsFadeOut;
  981. float m_flStunLerpTarget;
  982. float m_flLastMovementStunChange;
  983. #ifdef GAME_DLL
  984. CUtlVector <stun_struct_t> m_PlayerStuns;
  985. CUtlVector< CHandle<CTFPlayer> > m_hPlayersVisibleAtChargeStart; // ACHIEVEMENT_TF_DEMOMAN_KILL_PLAYER_YOU_DIDNT_SEE
  986. #else
  987. stun_struct_t m_ActiveStunInfo;
  988. #endif // CLIENT_DLL
  989. float m_flInvulnerabilityRemoveTime;
  990. /*
  991. float m_flShieldChargeStartTime;
  992. */
  993. // Demoman charge weapon glow.
  994. float m_flLastChargeTime;
  995. float m_flLastNoChargeTime;
  996. bool m_bChargeGlowing;
  997. bool m_bChargeOffSounded;
  998. bool m_bBiteEffectWasApplied;
  999. float m_flNextRocketPackTime;
  1000. float m_flLastNoMovementTime;
  1001. CNetworkVar( bool, m_bArenaFirstBloodBoost );
  1002. // passtime
  1003. public:
  1004. void SetHasPasstimeBall( bool has ) { m_bHasPasstimeBall = has; }
  1005. bool HasPasstimeBall() const { return m_bHasPasstimeBall; }
  1006. bool IsTargetedForPasstimePass() const { return m_bIsTargetedForPasstimePass; }
  1007. void SetPasstimePassTarget( CTFPlayer *ent );
  1008. CTFPlayer *GetPasstimePassTarget() const;
  1009. void SetAskForBallTime( float time ) { m_askForBallTime = time; }
  1010. float AskForBallTime() const { return m_askForBallTime; }
  1011. float m_flPasstimeThrowAnimStateTime;
  1012. int m_iPasstimeThrowAnimState;
  1013. private:
  1014. CNetworkVar( bool, m_bHasPasstimeBall );
  1015. CNetworkVar( bool, m_bIsTargetedForPasstimePass );
  1016. CNetworkHandle( CTFPlayer, m_hPasstimePassTarget );
  1017. CNetworkVar( float, m_askForBallTime );
  1018. };
  1019. #define CONTROL_STUN_ANIM_TIME 1.5f
  1020. #define STUN_ANIM_NONE 0
  1021. #define STUN_ANIM_LOOP 1
  1022. #define STUN_ANIM_END 2
  1023. #define PASSTIME_THROW_ANIM_NONE 0
  1024. #define PASSTIME_THROW_ANIM_LOOP 1
  1025. #define PASSTIME_THROW_ANIM_END 2
  1026. #define PASSTIME_THROW_ANIM_CANCEL 3
  1027. extern const char *g_pszBDayGibs[22];
  1028. class CTraceFilterIgnoreTeammatesAndTeamObjects : public CTraceFilterSimple
  1029. {
  1030. public:
  1031. DECLARE_CLASS( CTraceFilterIgnoreTeammatesAndTeamObjects, CTraceFilterSimple );
  1032. CTraceFilterIgnoreTeammatesAndTeamObjects( const IHandleEntity *passentity, int collisionGroup, int iIgnoreTeam )
  1033. : CTraceFilterSimple( passentity, collisionGroup ), m_iIgnoreTeam( iIgnoreTeam ) {}
  1034. virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask );
  1035. private:
  1036. int m_iIgnoreTeam;
  1037. };
  1038. enum { kSoldierBuffCount = 6 };
  1039. extern ETFCond g_SoldierBuffAttributeIDToConditionMap[kSoldierBuffCount + 1];
  1040. class CTFPlayerSharedUtils
  1041. {
  1042. public:
  1043. static CEconItemView *GetEconItemViewByLoadoutSlot( CTFPlayer *pTFPlayer, int iSlot, CEconEntity **pEntity = NULL );
  1044. static bool ConceptIsPartnerTaunt( int iConcept );
  1045. static CTFWeaponBuilder *GetBuilderForObjectType( CTFPlayer *pTFPlayer, int iObjectType );
  1046. };
  1047. class CTargetOnlyFilter : public CTraceFilterSimple
  1048. {
  1049. public:
  1050. CTargetOnlyFilter( CBaseEntity *pShooter, CBaseEntity *pTarget );
  1051. virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask );
  1052. CBaseEntity *m_pShooter;
  1053. CBaseEntity *m_pTarget;
  1054. };
  1055. #endif // TF_PLAYER_SHARED_H