From 2d74f14de09b94f41d2d6bbb47537163b35146a1 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 14 Dec 2024 14:30:21 -0700 Subject: [PATCH] Implement/match `Act3::FUN_10072ad0` (#1228) * Implement `Act3::FUN_10072ad0` * Improve match * Improve match * Match --- LEGO1/lego/legoomni/include/act3.h | 12 +-- LEGO1/lego/legoomni/src/worlds/act3.cpp | 133 +++++++++++++++++++++++- 2 files changed, 136 insertions(+), 9 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index 2abc9a51..fad19342 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -158,12 +158,12 @@ class Act3 : public LegoWorld { Helicopter* m_copter; // 0x420c Act3Shark* m_shark; // 0x4210 MxFloat m_time; // 0x4214 - undefined m_unk0x4218; // 0x4218 - undefined m_unk0x4219; // 0x4219 - undefined m_unk0x421a; // 0x421a - undefined m_unk0x421b; // 0x421b - undefined m_unk0x421c; // 0x421c - undefined m_unk0x421d; // 0x421d + MxU8 m_unk0x4218; // 0x4218 + MxU8 m_unk0x4219; // 0x4219 + MxU8 m_unk0x421a; // 0x421a + MxU8 m_unk0x421b; // 0x421b + MxU8 m_unk0x421c; // 0x421c + MxU8 m_unk0x421d; // 0x421d undefined m_unk0x421e; // 0x421e Act3List m_unk0x4220; // 0x4220 MxPresenter* m_helicopterDots[15]; // 0x4230 diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index 233bde61..b415e40e 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -30,6 +30,77 @@ DECOMP_SIZE_ASSERT(Act3State, 0x0c) DECOMP_SIZE_ASSERT(Act3ListElement, 0x0c) DECOMP_SIZE_ASSERT(Act3List, 0x10) +// GLOBAL: LEGO1 0x100d94f8 +Act3Script::Script g_unk0x100d94f8[] = { + Act3Script::c_sns02xni_PlayWav, + Act3Script::c_sns03xni_PlayWav, + Act3Script::c_sns04xni_PlayWav, + Act3Script::c_sns05xni_PlayWav, + Act3Script::c_sns06xni_PlayWav, + Act3Script::c_sns07xni_PlayWav, + Act3Script::c_sns08xni_PlayWav, + Act3Script::c_sns09xni_PlayWav, + Act3Script::c_sns10xni_PlayWav, + Act3Script::c_sns11xni_PlayWav, + Act3Script::c_sns12xla_PlayWav, + Act3Script::c_sns13xla_PlayWav, + Act3Script::c_sns14xla_PlayWav, + Act3Script::c_sns15xla_PlayWav, + Act3Script::c_sns16xla_PlayWav, + Act3Script::c_sns17xla_PlayWav +}; + +// GLOBAL: LEGO1 0x100d9538 +Act3Script::Script g_unk0x100d9538[] = { + Act3Script::c_sns19xni_PlayWav, + Act3Script::c_sns20xni_PlayWav, + Act3Script::c_sns22xni_PlayWav, + Act3Script::c_sns23xni_PlayWav, + Act3Script::c_sns35xla_PlayWav, + (Act3Script::Script) 0 +}; + +// GLOBAL: LEGO1 0x100d9550 +Act3Script::Script g_unk0x100d9550[] = { + Act3Script::c_sns25xni_PlayWav, + Act3Script::c_sns26xni_PlayWav, + Act3Script::c_sns27xni_PlayWav, + Act3Script::c_sns28xni_PlayWav, + Act3Script::c_sns29xni_PlayWav, + Act3Script::c_sns37xla_PlayWav, + Act3Script::c_sns38xla_PlayWav, + Act3Script::c_sns39xla_PlayWav +}; + +// GLOBAL: LEGO1 0x100d9570 +Act3Script::Script g_unk0x100d9570[] = { + Act3Script::c_sns30xni_PlayWav, + Act3Script::c_sns31xni_PlayWav, + Act3Script::c_sns32xni_PlayWav, + Act3Script::c_sns40xla_PlayWav, + Act3Script::c_sns41xla_PlayWav, + Act3Script::c_sns42xla_PlayWav +}; + +// GLOBAL: LEGO1 0x100d9588 +Act3Script::Script g_unk0x100d9588[] = { + Act3Script::c_sns43xma_PlayWav, Act3Script::c_sns46xin_PlayWav, Act3Script::c_sns60xna_PlayWav, + Act3Script::c_sns52xro_PlayWav, Act3Script::c_sns58xna_PlayWav, Act3Script::c_sns68xbu_PlayWav, + Act3Script::c_sns59xna_PlayWav, Act3Script::c_sns51xin_PlayWav, Act3Script::c_sns61xva_PlayWav, + Act3Script::c_sns44xma_PlayWav, Act3Script::c_sns47xin_PlayWav, Act3Script::c_sns53xro_PlayWav, + Act3Script::c_sns45xma_PlayWav, Act3Script::c_sns69xsn_PlayWav, Act3Script::c_sns48xin_PlayWav, + Act3Script::c_sns66xsl_PlayWav, Act3Script::c_sns49xin_PlayWav, Act3Script::c_sns62xmg_PlayWav, + Act3Script::c_sns54xro_PlayWav, Act3Script::c_sns50xin_PlayWav +}; + +// GLOBAL: LEGO1 0x100d95d8 +Act3Script::Script g_unk0x100d95d8[] = { + Act3Script::c_tns080br_PlayWav, + Act3Script::c_tnsx07br_PlayWav, + Act3Script::c_snsxx2br_PlayWav, + Act3Script::c_snsy23br_PlayWav +}; + // GLOBAL: LEGO1 0x100f7814 MxU8 g_unk0x100f7814 = 0; @@ -336,11 +407,67 @@ MxResult Act3::ShootDonut(LegoPathController* p_controller, Vector3& p_location, return FAILURE; } -// STUB: LEGO1 0x10072ad0 -// STUB: BETA10 0x10015eec +// FUNCTION: LEGO1 0x10072ad0 +// FUNCTION: BETA10 0x10015eec void Act3::FUN_10072ad0(undefined4 p_param1) { - // TODO + float time = Timer()->GetTime(); + Act3Script::Script objectId; + + switch (p_param1) { + case 1: { + if (m_unk0x4218 >= sizeOfArray(g_unk0x100d94f8)) { + m_unk0x4218 = 0; + } + + objectId = g_unk0x100d94f8[m_unk0x4218++]; + break; + } + case 2: { + if (m_unk0x4219 >= sizeOfArray(g_unk0x100d9538) - 1) { + m_unk0x4219 = 0; + } + + objectId = g_unk0x100d9538[m_unk0x4219++]; + break; + } + case 3: { + if (m_unk0x421a >= sizeOfArray(g_unk0x100d9550)) { + m_unk0x421a = 0; + } + + objectId = g_unk0x100d9550[m_unk0x421a++]; + break; + } + case 4: { + if (m_unk0x421b >= sizeOfArray(g_unk0x100d9570)) { + m_unk0x421b = 0; + } + + objectId = g_unk0x100d9570[m_unk0x421b++]; + break; + } + case 5: { + if (m_unk0x421c >= sizeOfArray(g_unk0x100d9588)) { + m_unk0x421c = 0; + } + + objectId = g_unk0x100d9588[m_unk0x421c++]; + break; + } + case 6: { + if (m_unk0x421d >= sizeOfArray(g_unk0x100d95d8)) { + m_unk0x421d = 0; + } + + m_unk0x4220.Insert(g_unk0x100d95d8[m_unk0x421d++], 1); + return; + } + default: + return; + } + + m_unk0x4220.Insert(objectId, 3); } // FUNCTION: LEGO1 0x10072c30