Team Fortress 2 Source Code as on 22/4/2020
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.

76 lines
1.4 KiB

  1. //========= Copyright 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. END_DATADESC()
  13. CMapInfo *g_pMapInfo = NULL;
  14. CMapInfo::CMapInfo()
  15. {
  16. m_flBombRadius = 500.0f;
  17. m_iBuyingStatus = 0;
  18. if ( g_pMapInfo )
  19. {
  20. // Should only be one of these.
  21. Warning( "Warning: Multiple info_map_parameters entities in map!\n" );
  22. }
  23. else
  24. {
  25. g_pMapInfo = this;
  26. }
  27. }
  28. CMapInfo::~CMapInfo()
  29. {
  30. if ( g_pMapInfo == this )
  31. g_pMapInfo = NULL;
  32. }
  33. bool CMapInfo::KeyValue( const char *szKeyName, const char *szValue )
  34. {
  35. if (FStrEq(szKeyName, "buying"))
  36. {
  37. m_iBuyingStatus = atoi(szValue);
  38. return true;
  39. }
  40. else if (FStrEq(szKeyName, "bombradius"))
  41. {
  42. m_flBombRadius = (float)(atoi(szValue));
  43. if (m_flBombRadius > 2048)
  44. m_flBombRadius = 2048;
  45. return true;
  46. }
  47. return BaseClass::KeyValue( szKeyName, szValue );
  48. }
  49. void CMapInfo::Spawn( void )
  50. {
  51. SetMoveType( MOVETYPE_NONE );
  52. SetSolid( SOLID_NONE );
  53. AddEffects( EF_NODRAW );
  54. }
  55. void CMapInfo::InputFireWinCondition(inputdata_t &inputdata )
  56. {
  57. CSGameRules()->TerminateRound( 5, inputdata.value.Int() );
  58. }