Implement methods to load dta files. (#673)

* Implement methods to load dta files.

* fix style issues

* fix vtables

* fix more style issues

* fix ddtor names

* Remove explicit padding, add annotations, asserts

* Use List template

* trigger CI

* Fix class refactor

* Match code, fix annotations

* Fix

* 98% match

* Fix

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert
2024-03-15 20:43:45 -04:00
committed by GitHub
parent 4ddd9e200c
commit d07d7edc81
11 changed files with 470 additions and 15 deletions

View File

@@ -3,6 +3,33 @@
#include "legostate.h"
// SIZE 0x30
struct ModelInfo {
char* m_modelName; // 0x00
MxU8 m_unk0x04; // 0x04
float m_location[3]; // 0x08
float m_direction[3]; // 0x14
float m_up[3]; // 0x20
MxU8 m_unk0x2c; // 0x2c
};
// SIZE 0x30
struct AnimInfo {
char* m_animName; // 0x00
undefined4 m_unk0x04; // 0x04
MxS16 m_unk0x08; // 0x08
MxU8 m_unk0x0a; // 0x0a
MxU8 m_unk0x0b; // 0x0b
MxU8 m_unk0x0c; // 0x0c
MxU8 m_unk0x0d; // 0x0d
MxU32 m_unk0x10[4]; // 0x10
MxU8 m_modelCount; // 0x20
ModelInfo* m_models; // 0x24
MxU8 m_unk0x28; // 0x28
MxU8 m_unk0x29; // 0x29
MxS8 m_unk0x2a[3]; // 0x2a
};
// VTABLE: LEGO1 0x100d8d80
// SIZE 0x1c
class AnimState : public LegoState {
@@ -26,6 +53,9 @@ public:
MxBool SetFlag() override; // vtable+0x18
MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c
void FUN_100651d0(MxU32, AnimInfo*, MxU32&);
void FUN_10065240(MxU32, AnimInfo*, MxU32);
// SYNTHETIC: LEGO1 0x10065130
// AnimState::`scalar deleting destructor'

View File

@@ -24,6 +24,7 @@ class Isle : public LegoWorld {
public:
Isle();
~Isle() override;
MxLong Notify(MxParam& p_param) override; // vtable+0x04
// FUNCTION: LEGO1 0x10030910
@@ -42,22 +43,25 @@ public:
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+50
void Add(MxCore* p_object) override; // vtable+58
// FUNCTION: LEGO1 0x10030900
MxBool VTable0x5c() override { return TRUE; } // vtable+5c
// FUNCTION: LEGO1 0x10033170
void VTable0x60() override {} // vtable+60
void VTable0x60() override {} // vtable+60
MxBool VTable0x64() override; // vtable+64
void Enable(MxBool p_enable) override; // vtable+68
virtual void VTable0x6c(IslePathActor* p_actor); // vtable+6c
inline void SetUnknown13c(MxU32 p_unk0x13c) { m_unk0x13c = p_unk0x13c; }
MxLong StopAction(MxParam& p_param);
MxLong HandleType17Notification(MxParam& p_param);
MxLong HandleType19Notification(MxParam& p_param);
MxLong HandleTransitionEnd();
void FUN_10032620();
inline void SetUnknown13c(MxU32 p_unk0x13c) { m_unk0x13c = p_unk0x13c; }
// SYNTHETIC: LEGO1 0x10030a30
// Isle::`scalar deleting destructor'

View File

@@ -1,15 +1,24 @@
#ifndef LEGOANIMATIONMANAGER_H
#define LEGOANIMATIONMANAGER_H
#include "animstate.h"
#include "decomp.h"
#include "legotraninfolist.h"
#include "mxcore.h"
// SIZE 0x18
struct Character {
char* m_name; // 0x00
undefined m_unk0x04[0x10]; // 0x04
MxBool m_active; // 0x14
};
// VTABLE: LEGO1 0x100d8c18
// SIZE 0x500
class LegoAnimationManager : public MxCore {
public:
LegoAnimationManager();
~LegoAnimationManager() override; // vtable+0x00
~LegoAnimationManager() override;
MxLong Notify(MxParam& p_param) override; // vtable+0x04
MxResult Tickle() override; // vtable+0x08
@@ -31,8 +40,14 @@ public:
void FUN_1005ef10();
void FUN_1005f0b0();
void FUN_1005f6d0(MxBool);
void FUN_1005f720(MxS32 p_scriptIndex);
MxResult LoadScriptInfo(MxS32 p_scriptIndex);
MxBool FUN_10060140(char* p_name, MxU32& p_index);
MxResult ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info);
MxResult ReadModelInfo(LegoFile* p_file, ModelInfo* p_info);
void FUN_100603c0();
void FUN_10061010(undefined4);
void FUN_100617c0(MxS32, MxU16&, MxU32&);
MxS8 FUN_10062360(char*);
void FUN_10064670(MxBool);
static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig);
@@ -43,7 +58,34 @@ public:
private:
void Init();
undefined m_unk0x08[0x4f8]; // 0x08
undefined4 m_unk0x08; // 0x08
MxU16 m_animCount; // 0x0c
MxU16 m_unk0x0e; // 0x0e
MxU32 m_unk0x10; // 0x10
AnimInfo* m_anims; // 0x14
undefined m_unk0x018[8]; // 0x18
LegoTranInfoList* m_tranInfoList; // 0x20
LegoTranInfoList* m_tranInfoList2; // 0x24
undefined4 m_unk0x28[2]; // 0x28
undefined4 m_unk0x30[2]; // 0x30
undefined m_unk0x38; // 0x38
undefined m_unk0x39; // 0x39
undefined m_unk0x3a; // 0x3a
undefined m_unk0x3b[0x3c1]; // 0x3b
undefined4 m_unk0x3fc; // 0x3fc
MxU8 m_unk0x400; // 0x400
undefined m_unk0x401; // 0x401
MxU8 m_unk0x402; // 0x402
undefined m_unk0x403[0x1d]; // 0x403
AnimState* m_animState; // 0x420
undefined4 m_unk0x424; // 0x424
undefined m_unk0x428; // 0x428
undefined m_unk0x429; // 0x429
undefined m_unk0x42a; // 0x42a
undefined m_unk0x42b; // 0x42b
undefined4 m_unk0x42c; // 0x42c
undefined m_unk0x430; // 0x430
undefined m_unk0x431[0xcf]; // 0x431
};
#endif // LEGOANIMATIONMANAGER_H

View File

@@ -98,7 +98,6 @@ public:
inline MxS32 GetIndex() { return m_index; }
inline const char* GetKey() { return m_key; }
private:
MxS32 m_index; // 0x00
char m_key[20]; // 0x04
MxAtomId* m_script; // 0x18
@@ -203,6 +202,7 @@ public:
MxS32 GetScriptIndex(const char* p_key);
static MxS32 GetCurrPathInfo(LegoPathBoundary**, MxS32&);
const char* FindScript(MxU32 p_id);
static void CreateInstance();
static LegoOmni* GetInstance();

View File

@@ -0,0 +1,11 @@
#ifndef LEGOTRANINFO_H
#define LEGOTRANINFO_H
#include "decomp.h"
// SIZE 0x78
struct LegoTranInfo { // See FUN_100609f0 for construction
undefined m_unk0x00[0x78]; // 0x00
};
#endif // LEGOTRANINFO_H

View File

@@ -0,0 +1,51 @@
#ifndef LEGOTRANINFOLIST_H
#define LEGOTRANINFOLIST_H
#include "legotraninfo.h"
#include "mxlist.h"
#include "mxtypes.h"
// VTABLE: LEGO1 0x100d8ca8
// class MxCollection<LegoTranInfo *>
// VTABLE: LEGO1 0x100d8cc0
// class MxList<LegoTranInfo *>
// VTABLE: LEGO1 0x100d8cd8
// class MxPtrList<LegoTranInfo>
// VTABLE: LEGO1 0x100d8c90
// SIZE 0x18
class LegoTranInfoList : public MxPtrList<LegoTranInfo> {
public:
LegoTranInfoList() : MxPtrList<LegoTranInfo>(FALSE) {}
};
// TEMPLATE: LEGO1 0x1005fdf0
// MxCollection<LegoTranInfo *>::Compare
// TEMPLATE: LEGO1 0x1005fe00
// MxCollection<LegoTranInfo *>::~MxCollection<LegoTranInfo *>
// TEMPLATE: LEGO1 0x1005fe50
// MxCollection<LegoTranInfo *>::Destroy
// TEMPLATE: LEGO1 0x1005fe60
// MxList<LegoTranInfo *>::~MxList<LegoTranInfo *>
// SYNTHETIC: LEGO1 0x1005fef0
// LegoTranInfoList::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1005ff60
// MxPtrList<LegoTranInfo>::~MxPtrList<LegoTranInfo>
// SYNTHETIC: LEGO1 0x1005ffb0
// MxCollection<LegoTranInfo *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x10060020
// MxList<LegoTranInfo *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x100600d0
// MxPtrList<LegoTranInfo>::`scalar deleting destructor'
#endif // LEGOTRANINFOLIST_H