BVB Source Codes

CRYENGINE Show TargetTrackCommon.h Source code

Return Download CRYENGINE: download TargetTrackCommon.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.    Description: Defines common helpers for the Target Track system
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 02:01:2010: Created by Kevin Kirst
  12.  
  13. *************************************************************************/
  14.  
  15. #ifndef __TARGET_TRACK_COMMON_H__
  16. #define __TARGET_TRACK_COMMON_H__
  17.  
  18. // Define if target track should determine the AI threat level for you
  19. #define TARGET_TRACK_DOTARGETTHREAT
  20.  
  21. // Define if target track should determine the AI target type for you
  22. #define TARGET_TRACK_DOTARGETTYPE
  23.  
  24. #ifdef CRYAISYSTEM_DEBUG
  25.         #define TARGET_TRACK_DEBUG
  26. #endif
  27.  
  28. #include <CryAISystem/ITargetTrackManager.h>
  29.  
  30. class CTargetTrack;
  31. struct ITargetTrackModifier;
  32.  
  33. namespace TargetTrackHelpers
  34. {
  35. // Desired target selection methods
  36. enum EDesiredTargetMethod
  37. {
  38.         // Selection types
  39.         eDTM_Select_Highest = 0x01,
  40.         eDTM_Select_Lowest  = 0x02,
  41.         eDTM_SELECTION_MASK = 0x0F,
  42.  
  43.         // Selection filters
  44.         eDTM_Filter_LimitDesired    = 0x10,   // Try not to select dead targets if possible
  45.         eDTM_Filter_LimitPotential  = 0x20,   // Check the target limits and obey if possible
  46.         eDTM_Filter_CanAquireTarget = 0x40,   // Check the result of the CanAcquireTarget helper
  47.         eDTM_FILTER_MASK            = 0xF0,
  48.  
  49.         eDTM_COUNT,
  50. };
  51.  
  52. // Information related to an envelope
  53. struct SEnvelopeData
  54. {
  55.         float m_fCurrentValue;
  56.         float m_fStartTime;
  57.         float m_fLastInvokeTime;
  58.         float m_fLastRunningValue;
  59.         float m_fLastReleasingValue;
  60.         bool  m_bReinvoked;
  61.  
  62.         SEnvelopeData();
  63. };
  64.  
  65. // Describes an incoming stimulus to be handled
  66. struct STargetTrackStimulusEvent
  67. {
  68.         string               m_sStimulusName;
  69.         Vec3                 m_vTargetPos;
  70.         tAIObjectID          m_ownerId;
  71.         tAIObjectID          m_targetId;
  72.         EAITargetThreat      m_eTargetThreat;
  73.         EAIEventStimulusType m_eStimulusType;
  74.  
  75.         STargetTrackStimulusEvent(tAIObjectID ownerId);
  76.         STargetTrackStimulusEvent(tAIObjectID ownerId, tAIObjectID targetId, const char* szStimulusName, const SStimulusEvent& eventInfo);
  77. };
  78.  
  79. // Describes a registered pulse for a stimulus configuration
  80. struct STargetTrackPulseConfig
  81. {
  82.         string m_sPulse;
  83.         float  m_fValue;
  84.         float  m_fDuration;
  85.         bool   m_bInherited;
  86.  
  87.         STargetTrackPulseConfig();
  88.         STargetTrackPulseConfig(const char* szPulse, float fValue, float fDuration);
  89.         STargetTrackPulseConfig(const STargetTrackPulseConfig& other, bool bInherited = false);
  90. };
  91.  
  92. // Describes a registered modifier for a stimulus configuration
  93. struct STargetTrackModifierConfig
  94. {
  95.         uint32 m_uId;
  96.         float  m_fValue;
  97.         float  m_fLimit;
  98.         bool   m_bInherited;
  99.  
  100.         STargetTrackModifierConfig();
  101.         STargetTrackModifierConfig(uint32 uId, float fValue, float fLimit);
  102.         STargetTrackModifierConfig(const STargetTrackModifierConfig& other, bool bInherited = false);
  103. };
  104.  
  105. // Describes a registered stimulus for a configuration
  106. struct STargetTrackStimulusConfig
  107. {
  108.         // ADSR values not used should be marked with this
  109.         static const float INVALID_VALUE;
  110.  
  111.         typedef VectorMap<uint32, STargetTrackPulseConfig> TPulseContainer;
  112.         TPulseContainer m_pulses;
  113.  
  114.         typedef VectorMap<uint32, STargetTrackModifierConfig> TModifierContainer;
  115.         TModifierContainer m_modifiers;
  116.  
  117.         typedef VectorMap<EAITargetThreat, float> TThreatLevelContainer;
  118.         TThreatLevelContainer m_threatLevels;
  119.  
  120.         string                m_sStimulus;
  121.         float                 m_fPeak;
  122.         float                 m_fAttack;
  123.         float                 m_fDecay;
  124.         float                 m_fSustainRatio;
  125.         float                 m_fRelease;
  126.         float                 m_fIgnore;
  127.         bool                  m_bHostileOnly;
  128.  
  129.         // Mask to state which properties where inherited
  130.         enum EInheritanceMask
  131.         {
  132.                 eIM_Peak    = 0x01,
  133.                 eIM_Attack  = 0x02,
  134.                 eIM_Decay   = 0x04,
  135.                 eIM_Sustain = 0x08,
  136.                 eIM_Release = 0x10,
  137.                 eIM_Ignore  = 0x20,
  138.         };
  139.         unsigned char m_ucInheritanceMask;
  140.  
  141.         STargetTrackStimulusConfig();
  142.         STargetTrackStimulusConfig(const char* szStimulus, bool bHostileOnly, float fPeak, float fSustainRatio, float fAttack, float fDecay, float fRelease, float fIgnore);
  143.         STargetTrackStimulusConfig(const STargetTrackStimulusConfig& other, bool bInherited = false);
  144. };
  145.  
  146. // Describes a registered configuration
  147. struct STargetTrackConfig
  148. {
  149.         typedef std::map<uint32, STargetTrackStimulusConfig> TStimulusContainer;
  150.         TStimulusContainer m_stimuli;
  151.         string             m_sName;
  152.         string             m_sTemplate;
  153.  
  154.         // Helper to know when template values have been applied
  155.         bool m_bTemplateApplied;
  156.  
  157.         STargetTrackConfig();
  158.         STargetTrackConfig(const char* szName);
  159. };
  160.  
  161. // Interface for accessing the target track pool
  162. struct ITargetTrackPoolProxy
  163. {
  164.         virtual ~ITargetTrackPoolProxy(){}
  165.         virtual CTargetTrack* GetUnusedTargetTrackFromPool() = 0;
  166.         virtual void          AddTargetTrackToPool(CTargetTrack* pTrack) = 0;
  167. };
  168.  
  169. // Interface for accessing target track configurations and stimulus configurations
  170. struct ITargetTrackConfigProxy
  171. {
  172.         virtual ~ITargetTrackConfigProxy(){}
  173.         virtual bool                        GetTargetTrackConfig(uint32 uNameHash, STargetTrackConfig const*& pOutConfig) const = 0;
  174.         virtual bool                        GetTargetTrackStimulusConfig(uint32 uNameHash, uint32 uStimulusHash, STargetTrackStimulusConfig const*& pOutConfig) const = 0;
  175.         virtual const ITargetTrackModifier* GetTargetTrackModifier(uint32 uId) const = 0;
  176.  
  177.         virtual void                        ModifyTargetThreat(IAIObject& ownerAI, IAIObject& targetAI, const ITargetTrack& track, float& outThreatRatio, EAITargetThreat& outThreat) const = 0;
  178. };
  179. }
  180.  
  181. #endif //__TARGET_TRACK_COMMON_H__
  182.  
downloadTargetTrackCommon.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top