mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 22:27:43 +00:00
Fix doors and various area streaming bugs
This commit is contained in:
@@ -23,7 +23,7 @@ CMaterialList MakeDockMaterialList()
|
||||
CScriptDock::CScriptDock(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||
const zeus::CVector3f position, const zeus::CVector3f& extents, s32 dock, TAreaId area,
|
||||
bool active, s32 dockReferenceCount, bool loadConnected)
|
||||
: CPhysicsActor(uid, active, name, info, zeus::CTransform(zeus::CMatrix3f::skIdentityMatrix3f, position),
|
||||
: CPhysicsActor(uid, true/*active*/, name, info, zeus::CTransform(zeus::CMatrix3f::skIdentityMatrix3f, position),
|
||||
CModelData::CModelDataNull(), MakeDockMaterialList(), zeus::CAABox(-extents * 0.5f, extents * 0.5f),
|
||||
SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f)
|
||||
, x258_dockReferenceCount(dockReferenceCount)
|
||||
@@ -40,6 +40,7 @@ void CScriptDock::Accept(IVisitor& visitor)
|
||||
|
||||
void CScriptDock::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
x30_24_active = true;
|
||||
if (!GetActive())
|
||||
{
|
||||
UpdateAreaActivateFlags(mgr);
|
||||
@@ -96,7 +97,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
||||
case EScriptObjectMessage::Registered:
|
||||
{
|
||||
CGameArea* area = mgr.WorldNC()->GetArea(x260_area);
|
||||
if (area->GetDockCount() <= x25c_dock)
|
||||
if (area->GetDockCount() < x25c_dock)
|
||||
return;
|
||||
IGameArea::Dock* dock = area->DockNC(x25c_dock);
|
||||
if (!dock->IsReferenced())
|
||||
@@ -147,6 +148,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
||||
break;
|
||||
case EScriptObjectMessage::Increment:
|
||||
SetLoadConnected(mgr, true);
|
||||
[[fallthrough]];
|
||||
case EScriptObjectMessage::Decrement:
|
||||
{
|
||||
TAreaId aid = x260_area;
|
||||
@@ -155,7 +157,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
||||
IGameArea::Dock* dock = mgr.WorldNC()->GetArea(x260_area)->DockNC(x25c_dock);
|
||||
aid = dock->GetConnectedAreaId(dock->GetReferenceCount());
|
||||
}
|
||||
else if (aid == 0 || (mgr.GetWorld()->GetNumAreas() <= aid || !mgr.WorldNC()->GetArea(aid)->GetActive()))
|
||||
else if (aid == 0 || (aid >= mgr.GetWorld()->GetNumAreas() || !mgr.WorldNC()->GetArea(aid)->GetActive()))
|
||||
return;
|
||||
CWorld::PropogateAreaChain(CGameArea::EOcclusionState(msg == EScriptObjectMessage::Increment),
|
||||
mgr.WorldNC()->GetArea(aid), mgr.WorldNC());
|
||||
@@ -203,10 +205,10 @@ s32 CScriptDock::GetDockReference(const CStateManager& mgr) const
|
||||
|
||||
TAreaId CScriptDock::GetCurrentConnectedAreaId(const CStateManager& mgr) const
|
||||
{
|
||||
if (mgr.GetWorld()->GetNumAreas() < x260_area)
|
||||
if (x260_area >= mgr.GetWorld()->GetNumAreas())
|
||||
return kInvalidAreaId;
|
||||
const CGameArea* area = mgr.GetWorld()->GetAreaAlways(x260_area);
|
||||
if (area->GetDockCount() < x25c_dock)
|
||||
if (x25c_dock >= area->GetDockCount())
|
||||
return kInvalidAreaId;
|
||||
|
||||
const IGameArea::Dock* dock = area->GetDock(x25c_dock);
|
||||
|
||||
Reference in New Issue
Block a user