From 7c8ad513518b665087e7fec4b20843ba131bda66 Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Fri, 16 Jan 2026 23:44:59 +0100 Subject: [PATCH] Clear unknowns in `LegoPathEdgeContainer` and `LegoBEWithFloat` Renames `LegoBEWithFloat` also to `LegoBEWithMidpoint` to be more specific. --- .../legoomni/include/legopathcontroller.h | 38 ++++++++-------- .../legoomni/include/legopathedgecontainer.h | 45 ++++++++++--------- LEGO1/lego/legoomni/src/actors/act2actor.cpp | 2 +- LEGO1/lego/legoomni/src/actors/act3actors.cpp | 4 +- .../lego/legoomni/src/paths/legopathactor.cpp | 2 +- .../legoomni/src/paths/legopathcontroller.cpp | 40 +++++++++-------- 6 files changed, 69 insertions(+), 62 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 4632c6b1..89b11074 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -291,58 +291,58 @@ class LegoPathController : public MxCore { // _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Ubound // TEMPLATE: LEGO1 0x100493a0 -// list >::~list > +// list >::~list > // TEMPLATE: LEGO1 0x10049410 -// list >::insert +// list >::insert // TEMPLATE: LEGO1 0x10049470 -// list >::_Buynode +// list >::_Buynode // TEMPLATE: LEGO1 0x100494a0 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::iterator::_Inc +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::iterator::_Inc // TEMPLATE: LEGO1 0x100494e0 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::~_Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::~_Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::insert +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::insert // TEMPLATE: LEGO1 0x10049840 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::iterator::_Dec +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::iterator::_Dec // TEMPLATE: LEGO1 0x10049890 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::erase +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::erase // TEMPLATE: LEGO1 0x10049cf0 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Buynode +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::_Buynode // TEMPLATE: LEGO1 0x10049d50 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Init +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::_Init // TEMPLATE: LEGO1 0x10049e00 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Insert +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::_Insert // TEMPLATE: LEGO1 0x10049d10 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Erase +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::_Erase // TEMPLATE: LEGO1 0x1004a090 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Lrotate +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::_Lrotate // TEMPLATE: LEGO1 0x1004a0f0 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Rrotate +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::_Rrotate // TEMPLATE: LEGO1 0x1004a150 -// List::~List +// List::~List // TEMPLATE: LEGO1 0x1004a1a0 -// Multiset::~Multiset +// Multiset::~Multiset // TEMPLATE: LEGO1 0x1004a1f0 -// multiset >::~multiset > +// multiset >::~multiset > // TEMPLATE: LEGO1 0x1004a760 -// ?_Construct@@YAXPAPAULegoBEWithFloat@@ABQAU1@@Z +// ?_Construct@@YAXPAPAULegoBEWithMidpoint@@ABQAU1@@Z // TEMPLATE: LEGO1 0x1004a780 // ?_Construct@@YAXPAPAULegoPathCtrlEdge@@ABQAU1@@Z @@ -351,7 +351,7 @@ class LegoPathController : public MxCore { // _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Nil // GLOBAL: LEGO1 0x100f4364 -// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Nil +// _Tree >::_Kfn,LegoBEWithMidpointComparator,allocator >::_Nil // clang-format on #endif // LEGOPATHCONTROLLER_H diff --git a/LEGO1/lego/legoomni/include/legopathedgecontainer.h b/LEGO1/lego/legoomni/include/legopathedgecontainer.h index bba8547b..5998f842 100644 --- a/LEGO1/lego/legoomni/include/legopathedgecontainer.h +++ b/LEGO1/lego/legoomni/include/legopathedgecontainer.h @@ -27,56 +27,61 @@ struct LegoBoundaryEdge { }; // SIZE 0x10 -struct LegoBEWithFloat { - LegoBEWithFloat() +struct LegoBEWithMidpoint { + LegoBEWithMidpoint() { m_edge = NULL; m_boundary = NULL; m_next = NULL; - m_unk0x0c = 0.0f; + m_distanceToMidpoint = 0.0f; } // FUNCTION: BETA10 0x100bd9a0 - LegoBEWithFloat(LegoPathCtrlEdge* p_edge, LegoPathBoundary* p_boundary, MxFloat p_unk0x0c) + LegoBEWithMidpoint(LegoPathCtrlEdge* p_edge, LegoPathBoundary* p_boundary, MxFloat p_distanceToMidpoint) { m_edge = p_edge; m_boundary = p_boundary; m_next = NULL; - m_unk0x0c = p_unk0x0c; + m_distanceToMidpoint = p_distanceToMidpoint; } // FUNCTION: BETA10 0x100bd9f0 - LegoBEWithFloat(LegoPathCtrlEdge* p_edge, LegoPathBoundary* p_boundary, LegoBEWithFloat* p_next, MxFloat p_unk0x0c) + LegoBEWithMidpoint( + LegoPathCtrlEdge* p_edge, + LegoPathBoundary* p_boundary, + LegoBEWithMidpoint* p_next, + MxFloat p_distanceToMidpoint + ) { m_edge = p_edge; m_boundary = p_boundary; m_next = p_next; - m_unk0x0c = p_unk0x0c; + m_distanceToMidpoint = p_distanceToMidpoint; } LegoPathCtrlEdge* m_edge; // 0x00 LegoPathBoundary* m_boundary; // 0x04 - LegoBEWithFloat* m_next; // 0x08 - MxFloat m_unk0x0c; // 0x0c + LegoBEWithMidpoint* m_next; // 0x08 + MxFloat m_distanceToMidpoint; // 0x0c - int operator==(LegoBEWithFloat) const { return 0; } - int operator<(LegoBEWithFloat) const { return 0; } + int operator==(LegoBEWithMidpoint) const { return 0; } + int operator<(LegoBEWithMidpoint) const { return 0; } }; -struct LegoBEWithFloatComparator { +struct LegoBEWithMidpointComparator { // FUNCTION: BETA10 0x100bef80 - bool operator()(LegoBEWithFloat* const& p_a, LegoBEWithFloat* const& p_b) const + bool operator()(LegoBEWithMidpoint* const& p_a, LegoBEWithMidpoint* const& p_b) const { - return p_a->m_unk0x0c < p_b->m_unk0x0c; + return p_a->m_distanceToMidpoint < p_b->m_distanceToMidpoint; } }; -typedef multiset LegoBEWithFloatSet; +typedef multiset LegoBEWithMidpointSet; // SIZE 0x3c struct LegoPathEdgeContainer : public list { enum { - c_bit1 = 0x01 + c_hasPath = 0x01 }; // FUNCTION: BETA10 0x100118e0 @@ -87,18 +92,18 @@ struct LegoPathEdgeContainer : public list { } // FUNCTION: BETA10 0x100bd660 - void SetBit1(MxU32 p_set) + void SetPath(MxU32 p_set) { if (p_set) { - m_flags |= c_bit1; + m_flags |= c_hasPath; } else { - m_flags &= ~c_bit1; + m_flags &= ~c_hasPath; } } // FUNCTION: BETA10 0x1001cb50 - MxU32 GetBit1() { return m_flags & c_bit1; } + MxU32 HasPath() { return m_flags & c_hasPath; } Mx3DPointFloat m_position; // 0x0c Mx3DPointFloat m_direction; // 0x20 diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index dcd7cb40..187931b5 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -181,7 +181,7 @@ MxResult Act2Actor::HitActor(LegoPathActor*, MxBool) // FUNCTION: LEGO1 0x10018a20 MxResult Act2Actor::VTable0x9c() { - if (m_grec && !m_grec->GetBit1()) { + if (m_grec && !m_grec->HasPath()) { delete m_grec; m_grec = NULL; return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/actors/act3actors.cpp b/LEGO1/lego/legoomni/src/actors/act3actors.cpp index d4e82e40..af36e119 100644 --- a/LEGO1/lego/legoomni/src/actors/act3actors.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3actors.cpp @@ -510,7 +510,7 @@ MxResult Act3Cop::FUN_10040360() // FUNCTION: BETA10 0x1001942c MxResult Act3Cop::VTable0x9c() { - if (m_grec && !m_grec->GetBit1()) { + if (m_grec && !m_grec->HasPath()) { delete m_grec; m_grec = NULL; m_lastTime = Timer()->GetTime(); @@ -1120,7 +1120,7 @@ void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEd // FUNCTION: BETA10 0x1001b75b MxResult Act3Brickster::VTable0x9c() { - if (m_grec && !m_grec->GetBit1()) { + if (m_grec && !m_grec->HasPath()) { delete m_grec; m_grec = NULL; m_lastTime = Timer()->GetTime(); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 803fc222..85e29f7e 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -630,7 +630,7 @@ MxResult LegoPathActor::VTable0x9c() MxU32 local20 = 1; if (m_grec != NULL) { - if (m_grec->GetBit1()) { + if (m_grec->HasPath()) { local1c = 0; local20 = 0; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index abf16351..27c9fc2a 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -775,22 +775,22 @@ MxResult LegoPathController::FUN_10048310( p_grec->m_boundary = p_newBoundary; if (p_newBoundary == p_oldBoundary) { - p_grec->SetBit1(TRUE); + p_grec->SetPath(TRUE); return SUCCESS; } - list boundaryList; - list::iterator boundaryListIt; + list boundaryList; + list::iterator boundaryListIt; - LegoBEWithFloatSet boundarySet; - LegoBEWithFloatSet::iterator boundarySetItA; - LegoBEWithFloatSet::iterator boundarySetItB; + LegoBEWithMidpointSet boundarySet; + LegoBEWithMidpointSet::iterator boundarySetItA; + LegoBEWithMidpointSet::iterator boundarySetItB; LegoPathCtrlEdgeSet pathCtrlEdgeSet(m_pfsE); MxFloat local14 = 999999.0f; - p_grec->SetBit1(FALSE); + p_grec->SetPath(FALSE); for (MxS32 i = 0; i < p_oldBoundary->GetNumEdges(); i++) { LegoPathCtrlEdge* edge = (LegoPathCtrlEdge*) p_oldBoundary->GetEdges()[i]; @@ -805,12 +805,13 @@ MxResult LegoPathController::FUN_10048310( local14) { local14 = dist; p_grec->erase(p_grec->begin(), p_grec->end()); - p_grec->SetBit1(TRUE); + p_grec->SetPath(TRUE); p_grec->push_back(LegoBoundaryEdge(edge, p_oldBoundary)); } } else { - boundaryList.push_back(LegoBEWithFloat(edge, p_oldBoundary, edge->DistanceToMidpoint(p_oldPosition)) + boundaryList.push_back( + LegoBEWithMidpoint(edge, p_oldBoundary, edge->DistanceToMidpoint(p_oldPosition)) ); boundarySet.insert(&boundaryList.back()); } @@ -820,9 +821,9 @@ MxResult LegoPathController::FUN_10048310( pathCtrlEdgeSet.erase(edge); } - if (!p_grec->GetBit1()) { + if (!p_grec->HasPath()) { while (pathCtrlEdgeSet.size() > 0) { - LegoBEWithFloat edgeWithFloat; + LegoBEWithMidpoint edgeWithFloat; MxFloat local70 = 999999.0f; boundarySetItA = boundarySetItB = boundarySet.begin(); @@ -848,11 +849,12 @@ MxResult LegoPathController::FUN_10048310( if (bOther == p_newBoundary) { shouldRemove = FALSE; - LegoBEWithFloat* pfs = *boundarySetItA; + LegoBEWithMidpoint* pfs = *boundarySetItA; assert(pfs); float dist; - if ((dist = pfs->m_edge->DistanceToMidpoint(p_newPosition) + pfs->m_unk0x0c) < local70) { + if ((dist = pfs->m_edge->DistanceToMidpoint(p_newPosition) + pfs->m_distanceToMidpoint) < + local70) { edgeWithFloat.m_edge = NULL; local70 = dist; @@ -860,7 +862,7 @@ MxResult LegoPathController::FUN_10048310( if (dist < local14) { local14 = dist; p_grec->erase(p_grec->begin(), p_grec->end()); - p_grec->SetBit1(TRUE); + p_grec->SetPath(TRUE); do { p_grec->push_front(LegoBoundaryEdge(pfs->m_edge, pfs->m_boundary)); @@ -878,10 +880,10 @@ MxResult LegoPathController::FUN_10048310( shouldRemove = FALSE; float dist; - if ((dist = edge->DistanceBetweenMidpoints(*e) + (*boundarySetItA)->m_unk0x0c) < - local70) { + if ((dist = edge->DistanceBetweenMidpoints(*e) + + (*boundarySetItA)->m_distanceToMidpoint) < local70) { local70 = dist; - edgeWithFloat = LegoBEWithFloat(edge, bOther, *boundarySetItA, dist); + edgeWithFloat = LegoBEWithMidpoint(edge, bOther, *boundarySetItA, dist); } } } @@ -913,7 +915,7 @@ MxResult LegoPathController::FUN_10048310( } } - if (p_grec->GetBit1()) { + if (p_grec->HasPath()) { if (p_grec->size() > 0) { LegoPathCtrlEdge* edge = p_grec->front().m_edge; @@ -959,7 +961,7 @@ MxS32 LegoPathController::FUN_1004a240( p_v1 = p_grec.m_position; p_v2 = p_grec.m_direction; p_boundary = p_grec.m_boundary; - p_grec.SetBit1(FALSE); + p_grec.SetPath(FALSE); return 1; }