metaforce/Runtime/World/CScriptAreaAttributes.cpp

48 lines
1.6 KiB
C++
Raw Normal View History

#include "Runtime/World/CScriptAreaAttributes.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/World/CEnvFxManager.hpp"
#include "Runtime/World/CWorld.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
2016-04-23 18:04:49 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce {
2016-04-23 18:04:49 +00:00
CScriptAreaAttributes::CScriptAreaAttributes(TUniqueId uid, const CEntityInfo& info, bool showSkybox, EEnvFxType fxType,
float envFxDensity, float thermalHeat, float xrayFogDistance,
2017-08-13 05:26:14 +00:00
float worldLightingLevel, CAssetId skybox, EPhazonType phazonType)
: 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)
2018-12-08 05:30:43 +00:00
, x50_phazon(phazonType) {}
2016-04-23 18:04:49 +00:00
2018-12-08 05:30:43 +00:00
void CScriptAreaAttributes::Accept(IVisitor& visitor) { visitor.Visit(this); }
2017-01-15 03:07:01 +00:00
2018-12-08 05:30:43 +00:00
void CScriptAreaAttributes::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) {
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
if (x4_areaId == kInvalidAreaId) {
2018-12-08 05:30:43 +00:00
return;
}
2018-12-08 05:30:43 +00:00
if (msg == EScriptObjectMessage::InitializedInArea) {
CGameArea* area = stateMgr.GetWorld()->GetArea(x4_areaId);
2018-12-08 05:30:43 +00:00
area->SetAreaAttributes(this);
stateMgr.GetEnvFxManager()->SetFxDensity(500, x3c_envFxDensity);
} else if (msg == EScriptObjectMessage::Deleted) {
CGameArea* area = stateMgr.GetWorld()->GetArea(x4_areaId);
2018-12-08 05:30:43 +00:00
if (!area->IsPostConstructed()) {
2018-12-08 05:30:43 +00:00
return;
}
2018-12-08 05:30:43 +00:00
area->SetAreaAttributes(nullptr);
}
2016-04-23 18:04:49 +00:00
}
2018-12-08 05:30:43 +00:00
2021-04-10 08:42:06 +00:00
} // namespace metaforce