Beta matching MxDSObject/MxDSAction (#878)

* Beta matching MxDSObject/MxDSAction

* MxDSAction copy constructor

* A bit more refactor

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
MS 2024-05-03 08:01:27 -04:00 committed by GitHub
parent 72cbd1fc60
commit 446caa4ca1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 295 additions and 187 deletions

View file

@ -8,6 +8,7 @@
class MxOmni; class MxOmni;
// VTABLE: LEGO1 0x100dc098 // VTABLE: LEGO1 0x100dc098
// VTABLE: BETA10 0x101c1b68
// SIZE 0x94 // SIZE 0x94
class MxDSAction : public MxDSObject { class MxDSAction : public MxDSObject {
public: public:
@ -27,10 +28,12 @@ class MxDSAction : public MxDSObject {
MxDSAction(); MxDSAction();
~MxDSAction() override; ~MxDSAction() override;
MxDSAction(MxDSAction& p_dsAction);
void CopyFrom(MxDSAction& p_dsAction); void CopyFrom(MxDSAction& p_dsAction);
MxDSAction& operator=(MxDSAction& p_dsAction); MxDSAction& operator=(MxDSAction& p_dsAction);
// FUNCTION: LEGO1 0x100ad980 // FUNCTION: LEGO1 0x100ad980
// FUNCTION: BETA10 0x1012bcf0
inline const char* ClassName() const override // vtable+0x0c inline const char* ClassName() const override // vtable+0x0c
{ {
// STRING: LEGO1 0x101013f4 // STRING: LEGO1 0x101013f4
@ -38,6 +41,7 @@ class MxDSAction : public MxDSObject {
} }
// FUNCTION: LEGO1 0x100ad990 // FUNCTION: LEGO1 0x100ad990
// FUNCTION: BETA10 0x1012bd10
inline MxBool IsA(const char* p_name) const override // vtable+0x10 inline MxBool IsA(const char* p_name) const override // vtable+0x10
{ {
return !strcmp(p_name, MxDSAction::ClassName()) || MxDSObject::IsA(p_name); return !strcmp(p_name, MxDSAction::ClassName()) || MxDSObject::IsA(p_name);
@ -57,22 +61,39 @@ class MxDSAction : public MxDSObject {
void AppendExtra(MxU16 p_extraLength, const char* p_extraData); void AppendExtra(MxU16 p_extraLength, const char* p_extraData);
// FUNCTION: BETA10 0x1003a560
inline void GetExtra(MxU16& p_extraLength, char*& p_extraData) inline void GetExtra(MxU16& p_extraLength, char*& p_extraData)
{ {
p_extraLength = m_extraLength; p_extraLength = m_extraLength;
p_extraData = m_extraData; p_extraData = m_extraData;
} }
// FUNCTION: BETA10 0x1003cf70
inline MxU32 GetFlags() { return m_flags; } inline MxU32 GetFlags() { return m_flags; }
// FUNCTION: BETA10 0x1004daa0
inline void SetFlags(MxU32 p_flags) { m_flags = p_flags; } inline void SetFlags(MxU32 p_flags) { m_flags = p_flags; }
inline char* GetExtraData() { return m_extraData; } inline char* GetExtraData() { return m_extraData; }
inline MxU16 GetExtraLength() const { return m_extraLength; } inline MxU16 GetExtraLength() const { return m_extraLength; }
// FUNCTION: BETA10 0x1005a560
inline MxLong GetStartTime() const { return m_startTime; } inline MxLong GetStartTime() const { return m_startTime; }
// FUNCTION: BETA10 0x1012be80
inline MxS32 GetLoopCount() { return m_loopCount; } inline MxS32 GetLoopCount() { return m_loopCount; }
inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; } inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; }
// FUNCTION: BETA10 0x1003db50
inline Mx3DPointFloat& GetLocation() { return m_location; } inline Mx3DPointFloat& GetLocation() { return m_location; }
// FUNCTION: BETA10 0x1003db80
inline Mx3DPointFloat& GetDirection() { return m_direction; } inline Mx3DPointFloat& GetDirection() { return m_direction; }
// FUNCTION: BETA10 0x1003dbb0
inline Mx3DPointFloat& GetUp() { return m_up; } inline Mx3DPointFloat& GetUp() { return m_up; }
inline void SetLocation(const Vector3& p_location) { m_location = p_location; } inline void SetLocation(const Vector3& p_location) { m_location = p_location; }
inline void SetDirection(const Vector3& p_direction) { m_direction = p_direction; } inline void SetDirection(const Vector3& p_direction) { m_direction = p_direction; }
inline void SetUp(const Vector3& p_up) { m_up = p_up; } inline void SetUp(const Vector3& p_up) { m_up = p_up; }
@ -85,6 +106,7 @@ class MxDSAction : public MxDSObject {
inline MxBool IsBit3() const { return m_flags & c_bit3; } inline MxBool IsBit3() const { return m_flags & c_bit3; }
// SYNTHETIC: LEGO1 0x100ada60 // SYNTHETIC: LEGO1 0x100ada60
// SYNTHETIC: BETA10 0x1012be40
// MxDSAction::`scalar deleting destructor' // MxDSAction::`scalar deleting destructor'
protected: protected:

View file

@ -8,6 +8,7 @@
class MxPresenter; class MxPresenter;
// VTABLE: LEGO1 0x100dc868 // VTABLE: LEGO1 0x100dc868
// VTABLE: BETA10 0x101c23f0
// SIZE 0x2c // SIZE 0x2c
class MxDSObject : public MxCore { class MxDSObject : public MxCore {
public: public:
@ -30,15 +31,18 @@ class MxDSObject : public MxCore {
~MxDSObject() override; ~MxDSObject() override;
void CopyFrom(MxDSObject& p_dsObject); void CopyFrom(MxDSObject& p_dsObject);
MxDSObject(MxDSObject& p_dsObject);
MxDSObject& operator=(MxDSObject& p_dsObject); MxDSObject& operator=(MxDSObject& p_dsObject);
void SetObjectName(const char* p_objectName); void SetObjectName(const char* p_objectName);
void SetSourceName(const char* p_sourceName); void SetSourceName(const char* p_sourceName);
// FUNCTION: LEGO1 0x100bf730 // FUNCTION: LEGO1 0x100bf730
// FUNCTION: BETA10 0x1012bdd0
inline const char* ClassName() const override { return "MxDSObject"; } // vtable+0c inline const char* ClassName() const override { return "MxDSObject"; } // vtable+0c
// FUNCTION: LEGO1 0x100bf740 // FUNCTION: LEGO1 0x100bf740
// FUNCTION: BETA10 0x1012bd70
inline MxBool IsA(const char* p_name) const override inline MxBool IsA(const char* p_name) const override
{ {
return !strcmp(p_name, MxDSObject::ClassName()) || MxCore::IsA(p_name); return !strcmp(p_name, MxDSObject::ClassName()) || MxCore::IsA(p_name);
@ -50,27 +54,34 @@ class MxDSObject : public MxCore {
// FUNCTION: ISLE 0x401c40 // FUNCTION: ISLE 0x401c40
// FUNCTION: LEGO1 0x10005530 // FUNCTION: LEGO1 0x10005530
inline virtual void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } // vtable+20; // FUNCTION: BETA10 0x100152e0
inline virtual void SetAtomId(MxAtomId p_atomId) { m_atomId = p_atomId; } // vtable+20;
inline Type GetType() const { return (Type) this->m_type; } inline Type GetType() const { return (Type) m_type; }
inline const char* GetSourceName() const { return this->m_sourceName; } inline const char* GetSourceName() const { return m_sourceName; }
inline const char* GetObjectName() const { return this->m_objectName; } inline const char* GetObjectName() const { return m_objectName; }
inline MxU32 GetObjectId() { return this->m_objectId; } inline MxU32 GetObjectId() { return m_objectId; }
inline const MxAtomId& GetAtomId() { return this->m_atomId; } inline const MxAtomId& GetAtomId() { return m_atomId; }
inline MxS16 GetUnknown24() { return this->m_unk0x24; } inline MxS16 GetUnknown24() { return m_unk0x24; }
inline MxPresenter* GetUnknown28() { return this->m_unk0x28; } inline MxPresenter* GetUnknown28() { return m_unk0x28; }
inline void SetType(Type p_type) { this->m_type = p_type; } inline void SetType(Type p_type) { m_type = p_type; }
inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; }
inline void SetUnknown24(MxS16 p_unk0x24) { this->m_unk0x24 = p_unk0x24; } // FUNCTION: BETA10 0x100152b0
inline void SetUnknown28(MxPresenter* p_unk0x28) { this->m_unk0x28 = p_unk0x28; } inline void SetObjectId(MxU32 p_objectId) { m_objectId = p_objectId; }
// FUNCTION: BETA10 0x10039570
inline void SetUnknown24(MxS16 p_unk0x24) { m_unk0x24 = p_unk0x24; }
inline void SetUnknown28(MxPresenter* p_unk0x28) { m_unk0x28 = p_unk0x28; }
inline void ClearAtom() { m_atomId.Clear(); } inline void ClearAtom() { m_atomId.Clear(); }
// SYNTHETIC: LEGO1 0x100bf7c0 // SYNTHETIC: LEGO1 0x100bf7c0
// SYNTHETIC: BETA10 0x10148770
// MxDSObject::`scalar deleting destructor' // MxDSObject::`scalar deleting destructor'
private: protected:
MxU32 m_sizeOnDisk; // 0x08 MxU32 m_sizeOnDisk; // 0x08
MxU16 m_type; // 0x0c MxU16 m_type; // 0x0c
char* m_sourceName; // 0x10 char* m_sourceName; // 0x10

View file

@ -4,106 +4,132 @@
#include "mxtimer.h" #include "mxtimer.h"
#include "mxutilities.h" #include "mxutilities.h"
#include <assert.h>
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>
DECOMP_SIZE_ASSERT(MxDSAction, 0x94) DECOMP_SIZE_ASSERT(MxDSAction, 0x94)
// GLOBAL: LEGO1 0x10101410 // GLOBAL: LEGO1 0x10101410
// GLOBAL: BETA10 0x10201f5c
MxU16 g_sep = TWOCC(',', ' '); MxU16 g_sep = TWOCC(',', ' ');
// FUNCTION: LEGO1 0x100ad810 // FUNCTION: LEGO1 0x100ad810
// FUNCTION: BETA10 0x1012afd0
MxDSAction::MxDSAction() MxDSAction::MxDSAction()
{ {
this->m_flags = MxDSAction::c_enabled; m_type = e_action;
this->m_startTime = INT_MIN; m_flags = MxDSAction::c_enabled;
this->m_extraData = NULL; m_extraLength = 0;
this->m_extraLength = 0; m_extraData = NULL;
this->m_duration = INT_MIN; m_startTime = INT_MIN;
this->m_loopCount = -1; m_duration = INT_MIN;
m_loopCount = -1;
this->SetType(e_action); m_location.Fill(FLT_MAX);
this->m_location.Fill(FLT_MAX); m_direction.Fill(FLT_MAX);
this->m_direction.Fill(FLT_MAX); m_up.Fill(FLT_MAX);
this->m_up.Fill(FLT_MAX); m_unk0x84 = NULL;
this->m_unk0x84 = NULL; m_unk0x88 = 0;
this->m_unk0x88 = 0; m_origin = NULL;
this->m_origin = NULL; m_unk0x90 = INT_MIN;
this->m_unk0x90 = INT_MIN;
} }
// FUNCTION: LEGO1 0x100ad940 // FUNCTION: LEGO1 0x100ad940
// FUNCTION: BETA10 0x1012bc50
MxLong MxDSAction::GetDuration() MxLong MxDSAction::GetDuration()
{ {
return this->m_duration; return m_duration;
} }
// FUNCTION: LEGO1 0x100ad950 // FUNCTION: LEGO1 0x100ad950
// FUNCTION: BETA10 0x1012bc90
void MxDSAction::SetDuration(MxLong p_duration) void MxDSAction::SetDuration(MxLong p_duration)
{ {
this->m_duration = p_duration; m_duration = p_duration;
} }
// FUNCTION: LEGO1 0x100ad960 // FUNCTION: LEGO1 0x100ad960
// FUNCTION: BETA10 0x1012bcc0
MxBool MxDSAction::HasId(MxU32 p_objectId) MxBool MxDSAction::HasId(MxU32 p_objectId)
{ {
return this->GetObjectId() == p_objectId; return m_objectId == p_objectId;
} }
// FUNCTION: LEGO1 0x100ada40 // FUNCTION: LEGO1 0x100ada40
// FUNCTION: BETA10 0x1012bdf0
void MxDSAction::SetUnknown90(MxLong p_unk0x90) void MxDSAction::SetUnknown90(MxLong p_unk0x90)
{ {
this->m_unk0x90 = p_unk0x90; m_unk0x90 = p_unk0x90;
} }
// FUNCTION: LEGO1 0x100ada50 // FUNCTION: LEGO1 0x100ada50
// FUNCTION: BETA10 0x1012be20
MxLong MxDSAction::GetUnknown90() MxLong MxDSAction::GetUnknown90()
{ {
return this->m_unk0x90; return m_unk0x90;
} }
// FUNCTION: LEGO1 0x100ada80 // FUNCTION: LEGO1 0x100ada80
// FUNCTION: BETA10 0x1012b144
MxDSAction::~MxDSAction() MxDSAction::~MxDSAction()
{ {
delete[] this->m_extraData; delete[] m_extraData;
} }
// FUNCTION: LEGO1 0x100adaf0 // FUNCTION: LEGO1 0x100adaf0
// FUNCTION: BETA10 0x1012b1c7
void MxDSAction::CopyFrom(MxDSAction& p_dsAction) void MxDSAction::CopyFrom(MxDSAction& p_dsAction)
{ {
this->SetObjectId(p_dsAction.GetObjectId()); m_objectId = p_dsAction.m_objectId;
this->m_flags = p_dsAction.m_flags; m_flags = p_dsAction.m_flags;
this->m_startTime = p_dsAction.m_startTime; m_startTime = p_dsAction.m_startTime;
this->m_duration = p_dsAction.m_duration; m_duration = p_dsAction.m_duration;
this->m_loopCount = p_dsAction.m_loopCount; m_loopCount = p_dsAction.m_loopCount;
this->m_location = p_dsAction.m_location; m_location = p_dsAction.m_location;
this->m_direction = p_dsAction.m_direction; m_direction = p_dsAction.m_direction;
this->m_up = p_dsAction.m_up; m_up = p_dsAction.m_up;
AppendExtra(p_dsAction.m_extraLength, p_dsAction.m_extraData); AppendExtra(p_dsAction.m_extraLength, p_dsAction.m_extraData);
this->m_unk0x84 = p_dsAction.m_unk0x84; m_unk0x84 = p_dsAction.m_unk0x84;
this->m_unk0x88 = p_dsAction.m_unk0x88; m_unk0x88 = p_dsAction.m_unk0x88;
this->m_origin = p_dsAction.m_origin; m_origin = p_dsAction.m_origin;
this->m_unk0x90 = p_dsAction.m_unk0x90; m_unk0x90 = p_dsAction.m_unk0x90;
}
// FUNCTION: BETA10 0x1012b2b3
MxDSAction::MxDSAction(MxDSAction& p_dsAction) : MxDSObject(p_dsAction)
{
CopyFrom(p_dsAction);
} }
// FUNCTION: LEGO1 0x100adbd0 // FUNCTION: LEGO1 0x100adbd0
// FUNCTION: BETA10 0x1012b355
undefined4 MxDSAction::VTable0x14() undefined4 MxDSAction::VTable0x14()
{ {
return MxDSObject::VTable0x14(); return MxDSObject::VTable0x14();
} }
// FUNCTION: LEGO1 0x100adbe0 // FUNCTION: LEGO1 0x100adbe0
// FUNCTION: BETA10 0x1012b373
MxU32 MxDSAction::GetSizeOnDisk() MxU32 MxDSAction::GetSizeOnDisk()
{ {
MxU32 totalSizeOnDisk; MxU32 size = MxDSObject::GetSizeOnDisk();
size += sizeof(m_flags);
size += sizeof(m_startTime);
size += sizeof(m_duration);
size += sizeof(m_loopCount);
size += sizeof(double) * 3; // m_location
size += sizeof(double) * 3; // m_direction
size += sizeof(double) * 3; // m_up
size += sizeof(m_extraLength);
size += m_extraLength;
totalSizeOnDisk = MxDSObject::GetSizeOnDisk() + 90 + this->m_extraLength; m_sizeOnDisk = size - MxDSObject::GetSizeOnDisk();
this->m_sizeOnDisk = totalSizeOnDisk - MxDSObject::GetSizeOnDisk();
return totalSizeOnDisk; return size;
} }
// FUNCTION: LEGO1 0x100adc10 // FUNCTION: LEGO1 0x100adc10
// FUNCTION: BETA10 0x1012b3d9
MxDSAction& MxDSAction::operator=(MxDSAction& p_dsAction) MxDSAction& MxDSAction::operator=(MxDSAction& p_dsAction)
{ {
if (this == &p_dsAction) { if (this == &p_dsAction) {
@ -111,11 +137,12 @@ MxDSAction& MxDSAction::operator=(MxDSAction& p_dsAction)
} }
MxDSObject::operator=(p_dsAction); MxDSObject::operator=(p_dsAction);
this->CopyFrom(p_dsAction); CopyFrom(p_dsAction);
return *this; return *this;
} }
// FUNCTION: LEGO1 0x100adc40 // FUNCTION: LEGO1 0x100adc40
// FUNCTION: BETA10 0x1012b420
MxDSAction* MxDSAction::Clone() MxDSAction* MxDSAction::Clone()
{ {
MxDSAction* clone = new MxDSAction(); MxDSAction* clone = new MxDSAction();
@ -128,54 +155,56 @@ MxDSAction* MxDSAction::Clone()
} }
// FUNCTION: LEGO1 0x100adcd0 // FUNCTION: LEGO1 0x100adcd0
// FUNCTION: BETA10 0x1012b4ca
MxLong MxDSAction::GetElapsedTime() MxLong MxDSAction::GetElapsedTime()
{ {
return Timer()->GetTime() - this->m_unk0x90; return Timer()->GetTime() - m_unk0x90;
} }
// FUNCTION: LEGO1 0x100add00 // FUNCTION: LEGO1 0x100add00
// FUNCTION: BETA10 0x1012b4f5
void MxDSAction::MergeFrom(MxDSAction& p_dsAction) void MxDSAction::MergeFrom(MxDSAction& p_dsAction)
{ {
if (p_dsAction.m_startTime != INT_MIN) { if (p_dsAction.GetStartTime() != INT_MIN) {
this->m_startTime = p_dsAction.m_startTime; m_startTime = p_dsAction.GetStartTime();
} }
if (p_dsAction.GetDuration() != INT_MIN) { if (p_dsAction.GetDuration() != INT_MIN) {
this->m_duration = p_dsAction.GetDuration(); m_duration = p_dsAction.GetDuration();
} }
if (p_dsAction.m_loopCount != -1) { if (p_dsAction.GetLoopCount() != -1) {
this->m_loopCount = p_dsAction.m_loopCount; m_loopCount = p_dsAction.GetLoopCount();
} }
if (p_dsAction.m_location[0] != FLT_MAX) { if (p_dsAction.GetLocation()[0] != FLT_MAX) {
this->m_location[0] = p_dsAction.m_location[0]; m_location[0] = p_dsAction.GetLocation()[0];
} }
if (p_dsAction.m_location[1] != FLT_MAX) { if (p_dsAction.GetLocation()[1] != FLT_MAX) {
this->m_location[1] = p_dsAction.m_location[1]; m_location[1] = p_dsAction.GetLocation()[1];
} }
if (p_dsAction.m_location[2] != FLT_MAX) { if (p_dsAction.GetLocation()[2] != FLT_MAX) {
this->m_location[2] = p_dsAction.m_location[2]; m_location[2] = p_dsAction.GetLocation()[2];
} }
if (p_dsAction.m_direction[0] != FLT_MAX) { if (p_dsAction.GetDirection()[0] != FLT_MAX) {
this->m_direction[0] = p_dsAction.m_direction[0]; m_direction[0] = p_dsAction.GetDirection()[0];
} }
if (p_dsAction.m_direction[1] != FLT_MAX) { if (p_dsAction.GetDirection()[1] != FLT_MAX) {
this->m_direction[1] = p_dsAction.m_direction[1]; m_direction[1] = p_dsAction.GetDirection()[1];
} }
if (p_dsAction.m_direction[2] != FLT_MAX) { if (p_dsAction.GetDirection()[2] != FLT_MAX) {
this->m_direction[2] = p_dsAction.m_up[2]; // This is correct m_direction[2] = p_dsAction.GetUp()[2]; // This is correct
} }
if (p_dsAction.m_up[0] != FLT_MAX) { if (p_dsAction.GetUp()[0] != FLT_MAX) {
this->m_up[0] = p_dsAction.m_up[0]; m_up[0] = p_dsAction.GetUp()[0];
} }
if (p_dsAction.m_up[1] != FLT_MAX) { if (p_dsAction.GetUp()[1] != FLT_MAX) {
this->m_up[1] = p_dsAction.m_up[1]; m_up[1] = p_dsAction.GetUp()[1];
} }
if (p_dsAction.m_up[2] != FLT_MAX) { if (p_dsAction.GetUp()[2] != FLT_MAX) {
this->m_up[2] = p_dsAction.m_up[2]; m_up[2] = p_dsAction.GetUp()[2];
} }
MxU16 extraLength; MxU16 extraLength;
@ -183,64 +212,71 @@ void MxDSAction::MergeFrom(MxDSAction& p_dsAction)
p_dsAction.GetExtra(extraLength, extraData); p_dsAction.GetExtra(extraLength, extraData);
if (extraLength && extraData) { if (extraLength && extraData) {
if (!this->m_extraData || !strncmp("XXX", this->m_extraData, 3)) { if (!m_extraData || !strncmp("XXX", m_extraData, 3)) {
delete[] this->m_extraData; delete[] m_extraData;
this->m_extraLength = 0; m_extraLength = 0;
AppendExtra(extraLength, extraData); AppendExtra(extraLength, extraData);
} }
} }
} }
// FUNCTION: LEGO1 0x100ade60 // FUNCTION: LEGO1 0x100ade60
// FUNCTION: BETA10 0x1012b8a9
void MxDSAction::AppendExtra(MxU16 p_extraLength, const char* p_extraData) void MxDSAction::AppendExtra(MxU16 p_extraLength, const char* p_extraData)
{ {
if (this->m_extraData == p_extraData || !p_extraData) { if (m_extraData == p_extraData) {
return; return;
} }
if (this->m_extraLength) { if (p_extraData) {
char* concat = new char[p_extraLength + this->m_extraLength + sizeof(g_sep)]; if (m_extraLength) {
memcpy(concat, this->m_extraData, this->m_extraLength); char* newExtra = new char[p_extraLength + m_extraLength + sizeof(g_sep)];
assert(newExtra);
memcpy(newExtra, m_extraData, m_extraLength);
memcpy(&newExtra[m_extraLength], &g_sep, sizeof(g_sep));
memcpy(&newExtra[m_extraLength + sizeof(g_sep)], p_extraData, p_extraLength);
*(MxU16*) &concat[this->m_extraLength] = g_sep; m_extraLength += p_extraLength + sizeof(g_sep);
memcpy(&concat[this->m_extraLength + sizeof(g_sep)], p_extraData, p_extraLength); delete[] m_extraData;
m_extraData = newExtra;
}
else {
m_extraData = new char[p_extraLength];
this->m_extraLength += p_extraLength + sizeof(g_sep); if (m_extraData) {
delete[] this->m_extraData; m_extraLength = p_extraLength;
this->m_extraData = concat; memcpy(m_extraData, p_extraData, p_extraLength);
} }
else { else {
char* copy = new char[p_extraLength]; assert(0);
this->m_extraData = copy; }
if (copy) {
this->m_extraLength = p_extraLength;
memcpy(copy, p_extraData, p_extraLength);
} }
} }
} }
// FUNCTION: LEGO1 0x100adf70 // FUNCTION: LEGO1 0x100adf70
// FUNCTION: BETA10 0x1012ba6a
void MxDSAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) void MxDSAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
{ {
MxDSObject::Deserialize(p_source, p_unk0x24); MxDSObject::Deserialize(p_source, p_unk0x24);
GetScalar(p_source, this->m_flags); // clang-format off
GetScalar(p_source, this->m_startTime); m_flags = *( MxU32*) p_source; p_source += sizeof(m_flags);
GetScalar(p_source, this->m_duration); m_startTime = *(MxLong*) p_source; p_source += sizeof(m_startTime);
GetScalar(p_source, this->m_loopCount); m_duration = *(MxLong*) p_source; p_source += sizeof(m_duration);
GetDouble(p_source, this->m_location[0]); m_loopCount = *( MxS32*) p_source; p_source += sizeof(m_loopCount);
GetDouble(p_source, this->m_location[1]); m_location[0] = *(double*) p_source; p_source += sizeof(double);
GetDouble(p_source, this->m_location[2]); m_location[1] = *(double*) p_source; p_source += sizeof(double);
GetDouble(p_source, this->m_direction[0]); m_location[2] = *(double*) p_source; p_source += sizeof(double);
GetDouble(p_source, this->m_direction[1]); m_direction[0] = *(double*) p_source; p_source += sizeof(double);
GetDouble(p_source, this->m_direction[2]); m_direction[1] = *(double*) p_source; p_source += sizeof(double);
GetDouble(p_source, this->m_up[0]); m_direction[2] = *(double*) p_source; p_source += sizeof(double);
GetDouble(p_source, this->m_up[1]); m_up[0] = *(double*) p_source; p_source += sizeof(double);
GetDouble(p_source, this->m_up[2]); m_up[1] = *(double*) p_source; p_source += sizeof(double);
m_up[2] = *(double*) p_source; p_source += sizeof(double);
MxU16 extraLength = *(MxU16*) p_source; MxU16 extraLength = *( MxU16*) p_source; p_source += sizeof(extraLength);
p_source += 2; // clang-format on
if (extraLength) { if (extraLength) {
AppendExtra(extraLength, (char*) p_source); AppendExtra(extraLength, (char*) p_source);

View file

@ -3,6 +3,7 @@
DECOMP_SIZE_ASSERT(MxDSAnim, 0xb8) DECOMP_SIZE_ASSERT(MxDSAnim, 0xb8)
// FUNCTION: LEGO1 0x100c8ff0 // FUNCTION: LEGO1 0x100c8ff0
// FUNCTION: BETA10 0x1015cd71
MxDSAnim::MxDSAnim() MxDSAnim::MxDSAnim()
{ {
this->SetType(e_anim); this->SetType(e_anim);

View file

@ -3,6 +3,7 @@
DECOMP_SIZE_ASSERT(MxDSEvent, 0xb8) DECOMP_SIZE_ASSERT(MxDSEvent, 0xb8)
// FUNCTION: LEGO1 0x100c95f0 // FUNCTION: LEGO1 0x100c95f0
// FUNCTION: BETA10 0x1015d2e5
MxDSEvent::MxDSEvent() MxDSEvent::MxDSEvent()
{ {
this->SetType(e_event); this->SetType(e_event);

View file

@ -5,6 +5,7 @@
DECOMP_SIZE_ASSERT(MxDSMediaAction, 0xb8) DECOMP_SIZE_ASSERT(MxDSMediaAction, 0xb8)
// FUNCTION: LEGO1 0x100c8b40 // FUNCTION: LEGO1 0x100c8b40
// FUNCTION: BETA10 0x1015c760
MxDSMediaAction::MxDSMediaAction() MxDSMediaAction::MxDSMediaAction()
{ {
this->m_mediaSrcPath = NULL; this->m_mediaSrcPath = NULL;

View file

@ -5,6 +5,7 @@ DECOMP_SIZE_ASSERT(MxDSActionList, 0x1c);
DECOMP_SIZE_ASSERT(MxDSActionListCursor, 0x10); DECOMP_SIZE_ASSERT(MxDSActionListCursor, 0x10);
// FUNCTION: LEGO1 0x100c9b90 // FUNCTION: LEGO1 0x100c9b90
// FUNCTION: BETA10 0x10159410
MxDSMultiAction::MxDSMultiAction() MxDSMultiAction::MxDSMultiAction()
{ {
this->SetType(e_multiAction); this->SetType(e_multiAction);

View file

@ -19,18 +19,20 @@
DECOMP_SIZE_ASSERT(MxDSObject, 0x2c); DECOMP_SIZE_ASSERT(MxDSObject, 0x2c);
// FUNCTION: LEGO1 0x100bf6a0 // FUNCTION: LEGO1 0x100bf6a0
// FUNCTION: BETA10 0x101478c0
MxDSObject::MxDSObject() MxDSObject::MxDSObject()
{ {
this->SetType(e_object); m_type = e_object;
this->m_sourceName = NULL; m_sourceName = NULL;
this->m_unk0x14 = 0; m_unk0x14 = 0;
this->m_objectName = NULL; m_objectName = NULL;
this->m_unk0x24 = -1; m_objectId = -1;
this->m_objectId = -1; m_unk0x24 = -1;
this->m_unk0x28 = 0; m_unk0x28 = NULL;
} }
// FUNCTION: LEGO1 0x100bf7e0 // FUNCTION: LEGO1 0x100bf7e0
// FUNCTION: BETA10 0x1014798e
MxDSObject::~MxDSObject() MxDSObject::~MxDSObject()
{ {
delete[] m_objectName; delete[] m_objectName;
@ -38,120 +40,147 @@ MxDSObject::~MxDSObject()
} }
// FUNCTION: LEGO1 0x100bf870 // FUNCTION: LEGO1 0x100bf870
// FUNCTION: BETA10 0x10147a45
void MxDSObject::CopyFrom(MxDSObject& p_dsObject) void MxDSObject::CopyFrom(MxDSObject& p_dsObject)
{ {
this->SetSourceName(p_dsObject.m_sourceName); SetSourceName(p_dsObject.m_sourceName);
this->m_unk0x14 = p_dsObject.m_unk0x14; m_unk0x14 = p_dsObject.m_unk0x14;
this->SetObjectName(p_dsObject.m_objectName); SetObjectName(p_dsObject.m_objectName);
this->m_objectId = p_dsObject.m_objectId; m_objectId = p_dsObject.m_objectId;
this->m_unk0x24 = p_dsObject.m_unk0x24; m_unk0x24 = p_dsObject.m_unk0x24;
this->m_atomId = p_dsObject.m_atomId; m_atomId = p_dsObject.m_atomId;
this->m_unk0x28 = p_dsObject.m_unk0x28; m_unk0x28 = p_dsObject.m_unk0x28;
}
// FUNCTION: BETA10 0x10147abf
MxDSObject::MxDSObject(MxDSObject& p_dsObject)
{
CopyFrom(p_dsObject);
} }
// FUNCTION: LEGO1 0x100bf8c0 // FUNCTION: LEGO1 0x100bf8c0
// FUNCTION: BETA10 0x10147b57
MxDSObject& MxDSObject::operator=(MxDSObject& p_dsObject) MxDSObject& MxDSObject::operator=(MxDSObject& p_dsObject)
{ {
if (this == &p_dsObject) { if (this == &p_dsObject) {
return *this; return *this;
} }
this->CopyFrom(p_dsObject); CopyFrom(p_dsObject);
return *this; return *this;
} }
// FUNCTION: LEGO1 0x100bf8e0 // FUNCTION: LEGO1 0x100bf8e0
// FUNCTION: BETA10 0x10147b92
void MxDSObject::SetObjectName(const char* p_objectName) void MxDSObject::SetObjectName(const char* p_objectName)
{ {
if (p_objectName != this->m_objectName) { if (p_objectName == m_objectName) {
delete[] this->m_objectName; return;
}
if (p_objectName) { delete[] m_objectName;
this->m_objectName = new char[strlen(p_objectName) + 1];
if (this->m_objectName) { if (p_objectName) {
strcpy(this->m_objectName, p_objectName); m_objectName = new char[strlen(p_objectName) + 1];
}
} if (m_objectName) {
else { strcpy(m_objectName, p_objectName);
this->m_objectName = NULL;
} }
} }
else {
m_objectName = NULL;
}
} }
// FUNCTION: LEGO1 0x100bf950 // FUNCTION: LEGO1 0x100bf950
// FUNCTION: BETA10 0x10147c2e
void MxDSObject::SetSourceName(const char* p_sourceName) void MxDSObject::SetSourceName(const char* p_sourceName)
{ {
if (p_sourceName != this->m_sourceName) { if (p_sourceName == m_sourceName) {
delete[] this->m_sourceName; return;
}
if (p_sourceName) { delete[] m_sourceName;
this->m_sourceName = new char[strlen(p_sourceName) + 1];
if (this->m_sourceName) { if (p_sourceName) {
strcpy(this->m_sourceName, p_sourceName); m_sourceName = new char[strlen(p_sourceName) + 1];
}
} if (m_sourceName) {
else { strcpy(m_sourceName, p_sourceName);
this->m_sourceName = NULL;
} }
} }
else {
m_sourceName = NULL;
}
} }
// FUNCTION: LEGO1 0x100bf9c0 // FUNCTION: LEGO1 0x100bf9c0
// FUNCTION: BETA10 0x10147cca
undefined4 MxDSObject::VTable0x14() undefined4 MxDSObject::VTable0x14()
{ {
// DECOMP: Rendered as 8 + 2 in beta. Maybe a sizeof() call?
return 10; return 10;
} }
// FUNCTION: LEGO1 0x100bf9d0 // FUNCTION: LEGO1 0x100bf9d0
// FUNCTION: BETA10 0x10147cee
MxU32 MxDSObject::GetSizeOnDisk() MxU32 MxDSObject::GetSizeOnDisk()
{ {
MxU32 sizeOnDisk; MxU32 sizeOnDisk = 0;
if (this->m_sourceName) { sizeOnDisk += 2;
sizeOnDisk = strlen(this->m_sourceName) + 3;
}
else {
sizeOnDisk = 3;
}
sizeOnDisk += 4; if (m_sourceName) {
sizeOnDisk += strlen(m_sourceName) + 1;
if (this->m_objectName) {
sizeOnDisk += strlen(this->m_objectName) + 1;
} }
else { else {
sizeOnDisk++; sizeOnDisk++;
} }
sizeOnDisk += 4; sizeOnDisk += sizeof(m_unk0x14);
this->m_sizeOnDisk = sizeOnDisk;
if (m_objectName) {
sizeOnDisk += strlen(m_objectName) + 1;
}
else {
sizeOnDisk++;
}
sizeOnDisk += sizeof(m_objectId);
m_sizeOnDisk = sizeOnDisk;
return sizeOnDisk; return sizeOnDisk;
} }
// FUNCTION: LEGO1 0x100bfa20 // FUNCTION: LEGO1 0x100bfa20
// FUNCTION: BETA10 0x10147d73
void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
{ {
GetString(p_source, this->m_sourceName, this, &MxDSObject::SetSourceName); SetSourceName((char*) p_source);
GetScalar(p_source, this->m_unk0x14); p_source += strlen(m_sourceName) + 1;
GetString(p_source, this->m_objectName, this, &MxDSObject::SetObjectName);
GetScalar(p_source, this->m_objectId);
this->m_unk0x24 = p_unk0x24; m_unk0x14 = *(undefined4*) p_source;
p_source += sizeof(m_unk0x14);
SetObjectName((char*) p_source);
p_source += strlen(m_objectName) + 1;
m_objectId = *(MxU32*) p_source;
p_source += sizeof(m_objectId);
m_unk0x24 = p_unk0x24;
} }
// FUNCTION: LEGO1 0x100bfb30 // FUNCTION: LEGO1 0x100bfb30
// FUNCTION: BETA10 0x10147f35
MxDSObject* DeserializeDSObjectDispatch(MxU8*& p_source, MxS16 p_flags) MxDSObject* DeserializeDSObjectDispatch(MxU8*& p_source, MxS16 p_flags)
{ {
MxDSObject* obj = NULL;
MxU16 type = *(MxU16*) p_source; MxU16 type = *(MxU16*) p_source;
p_source += 2; p_source += 2;
MxDSObject* obj = NULL;
switch (type) { switch (type) {
default:
return NULL;
case MxDSObject::e_object: case MxDSObject::e_object:
obj = new MxDSObject(); obj = new MxDSObject();
break; break;
@ -167,6 +196,15 @@ MxDSObject* DeserializeDSObjectDispatch(MxU8*& p_source, MxS16 p_flags)
case MxDSObject::e_sound: case MxDSObject::e_sound:
obj = new MxDSSound(); obj = new MxDSSound();
break; break;
case MxDSObject::e_event:
obj = new MxDSEvent();
break;
case MxDSObject::e_still:
obj = new MxDSStill();
break;
case MxDSObject::e_objectAction:
obj = new MxDSObjectAction();
break;
case MxDSObject::e_multiAction: case MxDSObject::e_multiAction:
obj = new MxDSMultiAction(); obj = new MxDSMultiAction();
break; break;
@ -176,18 +214,11 @@ MxDSObject* DeserializeDSObjectDispatch(MxU8*& p_source, MxS16 p_flags)
case MxDSObject::e_parallelAction: case MxDSObject::e_parallelAction:
obj = new MxDSParallelAction(); obj = new MxDSParallelAction();
break; break;
case MxDSObject::e_event:
obj = new MxDSEvent();
break;
case MxDSObject::e_selectAction: case MxDSObject::e_selectAction:
obj = new MxDSSelectAction(); obj = new MxDSSelectAction();
break; break;
case MxDSObject::e_still: default:
obj = new MxDSStill(); return NULL;
break;
case MxDSObject::e_objectAction:
obj = new MxDSObjectAction();
break;
} }
if (obj) { if (obj) {

View file

@ -3,6 +3,7 @@
DECOMP_SIZE_ASSERT(MxDSObjectAction, 0xb8) DECOMP_SIZE_ASSERT(MxDSObjectAction, 0xb8)
// FUNCTION: LEGO1 0x100c8870 // FUNCTION: LEGO1 0x100c8870
// FUNCTION: BETA10 0x1015c3b0
MxDSObjectAction::MxDSObjectAction() MxDSObjectAction::MxDSObjectAction()
{ {
this->SetType(e_objectAction); this->SetType(e_objectAction);

View file

@ -5,6 +5,7 @@
DECOMP_SIZE_ASSERT(MxDSParallelAction, 0x9c) DECOMP_SIZE_ASSERT(MxDSParallelAction, 0x9c)
// FUNCTION: LEGO1 0x100cae80 // FUNCTION: LEGO1 0x100cae80
// FUNCTION: BETA10 0x1015a14d
MxDSParallelAction::MxDSParallelAction() MxDSParallelAction::MxDSParallelAction()
{ {
this->SetType(e_parallelAction); this->SetType(e_parallelAction);

View file

@ -10,6 +10,7 @@ DECOMP_SIZE_ASSERT(MxStringListCursor, 0x10)
DECOMP_SIZE_ASSERT(MxListEntry<MxString>, 0x18) DECOMP_SIZE_ASSERT(MxListEntry<MxString>, 0x18)
// FUNCTION: LEGO1 0x100cb2b0 // FUNCTION: LEGO1 0x100cb2b0
// FUNCTION: BETA10 0x1015a515
MxDSSelectAction::MxDSSelectAction() MxDSSelectAction::MxDSSelectAction()
{ {
this->SetType(e_selectAction); this->SetType(e_selectAction);

View file

@ -5,6 +5,7 @@
DECOMP_SIZE_ASSERT(MxDSSerialAction, 0xa8) DECOMP_SIZE_ASSERT(MxDSSerialAction, 0xa8)
// FUNCTION: LEGO1 0x100ca9d0 // FUNCTION: LEGO1 0x100ca9d0
// FUNCTION: BETA10 0x10159cf3
MxDSSerialAction::MxDSSerialAction() MxDSSerialAction::MxDSSerialAction()
{ {
this->SetType(e_serialAction); this->SetType(e_serialAction);

View file

@ -5,6 +5,7 @@
DECOMP_SIZE_ASSERT(MxDSSound, 0xc0) DECOMP_SIZE_ASSERT(MxDSSound, 0xc0)
// FUNCTION: LEGO1 0x100c92c0 // FUNCTION: LEGO1 0x100c92c0
// FUNCTION: BETA10 0x1015cfdb
MxDSSound::MxDSSound() MxDSSound::MxDSSound()
{ {
this->m_volume = 0x4f; this->m_volume = 0x4f;

View file

@ -3,6 +3,7 @@
DECOMP_SIZE_ASSERT(MxDSStill, 0xb8) DECOMP_SIZE_ASSERT(MxDSStill, 0xb8)
// FUNCTION: LEGO1 0x100c98c0 // FUNCTION: LEGO1 0x100c98c0
// FUNCTION: BETA10 0x1015d54f
MxDSStill::MxDSStill() MxDSStill::MxDSStill()
{ {
this->SetType(e_still); this->SetType(e_still);

View file

@ -195,11 +195,11 @@ class Vector3 : public Vector2 {
virtual void EqualsCross(float* p_a, Vector3* p_b) { EqualsCrossImpl(p_a, p_b->m_data); } // vtable+0x78 virtual void EqualsCross(float* p_a, Vector3* p_b) { EqualsCrossImpl(p_a, p_b->m_data); } // vtable+0x78
// FUNCTION: LEGO1 0x10003bf0 // FUNCTION: LEGO1 0x10003bf0
virtual void EqualsScalar(float* p_value) virtual void Fill(const float& p_value)
{ {
m_data[0] = *p_value; m_data[0] = p_value;
m_data[1] = *p_value; m_data[1] = p_value;
m_data[2] = *p_value; m_data[2] = p_value;
} // vtable+0x84 } // vtable+0x84
// Vector2 overrides // Vector2 overrides
@ -270,8 +270,6 @@ class Vector3 : public Vector2 {
return m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2]; return m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2];
} // vtable+0x40 } // vtable+0x40
inline void Fill(float p_value) { EqualsScalar(&p_value); }
friend class Mx3DPointFloat; friend class Mx3DPointFloat;
}; };
@ -374,12 +372,12 @@ class Vector4 : public Vector3 {
} // vtable+0x40 } // vtable+0x40
// FUNCTION: LEGO1 0x10002b40 // FUNCTION: LEGO1 0x10002b40
void EqualsScalar(float* p_value) override void Fill(const float& p_value) override
{ {
m_data[0] = *p_value; m_data[0] = p_value;
m_data[1] = *p_value; m_data[1] = p_value;
m_data[2] = *p_value; m_data[2] = p_value;
m_data[3] = *p_value; m_data[3] = p_value;
} // vtable+0x84 } // vtable+0x84
friend class Mx4DPointFloat; friend class Mx4DPointFloat;