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.

85 lines
2.0 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef PREDICTED_VIEWMODEL_H
  8. #define PREDICTED_VIEWMODEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "predictable_entity.h"
  13. #include "utlvector.h"
  14. #include "baseplayer_shared.h"
  15. #include "shared_classnames.h"
  16. #if defined( CSTRIKE15 )
  17. #include "weapon_csbase.h"
  18. #ifdef CLIENT_DLL
  19. #include "c_cs_player.h"
  20. #endif
  21. #endif
  22. #if defined( CLIENT_DLL )
  23. #define CPredictedViewModel C_PredictedViewModel
  24. #endif
  25. class CPredictedViewModel : public CBaseViewModel
  26. {
  27. DECLARE_CLASS( CPredictedViewModel, CBaseViewModel );
  28. public:
  29. DECLARE_NETWORKCLASS();
  30. CPredictedViewModel( void );
  31. virtual ~CPredictedViewModel( void );
  32. virtual void CalcViewModelLag( Vector& origin, QAngle& angles, QAngle& original_angles );
  33. virtual void AddViewModelBob( CBasePlayer *owner, Vector& eyePosition, QAngle& eyeAngles );
  34. virtual void ApplyViewModelPitchAndDip( CBasePlayer *owner, Vector& origin, QAngle& angles );
  35. #if defined( CSTRIKE15 )
  36. virtual void CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles );
  37. #if defined( CLIENT_DLL )
  38. BobState_t &GetBobState() { return m_BobState; }
  39. #endif //CLIENT_DLL
  40. #endif //CSTRIKE15
  41. #if defined( CLIENT_DLL )
  42. virtual bool ShouldPredict( void )
  43. {
  44. if ( C_BasePlayer::IsLocalPlayer( GetOwner() ) )
  45. return true;
  46. return BaseClass::ShouldPredict();
  47. }
  48. #endif
  49. private:
  50. #if defined( CLIENT_DLL )
  51. // This is used to lag the angles.
  52. CInterpolatedVar<QAngle> m_LagAnglesHistory;
  53. QAngle m_vLagAngles;
  54. Vector m_vPredictedOffset;
  55. CPredictedViewModel( const CPredictedViewModel & ); // not defined, not accessible
  56. #if defined( CSTRIKE15 )
  57. protected:
  58. BobState_t m_BobState; // view model head bob state
  59. QAngle m_vLoweredWeaponOffset;
  60. float m_flInaccuracyTilt;
  61. float m_flOldAccuracyDiffSmoothed;
  62. #endif //CSTRIKE15
  63. #endif
  64. };
  65. #endif // PREDICTED_VIEWMODEL_H