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.

73 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // nav.h
  9. // Data structures and constants for the Navigation Mesh system
  10. // Author: Michael S. Booth ([email protected]), January 2003
  11. #ifndef _CS_NAV_H_
  12. #define _CS_NAV_H_
  13. #include "nav.h"
  14. /**
  15. * Below are several constants used by the navigation system.
  16. * @todo Move these into TheNavMesh singleton.
  17. */
  18. const float BotRadius = 10.0f; ///< circular extent that contains bot
  19. class CNavArea;
  20. class CSNavNode;
  21. #if 0
  22. //--------------------------------------------------------------------------------------------------------------
  23. /**
  24. * Return true if given entity can be ignored when moving
  25. */
  26. #define WALK_THRU_DOORS 0x01
  27. #define WALK_THRU_BREAKABLES 0x02
  28. #define WALK_THRU_TOGGLE_BRUSHES 0x04
  29. #define WALK_THRU_EVERYTHING (WALK_THRU_DOORS | WALK_THRU_BREAKABLES | WALK_THRU_TOGGLE_BRUSHES)
  30. inline bool IsEntityWalkable( CBaseEntity *entity, unsigned int flags )
  31. {
  32. if (FClassnameIs( entity, "worldspawn" ))
  33. return false;
  34. if (FClassnameIs( entity, "player" ))
  35. return false;
  36. // if we hit a door, assume its walkable because it will open when we touch it
  37. if (FClassnameIs( entity, "prop_door*" ) || FClassnameIs( entity, "func_door*" ))
  38. return (flags & WALK_THRU_DOORS) ? true : false;
  39. // if we hit a clip brush, ignore it if it is not BRUSHSOLID_ALWAYS
  40. if (FClassnameIs( entity, "func_brush" ))
  41. {
  42. CFuncBrush *brush = (CFuncBrush *)entity;
  43. switch ( brush->m_iSolidity )
  44. {
  45. case CFuncBrush::BRUSHSOLID_ALWAYS:
  46. return false;
  47. case CFuncBrush::BRUSHSOLID_NEVER:
  48. return true;
  49. case CFuncBrush::BRUSHSOLID_TOGGLE:
  50. return (flags & WALK_THRU_TOGGLE_BRUSHES) ? true : false;
  51. }
  52. }
  53. // if we hit a breakable object, assume its walkable because we will shoot it when we touch it
  54. if (FClassnameIs( entity, "func_breakable" ) && entity->GetHealth() && entity->m_takedamage == DAMAGE_YES)
  55. return (flags & WALK_THRU_BREAKABLES) ? true : false;
  56. if (FClassnameIs( entity, "func_breakable_surf" ) && entity->m_takedamage == DAMAGE_YES)
  57. return (flags & WALK_THRU_BREAKABLES) ? true : false;
  58. return false;
  59. }
  60. #endif
  61. #endif // _CS_NAV_H_