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.

73 lines
2.3 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Used to deal with AI navigation
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //===========================================================================//
  8. #ifndef AI_LINK_H
  9. #define AI_LINK_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "ai_hull.h" // For num hulls
  14. enum Link_Info_t
  15. {
  16. bits_LINK_STALE_SUGGESTED = 0x01, // NPC found this link to be blocked
  17. bits_LINK_OFF = 0x02, // This link has been turned off
  18. bits_LINK_PRECISE_MOVEMENT = 0x04, // This link requires precise movement near it (for moving through doors for NPCs w/ sloppy movement)
  19. bits_PREFER_AVOID = 0x08, // This link has been marked as to prefer not to use it
  20. bits_LINK_ASW_BASHABLE = 0x10, // This link is marked as blocked by a door that certain NPCs can break down
  21. };
  22. // for most purposes a bashable door link is considered impassable (only special case NPCs can break them down and they
  23. // need custom behaviors)
  24. //=============================================================================
  25. // >> CAI_Link
  26. //=============================================================================
  27. class CAI_DynamicLink;
  28. #define AI_MOVE_TYPE_BITS ( bits_CAP_MOVE_GROUND | bits_CAP_MOVE_JUMP | bits_CAP_MOVE_FLY | bits_CAP_MOVE_CLIMB | bits_CAP_MOVE_SWIM | bits_CAP_MOVE_CRAWL )
  29. class CAI_Link
  30. {
  31. public:
  32. short m_iSrcID; // the node that 'owns' this link
  33. short m_iDestID; // the node on the other end of the link.
  34. inline int DestNodeID( int srcID ); // Given the source node ID, returns the destination ID
  35. byte m_iAcceptedMoveTypes[NUM_HULLS]; // Capability_T of motions acceptable for each hull type
  36. byte m_LinkInfo; // other information about this link
  37. float m_timeStaleExpires;
  38. int m_nDangerCount; // How many dangerous things are near this link?
  39. CAI_DynamicLink *m_pDynamicLink;
  40. private:
  41. friend class CAI_Network;
  42. CAI_Link(void);
  43. };
  44. //-----------------------------------------------------------------------------
  45. // Purpose: Given the source node ID, returns the destination ID
  46. // Input :
  47. // Output :
  48. //-----------------------------------------------------------------------------
  49. inline int CAI_Link::DestNodeID(int srcID)
  50. {
  51. // hardware op for ( srcID==m_iSrcID ? m_iDestID : m_iSrcID )
  52. return ieqsel( srcID, m_iSrcID, m_iDestID, m_iSrcID );
  53. }
  54. #endif // AI_LINK_H