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{
13
14public:
16 {
18 union
19 {
20 struct
21 {
26
27 struct
28 {
31 u8 _e;
33
34 struct
35 {
36 u8 _c;
37 u8 index;
38 u8 _e;
40 };
41 };
42
51 static_assert(sizeof(GustType) == 1, "Bg::GustType size mismatch");
52
60 static_assert(sizeof(Gust) == 0x14, "Bg::Gust size mismatch");
61
62public:
63 // Address: 0x02684480
64 Bg();
65 // Address: 0x0268BB9C
66 virtual ~Bg();
67
68 // Address: 0x02684F74
69 static u16* getUnit(u16 x, u16 y, u32 file, u8 layer, s32* block_idx = nullptr);
70 // Address: 0x02685000
71 static u16* getUnitCurrentCdFile(u16 x, u16 y, u8 layer, s32* block_idx = nullptr);
72
73 u64 getBgCheckData(u16 x, u16 y, u8 layer, bool with_p_sw = true); // See BgUnitCode
74 u64 getBgCheckData(f32 x, f32 y, u8 layer, bool with_p_sw = true) // ^^^
75 {
76 return getBgCheckData(u16(x), u16(-y), layer, with_p_sw);
77 }
78
79 BgUnitCode::HitType getUnitHitType(u16 x, u16 y, u8 layer);
80 BgUnitCode::HitType getUnitHitType(f32 x, f32 y, u8 layer)
81 {
82 return getUnitHitType(u16(x), u16(-y), layer);
83 }
84
85 BgUnitCode::Type getUnitType(u16 x, u16 y, u8 layer);
86 BgUnitCode::Type getUnitType(f32 x, f32 y, u8 layer)
87 {
88 return getUnitType(u16(x), u16(-y), layer);
89 }
90
91 BgUnitCode::TypeInfo getUnitTypeInfo(u16 x, u16 y, u8 layer);
92 BgUnitCode::TypeInfo getUnitTypeInfo(f32 x, f32 y, u8 layer)
93 {
94 return getUnitTypeInfo(u16(x), u16(-y), layer);
95 }
96
97 // Address: 0x02685378
98 void setUnit(u16 x, u16 y, u32 file, u8 layer, u16 unit);
99 // Address: 0x026854A8
100 void setUnitCurrentCdFile(u16 x, u16 y, u8 layer, u16 unit);
101
102 void setWaterInWave(const sead::Vector2f& pos, u8 wave_scale);
103
104 // Address: 0x0268B8E4
106
107 // Address: 0x0268B964
108 void registerGrass(f32 x, f32 y, f32 z, u8, u8 index, u8);
109
110 // Address: 0x0268B96C
111 void registerFlower(f32 x, f32 y, f32 z, u8 color, u8 index, u8);
112
113 // Address: 0x02685914
114 void registerButterfly(f32 x, f32 y, f32 z, u8, u8 index, u8);
115
116 // Address: 0x0268B974
117 void updateFlower(f32 x, f32 y, u8 index, bool enabled);
118
119 // Address: 0x0268B908
120 void deleteFlower(u8 index);
121
122 // Address: 0x02686080
123 void registerGust(GustType type, const sead::Vector3f& pos, u8, s8 direction);
124
125 /**
126 * @brief Checks for gusts of wind caused by players affecting grass/flowers.
127 * @return @c 0 for nothing, otherwise @c -1 or @c 1 for left and right respectively.
128 * @par Address: 0x02685FB0
129 */
130 s8 checkGust(GustType type, const sead::Vector3f& pos, f32* dist);
131
132 f32 getWaveSurfaceX(s32 index) const
133 {
134 return mWaveSurfaceX[index];
135 }
136
137 f32 getWaveSurfaceY(s32 index) const
138 {
139 return mWaveSurfaceY[index];
140 }
141
143 {
144 return mGrassDecorationInfo[index];
145 }
146
148 {
149 return mFlowerDecorationInfo[index];
150 }
151
153 {
154 return mButterflyDecorationInfo[index];
155 }
156
158 {
159 return mFlowerNo;
160 }
161
163 {
164 return mFlowerType;
165 }
166
167 void setFlowerType(u8 type)
168 {
169 mFlowerType = type;
170 }
171
173 {
174 return mBgDeco;
175 }
176
177private:
186 u8 _2824[0x558];
187 u8 _2d7c[0x558];
188 u8 _32d4[0x88];
189 u8 _335c[800];
190 u8 _367c[100];
191 u8 _36e0[100];
192 u32 _3744[100];
199 u8 _3f24[100];
204 u8 _7e20[0x1D64];
205};
206static_assert(sizeof(Bg) == 0x9B88, "Bg size mismatch");
Definition Bg.h:11
bool mHasLavaWaves
Definition Bg.h:183
void setWaterInWave(const sead::Vector2f &pos, u8 wave_scale)
f32 _18
Definition Bg.h:180
BgUnitCode::TypeInfo getUnitTypeInfo(u16 x, u16 y, u8 layer)
u8 _3f24[100]
Definition Bg.h:199
u8 getFlowerType() const
Definition Bg.h:162
u64 getBgCheckData(u16 x, u16 y, u8 layer, bool with_p_sw=true)
DecorationInfo & getButterflyDecorationInfo(u32 index)
Definition Bg.h:152
DecorationInfo * mGrassDecorationInfo
Definition Bg.h:193
u32 _3744[100]
Definition Bg.h:192
DecorationInfo * mButterflyDecorationInfo
Definition Bg.h:195
sead::Vector2f mFlowerPositions[100]
Definition Bg.h:198
u8 _2d7c[0x558]
Definition Bg.h:187
void setUnitCurrentCdFile(u16 x, u16 y, u8 layer, u16 unit)
u8 _367c[100]
Definition Bg.h:190
virtual ~Bg()
f32 mWaveSurfaceX[1280]
Definition Bg.h:181
void setUnit(u16 x, u16 y, u32 file, u8 layer, u16 unit)
u32 _10
Definition Bg.h:178
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:197
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:179
void deleteFlower(u8 index)
u8 _7e20[0x1D64]
Definition Bg.h:204
u32 _2820
Definition Bg.h:185
u8 mFlowerType
Definition Bg.h:201
DecorationInfo & getFlowerDecorationInfo(u32 index)
Definition Bg.h:147
f32 mWaveSurfaceY[1280]
Definition Bg.h:182
GustType
Definition Bg.h:44
@ cGustType_2
Definition Bg.h:47
@ cGustType_Spin
Definition Bg.h:48
@ cGustType_Invalid
Definition Bg.h:45
@ cGustType_Run
Definition Bg.h:49
@ cGustType_1
Definition Bg.h:46
bool mHasFlowers
Definition Bg.h:202
DecorationInfo & getGrassDecorationInfo(u32 index)
Definition Bg.h:142
BgDeco mBgDeco
Definition Bg.h:203
u32 _3f88
Definition Bg.h:200
void setFlowerType(u8 type)
Definition Bg.h:167
DecorationInfo * mFlowerDecorationInfo
Definition Bg.h:194
u8 _32d4[0x88]
Definition Bg.h:188
f32 getWaveSurfaceX(s32 index) const
Definition Bg.h:132
static u16 * getUnitCurrentCdFile(u16 x, u16 y, u8 layer, s32 *block_idx=nullptr)
void registerFlower(f32 x, f32 y, f32 z, u8 color, u8 index, u8)
bool mHasTerrain
Definition Bg.h:184
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:196
BgUnitCode::Type getUnitType(u16 x, u16 y, u8 layer)
u8 _335c[800]
Definition Bg.h:189
void registerButterfly(f32 x, f32 y, f32 z, u8, u8 index, u8)
Bg()
u8 getNextFlowerIndex()
u8 _36e0[100]
Definition Bg.h:191
u8 _2824[0x558]
Definition Bg.h:186
f32 getWaveSurfaceY(s32 index) const
Definition Bg.h:137
BgUnitCode::HitType getUnitHitType(u16 x, u16 y, u8 layer)
u32 getFlowerCount() const
Definition Bg.h:157
BgDeco & getBgDeco()
Definition Bg.h:172
Definition Bg.h:54
sead::Vector3f pos
Definition Bg.h:55
s8 direction
Definition Bg.h:58
f32 radius
Definition Bg.h:56
u8 _11
Definition Bg.h:57