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.

111 lines
3.1 KiB

  1. //========= Copyright � 1996-2008, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef AMBIENTGENERIC_H
  7. #define AMBIENTGENERIC_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. // runtime pitch shift and volume fadein/out structure
  12. // NOTE: IF YOU CHANGE THIS STRUCT YOU MUST CHANGE THE SAVE/RESTORE VERSION NUMBER
  13. // SEE BELOW (in the typedescription for the class)
  14. typedef struct dynpitchvol
  15. {
  16. // NOTE: do not change the order of these parameters
  17. // NOTE: unless you also change order of rgdpvpreset array elements!
  18. int preset;
  19. int pitchrun; // pitch shift % when sound is running 0 - 255
  20. int pitchstart; // pitch shift % when sound stops or starts 0 - 255
  21. int spinup; // spinup time 0 - 100
  22. int spindown; // spindown time 0 - 100
  23. int volrun; // volume change % when sound is running 0 - 10
  24. int volstart; // volume change % when sound stops or starts 0 - 10
  25. int fadein; // volume fade in time 0 - 100
  26. int fadeout; // volume fade out time 0 - 100
  27. // Low Frequency Oscillator
  28. int lfotype; // 0) off 1) square 2) triangle 3) random
  29. int lforate; // 0 - 1000, how fast lfo osciallates
  30. int lfomodpitch; // 0-100 mod of current pitch. 0 is off.
  31. int lfomodvol; // 0-100 mod of current volume. 0 is off.
  32. int cspinup; // each trigger hit increments counter and spinup pitch
  33. int cspincount;
  34. int pitch;
  35. int spinupsav;
  36. int spindownsav;
  37. int pitchfrac;
  38. int vol;
  39. int fadeinsav;
  40. int fadeoutsav;
  41. int volfrac;
  42. int lfofrac;
  43. int lfomult;
  44. } dynpitchvol_t;
  45. #define SF_AMBIENT_SOUND_EVERYWHERE 1
  46. #define SF_AMBIENT_SOUND_START_SILENT 16
  47. #define SF_AMBIENT_SOUND_NOT_LOOPING 32
  48. class CAmbientGeneric : public CPointEntity
  49. {
  50. public:
  51. DECLARE_CLASS( CAmbientGeneric, CPointEntity );
  52. virtual bool KeyValue( const char *szKeyName, const char *szValue );
  53. virtual void Spawn( void );
  54. virtual void Precache( void );
  55. virtual void Activate( void );
  56. void RampThink( void );
  57. void InitModulationParms(void);
  58. void ComputeMaxAudibleDistance( );
  59. // Rules about which entities need to transmit along with me
  60. virtual void SetTransmit( CCheckTransmitInfo *pInfo, bool bAlways );
  61. virtual void UpdateOnRemove( void );
  62. virtual void ToggleSound();
  63. virtual void SendSound( SoundFlags_t flags );
  64. // Input handlers
  65. void InputPlaySound( inputdata_t &inputdata );
  66. void InputStopSound( inputdata_t &inputdata );
  67. void InputToggleSound( inputdata_t &inputdata );
  68. void InputPitch( inputdata_t &inputdata );
  69. void InputVolume( inputdata_t &inputdata );
  70. void InputFadeIn( inputdata_t &inputdata );
  71. void InputFadeOut( inputdata_t &inputdata );
  72. DECLARE_DATADESC();
  73. float m_radius;
  74. float m_flMaxRadius;
  75. soundlevel_t m_iSoundLevel; // dB value
  76. dynpitchvol_t m_dpv;
  77. bool m_fActive; // only true when the entity is playing a looping sound
  78. bool m_fLooping; // true when the sound played will loop
  79. string_t m_iszSound; // Path/filename of WAV file to play.
  80. string_t m_sSourceEntName;
  81. EHANDLE m_hSoundSource; // entity from which the sound comes
  82. int m_nSoundSourceEntIndex; // In case the entity goes away before we finish stopping the sound...
  83. };
  84. #endif // AMBIENTGENERIC_H