diff --git a/LEGO1/mxdsactionlist.cpp b/LEGO1/mxdsactionlist.cpp index 86c75365..46eb4e36 100644 --- a/LEGO1/mxdsactionlist.cpp +++ b/LEGO1/mxdsactionlist.cpp @@ -2,6 +2,7 @@ #include "mxdsaction.h" DECOMP_SIZE_ASSERT(MxDSActionList, 0x1c); +DECOMP_SIZE_ASSERT(MxDSActionListCursor, 0x10); // OFFSET: LEGO1 0x100c9c90 MxS8 MxDSActionList::Compare(MxDSAction *p_var0, MxDSAction *p_var1) diff --git a/LEGO1/mxdsserialaction.cpp b/LEGO1/mxdsserialaction.cpp index c6aa541f..7196b1b7 100644 --- a/LEGO1/mxdsserialaction.cpp +++ b/LEGO1/mxdsserialaction.cpp @@ -1,16 +1,80 @@ #include "mxdsserialaction.h" +#include "mxdsmediaaction.h" DECOMP_SIZE_ASSERT(MxDSSerialAction, 0xa8) // OFFSET: LEGO1 0x100ca9d0 MxDSSerialAction::MxDSSerialAction() { - // TODO this->SetType(MxDSType_SerialAction); + this->m_cursor = new MxDSActionListCursor(this->m_actions); + this->m_unk0xa0 = 0; } -// OFFSET: LEGO1 0x100cac10 STUB +// OFFSET: LEGO1 0x100caac0 +void MxDSSerialAction::SetDuration(MxLong p_duration) +{ + this->m_duration = p_duration; +} + +// OFFSET: LEGO1 0x100cac10 MxDSSerialAction::~MxDSSerialAction() { - // TODO + if (this->m_cursor) + delete this->m_cursor; + + this->m_cursor = NULL; } + +// OFFSET: LEGO1 0x100cac90 +void MxDSSerialAction::CopyFrom(MxDSSerialAction &p_dsSerialAction) +{ +} + +// OFFSET: LEGO1 0x100caca0 +MxDSSerialAction &MxDSSerialAction::operator=(MxDSSerialAction &p_dsSerialAction) +{ + if (this == &p_dsSerialAction) + return *this; + + MxDSMultiAction::operator=(p_dsSerialAction); + this->CopyFrom(p_dsSerialAction); + return *this; +} + +// OFFSET: LEGO1 0x100cacd0 +MxDSAction *MxDSSerialAction::Clone() +{ + MxDSSerialAction *clone = new MxDSSerialAction(); + + if (clone) + *clone = *this; + + return clone; +} + +// OFFSET: LEGO1 0x100cad60 +MxLong MxDSSerialAction::GetDuration() +{ + if (this->m_duration) + return this->m_duration; + + MxDSActionListCursor cursor(this->m_actions); + MxDSAction *action; + + while (cursor.Next(action)) { + if (!action) + continue; + + this->m_duration += action->GetDuration() + action->GetStartTime(); + + if (action->IsA("MxDSMediaAction")) { + MxLong sustainTime = ((MxDSMediaAction*) action)->GetSustainTime(); + + if (sustainTime && sustainTime != -1) + this->m_duration += sustainTime; + } + } + + return this->m_duration; +} \ No newline at end of file diff --git a/LEGO1/mxdsserialaction.h b/LEGO1/mxdsserialaction.h index 6bf30c0f..e2f6cd72 100644 --- a/LEGO1/mxdsserialaction.h +++ b/LEGO1/mxdsserialaction.h @@ -12,6 +12,9 @@ class MxDSSerialAction : public MxDSMultiAction MxDSSerialAction(); virtual ~MxDSSerialAction() override; + void CopyFrom(MxDSSerialAction &p_dsSerialAction); + MxDSSerialAction &operator=(MxDSSerialAction &p_dsSerialAction); + // OFFSET: LEGO1 0x100caad0 inline virtual const char *ClassName() const override // vtable+0x0c { @@ -25,7 +28,12 @@ class MxDSSerialAction : public MxDSMultiAction return !strcmp(name, MxDSSerialAction::ClassName()) || MxDSMultiAction::IsA(name); } - undefined4 m_unk0x9c; + virtual MxLong GetDuration(); // vtable+24; + virtual void SetDuration(MxLong p_duration); // vtable+28; + virtual MxDSAction *Clone(); // vtable+2c; + +private: + MxDSActionListCursor *m_cursor; undefined4 m_unk0xa0; undefined4 m_unk0xa4; }; diff --git a/LEGO1/mxpresenterlist.cpp b/LEGO1/mxpresenterlist.cpp index ca3f15a8..1edb6e12 100644 --- a/LEGO1/mxpresenterlist.cpp +++ b/LEGO1/mxpresenterlist.cpp @@ -2,6 +2,7 @@ #include "mxpresenter.h" DECOMP_SIZE_ASSERT(MxPresenterList, 0x18); +DECOMP_SIZE_ASSERT(MxPresenterListCursor, 0x10); // OFFSET: LEGO1 0x1001cd00 MxS8 MxPresenterList::Compare(MxPresenter *p_var0, MxPresenter *p_var1)