Implement/match MxDSSerialAction (#139)

* Implement/match MxDSSerialAction

* Add neccessary MxDSMultiAction functions
This commit is contained in:
Christian Semmler 2023-09-25 15:53:57 -04:00 committed by GitHub
parent b2ec18f943
commit e1e2abc510
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 4 deletions

View file

@ -2,6 +2,7 @@
#include "mxdsaction.h" #include "mxdsaction.h"
DECOMP_SIZE_ASSERT(MxDSActionList, 0x1c); DECOMP_SIZE_ASSERT(MxDSActionList, 0x1c);
DECOMP_SIZE_ASSERT(MxDSActionListCursor, 0x10);
// OFFSET: LEGO1 0x100c9c90 // OFFSET: LEGO1 0x100c9c90
MxS8 MxDSActionList::Compare(MxDSAction *p_var0, MxDSAction *p_var1) MxS8 MxDSActionList::Compare(MxDSAction *p_var0, MxDSAction *p_var1)

View file

@ -1,16 +1,80 @@
#include "mxdsserialaction.h" #include "mxdsserialaction.h"
#include "mxdsmediaaction.h"
DECOMP_SIZE_ASSERT(MxDSSerialAction, 0xa8) DECOMP_SIZE_ASSERT(MxDSSerialAction, 0xa8)
// OFFSET: LEGO1 0x100ca9d0 // OFFSET: LEGO1 0x100ca9d0
MxDSSerialAction::MxDSSerialAction() MxDSSerialAction::MxDSSerialAction()
{ {
// TODO
this->SetType(MxDSType_SerialAction); 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() 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(); MxDSSerialAction();
virtual ~MxDSSerialAction() override; virtual ~MxDSSerialAction() override;
void CopyFrom(MxDSSerialAction &p_dsSerialAction);
MxDSSerialAction &operator=(MxDSSerialAction &p_dsSerialAction);
// OFFSET: LEGO1 0x100caad0 // OFFSET: LEGO1 0x100caad0
inline virtual const char *ClassName() const override // vtable+0x0c 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); 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_unk0xa0;
undefined4 m_unk0xa4; undefined4 m_unk0xa4;
}; };

View file

@ -2,6 +2,7 @@
#include "mxpresenter.h" #include "mxpresenter.h"
DECOMP_SIZE_ASSERT(MxPresenterList, 0x18); DECOMP_SIZE_ASSERT(MxPresenterList, 0x18);
DECOMP_SIZE_ASSERT(MxPresenterListCursor, 0x10);
// OFFSET: LEGO1 0x1001cd00 // OFFSET: LEGO1 0x1001cd00
MxS8 MxPresenterList::Compare(MxPresenter *p_var0, MxPresenter *p_var1) MxS8 MxPresenterList::Compare(MxPresenter *p_var0, MxPresenter *p_var1)