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.

83 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef AI_SPOTLIGHT_H
  7. #define AI_SPOTLIGHT_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "ai_component.h"
  12. class CBeam;
  13. class CSprite;
  14. class SmokeTrail;
  15. class CSpotlightEnd;
  16. //-----------------------------------------------------------------------------
  17. // Parameters for how the scanner relates to citizens.
  18. //-----------------------------------------------------------------------------
  19. enum
  20. {
  21. AI_SPOTLIGHT_NO_DLIGHTS = 0x1,
  22. };
  23. class CAI_Spotlight : public CAI_Component
  24. {
  25. DECLARE_SIMPLE_DATADESC();
  26. DECLARE_CLASS_NOBASE( CAI_Spotlight );
  27. public:
  28. CAI_Spotlight();
  29. ~CAI_Spotlight();
  30. void Init( CAI_BaseNPC *pOuter, int nFlags, float flConstraintAngle, float flMaxLength );
  31. // Create, destroy the spotlight
  32. void SpotlightCreate( int nAttachment, const Vector &vecInitialDir );
  33. void SpotlightDestroy(void);
  34. // Controls the spotlight target position + direction
  35. void SetSpotlightTargetPos( const Vector &vSpotlightTargetPos );
  36. void SetSpotlightTargetDirection( const Vector &vSpotlightTargetDir );
  37. // Updates the spotlight. Call every frame!
  38. void Update(void);
  39. private:
  40. void Precache(void);
  41. void CreateSpotlightEntities( void );
  42. void UpdateSpotlightDirection( void );
  43. void UpdateSpotlightEndpoint( void );
  44. // Constrain to cone, returns true if it was constrained
  45. bool ConstrainToCone( Vector *pDirection );
  46. // Computes the spotlight endpoint
  47. void ComputeEndpoint( const Vector &vecStartPoint, Vector *pEndPoint );
  48. private:
  49. CHandle<CBeam> m_hSpotlight;
  50. CHandle<CSpotlightEnd> m_hSpotlightTarget;
  51. Vector m_vSpotlightTargetPos;
  52. Vector m_vSpotlightDir;
  53. float m_flSpotlightCurLength;
  54. float m_flSpotlightMaxLength;
  55. float m_flConstraintAngle;
  56. int m_nHaloSprite;
  57. int m_nSpotlightAttachment;
  58. int m_nFlags;
  59. Quaternion m_vAngularVelocity;
  60. };
  61. #endif // AI_SPOTLIGHT_H