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.

106 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef WEAPON_IFMSTEADYCAM_H
  7. #define WEAPON_IFMSTEADYCAM_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "weapon_ifmbasecamera.h"
  12. #if defined( CLIENT_DLL )
  13. #define CWeaponIFMSteadyCam C_WeaponIFMSteadyCam
  14. #endif
  15. class CWeaponIFMSteadyCam : public CWeaponIFMBaseCamera
  16. {
  17. public:
  18. DECLARE_CLASS( CWeaponIFMSteadyCam, CWeaponIFMBaseCamera );
  19. DECLARE_NETWORKCLASS();
  20. DECLARE_PREDICTABLE();
  21. #ifdef GAME_DLL
  22. DECLARE_DATADESC();
  23. #endif
  24. public:
  25. // Shared code
  26. CWeaponIFMSteadyCam();
  27. virtual ~CWeaponIFMSteadyCam();
  28. virtual void ItemPostFrame();
  29. private:
  30. #ifdef CLIENT_DLL
  31. public:
  32. // Client code
  33. virtual void CreateMove( float flInputSampleTime, CUserCmd *pCmd, const QAngle &vecOldViewAngles );
  34. virtual void DrawCrosshair( void );
  35. virtual void GetToolRecordingState( KeyValues *msg );
  36. private:
  37. // Purpose: Draw the weapon's crosshair
  38. void DrawArmLength( int x, int y, int w, int h, Color clr );
  39. void DrawFOV( int x, int y, int w, int h, Color clrEdges, Color clrTriangle );
  40. // Transmits the lock target
  41. void TransmitLockTarget();
  42. // Updates the relative orientation of the camera
  43. void UpdateRelativeOrientation();
  44. void UpdateLockedRelativeOrientation();
  45. void UpdateDirectRelativeOrientation();
  46. // Computes a matrix given a forward direction
  47. void MatrixFromForwardDirection( const Vector &vecForward, matrix3x4_t &mat );
  48. // Targets the camera to always look at a point
  49. void LockCamera();
  50. // Toggles to springy camera
  51. void ToggleSpringCamera();
  52. void ToggleDirectMode();
  53. // Compute the location of the camera for rendering
  54. virtual void ComputeAbsCameraTransform( Vector &origin, QAngle &angles );
  55. // Updates the relative orientation of the camera, spring mode
  56. void ComputeMouseRay( const VMatrix &steadyCamToPlayer, Vector &vecForward );
  57. // Updates the 2d spring
  58. void ComputeViewOffset();
  59. bool m_bIsLocked;
  60. bool m_bInDirectMode;
  61. bool m_bInSpringMode;
  62. Vector m_vecOffset;
  63. Vector m_vec2DVelocity;
  64. Vector m_vecActualViewOffset;
  65. Vector m_vecViewOffset;
  66. float m_flFOVOffsetY;
  67. vgui::HFont m_hFont;
  68. int m_nTextureId;
  69. #endif // CLIENT_DLL
  70. #ifdef GAME_DLL
  71. public:
  72. // Server code
  73. #endif // GAME_DLL
  74. private:
  75. EHANDLE m_hLockTarget;
  76. private:
  77. CWeaponIFMSteadyCam( const CWeaponIFMSteadyCam & );
  78. };
  79. #endif // WEAPON_IFMSTEADYCAM_H