2023-06-29 04:10:08 -04:00
|
|
|
#include "mxdsmultiaction.h"
|
|
|
|
|
2023-09-20 16:22:57 -04:00
|
|
|
DECOMP_SIZE_ASSERT(MxDSMultiAction, 0x9c)
|
2023-12-20 20:09:05 -05:00
|
|
|
DECOMP_SIZE_ASSERT(MxDSActionList, 0x1c);
|
|
|
|
DECOMP_SIZE_ASSERT(MxDSActionListCursor, 0x10);
|
2023-09-20 16:22:57 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c9b90
|
2023-06-29 04:10:08 -04:00
|
|
|
MxDSMultiAction::MxDSMultiAction()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
this->SetType(MxDSType_MultiAction);
|
|
|
|
this->m_actions = new MxDSActionList;
|
|
|
|
this->m_actions->SetDestroy(MxDSActionList::Destroy);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca060
|
2023-06-29 04:10:08 -04:00
|
|
|
MxDSMultiAction::~MxDSMultiAction()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
if (this->m_actions)
|
|
|
|
delete this->m_actions;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2023-09-20 16:36:15 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca0d0
|
2023-10-24 19:38:27 -04:00
|
|
|
void MxDSMultiAction::CopyFrom(MxDSMultiAction& p_dsMultiAction)
|
2023-09-25 13:08:19 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
this->m_actions->DeleteAll();
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSActionListCursor cursor(p_dsMultiAction.m_actions);
|
|
|
|
MxDSAction* action;
|
|
|
|
while (cursor.Next(action))
|
|
|
|
this->m_actions->Append(action->Clone());
|
2023-09-25 13:08:19 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca260
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSMultiAction& MxDSMultiAction::operator=(MxDSMultiAction& p_dsMultiAction)
|
2023-09-25 13:08:19 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
if (this == &p_dsMultiAction)
|
|
|
|
return *this;
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSAction::operator=(p_dsMultiAction);
|
|
|
|
this->CopyFrom(p_dsMultiAction);
|
|
|
|
return *this;
|
2023-09-25 13:08:19 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca290
|
2023-12-13 05:48:14 -05:00
|
|
|
void MxDSMultiAction::SetUnknown90(MxLong p_unk0x90)
|
2023-09-25 13:08:19 -04:00
|
|
|
{
|
2023-12-13 05:48:14 -05:00
|
|
|
this->m_unk0x90 = p_unk0x90;
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSActionListCursor cursor(this->m_actions);
|
|
|
|
MxDSAction* action;
|
|
|
|
while (cursor.Next(action))
|
2023-12-13 05:48:14 -05:00
|
|
|
action->SetUnknown90(p_unk0x90);
|
2023-09-25 13:08:19 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca370
|
2023-10-24 19:38:27 -04:00
|
|
|
void MxDSMultiAction::MergeFrom(MxDSAction& p_dsMultiAction)
|
2023-09-25 13:08:19 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSAction::MergeFrom(p_dsMultiAction);
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSActionListCursor cursor(this->m_actions);
|
|
|
|
MxDSAction* action;
|
|
|
|
while (cursor.Next(action))
|
|
|
|
action->MergeFrom(p_dsMultiAction);
|
2023-09-25 13:08:19 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca450
|
2023-09-25 13:08:19 -04:00
|
|
|
MxBool MxDSMultiAction::HasId(MxU32 p_objectId)
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
if (this->GetObjectId() == p_objectId)
|
|
|
|
return TRUE;
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSActionListCursor cursor(this->m_actions);
|
|
|
|
MxDSAction* action;
|
|
|
|
while (cursor.Next(action)) {
|
|
|
|
if (action->HasId(p_objectId))
|
|
|
|
return TRUE;
|
|
|
|
}
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
return FALSE;
|
2023-09-25 13:08:19 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca550
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSAction* MxDSMultiAction::Clone()
|
2023-09-25 13:08:19 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSMultiAction* clone = new MxDSMultiAction();
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
if (clone)
|
|
|
|
*clone = *this;
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
return clone;
|
2023-09-25 13:08:19 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca5e0
|
2023-12-13 05:48:14 -05:00
|
|
|
undefined4 MxDSMultiAction::VTable0x14()
|
2023-09-20 16:36:15 -04:00
|
|
|
{
|
2023-12-13 05:48:14 -05:00
|
|
|
undefined4 result = MxDSAction::VTable0x14();
|
2023-09-20 16:36:15 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSActionListCursor cursor(this->m_actions);
|
|
|
|
MxDSAction* action;
|
|
|
|
while (cursor.Next(action))
|
2023-12-13 05:48:14 -05:00
|
|
|
result += action->VTable0x14();
|
2023-09-20 16:36:15 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
return result;
|
2023-09-20 16:36:15 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca6c0
|
2023-09-20 16:36:15 -04:00
|
|
|
MxU32 MxDSMultiAction::GetSizeOnDisk()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxU32 totalSizeOnDisk = MxDSAction::GetSizeOnDisk() + 16;
|
2023-09-20 16:36:15 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSActionListCursor cursor(this->m_actions);
|
|
|
|
MxDSAction* action;
|
|
|
|
while (cursor.Next(action))
|
|
|
|
totalSizeOnDisk += action->GetSizeOnDisk();
|
2023-09-20 16:36:15 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
this->m_sizeOnDisk = totalSizeOnDisk - MxDSAction::GetSizeOnDisk();
|
2023-09-20 16:36:15 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
return totalSizeOnDisk;
|
2023-09-25 13:08:19 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca7b0
|
2023-12-17 12:24:39 -05:00
|
|
|
void MxDSMultiAction::Deserialize(MxU8** p_source, MxS16 p_unk0x24)
|
2023-09-25 13:08:19 -04:00
|
|
|
{
|
2023-12-13 05:48:14 -05:00
|
|
|
MxDSAction::Deserialize(p_source, p_unk0x24);
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxU32 extraFlag = *(MxU32*) (*p_source + 4) & 1;
|
|
|
|
*p_source += 12;
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxU32 count = *(MxU32*) *p_source;
|
|
|
|
*p_source += sizeof(count);
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
if (count) {
|
|
|
|
while (count--) {
|
|
|
|
MxU32 extraFlag = *(MxU32*) (*p_source + 4) & 1;
|
|
|
|
*p_source += 8;
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-12-13 05:48:14 -05:00
|
|
|
MxDSAction* action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_unk0x24);
|
2023-10-24 19:38:27 -04:00
|
|
|
*p_source += extraFlag;
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
this->m_actions->Append(action);
|
|
|
|
}
|
|
|
|
}
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
*p_source += extraFlag;
|
2023-09-25 13:08:19 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100ca8c0
|
2023-09-25 13:08:19 -04:00
|
|
|
void MxDSMultiAction::SetAtomId(MxAtomId p_atomId)
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSAction::SetAtomId(p_atomId);
|
2023-09-25 13:08:19 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDSActionListCursor cursor(this->m_actions);
|
|
|
|
MxDSAction* action;
|
|
|
|
while (cursor.Next(action))
|
|
|
|
action->SetAtomId(p_atomId);
|
2023-10-25 14:51:59 -04:00
|
|
|
}
|