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/shared/env_detail_controller.cpp | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'game/shared/env_detail_controller.cpp')
| -rw-r--r-- | game/shared/env_detail_controller.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/game/shared/env_detail_controller.cpp b/game/shared/env_detail_controller.cpp new file mode 100644 index 0000000..ed18616 --- /dev/null +++ b/game/shared/env_detail_controller.cpp @@ -0,0 +1,75 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#include "cbase.h" + +#include "env_detail_controller.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +LINK_ENTITY_TO_CLASS(env_detail_controller, CEnvDetailController); + +IMPLEMENT_NETWORKCLASS_ALIASED( EnvDetailController, DT_DetailController ) + +BEGIN_NETWORK_TABLE_NOBASE( CEnvDetailController, DT_DetailController ) + #ifdef CLIENT_DLL + RecvPropFloat( RECVINFO( m_flFadeStartDist ) ), + RecvPropFloat( RECVINFO( m_flFadeEndDist ) ), + #else + SendPropFloat( SENDINFO( m_flFadeStartDist ) ), + SendPropFloat( SENDINFO( m_flFadeEndDist ) ), + #endif +END_NETWORK_TABLE() + +static CEnvDetailController *s_detailController = NULL; +CEnvDetailController * GetDetailController() +{ + return s_detailController; +} + +CEnvDetailController::CEnvDetailController() +{ + s_detailController = this; +} + +CEnvDetailController::~CEnvDetailController() +{ + if ( s_detailController == this ) + { + s_detailController = NULL; + } +} + +//-------------------------------------------------------------------------------------------------------------- +int CEnvDetailController::UpdateTransmitState() +{ +#ifndef CLIENT_DLL + // ALWAYS transmit to all clients. + return SetTransmitState( FL_EDICT_ALWAYS ); +#else + return 0; +#endif +} + +#ifndef CLIENT_DLL + + bool CEnvDetailController::KeyValue( const char *szKeyName, const char *szValue ) + { + if (FStrEq(szKeyName, "fademindist")) + { + m_flFadeStartDist = atof(szValue); + } + else if (FStrEq(szKeyName, "fademaxdist")) + { + m_flFadeEndDist = atof(szValue); + } + + return true; + } + +#endif // !CLIENT_DLL |