diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2024-07-22 11:33:37 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-22 12:33:37 -0600 |
| commit | 6bf2f3cc5578f3e3108df8337a462ee4c618915a (patch) | |
| tree | ad1c0cb2a80e4252dabe76ff4a11b2a612d0ca06 /libs | |
| parent | 70e278ee845b1514981a4ef49a113fe91305c891 (diff) | |
some cc doc and obj_brg work (#2184)
* some cc doc
* document dCcD material types
* work on d_a_obj_brg
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/SSystem/SComponent/c_cc_d.cpp | 278 | ||||
| -rw-r--r-- | libs/SSystem/SComponent/c_cc_s.cpp | 355 |
2 files changed, 359 insertions, 274 deletions
diff --git a/libs/SSystem/SComponent/c_cc_d.cpp b/libs/SSystem/SComponent/c_cc_d.cpp index 3ae8601816..e906c17380 100644 --- a/libs/SSystem/SComponent/c_cc_d.cpp +++ b/libs/SSystem/SComponent/c_cc_d.cpp @@ -4,6 +4,10 @@ */ #include "SSystem/SComponent/c_cc_d.h" +#include "JSystem/JUtility/JUTAssert.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); /* 80430CB4-80430CC0 05D9D4 000C+00 1/1 2/2 0/0 .bss m_virtual_center__14cCcD_ShapeAttr */ @@ -18,7 +22,7 @@ void cCcD_DivideInfo::Set(u32 xDivInfo, u32 yDivInfo, u32 zDivInfo) { /* 80263368-802633A8 25DCA8 0040+00 0/0 5/5 0/0 .text Chk__15cCcD_DivideInfoCFRC15cCcD_DivideInfo */ -bool cCcD_DivideInfo::Chk(cCcD_DivideInfo const& other) const { +bool cCcD_DivideInfo::Chk(const cCcD_DivideInfo& other) const { if ((mXDivInfo & other.mXDivInfo) == 0 || (mZDivInfo & other.mZDivInfo) == 0 || (mYDivInfo & other.mYDivInfo) == 0) { @@ -29,31 +33,30 @@ bool cCcD_DivideInfo::Chk(cCcD_DivideInfo const& other) const { } /* 802633A8-802634D4 25DCE8 012C+00 0/0 2/2 0/0 .text SetArea__15cCcD_DivideAreaFRC8cM3dGAab */ -void cCcD_DivideArea::SetArea(cM3dGAab const& aab) { - Set(&aab.mMin, &aab.mMax); +void cCcD_DivideArea::SetArea(const cM3dGAab& aab) { + Set(aab.GetMinP(), aab.GetMaxP()); - mScaledXDiff = 1.0f / 32.0f * (mMax.x - mMin.x); + mScaledXDiff = 1.0f / 32.0f * (GetMaxP()->x - GetMinP()->x); mXDiffIsZero = cM3d_IsZero(mScaledXDiff); if (!mXDiffIsZero) { mInvScaledXDiff = 1.0f / mScaledXDiff; } - mScaledYDiff = 1.0f / 32.0f * (mMax.y - mMin.y); + mScaledYDiff = 1.0f / 32.0f * (GetMaxP()->y - GetMinP()->y); mYDiffIsZero = cM3d_IsZero(mScaledYDiff); if (!mYDiffIsZero) { mInvScaledYDiff = 1.0f / mScaledYDiff; } - mScaledZDiff = 1.0f / 32.0f * (mMax.z - mMin.z); + mScaledZDiff = 1.0f / 32.0f * (GetMaxP()->z - GetMinP()->z); mZDiffIsZero = cM3d_IsZero(mScaledZDiff); if (!mZDiffIsZero) { mInvScaledZDiff = 1.0f / mScaledZDiff; } } -/* ############################################################################################## */ /* 8039A7E8-8039A868 026E48 0080+00 2/2 0/0 0/0 .rodata l_base */ -static u32 const l_base[32] = { +static const u32 l_base[32] = { 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F, 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF, 0x00001FFF, 0x00003FFF, 0x00007FFF, 0x0000FFFF, 0x0001FFFF, 0x0003FFFF, 0x0007FFFF, 0x000FFFFF, 0x001FFFFF, 0x003FFFFF, 0x007FFFFF, 0x00FFFFFF, @@ -62,15 +65,15 @@ static u32 const l_base[32] = { /* 802634D4-802636A0 25DE14 01CC+00 0/0 2/2 0/0 .text * CalcDivideInfo__15cCcD_DivideAreaFP15cCcD_DivideInfoRC8cM3dGAabUl */ -void cCcD_DivideArea::CalcDivideInfo(cCcD_DivideInfo* pDivideInfo, cM3dGAab const& aab, +void cCcD_DivideArea::CalcDivideInfo(cCcD_DivideInfo* pDivideInfo, const cM3dGAab& aab, u32 param_2) { if (param_2 != 0) { pDivideInfo->Set(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF); } else { u32 xDivInfo, yDivInfo, zDivInfo; if (!mXDiffIsZero) { - s32 var1 = mInvScaledXDiff * (aab.mMin.x - mMin.x); - s32 var3 = mInvScaledXDiff * (aab.mMax.x - mMin.x); + s32 var1 = mInvScaledXDiff * (aab.GetMinP()->x - GetMinP()->x); + s32 var3 = mInvScaledXDiff * (aab.GetMaxP()->x - GetMinP()->x); if (31 < var3) { var3 = 31; } @@ -85,8 +88,8 @@ void cCcD_DivideArea::CalcDivideInfo(cCcD_DivideInfo* pDivideInfo, cM3dGAab cons } if (!mYDiffIsZero) { - s32 var1 = mInvScaledYDiff * (aab.mMin.y - mMin.y); - s32 var3 = mInvScaledYDiff * (aab.mMax.y - mMin.y); + s32 var1 = mInvScaledYDiff * (aab.GetMinP()->y - GetMinP()->y); + s32 var3 = mInvScaledYDiff * (aab.GetMaxP()->y - GetMinP()->y); if (31 < var3) { var3 = 31; } @@ -101,8 +104,8 @@ void cCcD_DivideArea::CalcDivideInfo(cCcD_DivideInfo* pDivideInfo, cM3dGAab cons } if (!mZDiffIsZero) { - s32 var1 = mInvScaledZDiff * (aab.mMin.z - mMin.z); - s32 var3 = mInvScaledZDiff * (aab.mMax.z - mMin.z); + s32 var1 = mInvScaledZDiff * (aab.GetMinP()->z - GetMinP()->z); + s32 var3 = mInvScaledZDiff * (aab.GetMaxP()->z - GetMinP()->z); if (31 < var3) { var3 = 31; } @@ -122,11 +125,11 @@ void cCcD_DivideArea::CalcDivideInfo(cCcD_DivideInfo* pDivideInfo, cM3dGAab cons /* 802636A0-80263894 25DFE0 01F4+00 0/0 3/3 0/0 .text * CalcDivideInfoOverArea__15cCcD_DivideAreaFP15cCcD_DivideInfoRC8cM3dGAab */ -void cCcD_DivideArea::CalcDivideInfoOverArea(cCcD_DivideInfo* pDivideInfo, cM3dGAab const& aab) { +void cCcD_DivideArea::CalcDivideInfoOverArea(cCcD_DivideInfo* pDivideInfo, const cM3dGAab& aab) { u32 xDivInfo, yDivInfo, zDivInfo; if (!mXDiffIsZero) { - s32 var1 = mInvScaledXDiff * (aab.mMin.x - mMin.x); - s32 var3 = mInvScaledXDiff * (aab.mMax.x - mMin.x); + s32 var1 = mInvScaledXDiff * (aab.GetMinP()->x - GetMinP()->x); + s32 var3 = mInvScaledXDiff * (aab.GetMaxP()->x - GetMinP()->x); if (var3 < 0 || 31 < var1) { xDivInfo = 0; } else { @@ -144,8 +147,8 @@ void cCcD_DivideArea::CalcDivideInfoOverArea(cCcD_DivideInfo* pDivideInfo, cM3dG } if (!mYDiffIsZero) { - s32 var1 = mInvScaledYDiff * (aab.mMin.y - mMin.y); - s32 var3 = mInvScaledYDiff * (aab.mMax.y - mMin.y); + s32 var1 = mInvScaledYDiff * (aab.GetMinP()->y - GetMinP()->y); + s32 var3 = mInvScaledYDiff * (aab.GetMaxP()->y - GetMinP()->y); if (var3 < 0 || 31 < var1) { yDivInfo = 0; } else { @@ -163,8 +166,8 @@ void cCcD_DivideArea::CalcDivideInfoOverArea(cCcD_DivideInfo* pDivideInfo, cM3dG } if (!mZDiffIsZero) { - s32 var1 = mInvScaledZDiff * (aab.mMin.z - mMin.z); - s32 var3 = mInvScaledZDiff * (aab.mMax.z - mMin.z); + s32 var1 = mInvScaledZDiff * (aab.GetMinP()->z - GetMinP()->z); + s32 var3 = mInvScaledZDiff * (aab.GetMaxP()->z - GetMinP()->z); if (var3 < 0 || 31 < var1) { zDivInfo = 0; } else { @@ -195,51 +198,59 @@ cCcD_GStts* cCcD_Stts::GetGStts() { } /* 802638A4-80263904 25E1E4 0060+00 0/0 1/1 0/0 .text Init__9cCcD_SttsFiiPvUi */ -void cCcD_Stts::Init(int weight, int param_1, void* pActor, unsigned int apid) { +void cCcD_Stts::Init(int weight, int param_1, void* pactor, fpc_ProcID apid) { Ct(); - mWeight = weight; + m_weight = weight; field_0x15 = param_1; - mActor = static_cast<fopAc_ac_c*>(pActor); - mApid = apid; + mp_actor = static_cast<fopAc_ac_c*>(pactor); + m_apid = apid; } /* 80263904-80263934 25E244 0030+00 1/0 1/1 0/0 .text Ct__9cCcD_SttsFv */ void cCcD_Stts::Ct() { - mXyz.x = 0.0f; - mXyz.y = 0.0f; - mXyz.z = 0.0f; - mActor = 0; - mApid = 0xFFFFFFFF; - mWeight = 0; + m_cc_move.x = 0.0f; + m_cc_move.y = 0.0f; + m_cc_move.z = 0.0f; + mp_actor = NULL; + m_apid = fpcM_ERROR_PROCESS_ID_e; + m_weight = 0; field_0x15 = 0; - mTg = 0; + m_dmg = 0; } /* 80263934-8026395C 25E274 0028+00 0/0 3/3 0/0 .text PlusCcMove__9cCcD_SttsFfff */ void cCcD_Stts::PlusCcMove(f32 x, f32 y, f32 z) { - mXyz.x += x; - mXyz.y += y; - mXyz.z += z; + m_cc_move.x += x; + m_cc_move.y += y; + m_cc_move.z += z; + + CHECK_FLOAT_CLASS(422, m_cc_move.x); + CHECK_FLOAT_CLASS(423, m_cc_move.y); + CHECK_FLOAT_CLASS(424, m_cc_move.z); + + CHECK_FLOAT_RANGE(426, m_cc_move.x); + CHECK_FLOAT_RANGE(427, m_cc_move.y); + CHECK_FLOAT_RANGE(428, m_cc_move.z); } /* 8026395C-80263970 25E29C 0014+00 0/0 10/10 23/23 .text ClrCcMove__9cCcD_SttsFv */ void cCcD_Stts::ClrCcMove() { - mXyz.z = 0.0f; - mXyz.y = 0.0f; - mXyz.x = 0.0f; + m_cc_move.z = 0.0f; + m_cc_move.y = 0.0f; + m_cc_move.x = 0.0f; } /* 80263970-80263984 25E2B0 0014+00 0/0 2/2 0/0 .text PlusDmg__9cCcD_SttsFi */ void cCcD_Stts::PlusDmg(int dmg) { - if (mTg >= dmg) { + if (m_dmg >= dmg) { return; } - mTg = dmg; + m_dmg = dmg; } /* 80263984-802639B0 25E2C4 002C+00 0/0 1/1 0/0 .text GetWeightF__9cCcD_SttsCFv */ f32 cCcD_Stts::GetWeightF() const { - return (s32)mWeight; + return (s32)m_weight; } /* 802639B0-802639C4 25E2F0 0014+00 0/0 1/1 0/0 .text ct__18cCcD_ObjCommonBaseFv */ @@ -251,7 +262,7 @@ void cCcD_ObjCommonBase::ct() { /* 802639C4-80263A10 25E304 004C+00 1/1 0/0 0/0 .text Set__14cCcD_ObjHitInfFRC17cCcD_SrcObjHitInf */ -void cCcD_ObjHitInf::Set(cCcD_SrcObjHitInf const& src) { +void cCcD_ObjHitInf::Set(const cCcD_SrcObjHitInf& src) { mObjAt.Set(src.mObjAt); mObjTg.Set(src.mObjTg); mObjCo.Set(src.mObjCo); @@ -263,7 +274,7 @@ void cCcD_Obj::ct() { } /* 80263A1C-80263A48 25E35C 002C+00 0/0 1/1 0/0 .text Set__8cCcD_ObjFRC11cCcD_SrcObj */ -void cCcD_Obj::Set(cCcD_SrcObj const& src) { +void cCcD_Obj::Set(const cCcD_SrcObj& src) { mFlags = src.mFlags; cCcD_ObjHitInf::Set(src.mSrcObjHitInf); } @@ -279,19 +290,19 @@ fopAc_ac_c* cCcD_Obj::GetAc() { /* 80263A64-80263A88 25E3A4 0024+00 3/0 2/0 0/0 .text * getShapeAccess__14cCcD_ShapeAttrCFPQ214cCcD_ShapeAttr5Shape */ -void cCcD_ShapeAttr::getShapeAccess(cCcD_ShapeAttr::Shape* p_shape) const { - p_shape->_0 = 2; - p_shape->_14 = 0.0f; - p_shape->_10 = 0.0f; - p_shape->_C = 0.0f; - p_shape->_8 = 0.0f; - p_shape->_4 = 0.0f; +void cCcD_ShapeAttr::getShapeAccess(cCcD_ShapeAttr::Shape* pshape) const { + pshape->_0 = 2; + pshape->_14 = 0.0f; + pshape->_10 = 0.0f; + pshape->_C = 0.0f; + pshape->_8 = 0.0f; + pshape->_4 = 0.0f; } /* 80263A88-80263B58 25E3C8 00D0+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_TriAttrCFRC12cCcD_CpsAttrP4cXyz */ -bool cCcD_TriAttr::CrossAtTg(cCcD_CpsAttr const& cpsAttr, cXyz* p_xyz) const { - if (cM3dGTri::Cross(cpsAttr, p_xyz)) { +bool cCcD_TriAttr::CrossAtTg(const cCcD_CpsAttr& cpsAttr, cXyz* pxyz) const { + if (cM3dGTri::Cross(cpsAttr, pxyz)) { return true; } else { return false; @@ -300,8 +311,8 @@ bool cCcD_TriAttr::CrossAtTg(cCcD_CpsAttr const& cpsAttr, cXyz* p_xyz) const { /* 80263B58-80263B90 25E498 0038+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_TriAttrCFRC12cCcD_CylAttrP4cXyz */ -bool cCcD_TriAttr::CrossAtTg(cCcD_CylAttr const& cylAttr, cXyz* p_xyz) const { - if (cM3dGTri::Cross(cylAttr, p_xyz)) { +bool cCcD_TriAttr::CrossAtTg(const cCcD_CylAttr& cylAttr, cXyz* pxyz) const { + if (cM3dGTri::Cross(cylAttr, pxyz)) { return true; } else { return false; @@ -310,8 +321,8 @@ bool cCcD_TriAttr::CrossAtTg(cCcD_CylAttr const& cylAttr, cXyz* p_xyz) const { /* 80263B90-80263BCC 25E4D0 003C+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_TriAttrCFRC12cCcD_SphAttrP4cXyz */ -bool cCcD_TriAttr::CrossAtTg(cCcD_SphAttr const& sphAttr, cXyz* p_xyz) const { - if (cM3dGTri::Cross(sphAttr, p_xyz)) { +bool cCcD_TriAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const { + if (cM3dGTri::Cross(sphAttr, pxyz)) { return true; } else { return false; @@ -320,8 +331,8 @@ bool cCcD_TriAttr::CrossAtTg(cCcD_SphAttr const& sphAttr, cXyz* p_xyz) const { /* 80263BCC-80263C04 25E50C 0038+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_TriAttrCFRC12cCcD_TriAttrP4cXyz */ -bool cCcD_TriAttr::CrossAtTg(cCcD_TriAttr const& other, cXyz* p_xyz) const { - if (cM3dGTri::Cross(other, p_xyz)) { +bool cCcD_TriAttr::CrossAtTg(const cCcD_TriAttr& other, cXyz* pxyz) const { + if (cM3dGTri::Cross(other, pxyz)) { return true; } else { return false; @@ -337,7 +348,7 @@ void cCcD_TriAttr::CalcAabBox() { } /* 80263C9C-80263D38 25E5DC 009C+00 1/0 1/0 0/0 .text GetNVec__12cCcD_TriAttrCFRC4cXyzP4cXyz */ -bool cCcD_TriAttr::GetNVec(cXyz const& param_0, cXyz* pOut) const { +bool cCcD_TriAttr::GetNVec(const cXyz& param_0, cXyz* pOut) const { if (getPlaneFunc(¶m_0) >= 0.0f) { *pOut = mNormal; } else { @@ -349,8 +360,8 @@ bool cCcD_TriAttr::GetNVec(cXyz const& param_0, cXyz* pOut) const { /* 80263D38-80263D7C 25E678 0044+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_CpsAttrCFRC12cCcD_CpsAttrP4cXyz */ -bool cCcD_CpsAttr::CrossAtTg(cCcD_CpsAttr const& other, cXyz* p_xyz) const { - if (cM3dGCps::Cross(&other, p_xyz)) { +bool cCcD_CpsAttr::CrossAtTg(const cCcD_CpsAttr& other, cXyz* pxyz) const { + if (cM3dGCps::Cross(&other, pxyz)) { return true; } else { return false; @@ -359,8 +370,8 @@ bool cCcD_CpsAttr::CrossAtTg(cCcD_CpsAttr const& other, cXyz* p_xyz) const { /* 80263D7C-80263DC0 25E6BC 0044+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_CpsAttrCFRC12cCcD_CylAttrP4cXyz */ -bool cCcD_CpsAttr::CrossAtTg(cCcD_CylAttr const& cylAttr, cXyz* p_xyz) const { - if (cM3dGCps::Cross(&cylAttr, p_xyz)) { +bool cCcD_CpsAttr::CrossAtTg(const cCcD_CylAttr& cylAttr, cXyz* pxyz) const { + if (cM3dGCps::Cross(&cylAttr, pxyz)) { return true; } else { return false; @@ -369,8 +380,8 @@ bool cCcD_CpsAttr::CrossAtTg(cCcD_CylAttr const& cylAttr, cXyz* p_xyz) const { /* 80263DC0-80263E04 25E700 0044+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_CpsAttrCFRC12cCcD_SphAttrP4cXyz */ -bool cCcD_CpsAttr::CrossAtTg(cCcD_SphAttr const& sphAttr, cXyz* p_xyz) const { - if (cM3dGCps::Cross(&sphAttr, p_xyz)) { +bool cCcD_CpsAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const { + if (cM3dGCps::Cross(&sphAttr, pxyz)) { return true; } else { return false; @@ -379,8 +390,8 @@ bool cCcD_CpsAttr::CrossAtTg(cCcD_SphAttr const& sphAttr, cXyz* p_xyz) const { /* 80263E04-80263ED4 25E744 00D0+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_CpsAttrCFRC12cCcD_TriAttrP4cXyz */ -bool cCcD_CpsAttr::CrossAtTg(cCcD_TriAttr const& triAttr, cXyz* p_xyz) const { - if (triAttr.cM3dGTri::Cross(*this, p_xyz)) { +bool cCcD_CpsAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const { + if (triAttr.cM3dGTri::Cross(*this, pxyz)) { return true; } else { return false; @@ -389,7 +400,7 @@ bool cCcD_CpsAttr::CrossAtTg(cCcD_TriAttr const& triAttr, cXyz* p_xyz) const { /* 80263ED4-80263F24 25E814 0050+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CpsAttrCFRC12cCcD_CpsAttrPf */ -bool cCcD_CpsAttr::CrossCo(cCcD_CpsAttr const& other, f32* param_1) const { +bool cCcD_CpsAttr::CrossCo(const cCcD_CpsAttr& other, f32* param_1) const { *param_1 = 0.0f; cXyz xyz; if (cM3dGCps::Cross(&other, &xyz)) { @@ -401,7 +412,7 @@ bool cCcD_CpsAttr::CrossCo(cCcD_CpsAttr const& other, f32* param_1) const { /* 80263F24-80263F74 25E864 0050+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CpsAttrCFRC12cCcD_CylAttrPf */ -bool cCcD_CpsAttr::CrossCo(cCcD_CylAttr const& cylAttr, f32* param_1) const { +bool cCcD_CpsAttr::CrossCo(const cCcD_CylAttr& cylAttr, f32* param_1) const { *param_1 = 0.0f; cXyz xyz; if (cM3dGCps::Cross(&cylAttr, &xyz)) { @@ -413,7 +424,7 @@ bool cCcD_CpsAttr::CrossCo(cCcD_CylAttr const& cylAttr, f32* param_1) const { /* 80263F74-80263FC4 25E8B4 0050+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CpsAttrCFRC12cCcD_SphAttrPf */ -bool cCcD_CpsAttr::CrossCo(cCcD_SphAttr const& sphAttr, f32* param_1) const { +bool cCcD_CpsAttr::CrossCo(const cCcD_SphAttr& sphAttr, f32* param_1) const { *param_1 = 0.0f; cXyz xyz; if (cM3dGCps::Cross(&sphAttr, &xyz)) { @@ -432,7 +443,7 @@ void cCcD_CpsAttr::CalcAabBox() { } /* 80264014-8026417C 25E954 0168+00 1/0 1/0 0/0 .text GetNVec__12cCcD_CpsAttrCFRC4cXyzP4cXyz */ -bool cCcD_CpsAttr::GetNVec(cXyz const& param_0, cXyz* param_1) const { +bool cCcD_CpsAttr::GetNVec(const cXyz& param_0, cXyz* param_1) const { Vec diff; const cXyz& endP = GetEndP(); VECSubtract(&endP, &mStart, &diff); @@ -468,8 +479,8 @@ bool cCcD_CpsAttr::GetNVec(cXyz const& param_0, cXyz* param_1) const { /* 8026417C-802641C8 25EABC 004C+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_CylAttrCFRC12cCcD_CpsAttrP4cXyz */ -bool cCcD_CylAttr::CrossAtTg(cCcD_CpsAttr const& cpsAttr, cXyz* p_xyz) const { - if (cM3dGCyl::Cross(&cpsAttr, p_xyz)) { +bool cCcD_CylAttr::CrossAtTg(const cCcD_CpsAttr& cpsAttr, cXyz* pxyz) const { + if (cM3dGCyl::Cross(&cpsAttr, pxyz)) { return true; } else { return false; @@ -478,8 +489,8 @@ bool cCcD_CylAttr::CrossAtTg(cCcD_CpsAttr const& cpsAttr, cXyz* p_xyz) const { /* 802641C8-8026420C 25EB08 0044+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_CylAttrCFRC12cCcD_CylAttrP4cXyz */ -bool cCcD_CylAttr::CrossAtTg(cCcD_CylAttr const& other, cXyz* p_xyz) const { - if (cross(&other, p_xyz)) { +bool cCcD_CylAttr::CrossAtTg(const cCcD_CylAttr& other, cXyz* pxyz) const { + if (cross(&other, pxyz)) { return true; } else { return false; @@ -488,8 +499,8 @@ bool cCcD_CylAttr::CrossAtTg(cCcD_CylAttr const& other, cXyz* p_xyz) const { /* 8026420C-80264250 25EB4C 0044+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_CylAttrCFRC12cCcD_SphAttrP4cXyz */ -bool cCcD_CylAttr::CrossAtTg(cCcD_SphAttr const& sphAttr, cXyz* p_xyz) const { - if (cross(&sphAttr, p_xyz)) { +bool cCcD_CylAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const { + if (cross(&sphAttr, pxyz)) { return true; } else { return false; @@ -498,8 +509,8 @@ bool cCcD_CylAttr::CrossAtTg(cCcD_SphAttr const& sphAttr, cXyz* p_xyz) const { /* 80264250-80264288 25EB90 0038+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_CylAttrCFRC12cCcD_TriAttrP4cXyz */ -bool cCcD_CylAttr::CrossAtTg(cCcD_TriAttr const& triAttr, cXyz* p_xyz) const { - if (cM3dGCyl::Cross(triAttr, p_xyz)) { +bool cCcD_CylAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const { + if (cM3dGCyl::Cross(triAttr, pxyz)) { return true; } else { return false; @@ -508,7 +519,7 @@ bool cCcD_CylAttr::CrossAtTg(cCcD_TriAttr const& triAttr, cXyz* p_xyz) const { /* 80264288-802642CC 25EBC8 0044+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_CylAttrPf */ -bool cCcD_CylAttr::CrossCo(cCcD_CylAttr const& other, f32* f) const { +bool cCcD_CylAttr::CrossCo(const cCcD_CylAttr& other, f32* f) const { if (cM3dGCyl::Cross(&other, f)) { return true; } else { @@ -518,7 +529,7 @@ bool cCcD_CylAttr::CrossCo(cCcD_CylAttr const& other, f32* f) const { /* 802642CC-80264310 25EC0C 0044+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_SphAttrPf */ -bool cCcD_CylAttr::CrossCo(cCcD_SphAttr const& sphAttr, f32* f) const { +bool cCcD_CylAttr::CrossCo(const cCcD_SphAttr& sphAttr, f32* f) const { if (cM3dGCyl::Cross(&sphAttr, f)) { return true; } else { @@ -528,7 +539,7 @@ bool cCcD_CylAttr::CrossCo(cCcD_SphAttr const& sphAttr, f32* f) const { /* 80264310-80264368 25EC50 0058+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_CpsAttrPf */ -bool cCcD_CylAttr::CrossCo(cCcD_CpsAttr const& cpsAttr, f32* f) const { +bool cCcD_CylAttr::CrossCo(const cCcD_CpsAttr& cpsAttr, f32* f) const { *f = 0.0f; cXyz xyz; if (cM3dGCyl::Cross(&cpsAttr, &xyz)) { @@ -542,26 +553,26 @@ bool cCcD_CylAttr::CrossCo(cCcD_CpsAttr const& cpsAttr, f32* f) const { void cCcD_CylAttr::CalcAabBox() { cXyz min; cXyz max; - min.x = mCenter.x - mRadius; - min.y = mCenter.y; - min.z = mCenter.z - mRadius; - max.x = mCenter.x + mRadius; - max.y = mCenter.y + mHeight; - max.z = mCenter.z + mRadius; + min.x = GetCP()->x - GetR(); + min.y = GetCP()->y; + min.z = GetCP()->z - GetR(); + max.x = GetCP()->x + GetR(); + max.y = GetCP()->y + GetH(); + max.z = GetCP()->z + GetR(); mAab.Set(&min, &max); } /* 802643D0-802644B8 25ED10 00E8+00 1/0 1/0 0/0 .text GetNVec__12cCcD_CylAttrCFRC4cXyzP4cXyz */ -bool cCcD_CylAttr::GetNVec(cXyz const& param_0, cXyz* param_1) const { +bool cCcD_CylAttr::GetNVec(const cXyz& param_0, cXyz* param_1) const { Vec vec; - if (mCenter.y > param_0.y) { + if (GetCP()->y > param_0.y) { vec = mCenter; } else { - if (mCenter.y + mHeight < param_0.y) { - vec.x = mCenter.x; - vec.y = mCenter.y; - vec.z = mCenter.z; - vec.y = mCenter.y + mHeight; + if (GetCP()->y + GetH() < param_0.y) { + vec.x = GetCP()->x; + vec.y = GetCP()->y; + vec.z = GetCP()->z; + vec.y = GetCP()->y + GetH(); } else { vec = mCenter; vec.y = param_0.y; @@ -581,23 +592,23 @@ bool cCcD_CylAttr::GetNVec(cXyz const& param_0, cXyz* param_1) const { /* 802644B8-802644EC 25EDF8 0034+00 1/0 1/0 0/0 .text * getShapeAccess__12cCcD_CylAttrCFPQ214cCcD_ShapeAttr5Shape */ -void cCcD_CylAttr::getShapeAccess(cCcD_ShapeAttr::Shape* p_shape) const { - p_shape->_0 = 1; - p_shape->_4 = mCenter.x; - p_shape->_8 = mCenter.y; - p_shape->_C = mCenter.z; - p_shape->_10 = mRadius; - p_shape->_14 = mHeight; +void cCcD_CylAttr::getShapeAccess(cCcD_ShapeAttr::Shape* pshape) const { + pshape->_0 = 1; + pshape->_4 = mCenter.x; + pshape->_8 = mCenter.y; + pshape->_C = mCenter.z; + pshape->_10 = mRadius; + pshape->_14 = mHeight; } -inline bool inlineCross(cM3dGSph const& sph, cM3dGCps const* p_cps, cXyz* p_xyz) { - return cM3d_Cross_CpsSph(*p_cps, sph, p_xyz); +inline bool inlineCross(const cM3dGSph& sph, const cM3dGCps* pcps, cXyz* pxyz) { + return cM3d_Cross_CpsSph(*pcps, sph, pxyz); } /* 802644EC-80264538 25EE2C 004C+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_SphAttrCFRC12cCcD_CpsAttrP4cXyz */ -bool cCcD_SphAttr::CrossAtTg(cCcD_CpsAttr const& cpsAttr, cXyz* p_xyz) const { - if (inlineCross(*this, &cpsAttr, p_xyz)) { +bool cCcD_SphAttr::CrossAtTg(const cCcD_CpsAttr& cpsAttr, cXyz* pxyz) const { + if (inlineCross(*this, &cpsAttr, pxyz)) { return true; } else { return false; @@ -606,8 +617,8 @@ bool cCcD_SphAttr::CrossAtTg(cCcD_CpsAttr const& cpsAttr, cXyz* p_xyz) const { /* 80264538-8026457C 25EE78 0044+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_SphAttrCFRC12cCcD_CylAttrP4cXyz */ -bool cCcD_SphAttr::CrossAtTg(cCcD_CylAttr const& cylAttr, cXyz* p_xyz) const { - if (cross(&cylAttr, p_xyz)) { +bool cCcD_SphAttr::CrossAtTg(const cCcD_CylAttr& cylAttr, cXyz* pxyz) const { + if (cross(&cylAttr, pxyz)) { return true; } else { return false; @@ -616,8 +627,8 @@ bool cCcD_SphAttr::CrossAtTg(cCcD_CylAttr const& cylAttr, cXyz* p_xyz) const { /* 8026457C-802645C0 25EEBC 0044+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_SphAttrCFRC12cCcD_SphAttrP4cXyz */ -bool cCcD_SphAttr::CrossAtTg(cCcD_SphAttr const& sphAttr, cXyz* p_xyz) const { - if (cross(&sphAttr, p_xyz)) { +bool cCcD_SphAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const { + if (cross(&sphAttr, pxyz)) { return true; } else { return false; @@ -626,8 +637,8 @@ bool cCcD_SphAttr::CrossAtTg(cCcD_SphAttr const& sphAttr, cXyz* p_xyz) const { /* 802645C0-802645F8 25EF00 0038+00 1/0 1/0 0/0 .text * CrossAtTg__12cCcD_SphAttrCFRC12cCcD_TriAttrP4cXyz */ -bool cCcD_SphAttr::CrossAtTg(cCcD_TriAttr const& triAttr, cXyz* p_xyz) const { - if (triAttr.cM3dGTri::Cross(*this, p_xyz)) { +bool cCcD_SphAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const { + if (triAttr.cM3dGTri::Cross(*this, pxyz)) { return true; } else { return false; @@ -636,7 +647,7 @@ bool cCcD_SphAttr::CrossAtTg(cCcD_TriAttr const& triAttr, cXyz* p_xyz) const { /* 802645F8-80264644 25EF38 004C+00 1/0 1/0 0/0 .text CrossCo__12cCcD_SphAttrCFRC12cCcD_CylAttrPf */ -bool cCcD_SphAttr::CrossCo(cCcD_CylAttr const& cylAttr, f32* f) const { +bool cCcD_SphAttr::CrossCo(const cCcD_CylAttr& cylAttr, f32* f) const { if (cM3dGSph::Cross(&cylAttr, f)) { return true; } else { @@ -646,7 +657,7 @@ bool cCcD_SphAttr::CrossCo(cCcD_CylAttr const& cylAttr, f32* f) const { /* 80264644-80264688 25EF84 0044+00 1/0 1/0 0/0 .text CrossCo__12cCcD_SphAttrCFRC12cCcD_SphAttrPf */ -bool cCcD_SphAttr::CrossCo(cCcD_SphAttr const& sphAttr, f32* f) const { +bool cCcD_SphAttr::CrossCo(const cCcD_SphAttr& sphAttr, f32* f) const { if (cM3dGSph::Cross(&sphAttr, f)) { return true; } else { @@ -656,7 +667,7 @@ bool cCcD_SphAttr::CrossCo(cCcD_SphAttr const& sphAttr, f32* f) const { /* 80264688-802646E0 25EFC8 0058+00 1/0 1/0 0/0 .text CrossCo__12cCcD_SphAttrCFRC12cCcD_CpsAttrPf */ -bool cCcD_SphAttr::CrossCo(cCcD_CpsAttr const& cpsAttr, f32* f) const { +bool cCcD_SphAttr::CrossCo(const cCcD_CpsAttr& cpsAttr, f32* f) const { *f = 0.0f; cXyz xyz; if (cM3dGSph::Cross(&cpsAttr, &xyz)) { @@ -671,22 +682,21 @@ void cCcD_SphAttr::CalcAabBox() { cXyz min; cXyz max; - min = max = mCenter; + min = max = *GetCP(); - // min -= mRadius; doesn't work :( - min.x -= mRadius; - min.y -= mRadius; - min.z -= mRadius; + min.x -= GetR(); + min.y -= GetR(); + min.z -= GetR(); - max.x += mRadius; - max.y += mRadius; - max.z += mRadius; + max.x += GetR(); + max.y += GetR(); + max.z += GetR(); mAab.Set(&min, &max); } /* 8026476C-80264808 25F0AC 009C+00 1/0 1/0 0/0 .text GetNVec__12cCcD_SphAttrCFRC4cXyzP4cXyz */ -bool cCcD_SphAttr::GetNVec(cXyz const& param_0, cXyz* param_1) const { +bool cCcD_SphAttr::GetNVec(const cXyz& param_0, cXyz* param_1) const { param_1->x = param_0.x - mCenter.x; param_1->y = param_0.y - mCenter.y; param_1->z = param_0.z - mCenter.z; @@ -704,13 +714,13 @@ bool cCcD_SphAttr::GetNVec(cXyz const& param_0, cXyz* param_1) const { /* 80264808-8026483C 25F148 0034+00 1/0 1/0 0/0 .text * getShapeAccess__12cCcD_SphAttrCFPQ214cCcD_ShapeAttr5Shape */ -void cCcD_SphAttr::getShapeAccess(cCcD_ShapeAttr::Shape* p_shape) const { - p_shape->_0 = 0; - p_shape->_4 = mCenter.x; - p_shape->_8 = mCenter.y; - p_shape->_C = mCenter.z; - p_shape->_10 = mRadius; - p_shape->_14 = 0.0f; +void cCcD_SphAttr::getShapeAccess(cCcD_ShapeAttr::Shape* pshape) const { + pshape->_0 = 0; + pshape->_4 = mCenter.x; + pshape->_8 = mCenter.y; + pshape->_C = mCenter.z; + pshape->_10 = mRadius; + pshape->_14 = 0.0f; } /* 8026483C-8026484C 25F17C 0010+00 0/0 1/1 0/0 .text SetHit__10cCcD_ObjAtFP8cCcD_Obj */ @@ -721,7 +731,7 @@ void cCcD_ObjAt::SetHit(cCcD_Obj* pObj) { /* 8026484C-80264868 25F18C 001C+00 1/1 0/0 0/0 .text Set__10cCcD_ObjAtFRC13cCcD_SrcObjAt */ -void cCcD_ObjAt::Set(cCcD_SrcObjAt const& src) { +void cCcD_ObjAt::Set(const cCcD_SrcObjAt& src) { cCcD_ObjCommonBase::Set(src.mBase); mType = src.mType; mAtp = src.mAtp; @@ -735,7 +745,7 @@ void cCcD_ObjAt::ClrHit() { /* 80264880-80264894 25F1C0 0014+00 1/1 0/0 0/0 .text Set__10cCcD_ObjTgFRC13cCcD_SrcObjTg */ -void cCcD_ObjTg::Set(cCcD_SrcObjTg const& src) { +void cCcD_ObjTg::Set(const cCcD_SrcObjTg& src) { cCcD_ObjCommonBase::Set(src.mBase); mType = src.mType; } diff --git a/libs/SSystem/SComponent/c_cc_s.cpp b/libs/SSystem/SComponent/c_cc_s.cpp index ee9f8296d9..6dc1fff27f 100644 --- a/libs/SSystem/SComponent/c_cc_s.cpp +++ b/libs/SSystem/SComponent/c_cc_s.cpp @@ -4,6 +4,12 @@ */ #include "SSystem/SComponent/c_cc_s.h" +#include "JSystem/JUtility/JUTAssert.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); /* 80264A6C-80264A94 25F3AC 0028+00 0/0 1/1 0/0 .text __ct__4cCcSFv */ cCcS::cCcS() {} @@ -50,27 +56,43 @@ WeightType cCcS::GetWt(u8 param_0) const { /* 80264BA8-80264C5C 25F4E8 00B4+00 0/0 7/7 454/454 .text Set__4cCcSFP8cCcD_Obj */ void cCcS::Set(cCcD_Obj* obj) { if (obj->ChkAtSet()) { - if (mObjAtCount < ARRAY_SIZE(mpObjAt)) { + if (mObjAtCount >= ARRAY_SIZE(mpObjAt)) { + OS_REPORT("\x1b[43;30m"); + OS_REPORT("cCcS::Set AT Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObjAt)); + OS_REPORT("\x1b[m"); + } else { mpObjAt[mObjAtCount] = obj; mObjAtCount++; } } if (obj->ChkTgSet()) { - if (mObjTgCount < ARRAY_SIZE(mpObjTg)) { + if (mObjTgCount >= ARRAY_SIZE(mpObjTg)) { + OS_REPORT("\x1b[43;30m"); + OS_REPORT("cCcS::Set TG Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObjTg)); + OS_REPORT("\x1b[m"); + } else { mpObjTg[mObjTgCount] = obj; mObjTgCount++; } } if (obj->ChkCoSet()) { - if (mObjCoCount < ARRAY_SIZE(mpObjCo)) { + if (mObjCoCount >= ARRAY_SIZE(mpObjCo)) { + OS_REPORT("\x1b[43;30m"); + OS_REPORT("cCcS::Set CO Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObjCo)); + OS_REPORT("\x1b[m"); + } else { mpObjCo[mObjCoCount] = obj; mObjCoCount++; } } - if (mObjCount < ARRAY_SIZE(mpObj)) { + if (mObjCount >= ARRAY_SIZE(mpObj)) { + OS_REPORT("\x1b[43;30m"); + OS_REPORT("cCcS::Set SET Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObj)); + OS_REPORT("\x1b[m"); + } else { mpObj[mObjCount] = obj; mObjCount++; } @@ -119,16 +141,17 @@ void cCcS::ClrAtHitInf() { } /* 80264E2C-80264F40 25F76C 0114+00 1/1 0/0 0/0 .text ChkNoHitAtTg__4cCcSFP8cCcD_ObjP8cCcD_Obj */ -bool cCcS::ChkNoHitAtTg(cCcD_Obj* obj1, cCcD_Obj* obj2) { - fopAc_ac_c* ac1 = obj1->GetAc(); - fopAc_ac_c* ac2 = obj2->GetAc(); - if ((ac1 != NULL && ac2 != NULL && ac1 == ac2) || (obj1->GetAtGrp() & obj2->GetTgGrp()) == 0 || - (obj1->GetAtType() & obj2->GetTgType()) == 0) +bool cCcS::ChkNoHitAtTg(cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj) { + fopAc_ac_c* pat_ac = pat_obj->GetAc(); + fopAc_ac_c* ptg_ac = ptg_obj->GetAc(); + if ((pat_ac != NULL && ptg_ac != NULL && pat_ac == ptg_ac) || + (pat_obj->GetAtGrp() & ptg_obj->GetTgGrp()) == 0 || + (pat_obj->GetAtType() & ptg_obj->GetTgType()) == 0) { - return 1; + return true; } else { - return ChkNoHitGAtTg(obj1->GetGObjInf(), obj2->GetGObjInf(), obj1->GetStts()->GetGStts(), - obj2->GetStts()->GetGStts()); + return ChkNoHitGAtTg(pat_obj->GetGObjInf(), ptg_obj->GetGObjInf(), + pat_obj->GetStts()->GetGStts(), ptg_obj->GetStts()->GetGStts()); } } @@ -137,48 +160,52 @@ void cCcS::ChkAtTg() { cCcD_Obj** objTgEnd = mpObjTg + mObjTgCount; ClrAtHitInf(); ClrTgHitInf(); - for (cCcD_Obj** pObjAt = mpObjAt; pObjAt < mpObjAt + mObjAtCount; ++pObjAt) { - if (*pObjAt == NULL || !(*pObjAt)->ChkAtSet()) + for (cCcD_Obj** pat_obj = mpObjAt; pat_obj < mpObjAt + mObjAtCount; ++pat_obj) { + if (*pat_obj == NULL || !(*pat_obj)->ChkAtSet()) continue; - cCcD_ShapeAttr* atShapeAttr = (*pObjAt)->GetShapeAttr(); - for (cCcD_Obj** pObjTg = mpObjTg; pObjTg < objTgEnd; ++pObjTg) { - if (*pObjTg == NULL || !(*pObjTg)->ChkTgSet()) + cCcD_ShapeAttr* pat_sa = (*pat_obj)->GetShapeAttr(); + JUT_ASSERT(pat_sa != 0); + + for (cCcD_Obj** ptg_obj = mpObjTg; ptg_obj < objTgEnd; ++ptg_obj) { + if (*ptg_obj == NULL || !(*ptg_obj)->ChkTgSet()) continue; - if (!(*pObjAt)->GetDivideInfo().Chk((*pObjTg)->GetDivideInfo())) + if (!(*pat_obj)->GetDivideInfo().Chk((*ptg_obj)->GetDivideInfo())) continue; - if (ChkNoHitAtTg(*pObjAt, *pObjTg)) + if (ChkNoHitAtTg(*pat_obj, *ptg_obj)) continue; - cCcD_ShapeAttr* tgShapeAttr = (*pObjTg)->GetShapeAttr(); + cCcD_ShapeAttr* ptg_sa = (*ptg_obj)->GetShapeAttr(); + JUT_ASSERT(ptg_sa != 0); static cXyz cross; - bool didCross = atShapeAttr->CrossAtTg(*tgShapeAttr, &cross); - bool anyBsRevHit = (*pObjAt)->ChkBsRevHit() || (*pObjTg)->ChkBsRevHit(); + bool didCross = pat_sa->CrossAtTg(*ptg_sa, &cross); + bool anyBsRevHit = (*pat_obj)->ChkBsRevHit() || (*ptg_obj)->ChkBsRevHit(); if (!anyBsRevHit && didCross) { - SetAtTgCommonHitInf(*pObjAt, *pObjTg, &cross); + SetAtTgCommonHitInf(*pat_obj, *ptg_obj, &cross); } else if (anyBsRevHit && !didCross) { - cCcD_ShapeAttr* atShape2 = (*pObjAt)->GetShapeAttr(); - if (atShape2 == NULL) { + cCcD_ShapeAttr* pat_sa = (*pat_obj)->GetShapeAttr(); + if (pat_sa == NULL) { cross.set(0.0f, 0.0f, 0.0f); } else { - atShape2->GetWorkAab().CalcCenter(&cross); + pat_sa->GetWorkAab().CalcCenter(&cross); } - SetAtTgCommonHitInf(*pObjAt, *pObjTg, &cross); + SetAtTgCommonHitInf(*pat_obj, *ptg_obj, &cross); } } } } /* 8026515C-80265230 25FA9C 00D4+00 1/1 0/0 0/0 .text ChkNoHitCo__4cCcSFP8cCcD_ObjP8cCcD_Obj */ -bool cCcS::ChkNoHitCo(cCcD_Obj* obj1, cCcD_Obj* obj2) { - fopAc_ac_c* ac1 = obj1->GetAc(); - fopAc_ac_c* ac2 = obj2->GetAc(); - if (!(((ac1 == NULL || ac2 == NULL) || ac1 != ac2 || obj1->ChkCoSameActorHit() || - obj2->ChkCoSameActorHit()) && - (obj1->GetCoIGrp() & (obj2->GetCoVsGrp() >> 3)) && - ((obj1->GetCoVsGrp() >> 3) & obj2->GetCoIGrp() && !ChkNoHitGCo(obj1, obj2)))) +bool cCcS::ChkNoHitCo(cCcD_Obj* pco1_obj, cCcD_Obj* pco2_obj) { + fopAc_ac_c* ac1 = pco1_obj->GetAc(); + fopAc_ac_c* ac2 = pco2_obj->GetAc(); + if (!(((ac1 == NULL || ac2 == NULL) || ac1 != ac2 || pco1_obj->ChkCoSameActorHit() || + pco2_obj->ChkCoSameActorHit()) && + (pco1_obj->GetCoIGrp() & (pco2_obj->GetCoVsGrp() >> 3)) && + ((pco1_obj->GetCoVsGrp() >> 3) & pco2_obj->GetCoIGrp() && + !ChkNoHitGCo(pco1_obj, pco2_obj)))) { return true; } else { @@ -193,25 +220,29 @@ void cCcS::ChkCo() { return; cCcD_Obj** objCoEnd = mpObjCo + mObjCoCount; - for (cCcD_Obj** objCo1 = mpObjCo; objCo1 < objCoEnd - 1; ++objCo1) { - if (*objCo1 == NULL || !(*objCo1)->ChkCoSet()) + for (cCcD_Obj** pco1_obj = mpObjCo; pco1_obj < objCoEnd - 1; ++pco1_obj) { + if (*pco1_obj == NULL || !(*pco1_obj)->ChkCoSet()) continue; - cCcD_ShapeAttr* co1ShapeAttr = (*objCo1)->GetShapeAttr(); - for (cCcD_Obj** objCo2 = objCo1 + 1; objCo2 < objCoEnd; ++objCo2) { - if (*objCo2 == NULL || !(*objCo2)->ChkCoSet()) + cCcD_ShapeAttr* pco1_sa = (*pco1_obj)->GetShapeAttr(); + JUT_ASSERT(pco1_sa != 0); + + for (cCcD_Obj** pco2_obj = pco1_obj + 1; pco2_obj < objCoEnd; ++pco2_obj) { + if (*pco2_obj == NULL || !(*pco2_obj)->ChkCoSet()) continue; - if (!(*objCo1)->GetDivideInfo().Chk((*objCo2)->GetDivideInfo())) + if (!(*pco1_obj)->GetDivideInfo().Chk((*pco2_obj)->GetDivideInfo())) continue; - if (ChkNoHitCo(*objCo1, *objCo2)) + if (ChkNoHitCo(*pco1_obj, *pco2_obj)) continue; - cCcD_ShapeAttr* co2ShapeAttr = (*objCo2)->GetShapeAttr(); - f32 crossLen; - if (co1ShapeAttr->CrossCo(*co2ShapeAttr, &crossLen)) { - cXyz& obj2CoCP = co2ShapeAttr->GetCoCP(); - cXyz& obj1CoCP = co1ShapeAttr->GetCoCP(); - SetCoCommonHitInf(*objCo1, &obj1CoCP, *objCo2, &obj2CoCP, crossLen); + cCcD_ShapeAttr* pco2_sa = (*pco2_obj)->GetShapeAttr(); + JUT_ASSERT(pco2_sa != 0); + + f32 cross_len; + if (pco1_sa->CrossCo(*pco2_sa, &cross_len)) { + cXyz& co2_center = pco2_sa->GetCoCP(); + cXyz& co1_center = pco1_sa->GetCoCP(); + SetCoCommonHitInf(*pco1_obj, &co1_center, *pco2_obj, &co2_center, cross_len); } } } @@ -219,76 +250,83 @@ void cCcS::ChkCo() { /* 802653A0-802653C8 25FCE0 0028+00 1/0 0/0 0/0 .text * CalcTgPlusDmg__4cCcSFP8cCcD_ObjP8cCcD_ObjP9cCcD_SttsP9cCcD_Stts */ -void cCcS::CalcTgPlusDmg(cCcD_Obj* obj1, cCcD_Obj* obj2, cCcD_Stts* stts1, cCcD_Stts* stts2) { - stts2->PlusDmg(obj1->GetAtAtp()); +void cCcS::CalcTgPlusDmg(cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj, cCcD_Stts* pat_stts, + cCcD_Stts* ptg_stts) { + ptg_stts->PlusDmg(pat_obj->GetAtAtp()); } /* 802653C8-802655E4 25FD08 021C+00 1/1 0/0 0/0 .text * SetAtTgCommonHitInf__4cCcSFP8cCcD_ObjP8cCcD_ObjP4cXyz */ -void cCcS::SetAtTgCommonHitInf(cCcD_Obj* obj1, cCcD_Obj* obj2, cXyz* pXyz) { - cCcD_Stts* obj1Stts = obj1->GetStts(); - cCcD_Stts* obj2Stts = obj2->GetStts(); - if (!ChkAtTgHitAfterCross(!obj2->ChkTgNoAtHitInfSet(), !obj1->ChkAtNoTgHitInfSet(), - obj1->GetGObjInf(), obj2->GetGObjInf(), obj1Stts, obj2Stts, - obj1Stts->GetGStts(), obj2Stts->GetGStts())) +void cCcS::SetAtTgCommonHitInf(cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj, cXyz* pcross) { + cCcD_Stts* pat_stts = pat_obj->GetStts(); + cCcD_Stts* ptg_stts = ptg_obj->GetStts(); + if (!ChkAtTgHitAfterCross(!ptg_obj->ChkTgNoAtHitInfSet(), !pat_obj->ChkAtNoTgHitInfSet(), + pat_obj->GetGObjInf(), ptg_obj->GetGObjInf(), pat_stts, ptg_stts, + pat_stts->GetGStts(), ptg_stts->GetGStts())) { - if (!obj2->ChkTgNoAtHitInfSet()) { - obj1->SetAtHit(obj2); + if (!ptg_obj->ChkTgNoAtHitInfSet()) { + pat_obj->SetAtHit(ptg_obj); } - bool tmp = !(obj1->ChkAtNoTgHitInfSet() || - (obj1->ChkAtType(AT_TYPE_SLINGSHOT) && obj2->ChkTgNoSlingHitInfSet())); + bool tmp = !(pat_obj->ChkAtNoTgHitInfSet() || + (pat_obj->ChkAtType(AT_TYPE_SLINGSHOT) && ptg_obj->ChkTgNoSlingHitInfSet())); if (tmp) { - obj2->SetTgHit(obj1); - CalcTgPlusDmg(obj1, obj2, obj1Stts, obj2Stts); + ptg_obj->SetTgHit(pat_obj); + CalcTgPlusDmg(pat_obj, ptg_obj, pat_stts, ptg_stts); } - SetAtTgGObjInf(!obj2->ChkTgNoAtHitInfSet(), tmp, obj1, obj2, obj1->GetGObjInf(), - obj2->GetGObjInf(), obj1Stts, obj2Stts, obj1Stts->GetGStts(), - obj2Stts->GetGStts(), pXyz); + SetAtTgGObjInf(!ptg_obj->ChkTgNoAtHitInfSet(), tmp, pat_obj, ptg_obj, pat_obj->GetGObjInf(), + ptg_obj->GetGObjInf(), pat_stts, ptg_stts, pat_stts->GetGStts(), + ptg_stts->GetGStts(), pcross); } } /* 802655E4-80265750 25FF24 016C+00 1/1 0/0 0/0 .text * SetCoCommonHitInf__4cCcSFP8cCcD_ObjP4cXyzP8cCcD_ObjP4cXyzf */ -void cCcS::SetCoCommonHitInf(cCcD_Obj* obj1, cXyz* xyz1, cCcD_Obj* obj2, cXyz* xyz2, f32 crossLen) { - bool obj2CoHitInfSet = !obj2->ChkCoNoCoHitInfSet(); - bool obj1CoHitInfSet = !obj1->ChkCoNoCoHitInfSet(); - if (obj2CoHitInfSet) { - obj1->SetCoHit(obj2); +void cCcS::SetCoCommonHitInf(cCcD_Obj* pco1_obj, cXyz* ppos1, cCcD_Obj* pco2_obj, cXyz* ppos2, + f32 cross_len) { + bool co2_inf_set = !pco2_obj->ChkCoNoCoHitInfSet(); + bool co1_inf_set = !pco1_obj->ChkCoNoCoHitInfSet(); + if (co2_inf_set) { + pco1_obj->SetCoHit(pco2_obj); } - if (obj1CoHitInfSet) { - obj2->SetCoHit(obj1); + if (co1_inf_set) { + pco2_obj->SetCoHit(pco1_obj); } - if (obj2CoHitInfSet && obj1CoHitInfSet) { - SetPosCorrect(obj1, xyz1, obj2, xyz2, crossLen); + if (co2_inf_set && co1_inf_set) { + SetPosCorrect(pco1_obj, ppos1, pco2_obj, ppos2, cross_len); } - cCcD_Stts* obj1Stts = obj1->GetStts(); - cCcD_Stts* obj2Stts = obj2->GetStts(); - SetCoGObjInf(obj2CoHitInfSet, obj1CoHitInfSet, obj1->GetGObjInf(), obj2->GetGObjInf(), obj1Stts, - obj2Stts, obj1Stts->GetGStts(), obj2Stts->GetGStts()); + cCcD_Stts* pco1_stts = pco1_obj->GetStts(); + cCcD_Stts* pco2_stts = pco2_obj->GetStts(); + SetCoGObjInf(co2_inf_set, co1_inf_set, pco1_obj->GetGObjInf(), pco2_obj->GetGObjInf(), + pco1_stts, pco2_stts, pco1_stts->GetGStts(), pco2_stts->GetGStts()); } /* 80265750-80265BB4 260090 0464+00 1/0 0/0 0/0 .text * SetPosCorrect__4cCcSFP8cCcD_ObjP4cXyzP8cCcD_ObjP4cXyzf */ -void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* xyz1, cCcD_Obj* obj2, cXyz* xyz2, f32 crossLen) { - if (obj1->ChkCoNoCrr() || obj2->ChkCoNoCrr()) +void cCcS::SetPosCorrect(cCcD_Obj* pco1_obj, cXyz* ppos1, cCcD_Obj* pco2_obj, cXyz* ppos2, + f32 cross_len) { + CHECK_FLOAT_CLASS(616, cross_len); + CHECK_FLOAT_RANGE(617, cross_len); + + if (pco1_obj->ChkCoNoCrr() || pco2_obj->ChkCoNoCrr()) return; - if (obj1->GetStts() == NULL || obj2->GetStts() == NULL) + if (pco1_obj->GetStts() == NULL || pco2_obj->GetStts() == NULL) return; - if (obj1->GetStts()->GetAc() != NULL && obj1->GetStts()->GetAc() == obj2->GetStts()->GetAc()) + if (pco1_obj->GetStts()->GetAc() != NULL && + pco1_obj->GetStts()->GetAc() == pco2_obj->GetStts()->GetAc()) return; - if (!(fabsf(crossLen) < (1.0f / 125.0f))) { - SetCoGCorrectProc(obj1, obj2); - bool bothCoSph3DCrr = obj1->ChkCoSph3DCrr() && obj2->ChkCoSph3DCrr(); - WeightType obj1WeightType = GetWt(obj1->GetStts()->GetWeightUc()); - WeightType obj2WeightType = GetWt(obj2->GetStts()->GetWeightUc()); - f32 obj1SrcWeight = obj1->GetStts()->GetWeightF(); - f32 obj2SrcWeight = obj2->GetStts()->GetWeightF(); + if (!(fabsf(cross_len) < (1.0f / 125.0f))) { + SetCoGCorrectProc(pco1_obj, pco2_obj); + bool bothCoSph3DCrr = pco1_obj->ChkCoSph3DCrr() && pco2_obj->ChkCoSph3DCrr(); + WeightType obj1WeightType = GetWt(pco1_obj->GetStts()->GetWeightUc()); + WeightType obj2WeightType = GetWt(pco2_obj->GetStts()->GetWeightUc()); + f32 obj1SrcWeight = pco1_obj->GetStts()->GetWeightF(); + f32 obj2SrcWeight = pco2_obj->GetStts()->GetWeightF(); f32 combinedWeight = obj1SrcWeight + obj2SrcWeight; f32 obj2Weight, obj1Weight; @@ -328,54 +366,86 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* xyz1, cCcD_Obj* obj2, cXyz* xyz2, } f32 objDistLen; - Vec obj1Move; - Vec obj2Move; + Vec vec1; + Vec vec2; Vec objsDist; if (bothCoSph3DCrr) { - VECSubtract(xyz2, xyz1, &objsDist); + VECSubtract(ppos2, ppos1, &objsDist); objDistLen = VECMag(&objsDist); } else { - objsDist.x = xyz2->x - xyz1->x; + objsDist.x = ppos2->x - ppos1->x; objsDist.y = 0; - objsDist.z = xyz2->z - xyz1->z; + objsDist.z = ppos2->z - ppos1->z; objDistLen = sqrtf(objsDist.x * objsDist.x + objsDist.z * objsDist.z); } if (!cM3d_IsZero(objDistLen)) { if (bothCoSph3DCrr) { - VECScale(&objsDist, &objsDist, crossLen / objDistLen); + VECScale(&objsDist, &objsDist, cross_len / objDistLen); obj2Weight *= -1; - VECScale(&objsDist, &obj1Move, obj2Weight); - VECScale(&objsDist, &obj2Move, obj1Weight); + VECScale(&objsDist, &vec1, obj2Weight); + VECScale(&objsDist, &vec2, obj1Weight); } else { - f32 pushFactor = crossLen / objDistLen; + f32 pushFactor = cross_len / objDistLen; objsDist.x *= pushFactor; objsDist.z *= pushFactor; - obj1Move.x = -objsDist.x * obj2Weight; - obj1Move.y = 0; - obj1Move.z = -objsDist.z * obj2Weight; - obj2Move.x = objsDist.x * obj1Weight; - obj2Move.y = 0; - obj2Move.z = objsDist.z * obj1Weight; + vec1.x = -objsDist.x * obj2Weight; + vec1.y = 0; + vec1.z = -objsDist.z * obj2Weight; + vec2.x = objsDist.x * obj1Weight; + vec2.y = 0; + vec2.z = objsDist.z * obj1Weight; } } else { - obj1Move.y = 0; - obj1Move.z = 0; - obj2Move.y = 0; - obj2Move.z = 0; - if (!cM3d_IsZero(crossLen)) { - obj1Move.x = -crossLen * obj2Weight; - obj2Move.x = crossLen * obj1Weight; + vec1.y = 0; + vec1.z = 0; + vec2.y = 0; + vec2.z = 0; + if (!cM3d_IsZero(cross_len)) { + vec1.x = -cross_len * obj2Weight; + vec2.x = cross_len * obj1Weight; } else { - obj1Move.x = -obj2Weight; - obj2Move.x = obj1Weight; + vec1.x = -obj2Weight; + vec2.x = obj1Weight; } } - obj1->GetStts()->PlusCcMove(obj1Move.x, obj1Move.y, obj1Move.z); - obj2->GetStts()->PlusCcMove(obj2Move.x, obj2Move.y, obj2Move.z); - VECAdd(xyz1, &obj1Move, xyz1); - VECAdd(xyz2, &obj2Move, xyz2); + CHECK_FLOAT_CLASS(767, vec1.x); + CHECK_FLOAT_CLASS(768, vec1.y); + CHECK_FLOAT_CLASS(769, vec1.z); + + CHECK_FLOAT_CLASS(771, vec2.x); + CHECK_FLOAT_CLASS(772, vec2.y); + CHECK_FLOAT_CLASS(773, vec2.z); + + CHECK_FLOAT_RANGE(775, vec1.x); + CHECK_FLOAT_RANGE(776, vec1.y); + CHECK_FLOAT_RANGE(777, vec1.z); + + CHECK_FLOAT_RANGE(779, vec2.x); + CHECK_FLOAT_RANGE(780, vec2.y); + CHECK_FLOAT_RANGE(781, vec2.z); + + pco1_obj->GetStts()->PlusCcMove(vec1.x, vec1.y, vec1.z); + pco2_obj->GetStts()->PlusCcMove(vec2.x, vec2.y, vec2.z); + (*ppos1) += vec1; + (*ppos2) += vec2; + + CHECK_FLOAT_CLASS(790, ppos1->x); + CHECK_FLOAT_CLASS(791, ppos1->y); + CHECK_FLOAT_CLASS(792, ppos1->z); + + CHECK_FLOAT_CLASS(794, ppos2->x); + CHECK_FLOAT_CLASS(795, ppos2->y); + CHECK_FLOAT_CLASS(796, ppos2->z); + + CHECK_FLOAT_RANGE(798, ppos1->x); + CHECK_FLOAT_RANGE(799, ppos1->y); + CHECK_FLOAT_RANGE(800, ppos1->z); + + CHECK_FLOAT_RANGE(802, ppos2->x); + CHECK_FLOAT_RANGE(803, ppos2->y); + CHECK_FLOAT_RANGE(804, ppos2->z); } } @@ -383,20 +453,25 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* xyz1, cCcD_Obj* obj2, cXyz* xyz2, void cCcS::CalcArea() { cM3dGAab aab; aab.ClearForMinMax(); - for (cCcD_Obj** pObj = mpObj; pObj < mpObj + mObjCount; ++pObj) { - if (*pObj != NULL) { - cCcD_ShapeAttr* objShape = (*pObj)->GetShapeAttr(); - objShape->CalcAabBox(); - aab.SetMinMax(objShape->GetWorkAab()); + for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) { + if (*pset_obj != NULL) { + cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr(); + JUT_ASSERT(pset_sa != 0); + + pset_sa->CalcAabBox(); + aab.SetMinMax(pset_sa->GetWorkAab()); } } mDivideArea.SetArea(aab); - for (cCcD_Obj** pObj = mpObj; pObj < mpObj + mObjCount; ++pObj) { - if (*pObj != NULL) { - const cCcD_ShapeAttr* objShape = (*pObj)->GetShapeAttr(); - cCcD_DivideInfo* divideInfo = &(*pObj)->GetDivideInfo(); - mDivideArea.CalcDivideInfo(divideInfo, objShape->GetWorkAab(), (*pObj)->ChkBsRevHit()); + for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) { + if (*pset_obj != NULL) { + const cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr(); + JUT_ASSERT(pset_sa != 0); + + cCcD_DivideInfo* divideInfo = &(*pset_obj)->GetDivideInfo(); + mDivideArea.CalcDivideInfo(divideInfo, pset_sa->GetWorkAab(), + (*pset_obj)->ChkBsRevHit()); } } } @@ -439,41 +514,41 @@ void cCcS::DrawClear() { /* 80265DF4-80265DF8 260734 0004+00 1/0 1/0 0/0 .text * SetCoGCorrectProc__4cCcSFP8cCcD_ObjP8cCcD_Obj */ -void cCcS::SetCoGCorrectProc(cCcD_Obj* param_0, cCcD_Obj* param_1) {} +void cCcS::SetCoGCorrectProc(cCcD_Obj* pco1_obj, cCcD_Obj* pco2_obj) {} /* 80265DF8-80265DFC 260738 0004+00 1/0 0/0 0/0 .text * SetCoGObjInf__4cCcSFbbP12cCcD_GObjInfP12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GStts */ -void cCcS::SetCoGObjInf(bool param_0, bool param_1, cCcD_GObjInf* param_2, cCcD_GObjInf* param_3, - cCcD_Stts* param_4, cCcD_Stts* param_5, cCcD_GStts* param_6, - cCcD_GStts* param_7) {} +void cCcS::SetCoGObjInf(bool co2_set, bool co1_set, cCcD_GObjInf* pco1_gobj, + cCcD_GObjInf* pco2_gobj, cCcD_Stts* pco1_stts, cCcD_Stts* pco2_stts, + cCcD_GStts* pco1_gstts, cCcD_GStts* pco2_gstts) {} /* 80265DFC-80265E00 26073C 0004+00 1/0 0/0 0/0 .text * SetAtTgGObjInf__4cCcSFbbP8cCcD_ObjP8cCcD_ObjP12cCcD_GObjInfP12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GSttsP4cXyz */ -void cCcS::SetAtTgGObjInf(bool param_0, bool param_1, cCcD_Obj* param_2, cCcD_Obj* param_3, - cCcD_GObjInf* param_4, cCcD_GObjInf* param_5, cCcD_Stts* param_6, - cCcD_Stts* param_7, cCcD_GStts* param_8, cCcD_GStts* param_9, - cXyz* param_10) {} +void cCcS::SetAtTgGObjInf(bool param_0, bool param_1, cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj, + cCcD_GObjInf* pat_gobj, cCcD_GObjInf* ptg_gobj, cCcD_Stts* pat_stts, + cCcD_Stts* ptg_stts, cCcD_GStts* pat_gstts, cCcD_GStts* ptg_gstts, + cXyz* pcross) {} /* 80265E00-80265E08 260740 0008+00 1/0 0/0 0/0 .text * ChkNoHitGAtTg__4cCcSFPC12cCcD_GObjInfPC12cCcD_GObjInfP10cCcD_GSttsP10cCcD_GStts */ -bool cCcS::ChkNoHitGAtTg(cCcD_GObjInf const* param_0, cCcD_GObjInf const* param_1, - cCcD_GStts* param_2, cCcD_GStts* param_3) { +bool cCcS::ChkNoHitGAtTg(const cCcD_GObjInf* pat_gobj, const cCcD_GObjInf* ptg_gobj, + cCcD_GStts* pat_gstts, cCcD_GStts* ptg_gstts) { return false; } /* 80265E08-80265E10 260748 0008+00 1/0 0/0 0/0 .text * ChkAtTgHitAfterCross__4cCcSFbbPC12cCcD_GObjInfPC12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GStts */ -bool cCcS::ChkAtTgHitAfterCross(bool param_0, bool param_1, cCcD_GObjInf const* param_2, - cCcD_GObjInf const* param_3, cCcD_Stts* param_4, cCcD_Stts* param_5, - cCcD_GStts* param_6, cCcD_GStts* param_7) { +bool cCcS::ChkAtTgHitAfterCross(bool param_0, bool param_1, const cCcD_GObjInf* pat_gobj, + const cCcD_GObjInf* ptg_gobj, cCcD_Stts* pat_stts, cCcD_Stts* ptg_stts, + cCcD_GStts* pat_gstts, cCcD_GStts* ptg_gstts) { return false; } /* 80265E10-80265E18 260750 0008+00 1/0 0/0 0/0 .text ChkNoHitGCo__4cCcSFP8cCcD_ObjP8cCcD_Obj */ -bool cCcS::ChkNoHitGCo(cCcD_Obj* param_0, cCcD_Obj* param_1) { +bool cCcS::ChkNoHitGCo(cCcD_Obj* pco1_obj, cCcD_Obj* pco2_obj) { return false; } |
