Implement/match LegoAct2::HandlePathStruct (#1187)

* Implement/match `LegoAct2::HandlePathStruct`

* Add Act2Brick::FUN_1007a670

* Add Act2Brick::Create

* Name variable

* Add stdio.h
This commit is contained in:
Christian Semmler
2024-12-03 13:31:24 -07:00
committed by GitHub
parent 3c624ff14c
commit 5693b1a266
6 changed files with 149 additions and 9 deletions

View File

@@ -12,10 +12,15 @@
#include "mxtimer.h"
#include "roi/legoroi.h"
#include <stdio.h>
#include <vec.h>
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,6 +38,36 @@ Act2Brick::~Act2Brick()
TickleManager()->UnregisterClient(this);
}
// FUNCTION: LEGO1 0x1007a4e0
// FUNCTION: BETA10 0x10012ad5
MxResult Act2Brick::Create(MxS32 p_index)
{
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;
}
// FUNCTION: LEGO1 0x1007a620
// FUNCTION: BETA10 0x10012ba2
void Act2Brick::Remove()
@@ -48,6 +83,28 @@ void Act2Brick::Remove()
m_unk0x164 = 0;
}
// FUNCTION: LEGO1 0x1007a670
// FUNCTION: BETA10 0x10012c04
void Act2Brick::FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBoundary* p_boundary)
{
m_unk0x17c = p_param2[3];
m_unk0x168 = p_param2[3];
((Vector3&) m_unk0x168).Sub(p_param1[3]);
((Vector3&) m_unk0x168).Div(8.0f);
m_unk0x190 = 0;
TickleManager()->RegisterClient(this, 20);
m_unk0x164 = 2;
CurrentWorld()->PlaceActor(this);
p_boundary->AddActor(this);
SetState(LegoPathActor::c_bit3);
m_roi->FUN_100a58f0(p_param1);
m_roi->VTable0x14();
m_roi->SetVisibility(TRUE);
}
// FUNCTION: LEGO1 0x1007a750
MxResult Act2Brick::VTable0x94(LegoPathActor* p_actor, MxBool)
{