Name function

This commit is contained in:
jonschz 2025-07-13 09:53:45 +02:00
parent 5a62c09900
commit 61c7a42a6f
2 changed files with 11 additions and 18 deletions

View File

@ -47,7 +47,7 @@ class Act3List : private list<Act3ListElement> {
void Insert(MxS32 p_objectId, InsertMode p_option); void Insert(MxS32 p_objectId, InsertMode p_option);
void DeleteActionWrapper(); void DeleteActionWrapper();
void Clear(); void Clear();
void FUN_100720d0(MxU32 p_objectId); void RemoveByObjectIdOrFirst(MxU32 p_objectId);
private: private:
undefined4 m_unk0x0c; // 0x0c undefined4 m_unk0x0c; // 0x0c

View File

@ -173,39 +173,33 @@ void Act3List::Clear()
} }
} }
// Removes the element with the given objectId from the list, or the first if `p_objectId` is zero.
// FUNCTION: LEGO1 0x100720d0 // FUNCTION: LEGO1 0x100720d0
void Act3List::FUN_100720d0(MxU32 p_objectId) void Act3List::RemoveByObjectIdOrFirst(MxU32 p_objectId)
{ {
if (m_unk0x0c) { if (m_unk0x0c) {
return; return;
} }
MxU32 removed = FALSE; MxU32 removed = FALSE;
Act3List::iterator it; Act3List::iterator it;
// This iterator appears to be unnecessary - maybe left in by accident, or it was used for assertions.
// This iterator appears to be unnecessary - maybe left in by accident. // Removing it decreases the match percentage.
// Removing it decreases the match. Act3List::iterator unused_iterator;
Act3List::iterator it3;
if (!empty()) { if (!empty()) {
if (!p_objectId) { if (!p_objectId) {
pop_front(); pop_front();
removed = TRUE; removed = TRUE;
} }
else { else {
for (it = begin(); it != end(); it++) { for (it = begin(); it != end(); it++) {
Act3ListElement& current = *it; Act3ListElement& current = *it;
// No idea why `current` is used in one but not the other, // No idea why `current` is used in one comparison but not the other,
// but this is what produces the best match. // but this is what produces the best match.
if (current.m_hasStarted && (*it).m_objectId == p_objectId) { if (current.m_hasStarted && (*it).m_objectId == p_objectId) {
erase(it); erase(it);
removed = TRUE; removed = TRUE;
break; break;
} }
} }
@ -213,8 +207,7 @@ void Act3List::FUN_100720d0(MxU32 p_objectId)
if (removed && size() > 0) { if (removed && size() > 0) {
it = begin(); it = begin();
it3 = it; unused_iterator = it;
Act3ListElement& firstItem = front(); Act3ListElement& firstItem = front();
it++; it++;
@ -229,7 +222,7 @@ void Act3List::FUN_100720d0(MxU32 p_objectId)
} }
} }
it++; it++;
it3++; unused_iterator++;
} }
if (!firstItem.m_hasStarted) { if (!firstItem.m_hasStarted) {
@ -632,7 +625,7 @@ MxLong Act3::Notify(MxParam& p_param)
} while (length < (MxS32) sizeOfArray(m_helicopterDots)); } while (length < (MxS32) sizeOfArray(m_helicopterDots));
} }
else { else {
m_unk0x4220.FUN_100720d0(param.GetAction()->GetObjectId()); m_unk0x4220.RemoveByObjectIdOrFirst(param.GetAction()->GetObjectId());
} }
} }
break; break;
@ -652,7 +645,7 @@ MxLong Act3::Notify(MxParam& p_param)
case c_notificationEndAnim: case c_notificationEndAnim:
if (m_state->m_unk0x08 == 1) { if (m_state->m_unk0x08 == 1) {
assert(m_copter && m_brickster && m_cop1 && m_cop2); assert(m_copter && m_brickster && m_cop1 && m_cop2);
m_unk0x4220.FUN_100720d0(0); m_unk0x4220.RemoveByObjectIdOrFirst(0);
m_state->m_unk0x08 = 0; m_state->m_unk0x08 = 0;
Disable(TRUE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); Disable(TRUE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
m_copter->HandleClick(); m_copter->HandleClick();