Clear unknowns in LegoPathEdgeContainer and LegoBEWithFloat (#1723)

Renames `LegoBEWithFloat` also to `LegoBEWithMidpoint` to be more specific.
This commit is contained in:
Fabian Neundorf 2026-01-18 15:50:17 +01:00 committed by GitHub
parent 8b0b6d9082
commit 01c92d1966
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 69 additions and 62 deletions

View File

@ -291,58 +291,58 @@ class LegoPathController : public MxCore {
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Ubound
// TEMPLATE: LEGO1 0x100493a0
// list<LegoBEWithFloat,allocator<LegoBEWithFloat> >::~list<LegoBEWithFloat,allocator<LegoBEWithFloat> >
// list<LegoBEWithMidpoint,allocator<LegoBEWithMidpoint> >::~list<LegoBEWithMidpoint,allocator<LegoBEWithMidpoint> >
// TEMPLATE: LEGO1 0x10049410
// list<LegoBEWithFloat,allocator<LegoBEWithFloat> >::insert
// list<LegoBEWithMidpoint,allocator<LegoBEWithMidpoint> >::insert
// TEMPLATE: LEGO1 0x10049470
// list<LegoBEWithFloat,allocator<LegoBEWithFloat> >::_Buynode
// list<LegoBEWithMidpoint,allocator<LegoBEWithMidpoint> >::_Buynode
// TEMPLATE: LEGO1 0x100494a0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::iterator::_Inc
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::iterator::_Inc
// TEMPLATE: LEGO1 0x100494e0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::~_Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFlo
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::~_Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithFlo
// TEMPLATE: LEGO1 0x100495b0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::insert
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::insert
// TEMPLATE: LEGO1 0x10049840
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::iterator::_Dec
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::iterator::_Dec
// TEMPLATE: LEGO1 0x10049890
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::erase
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::erase
// TEMPLATE: LEGO1 0x10049cf0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Buynode
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Buynode
// TEMPLATE: LEGO1 0x10049d50
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Init
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Init
// TEMPLATE: LEGO1 0x10049e00
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Insert
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Insert
// TEMPLATE: LEGO1 0x10049d10
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Erase
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Erase
// TEMPLATE: LEGO1 0x1004a090
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Lrotate
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Lrotate
// TEMPLATE: LEGO1 0x1004a0f0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Rrotate
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Rrotate
// TEMPLATE: LEGO1 0x1004a150
// List<LegoBEWithFloat>::~List<LegoBEWithFloat>
// List<LegoBEWithMidpoint>::~List<LegoBEWithMidpoint>
// TEMPLATE: LEGO1 0x1004a1a0
// Multiset<LegoBEWithFloat *,LegoBEWithFloatComparator>::~Multiset<LegoBEWithFloat *,LegoBEWithFloatComparator>
// Multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator>::~Multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator>
// TEMPLATE: LEGO1 0x1004a1f0
// multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::~multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >
// multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::~multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >
// 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<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Nil
// GLOBAL: LEGO1 0x100f4364
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Nil
// _Tree<LegoBEWithMidpoint *,LegoBEWithMidpoint *,multiset<LegoBEWithMidpoint *,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Kfn,LegoBEWithMidpointComparator,allocator<LegoBEWithMidpoint *> >::_Nil
// clang-format on
#endif // LEGOPATHCONTROLLER_H

View File

@ -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<LegoBEWithFloat*, LegoBEWithFloatComparator> LegoBEWithFloatSet;
typedef multiset<LegoBEWithMidpoint*, LegoBEWithMidpointComparator> LegoBEWithMidpointSet;
// SIZE 0x3c
struct LegoPathEdgeContainer : public list<LegoBoundaryEdge> {
enum {
c_bit1 = 0x01
c_hasPath = 0x01
};
// FUNCTION: BETA10 0x100118e0
@ -87,18 +92,18 @@ struct LegoPathEdgeContainer : public list<LegoBoundaryEdge> {
}
// 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

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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<LegoBEWithFloat> boundaryList;
list<LegoBEWithFloat>::iterator boundaryListIt;
list<LegoBEWithMidpoint> boundaryList;
list<LegoBEWithMidpoint>::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;
}