diff --git a/LEGO1/mxdsaction.cpp b/LEGO1/mxdsaction.cpp index cccea39c..536fbd8a 100644 --- a/LEGO1/mxdsaction.cpp +++ b/LEGO1/mxdsaction.cpp @@ -96,8 +96,8 @@ void MxDSAction::Deserialize(char **p_source, MxS16 p_unk24) this->m_flags = *(MxU32*) *p_source; *p_source += sizeof(MxU32); - this->m_startTime = *(DWORD*) *p_source; - *p_source += sizeof(DWORD); + this->m_startTime = *(MxLong*) *p_source; + *p_source += sizeof(MxLong); this->m_duration = *(MxLong*) *p_source; *p_source += sizeof(MxLong); this->m_loopCount = *(MxS32*) *p_source; diff --git a/LEGO1/mxdsaction.h b/LEGO1/mxdsaction.h index 265f0a6f..0140390b 100644 --- a/LEGO1/mxdsaction.h +++ b/LEGO1/mxdsaction.h @@ -53,6 +53,7 @@ class MxDSAction : public MxDSObject inline void SetFlags(MxU32 m_flags) { this->m_flags = m_flags; } inline char *GetExtraData() { return m_extraData; } inline MxU16 GetExtraLength() const { return m_extraLength; } + inline MxLong GetStartTime() const { return m_startTime; } inline const MxVector3Data &GetLocation() const { return m_location; } inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; } @@ -61,7 +62,7 @@ class MxDSAction : public MxDSObject private: MxU32 m_sizeOnDisk; MxU32 m_flags; - DWORD m_startTime; + MxLong m_startTime; protected: MxLong m_duration; 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/mxdsmediaaction.h b/LEGO1/mxdsmediaaction.h index f3c03839..cc710425 100644 --- a/LEGO1/mxdsmediaaction.h +++ b/LEGO1/mxdsmediaaction.h @@ -34,6 +34,7 @@ class MxDSMediaAction : public MxDSAction void CopyMediaSrcPath(const char *p_mediaSrcPath); inline MxS32 GetMediaFormat() const { return this->m_mediaFormat; } + inline MxLong GetSustainTime() const { return this->m_sustainTime; } private: MxU32 m_sizeOnDisk; char *m_mediaSrcPath; diff --git a/LEGO1/mxdsmultiaction.h b/LEGO1/mxdsmultiaction.h index 7d4312f4..4900aa2e 100644 --- a/LEGO1/mxdsmultiaction.h +++ b/LEGO1/mxdsmultiaction.h @@ -30,6 +30,8 @@ class MxDSMultiAction : public MxDSAction private: MxU32 m_sizeOnDisk; + +protected: MxDSActionList *m_actions; }; 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)