Implement/match LegoPathController::ReadEdge

This commit is contained in:
Christian Semmler 2024-05-11 12:57:37 -04:00
parent 09394c3512
commit eaffc44212
5 changed files with 78 additions and 14 deletions

View File

@ -9,7 +9,7 @@
struct LegoEdge;
class LegoPathBoundary;
class LegoPathController;
class LegoUnknown100db7f4;
struct LegoUnknown100db7f4;
// VTABLE: LEGO1 0x100d6e28
// SIZE 0x154

View File

@ -16,7 +16,7 @@ class Vector3;
// VTABLE: LEGO1 0x100d7da8
// SIZE 0x40
class LegoPathCtrlEdge : public LegoUnknown100db7f4 {};
struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {};
struct LegoPathCtrlEdgeCompare {
MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const
@ -73,8 +73,8 @@ class LegoPathController : public MxCore {
private:
MxResult Read(LegoStorage* p_storage);
MxResult FUN_10047b30(LegoStorage* p_storage);
MxResult FUN_10047c10(LegoStorage* p_storage);
MxResult ReadStruct(LegoStorage* p_storage);
MxResult ReadEdge(LegoStorage* p_storage);
MxResult FUN_10047e90(LegoStorage* p_storage);
static MxResult FUN_100482b0(LegoStorage* p_storage, Mx3DPointFloat&);

View File

@ -154,7 +154,7 @@ 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 && ReadStruct(p_storage) != SUCCESS) {
return FAILURE;
}
@ -166,7 +166,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage)
}
}
if (m_numE > 0 && FUN_10047c10(p_storage) != SUCCESS) {
if (m_numE > 0 && ReadEdge(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::ReadStruct(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::ReadEdge(LegoStorage* p_storage)
{
// TODO
for (MxS32 i = 0; i < m_numE; i++) {
LegoPathCtrlEdge& edge = m_unk0x0c[i];
MxS16 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 & USHRT_MAX];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_pointB = &m_unk0x10[s & USHRT_MAX];
if (edge.m_flags & LegoUnknown100db7f4::c_bit3) {
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_faceA = &m_unk0x08[s & USHRT_MAX];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_ccwA = &m_unk0x0c[s & USHRT_MAX];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_cwA = &m_unk0x0c[s & USHRT_MAX];
}
if (edge.m_flags & LegoUnknown100db7f4::c_bit4) {
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_faceB = &m_unk0x08[s & USHRT_MAX];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_ccwB = &m_unk0x0c[s & USHRT_MAX];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE;
}
edge.m_cwB = &m_unk0x0c[s & USHRT_MAX];
}
if (FUN_100482b0(p_storage, edge.m_unk0x28) != SUCCESS) {
return FAILURE;
}
if (p_storage->Read(&edge.m_unk0x3c, sizeof(edge.m_unk0x3c)) != SUCCESS) {
return FAILURE;
}
}
return SUCCESS;
}

View File

@ -6,7 +6,7 @@ DECOMP_SIZE_ASSERT(LegoUnknown100db7f4, 0x40)
// FUNCTION: BETA10 0x10183050
LegoUnknown100db7f4::LegoUnknown100db7f4()
{
m_unk0x24 = 0;
m_flags = 0;
m_unk0x28.Clear();
m_unk0x3c = 0;
}

View File

@ -7,8 +7,13 @@
// VTABLE: LEGO1 0x100db7f4
// SIZE 0x40
class LegoUnknown100db7f4 : public LegoEdge {
struct LegoUnknown100db7f4 : public LegoEdge {
public:
enum {
c_bit3 = 0x04,
c_bit4 = 0x08
};
LegoUnknown100db7f4();
// FUNCTION: LEGO1 0x1002ddc0
@ -30,8 +35,7 @@ class LegoUnknown100db7f4 : public LegoEdge {
// SYNTHETIC: LEGO1 0x1009a6c0
// LegoUnknown100db7f4::`scalar deleting destructor'
private:
LegoU16 m_unk0x24; // 0x24
LegoU16 m_flags; // 0x24
Mx3DPointFloat m_unk0x28; // 0x28
LegoU32 m_unk0x3c; // 0x3c
};