Match MxDSAction::CopyFrom (#104)

* Match MxDSAction::CopyFrom

* Fix src/dest

* Update mxvector.h

* Update mxvector.h

* Update mxvector.h

* Update mxdsaction.cpp
This commit is contained in:
Christian Semmler 2023-08-09 19:48:49 -04:00 committed by GitHub
parent bd9dca0d3f
commit 88bfb3c419
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 13 deletions

View file

@ -51,10 +51,9 @@ void MxDSAction::CopyFrom(MxDSAction &p_dsAction)
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());
this->m_location.CopyFrom(p_dsAction.m_location);
this->m_direction.CopyFrom(p_dsAction.m_direction);
this->m_up.CopyFrom(p_dsAction.m_up);
FUN_100ADE60(p_dsAction.m_unk80, p_dsAction.m_unk7c);
this->m_unk84 = p_dsAction.m_unk84;

View file

@ -57,8 +57,8 @@ class MxVector2
virtual void DivScalar(float *p_value);
// vtable + 0x6C
virtual void SetVector(MxVector2 *other);
virtual void SetVector(float *other);
virtual void SetVector(MxVector2 *p_other);
virtual void SetVector(float *p_other);
inline float& operator[](size_t idx) { return m_data[idx]; }
inline const float operator[](size_t idx) const { return m_data[idx]; }
@ -134,12 +134,29 @@ class MxVector4 : public MxVector3
class MxVector3Data : public MxVector3
{
public:
inline MxVector3Data() : MxVector3(&x) {}
inline MxVector3Data() : MxVector3(storage) {}
inline MxVector3Data(float p_x, float p_y, float p_z)
: MxVector3(&x)
: MxVector3(storage)
, x(p_x), y(p_y), z(p_z)
{}
float x, y, z;
union {
float storage[3];
struct {
float x;
float y;
float z;
};
};
void CopyFrom(MxVector3Data &p_other) {
EqualsImpl(p_other.m_data);
float *dest = this->storage;
float *src = p_other.storage;
for (size_t i = sizeof(storage) / sizeof(float); i > 0; --i)
*dest++ = *src++;
}
};
// VTABLE 0x100d41e8
@ -147,8 +164,16 @@ class MxVector3Data : public MxVector3
class MxVector4Data : public MxVector4
{
public:
inline MxVector4Data() : MxVector4(&x) {}
float x, y, z, w;
inline MxVector4Data() : MxVector4(storage) {}
union {
float storage[4];
struct {
float x;
float y;
float z;
float w;
};
};
};
#endif // MXVECTOR_H