mirror of
https://github.com/zeldaret/ss
synced 2026-09-01 17:39:55 -04:00
lyt_layout matching
This commit is contained in:
@@ -39,11 +39,55 @@ struct AnimationShareBlock {
|
||||
};
|
||||
} // namespace res
|
||||
|
||||
struct AnimResource {
|
||||
AnimResource(const void *anmResBuf) {
|
||||
// TODO
|
||||
struct AnimationShareInfo {
|
||||
const char *GetTargetGroupName() const {
|
||||
return targetGroupName;
|
||||
}
|
||||
const char *GetSrcPaneName() const {
|
||||
return srcPaneName;
|
||||
}
|
||||
|
||||
char srcPaneName[17]; // at 0x00
|
||||
char targetGroupName[17]; // at 0x11
|
||||
u8 padding[2]; // at 0x12
|
||||
};
|
||||
struct AnimationGroupRef {
|
||||
const char *GetName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
char name[17]; // at 0x00
|
||||
u8 flag; // at 0x11
|
||||
u8 padding[2]; // at 0x12
|
||||
};
|
||||
|
||||
class AnimResource {
|
||||
public:
|
||||
AnimResource();
|
||||
AnimResource(const void *anmResBuf) {
|
||||
Set(anmResBuf);
|
||||
}
|
||||
void Set(const void *anmResBuf);
|
||||
void Init();
|
||||
u16 GetGroupNum() const;
|
||||
const AnimationGroupRef *GetGroupArray() const;
|
||||
bool IsDescendingBind() const;
|
||||
u16 GetAnimationShareInfoNum() const;
|
||||
AnimationShareInfo *GetAnimationShareInfoArray() const;
|
||||
u16 CalcAnimationNum(Pane *pPane, bool bRecursive) const;
|
||||
u16 CalcAnimationNum(Group *pGroup, bool bRecursive) const;
|
||||
|
||||
const res::AnimationBlock *GetResourceBlock() const {
|
||||
return mpResBlock;
|
||||
}
|
||||
const res::AnimationTagBlock *GetTagBlock() const {
|
||||
return mpTagBlock;
|
||||
}
|
||||
const res::AnimationShareBlock *GetShareBlock() const {
|
||||
return mpShareBlock;
|
||||
}
|
||||
|
||||
private:
|
||||
const res::BinaryFileHeader *mpFileHeader; // at 0x00
|
||||
const res::AnimationBlock *mpResBlock; // at 0x04
|
||||
const res::AnimationTagBlock *mpTagBlock; // at 0x08
|
||||
@@ -51,29 +95,32 @@ struct AnimResource {
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
struct AnimPaneTree {
|
||||
AnimPaneTree(Pane *pTargetPane, const AnimResource &animRes) : mAnimRes(animRes) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool IsEnabled() const {
|
||||
// TODO
|
||||
return false;
|
||||
class AnimPaneTree {
|
||||
public:
|
||||
AnimPaneTree(Pane *pTargetPane, const AnimResource &animRes) : mAnimRes() {
|
||||
Init();
|
||||
Set(pTargetPane, animRes);
|
||||
}
|
||||
bool IsEnabled() const;
|
||||
static u16 FindAnimContent(const res::AnimationBlock *pAnimBlock, const char *animContName, u8 animContType);
|
||||
void Init();
|
||||
void Set(Pane *pTargetPane, const AnimResource &animRes);
|
||||
AnimTransform *Bind(Layout *pLayout, Pane *pTargetPane, ResourceAccessor *pResAccessor) const;
|
||||
|
||||
// Inline Names Guess
|
||||
u16 GetLinkNum() const {
|
||||
return mLinkNum;
|
||||
}
|
||||
|
||||
private:
|
||||
AnimResource mAnimRes; // at 0x00
|
||||
u16 mAnimPaneIdx; // at 0x10
|
||||
u16 mLinkNum; // at 0x12
|
||||
u16 mAnimMatIdx[9]; // at 0x14
|
||||
u8 mAnimMatCnt; // at 0x26
|
||||
};
|
||||
} // namespace detail
|
||||
struct AnimationGroupRef {
|
||||
char name[17]; // at 0x00
|
||||
u8 flag; // at 0x11
|
||||
u8 padding[2]; // at 0x12
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
struct AnimTransform {
|
||||
inline AnimTransform() : mLink(), mpRes(NULL), mFrame(0.0f) {}
|
||||
|
||||
@@ -112,7 +159,8 @@ struct AnimationLink {
|
||||
u16 mIdx; // at 0xC
|
||||
bool mbDisable; // at 0xE
|
||||
};
|
||||
struct AnimTransformBasic : AnimTransform {
|
||||
class AnimTransformBasic : public AnimTransform {
|
||||
public:
|
||||
AnimTransformBasic();
|
||||
virtual ~AnimTransformBasic(); // at 0x08
|
||||
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor); // at 0x0C
|
||||
@@ -122,6 +170,7 @@ struct AnimTransformBasic : AnimTransform {
|
||||
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
|
||||
|
||||
@@ -54,10 +54,10 @@ void DrawQuad(const math::VEC2 &, const Size &, u8, const TexCoordData *, const
|
||||
void DrawQuad(const math::VEC2 &, const Size &, u8, const TexCoordData *, const ut::Color *, u8);
|
||||
void DrawLine(const math::VEC2 &pos, const Size &size, ut::Color color);
|
||||
|
||||
s32 GetSignatureInt(const char *sig) {
|
||||
inline s32 GetSignatureInt(const char *sig) {
|
||||
return *((s32 *)sig);
|
||||
}
|
||||
bool TestFileVersion(const res::BinaryFileHeader &fileHeader) {
|
||||
inline bool TestFileVersion(const res::BinaryFileHeader &fileHeader) {
|
||||
u32 majorVer = (fileHeader.version >> 8) & 0xFF;
|
||||
u32 minorVer = fileHeader.version & 0xFF;
|
||||
bool ret = majorVer == 0 && (minorVer > 7 && minorVer <= 10);
|
||||
|
||||
@@ -40,6 +40,13 @@ public:
|
||||
virtual void Animate(u32 option); // at 0x38
|
||||
virtual void SetTagProcessor(ut::TagProcessorBase<wchar_t> *pTagProcessor); // at 0x3C
|
||||
|
||||
private:
|
||||
ut::LinkList<AnimTransform, 4> mAnimTransList; // at 0x04
|
||||
Pane *mpRootPane; // at 0x10
|
||||
GroupContainer *mpGroupContainer; // at 0x14
|
||||
Size mLayoutSize; // at 0x18
|
||||
|
||||
public:
|
||||
// STATICS
|
||||
static void FreeMemory(void *p) {
|
||||
MEMFreeToAllocator(mspAllocator, p);
|
||||
@@ -109,12 +116,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
ut::LinkList<AnimTransform, 4> mAnimTransList; // at 0x04
|
||||
Pane *mpRootPane; // at 0x10
|
||||
GroupContainer *mpGroupContainer; // at 0x14
|
||||
Size mLayoutSize; // at 0x18
|
||||
|
||||
static MEMAllocator *mspAllocator;
|
||||
};
|
||||
} // namespace lyt
|
||||
|
||||
@@ -50,15 +50,6 @@ struct StepKey {};
|
||||
|
||||
} // namespace res
|
||||
|
||||
struct AnimationShareInfo {
|
||||
const char *GetSrcPaneName() const {
|
||||
return srcPaneName;
|
||||
}
|
||||
|
||||
char srcPaneName[17]; // at 0x00
|
||||
char targetGroupName[17]; // at 0x11
|
||||
u8 padding[2]; // at 0x12
|
||||
};
|
||||
namespace detail {
|
||||
template <typename T>
|
||||
inline bool TestBit(T bits, int index) {
|
||||
@@ -66,7 +57,7 @@ inline bool TestBit(T bits, int index) {
|
||||
return bits & mask;
|
||||
}
|
||||
template <typename T>
|
||||
inline bool SetBit(T *bits, int pos, bool val) {
|
||||
inline void SetBit(T *bits, int pos, bool val) {
|
||||
T mask = T(1 << pos);
|
||||
*bits = T((*bits & ~mask)) | (val << pos);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_LYT_UTIL_H
|
||||
#define NW4R_LYT_UTIL_H
|
||||
|
||||
#include <nw4r/lyt/lyt_animation.h>
|
||||
#include <nw4r/lyt/lyt_group.h>
|
||||
|
||||
namespace nw4r {
|
||||
namespace lyt {
|
||||
|
||||
void BindAnimation(Group *pGroup, AnimTransform *pAnimTrans, bool bRecursive, bool bDisable);
|
||||
|
||||
} // namespace lyt
|
||||
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user