Counter Strike : Global Offensive Source Code
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.

117 lines
3.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef PORTAL_PLAYERANIMSTATE_H
  7. #define PORTAL_PLAYERANIMSTATE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "convar.h"
  12. #include "multiplayer_animstate.h"
  13. #if defined( CLIENT_DLL )
  14. class C_Portal_Player;
  15. #define CPortal_Player C_Portal_Player
  16. #else
  17. class CPortal_Player;
  18. #endif
  19. //enum PlayerAnimEvent_t
  20. //{
  21. // PLAYERANIMEVENT_FIRE_GUN=0,
  22. // PLAYERANIMEVENT_THROW_GRENADE,
  23. // PLAYERANIMEVENT_ROLL_GRENADE,
  24. // PLAYERANIMEVENT_JUMP,
  25. // PLAYERANIMEVENT_RELOAD,
  26. // PLAYERANIMEVENT_SECONDARY_ATTACK,
  27. //
  28. // PLAYERANIMEVENT_HS_NONE,
  29. // PLAYERANIMEVENT_CANCEL_GESTURES, // cancel current gesture
  30. //
  31. // PLAYERANIMEVENT_COUNT
  32. //};
  33. enum PlayerAnimDamageStage_t
  34. {
  35. DAMAGE_STAGE_NONE = 0,
  36. DAMAGE_STAGE_FINAL = 3
  37. };
  38. // ------------------------------------------------------------------------------------------------ //
  39. // CPlayerAnimState declaration.
  40. // ------------------------------------------------------------------------------------------------ //
  41. class CPortalPlayerAnimState : public CMultiPlayerAnimState
  42. {
  43. public:
  44. DECLARE_CLASS( CPortalPlayerAnimState, CMultiPlayerAnimState );
  45. CPortalPlayerAnimState();
  46. CPortalPlayerAnimState( CBasePlayer *pPlayer, MultiPlayerMovementData_t &movementData );
  47. ~CPortalPlayerAnimState();
  48. void InitPortal( CPortal_Player *pPlayer );
  49. CPortal_Player *GetPortalPlayer( void ) const { return m_pPortalPlayer; }
  50. virtual void ClearAnimationState();
  51. virtual Activity TranslateActivity( Activity actDesired );
  52. virtual bool SetupPoseParameters( CStudioHdr *pStudioHdr );
  53. virtual void DoAnimationEvent( PlayerAnimEvent_t event, int nData = 0 );
  54. virtual void Update( float eyeYaw, float eyePitch );
  55. virtual Activity CalcMainActivity();
  56. void Teleport( const Vector *pNewOrigin, const QAngle *pNewAngles, CPortal_Player* pPlayer );
  57. void TransformYAWs( const matrix3x4_t &matTransform );
  58. virtual bool ShouldLongFall( void ) const;
  59. virtual bool HandleMoving( Activity &idealActivity );
  60. virtual bool HandleJumping( Activity &idealActivity );
  61. virtual bool HandleDucking( Activity &idealActivity );
  62. virtual bool HandleDying( Activity &idealActivity );
  63. void BridgeRemovedFromUnder( void ) { m_bBridgeRemovedFromUnder = true; }
  64. float m_fNextBouncePredictTime;
  65. float m_fPrevBouncePredict;
  66. private:
  67. bool HandleInAir( Activity &idealActivity );
  68. bool HandleBouncing( Activity &idealActivity );
  69. bool HandleTractorBeam( Activity &idealActivity );
  70. bool HandleLanding();
  71. void IncreaseDamageStage();
  72. CPortal_Player *m_pPortalPlayer;
  73. bool m_bInAirWalk;
  74. bool m_bLanding;
  75. Vector m_vLastVelocity;
  76. float m_flHoldDeployedPoseUntilTime;
  77. unsigned int m_nDamageStage;
  78. // tractor beam
  79. bool m_bWasInTractorBeam;
  80. bool m_bFirstTractorBeamFrame;
  81. bool m_bBridgeRemovedFromUnder;
  82. };
  83. CPortalPlayerAnimState* CreatePortalPlayerAnimState( CPortal_Player *pPlayer );
  84. // If this is set, then the game code needs to make sure to send player animation events
  85. // to the local player if he's the one being watched.
  86. extern ConVar cl_showanimstate;
  87. #endif // PORTAL_PLAYERANIMSTATE_H