Act3List Insert() and Clear() (#1206)

* Act3List Insert() and Clear()

* Fix Act3ListElement constructors
This commit is contained in:
MS 2024-12-11 12:01:55 -05:00 committed by GitHub
parent adc83dc76e
commit 6d9fa3ed7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 76 additions and 0 deletions

View file

@ -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<Act3ListElement> {
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<Act3ListElement,allocator<Act3ListElement> >::insert
// TEMPLATE: LEGO1 0x10071f70
// list<Act3ListElement,allocator<Act3ListElement> >::_Buynode
// TEMPLATE: LEGO1 0x10072220
// list<Act3ListElement,allocator<Act3ListElement> >::erase
// TEMPLATE: LEGO1 0x10072440
// list<Act3ListElement,allocator<Act3ListElement> >::~list<Act3ListElement,allocator<Act3ListElement> >

View file

@ -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)
{