summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorelijah-thomas774 <elijahthomas774@gmail.com>2024-06-09 21:04:42 -0400
committerelijah-thomas774 <elijahthomas774@gmail.com>2024-06-09 21:04:42 -0400
commit53aa4e2efa0f5e2d662857ebdb593d33099b86bf (patch)
tree5854ea5474683f1756355dd90cfba8d67fed0c30 /include
parentf7e702e159da9b3b27acd76c535be10677f30e94 (diff)
lyt_animation *ALMOST*
Diffstat (limited to 'include')
-rw-r--r--include/nw4r/lyt/lyt_animation.h35
-rw-r--r--include/nw4r/lyt/lyt_common.h5
-rw-r--r--include/nw4r/lyt/lyt_material.h12
-rw-r--r--include/nw4r/lyt/lyt_pane.h8
-rw-r--r--include/nw4r/lyt/lyt_resources.h8
-rw-r--r--include/rvl/OS/OSFastCast.h16
6 files changed, 71 insertions, 13 deletions
diff --git a/include/nw4r/lyt/lyt_animation.h b/include/nw4r/lyt/lyt_animation.h
index 4db537ea..64e6195c 100644
--- a/include/nw4r/lyt/lyt_animation.h
+++ b/include/nw4r/lyt/lyt_animation.h
@@ -25,14 +25,24 @@ public:
virtual void Animate(u32 idx, Pane *pPane) = 0; // at 0x1C
virtual void Animate(u32 idx, Material *pMaterial) = 0; // at 0x20
- res::AnimationBlock *GetAnimResource() const {
+ f32 GetFrameMax() const {
+ return mFrame; // TOOD
+ }
+
+ const res::AnimationBlock *GetAnimResource() const {
return mpRes;
}
+ f32 GetFrame() const {
+ return mFrame;
+ }
+ void SetFrame(f32 frame) {
+ mFrame = frame;
+ }
ut::LinkListNode mLink; // at 0x4
protected:
- res::AnimationBlock *mpRes; // at 0xC
- f32 mFrame; // at 0x10
+ const res::AnimationBlock *mpRes; // at 0xC
+ f32 mFrame; // at 0x10
};
class AnimResource {
@@ -44,10 +54,10 @@ public:
void Set(const void *anmResBuf);
void Init();
u16 GetGroupNum() const;
- AnimationGroupRef *GetGroupArray() const;
+ const AnimationGroupRef *GetGroupArray() const;
bool IsDescendingBind() const;
u16 GetAnimationShareInfoNum() const;
- AnimationShareInfo *GetAnimationShareInfoArray() const;
+ const AnimationShareInfo *GetAnimationShareInfoArray() const;
u16 CalcAnimationNum(Pane *pPane, bool bRecursive) const;
u16 CalcAnimationNum(Group *pGroup, bool bRecursive) const;
@@ -71,7 +81,7 @@ private:
class AnimTransformBasic : public AnimTransform {
public:
AnimTransformBasic();
- AnimationLink *FindUnbindLink(AnimationLink *pLink);
+ AnimationLink *FindUnbindLink(AnimationLink *pLink) const;
virtual ~AnimTransformBasic(); // at 0x08
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor); // at 0x0C
@@ -84,8 +94,12 @@ public:
template <typename T>
AnimationLink *Bind(T *pTarget, AnimationLink *pAnimLink, u16 idx, bool bDisable);
-private:
- void *mpFileResAry; // at 0x14
+ AnimationLink *GetAnimLinkAry() const {
+ return mAnimLinkAry;
+ }
+
+protected:
+ void **mpFileResAry; // at 0x14
AnimationLink *mAnimLinkAry; // at 0x18
u16 mAnimLinkNum; // at 0x1C
};
@@ -97,7 +111,10 @@ public:
Init();
Set(pTargetPane, animRes);
}
- bool IsEnabled() const;
+ bool IsEnabled() const {
+ // TODO
+ return false;
+ }
static u16 FindAnimContent(const res::AnimationBlock *pAnimBlock, const char *animContName, u8 animContType);
void Init();
void Set(Pane *pTargetPane, const AnimResource &animRes);
diff --git a/include/nw4r/lyt/lyt_common.h b/include/nw4r/lyt/lyt_common.h
index bd09aae9..ffee8317 100644
--- a/include/nw4r/lyt/lyt_common.h
+++ b/include/nw4r/lyt/lyt_common.h
@@ -41,6 +41,11 @@ inline void SetVerticalPosition(u8 *pVar, u8 newVal) {
*pVar = newVal * 3 + GetHorizontalPosition(*pVar);
}
+inline const char *GetStrTableStr(const void *pStrTable, int index) {
+ const u32 *offsets = (u32 *)pStrTable;
+ const char *stringPool = (char *)pStrTable;
+ return &stringPool[offsets[index]];
+}
typedef math::VEC2 TexCoordData[TEXCOORD_VTX_COUNT];
class TexCoordAry {
diff --git a/include/nw4r/lyt/lyt_material.h b/include/nw4r/lyt/lyt_material.h
index 3a1d4dce..ec2c924e 100644
--- a/include/nw4r/lyt/lyt_material.h
+++ b/include/nw4r/lyt/lyt_material.h
@@ -78,8 +78,15 @@ public:
}
// SetTexSRTElement__Q34nw4r3lyt8MaterialFUlUlf
+ void SetTexSRTElement(u32 texSRTIdx, u32 eleIdx, f32 value) {
+ f32 *srtAry = (f32 *)&(GetTexSRTAry()[texSRTIdx]);
+ srtAry[eleIdx] = value;
+ }
// GetTexturePtr__Q34nw4r3lyt8MaterialFUc
+ TexMap *GetTexturePtr(u8 idx) {
+ return &GetTexMapAry()[idx];
+ }
// GetTexSRTCap__Q34nw4r3lyt8MaterialCFv
u8 GetTexSRTCap() const {
@@ -90,7 +97,12 @@ public:
u8 GetIndTexSRTCap() const {
return mGXMemCap.indSRT;
}
+
// SetIndTexSRTElement__Q34nw4r3lyt8MaterialFUlUlf
+ void SetIndTexSRTElement(u32 texSRTIdx, u32 eleIdx, f32 value) {
+ f32 *srtAry = (f32 *)&(GetIndTexSRTAry()[texSRTIdx]);
+ srtAry[eleIdx] = value;
+ }
ut::LinkList<AnimationLink, 0> *GetAnimationList() {
return &mAnimList;
diff --git a/include/nw4r/lyt/lyt_pane.h b/include/nw4r/lyt/lyt_pane.h
index 54e16eea..b73d8d30 100644
--- a/include/nw4r/lyt/lyt_pane.h
+++ b/include/nw4r/lyt/lyt_pane.h
@@ -78,6 +78,10 @@ public:
mSize = value;
}
+ void SetSRTElement(u32 idx, f32 f) {
+ ((f32 *)&mTranslate)[idx] = f;
+ }
+
const res::ExtUserDataList *GetExtUserDataList() const {
return mpExtUserDataList;
}
@@ -85,6 +89,10 @@ public:
mpExtUserDataList = pBlock;
}
+ const char *GetName() const {
+ return mName;
+ }
+
Pane();
Pane(const res::Pane *pBlock);
void Init();
diff --git a/include/nw4r/lyt/lyt_resources.h b/include/nw4r/lyt/lyt_resources.h
index b90e101f..dcdd27d4 100644
--- a/include/nw4r/lyt/lyt_resources.h
+++ b/include/nw4r/lyt/lyt_resources.h
@@ -30,8 +30,8 @@ struct BinaryFileHeader {
};
struct DataBlockHeader {
- u32 kind; // at 0x0
- u32 size; // at 0x4
+ char kind[4]; // at 0x0
+ u32 size; // at 0x4
};
struct TexSRT {
@@ -250,7 +250,7 @@ struct WindowContent {
struct AnimationBlock {
DataBlockHeader blockHeader; // at 0x00
u16 frameSize; // at 0x08
- bool loop; // at 0x0A
+ u8 loop; // at 0x0A
u8 padding1; // at 0x0B
u16 fileNum; // at 0x0C
u16 animContNum; // at 0x0E
@@ -308,7 +308,7 @@ struct AnimationContent {
char name[20]; // at 0x00
u8 num; // at 0x14
u8 type; // at 0x15
- u8 padding[2]; // at 0x17
+ u8 padding[2]; // at 0x67
};
} // namespace res
diff --git a/include/rvl/OS/OSFastCast.h b/include/rvl/OS/OSFastCast.h
index 5791018a..8db17517 100644
--- a/include/rvl/OS/OSFastCast.h
+++ b/include/rvl/OS/OSFastCast.h
@@ -57,11 +57,27 @@ static inline u16 __OSf32tou16(register f32 arg) {
r = *(u16 *)ptr;
return r;
}
+static inline u8 __OSf32tou8(register f32 arg) {
+ f32 a;
+ register f32 *ptr = &a;
+ register u8 r;
+
+ // clang-format off
+ asm {
+ psq_st arg, 0(ptr), 1, 2
+ lbz r, 0(ptr)
+ }
+ // clang-format on
+ return r;
+}
static inline void OSf32tou16(const f32 *in, u16 *out) {
*out = __OSf32tou16(*in);
}
+static inline void OSf32tou8(const f32 *in, u8 *out) {
+ *out = __OSf32tou8(*in);
+}
static inline f32 __OSs16tof32(register const s16 *arg) {
register f32 ret;