This commit is contained in:
Christian Semmler 2024-12-05 18:11:07 -07:00
parent 6da5b39430
commit f4c124ea86
3 changed files with 58 additions and 8 deletions

View File

@ -32,7 +32,7 @@ struct LegoBoundaryEdgeWithFloat {
{
m_edge = NULL;
m_boundary = NULL;
m_unk0x08 = 0;
m_next = NULL;
m_unk0x0c = 0.0f;
}
@ -41,14 +41,28 @@ struct LegoBoundaryEdgeWithFloat {
{
m_edge = p_edge;
m_boundary = p_boundary;
m_unk0x08 = 0;
m_next = NULL;
m_unk0x0c = p_unk0x0c;
}
LegoPathCtrlEdge* m_edge; // 0x00
LegoPathBoundary* m_boundary; // 0x04
undefined4 m_unk0x08; // 0x08
MxFloat m_unk0x0c; // 0x0c
// FUNCTION: BETA10 0x100bd9f0
LegoBoundaryEdgeWithFloat(
LegoPathCtrlEdge* p_edge,
LegoPathBoundary* p_boundary,
LegoBoundaryEdgeWithFloat* p_next,
MxFloat p_unk0x0c
)
{
m_edge = p_edge;
m_boundary = p_boundary;
m_next = p_next;
m_unk0x0c = p_unk0x0c;
}
LegoPathCtrlEdge* m_edge; // 0x00
LegoPathBoundary* m_boundary; // 0x04
LegoBoundaryEdgeWithFloat* m_next; // 0x08
MxFloat m_unk0x0c; // 0x0c
int operator==(LegoBoundaryEdgeWithFloat) const { return 0; }
int operator<(LegoBoundaryEdgeWithFloat) const { return 0; }

View File

@ -832,12 +832,35 @@ MxResult LegoPathController::FUN_10048310(
edgeWithFloat.m_edge = NULL;
if (dist < local14) {
// TODO
local14 = dist;
p_grec->erase(p_grec->begin(), p_grec->end());
p_grec->SetBit1(TRUE);
do {
p_grec->push_front(LegoBoundaryEdge(pfs->m_edge, pfs->m_boundary));
pfs = pfs->m_next;
} while (pfs != NULL);
}
}
}
else {
// TODO
for (MxS32 i = 0; i < bOther->GetNumEdges(); i++) {
LegoPathCtrlEdge* edge = (LegoPathCtrlEdge*) p_oldBoundary->GetEdges()[i];
if (edge->GetMask0x03()) {
if (pathCtrlEdgeSet.find(edge) != pathCtrlEdgeSet.end()) {
shouldRemove = FALSE;
float dist = edge->DistanceBetweenMidpoints(*e) + (*boundarySetItA)->m_unk0x0c;
if (dist < local70) {
local70 = dist;
edgeWithFloat =
LegoBoundaryEdgeWithFloat(edge, bOther, *boundarySetItA, dist);
}
}
}
}
}
}

View File

@ -74,6 +74,19 @@ struct LegoUnknown100db7f4 : public LegoEdge {
return sqrt(point.LenSquared());
}
// FUNCTION: BETA10 0x100bd540
LegoFloat DistanceBetweenMidpoints(const LegoUnknown100db7f4& p_other)
{
Mx3DPointFloat point1(*m_pointA);
Mx3DPointFloat point2(*p_other.m_pointA);
((Vector3&) point1).Add(*m_pointB);
((Vector3&) point1).Mul(0.5f);
((Vector3&) point2).Add(*m_pointB);
((Vector3&) point2).Mul(0.5f);
((Vector3&) point1).Sub(point2);
return sqrt(point1.LenSquared());
}
// FUNCTION: BETA10 0x1001cc60
LegoU32 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); }