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.

74 lines
1.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "env_detail_controller.h"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. IMPLEMENT_NETWORKCLASS_ALIASED( EnvDetailController, DT_DetailController )
  12. LINK_ENTITY_TO_CLASS_ALIASED(env_detail_controller, EnvDetailController);
  13. BEGIN_NETWORK_TABLE_NOBASE( CEnvDetailController, DT_DetailController )
  14. #ifdef CLIENT_DLL
  15. RecvPropFloat( RECVINFO( m_flFadeStartDist ) ),
  16. RecvPropFloat( RECVINFO( m_flFadeEndDist ) ),
  17. #else
  18. SendPropFloat( SENDINFO( m_flFadeStartDist ) ),
  19. SendPropFloat( SENDINFO( m_flFadeEndDist ) ),
  20. #endif
  21. END_NETWORK_TABLE()
  22. static CEnvDetailController *s_detailController = NULL;
  23. CEnvDetailController * GetDetailController()
  24. {
  25. return s_detailController;
  26. }
  27. CEnvDetailController::CEnvDetailController()
  28. {
  29. s_detailController = this;
  30. }
  31. CEnvDetailController::~CEnvDetailController()
  32. {
  33. if ( s_detailController == this )
  34. {
  35. s_detailController = NULL;
  36. }
  37. }
  38. //--------------------------------------------------------------------------------------------------------------
  39. int CEnvDetailController::UpdateTransmitState()
  40. {
  41. #ifndef CLIENT_DLL
  42. // ALWAYS transmit to all clients.
  43. return SetTransmitState( FL_EDICT_ALWAYS );
  44. #else
  45. return 0;
  46. #endif
  47. }
  48. #ifndef CLIENT_DLL
  49. bool CEnvDetailController::KeyValue( const char *szKeyName, const char *szValue )
  50. {
  51. if (FStrEq(szKeyName, "fademindist"))
  52. {
  53. m_flFadeStartDist = atof(szValue);
  54. }
  55. else if (FStrEq(szKeyName, "fademaxdist"))
  56. {
  57. m_flFadeEndDist = atof(szValue);
  58. }
  59. return true;
  60. }
  61. #endif // !CLIENT_DLL