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.

131 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #ifndef HL1MP_PLAYER_H
  9. #define HL1MP_PLAYER_H
  10. #pragma once
  11. #include "cbase.h"
  12. #include "hl1_c_player.h"
  13. #include "hl1_player_shared.h"
  14. class C_HL1MP_Player : public C_HL1_Player
  15. {
  16. public:
  17. DECLARE_CLASS( C_HL1MP_Player, C_HL1_Player );
  18. DECLARE_CLIENTCLASS();
  19. DECLARE_PREDICTABLE();
  20. DECLARE_INTERPOLATION();
  21. C_HL1MP_Player( void );
  22. ~C_HL1MP_Player();
  23. virtual const QAngle& GetRenderAngles();
  24. virtual void UpdateClientSideAnimation();
  25. virtual void ProcessMuzzleFlashEvent();
  26. void DoAnimationEvent( PlayerAnimEvent_t event, int nData = 0 );
  27. virtual bool ShouldPredict( void );
  28. virtual void CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov );
  29. IRagdoll* GetRepresentativeRagdoll() const;
  30. virtual void Spawn( void );
  31. virtual void AddEntity( void );
  32. virtual bool ShouldDraw( void );
  33. virtual void OnDataChanged( DataUpdateType_t type );
  34. virtual void PostDataUpdate( DataUpdateType_t updateType );
  35. virtual void ClientThink( void );
  36. virtual C_BaseAnimating *BecomeRagdollOnClient();
  37. //QAngle GetAnimEyeAngles( void ) { return m_angEyeAngles; }
  38. const QAngle& EyeAngles( void )
  39. {
  40. if ( IsLocalPlayer() )
  41. {
  42. return BaseClass::EyeAngles();
  43. }
  44. else
  45. {
  46. return m_angEyeAngles;
  47. }
  48. }
  49. virtual ShadowType_t ShadowCastType()
  50. {
  51. if ( !IsVisible() )
  52. return SHADOWS_NONE;
  53. return SHADOWS_RENDER_TO_TEXTURE_DYNAMIC;
  54. }
  55. void PreThink( void );
  56. int m_iRealSequence;
  57. private:
  58. C_HL1MP_Player( const C_HL1MP_Player & );
  59. EHANDLE m_hRagdoll;
  60. QAngle m_angEyeAngles;
  61. CInterpolatedVar< QAngle > m_iv_angEyeAngles;
  62. IHL1MPPlayerAnimState* m_PlayerAnimState;
  63. int m_iSpawnInterpCounter;
  64. int m_iSpawnInterpCounterCache;
  65. float m_fLastPredFreeze;
  66. };
  67. class C_HL1MPRagdoll : public C_BaseAnimatingOverlay
  68. {
  69. public:
  70. DECLARE_CLASS( C_HL1MPRagdoll, C_BaseAnimatingOverlay );
  71. DECLARE_CLIENTCLASS();
  72. C_HL1MPRagdoll();
  73. ~C_HL1MPRagdoll();
  74. virtual void OnDataChanged( DataUpdateType_t type );
  75. int GetPlayerEntIndex() const;
  76. IRagdoll* GetIRagdoll() const;
  77. void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
  78. void UpdateOnRemove( void );
  79. virtual void SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightCount, float *pFlexWeights, float *pFlexDelayedWeights );
  80. private:
  81. C_HL1MPRagdoll( const C_HL1MPRagdoll & ) {}
  82. void Interp_Copy( C_BaseAnimatingOverlay *pSourceEntity );
  83. void CreateHL1MPRagdoll( void );
  84. private:
  85. EHANDLE m_hPlayer;
  86. CNetworkVector( m_vecRagdollVelocity );
  87. CNetworkVector( m_vecRagdollOrigin );
  88. };
  89. inline C_HL1MP_Player *ToHL1MPPlayer( CBaseEntity *pEntity )
  90. {
  91. if ( !pEntity || !pEntity->IsPlayer() )
  92. return NULL;
  93. return dynamic_cast<C_HL1MP_Player*>( pEntity );
  94. }
  95. #endif