2016-04-23 18:04:49 +00:00
|
|
|
#include "CScriptAreaAttributes.hpp"
|
2016-10-02 03:06:20 +00:00
|
|
|
#include "CEnvFxManager.hpp"
|
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "CWorld.hpp"
|
2017-01-15 03:07:01 +00:00
|
|
|
#include "TCastTo.hpp"
|
2016-04-23 18:04:49 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
CScriptAreaAttributes::CScriptAreaAttributes(TUniqueId uid, const CEntityInfo& info, bool showSkybox, EEnvFxType fxType,
|
|
|
|
float envFxDensity, float thermalHeat, float xrayFogDistance,
|
|
|
|
float worldLightingLevel, ResId skybox, EPhazonType phazonType)
|
2016-12-19 18:27:58 +00:00
|
|
|
: CEntity(uid, info, true, std::string())
|
|
|
|
, x34_24_showSkybox(showSkybox)
|
|
|
|
, x38_envFx(fxType)
|
|
|
|
, x3c_envFxDensity(envFxDensity)
|
|
|
|
, x40_thermalHeat(thermalHeat)
|
|
|
|
, x44_xrayFogDistance(xrayFogDistance)
|
|
|
|
, x48_worldLightingLevel(worldLightingLevel)
|
|
|
|
, x4c_skybox(skybox)
|
|
|
|
, x50_phazon(phazonType)
|
2016-04-23 18:04:49 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:07:01 +00:00
|
|
|
void CScriptAreaAttributes::Accept(IVisitor& visitor)
|
|
|
|
{
|
|
|
|
visitor.Visit(this);
|
|
|
|
}
|
|
|
|
|
2016-10-02 03:06:20 +00:00
|
|
|
void CScriptAreaAttributes::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
|
|
|
{
|
2017-03-04 04:58:33 +00:00
|
|
|
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
2016-10-02 03:06:20 +00:00
|
|
|
if (x4_areaId == kInvalidAreaId)
|
|
|
|
return;
|
|
|
|
|
2017-02-19 09:27:01 +00:00
|
|
|
if (msg == EScriptObjectMessage::Constructed)
|
2016-10-02 03:06:20 +00:00
|
|
|
{
|
2017-01-04 04:08:30 +00:00
|
|
|
CGameArea* area = stateMgr.WorldNC()->GetArea(x4_areaId);
|
2016-10-02 03:06:20 +00:00
|
|
|
area->SetAreaAttributes(this);
|
|
|
|
stateMgr.GetEnvFxManager()->SetFxDensity(500, x3c_envFxDensity);
|
|
|
|
}
|
2017-02-14 04:27:20 +00:00
|
|
|
else if (msg >= EScriptObjectMessage::Deleted)
|
2016-10-02 03:06:20 +00:00
|
|
|
{
|
2017-01-04 04:08:30 +00:00
|
|
|
CGameArea* area = stateMgr.WorldNC()->GetArea(x4_areaId);
|
2016-10-02 03:06:20 +00:00
|
|
|
|
|
|
|
if (!area->IsPostConstructed())
|
|
|
|
return;
|
|
|
|
|
|
|
|
area->SetAreaAttributes(nullptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-23 18:04:49 +00:00
|
|
|
}
|