From a61011c82ff5277cc8b74564834935b3830672e7 Mon Sep 17 00:00:00 2001 From: Aetias Date: Mon, 8 Apr 2024 23:32:48 +0200 Subject: [PATCH] Add vtable for `ModelRender` --- include/Item/ItemManager.hpp | 4 ++-- include/Render/ModelRender.hpp | 20 ++++++++++++++++++++ include/lib/math.h | 7 +++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/include/Item/ItemManager.hpp b/include/Item/ItemManager.hpp index b1ff2db0..44defa6f 100644 --- a/include/Item/ItemManager.hpp +++ b/include/Item/ItemManager.hpp @@ -9,6 +9,7 @@ #include "Player/EquipItem.hpp" #include "System/SysNew.hpp" #include "System/OverlayManager.hpp" +#include "Render/ModelRender.hpp" #define MAX_HOURGLASS_SECONDS 1500 // 25 minutes @@ -143,7 +144,6 @@ enum DungeonItemModelId_ { DungeonItemModelId_TriangleCrystal, // switch_cstl_t_c DungeonItemModelId_COUNT, }; -struct ItemModel; struct SaveItemManager { /* 00 */ ItemFlags itemFlags; @@ -202,7 +202,7 @@ private: /* 0be */ unk8 mUnk_0be[2]; // padding? /* 0c0 */ ItemModel *mItemModels[ItemModelId_COUNT]; /* 100 */ ItemModel *mDungeonItemModels[DungeonItemModelId_COUNT]; // non-null in dungeons/caves - /* 114 */ void *mUnk_114; + /* 114 */ ModelRender *mUnk_114; /* 118 */ ItemId mFanfareItem; /* 11c */ unk32 mUnk_11c; /* 120 */ void *mFanfareItemModel; diff --git a/include/Render/ModelRender.hpp b/include/Render/ModelRender.hpp index b7a99bb8..d511175b 100644 --- a/include/Render/ModelRender.hpp +++ b/include/Render/ModelRender.hpp @@ -5,7 +5,10 @@ #include "System/SysNew.hpp" +class ItemModel; + class ModelRender : public SysObject { +public: /* 00 (vtable) */ /* 04 */ u32 mUnk_04; /* 08 */ void *mLcdcAddr; @@ -17,4 +20,21 @@ class ModelRender : public SysObject { /* 20 */ unk8 mUnk_20[0x38]; /* 58 */ void *mUnk_58; /* 5c */ + + /* 00 */ virtual ~ModelRender(); + /* 08 */ virtual void* GetLcdcAddress(); + /* 0c */ virtual void vfunc_0c(ItemModel *model); + /* 10 */ virtual void SetTransform(Vec3p *scale, Mat3p *rotation, Vec3p *translation); + /* 14 */ virtual void SetRotationTranslation(Mat3p *rotation, Vec3p *translation); + /* 18 */ virtual void SetTranslation(Vec3p *translation); + /* 1c */ virtual void PushGeometryCommands(); + /* 20 */ virtual void vfunc_20(); + /* 24 */ virtual void vfunc_24(unk32 param1); + /* 28 */ virtual void vfunc_28(); + /* 2c */ virtual void vfunc_2c(); + /* 30 */ virtual void vfunc_30(); + /* 34 */ virtual void vfunc_34(); + /* 38 */ virtual void vfunc_38(); + /* 3c */ virtual void vfunc_3c(); + /* 40 */ }; diff --git a/include/lib/math.h b/include/lib/math.h index 0eae4aa1..8790c9f6 100644 --- a/include/lib/math.h +++ b/include/lib/math.h @@ -28,6 +28,13 @@ typedef struct { /* 10 */ } Vec4p; +typedef struct { + /* 00 */ Vec3p xColumn; + /* 0c */ Vec3p yColumn; + /* 18 */ Vec3p zColumn; + /* 24 */ +} Mat3p; + extern "C" u32 FastDivide(u32 a, u32 b); extern "C" u32 Divide(u32 a, u32 b); extern "C" bool Approach(unk32 *src, unk32 dest, unk32 step);