diff --git a/LEGO1/mxdsobject.cpp b/LEGO1/mxdsobject.cpp index af2c670e..5e7d7103 100644 --- a/LEGO1/mxdsobject.cpp +++ b/LEGO1/mxdsobject.cpp @@ -8,20 +8,12 @@ MxDSObject::MxDSObject() { // The following code yields 100% matching assembly if m_unk24 is declared as (signed) short. // However, in other areas m_unk24 (notably, ISLE.EXE) is treated as unsigned short. - // this->m_unk0c = 0; - // this->m_unk10 = 0; - // this->m_unk14 = 0; - // this->m_name = NULL; - // this->m_unk24 = -1; - // this->m_unk1c = -1; - // this->m_unk28 = 0; - - // Assembly not matching but m_unk24 is unsigned short (probably correct) + // Since we don't have a proper solution yet, we are using a union to work around this discrepancy. this->m_unk0c = 0; this->m_unk10 = 0; this->m_unk14 = 0; this->m_name = NULL; - this->m_unk24 = 0xFFFF; + this->m_unk24signed = -1; this->m_unk1c = -1; this->m_unk28 = 0; } diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index ac21fcb5..99c62dd2 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -27,7 +27,13 @@ class MxDSObject : public MxCore char *m_name; int m_unk1c; MxAtomId m_atomId; - unsigned short m_unk24; + // So far, implementing MxDSObject::MxDSObject correctly required that m_unk24 is declared a (signed) short. + // Most of the other game's code appears to treat it as unsigned short, however. + // This union is a workaround until we have figured this out. + union { + unsigned short m_unk24; + short m_unk24signed; + }; unsigned short m_unk26; int m_unk28; };