mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-04 18:09:53 +03:00
1
This commit is contained in:
71
game/server/cstrike/point_surroundtest.cpp
Normal file
71
game/server/cstrike/point_surroundtest.cpp
Normal file
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user