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.

173 lines
4.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #ifndef HL2MP_PLAYER_H
  9. #define HL2MP_PLAYER_H
  10. #pragma once
  11. class C_HL2MP_Player;
  12. #include "c_basehlplayer.h"
  13. #include "hl2mp_player_shared.h"
  14. #include "beamdraw.h"
  15. //=============================================================================
  16. // >> HL2MP_Player
  17. //=============================================================================
  18. class C_HL2MP_Player : public C_BaseHLPlayer
  19. {
  20. public:
  21. DECLARE_CLASS( C_HL2MP_Player, C_BaseHLPlayer );
  22. DECLARE_CLIENTCLASS();
  23. DECLARE_PREDICTABLE();
  24. DECLARE_INTERPOLATION();
  25. C_HL2MP_Player();
  26. ~C_HL2MP_Player( void );
  27. void ClientThink( void );
  28. static C_HL2MP_Player* GetLocalHL2MPPlayer();
  29. virtual int DrawModel( int flags );
  30. virtual void AddEntity( void );
  31. QAngle GetAnimEyeAngles( void ) { return m_angEyeAngles; }
  32. Vector GetAttackSpread( CBaseCombatWeapon *pWeapon, CBaseEntity *pTarget = NULL );
  33. // Should this object cast shadows?
  34. virtual ShadowType_t ShadowCastType( void );
  35. virtual C_BaseAnimating *BecomeRagdollOnClient();
  36. virtual const QAngle& GetRenderAngles();
  37. virtual bool ShouldDraw( void );
  38. virtual void OnDataChanged( DataUpdateType_t type );
  39. virtual float GetFOV( void );
  40. virtual CStudioHdr *OnNewModel( void );
  41. virtual void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator );
  42. virtual void ItemPreFrame( void );
  43. virtual void ItemPostFrame( void );
  44. virtual float GetMinFOV() const { return 5.0f; }
  45. virtual Vector GetAutoaimVector( float flDelta );
  46. virtual void NotifyShouldTransmit( ShouldTransmitState_t state );
  47. virtual void CreateLightEffects( void ) {}
  48. virtual bool ShouldReceiveProjectedTextures( int flags );
  49. virtual void PostDataUpdate( DataUpdateType_t updateType );
  50. virtual void PlayStepSound( Vector &vecOrigin, surfacedata_t *psurface, float fvol, bool force );
  51. virtual void PreThink( void );
  52. virtual void DoImpactEffect( trace_t &tr, int nDamageType );
  53. IRagdoll* GetRepresentativeRagdoll() const;
  54. virtual void CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov );
  55. virtual const QAngle& EyeAngles( void );
  56. bool CanSprint( void );
  57. void StartSprinting( void );
  58. void StopSprinting( void );
  59. void HandleSpeedChanges( void );
  60. void UpdateLookAt( void );
  61. void Initialize( void );
  62. int GetIDTarget() const;
  63. void UpdateIDTarget( void );
  64. void PrecacheFootStepSounds( void );
  65. const char *GetPlayerModelSoundPrefix( void );
  66. HL2MPPlayerState State_Get() const;
  67. // Walking
  68. void StartWalking( void );
  69. void StopWalking( void );
  70. bool IsWalking( void ) { return m_fIsWalking; }
  71. virtual void PostThink( void );
  72. private:
  73. C_HL2MP_Player( const C_HL2MP_Player & );
  74. CPlayerAnimState m_PlayerAnimState;
  75. QAngle m_angEyeAngles;
  76. CInterpolatedVar< QAngle > m_iv_angEyeAngles;
  77. EHANDLE m_hRagdoll;
  78. int m_headYawPoseParam;
  79. int m_headPitchPoseParam;
  80. float m_headYawMin;
  81. float m_headYawMax;
  82. float m_headPitchMin;
  83. float m_headPitchMax;
  84. bool m_isInit;
  85. Vector m_vLookAtTarget;
  86. float m_flLastBodyYaw;
  87. float m_flCurrentHeadYaw;
  88. float m_flCurrentHeadPitch;
  89. int m_iIDEntIndex;
  90. CountdownTimer m_blinkTimer;
  91. int m_iSpawnInterpCounter;
  92. int m_iSpawnInterpCounterCache;
  93. int m_iPlayerSoundType;
  94. void ReleaseFlashlight( void );
  95. Beam_t *m_pFlashlightBeam;
  96. CNetworkVar( HL2MPPlayerState, m_iPlayerState );
  97. bool m_fIsWalking;
  98. };
  99. inline C_HL2MP_Player *ToHL2MPPlayer( CBaseEntity *pEntity )
  100. {
  101. if ( !pEntity || !pEntity->IsPlayer() )
  102. return NULL;
  103. return dynamic_cast<C_HL2MP_Player*>( pEntity );
  104. }
  105. class C_HL2MPRagdoll : public C_BaseAnimatingOverlay
  106. {
  107. public:
  108. DECLARE_CLASS( C_HL2MPRagdoll, C_BaseAnimatingOverlay );
  109. DECLARE_CLIENTCLASS();
  110. C_HL2MPRagdoll();
  111. ~C_HL2MPRagdoll();
  112. virtual void OnDataChanged( DataUpdateType_t type );
  113. int GetPlayerEntIndex() const;
  114. IRagdoll* GetIRagdoll() const;
  115. void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
  116. void UpdateOnRemove( void );
  117. virtual void SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightCount, float *pFlexWeights, float *pFlexDelayedWeights );
  118. private:
  119. C_HL2MPRagdoll( const C_HL2MPRagdoll & ) {}
  120. void Interp_Copy( C_BaseAnimatingOverlay *pDestinationEntity );
  121. void CreateHL2MPRagdoll( void );
  122. private:
  123. EHANDLE m_hPlayer;
  124. CNetworkVector( m_vecRagdollVelocity );
  125. CNetworkVector( m_vecRagdollOrigin );
  126. };
  127. #endif //HL2MP_PLAYER_H