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.

82 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef TF_PLAYERANIMSTATE_H
  7. #define TF_PLAYERANIMSTATE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "convar.h"
  12. #include "iplayeranimstate.h"
  13. #include "base_playeranimstate.h"
  14. #ifdef CLIENT_DLL
  15. class C_BaseAnimatingOverlay;
  16. class C_WeaponCSBase;
  17. // Avoid redef warnings
  18. #undef CBaseAnimatingOverlay
  19. #define CBaseAnimatingOverlay C_BaseAnimatingOverlay
  20. #define CWeaponCSBase C_WeaponCSBase
  21. #define CCSPlayer C_CSPlayer
  22. #else
  23. class CBaseAnimatingOverlay;
  24. class CWeaponCSBase;
  25. class CCSPlayer;
  26. #endif
  27. // When moving this fast, he plays run anim.
  28. #define ARBITRARY_RUN_SPEED 175.0f
  29. enum PlayerAnimEvent_t
  30. {
  31. PLAYERANIMEVENT_FIRE_GUN_PRIMARY=0,
  32. PLAYERANIMEVENT_FIRE_GUN_SECONDARY,
  33. PLAYERANIMEVENT_THROW_GRENADE,
  34. PLAYERANIMEVENT_JUMP,
  35. PLAYERANIMEVENT_RELOAD,
  36. PLAYERANIMEVENT_RELOAD_START, ///< w_model partial reload for shotguns
  37. PLAYERANIMEVENT_RELOAD_LOOP, ///< w_model partial reload for shotguns
  38. PLAYERANIMEVENT_RELOAD_END, ///< w_model partial reload for shotguns
  39. PLAYERANIMEVENT_CLEAR_FIRING, ///< clear animations on the firing layer
  40. PLAYERANIMEVENT_COUNT
  41. };
  42. class ICSPlayerAnimState : virtual public IPlayerAnimState
  43. {
  44. public:
  45. // This is called by both the client and the server in the same way to trigger events for
  46. // players firing, jumping, throwing grenades, etc.
  47. virtual void DoAnimationEvent( PlayerAnimEvent_t event, int nData = 0 ) = 0;
  48. // Returns true if we're playing the grenade prime or throw animation.
  49. virtual bool IsThrowingGrenade() = 0;
  50. };
  51. // This abstracts the differences between CS players and hostages.
  52. class ICSPlayerAnimStateHelpers
  53. {
  54. public:
  55. virtual CWeaponCSBase* CSAnim_GetActiveWeapon() = 0;
  56. virtual bool CSAnim_CanMove() = 0;
  57. };
  58. ICSPlayerAnimState* CreatePlayerAnimState( CBaseAnimatingOverlay *pEntity, ICSPlayerAnimStateHelpers *pHelpers, LegAnimType_t legAnimType, bool bUseAimSequences );
  59. ICSPlayerAnimState* CreateHostageAnimState( CBaseAnimatingOverlay *pEntity, ICSPlayerAnimStateHelpers *pHelpers, LegAnimType_t legAnimType, bool bUseAimSequences );
  60. // If this is set, then the game code needs to make sure to send player animation events
  61. // to the local player if he's the one being watched.
  62. extern ConVar cl_showanimstate;
  63. #endif // TF_PLAYERANIMSTATE_H