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.

128 lines
3.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: A link that can be turned on and off. Unlike normal links
  4. // dyanimc links must be entities so they and receive messages.
  5. // They update the state of the actual links. Allows us to save
  6. // a lot of memory by not making all links into entities
  7. //
  8. // $Workfile: $
  9. // $Date: $
  10. //
  11. //-----------------------------------------------------------------------------
  12. // $Log: $
  13. //
  14. // $NoKeywords: $
  15. //=============================================================================//
  16. #ifndef AI_DYNAMICLINK_H
  17. #define AI_DYNAMICLINK_H
  18. #pragma once
  19. enum DynamicLinkState_t
  20. {
  21. LINK_OFF = 0,
  22. LINK_ON = 1,
  23. };
  24. class CAI_Link;
  25. //=============================================================================
  26. // >> CAI_DynanicLink
  27. //=============================================================================
  28. class CAI_DynamicLink : public CServerOnlyEntity
  29. {
  30. DECLARE_CLASS( CAI_DynamicLink, CServerOnlyEntity );
  31. public:
  32. static void InitDynamicLinks(void);
  33. static void ResetDynamicLinks(void);
  34. static void PurgeDynamicLinks(void);
  35. static void GenerateControllerLinks();
  36. static bool gm_bInitialized;
  37. static CAI_DynamicLink* GetDynamicLink(int nSrcID, int nDstID);
  38. static CAI_DynamicLink* m_pAllDynamicLinks; // A linked list of all dynamic link
  39. CAI_DynamicLink* m_pNextDynamicLink; // The next dynamic link in the list of dynamic links
  40. int m_nSrcEditID; // the node that 'owns' this link
  41. int m_nDestEditID; // the node on the other end of the link.
  42. int m_nSrcID; // the node that 'owns' this link
  43. int m_nDestID; // the node on the other end of the link.
  44. DynamicLinkState_t m_nLinkState; //
  45. string_t m_strAllowUse; // Only this entity name or classname may use the link
  46. bool m_bInvertAllow; // Instead of only allowing the m_strAllowUse entity, exclude only it
  47. bool m_bPreciseMovement; // Movement must be precise near here
  48. bool m_bFixedUpIds;
  49. bool m_bNotSaved;
  50. int m_nLinkType;
  51. int m_nPriority;
  52. void SetLinkState( void );
  53. bool IsLinkValid( void );
  54. CAI_Link * FindLink();
  55. int ObjectCaps();
  56. // ----------------
  57. // Inputs
  58. // ----------------
  59. void InputTurnOn( inputdata_t &inputdata );
  60. void InputTurnOff( inputdata_t &inputdata );
  61. DECLARE_DATADESC();
  62. CAI_DynamicLink();
  63. ~CAI_DynamicLink();
  64. };
  65. //=============================================================================
  66. // >> CAI_DynanicLinkVolume
  67. //=============================================================================
  68. class CAI_DynamicLinkController : public CServerOnlyEntity
  69. {
  70. DECLARE_CLASS( CAI_DynamicLinkController, CServerOnlyEntity );
  71. public:
  72. void GenerateLinksFromVolume();
  73. // ----------------
  74. // Inputs
  75. // ----------------
  76. void InputTurnOn( inputdata_t &inputdata );
  77. void InputTurnOff( inputdata_t &inputdata );
  78. void InputSetAllowed( inputdata_t &inputdata );
  79. void InputSetInvert( inputdata_t &inputdata );
  80. CUtlVector< CHandle<CAI_DynamicLink> > m_ControlledLinks;
  81. DynamicLinkState_t m_nLinkState;
  82. string_t m_strAllowUse; // Only this entity name or classname may use the link
  83. int m_nPriority;
  84. bool m_bInvertAllow; // Instead of only allowing the m_strAllowUse entity, exclude only it
  85. bool m_bUseAirLinkRadius;
  86. DECLARE_DATADESC();
  87. };
  88. //=============================================================================
  89. //=============================================================================
  90. class CAI_RadialLinkController : public CBaseEntity
  91. {
  92. DECLARE_CLASS( CAI_RadialLinkController, CBaseEntity );
  93. public:
  94. void Spawn();
  95. void Activate();
  96. void PollMotionThink();
  97. void ModifyNodeLinks( bool bMakeStale );
  98. public:
  99. float m_flRadius;
  100. Vector m_vecAtRestOrigin;
  101. bool m_bAtRest;
  102. DECLARE_DATADESC();
  103. };
  104. #endif // AI_DYNAMICLINK_H