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.

125 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Base combat character with no AI
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #ifndef HL1TALKNPC_H
  10. #define HL1TALKNPC_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "soundflags.h"
  15. #include "ai_task.h"
  16. #include "ai_schedule.h"
  17. #include "ai_default.h"
  18. #include "ai_speech.h"
  19. #include "ai_basenpc.h"
  20. #include "ai_behavior.h"
  21. #include "ai_behavior_follow.h"
  22. #include "npc_talker.h"
  23. #define SF_NPC_PREDISASTER ( 1 << 16 ) // This is a predisaster scientist or barney. Influences how they speak.
  24. //=========================================================
  25. // Talking NPC base class
  26. // Used for scientists and barneys
  27. //=========================================================
  28. //=============================================================================
  29. // >> CHL1NPCTalker
  30. //=============================================================================
  31. class CHL1NPCTalker : public CNPCSimpleTalker
  32. {
  33. DECLARE_CLASS( CHL1NPCTalker, CNPCSimpleTalker );
  34. public:
  35. CHL1NPCTalker( void )
  36. {
  37. }
  38. virtual void Precache();
  39. void StartTask( const Task_t *pTask );
  40. void RunTask( const Task_t *pTask );
  41. int SelectSchedule ( void );
  42. bool HandleInteraction(int interactionType, void *data, CBaseCombatCharacter* sourceEnt);
  43. bool ShouldGib( const CTakeDamageInfo &info );
  44. int TranslateSchedule( int scheduleType );
  45. void IdleHeadTurn( CBaseEntity *pTarget, float flDuration = 0.0, float flImportance = 1.0f );
  46. void SetHeadDirection( const Vector &vTargetPos, float flInterval);
  47. bool CorpseGib( const CTakeDamageInfo &info );
  48. Disposition_t IRelationType( CBaseEntity *pTarget );
  49. void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator );
  50. void StartFollowing( CBaseEntity *pLeader );
  51. void StopFollowing( void );
  52. int PlayScriptedSentence( const char *pszSentence, float delay, float volume, soundlevel_t soundlevel, bool bConcurrent, CBaseEntity *pListener );
  53. void Touch( CBaseEntity *pOther );
  54. float PickLookTarget( bool bExcludePlayers = false, float minTime = 1.5, float maxTime = 2.5 );
  55. bool OnObstructingDoor( AILocalMoveGoal_t *pMoveGoal, CBaseDoor *pDoor, float distClear, AIMoveResult_t *pResult );
  56. // Hacks! HL2 has a system for avoiding the player, we don't
  57. // This ensures that we fall back to the real player avoidance
  58. // Essentially does the opposite of what it says
  59. virtual bool ShouldPlayerAvoid( void ) { return false; }
  60. bool IsValidSpeechTarget( int flags, CBaseEntity *pEntity );
  61. protected:
  62. virtual void FollowerUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
  63. int FIdleSpeak ( void );
  64. private:
  65. virtual void DeclineFollowing( void ) {}
  66. virtual int SelectDeadSchedule( void );
  67. public:
  68. bool m_bInBarnacleMouth;
  69. enum
  70. {
  71. SCHED_HL1TALKER_FOLLOW_MOVE_AWAY = BaseClass::NEXT_SCHEDULE,
  72. SCHED_HL1TALKER_IDLE_SPEAK_WAIT,
  73. SCHED_HL1TALKER_BARNACLE_HIT,
  74. SCHED_HL1TALKER_BARNACLE_PULL,
  75. SCHED_HL1TALKER_BARNACLE_CHOMP,
  76. SCHED_HL1TALKER_BARNACLE_CHEW,
  77. NEXT_SCHEDULE,
  78. };
  79. enum
  80. {
  81. TASK_HL1TALKER_FOLLOW_WALK_PATH_FOR_UNITS = BaseClass::NEXT_TASK,
  82. NEXT_TASK,
  83. };
  84. DECLARE_DATADESC();
  85. DEFINE_CUSTOM_AI;
  86. };
  87. #endif //HL1TALKNPC_H