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.

84 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef HLTVCAMERA_H
  7. #define HLTVCAMERA_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "GameEventListener.h"
  12. class C_HLTVCamera : CGameEventListener
  13. {
  14. public:
  15. C_HLTVCamera();
  16. virtual ~C_HLTVCamera();
  17. void Init();
  18. void Reset();
  19. void CalcView(Vector& origin, QAngle& angles, float& fov);
  20. void FireGameEvent( IGameEvent *event );
  21. void SetMode(int iMode);
  22. void SetChaseCamParams( float flOffset, float flDistance, float flTheta, float flPhi );
  23. void SpecNextPlayer( bool bInverse );
  24. // See UTIL_PlayerByCommandArg for what all might go in here.
  25. void SpecPlayerByPredicate( const char *szPlayerSearch );
  26. void ToggleChaseAsFirstPerson();
  27. bool IsPVSLocked();
  28. void SetAutoDirector( bool bActive );
  29. int GetMode(); // returns current camera mode
  30. C_BaseEntity *GetPrimaryTarget(); // return primary target
  31. void SetPrimaryTarget( int nEntity); // set the primary obs target
  32. C_BaseEntity *GetCameraMan(); // return camera entity if any
  33. void CreateMove(CUserCmd *cmd);
  34. void FixupMovmentParents();
  35. void PostEntityPacketReceived();
  36. const char* GetTitleText() { return m_szTitleText; }
  37. int GetNumSpectators() { return m_nNumSpectators; }
  38. protected:
  39. void CalcChaseCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
  40. void CalcFixedView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
  41. void CalcInEyeCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
  42. void CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float& fov);
  43. void SmoothCameraAngle( QAngle& targetAngle );
  44. void SetCameraAngle( QAngle& targetAngle );
  45. void Accelerate( Vector& wishdir, float wishspeed, float accel );
  46. int m_nCameraMode; // current camera mode
  47. int m_iCameraMan; // camera man entindex or 0
  48. Vector m_vCamOrigin; //current camera origin
  49. QAngle m_aCamAngle; //current camera angle
  50. int m_iTraget1; // first tracked target or 0
  51. int m_iTraget2; // second tracked target or 0
  52. float m_flFOV; // current FOV
  53. float m_flOffset; // z-offset from target origin
  54. float m_flDistance; // distance to traget origin+offset
  55. float m_flLastDistance; // too smooth distance
  56. float m_flTheta; // view angle horizontal
  57. float m_flPhi; // view angle vertical
  58. float m_flInertia; // camera inertia 0..100
  59. float m_flLastAngleUpdateTime;
  60. bool m_bEntityPacketReceived; // true after a new packet was received
  61. int m_nNumSpectators;
  62. char m_szTitleText[64];
  63. CUserCmd m_LastCmd;
  64. Vector m_vecVelocity;
  65. };
  66. extern C_HLTVCamera *HLTVCamera(); // get Singleton
  67. #endif // HLTVCAMERA_H