Implement/match LegoPathController::FUN_10045c20 and LegoPathController ctor (#903)

* Implement/match LegoPathController::FUN_10045c20 and LegoPathController ctor

* Remove obsolete struct
This commit is contained in:
Christian Semmler
2024-05-11 09:32:11 -04:00
committed by GitHub
parent c77dd44105
commit 5df947dbb9
9 changed files with 73 additions and 29 deletions

View File

@@ -80,6 +80,7 @@ MxResult LegoPathActor::VTable0x80(Vector3& p_point1, Vector3& p_point2, Vector3
}
// FUNCTION: LEGO1 0x1002d9c0
// FUNCTION: BETA10 0x100ae9da
MxResult LegoPathActor::VTable0x88(
LegoPathBoundary* p_boundary,
float p_time,

View File

@@ -1,13 +1,22 @@
#include "legopathcontroller.h"
#include "legopathboundary.h"
#include "mxmisc.h"
#include "mxtimer.h"
DECOMP_SIZE_ASSERT(LegoPathController, 0x40)
// STUB: LEGO1 0x10044f40
// FUNCTION: LEGO1 0x10044f40
// FUNCTION: BETA10 0x100b6860
LegoPathController::LegoPathController()
{
// TODO
m_unk0x08 = NULL;
m_unk0x0c = 0;
m_unk0x10 = 0;
m_unk0x14 = 0;
m_numL = 0;
m_numE = 0;
m_numN = 0;
m_numT = 0;
}
// STUB: LEGO1 0x10045880
@@ -29,7 +38,7 @@ MxResult LegoPathController::Tickle()
return SUCCESS;
}
// STUB: LEGO1 0x10045c20
// FUNCTION: LEGO1 0x10045c20
// FUNCTION: BETA10 0x100b6d80
MxResult LegoPathController::FUN_10045c20(
LegoPathActor* p_actor,
@@ -40,10 +49,28 @@ MxResult LegoPathController::FUN_10045c20(
float p_destScale
)
{
if (p_actor->GetController() != NULL) {
p_actor->GetController()->FUN_10046770(p_actor);
p_actor->SetController(NULL);
}
LegoPathBoundary* pBoundary = GetPathBoundary(p_name);
LegoEdge* pSrcE = pBoundary->GetEdges()[p_src];
LegoEdge* pDestE = pBoundary->GetEdges()[p_dest];
float time = Timer()->GetTime();
if (p_actor->VTable0x88(pBoundary, time, *pSrcE, p_srcScale, (LegoUnknown100db7f4&) *pDestE, p_destScale) !=
SUCCESS) {
return FAILURE;
}
p_actor->SetController(this);
m_actors.insert(p_actor);
return SUCCESS;
}
// STUB: LEGO1 0x10046770
// FUNCTION: BETA10 0x100b7264
undefined4 LegoPathController::FUN_10046770(LegoPathActor* p_actor)
{
return 0;
@@ -72,7 +99,7 @@ MxResult LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_va
LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name)
{
for (MxS32 i = 0; i < m_numL; i++) {
if (strcmpi(m_unk0x08[i].GetName(), p_name) == 0) {
if (!strcmpi(m_unk0x08[i].GetName(), p_name)) {
return &m_unk0x08[i];
}
}