metaforce/Runtime/World/CGameArea.cpp

331 lines
6.4 KiB
C++
Raw Normal View History

2016-04-19 00:17:49 +00:00
#include "CGameArea.hpp"
2016-07-28 04:55:06 +00:00
#include "GameGlobalObjects.hpp"
#include "Graphics/CBooRenderer.hpp"
2016-04-19 00:17:49 +00:00
namespace urde
{
2016-07-23 00:26:17 +00:00
void CGameArea::CAreaFog::SetCurrent() const
{
}
void CGameArea::CAreaFog::Update(float dt)
{
}
void CGameArea::CAreaFog::RollFogOut(float, float, const zeus::CColor& color)
{
}
void CGameArea::CAreaFog::FadeFog(ERglFogMode,
const zeus::CColor& color, const zeus::CVector2f& vec1,
float, const zeus::CVector2f& vec2)
{
}
void CGameArea::CAreaFog::SetFogExplicit(ERglFogMode, const zeus::CColor& color, const zeus::CVector2f& vec)
{
}
bool CGameArea::CAreaFog::IsFogDisabled() const
{
return true;
2016-07-23 00:26:17 +00:00
}
void CGameArea::CAreaFog::DisableFog()
{
}
CDummyGameArea::CDummyGameArea(CInputStream& in, int idx, int mlvlVersion)
{
x8_nameSTRG = in.readUint32Big();
x14_transform.read34RowMajor(in);
zeus::CAABox aabb;
aabb.readBoundingBoxBig(in);
xc_mrea = in.readUint32Big();
if (mlvlVersion > 15)
x10_areaId = in.readUint32Big();
u32 attachAreaCount = in.readUint32Big();
x44_attachedAreaIndices.reserve(attachAreaCount);
for (u32 i=0 ; i<attachAreaCount ; ++i)
x44_attachedAreaIndices.push_back(in.readUint16Big());
u32 depCount = in.readUint32Big();
for (u32 i=0 ; i<depCount ; ++i)
in.readUint32Big();
u32 dockCount = in.readUint32Big();
x54_docks.reserve(dockCount);
for (u32 i=0 ; i<dockCount ; ++i)
x54_docks.emplace_back(in, x14_transform);
2016-07-23 00:26:17 +00:00
}
bool CDummyGameArea::IGetScriptingMemoryAlways() const
{
return false;
2016-07-23 00:26:17 +00:00
}
TAreaId CDummyGameArea::IGetAreaId() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
ResId CDummyGameArea::IGetAreaAssetId() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
bool CDummyGameArea::IIsActive() const
{
return false;
2016-07-23 00:26:17 +00:00
}
TAreaId CDummyGameArea::IGetAttachedAreaId(int) const
{
return 0;
2016-07-23 00:26:17 +00:00
}
u32 CDummyGameArea::IGetNumAttachedAreas() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
ResId CDummyGameArea::IGetStringTableAssetId() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
static zeus::CTransform identityXf(zeus::CMatrix3f::skIdentityMatrix3f);
2016-07-23 00:26:17 +00:00
const zeus::CTransform& CDummyGameArea::IGetTM() const
{
return identityXf;
2016-07-23 00:26:17 +00:00
}
2016-04-19 00:17:49 +00:00
static std::vector<SObjectTag> ReadDependencyList(CInputStream& in)
{
std::vector<SObjectTag> ret;
u32 count = in.readUint32Big();
ret.reserve(count);
for (u32 i=0 ; i<count ; ++i)
2016-04-19 00:17:49 +00:00
{
ret.emplace_back();
ret.back().readMLVL(in);
}
return ret;
}
2016-07-24 04:46:32 +00:00
CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion)
: x4_selfIdx(idx), xf0_25_active(true)
2016-04-19 00:17:49 +00:00
{
x8_nameSTRG = in.readUint32Big();
xc_transform.read34RowMajor(in);
x3c_invTransform = xc_transform.inverse();
x6c_aabb.readBoundingBoxBig(in);
2016-04-23 18:04:49 +00:00
2016-04-19 00:17:49 +00:00
x84_mrea = in.readUint32Big();
2016-04-23 18:04:49 +00:00
if (mlvlVersion > 15)
x88_areaId = in.readUint32Big();
else
x88_areaId = -1;
2016-04-19 00:17:49 +00:00
u32 attachedCount = in.readUint32Big();
x8c_attachedAreaIndices.reserve(attachedCount);
for (u32 i=0 ; i<attachedCount ; ++i)
2016-04-19 00:17:49 +00:00
x8c_attachedAreaIndices.push_back(in.readUint16Big());
2016-07-23 00:26:17 +00:00
x9c_deps1 = ::urde::ReadDependencyList(in);
xac_deps2 = ::urde::ReadDependencyList(in);
}
bool CGameArea::IGetScriptingMemoryAlways() const
{
return false;
2016-07-23 00:26:17 +00:00
}
TAreaId CGameArea::IGetAreaId() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
ResId CGameArea::IGetAreaAssetId() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
bool CGameArea::IIsActive() const
{
return false;
2016-07-23 00:26:17 +00:00
}
TAreaId CGameArea::IGetAttachedAreaId(int) const
{
return 0;
2016-07-23 00:26:17 +00:00
}
u32 CGameArea::IGetNumAttachedAreas() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
ResId CGameArea::IGetStringTableAssetId() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
const zeus::CTransform& CGameArea::IGetTM() const
{
return identityXf;
2016-07-23 00:26:17 +00:00
}
bool CGameArea::DoesAreaNeedEnvFx() const
{
return false;
2016-07-23 00:26:17 +00:00
}
bool CGameArea::DoesAreaNeedSkyNow() const
{
return false;
2016-07-23 00:26:17 +00:00
}
void CGameArea::UpdateFog(float dt)
{
}
bool CGameArea::OtherAreaOcclusionChanged()
{
return false;
2016-07-23 00:26:17 +00:00
}
void CGameArea::PingOcclusionState()
{
}
void CGameArea::PreRender()
{
}
2016-07-23 03:07:07 +00:00
void CGameArea::UpdateThermalVisor(float dt)
{
if (x12c_postConstructed->x1120_thermalSpeed == 0.f)
return;
float influence = x12c_postConstructed->x111c_thermalCurrent;
float delta = x12c_postConstructed->x1120_thermalSpeed * dt;
if (std::fabs(x12c_postConstructed->x1124_thermalTarget -
x12c_postConstructed->x111c_thermalCurrent) < delta)
{
influence = x12c_postConstructed->x1124_thermalTarget;
x12c_postConstructed->x1120_thermalSpeed = 0.f;
}
else if (x12c_postConstructed->x1124_thermalTarget < influence)
influence -= delta;
else
influence += delta;
x12c_postConstructed->x111c_thermalCurrent = influence;
}
2016-07-23 00:26:17 +00:00
void CGameArea::AliveUpdate(float dt)
{
2016-07-23 03:07:07 +00:00
if (!x12c_postConstructed->x10dc_)
x12c_postConstructed->x10e4_ += dt;
else
x12c_postConstructed->x10e4_ = 0.f;
UpdateFog(dt);
UpdateThermalVisor(dt);
2016-07-23 00:26:17 +00:00
}
void CGameArea::SetOcclusionState(EOcclusionState state)
{
}
void CGameArea::RemoveStaticGeometry()
{
2016-07-28 04:55:06 +00:00
if (!xf0_24_postConstructed || !x12c_postConstructed || !x12c_postConstructed->x10dc_)
return;
x12c_postConstructed->x10e0_ = 0;
x12c_postConstructed->x10dc_ = 0;
g_Renderer->RemoveStaticGeometry(&x12c_postConstructed->x4c_insts);
2016-07-23 00:26:17 +00:00
}
void CGameArea::AddStaticGeometry()
{
2016-07-28 04:55:06 +00:00
if (x12c_postConstructed->x10dc_ != 1)
{
x12c_postConstructed->x10e0_ = 0;
x12c_postConstructed->x10dc_ = 1;
if (!x12c_postConstructed->x1108_25_)
FillInStaticGeometry();
g_Renderer->AddStaticGeometry(&x12c_postConstructed->x4c_insts,
x12c_postConstructed->xc_octTree ?
&*x12c_postConstructed->xc_octTree : nullptr,
x4_selfIdx);
}
2016-07-23 00:26:17 +00:00
}
void CGameArea::SetChain(CGameArea* other, int)
{
}
void CGameArea::StartStreamingMainArea()
{
}
u32 CGameArea::GetNumPartSizes() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
void CGameArea::AllocNewAreaData(int, int)
{
}
void CGameArea::Invalidate(CStateManager& mgr)
{
}
void CGameArea::CullDeadAreaRequests()
{
}
void CGameArea::StartStreamIn(CStateManager& mgr)
{
}
bool CGameArea::Validate(CStateManager& mgr)
{
return false;
2016-07-23 00:26:17 +00:00
}
void CGameArea::PostConstructArea()
{
}
void CGameArea::FillInStaticGeometry()
{
}
void CGameArea::VerifyTokenList()
{
}
void CGameArea::ClearTokenList()
{
}
2016-04-19 00:17:49 +00:00
2016-07-23 00:26:17 +00:00
u32 CGameArea::GetPreConstructedSize() const
{
return 0;
2016-07-23 00:26:17 +00:00
}
bool CGameArea::VerifyHeader() const
{
return false;
2016-04-19 00:17:49 +00:00
}
}