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.

82 lines
1.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "mapinfo.h"
  8. #include "cs_gamerules.h"
  9. LINK_ENTITY_TO_CLASS( info_map_parameters, CMapInfo );
  10. BEGIN_DATADESC( CMapInfo )
  11. DEFINE_INPUTFUNC( FIELD_INTEGER, "FireWinCondition", InputFireWinCondition ),
  12. DEFINE_KEYFIELD( m_iPetPopulation, FIELD_INTEGER, "petpopulation" ),
  13. DEFINE_KEYFIELD( m_bUseNormalSpawnsForDM, FIELD_BOOLEAN, "usenormalspawnsfordm" ),
  14. DEFINE_KEYFIELD( m_bDisableAutoGeneratedDMSpawns, FIELD_BOOLEAN, "disableautogenerateddmspawns" ),
  15. DEFINE_KEYFIELD( m_flBotMaxVisionDistance, FIELD_FLOAT, "botmaxvisiondistance" ),
  16. DEFINE_KEYFIELD( m_iHostageCount, FIELD_INTEGER, "hostagecount" ),
  17. END_DATADESC()
  18. CMapInfo *g_pMapInfo = NULL;
  19. CMapInfo::CMapInfo()
  20. {
  21. m_flBombRadius = 500.0f;
  22. m_iBuyingStatus = 0;
  23. m_flBotMaxVisionDistance = -1.0f;
  24. if ( g_pMapInfo )
  25. {
  26. // Should only be one of these.
  27. Warning( "Warning: Multiple info_map_parameters entities in map!\n" );
  28. }
  29. else
  30. {
  31. g_pMapInfo = this;
  32. }
  33. }
  34. CMapInfo::~CMapInfo()
  35. {
  36. if ( g_pMapInfo == this )
  37. g_pMapInfo = NULL;
  38. }
  39. bool CMapInfo::KeyValue( const char *szKeyName, const char *szValue )
  40. {
  41. if (FStrEq(szKeyName, "buying"))
  42. {
  43. m_iBuyingStatus = atoi(szValue);
  44. return true;
  45. }
  46. else if (FStrEq(szKeyName, "bombradius"))
  47. {
  48. m_flBombRadius = (float)(atoi(szValue));
  49. if (m_flBombRadius > 2048)
  50. m_flBombRadius = 2048;
  51. return true;
  52. }
  53. return BaseClass::KeyValue( szKeyName, szValue );
  54. }
  55. void CMapInfo::Spawn( void )
  56. {
  57. SetMoveType( MOVETYPE_NONE );
  58. SetSolid( SOLID_NONE );
  59. AddEffects( EF_NODRAW );
  60. }
  61. void CMapInfo::InputFireWinCondition(inputdata_t &inputdata )
  62. {
  63. CSGameRules()->TerminateRound( 5, inputdata.value.Int() );
  64. }