From 96e32a255ca16d6363516bdee1e12e1a30fd5ffd Mon Sep 17 00:00:00 2001 From: jonschz Date: Sat, 27 Jul 2024 08:20:26 +0200 Subject: [PATCH] Implement/match the rest of `LegoRaceCar` --- LEGO1/lego/legoomni/include/legoracers.h | 7 +- LEGO1/lego/legoomni/src/race/legoracers.cpp | 79 ++++++++++++++------- 2 files changed, 59 insertions(+), 27 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoracers.h b/LEGO1/lego/legoomni/include/legoracers.h index ab5310a7..634874eb 100644 --- a/LEGO1/lego/legoomni/include/legoracers.h +++ b/LEGO1/lego/legoomni/include/legoracers.h @@ -11,8 +11,9 @@ // SIZE 0x08 struct EdgeReference { - const char* m_name; // 0x00 - LegoPathBoundary* m_data; // 0x04 + const char* m_name; // 0x00 + // name verified by BETA10 0x100cbee6 + LegoPathBoundary* m_b; // 0x04 }; // SIZE 0x10 @@ -86,7 +87,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { LegoPathBoundary* m_unk0x78; // 0x78 LegoPathBoundary* m_unk0x7c; // 0x7c - static EdgeReference g_edgeReferences[]; + static EdgeReference g_skBMap[]; // name verified by BETA10 0x100cbee6 static const SkeletonKickPhase g_skeletonKickPhases[]; static const char* g_strSpeed; static const char* g_srtsl18to29[]; diff --git a/LEGO1/lego/legoomni/src/race/legoracers.cpp b/LEGO1/lego/legoomni/src/race/legoracers.cpp index 355f3b79..f41b0e90 100644 --- a/LEGO1/lego/legoomni/src/race/legoracers.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracers.cpp @@ -22,7 +22,7 @@ DECOMP_SIZE_ASSERT(SkeletonKickPhase, 0x10) DECOMP_SIZE_ASSERT(LegoRaceCar, 0x200) // GLOBAL: LEGO1 0x100f0a20 -EdgeReference LegoRaceCar::g_edgeReferences[] = { +EdgeReference LegoRaceCar::g_skBMap[] = { {// STRING: LEGO1 0x100f0a10 "EDG03_772", NULL @@ -51,18 +51,18 @@ EdgeReference LegoRaceCar::g_edgeReferences[] = { // GLOBAL: LEGO1 0x100f0a50 const SkeletonKickPhase LegoRaceCar::g_skeletonKickPhases[] = { - {&LegoRaceCar::g_edgeReferences[0], 0.1, 0.2, LEGORACECAR_KICK2}, - {&LegoRaceCar::g_edgeReferences[1], 0.2, 0.3, LEGORACECAR_KICK2}, - {&LegoRaceCar::g_edgeReferences[2], 0.3, 0.4, LEGORACECAR_KICK2}, - {&LegoRaceCar::g_edgeReferences[2], 0.6, 0.7, LEGORACECAR_KICK1}, - {&LegoRaceCar::g_edgeReferences[1], 0.7, 0.8, LEGORACECAR_KICK1}, - {&LegoRaceCar::g_edgeReferences[0], 0.8, 0.9, LEGORACECAR_KICK1}, - {&LegoRaceCar::g_edgeReferences[3], 0.1, 0.2, LEGORACECAR_KICK1}, - {&LegoRaceCar::g_edgeReferences[4], 0.2, 0.3, LEGORACECAR_KICK1}, - {&LegoRaceCar::g_edgeReferences[5], 0.3, 0.4, LEGORACECAR_KICK1}, - {&LegoRaceCar::g_edgeReferences[5], 0.6, 0.7, LEGORACECAR_KICK2}, - {&LegoRaceCar::g_edgeReferences[4], 0.7, 0.8, LEGORACECAR_KICK2}, - {&LegoRaceCar::g_edgeReferences[3], 0.8, 0.9, LEGORACECAR_KICK2}, + {&LegoRaceCar::g_skBMap[0], 0.1, 0.2, LEGORACECAR_KICK2}, + {&LegoRaceCar::g_skBMap[1], 0.2, 0.3, LEGORACECAR_KICK2}, + {&LegoRaceCar::g_skBMap[2], 0.3, 0.4, LEGORACECAR_KICK2}, + {&LegoRaceCar::g_skBMap[2], 0.6, 0.7, LEGORACECAR_KICK1}, + {&LegoRaceCar::g_skBMap[1], 0.7, 0.8, LEGORACECAR_KICK1}, + {&LegoRaceCar::g_skBMap[0], 0.8, 0.9, LEGORACECAR_KICK1}, + {&LegoRaceCar::g_skBMap[3], 0.1, 0.2, LEGORACECAR_KICK1}, + {&LegoRaceCar::g_skBMap[4], 0.2, 0.3, LEGORACECAR_KICK1}, + {&LegoRaceCar::g_skBMap[5], 0.3, 0.4, LEGORACECAR_KICK1}, + {&LegoRaceCar::g_skBMap[5], 0.6, 0.7, LEGORACECAR_KICK2}, + {&LegoRaceCar::g_skBMap[4], 0.7, 0.8, LEGORACECAR_KICK2}, + {&LegoRaceCar::g_skBMap[3], 0.8, 0.9, LEGORACECAR_KICK2}, }; // GLOBAL: LEGO1 0x100f0b10 @@ -213,8 +213,8 @@ void LegoRaceCar::ParseAction(char* p_extra) const char* edge0354 = "EDG03_54"; m_unk0x7c = currentWorld->FindPathBoundary(edge0354); - for (MxS32 j = 0; j < sizeOfArray(g_edgeReferences); j++) { - g_edgeReferences[j].m_data = currentWorld->FindPathBoundary(g_edgeReferences[j].m_name); + for (MxS32 j = 0; j < sizeOfArray(g_skBMap); j++) { + g_skBMap[j].m_b = currentWorld->FindPathBoundary(g_skBMap[j].m_name); } } } @@ -294,7 +294,7 @@ MxU32 LegoRaceCar::HandleSkeletonKicks(float p_param1) float skeletonCurAnimPhase = skeletonCurAnimPosition / skeletonCurAnimDuration; for (MxS32 i = 0; i < sizeOfArray(g_skeletonKickPhases); i++) { - if (m_boundary == current->m_edgeRef->m_data && current->m_lower <= skeletonCurAnimPhase && + if (m_boundary == current->m_edgeRef->m_b && current->m_lower <= skeletonCurAnimPhase && skeletonCurAnimPhase <= current->m_upper) { m_userState = current->m_userState; } @@ -451,14 +451,45 @@ MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) return SUCCESS; } -// STUB: LEGO1 0x10013600 +// FUNCTION: LEGO1 0x10013600 +// FUNCTION: BETA10 0x100cbe60 MxResult LegoRaceCar::VTable0x9c() { - // TODO - return SUCCESS; + MxResult result; + + if (m_userNavFlag) { + result = LegoCarRaceActor::VTable0x9c(); + + if (m_boundary) { + MxS32 bVar2 = 0; + + for (MxS32 i = 0; i < sizeOfArray(g_skBMap); i++) { + assert(g_skBMap[i].m_b); + if (m_boundary == g_skBMap[i].m_b) { + bVar2 = 1; + break; + } + } + + if (m_userState == LEGORACECAR_UNKNOWN_1) { + if (!bVar2) { + m_userState = LEGORACECAR_UNKNOWN_0; + } + } + else { + m_userState = LEGORACECAR_UNKNOWN_1; + } + } + } + else { + result = LegoCarRaceActor::VTable0x9c(); + } + + return result; } -// STUB: LEGO1 0x10014500 +// FUNCTION: LEGO1 0x10014500 +// FUNCTION: BETA10 0x100cd5e0 MxU32 LegoRaceCar::VTable0x6c( LegoPathBoundary* p_boundary, Vector3& p_v1, @@ -468,12 +499,12 @@ MxU32 LegoRaceCar::VTable0x6c( Vector3& p_v3 ) { - // TODO - return 0; + return LegoCarRaceActor::VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3); } -// STUB: LEGO1 0x10014560 +// FUNCTION: LEGO1 0x10014560 +// FUNCTION: BETA10 0x100cd660 void LegoRaceCar::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { - // TODO + LegoCarRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4); }