c_bg_s work

This commit is contained in:
Jasper St. Pierre
2023-11-12 17:15:07 -08:00
parent bf3f3011f1
commit 8b0d90d95c
9 changed files with 67 additions and 20 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ public:
s32 GetTriGrp(int, int) const;
s32 GetGrpToRoomId(int, int) const;
cM3dGPla* GetTriPla(int, int) const;
bool GetTriPnt(cBgS_PolyInfo&, cXyz*, cXyz*, cXyz*) const;
void GetTriPnt(cBgS_PolyInfo&, cXyz*, cXyz*, cXyz*) const;
void ShdwDraw(cBgS_ShdwDraw*);
s32 GetGrpInf(cBgS_PolyInfo&, int) const;
+3 -3
View File
@@ -20,11 +20,11 @@ public:
void SetNowY(f32 y) { mNowY = y; }
cXyz* GetPointP() { return &m_pos; }
u32 GetWallPrecheck() const { return mWallPrecheck; }
void OffWall() { mFlags &= ~2; }
void OffWall() { mFlag &= ~2; }
private:
public:
/* 0x24 */ cXyz m_pos;
/* 0x30 */ u32 mFlags;
/* 0x30 */ u32 mFlag;
/* 0x34 */ f32 mNowY;
/* 0x38 */ u32 mWallPrecheck;
/* 0x3C */ u32 mGndPrecheck;
+5 -5
View File
@@ -10,7 +10,7 @@ class cBgS_LinChk : public cBgS_Chk, public cBgS_PolyInfo {
public:
/* 0x024 */ cM3dGLin mLin;
/* 0x040 */ cXyz field_0x40;
/* 0x04C */ u32 field_0x4c;
/* 0x04C */ u32 mFlag;
/* 0x050 */ bool mPreWallChk;
/* 0x051 */ bool mPreGroundChk;
/* 0x052 */ bool mPreRoofChk;
@@ -26,10 +26,10 @@ public:
virtual ~cBgS_LinChk() {}
void ClrHit() { field_0x4c &= ~0x10; }
void SetHit() { field_0x4c |= 0x10; }
u32 ChkHit() const { return field_0x4c & 0x10; }
void ClrSttsRoofOff() { field_0x4c &= ~0x20000000; }
void ClrHit() { mFlag &= ~0x10; }
void SetHit() { mFlag |= 0x10; }
u32 ChkHit() const { return mFlag & 0x10; }
void ClrSttsRoofOff() { mFlag &= ~0x20000000; }
void SetCross(const cXyz& pos) { mLin.SetEnd(pos); }
cXyz& i_GetCross() { return mLin.GetEnd(); }
cM3dGLin* GetLinP() { return &mLin; }
@@ -2,6 +2,7 @@
#define C_BG_S_POLY_INFO_H
#include "dolphin/types.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "global.h"
class cBgW;
@@ -25,6 +26,12 @@ public:
void SetPolyInfo(const cBgS_PolyInfo& other) {
*this = other;
}
void SetActorInfo(int bg_index, void* bgw, unsigned int actor_id) {
JUT_ASSERT(0x59, 0 <= bg_index);
mBgIndex = bg_index;
mpBgW = (cBgW*)bgw;
mActorId = actor_id;
}
bool ChkSafe(const void* bgw, unsigned int pid) {
if (mpBgW == bgw && mActorId == pid)
return true;
+2 -2
View File
@@ -139,12 +139,12 @@ public:
bool Set(cBgD_t*, u32, f32(*)[3][4]);
void RwgLineCheck(u16, cBgS_LinChk*);
void LineCheckRp(cBgS_LinChk*, int);
void LineCheckGrpRp(cBgS_LinChk*, int, int);
bool LineCheckGrpRp(cBgS_LinChk*, int, int);
bool RwgGroundCheckCommon(f32, u16, cBgS_GndChk*);
bool RwgGroundCheckGnd(u16, cBgS_GndChk*);
bool RwgGroundCheckWall(u16, cBgS_GndChk*);
void GroundCrossRp(cBgS_GndChk*, int);
void GroundCrossGrpRp(cBgS_GndChk*, int, int);
bool GroundCrossGrpRp(cBgS_GndChk*, int, int);
void CopyOldMtx();
void Move();
void RwgShdwDraw(int, cBgS_ShdwDraw*);
+45 -5
View File
@@ -4,6 +4,8 @@
//
#include "SSystem/SComponent/c_bg_s.h"
#include "SSystem/SComponent/c_bg_s_gnd_chk.h"
#include "SSystem/SComponent/c_bg_s_lin_chk.h"
#include "SSystem/SComponent/c_bg_w.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "dolphin/types.h"
@@ -69,6 +71,10 @@ bool cBgS::Regist(cBgW* bgw, unsigned int pid, void* actor) {
return true;
}
static void dummy() {
OSReport("c_bg_s_poly_info.h");
}
/* 80246600-8024669C .text Release__4cBgSFP4cBgW */
int cBgS::Release(cBgW* bgw) {
if (bgw == NULL)
@@ -103,13 +109,42 @@ void cBgS::Dt() {
}
/* 8024676C-802468E4 .text LineCross__4cBgSFP11cBgS_LinChk */
bool cBgS::LineCross(cBgS_LinChk*) {
/* Nonmatching */
bool cBgS::LineCross(cBgS_LinChk* chk) {
bool ret = false;
chk->ClearPi();
chk->ClrHit();
for (s32 bg_index = 0; bg_index < (s32)ARRAY_SIZE(m_chk_element); bg_index++) {
cBgS_ChkElm* elm = &m_chk_element[bg_index];
if (elm->ChkUsed() && elm->m_bgw_base_ptr->pm_vtx_tbl != NULL && !chk->ChkSameActorPid(elm->m_actor_id)) {
chk->mPreWallChk = !(chk->mFlag & 0x40000000);
chk->mPreGroundChk = !(chk->mFlag & 0x80000000);
chk->mPreRoofChk = !(chk->mFlag & 0x20000000);
if (elm->m_bgw_base_ptr->LineCheckGrpRp(chk, elm->m_bgw_base_ptr->m_rootGrpIdx, 1)) {
chk->SetActorInfo(bg_index, elm->m_bgw_base_ptr, elm->m_actor_id);
ret = true;
}
}
}
if (ret)
chk->SetHit();
return ret;
}
/* 802468E4-80246A14 .text GroundCross__4cBgSFP11cBgS_GndChk */
f32 cBgS::GroundCross(cBgS_GndChk*) {
/* Nonmatching */
f32 cBgS::GroundCross(cBgS_GndChk* chk) {
chk->SetNowY(-1e+09);
chk->ClearPi();
chk->mWallPrecheck = (chk->mFlag & 0x02);
chk->mGndPrecheck = (chk->mFlag & 0x01);
for (s32 bg_index = 0; bg_index < (s32)ARRAY_SIZE(m_chk_element); bg_index++) {
cBgS_ChkElm* elm = &m_chk_element[bg_index];
if (elm->ChkUsed() && elm->m_bgw_base_ptr->pm_vtx_tbl != NULL && !chk->ChkSameActorPid(elm->m_actor_id)) {
if (elm->m_bgw_base_ptr->GroundCrossGrpRp(chk, elm->m_bgw_base_ptr->m_rootGrpIdx, 1)) {
chk->SetActorInfo(bg_index, elm->m_bgw_base_ptr, elm->m_actor_id);
}
}
}
return chk->GetNowY();
}
/* 80246A14-80246C98 .text ConvDzb__4cBgSFPv */
@@ -203,8 +238,13 @@ cM3dGPla* cBgS::GetTriPla(int bg_index, int poly_index) const {
return m_chk_element[bg_index].m_bgw_base_ptr->GetTriPla(poly_index);
}
static void dummy2() {
// from c_bg_s_poly_info.h
OSReport("0 <= grp_index && grp_index < pm_bgd->m_g_num");
}
/* 802470B8-80247178 .text GetTriPnt__4cBgSCFR13cBgS_PolyInfoP4cXyzP4cXyzP4cXyz */
bool cBgS::GetTriPnt(cBgS_PolyInfo& poly, cXyz* p0, cXyz* p1, cXyz* p2) const {
void cBgS::GetTriPnt(cBgS_PolyInfo& poly, cXyz* p0, cXyz* p1, cXyz* p2) const {
s32 id = poly.GetBgIndex();
JUT_ASSERT(0x2f6, 0 <= id && id < 256);
if (m_chk_element[id].ChkUsed())
+1 -1
View File
@@ -10,5 +10,5 @@
cBgS_GndChk::cBgS_GndChk() {
m_pos = cXyz::Zero;
SetActorPid(0xFFFFFFFF);
mFlags = 3;
mFlag = 3;
}
+1 -1
View File
@@ -13,7 +13,7 @@ void cBgS_LinChk::ct() {
mLin.mEnd = zero;
field_0x40 = zero;
SetActorPid(-1);
field_0x4c = 0;
mFlag = 0;
mFrontFlag = 1;
mBackFlag = 0;
}
+2 -2
View File
@@ -161,7 +161,7 @@ void cBgW::LineCheckRp(cBgS_LinChk*, int) {
}
/* 80248868-8024898C .text LineCheckGrpRp__4cBgWFP11cBgS_LinChkii */
void cBgW::LineCheckGrpRp(cBgS_LinChk*, int, int) {
bool cBgW::LineCheckGrpRp(cBgS_LinChk*, int, int) {
/* Nonmatching */
}
@@ -198,7 +198,7 @@ void cBgW::GroundCrossRp(cBgS_GndChk*, int) {
}
/* 802491F4-80249368 .text GroundCrossGrpRp__4cBgWFP11cBgS_GndChkii */
void cBgW::GroundCrossGrpRp(cBgS_GndChk*, int, int) {
bool cBgW::GroundCrossGrpRp(cBgS_GndChk*, int, int) {
/* Nonmatching */
}