mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-21 13:39:11 +00:00
47
src/MetroidPrime/ScriptObjects/CScriptAreaAttributes.cpp
Normal file
47
src/MetroidPrime/ScriptObjects/CScriptAreaAttributes.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#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,
|
||||
CStateManager& stateMgr) override {
|
||||
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
||||
|
||||
if (x4_areaId == kInvalidAreaId) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (msg) {
|
||||
case kSM_InitializedInArea: {
|
||||
TAreaId areaId = x4_areaId;
|
||||
stateMgr.World()->Area(areaId)->SetAreaAttributes(this);
|
||||
stateMgr.EnvFxManager()->SetFxDensity(500, x3c_envFxDensity);
|
||||
break;
|
||||
}
|
||||
|
||||
case kSM_Deleted: {
|
||||
TAreaId areaId = x4_areaId;
|
||||
CGameArea* area = stateMgr.World()->Area(areaId);
|
||||
|
||||
if (area->IsLoaded()) {
|
||||
area->SetAreaAttributes(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CScriptAreaAttributes::Accept(IVisitor& visitor) override { visitor.Visit(*this); }
|
||||
|
||||
CScriptAreaAttributes::~CScriptAreaAttributes() {}
|
||||
Reference in New Issue
Block a user