mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-26 09:28:01 -05:00
Implement/match MxDSParallelAction (#138)
* Implement/match MxDSParallelAction * Fix type * Remove space * Add neccessary MxDSMultiAction functions
This commit is contained in:
parent
548f337cad
commit
b2ec18f943
6 changed files with 86 additions and 3 deletions
|
@ -96,8 +96,8 @@ void MxDSAction::Deserialize(char **p_source, MxS16 p_unk24)
|
||||||
|
|
||||||
this->m_flags = *(MxU32*) *p_source;
|
this->m_flags = *(MxU32*) *p_source;
|
||||||
*p_source += sizeof(MxU32);
|
*p_source += sizeof(MxU32);
|
||||||
this->m_startTime = *(DWORD*) *p_source;
|
this->m_startTime = *(MxLong*) *p_source;
|
||||||
*p_source += sizeof(DWORD);
|
*p_source += sizeof(MxLong);
|
||||||
this->m_duration = *(MxLong*) *p_source;
|
this->m_duration = *(MxLong*) *p_source;
|
||||||
*p_source += sizeof(MxLong);
|
*p_source += sizeof(MxLong);
|
||||||
this->m_loopCount = *(MxS32*) *p_source;
|
this->m_loopCount = *(MxS32*) *p_source;
|
||||||
|
|
|
@ -13,6 +13,7 @@ class MxDSAction : public MxDSObject
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
Flag_Looping = 0x01,
|
Flag_Looping = 0x01,
|
||||||
|
Flag_Bit3 = 0x04,
|
||||||
Flag_Enabled = 0x20,
|
Flag_Enabled = 0x20,
|
||||||
Flag_Parsed = 0x80,
|
Flag_Parsed = 0x80,
|
||||||
};
|
};
|
||||||
|
@ -53,15 +54,17 @@ class MxDSAction : public MxDSObject
|
||||||
inline void SetFlags(MxU32 m_flags) { this->m_flags = m_flags; }
|
inline void SetFlags(MxU32 m_flags) { this->m_flags = m_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; }
|
||||||
|
inline MxLong GetStartTime() const { return m_startTime; }
|
||||||
inline const MxVector3Data &GetLocation() const { return m_location; }
|
inline const MxVector3Data &GetLocation() const { return m_location; }
|
||||||
inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; }
|
inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; }
|
||||||
|
|
||||||
inline MxBool IsLooping() const { return this->m_flags & Flag_Looping; }
|
inline MxBool IsLooping() const { return this->m_flags & Flag_Looping; }
|
||||||
|
inline MxBool IsBit3() const { return this->m_flags & Flag_Bit3; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MxU32 m_sizeOnDisk;
|
MxU32 m_sizeOnDisk;
|
||||||
MxU32 m_flags;
|
MxU32 m_flags;
|
||||||
DWORD m_startTime;
|
MxLong m_startTime;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MxLong m_duration;
|
MxLong m_duration;
|
||||||
|
|
|
@ -34,6 +34,7 @@ class MxDSMediaAction : public MxDSAction
|
||||||
void CopyMediaSrcPath(const char *p_mediaSrcPath);
|
void CopyMediaSrcPath(const char *p_mediaSrcPath);
|
||||||
|
|
||||||
inline MxS32 GetMediaFormat() const { return this->m_mediaFormat; }
|
inline MxS32 GetMediaFormat() const { return this->m_mediaFormat; }
|
||||||
|
inline MxLong GetSustainTime() const { return this->m_sustainTime; }
|
||||||
private:
|
private:
|
||||||
MxU32 m_sizeOnDisk;
|
MxU32 m_sizeOnDisk;
|
||||||
char *m_mediaSrcPath;
|
char *m_mediaSrcPath;
|
||||||
|
|
|
@ -39,6 +39,8 @@ class MxDSMultiAction : public MxDSAction
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MxU32 m_sizeOnDisk;
|
MxU32 m_sizeOnDisk;
|
||||||
|
|
||||||
|
protected:
|
||||||
MxDSActionList *m_actions;
|
MxDSActionList *m_actions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "mxdsparallelaction.h"
|
#include "mxdsparallelaction.h"
|
||||||
|
#include "mxdsmediaaction.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxDSParallelAction, 0x9c)
|
DECOMP_SIZE_ASSERT(MxDSParallelAction, 0x9c)
|
||||||
|
|
||||||
|
@ -12,3 +13,74 @@ MxDSParallelAction::MxDSParallelAction()
|
||||||
MxDSParallelAction::~MxDSParallelAction()
|
MxDSParallelAction::~MxDSParallelAction()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100cb090
|
||||||
|
void MxDSParallelAction::CopyFrom(MxDSParallelAction &p_dsParallelAction)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100cb0a0
|
||||||
|
MxDSParallelAction &MxDSParallelAction::operator=(MxDSParallelAction &p_dsParallelAction)
|
||||||
|
{
|
||||||
|
if (this == &p_dsParallelAction)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
MxDSMultiAction::operator=(p_dsParallelAction);
|
||||||
|
this->CopyFrom(p_dsParallelAction);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100cb0d0
|
||||||
|
MxDSAction *MxDSParallelAction::Clone()
|
||||||
|
{
|
||||||
|
MxDSParallelAction *clone = new MxDSParallelAction();
|
||||||
|
|
||||||
|
if (clone)
|
||||||
|
*clone = *this;
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100cb160
|
||||||
|
MxLong MxDSParallelAction::GetDuration()
|
||||||
|
{
|
||||||
|
if (this->m_duration)
|
||||||
|
return this->m_duration;
|
||||||
|
|
||||||
|
MxDSActionListCursor cursor(this->m_actions);
|
||||||
|
MxDSAction *action;
|
||||||
|
|
||||||
|
while (cursor.Next(action)) {
|
||||||
|
if (!action)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
MxLong duration = action->GetDuration();
|
||||||
|
if (duration == -1) {
|
||||||
|
this->m_duration = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
duration += action->GetStartTime();
|
||||||
|
if (action->IsA("MxDSMediaAction")) {
|
||||||
|
MxLong sustainTime = ((MxDSMediaAction*) action)->GetSustainTime();
|
||||||
|
|
||||||
|
if (sustainTime == -1)
|
||||||
|
duration = -1;
|
||||||
|
else if (sustainTime)
|
||||||
|
duration += sustainTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (duration == -1) {
|
||||||
|
this->m_duration = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->m_duration < duration)
|
||||||
|
this->m_duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->IsBit3())
|
||||||
|
this->m_duration *= this->m_loopCount;
|
||||||
|
|
||||||
|
return this->m_duration;
|
||||||
|
}
|
|
@ -11,6 +11,9 @@ class MxDSParallelAction : public MxDSMultiAction
|
||||||
MxDSParallelAction();
|
MxDSParallelAction();
|
||||||
virtual ~MxDSParallelAction() override;
|
virtual ~MxDSParallelAction() override;
|
||||||
|
|
||||||
|
void CopyFrom(MxDSParallelAction &p_dsParallelAction);
|
||||||
|
MxDSParallelAction &operator=(MxDSParallelAction &p_dsParallelAction);
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100caf00
|
// OFFSET: LEGO1 0x100caf00
|
||||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||||
{
|
{
|
||||||
|
@ -24,6 +27,8 @@ class MxDSParallelAction : public MxDSMultiAction
|
||||||
return !strcmp(name, MxDSParallelAction::ClassName()) || MxDSMultiAction::IsA(name);
|
return !strcmp(name, MxDSParallelAction::ClassName()) || MxDSMultiAction::IsA(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual MxLong GetDuration(); // vtable+24;
|
||||||
|
virtual MxDSAction *Clone(); // vtable+2c;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MXDSPARALLELACTION_H
|
#endif // MXDSPARALLELACTION_H
|
||||||
|
|
Loading…
Reference in a new issue