mirror of
https://github.com/zeldaret/ss
synced 2026-09-02 09:51:53 -04:00
template out lyt_animation
This commit is contained in:
@@ -2,12 +2,38 @@
|
||||
#define NW4R_LYT_ANIMATION_H
|
||||
#include "common.h"
|
||||
#include <nw4r/lyt/lyt_common.h>
|
||||
#include <nw4r/lyt/lyt_material.h>
|
||||
#include <nw4r/lyt/lyt_pane.h>
|
||||
#include <nw4r/lyt/lyt_resourceAccessor.h>
|
||||
#include <nw4r/lyt/lyt_types.h>
|
||||
#include <nw4r/ut/ut_LinkList.h>
|
||||
|
||||
namespace nw4r {
|
||||
namespace lyt {
|
||||
class AnimTransform {
|
||||
public:
|
||||
AnimTransform();
|
||||
|
||||
u16 GetFrameSize() const;
|
||||
bool IsLoopData() const;
|
||||
virtual ~AnimTransform() = 0; // at 0x08
|
||||
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor) = 0; // at 0x0C
|
||||
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor, //
|
||||
u16 animNum) = 0; // at 0x10
|
||||
virtual void Bind(Pane *pPane, bool bRecursive, bool bDisable) = 0; // at 0x14
|
||||
virtual void Bind(Material *pMaterial, bool bDisable) = 0; // at 0x18
|
||||
virtual void Animate(u32 idx, Pane *pPane) = 0; // at 0x1C
|
||||
virtual void Animate(u32 idx, Material *pMaterial) = 0; // at 0x20
|
||||
|
||||
res::AnimationBlock *GetAnimResource() const {
|
||||
return mpRes;
|
||||
}
|
||||
|
||||
ut::LinkListNode mLink; // at 0x4
|
||||
protected:
|
||||
res::AnimationBlock *mpRes; // at 0xC
|
||||
f32 mFrame; // at 0x10
|
||||
};
|
||||
|
||||
class AnimResource {
|
||||
public:
|
||||
@@ -18,7 +44,7 @@ public:
|
||||
void Set(const void *anmResBuf);
|
||||
void Init();
|
||||
u16 GetGroupNum() const;
|
||||
const AnimationGroupRef *GetGroupArray() const;
|
||||
AnimationGroupRef *GetGroupArray() const;
|
||||
bool IsDescendingBind() const;
|
||||
u16 GetAnimationShareInfoNum() const;
|
||||
AnimationShareInfo *GetAnimationShareInfoArray() const;
|
||||
@@ -42,6 +68,28 @@ private:
|
||||
const res::AnimationShareBlock *mpShareBlock; // at 0x0C
|
||||
};
|
||||
|
||||
class AnimTransformBasic : public AnimTransform {
|
||||
public:
|
||||
AnimTransformBasic();
|
||||
AnimationLink *FindUnbindLink(AnimationLink *pLink);
|
||||
|
||||
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, bool bDisable); // 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
|
||||
|
||||
template <typename T>
|
||||
AnimationLink *Bind(T *pTarget, AnimationLink *pAnimLink, u16 idx, bool bDisable);
|
||||
|
||||
private:
|
||||
void *mpFileResAry; // at 0x14
|
||||
AnimationLink *mAnimLinkAry; // at 0x18
|
||||
u16 mAnimLinkNum; // at 0x1C
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
class AnimPaneTree {
|
||||
public:
|
||||
@@ -68,30 +116,11 @@ private:
|
||||
u8 mAnimMatCnt; // at 0x26
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
AnimationLink *FindAnimationLink(ut::LinkList<AnimationLink, 0> *pAnimList, AnimTransform *pAnimTrans);
|
||||
AnimationLink *FindAnimationLink(ut::LinkList<AnimationLink, 0> *pAnimList, const AnimResource &animRes);
|
||||
void UnbindAnimationLink(ut::LinkList<AnimationLink, 0> *pAnimList, AnimTransform *pAnimTrans);
|
||||
void UnbindAnimationLink(ut::LinkList<AnimationLink, 0> *pAnimList, const AnimResource &animRes);
|
||||
|
||||
class AnimTransformBasic : public AnimTransform {
|
||||
public:
|
||||
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
|
||||
|
||||
private:
|
||||
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
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <nw4r/ut/ut_ResFont.h>
|
||||
#include <rvl/MEM/mem_allocator.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace lyt {
|
||||
|
||||
|
||||
@@ -276,9 +276,40 @@ struct AnimationShareBlock {
|
||||
u8 padding[2]; // at 0x0E
|
||||
};
|
||||
|
||||
// TODO
|
||||
struct HermiteKey {};
|
||||
struct StepKey {};
|
||||
struct HermiteKey {
|
||||
f32 frame; // at 0x0
|
||||
f32 value; // at 0x4
|
||||
f32 slope; // at 0x8
|
||||
};
|
||||
|
||||
struct StepKey {
|
||||
f32 frame; // at 0x0
|
||||
u16 value; // at 0x4
|
||||
u16 padding; // at 0x6
|
||||
};
|
||||
|
||||
struct AnimationInfo {
|
||||
u32 kind; // at 0x0
|
||||
u8 num; // at 0x4
|
||||
u8 padding[3]; // at 0x5
|
||||
};
|
||||
|
||||
struct AnimationTarget {
|
||||
u8 id; // at 0x0
|
||||
u8 target; // at 0x1
|
||||
u8 curveType; // at 0x2
|
||||
u8 padding1; // at 0x3
|
||||
u16 keyNum; // at 0x4
|
||||
u16 padding2[2]; // at 0x6
|
||||
u32 keyOffset; // at 0x8
|
||||
};
|
||||
|
||||
struct AnimationContent {
|
||||
char name[20]; // at 0x00
|
||||
u8 num; // at 0x14
|
||||
u8 type; // at 0x15
|
||||
u8 padding[2]; // at 0x17
|
||||
};
|
||||
|
||||
} // namespace res
|
||||
} // namespace lyt
|
||||
|
||||
@@ -66,24 +66,6 @@ struct Size {
|
||||
inline bool operator==(const Size &a, const Size &b) {
|
||||
return (a.width == b.width && a.height == b.height);
|
||||
}
|
||||
struct AnimTransform {
|
||||
inline AnimTransform() : mLink(), mpRes(NULL), mFrame(0.0f) {}
|
||||
|
||||
u16 GetFrameSize() const;
|
||||
bool IsLoopData() const;
|
||||
virtual ~AnimTransform() = 0; // at 0x08
|
||||
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor) = 0; // at 0x0C
|
||||
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor, //
|
||||
u16 animNum) = 0; // at 0x10
|
||||
virtual void Bind(Pane *pPane, bool bRecursive) = 0; // at 0x14
|
||||
virtual void Bind(Material *pMaterial, bool bDisable) = 0; // at 0x18
|
||||
virtual void Animate(u32 idx, Pane *pPane) = 0; // at 0x1C
|
||||
virtual void Animate(u32 idx, Material *pMaterial) = 0; // at 0x20
|
||||
|
||||
ut::LinkListNode mLink; // at 0x4
|
||||
res::AnimationBlock *mpRes; // at 0xC
|
||||
f32 mFrame; // at 0x10
|
||||
};
|
||||
struct AnimationShareInfo {
|
||||
const char *GetTargetGroupName() const {
|
||||
return targetGroupName;
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
Set(red, green, blue, alpha);
|
||||
}
|
||||
Color(const GXColor &clr) {
|
||||
*this = *(u32 *)&clr;
|
||||
ToU32ref() = *(u32 *)&clr;
|
||||
}
|
||||
~Color() {}
|
||||
|
||||
@@ -35,7 +35,8 @@ public:
|
||||
}
|
||||
|
||||
Color &operator=(const GXColor &c) {
|
||||
*(u32 *)this = *(u32 *)&c; // TODO -> This Seems Maybe Wrong
|
||||
ToU32ref() = *(u32 *)&c; // TODO -> This Seems Maybe Wrong
|
||||
return *this;
|
||||
}
|
||||
|
||||
Color operator|(u32 color) {
|
||||
|
||||
Reference in New Issue
Block a user