d_bg_s almost done

This commit is contained in:
LagoLunatic
2023-12-16 00:48:26 -05:00
parent 0b64eb7d7e
commit af28c5dfa1
6 changed files with 107 additions and 29 deletions
+12 -1
View File
@@ -42,7 +42,7 @@ public:
virtual ~cBgS_PolyInfo() {}
s32 GetPolyIndex() const { return mPolyIndex; }
s32 GetBgIndex() const { return mBgIndex; }
u16 GetBgIndex() const { return mBgIndex; }
bool ChkSetInfo() const {
if (mPolyIndex == 0xFFFF || mBgIndex == 0x100) {
return false;
@@ -50,6 +50,17 @@ public:
return true;
}
bool ChkBgIndex() const {
if (mBgIndex == 0x100) {
return false;
}
return true;
}
// TODO
void ChkSafe(const void*, unsigned int) const {}
void ChkSetInf() const {}
void SetPolyIndex(int) {}
}; // Size: 0x10
STATIC_ASSERT(sizeof(cBgS_PolyInfo) == 0x10);
+1 -1
View File
@@ -189,7 +189,7 @@ public:
void ChkLock() {}
bool ChkMoveBg() { return mFlags & MOVE_BG_e; }
void ChkNoCalcVtx() {}
bool ChkPriority(int prio) { return mWallCorrectPriority == prio; }
BOOL ChkPriority(int prio) { return mWallCorrectPriority == prio; }
void ChkRoofRegist() {}
void ChkThrough() {}
void ChkWallRegist() {}
+19 -5
View File
@@ -2,6 +2,7 @@
#define C_M3D_G_CYL_H
#include "SSystem/SComponent/c_xyz.h"
#include "SSystem/SComponent/c_m3d_g_cps.h"
#include "global.h"
// Cylinder
@@ -18,26 +19,39 @@ public:
/* 0x00 */ cXyz mCenter;
/* 0x0C */ f32 mRadius;
/* 0x10 */ f32 mHeight;
/* 0x14 vtable */
/* 0x14 */ /* vtable */
public:
cM3dGCyl() {}
cM3dGCyl(const cXyz*, f32, f32);
virtual ~cM3dGCyl() {}
void SetC(const cXyz& pos);
void SetH(f32 h);
void SetR(f32 r);
inline void Set(const cM3dGCylS & src) {
void Set(const cM3dGCylS & src) {
SetC(src.mCenter);
SetR(src.mRadius);
SetH(src.mHeight);
}
void Set(const cXyz& center, f32 radius, f32 height) {
SetC(center);
SetR(radius);
SetH(height);
}
bool cross(const cM3dGSph*, cXyz*) const;
bool cross(const cM3dGCyl*, cXyz*) const;
bool cross(const cM3dGSph*, f32*) const;
bool cross(const cM3dGCyl*, f32*) const;
const cXyz* GetCP(void) const { return &mCenter; }
f32 GetR(void) const { return mRadius; }
f32 GetH(void) const { return mHeight; }
const cXyz* GetCP() const { return &mCenter; }
f32 GetR() const { return mRadius; }
f32 GetH() const { return mHeight; }
cXyz& GetC() { return mCenter; }
void Cross(const cM3dGCps*, cXyz*) const {}
void Cross(const cM3dGTri&, cXyz*) const {}
void GetC() const {}
void GetCP() {}
void GetRP() {}
}; // Size = 0x18
STATIC_ASSERT(0x18 == sizeof(cM3dGCyl));
+35 -1
View File
@@ -101,7 +101,7 @@ public:
f32 RoofChk(dBgS_RoofChk*);
bool SplGrpChk(dBgS_SplGrpChk*);
bool SphChk(dBgS_SphChk*, void*);
void WallCrrPos(dBgS_CrrPos*);
bool WallCrrPos(dBgS_CrrPos*);
void MoveBgCrrPos(cBgS_PolyInfo&, bool, cXyz*, csXyz*, csXyz*);
void MoveBgTransPos(cBgS_PolyInfo&, bool, cXyz*, csXyz*, csXyz*);
void MoveBgMatrixCrrPos(cBgS_PolyInfo&, bool, cXyz*, csXyz*, csXyz*);
@@ -134,6 +134,40 @@ public:
field_0x38 &= ~8;
}
void ChkXCrr() {}
void ChkZCrr() {}
void ClrPosVec() {
field_0x4c.x = field_0x4c.y = field_0x4c.z = 0.0f;
}
void ClrWallHit() {}
void ClrXCrr() {}
void ClrZCrr() {}
void GetCylP() const {}
void GetGroundH() const {}
void GetOldPos() const {}
cXyz* GetPos() const { return pm_pos; }
cXyz& GetPosVec() { return field_0x4c; }
void GetWallH() const {}
void GetWallR() const {}
void Set(cXyz*, cXyz*, unsigned int, cXyz*) {}
void SetCyl() {
mCyl1.Set(*pm_pos, field_0x40, field_0x3c * 2.0f);
}
void SetLin() {
mLin.SetStartEnd(*mpLine0, *pm_pos);
}
void SetOldCyl() {
mCyl0.Set(*mpLine0, field_0x40, field_0x3c * 2.0f);
}
void SetWall(f32, f32) {}
void SetWallActorInfo(int bg_index, void* bgw, unsigned int actor_id) {
SetActorInfo(bg_index, bgw, actor_id);
}
void SetWallHit() {}
void SetWallPolyIndex(int) {}
void SetXCrr() {}
void SetZCrr() {}
/* 0x038 */ u32 field_0x38;
/* 0x03C */ f32 field_0x3c;
/* 0x040 */ f32 field_0x40;
+1 -1
View File
@@ -47,7 +47,7 @@ public:
void RwgWallCrrPos(u16, dBgS_CrrPos*);
void WallCrrPosRp(dBgS_CrrPos*, int);
void WallCrrPosGrpRp(dBgS_CrrPos*, int, int);
void WallCrrPos(dBgS_CrrPos*);
bool WallCrrPos(dBgS_CrrPos*);
void ChangeAttributeCodeByPathPntNo(int, u32);
virtual ~dBgW() {}
+39 -20
View File
@@ -272,7 +272,6 @@ int dBgS::GetRoomPathPntNo(cBgS_PolyInfo& polyInfo) {
/* 800A0E68-800A0F88 .text GetRoomId__4dBgSFR13cBgS_PolyInfo */
s32 dBgS::GetRoomId(cBgS_PolyInfo& polyInfo) {
/* Nonmatching */
if (!polyInfo.ChkSetInfo())
return -1;
@@ -283,7 +282,7 @@ s32 dBgS::GetRoomId(cBgS_PolyInfo& polyInfo) {
return -1;
dBgW* bgwp = (dBgW*)m_chk_element[id].m_bgw_base_ptr;
u16 roomNo = bgwp->mRoomNo;
s32 roomNo = bgwp->mRoomNo;
if (roomNo == 0xFFFF) {
s32 grp = GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex());
roomNo = GetGrpToRoomId(polyInfo.GetBgIndex(), grp);
@@ -295,7 +294,6 @@ s32 dBgS::GetRoomId(cBgS_PolyInfo& polyInfo) {
/* 800A0F88-800A111C .text ChkPolyHSStick__4dBgSFR13cBgS_PolyInfo */
BOOL dBgS::ChkPolyHSStick(cBgS_PolyInfo& polyInfo) {
/* Nonmatching */
s32 bg_index = polyInfo.GetBgIndex();
JUT_ASSERT(0x583, 0 <= bg_index && bg_index < 256);
if (!m_chk_element[bg_index].ChkUsed())
@@ -328,15 +326,15 @@ bool dBgS::LineCrossNonMoveBG(cBgS_LinChk* chk) {
/* 800A12A4-800A13E0 .text WallCorrect__4dBgSFP9dBgS_Acch */
void dBgS::WallCorrect(dBgS_Acch* acch) {
/* Nonmatching */
acch->CalcWallRR();
acch->SetWallCir();
acch->SetLin();
acch->CalcWallBmdCyl();
cBgS_ChkElm* elm;
for (s32 prio = 0; prio < 3; prio++) {
for (s32 bg_index = 0; bg_index < (s32)ARRAY_SIZE(m_chk_element); bg_index++) {
cBgS_ChkElm* elm = &m_chk_element[bg_index];
elm = &m_chk_element[bg_index];
if (elm->ChkUsed() && elm->m_bgw_base_ptr->pm_vtx_tbl != NULL) {
acch->SetNowActorInfo(bg_index, elm->m_bgw_base_ptr, elm->m_actor_id);
if (!acch->ChkSameActorPid(elm->m_actor_id)) {
@@ -351,11 +349,11 @@ void dBgS::WallCorrect(dBgS_Acch* acch) {
/* 800A13E0-800A14FC .text RoofChk__4dBgSFP12dBgS_RoofChk */
f32 dBgS::RoofChk(dBgS_RoofChk* chk) {
/* Nonmatching */
chk->SetNowY(1e+09);
chk->ClearPi();
cBgS_ChkElm* elm;
for (s32 bg_index = 0; bg_index < (s32)ARRAY_SIZE(m_chk_element); bg_index++) {
cBgS_ChkElm* elm = &m_chk_element[bg_index];
elm = &m_chk_element[bg_index];
if (elm->ChkUsed() && elm->m_bgw_base_ptr->pm_vtx_tbl != NULL && !chk->ChkSameActorPid(elm->m_actor_id)) {
dBgW* bgwp = (dBgW*)elm->m_bgw_base_ptr;
if (bgwp->RoofChkGrpRp(chk, elm->m_bgw_base_ptr->m_rootGrpIdx, 1)) {
@@ -386,11 +384,11 @@ bool dBgS::SplGrpChk(dBgS_SplGrpChk* chk) {
/* 800A160C-800A1730 .text SphChk__4dBgSFP11dBgS_SphChkPv */
bool dBgS::SphChk(dBgS_SphChk* chk, void* user) {
/* Nonmatching */
cBgS_ChkElm* elm;
bool ret = false;
chk->Init();
for (s32 bg_index = 0; bg_index < (s32)ARRAY_SIZE(m_chk_element); bg_index++) {
cBgS_ChkElm* elm = &m_chk_element[bg_index];
elm = &m_chk_element[bg_index];
if (elm->ChkUsed() && elm->m_bgw_base_ptr->pm_vtx_tbl != NULL && !chk->ChkSameActorPid(elm->m_actor_id)) {
dBgW* bgwp = (dBgW*)elm->m_bgw_base_ptr;
if (bgwp->SphChkGrpRp(chk, user, elm->m_bgw_base_ptr->m_rootGrpIdx, 1)) {
@@ -403,14 +401,38 @@ bool dBgS::SphChk(dBgS_SphChk* chk, void* user) {
}
/* 800A1730-800A1954 .text WallCrrPos__4dBgSFP11dBgS_CrrPos */
void dBgS::WallCrrPos(dBgS_CrrPos* crr) {
/* Nonmatching */
bool dBgS::WallCrrPos(dBgS_CrrPos* crr) {
crr->SetOldCyl();
crr->SetCyl();
crr->SetLin();
crr->ClrPosVec();
cBgS_ChkElm* elm;
bool ret = false;
for (s32 prio = 0; prio < 3; prio++) {
for (s32 bg_index = 0; bg_index < (s32)ARRAY_SIZE(m_chk_element); bg_index++) {
elm = &m_chk_element[bg_index];
if (elm->ChkUsed() && elm->m_bgw_base_ptr->pm_vtx_tbl != NULL) {
if (crr->ChkSameActorPid(elm->m_actor_id))
continue;
dBgW* bgwp = (dBgW*)elm->m_bgw_base_ptr;
BOOL isPrio = bgwp->ChkPriority(prio);
if (isPrio && bgwp->WallCrrPos(crr)) {
crr->SetWallActorInfo(bg_index, elm->m_bgw_base_ptr, elm->m_actor_id);
crr->GetPos()->x += crr->GetPosVec().x;
crr->GetPos()->y += crr->GetPosVec().y;
crr->GetPos()->z += crr->GetPosVec().z;
ret = true;
}
}
}
}
return ret;
}
/* 800A1954-800A1A74 .text MoveBgCrrPos__4dBgSFR13cBgS_PolyInfobP4cXyzP5csXyzP5csXyz */
void dBgS::MoveBgCrrPos(cBgS_PolyInfo& polyInfo, bool accept, cXyz* pos, csXyz* angle1, csXyz* angle2) {
/* Nonmatching */
if (!accept)
if (!accept || !polyInfo.ChkBgIndex())
return;
s32 bg_index = polyInfo.GetBgIndex();
@@ -426,8 +448,7 @@ void dBgS::MoveBgCrrPos(cBgS_PolyInfo& polyInfo, bool accept, cXyz* pos, csXyz*
/* 800A1A74-800A1B94 .text MoveBgTransPos__4dBgSFR13cBgS_PolyInfobP4cXyzP5csXyzP5csXyz */
void dBgS::MoveBgTransPos(cBgS_PolyInfo& polyInfo, bool accept, cXyz* pos, csXyz* angle1, csXyz* angle2) {
/* Nonmatching */
if (!accept)
if (!accept || !polyInfo.ChkBgIndex())
return;
s32 bg_index = polyInfo.GetBgIndex();
@@ -443,8 +464,7 @@ void dBgS::MoveBgTransPos(cBgS_PolyInfo& polyInfo, bool accept, cXyz* pos, csXyz
/* 800A1B94-800A1C98 .text MoveBgMatrixCrrPos__4dBgSFR13cBgS_PolyInfobP4cXyzP5csXyzP5csXyz */
void dBgS::MoveBgMatrixCrrPos(cBgS_PolyInfo& polyInfo, bool accept, cXyz* pos, csXyz* angle1, csXyz* angle2) {
/* Nonmatching */
if (!accept)
if (!accept || !polyInfo.ChkBgIndex())
return;
s32 bg_index = polyInfo.GetBgIndex();
@@ -525,7 +545,6 @@ void dBgS_CrrPos::CrrPos(dBgS&) {
}
/* 800A2550-800A257C .text MatrixCrrPos__4dBgWFR13cBgS_PolyInfoPvbP4cXyzP5csXyzP5csXyz */
void dBgW::MatrixCrrPos(cBgS_PolyInfo&, void*, bool, cXyz*, csXyz*, csXyz*) {
/* Nonmatching */
void dBgW::MatrixCrrPos(cBgS_PolyInfo& polyInfo, void* param_2, bool param_3, cXyz* param_4, csXyz* param_5, csXyz* param_6) {
CrrPos(polyInfo, param_2, param_3, param_4, param_5, param_6);
}