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.

71 lines
1.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // nav_entities.h
  9. // Navigation entities
  10. // Author: Michael S. Booth ([email protected]), January 2003
  11. #ifndef NAV_ENTITIES_H
  12. #define NAV_ENTITIES_H
  13. //-----------------------------------------------------------------------------------------------------
  14. /**
  15. * An entity that can block/unblock nav areas. This is meant for semi-transient areas that block
  16. * pathfinding but can be ignored for longer-term queries like computing L4D flow distances and
  17. * escape routes.
  18. */
  19. class CFuncNavBlocker : public CBaseEntity
  20. {
  21. DECLARE_DATADESC();
  22. DECLARE_CLASS( CFuncNavBlocker, CBaseEntity );
  23. public:
  24. void Spawn();
  25. virtual void UpdateOnRemove( void );
  26. void InputBlockNav( inputdata_t &inputdata );
  27. void InputUnblockNav( inputdata_t &inputdata );
  28. inline bool IsBlockingNav( int teamNumber ) const
  29. {
  30. if ( teamNumber == TEAM_ANY )
  31. {
  32. bool isBlocked = false;
  33. for ( int i=0; i<MAX_NAV_TEAMS; ++i )
  34. {
  35. isBlocked |= m_isBlockingNav[ i ];
  36. }
  37. return isBlocked;
  38. }
  39. teamNumber = teamNumber % MAX_NAV_TEAMS;
  40. return m_isBlockingNav[ teamNumber ];
  41. }
  42. int DrawDebugTextOverlays( void );
  43. bool operator()( CNavArea *area ); // functor that blocks areas in our extent
  44. static bool CalculateBlocked( bool *pResultByTeam, const Vector &vecMins, const Vector &vecMaxs );
  45. private:
  46. void UpdateBlocked();
  47. static CUtlLinkedList<CFuncNavBlocker *> gm_NavBlockers;
  48. void BlockNav( void );
  49. void UnblockNav( void );
  50. bool m_isBlockingNav[MAX_NAV_TEAMS];
  51. int m_blockedTeamNumber;
  52. bool m_bDisabled;
  53. Vector m_CachedMins, m_CachedMaxs;
  54. };
  55. #endif // NAV_ENTITIES_H