isle/LEGO1/mxdsmultiaction.cpp

155 lines
3.3 KiB
C++
Raw Normal View History

#include "mxdsmultiaction.h"
DECOMP_SIZE_ASSERT(MxDSMultiAction, 0x9c)
// OFFSET: LEGO1 0x100c9b90
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);
}
// OFFSET: LEGO1 0x100ca060
MxDSMultiAction::~MxDSMultiAction()
{
2023-10-24 19:38:27 -04:00
if (this->m_actions)
delete this->m_actions;
}
// OFFSET: LEGO1 0x100ca0d0
2023-10-24 19:38:27 -04:00
void MxDSMultiAction::CopyFrom(MxDSMultiAction& p_dsMultiAction)
{
2023-10-24 19:38:27 -04:00
this->m_actions->DeleteAll();
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());
}
// OFFSET: LEGO1 0x100ca260
2023-10-24 19:38:27 -04:00
MxDSMultiAction& MxDSMultiAction::operator=(MxDSMultiAction& p_dsMultiAction)
{
2023-10-24 19:38:27 -04:00
if (this == &p_dsMultiAction)
return *this;
2023-10-24 19:38:27 -04:00
MxDSAction::operator=(p_dsMultiAction);
this->CopyFrom(p_dsMultiAction);
return *this;
}
// OFFSET: LEGO1 0x100ca290
void MxDSMultiAction::SetUnkTimingField(MxLong p_unkTimingField)
{
2023-10-24 19:38:27 -04:00
this->m_unkTimingField = p_unkTimingField;
2023-10-24 19:38:27 -04:00
MxDSActionListCursor cursor(this->m_actions);
MxDSAction* action;
while (cursor.Next(action))
action->SetUnkTimingField(p_unkTimingField);
}
// OFFSET: LEGO1 0x100ca370
2023-10-24 19:38:27 -04:00
void MxDSMultiAction::MergeFrom(MxDSAction& p_dsMultiAction)
{
2023-10-24 19:38:27 -04:00
MxDSAction::MergeFrom(p_dsMultiAction);
2023-10-24 19:38:27 -04:00
MxDSActionListCursor cursor(this->m_actions);
MxDSAction* action;
while (cursor.Next(action))
action->MergeFrom(p_dsMultiAction);
}
// OFFSET: LEGO1 0x100ca450
MxBool MxDSMultiAction::HasId(MxU32 p_objectId)
{
2023-10-24 19:38:27 -04:00
if (this->GetObjectId() == p_objectId)
return TRUE;
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-10-24 19:38:27 -04:00
return FALSE;
}
// OFFSET: LEGO1 0x100ca550
2023-10-24 19:38:27 -04:00
MxDSAction* MxDSMultiAction::Clone()
{
2023-10-24 19:38:27 -04:00
MxDSMultiAction* clone = new MxDSMultiAction();
2023-10-24 19:38:27 -04:00
if (clone)
*clone = *this;
2023-10-24 19:38:27 -04:00
return clone;
}
// OFFSET: LEGO1 0x100ca5e0
undefined4 MxDSMultiAction::unk14()
{
2023-10-24 19:38:27 -04:00
undefined4 result = MxDSAction::unk14();
2023-10-24 19:38:27 -04:00
MxDSActionListCursor cursor(this->m_actions);
MxDSAction* action;
while (cursor.Next(action))
result += action->unk14();
2023-10-24 19:38:27 -04:00
return result;
}
// OFFSET: LEGO1 0x100ca6c0
MxU32 MxDSMultiAction::GetSizeOnDisk()
{
2023-10-24 19:38:27 -04:00
MxU32 totalSizeOnDisk = MxDSAction::GetSizeOnDisk() + 16;
2023-10-24 19:38:27 -04:00
MxDSActionListCursor cursor(this->m_actions);
MxDSAction* action;
while (cursor.Next(action))
totalSizeOnDisk += action->GetSizeOnDisk();
2023-10-24 19:38:27 -04:00
this->m_sizeOnDisk = totalSizeOnDisk - MxDSAction::GetSizeOnDisk();
2023-10-24 19:38:27 -04:00
return totalSizeOnDisk;
}
// OFFSET: LEGO1 0x100ca7b0
2023-10-24 19:38:27 -04:00
void MxDSMultiAction::Deserialize(char** p_source, MxS16 p_unk24)
{
2023-10-24 19:38:27 -04:00
MxDSAction::Deserialize(p_source, p_unk24);
2023-10-24 19:38:27 -04:00
MxU32 extraFlag = *(MxU32*) (*p_source + 4) & 1;
*p_source += 12;
2023-10-24 19:38:27 -04:00
MxU32 count = *(MxU32*) *p_source;
*p_source += sizeof(count);
2023-10-24 19:38:27 -04:00
if (count) {
while (count--) {
MxU32 extraFlag = *(MxU32*) (*p_source + 4) & 1;
*p_source += 8;
2023-10-24 19:38:27 -04:00
MxDSAction* action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_unk24);
*p_source += extraFlag;
2023-10-24 19:38:27 -04:00
this->m_actions->Append(action);
}
}
2023-10-24 19:38:27 -04:00
*p_source += extraFlag;
}
// OFFSET: LEGO1 0x100ca8c0
void MxDSMultiAction::SetAtomId(MxAtomId p_atomId)
{
2023-10-24 19:38:27 -04:00
MxDSAction::SetAtomId(p_atomId);
2023-10-24 19:38:27 -04:00
MxDSActionListCursor cursor(this->m_actions);
MxDSAction* action;
while (cursor.Next(action))
action->SetAtomId(p_atomId);
}