diff options
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 |