d_bg_s_acch almost

This commit is contained in:
LagoLunatic
2024-01-05 02:32:41 -05:00
parent 2b4cda8b5e
commit a19a4d3378
3 changed files with 19 additions and 15 deletions
+12 -8
View File
@@ -24,13 +24,20 @@ public:
cXyz* GetNP() { return &mNormal; }
const cXyz* GetNP() const { return &mNormal; }
f32 GetD() const { return mD; }
float getCrossY(const cXyz& i_axis) const { // fake inline
void getCrossY(const cXyz& i_axis, f32* i_value) const {
if (!cM3d_IsZero(mNormal.y)) {
*i_value = (-mNormal.x * i_axis.x - mNormal.z * i_axis.z - mD) / mNormal.y;
}
}
f32 getCrossY_NonIsZero(const cXyz& i_axis) const {
return (-mNormal.x * i_axis.x - mNormal.z * i_axis.z - mD) / mNormal.y;
}
void getCrossY(const cXyz& i_axis, float* i_value) const {
if (!cM3d_IsZero(mNormal.y)) {
*i_value = getCrossY(i_axis);
bool getCrossYLessD(const Vec& i_axis, f32* i_value) const {
if (cM3d_IsZero(mNormal.y)) {
return false;
}
*i_value = (-mNormal.x * i_axis.x - mNormal.z * i_axis.z) / mNormal.y;
return true;
}
f32 getSignedLenPos(const cXyz* param_1) const {
return cM3d_SignedLenPlaAndPos(this, param_1);
@@ -41,11 +48,8 @@ public:
// TODO
void Set(const cM3dGPla*) {}
void SetupFrom3Vtx(const Vec*, const Vec*, const Vec*) {}
cM3dGPla(const cXyz*, float) {}
cM3dGPla(const cXyz*, f32) {}
void cross(const cM3dGLin&, Vec&) const {}
void getCrossYLessD(const Vec&, float*) const {}
void getCrossY_NonIsZero(const cXyz&) const {}
void operator=(const cM3dGPla&) {}
}; // Size: 0x14
#endif
+1 -1
View File
@@ -177,7 +177,7 @@ bool cBgW::RwgGroundCheckGnd(u16 idx, cBgS_GndChk* chk) {
while (true) {
cBgW_RwgElm * rwg = &pm_rwg[idx];
cBgW_TriElm * tri = &pm_tri[idx];
f32 y = tri->m_plane.getCrossY(*chk->GetPointP());
f32 y = tri->m_plane.getCrossY_NonIsZero(*chk->GetPointP());
if (RwgGroundCheckCommon(y, (u16)idx, chk))
ret = true;
idx = rwg->next;
+6 -6
View File
@@ -116,7 +116,6 @@ void dBgS_Acch::GroundCheckInit(dBgS&) {
/* 800A2EE8-800A305C .text GroundCheck__9dBgS_AcchFR4dBgS */
void dBgS_Acch::GroundCheck(dBgS& i_bgs) {
/* Nonmatching */
if (m_flags & GRND_NONE)
return;
@@ -446,11 +445,12 @@ bool dBgS_Acch::GetOnePolyInfo(cBgS_PolyInfo* dst) {
/* 800A42B4-800A4348 .text GetWallAddY__9dBgS_AcchFR3Veci */
f32 dBgS_Acch::GetWallAddY(Vec& vec, int) {
/* Nonmatching */
if (ChkGroundFind() && m_pla.GetNP()->y < 0.5f) {
f32 cross_y;
m_pla.getCrossY(vec, &cross_y);
if (cross_y < 0.0f)
if (!ChkGroundFind() || m_pla.mNormal.y < 0.5f) {
return 0.0f;
}
f32 cross_y;
if (m_pla.getCrossYLessD(vec, &cross_y)) {
if (cross_y > 0.0f)
cross_y = 0.0f;
return -cross_y;
} else {