prime/src/MetroidPrime/ScriptObjects/CScriptAreaAttributes.cpp

45 lines
1.6 KiB
C++
Raw Normal View History

2022-10-14 16:03:05 +00:00
#include "MetroidPrime/ScriptObjects/CScriptAreaAttributes.hpp"
CScriptAreaAttributes::CScriptAreaAttributes(TUniqueId uid, const CEntityInfo& info,
bool showSkybox, EEnvFxType fxType, float envFxDensity,
float thermalHeat, float xrayFogDistance,
float worldLightingLevel, CAssetId skybox,
EPhazonType phazonType)
: CEntity(uid, info, true, rstl::string_l(""))
, 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) {}
void CScriptAreaAttributes::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId,
2022-11-08 14:23:03 +00:00
CStateManager& stateMgr) {
2022-10-14 16:03:05 +00:00
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
2022-10-21 01:32:04 +00:00
if (GetCurrentAreaId() == kInvalidAreaId) {
2022-10-14 16:03:05 +00:00
return;
}
switch (msg) {
case kSM_InitializedInArea: {
stateMgr.World()->Area(GetCurrentAreaId())->SetAreaAttributes(this);
2022-10-14 16:03:05 +00:00
stateMgr.EnvFxManager()->SetFxDensity(500, x3c_envFxDensity);
break;
2022-10-21 01:32:04 +00:00
}
2022-10-14 16:03:05 +00:00
case kSM_Deleted: {
if (stateMgr.World()->IsAreaValid(GetCurrentAreaId())) {
stateMgr.World()->Area(GetCurrentAreaId())->SetAreaAttributes(nullptr);
2022-10-14 16:03:05 +00:00
}
break;
2022-10-21 01:32:04 +00:00
}
2022-10-14 16:03:05 +00:00
}
}
2022-11-08 14:23:03 +00:00
void CScriptAreaAttributes::Accept(IVisitor& visitor) { visitor.Visit(*this); }
2022-10-14 16:03:05 +00:00
CScriptAreaAttributes::~CScriptAreaAttributes() {}