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.

97 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #ifndef HL2MP_PLAYER_SHARED_H
  9. #define HL2MP_PLAYER_SHARED_H
  10. #pragma once
  11. #define HL2MP_PUSHAWAY_THINK_INTERVAL (1.0f / 20.0f)
  12. #include "studio.h"
  13. enum
  14. {
  15. PLAYER_SOUNDS_CITIZEN = 0,
  16. PLAYER_SOUNDS_COMBINESOLDIER,
  17. PLAYER_SOUNDS_METROPOLICE,
  18. PLAYER_SOUNDS_MAX,
  19. };
  20. enum HL2MPPlayerState
  21. {
  22. // Happily running around in the game.
  23. STATE_ACTIVE=0,
  24. STATE_OBSERVER_MODE, // Noclipping around, watching players, etc.
  25. NUM_PLAYER_STATES
  26. };
  27. #if defined( CLIENT_DLL )
  28. #define CHL2MP_Player C_HL2MP_Player
  29. #endif
  30. class CPlayerAnimState
  31. {
  32. public:
  33. enum
  34. {
  35. TURN_NONE = 0,
  36. TURN_LEFT,
  37. TURN_RIGHT
  38. };
  39. CPlayerAnimState( CHL2MP_Player *outer );
  40. Activity BodyYawTranslateActivity( Activity activity );
  41. void Update();
  42. const QAngle& GetRenderAngles();
  43. void GetPoseParameters( CStudioHdr *pStudioHdr, float poseParameter[MAXSTUDIOPOSEPARAM] );
  44. CHL2MP_Player *GetOuter();
  45. private:
  46. void GetOuterAbsVelocity( Vector& vel );
  47. int ConvergeAngles( float goal,float maxrate, float dt, float& current );
  48. void EstimateYaw( void );
  49. void ComputePoseParam_BodyYaw( void );
  50. void ComputePoseParam_BodyPitch( CStudioHdr *pStudioHdr );
  51. void ComputePoseParam_BodyLookYaw( void );
  52. void ComputePlaybackRate();
  53. CHL2MP_Player *m_pOuter;
  54. float m_flGaitYaw;
  55. float m_flStoredCycle;
  56. // The following variables are used for tweaking the yaw of the upper body when standing still and
  57. // making sure that it smoothly blends in and out once the player starts moving
  58. // Direction feet were facing when we stopped moving
  59. float m_flGoalFeetYaw;
  60. float m_flCurrentFeetYaw;
  61. float m_flCurrentTorsoYaw;
  62. // To check if they are rotating in place
  63. float m_flLastYaw;
  64. // Time when we stopped moving
  65. float m_flLastTurnTime;
  66. // One of the above enums
  67. int m_nTurningInPlace;
  68. QAngle m_angRender;
  69. float m_flTurnCorrectionTime;
  70. };
  71. #endif //HL2MP_PLAYER_SHARED_h