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.

67 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #if !defined( IPREDICTION_H )
  14. #define IPREDICTION_H
  15. #ifdef _WIN32
  16. #pragma once
  17. #endif
  18. #include "interface.h"
  19. #include "mathlib/vector.h" // Solely to get at define for QAngle
  20. class IMoveHelper;
  21. //-----------------------------------------------------------------------------
  22. // Purpose: Engine interface into client side prediction system
  23. //-----------------------------------------------------------------------------
  24. abstract_class IPrediction
  25. {
  26. public:
  27. virtual ~IPrediction( void ) {};
  28. virtual void Init( void ) = 0;
  29. virtual void Shutdown( void ) = 0;
  30. // Run prediction
  31. virtual void Update
  32. (
  33. int startframe, // World update ( un-modded ) most recently received
  34. bool validframe, // Is frame data valid
  35. int incoming_acknowledged, // Last command acknowledged to have been run by server (un-modded)
  36. int outgoing_command // Last command (most recent) sent to server (un-modded)
  37. ) = 0;
  38. // We are about to get a network update from the server. We know the update #, so we can pull any
  39. // data purely predicted on the client side and transfer it to the new from data state.
  40. virtual void PreEntityPacketReceived( int commands_acknowledged, int current_world_update_packet ) = 0;
  41. virtual void PostEntityPacketReceived( void ) = 0;
  42. virtual void PostNetworkDataReceived( int commands_acknowledged ) = 0;
  43. virtual void OnReceivedUncompressedPacket( void ) = 0;
  44. // The engine needs to be able to access a few predicted values
  45. virtual void GetViewOrigin( Vector& org ) = 0;
  46. virtual void SetViewOrigin( Vector& org ) = 0;
  47. virtual void GetViewAngles( QAngle& ang ) = 0;
  48. virtual void SetViewAngles( QAngle& ang ) = 0;
  49. virtual void GetLocalViewAngles( QAngle& ang ) = 0;
  50. virtual void SetLocalViewAngles( QAngle& ang ) = 0;
  51. };
  52. extern IPrediction *g_pClientSidePrediction;
  53. #define VCLIENT_PREDICTION_INTERFACE_VERSION "VClientPrediction001"
  54. #endif // IPREDICTION_H