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