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.

143 lines
4.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Defines the player specific data that is sent only to the player
  4. // to whom it belongs.
  5. //
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef C_PLAYERLOCALDATA_H
  9. #define C_PLAYERLOCALDATA_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "basetypes.h"
  14. #include "mathlib/vector.h"
  15. #include "playernet_vars.h"
  16. #ifdef CLIENT_DLL
  17. #define CPostProcessController C_PostProcessController
  18. #define CColorCorrection C_ColorCorrection
  19. #endif
  20. class CPostProcessController;
  21. class CColorCorrection;
  22. //-----------------------------------------------------------------------------
  23. // Purpose: Player specific data ( sent only to local player, too )
  24. //-----------------------------------------------------------------------------
  25. class CPlayerLocalData
  26. {
  27. public:
  28. DECLARE_PREDICTABLE();
  29. DECLARE_CLASS_NOBASE( CPlayerLocalData );
  30. DECLARE_EMBEDDED_NETWORKVAR();
  31. CPlayerLocalData() :
  32. m_iv_viewPunchAngle( "CPlayerLocalData::m_iv_viewPunchAngle" ),
  33. m_iv_aimPunchAngle( "CPlayerLocalData::m_iv_aimPunchAngle" ),
  34. m_iv_aimPunchAngleVel( "CPlayerLocalData::m_iv_aimPunchAngleVel" )
  35. {
  36. memset( m_chAreaBits, 0, sizeof( m_chAreaBits ) );
  37. memset( m_chAreaPortalBits, 0, sizeof( m_chAreaPortalBits ) );
  38. m_nStepside = 0;
  39. m_nOldButtons = 0;
  40. m_flFOVRate = 0.0f;
  41. m_iHideHUD = 0;
  42. m_nDuckTimeMsecs = 0;
  43. m_nDuckJumpTimeMsecs = 0;
  44. m_nJumpTimeMsecs = 0;
  45. m_flFallVelocity = 0.0f;
  46. m_flOldFallVelocity = 0.0f;
  47. m_flStepSize = 0.0f;
  48. /* REI: How to safely init these in constructor?
  49. m_viewPunchAngle.Zero();
  50. m_aimPunchAngle.Zero();
  51. m_aimPunchAngleVel.Zero();
  52. */
  53. m_bDucked = false;
  54. m_bDucking = false;
  55. m_flLastDuckTime = -1.0f;
  56. m_bInDuckJump = false;
  57. m_bDrawViewmodel = false;
  58. m_bWearingSuit = false;
  59. m_bPoisoned = false;
  60. m_bAllowAutoMovement = true;
  61. m_bInLanding = false;
  62. m_flLandingTime = -1.0f;
  63. m_vecClientBaseVelocity.Zero();
  64. m_iv_viewPunchAngle.Setup( &m_viewPunchAngle, LATCH_SIMULATION_VAR );
  65. m_iv_aimPunchAngle.Setup( &m_aimPunchAngle, LATCH_SIMULATION_VAR );
  66. m_iv_aimPunchAngleVel.Setup( &m_aimPunchAngleVel, LATCH_SIMULATION_VAR );
  67. m_bAutoAimTarget = false;
  68. m_bSlowMovement = false;
  69. m_fTBeamEndTime = 0.0f;
  70. }
  71. unsigned char m_chAreaBits[MAX_AREA_STATE_BYTES]; // Area visibility flags.
  72. unsigned char m_chAreaPortalBits[MAX_AREA_PORTAL_STATE_BYTES];// Area portal visibility flags.
  73. // BEGIN PREDICTION DATA COMPACTION (these fields are together to allow for faster copying in prediction system)
  74. int m_nStepside;
  75. int m_nOldButtons;
  76. float m_flFOVRate; // rate at which the FOV changes
  77. int m_iHideHUD; // bitfields containing sections of the HUD to hide
  78. int m_nDuckTimeMsecs;
  79. int m_nDuckJumpTimeMsecs;
  80. int m_nJumpTimeMsecs;
  81. float m_flFallVelocity;
  82. float m_flOldFallVelocity;
  83. float m_flStepSize;
  84. CNetworkQAngle( m_viewPunchAngle ); // auto-decaying view angle adjustment
  85. CNetworkQAngle( m_aimPunchAngle ); // auto-decaying aim angle adjustment
  86. CNetworkQAngle( m_aimPunchAngleVel ); // velocity of auto-decaying aim angle adjustment
  87. bool m_bDucked; // Set exactly between FinishDuck() and FinishUnDuck(); marks that our position may have been moved by ducking
  88. bool m_bDucking; // Set if we are currently in a duck transition (that is, m_bDucked != the state of the user-pressed duck button)
  89. float m_flLastDuckTime; // last time the player pressed duck
  90. bool m_bInDuckJump;
  91. bool m_bDrawViewmodel;
  92. bool m_bWearingSuit;
  93. bool m_bPoisoned;
  94. bool m_bAllowAutoMovement;
  95. // END PREDICTION DATA COMPACTION
  96. bool m_bInLanding;
  97. float m_flLandingTime;
  98. // Base velocity that was passed in to server physics so
  99. // client can predict conveyors correctly. Server zeroes it, so we need to store here, too.
  100. Vector m_vecClientBaseVelocity;
  101. CInterpolatedVar< QAngle > m_iv_viewPunchAngle;
  102. CInterpolatedVar< QAngle > m_iv_aimPunchAngle;
  103. CInterpolatedVar< QAngle > m_iv_aimPunchAngleVel;
  104. // Autoaim
  105. bool m_bAutoAimTarget;
  106. // 3d skybox
  107. sky3dparams_t m_skybox3d;
  108. // audio environment
  109. audioparams_t m_audio;
  110. bool m_bSlowMovement;
  111. float m_fTBeamEndTime;
  112. };
  113. #endif // C_PLAYERLOCALDATA_H