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.

64 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef PLAYER_COMMAND_H
  8. #define PLAYER_COMMAND_H
  9. #pragma once
  10. #include "edict.h"
  11. #include "usercmd.h"
  12. class IMoveHelper;
  13. class CMoveData;
  14. class CBasePlayer;
  15. //-----------------------------------------------------------------------------
  16. // Purpose: Server side player movement
  17. //-----------------------------------------------------------------------------
  18. class CPlayerMove
  19. {
  20. public:
  21. DECLARE_CLASS_NOBASE( CPlayerMove );
  22. // Construction/destruction
  23. CPlayerMove( void );
  24. virtual ~CPlayerMove( void ) {}
  25. // Public interfaces:
  26. // Run a movement command from the player
  27. void RunCommand ( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *moveHelper );
  28. protected:
  29. // Prepare for running movement
  30. virtual void SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move );
  31. // Finish movement
  32. virtual void FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move );
  33. // Called before and after any movement processing
  34. virtual void StartCommand( CBasePlayer *player, CUserCmd *cmd );
  35. void FinishCommand( CBasePlayer *player );
  36. // Helper to determine if the user is standing on ground
  37. void CheckMovingGround( CBasePlayer *player, double frametime );
  38. // Helpers to call pre and post think for player, and to call think if a think function is set
  39. void RunPreThink( CBasePlayer *player );
  40. void RunThink (CBasePlayer *ent, double frametime );
  41. void RunPostThink( CBasePlayer *player );
  42. };
  43. //-----------------------------------------------------------------------------
  44. // Singleton accessor
  45. //-----------------------------------------------------------------------------
  46. CPlayerMove *PlayerMove();
  47. #endif // PLAYER_COMMAND_H