New Super Mario Bros. U Headers
Loading...
Searching...
No Matches
Bg.h
Go to the documentation of this file.
1#pragma once
2
3#include <collision/BgUnitCode.h>
4#include <map/BgDeco.h>
5#include <map/WaveType.h>
6#include <utility/Direction.h>
7
8#include <heap/seadDisposer.h>
9#include <math/seadVector.h>
10
11class Bg
12{
13 // createInstance() Address: 0x02684EF0
14 // sInstance Address: 0x101DAB94
16
17public:
19 {
21 union
22 {
23 struct
24 {
29
30 struct
31 {
34 u8 _e;
36
37 struct
38 {
39 u8 _c;
40 u8 index;
41 u8 _e;
43 };
44 };
45
54 static_assert(sizeof(GustType) == 1, "Bg::GustType size mismatch");
55
63 static_assert(sizeof(Gust) == 0x14, "Bg::Gust size mismatch");
64
65public:
66 // Address: 0x02684480
67 Bg();
68 // Address: 0x0268BB9C
69 virtual ~Bg();
70
71 // Address: 0x02684F74
72 static u16* getUnit(u16 x, u16 y, u32 file, u8 layer, s32* block_idx = nullptr);
73 // Address: 0x02685000
74 static u16* getUnitCurrentCdFile(u16 x, u16 y, u8 layer, s32* block_idx = nullptr);
75
76 // Address: 0x026850F0
77 u64 getBgCheckData(u16 x, u16 y, u8 layer, bool with_p_sw = true); // See BgUnitCode
78 u64 getBgCheckData(f32 x, f32 y, u8 layer, bool with_p_sw = true) // ^^^
79 {
80 return getBgCheckData(u16(x), u16(-y), layer, with_p_sw);
81 }
82
83 BgUnitCode::HitType getUnitHitType(u16 x, u16 y, u8 layer);
84 BgUnitCode::HitType getUnitHitType(f32 x, f32 y, u8 layer)
85 {
86 return getUnitHitType(u16(x), u16(-y), layer);
87 }
88
89 BgUnitCode::Type getUnitType(u16 x, u16 y, u8 layer);
90 BgUnitCode::Type getUnitType(f32 x, f32 y, u8 layer)
91 {
92 return getUnitType(u16(x), u16(-y), layer);
93 }
94
95 BgUnitCode::TypeInfo getUnitTypeInfo(u16 x, u16 y, u8 layer);
96 BgUnitCode::TypeInfo getUnitTypeInfo(f32 x, f32 y, u8 layer)
97 {
98 return getUnitTypeInfo(u16(x), u16(-y), layer);
99 }
100
101 // Address: 0x02685378
102 void setUnit(u16 x, u16 y, u32 file, u8 layer, u16 unit);
103 // Address: 0x026854A8
104 void setUnitCurrentCdFile(u16 x, u16 y, u8 layer, u16 unit);
105
106 // Address: 0x0268B71C
107 void setWaterWave(const sead::Vector2f& pos, WaveType type);
108
109 // Address: 0x0268B8E4
111
112 // Address: 0x0268B964
113 void registerGrass(f32 x, f32 y, f32 z, u8, u8 index, u8);
114
115 // Address: 0x0268B96C
116 void registerFlower(f32 x, f32 y, f32 z, u8 color, u8 index, u8);
117
118 // Address: 0x02685914
119 void registerButterfly(f32 x, f32 y, f32 z, u8, u8 index, u8);
120
121 // Address: 0x0268B974
122 void updateFlower(f32 x, f32 y, u8 index, bool enabled);
123
124 // Address: 0x0268B908
125 void deleteFlower(u8 index);
126
127 // Address: 0x02686080
128 void registerGust(GustType type, const sead::Vector3f& pos, u8, s8 direction);
129
130 /**
131 * @brief Checks for gusts of wind caused by players affecting grass/flowers.
132 * @return @c 0 for nothing, otherwise @c -1 or @c 1 for left and right respectively.
133 * @par Address: 0x02685FB0
134 */
135 s8 checkGust(GustType type, const sead::Vector3f& pos, f32* dist);
136
137 // Address: 0x026854C0
138 u32 FUN_026854c0(u16, u16, u8 layer, bool);
139
140 f32 getWaveSurfaceX(s32 index) const
141 {
142 return mWaveSurfaceX[index];
143 }
144
145 f32 getWaveSurfaceY(s32 index) const
146 {
147 return mWaveSurfaceY[index];
148 }
149
151 {
152 return mGrassDecorationInfo[index];
153 }
154
156 {
157 return mFlowerDecorationInfo[index];
158 }
159
161 {
162 return mButterflyDecorationInfo[index];
163 }
164
166 {
167 return mFlowerNo;
168 }
169
171 {
172 return mFlowerType;
173 }
174
175 void setFlowerType(u8 type)
176 {
177 mFlowerType = type;
178 }
179
181 {
182 return mBgDeco;
183 }
184
185 bool getHasLavaWaves() const
186 {
187 return mHasLavaWaves;
188 }
189
190 void setHasLavaWaves(u8 has_waves)
191 {
192 mHasLavaWaves = has_waves;
193 }
194
195 bool getHasLiquid() const
196 {
197 return mHasLiquid;
198 }
199
200 void setHasLiquid(bool has_liquid)
201 {
202 mHasLiquid = has_liquid;
203 }
204
205private:
214 u8 _2824[0x558];
215 u8 _2d7c[0x558];
216 u8 _32d4[0x88];
217 u8 _335c[800];
218 u8 _367c[100];
219 u8 _36e0[100];
220 u32 _3744[100];
227 u8 _3f24[100];
232 u8 _7e20[0x1D64];
233};
234static_assert(sizeof(Bg) == 0x9B88, "Bg size mismatch");
Definition Bg.h:12
bool mHasLavaWaves
Definition Bg.h:211
f32 _18
Definition Bg.h:208
BgUnitCode::TypeInfo getUnitTypeInfo(u16 x, u16 y, u8 layer)
bool getHasLavaWaves() const
Definition Bg.h:185
u8 _3f24[100]
Definition Bg.h:227
u8 getFlowerType() const
Definition Bg.h:170
u64 getBgCheckData(u16 x, u16 y, u8 layer, bool with_p_sw=true)
DecorationInfo & getButterflyDecorationInfo(u32 index)
Definition Bg.h:160
bool mHasLiquid
Definition Bg.h:212
DecorationInfo * mGrassDecorationInfo
Definition Bg.h:221
u32 _3744[100]
Definition Bg.h:220
DecorationInfo * mButterflyDecorationInfo
Definition Bg.h:223
sead::Vector2f mFlowerPositions[100]
Definition Bg.h:226
u8 _2d7c[0x558]
Definition Bg.h:215
u32 FUN_026854c0(u16, u16, u8 layer, bool)
void setUnitCurrentCdFile(u16 x, u16 y, u8 layer, u16 unit)
u8 _367c[100]
Definition Bg.h:218
virtual ~Bg()
f32 mWaveSurfaceX[1280]
Definition Bg.h:209
void setUnit(u16 x, u16 y, u32 file, u8 layer, u16 unit)
u32 _10
Definition Bg.h:206
void updateFlower(f32 x, f32 y, u8 index, bool enabled)
static u16 * getUnit(u16 x, u16 y, u32 file, u8 layer, s32 *block_idx=nullptr)
Gust mGust[40]
Definition Bg.h:225
s8 checkGust(GustType type, const sead::Vector3f &pos, f32 *dist)
Checks for gusts of wind caused by players affecting grass/flowers.
f32 _14
Definition Bg.h:207
void deleteFlower(u8 index)
u8 _7e20[0x1D64]
Definition Bg.h:232
u32 _2820
Definition Bg.h:213
u8 mFlowerType
Definition Bg.h:229
DecorationInfo & getFlowerDecorationInfo(u32 index)
Definition Bg.h:155
f32 mWaveSurfaceY[1280]
Definition Bg.h:210
GustType
Definition Bg.h:47
@ cGustType_2
Definition Bg.h:50
@ cGustType_Spin
Definition Bg.h:51
@ cGustType_Invalid
Definition Bg.h:48
@ cGustType_Run
Definition Bg.h:52
@ cGustType_1
Definition Bg.h:49
bool mHasFlowers
Definition Bg.h:230
DecorationInfo & getGrassDecorationInfo(u32 index)
Definition Bg.h:150
BgDeco mBgDeco
Definition Bg.h:231
u32 _3f88
Definition Bg.h:228
void setFlowerType(u8 type)
Definition Bg.h:175
DecorationInfo * mFlowerDecorationInfo
Definition Bg.h:222
u8 _32d4[0x88]
Definition Bg.h:216
f32 getWaveSurfaceX(s32 index) const
Definition Bg.h:140
static u16 * getUnitCurrentCdFile(u16 x, u16 y, u8 layer, s32 *block_idx=nullptr)
void setHasLiquid(bool has_liquid)
Definition Bg.h:200
void registerFlower(f32 x, f32 y, f32 z, u8 color, u8 index, u8)
void registerGust(GustType type, const sead::Vector3f &pos, u8, s8 direction)
void registerGrass(f32 x, f32 y, f32 z, u8, u8 index, u8)
u32 mFlowerNo
Definition Bg.h:224
BgUnitCode::Type getUnitType(u16 x, u16 y, u8 layer)
u8 _335c[800]
Definition Bg.h:217
void registerButterfly(f32 x, f32 y, f32 z, u8, u8 index, u8)
Bg()
u8 getNextFlowerIndex()
u8 _36e0[100]
Definition Bg.h:219
u8 _2824[0x558]
Definition Bg.h:214
void setHasLavaWaves(u8 has_waves)
Definition Bg.h:190
f32 getWaveSurfaceY(s32 index) const
Definition Bg.h:145
BgUnitCode::HitType getUnitHitType(u16 x, u16 y, u8 layer)
u32 getFlowerCount() const
Definition Bg.h:165
bool getHasLiquid() const
Definition Bg.h:195
BgDeco & getBgDeco()
Definition Bg.h:180
void setWaterWave(const sead::Vector2f &pos, WaveType type)
Definition Bg.h:57
sead::Vector3f pos
Definition Bg.h:58
s8 direction
Definition Bg.h:61
f32 radius
Definition Bg.h:59
u8 _11
Definition Bg.h:60