mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 23:57:54 -05:00
Bootstrap MxDSMultiAction (#133)
* Bootstrap MxDSMultiAction * Move destroy function to list class * Fix unk14 call
This commit is contained in:
parent
b743f99d20
commit
99c27a6a50
6 changed files with 91 additions and 6 deletions
|
@ -109,6 +109,7 @@ add_library(lego1 SHARED
|
||||||
LEGO1/mxdiskstreamprovider.cpp
|
LEGO1/mxdiskstreamprovider.cpp
|
||||||
LEGO1/mxdisplaysurface.cpp
|
LEGO1/mxdisplaysurface.cpp
|
||||||
LEGO1/mxdsaction.cpp
|
LEGO1/mxdsaction.cpp
|
||||||
|
LEGO1/mxdsactionlist.cpp
|
||||||
LEGO1/mxdsanim.cpp
|
LEGO1/mxdsanim.cpp
|
||||||
LEGO1/mxdschunk.cpp
|
LEGO1/mxdschunk.cpp
|
||||||
LEGO1/mxdsevent.cpp
|
LEGO1/mxdsevent.cpp
|
||||||
|
|
21
LEGO1/mxdsactionlist.cpp
Normal file
21
LEGO1/mxdsactionlist.cpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include "mxdsactionlist.h"
|
||||||
|
#include "mxdsaction.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(MxDSActionList, 0x1c);
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100c9c90
|
||||||
|
MxS8 MxDSActionList::Compare(MxDSAction *p_var0, MxDSAction *p_var1)
|
||||||
|
{
|
||||||
|
if (p_var1 == p_var0)
|
||||||
|
return 0;
|
||||||
|
if (p_var1 <= p_var0)
|
||||||
|
return 1;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100c9cb0
|
||||||
|
void MxDSActionList::Destroy(MxDSAction *p_action)
|
||||||
|
{
|
||||||
|
if (p_action)
|
||||||
|
delete p_action;
|
||||||
|
}
|
28
LEGO1/mxdsactionlist.h
Normal file
28
LEGO1/mxdsactionlist.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef MXDSACTIONLIST_H
|
||||||
|
#define MXDSACTIONLIST_H
|
||||||
|
|
||||||
|
#include "decomp.h"
|
||||||
|
#include "mxlist.h"
|
||||||
|
|
||||||
|
class MxDSAction;
|
||||||
|
|
||||||
|
// VTABLE 0x100dced8
|
||||||
|
// SIZE 0x1c
|
||||||
|
class MxDSActionList : public MxList<MxDSAction>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxDSActionList() {
|
||||||
|
this->m_unk18 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual MxS8 Compare(MxDSAction *, MxDSAction *); // +0x14
|
||||||
|
|
||||||
|
static void Destroy(MxDSAction *p_action);
|
||||||
|
|
||||||
|
private:
|
||||||
|
undefined m_unk18;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef MxListCursorChild<MxDSAction> MxDSActionListCursor;
|
||||||
|
|
||||||
|
#endif // MXDSACTIONLIST_H
|
|
@ -5,12 +5,42 @@ DECOMP_SIZE_ASSERT(MxDSMultiAction, 0x9c)
|
||||||
// OFFSET: LEGO1 0x100c9b90
|
// OFFSET: LEGO1 0x100c9b90
|
||||||
MxDSMultiAction::MxDSMultiAction()
|
MxDSMultiAction::MxDSMultiAction()
|
||||||
{
|
{
|
||||||
// TODO
|
|
||||||
this->SetType(MxDSType_MultiAction);
|
this->SetType(MxDSType_MultiAction);
|
||||||
|
this->m_actions = new MxDSActionList;
|
||||||
|
this->m_actions->SetDestroy(MxDSActionList::Destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100ca060 STUB
|
// OFFSET: LEGO1 0x100ca060
|
||||||
MxDSMultiAction::~MxDSMultiAction()
|
MxDSMultiAction::~MxDSMultiAction()
|
||||||
{
|
{
|
||||||
// TODO
|
if (this->m_actions)
|
||||||
|
delete this->m_actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ca5e0
|
||||||
|
undefined4 MxDSMultiAction::unk14()
|
||||||
|
{
|
||||||
|
undefined4 result = MxDSAction::unk14();
|
||||||
|
|
||||||
|
MxDSActionListCursor cursor(this->m_actions);
|
||||||
|
MxDSAction *action;
|
||||||
|
while (cursor.Next(action))
|
||||||
|
result += action->unk14();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ca6c0
|
||||||
|
MxU32 MxDSMultiAction::GetSizeOnDisk()
|
||||||
|
{
|
||||||
|
MxU32 totalSizeOnDisk = MxDSAction::GetSizeOnDisk() + 16;
|
||||||
|
|
||||||
|
MxDSActionListCursor cursor(this->m_actions);
|
||||||
|
MxDSAction *action;
|
||||||
|
while (cursor.Next(action))
|
||||||
|
totalSizeOnDisk += action->GetSizeOnDisk();
|
||||||
|
|
||||||
|
this->m_sizeOnDisk = totalSizeOnDisk - MxDSAction::GetSizeOnDisk();
|
||||||
|
|
||||||
|
return totalSizeOnDisk;
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
#define MXDSMULTIACTION_H
|
#define MXDSMULTIACTION_H
|
||||||
|
|
||||||
#include "mxdsaction.h"
|
#include "mxdsaction.h"
|
||||||
#include "decomp.h"
|
#include "mxdsactionlist.h"
|
||||||
|
|
||||||
// VTABLE 0x100dcef0
|
// VTABLE 0x100dcef0
|
||||||
// SIZE 0x9c
|
// SIZE 0x9c
|
||||||
|
@ -25,8 +25,12 @@ class MxDSMultiAction : public MxDSAction
|
||||||
return !strcmp(name, MxDSMultiAction::ClassName()) || MxDSAction::IsA(name);
|
return !strcmp(name, MxDSMultiAction::ClassName()) || MxDSAction::IsA(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
undefined4 m_unk0x94;
|
virtual undefined4 unk14(); // vtable+14;
|
||||||
undefined4 m_unk0x98;
|
virtual MxU32 GetSizeOnDisk(); // vtable+18;
|
||||||
|
|
||||||
|
private:
|
||||||
|
MxU32 m_sizeOnDisk;
|
||||||
|
MxDSActionList *m_actions;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MXDSMULTIACTION_H
|
#endif // MXDSMULTIACTION_H
|
||||||
|
|
|
@ -60,6 +60,7 @@ class MxList : protected MxListParent<T>
|
||||||
|
|
||||||
void Append(T*);
|
void Append(T*);
|
||||||
MxU32 GetCount() { return m_count; }
|
MxU32 GetCount() { return m_count; }
|
||||||
|
void SetDestroy(void (*p_customDestructor)(T *)) { this->m_customDestructor = p_customDestructor; }
|
||||||
|
|
||||||
friend class MxListCursor<T>;
|
friend class MxListCursor<T>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue