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.

118 lines
3.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef IMOVEHELPER_H
  8. #define IMOVEHELPER_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //-----------------------------------------------------------------------------
  13. // Forward declarations
  14. //-----------------------------------------------------------------------------
  15. enum PLAYER_ANIM;
  16. class IPhysicsSurfaceProps;
  17. class Vector;
  18. struct model_t;
  19. struct cmodel_t;
  20. struct vcollide_t;
  21. class CGameTrace;
  22. enum soundlevel_t;
  23. //-----------------------------------------------------------------------------
  24. // Purpose: Identifies how submerged in water a player is.
  25. //-----------------------------------------------------------------------------
  26. enum
  27. {
  28. WL_NotInWater=0,
  29. WL_Feet,
  30. WL_Waist,
  31. WL_Eyes
  32. };
  33. //-----------------------------------------------------------------------------
  34. // An entity identifier that works in both game + client dlls
  35. //-----------------------------------------------------------------------------
  36. typedef CBaseHandle EntityHandle_t;
  37. #define INVALID_ENTITY_HANDLE INVALID_EHANDLE
  38. //-----------------------------------------------------------------------------
  39. // Functions the engine provides to IGameMovement to assist in its movement.
  40. //-----------------------------------------------------------------------------
  41. abstract_class IMoveHelper
  42. {
  43. public:
  44. // Call this to set the singleton
  45. static IMoveHelper* GetSingleton( ) { return sm_pSingleton; }
  46. // Methods associated with a particular entity
  47. virtual char const* GetName( EntityHandle_t handle ) const = 0;
  48. // sets the entity being moved
  49. virtual void SetHost( CBaseEntity *host ) = 0;
  50. // Adds the trace result to touch list, if contact is not already in list.
  51. virtual void ResetTouchList( void ) = 0;
  52. virtual bool AddToTouched( const CGameTrace& tr, const Vector& impactvelocity ) = 0;
  53. virtual void ProcessImpacts( void ) = 0;
  54. // Numbered line printf
  55. virtual void Con_NPrintf( int idx, PRINTF_FORMAT_STRING char const* fmt, ... ) = 0;
  56. // These have separate server vs client impementations
  57. virtual void StartSound( const Vector& origin, int channel, char const* sample, float volume, soundlevel_t soundlevel, int fFlags, int pitch ) = 0;
  58. virtual void StartSound( const Vector& origin, const char *soundname ) = 0;
  59. virtual void PlaybackEventFull( int flags, int clientindex, unsigned short eventindex, float delay, Vector& origin, Vector& angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ) = 0;
  60. // Apply falling damage to m_pHostPlayer based on m_pHostPlayer->m_flFallVelocity.
  61. virtual bool PlayerFallingDamage( void ) = 0;
  62. // Apply falling damage to m_pHostPlayer based on m_pHostPlayer->m_flFallVelocity.
  63. virtual void PlayerSetAnimation( PLAYER_ANIM playerAnim ) = 0;
  64. virtual IPhysicsSurfaceProps *GetSurfaceProps( void ) = 0;
  65. virtual bool IsWorldEntity( const CBaseHandle &handle ) = 0;
  66. protected:
  67. // Inherited classes can call this to set the singleton
  68. static void SetSingleton( IMoveHelper* pMoveHelper ) { sm_pSingleton = pMoveHelper; }
  69. // Clients shouldn't call delete directly
  70. virtual ~IMoveHelper() {}
  71. // The global instance
  72. static IMoveHelper* sm_pSingleton;
  73. };
  74. //-----------------------------------------------------------------------------
  75. // Add this to the CPP file that implements the IMoveHelper
  76. //-----------------------------------------------------------------------------
  77. #define IMPLEMENT_MOVEHELPER() \
  78. IMoveHelper* IMoveHelper::sm_pSingleton = 0
  79. //-----------------------------------------------------------------------------
  80. // Call this to set the singleton
  81. //-----------------------------------------------------------------------------
  82. inline IMoveHelper* MoveHelper( )
  83. {
  84. return IMoveHelper::GetSingleton();
  85. }
  86. #endif // IMOVEHELPER_H