2016-07-14 17:12:17 +03:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
|
|
|
CMapInfo *g_pMapInfo = nullptr;
|
|
|
|
|
|
|
|
CMapInfo::CMapInfo()
|
|
|
|
{
|
|
|
|
m_flBombRadius = 500.0f;
|
|
|
|
m_iBuyingStatus = BUYING_EVERYONE;
|
|
|
|
|
|
|
|
#ifdef REGAMEDLL_ADD
|
|
|
|
if (g_pMapInfo)
|
|
|
|
{
|
|
|
|
// Should only be one of these.
|
|
|
|
ALERT(at_warning, "Warning: Multiple info_map_parameters entities in map!\n");
|
|
|
|
}
|
|
|
|
else
|
2016-07-14 19:02:33 +03:00
|
|
|
#endif
|
2016-07-14 17:12:17 +03:00
|
|
|
{
|
|
|
|
g_pMapInfo = this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMapInfo::CheckMapInfo()
|
|
|
|
{
|
|
|
|
bool bCTCantBuy, bTCantBuy;
|
|
|
|
switch (m_iBuyingStatus)
|
|
|
|
{
|
|
|
|
case BUYING_EVERYONE:
|
|
|
|
bCTCantBuy = false;
|
|
|
|
bTCantBuy = false;
|
|
|
|
|
|
|
|
ALERT(at_console, "EVERYONE CAN BUY!\n");
|
|
|
|
break;
|
|
|
|
case BUYING_ONLY_CTS:
|
|
|
|
bCTCantBuy = false;
|
|
|
|
bTCantBuy = true;
|
|
|
|
|
|
|
|
ALERT(at_console, "Only CT's can buy!!\n");
|
|
|
|
break;
|
|
|
|
case BUYING_ONLY_TERRORISTS:
|
|
|
|
bCTCantBuy = true;
|
|
|
|
bTCantBuy = false;
|
|
|
|
|
|
|
|
ALERT(at_console, "Only T's can buy!!\n");
|
|
|
|
break;
|
|
|
|
case BUYING_NO_ONE:
|
|
|
|
bCTCantBuy = true;
|
|
|
|
bTCantBuy = true;
|
|
|
|
|
|
|
|
ALERT(at_console, "No one can buy!!\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bCTCantBuy = false;
|
|
|
|
bTCantBuy = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
CSGameRules()->m_flBombRadius = m_flBombRadius;
|
|
|
|
CSGameRules()->m_bCTCantBuy = bCTCantBuy;
|
|
|
|
CSGameRules()->m_bTCantBuy = bTCantBuy;
|
|
|
|
}
|
|
|
|
|
2017-07-01 23:40:10 +03:00
|
|
|
void CMapInfo::KeyValue(KeyValueData *pkvd)
|
2016-07-14 17:12:17 +03:00
|
|
|
{
|
|
|
|
if (FStrEq(pkvd->szKeyName, "buying"))
|
|
|
|
{
|
|
|
|
m_iBuyingStatus = (InfoMapBuyParam)Q_atoi(pkvd->szValue);
|
|
|
|
pkvd->fHandled = TRUE;
|
|
|
|
}
|
|
|
|
else if (FStrEq(pkvd->szKeyName, "bombradius"))
|
|
|
|
{
|
|
|
|
m_flBombRadius = (float)Q_atoi(pkvd->szValue);
|
|
|
|
|
|
|
|
if (m_flBombRadius > MAX_BOMB_RADIUS)
|
|
|
|
m_flBombRadius = MAX_BOMB_RADIUS;
|
|
|
|
|
|
|
|
pkvd->fHandled = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-01 23:40:10 +03:00
|
|
|
void CMapInfo::Spawn()
|
2016-07-14 17:12:17 +03:00
|
|
|
{
|
|
|
|
pev->movetype = MOVETYPE_NONE;
|
|
|
|
pev->solid = SOLID_NOT;
|
|
|
|
pev->effects |= EF_NODRAW;
|
|
|
|
}
|
|
|
|
|
2016-10-11 14:51:28 +03:00
|
|
|
void CMapInfo::UpdateOnRemove()
|
|
|
|
{
|
|
|
|
g_pMapInfo = nullptr;
|
|
|
|
}
|
|
|
|
|
2017-01-29 02:56:29 +03:00
|
|
|
LINK_ENTITY_TO_CLASS(info_map_parameters, CMapInfo, CCSMapInfo)
|