ReGameDLL_CS/regamedll/dlls/mapinfo.cpp
s1lentq 183a9f674c Fix: now nades not drop if throws a grenade player.
Rollback: remove virtual destructor in class CBaseEntity
Add: Using info about item from table weaponInfo (yet only for hegrenade, flashbang, smokegrenade)
2016-07-15 20:52:38 +07:00

89 lines
1.7 KiB
C++

#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
#endif
{
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;
}
void CMapInfo::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
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;
}
}
void CMapInfo::__MAKE_VHOOK(Spawn)()
{
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_NOT;
pev->effects |= EF_NODRAW;
}
LINK_ENTITY_TO_CLASS(info_map_parameters, CMapInfo, CCSMapInfo);