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.

96 lines
3.4 KiB

  1. // NextBotContextualQueryInterface.h
  2. // Queries within the context of the bot's current behavior state
  3. // Author: Michael Booth, June 2007
  4. // Copyright (c) 2007 Turtle Rock Studios, Inc. - All Rights Reserved
  5. #ifndef _NEXT_BOT_CONTEXTUAL_QUERY_H_
  6. #define _NEXT_BOT_CONTEXTUAL_QUERY_H_
  7. class INextBot;
  8. class CBaseEntity;
  9. class CBaseCombatCharacter;
  10. class Path;
  11. class CKnownEntity;
  12. /**
  13. * Since behaviors can have several concurrent actions active, we ask
  14. * the topmost child action first, and if it defers, its parent, and so
  15. * on, until we get a definitive answer.
  16. */
  17. enum QueryResultType
  18. {
  19. ANSWER_NO,
  20. ANSWER_YES,
  21. ANSWER_UNDEFINED
  22. };
  23. // Can pass this into IContextualQuery::IsHindrance to see if any hindrance is ever possible
  24. #define IS_ANY_HINDRANCE_POSSIBLE ( (CBaseEntity*)0xFFFFFFFF )
  25. //----------------------------------------------------------------------------------------------------------------
  26. /**
  27. * The interface for queries that are dependent on the bot's current behavior state
  28. */
  29. class IContextualQuery
  30. {
  31. public:
  32. virtual ~IContextualQuery() { }
  33. virtual QueryResultType ShouldPickUp( const INextBot *me, CBaseEntity *item ) const; // if the desired item was available right now, should we pick it up?
  34. virtual QueryResultType ShouldHurry( const INextBot *me ) const; // are we in a hurry?
  35. virtual QueryResultType ShouldRetreat( const INextBot *me ) const; // is it time to retreat?
  36. virtual QueryResultType IsHindrance( const INextBot *me, CBaseEntity *blocker ) const; // return true if we should wait for 'blocker' that is across our path somewhere up ahead.
  37. virtual Vector SelectTargetPoint( const INextBot *me, const CBaseCombatCharacter *subject ) const; // given a subject, return the world space position we should aim at
  38. /**
  39. * Allow bot to approve of positions game movement tries to put him into.
  40. * This is most useful for bots derived from CBasePlayer that go through
  41. * the player movement system.
  42. */
  43. virtual QueryResultType IsPositionAllowed( const INextBot *me, const Vector &pos ) const;
  44. virtual const CKnownEntity * SelectMoreDangerousThreat( const INextBot *me,
  45. const CBaseCombatCharacter *subject,
  46. const CKnownEntity *threat1,
  47. const CKnownEntity *threat2 ) const; // return the more dangerous of the two threats to 'subject', or NULL if we have no opinion
  48. };
  49. inline QueryResultType IContextualQuery::ShouldPickUp( const INextBot *me, CBaseEntity *item ) const
  50. {
  51. return ANSWER_UNDEFINED;
  52. }
  53. inline QueryResultType IContextualQuery::ShouldHurry( const INextBot *me ) const
  54. {
  55. return ANSWER_UNDEFINED;
  56. }
  57. inline QueryResultType IContextualQuery::ShouldRetreat( const INextBot *me ) const
  58. {
  59. return ANSWER_UNDEFINED;
  60. }
  61. inline QueryResultType IContextualQuery::IsHindrance( const INextBot *me, CBaseEntity *blocker ) const
  62. {
  63. return ANSWER_UNDEFINED;
  64. }
  65. inline Vector IContextualQuery::SelectTargetPoint( const INextBot *me, const CBaseCombatCharacter *subject ) const
  66. {
  67. return vec3_origin;
  68. }
  69. inline QueryResultType IContextualQuery::IsPositionAllowed( const INextBot *me, const Vector &pos ) const
  70. {
  71. return ANSWER_UNDEFINED;
  72. }
  73. inline const CKnownEntity *IContextualQuery::SelectMoreDangerousThreat( const INextBot *me, const CBaseCombatCharacter *subject, const CKnownEntity *threat1, const CKnownEntity *threat2 ) const
  74. {
  75. return NULL;
  76. }
  77. #endif // _NEXT_BOT_CONTEXTUAL_QUERY_H_