From 6d9fa3ed7f2c646339fa08b68e21611b00b00b0b Mon Sep 17 00:00:00 2001 From: MS Date: Wed, 11 Dec 2024 12:01:55 -0500 Subject: [PATCH] Act3List Insert() and Clear() (#1206) * Act3List Insert() and Clear() * Fix Act3ListElement constructors --- LEGO1/lego/legoomni/include/act3.h | 18 ++++++++ LEGO1/lego/legoomni/src/worlds/act3.cpp | 58 +++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index 8df70e22..a8bfb77e 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -21,6 +21,13 @@ struct Act3ListElement { undefined4 m_unk0x04; // 0x04 undefined m_unk0x08; // 0x08 + Act3ListElement() {} + + Act3ListElement(MxU32 p_objectId, undefined4 p_unk0x04, undefined p_unk0x08) + : m_objectId(p_objectId), m_unk0x04(p_unk0x04), m_unk0x08(p_unk0x08) + { + } + int operator==(Act3ListElement) const { return 0; } int operator<(Act3ListElement) const { return 0; } }; @@ -30,7 +37,9 @@ class Act3List : private list { public: Act3List() { m_unk0x0c = 0; } + void Insert(MxS32 p_objectId, MxS32 p_option); void FUN_10071fa0(); + void Clear(); void FUN_100720d0(MxU32 p_objectId); private: @@ -137,6 +146,15 @@ class Act3 : public LegoWorld { LegoGameState::Area m_destLocation; // 0x4270 }; +// TEMPLATE: LEGO1 0x10071f10 +// list >::insert + +// TEMPLATE: LEGO1 0x10071f70 +// list >::_Buynode + +// TEMPLATE: LEGO1 0x10072220 +// list >::erase + // TEMPLATE: LEGO1 0x10072440 // list >::~list > diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index 429a624b..38e5098a 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -34,12 +34,70 @@ DECOMP_SIZE_ASSERT(Act3List, 0x10) Act3Script::Script g_unk0x100d95e8[] = {Act3Script::c_tlp053in_RunAnim, Act3Script::c_tlp064la_RunAnim, Act3Script::c_tlp068in_RunAnim}; +// FUNCTION: LEGO1 0x10071d40 +void Act3List::Insert(MxS32 p_objectId, MxS32 p_option) +{ + if (m_unk0x0c) { + return; + } + + switch (p_option) { + case 1: + if (!empty()) { + FUN_10071fa0(); + push_back(Act3ListElement(p_objectId, p_option, FALSE)); + } + else { + InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL); + push_back(Act3ListElement(p_objectId, p_option, TRUE)); + } + break; + case 2: + if (empty()) { + push_back(Act3ListElement(p_objectId, p_option, TRUE)); + InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL); + } + else { + push_back(Act3ListElement(p_objectId, p_option, FALSE)); + } + break; + case 3: + if (empty()) { + push_back(Act3ListElement(p_objectId, p_option, TRUE)); + InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL); + } + break; + } +} + // FUNCTION: LEGO1 0x10071fa0 void Act3List::FUN_10071fa0() { DeleteAction(); } +// FUNCTION: LEGO1 0x10071fb0 +void Act3List::Clear() +{ + m_unk0x0c = 1; + BackgroundAudioManager()->Stop(); + + if (empty()) { + return; + } + + for (Act3List::iterator it = begin(); it != end();) { + if ((*it).m_unk0x08) { + MxDSAction ds; + ds.SetAtomId(*g_act3Script); + ds.SetObjectId((*it).m_objectId); + DeleteObject(ds); + } + + erase(it++); + } +} + // FUNCTION: LEGO1 0x100720d0 void Act3List::FUN_100720d0(MxU32 p_objectId) {