diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index 5dfc894c..c46ee609 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -42,6 +42,7 @@ class MxDSObject : public MxCore protected: inline void SetType(MxDSType p_type) { this->m_type = p_type; } + inline MxDSType GetType() { return (MxDSType) this->m_type; } private: MxU32 m_sizeOnDisk; diff --git a/LEGO1/mxdssound.cpp b/LEGO1/mxdssound.cpp index d05f785d..cbb1c057 100644 --- a/LEGO1/mxdssound.cpp +++ b/LEGO1/mxdssound.cpp @@ -1,9 +1,11 @@ #include "mxdssound.h" +DECOMP_SIZE_ASSERT(MxDSSound, 0xc0) + // OFFSET: LEGO1 0x100c92c0 MxDSSound::MxDSSound() { - this->m_lastField = 0x4f; + this->m_volume = 0x4f; this->SetType(MxDSType_Sound); } @@ -11,3 +13,50 @@ MxDSSound::MxDSSound() MxDSSound::~MxDSSound() { } + +// OFFSET: LEGO1 0x100c94c0 +void MxDSSound::CopyFrom(MxDSSound &p_dsSound) +{ + this->SetType(p_dsSound.GetType()); + this->m_volume = p_dsSound.m_volume; +} + +// OFFSET: LEGO1 0x100c94e0 +MxDSSound &MxDSSound::operator=(MxDSSound &p_dsSound) +{ + if (this == &p_dsSound) + return *this; + + MxDSMediaAction::operator=(p_dsSound); + this->CopyFrom(p_dsSound); + return *this; +} + +// OFFSET: LEGO1 0x100c95d0 +MxU32 MxDSSound::GetSizeOnDisk() +{ + MxU32 totalSizeOnDisk = MxDSMediaAction::GetSizeOnDisk(); + + this->m_sizeOnDisk = sizeof(this->m_volume); + return totalSizeOnDisk + 4; +} + +// OFFSET: LEGO1 0x100c95a0 +void MxDSSound::Deserialize(char **p_source, MxS16 p_unk24) +{ + MxDSMediaAction::Deserialize(p_source, p_unk24); + + this->m_volume = *(MxS32*) *p_source; + *p_source += sizeof(MxS32); +} + +// OFFSET: LEGO1 0x100c9510 +MxDSAction *MxDSSound::Clone() +{ + MxDSSound *clone = new MxDSSound(); + + if (clone) + *clone = *this; + + return clone; +} \ No newline at end of file diff --git a/LEGO1/mxdssound.h b/LEGO1/mxdssound.h index eca6c055..de345e51 100644 --- a/LEGO1/mxdssound.h +++ b/LEGO1/mxdssound.h @@ -2,7 +2,6 @@ #define MXDSSOUND_H #include "mxdsmediaaction.h" -#include "mxtypes.h" // VTABLE 0x100dcdd0 // SIZE 0xc0 @@ -12,6 +11,9 @@ class MxDSSound : public MxDSMediaAction MxDSSound(); virtual ~MxDSSound() override; + void CopyFrom(MxDSSound &p_dsSound); + MxDSSound &operator=(MxDSSound &p_dsSound); + // OFFSET: LEGO1 0x100c9330 inline virtual const char *ClassName() const override // vtable+0x0c { @@ -24,10 +26,14 @@ class MxDSSound : public MxDSMediaAction { return !strcmp(name, MxDSSound::ClassName()) || MxDSMediaAction::IsA(name); } + + virtual MxU32 GetSizeOnDisk(); // vtable+18; + virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c; + virtual MxDSAction *Clone(); // vtable+2c; + private: - MxS32 m_unkb8; - MxLong m_lastField; // 0xbc + MxU32 m_sizeOnDisk; + MxS32 m_volume; // 0xbc }; - #endif // MXDSSOUND_H