d_bg_s OK

This commit is contained in:
LagoLunatic
2023-12-16 20:41:57 -05:00
parent af28c5dfa1
commit 725113992d
8 changed files with 178 additions and 85 deletions
+1 -1
View File
@@ -381,7 +381,7 @@ config.libs = [
Object(NonMatching, "d/d_vib_pattern.cpp"),
Object(NonMatching, "d/d_attention.cpp"),
Object(NonMatching, "d/d_att_dist.cpp"),
Object(NonMatching, "d/d_bg_s.cpp"),
Object(Matching, "d/d_bg_s.cpp"),
Object(NonMatching, "d/d_bg_s_acch.cpp"),
Object(NonMatching, "d/d_bg_s_func.cpp"),
Object(Matching, "d/d_bg_s_lin_chk.cpp"),
+25 -12
View File
@@ -20,30 +20,43 @@ public:
public:
cBgS_LinChk() { ct(); }
void ct();
void Set2(cXyz*, cXyz*, unsigned int);
void GetCross();
void Set2(cXyz* pStart, cXyz* pEnd, unsigned int actorPid);
virtual ~cBgS_LinChk() {}
void ClrHit() { mFlag &= ~0x10; }
void SetHit() { mFlag |= 0x10; }
u32 ChkHit() const { return mFlag & 0x10; }
void ClrHit() { mFlag &= ~0x10; }
bool ChkHit() { return mFlag & 0x10; }
void SetSttsWallOff() { mFlag |= 0x40000000; }
void ClrSttsWallOff() { mFlag &= ~0x40000000; }
bool ChkSttsWallOff() { return mFlag & 0x40000000; }
void SetSttsGroundOff() { mFlag |= 0x80000000; }
void ClrSttsGroundOff() { mFlag &= ~0x80000000; }
bool ChkSttsGroundOff() { return mFlag & 0x80000000; }
void SetSttsRoofOff() { mFlag |= 0x20000000; }
void ClrSttsRoofOff() { mFlag &= ~0x20000000; }
void SetCross(const cXyz& pos) { mLin.SetEnd(pos); }
cXyz& i_GetCross() { return mLin.GetEnd(); }
bool ChkSttsRoofOff() { return mFlag & 0x20000000; }
void SetCross(cXyz& pos) { mLin.SetEnd(pos); }
cXyz& GetCross() { return mLin.GetEnd(); }
cXyz& GetCrossP() { return mLin.GetEndP(); }
cM3dGLin* GetLinP() { return &mLin; }
void OnFrontFlag() { mFrontFlag = true; }
void OffFrontFlag() { mFrontFlag = false; }
bool ChkFrontFlag() { return mFrontFlag; }
void OnBackFlag() { mBackFlag = true; }
void OffBackFlag() { mBackFlag = false; }
bool ChkBackFlag() const { return mBackFlag; }
bool ChkFrontFlag() const { return mFrontFlag; }
bool ChkBackFlag() { return mBackFlag; }
bool GetPreWallChk() const { return mPreWallChk; }
bool GetPreGroundChk() const { return mPreGroundChk; }
bool GetPreRoofChk() const { return mPreRoofChk; }
inline void PreCalc() {
mPreWallChk = !(mFlag & 0x40000000);
mPreGroundChk = !(mFlag & 0x80000000);
mPreRoofChk = !(mFlag & 0x20000000);
void PreCalc() {
mPreWallChk = !ChkSttsWallOff();
mPreGroundChk = !ChkSttsGroundOff();
mPreRoofChk = !ChkSttsRoofOff();
}
void ClearCheckIndex() {} // TODO
}; // Size: 0x58
#endif /* C_BG_S_LIN_CHK_H */
+61 -47
View File
@@ -113,74 +113,88 @@ public:
class dBgS_CrrPos : public cBgS_PolyInfo, public dBgS_Chk, public cBgS_Chk {
public:
dBgS_CrrPos();
void CrrPos(dBgS&);
dBgS_CrrPos() {
SetPolyPassChk(GetPolyPassChkInfo());
SetGrpPassChk(GetGrpPassChkInfo());
SetActorPid(fpcM_ERROR_PROCESS_ID_e);
mFlag = 0;
mWallHeight = 0.0f;
mWallRadius = 0.0f;
pm_pos = NULL;
pm_old_pos = NULL;
mGroundH = -1e+9f;
field_0x60 = 0;
field_0x68 = 20.0f;
field_0x58 = NULL;
mGndUpY = 400.0f;
}
virtual ~dBgS_CrrPos() {}
void Set(cXyz* i_pos, cXyz* i_line, void* param_2, cXyz* param_3) {
mpLine0 = i_line;
void CrrPos(dBgS&);
void Set(cXyz* i_pos, cXyz* i_line, void* actor, cXyz* param_3) {
// not 100% sure if this is right
Set(i_pos, i_line, fpcM_GetID(actor), param_3);
}
void Set(cXyz* i_pos, cXyz* i_line, unsigned int actorPid, cXyz* param_3) {
// not 100% sure if this is right
pm_pos = i_pos;
field_0x58 = param_2;
SetActorPid(fpcM_ERROR_PROCESS_ID_e);
field_0x3c = param_3->y;
field_0x40 = param_3->z;
pm_old_pos = i_line;
field_0x58 = param_3;
SetActorPid(actorPid);
}
void SetGndUpY(f32 param_0) { mGndUpY = param_0; }
void SetWallHit() { mFlag |= 0x10; }
void ClrWallHit() { mFlag &= ~0x10; }
void SetXCrr() { mFlag |= 0x20; }
void ClrXCrr() { mFlag &= ~0x20; }
bool ChkXCrr() { return mFlag & 0x20; }
void SetZCrr() { mFlag |= 0x40; }
void ClrZCrr() { mFlag &= ~0x40; }
bool ChkZCrr() { return mFlag & 0x40; }
void SetGndUpY(f32 y) { mGndUpY = y; }
void ClrNoRoof() {
mGndChk.OffWall();
field_0x38 &= ~8;
mFlag &= ~8;
}
void ClrPosVec() { field_0x4c.x = field_0x4c.y = field_0x4c.z = 0.0f; }
void ChkXCrr() {}
void ChkZCrr() {}
void ClrPosVec() {
field_0x4c.x = field_0x4c.y = field_0x4c.z = 0.0f;
f32 GetWallH() const { return mWallHeight; }
f32 GetWallR() const { return mWallRadius; }
void SetWall(f32 height, f32 radius) {
mWallHeight = height;
mWallRadius = radius;
}
void ClrWallHit() {}
void ClrXCrr() {}
void ClrZCrr() {}
void GetCylP() const {}
void GetGroundH() const {}
void GetOldPos() const {}
f32 GetGroundH() const { return mGroundH; }
cXyz* GetOldPos() const { return pm_old_pos; }
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) {}
const cM3dGCyl* GetCylP() const { return &mCyl; }
void SetOldCyl() { mOldCyl.Set(*pm_old_pos, mWallRadius, mWallHeight * 2.0f); }
void SetCyl() { mCyl.Set(*pm_pos, mWallRadius, mWallHeight * 2.0f); }
void SetLin() { mLin.SetStartEnd(*pm_old_pos, *pm_pos); }
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() {}
void SetWallPolyIndex(int) {} // TODO
/* 0x038 */ u32 field_0x38;
/* 0x03C */ f32 field_0x3c;
/* 0x040 */ f32 field_0x40;
/* 0x038 */ u32 mFlag;
/* 0x03C */ f32 mWallHeight;
/* 0x040 */ f32 mWallRadius;
/* 0x044 */ cXyz* pm_pos;
/* 0x048 */ cXyz* mpLine0;
/* 0x048 */ cXyz* pm_old_pos;
/* 0x04C */ cXyz field_0x4c;
/* 0x058 */ void* field_0x58;
/* 0x05C */ f32 field_0x5c;
/* 0x058 */ cXyz* field_0x58;
/* 0x05C */ f32 mGroundH;
/* 0x060 */ u8 field_0x60;
/* 0x064 */ f32 mGndUpY;
/* 0x068 */ f32 field_0x68;
/* 0x06C */ cM3dGCyl mCyl0;
/* 0x084 */ cM3dGCyl mCyl1;
/* 0x06C */ cM3dGCyl mOldCyl;
/* 0x084 */ cM3dGCyl mCyl;
/* 0x09C */ cM3dGLin mLin;
/* 0x0B8 */ cBgS_GndChk mGndChk;
/* 0x0F8 */ cBgS_LinChk mLinChk;
@@ -188,7 +202,7 @@ public:
class dBgS_LinkCrrPos : public dBgS_CrrPos {
public:
dBgS_LinkCrrPos();
dBgS_LinkCrrPos() { SetLink(); }
virtual ~dBgS_LinkCrrPos() {}
};
+1 -1
View File
@@ -16,7 +16,7 @@ typedef void (*fpcM_ManagementFunc)(void);
typedef int (*fpcM_DrawIteraterFunc)(void*, void*);
inline u32 fpcM_GetID(const void* pProc) {
return pProc != NULL ? ((base_process_class*)pProc)->mBsPcId : 0xFFFFFFFF;
return pProc != NULL ? ((base_process_class*)pProc)->mBsPcId : fpcM_ERROR_PROCESS_ID_e;
}
inline s16 fpcM_GetName(const void* pActor) {
return ((base_process_class*)pActor)->mProcName;
+1 -1
View File
@@ -128,7 +128,7 @@ bool cBgS::LineCross(cBgS_LinChk* chk) {
/* 802468E4-80246A14 .text GroundCross__4cBgSFP11cBgS_GndChk */
f32 cBgS::GroundCross(cBgS_GndChk* chk) {
chk->SetNowY(-1e+09);
chk->SetNowY(-1e+09f);
chk->ClearPi();
chk->mWallPrecheck = (chk->mFlag & 0x02);
chk->mGndPrecheck = (chk->mFlag & 0x01);
+13 -19
View File
@@ -51,7 +51,7 @@ daAgb_HIO_c::daAgb_HIO_c() {
field_0x04[1].mColor.b = 0;
field_0x04[1].mColor.a = 0;
field_0x14 = 24.0f;
field_0x14 = 25.0f;
field_0x18 = 50.0f;
field_0x1c = 781.25f;
field_0x20 = 170.0f;
@@ -895,7 +895,7 @@ void daAgb_c::modeProcCall() {
/* 800D30D4-800D36F4 .text daAgb_Execute__FP7daAgb_c */
// NONMATCHING - regswap
static int daAgb_Execute(daAgb_c* i_this) {
daPy_lk_c* temp_r29 = (daPy_lk_c*)dComIfGp_getPlayer(0);
daPy_py_c* player = daPy_getPlayerActorClass();
i_this->field_0x679 = 0;
if (mDoGaC_GbaLink() && mDoGaC_RecvStatusCheck(4)) {
@@ -954,12 +954,12 @@ static int daAgb_Execute(daAgb_c* i_this) {
}
} else {
daPy_lk_c* player_p2 = daPy_getPlayerLinkActorClass();
if ((dComIfGp_getPlayer(0) == player_p2 && !temp_r29->checkPlayerFly()) ||
((fopAcM_GetName(temp_r29) == PROC_NPC_MD && !daNpc_Md_c::isFlying()) ||
(fopAcM_GetName(temp_r29) == PROC_NPC_CB1 && !daNpc_Cb1_c::m_flying) ||
fopAcM_GetName(temp_r29) == PROC_NPC_OS))
if ((dComIfGp_getPlayer(0) == player_p2 && !player->checkPlayerFly()) ||
((fopAcM_GetName(player) == PROC_NPC_MD && !daNpc_Md_c::isFlying()) ||
(fopAcM_GetName(player) == PROC_NPC_CB1 && !daNpc_Cb1_c::m_flying) ||
fopAcM_GetName(player) == PROC_NPC_OS))
{
f32 speedF = fabs(temp_r29->speedF);
f32 speedF = fabs(player->speedF);
if (speedF <= 0.0f) {
daAgb_c::mFlags.field_0x5_3 = 0;
@@ -1045,9 +1045,9 @@ static int daAgb_Draw(daAgb_c* i_this) {
mDoExt_modelUpdateDL(i_this->mpModel);
if (i_this->field_0x679 != 0 &&
i_this->current.pos.y - i_this->mCrrPos.field_0x5c > 2.5f)
i_this->current.pos.y - i_this->mCrrPos.GetGroundH() > 2.5f)
{
dComIfGd_setSimpleShadow2(&i_this->current.pos, i_this->mCrrPos.field_0x5c, 50.0f,
dComIfGd_setSimpleShadow2(&i_this->current.pos, i_this->mCrrPos.GetGroundH(), 50.0f,
i_this->mCrrPos.mGndChk, 0, 1.0f, &i_this->mTexObj);
}
@@ -1116,20 +1116,14 @@ static int daAgb_Create(fopAc_ac_c* i_this) {
return cPhs_ERROR_e;
}
// a_this->mCrrPos.Set(&a_this->current.pos, &a_this->next.pos, NULL, );
a_this->mCrrPos.mpLine0 = &a_this->current.pos;
a_this->mCrrPos.pm_pos = &a_this->next.pos;
a_this->mCrrPos.field_0x58 = NULL;
a_this->mCrrPos.SetActorPid(fpcM_ERROR_PROCESS_ID_e);
a_this->mCrrPos.field_0x3c = 171.0f;
a_this->mCrrPos.field_0x40 = 50.0f;
a_this->mCrrPos.Set(&fopAcM_GetPosition_p(a_this), &fopAcM_GetOldPosition_p(a_this), (void*)NULL, NULL);
a_this->mCrrPos.SetWall(171.0f, 50.0f);
a_this->mCrrPos.SetGndUpY(170.0f);
a_this->mCrrPos.ClrNoRoof();
a_this->mAcch.Set(&a_this->current.pos, &a_this->next.pos, a_this, 1, &a_this->mAcchCir);
a_this->mAcch.Set(&fopAcM_GetPosition_p(a_this), &fopAcM_GetOldPosition_p(a_this), a_this, 1, &a_this->mAcchCir);
a_this->mAcch.OnLineCheck();
a_this->mAcch.SetGrndNone();
a_this->mAcchCir.SetWall(171.01f, 40.0f);
a_this->mAcchCir.SetWall(171.0f, 40.0f);
TestDataManager[4].field_0x0 = (u32)&daAgb_c::mGbaFlg;
TestDataManager[8].field_0x0 = (u32)&daAgb_c::mSwitch;
+1 -1
View File
@@ -262,7 +262,7 @@ namespace daObjMovebox {
M_wall_work[i].Set(&temp_44, &temp_38, (fopAc_ac_c*)movebox);
M_wall_work[i].SetActorPid(movebox->mBase.mBsPcId);
if (dComIfG_Bgsp()->LineCross(&M_wall_work[i])) {
mWallPos[i] = M_wall_work[i].i_GetCross();
mWallPos[i] = M_wall_work[i].GetCross();
f32 dist = temp_44.abs2(mWallPos[i]);
if (dist < mNearestWallDist) {
mNearestWallDist = dist;
+75 -3
View File
@@ -9,6 +9,11 @@
#include "d/d_com_inf_game.h"
#include "f_op/f_op_actor_mng.h"
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1));
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f);
#define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f)
#define CHECK_PVEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v->x && v->x < 1.0e32f && -1.0e32f < v->y && v->y < 1.0e32f && -1.0e32f < v->z && v->z < 1.0e32f)
/* 800A0270-800A0290 .text Ct__4dBgSFv */
void dBgS::Ct() {
cBgS::Ct();
@@ -349,7 +354,7 @@ void dBgS::WallCorrect(dBgS_Acch* acch) {
/* 800A13E0-800A14FC .text RoofChk__4dBgSFP12dBgS_RoofChk */
f32 dBgS::RoofChk(dBgS_RoofChk* chk) {
chk->SetNowY(1e+09);
chk->SetNowY(1e+09f);
chk->ClearPi();
cBgS_ChkElm* elm;
for (s32 bg_index = 0; bg_index < (s32)ARRAY_SIZE(m_chk_element); bg_index++) {
@@ -540,8 +545,75 @@ fopAc_ac_c* dBgS::PushPullCallBack(cBgS_PolyInfo& polyInfo, fopAc_ac_c* ac, s16
}
/* 800A1FD8-800A2550 .text CrrPos__11dBgS_CrrPosFR4dBgS */
void dBgS_CrrPos::CrrPos(dBgS&) {
/* Nonmatching */
void dBgS_CrrPos::CrrPos(dBgS& i_bgs) {
if (mFlag & 1)
return;
ClrWallHit();
ClrXCrr();
ClrZCrr();
CHECK_PVEC3_RANGE(2280, pm_pos);
if (!(mFlag & 4)) {
f32 dist2 = GetOldPos()->abs2(*pm_pos);
bool inWall = false;
if (dist2 > (0.65f*0.65f * GetWallR()*GetWallR())) {
inWall = true;
cBgS_LinChk linChk;
cXyz startPos(*pm_old_pos);
cXyz endPos(*pm_pos);
startPos.y += GetWallH();
endPos.y += GetWallH();
linChk.Set2(&startPos, &endPos, GetActorPid());
linChk.SetExtChk(*this);
linChk.SetSttsGroundOff();
if (i_bgs.LineCross(&linChk)) {
*pm_pos = linChk.GetCross();
cM3dGPla* plane = i_bgs.GetTriPla(linChk.GetBgIndex(), linChk.GetPolyIndex());
pm_pos->x += plane->GetNP()->x;
pm_pos->y += plane->GetNP()->y - mWallHeight;
pm_pos->z += plane->GetNP()->z;
}
}
if (i_bgs.WallCrrPos(this) && inWall) {
cBgS_LinChk linChk;
cXyz startPos(*pm_old_pos);
cXyz endPos(*pm_pos);
startPos.y += mWallHeight;
endPos.y += mWallHeight;
linChk.Set2(&startPos, &endPos, GetActorPid());
linChk.SetExtChk(*this);
linChk.SetSttsGroundOff();
if (i_bgs.LineCross(&linChk)) {
*pm_pos = linChk.GetCross();
cM3dGPla* plane = i_bgs.GetTriPla(linChk.GetBgIndex(), linChk.GetPolyIndex());
pm_pos->x += plane->GetNP()->x;
pm_pos->y += plane->GetNP()->y - mWallHeight;
pm_pos->z += plane->GetNP()->z;
}
}
}
if (!(mFlag & 2)) {
field_0x60 = 0;
mGndChk.SetExtChk(*this);
cXyz pos = *pm_pos;
pos.y += mGndUpY;
mGndChk.SetPos(&pos);
f32 f31 = pm_pos->y;
mGroundH = i_bgs.GroundCross(&mGndChk);
if (mGroundH != -1e+09f && mGroundH > f31) {
pm_pos->y = mGroundH;
if (field_0x58) {
field_0x58->y = 0.0f;
}
field_0x60 = 1;
}
}
}
/* 800A2550-800A257C .text MatrixCrrPos__4dBgWFR13cBgS_PolyInfoPvbP4cXyzP5csXyzP5csXyz */