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.

76 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "player_command.h"
  9. #include "igamemovement.h"
  10. #include "in_buttons.h"
  11. #include "ipredictionsystem.h"
  12. #include "tfc_player.h"
  13. static CMoveData g_MoveData;
  14. CMoveData *g_pMoveData = &g_MoveData;
  15. IPredictionSystem *IPredictionSystem::g_pPredictionSystems = NULL;
  16. //-----------------------------------------------------------------------------
  17. // Sets up the move data for TF2
  18. //-----------------------------------------------------------------------------
  19. class CTFCPlayerMove : public CPlayerMove
  20. {
  21. DECLARE_CLASS( CTFCPlayerMove, CPlayerMove );
  22. public:
  23. virtual void StartCommand( CBasePlayer *player, CUserCmd *cmd );
  24. virtual void SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move );
  25. virtual void FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move );
  26. };
  27. // PlayerMove Interface
  28. static CTFCPlayerMove g_PlayerMove;
  29. //-----------------------------------------------------------------------------
  30. // Singleton accessor
  31. //-----------------------------------------------------------------------------
  32. CPlayerMove *PlayerMove()
  33. {
  34. return &g_PlayerMove;
  35. }
  36. //-----------------------------------------------------------------------------
  37. // Main setup, finish
  38. //-----------------------------------------------------------------------------
  39. void CTFCPlayerMove::StartCommand( CBasePlayer *player, CUserCmd *cmd )
  40. {
  41. BaseClass::StartCommand( player, cmd );
  42. }
  43. //-----------------------------------------------------------------------------
  44. // Purpose: This is called pre player movement and copies all the data necessary
  45. // from the player for movement. (Server-side, the client-side version
  46. // of this code can be found in prediction.cpp.)
  47. //-----------------------------------------------------------------------------
  48. void CTFCPlayerMove::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move )
  49. {
  50. BaseClass::SetupMove( player, ucmd, pHelper, move );
  51. }
  52. //-----------------------------------------------------------------------------
  53. // Purpose: This is called post player movement to copy back all data that
  54. // movement could have modified and that is necessary for future
  55. // movement. (Server-side, the client-side version of this code can
  56. // be found in prediction.cpp.)
  57. //-----------------------------------------------------------------------------
  58. void CTFCPlayerMove::FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move )
  59. {
  60. // Call the default FinishMove code.
  61. BaseClass::FinishMove( player, ucmd, move );
  62. }