NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_bc.hpp
1#pragma once
2
3#include <game/bases/d_rc.hpp>
4
5enum SensorFlags {
6 SENSOR_IS_POINT = 0,
7 SENSOR_IS_LINE = 1
8};
9
11
12/// @unofficial
14 operator const sBcSensorIf_c *() const { return (const sBcSensorIf_c *) this; }
15
16 u32 mFlags;
17 int mX, mY;
18};
19
20/// @unofficial
22 operator const sBcSensorIf_c *() const { return (const sBcSensorIf_c *) this; }
23
24 u32 mFlags;
25 int mLineA, mLineB;
26 int mDistanceFromCenter;
27};
28
29/// @unofficial
31public:
32 operator const sBcSensorIf_c *() const { return (sBcSensorIf_c *) &mFlags; }
33
34 u32 mFlags;
35 long mInfMargin;
36 long mSupMargin;
37 long mOffset;
38};
39
40/// @unofficial
42public:
43 sBcPointData mFoot;
44 sBcPointData mHead;
45 sBcPointData mWall;
46 sBcPointData mVine;
47};
48
49class dBg_ctr_c {
50public:
51 dActor_c *mpActor;
52 u8 mPad1[0x9c];
53 mVec2_c m_a0;
54 mVec2_c m_ac;
55 u8 mPad2[0xc];
56 short *mRotation;
57 short m_c0;
58 short m_c2;
59 u8 mPad4[0x4];
60 int m_c8;
61 u32 mFlags;
62 int m_d0;
63 u8 mpPad5[0xc];
64 int m_e0;
65
66 void addDokanMoveDiff(mVec3_c *);
67};
68
69class dBc_c {
70public:
71 enum Flag_e {
72 FLAG_0 = BIT_FLAG(0),
73 FLAG_1 = BIT_FLAG(1),
74 FLAG_2 = BIT_FLAG(2),
75 FLAG_3 = BIT_FLAG(3),
76 FLAG_4 = BIT_FLAG(4),
77 FLAG_5 = BIT_FLAG(5),
78 FLAG_6 = BIT_FLAG(6),
79 FLAG_7 = BIT_FLAG(7),
80 FLAG_8 = BIT_FLAG(8),
81 FLAG_9 = BIT_FLAG(9),
82 FLAG_10 = BIT_FLAG(10),
83 FLAG_11 = BIT_FLAG(11),
84 FLAG_12 = BIT_FLAG(12),
85 FLAG_13 = BIT_FLAG(13),
86 FLAG_14 = BIT_FLAG(14),
87 FLAG_15 = BIT_FLAG(15),
88 FLAG_16 = BIT_FLAG(16),
89 FLAG_17 = BIT_FLAG(17),
90 FLAG_18 = BIT_FLAG(18),
91 FLAG_19 = BIT_FLAG(19),
92 FLAG_20 = BIT_FLAG(20),
93 FLAG_21 = BIT_FLAG(21),
94 FLAG_22 = BIT_FLAG(22),
95 FLAG_23 = BIT_FLAG(23),
96 FLAG_24 = BIT_FLAG(24),
97 FLAG_25 = BIT_FLAG(25),
98 FLAG_26 = BIT_FLAG(26),
99 FLAG_27 = BIT_FLAG(27),
100 FLAG_28 = BIT_FLAG(28),
101 FLAG_29 = BIT_FLAG(29),
102 FLAG_30 = BIT_FLAG(30),
103
104 FLAG_WALL_R =
105 FLAG_0 | FLAG_2 | FLAG_4,
106 FLAG_WALL_L =
107 FLAG_1 | FLAG_3 | FLAG_5,
108 FLAG_FOOT =
109 FLAG_13 | FLAG_14 | FLAG_15 | FLAG_16 | FLAG_14 |
110 FLAG_15 | FLAG_16 | FLAG_17 | FLAG_18 | FLAG_19 |
111 FLAG_20,
112 FLAG_HEAD =
113 FLAG_26 | FLAG_27 | FLAG_28 | FLAG_29
114 };
115
116 enum WATER_TYPE_e {
117 WATER_CHECK_NONE,
118 WATER_CHECK_WATER,
119 WATER_CHECK_WATER_BUBBLE,
120 WATER_CHECK_YOGAN,
121 WATER_CHECK_POISON
122 };
123
124 dBc_c();
125 virtual ~dBc_c();
126
127 void init();
128 void set(dActor_c *, const sBcSensorIf_c *, const sBcSensorIf_c *, const sBcSensorIf_c *); ///< @unofficial
129
130 void checkLink();
131 bool checkRide();
132 bool checkHead(unsigned long);
133 s16 getSakaAngle(u8);
134 s16 getSakaMoveAngle(u8);
135 Flag_e checkWall(float *);
136 Flag_e checkWallEnm(float *);
137 Flag_e checkFoot();
138 Flag_e checkFootEnm();
139 u16 getWallAttr(int);
140 u16 getFootAttr();
141
142 u32 checkPoleCollision(sBcPointData *); ///< @unofficial
143 u32 checkVineCollision(sBcPointData *); ///< @unofficial
144
145 bool hasSensorFoot() { return mpSensorFoot != nullptr; }
146 bool hasSensorHead() { return mpSensorHead != nullptr; }
147 bool hasSensorWall() { return mpSensorWall != nullptr; }
148
149 bool checkRoofPlayer(const mVec3_c *, float *);
150 u32 getSakaDir();
151 int checkDokanLR(mVec3_c *, u8, int *, float, float);
152 int checkDokanDown(mVec3_c *, int *);
153 int checkDokanUp(mVec3_c *, int *);
154 void setRideOnObjBg(dBg_ctr_c *, const mVec3_c &);
155 bool checkWallPlayer(const mVec3_c *, const mVec3_c *, float *);
156 u32 checkBgPlr(dActor_c *);
157 u16 getHeadAttr();
158 short getHeadSakaMoveAngle(u8 direction);
159 void clearBgcSaveAll();
160
161 bool getSakaUpDown(u8 direction);
162 short getSakaAngleBySpeed(float);
163 int getSakaType();
164
165 u32 getFlags() const { return mFlags; }
166
167 u32 isWallR() { return mFlags & FLAG_WALL_R; }
168 u32 isWallL() { return mFlags & FLAG_WALL_L; }
169 u32 isWall() { return mFlags & (FLAG_WALL_R | FLAG_WALL_L); }
170 u32 isWall(u8 dir) { return mFlags & (FLAG_WALL_R << dir); }
171 u32 isFoot(); // { return mFlags & FLAG_FOOT; }
172 u32 isHead() { return mFlags & FLAG_HEAD; }
173 u32 isCollision() { return mFlags & (FLAG_WALL_L | FLAG_WALL_R | FLAG_FOOT | FLAG_HEAD); }
174
175 dActor_c *mpOwner;
176 sBcSensorIf_c *mpSensorFoot;
177 sBcSensorIf_c *mpSensorHead;
178 sBcSensorIf_c *mpSensorWall;
179 mVec3_c *mpOwnerPos;
180 mVec3_c *mpOwnerLastPos;
181 mVec3_c *mpOwnerSpeed;
182 mVec3_c mPushForce;
183 mVec2_c mOwnerPosDelta;
184 mVec2_c m_34;
185 mVec2_c m_3c;
186 float m_44;
187 float m_48;
188 float m_4c;
189 dRc_c *mpRc;
190 dActor_c *mpNoHitActor;
191 dBg_ctr_c *mpCtrHead;
192 dBg_ctr_c *mpCtrFoot;
193 dBg_ctr_c *mpCtrWall;
194 dBg_ctr_c *mpCtrWalls[2];
195 dBc_c *mPrevTrigBelowSensor;
196 dBc_c *mPrevTrigAboveSensor;
197 dBc_c *mPrevTrigAdjSensor;
198 dBc_c *mPrevTrigAdjSensorForDirection[2];
199 dBg_ctr_c *mLinkW[2];
200 u32 mFlags;
201 u32 mPrevFlags;
202 u32 mLastUnitType;
203 u32 mLastUnitKind;
204 s8 mOwningPlrNo;
205 s8 mRidePlrNo;
206 char mPad5[0x22];
207 u8 mPlayerFlags;
208 char mPad6[0x4];
209 int m_c4;
210 mAng mAdjacentSlopeAngle;
211 int mFenceType;
212 dBg_ctr_c *mpFenceCollision;
213 char mPad7[0x8];
214 float mIceSpeed;
215 bool m_e0;
216 u8 m_e1;
217 u8 m_e2;
218 bool mMovingLeft;
219 bool mGrounded;
220 u8 mAmiLine;
221 char mPad9[0x2];
222 u8 *mpLayer;
223 u8 mLayer;
224
225 static int checkWaterDepth(float, float, u8, u8, float *);
226 static WATER_TYPE_e checkWater(float, float, u8, float *);
227
228 static u32 checkBg(float, float, u8, u8, unsigned long);
229 static u32 checkWireNet(float x, float y, unsigned char layer);
230 static u32 checkGround(const mVec3_c *, float *, u8, u8, s8);
231 static u32 checkGround(const mVec3_c *, float *, int *, u8, u8, s8);
232 static bool checkGroundAngle(const mVec3_c *, float *, s16 *, u8, u8, s8, int *, int);
233 static u32 checkGroundHalf(const mVec3_c *, float *, u8, u8);
234 static u32 checkTenjou(const mVec3_c *, float *, u8, u8);
235 static u32 checkWall(const mVec3_c *, const mVec3_c *, float *, u8, u8, dActor_c **);
236 static u32 getUnitType(float x, float y, u8 layer);
237 static u32 getUnitKind(float x, float y, u8 layer);
238 static void getAirWaterHitPos(mVec2_c *);
239 static void getAirWaterHitAngle(short *);
240};
The minimum required implementation for a stage actor.
Definition d_actor.hpp:15
u32 checkPoleCollision(sBcPointData *)
void set(dActor_c *, const sBcSensorIf_c *, const sBcSensorIf_c *, const sBcSensorIf_c *)
u32 checkVineCollision(sBcPointData *)
A two-dimensional floating point vector.
Definition m_vec.hpp:26
A three-dimensional floating point vector.
Definition m_vec.hpp:122