Implement/match the rest of LegoRaceCar

This commit is contained in:
jonschz 2024-07-27 08:20:26 +02:00
parent 0d385e27d0
commit 96e32a255c
2 changed files with 59 additions and 27 deletions

View File

@ -11,8 +11,9 @@
// SIZE 0x08 // SIZE 0x08
struct EdgeReference { struct EdgeReference {
const char* m_name; // 0x00 const char* m_name; // 0x00
LegoPathBoundary* m_data; // 0x04 // name verified by BETA10 0x100cbee6
LegoPathBoundary* m_b; // 0x04
}; };
// SIZE 0x10 // SIZE 0x10
@ -86,7 +87,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap {
LegoPathBoundary* m_unk0x78; // 0x78 LegoPathBoundary* m_unk0x78; // 0x78
LegoPathBoundary* m_unk0x7c; // 0x7c LegoPathBoundary* m_unk0x7c; // 0x7c
static EdgeReference g_edgeReferences[]; static EdgeReference g_skBMap[]; // name verified by BETA10 0x100cbee6
static const SkeletonKickPhase g_skeletonKickPhases[]; static const SkeletonKickPhase g_skeletonKickPhases[];
static const char* g_strSpeed; static const char* g_strSpeed;
static const char* g_srtsl18to29[]; static const char* g_srtsl18to29[];

View File

@ -22,7 +22,7 @@ DECOMP_SIZE_ASSERT(SkeletonKickPhase, 0x10)
DECOMP_SIZE_ASSERT(LegoRaceCar, 0x200) DECOMP_SIZE_ASSERT(LegoRaceCar, 0x200)
// GLOBAL: LEGO1 0x100f0a20 // GLOBAL: LEGO1 0x100f0a20
EdgeReference LegoRaceCar::g_edgeReferences[] = { EdgeReference LegoRaceCar::g_skBMap[] = {
{// STRING: LEGO1 0x100f0a10 {// STRING: LEGO1 0x100f0a10
"EDG03_772", "EDG03_772",
NULL NULL
@ -51,18 +51,18 @@ EdgeReference LegoRaceCar::g_edgeReferences[] = {
// GLOBAL: LEGO1 0x100f0a50 // GLOBAL: LEGO1 0x100f0a50
const SkeletonKickPhase LegoRaceCar::g_skeletonKickPhases[] = { const SkeletonKickPhase LegoRaceCar::g_skeletonKickPhases[] = {
{&LegoRaceCar::g_edgeReferences[0], 0.1, 0.2, LEGORACECAR_KICK2}, {&LegoRaceCar::g_skBMap[0], 0.1, 0.2, LEGORACECAR_KICK2},
{&LegoRaceCar::g_edgeReferences[1], 0.2, 0.3, LEGORACECAR_KICK2}, {&LegoRaceCar::g_skBMap[1], 0.2, 0.3, LEGORACECAR_KICK2},
{&LegoRaceCar::g_edgeReferences[2], 0.3, 0.4, LEGORACECAR_KICK2}, {&LegoRaceCar::g_skBMap[2], 0.3, 0.4, LEGORACECAR_KICK2},
{&LegoRaceCar::g_edgeReferences[2], 0.6, 0.7, LEGORACECAR_KICK1}, {&LegoRaceCar::g_skBMap[2], 0.6, 0.7, LEGORACECAR_KICK1},
{&LegoRaceCar::g_edgeReferences[1], 0.7, 0.8, LEGORACECAR_KICK1}, {&LegoRaceCar::g_skBMap[1], 0.7, 0.8, LEGORACECAR_KICK1},
{&LegoRaceCar::g_edgeReferences[0], 0.8, 0.9, LEGORACECAR_KICK1}, {&LegoRaceCar::g_skBMap[0], 0.8, 0.9, LEGORACECAR_KICK1},
{&LegoRaceCar::g_edgeReferences[3], 0.1, 0.2, LEGORACECAR_KICK1}, {&LegoRaceCar::g_skBMap[3], 0.1, 0.2, LEGORACECAR_KICK1},
{&LegoRaceCar::g_edgeReferences[4], 0.2, 0.3, LEGORACECAR_KICK1}, {&LegoRaceCar::g_skBMap[4], 0.2, 0.3, LEGORACECAR_KICK1},
{&LegoRaceCar::g_edgeReferences[5], 0.3, 0.4, LEGORACECAR_KICK1}, {&LegoRaceCar::g_skBMap[5], 0.3, 0.4, LEGORACECAR_KICK1},
{&LegoRaceCar::g_edgeReferences[5], 0.6, 0.7, LEGORACECAR_KICK2}, {&LegoRaceCar::g_skBMap[5], 0.6, 0.7, LEGORACECAR_KICK2},
{&LegoRaceCar::g_edgeReferences[4], 0.7, 0.8, LEGORACECAR_KICK2}, {&LegoRaceCar::g_skBMap[4], 0.7, 0.8, LEGORACECAR_KICK2},
{&LegoRaceCar::g_edgeReferences[3], 0.8, 0.9, LEGORACECAR_KICK2}, {&LegoRaceCar::g_skBMap[3], 0.8, 0.9, LEGORACECAR_KICK2},
}; };
// GLOBAL: LEGO1 0x100f0b10 // GLOBAL: LEGO1 0x100f0b10
@ -213,8 +213,8 @@ void LegoRaceCar::ParseAction(char* p_extra)
const char* edge0354 = "EDG03_54"; const char* edge0354 = "EDG03_54";
m_unk0x7c = currentWorld->FindPathBoundary(edge0354); m_unk0x7c = currentWorld->FindPathBoundary(edge0354);
for (MxS32 j = 0; j < sizeOfArray(g_edgeReferences); j++) { for (MxS32 j = 0; j < sizeOfArray(g_skBMap); j++) {
g_edgeReferences[j].m_data = currentWorld->FindPathBoundary(g_edgeReferences[j].m_name); 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; float skeletonCurAnimPhase = skeletonCurAnimPosition / skeletonCurAnimDuration;
for (MxS32 i = 0; i < sizeOfArray(g_skeletonKickPhases); i++) { 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) { skeletonCurAnimPhase <= current->m_upper) {
m_userState = current->m_userState; m_userState = current->m_userState;
} }
@ -451,14 +451,45 @@ MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
return SUCCESS; return SUCCESS;
} }
// STUB: LEGO1 0x10013600 // FUNCTION: LEGO1 0x10013600
// FUNCTION: BETA10 0x100cbe60
MxResult LegoRaceCar::VTable0x9c() MxResult LegoRaceCar::VTable0x9c()
{ {
// TODO MxResult result;
return SUCCESS;
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( MxU32 LegoRaceCar::VTable0x6c(
LegoPathBoundary* p_boundary, LegoPathBoundary* p_boundary,
Vector3& p_v1, Vector3& p_v1,
@ -468,12 +499,12 @@ MxU32 LegoRaceCar::VTable0x6c(
Vector3& p_v3 Vector3& p_v3
) )
{ {
// TODO return LegoCarRaceActor::VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3);
return 0;
} }
// STUB: LEGO1 0x10014560 // FUNCTION: LEGO1 0x10014560
// FUNCTION: BETA10 0x100cd660
void LegoRaceCar::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) void LegoRaceCar::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
{ {
// TODO LegoCarRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4);
} }