Implement/match LegoPathController::ReadEdge (#907)

* Implement/match LegoPathController::ReadEdge

* Fix

* Rename

* Add 100482b0

* Rename
This commit is contained in:
Christian Semmler
2024-05-11 13:45:13 -04:00
committed by GitHub
parent 09394c3512
commit 1f0a2a50ce
5 changed files with 86 additions and 19 deletions

View File

@@ -154,19 +154,19 @@ MxResult LegoPathController::Read(LegoStorage* p_storage)
m_unk0x08 = new LegoPathBoundary[m_numL];
}
if (m_numT > 0 && FUN_10047b30(p_storage) != SUCCESS) {
if (m_numT > 0 && ReadStructs(p_storage) != SUCCESS) {
return FAILURE;
}
if (m_numN > 0) {
for (MxS32 i = 0; i < m_numN; i++) {
if (FUN_100482b0(p_storage, m_unk0x10[i]) != SUCCESS) {
if (ReadVector(p_storage, m_unk0x10[i]) != SUCCESS) {
return FAILURE;
}
}
}
if (m_numE > 0 && FUN_10047c10(p_storage) != SUCCESS) {
if (m_numE > 0 && ReadEdges(p_storage) != SUCCESS) {
return FAILURE;
}
@@ -183,7 +183,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage)
// FUNCTION: LEGO1 0x10047b30
// FUNCTION: BETA10 0x100b7cd6
MxResult LegoPathController::FUN_10047b30(LegoStorage* p_storage)
MxResult LegoPathController::ReadStructs(LegoStorage* p_storage)
{
for (MxS32 i = 0; i < m_numT; i++) {
MxU8 length = 0;
@@ -210,11 +210,71 @@ MxResult LegoPathController::FUN_10047b30(LegoStorage* p_storage)
return SUCCESS;
}
// STUB: LEGO1 0x10047c10
// FUNCTION: LEGO1 0x10047c10
// FUNCTION: BETA10 0x100b7df3
MxResult LegoPathController::FUN_10047c10(LegoStorage* p_storage)
MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
{
// TODO
for (MxS32 i = 0; i < m_numE; i++) {
LegoPathCtrlEdge& edge = m_unk0x0c[i];
MxU16 s;
if (p_storage->Read(&edge.m_flags, sizeof(edge.m_flags)) != SUCCESS) {
return FAILURE;
}
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_pointA = &m_unk0x10[s];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_pointB = &m_unk0x10[s];
if (edge.m_flags & LegoUnknown100db7f4::c_bit3) {
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_faceA = &m_unk0x08[s];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_ccwA = &m_unk0x0c[s];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_cwA = &m_unk0x0c[s];
}
if (edge.m_flags & LegoUnknown100db7f4::c_bit4) {
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_faceB = &m_unk0x08[s];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_ccwB = &m_unk0x0c[s];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_cwB = &m_unk0x0c[s];
}
if (ReadVector(p_storage, edge.m_unk0x28) != SUCCESS) {
return FAILURE;
}
if (p_storage->Read(&edge.m_unk0x3c, sizeof(edge.m_unk0x3c)) != SUCCESS) {
return FAILURE;
}
}
return SUCCESS;
}
@@ -226,10 +286,13 @@ MxResult LegoPathController::FUN_10047e90(LegoStorage* p_storage)
return SUCCESS;
}
// STUB: LEGO1 0x100482b0
// FUNCTION: LEGO1 0x100482b0
// FUNCTION: BETA10 0x100b8864
MxResult LegoPathController::FUN_100482b0(LegoStorage* p_storage, Mx3DPointFloat&)
MxResult LegoPathController::ReadVector(LegoStorage* p_storage, Mx3DPointFloat& p_vec)
{
// TODO
if (p_storage->Read(p_vec.GetData(), sizeof(float) * 3) != SUCCESS) {
return FAILURE;
}
return SUCCESS;
}