NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
lyt_window.h
1#ifndef NW4R_LYT_WINDOW_H
2#define NW4R_LYT_WINDOW_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/lyt/lyt_common.h>
6#include <nw4r/lyt/lyt_pane.h>
7
8#include <nw4r/ut.h>
9
10namespace nw4r {
11namespace lyt {
12
13// Forward declarations
14class Material;
15struct ResBlockSet;
16
17/******************************************************************************
18 *
19 * InflationLRTB
20 *
21 ******************************************************************************/
23 f32 l; // at 0x0
24 f32 r; // at 0x4
25 f32 t; // at 0x8
26 f32 b; // at 0xC
27};
28
29namespace res {
30
31/******************************************************************************
32 *
33 * WindowContent
34 *
35 ******************************************************************************/
37 ulong vtxCols[VERTEXCOLOR_MAX]; // at 0x0
38 u16 materialIdx; // at 0x10
39 u8 texCoordNum; // at 0x12
40 u8 PADDING_0x13[0x14 - 0x13]; // at 0x13
41};
42
43/******************************************************************************
44 *
45 * WindowFrame
46 *
47 ******************************************************************************/
49 u16 materialIdx; // at 0x0
50 u8 textureFlip; // at 0x2
51 u8 PADDING_0x3; // at 0x3
52};
53
54/******************************************************************************
55 *
56 * WND1 binary layout
57 *
58 ******************************************************************************/
59struct Window : public Pane {
60 static const ulong SIGNATURE = 'wnd1';
61
62 InflationLRTB inflation; // at 0x4C
63 u8 frameNum; // at 0x5C
64 u8 PADDING_0x5D; // at 0x5D
65 u8 PADDING_0x5E; // at 0x5E
66 u8 PADDING_0x5F; // at 0x5F
67 ulong contentOffset; // at 0x60
68 ulong frameOffsetTableOffset; // at 0x64
69};
70
71} // namespace res
72
73/******************************************************************************
74 *
75 * WindowFrameEnum
76 *
77 ******************************************************************************/
78enum WindowFrameEnum {
79 WINDOWFRAME_LT,
80 WINDOWFRAME_RT,
81 WINDOWFRAME_LB,
82 WINDOWFRAME_RB,
83
84 WINDOWFRAME_L,
85 WINDOWFRAME_R,
86 WINDOWFRAME_T,
87 WINDOWFRAME_B,
88
89 WINDOWFRAME_MAX
90};
91
92/******************************************************************************
93 *
94 * WindowFrameSize
95 *
96 ******************************************************************************/
98 f32 l; // at 0x0
99 f32 r; // at 0x4
100 f32 t; // at 0x8
101 f32 b; // at 0xC
102};
103
104/******************************************************************************
105 *
106 * Window
107 *
108 ******************************************************************************/
109class Window : public Pane {
110public:
111 NW4R_UT_RTTI_DECL(Window);
112
113public:
114 Window(const res::Window* pRes, const ResBlockSet& rBlockSet);
115 virtual ~Window(); // at 0x8
116
117 virtual void DrawSelf(const DrawInfo& rInfo); // at 0x18
118 virtual void AnimateSelf(ulong option); // at 0x20
119
120 virtual ut::Color GetVtxColor(ulong idx) const; // at 0x24
121 virtual void SetVtxColor(ulong idx, ut::Color color); // at 0x28
122 virtual u8 GetVtxColorElement(ulong idx) const; // at 0x34
123 virtual void SetVtxColorElement(ulong idx, u8 value); // at 0x38
124
125 virtual Material* FindMaterialByName(const char* pName,
126 bool recursive); // at 0x40
127
128 virtual void UnbindAnimationSelf(AnimTransform* pAnimTrans); // at 0x50
129
130 virtual AnimationLink*
131 FindAnimationLink(AnimTransform* pAnimTrans); // at 0x54
132
133 virtual void SetAnimationEnable(AnimTransform* pAnimTrans, bool enable,
134 bool recursive); // at 0x58
135
136 virtual Material* GetContentMaterial() const; // at 0x64
137 virtual Material* GetFrameMaterial(ulong idx) const; // at 0x68
138
139protected:
140 struct Frame {
141 u8 textureFlip; // at 0x0
142 Material* pMaterial; // at 0x4
143
144 Frame() : textureFlip(0), pMaterial(NULL) {}
145 };
146
147 struct Content {
148 ut::Color vtxColors[VERTEXCOLOR_MAX]; // at 0x0
149 detail::TexCoordAry texCoordAry; // at 0x10
150 };
151
152protected:
153 virtual void DrawContent(const math::VEC2& rBase,
154 const WindowFrameSize& rFrameSize,
155 u8 alpha); // at 0x6C
156
157 virtual void DrawFrame(const math::VEC2& rBase, const Frame& rFrame,
158 const WindowFrameSize& rFrameSize,
159 u8 alpha); // at 0x70
160
161 virtual void DrawFrame4(const math::VEC2& rBase, const Frame* pFrames,
162 const WindowFrameSize& rFrameSize,
163 u8 alpha); // at 0x74
164
165 virtual void DrawFrame8(const math::VEC2& rBase, const Frame* pFrames,
166 const WindowFrameSize& rFrameSize,
167 u8 alpha); // at 0x78
168
169 WindowFrameSize GetFrameSize(u8 frameNum, const Frame* pFrames);
170
171protected:
172 InflationLRTB mContentInflation; // at 0xD4
173 Content mContent; // at 0xE4
174 Frame* mFrames; // at 0xFC
175 u8 mFrameNum; // at 0x100
176};
177
178} // namespace lyt
179} // namespace nw4r
180
181#endif
2D graphics drawing library.