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.

77 lines
1.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: A game system for tracking and updating entity spot state
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CS_ENTITY_SPOTTING_H
  8. #define CS_ENTITY_SPOTTING_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "igamesystem.h"
  13. class CCSPlayer;
  14. class CCSEntitySpotting : public CAutoGameSystemPerFrame
  15. {
  16. public:
  17. enum SpottingRules_T
  18. {
  19. SPOT_RULE_ENEMY = ( 1<<0 ), // spotted when seen by an enemy
  20. SPOT_RULE_CT = ( 1<<1 ), // spotted when seen by CT
  21. SPOT_RULE_T = ( 1<<2 ), // spotted when seen by T
  22. SPOT_RULE_ALWAYS_SEEN_BY_FRIEND = ( 1<<3 ), // always visible to friend
  23. SPOT_RULE_ALWAYS_SEEN_BY_CT = ( 1<<4 ), // always visible to CT
  24. SPOT_RULE_ALWAYS_SEEN_BY_T = ( 1<<5 ), // always visible to T
  25. };
  26. CCSEntitySpotting( const char * szName );
  27. virtual ~CCSEntitySpotting( void ) {}
  28. virtual bool Init( void );
  29. virtual char const *Name() { return "CCSEntitySpotting"; }
  30. virtual void FrameUpdatePostEntityThink( void );
  31. void UpdateSpottedEntities( void );
  32. protected:
  33. float m_fLastUpdate;
  34. };
  35. extern CCSEntitySpotting * g_EntitySpotting;
  36. //===========================================================
  37. // - GatherNonPVSSpottedEntitiesFunctor -
  38. //
  39. // Given a player, generate a list of spotted entities that
  40. // exist outside of that player's PVS.
  41. // Query GetSpotted for result
  42. //===========================================================
  43. class GatherNonPVSSpottedEntitiesFunctor
  44. {
  45. public:
  46. GatherNonPVSSpottedEntitiesFunctor( CCSPlayer * pPlayer );
  47. bool operator()( CBaseEntity * pEntity );
  48. const CBitVec<MAX_EDICTS> & GetSpotted( void )
  49. {
  50. return m_EntitySpotted;
  51. }
  52. private:
  53. CCSPlayer *m_pPlayer;
  54. int m_nSourceTeam;
  55. CBitVec<MAX_EDICTS> m_EntitySpotted;
  56. byte m_pSourcePVS[MAX_MAP_LEAFS/8];
  57. bool m_bForceSpot;
  58. };
  59. #endif // ENTITY_RESOURCE_H