NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_resanmtexpat.h
1#ifndef NW4R_G3D_RES_RES_ANM_TEX_PAT_H
2#define NW4R_G3D_RES_RES_ANM_TEX_PAT_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/g3d/res/g3d_resanm.h>
6#include <nw4r/g3d/res/g3d_rescommon.h>
7#include <nw4r/g3d/res/g3d_resdict.h>
8#include <nw4r/g3d/res/g3d_resfile.h>
9#include <nw4r/g3d/res/g3d_respltt.h>
10#include <nw4r/g3d/res/g3d_restex.h>
11
12namespace nw4r {
13namespace g3d {
14
15/******************************************************************************
16 *
17 * TexPatAnmResult
18 *
19 ******************************************************************************/
21 static const int NUM_OF_ANMS = 8;
22
23 u8 bTexExist; // at 0x0
24 u8 bPlttExist; // at 0x1
25 u8 PADDING_0x2[0x4 - 0x2]; // at 0x2
26 ResTex tex[NUM_OF_ANMS]; // at 0x4
27 ResPltt pltt[NUM_OF_ANMS]; // at 0x24
28};
29
30/******************************************************************************
31 *
32 * ResAnmTexPat
33 *
34 ******************************************************************************/
36 f32 frame; // at 0x0
37 u16 texIndex; // at 0x4
38 u16 plttIndex; // at 0x6
39};
40
42 u16 numFrameValues; // at 0x0
43 u8 PADDING_0x2[0x4 - 0x2]; // at 0x2
44 f32 invKeyFrameRange; // at 0x4
45 ResAnmTexPatFrmData frameValues[1]; // at 0x8
46};
47
49 enum Flag {
50 FLAG_ANM_EXISTS = (1 << 0),
51 FLAG_ANM_CONST = (1 << 1),
52 FLAG_ANM_TEX = (1 << 2),
53 FLAG_ANM_PLTT = (1 << 3),
54
55 // Four bits in 'flags' for each animation
56 NUM_OF_FLAGS = 4
57 };
58
59 union AnmData {
60 s32 toResAnmTexPatAnmData; // at 0x0
61
62 struct {
63 u16 texIndex; // at 0x0
64 u16 plttIndex; // at 0x2
65 } constValue;
66 };
67
68 s32 name; // at 0x0
69 ulong flags; // at 0x4
70 AnmData anms[1]; // at 0x8
71};
72
74 u16 numFrame; // at 0x0
75 u16 numMaterial; // at 0x2
76 u16 numTexture; // at 0x4
77 u16 numPalette; // at 0x6
78 AnmPolicy policy; // at 0x8
79};
80
82 ResBlockHeaderData header; // at 0x0
83 ulong revision; // at 0x8
84 s32 toResFileData; // at 0xC
85 s32 toTexPatDataDic; // at 0x10
86 s32 toTexNameArray; // at 0x14
87 s32 toPlttNameArray; // at 0x18
88 s32 toResTexArray; // at 0x1C
89 s32 toResPlttArray; // at 0x20
90 s32 toResUserData; // at 0x24
91 s32 name; // at 0x28
92 s32 original_path; // at 0x2C
93 ResAnmTexPatInfoData info; // at 0x30
94};
95
96class ResAnmTexPat : public ResCommon<ResAnmTexPatData> {
97public:
98 static const ulong SIGNATURE = 'PAT0';
99 static const int REVISION = 3;
100
101public:
102 NW4R_G3D_RESOURCE_FUNC_DEF(ResAnmTexPat);
103
104 bool Bind(const ResFile file);
105 void Release();
106
107 ResFile GetParent() const;
108
109 ulong GetRevision() const {
110 return ref().revision;
111 }
112
113 bool CheckRevision() const {
114 return GetRevision() == REVISION;
115 }
116
117 void GetAnmResult(TexPatAnmResult* pResult, ulong idx, f32 frame) const;
118
119 const ResAnmTexPatMatData* GetMatAnm(int idx) const {
120 return static_cast<ResAnmTexPatMatData*>(
121 ofs_to_obj<ResDic>(ref().toTexPatDataDic)[idx]);
122 }
123 const ResAnmTexPatMatData* GetMatAnm(ulong idx) const {
124 return static_cast<ResAnmTexPatMatData*>(
125 ofs_to_obj<ResDic>(ref().toTexPatDataDic)[idx]);
126 }
127
128 int GetNumFrame() const {
129 return ref().info.numFrame;
130 }
131
132 int GetNumMaterial() const {
133 return ref().info.numMaterial;
134 }
135
136 AnmPolicy GetAnmPolicy() const {
137 return ref().info.policy;
138 }
139};
140
141} // namespace g3d
142} // namespace nw4r
143
144#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10