Refactor MxDSType

This commit is contained in:
Christian Semmler 2024-01-17 10:09:59 -05:00
parent 923db8c82f
commit c6f14e2bd9
15 changed files with 46 additions and 52 deletions

View File

@ -4,7 +4,6 @@
#include "decomp.h" #include "decomp.h"
#include "mxatomid.h" #include "mxatomid.h"
#include "mxcore.h" #include "mxcore.h"
#include "mxdstypes.h"
class MxPresenter; class MxPresenter;
@ -12,6 +11,21 @@ class MxPresenter;
// SIZE 0x2c // SIZE 0x2c
class MxDSObject : public MxCore { class MxDSObject : public MxCore {
public: public:
enum MxDSType {
e_object = 0,
e_action,
e_mediaAction,
e_anim,
e_sound,
e_multiAction,
e_serialAction,
e_parallelAction,
e_event,
e_selectAction,
e_still,
e_objectAction,
};
MxDSObject(); MxDSObject();
virtual ~MxDSObject() override; virtual ~MxDSObject() override;

View File

@ -1,19 +0,0 @@
#ifndef MXDSTYPES_H
#define MXDSTYPES_H
enum MxDSType {
MxDSType_Object = 0,
MxDSType_Action = 1,
MxDSType_MediaAction = 2,
MxDSType_Anim = 3,
MxDSType_Sound = 4,
MxDSType_MultiAction = 5,
MxDSType_SerialAction = 6,
MxDSType_ParallelAction = 7,
MxDSType_Event = 8,
MxDSType_SelectAction = 9,
MxDSType_Still = 10,
MxDSType_ObjectAction = 11,
};
#endif // MXDSTYPES_H

View File

@ -22,7 +22,7 @@ MxDSAction::MxDSAction()
this->m_duration = INT_MIN; this->m_duration = INT_MIN;
this->m_loopCount = -1; this->m_loopCount = -1;
this->SetType(MxDSType_Action); this->SetType(e_action);
this->m_location.Fill(FLT_MAX); this->m_location.Fill(FLT_MAX);
this->m_direction.Fill(FLT_MAX); this->m_direction.Fill(FLT_MAX);
this->m_up.Fill(FLT_MAX); this->m_up.Fill(FLT_MAX);

View File

@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(MxDSAnim, 0xb8)
// FUNCTION: LEGO1 0x100c8ff0 // FUNCTION: LEGO1 0x100c8ff0
MxDSAnim::MxDSAnim() MxDSAnim::MxDSAnim()
{ {
this->SetType(MxDSType_Anim); this->SetType(e_anim);
} }
// FUNCTION: LEGO1 0x100c91a0 // FUNCTION: LEGO1 0x100c91a0

View File

@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(MxDSEvent, 0xb8)
// FUNCTION: LEGO1 0x100c95f0 // FUNCTION: LEGO1 0x100c95f0
MxDSEvent::MxDSEvent() MxDSEvent::MxDSEvent()
{ {
this->SetType(MxDSType_Event); this->SetType(e_event);
} }
// FUNCTION: LEGO1 0x100c97a0 // FUNCTION: LEGO1 0x100c97a0

View File

@ -15,7 +15,7 @@ MxDSMediaAction::MxDSMediaAction()
this->m_paletteManagement = 1; this->m_paletteManagement = 1;
this->m_unk0xb4 = -1; this->m_unk0xb4 = -1;
this->m_sustainTime = 0; this->m_sustainTime = 0;
this->SetType(MxDSType_MediaAction); this->SetType(e_mediaAction);
} }
// FUNCTION: LEGO1 0x100c8cf0 // FUNCTION: LEGO1 0x100c8cf0

View File

@ -7,7 +7,7 @@ DECOMP_SIZE_ASSERT(MxDSActionListCursor, 0x10);
// FUNCTION: LEGO1 0x100c9b90 // FUNCTION: LEGO1 0x100c9b90
MxDSMultiAction::MxDSMultiAction() MxDSMultiAction::MxDSMultiAction()
{ {
this->SetType(MxDSType_MultiAction); this->SetType(e_multiAction);
this->m_actions = new MxDSActionList; this->m_actions = new MxDSActionList;
this->m_actions->SetDestroy(MxDSActionList::Destroy); this->m_actions->SetDestroy(MxDSActionList::Destroy);
} }

View File

@ -11,7 +11,6 @@
#include "mxdsserialaction.h" #include "mxdsserialaction.h"
#include "mxdssound.h" #include "mxdssound.h"
#include "mxdsstill.h" #include "mxdsstill.h"
#include "mxdstypes.h"
#include "mxutil.h" #include "mxutil.h"
#include <stdlib.h> #include <stdlib.h>
@ -22,7 +21,7 @@ DECOMP_SIZE_ASSERT(MxDSObject, 0x2c);
// FUNCTION: LEGO1 0x100bf6a0 // FUNCTION: LEGO1 0x100bf6a0
MxDSObject::MxDSObject() MxDSObject::MxDSObject()
{ {
this->SetType(MxDSType_Object); this->SetType(e_object);
this->m_sourceName = NULL; this->m_sourceName = NULL;
this->m_unk0x14 = 0; this->m_unk0x14 = 0;
this->m_objectName = NULL; this->m_objectName = NULL;
@ -148,40 +147,40 @@ MxDSObject* DeserializeDSObjectDispatch(MxU8** p_source, MxS16 p_flags)
switch (type) { switch (type) {
default: default:
return NULL; return NULL;
case MxDSType_Object: case MxDSObject::e_object:
obj = new MxDSObject(); obj = new MxDSObject();
break; break;
case MxDSType_Action: case MxDSObject::e_action:
obj = new MxDSAction(); obj = new MxDSAction();
break; break;
case MxDSType_MediaAction: case MxDSObject::e_mediaAction:
obj = new MxDSMediaAction(); obj = new MxDSMediaAction();
break; break;
case MxDSType_Anim: case MxDSObject::e_anim:
obj = new MxDSAnim(); obj = new MxDSAnim();
break; break;
case MxDSType_Sound: case MxDSObject::e_sound:
obj = new MxDSSound(); obj = new MxDSSound();
break; break;
case MxDSType_MultiAction: case MxDSObject::e_multiAction:
obj = new MxDSMultiAction(); obj = new MxDSMultiAction();
break; break;
case MxDSType_SerialAction: case MxDSObject::e_serialAction:
obj = new MxDSSerialAction(); obj = new MxDSSerialAction();
break; break;
case MxDSType_ParallelAction: case MxDSObject::e_parallelAction:
obj = new MxDSParallelAction(); obj = new MxDSParallelAction();
break; break;
case MxDSType_Event: case MxDSObject::e_event:
obj = new MxDSEvent(); obj = new MxDSEvent();
break; break;
case MxDSType_SelectAction: case MxDSObject::e_selectAction:
obj = new MxDSSelectAction(); obj = new MxDSSelectAction();
break; break;
case MxDSType_Still: case MxDSObject::e_still:
obj = new MxDSStill(); obj = new MxDSStill();
break; break;
case MxDSType_ObjectAction: case MxDSObject::e_objectAction:
obj = new MxDSObjectAction(); obj = new MxDSObjectAction();
break; break;
} }

View File

@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(MxDSObjectAction, 0xb8)
// FUNCTION: LEGO1 0x100c8870 // FUNCTION: LEGO1 0x100c8870
MxDSObjectAction::MxDSObjectAction() MxDSObjectAction::MxDSObjectAction()
{ {
this->SetType(MxDSType_ObjectAction); this->SetType(e_objectAction);
} }
// FUNCTION: LEGO1 0x100c8a20 // FUNCTION: LEGO1 0x100c8a20

View File

@ -7,7 +7,7 @@ DECOMP_SIZE_ASSERT(MxDSParallelAction, 0x9c)
// FUNCTION: LEGO1 0x100cae80 // FUNCTION: LEGO1 0x100cae80
MxDSParallelAction::MxDSParallelAction() MxDSParallelAction::MxDSParallelAction()
{ {
this->SetType(MxDSType_ParallelAction); this->SetType(e_parallelAction);
} }
// FUNCTION: LEGO1 0x100cb040 // FUNCTION: LEGO1 0x100cb040

View File

@ -12,7 +12,7 @@ DECOMP_SIZE_ASSERT(MxListEntry<MxString>, 0x18)
// FUNCTION: LEGO1 0x100cb2b0 // FUNCTION: LEGO1 0x100cb2b0
MxDSSelectAction::MxDSSelectAction() MxDSSelectAction::MxDSSelectAction()
{ {
this->SetType(MxDSType_SelectAction); this->SetType(e_selectAction);
this->m_unk0xac = new MxStringList; this->m_unk0xac = new MxStringList;
} }

View File

@ -7,7 +7,7 @@ DECOMP_SIZE_ASSERT(MxDSSerialAction, 0xa8)
// FUNCTION: LEGO1 0x100ca9d0 // FUNCTION: LEGO1 0x100ca9d0
MxDSSerialAction::MxDSSerialAction() MxDSSerialAction::MxDSSerialAction()
{ {
this->SetType(MxDSType_SerialAction); this->SetType(e_serialAction);
this->m_cursor = new MxDSActionListCursor(this->m_actions); this->m_cursor = new MxDSActionListCursor(this->m_actions);
this->m_unk0xa0 = 0; this->m_unk0xa0 = 0;
} }

View File

@ -8,7 +8,7 @@ DECOMP_SIZE_ASSERT(MxDSSound, 0xc0)
MxDSSound::MxDSSound() MxDSSound::MxDSSound()
{ {
this->m_volume = 0x4f; this->m_volume = 0x4f;
this->SetType(MxDSType_Sound); this->SetType(e_sound);
} }
// FUNCTION: LEGO1 0x100c9470 // FUNCTION: LEGO1 0x100c9470

View File

@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(MxDSStill, 0xb8)
// FUNCTION: LEGO1 0x100c98c0 // FUNCTION: LEGO1 0x100c98c0
MxDSStill::MxDSStill() MxDSStill::MxDSStill()
{ {
this->SetType(MxDSType_Still); this->SetType(e_still);
} }
// FUNCTION: LEGO1 0x100c9a70 // FUNCTION: LEGO1 0x100c9a70

View File

@ -185,7 +185,7 @@ const char* PresenterNameDispatch(const MxDSAction& p_action)
if (!name || strlen(name) == 0) { if (!name || strlen(name) == 0) {
switch (p_action.GetType()) { switch (p_action.GetType()) {
case MxDSType_Anim: case MxDSObject::e_anim:
format = ((MxDSAnim&) p_action).GetMediaFormat(); format = ((MxDSAnim&) p_action).GetMediaFormat();
switch (format) { switch (format) {
case FOURCC(' ', 'F', 'L', 'C'): case FOURCC(' ', 'F', 'L', 'C'):
@ -197,7 +197,7 @@ const char* PresenterNameDispatch(const MxDSAction& p_action)
} }
break; break;
case MxDSType_Sound: case MxDSObject::e_sound:
format = ((MxDSSound&) p_action).GetMediaFormat(); format = ((MxDSSound&) p_action).GetMediaFormat();
switch (format) { switch (format) {
case FOURCC(' ', 'M', 'I', 'D'): case FOURCC(' ', 'M', 'I', 'D'):
@ -209,17 +209,17 @@ const char* PresenterNameDispatch(const MxDSAction& p_action)
} }
break; break;
case MxDSType_SerialAction: case MxDSObject::e_serialAction:
case MxDSType_ParallelAction: case MxDSObject::e_parallelAction:
case MxDSType_SelectAction: case MxDSObject::e_selectAction:
name = "MxCompositePresenter"; name = "MxCompositePresenter";
break; break;
case MxDSType_Event: case MxDSObject::e_event:
name = "MxEventPresenter"; name = "MxEventPresenter";
break; break;
case MxDSType_Still: case MxDSObject::e_still:
name = "MxStillPresenter"; name = "MxStillPresenter";
break; break;
} }