2024-02-18 12:43:42 -05:00
|
|
|
#ifndef __LEGOANIM_H
|
|
|
|
#define __LEGOANIM_H
|
|
|
|
|
|
|
|
#include "decomp.h"
|
2024-02-23 10:06:16 -05:00
|
|
|
#include "misc/legostorage.h"
|
|
|
|
#include "misc/legotree.h"
|
2024-03-08 14:28:52 -05:00
|
|
|
#include "realtime/matrix.h"
|
2024-02-18 12:43:42 -05:00
|
|
|
|
|
|
|
// SIZE 0x08
|
|
|
|
class LegoAnimKey {
|
|
|
|
public:
|
2024-02-18 15:31:29 -05:00
|
|
|
enum Flags {
|
2024-03-12 13:21:58 -04:00
|
|
|
c_bit1 = 0x01,
|
|
|
|
c_bit2 = 0x02,
|
|
|
|
c_bit3 = 0x04
|
2024-02-18 15:31:29 -05:00
|
|
|
};
|
|
|
|
|
2024-02-18 12:43:42 -05:00
|
|
|
LegoAnimKey();
|
|
|
|
LegoResult Read(LegoStorage* p_storage);
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoFloat GetTime() { return m_time; }
|
|
|
|
void SetTime(LegoFloat p_time) { m_time = p_time; }
|
|
|
|
LegoU32 TestBit1() { return m_flags & c_bit1; }
|
2024-03-12 13:21:58 -04:00
|
|
|
LegoU32 TestBit2() { return m_flags & c_bit2; }
|
|
|
|
LegoU32 TestBit3() { return m_flags & c_bit3; }
|
2024-02-18 12:43:42 -05:00
|
|
|
|
|
|
|
protected:
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoU8 m_flags; // 0x00
|
|
|
|
LegoFloat m_time; // 0x04
|
2024-02-18 12:43:42 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// SIZE 0x14
|
|
|
|
class LegoTranslationKey : public LegoAnimKey {
|
|
|
|
public:
|
|
|
|
LegoTranslationKey();
|
|
|
|
LegoResult Read(LegoStorage* p_storage);
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoFloat GetX() { return m_x; }
|
|
|
|
void SetX(LegoFloat p_x) { m_x = p_x; }
|
|
|
|
LegoFloat GetY() { return m_y; }
|
|
|
|
void SetY(LegoFloat p_y) { m_y = p_y; }
|
|
|
|
LegoFloat GetZ() { return m_z; }
|
|
|
|
void SetZ(LegoFloat p_z) { m_z = p_z; }
|
2024-02-18 12:43:42 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
LegoFloat m_x; // 0x08
|
|
|
|
LegoFloat m_y; // 0x0c
|
|
|
|
LegoFloat m_z; // 0x10
|
|
|
|
};
|
|
|
|
|
|
|
|
// SIZE 0x18
|
|
|
|
class LegoRotationKey : public LegoAnimKey {
|
|
|
|
public:
|
|
|
|
LegoRotationKey();
|
|
|
|
LegoResult Read(LegoStorage* p_storage);
|
2024-03-12 13:21:58 -04:00
|
|
|
LegoFloat GetAngle() { return m_angle; }
|
|
|
|
void SetAngle(LegoFloat p_angle) { m_angle = p_angle; }
|
|
|
|
LegoFloat GetX() { return m_x; }
|
|
|
|
void SetX(LegoFloat p_x) { m_x = p_x; }
|
|
|
|
LegoFloat GetY() { return m_y; }
|
|
|
|
void SetY(LegoFloat p_y) { m_y = p_y; }
|
|
|
|
LegoFloat GetZ() { return m_z; }
|
|
|
|
void SetZ(LegoFloat p_z) { m_z = p_z; }
|
2024-02-18 12:43:42 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
LegoFloat m_angle; // 0x08
|
|
|
|
LegoFloat m_x; // 0x0c
|
|
|
|
LegoFloat m_y; // 0x10
|
|
|
|
LegoFloat m_z; // 0x14
|
|
|
|
};
|
|
|
|
|
|
|
|
// SIZE 0x14
|
|
|
|
class LegoScaleKey : public LegoAnimKey {
|
|
|
|
public:
|
|
|
|
LegoScaleKey();
|
|
|
|
LegoResult Read(LegoStorage* p_storage);
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoFloat GetX() { return m_x; }
|
|
|
|
void SetX(LegoFloat p_x) { m_x = p_x; }
|
|
|
|
LegoFloat GetY() { return m_y; }
|
|
|
|
void SetY(LegoFloat p_y) { m_y = p_y; }
|
|
|
|
LegoFloat GetZ() { return m_z; }
|
|
|
|
void SetZ(LegoFloat p_z) { m_z = p_z; }
|
2024-02-18 12:43:42 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
LegoFloat m_x; // 0x08
|
|
|
|
LegoFloat m_y; // 0x0c
|
|
|
|
LegoFloat m_z; // 0x10
|
|
|
|
};
|
|
|
|
|
|
|
|
// SIZE 0x0c
|
|
|
|
class LegoMorphKey : public LegoAnimKey {
|
|
|
|
public:
|
|
|
|
LegoMorphKey();
|
|
|
|
LegoResult Read(LegoStorage* p_storage);
|
2024-03-12 14:11:13 -04:00
|
|
|
LegoBool GetUnknown0x08() { return m_unk0x08; }
|
2024-02-18 12:43:42 -05:00
|
|
|
|
|
|
|
protected:
|
2024-03-12 14:11:13 -04:00
|
|
|
LegoBool m_unk0x08; // 0x08
|
2024-02-18 12:43:42 -05:00
|
|
|
};
|
|
|
|
|
2024-02-20 12:03:24 -05:00
|
|
|
// SIZE 0x0c
|
|
|
|
class LegoUnknownKey : public LegoAnimKey {
|
|
|
|
public:
|
|
|
|
LegoUnknownKey();
|
|
|
|
LegoResult Read(LegoStorage* p_storage);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
undefined4 m_unk0x08; // 0x08
|
|
|
|
};
|
|
|
|
|
2024-02-18 12:43:42 -05:00
|
|
|
// VTABLE: LEGO1 0x100db8c8
|
|
|
|
// SIZE 0x34
|
|
|
|
class LegoAnimNodeData : public LegoTreeNodeData {
|
|
|
|
public:
|
|
|
|
LegoAnimNodeData();
|
|
|
|
~LegoAnimNodeData() override;
|
|
|
|
LegoResult Read(LegoStorage* p_storage) override; // vtable+0x04
|
|
|
|
LegoResult Write(LegoStorage* p_storage) override; // vtable+0x08
|
|
|
|
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoResult CreateLocalTransform(LegoFloat p_time, Matrix4& p_matrix);
|
2024-03-08 14:28:52 -05:00
|
|
|
LegoBool FUN_100a0990(LegoFloat p_time);
|
|
|
|
|
|
|
|
const LegoChar* GetName() { return m_name; }
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoU32 GetTranslationIndex() { return m_translationIndex; }
|
|
|
|
LegoU32 GetRotationIndex() { return m_rotationIndex; }
|
|
|
|
LegoU32 GetScaleIndex() { return m_scaleIndex; }
|
2024-03-12 14:11:13 -04:00
|
|
|
LegoU32 GetMorphIndex() { return m_morphIndex; }
|
2024-03-11 15:15:18 -04:00
|
|
|
|
|
|
|
void SetTranslationIndex(LegoU32 p_translationIndex) { m_translationIndex = p_translationIndex; }
|
|
|
|
void SetRotationIndex(LegoU32 p_rotationIndex) { m_rotationIndex = p_rotationIndex; }
|
|
|
|
void SetScaleIndex(LegoU32 p_scaleIndex) { m_scaleIndex = p_scaleIndex; }
|
2024-03-12 14:11:13 -04:00
|
|
|
void SetMorphIndex(LegoU32 p_morphIndex) { m_morphIndex = p_morphIndex; }
|
2024-04-12 11:53:22 -04:00
|
|
|
void SetUnknown0x20(undefined2 p_unk0x20) { m_unk0x20 = p_unk0x20; }
|
2024-03-11 15:15:18 -04:00
|
|
|
|
|
|
|
LegoResult CreateLocalTransform(LegoTime p_time, Matrix4& p_matrix)
|
|
|
|
{
|
|
|
|
return CreateLocalTransform((LegoFloat) p_time, p_matrix);
|
|
|
|
}
|
2024-03-08 14:28:52 -05:00
|
|
|
LegoBool FUN_100a0990(LegoTime p_time) { return FUN_100a0990((LegoFloat) p_time); }
|
|
|
|
|
2024-03-11 15:15:18 -04:00
|
|
|
inline static void GetTranslation(
|
2024-03-12 13:21:58 -04:00
|
|
|
LegoU16 p_numTranslationKeys,
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoTranslationKey* p_translationKeys,
|
|
|
|
LegoFloat p_time,
|
|
|
|
Matrix4& p_matrix,
|
|
|
|
LegoU32& p_old_index
|
|
|
|
);
|
|
|
|
/*inline*/ static void GetRotation(
|
2024-03-12 13:21:58 -04:00
|
|
|
LegoU16 p_numRotationKeys,
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoRotationKey* p_rotationKeys,
|
|
|
|
LegoFloat p_time,
|
|
|
|
Matrix4& p_matrix,
|
|
|
|
LegoU32& p_old_index
|
|
|
|
);
|
|
|
|
inline static void GetScale(
|
2024-03-12 13:21:58 -04:00
|
|
|
LegoU16 p_numScaleKeys,
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoScaleKey* p_scaleKeys,
|
|
|
|
LegoFloat p_time,
|
|
|
|
Matrix4& p_matrix,
|
|
|
|
LegoU32& p_old_index
|
|
|
|
);
|
|
|
|
inline static LegoFloat Interpolate(
|
|
|
|
LegoFloat p_time,
|
|
|
|
LegoAnimKey& p_key1,
|
|
|
|
LegoFloat p_value1,
|
|
|
|
LegoAnimKey& p_key2,
|
|
|
|
LegoFloat p_value2
|
|
|
|
);
|
|
|
|
|
|
|
|
static LegoU32 FindKeys(
|
|
|
|
LegoFloat p_time,
|
|
|
|
LegoU32 p_numKeys,
|
|
|
|
LegoAnimKey* p_keys,
|
|
|
|
LegoU32 p_size,
|
|
|
|
LegoU32& p_new_index,
|
|
|
|
LegoU32& p_old_index
|
|
|
|
);
|
|
|
|
|
2024-02-18 12:43:42 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x1009fd80
|
|
|
|
// LegoAnimNodeData::`scalar deleting destructor'
|
|
|
|
|
|
|
|
protected:
|
|
|
|
LegoChar* m_name; // 0x04
|
|
|
|
LegoU16 m_numTranslationKeys; // 0x08
|
|
|
|
LegoU16 m_numRotationKeys; // 0x0a
|
|
|
|
LegoU16 m_numScaleKeys; // 0x0c
|
|
|
|
LegoU16 m_numMorphKeys; // 0x0e
|
|
|
|
LegoTranslationKey* m_translationKeys; // 0x10
|
|
|
|
LegoRotationKey* m_rotationKeys; // 0x14
|
|
|
|
LegoScaleKey* m_scaleKeys; // 0x18
|
|
|
|
LegoMorphKey* m_morphKeys; // 0x1c
|
2024-02-20 12:03:24 -05:00
|
|
|
undefined2 m_unk0x20; // 0x20
|
|
|
|
undefined2 m_unk0x22; // 0x22
|
2024-03-11 15:15:18 -04:00
|
|
|
LegoU32 m_translationIndex; // 0x24
|
|
|
|
LegoU32 m_rotationIndex; // 0x28
|
|
|
|
LegoU32 m_scaleIndex; // 0x2c
|
2024-03-12 14:11:13 -04:00
|
|
|
LegoU32 m_morphIndex; // 0x30
|
2024-02-18 12:43:42 -05:00
|
|
|
};
|
|
|
|
|
2024-02-18 15:31:29 -05:00
|
|
|
// SIZE 0x08
|
|
|
|
struct LegoAnimActorEntry {
|
|
|
|
LegoChar* m_name; // 0x00
|
|
|
|
undefined4 m_unk0x04; // 0x04
|
|
|
|
};
|
|
|
|
|
|
|
|
// SIZE 0x24
|
|
|
|
class LegoAnimScene {
|
|
|
|
public:
|
|
|
|
LegoAnimScene();
|
|
|
|
~LegoAnimScene();
|
|
|
|
LegoResult Read(LegoStorage* p_storage);
|
|
|
|
|
|
|
|
private:
|
2024-02-20 12:03:24 -05:00
|
|
|
LegoU16 m_unk0x00; // 0x00
|
|
|
|
LegoTranslationKey* m_unk0x04; // 0x04
|
|
|
|
LegoU16 m_unk0x08; // 0x08
|
|
|
|
LegoTranslationKey* m_unk0x0c; // 0x0c
|
|
|
|
LegoU16 m_unk0x10; // 0x10
|
|
|
|
LegoUnknownKey* m_unk0x14; // 0x14
|
|
|
|
undefined4 m_unk0x18; // 0x18
|
|
|
|
undefined4 m_unk0x1c; // 0x1c
|
|
|
|
undefined4 m_unk0x20; // 0x20
|
2024-02-18 15:31:29 -05:00
|
|
|
};
|
|
|
|
|
2024-02-18 12:43:42 -05:00
|
|
|
// VTABLE: LEGO1 0x100db8d8
|
|
|
|
// SIZE 0x18
|
|
|
|
class LegoAnim : public LegoTree {
|
|
|
|
public:
|
|
|
|
LegoAnim();
|
|
|
|
~LegoAnim() override;
|
|
|
|
LegoTime GetDuration() { return m_duration; }
|
2024-02-25 12:04:30 -05:00
|
|
|
LegoU32 GetNumActors() { return m_numActors; }
|
2024-02-18 15:31:29 -05:00
|
|
|
LegoResult Write(LegoStorage* p_storage) override; // vtable+0x08
|
|
|
|
virtual LegoResult Read(LegoStorage* p_storage, LegoS32 p_parseScene); // vtable+0x10
|
2024-02-18 12:43:42 -05:00
|
|
|
|
2024-02-25 12:04:30 -05:00
|
|
|
const LegoChar* GetActorName(LegoU32 p_index);
|
|
|
|
undefined4 GetActorUnknown0x04(LegoU32 p_index);
|
|
|
|
|
2024-02-18 12:43:42 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x100a0ba0
|
|
|
|
// LegoAnim::`scalar deleting destructor'
|
|
|
|
|
|
|
|
protected:
|
2024-02-18 15:31:29 -05:00
|
|
|
LegoTime m_duration; // 0x08
|
|
|
|
LegoAnimActorEntry* m_actors; // 0x0c
|
|
|
|
LegoU32 m_numActors; // 0x10
|
|
|
|
LegoAnimScene* m_scene; // 0x14
|
2024-02-18 12:43:42 -05:00
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a1040
|
|
|
|
LegoTreeNodeData* CreateData() override { return new LegoAnimNodeData(); } // vtable+0x0c
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __LEGOANIM_H
|