diff --git a/LEGO1/lego/legoomni/include/act2brick.h b/LEGO1/lego/legoomni/include/act2brick.h index 0302d2dc..1ad730f2 100644 --- a/LEGO1/lego/legoomni/include/act2brick.h +++ b/LEGO1/lego/legoomni/include/act2brick.h @@ -31,7 +31,7 @@ class Act2Brick : public LegoPathActor { // SYNTHETIC: LEGO1 0x1007a450 // Act2Brick::`scalar deleting destructor' - MxResult FUN_1007a4e0(undefined4 p_param1); + MxResult Create(MxS32 p_index); void Remove(); void FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBoundary* p_boundary); void PlayWhistleSound(); @@ -39,6 +39,7 @@ class Act2Brick : public LegoPathActor { void Mute(MxBool p_muted); private: + static LegoChar* g_lodNames[]; static MxLong g_lastHitActorTime; LegoCacheSound* m_whistleSound; // 0x154 diff --git a/LEGO1/lego/legoomni/src/entity/act2brick.cpp b/LEGO1/lego/legoomni/src/entity/act2brick.cpp index c2af1c35..6291c390 100644 --- a/LEGO1/lego/legoomni/src/entity/act2brick.cpp +++ b/LEGO1/lego/legoomni/src/entity/act2brick.cpp @@ -16,6 +16,10 @@ DECOMP_SIZE_ASSERT(Act2Brick, 0x194) +// GLOBAL: LEGO1 0x100f7a38 +LegoChar* Act2Brick::g_lodNames[] = + {"xchbase1", "xchblad1", "xchseat1", "xchtail1", "xhback1", "xhljet1", "xhmidl1", "xhmotr1", "xhsidl1", "xhsidr1"}; + // GLOBAL: LEGO1 0x100f7a60 MxLong Act2Brick::g_lastHitActorTime = 0; @@ -33,11 +37,33 @@ Act2Brick::~Act2Brick() TickleManager()->UnregisterClient(this); } -// STUB: LEGO1 0x1007a4e0 -// STUB: BETA10 0x10012ad5 -MxResult Act2Brick::FUN_1007a4e0(undefined4 p_param1) +// FUNCTION: LEGO1 0x1007a4e0 +// FUNCTION: BETA10 0x10012ad5 +MxResult Act2Brick::Create(MxS32 p_index) { - // TODO + if (m_roi != NULL) { + return FAILURE; + } + + char name[12]; + sprintf(name, "chbrick%d", p_index); + + m_roi = CharacterManager()->CreateAutoROI(name, g_lodNames[p_index], FALSE); + + BoundingSphere sphere = m_roi->GetBoundingSphere(); + sphere.Center()[1] -= 0.3; + + if (p_index < 6) { + sphere.Radius() = m_roi->GetBoundingSphere().Radius() * 0.5f; + } + else { + sphere.Radius() = m_roi->GetBoundingSphere().Radius() * 2.0f; + } + + m_roi->SetBoundingSphere(sphere); + m_roi->SetEntity(this); + CurrentWorld()->Add(this); + m_unk0x164 = 1; return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index cf9dd1f5..2defc80d 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -642,7 +642,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param) m_unk0x10d0 = 0; if (m_unk0x10c0 < 6) { - m_bricks[m_unk0x10c0].FUN_1007a4e0(m_unk0x10c0); + m_bricks[m_unk0x10c0].Create(m_unk0x10c0); m_unk0x10c0++; }