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.

115 lines
2.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef SOUNDSCAPE_H
  7. #define SOUNDSCAPE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. class CEnvSoundscape;
  12. struct ss_update_t
  13. {
  14. CBasePlayer *pPlayer;
  15. CEnvSoundscape *pCurrentSoundscape;
  16. Vector playerPosition;
  17. float currentDistance;
  18. int traceCount;
  19. bool bInRange;
  20. };
  21. class CEnvSoundscape : public CServerOnlyEntity
  22. {
  23. public:
  24. DECLARE_CLASS( CEnvSoundscape, CServerOnlyEntity );
  25. DECLARE_DATADESC();
  26. CEnvSoundscape();
  27. ~CEnvSoundscape();
  28. bool KeyValue( const char *szKeyName, const char *szValue );
  29. void Spawn( void );
  30. void Precache( void );
  31. void UpdateForPlayer( ss_update_t &update );
  32. void WriteAudioParamsTo( audioparams_t &audio );
  33. bool InRangeOfPlayer( CBasePlayer *pPlayer );
  34. void DrawDebugGeometryOverlays( void );
  35. void InputEnable( inputdata_t &inputdata );
  36. void InputDisable( inputdata_t &inputdata );
  37. void InputToggleEnabled( inputdata_t &inputdata );
  38. string_t GetSoundscapeName() const {return m_soundscapeName;}
  39. private:
  40. bool IsEnabled( void ) const;
  41. void Disable( void );
  42. void Enable( void );
  43. public:
  44. COutputEvent m_OnPlay;
  45. float m_flRadius;
  46. string_t m_soundscapeName;
  47. int m_soundscapeIndex;
  48. int m_soundscapeEntityId;
  49. string_t m_positionNames[NUM_AUDIO_LOCAL_SOUNDS];
  50. // If this is set, then this soundscape ignores all its parameters and uses
  51. // those of this soundscape.
  52. CHandle<CEnvSoundscape> m_hProxySoundscape;
  53. private:
  54. bool m_bDisabled;
  55. };
  56. class CEnvSoundscapeProxy : public CEnvSoundscape
  57. {
  58. public:
  59. DECLARE_CLASS( CEnvSoundscapeProxy, CEnvSoundscape );
  60. DECLARE_DATADESC();
  61. CEnvSoundscapeProxy();
  62. virtual void Activate();
  63. // Here just to stop it falling back to CEnvSoundscape's, and
  64. // printing bogus errors about missing soundscapes.
  65. virtual void Precache() { return; }
  66. private:
  67. string_t m_MainSoundscapeName;
  68. };
  69. class CEnvSoundscapeTriggerable : public CEnvSoundscape
  70. {
  71. friend class CTriggerSoundscape;
  72. public:
  73. DECLARE_CLASS( CEnvSoundscapeTriggerable, CEnvSoundscape );
  74. DECLARE_DATADESC();
  75. CEnvSoundscapeTriggerable();
  76. // Overrides the base class's think and prevents it from running at all.
  77. virtual void Think();
  78. private:
  79. // Passed through from CTriggerSoundscape.
  80. void DelegateStartTouch( CBaseEntity *pEnt );
  81. void DelegateEndTouch( CBaseEntity *pEnt );
  82. };
  83. #endif // SOUNDSCAPE_H