lyt_pane matching

This commit is contained in:
elijah-thomas774
2024-05-23 00:16:00 -04:00
parent d69b2b450c
commit 08e0e57034
16 changed files with 901 additions and 154 deletions
+1
View File
@@ -18,6 +18,7 @@ force_active: [
"GetResource__Q34nw4r3lyt24MultiArcResourceAccessorFUlPCcPUl",
"RegistFont__Q34nw4r3lyt24MultiArcResourceAccessorFPQ34nw4r3lyt11FontRefLink",
"GetFont__Q34nw4r3lyt24MultiArcResourceAccessorFPCc",
"GetPaneRect__Q34nw4r3lyt4PaneCFRCQ34nw4r3lyt8DrawInfo",
]
# modules:
+12
View File
@@ -316,6 +316,18 @@ nw4r/db/db_directPrint.cpp:
.sbss start:0x805765E8 end:0x805765EC
.bss start:0x80636B80 end:0x80636BA4
nw4r/lyt/lyt_init.cpp:
.text start:0x80486A70 end:0x80486AC4
.data start:0x8056E3E8 end:0x8056E430
.sdata start:0x80574EB0 end:0x80574EB8
nw4r/lyt/lyt_pane.cpp:
.text start:0x80486AD0 end:0x80487EAC
.ctors start:0x804DB974 end:0x804DB978
.data start:0x8056E430 end:0x8056E4A8
.sbss start:0x805766F0 end:0x805766F8
.sdata2 start:0x8057F220 end:0x8057F240
nw4r/lyt/lyt_resourceAccessor.cpp:
.text start:0x80492000 end:0x80492058
.data start:0x8056E7E0 end:0x8056E7F8
+14 -16
View File
@@ -2880,7 +2880,7 @@ fn_80065E70 = .text:0x80065E70; // type:function size:0xC4
fn_80065F40 = .text:0x80065F40; // type:function size:0x28
fn_80065F70 = .text:0x80065F70; // type:function size:0x328
fn_800662A0 = .text:0x800662A0; // type:function size:0xD4
fn_80066380 = .text:0x80066380; // type:function size:0x8
GetRuntimeTypeInfo__Q34nw4r3lyt4PaneCFv = .text:0x80066380; // type:function size:0x8
fn_80066390 = .text:0x80066390; // type:function size:0xE8
fn_80066480 = .text:0x80066480; // type:function size:0xC
fn_80066490 = .text:0x80066490; // type:function size:0x40
@@ -17361,7 +17361,7 @@ searchBaseByGroupType__10fManager_cFUcPC7fBase_c = .text:0x802E2980; // type:fun
mainLoop__10fManager_cFv = .text:0x802E29E0; // type:function size:0xC0
__sinit_\f_manager_cpp = .text:0x802E2AA0; // type:function size:0x138 scope:local
__ct__9fLiMgBa_cFv = .text:0x802E2BE0; // type:function size:0x10
fn_802E2BF0 = .text:0x802E2BF0; // type:function size:0x1C scope:local
__arraydtor = .text:0x802E2BF0; // type:function size:0x1C scope:local
walkPack__11fTrMgPTMF_cFv = .text:0x802E2C10; // type:function size:0x84
searchNodeByProfName__9fTrMgBa_cCFUsPC9fTrNdBa_c = .text:0x802E2CA0; // type:function size:0x68
searchNodeByGroupType__9fTrMgBa_cCFUcPC9fTrNdBa_c = .text:0x802E2D10; // type:function size:0x68
@@ -25854,15 +25854,13 @@ LytInit__Q24nw4r3lytFv = .text:0x80486A70; // type:function size:0x54
__ct__Q34nw4r3lyt4PaneFPCQ44nw4r3lyt3res4Pane = .text:0x80486AD0; // type:function size:0x128
__dt__Q34nw4r3lyt4PaneFv = .text:0x80486C00; // type:function size:0x13C
AppendChild__Q34nw4r3lyt4PaneFPQ34nw4r3lyt4Pane = .text:0x80486D40; // type:function size:0x50
RemoveChild__Q34nw4r3lyt4PaneFPQ34nw4r3lyt4P = .text:0x80486D90; // type:function size:0x3C
FUN_80486dd0 = .text:0x80486DD0; // type:function size:0x110
FUN_80486ee0 = .text:0x80486EE0; // type:function size:0x110
RemoveChild__Q34nw4r3lyt4PaneFPQ34nw4r3lyt4Pane = .text:0x80486D90; // type:function size:0x3C
GetPaneRect__Q34nw4r3lyt4PaneCFv = .text:0x80486DD0; // type:function size:0x110
GetPaneRect__Q34nw4r3lyt4PaneCFRCQ34nw4r3lyt8DrawInfo = .text:0x80486EE0; // type:function size:0x110
GetVtxColor__Q34nw4r3lyt4PaneCFUl = .text:0x80486FF0; // type:function size:0xC
SetVtxColor__Q34nw4r3lyt4PaneFUlQ34nw4r2ut5Color = .text:0x80487000; // type:function size:0x4
GetColorElement__Q34nw4r3lyt4PaneCFUl = .text:0x80487010; // type:function size:0x20
fn_80487030 = .text:0x80487030; // type:function size:0x4
SetColorElement__Q34nw4r3lyt4PaneFUlUc = .text:0x80487040; // type:function size:0x20
fn_80487060 = .text:0x80487060; // type:function size:0x4
GetColorElement__Q34nw4r3lyt4PaneCFUl = .text:0x80487010; // type:function size:0x24
SetColorElement__Q34nw4r3lyt4PaneFUlUc = .text:0x80487040; // type:function size:0x24
GetVtxColorElement__Q34nw4r3lyt4PaneCFUl = .text:0x80487070; // type:function size:0x8
SetVtxColorElement__Q34nw4r3lyt4PaneFUlUc = .text:0x80487080; // type:function size:0x4
FindPaneByName__Q34nw4r3lyt4PaneFPCcb = .text:0x80487090; // type:function size:0xA8
@@ -25886,10 +25884,10 @@ GetVtxPos__Q34nw4r3lyt4PaneCFv = .text:0x80487C80; // type:function size:0xC8
GetMaterialNum__Q34nw4r3lyt4PaneCFv = .text:0x80487D50; // type:function size:0x14
GetMaterial__Q34nw4r3lyt4PaneCFv = .text:0x80487D70; // type:function size:0x8
GetMaterial__Q34nw4r3lyt4PaneCFUl = .text:0x80487D80; // type:function size:0x20
GetExtUserData__Q34nw4r3lyt4PaneCFv = .text:0x80487DA0; // type:function size:0x1C
GetExtUserDataNum__Q34nw4r3lyt4PaneCFv = .text:0x80487DC0; // type:function size:0x1C
GetExtUserDataNum__Q34nw4r3lyt4PaneCFv = .text:0x80487DA0; // type:function size:0x1C
GetExtUserData__Q34nw4r3lyt4PaneCFv = .text:0x80487DC0; // type:function size:0x1C
FindExtUserDataByName__Q34nw4r3lyt4PaneFPCc = .text:0x80487DE0; // type:function size:0xBC
__sinit_lyt_pane_cpp = .text:0x80487EA0; // type:function size:0xC
__sinit_\lyt_pane_cpp = .text:0x80487EA0; // type:function size:0xC scope:local
__ct__Q34nw4r3lyt5GroupFPCQ44nw4r3lyt3res5GroupPQ34nw4r3lyt4Pane = .text:0x80487EB0; // type:function size:0x114
__dt__Q34nw4r3lyt5GroupFv = .text:0x80487FD0; // type:function size:0xAC
__dt__Q34nw4r3lyt14GroupContainerFv = .text:0x80488080; // type:function size:0xCC
@@ -37073,8 +37071,8 @@ lbl_8056E32C = .data:0x8056E32C; // type:object size:0x14
lbl_8056E340 = .data:0x8056E340; // type:object size:0x10
lbl_8056E350 = .data:0x8056E350; // type:object size:0x38
lbl_8056E388 = .data:0x8056E388; // type:object size:0x60
lbl_8056E3E8 = .data:0x8056E3E8; // type:object size:0x48
lbl_8056E430 = .data:0x8056E430; // type:object size:0x78
lbl_8056E3E8 = .data:0x8056E3E8; // type:object size:0x46 scope:local data:string
__vt__Q34nw4r3lyt4Pane = .data:0x8056E430; // type:object size:0x74
lbl_8056E4A8 = .data:0x8056E4A8; // type:object size:0x10
lbl_8056E4B8 = .data:0x8056E4B8; // type:object size:0x40
lbl_8056E4F8 = .data:0x8056E4F8; // type:object size:0x78
@@ -39586,7 +39584,7 @@ lbl_80574E94 = .sdata:0x80574E94; // type:object size:0x4
lbl_80574E98 = .sdata:0x80574E98; // type:object size:0x8
lbl_80574EA0 = .sdata:0x80574EA0; // type:object size:0x8 data:4byte
lbl_80574EA8 = .sdata:0x80574EA8; // type:object size:0x8 data:4byte
lbl_80574EB0 = .sdata:0x80574EB0; // type:object size:0x8 data:4byte
NW4R_LYT_Version___22@unnamed@lyt_init_cpp@ = .sdata:0x80574EB0; // type:object size:0x4 scope:local data:4byte
lbl_80574EB8 = .sdata:0x80574EB8; // type:object size:0x8
lbl_80574EC0 = .sdata:0x80574EC0; // type:object size:0x2 data:string
lbl_80574EC4 = .sdata:0x80574EC4; // type:object size:0x3 data:string
@@ -40877,7 +40875,7 @@ lbl_805766D0 = .sbss:0x805766D0; // type:object size:0x8 data:4byte
lbl_805766D8 = .sbss:0x805766D8; // type:object size:0x8 data:byte
lbl_805766E0 = .sbss:0x805766E0; // type:object size:0x8 data:byte
lbl_805766E8 = .sbss:0x805766E8; // type:object size:0x8 data:4byte
lbl_805766F0 = .sbss:0x805766F0; // type:object size:0x8 data:4byte
typeInfo__Q34nw4r3lyt4Pane = .sbss:0x805766F0; // type:object size:0x4 data:4byte
mspAllocator__Q34nw4r3lyt6Layout = .sbss:0x805766F8; // type:object size:0x8 data:4byte
lbl_80576700 = .sbss:0x80576700; // type:object size:0x8 data:4byte
lbl_80576708 = .sbss:0x80576708; // type:object size:0x8 data:4byte
+2
View File
@@ -352,6 +352,8 @@ config.libs = [
nw4rLib(
"lyt",
[
Object(Matching, "nw4r/lyt/lyt_init.cpp"),
Object(Matching, "nw4r/lyt/lyt_pane.cpp"),
Object(Matching, "nw4r/lyt/lyt_resourceAccessor.cpp"),
Object(Matching, "nw4r/lyt/lyt_arcResourceAccessor.cpp"),
Object(Matching, "nw4r/lyt/lyt_common.cpp"),
+41 -26
View File
@@ -19,32 +19,25 @@ struct AnimationBlock {
};
struct AnimTransform {
inline AnimTransform() : mNode(), mResource(NULL), mFrame(0.0f) {}
inline AnimTransform() : mLink(), mpRes(NULL), mFrame(0.0f) {}
u16 GetFrameSize() const;
bool IsLoopData() const;
virtual ~AnimTransform() = 0;
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor) = 0;
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor, u16 animNum) = 0;
virtual void Bind(Pane *pPane, bool bRecursive) = 0;
virtual void Bind(Material *pMaterial, bool bDisable) = 0;
virtual void Animate(u32 idx, Pane *pPane) = 0;
virtual void Animate(u32 idx, Material *pMaterial) = 0;
ut::LinkListNode mNode; // at 0x0
AnimationBlock *mResource; // at 0xC
f32 mFrame; // at 0x10
};
struct AnimTransformBasic : AnimTransform {
AnimTransformBasic();
virtual ~AnimTransformBasic();
virtual UNKTYPE SetResource(const res::AnimationBlock *, ResourceAccessor *);
virtual UNKTYPE Bind(Pane *, bool);
virtual UNKTYPE Bind(Material *);
virtual UNKTYPE Animate(u32, Pane *);
virtual UNKTYPE Animate(u32, Material *);
u32 INT_0x14;
u32 INT_0x18;
u16 INT_0x1C;
ut::LinkListNode mLink; // at 0x0
AnimationBlock *mpRes; // at 0xC
f32 mFrame; // at 0x10
};
struct AnimationLink {
inline AnimationLink() : mNode() {
inline AnimationLink() : mLink() {
Reset();
}
@@ -53,16 +46,38 @@ struct AnimationLink {
}
inline void Set(AnimTransform *pTransform, u16 us, bool b) {
mTransform = pTransform;
SHORT_0xC = us;
BOOL_0xE = b;
mAnimTrans = pTransform;
mIdx = us;
mbDisable = b;
}
ut::LinkListNode mNode; // at 0x0
AnimTransform *mTransform; // at 0x8
u16 SHORT_0xC;
bool BOOL_0xE;
ut::LinkListNode mLink; // at 0x0
AnimTransform *mAnimTrans; // at 0x8
u16 mIdx; // at 0xC
bool mbDisable; // at 0xE
};
struct AnimTransformBasic : AnimTransform {
AnimTransformBasic();
virtual ~AnimTransformBasic(); // at 0x08
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor); // at 0x0C
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor, u16 animNum); // at 0x10
virtual void Bind(Pane *pPane, bool bRecursive); // at 0x14
virtual void Bind(Material *pMaterial, bool bDisable); // at 0x18
virtual void Animate(u32 idx, Pane *pPane); // at 0x1C
virtual void Animate(u32 idx, Material *pMaterial); // at 0x20
void *mpFileResAry; // at 0x14
AnimationLink *mAnimLinkAry; // at 0x18
u16 mAnimLinkNum; // at 0x1C
};
namespace detail {
void UnbindAnimationLink(ut::LinkList<AnimationLink, 0> *, AnimTransform *);
AnimationLink *FindAnimationLink(ut::LinkList<AnimationLink, 0> *, AnimTransform *);
AnimationLink *FindAnimationLink(ut::LinkList<AnimationLink, 0> *, const AnimResource &);
void UnbindAnimationLink(ut::LinkList<AnimationLink, 0> *, AnimTransform *);
} // namespace detail
} // namespace lyt
} // namespace nw4r
+77 -2
View File
@@ -3,18 +3,93 @@
#include "common.h"
#include "nw4r/math/math_types.h"
#include "nw4r/ut/ut_Rect.h"
#include <nw4r/lyt/lyt_types.h>
namespace nw4r {
namespace lyt {
struct DrawInfo {
virtual ~DrawInfo();
DrawInfo();
bool isYAxisUp() const {
// NYI
}
// field accessors
const math::VEC2 &GetLocationAdjustScale() const {
return mScale;
}
void SetLocationAdjustScale(const math::VEC2 &scale) {
this->mScale = scale;
}
const math::MTX34 &GetViewMtx() const {
return mViewMtx;
}
void SetViewMtx(const math::MTX34 &value) {
this->mViewMtx = value;
}
f32 GetGlobalAlpha() const {
return mGlobalAlpha;
}
void SetGlobalAlpha(f32 alpha) {
this->mGlobalAlpha = alpha;
}
const ut::Rect &GetViewRect() const {
return this->mViewRect;
}
void SetViewRect(const ut::Rect &value) {
this->mViewRect = value;
}
// mFlags accessors
bool IsInvisiblePaneCalculateMtx() const {
return mFlags.invisiblePaneCalculateMtx;
}
void SetInvisiblePaneCalculateMtx(bool bEnable) {
this->mFlags.invisiblePaneCalculateMtx = bEnable;
}
bool IsLocationAdjust() const {
return mFlags.locationAdjust;
}
void SetLocationAdjust(bool bEnable) {
this->mFlags.locationAdjust = bEnable;
}
bool IsMultipleViewMtxOnDraw() const {
return mFlags.mulViewDraw;
}
void SetMultipleViewMtxOnDraw(bool bEnable) {
this->mFlags.mulViewDraw = bEnable;
}
bool IsInfluencedAlpha() const {
return mFlags.influencedAlpha;
}
void SetInfluencedAlpha(bool bEnable) {
this->mFlags.influencedAlpha = bEnable;
}
bool IsDebugDrawMode() const {
return mFlags.debugDrawMode;
}
void SetDebugDrawMode(bool bEnable) {
this->mFlags.debugDrawMode = bEnable;
}
private:
math::MTX34 mViewMtx; // at 0x0
ut::Rect mViewRect; // at 0x34
math::VEC2 mScale; // at 0x44
f32 mGlobalAlpha; // at 0x48
u8 mFlags; // at 0x50
struct {
u8 mulViewDraw : 1;
u8 influencedAlpha : 1;
u8 locationAdjust : 1;
u8 invisiblePaneCalculateMtx : 1;
u8 debugDrawMode : 1;
} mFlags; // at 0x50
};
} // namespace lyt
} // namespace nw4r
+10
View File
@@ -0,0 +1,10 @@
#ifndef NW4R_LYT_INIT_H
#define NW4R_LYT_INIT_H
namespace nw4r {
namespace lyt {
void LytInit();
}
} // namespace nw4r
#endif
+4 -2
View File
@@ -41,8 +41,10 @@ struct Layout {
template <typename T>
static void DeleteObj(T *t) {
t->~T();
FreeMemory(t);
if (t) {
t->~T();
FreeMemory(t);
}
}
template <typename T>
+49 -11
View File
@@ -2,22 +2,60 @@
#define NW4R_LYT_MATERIAL_H
#include "nw4r/lyt/lyt_animation.h"
#include "nw4r/ut/ut_LinkList.h"
#include <nw4r/ut/ut_Color.h>
#include <rvl/GX.h>
#define MATERIAL_NAME_SIZE 20
namespace nw4r {
namespace lyt {
// TO-DO
struct BitGXNums {
union {
u32 texSRT;
u32 texCoordGen;
u32 indSRT;
u32 indStage;
u32 tevSwap;
u32 tevStage;
u32 chanCtrl;
u32 matCol;
u32 alpComp;
u32 blendMode;
};
};
struct Material {
ut::LinkList<AnimationLink, 0> mAnimLinks; // at 0x4
// . . .
GXColorS10 COLOR_0x10;
GXColorS10 COLOR_0x18;
GXColorS10 COLOR_0x20;
// . . .
UNKWORD WORD_0x40;
// . . .
u8 BYTE_0x59;
// . . .
// SetupGX__Q34nw4r3lyt8MaterialFbUc
// BindAnimation__Q34nw4r3lyt8MaterialFPQ34nw4r3lyt13AnimTransform
// UnbindAnimation__Q34nw4r3lyt8MaterialFPQ34nw4r3lyt13AnimTransform
// UnbindAllAnimation__Q34nw4r3lyt8MaterialFv
// Animate__Q34nw4r3lyt8MaterialFv
// FindAnimationLink__Q34nw4r3lyt8MaterialFPQ34nw4r3lyt13AnimTransform
// FindAnimationLink__Q34nw4r3lyt8MaterialFRCQ34nw4r3lyt12AnimResource
// SetAnimationEnable__Q34nw4r3lyt8MaterialFPQ34nw4r3lyt13AnimTransformb
// SetAnimationEnable__Q34nw4r3lyt8MaterialFRCQ34nw4r3lyt12AnimResourceb
virtual ~Material(); // at 0x08
virtual bool SetupGX(bool bModVtxCok, u8 alpha); // at 0x0C
virtual void BindAnimation(AnimTransform *pAnimTrans); // at 0x10
virtual void UnbindAnimation(AnimTransform *pAnimTrans); // at 0x14
virtual void UnbindAllAnimation(); // at 0x18
virtual void Animate(); // at 0x1C
virtual AnimationLink *FindAnimationLink(AnimTransform *pAnimTrans); // at 0x20
virtual AnimationLink *FindAnimationLink(const AnimResource &animRes); // at 0x24
virtual void SetAnimationEnable(AnimTransform *pAnimTrans, bool bEnable); // at 0x28
virtual void SetAnimationEnable(const AnimResource &animRes, bool bEnable); // at 0x2C
ut::LinkList<AnimationLink, 0> mAnimList; // at 0x4
GXColorS10 mTevCols[3]; // at 0x10
ut::Color mTevKCols[4]; // at 0x28
BitGXNums mGXMemCap; // at 0x38
BitGXNums mGXMemNum; // at 0x3C
void *mpGXMem; // at 0x40
char mName[MATERIAL_NAME_SIZE + 1]; // at 0x44
bool mbUserAllocated; // at 0x59
u8 mPadding[2]; // at 0x5A
};
} // namespace lyt
} // namespace nw4r
+105 -89
View File
@@ -7,51 +7,63 @@
#include "nw4r/ut/ut_LinkList.h"
#include "nw4r/ut/ut_RuntimeTypeInfo.h"
#include "nw4r/ut/ut_algorithm.h"
#include <MSL_C/string.h>
#include <nw4r/lyt/lyt_types.h>
#include <string.h>
#define PANE_NAME_SIZE 17
#define PANE_USERDATA_SIZE 9
#define PANE_NAME_SIZE 16
#define PANE_USERDATA_SIZE 8
#define ANIMTARGET_PANE_MAX 10
namespace nw4r {
namespace lyt {
void LytInit();
struct Size {
inline Size() : x(), y() {}
inline Size() : width(), height() {}
inline Size &operator=(const Size &rhs) {
x = rhs.x;
y = rhs.y;
width = rhs.width;
height = rhs.height;
return *this;
}
f32 x, y;
f32 width, height;
};
namespace detail {
struct PaneBase {
inline PaneBase() : mNode() {}
PaneBase();
virtual ~PaneBase();
ut::LinkListNode mNode; // at 0x4
ut::LinkListNode mLink; // at 0x4
};
} // namespace detail
// TODO: Find proper place?
// GUESS: In the FindExtUserDataByName function it iterates through ExtUserData
struct ExtUserData {
u32 stringOffs;
u32 UNK_0x04;
u32 UNK_0x08;
};
namespace res {
struct ExtUserDataList {
DataBlockHeader blockHeader; // at 0x00
u16 num; // at 0x08
u16 padding; // at 0x0A
};
struct Pane {
u32 mMagic; // "pan1", at 0x0
u32 mLength; // at 0x4
u8 BYTE_0x8;
u8 BYTE_0x9;
u8 BYTE_0xA;
u8 BYTE_0xB; // NO REFERENCES
char mName[PANE_NAME_SIZE]; // at 0xC
DataBlockHeader blockHeader; // at 0x00 "pan1"
u8 flag; // at 0x08
u8 basePosition; // at 0x09
u8 alpha; // at 0x0A
u8 padding; //
char name[PANE_NAME_SIZE]; // at 0x0C
char mUserData[PANE_USERDATA_SIZE]; // at 0x1C
math::VEC3 VEC3_0x24;
math::VEC3 VEC3_0x30;
math::VEC2 VEC2_0x3C;
Size mSize; // at 0x44
math::VEC3 translate; // at 0x24
math::VEC3 rotate; // at 0x30
math::VEC2 scale; // at 0x3C
Size size; // at 0x44
};
} // namespace res
@@ -59,77 +71,81 @@ struct Pane : detail::PaneBase {
// For use with TestBit<Uc>
enum PaneBits { VISIBLE, INFLUENCED_ALPHA, LOCATION_ADJUST };
inline void Init() {
mParent = NULL;
mMaterial = NULL;
BYTE_0xD6 = 0;
INT_0xB4 = 0;
bool IsVisible() const {
return detail::TestBit<u8>(mFlag, VISIBLE);
}
bool IsInfluencedAlpha() const {
return detail::TestBit<u8>(mFlag, INFLUENCED_ALPHA);
}
bool IsLocationAdjust() const {
return detail::TestBit<u8>(mFlag, LOCATION_ADJUST);
}
inline void SetName(const char *pName) {
strncpy(mName, pName, PANE_NAME_SIZE);
mName[PANE_NAME_SIZE - 1] = '\0';
}
Pane(const res::Pane *pBlock);
void Init();
void SetName(const char *pName);
void SetUserData(const char *pData);
void AppendChild(Pane *pChild);
void PrependChild(Pane *pChild);
void InsertChild(Pane *at, Pane *pChild);
void InsertChild(ut::LinkList<Pane, 4>::Iterator next, Pane *pChild);
void RemoveChild(Pane *pChild);
ut::Rect GetPaneRect() const;
ut::Rect GetPaneRect(const DrawInfo &) const;
void AddAnimationLink(AnimationLink *pAnimationLink);
math::VEC2 GetVtxPos() const;
void CalculateMtxChild(const DrawInfo &drawInfo);
u16 GetExtUserDataNum() const;
ExtUserData *GetExtUserData() const;
ExtUserData *FindExtUserDataByName(const char *name);
inline void SetUserData(const char *pData) {
strncpy(mUserData, pData, PANE_USERDATA_SIZE);
mUserData[PANE_USERDATA_SIZE - 1] = '\0';
}
virtual ~Pane(); // at 0x8
virtual const ut::detail::RuntimeTypeInfo *GetRuntimeTypeInfo() const; // at 0xC
virtual void CalculateMtx(const DrawInfo &drawInfo); // at 0x10
virtual void Draw(const DrawInfo &); // at 0x14
virtual void DrawSelf(const DrawInfo &); // at 0x18
virtual void Animate(u32); // at 0x1C
virtual void AnimateSelf(u32); // at 0x20
virtual ut::Color GetVtxColor(u32) const; // at 0x24
virtual void SetVtxColor(u32, ut::Color); // at 0x28
virtual u8 GetColorElement(u32 idx) const; // at 0x2C
virtual void SetColorElement(u32 idx, u8 value); // at 0x30
virtual u8 GetVtxColorElement(u32 idx) const; // at 0x34
virtual void SetVtxColorElement(u32 idx, u8 value); // at 0x38
virtual Pane *FindPaneByName(const char *findName, bool bRecursive); // at 0x3C
virtual Material *FindMaterialByName(const char *findName, bool bRecursive); // at 0x40
virtual void BindAnimation(AnimTransform *pAnimTrans, bool bRecursive, bool bDisable); // at 0x44
virtual void UnbindAnimation(AnimTransform *pAnimTrans, bool bRecusive); // at 0x48
virtual void UnbindAllAnimation(bool bRecursive); // at 0x4C
virtual void UnbindAnimationSelf(AnimTransform *pAnimTrans); // at 0x50
virtual AnimationLink *FindAnimationLinkSelf(AnimTransform *pAnimTrans); // at 0x54
virtual AnimationLink *FindAnimationLinkSelf(const AnimResource &animRes); // at 0x58
virtual void SetAnimationEnable(AnimTransform *pAnimTrans, bool bEnable, bool bRecursive); // at 0x5C
virtual void SetAnimationEnable(const AnimResource &animRes, bool bEnable, bool bRecursive); // at 0x60
virtual u8 GetMaterialNum() const; // at 0x64
virtual Material *GetMaterial() const; // at 0x68
virtual Material *GetMaterial(u32 idx) const; // at 0x6C
virtual void LoadMtx(const DrawInfo &drawInfo); // at 0x70
inline void InsertChild(ut::LinkList<lyt::Pane, 4>::Iterator iter, lyt::Pane *pChild) {
mChildren.Insert(iter, pChild);
pChild->mParent = this;
}
Pane(const res::Pane *);
virtual ~Pane(); // at 0x8
virtual const ut::detail::RuntimeTypeInfo *GetRuntimeTypeInfo() const; // at 0xC
virtual UNKTYPE CalculateMtx(const DrawInfo &); // at 0x10
virtual UNKTYPE Draw(const DrawInfo &); // at 0x14
virtual void DrawSelf(const DrawInfo &); // at 0x18
virtual UNKTYPE Animate(u32); // at 0x1C
virtual UNKTYPE AnimateSelf(u32); // at 0x20
virtual ut::Color GetVtxColor(u32) const; // at 0x24
virtual void SetVtxColor(u32, ut::Color); // at 0x28
virtual UNKTYPE GetColorElement(u32) const; // at 0x2C
virtual UNKTYPE SetColorElement(u32, u8); // at 0x30
virtual u8 GetVtxColorElement(u32) const; // at 0x34
virtual void SetVtxColorElement(u32, u8); // at 0x38
virtual Pane *FindPaneByName(const char *, bool); // at 0x3C
virtual UNKTYPE FindMaterialByName(const char *, bool); // at 0x40
virtual UNKTYPE BindAnimation(AnimTransform *, bool); // at 0x44
virtual UNKTYPE UnbindAnimation(AnimTransform *, bool); // at 0x48
virtual UNKTYPE UnbindAllAnimation(bool); // at 0x4C
virtual UNKTYPE UnbindAnimationSelf(AnimTransform *); // at 0x50
virtual UNKTYPE FindAnimationLink(AnimTransform *); // at 0x54
virtual UNKTYPE SetAnimationEnable(AnimTransform *, bool, bool); // at 0x58
virtual UNKTYPE GetMaterial() const; // at 0x5C
virtual UNKTYPE LoadMtx(const DrawInfo &); // at 0x60
void AppendChild(Pane *);
void RemoveChild(Pane *);
UNKTYPE GetPaneRect(const DrawInfo &) const;
UNKTYPE AddAnimationLink(AnimationLink *);
UNKTYPE GetVtxPos() const;
ut::LinkListNode mNode; // at 0x4
Pane *mParent; // at 0x8
ut::LinkList<Pane, 4> mChildren; // at 0x14
ut::LinkList<AnimationLink, 0> mAnims; // at 0x20;
Material *mMaterial; // at 0x2C
math::VEC3 mTranslate; // at 0x30
math::VEC3 VEC3_0x3C;
math::VEC2 mScale; // at 0x48
Size mSize; // at 0x50
math::MTX34 MTX34_0x58;
math::MTX34 mGlobalMtx; // at 0x84
int INT_0xB4;
u8 mAlpha; // at 0xB8
u8 BYTE_0xB9;
u8 BYTE_0xBA;
u8 mFlags; // at 0xBB
char mName[PANE_NAME_SIZE]; // at 0xBC
char mUserData[PANE_USERDATA_SIZE]; // at 0xCD
u8 BYTE_0xD6;
Pane *mpParent; // at 0x0C
ut::LinkList<Pane, 4> mChildList; // at 0x10
ut::LinkList<AnimationLink, 0> mAnimList; // at 0x1C;
Material *mpMaterial; // at 0x28
math::VEC3 mTranslate; // at 0x2C
math::VEC3 mRotate; // at 0x38
math::VEC2 mScale; // at 0x44
Size mSize; // at 0x4C
math::MTX34 mMtx; // at 0x54
math::MTX34 mGlbMtx; // at 0x84
res::ExtUserDataList *mpExtUserDataList; // at 0xB4
u8 mAlpha; // at 0xB8
u8 mGlbAlpha; // at 0xB9
u8 mBasePosition; // at 0xBA
u8 mFlag; // at 0xBB
char mName[PANE_NAME_SIZE + 1]; // at 0xBC
char mUserData[PANE_USERDATA_SIZE + 1]; // at 0xCD
bool mbUserAllocated; // at 0xD6
u8 mPadding; // at 0xD7
static ut::detail::RuntimeTypeInfo typeInfo;
};
+20
View File
@@ -0,0 +1,20 @@
#ifndef NW4R_LYT_TYPES_H
#define NW4R_LYT_TYPES_H
#include <nw4r/ut/ut_algorithm.h>
namespace nw4r {
namespace lyt {
namespace detail {
template <typename T>
inline bool TestBit(T bits, int index) {
T mask = 1 << index;
return bits & mask;
}
} // namespace detail
} // namespace lyt
} // namespace nw4r
#endif
+12 -4
View File
@@ -16,11 +16,19 @@ struct Rect {
Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {}
~Rect() {}
void SetWidth(f32 width) { right = left + width; }
f32 GetWidth() const { return right - left; }
void SetWidth(f32 width) {
right = left + width;
}
f32 GetWidth() const {
return right - left;
}
void SetHeight(f32 height) { bottom = top + height; }
f32 GetHeight() const { return bottom - top; }
void SetHeight(f32 height) {
bottom = top - height;
}
f32 GetHeight() const {
return bottom - top;
}
void Normalize() {
f32 l = left;
+1 -1
View File
@@ -239,7 +239,7 @@ void Matrix34f::makeT(const Vector3f &t) {
}
void Matrix34f::fromQuat(const Quatf &q) {
m[0][0] = 1.0f - (2.0f * q.y * q.y) - (2.0f * q.z * q.z);
m[0][0] = 1.0f - (2 * q.y * q.y) - (2.0f * q.z * q.z);
m[0][1] = (2.0f * q.x * q.y) - (2.0f * q.w * q.z);
m[0][2] = (2.0f * q.x * q.z) + (2.0f * q.w * q.y);
+3 -3
View File
@@ -146,7 +146,7 @@ void detail::DrawQuad(const math::VEC2 &basePt, const Size &size, u8 texCoordNum
GXTexCoord2f32(texCoords[i][0].x, texCoords[i][0].y);
}
GXPosition2f32(basePt.x + size.x, basePt.y);
GXPosition2f32(basePt.x + size.width, basePt.y);
if (vtxColors != NULL) {
GXColor1u32(vtxColors[1]);
}
@@ -154,7 +154,7 @@ void detail::DrawQuad(const math::VEC2 &basePt, const Size &size, u8 texCoordNum
GXTexCoord2f32(texCoords[i][1].x, texCoords[i][1].y);
}
GXPosition2f32(basePt.x + size.x, basePt.y - size.y);
GXPosition2f32(basePt.x + size.width, basePt.y - size.height);
if (vtxColors != NULL) {
GXColor1u32(vtxColors[3]);
}
@@ -162,7 +162,7 @@ void detail::DrawQuad(const math::VEC2 &basePt, const Size &size, u8 texCoordNum
GXTexCoord2f32(texCoords[i][3].x, texCoords[i][3].y);
}
GXPosition2f32(basePt.x, basePt.y - size.y);
GXPosition2f32(basePt.x, basePt.y - size.height);
if (vtxColors != NULL) {
GXColor1u32(vtxColors[2]);
}
+14
View File
@@ -0,0 +1,14 @@
#include <rvl/OS.h>
namespace {
const char *NW4R_LYT_Version_ = "<< NW4R - LYT \tfinal build: Mar 15 2010 02:17:33 (0x4302_158) >>";
}
namespace nw4r {
namespace lyt {
void LytInit() {
OSRegisterVersion(NW4R_LYT_Version_);
OSInitFastCast();
}
} // namespace lyt
} // namespace nw4r
+536
View File
@@ -0,0 +1,536 @@
#include <nw4r/lyt/lyt_drawInfo.h>
#include <nw4r/lyt/lyt_layout.h>
#include <nw4r/lyt/lyt_material.h>
#include <nw4r/lyt/lyt_pane.h>
#include <nw4r/ut/ut_Color.h>
#include <nw4r/ut/ut_Rect.h>
#include <nw4r/ut/ut_RuntimeTypeInfo.h>
#include <nw4r/ut/ut_list.h>
// ReverseYAxis__22@unnamed@lyt_pane_cpp@FPQ34nw4r4math5MTX34
void float_order() {
0.0f;
1.0f;
}
namespace nw4r {
namespace lyt {
namespace detail {
// __ct__Q44nw4r3lyt6detail8PaneBaseFv
PaneBase::PaneBase() : mLink() {}
// __dt__Q44nw4r3lyt6detail8PaneBaseFv
PaneBase::~PaneBase() {}
} // namespace detail
NW4R_UT_RTTI_DEF_BASE(Pane);
// 80486a70
// __ct__Q34nw4r3lyt4PaneFv
// __dt__Q34nw4r2ut38LinkList<Q34nw4r3lyt13AnimationLink,0>Fv
// __dt__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv
// __ct__Q34nw4r3lyt4PaneFPCQ44nw4r3lyt3res4Pane
Pane::Pane(const res::Pane *pBlock) : mChildList(), mAnimList(), mSize() {
this->mpParent = nullptr;
this->mpMaterial = nullptr;
this->mbUserAllocated = false;
this->mpExtUserDataList = nullptr;
this->mBasePosition = pBlock->basePosition;
strncpy(this->mName, pBlock->name, PANE_NAME_SIZE);
this->mName[PANE_NAME_SIZE] = '\0';
strncpy(this->mUserData, pBlock->mUserData, PANE_USERDATA_SIZE);
this->mUserData[PANE_USERDATA_SIZE] = '\0';
this->mTranslate = pBlock->translate;
this->mRotate = pBlock->rotate;
this->mScale = pBlock->scale;
this->mSize = pBlock->size;
this->mGlbAlpha = this->mAlpha = pBlock->alpha;
this->mFlag = pBlock->flag;
}
// Init__Q34nw4r3lyt4PaneFv
void Pane::Init() {
this->mpParent = NULL;
this->mpMaterial = NULL;
this->mbUserAllocated = false;
this->mpExtUserDataList = NULL;
}
// __dt__Q34nw4r3lyt4PaneFv
Pane::~Pane() {
ut::LinkList<Pane, 4>::Iterator it = this->mChildList.GetBeginIter();
while (it != this->mChildList.GetEndIter()) {
ut::LinkList<Pane, 4>::Iterator currIt = it++;
mChildList.Erase(currIt);
if (!currIt->mbUserAllocated) {
Layout::DeleteObj<Pane>(&*currIt);
}
}
this->UnbindAnimationSelf(nullptr);
if (this->mpMaterial && !this->mpMaterial->mbUserAllocated) {
Layout::DeleteObj<Material>(this->mpMaterial);
}
}
// SetName__Q34nw4r3lyt4PaneFPCc
void Pane::SetName(const char *pName) {
strncpy(this->mName, pName, PANE_NAME_SIZE);
this->mName[PANE_NAME_SIZE - 1] = '\0';
}
// SetUserData__Q34nw4r3lyt4PaneFPCc
void Pane::SetUserData(const char *pData) {
strncpy(this->mUserData, pData, PANE_USERDATA_SIZE);
this->mUserData[PANE_USERDATA_SIZE - 1] = '\0';
}
// AppendChild__Q34nw4r3lyt4PaneFPQ34nw4r3lyt4Pane
void Pane::AppendChild(Pane *pChild) {
InsertChild(this->mChildList.GetEndIter(), pChild);
}
// PrependChild__Q34nw4r3lyt4PaneFPQ34nw4r3lyt4Pane
void Pane::PrependChild(Pane *pChild) {
InsertChild(this->mChildList.GetBeginIter(), pChild);
}
// InsertChild__Q34nw4r3lyt4PaneFPQ34nw4r3lyt4PanePQ34nw4r3lyt4Pane
void Pane::InsertChild(Pane *at, Pane *pChild) {
this->mChildList.Insert(mChildList.GetIteratorFromPointer(&at->mLink), pChild);
pChild->mpParent = this;
}
// InsertChild__Q34nw4r3lyt4PaneFQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8IteratorPQ34nw4r3lyt4Pane
// Guess for now. Not in SS
void Pane::InsertChild(ut::LinkList<Pane, 4>::Iterator next, Pane *pChild) {
this->mChildList.Insert(next, pChild);
pChild->mpParent = this;
}
// RemoveChild__Q34nw4r3lyt4PaneFPQ34nw4r3lyt4Pane
void Pane::RemoveChild(Pane *pChild) {
this->mChildList.Erase(pChild);
pChild->mpParent = nullptr;
}
// GetPaneRect__Q34nw4r3lyt4PaneCFv
ut::Rect Pane::GetPaneRect() const {
ut::Rect ret;
math::VEC2 basePt = GetVtxPos();
ret.left = basePt.x;
ret.top = basePt.y;
ret.right = basePt.x + mSize.width;
ret.bottom = basePt.y - mSize.height;
return ret;
}
// GetPaneRect__Q34nw4r3lyt4PaneCFRCQ34nw4r3lyt8DrawInfo
ut::Rect Pane::GetPaneRect(const DrawInfo &) const {
return GetPaneRect();
}
// GetVtxColor__Q34nw4r3lyt4PaneCFUl
ut::Color Pane::GetVtxColor(u32) const {
return ut::Color();
}
// SetVtxColor__Q34nw4r3lyt4PaneFUlQ34nw4r2ut5Color
void Pane::SetVtxColor(u32, ut::Color) {}
// GetColorElement__Q34nw4r3lyt4PaneCFUl
u8 Pane::GetColorElement(u32 idx) const {
if (idx == 0x10) {
return this->mAlpha;
} else {
return GetVtxColorElement(idx);
}
}
// SetColorElement__Q34nw4r3lyt4PaneFUlUc
void Pane::SetColorElement(u32 idx, u8 value) {
if (idx == 0x10) {
this->mAlpha = value;
} else {
return SetVtxColorElement(idx, value);
}
}
// GetVtxColorElement__Q34nw4r3lyt4PaneCFUl
u8 Pane::GetVtxColorElement(u32 idx) const {
return 0xFF;
}
// SetVtxColorElement__Q34nw4r3lyt4PaneFUlUc
void Pane::SetVtxColorElement(u32 idx, u8 value) {}
// FindPaneByName__Q34nw4r3lyt4PaneFPCcb
Pane *Pane::FindPaneByName(const char *findName, bool bRecursive) {
if (detail::EqualsResName(this->mName, findName)) {
return this;
}
if (bRecursive) {
for (ut::LinkList<Pane, 4>::Iterator it = this->mChildList.GetBeginIter(); it != this->mChildList.GetEndIter();
it++) {
Pane *pPane = it->FindPaneByName(findName, bRecursive);
if (pPane != nullptr) {
return pPane;
}
}
}
return nullptr;
}
// FindMaterialByName__Q34nw4r3lyt4PaneFPCcb
Material *Pane::FindMaterialByName(const char *findName, bool bRecursive) {
if (this->mpMaterial && detail::EqualsMaterialName(this->mpMaterial->mName, findName)) {
return this->mpMaterial;
}
if (bRecursive) {
for (ut::LinkList<Pane, 4>::Iterator it = this->mChildList.GetBeginIter(); it != this->mChildList.GetEndIter();
it++) {
Material *pPane = it->FindMaterialByName(findName, bRecursive);
if (pPane != nullptr) {
return pPane;
}
}
}
return nullptr;
}
// CalculateMtx__Q34nw4r3lyt4PaneFRCQ34nw4r3lyt8DrawInfo
void Pane::CalculateMtx(const DrawInfo &drawInfo) {
if (!IsVisible() && !drawInfo.IsInvisiblePaneCalculateMtx()) {
return;
}
math::VEC2 scale = this->mScale;
if (drawInfo.IsLocationAdjust() && IsLocationAdjust()) {
scale.x *= drawInfo.GetLocationAdjustScale().x;
scale.y *= drawInfo.GetLocationAdjustScale().y;
}
if (mRotate.x != 0.0f || mRotate.y != 0.0f) {
f32 sinx, siny, sinz;
f32 cosx, cosy, cosz;
math::SinCosDeg(&sinx, &cosx, mRotate.x);
math::SinCosDeg(&siny, &cosy, mRotate.y);
math::SinCosDeg(&sinz, &cosz, mRotate.z);
const f32 cosz_cosx = cosz * cosx;
const f32 siny_sinx = siny * sinx;
const f32 sinz_cosx = sinz * cosx;
this->mMtx._00 = cosz * cosy * scale.x;
this->mMtx._10 = (sinz * cosy) * scale.x;
this->mMtx._20 = (-siny) * scale.x;
this->mMtx._01 = (-sinz_cosx + cosz * siny_sinx) * scale.y;
this->mMtx._11 = (cosz_cosx + sinz * siny_sinx) * scale.y;
this->mMtx._21 = (cosy * sinx) * scale.y;
this->mMtx._02 = (sinz * sinx) + (cosz_cosx * siny);
this->mMtx._12 = (-cosz * sinx) + (sinz_cosx * siny);
this->mMtx._22 = (cosy * cosx);
} else if (mRotate.z != 0.0f) {
f32 sinz;
f32 cosz;
math::SinCosDeg(&sinz, &cosz, mRotate.z);
this->mMtx._00 = cosz * scale.x;
this->mMtx._01 = -sinz * scale.y;
this->mMtx._02 = 0.0f;
this->mMtx._10 = sinz * scale.x;
this->mMtx._11 = cosz * scale.y;
this->mMtx._12 = 0.0f;
this->mMtx._20 = 0.0f;
this->mMtx._21 = 0.0f;
this->mMtx._22 = 1.0f;
} else {
this->mMtx._00 = scale.x;
this->mMtx._01 = 0.0f;
this->mMtx._02 = 0.0f;
this->mMtx._10 = 0.0f;
this->mMtx._11 = scale.y;
this->mMtx._12 = 0.0f;
this->mMtx._20 = 0.0f;
this->mMtx._21 = 0.0f;
this->mMtx._22 = 1.0f;
}
this->mMtx._03 = this->mTranslate.x;
this->mMtx._13 = this->mTranslate.y;
this->mMtx._23 = this->mTranslate.z;
if (this->mpParent) {
PSMTXConcat(this->mpParent->mGlbMtx, this->mMtx, this->mGlbMtx);
} else {
if (drawInfo.IsMultipleViewMtxOnDraw()) {
this->mGlbMtx = this->mMtx;
} else {
PSMTXConcat(drawInfo.GetViewMtx(), this->mMtx, this->mGlbMtx);
}
}
u8 alpha;
bool b = drawInfo.IsInfluencedAlpha() && this->mpParent;
if (b) {
alpha = this->mAlpha * drawInfo.GetGlobalAlpha();
} else {
alpha = this->mAlpha;
}
this->mGlbAlpha = alpha;
if (IsInfluencedAlpha() && this->mAlpha != 0xFF) {
DrawInfo &mtDrawInfo = const_cast<DrawInfo &>(drawInfo);
const f32 crGlobalAlpha = drawInfo.GetGlobalAlpha();
const bool bCdInfluenced = drawInfo.IsInfluencedAlpha();
mtDrawInfo.SetGlobalAlpha(crGlobalAlpha * mAlpha * (1.0f / 0xFF));
mtDrawInfo.SetInfluencedAlpha(true);
CalculateMtxChild(drawInfo);
mtDrawInfo.SetGlobalAlpha(crGlobalAlpha);
mtDrawInfo.SetInfluencedAlpha(bCdInfluenced);
} else {
CalculateMtxChild(drawInfo);
}
}
// CalculateMtxChild__Q34nw4r3lyt4PaneFRCQ34nw4r3lyt8DrawInfo
// Guess but makes sense
void Pane::CalculateMtxChild(const DrawInfo &drawInfo) {
for (ut::LinkList<Pane, 4>::Iterator it = this->mChildList.GetBeginIter(); it != this->mChildList.GetEndIter();
it++) {
it->CalculateMtx(drawInfo);
}
}
// Draw__Q34nw4r3lyt4PaneFRCQ34nw4r3lyt8DrawInfo
void Pane::Draw(const DrawInfo &drawInfo) {
if (IsVisible()) {
this->DrawSelf(drawInfo);
for (ut::LinkList<Pane, 4>::Iterator it = this->mChildList.GetBeginIter(); it != this->mChildList.GetEndIter();
it++) {
it->Draw(drawInfo);
}
}
}
// DrawSelf__Q34nw4r3lyt4PaneFRCQ34nw4r3lyt8DrawInfo
void Pane::DrawSelf(const DrawInfo &drawInfo) {}
// Animate__Q34nw4r3lyt4PaneFUl
void Pane::Animate(u32 option) {
this->AnimateSelf(option);
if (IsVisible() || !(option & 1)) {
for (ut::LinkList<Pane, 4>::Iterator it = this->mChildList.GetBeginIter(); it != this->mChildList.GetEndIter();
it++) {
it->Animate(option);
}
}
}
// AnimateSelf__Q34nw4r3lyt4PaneFUl
void Pane::AnimateSelf(u32 option) {
for (ut::LinkList<AnimationLink, 0>::Iterator it = this->mAnimList.GetBeginIter();
it != this->mAnimList.GetEndIter(); it++) {
if (!it->mbDisable) {
AnimTransform *animTrans = it->mAnimTrans;
animTrans->Animate(it->mIdx, this);
}
}
if (IsVisible() || !(option & 1)) {
if (this->mpMaterial) {
mpMaterial->Animate();
}
}
}
// BindAnimation__Q34nw4r3lyt4PaneFPQ34nw4r3lyt13AnimTransformbb
void Pane::BindAnimation(AnimTransform *pAnimTrans, bool bRecursive, bool bDisable) {
pAnimTrans->Bind(this, bRecursive);
}
// UnbindAnimation__Q34nw4r3lyt4PaneFPQ34nw4r3lyt13AnimTransformb
void Pane::UnbindAnimation(AnimTransform *pAnimTrans, bool bRecusive) {
this->UnbindAnimationSelf(pAnimTrans);
if (bRecusive) {
for (ut::LinkList<Pane, 4>::Iterator it = this->mChildList.GetBeginIter(); it != this->mChildList.GetEndIter();
it++) {
it->UnbindAnimation(pAnimTrans, bRecusive);
}
}
}
// UnbindAllAnimation__Q34nw4r3lyt4PaneFb
void Pane::UnbindAllAnimation(bool bRecursive) {
UnbindAnimation(nullptr, bRecursive);
}
// UnbindAnimationSelf__Q34nw4r3lyt4PaneFPQ34nw4r3lyt13AnimTransform
void Pane::UnbindAnimationSelf(AnimTransform *pAnimTrans) {
if (this->mpMaterial) {
this->mpMaterial->UnbindAnimation(pAnimTrans);
}
detail::UnbindAnimationLink(&this->mAnimList, pAnimTrans);
}
// AddAnimationLink__Q34nw4r3lyt4PaneFPQ34nw4r3lyt13AnimationLink
void Pane::AddAnimationLink(AnimationLink *pAnimationLink) {
this->mAnimList.PushBack(pAnimationLink);
}
// FindAnimationLinkSelf__Q34nw4r3lyt4PaneFPQ34nw4r3lyt13AnimTransform
AnimationLink *Pane::FindAnimationLinkSelf(AnimTransform *pAnimTrans) {
return detail::FindAnimationLink(&this->mAnimList, pAnimTrans);
}
// FindAnimationLinkSelf__Q34nw4r3lyt4PaneFRCQ34nw4r3lyt12AnimResource
AnimationLink *Pane::FindAnimationLinkSelf(const AnimResource &animRes) {
return detail::FindAnimationLink(&this->mAnimList, animRes);
}
// SetAnimationEnable__Q34nw4r3lyt4PaneFPQ34nw4r3lyt13AnimTransformbb
void Pane::SetAnimationEnable(AnimTransform *pAnimTrans, bool bEnable, bool bRecursive) {
AnimationLink *pAnimLink = FindAnimationLinkSelf(pAnimTrans);
if (pAnimLink) {
pAnimLink->mbDisable = !bEnable;
}
u8 materialNum = GetMaterialNum();
for (u8 i = 0; i < materialNum; i++) {
GetMaterial(i)->SetAnimationEnable(pAnimTrans, bEnable);
}
if (bRecursive) {
for (ut::LinkList<Pane, 4>::Iterator it = this->mChildList.GetBeginIter(); it != this->mChildList.GetEndIter();
it++) {
it->SetAnimationEnable(pAnimTrans, bEnable, bRecursive);
}
}
}
// SetAnimationEnable__Q34nw4r3lyt4PaneFRCQ34nw4r3lyt12AnimResourcebb
void Pane::SetAnimationEnable(const AnimResource &animRes, bool bEnable, bool bRecursive) {
AnimationLink *pAnimLink = FindAnimationLinkSelf(animRes);
if (pAnimLink) {
pAnimLink->mbDisable = !bEnable;
}
u8 materialNum = GetMaterialNum();
for (u8 i = 0; i < materialNum; i++) {
GetMaterial(i)->SetAnimationEnable(animRes, bEnable);
}
if (bRecursive) {
for (ut::LinkList<Pane, 4>::Iterator it = this->mChildList.GetBeginIter(); it != this->mChildList.GetEndIter();
it++) {
it->SetAnimationEnable(animRes, bEnable, bRecursive);
}
}
}
// LoadMtx__Q34nw4r3lyt4PaneFRCQ34nw4r3lyt8DrawInfo
void Pane::LoadMtx(const DrawInfo &drawInfo) {
math::MTX34 mtx;
math::MTX34 *mtxPtr;
if (drawInfo.IsMultipleViewMtxOnDraw()) {
PSMTXConcat(drawInfo.GetViewMtx(), this->mGlbMtx, mtx);
mtxPtr = &mtx;
} else {
mtxPtr = &this->mGlbMtx;
}
GXLoadPosMtxImm(*mtxPtr, GX_PNMTX0);
GXSetCurrentMtx(GX_PNMTX0);
}
// GetVtxPos__Q34nw4r3lyt4PaneCFv
math::VEC2 Pane::GetVtxPos() const {
math::VEC2 basePt(0.0f, 0.0f);
switch (this->mBasePosition % 3) {
default:
basePt.x = 0.0f;
break;
case 1:
basePt.x = -this->mSize.width / 2;
break;
case 2:
basePt.x = -this->mSize.width;
break;
}
switch (this->mBasePosition / 3) {
default:
basePt.y = 0.0f;
break;
case 1:
basePt.y = this->mSize.height / 2;
break;
case 2:
basePt.y = this->mSize.height;
break;
}
return basePt;
}
// GetMaterialNum__Q34nw4r3lyt4PaneCFv
u8 Pane::GetMaterialNum() const {
if (this->mpMaterial) {
return 1;
} else {
return 0;
}
}
// GetMaterial__Q34nw4r3lyt4PaneCFv
Material *Pane::GetMaterial() const {
return this->mpMaterial;
}
// GetMaterial__Q34nw4r3lyt4PaneCFUl
Material *Pane::GetMaterial(u32 idx) const {
if (idx == 0) {
return GetMaterial();
}
return nullptr;
}
u16 Pane::GetExtUserDataNum() const {
if (this->mpExtUserDataList) {
return this->mpExtUserDataList->num;
}
return 0;
}
ExtUserData *Pane::GetExtUserData() const {
if (this->mpExtUserDataList) {
return (ExtUserData *)(this->mpExtUserDataList + 1);
}
return nullptr;
}
ExtUserData *Pane::FindExtUserDataByName(const char *name) {
ExtUserData *pUserData = GetExtUserData();
if (!pUserData) {
return nullptr;
}
int i = 0;
for (int i = 0; i < this->mpExtUserDataList->num;) {
u32 offset = pUserData->stringOffs;
const char *str = 0;
if (offset != 0) {
str = (const char *)(pUserData) + offset;
} else {
str = 0;
}
if (strcmp(name, str) == 0) {
return pUserData;
};
i++;
pUserData++;
}
return nullptr;
}
} // namespace lyt
} // namespace nw4r