Refactor LegoPathController variable names

This commit is contained in:
Florian Kaiser 2025-05-12 10:24:57 +02:00
parent 81f28f149f
commit c3b8a6e150
2 changed files with 53 additions and 53 deletions

View File

@ -189,12 +189,12 @@ class LegoPathController : public MxCore {
LegoPathBoundary* m_boundaries; // 0x08 LegoPathBoundary* m_boundaries; // 0x08
LegoPathCtrlEdge* m_edges; // 0x0c LegoPathCtrlEdge* m_edges; // 0x0c
Mx3DPointFloat* m_unk0x10; // 0x10 Mx3DPointFloat* m_nodes; // 0x10
LegoPathStruct* m_structs; // 0x14 LegoPathStruct* m_structs; // 0x14
MxU16 m_numL; // 0x18 MxU16 m_numBoundaries; // 0x18
MxU16 m_numE; // 0x1a MxU16 m_numEdges; // 0x1a
MxU16 m_numN; // 0x1c MxU16 m_numNodes; // 0x1c
MxU16 m_numT; // 0x1e MxU16 m_numStructs; // 0x1e
LegoPathCtrlEdgeSet m_pfsE; // 0x20 LegoPathCtrlEdgeSet m_pfsE; // 0x20
LegoPathActorSet m_actors; // 0x30 LegoPathActorSet m_actors; // 0x30

View File

@ -71,12 +71,12 @@ LegoPathController::LegoPathController()
{ {
m_boundaries = NULL; m_boundaries = NULL;
m_edges = NULL; m_edges = NULL;
m_unk0x10 = NULL; m_nodes = NULL;
m_structs = NULL; m_structs = NULL;
m_numL = 0; m_numBoundaries = 0;
m_numE = 0; m_numEdges = 0;
m_numN = 0; m_numNodes = 0;
m_numT = 0; m_numStructs = 0;
} }
// FUNCTION: LEGO1 0x10045880 // FUNCTION: LEGO1 0x10045880
@ -89,15 +89,15 @@ MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, con
if ((result = Read(&storage)) == SUCCESS) { if ((result = Read(&storage)) == SUCCESS) {
MxS32 i; MxS32 i;
for (i = 0; i < m_numT; i++) { for (i = 0; i < m_numStructs; i++) {
m_structs[i].SetAtomId(p_trigger); m_structs[i].SetAtomId(p_trigger);
} }
for (i = 0; i < m_numN; i++) { for (i = 0; i < m_numNodes; i++) {
m_unk0x10[i] += p_location; m_nodes[i] += p_location;
} }
for (i = 0; i < m_numL; i++) { for (i = 0; i < m_numBoundaries; i++) {
LegoPathBoundary& boundary = m_boundaries[i]; LegoPathBoundary& boundary = m_boundaries[i];
MxS32 j; MxS32 j;
@ -142,25 +142,25 @@ void LegoPathController::Destroy()
delete[] m_boundaries; delete[] m_boundaries;
} }
m_boundaries = NULL; m_boundaries = NULL;
m_numL = 0; m_numBoundaries = 0;
if (m_unk0x10 != NULL) { if (m_nodes != NULL) {
delete[] m_unk0x10; delete[] m_nodes;
} }
m_unk0x10 = NULL; m_nodes = NULL;
m_numN = 0; m_numNodes = 0;
if (m_structs != NULL) { if (m_structs != NULL) {
delete[] m_structs; delete[] m_structs;
} }
m_structs = NULL; m_structs = NULL;
m_numT = 0; m_numStructs = 0;
if (m_edges != NULL) { if (m_edges != NULL) {
delete[] m_edges; delete[] m_edges;
} }
m_edges = NULL; m_edges = NULL;
m_numE = 0; m_numEdges = 0;
MxS32 j; MxS32 j;
for (j = 0; j < sizeOfArray(g_unk0x100f42f0); j++) { for (j = 0; j < sizeOfArray(g_unk0x100f42f0); j++) {
@ -253,7 +253,7 @@ MxResult LegoPathController::PlaceActor(
p_actor->SetController(NULL); p_actor->SetController(NULL);
} }
for (MxS32 i = 0; i < m_numL; i++) { for (MxS32 i = 0; i < m_numBoundaries; i++) {
LegoPathBoundary& b = m_boundaries[i]; LegoPathBoundary& b = m_boundaries[i];
LegoAnimPresenterSet& presenters = b.GetPresenters(); LegoAnimPresenterSet& presenters = b.GetPresenters();
LegoAnimPresenter* presenter = p_presenter; LegoAnimPresenter* presenter = p_presenter;
@ -333,7 +333,7 @@ MxResult LegoPathController::RemoveActor(LegoPathActor* p_actor)
p_actor->VTable0xc4(); p_actor->VTable0xc4();
m_actors.erase(p_actor); m_actors.erase(p_actor);
for (MxS32 i = 0; i < m_numL; i++) { for (MxS32 i = 0; i < m_numBoundaries; i++) {
if (m_boundaries[i].RemoveActor(p_actor) == SUCCESS) { if (m_boundaries[i].RemoveActor(p_actor) == SUCCESS) {
result = SUCCESS; result = SUCCESS;
} }
@ -346,7 +346,7 @@ MxResult LegoPathController::RemoveActor(LegoPathActor* p_actor)
// FUNCTION: BETA10 0x100b72f7 // FUNCTION: BETA10 0x100b72f7
void LegoPathController::FUN_100468f0(LegoAnimPresenter* p_presenter) void LegoPathController::FUN_100468f0(LegoAnimPresenter* p_presenter)
{ {
for (MxS32 i = 0; i < m_numL; i++) { for (MxS32 i = 0; i < m_numBoundaries; i++) {
if (!(m_boundaries[i].m_flags & LegoWEGEdge::c_bit3)) { if (!(m_boundaries[i].m_flags & LegoWEGEdge::c_bit3)) {
m_boundaries[i].FUN_10057fe0(p_presenter); m_boundaries[i].FUN_10057fe0(p_presenter);
} }
@ -357,7 +357,7 @@ void LegoPathController::FUN_100468f0(LegoAnimPresenter* p_presenter)
// FUNCTION: BETA10 0x100b737b // FUNCTION: BETA10 0x100b737b
void LegoPathController::FUN_10046930(LegoAnimPresenter* p_presenter) void LegoPathController::FUN_10046930(LegoAnimPresenter* p_presenter)
{ {
for (MxS32 i = 0; i < m_numL; i++) { for (MxS32 i = 0; i < m_numBoundaries; i++) {
m_boundaries[i].FUN_100586e0(p_presenter); m_boundaries[i].FUN_100586e0(p_presenter);
} }
} }
@ -385,7 +385,7 @@ void LegoPathController::FUN_10046970()
MxResult LegoPathController::FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL) MxResult LegoPathController::FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL)
{ {
p_boundaries = m_boundaries; p_boundaries = m_boundaries;
p_numL = m_numL; p_numL = m_numBoundaries;
return SUCCESS; return SUCCESS;
} }
@ -393,7 +393,7 @@ MxResult LegoPathController::FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32
// FUNCTION: BETA10 0x100b7531 // FUNCTION: BETA10 0x100b7531
LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name) LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name)
{ {
for (MxS32 i = 0; i < m_numL; i++) { for (MxS32 i = 0; i < m_numBoundaries; i++) {
if (!strcmpi(m_boundaries[i].GetName(), p_name)) { if (!strcmpi(m_boundaries[i].GetName(), p_name)) {
return &m_boundaries[i]; return &m_boundaries[i];
} }
@ -406,7 +406,7 @@ LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name)
// FUNCTION: BETA10 0x100b75bc // FUNCTION: BETA10 0x100b75bc
void LegoPathController::FUN_10046bb0(LegoWorld* p_world) void LegoPathController::FUN_10046bb0(LegoWorld* p_world)
{ {
for (MxS32 i = 0; i < m_numT; i++) { for (MxS32 i = 0; i < m_numStructs; i++) {
m_structs[i].SetWorld(p_world); m_structs[i].SetWorld(p_world);
} }
} }
@ -461,55 +461,55 @@ MxResult LegoPathController::Reset()
// FUNCTION: BETA10 0x100b781f // FUNCTION: BETA10 0x100b781f
MxResult LegoPathController::Read(LegoStorage* p_storage) MxResult LegoPathController::Read(LegoStorage* p_storage)
{ {
if (p_storage->Read(&m_numT, sizeof(m_numT)) != SUCCESS) { if (p_storage->Read(&m_numStructs, sizeof(m_numStructs)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
if (m_numT > 0) { if (m_numStructs > 0) {
m_structs = new LegoPathStruct[m_numT]; m_structs = new LegoPathStruct[m_numStructs];
} }
if (p_storage->Read(&m_numN, sizeof(m_numN)) != SUCCESS) { if (p_storage->Read(&m_numNodes, sizeof(m_numNodes)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
if (m_numN > 0) { if (m_numNodes > 0) {
m_unk0x10 = new Mx3DPointFloat[m_numN]; m_nodes = new Mx3DPointFloat[m_numNodes];
} }
if (p_storage->Read(&m_numE, sizeof(m_numE)) != SUCCESS) { if (p_storage->Read(&m_numEdges, sizeof(m_numEdges)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
if (m_numE > 0) { if (m_numEdges > 0) {
m_edges = new LegoPathCtrlEdge[m_numE]; m_edges = new LegoPathCtrlEdge[m_numEdges];
} }
if (p_storage->Read(&m_numL, sizeof(m_numL)) != SUCCESS) { if (p_storage->Read(&m_numBoundaries, sizeof(m_numBoundaries)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
if (m_numL > 0) { if (m_numBoundaries > 0) {
m_boundaries = new LegoPathBoundary[m_numL]; m_boundaries = new LegoPathBoundary[m_numBoundaries];
} }
if (m_numT > 0 && ReadStructs(p_storage) != SUCCESS) { if (m_numStructs > 0 && ReadStructs(p_storage) != SUCCESS) {
return FAILURE; return FAILURE;
} }
if (m_numN > 0) { if (m_numNodes > 0) {
for (MxS32 i = 0; i < m_numN; i++) { for (MxS32 i = 0; i < m_numNodes; i++) {
if (ReadVector(p_storage, m_unk0x10[i]) != SUCCESS) { if (ReadVector(p_storage, m_nodes[i]) != SUCCESS) {
return FAILURE; return FAILURE;
} }
} }
} }
if (m_numE > 0 && ReadEdges(p_storage) != SUCCESS) { if (m_numEdges > 0 && ReadEdges(p_storage) != SUCCESS) {
return FAILURE; return FAILURE;
} }
if (m_numL > 0 && ReadBoundaries(p_storage) != SUCCESS) { if (m_numBoundaries > 0 && ReadBoundaries(p_storage) != SUCCESS) {
return FAILURE; return FAILURE;
} }
for (MxS32 j = 0; j < m_numE; j++) { for (MxS32 j = 0; j < m_numEdges; j++) {
m_pfsE.insert(&m_edges[j]); m_pfsE.insert(&m_edges[j]);
} }
@ -520,7 +520,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage)
// FUNCTION: BETA10 0x100b7cd6 // FUNCTION: BETA10 0x100b7cd6
MxResult LegoPathController::ReadStructs(LegoStorage* p_storage) MxResult LegoPathController::ReadStructs(LegoStorage* p_storage)
{ {
for (MxS32 i = 0; i < m_numT; i++) { for (MxS32 i = 0; i < m_numStructs; i++) {
MxU8 length = 0; MxU8 length = 0;
if (p_storage->Read(&length, sizeof(length)) != SUCCESS) { if (p_storage->Read(&length, sizeof(length)) != SUCCESS) {
@ -549,7 +549,7 @@ MxResult LegoPathController::ReadStructs(LegoStorage* p_storage)
// FUNCTION: BETA10 0x100b7df3 // FUNCTION: BETA10 0x100b7df3
MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
{ {
for (MxS32 i = 0; i < m_numE; i++) { for (MxS32 i = 0; i < m_numEdges; i++) {
LegoPathCtrlEdge& edge = m_edges[i]; LegoPathCtrlEdge& edge = m_edges[i];
MxU16 s; MxU16 s;
@ -560,12 +560,12 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
edge.m_pointA = &m_unk0x10[s]; edge.m_pointA = &m_nodes[s];
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
edge.m_pointB = &m_unk0x10[s]; edge.m_pointB = &m_nodes[s];
if (edge.m_flags & LegoUnknown100db7f4::c_bit3) { if (edge.m_flags & LegoUnknown100db7f4::c_bit3) {
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
@ -617,7 +617,7 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
// FUNCTION: BETA10 0x100b8293 // FUNCTION: BETA10 0x100b8293
MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
{ {
for (MxS32 i = 0; i < m_numL; i++) { for (MxS32 i = 0; i < m_numBoundaries; i++) {
LegoPathBoundary& boundary = m_boundaries[i]; LegoPathBoundary& boundary = m_boundaries[i];
MxU8 numE; MxU8 numE;
MxU16 s; MxU16 s;
@ -975,7 +975,7 @@ MxResult LegoPathController::FUN_1004a380(
Mx3DPointFloat local24; Mx3DPointFloat local24;
MxU32 local8 = TRUE; MxU32 local8 = TRUE;
for (MxS32 i = 0; i < m_numL; i++) { for (MxS32 i = 0; i < m_numBoundaries; i++) {
if (m_boundaries[i].m_flags & LegoPathBoundary::c_bit3) { if (m_boundaries[i].m_flags & LegoPathBoundary::c_bit3) {
continue; continue;
} }