Implement/match MxDSSerialAction

This commit is contained in:
Christian Semmler 2023-09-24 09:01:29 -04:00
parent 6dd94d3626
commit 6b648d0039
8 changed files with 85 additions and 7 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -30,6 +30,8 @@ class MxDSMultiAction : public MxDSAction
private:
MxU32 m_sizeOnDisk;
protected:
MxDSActionList *m_actions;
};

View File

@ -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;
}

View File

@ -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;
};

View File

@ -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)