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
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return true;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameArea::CAreaFog::DisableFog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-07-23 21:41:18 +00:00
|
|
|
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);
|
2016-07-24 06:05:12 +00:00
|
|
|
for (u32 i=0 ; i<attachAreaCount ; ++i)
|
2016-07-23 21:41:18 +00:00
|
|
|
x44_attachedAreaIndices.push_back(in.readUint16Big());
|
|
|
|
|
|
|
|
u32 depCount = in.readUint32Big();
|
2016-07-24 06:05:12 +00:00
|
|
|
for (u32 i=0 ; i<depCount ; ++i)
|
2016-07-23 21:41:18 +00:00
|
|
|
in.readUint32Big();
|
|
|
|
|
|
|
|
u32 dockCount = in.readUint32Big();
|
|
|
|
x54_docks.reserve(dockCount);
|
2016-07-24 06:05:12 +00:00
|
|
|
for (u32 i=0 ; i<dockCount ; ++i)
|
2016-07-23 21:41:18 +00:00
|
|
|
x54_docks.emplace_back(in, x14_transform);
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CDummyGameArea::IGetScriptingMemoryAlways() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return false;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TAreaId CDummyGameArea::IGetAreaId() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ResId CDummyGameArea::IGetAreaAssetId() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CDummyGameArea::IIsActive() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return false;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TAreaId CDummyGameArea::IGetAttachedAreaId(int) const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u32 CDummyGameArea::IGetNumAttachedAreas() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ResId CDummyGameArea::IGetStringTableAssetId() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
2016-07-24 06:05:12 +00:00
|
|
|
static zeus::CTransform identityXf(zeus::CMatrix3f::skIdentityMatrix3f);
|
2016-07-23 00:26:17 +00:00
|
|
|
const zeus::CTransform& CDummyGameArea::IGetTM() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
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);
|
2016-07-24 06:05:12 +00:00
|
|
|
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);
|
2016-07-24 06:05:12 +00:00
|
|
|
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
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return false;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TAreaId CGameArea::IGetAreaId() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ResId CGameArea::IGetAreaAssetId() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGameArea::IIsActive() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return false;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TAreaId CGameArea::IGetAttachedAreaId(int) const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u32 CGameArea::IGetNumAttachedAreas() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ResId CGameArea::IGetStringTableAssetId() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const zeus::CTransform& CGameArea::IGetTM() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return identityXf;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGameArea::DoesAreaNeedEnvFx() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return false;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGameArea::DoesAreaNeedSkyNow() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return false;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameArea::UpdateFog(float dt)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CGameArea::OtherAreaOcclusionChanged()
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
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
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
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)
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
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
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return 0;
|
2016-07-23 00:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGameArea::VerifyHeader() const
|
|
|
|
{
|
2016-07-24 06:05:12 +00:00
|
|
|
return false;
|
2016-04-19 00:17:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|