mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-22 15:37:55 -05:00
Implement most of MxDSAction (#103)
* Implement most of MxDSAction * Update mxdsaction.h * Update mxdsobject.cpp
This commit is contained in:
parent
d41b7f2ca4
commit
bd9dca0d3f
6 changed files with 234 additions and 35 deletions
|
@ -90,7 +90,7 @@ void IsleApp::Close()
|
||||||
|
|
||||||
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL);
|
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL);
|
||||||
|
|
||||||
Lego()->RemoveWorld(ds.GetAtomId(), ds.GetUnknown1c());
|
Lego()->RemoveWorld(ds.GetAtomId(), ds.GetObjectId());
|
||||||
Lego()->vtable24(ds);
|
Lego()->vtable24(ds);
|
||||||
TransitionManager()->SetWaitIndicator(NULL);
|
TransitionManager()->SetWaitIndicator(NULL);
|
||||||
Lego()->vtable3c();
|
Lego()->vtable3c();
|
||||||
|
@ -729,7 +729,7 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
|
||||||
|
|
||||||
ds.SetAtomId(stream->atom);
|
ds.SetAtomId(stream->atom);
|
||||||
ds.SetUnknown24(-1);
|
ds.SetUnknown24(-1);
|
||||||
ds.SetUnknown1c(0);
|
ds.SetObjectId(0);
|
||||||
VideoManager()->EnableFullScreenMovie(TRUE, TRUE);
|
VideoManager()->EnableFullScreenMovie(TRUE, TRUE);
|
||||||
|
|
||||||
if (Start(&ds) != SUCCESS) {
|
if (Start(&ds) != SUCCESS) {
|
||||||
|
@ -738,7 +738,7 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
|
||||||
} else {
|
} else {
|
||||||
ds.SetAtomId(stream->atom);
|
ds.SetAtomId(stream->atom);
|
||||||
ds.SetUnknown24(-1);
|
ds.SetUnknown24(-1);
|
||||||
ds.SetUnknown1c(0);
|
ds.SetObjectId(0);
|
||||||
if (Start(&ds) != SUCCESS) {
|
if (Start(&ds) != SUCCESS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,3 +41,184 @@ MxDSAction::~MxDSAction()
|
||||||
{
|
{
|
||||||
delete this->m_unk7c;
|
delete this->m_unk7c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100adaf0
|
||||||
|
void MxDSAction::CopyFrom(MxDSAction &p_dsAction)
|
||||||
|
{
|
||||||
|
this->SetObjectId(p_dsAction.GetObjectId());
|
||||||
|
this->m_flags = p_dsAction.m_flags;
|
||||||
|
this->m_startTime = p_dsAction.m_startTime;
|
||||||
|
this->m_duration = p_dsAction.m_duration;
|
||||||
|
this->m_loopCount = p_dsAction.m_loopCount;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// this->m_location.SetVector(p_dsAction.m_location.GetData());
|
||||||
|
// this->m_direction.SetVector(p_dsAction.m_direction.GetData());
|
||||||
|
// this->m_up.SetVector(p_dsAction.m_up.GetData());
|
||||||
|
|
||||||
|
FUN_100ADE60(p_dsAction.m_unk80, p_dsAction.m_unk7c);
|
||||||
|
this->m_unk84 = p_dsAction.m_unk84;
|
||||||
|
this->m_unk88 = p_dsAction.m_unk88;
|
||||||
|
this->m_omni = p_dsAction.m_omni;
|
||||||
|
this->m_someTimingField = p_dsAction.m_someTimingField;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100adc10
|
||||||
|
MxDSAction &MxDSAction::operator=(MxDSAction &p_dsAction)
|
||||||
|
{
|
||||||
|
if (this == &p_dsAction)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
MxDSObject::operator=(p_dsAction);
|
||||||
|
this->CopyFrom(p_dsAction);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100adbe0
|
||||||
|
MxU32 MxDSAction::GetSizeOnDisk()
|
||||||
|
{
|
||||||
|
MxU32 totalSizeOnDisk;
|
||||||
|
|
||||||
|
totalSizeOnDisk = MxDSObject::GetSizeOnDisk() + 90 + this->m_unk80;
|
||||||
|
this->m_sizeOnDisk = totalSizeOnDisk - MxDSObject::GetSizeOnDisk();
|
||||||
|
|
||||||
|
return totalSizeOnDisk;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100adf70
|
||||||
|
void MxDSAction::Deserialize(char **p_source, MxS16 p_unk24)
|
||||||
|
{
|
||||||
|
MxDSObject::Deserialize(p_source, p_unk24);
|
||||||
|
|
||||||
|
this->m_flags = *(DWORD*) *p_source;
|
||||||
|
*p_source += sizeof(DWORD);
|
||||||
|
this->m_startTime = *(DWORD*) *p_source;
|
||||||
|
*p_source += sizeof(DWORD);
|
||||||
|
this->m_duration = *(MxLong*) *p_source;
|
||||||
|
*p_source += sizeof(MxLong);
|
||||||
|
this->m_loopCount = *(MxS32*) *p_source;
|
||||||
|
*p_source += sizeof(MxS32);
|
||||||
|
this->m_location[0] = *(double*) *p_source;
|
||||||
|
*p_source += sizeof(double);
|
||||||
|
this->m_location[1] = *(double*) *p_source;
|
||||||
|
*p_source += sizeof(double);
|
||||||
|
this->m_location[2] = *(double*) *p_source;
|
||||||
|
*p_source += sizeof(double);
|
||||||
|
this->m_direction[0] = *(double*) *p_source;
|
||||||
|
*p_source += sizeof(double);
|
||||||
|
this->m_direction[1] = *(double*) *p_source;
|
||||||
|
*p_source += sizeof(double);
|
||||||
|
this->m_direction[2] = *(double*) *p_source;
|
||||||
|
*p_source += sizeof(double);
|
||||||
|
this->m_up[0] = *(double*) *p_source;
|
||||||
|
*p_source += sizeof(double);
|
||||||
|
this->m_up[1] = *(double*) *p_source;
|
||||||
|
*p_source += sizeof(double);
|
||||||
|
this->m_up[2] = *(double*) *p_source;
|
||||||
|
*p_source += sizeof(double);
|
||||||
|
|
||||||
|
MxU16 extralen = *(MxU16*) *p_source;
|
||||||
|
*p_source += sizeof(MxU16);
|
||||||
|
if (extralen) {
|
||||||
|
FUN_100ADE60(extralen, *p_source);
|
||||||
|
*p_source += extralen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ad940
|
||||||
|
MxLong MxDSAction::GetDuration()
|
||||||
|
{
|
||||||
|
return this->m_duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ad950
|
||||||
|
void MxDSAction::SetDuration(MxLong p_duration)
|
||||||
|
{
|
||||||
|
this->m_duration = p_duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100adc40
|
||||||
|
MxDSAction *MxDSAction::Clone()
|
||||||
|
{
|
||||||
|
MxDSAction *clone = new MxDSAction();
|
||||||
|
|
||||||
|
if (clone)
|
||||||
|
*clone = *this;
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100add00
|
||||||
|
void MxDSAction::MergeFrom(MxDSAction &p_dsAction)
|
||||||
|
{
|
||||||
|
if (p_dsAction.m_startTime != INT_MIN)
|
||||||
|
this->m_startTime = p_dsAction.m_startTime;
|
||||||
|
|
||||||
|
if (p_dsAction.GetDuration() != INT_MIN)
|
||||||
|
this->m_duration = p_dsAction.GetDuration();
|
||||||
|
|
||||||
|
if (p_dsAction.m_loopCount != -1)
|
||||||
|
this->m_loopCount = p_dsAction.m_loopCount;
|
||||||
|
|
||||||
|
if (p_dsAction.m_location[0] != FLT_MAX)
|
||||||
|
this->m_location[0] = p_dsAction.m_location[0];
|
||||||
|
if (p_dsAction.m_location[1] != FLT_MAX)
|
||||||
|
this->m_location[1] = p_dsAction.m_location[1];
|
||||||
|
if (p_dsAction.m_location[2] != FLT_MAX)
|
||||||
|
this->m_location[2] = p_dsAction.m_location[2];
|
||||||
|
|
||||||
|
if (p_dsAction.m_direction[0] != FLT_MAX)
|
||||||
|
this->m_direction[0] = p_dsAction.m_direction[0];
|
||||||
|
if (p_dsAction.m_direction[1] != FLT_MAX)
|
||||||
|
this->m_direction[1] = p_dsAction.m_direction[1];
|
||||||
|
if (p_dsAction.m_direction[2] != FLT_MAX)
|
||||||
|
this->m_direction[2] = p_dsAction.m_direction[2];
|
||||||
|
|
||||||
|
if (p_dsAction.m_up[0] != FLT_MAX)
|
||||||
|
this->m_up[0] = p_dsAction.m_up[0];
|
||||||
|
if (p_dsAction.m_up[1] != FLT_MAX)
|
||||||
|
this->m_up[1] = p_dsAction.m_up[1];
|
||||||
|
if (p_dsAction.m_up[2] != FLT_MAX)
|
||||||
|
this->m_up[2] = p_dsAction.m_up[2];
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
if (p_dsAction.m_unk80 &&
|
||||||
|
p_dsAction.m_unk7c &&
|
||||||
|
*p_dsAction.m_unk7c &&
|
||||||
|
!strncmp("XXX", (const char*) p_dsAction.m_unk7c, 3))
|
||||||
|
{
|
||||||
|
delete this->m_unk7c;
|
||||||
|
this->m_unk80 = 0;
|
||||||
|
FUN_100ADE60(p_dsAction.m_unk80, p_dsAction.m_unk7c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ad960
|
||||||
|
MxBool MxDSAction::HasId(MxU32 p_objectId)
|
||||||
|
{
|
||||||
|
return this->GetObjectId() == p_objectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ada40
|
||||||
|
void MxDSAction::SetSomeTimingField(MxLong p_someTimingField)
|
||||||
|
{
|
||||||
|
this->m_someTimingField = p_someTimingField;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ada50
|
||||||
|
MxLong MxDSAction::GetSomeTimingField()
|
||||||
|
{
|
||||||
|
return this->m_someTimingField;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100adcd0
|
||||||
|
MxLong MxDSAction::GetCurrentTime()
|
||||||
|
{
|
||||||
|
return Timer()->GetTime() - this->m_someTimingField;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ade60 STUB
|
||||||
|
void MxDSAction::FUN_100ADE60(MxU16 p_length, void *p_data)
|
||||||
|
{
|
||||||
|
// TOOD
|
||||||
|
}
|
|
@ -13,6 +13,9 @@ class MxDSAction : public MxDSObject
|
||||||
__declspec(dllexport) MxDSAction();
|
__declspec(dllexport) MxDSAction();
|
||||||
__declspec(dllexport) virtual ~MxDSAction();
|
__declspec(dllexport) virtual ~MxDSAction();
|
||||||
|
|
||||||
|
void CopyFrom(MxDSAction &p_dsAction);
|
||||||
|
MxDSAction &operator=(MxDSAction &p_dsAction);
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100ad980
|
// OFFSET: LEGO1 0x100ad980
|
||||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||||
{
|
{
|
||||||
|
@ -25,21 +28,35 @@ class MxDSAction : public MxDSObject
|
||||||
{
|
{
|
||||||
return !strcmp(name, MxDSAction::ClassName()) || MxDSObject::IsA(name);
|
return !strcmp(name, MxDSAction::ClassName()) || MxDSObject::IsA(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual MxU32 GetSizeOnDisk(); // vtable+18;
|
||||||
|
virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c;
|
||||||
|
virtual MxLong GetDuration(); // vtable+24;
|
||||||
|
virtual void SetDuration(LONG p_duration); // vtable+28;
|
||||||
|
virtual MxDSAction *Clone(); // vtable+2c;
|
||||||
|
virtual void MergeFrom(MxDSAction &p_dsAction); // vtable+30;
|
||||||
|
virtual MxBool HasId(MxU32 p_objectId); // vtable+34;
|
||||||
|
virtual void SetSomeTimingField(MxLong p_someTimingField); // vtable+38;
|
||||||
|
virtual MxLong GetSomeTimingField(); // vtable+3c;
|
||||||
|
virtual MxLong GetCurrentTime(); // vtable+40;
|
||||||
|
|
||||||
|
void FUN_100ADE60(MxU16 p_length, void *p_data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
undefined4 m_unk2c;
|
MxU32 m_sizeOnDisk;
|
||||||
DWORD m_flags;
|
DWORD m_flags;
|
||||||
DWORD m_startTime;
|
DWORD m_startTime;
|
||||||
LONG m_duration;
|
MxLong m_duration;
|
||||||
MxS32 m_loopCount;
|
MxS32 m_loopCount;
|
||||||
MxVector3Data m_location;
|
MxVector3Data m_location;
|
||||||
MxVector3Data m_direction;
|
MxVector3Data m_direction;
|
||||||
MxVector3Data m_up;
|
MxVector3Data m_up;
|
||||||
undefined4 *m_unk7c;
|
undefined4 *m_unk7c;
|
||||||
undefined2 m_unk80;
|
MxU16 m_unk80;
|
||||||
undefined4 m_unk84;
|
undefined4 m_unk84;
|
||||||
undefined4 m_unk88;
|
undefined4 m_unk88;
|
||||||
MxOmni* m_omni; // 0x8c
|
MxOmni* m_omni; // 0x8c
|
||||||
MxS32 m_someTimingField; // 0x90
|
MxLong m_someTimingField; // 0x90
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MXDSACTION_H
|
#endif // MXDSACTION_H
|
||||||
|
|
|
@ -13,7 +13,7 @@ MxDSObject::MxDSObject()
|
||||||
this->m_unk14 = 0;
|
this->m_unk14 = 0;
|
||||||
this->m_objectName = NULL;
|
this->m_objectName = NULL;
|
||||||
this->m_unk24 = -1;
|
this->m_unk24 = -1;
|
||||||
this->m_unk1c = -1;
|
this->m_objectId = -1;
|
||||||
this->m_unk28 = 0;
|
this->m_unk28 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ void MxDSObject::CopyFrom(MxDSObject &p_dsObject)
|
||||||
this->SetSourceName(p_dsObject.m_sourceName);
|
this->SetSourceName(p_dsObject.m_sourceName);
|
||||||
this->m_unk14 = p_dsObject.m_unk14;
|
this->m_unk14 = p_dsObject.m_unk14;
|
||||||
this->SetObjectName(p_dsObject.m_objectName);
|
this->SetObjectName(p_dsObject.m_objectName);
|
||||||
this->m_unk1c = p_dsObject.m_unk1c;
|
this->m_objectId = p_dsObject.m_objectId;
|
||||||
this->m_unk24 = p_dsObject.m_unk24;
|
this->m_unk24 = p_dsObject.m_unk24;
|
||||||
this->m_atomId = p_dsObject.m_atomId;
|
this->m_atomId = p_dsObject.m_atomId;
|
||||||
this->m_unk28 = p_dsObject.m_unk28;
|
this->m_unk28 = p_dsObject.m_unk28;
|
||||||
|
@ -91,39 +91,39 @@ undefined4 MxDSObject::unk14()
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100bf9d0
|
// OFFSET: LEGO1 0x100bf9d0
|
||||||
MxU32 MxDSObject::CalculateUnk08()
|
MxU32 MxDSObject::GetSizeOnDisk()
|
||||||
{
|
{
|
||||||
MxU32 unk08;
|
MxU32 sizeOnDisk;
|
||||||
|
|
||||||
if (this->m_sourceName)
|
if (this->m_sourceName)
|
||||||
unk08 = strlen(this->m_sourceName) + 3;
|
sizeOnDisk = strlen(this->m_sourceName) + 3;
|
||||||
else
|
else
|
||||||
unk08 = 3;
|
sizeOnDisk = 3;
|
||||||
|
|
||||||
unk08 += 4;
|
sizeOnDisk += 4;
|
||||||
|
|
||||||
if (this->m_objectName)
|
if (this->m_objectName)
|
||||||
unk08 += strlen(this->m_objectName) + 1;
|
sizeOnDisk += strlen(this->m_objectName) + 1;
|
||||||
else
|
else
|
||||||
unk08++;
|
sizeOnDisk++;
|
||||||
|
|
||||||
unk08 += 4;
|
sizeOnDisk += 4;
|
||||||
this->m_unk08 = unk08;
|
this->m_sizeOnDisk = sizeOnDisk;
|
||||||
return unk08;
|
return sizeOnDisk;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100bfa20
|
// OFFSET: LEGO1 0x100bfa20
|
||||||
void MxDSObject::Parse(char **p_source, MxS16 p_unk24)
|
void MxDSObject::Deserialize(char **p_source, MxS16 p_unk24)
|
||||||
{
|
{
|
||||||
this->SetSourceName(*p_source);
|
this->SetSourceName(*p_source);
|
||||||
*p_source += strlen(this->m_sourceName) + 1;
|
*p_source += strlen(this->m_sourceName) + 1;
|
||||||
this->m_unk14 = *(undefined4*) *p_source;
|
this->m_unk14 = *(undefined4*) *p_source;
|
||||||
*p_source += 4;
|
*p_source += sizeof(undefined4);
|
||||||
|
|
||||||
this->SetObjectName(*p_source);
|
this->SetObjectName(*p_source);
|
||||||
*p_source += strlen(this->m_objectName) + 1;
|
*p_source += strlen(this->m_objectName) + 1;
|
||||||
this->m_unk1c = *(undefined4*) *p_source;
|
this->m_objectId = *(MxU32*) *p_source;
|
||||||
*p_source += 4;
|
*p_source += sizeof(MxU32);
|
||||||
|
|
||||||
this->m_unk24 = p_unk24;
|
this->m_unk24 = p_unk24;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,29 +28,28 @@ class MxDSObject : public MxCore
|
||||||
inline virtual MxBool IsA(const char *name) const override { return !strcmp(name, MxDSObject::ClassName()) || MxCore::IsA(name); }; // vtable+10;
|
inline virtual MxBool IsA(const char *name) const override { return !strcmp(name, MxDSObject::ClassName()) || MxCore::IsA(name); }; // vtable+10;
|
||||||
|
|
||||||
virtual undefined4 unk14(); // vtable+14;
|
virtual undefined4 unk14(); // vtable+14;
|
||||||
virtual MxU32 CalculateUnk08(); // vtable+18;
|
virtual MxU32 GetSizeOnDisk(); // vtable+18;
|
||||||
virtual void Parse(char **p_source, MxS16 p_unk24); // vtable+1c;
|
virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c;
|
||||||
|
|
||||||
inline const MxAtomId& GetAtomId() { return this->m_atomId; }
|
|
||||||
inline undefined4 GetUnknown1c() { return this->m_unk1c; }
|
|
||||||
|
|
||||||
inline void SetUnknown1c(undefined4 p_unk1c) { this->m_unk1c = p_unk1c; }
|
|
||||||
inline void SetUnknown24(MxS16 p_unk24) { this->m_unk24 = p_unk24; }
|
|
||||||
|
|
||||||
// OFFSET: ISLE 0x401c40
|
// OFFSET: ISLE 0x401c40
|
||||||
// OFFSET: LEGO1 0x10005530
|
// OFFSET: LEGO1 0x10005530
|
||||||
inline void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; }
|
inline virtual void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } // vtable+20;
|
||||||
|
|
||||||
|
inline const MxAtomId& GetAtomId() { return this->m_atomId; }
|
||||||
|
inline MxU32 GetObjectId() { return this->m_objectId; }
|
||||||
|
|
||||||
|
inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; }
|
||||||
|
inline void SetUnknown24(MxS16 p_unk24) { this->m_unk24 = p_unk24; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline void SetType(MxDSType p_type) { this->m_type = p_type; }
|
inline void SetType(MxDSType p_type) { this->m_type = p_type; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MxU32 m_unk08;
|
MxU32 m_sizeOnDisk;
|
||||||
MxU16 m_type;
|
MxU16 m_type;
|
||||||
char* m_sourceName;
|
char* m_sourceName;
|
||||||
undefined4 m_unk14;
|
undefined4 m_unk14;
|
||||||
char *m_objectName;
|
char *m_objectName;
|
||||||
undefined4 m_unk1c;
|
MxU32 m_objectId;
|
||||||
MxAtomId m_atomId;
|
MxAtomId m_atomId;
|
||||||
MxS16 m_unk24;
|
MxS16 m_unk24;
|
||||||
undefined4 m_unk28;
|
undefined4 m_unk28;
|
||||||
|
|
|
@ -60,6 +60,8 @@ class MxVector2
|
||||||
virtual void SetVector(MxVector2 *other);
|
virtual void SetVector(MxVector2 *other);
|
||||||
virtual void SetVector(float *other);
|
virtual void SetVector(float *other);
|
||||||
|
|
||||||
|
inline float& operator[](size_t idx) { return m_data[idx]; }
|
||||||
|
inline const float operator[](size_t idx) const { return m_data[idx]; }
|
||||||
protected:
|
protected:
|
||||||
float *m_data;
|
float *m_data;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue