isle-portable/LEGO1/mxdsparallelaction.cpp

87 lines
1.7 KiB
C++
Raw Normal View History

#include "mxdsparallelaction.h"
2023-10-24 19:38:27 -04:00
#include "mxdsmediaaction.h"
DECOMP_SIZE_ASSERT(MxDSParallelAction, 0x9c)
// OFFSET: LEGO1 0x100cae80
MxDSParallelAction::MxDSParallelAction()
{
2023-10-24 19:38:27 -04:00
this->SetType(MxDSType_ParallelAction);
}
// OFFSET: LEGO1 0x100cb040
MxDSParallelAction::~MxDSParallelAction()
{
}
// OFFSET: LEGO1 0x100cb090
2023-10-24 19:38:27 -04:00
void MxDSParallelAction::CopyFrom(MxDSParallelAction& p_dsParallelAction)
{
}
// OFFSET: LEGO1 0x100cb0a0
2023-10-24 19:38:27 -04:00
MxDSParallelAction& MxDSParallelAction::operator=(MxDSParallelAction& p_dsParallelAction)
{
2023-10-24 19:38:27 -04:00
if (this == &p_dsParallelAction)
return *this;
2023-10-24 19:38:27 -04:00
MxDSMultiAction::operator=(p_dsParallelAction);
this->CopyFrom(p_dsParallelAction);
return *this;
}
// OFFSET: LEGO1 0x100cb0d0
2023-10-24 19:38:27 -04:00
MxDSAction* MxDSParallelAction::Clone()
{
2023-10-24 19:38:27 -04:00
MxDSParallelAction* clone = new MxDSParallelAction();
2023-10-24 19:38:27 -04:00
if (clone)
*clone = *this;
2023-10-24 19:38:27 -04:00
return clone;
}
// OFFSET: LEGO1 0x100cb160
MxLong MxDSParallelAction::GetDuration()
{
2023-10-24 19:38:27 -04:00
if (this->m_duration)
return this->m_duration;
MxDSActionListCursor cursor(this->m_actions);
MxDSAction* action;
while (cursor.Next(action)) {
if (!action)
continue;
MxLong duration = action->GetDuration();
if (duration == -1) {
this->m_duration = -1;
break;
}
duration += action->GetStartTime();
if (action->IsA("MxDSMediaAction")) {
MxLong sustainTime = ((MxDSMediaAction*) action)->GetSustainTime();
if (sustainTime == -1)
duration = -1;
else if (sustainTime)
duration += sustainTime;
}
if (duration == -1) {
this->m_duration = -1;
break;
}
if (this->m_duration < duration)
this->m_duration = duration;
}
if (this->IsBit3())
this->m_duration *= this->m_loopCount;
return this->m_duration;
}