Add BETA10 assertions in LegoPathController

This commit is contained in:
jonschz 2025-06-11 23:16:41 +02:00
parent bc481cc1c5
commit c86f320ede
2 changed files with 19 additions and 0 deletions

View File

@ -559,27 +559,32 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
assert(s < m_numN);
edge.m_pointA = &m_nodes[s];
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
assert(s < m_numN);
edge.m_pointB = &m_nodes[s];
if (edge.m_flags & LegoOrientedEdge::c_hasFaceA) {
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
assert(s < m_numL);
edge.m_faceA = &m_boundaries[s];
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
assert(s < m_numE);
edge.m_ccwA = &m_edges[s];
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
assert(s < m_numE);
edge.m_cwA = &m_edges[s];
}
@ -587,16 +592,19 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
assert(s < m_numL);
edge.m_faceB = &m_boundaries[s];
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
assert(s < m_numE);
edge.m_ccwB = &m_edges[s];
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
assert(s < m_numE);
edge.m_cwB = &m_edges[s];
}
@ -617,15 +625,21 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
{
for (MxS32 i = 0; i < m_numL; i++) {
#ifdef BETA10
Mx4DPointFloat unused;
#endif
LegoPathBoundary& boundary = m_boundaries[i];
MxU8 numE;
MxU16 s;
MxU8 j;
if (p_storage->Read(&numE, sizeof(numE)) != SUCCESS) {
return FAILURE;
}
assert(numE > 2);
boundary.m_edgeNormals = new Mx4DPointFloat[numE];
LegoOrientedEdge** edges = new LegoOrientedEdge*[numE];
@ -636,6 +650,8 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
return FAILURE;
}
assert(s < m_numE);
edges[j] = &m_edges[s];
}
@ -693,6 +709,8 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
return FAILURE;
}
assert(s < m_numT);
boundary.m_pathTrigger[j].m_pathStruct = &m_structs[s];
if (p_storage->Read(&boundary.m_pathTrigger[j].m_data, sizeof(boundary.m_pathTrigger[j].m_data)) !=

View File

@ -25,6 +25,7 @@ class LegoWEEdge {
// FUNCTION: BETA10 0x100373f0
LegoU32 IsEqual(LegoWEEdge* p_other) { return this == p_other; }
// FUNCTION: BETA10 0x100bd410
void SetEdges(LegoOrientedEdge** p_edges, LegoU8 p_numEdges)
{
m_edges = p_edges;