mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-04 18:09:53 +03:00
1
This commit is contained in:
76
game/server/cstrike/mapinfo.cpp
Normal file
76
game/server/cstrike/mapinfo.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "mapinfo.h"
|
||||
#include "cs_gamerules.h"
|
||||
|
||||
LINK_ENTITY_TO_CLASS( info_map_parameters, CMapInfo );
|
||||
|
||||
BEGIN_DATADESC( CMapInfo )
|
||||
|
||||
DEFINE_INPUTFUNC( FIELD_INTEGER, "FireWinCondition", InputFireWinCondition ),
|
||||
|
||||
END_DATADESC()
|
||||
|
||||
CMapInfo *g_pMapInfo = NULL;
|
||||
|
||||
|
||||
CMapInfo::CMapInfo()
|
||||
{
|
||||
m_flBombRadius = 500.0f;
|
||||
m_iBuyingStatus = 0;
|
||||
|
||||
if ( g_pMapInfo )
|
||||
{
|
||||
// Should only be one of these.
|
||||
Warning( "Warning: Multiple info_map_parameters entities in map!\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pMapInfo = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CMapInfo::~CMapInfo()
|
||||
{
|
||||
if ( g_pMapInfo == this )
|
||||
g_pMapInfo = NULL;
|
||||
}
|
||||
|
||||
|
||||
bool CMapInfo::KeyValue( const char *szKeyName, const char *szValue )
|
||||
{
|
||||
if (FStrEq(szKeyName, "buying"))
|
||||
{
|
||||
m_iBuyingStatus = atoi(szValue);
|
||||
return true;
|
||||
}
|
||||
else if (FStrEq(szKeyName, "bombradius"))
|
||||
{
|
||||
m_flBombRadius = (float)(atoi(szValue));
|
||||
if (m_flBombRadius > 2048)
|
||||
m_flBombRadius = 2048;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return BaseClass::KeyValue( szKeyName, szValue );
|
||||
}
|
||||
|
||||
|
||||
void CMapInfo::Spawn( void )
|
||||
{
|
||||
SetMoveType( MOVETYPE_NONE );
|
||||
SetSolid( SOLID_NONE );
|
||||
AddEffects( EF_NODRAW );
|
||||
}
|
||||
|
||||
void CMapInfo::InputFireWinCondition(inputdata_t &inputdata )
|
||||
{
|
||||
CSGameRules()->TerminateRound( 5, inputdata.value.Int() );
|
||||
}
|
||||
Reference in New Issue
Block a user