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.

74 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef FUNC_RESPAWNROOM_H
  7. #define FUNC_RESPAWNROOM_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "triggers.h"
  12. class CFuncRespawnRoomVisualizer;
  13. // This class is to get around the fact that DEFINE_FUNCTION doesn't like multiple inheritance
  14. class CFuncRespawnRoomShim : public CBaseTrigger
  15. {
  16. virtual void RespawnRoomTouch( CBaseEntity *pOther ) = 0;
  17. public:
  18. void Touch( CBaseEntity *pOther ) { return RespawnRoomTouch( pOther ) ; }
  19. };
  20. //-----------------------------------------------------------------------------
  21. // Purpose: Defines an area considered inside a respawn room
  22. //-----------------------------------------------------------------------------
  23. DECLARE_AUTO_LIST( IFuncRespawnRoomAutoList );
  24. class CFuncRespawnRoom : public CFuncRespawnRoomShim, public IFuncRespawnRoomAutoList
  25. {
  26. DECLARE_CLASS( CFuncRespawnRoom, CFuncRespawnRoomShim );
  27. public:
  28. CFuncRespawnRoom();
  29. DECLARE_DATADESC();
  30. DECLARE_SERVERCLASS();
  31. virtual void Spawn( void );
  32. virtual void Activate( void );
  33. virtual void ChangeTeam( int iTeamNum ) OVERRIDE;
  34. virtual void RespawnRoomTouch( CBaseEntity *pOther ) OVERRIDE;
  35. virtual void StartTouch(CBaseEntity *pOther) OVERRIDE;
  36. virtual void EndTouch(CBaseEntity *pOther) OVERRIDE;
  37. // Inputs
  38. void InputSetActive( inputdata_t &inputdata );
  39. void InputSetInactive( inputdata_t &inputdata );
  40. void InputToggleActive( inputdata_t &inputdata );
  41. void InputRoundActivate( inputdata_t &inputdata );
  42. void SetActive( bool bActive );
  43. bool GetActive() const;
  44. void AddVisualizer( CFuncRespawnRoomVisualizer *pViz );
  45. private:
  46. bool m_bActive;
  47. int m_iOriginalTeam;
  48. CUtlVector< CHandle<CFuncRespawnRoomVisualizer> > m_hVisualizers;
  49. };
  50. //-----------------------------------------------------------------------------
  51. // Is a given point contained within a respawn room?
  52. //-----------------------------------------------------------------------------
  53. bool PointInRespawnRoom( const CBaseEntity *pEntity, const Vector &vecOrigin, bool bTouching_SameTeamOnly = false );
  54. bool PointsCrossRespawnRoomVisualizer( const Vector& vecStart, const Vector &vecEnd, int nTeamToIgnore = TEAM_UNASSIGNED );
  55. #endif // FUNC_RESPAWNROOM_H