diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/AI_Interest_Target.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/AI_Interest_Target.h')
| -rw-r--r-- | game/server/AI_Interest_Target.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/game/server/AI_Interest_Target.h b/game/server/AI_Interest_Target.h new file mode 100644 index 0000000..dd4cfe3 --- /dev/null +++ b/game/server/AI_Interest_Target.h @@ -0,0 +1,88 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Hooks and classes for the support of humanoid NPCs with +// groovy facial animation capabilities, aka, "Actors" +// +//=============================================================================// + +#ifndef AI_INTEREST_TARGET_H +#define AI_INTEREST_TARGET_H + +#if defined( _WIN32 ) +#pragma once +#endif + + +//----------------------------------------------------------------------------- +// CAI_BaseActor +// +// Purpose: The base class for all facially expressive NPCS. +// +//----------------------------------------------------------------------------- + +class CAI_InterestTarget_t +{ +public: + enum CAI_InterestTarget_e + { + LOOKAT_ENTITY = 0, + LOOKAT_POSITION, + LOOKAT_BOTH + }; + +public: + bool IsThis( CBaseEntity *pThis ); + const Vector &GetPosition( void ); + bool IsActive( void ); + float Interest( void ); + +public: + CAI_InterestTarget_e m_eType; // ???? + + EHANDLE m_hTarget; + Vector m_vecPosition; + float m_flStartTime; + float m_flEndTime; + float m_flRamp; + float m_flInterest; + + DECLARE_SIMPLE_DATADESC(); +}; + + +class CAI_InterestTarget : public CUtlVector<CAI_InterestTarget_t> +{ +public: + void Add( CBaseEntity *pTarget, float flImportance, float flDuration, float flRamp ); + void Add( const Vector &vecPosition, float flImportance, float flDuration, float flRamp ); + void Add( CBaseEntity *pTarget, const Vector &vecPosition, float flImportance, float flDuration, float flRamp ); + int Find( CBaseEntity *pTarget ) + { + int i; + for ( i = 0; i < Count(); i++) + { + if (pTarget == (*this)[i].m_hTarget) + return i; + } + return InvalidIndex(); + } + + void Cleanup( void ) + { + int i; + for (i = Count() - 1; i >= 0; i--) + { + if (!Element(i).IsActive()) + { + Remove( i ); + } + } + }; + +private: + void Add( CAI_InterestTarget_t::CAI_InterestTarget_e type, CBaseEntity *pTarget, const Vector &vecPosition, float flImportance, float flDuration, float flRamp ); +}; + + +//----------------------------------------------------------------------------- +#endif // AI_INTEREST_TARGET_H |