Skip to content

Commit f6f89ad

Browse files
committed
various d_bg debug cleanup
1 parent ae0f890 commit f6f89ad

30 files changed

+3689
-1232
lines changed

include/SSystem/SComponent/c_bg_s_shdw_draw.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class cBgS_ShdwDraw : public cBgS_Chk {
2020

2121
/* 0x14 */ cM3dGAab mM3dGAab;
2222
/* 0x30 */ cBgS_ShdwDraw_Callback mCallbackFun;
23+
#if DEBUG
24+
/* 0x34 */ int field_0x34;
25+
#endif
2326
};
2427

2528
#endif /* C_BG_S_SHDW_DRAW_H */

include/SSystem/SComponent/c_bg_w.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class cBgW_BgId {
1818
cBgW_BgId() { Ct(); }
1919
void Ct() { m_id = 0x100; }
2020

21-
u16 GetId() const { return m_id; }
21+
int GetId() const { return m_id; }
2222
};
2323

2424
bool cBgW_CheckBGround(float a1);

include/SSystem/SComponent/c_m3d_g_aab.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ class cM3dGAab {
3535
const f32 GetMinX(void) const { return mMin.x; }
3636
const f32 GetMinY(void) const { return mMin.y; }
3737
const f32 GetMinZ(void) const { return mMin.z; }
38-
bool Cross(const cM3dGLin *param_1) {
38+
bool Cross(const cM3dGLin *param_1) const {
3939
return cM3d_Cross_MinMaxBoxLine(GetMinP(), GetMaxP(), (Vec*)&param_1->GetStartP(), (Vec*)&param_1->GetEndP());
4040
}
41-
bool Cross(const cM3dGAab *param_1) {
41+
bool Cross(const cM3dGAab *param_1) const {
4242
return cM3d_Cross_AabAab(this, param_1);
4343
}
44-
bool Cross(const cM3dGCyl *param_1) {
44+
bool Cross(const cM3dGCyl *param_1) const {
4545
return cM3d_Cross_AabCyl(this, param_1);
4646
}
47-
bool Cross(const cM3dGSph *param_1) {
47+
bool Cross(const cM3dGSph *param_1) const {
4848
return cM3d_Cross_AabSph(this, param_1);
4949
}
5050
}; // Size = 0x1C

include/SSystem/SComponent/c_m3d_g_cir.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class cM3dGCir : public cM2dGCir {
3030
cM3dGCir(void);
3131
virtual ~cM3dGCir(void);
3232
void Set(f32, f32, f32, f32);
33+
34+
f32 GetHeight() const { return mPosZ; }
3335
};
3436

3537
#endif /* C_M3D_G_CIR_H */

include/SSystem/SComponent/c_m3d_g_pla.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class cM3dGPla {
3131
cM3d_CalcPla(v1, v2, v3, &mNormal, &mD);
3232
}
3333

34-
f32 getCrossY_NonIsZero(const cXyz *param_1) {
35-
return ((-mNormal.x * param_1->x - mNormal.z * param_1->z) - mD) / mNormal.y;
34+
f32 getCrossY_NonIsZero(const cXyz& param_1) const {
35+
return ((-mNormal.x * param_1.x - mNormal.z * param_1.z) - mD) / mNormal.y;
3636
}
3737

3838
bool cross(cM3dGLin const& line, Vec& point) {

include/d/d_bg_s.h

Lines changed: 121 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class cBgS_ChkElm {
1313
public:
1414
/* 0x00 */ dBgW_Base* m_bgw_base_ptr;
1515
/* 0x04 */ bool m_used;
16-
/* 0x08 */ u32 m_actor_id;
16+
/* 0x08 */ fpc_ProcID m_actor_id;
1717
/* 0x0C */ fopAc_ac_c* m_actor_ptr;
1818
/* 0x10 vtable */
1919

@@ -50,6 +50,7 @@ class cBgS {
5050
bool GetTriPnt(cBgS_PolyInfo const&, cXyz*, cXyz*, cXyz*) const;
5151
void ShdwDraw(cBgS_ShdwDraw*);
5252
u32 GetGrpInf(cBgS_PolyInfo const&) const;
53+
void Draw();
5354

5455
virtual ~cBgS() {}
5556
virtual void Ct();
@@ -67,40 +68,124 @@ u8 dKy_pol_sound_get(cBgS_PolyInfo const* param_0);
6768
class dBgS_HIO : public JORReflexible {
6869
public:
6970
#if DEBUG
71+
enum flags_e {
72+
FLAG_ACCH_WALL_OFF_e = 0x2,
73+
FLAG_CHECK_COUNTER_e = 0x4,
74+
FLAG_ACCH_WALL_TIMER_e = 0x8,
75+
FLAG_OBJ_LINE_CHECK_e = 0x10,
76+
FLAG_ACCH_DRAW_WALL_e = 0x400,
77+
FLAG_ROOF_TIMER_e = 0x2000,
78+
FLAG_ROOF_OFF_e = 0x4000,
79+
80+
FLAG2_GND_CHK_e = 0x1,
81+
FLAG2_SHAPE_DISP_e = 0x2,
82+
FLAG2_GROUND_CHECK_TIMER_e = 0x4,
83+
FLAG2_SPL_OFF_e = 0x8,
84+
FLAG2_SPL_TIMER_e = 0x10,
85+
FLAG2_LINE_OFF_e = 0x40,
86+
FLAG2_LINE_TIMER_e = 0x80,
87+
FLAG2_SHDW_DRAW_OFF_e = 0x100,
88+
FLAG2_SHDW_DRAW_TIMER_e = 0x200,
89+
FLAG2_CAPTPOLY_OFF_e = 0x800,
90+
FLAG2_CAPTPOLY_TIMER_e = 0x1000,
91+
FLAG2_SPH_CHK_OFF_e = 0x2000,
92+
FLAG2_SPH_CHK_TIMER_e = 0x4000,
93+
};
94+
7095
dBgS_HIO() {
71-
field_0x6 = 0;
72-
field_0x8 = 0;
96+
m_flags = 0;
97+
m_flags2 = 0;
7398

74-
field_0xc.x = field_0xc.y = field_0xc.z = 0.0f;
75-
field_0x18.x = field_0x18.y = field_0x18.z = 0.0f;
76-
field_0x24.x = field_0x24.y = field_0x24.z = 0.0f;
99+
m_linecheck_start.x = m_linecheck_start.y = m_linecheck_start.z = 0.0f;
100+
m_linecheck_end.x = m_linecheck_end.y = m_linecheck_end.z = 0.0f;
101+
m_gndcheck_pos.x = m_gndcheck_pos.y = m_gndcheck_pos.z = 0.0f;
77102

78-
field_0x30 = -1;
103+
m_errorCheck_actor_num = -1;
79104
}
80105

81106
virtual void genMessage(JORMContext*);
82107
virtual ~dBgS_HIO();
83108

84-
BOOL ChkLineOff();
85-
BOOL ChkCheckCounter();
86-
BOOL ChkLineTimer();
87-
BOOL ChkGroundCheckTimer();
88-
89-
/* 0x04 */ u8 field_0x4[0x6 - 0x4];
90-
/* 0x06 */ u16 field_0x6;
91-
/* 0x08 */ u16 field_0x8;
92-
/* 0x0C */ cXyz field_0xc;
93-
/* 0x18 */ cXyz field_0x18;
94-
/* 0x24 */ cXyz field_0x24;
95-
/* 0x30 */ int field_0x30;
109+
bool ChkLineOff() { return m_flags2 & FLAG2_LINE_OFF_e; }
110+
bool ChkCheckCounter() { return m_flags & FLAG_CHECK_COUNTER_e; }
111+
bool ChkLineTimer() { return m_flags2 & FLAG2_LINE_TIMER_e; }
112+
bool ChkGroundCheckTimer() { return m_flags2 & FLAG2_GROUND_CHECK_TIMER_e; }
113+
bool ChkObjLineCheck() { return m_flags & FLAG_OBJ_LINE_CHECK_e; }
114+
bool ChkGndCheck() { return m_flags2 & FLAG2_GND_CHK_e; }
115+
bool ChkCaptPolyTimer() { return m_flags2 & FLAG2_CAPTPOLY_TIMER_e; }
116+
bool ChkCaptPolyOff() { return m_flags2 & FLAG2_CAPTPOLY_OFF_e; }
117+
bool ChkShdwDrawOff() { return m_flags2 & FLAG2_SHDW_DRAW_OFF_e; }
118+
bool ChkShdwDrawTimer() { return m_flags2 & FLAG2_SHDW_DRAW_TIMER_e; }
119+
bool ChkAcchWallOff() { return m_flags & FLAG_ACCH_WALL_OFF_e; }
120+
bool ChkAcchWallTimer() { return m_flags & FLAG_ACCH_WALL_TIMER_e; }
121+
bool ChkRoofTimer() { return m_flags & FLAG_ROOF_TIMER_e; }
122+
bool ChkRoofOff() { return m_flags & FLAG_ROOF_OFF_e; }
123+
bool ChkSplOff() { return m_flags2 & FLAG2_SPL_OFF_e; }
124+
bool ChkSplTimer() { return m_flags2 & FLAG2_SPL_TIMER_e; }
125+
bool ChkSphChkOff() { return m_flags2 & FLAG2_SPH_CHK_OFF_e; }
126+
bool ChkSphChkTimer() { return m_flags2 & FLAG2_SPH_CHK_TIMER_e; }
127+
bool ChkShapeDisp() { return m_flags2 & FLAG2_SHAPE_DISP_e; }
128+
bool ChkAcchDrawWall() { return m_flags & FLAG_ACCH_DRAW_WALL_e; }
129+
130+
/* 0x04 */ s8 id;
131+
/* 0x06 */ u16 m_flags;
132+
/* 0x08 */ u16 m_flags2;
133+
/* 0x0C */ cXyz m_linecheck_start;
134+
/* 0x18 */ cXyz m_linecheck_end;
135+
/* 0x24 */ cXyz m_gndcheck_pos;
136+
/* 0x30 */ s32 m_errorCheck_actor_num;
96137
#endif
97138
};
98139

99-
extern int g_line_counter;
100-
extern OSStopwatch s_line_sw;
140+
class dBgS_InsideHIO : public JORReflexible {
141+
public:
142+
#if DEBUG
143+
enum flags_e {
144+
FLAG_DISP_POLY_e = 0x1,
145+
FLAG_DISP_DP_AREA_e = 0x2,
146+
FLAG_WHITE_WIRE_e = 0x4,
147+
FLAG_PLAYER_AROUND_e = 0x8,
148+
FLAG_DISP_WATER_POLY_e = 0x10,
149+
FLAG_GROUND_OFF_e = 0x20,
150+
FLAG_WALL_OFF_e = 0x40,
151+
FLAG_ROOF_OFF_e = 0x80,
152+
FLAG_GNDCHK_PLAYER_UNDER_e = 0x100,
153+
};
154+
155+
dBgS_InsideHIO() {
156+
m_flags = FLAG_PLAYER_AROUND_e;
157+
158+
m_raise_amount = 1.0f;
101159

102-
extern int g_ground_counter;
103-
extern OSStopwatch s_ground_sw;
160+
m_p0.x = 100.0f;
161+
m_p0.y = 0.0f;
162+
m_p0.z = 0.0f;
163+
164+
m_p1.x = 0.0f;
165+
m_p1.y = 0.0f;
166+
m_p1.z = 0.0f;
167+
}
168+
169+
virtual void genMessage(JORMContext*);
170+
virtual ~dBgS_InsideHIO();
171+
172+
BOOL ChkWallOff() { return m_flags & FLAG_WALL_OFF_e; }
173+
BOOL ChkRoofOff() { return m_flags & FLAG_ROOF_OFF_e; }
174+
BOOL ChkGroundOff() { return m_flags & FLAG_GROUND_OFF_e; }
175+
BOOL ChkGndChkPlayerUnder() { return m_flags & FLAG_GNDCHK_PLAYER_UNDER_e; }
176+
BOOL ChkWhiteWire() { return m_flags & FLAG_WHITE_WIRE_e; }
177+
BOOL ChkDispWaterPoly() { return m_flags & FLAG_DISP_WATER_POLY_e; }
178+
BOOL ChkDispDpArea() { return m_flags & FLAG_DISP_DP_AREA_e; }
179+
BOOL ChkPlayerAround() { return m_flags & FLAG_PLAYER_AROUND_e; }
180+
BOOL ChkDispPoly() { return m_flags & FLAG_DISP_POLY_e; }
181+
182+
/* 0x04 */ s8 id;
183+
/* 0x06 */ u16 m_flags;
184+
/* 0x08 */ f32 m_raise_amount;
185+
/* 0x0C */ cXyz m_p0;
186+
/* 0x18 */ cXyz m_p1;
187+
#endif
188+
};
104189

105190
class dBgS : public cBgS {
106191
public:
@@ -149,53 +234,31 @@ class dBgS : public cBgS {
149234

150235
bool WaterChk(dBgS_SplGrpChk* chk) { return SplGrpChk(chk); }
151236
u32 GetMtrlSndId(const cBgS_PolyInfo& param_0) { return dKy_pol_sound_get(&param_0); }
152-
void DebugDrawPoly(dBgW_Base *param_1) {}
153-
void DebugDrawPoly(dBgW_Base const& param_1) {}
154237
void DrawPoly(cBgS_PolyInfo const& param_0, GXColor const& param_1);
155238
fopAc_ac_c* GetActorPointer(cBgS_PolyInfo const& param_0) const { return cBgS::GetActorPointer(param_0); }
239+
240+
#if DEBUG
241+
void DebugDrawPoly(const dBgW_Base& param_1);
242+
#endif
243+
244+
#if DEBUG
245+
bool LineCross(cBgS_LinChk* i_linChk);
246+
f32 GroundCross(cBgS_GndChk* i_gndChk);
247+
void ShdwDraw(cBgS_ShdwDraw*);
248+
#else
156249
bool LineCross(cBgS_LinChk* i_linChk) {
157-
#if DEBUG
158-
if (m_hio.ChkLineOff()) {
159-
return false;
160-
}
161-
if (m_hio.ChkCheckCounter()) {
162-
g_line_counter++;
163-
}
164-
if (m_hio.ChkLineTimer()) {
165-
OSStartStopwatch(&s_line_sw);
166-
}
167-
bool rt = cBgS::LineCross(i_linChk);
168-
if (m_hio.ChkLineTimer()) {
169-
OSStopStopwatch(&s_line_sw);
170-
OSDumpStopwatch(&s_line_sw);
171-
}
172-
return rt;
173-
#else
174250
return cBgS::LineCross(i_linChk);
175-
#endif
176251
}
252+
177253
f32 GroundCross(cBgS_GndChk* i_gndChk) {
178-
#if DEBUG
179-
if (m_hio.ChkCheckCounter()) {
180-
g_ground_counter++;
181-
}
182-
if (m_hio.ChkGroundCheckTimer()) {
183-
OSStartStopwatch(&s_ground_sw);
184-
}
185-
f32 rt = cBgS::GroundCross(i_gndChk);
186-
if (m_hio.ChkGroundCheckTimer()) {
187-
OSStopStopwatch(&s_ground_sw);
188-
OSDumpStopwatch(&s_ground_sw);
189-
}
190-
return rt;
191-
#else
192254
return cBgS::GroundCross(i_gndChk);
193-
#endif
194255
}
256+
#endif
195257

196258
void ChkDeleteActorRegist(fopAc_ac_c*);
197259

198260
void Draw();
261+
void CaptPoly(dBgS_CaptPoly&);
199262

200263
#if DEBUG
201264
/* 0x1404 */ u8 field_0x1404[0x1408 - 0x1404];

0 commit comments

Comments
 (0)