CScriptAreaAttributes imps, update hecl

This commit is contained in:
Phillip Stephens 2016-10-01 20:06:20 -07:00
parent 6b97fa0242
commit 77d8b75d2f
8 changed files with 107 additions and 4 deletions

View File

@ -281,6 +281,7 @@ public:
CRumbleManager& GetRumbleManager() {return *x88c_rumbleManager;}
CCameraFilterPass& GetCameraFilterPass(int idx) {return xb84_camFilterPasses[idx];}
CEnvFxManager* GetEnvFxManager() { return x880_envFxManager; }
CWorld* GetWorld() {return x850_world.get();}
CRelayTracker* GetRelayTracker() { return x8bc_relayTracker.get(); }
CCameraManager* GetCameraManager() const { return x870_cameraManager; }

View File

@ -1,10 +1,22 @@
#include "CEnvFxManager.hpp"
#include "Graphics/CTexture.hpp"
namespace urde
{
CEnvFxManager::CEnvFxManager()
{
}
void CEnvFxManager::AsyncLoadResources(CStateManager& mgr)
{
}
void CEnvFxManager::SetFxDensity(s32 val, float density)
{
x34_fxDensity = density;
x38_ = val;
}
}

View File

@ -1,9 +1,14 @@
#ifndef __URDE_CENVFXMANAGER_HPP__
#define __URDE_CENVFXMANAGER_HPP__
#include "RetroTypes.hpp"
#include "CToken.hpp"
#include "zeus/CAABox.hpp"
namespace urde
{
class CStateManager;
class CTexture;
enum class EEnvFxType
{
@ -21,8 +26,27 @@ enum class EPhazonType
class CEnvFxManager
{
zeus::CAABox x0_ = zeus::CAABox(-63.5, 63.5);
zeus::CVector3f x18_ = zeus::CVector3f::skZero;
u8 x24_ = 0;
float x28_ = 0.f;
u32 x2c_ = -1;
float x30_ = 0.f;
float x34_fxDensity = 0.f;
float x38_ = 0.f;
u8 x3c = 0;
void SetupSnowTevs();
void SetupRainTevs();
public:
CEnvFxManager();
void AsyncLoadResources(CStateManager& mgr);
void Update(float, float, EEnvFxType, const CStateManager&);
void SetFxDensity(s32, float);
void MoveWrapCells(s32, s32);
void GetParticleBoundsToWorldScale() const;
};
}

View File

@ -3,6 +3,7 @@
#include "Graphics/CBooRenderer.hpp"
#include "CSimplePool.hpp"
#include "CStateManager.hpp"
#include "World/CScriptAreaAttributes.hpp"
namespace urde
{
@ -903,4 +904,14 @@ CGameArea::MREAHeader CGameArea::VerifyHeader() const
return header;
}
void CGameArea::SetAreaAttributes(const CScriptAreaAttributes* areaAttributes)
{
x12c_postConstructed->x10d8_areaAttributes = areaAttributes;
if (areaAttributes == nullptr)
return;
x12c_postConstructed->x111c_thermalCurrent = areaAttributes->GetThermalHeat();
x12c_postConstructed->x1128_worldLightingLevel = areaAttributes->GetWorldLightingLevel();
}
}

View File

@ -20,7 +20,7 @@
namespace urde
{
class CStateManager;
class CScriptAreaAttributes;
class CDummyGameArea : public IGameArea
{
friend class CDummyWorld;
@ -175,7 +175,7 @@ public:
std::unique_ptr<u8[]> x10c8_sclyBuf;
u32 x10d0_sclySize = 0;
u32 x10d4_ = 0;
u32 x10d8_ = 0;
const CScriptAreaAttributes* x10d8_areaAttributes = nullptr;
EOcclusionState x10dc_occlusionState = EOcclusionState::NotOccluded;
u32 x10e0_ = 0;
float x10e4_ = 5.f;
@ -202,7 +202,7 @@ public:
float x111c_thermalCurrent = 0.f;
float x1120_thermalSpeed = 0.f;
float x1124_thermalTarget = 0.f;
float x1128_ = 1.f;
float x1128_worldLightingLevel = 1.f;
float x112c_xraySpeed = 0.f;
float x1130_xrayTarget = 1.f;
float x1134_ = 0.f;
@ -305,6 +305,8 @@ public:
bool IsPostConstructed() const {return xf0_24_postConstructed;}
const CPostConstructed* GetPostConstructed() const {return x12c_postConstructed.get();}
void SetAreaAttributes(const CScriptAreaAttributes* areaAttributes);
};
}

View File

@ -1,4 +1,7 @@
#include "CScriptAreaAttributes.hpp"
#include "CEnvFxManager.hpp"
#include "CStateManager.hpp"
#include "CWorld.hpp"
namespace urde
{
@ -18,4 +21,47 @@ CScriptAreaAttributes::CScriptAreaAttributes(TUniqueId uid, const CEntityInfo& i
{
}
void CScriptAreaAttributes::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
{
AcceptScriptMsg(msg, objId, stateMgr);
if (x4_areaId == kInvalidAreaId)
return;
if (msg == EScriptObjectMessage::InternalMessage13)
{
CGameArea* area = stateMgr.GetWorld()->GetArea(x4_areaId);
area->SetAreaAttributes(this);
stateMgr.GetEnvFxManager()->SetFxDensity(500, x3c_envFxDensity);
}
else if (msg >= EScriptObjectMessage::InternalMessage12)
{
CGameArea* area = stateMgr.GetWorld()->GetArea(x4_areaId);
if (!area->IsPostConstructed())
return;
area->SetAreaAttributes(nullptr);
}
}
bool CScriptAreaAttributes::GetNeedsSky() const
{
return x34_24_showSkybox;
}
bool CScriptAreaAttributes::GetNeedsEnvFx() const
{
return x38_envFx != EEnvFxType::None;
}
float CScriptAreaAttributes::GetThermalHeat() const
{
return x40_thermalHeat;
}
float CScriptAreaAttributes::GetWorldLightingLevel() const
{
return x48_worldLightingLevel;
}
}

View File

@ -21,6 +21,13 @@ public:
float envFxDensity, float thermalHeat, float xrayFogDistance,
float worldLightingLevel, ResId skybox, EPhazonType phazonType);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
bool GetNeedsSky() const;
bool GetNeedsEnvFx() const;
float GetEnvFxDensity() const;
float GetThermalHeat() const;
float GetWorldLightingLevel() const;
};
}

2
hecl

@ -1 +1 @@
Subproject commit 471385dd4a8cad60bd65211f7b17f118d961ef94
Subproject commit 8e3b35cf8952762b1421dbda154cbd1ad27301d6