diff --git a/include/d/d_bg_s_acch.h b/include/d/d_bg_s_acch.h index 463bbfd34..f79dc73d8 100644 --- a/include/d/d_bg_s_acch.h +++ b/include/d/d_bg_s_acch.h @@ -63,6 +63,7 @@ class dBgS; class dBgS_Acch : public cBgS_Chk, public dBgS_Chk { public: enum { + /* 0x000001 */ UNK_1 = (1 << 0), /* 0x000002 */ GRND_NONE = (1 << 1), /* 0x000004 */ WALL_NONE = (1 << 2), /* 0x000008 */ ROOF_NONE = (1 << 3), @@ -137,9 +138,9 @@ public: f32 GetRoofHeight() { return m_roof_height; } f32 GetSeaHeight() { return m_sea_height; } void SetLin() { m_lin.SetStartEnd(*pm_old_pos, *pm_pos); } - bool ChkGroundFind() { return m_flags & GROUND_FIND; } - bool ChkGroundHit() { return m_flags & GROUND_HIT; } - bool ChkGroundLanding() { return m_flags & GROUND_LANDING; } + bool ChkGroundFind() { return (m_flags & GROUND_FIND) != 0; } + bool ChkGroundHit() { return (m_flags & GROUND_HIT) != 0; } + bool ChkGroundLanding() { return (m_flags & GROUND_LANDING) != 0; } void ClrGroundLanding() { m_flags &= ~GROUND_LANDING; } void ClrGroundAway() { m_flags &= ~GROUND_AWAY; } void ClrWallHit() { m_flags &= ~WALL_HIT; } @@ -149,6 +150,7 @@ public: void SetWaterNone() { m_flags |= WATER_NONE; } bool ChkWallHit() { return m_flags & WALL_HIT; } void OffLineCheckHit() { m_flags &= ~LINE_CHECK_HIT; } + void OnLineCheckHit() { m_flags |= LINE_CHECK_HIT; } void OffLineCheck() { m_flags &= ~LINE_CHECK; } void OffLineCheckNone() { m_flags &= ~LINE_CHECK_NONE; } void OnLineCheckNone() { m_flags |= LINE_CHECK_NONE; } @@ -160,11 +162,11 @@ public: void ClrWaterIn() { m_flags &= ~WATER_IN; } void SetWaterIn() { m_flags |= WATER_IN; } const u32 MaskWaterIn() { return m_flags & WATER_IN; } - const bool ChkWaterIn() { return MaskWaterIn();} + const bool ChkWaterIn() { return MaskWaterIn() != 0; } void ClrGroundFind() { m_flags &= ~GROUND_FIND; } u32 MaskRoofHit() { return m_flags & ROOF_HIT; } - bool ChkRoofHit() { return MaskRoofHit(); } - bool ChkClrSpeedY() { return m_flags & CLR_SPEED_Y; } + bool ChkRoofHit() { return MaskRoofHit() != 0; } + bool ChkClrSpeedY() { return (m_flags & CLR_SPEED_Y) != 0; } void SetGroundFind() { m_flags |= GROUND_FIND; } void SetGroundHit() { m_flags |= GROUND_HIT; } void ClrGroundHit() { m_flags &= ~GROUND_HIT; } @@ -183,10 +185,10 @@ public: void SetWallHit() { m_flags |= WALL_HIT; } void ClrWallNone() { m_flags &= ~WALL_NONE; } void OnSeaCheckOn() { m_flags |= SEA_CHECK; } - bool ChkSeaCheckOn() { return m_flags & SEA_CHECK;} + bool ChkSeaCheckOn() { return m_flags & SEA_CHECK; } void OnSeaWaterHeight() { m_flags |= SEA_WATER_HEIGHT; } bool ChkSeaWaterHeight() { return m_flags & SEA_WATER_HEIGHT; } - bool ChkSeaIn() { return m_flags & SEA_IN;} + bool ChkSeaIn() { return m_flags & SEA_IN; } cM3dGCyl* GetWallBmdCylP() { return &m_wall_cyl; } cM3dGCir* GetWallCirP(int index) { @@ -204,13 +206,12 @@ public: void SetWallCirHit(int i_no) { pm_acch_cir[i_no].SetWallHit(); } void SetWallAngleY(int i_no, s16 i_angle) { pm_acch_cir[i_no].SetWallAngleY(i_angle); } - f32 GetCx() const { return pm_pos->x; } - f32 GetCz() const { return pm_pos->z; } + f32 GetCx() { return pm_pos->x; } + f32 GetCz() { return pm_pos->z; } // TODO void ChkGroundAway() {} void DrawWall(dBgS&) {} - void OnLineCheckHit() {} void SetOld() {} public: diff --git a/src/d/actor/d_a_stone.cpp b/src/d/actor/d_a_stone.cpp index 6dbd56e2d..cb4d02e20 100644 --- a/src/d/actor/d_a_stone.cpp +++ b/src/d/actor/d_a_stone.cpp @@ -605,7 +605,8 @@ bool Act_c::damage_bg_proc_directly() { if (m674 == 0) { if (uVar7) { - if (mAcch.ChkGroundLanding() != false && m688 - current.pos.y > data().m38) { + bool groundLanding = mAcch.ChkGroundLanding(); + if (groundLanding && m688 - current.pos.y > data().m38) { damaged(2); iVar9 = true; } diff --git a/src/d/d_bg_s_acch.cpp b/src/d/d_bg_s_acch.cpp index 05399f6da..1f683a983 100644 --- a/src/d/d_bg_s_acch.cpp +++ b/src/d/d_bg_s_acch.cpp @@ -148,8 +148,8 @@ void dBgS_Acch::GroundCheck(dBgS& i_bgs) { } } - if (field_0xb0 && !(m_flags & GROUND_HIT)) { - m_flags |= GROUND_AWAY; + if (field_0xb0 && !ChkGroundHit()) { + SetGroundAway(); } } @@ -186,7 +186,7 @@ void dBgS_Acch::LineCheck(dBgS& i_bgs) { linChk.SetExtChk(*this); if (i_bgs.LineCross(&linChk)) { *pm_pos = linChk.GetLinP()->GetEnd(); - m_flags |= LINE_CHECK_HIT; + OnLineCheckHit(); if (pm_out_poly_info != NULL) pm_out_poly_info->SetPolyInfo(linChk); @@ -208,7 +208,7 @@ void dBgS_Acch::LineCheck(dBgS& i_bgs) { /* 800A3460-800A3F50 .text CrrPos__9dBgS_AcchFR4dBgS */ void dBgS_Acch::CrrPos(dBgS& i_bgs) { - if (m_flags & 0x1) { + if (m_flags & UNK_1) { return; }