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.

135 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Shared Player Variables / Functions and variables that may or may not be networked
  4. //
  5. //===========================================================================================//
  6. #ifndef SDK_PLAYER_SHARED_H
  7. #define SDK_PLAYER_SHARED_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "networkvar.h"
  12. #include "weapon_sdkbase.h"
  13. #ifdef CLIENT_DLL
  14. class C_SDKPlayer;
  15. #else
  16. class CSDKPlayer;
  17. #endif
  18. class CSDKPlayerShared
  19. {
  20. public:
  21. #ifdef CLIENT_DLL
  22. friend class C_SDKPlayer;
  23. typedef C_SDKPlayer OuterClass;
  24. DECLARE_PREDICTABLE();
  25. #else
  26. friend class CSDKPlayer;
  27. typedef CSDKPlayer OuterClass;
  28. #endif
  29. DECLARE_EMBEDDED_NETWORKVAR()
  30. DECLARE_CLASS_NOBASE( CSDKPlayerShared );
  31. CSDKPlayerShared();
  32. ~CSDKPlayerShared();
  33. #if defined ( SDK_USE_STAMINA ) || defined ( SDK_USE_SPRINTING )
  34. void SetStamina( float stamina );
  35. float GetStamina( void ) { return m_flStamina; }
  36. #endif // SDK_USE_STAMINA || SDK_USE_SPRINTING
  37. void Init( OuterClass *pOuter );
  38. bool IsSniperZoomed( void ) const;
  39. bool IsDucking( void ) const;
  40. #if defined ( SDK_USE_PLAYERCLASSES )
  41. void SetDesiredPlayerClass( int playerclass );
  42. int DesiredPlayerClass( void );
  43. void SetPlayerClass( int playerclass );
  44. int PlayerClass( void );
  45. #endif
  46. CWeaponSDKBase* GetActiveSDKWeapon() const;
  47. #if defined ( SDK_USE_PRONE )
  48. void StartGoingProne( void );
  49. void StandUpFromProne( void );
  50. bool IsProne() const;
  51. bool IsGettingUpFromProne() const;
  52. bool IsGoingProne() const;
  53. void SetProne( bool bProne, bool bNoAnimation = false );
  54. bool CanChangePosition( void );
  55. #endif
  56. bool IsJumping( void ) { return m_bJumping; }
  57. void SetJumping( bool bJumping );
  58. void ForceUnzoom( void );
  59. #ifdef SDK_USE_SPRINTING
  60. bool IsSprinting( void ) { return m_bIsSprinting; }
  61. void SetSprinting( bool bSprinting );
  62. void StartSprinting( void );
  63. void StopSprinting( void );
  64. void ResetSprintPenalty( void );
  65. #endif
  66. void ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pVecWorldMaxs );
  67. private:
  68. #if defined ( SDK_USE_PRONE )
  69. CNetworkVar( bool, m_bProne );
  70. #endif
  71. #if defined ( SDK_USE_PLAYERCLASSES )
  72. CNetworkVar( int, m_iPlayerClass );
  73. CNetworkVar( int, m_iDesiredPlayerClass );
  74. #endif
  75. #if defined ( SDK_USE_SPRINTING )
  76. CNetworkVar( bool, m_bIsSprinting );
  77. bool m_bGaveSprintPenalty;
  78. #endif
  79. #if defined ( SDK_USE_STAMINA ) || defined ( SDK_USE_SPRINTING )
  80. CNetworkVar( float, m_flStamina );
  81. #endif // SDK_USE_STAMINA || SDK_USE_SPRINTING
  82. public:
  83. #ifdef SDK_USE_PRONE
  84. float m_flNextProneCheck; // Prevent it switching their prone state constantly.
  85. CNetworkVar( float, m_flUnProneTime );
  86. CNetworkVar( float, m_flGoProneTime );
  87. CNetworkVar( bool, m_bForceProneChange );
  88. #endif
  89. bool m_bJumping;
  90. float m_flLastViewAnimationTime;
  91. //Tony; player speeds; at spawn server and client update both of these based on class (if any)
  92. float m_flRunSpeed;
  93. float m_flSprintSpeed;
  94. float m_flProneSpeed;
  95. private:
  96. OuterClass *m_pOuter;
  97. };
  98. #endif //SDK_PLAYER_SHARED_H