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/cstrike/point_surroundtest.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/cstrike/point_surroundtest.cpp')
| -rw-r--r-- | game/server/cstrike/point_surroundtest.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/game/server/cstrike/point_surroundtest.cpp b/game/server/cstrike/point_surroundtest.cpp new file mode 100644 index 0000000..8703827 --- /dev/null +++ b/game/server/cstrike/point_surroundtest.cpp @@ -0,0 +1,71 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#include "cbase.h" +#include "mapinfo.h" + + +class CSurroundTest : public CPointEntity +{ +public: + DECLARE_CLASS( CSurroundTest, CPointEntity ); + + void FireCorrectOutput( inputdata_t &inputdata ); + void Spawn( void ); + +private: + + COutputEvent m_On2Speakers; + COutputEvent m_On4Speakers; + COutputEvent m_On51Speakers; + + DECLARE_DATADESC(); +}; + +LINK_ENTITY_TO_CLASS( point_surroundtest, CSurroundTest ); + +BEGIN_DATADESC( CSurroundTest ) + DEFINE_INPUTFUNC( FIELD_VOID, "FireCorrectOutput", FireCorrectOutput ), + DEFINE_OUTPUT( m_On2Speakers, "On2Speakers" ), + DEFINE_OUTPUT( m_On4Speakers, "On4Speakers" ), + DEFINE_OUTPUT( m_On51Speakers, "On51Speakers" ), +END_DATADESC() + +enum +{ + SND_SURROUND_HEADPHONES = 0, + SND_SURROUND_2SPEAKERS = 2, + SND_SURROUND_4SPEAKERS = 4, + SND_SURROUND_51SPEAKERS, +}; + +void CSurroundTest::FireCorrectOutput( inputdata_t &inputdata ) +{ + ConVar const *pSurroundCVar = cvar->FindVar( "snd_surround_speakers" ); + + if ( pSurroundCVar ) + { + int iSetting = pSurroundCVar->GetInt(); + + if ( iSetting == SND_SURROUND_HEADPHONES || iSetting == SND_SURROUND_2SPEAKERS ) + { + m_On2Speakers.FireOutput( this, this ); + } + else if ( iSetting == SND_SURROUND_4SPEAKERS ) + { + m_On4Speakers.FireOutput( this, this ); + } + else if ( iSetting == SND_SURROUND_51SPEAKERS ) + { + m_On51Speakers.FireOutput( this, this ); + } + } +} + +void CSurroundTest::Spawn( void ) +{ + BaseClass::Spawn(); +}
\ No newline at end of file |