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