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.

1555 lines
57 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=============================================================================
  4. #ifndef TF_PLAYER_H
  5. #define TF_PLAYER_H
  6. #pragma once
  7. #include "basemultiplayerplayer.h"
  8. #include "server_class.h"
  9. #include "tf_achievementdata.h"
  10. #include "tf_playeranimstate.h"
  11. #include "tf_shareddefs.h"
  12. #include "tf_obj.h"
  13. #include "tf_player_shared.h"
  14. #include "tf_playerclass.h"
  15. #include "entity_tfstart.h"
  16. #include "steam/steam_gameserver.h"
  17. #include "ihasattributes.h"
  18. #include "tf_item_inventory.h"
  19. class CTFPlayer;
  20. class CTFTeam;
  21. class CTFGoal;
  22. class CTFGoalItem;
  23. class CTFItem;
  24. class CTFWeaponBuilder;
  25. //class CBaseObject;
  26. class CTFWeaponBase;
  27. class CIntroViewpoint;
  28. class CTriggerAreaCapture;
  29. class CTFWeaponBaseGun;
  30. class CCaptureZone;
  31. class CTFReviveMarker;
  32. class CWaveSpawnPopulator;
  33. class CTFTauntProp;
  34. class CTFDroppedWeapon;
  35. //=============================================================================
  36. //
  37. // Player State Information
  38. //
  39. class CPlayerStateInfo
  40. {
  41. public:
  42. int m_nPlayerState;
  43. const char *m_pStateName;
  44. // Enter/Leave state.
  45. void ( CTFPlayer::*pfnEnterState )();
  46. void ( CTFPlayer::*pfnLeaveState )();
  47. // Think (called every frame).
  48. void ( CTFPlayer::*pfnThink )();
  49. };
  50. enum EAmmoSource
  51. {
  52. kAmmoSource_Pickup, // this came from either a box of ammo or a player's dropped weapon
  53. kAmmoSource_Resupply, // resupply cabinet and/or full respawn
  54. kAmmoSource_DispenserOrCart, // the player is standing next to an engineer's dispenser or pushing the cart in a payload game
  55. };
  56. //=============================================================================
  57. //
  58. // TF Player
  59. //
  60. class CTFPlayer : public CBaseMultiplayerPlayer, public IHasAttributes, public IInventoryUpdateListener
  61. {
  62. public:
  63. DECLARE_CLASS( CTFPlayer, CBaseMultiplayerPlayer );
  64. DECLARE_SERVERCLASS();
  65. DECLARE_DATADESC();
  66. CTFPlayer();
  67. ~CTFPlayer();
  68. //=============================================================================
  69. // HPE_BEGIN:
  70. // [msmith] Added a player type so we can distinguish between bots and humans.
  71. //=============================================================================
  72. enum TFPlayerType{
  73. HUMAN_PLAYER,
  74. TEMP_BOT,
  75. TRAINING_BOT
  76. };
  77. //=============================================================================
  78. // HPE_END
  79. //=============================================================================
  80. // Creation/Destruction.
  81. static CTFPlayer *CreatePlayer( const char *className, edict_t *ed );
  82. static CTFPlayer *Instance( int iEnt );
  83. virtual int ShouldTransmit( const CCheckTransmitInfo *pInfo );
  84. virtual void SetupVisibility( CBaseEntity *pViewEntity, unsigned char *pvs, int pvssize );
  85. virtual void Spawn();
  86. virtual void ForceRespawn();
  87. void ForceRegenerateAndRespawn( void );
  88. virtual CBaseEntity *EntSelectSpawnPoint( void );
  89. virtual void InitialSpawn();
  90. static void PrecacheMvM();
  91. static void PrecacheKart();
  92. private:
  93. static void PrecachePlayerModels();
  94. static void PrecacheTFPlayer();
  95. public:
  96. virtual void Precache();
  97. virtual bool IsReadyToPlay( void );
  98. virtual bool IsReadyToSpawn( void );
  99. virtual bool ShouldGainInstantSpawn( void );
  100. virtual void ResetScores( void );
  101. virtual void UpdateOnRemove( void );
  102. void CheckInstantLoadoutRespawn( void );
  103. virtual void ResetPerRoundStats( void );
  104. void HandleCommand_JoinTeam( const char *pTeamName );
  105. void HandleCommand_JoinClass( const char *pClassName, bool bAllowSpawn = true );
  106. void HandleCommand_JoinTeam_NoMenus( const char *pTeamName );
  107. void CreateViewModel( int iViewModel = 0 );
  108. CBaseViewModel *GetOffHandViewModel();
  109. void SendOffHandViewModelActivity( Activity activity );
  110. virtual void CheatImpulseCommands( int iImpulse );
  111. virtual void PlayerRunCommand( CUserCmd *ucmd, IMoveHelper *moveHelper );
  112. virtual void CommitSuicide( bool bExplode = false, bool bForce = false );
  113. // Combats
  114. virtual void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator );
  115. virtual int TakeHealth( float flHealth, int bitsDamageType );
  116. virtual void Event_KilledOther( CBaseEntity *pVictim, const CTakeDamageInfo &info );
  117. virtual void Event_Killed( const CTakeDamageInfo &info );
  118. virtual void PlayerDeathThink( void );
  119. virtual void DetermineAssistForKill( const CTakeDamageInfo &info );
  120. virtual void SetNumberofDominations( int iDominations )
  121. {
  122. // Check for some bogus values, which are sneaking in somehow
  123. if ( iDominations < 0 )
  124. {
  125. Assert( iDominations >= 0 );
  126. iDominations = 0;
  127. }
  128. else if ( iDominations >= MAX_PLAYERS )
  129. {
  130. Assert( iDominations < MAX_PLAYERS );
  131. iDominations = MAX_PLAYERS-1;
  132. }
  133. m_iNumberofDominations = iDominations;
  134. }
  135. virtual int GetNumberofDominations( void ) { return m_iNumberofDominations; }
  136. void OnKilledOther_Effects( CBaseEntity *pVictim, const CTakeDamageInfo &info );
  137. virtual int OnTakeDamage( const CTakeDamageInfo &inputInfo );
  138. void AddConnectedPlayers( CUtlVector<CTFPlayer*> &vecPlayers, CTFPlayer *pPlayerToConsider );
  139. virtual int OnTakeDamage_Alive( const CTakeDamageInfo &info );
  140. virtual void DamageEffect(float flDamage, int fDamageType);
  141. void OnDealtDamage( CBaseCombatCharacter *pVictim, const CTakeDamageInfo &info ); // invoked when we deal damage to another victim
  142. int GetDamagePerSecond( void ) const;
  143. void ResetDamagePerSecond( void );
  144. virtual bool ShouldCollide( int collisionGroup, int contentsMask ) const;
  145. void ApplyPushFromDamage( const CTakeDamageInfo &info, Vector vecDir );
  146. void PlayDamageResistSound( float flStartDamage, float flModifiedDamage );
  147. bool CheckBlockBackstab( CTFPlayer *pTFAttacker );
  148. virtual bool Weapon_CanSwitchTo( CBaseCombatWeapon *pWeapon );
  149. void SetHealthBuffTime( float flTime ) { m_flHealthBuffTime = flTime; }
  150. CTFWeaponBase *GetActiveTFWeapon( void ) const;
  151. bool IsActiveTFWeapon( const CSchemaItemDefHandle &weaponHandle ) const;
  152. bool IsActiveTFWeapon( CEconItemDefinition *weaponHandle ) const;
  153. virtual void RemoveAllWeapons();
  154. virtual void Weapon_Equip( CBaseCombatWeapon *pWeapon ) OVERRIDE; // Adds weapon to player
  155. void SaveMe( void );
  156. void FireBullet( CTFWeaponBase *pWpn, const FireBulletsInfo_t &info, bool bDoEffects, int nDamageType, int nCustomDamageType = TF_DMG_CUSTOM_NONE );
  157. void ImpactWaterTrace( trace_t &trace, const Vector &vecStart );
  158. void NoteWeaponFired();
  159. bool HasItem( void ) const; // Currently can have only one item at a time.
  160. void SetItem( CTFItem *pItem );
  161. CTFItem *GetItem( void ) const;
  162. void SaveLastWeaponSlot( void );
  163. void SetRememberLastWeapon( bool bRememberLastWeapon ) { m_bRememberLastWeapon = bRememberLastWeapon; }
  164. void SetRememberActiveWeapon( bool bRememberActiveWeapon ) { m_bRememberActiveWeapon = bRememberActiveWeapon; }
  165. void Regenerate( bool bRefillHealthAndAmmo = true );
  166. float GetNextRegenTime( void ){ return m_flNextRegenerateTime; }
  167. void SetNextRegenTime( float flTime ){ m_flNextRegenerateTime = flTime; }
  168. float GetNextChangeClassTime( void ){ return m_flNextChangeClassTime; }
  169. void SetNextChangeClassTime( float flTime ){ m_flNextChangeClassTime = flTime; }
  170. float GetNextChangeTeamTime( void ){ return m_flNextChangeTeamTime; }
  171. void SetNextChangeTeamTime( float flTime ){ m_flNextChangeTeamTime = flTime; }
  172. virtual void RemoveAllItems( bool removeSuit );
  173. virtual bool BumpWeapon( CBaseCombatWeapon *pWeapon );
  174. bool DropCurrentWeapon( void );
  175. void DropFlag( bool bSilent = false );
  176. void DropRune( bool bApplyForce = true, int nTeam = TEAM_ANY );
  177. void TFWeaponRemove( int iWeaponID );
  178. bool TFWeaponDrop( CTFWeaponBase *pWeapon, bool bThrowForward );
  179. // Class.
  180. CTFPlayerClass *GetPlayerClass( void ) { return &m_PlayerClass; }
  181. const CTFPlayerClass *GetPlayerClass( void ) const { return &m_PlayerClass; }
  182. int GetDesiredPlayerClassIndex( void ) { return m_Shared.m_iDesiredPlayerClass; }
  183. void SetDesiredPlayerClassIndex( int iClass ) { m_Shared.m_iDesiredPlayerClass = iClass; }
  184. // Team.
  185. void ForceChangeTeam( int iTeamNum, bool bFullTeamSwitch = false );
  186. virtual void ChangeTeam( int iTeamNum, bool bAutoTeam, bool bSilent, bool bAutoBalance = false ) OVERRIDE;
  187. virtual void ChangeTeam( int iTeamNum ) OVERRIDE { BaseClass::ChangeTeam( iTeamNum ); }
  188. // mp_fadetoblack
  189. void HandleFadeToBlack( void );
  190. // Flashlight controls for SFM - JasonM
  191. virtual int FlashlightIsOn( void );
  192. virtual void FlashlightTurnOn( void );
  193. virtual void FlashlightTurnOff( void );
  194. // Think.
  195. virtual void PreThink();
  196. virtual void PostThink();
  197. virtual void ItemPostFrame();
  198. virtual void Weapon_FrameUpdate( void );
  199. virtual void Weapon_HandleAnimEvent( animevent_t *pEvent );
  200. virtual bool Weapon_ShouldSetLast( CBaseCombatWeapon *pOldWeapon, CBaseCombatWeapon *pNewWeapon );
  201. virtual void GetStepSoundVelocities( float *velwalk, float *velrun );
  202. virtual void SetStepSoundTime( stepsoundtimes_t iStepSoundTime, bool bWalking );
  203. virtual const char *GetOverrideStepSound( const char *pszBaseStepSoundName );
  204. virtual void OnEmitFootstepSound( const CSoundParameters& params, const Vector& vecOrigin, float fVolume );
  205. virtual void ModifyEmitSoundParams( EmitSound_t &params );
  206. // Utility.
  207. void UpdateModel( void );
  208. void UpdateSkin( int iTeam );
  209. int GiveAmmo( int iCount, int iAmmoIndex, bool bSuppressSound, EAmmoSource eAmmoSource );
  210. virtual int GiveAmmo( int iCount, int iAmmoIndex, bool bSuppressSound = false );
  211. virtual void RemoveAmmo( int iCount, int iAmmoIndex );
  212. virtual void RemoveAmmo( int iCount, const char *szName );
  213. virtual int GetAmmoCount( int iAmmoIndex ) const;
  214. int GetMaxAmmo( int iAmmoIndex, int iClassIndex = -1 );
  215. virtual int GetMaxHealth() const OVERRIDE;
  216. int GetMaxHealthForBuffing() const;
  217. int GetRuneHealthBonus() const;
  218. //-----------------------------------------------------------------------------------------------------
  219. // Return true if we are a "mini boss" in Mann Vs Machine mode
  220. bool IsMiniBoss( void ) const;
  221. void SetIsMiniBoss( bool isMiniBoss ) { m_bIsMiniBoss = isMiniBoss; }
  222. bool CanAttack( int iCanAttackFlags = 0 );
  223. void RemoveMeleeCrit( void );
  224. // This passes the event to the client's and server's CPlayerAnimState.
  225. void DoAnimationEvent( PlayerAnimEvent_t event, int mData = 0 );
  226. virtual void HandleAnimEvent( animevent_t *pEvent ) OVERRIDE;
  227. virtual bool ClientCommand( const CCommand &args );
  228. void ClientHearVox( const char *pSentence );
  229. void DisplayLocalItemStatus( CTFGoal *pGoal );
  230. int BuildObservableEntityList( void );
  231. virtual int GetNextObserverSearchStartPoint( bool bReverse ); // Where we should start looping the player list in a FindNextObserverTarget call
  232. virtual CBaseEntity *FindNextObserverTarget(bool bReverse);
  233. virtual bool IsValidObserverTarget(CBaseEntity * target); // true, if player is allowed to see this target
  234. virtual bool SetObserverTarget(CBaseEntity * target);
  235. virtual bool ModeWantsSpectatorGUI( int iMode ) { return (iMode != OBS_MODE_FREEZECAM && iMode != OBS_MODE_DEATHCAM); }
  236. void FindInitialObserverTarget( void );
  237. CBaseEntity *FindNearestObservableTarget( Vector vecOrigin, float flMaxDist );
  238. virtual void ValidateCurrentObserverTarget( void );
  239. void CheckUncoveringSpies( CTFPlayer *pTouchedPlayer );
  240. void Touch( CBaseEntity *pOther );
  241. virtual void RefreshCollisionBounds( void );
  242. float GetMovementForwardPull( void ) const;
  243. bool CanPlayerMove() const;
  244. float TeamFortress_CalculateMaxSpeed( bool bIgnoreSpecialAbility = false ) const;
  245. void TeamFortress_SetSpeed();
  246. EHANDLE TeamFortress_GetDisguiseTarget( int nTeam, int nClass );
  247. void TeamFortress_ClientDisconnected();
  248. void RemoveAllOwnedEntitiesFromWorld( bool bExplodeBuildings = false );
  249. void RemoveOwnedProjectiles();
  250. int GetNumActivePipebombs( void );
  251. Vector EstimateProjectileImpactPosition( CTFWeaponBaseGun *weapon ); // estimate where a projectile fired from the given weapon will initially hit (it may bounce on from there)
  252. Vector EstimateProjectileImpactPosition( float pitch, float yaw, float initVel ); // estimate where a projectile fired will initially hit (it may bounce on from there)
  253. Vector EstimateStickybombProjectileImpactPosition( float pitch, float yaw, float charge ); // Estimate where a stickybomb projectile will hit, using given pitch, yaw, and weapon charge (0-1)
  254. CTFTeamSpawn *GetSpawnPoint( void ){ return m_pSpawnPoint; }
  255. void SetAnimation( PLAYER_ANIM playerAnim );
  256. bool IsPlayerClass( int iClass ) const;
  257. void PlayFlinch( const CTakeDamageInfo &info );
  258. float PlayCritReceivedSound( void );
  259. void PainSound( const CTakeDamageInfo &info );
  260. void DeathSound( const CTakeDamageInfo &info );
  261. virtual const char* GetSceneSoundToken( void );
  262. void StunSound( CTFPlayer* pAttacker, int iStunFlags, int iOldStunFlags=0 );
  263. void SetSeeCrit( bool bAllSeeCrit, bool bMiniCrit, bool bShowDisguisedCrit ) { m_bAllSeeCrit = bAllSeeCrit; m_bMiniCrit = bMiniCrit; m_bShowDisguisedCrit = bShowDisguisedCrit; }
  264. void SetAttackBonusEffect( EAttackBonusEffects_t effect ) { m_eBonusAttackEffect = effect; }
  265. EAttackBonusEffects_t GetAttackBonusEffect( void ) { return m_eBonusAttackEffect; }
  266. // TF doesn't want the explosion ringing sound
  267. virtual void OnDamagedByExplosion( const CTakeDamageInfo &info ) { return; }
  268. void OnBurnOther( CTFPlayer *pTFPlayerVictim, CTFWeaponBase *pWeapon );
  269. // Buildables
  270. void SetWeaponBuilder( CTFWeaponBuilder *pBuilder );
  271. CTFWeaponBuilder *GetWeaponBuilder( void );
  272. int GetBuildResources( void );
  273. void RemoveBuildResources( int iAmount );
  274. void AddBuildResources( int iAmount );
  275. bool IsBuilding( void );
  276. int CanBuild( int iObjectType, int iObjectMode = 0 );
  277. CBaseObject *GetObject( int index ) const;
  278. CBaseObject *GetObjectOfType( int iObjectType, int iObjectMode = 0 ) const;
  279. int GetObjectCount( void ) const;
  280. int GetNumObjects( int iObjectType, int iObjectMode = 0 );
  281. void RemoveAllObjects( bool bExplodeBuildings = false );
  282. void StopPlacement( void );
  283. int StartedBuildingObject( int iObjectType );
  284. void StoppedBuilding( int iObjectType );
  285. void FinishedObject( CBaseObject *pObject );
  286. void AddObject( CBaseObject *pObject );
  287. void OwnedObjectDestroyed( CBaseObject *pObject );
  288. void RemoveObject( CBaseObject *pObject );
  289. bool PlayerOwnsObject( CBaseObject *pObject );
  290. void DetonateObjectOfType( int iObjectType, int iObjectMode = 0, bool bIgnoreSapperState = false );
  291. void StartBuildingObjectOfType( int iType, int iObjectMode = 0 );
  292. float GetObjectBuildSpeedMultiplier( int iObjectType, bool bIsRedeploy ) const;
  293. void OnSapperPlaced( CBaseEntity *sappedObject ); // invoked when we place a sapper on an enemy building
  294. bool IsPlacingSapper( void ) const; // return true if we are a spy who placed a sapper on a building in the last few moments
  295. void OnSapperStarted( float flStartTime );
  296. void OnSapperFinished( float flStartTime );
  297. bool IsSapping( void ) const;
  298. int GetSappingEvent( void) const;
  299. void ClearSappingEvent( void );
  300. void ClearSappingTracking( void );
  301. CTFTeam *GetTFTeam( void );
  302. CTFTeam *GetOpposingTFTeam( void );
  303. void TeleportEffect( void );
  304. void RemoveTeleportEffect( void );
  305. bool HasTheFlag( ETFFlagType exceptionTypes[] = NULL, int nNumExceptions = 0 ) const;
  306. virtual bool IsAllowedToPickUpFlag( void ) const;
  307. // Death & Ragdolls.
  308. virtual void CreateRagdollEntity( void );
  309. void CreateRagdollEntity( bool bGib, bool bBurning, bool bElectrocuted, bool bOnGround, bool bCloakedCorpse, bool bGoldRagdoll, bool bIceRagdoll, bool bBecomeAsh, int iDamageCustom = 0, bool bCritOnHardHit = false );
  310. void DestroyRagdoll( void );
  311. CNetworkHandle( CBaseEntity, m_hRagdoll ); // networked entity handle
  312. virtual bool ShouldGib( const CTakeDamageInfo &info ) OVERRIDE;
  313. bool HasBombinomiconEffectOnDeath( void );
  314. void StopRagdollDeathAnim( void );
  315. void SetGibbedOnLastDeath( bool bGibbed ) { m_bGibbedOnLastDeath = bGibbed; }
  316. bool WasGibbedOnLastDeath( void ) { return m_bGibbedOnLastDeath; }
  317. // Feign Death
  318. void SpyDeadRingerDeath( const CTakeDamageInfo& info );
  319. void FeignDeath( const CTakeDamageInfo& info );
  320. void CreateFeignDeathRagdoll( const CTakeDamageInfo& info, bool bGib, bool bBurning, bool bDisguised );
  321. // Dropping Ammo
  322. bool ShouldDropAmmoPack( void );
  323. void DropAmmoPack( const CTakeDamageInfo &info, bool bEmpty, bool bDisguisedWeapon );
  324. void DropExtraAmmo( const CTakeDamageInfo& info, bool bFromDeath = false );
  325. void DropHealthPack( const CTakeDamageInfo &info, bool bEmpty );
  326. void DropCurrencyPack( CurrencyRewards_t nSize = TF_CURRENCY_PACK_SMALL, int nAmount = 0, bool bForceDistribute = false, CBasePlayer* pMoneyMaker = NULL ); // Only pass in an amount when nSize = TF_CURRENCY_PACK_CUSTOM
  327. bool CanDisguise( void );
  328. bool CanDisguise_OnKill( void );
  329. bool CanGoInvisible( bool bAllowWhileCarryingFlag = false );
  330. void RemoveInvisibility( void );
  331. bool CanStartPhase( void );
  332. void RemoveDisguise( void );
  333. bool DoClassSpecialSkill( void );
  334. bool EndClassSpecialSkill( void );
  335. bool CanPickupBuilding( CBaseObject *pPickupObject );
  336. bool TryToPickupBuilding( void );
  337. float GetLastDamageReceivedTime( void ) { return m_flLastDamageTime; }
  338. float GetLastEntityDamagedTime( void ) { return m_flLastDamageDoneTime; }
  339. void SetLastEntityDamagedTime( float flTime ) { m_flLastDamageDoneTime = flTime; }
  340. CBaseEntity *GetLastEntityDamaged( void ) { return m_hLastDamageDoneEntity; }
  341. void SetLastEntityDamaged( CBaseEntity *pEnt ) { m_hLastDamageDoneEntity = pEnt; }
  342. void SetClassMenuOpen( bool bIsOpen );
  343. bool IsClassMenuOpen( void );
  344. float GetCritMult( void ) { return m_Shared.GetCritMult(); }
  345. void RecordDamageEvent( const CTakeDamageInfo &info, bool bKill, int nVictimPrevHealth ) { m_Shared.RecordDamageEvent(info,bKill,nVictimPrevHealth); }
  346. bool GetHudClassAutoKill( void ){ return m_bHudClassAutoKill; }
  347. void SetHudClassAutoKill( bool bAutoKill ){ m_bHudClassAutoKill = bAutoKill; }
  348. bool GetMedigunAutoHeal( void ){ return m_bMedigunAutoHeal; }
  349. void SetMedigunAutoHeal( bool bMedigunAutoHeal ){ m_bMedigunAutoHeal = bMedigunAutoHeal; }
  350. CBaseEntity *MedicGetHealTarget( void );
  351. float MedicGetChargeLevel( CTFWeaponBase **pRetMedigun = NULL );
  352. bool IsCallingForMedic( void ) const; // return true if this player has called for a Medic in the last few seconds
  353. float GetTimeSinceCalledForMedic( void ) const;
  354. void NoteMedicCall( void );
  355. bool ShouldAutoRezoom( void ) { return m_bAutoRezoom; }
  356. void SetAutoRezoom( bool bAutoRezoom ) { m_bAutoRezoom = bAutoRezoom; }
  357. bool ShouldAutoReload( void ){ return m_bAutoReload; }
  358. void SetAutoReload( bool bAutoReload ) { m_bAutoReload = bAutoReload; }
  359. virtual void ModifyOrAppendCriteria( AI_CriteriaSet& criteriaSet );
  360. virtual bool CanHearAndReadChatFrom( CBasePlayer *pPlayer );
  361. virtual bool CanBeAutobalanced();
  362. Vector GetClassEyeHeight( void );
  363. void UpdateExpression( void );
  364. void ClearExpression( void );
  365. virtual IResponseSystem *GetResponseSystem();
  366. virtual bool SpeakConceptIfAllowed( int iConcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
  367. virtual bool CanSpeakVoiceCommand( void );
  368. virtual bool ShouldShowVoiceSubtitleToEnemy( void );
  369. virtual void NoteSpokeVoiceCommand( const char *pszScenePlayed );
  370. void SpeakWeaponFire( int iCustomConcept = MP_CONCEPT_NONE );
  371. void ClearWeaponFireScene( void );
  372. virtual int DrawDebugTextOverlays( void );
  373. float m_flNextVoiceCommandTime;
  374. int m_iVoiceSpamCounter;
  375. float m_flNextSpeakWeaponFire;
  376. virtual int CalculateTeamBalanceScore( void );
  377. bool ShouldAnnounceAchievement( void ) OVERRIDE;
  378. virtual void OnAchievementEarned( int iAchievement );
  379. void CheckObserverSettings(); // checks, if target still valid (didn't die etc)
  380. CTriggerAreaCapture *GetControlPointStandingOn( void );
  381. CCaptureZone *GetCaptureZoneStandingOn( void );
  382. CCaptureZone *GetClosestCaptureZone( void );
  383. // given a vector of points, return the point we can actually travel to the quickest (requires a nav mesh)
  384. CTeamControlPoint *SelectClosestControlPointByTravelDistance( CUtlVector< CTeamControlPoint * > *pointVector ) const;
  385. bool CanAirDash( void ) const;
  386. virtual bool CanBreatheUnderwater() const OVERRIDE;
  387. bool CanGetWet() const;
  388. virtual bool IsDeflectable() { return true; }
  389. //=============================================================================
  390. // HPE_BEGIN:
  391. // [msmith] Added a player type so we can distinguish between bots and humans.
  392. //=============================================================================
  393. inline TFPlayerType GetPlayerType(){ return m_playerType; }
  394. inline void SetPlayerType( TFPlayerType playerType ){ m_playerType = playerType; }
  395. //=============================================================================
  396. // HPE_END
  397. //=============================================================================
  398. virtual void OnNavAreaChanged( CNavArea *enteredArea, CNavArea *leftArea ); // invoked (by UpdateLastKnownArea) when we enter a new nav area (or it is reset to NULL)
  399. bool IsThreatAimingTowardMe( CBaseEntity *threat, float cosTolerance = 0.8f ) const; // return true if the given threat is aiming in our direction
  400. bool IsThreatFiringAtMe( CBaseEntity *threat ) const; // return true if the given threat is aiming in our direction and firing its weapon
  401. bool IsInCombat( void ) const; // return true if we are engaged in active combat
  402. void PlayerUse( void );
  403. void InputIgnitePlayer( inputdata_t &inputdata );
  404. void InputSetCustomModel( inputdata_t &inputdata );
  405. void InputSetCustomModelOffset( inputdata_t &inputdata );
  406. void InputSetCustomModelRotation( inputdata_t &inputdata );
  407. void InputClearCustomModelRotation( inputdata_t &inputdata );
  408. void InputSetCustomModelRotates( inputdata_t &inputdata );
  409. void InputSetCustomModelVisibleToSelf( inputdata_t &inputdata );
  410. void InputSetForcedTauntCam( inputdata_t &inputdata );
  411. void InputExtinguishPlayer( inputdata_t &inputdata );
  412. void InputBleedPlayer( inputdata_t &inputdata );
  413. void InputTriggerLootIslandAchievement( inputdata_t &inputdata );
  414. void InputTriggerLootIslandAchievement2( inputdata_t &inputdata );
  415. void InputRollRareSpell( inputdata_t &inputdata );
  416. void InputRoundSpawn( inputdata_t &inputdata );
  417. bool InAirDueToExplosion( void ) { return (!(GetFlags() & FL_ONGROUND) && (GetWaterLevel() == WL_NotInWater) && (m_iBlastJumpState != 0) ); }
  418. bool InAirDueToKnockback( void ) { return (!(GetFlags() & FL_ONGROUND) && (GetWaterLevel() == WL_NotInWater) && ( (m_iBlastJumpState != 0) || m_Shared.InCond( TF_COND_KNOCKED_INTO_AIR ) || m_Shared.InCond( TF_COND_GRAPPLINGHOOK ) || m_Shared.InCond( TF_COND_GRAPPLINGHOOK_SAFEFALL ) ) ); }
  419. bool IsCoaching() const { return m_bIsCoaching; }
  420. void SetIsCoaching( bool bIsCoaching );
  421. void SetCoach( CTFPlayer *pCoach ) { m_hCoach = pCoach; }
  422. CTFPlayer* GetCoach() const { return m_hCoach; }
  423. void SetStudent( CTFPlayer *pStudent ) { m_hStudent = pStudent; }
  424. CTFPlayer* GetStudent() const { return m_hStudent; }
  425. void DoNoiseMaker(); // Halloween event item support.
  426. bool IsWormsGearEquipped( void ) const;
  427. bool IsRobotCostumeEquipped( void ) const;
  428. bool IsDemowolf( void ) const;
  429. bool IsFrankenHeavy( void ) const;
  430. bool IsFairyHeavy( void ) const;
  431. bool IsZombieCostumeEquipped( void ) const;
  432. bool HasWearablesEquipped( const CSchemaItemDefHandle *ppItemDefs, int nWearables ) const;
  433. CEconItemView *GetEquippedItemForLoadoutSlot( int iLoadoutSlot ){ return m_Inventory.GetInventoryItemByItemID( m_EquippedLoadoutItemIndices[iLoadoutSlot] ); }
  434. CBaseEntity *GetEntityForLoadoutSlot( int iLoadoutSlot ); //Gets whatever entity is associated with the loadout slot (wearable or weapon)
  435. CTFWearable *GetEquippedWearableForLoadoutSlot( int iLoadoutSlot );
  436. //Base entity overrides
  437. // Functions that intercept Base Calls for Attribute Checking
  438. void ApplyAbsVelocityImpulse ( const Vector &vecImpulse );
  439. bool ApplyPunchImpulseX ( float flImpulse );
  440. void ApplyAirBlastImpulse( const Vector &vecImpulse );
  441. void SetUseBossHealthBar( bool bUseBossHealthBar ) { m_bUseBossHealthBar = bUseBossHealthBar; }
  442. void SetUsingVRHeadset( bool bState ){ m_bUsingVRHeadset = bState; }
  443. static bool m_bTFPlayerNeedsPrecache;
  444. // IHasAttributes
  445. CAttributeManager *GetAttributeManager( void ) { return &m_AttributeManager; }
  446. CAttributeContainer *GetAttributeContainer( void ) { return NULL; }
  447. CBaseEntity *GetAttributeOwner( void ) { return NULL; }
  448. CAttributeList *GetAttributeList( void ) { return &m_AttributeList; }
  449. virtual void ReapplyProvision( void ) { return; }
  450. protected:
  451. CNetworkVarEmbedded( CAttributeContainerPlayer, m_AttributeManager );
  452. //----------------------------
  453. // INVENTORY MANAGEMENT
  454. public:
  455. // IInventoryUpdateListener
  456. virtual void InventoryUpdated( CPlayerInventory *pInventory );
  457. virtual void SOCacheUnsubscribed( const CSteamID & steamIDOwner ) { m_Shared.SetLoadoutUnavailable( true ); }
  458. // Inventory access
  459. CTFPlayerInventory *Inventory( void ) { return &m_Inventory; }
  460. private:
  461. CTFPlayerInventory m_Inventory;
  462. // Items that have been equipped on this player instance (the inventory loadout may have changed)
  463. itemid_t m_EquippedLoadoutItemIndices[CLASS_LOADOUT_POSITION_COUNT];
  464. public:
  465. void UpdateInventory( bool bInit );
  466. void VerifySOCache();
  467. CNetworkVarEmbedded( CTFPlayerShared, m_Shared );
  468. friend class CTFPlayerShared;
  469. int m_flNextTimeCheck; // Next time the player can execute a "timeleft" command
  470. CNetworkVar( bool, m_bSaveMeParity );
  471. CNetworkVar( bool, m_bIsCoaching);
  472. CNetworkHandle( CTFPlayer, m_hCoach );
  473. CNetworkHandle( CTFPlayer, m_hStudent );
  474. float m_flLastCoachCommand;
  475. CNetworkVar( bool, m_bIsABot );
  476. CNetworkVar( int, m_nBotSkill );
  477. int StateGet( void ) const;
  478. void SetOffHandWeapon( CTFWeaponBase *pWeapon );
  479. void HolsterOffHandWeapon( void );
  480. CTFWeaponBase* GetOffHandWeapon( void ) { return m_hOffHandWeapon; }
  481. float GetSpawnTime() { return m_flSpawnTime; }
  482. virtual void SelectItem( const char *pstr, int iSubType = 0 ) OVERRIDE;
  483. virtual bool Weapon_Switch( CBaseCombatWeapon *pWeapon, int viewmodelindex = 0 ) OVERRIDE;
  484. virtual void Weapon_Drop( CBaseCombatWeapon *pWeapon, const Vector *pvecTarget , const Vector *pVelocity ) OVERRIDE;
  485. virtual void OnMyWeaponFired( CBaseCombatWeapon *weapon ); // call this when this player fires a weapon to allow other systems to react
  486. bool ItemsMatch( TFPlayerClassData_t *pData, CEconItemView *pCurWeaponItem, CEconItemView *pNewWeaponItem, CTFWeaponBase *pWpnEntity = NULL );
  487. void ManageRegularWeapons( TFPlayerClassData_t *pData );
  488. void ManageRegularWeaponsLegacy( TFPlayerClassData_t *pData ); // Older, pre-inventory method of managing regular weapons
  489. void ManageBuilderWeapons( TFPlayerClassData_t *pData );
  490. virtual CBaseEntity *GiveNamedItem( const char *szName, int iSubType = 0, const CEconItemView *pScriptItem = NULL, bool bForce = false );
  491. void PostInventoryApplication( void );
  492. bool ItemIsAllowed( CEconItemView *pItem );
  493. void RemovePlayerAttributes( bool bSetBonuses );
  494. void ApplySetBonuses( void );
  495. void GetActiveSets( CUtlVector<const CEconItemSetDefinition *> *pItemSets );
  496. void ValidateWeapons( TFPlayerClassData_t *pData, bool bResetWeapons );
  497. void ValidateWearables( TFPlayerClassData_t *pData );
  498. CEconItemView* GetLoadoutItem( int iClass, int iSlot, bool bReportWhitelistFails = false );
  499. void UseActionSlotItemPressed( void );
  500. void UseActionSlotItemReleased( void );
  501. bool IsFireproof( void ) const;
  502. bool AddToSpyKnife( float value, bool force );
  503. private:
  504. void GetHorriblyHackedRailgunPosition( const Vector& vStart, Vector *out_pvStartPos );
  505. void MaybeDrawRailgunBeam( IRecipientFilter *pFilter, CTFWeaponBase *pWeapon, const Vector& vStartPos, const Vector& vEndPos );
  506. // Taunts
  507. public:
  508. bool IsReadyToTauntWithPartner( void ) const { return m_bIsReadyToHighFive; }
  509. CTFPlayer * GetTauntPartner( void ) { return m_hHighFivePartner; }
  510. float GetTauntYaw( void ) { return m_flTauntYaw; }
  511. float GetPrevTauntYaw( void ) { return m_flPrevTauntYaw; }
  512. void SetTauntYaw( float flTauntYaw );
  513. CTFPlayer * FindPartnerTauntInitiator( void );
  514. void AcceptTauntWithPartner( CTFPlayer *initiator );
  515. void MimicTauntFromPartner( CTFPlayer *initiator );
  516. bool CanMoveDuringTaunt();
  517. bool ShouldStopTaunting();
  518. bool IsTauntInitiator() const { return m_bIsTauntInitiator; }
  519. bool IsTauntForceMovingForward() const { return m_bTauntForceMoveForward; }
  520. float GetTauntMoveAcceleration() const { return m_flTauntMoveAccelerationTime; }
  521. float GetTauntMoveSpeed() const { return m_flTauntForceMoveForwardSpeed; }
  522. float GetTauntTurnAccelerationTime() const { return m_flTauntTurnAccelerationTime; }
  523. virtual int GetAllowedTauntPartnerTeam() const;
  524. CEconItemView *GetTauntEconItemView() { return m_TauntEconItemView.IsValid() ? &m_TauntEconItemView : NULL; }
  525. int GetTauntConcept( CEconItemDefinition *pItemDef );
  526. bool PlayTauntSceneFromItem( CEconItemView *pEconItemView );
  527. void OnTauntSucceeded( const char* pszSceneName, int iTauntIndex = 0, int iTauntConcept = 0 );
  528. void Taunt( taunts_t iTauntIndex = TAUNT_BASE_WEAPON, int iTauntConcept = 0 );
  529. bool IsTaunting( void ) const { return m_Shared.InCond( TF_COND_TAUNTING ); }
  530. void DoTauntAttack( void );
  531. bool IsAllowedToTaunt( void );
  532. bool FindOpenTauntPartnerPosition( CEconItemView *pEconItemView, Vector &position, float *flTolerance );
  533. bool IsAllowedToInitiateTauntWithPartner( CEconItemView *pEconItemView, char *pszErrorMessage = NULL, int cubErrorMessage = 0 );
  534. void CancelTaunt( void );
  535. void StopTaunt( void );
  536. void EndLongTaunt();
  537. float GetTauntRemoveTime( void ) const { return m_flTauntRemoveTime; }
  538. bool IsAllowedToRemoveTaunt() const { return m_bAllowedToRemoveTaunt; }
  539. void HandleTauntCommand( int iTauntSlot = 0 );
  540. QAngle m_angTauntCamera;
  541. CHandle< CBaseEntity > m_hTauntItem;
  542. void ClearTauntAttack();
  543. float GetTauntAttackTime() const { return m_flTauntAttackTime; }
  544. void SetRPSResult( int iRPSResult ) { m_iTauntRPSResult = iRPSResult; }
  545. void HandleWeaponSlotAfterTaunt();
  546. float GetCurrentTauntMoveSpeed() const { return m_flCurrentTauntMoveSpeed; }
  547. void SetCurrentTauntMoveSpeed( float flSpeed ) { m_flCurrentTauntMoveSpeed = flSpeed; }
  548. float GetVehicleReverseTime() const { return m_flVehicleReverseTime; }
  549. void SetVehicleReverseTime( float flTime ) { m_flVehicleReverseTime = flTime; }
  550. private:
  551. void GetReadyToTauntWithPartner( void );
  552. void CancelTauntWithPartner( void );
  553. void StopTauntSoundLoop();
  554. float PlayTauntOutroScene();
  555. float PlayTauntRemapInputScene();
  556. void ParseSharedTauntDataFromEconItemView( CEconItemView *pEconItemView );
  557. CNetworkVar( bool, m_bAllowMoveDuringTaunt );
  558. CNetworkVar( bool, m_bIsReadyToHighFive );
  559. CNetworkHandle( CTFPlayer, m_hHighFivePartner );
  560. CNetworkVar( int, m_nForceTauntCam );
  561. CNetworkVar( float, m_flTauntYaw );
  562. CNetworkVar( int, m_nActiveTauntSlot );
  563. CNetworkVar( item_definition_index_t, m_iTauntItemDefIndex );
  564. CNetworkVar( float, m_flCurrentTauntMoveSpeed );
  565. CNetworkVar( float, m_flVehicleReverseTime );
  566. bool m_bTauntForceMoveForward;
  567. float m_flTauntForceMoveForwardSpeed;
  568. float m_flTauntMoveAccelerationTime;
  569. float m_flTauntTurnSpeed;
  570. float m_flTauntTurnAccelerationTime;
  571. float m_flPrevTauntYaw;
  572. EHANDLE m_hTauntScene;
  573. CHandle< CTFTauntProp > m_hTauntProp;
  574. bool m_bInitTaunt;
  575. bool m_bTauntMimic;
  576. bool m_bIsTauntInitiator;
  577. float m_flTauntSoundTime;
  578. CUtlString m_strTauntSoundName;
  579. float m_flTauntSoundLoopTime;
  580. CUtlString m_strTauntSoundLoopName;
  581. CEconItemView m_TauntEconItemView;
  582. enum TauntStage_t
  583. {
  584. TAUNT_NONE = 0,
  585. TAUNT_INTRO,
  586. TAUNT_OUTRO
  587. } m_TauntStage;
  588. bool m_bAllowedToRemoveTaunt;
  589. float m_flTauntStartTime;
  590. float m_flTauntRemoveTime;
  591. float m_flTauntOutroTime;
  592. Vector m_vecTauntStartPosition;
  593. float m_flNextAllowTauntRemapInputTime;
  594. float m_flTauntAttackTime;
  595. float m_flTauntInhaleTime;
  596. taunt_attack_t m_iTauntAttack;
  597. int m_iTauntAttackCount;
  598. int m_iTauntRPSResult;
  599. int m_iPreTauntWeaponSlot;
  600. int m_iPreTauntFOV;
  601. float m_flNextReflectZap;
  602. public:
  603. virtual int GetSpecialDSP( void );
  604. virtual float PlayScene( const char *pszScene, float flDelay = 0.0f, AI_Response *response = NULL, IRecipientFilter *filter = NULL );
  605. void SetDeathFlags( int iDeathFlags ) { m_iDeathFlags = iDeathFlags; }
  606. int GetDeathFlags() { return m_iDeathFlags; }
  607. void SetMaxSentryKills( int iMaxSentryKills ) { m_iMaxSentryKills = iMaxSentryKills; }
  608. int GetMaxSentryKills() { return m_iMaxSentryKills; }
  609. CNetworkVar( bool, m_iSpawnCounter );
  610. void CheckForIdle( void );
  611. inline bool IsAwayFromKeyboard( void ) { return m_bIsAFK; }
  612. void PickWelcomeObserverPoint();
  613. virtual bool ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scene, CChoreoEvent *event );
  614. void StopRandomExpressions( void ) { m_flNextRandomExpressionTime = -1; }
  615. void StartRandomExpressions( void ) { m_flNextRandomExpressionTime = gpGlobals->curtime; }
  616. virtual bool WantsLagCompensationOnEntity( const CBasePlayer *pPlayer, const CUserCmd *pCmd, const CBitVec<MAX_EDICTS> *pEntityTransmitBits ) const;
  617. CTFWeaponBase *Weapon_OwnsThisID( int iWeaponID ) const;
  618. CTFWeaponBase *Weapon_GetWeaponByType( int iType );
  619. medigun_charge_types GetChargeEffectBeingProvided( void );
  620. // Achievements
  621. void AwardAchievement( int iAchievement, int iCount = 1 );
  622. void HandleAchievement_Medic_AssistHeavy( CTFPlayer *pPunchVictim );
  623. void HandleAchievement_Pyro_BurnFromBehind( CTFPlayer *pBurner );
  624. void ClearPunchVictims( void ) { m_aPunchVictims.RemoveAll(); }
  625. void ClearBurnFromBehindAttackers( void ) { m_aBurnFromBackAttackers.RemoveAll(); }
  626. int RocketJumped( void ) { return m_iBlastJumpState & TF_PLAYER_ROCKET_JUMPED; }
  627. int StickyJumped( void ) { return m_iBlastJumpState & TF_PLAYER_STICKY_JUMPED; }
  628. void SetBlastJumpState( int iState, bool bPlaySound = false );
  629. void ClearBlastJumpState( void );
  630. int GetPreviousTeam( void ) { return m_iPreviousteam; }
  631. bool IsArenaSpectator( void ) { return m_bArenaSpectator; }
  632. float GetTeamJoinTime( void ) { return m_flTeamJoinTime; }
  633. void MarkTeamJoinTime( void ) { m_flTeamJoinTime = gpGlobals->curtime; }
  634. void PlayerJustPlayed( bool bPlayed ) { m_bJustPlayed = bPlayed; }
  635. bool DidPlayerJustPlay( void ) { return m_bJustPlayed; }
  636. bool IsCapturingPoint( void );
  637. bool m_bSuicideExplode;
  638. bool m_bScattergunJump;
  639. int m_iOldStunFlags;
  640. bool m_bFlipViewModels;
  641. int m_iBlastJumpState;
  642. float m_flBlastJumpLandTime;
  643. bool m_bTakenBlastDamageSinceLastMovement;
  644. void SetTargetDummy( void ){ m_bIsTargetDummy = true; }
  645. bool ShouldCollideWithSentry( void ){ return m_bCollideWithSentry; }
  646. bool IsAnyEnemySentryAbleToAttackMe( void ) const; // return true if any enemy sentry has LOS and is facing me and is in range to attack
  647. int GetHealthBefore( void ) { return m_iHealthBefore; }
  648. int GetAutoTeam( int nPreferedTeam = TF_TEAM_AUTOASSIGN );
  649. bool ShouldForceAutoTeam( void );
  650. float m_flCommentOnCarrying;
  651. int GetTeamChangeCount( void ) { return m_iTeamChanges; }
  652. int GetClassChangeCount( void ) { return m_iClassChanges; }
  653. void IncrementKillCountSinceLastDeploy( const CTakeDamageInfo &info );
  654. void ForceItemRemovalOnRespawn( void ) { m_bForceItemRemovalOnRespawn = true; }
  655. // Item Testing
  656. public:
  657. void ItemTesting_Start( KeyValues *pKV );
  658. void ItemTesting_UpdateBots( KeyValues *pKV );
  659. CEconItemView *ItemTesting_GetTestItem( int iClass, int iSlot );
  660. void ItemTesting_DeleteItems();
  661. public:
  662. struct itemtest_t
  663. {
  664. KeyValues *pKV;
  665. CEconItemView scriptItem;
  666. };
  667. CUtlVector<itemtest_t> m_ItemsToTest;
  668. bool m_bItemTestingRespawn;
  669. bool IsMissionEnemy( void ){ return m_bIsMissionEnemy; }
  670. void MarkAsMissionEnemy( void ){ m_bIsMissionEnemy = true; }
  671. bool IsSupportEnemy( void ){ return m_bIsSupportEnemy; }
  672. void MarkAsSupportEnemy( void ){ m_bIsSupportEnemy = true; }
  673. void MarkAsLimitedSupportEnemy( void ){ m_bIsLimitedSupportEnemy = true; }
  674. // In-game currency
  675. int GetCurrency( void ) const { return m_nCurrency; }
  676. void SetCurrency( int nAmount ){ m_nCurrency = nAmount; }
  677. void AddCurrency( int nAmount );
  678. void RemoveCurrency( int nAmount );
  679. // Set the amount of money this bot is worth when killed. We re-use m_nCurrency, because bots don't collect currency.
  680. void SetCustomCurrencyWorth( int nAmount ) { m_nCurrency = nAmount; }
  681. // Bounty Mode
  682. int GetExperienceLevel( void ) { return m_nExperienceLevel; }
  683. void SetExperienceLevel( int nValue ) { m_nExperienceLevel.Set( MAX( nValue, 1 ) ); }
  684. int GetExperiencePoints( void ) { return m_nExperiencePoints; }
  685. void SetExperiencePoints( int nValue ) { m_nExperiencePoints = MAX( nValue, 0 ); }
  686. void AddExperiencePoints( int nValue, bool bGiveCurrency = false, CTFPlayer *pSource = NULL );
  687. void CalculateExperienceLevel( bool bAnnounce = true );
  688. void RefundExperiencePoints( void );
  689. void RememberUpgrade( int iPlayerClass, CEconItemView *pItem, int iUpgrade, int nCost, bool bDowngrade = false ); // store this upgrade for restoring at a checkpoint
  690. void ForgetFirstUpgradeForItem( CEconItemView *pItem ); // erase the first upgrade stored for this item (for powerup bottles)
  691. void ClearUpgradeHistory( void );
  692. void ReapplyItemUpgrades ( CEconItemView *pItem );
  693. void ReapplyPlayerUpgrades ( void );
  694. void SetWaveSpawnPopulator( CWaveSpawnPopulator *pWave ){ m_pWaveSpawnPopulator = pWave; }
  695. CUtlVector< CUpgradeInfo >* GetRefundableUpgrades( void ) { return &m_RefundableUpgrades; }
  696. void ResetRefundableUpgrades( void ) { m_RefundableUpgrades.RemoveAll(); }
  697. void BeginPurchasableUpgrades( void );
  698. void EndPurchasableUpgrades( void );
  699. bool CanPurchaseUpgrades( void ) const { Assert( m_nCanPurchaseUpgradesCount >= 0 ); return m_nCanPurchaseUpgradesCount > 0; }
  700. void PlayReadySound( void );
  701. void AccumulateSentryGunDamageDealt( float damage );
  702. void ResetAccumulatedSentryGunDamageDealt();
  703. float GetAccumulatedSentryGunDamageDealt();
  704. void IncrementSentryGunKillCount( void );
  705. void ResetAccumulatedSentryGunKillCount();
  706. int GetAccumulatedSentryGunKillCount();
  707. bool PlaySpecificSequence( const char *pSequenceName );
  708. void SetWaterExitTime( float flTime ){ m_flWaterExitTime = flTime; }
  709. float GetWaterExitTime( void ){ return m_flWaterExitTime; }
  710. void MerasmusPlayerBombExplode( bool bExcludeMe = true );
  711. void DropDeathCallingCard( CTFPlayer* pTFAttacker, CTFPlayer* pTFVictim );
  712. //---------------------------------
  713. // support entity IO for forcing speech concepts
  714. void InputSpeakResponseConcept( inputdata_t &inputdata );
  715. //---------------------------------
  716. float GetTimeSinceLastThink( void ) const { return ( m_flLastThinkTime >= 0.f ) ? gpGlobals->curtime - m_flLastThinkTime : -1.f; }
  717. float GetRespawnTimeOverride( void ) const { return m_flRespawnTimeOverride; }
  718. const char *GetRespawnLocationOverride( void ) const { return ( m_strRespawnLocationOverride == NULL_STRING ) ? NULL : m_strRespawnLocationOverride.ToCStr(); }
  719. void SetRespawnOverride( float flRespawnTime, string_t respawnLocation ) { m_flRespawnTimeOverride = flRespawnTime; m_strRespawnLocationOverride = respawnLocation; }
  720. void ResetIdleCheck( void ) { m_flLastAction = gpGlobals->curtime; }
  721. // Matchmaking
  722. void SetMatchSafeToLeave( bool bMatchSafeToLeave ) { m_bMatchSafeToLeave = bMatchSafeToLeave; }
  723. void SetPrevRoundTeamNum( int nTeamNum ){ m_nPrevRoundTeamNum = nTeamNum; }
  724. int GetPrevRoundTeamNum( void ){ return m_nPrevRoundTeamNum; }
  725. protected:
  726. // Creation/Destruction.
  727. virtual void InitClass( void );
  728. void GiveDefaultItems();
  729. bool SelectSpawnSpotByType( const char *pEntClassName, CBaseEntity* &pSpot ); // "info_player_teamspawn"
  730. bool SelectSpawnSpotByName( const char *pEntName, CBaseEntity* &pSpot ); // named info_player_teamspawn, i.e. "my_blue_offense_respawns"
  731. void RemoveNemesisRelationships();
  732. void RemoveAllItems();
  733. // Think.
  734. void TFPlayerThink();
  735. void UpdateTimers( void );
  736. // Regeneration due to being a Medic, or derived from items
  737. void RegenThink();
  738. void RuneRegenThink();
  739. void RegenAmmoInternal( int iAmmo, float flRegen );
  740. void ResetPlayerClass( void );
  741. virtual void Internal_HandleMapEvent( inputdata_t &inputdata ) OVERRIDE;
  742. private:
  743. float m_flAccumulatedHealthRegen; // Regeneration can be in small amounts, so we accumulate it and apply when it's > 1
  744. float m_flNextAmmoRegenAt;
  745. float m_flLastHealthRegenAt;
  746. float m_flAccumulatedRuneHealthRegen;
  747. float m_flNextRuneAmmoRegenAt;
  748. float m_flLastRuneHealthRegenAt;
  749. float m_flAccumulatedAmmoRegens[TF_AMMO_SECONDARY+1]; // Only support regenerating primary & secondary right now
  750. // Bots.
  751. friend void Bot_Think( CTFPlayer *pBot );
  752. // Physics.
  753. void PhysObjectSleep();
  754. void PhysObjectWake();
  755. // Ammo pack.
  756. bool CalculateAmmoPackPositionAndAngles( CTFWeaponBase *pWeapon, Vector &vecOrigin, QAngle &vecAngles );
  757. void AmmoPackCleanUp( void );
  758. // State.
  759. CPlayerStateInfo *StateLookupInfo( int nState );
  760. void StateEnter( int nState );
  761. void StateLeave( void );
  762. void StateTransition( int nState );
  763. void StateEnterWELCOME( void );
  764. void StateThinkWELCOME( void );
  765. void StateEnterPICKINGTEAM( void );
  766. void StateEnterACTIVE( void );
  767. void StateEnterOBSERVER( void );
  768. void StateThinkOBSERVER( void );
  769. void StateEnterDYING( void );
  770. void StateThinkDYING( void );
  771. virtual bool SetObserverMode(int mode);
  772. virtual void AttemptToExitFreezeCam( void );
  773. bool PlayGesture( const char *pGestureName );
  774. bool GetResponseSceneFromConcept( int iConcept, char *chSceneBuffer, int numSceneBufferBytes );
  775. public:
  776. // Achievement data storage
  777. CAchievementData m_AchievementData;
  778. CTFPlayerAnimState *m_PlayerAnimState;
  779. private:
  780. // Map introductions
  781. int m_iIntroStep;
  782. CHandle<CIntroViewpoint> m_hIntroView;
  783. float m_flIntroShowHintAt;
  784. float m_flIntroShowEventAt;
  785. bool m_bHintShown;
  786. bool m_bAbortFreezeCam;
  787. bool m_bSeenRoundInfo;
  788. bool m_bRegenerating;
  789. // Items.
  790. CNetworkHandle( CTFItem, m_hItem );
  791. // Combat.
  792. CNetworkHandle( CTFWeaponBase, m_hOffHandWeapon );
  793. float m_flHealthBuffTime;
  794. int m_iHealthBefore;
  795. float m_flNextRegenerateTime;
  796. float m_flNextChangeClassTime;
  797. float m_flNextChangeTeamTime;
  798. bool m_bAllSeeCrit;
  799. bool m_bMiniCrit;
  800. bool m_bShowDisguisedCrit;
  801. EAttackBonusEffects_t m_eBonusAttackEffect;
  802. int m_iTeamChanges;
  803. int m_iClassChanges;
  804. // Ragdolls.
  805. Vector m_vecTotalBulletForce;
  806. // State.
  807. CPlayerStateInfo *m_pStateInfo;
  808. // Spawn Point
  809. CTFTeamSpawn *m_pSpawnPoint;
  810. // Networked.
  811. CNetworkQAngle( m_angEyeAngles ); // Copied from EyeAngles() so we can send it to the client.
  812. CTFPlayerClass m_PlayerClass;
  813. int m_iLastWeaponFireUsercmd; // Firing a weapon. Last usercmd we shot a bullet on.
  814. int m_iLastWeaponSlot; // To save last switch between lives
  815. int m_iLastSkin;
  816. CNetworkVar( float, m_flLastDamageTime );
  817. float m_flLastDamageDoneTime;
  818. CHandle< CBaseEntity > m_hLastDamageDoneEntity;
  819. float m_flLastHealedTime;
  820. float m_flNextPainSoundTime;
  821. int m_LastDamageType;
  822. int m_iDeathFlags; // TF_DEATH_* flags with additional death info
  823. int m_iMaxSentryKills; // most kills by a single sentry
  824. int m_iNumberofDominations; // number of active dominations for this player
  825. bool m_bPlayedFreezeCamSound;
  826. bool m_bSwitchedClass;
  827. bool m_bRememberLastWeapon;
  828. bool m_bRememberActiveWeapon;
  829. int m_iActiveWeaponTypePriorToDeath;
  830. CHandle< CTFWeaponBuilder > m_hWeaponBuilder;
  831. CUtlVector<EHANDLE> m_aObjects; // List of player objects
  832. bool m_bIsClassMenuOpen;
  833. Vector m_vecLastDeathPosition;
  834. float m_flSpawnTime;
  835. float m_flLastAction;
  836. float m_flTimeInSpawn;
  837. CUtlVector<EHANDLE> m_hObservableEntities;
  838. CUtlVector<float> m_aBurnOtherTimes; // vector of times this player has burned others
  839. bool m_bHudClassAutoKill;
  840. // Background expressions
  841. string_t m_iszExpressionScene;
  842. EHANDLE m_hExpressionSceneEnt;
  843. float m_flNextRandomExpressionTime;
  844. bool m_bSpeakingConceptAsDisguisedSpy;
  845. bool m_bMedigunAutoHeal;
  846. bool m_bAutoRezoom; // does the player want to re-zoom after each shot for sniper rifles
  847. bool m_bAutoReload;
  848. bool m_bForceItemRemovalOnRespawn;
  849. int m_nPrevRoundTeamNum;
  850. public:
  851. // Powerplay cheats
  852. bool SetPowerplayEnabled( bool bOn );
  853. bool PlayerHasPowerplay( void );
  854. void PowerplayThink( void );
  855. CNetworkVar( bool, m_bInPowerPlay );
  856. bool IsGoingFeignDeath( void ) { return m_bGoingFeignDeath; }
  857. void SetDeployingBombState( BombDeployingState_t nDeployingBombState ) { m_nDeployingBombState = nDeployingBombState; }
  858. BombDeployingState_t GetDeployingBombState( void ) const { return m_nDeployingBombState; }
  859. void SetPendingMerasmusPlayerBombExplode( void ){ m_bPendingMerasmusPlayerBombExplode = true; }
  860. private:
  861. // Achievement data
  862. CUtlVector<EHANDLE> m_aPunchVictims;
  863. CUtlVector<EHANDLE> m_aBurnFromBackAttackers;
  864. int m_iLeftGroundHealth; // health we were at the last time we left the ground
  865. float m_flTeamJoinTime;
  866. bool m_bCreatedRocketJumpParticles;
  867. bool m_bJustPlayed;
  868. int m_iPreviousteam;
  869. bool m_bGibbedOnLastDeath;
  870. CUtlMap<int, float> m_Cappers;
  871. float m_fMaxHealthTime;
  872. // Feign death.
  873. bool m_bGoingFeignDeath;
  874. CHandle<CBaseEntity> m_hFeignRagdoll; // Don't use the normal ragdoll.
  875. Vector m_vecFeignDeathVelocity;
  876. CNetworkVar( bool, m_bArenaSpectator );
  877. bool m_bArenaIsAFK; // used to detect when players are AFK during an Arena-mode round
  878. bool m_bIsAFK;
  879. BombDeployingState_t m_nDeployingBombState;
  880. bool m_bIsMissionEnemy;
  881. bool m_bIsSupportEnemy;
  882. bool m_bIsLimitedSupportEnemy;
  883. // In-game currency
  884. CNetworkVar( int, m_nCurrency );
  885. CNetworkVar( bool, m_bIsMiniBoss );
  886. // Bounty Mode
  887. CNetworkVar( uint32, m_nExperienceLevel );
  888. CNetworkVar( uint32, m_nExperienceLevelProgress ); // Networked progress bar
  889. uint32 m_nExperiencePoints; // Raw player-only value
  890. // Matchmaking
  891. // is this player bound to the match on penalty of abandon. Sync'd via local-player-only DT
  892. CNetworkVar( bool, m_bMatchSafeToLeave );
  893. CWaveSpawnPopulator *m_pWaveSpawnPopulator;
  894. float m_flLastReadySoundTime;
  895. int m_nCanPurchaseUpgradesCount;
  896. CUtlVector< CUpgradeInfo > m_RefundableUpgrades;
  897. public:
  898. // Marking for death.
  899. CHandle<CTFPlayer> m_pMarkedForDeathTarget;
  900. CountdownTimer m_playerMovementStuckTimer; // for destroying stuck bots in MvM
  901. QAngle m_qPreviousChargeEyeAngle; // Previous EyeAngles to compute deltas for legal mouse movement
  902. private:
  903. //=============================================================================
  904. // HPE_BEGIN:
  905. // [msmith] Added a player type so we can distinguish between bots and humans.
  906. //=============================================================================
  907. TFPlayerType m_playerType;
  908. //=============================================================================
  909. // HPE_END
  910. //=============================================================================
  911. bool m_bIsTargetDummy;
  912. bool m_bCollideWithSentry;
  913. IntervalTimer m_calledForMedicTimer;
  914. CountdownTimer m_placedSapperTimer;
  915. CountdownTimer m_inCombatThrottleTimer;
  916. mutable char m_bIsCalculatingMaximumSpeed;
  917. public:
  918. float GetDesiredHeadScale() const;
  919. float GetHeadScaleSpeed() const;
  920. float GetDesiredTorsoScale() const;
  921. float GetTorsoScaleSpeed() const;
  922. float GetDesiredHandScale() const;
  923. float GetHandScaleSpeed() const;
  924. bool IsInPurgatory( void ) const;
  925. bool HasPurgatoryBuff( void ) const;
  926. void SetBombHeadTimestamp();
  927. float GetTimeSinceWasBombHead() const;
  928. float GetKartSpeedBoost( void );
  929. float GetKartHealth( void ) { return m_iKartHealth; }
  930. void AddKartDamage( int iDamage ) { m_iKartHealth = Max(0, m_iKartHealth + iDamage); }
  931. float GetKartKnockbackMultiplier( float flExtraMultiplier ) const;
  932. void ResetKartDamage();
  933. CBaseEntity *GetKartBombHeadTarget() const { return m_hKartBombHeadTarget; }
  934. void SetKartBombHeadTarget( CBaseEntity* pEnt ) { m_hKartBombHeadTarget = pEnt; }
  935. void AddHalloweenKartPushEvent( CTFPlayer *pOther, CBaseEntity *pInflictor, CBaseEntity *pWeapon, Vector vForce, int iDamage, int iDamageType = 0 );
  936. QAngle GetAnimRenderAngles( void ) { return m_PlayerAnimState->GetRenderAngles(); }
  937. void CancelEurekaTeleport();
  938. CNetworkVar( int, m_iKartState );
  939. CNetworkVar( float, m_flKartNextAvailableBoost );
  940. float m_flHHHKartAttackTime;
  941. // Wrenchmotron teleport
  942. bool m_bIsTeleportingUsingEurekaEffect;
  943. private:
  944. void UpdateHalloween( void );
  945. Vector m_vHalloweenKartPush;
  946. float m_flHalloweenKartPushEventTime;
  947. bool m_bCheckKartCollision;
  948. EHANDLE m_hKartBombHeadTarget;
  949. float m_flNextBonusDucksVOAllowedTime;
  950. CNetworkVar( int, m_iKartHealth );
  951. float m_flGhostLastHitByKartTime;
  952. bool m_bIsInPurgatory; // for 2011 Halloween event
  953. CountdownTimer m_purgatoryBuffTimer;
  954. CountdownTimer m_purgatoryPainMultiplierTimer;
  955. int m_purgatoryPainMultiplier;
  956. CNetworkVar( float, m_flHeadScale );
  957. CNetworkVar( float, m_flTorsoScale );
  958. CNetworkVar( float, m_flHandScale );
  959. //CountdownTimer m_fireproofTimer; // if active, we're fireproof
  960. // Wrenchmotron teleport
  961. CountdownTimer m_teleportHomeFlashTimer;
  962. eEurekaTeleportTargets m_eEurekaTeleportTarget;
  963. float m_accumulatedSentryGunDamageDealt; // for Sentry Buster missions in MvM
  964. int m_accumulatedSentryGunKillCount; // for Sentry Buster missions in MvM
  965. static const int DPS_Period = 90; // The duration of the sliding window for calculating DPS, in seconds
  966. int *m_damageRateArray; // One array element per second, for accumulating damage done during that time
  967. int m_lastDamageRateIndex;
  968. int m_peakDamagePerSecond;
  969. CNetworkVar( uint16, m_nActiveWpnClip );
  970. uint16 m_nActiveWpnClipPrev;
  971. float m_flNextClipSendTime;
  972. float m_flWaterExitTime;
  973. bool m_bPendingMerasmusPlayerBombExplode;
  974. float m_fLastBombHeadTimestamp;
  975. bool m_bIsSapping;
  976. int m_iSappingEvent;
  977. float m_flSapStartTime;
  978. float m_flLastThinkTime;
  979. float m_flRespawnTimeOverride;
  980. string_t m_strRespawnLocationOverride;
  981. CountdownTimer m_booTimer;
  982. CNetworkVar( bool, m_bUseBossHealthBar );
  983. CNetworkVar( bool, m_bUsingVRHeadset );
  984. CNetworkVar( bool, m_bForcedSkin );
  985. CNetworkVar( int, m_nForcedSkin );
  986. private:
  987. CHandle< CTFReviveMarker > m_hReviveMarker;
  988. public:
  989. CTFReviveMarker *GetReviveMarker( void ) { return m_hReviveMarker; }
  990. // Send ForcePlayerViewAngles user message. Handled in __MsgFunc_ForcePlayerViewAngles in
  991. // clientmode_tf.cpp. Sets Local and Abs angles, along with TauntYaw and VehicleMovingAngles.
  992. void ForcePlayerViewAngles( const QAngle& qTeleportAngles );
  993. CBaseEntity *GetGrapplingHookTarget() const { return m_hGrapplingHookTarget; }
  994. void SetGrapplingHookTarget( CBaseEntity *pTarget, bool bShouldBleed = false );
  995. bool IsUsingActionSlot() const { return m_bUsingActionSlot; }
  996. void SetSecondaryLastWeapon( CBaseCombatWeapon *pSecondaryLastWeapon ) { m_hSecondaryLastWeapon = pSecondaryLastWeapon; }
  997. CBaseCombatWeapon* GetSecondaryLastWeapon() const { return m_hSecondaryLastWeapon; }
  998. bool CanBeForcedToLaugh( void );
  999. void CreateDisguiseWeaponList( CTFPlayer *pDisguiseTarget );
  1000. void ClearDisguiseWeaponList();
  1001. bool CanPickupDroppedWeapon( const CTFDroppedWeapon *pWeapon );
  1002. CTFDroppedWeapon* GetDroppedWeaponInRange();
  1003. bool HasCampaignMedal( int iMedal );
  1004. void SetCampaignMedalActive( int iMedal ){ m_iCampaignMedals |= iMedal; }
  1005. void InspectButtonPressed();
  1006. void InspectButtonReleased();
  1007. bool IsInspecting() const;
  1008. void SetNextScorePointForPD( float flTime ){ m_flNextScorePointForPD = flTime; }
  1009. bool CanScorePointForPD( void ) const;
  1010. void AddCustomAttribute( const char *pszAttributeName, float flVal, float flDuration = -1.f );
  1011. void RemoveCustomAttribute( const char *pszAttributeName );
  1012. int GetSkinOverride() const { return m_iPlayerSkinOverride; }
  1013. bool ShouldGetBonusPointsForExtinguishEvent( int userID );
  1014. void SetLastAutobalanceTime( float flTime ) { m_flLastAutobalanceTime = flTime; }
  1015. float GetLastAutobalanceTime() { return m_flLastAutobalanceTime; }
  1016. private:
  1017. bool PickupWeaponFromOther( CTFDroppedWeapon *pDroppedWeapon );
  1018. bool TryToPickupDroppedWeapon();
  1019. float m_flSendPickupWeaponMessageTime;
  1020. void ModifyDamageInfo( CTakeDamageInfo *pInfo, const CBaseEntity *pTarget );
  1021. CNetworkHandle( CBaseEntity, m_hGrapplingHookTarget );
  1022. float m_flLastSeenHookTarget;
  1023. int m_nHookAttachedPlayers;
  1024. CNetworkHandle( CBaseCombatWeapon, m_hSecondaryLastWeapon );
  1025. CNetworkVar( bool, m_bUsingActionSlot );
  1026. CNetworkVar( float, m_flInspectTime );
  1027. CUtlVector< CHandle< CTFWeaponBase > > m_hDisguiseWeaponList; // copy disguise target weapons to this list
  1028. CNetworkVar( int, m_iCampaignMedals );
  1029. float m_flNextScorePointForPD;
  1030. float m_flLastRuneChargeUpdate;
  1031. float m_flLastDamageResistSoundTime;
  1032. void UpdateCustomAttributes();
  1033. void RemoveAllCustomAttributes();
  1034. CUtlMap< CUtlString, float > m_mapCustomAttributes;
  1035. CNetworkVar( int, m_iPlayerSkinOverride );
  1036. CUtlMap<int, float> m_PlayersExtinguished; // userID and most recent time they were extinguished for bonus points
  1037. float m_flLastAutobalanceTime;
  1038. // begin passtime
  1039. public:
  1040. bool SayAskForBall();
  1041. bool m_bPasstimeBallSlippery;
  1042. // end passtime
  1043. virtual bool ShouldForceTransmitsForTeam( int iTeam ) OVERRIDE;
  1044. virtual bool IsTruceValidForEnt( void ) const OVERRIDE;
  1045. };
  1046. //-----------------------------------------------------------------------------
  1047. // Purpose: Utility function to convert an entity into a tf player.
  1048. // Input: pEntity - the entity to convert into a player
  1049. //-----------------------------------------------------------------------------
  1050. inline CTFPlayer *ToTFPlayer( CBaseEntity *pEntity )
  1051. {
  1052. if ( !pEntity || !pEntity->IsPlayer() )
  1053. return NULL;
  1054. Assert( dynamic_cast<CTFPlayer*>( pEntity ) != 0 );
  1055. return static_cast< CTFPlayer* >( pEntity );
  1056. }
  1057. inline bool CTFPlayer::IsFireproof( void ) const
  1058. {
  1059. return m_Shared.InCond( TF_COND_FIRE_IMMUNE );
  1060. }
  1061. inline bool CTFPlayer::HasPurgatoryBuff( void ) const
  1062. {
  1063. return m_purgatoryBuffTimer.HasStarted() && !m_purgatoryBuffTimer.IsElapsed();
  1064. }
  1065. inline void CTFPlayer::OnSapperPlaced( CBaseEntity *sappedObject )
  1066. {
  1067. m_placedSapperTimer.Start( 3.0f );
  1068. }
  1069. inline void CTFPlayer::OnSapperStarted( float flStartTime )
  1070. {
  1071. if (m_iSappingEvent == TF_SAPEVENT_NONE && m_flSapStartTime == 0.00 )
  1072. {
  1073. m_flSapStartTime = flStartTime;
  1074. m_bIsSapping = true;
  1075. m_iSappingEvent = TF_SAPEVENT_PLACED;
  1076. }
  1077. }
  1078. inline void CTFPlayer::OnSapperFinished( float flStartTime )
  1079. {
  1080. if (m_iSappingEvent == TF_SAPEVENT_NONE && flStartTime == m_flSapStartTime )
  1081. {
  1082. m_bIsSapping = false;
  1083. m_flSapStartTime = 0.00;
  1084. m_iSappingEvent = TF_SAPEVENT_DONE;
  1085. }
  1086. }
  1087. inline bool CTFPlayer::IsSapping( void ) const
  1088. {
  1089. return m_bIsSapping;
  1090. }
  1091. inline int CTFPlayer::GetSappingEvent( void ) const
  1092. {
  1093. return m_iSappingEvent;
  1094. }
  1095. inline void CTFPlayer::ClearSappingEvent( void )
  1096. {
  1097. m_iSappingEvent = TF_SAPEVENT_NONE;
  1098. }
  1099. inline void CTFPlayer::ClearSappingTracking( void )
  1100. {
  1101. ClearSappingEvent();
  1102. m_bIsSapping = false;
  1103. m_flSapStartTime = 0.00;
  1104. }
  1105. inline bool CTFPlayer::IsPlacingSapper( void ) const
  1106. {
  1107. return !m_placedSapperTimer.IsElapsed();
  1108. }
  1109. inline int CTFPlayer::StateGet( void ) const
  1110. {
  1111. return m_Shared.m_nPlayerState;
  1112. }
  1113. inline bool CTFPlayer::IsInCombat( void ) const
  1114. {
  1115. // the simplest condition is whether we've been firing our weapon very recently
  1116. return GetTimeSinceWeaponFired() < 2.0f;
  1117. }
  1118. inline bool CTFPlayer::IsCallingForMedic( void ) const
  1119. {
  1120. return m_calledForMedicTimer.HasStarted() && m_calledForMedicTimer.IsLessThen( 5.0f );
  1121. }
  1122. inline float CTFPlayer::GetTimeSinceCalledForMedic() const
  1123. {
  1124. return m_calledForMedicTimer.GetElapsedTime();
  1125. }
  1126. inline void CTFPlayer::NoteMedicCall( void )
  1127. {
  1128. m_calledForMedicTimer.Start();
  1129. }
  1130. inline bool CTFPlayer::IsInPurgatory( void ) const
  1131. {
  1132. return m_Shared.InCond( TF_COND_PURGATORY );
  1133. }
  1134. inline void CTFPlayer::AccumulateSentryGunDamageDealt( float damage )
  1135. {
  1136. m_accumulatedSentryGunDamageDealt += damage;
  1137. }
  1138. inline void CTFPlayer::ResetAccumulatedSentryGunDamageDealt()
  1139. {
  1140. m_accumulatedSentryGunDamageDealt = 0.0f;
  1141. }
  1142. inline float CTFPlayer::GetAccumulatedSentryGunDamageDealt()
  1143. {
  1144. return m_accumulatedSentryGunDamageDealt;
  1145. }
  1146. inline void CTFPlayer::IncrementSentryGunKillCount( void )
  1147. {
  1148. ++m_accumulatedSentryGunKillCount;
  1149. }
  1150. inline void CTFPlayer::ResetAccumulatedSentryGunKillCount()
  1151. {
  1152. m_accumulatedSentryGunKillCount = 0;
  1153. }
  1154. inline int CTFPlayer::GetAccumulatedSentryGunKillCount()
  1155. {
  1156. return m_accumulatedSentryGunKillCount;
  1157. }
  1158. inline int CTFPlayer::GetDamagePerSecond( void ) const
  1159. {
  1160. return m_peakDamagePerSecond;
  1161. }
  1162. inline void CTFPlayer::ResetDamagePerSecond( void )
  1163. {
  1164. for( int i=0; i<DPS_Period; ++i )
  1165. {
  1166. m_damageRateArray[i] = 0;
  1167. }
  1168. m_lastDamageRateIndex = -1;
  1169. m_peakDamagePerSecond = 0;
  1170. }
  1171. //=============================================================================
  1172. //
  1173. // CObserverPoint
  1174. //
  1175. class CObserverPoint : public CPointEntity
  1176. {
  1177. DECLARE_CLASS( CObserverPoint, CPointEntity );
  1178. public:
  1179. DECLARE_DATADESC();
  1180. CObserverPoint();
  1181. virtual void Activate( void );
  1182. bool CanUseObserverPoint( CTFPlayer *pPlayer );
  1183. virtual int UpdateTransmitState();
  1184. void InputEnable( inputdata_t &inputdata );
  1185. void InputDisable( inputdata_t &inputdata );
  1186. bool IsDefaultWelcome( void ) { return m_bDefaultWelcome; }
  1187. bool IsMatchSummary( void ) { return m_bMatchSummary; }
  1188. void SetDisabled( bool bDisabled ){ m_bDisabled = bDisabled; }
  1189. public:
  1190. bool m_bDisabled;
  1191. bool m_bDefaultWelcome;
  1192. EHANDLE m_hAssociatedTeamEntity;
  1193. string_t m_iszAssociateTeamEntityName;
  1194. float m_flFOV;
  1195. bool m_bMatchSummary;
  1196. };
  1197. #endif // TF_PLAYER_H