Add some dBgW debug funcs from TP

This commit is contained in:
LagoLunatic
2026-09-28 23:01:30 -04:00
parent 1f9e8cb259
commit 09de0609ec
8 changed files with 146 additions and 26 deletions
+1
View File
@@ -34,6 +34,7 @@ public:
STATIC_ASSERT(sizeof(cBgS_ChkElm) == 0x14);
class cBgW;
class cBgS {
public:
/* 0x0000 */ cBgS_ChkElm m_chk_element[256];
+15 -7
View File
@@ -69,17 +69,20 @@ public:
fopAc_ac_c* GetActorPointer(cBgS_PolyInfo& i_poly) const {
return cBgS::GetActorPointer(i_poly);
}
// void CaptPoly(dBgS_CaptPoly&) {}
// void ChkDeleteActorRegist(fopAc_ac_c*) {}
// void DebugDrawPoly(dBgW&) {}
// void Draw() {}
// void DrawPoly(cBgS_PolyInfo&, GXColor&) {}
dBgW* GetBgWPointer(cBgS_PolyInfo& i_poly) { return (dBgW*)cBgS::GetBgWPointer(i_poly); }
// void GetPolyCamId(cBgS_PolyInfo&) {}
int GetPolyCamId(cBgS_PolyInfo& i_poly) { return GetPolyCamId(i_poly.GetBgIndex(), i_poly.GetPolyIndex()); }
#if DEBUG
// TODO
void DebugDrawPoly(dBgW&);
void DrawPoly(cBgS_PolyInfo&, GXColor&);
void Draw() {}
void CaptPoly(dBgS_CaptPoly&) {}
// void GroundCross(cBgS_GndChk*) {}
// void LineCross(cBgS_LinChk*) {}
// void ShdwDraw(cBgS_ShdwDraw*) {}
void ChkDeleteActorRegist(fopAc_ac_c*) {}
#endif
virtual void Ct();
virtual void Dt();
@@ -122,6 +125,11 @@ public:
void MoveBgMatrixCrrPos(cBgS_PolyInfo&, bool, cXyz*, csXyz*, csXyz*);
void RideCallBack(cBgS_PolyInfo&, fopAc_ac_c*);
fopAc_ac_c* PushPullCallBack(cBgS_PolyInfo&, fopAc_ac_c*, short, dBgW::PushPullLabel);
#if DEBUG
/* 0x1404 */ u8 field_0x1404[0x1408 - 0x1404];
// /* 0x1408 */ dBgS_HIO m_hio;
#endif
}; // Size: 0x1404
class dBgS_CrrPos : public cBgS_PolyInfo, public dBgS_Chk, public cBgS_Chk {
+6 -4
View File
@@ -110,14 +110,16 @@ public:
u32 GetPolyRopeThrough(int poly_index) { return GetMaskPolyInfo3_NoShift(poly_index, 0x80); }
u32 GetPolyHSStick(int poly_index) { return GetMaskPolyInfo3_NoShift(poly_index, 0x10); }
// Debug-only funcs
void DebugDraw() {}
void DrawBox() {}
void DrawPoly(cBgS_PolyInfo&, GXColor&) {}
#if DEBUG
void DrawBox();
void DebugDraw();
void DrawPoly(cBgS_PolyInfo&, GXColor&);
// TODO
void CaptPoly(dBgS_CaptPoly&) {}
void CaptPolyGrpRp(dBgS_CaptPoly&, int) {}
void CaptPolyRp(dBgS_CaptPoly&, int) {}
void RwgCaptPoly(int, dBgS_CaptPoly&) {}
#endif
/* 0xA8 */ dBgW_CrrFunc m_crr_func;
/* 0xAC */ s16 mOldRotY;
+5 -5
View File
@@ -18,7 +18,7 @@ public:
dMeter_HIO_c();
virtual ~dMeter_HIO_c();
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
/* 0x004 */ s8 mNo;
/* 0x005 */ u8 field_0x5[0x006 - 0x005];
@@ -185,7 +185,7 @@ public:
dMeter_menuHIO_c();
virtual ~dMeter_menuHIO_c();
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
/* 0x04 */ s8 mNo;
/* 0x05 */ u8 field_0x5[0x08 - 0x05];
@@ -288,7 +288,7 @@ public:
dMeter_msg_HIO_c();
virtual ~dMeter_msg_HIO_c();
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
/* 0x04 */ s8 mNo;
/* 0x05 */ GXColor field_0x5;
@@ -383,7 +383,7 @@ public:
dMeter_message_HIO_c();
virtual ~dMeter_message_HIO_c();
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
/* 0x04 */ s8 mNo;
/* 0x05 */ GXColor field_0x5;
@@ -475,7 +475,7 @@ public:
dMeter_map_HIO_c();
virtual ~dMeter_map_HIO_c();
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
/* 0x04 */ s8 mNo;
/* 0x05 */ u8 field_0x5;
+1 -1
View File
@@ -13,7 +13,7 @@ public:
dMn_HIO_c();
virtual ~dMn_HIO_c() {}
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
public:
/* 0x04 */ f32 mEchoScale;
+7 -7
View File
@@ -35,7 +35,7 @@ public:
dScnPly_dark_HIO_c();
virtual ~dScnPly_dark_HIO_c() {}
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
public:
/* 0x04 */ s8 mNo;
@@ -50,7 +50,7 @@ public:
dScnPly_reg_childHIO_c();
virtual ~dScnPly_reg_childHIO_c() {}
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
public:
/* 0x04 */ f32 mFloatRegs[30];
@@ -62,7 +62,7 @@ public:
dScnPly_env_otherHIO_c();
virtual ~dScnPly_env_otherHIO_c() {}
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
public:
/* 0x04 */ s8 mNo;
@@ -95,7 +95,7 @@ public:
dScnPly_env_debugHIO_c();
virtual ~dScnPly_env_debugHIO_c() {}
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
public:
/* 0x04 */ s8 mNo;
@@ -122,7 +122,7 @@ public:
virtual ~dScnPly_msg_HIO_c() {}
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
public:
/* 0x04 */ s8 mNo;
@@ -140,14 +140,14 @@ class dScnPly_preLoad_HIO_c : public mDoHIO_entry_c {
public:
virtual ~dScnPly_preLoad_HIO_c() {}
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
};
class dScnPly_env_HIO_c : public JORReflexible {
public:
virtual ~dScnPly_env_HIO_c() {}
void genMessage(JORMContext* ctx);
void genMessage(JORMContext* ctx) { UNUSED(ctx); }
public:
/* 0x04 */ s8 mNo;
+109
View File
@@ -10,6 +10,115 @@
#include "SSystem/SComponent/c_m2d.h"
#include "SSystem/SComponent/c_math.h"
#if DEBUG
#include "d/d_debug_viewer.h"
#endif
#if DEBUG
// Copied from TP debug build decomp.
void dBgW::DrawBox() {
cXyz min;
cXyz max;
cXyz points[8];
min = *pm_grp[m_rootGrpIdx].aab.GetMinP();
max = *pm_grp[m_rootGrpIdx].aab.GetMaxP();
points[0].x = min.x;
points[0].y = max.y;
points[0].z = min.z;
points[1].x = max.x;
points[1].y = max.y;
points[1].z = min.z;
points[2].x = min.x;
points[2].y = max.y;
points[2].z = max.z;
points[3].x = max.x;
points[3].y = max.y;
points[3].z = max.z;
points[4].x = min.x;
points[4].y = min.y;
points[4].z = min.z;
points[5].x = max.x;
points[5].y = min.y;
points[5].z = min.z;
points[6].x = min.x;
points[6].y = min.y;
points[6].z = max.z;
points[7].x = max.x;
points[7].y = min.y;
points[7].z = max.z;
dDbVw_drawCube8pXlu(points, (GXColor){0x00, 0xFF, 0x00, 0x64});
}
void dBgW::DebugDraw() {
GXColor ground_color = {0xFF, 0x00, 0x00, 0x80};
GXColor roof_color = {0x00, 0x00, 0xFF, 0x80};
GXColor wall_color = {0x00, 0xFF, 0x00, 0x80};
cBgD_Tri_t* t_tbl = pm_bgd->m_t_tbl;
for (int i = 0; i < pm_bgd->m_t_num; i++) {
cXyz normal;
normal = pm_tri[i].m_plane.mNormal;
cBgD_Vtx_t* v0 = &pm_vtx_tbl[t_tbl[i].vtx0];
cBgD_Vtx_t* v1 = &pm_vtx_tbl[t_tbl[i].vtx1];
cBgD_Vtx_t* v2 = &pm_vtx_tbl[t_tbl[i].vtx2];
cXyz points[3];
points[0].set(*v0);
points[1].set(*v1);
points[2].set(*v2);
points[0] += normal;
points[1] += normal;
points[2] += normal;
GXColor* pcolor;
if (cBgW_CheckBGround(normal.y)) {
pcolor = &ground_color;
} else if (cBgW_CheckBRoof(normal.y)) {
pcolor = &roof_color;
} else {
pcolor = &wall_color;
}
dDbVw_drawTriangleXlu(points, *pcolor, TRUE);
}
}
void dBgW::DrawPoly(cBgS_PolyInfo& polyinfo, GXColor& color) {
int poly_index = polyinfo.GetPolyIndex();
JUT_ASSERT(2579, 0 <= poly_index && poly_index < pm_bgd->m_t_num);
cXyz normal;
normal = pm_tri[poly_index].m_plane.mNormal;
cBgD_Tri_t* t_tbl = pm_bgd->m_t_tbl;
cBgD_Vtx_t* v0 = &pm_vtx_tbl[t_tbl[poly_index].vtx0];
cBgD_Vtx_t* v1 = &pm_vtx_tbl[t_tbl[poly_index].vtx1];
cBgD_Vtx_t* v2 = &pm_vtx_tbl[t_tbl[poly_index].vtx2];
cXyz points[3];
points[0].set(*v0);
points[1].set(*v1);
points[2].set(*v2);
points[0] += normal;
points[1] += normal;
points[2] += normal;
dDbVw_drawTriangleXlu(points, color, TRUE);
}
#endif
/* 800A5C3C-800A5CA8 .text __ct__4dBgWFv */
dBgW::dBgW() {
+2 -2
View File
@@ -2543,7 +2543,7 @@ void dCamera_c::checkGroundInfo() {
mRoomNo = -1;
if (mBG.m00.m00 && check_owner_action(mPadId, daPyStts0_SWIM_e)) {
mRoomMapToolCameraIdx = dComIfG_Bgsp()->GetPolyCamId(mBG.m00.m04.GetBgIndex(), mBG.m00.m04.GetPolyIndex());
mRoomMapToolCameraIdx = dComIfG_Bgsp()->GetPolyCamId(mBG.m00.m04);
}
else if (m360 == 0) {
mRoomMapToolCameraIdx = 0x1ff;
@@ -2551,7 +2551,7 @@ void dCamera_c::checkGroundInfo() {
else if (mBG.m5C.m00) {
mRoomMapToolCameraIdx = dComIfG_Bgsp()->GetRoomCamId(mBG.m5C.m04);
if (mRoomMapToolCameraIdx == 0xff) {
mRoomMapToolCameraIdx = dComIfG_Bgsp()->GetPolyCamId(mBG.m5C.m04.GetBgIndex(), mBG.m5C.m04.GetPolyIndex());
mRoomMapToolCameraIdx = dComIfG_Bgsp()->GetPolyCamId(mBG.m5C.m04);
}
else {
mRoomNo = dComIfG_Bgsp()->GetRoomId(mBG.m5C.m04);;