diff --git a/configure.py b/configure.py index 5ee7ad4f883..29b97732080 100755 --- a/configure.py +++ b/configure.py @@ -684,7 +684,7 @@ config.libs = [ Object(MatchingFor(ALL_GCN), "d/actor/d_a_no_chg_room.cpp"), Object(NonMatching, "d/actor/d_a_npc.cpp"), Object(MatchingFor(ALL_GCN), "d/actor/d_a_npc_cd.cpp"), - Object(NonMatching, "d/actor/d_a_npc_cd2.cpp"), + Object(NonMatching, "d/actor/d_a_npc_cd2.cpp"), # stripped vtable order Object(MatchingFor(ALL_GCN), "d/actor/d_a_obj_item.cpp"), Object(MatchingFor(ALL_GCN), "d/d_insect.cpp"), Object(MatchingFor(ALL_GCN), "d/actor/d_a_obj_ss_base.cpp"), @@ -1836,7 +1836,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_horse"), ActorRel(NonMatching, "d_a_hozelda"), ActorRel(MatchingFor(ALL_GCN), "d_a_izumi_gate"), - ActorRel(NonMatching, "d_a_kago"), + ActorRel(MatchingFor(ALL_GCN), "d_a_kago"), ActorRel(MatchingFor(ALL_GCN), "d_a_kytag01"), ActorRel(MatchingFor(ALL_GCN), "d_a_kytag02"), ActorRel(MatchingFor(ALL_GCN), "d_a_kytag03"), diff --git a/include/SSystem/SComponent/c_bg_s_poly_info.h b/include/SSystem/SComponent/c_bg_s_poly_info.h index 1693b5e058b..a0fbf35aba0 100644 --- a/include/SSystem/SComponent/c_bg_s_poly_info.h +++ b/include/SSystem/SComponent/c_bg_s_poly_info.h @@ -23,8 +23,8 @@ public: virtual ~cBgS_PolyInfo(); - u16 GetPolyIndex() const { return mPolyIndex; } - u16 GetBgIndex() const { return mBgIndex; } + int GetPolyIndex() const { return mPolyIndex; } + int GetBgIndex() const { return mBgIndex; } }; // Size: 0x10 #endif /* C_BG_S_POLY_INFO_H */ diff --git a/include/d/actor/d_a_kago.h b/include/d/actor/d_a_kago.h index de886797ca4..eae761af121 100644 --- a/include/d/actor/d_a_kago.h +++ b/include/d/actor/d_a_kago.h @@ -228,35 +228,4 @@ private: STATIC_ASSERT(sizeof(daKago_c) == 0xBA4); -class daKago_HIO_c : public JORReflexible { -public: - /* 808495AC */ daKago_HIO_c(); - /* 80854A4C */ virtual ~daKago_HIO_c() {} - - void genMessage(JORMContext* ctx); - - /* 0x04 */ s8 mChild; - /* 0x08 */ f32 mRevoconUpDown; - /* 0x0C */ f32 mRevoconUpDownMax; - /* 0x10 */ f32 mRevoconLeftRight; - /* 0x14 */ f32 mRevoconLeftRightMax; - /* 0x18 */ f32 mBasicSize; - /* 0x1C */ f32 mFlightSpeed; - /* 0x20 */ f32 mFlightGroundAltitude; - /* 0x24 */ f32 mFlightCeilingAltitude; - /* 0x28 */ f32 mShadowDensity; - /* 0x2C */ f32 mDescentRateIncrement; - /* 0x30 */ f32 mAscentRateDecel; - /* 0x34 */ f32 mDashTime; - /* 0x38 */ f32 mDashTimeMultiplier; - /* 0x3C */ f32 mWallHitInvulnTime; - /* 0x40 */ f32 mDashCooldownTime; - /* 0x44 */ f32 mZOffset; - /* 0x48 */ f32 mZOffsetHori; - /* 0x4C */ u8 mAngleTrackingMode; - /* 0x50 */ f32 mYOffsetFromWaterSurface; - /* 0x54 */ f32 mWaterSplashTime; - /* 0x58 */ f32 mSplashGenTimeDuringDash; -}; - #endif /* D_A_KAGO_H */ diff --git a/include/d/d_bg_pc.h b/include/d/d_bg_pc.h index 0c696fe5800..bbf58c21caf 100644 --- a/include/d/d_bg_pc.h +++ b/include/d/d_bg_pc.h @@ -30,13 +30,13 @@ public: u32 getHSStick() const { return BGPC_CHECK_BIT(m_code.code0, 18); } u32 getBoomerangThrough() const { return BGPC_CHECK_BIT(m_code.code0, 19); } u32 getRopeThrough() const { return BGPC_CHECK_BIT(m_code.code0, 20); } - u32 getHorseNoEntry() const { return BGPC_CHECK_BIT(m_code.code0, 21) != 0; } + u32 getHorseNoEntry() const { return BGPC_CHECK_BIT(m_code.code0, 21); } u32 getShdwThrough() const { return BGPC_CHECK_BIT(m_code.code0, 22); } u32 getBombThrough() const { return BGPC_CHECK_BIT(m_code.code0, 23); } s32 getSpl() const { return BGPC_GET_BITS(m_code.code0, 24, 4); } u32 getMagnet() const { return BGPC_GET_BITS(m_code.code0, 28, 2); } u32 getUnderwaterRoof() const { return BGPC_CHECK_BIT(m_code.code0, 30); } - u32 getMonkeyBars() const { return BGPC_CHECK_BIT(m_code.code0, 31) != 0; } + u32 getMonkeyBars() const { return (m_code.code0 >> 31) & 1; } s32 getLinkNo() const { return BGPC_GET_BITS(m_code.code1, 0, 8); } s32 getWallCode() const { return BGPC_GET_BITS(m_code.code1, 8, 4); } diff --git a/include/d/d_bg_s_cap_poly.h b/include/d/d_bg_s_cap_poly.h index 37dc20a85c4..0cda04c7390 100644 --- a/include/d/d_bg_s_cap_poly.h +++ b/include/d/d_bg_s_cap_poly.h @@ -2,6 +2,7 @@ #define D_BG_D_BG_S_CAPT_POLY_H #include "d/d_bg_s_chk.h" +#include "SSystem/SComponent/c_m3d_g_aab.h" struct dBgS_CaptPoly; @@ -15,4 +16,4 @@ public: /* 0x48 */ CaptPolyCallback m_callback; }; -#endif \ No newline at end of file +#endif diff --git a/include/dol2asm.h b/include/dol2asm.h index 3b28a7740e2..3e0563cd6a7 100644 --- a/include/dol2asm.h +++ b/include/dol2asm.h @@ -72,15 +72,6 @@ #define nofralloc #endif -// floating-point constants -// TODO: move to different header -#define _HUGE_ENUF 1e+300 -#define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF)) -#define HUGE_VAL ((double)INFINITY) -#define HUGE_VALL ((long double)INFINITY) - -#define DOUBLE_INF HUGE_VAL - #pragma section ".dead" #pragma section ".ctors$10" #pragma section ".ctors$15" diff --git a/include/global.h b/include/global.h index f5f4b7e8e24..695513b9247 100644 --- a/include/global.h +++ b/include/global.h @@ -75,6 +75,14 @@ void* __memcpy(void*, const void*, int); #define SQUARE(x) ((x) * (x)) +// floating-point constants +#define _HUGE_ENUF 1e+300 +#define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF)) +#define HUGE_VAL ((double)INFINITY) +#define HUGE_VALL ((long double)INFINITY) +#define DOUBLE_INF HUGE_VAL +static const float INF = 2000000000.0f; + // hack to make strings with no references compile properly #define DEAD_STRING(s) OSReport(s) diff --git a/src/JSystem/JUtility/JUTException.cpp b/src/JSystem/JUtility/JUTException.cpp index d2ae28366c2..626da42e861 100644 --- a/src/JSystem/JUtility/JUTException.cpp +++ b/src/JSystem/JUtility/JUTException.cpp @@ -240,9 +240,9 @@ void JUTException::setFPException(u32 fpscr_enable_bits) { /* 802E22C4-802E2454 2DCC04 0190+00 1/1 0/0 0/0 .text showFloatSub__12JUTExceptionFif */ void JUTException::showFloatSub(int index, f32 value) { - if (fpclassify(value) == FP_NAN) { + if (isnan(value)) { sConsole->print_f("F%02d: Nan ", index); - } else if (fpclassify(value) == FP_INFINITE) { + } else if (isinf(value)) { if (__signbit(value)) { sConsole->print_f("F%02d:+Inf ", index); } else { diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/float.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/float.h index 3c3b15ec083..e03f7ee6174 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/float.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/float.h @@ -17,7 +17,7 @@ (sizeof(x) == sizeof(double)) ? __fpclassifyd((double)(x)) : \ __fpclassifyl((long double)(x)) ) #define signbit(x) ((sizeof(x) == sizeof(float)) ? __signbitf(x) : __signbitd(x)) -#define isfinite(x) ((fpclassify(x) > 2)) +#define isfinite(x) ((fpclassify(x) > FP_INFINITE)) #define isnan(x) (fpclassify(x) == FP_NAN) #define isinf(x) (fpclassify(x) == FP_INFINITE) diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h index 15465dc7a7e..b35f51a98ee 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h @@ -101,7 +101,7 @@ inline float sqrtf(float mag) { return mag * tmpd; } else if (mag < 0.0) { return NAN; - } else if (fpclassify(mag) == 1) { + } else if (isnan(mag)) { return NAN; } else { return mag; diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/ansi_fp.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/ansi_fp.c index 728100f7c98..eb751768cec 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/ansi_fp.c +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/ansi_fp.c @@ -522,7 +522,7 @@ void __num2dec_internal(decimal* d, double x) { d->sign = sign; d->exp = 0; d->sig.length = 1; - d->sig.text[0] = fpclassify(x) == 1 ? 'N' : 'I'; + d->sig.text[0] = isnan(x)? 'N' : 'I'; return; } @@ -570,4 +570,4 @@ void __num2dec(const decform* form, double x, decimal* d) { for (i = 0; i < d->sig.length; i++) { d->sig.text[i] += '0'; } -} \ No newline at end of file +} diff --git a/src/d/actor/d_a_alink.cpp b/src/d/actor/d_a_alink.cpp index 276c467de8f..816f6fc9082 100644 --- a/src/d/actor/d_a_alink.cpp +++ b/src/d/actor/d_a_alink.cpp @@ -1923,19 +1923,17 @@ void daAlink_c::setMatrixWorldAxisRot(MtxP param_0, s16 param_1, s16 param_2, s1 } /* 8009DD90-8009E7B8 0986D0 0A28+00 2/2 0/0 0/0 .text jointControll__9daAlink_cFi */ -// NONMATCHING - 0x20 bytes missing from stack at 0x58 (release)/0x60 (debug) int daAlink_c::jointControll(int param_0) { csXyz sp18(0, 0, 0); int var_r27 = 0; - mDoExt_MtxCalcOldFrame* temp = field_0x2060; - J3DTransformInfo* temp_r3 = temp->getOldFrameTransInfo(param_0); - J3DTransformInfo sp80 = *temp_r3; + J3DTransformInfo sp80; + J3DTransformInfo sp60 = *field_0x2060->getOldFrameTransInfo(param_0); Quaternion sp50; Quaternion sp40; Quaternion sp30; - Quaternion sp20 = *temp->getOldFrameQuaternion(param_0); + Quaternion sp20 = *field_0x2060->getOldFrameQuaternion(param_0); csXyz sp10(0, 1, 2); @@ -2114,7 +2112,7 @@ int daAlink_c::jointControll(int param_0) { spC = field_0x2060->getOldFrameQuaternion(param_0); } - mDoMtx_stack_c::transS(sp80.mTranslate.x, sp80.mTranslate.y, sp80.mTranslate.z); + mDoMtx_stack_c::transS(sp60.mTranslate.x, sp60.mTranslate.y, sp60.mTranslate.z); mDoMtx_stack_c::quatM(&sp20); mDoMtx_stack_c::inverse(); cMtx_concat(temp_r26, mDoMtx_stack_c::get(), J3DSys::mCurrentMtx); diff --git a/src/d/actor/d_a_alink_horse.inc b/src/d/actor/d_a_alink_horse.inc index 155be7a6a6c..6c5418de5e3 100644 --- a/src/d/actor/d_a_alink_horse.inc +++ b/src/d/actor/d_a_alink_horse.inc @@ -1027,7 +1027,7 @@ void daAlink_c::setBaseBoarAnime() { void daAlink_c::setBaseRideAnime() { if (checkHorseRide()) { daHorse_c* horse_p = dComIfGp_getHorseActor(); - daAlink_ANM sp8[2]; + daAlink_ANM sp8[3]; getBaseHorseAnime(sp8); setDoubleAnime(horse_p->getBlendRate(), 1.0f, 1.0f, sp8[0], sp8[1], 10, horse_p->getMorfFrame()); diff --git a/src/d/actor/d_a_kago.cpp b/src/d/actor/d_a_kago.cpp index ee1a2646600..ced730f1a73 100644 --- a/src/d/actor/d_a_kago.cpp +++ b/src/d/actor/d_a_kago.cpp @@ -22,6 +22,7 @@ #include "f_op/f_op_camera_mng.h" #include "f_op/f_op_overlap_mng.h" +namespace { /* 80854D4C-80854D8C 000000 0040+00 1/1 0/0 0/0 .data cc_sph_src__22@unnamed@d_a_kago_cpp@ */ static dCcD_SrcSph cc_sph_src = { { @@ -34,6 +35,38 @@ static dCcD_SrcSph cc_sph_src = { {{0.0f, 0.0f, 0.0f}, 80.0f} // mSph } // mSphAttr }; +}; // namespace + +class daKago_HIO_c : public JORReflexible { +public: + /* 808495AC */ daKago_HIO_c(); + /* 80854A4C */ virtual ~daKago_HIO_c() {} + + void genMessage(JORMContext* ctx); + + /* 0x04 */ s8 mChild; + /* 0x08 */ f32 mRevoconUpDown; + /* 0x0C */ f32 mRevoconUpDownMax; + /* 0x10 */ f32 mRevoconLeftRight; + /* 0x14 */ f32 mRevoconLeftRightMax; + /* 0x18 */ f32 mBasicSize; + /* 0x1C */ f32 mFlightSpeed; + /* 0x20 */ f32 mFlightGroundAltitude; + /* 0x24 */ f32 mFlightCeilingAltitude; + /* 0x28 */ f32 mShadowDensity; + /* 0x2C */ f32 mDescentRateIncrement; + /* 0x30 */ f32 mAscentRateDecel; + /* 0x34 */ f32 mDashTime; + /* 0x38 */ f32 mDashTimeMultiplier; + /* 0x3C */ f32 mWallHitInvulnTime; + /* 0x40 */ f32 mDashCooldownTime; + /* 0x44 */ f32 mZOffset; + /* 0x48 */ f32 mZOffsetHori; + /* 0x4C */ u8 mAngleTrackingMode; + /* 0x50 */ f32 mYOffsetFromWaterSurface; + /* 0x54 */ f32 mWaterSplashTime; + /* 0x58 */ f32 mSplashGenTimeDuringDash; +}; /* 808495AC-80849660 0000EC 00B4+00 1/1 0/0 0/0 .text __ct__12daKago_HIO_cFv */ daKago_HIO_c::daKago_HIO_c() { @@ -249,7 +282,6 @@ static u8 l_HIOInit; static daKago_HIO_c l_HIO; /* 80849BA8-8084A070 0006E8 04C8+00 4/4 0/0 0/0 .text checkGroundHeight__8daKago_cF4cXyzPf */ -// NONMATCHING - fpr regalloc f32 daKago_c::checkGroundHeight(cXyz i_pos, f32* o_step) { f32 retVal; @@ -366,7 +398,6 @@ f32 daKago_c::checkGroundHeight(cXyz i_pos, f32* o_step) { } /* 8084A070-8084A210 000BB0 01A0+00 4/4 0/0 0/0 .text checkRoofHeight__8daKago_cF4cXyz */ -// NONMATCHING - regalloc f32 daKago_c::checkRoofHeight(cXyz param_0) { f32 roofChkYVal = mRoofHeight; BOOL unkFlag1 = FALSE; diff --git a/src/d/actor/d_a_npc_cd2.cpp b/src/d/actor/d_a_npc_cd2.cpp index f20cb12f098..594495344ed 100644 --- a/src/d/actor/d_a_npc_cd2.cpp +++ b/src/d/actor/d_a_npc_cd2.cpp @@ -388,6 +388,8 @@ static anmTblPrm const l_btpTWTbl[30] = { l_resMATa2[1], -1, l_resWCNa2[1], 7, l_resWONa2[1], 7, l_resWGNa2[1], 7, l_resWANb2[1], 7, }; +// TODO: these four tables should be converted into proper structs instead of byte arrays + /* 803B6604-803B7DC4 013724 17C0+00 0/1 0/0 0/0 .data a_jntTbl_M$3910 */ #pragma push #pragma force_active on @@ -1391,8 +1393,10 @@ J3DAnmTransform* daNpcCd2_c::getAnmP(int param_1, int param_2) { break; } break; - case 4: - case 5: + case 6: + case 0x17: + case 0x1b: + case 0x1f: switch (param_2) { case 1: case 8: @@ -1416,11 +1420,11 @@ J3DAnmTransform* daNpcCd2_c::getAnmP(int param_1, int param_2) { break; } break; - case 6: - case 0x17: - case 0x1b: - case 0x1f: - switch (param_2) { + case 7: + case 0x18: + case 0x1c: + case 0x20: + switch (param_2) { case 1: case 8: a_anmNum = 0x20; @@ -1443,10 +1447,8 @@ J3DAnmTransform* daNpcCd2_c::getAnmP(int param_1, int param_2) { break; } break; - case 7: - case 0x18: - case 0x1c: - case 0x20: + case 4: + case 5: switch(param_2) { case 0: break; @@ -1489,6 +1491,17 @@ J3DAnmTransform* daNpcCd2_c::getAnmP(int param_1, int param_2) { case 0x14: case 0x15: switch(param_2) { + case 1: + case 2: + case 3: + case 4: + case 5: + case 8: + case 9: + case 10: + case 11: + case 12: + break; case 6: case 7: a_anmNum = 0x22; @@ -1883,21 +1896,13 @@ daTagEscape_c* daNpcCd2_c::getEscapeTag() { /* 80159818-801598E8 154158 00D0+00 0/0 0/0 5/5 .text checkFearSituation__10daNpcCd2_cFv */ -// NONMATCHING - r30 needs to be assigned to r4 and r5 bool daNpcCd2_c::checkFearSituation() { f32 dVar10 = fopAcM_GetPosition_p(this)->y - fopAcM_GetPosition_p(daPy_getPlayerActorClass())->y; - bool rv; - bool bVar5; - rv = false; - bVar5 = ((!mIsDarkWorld && daPy_py_c::checkNowWolf()) && dVar10 < 200.0f); - if (bVar5) { - f32 maxDist = pow(500.0f, 2.0f); - if (fopAcM_searchPlayerDistanceXZ2(this) < maxDist) { - rv = true; - } - } - return rv; + return !mIsDarkWorld && + daPy_py_c::checkNowWolf() && + dVar10 < 200.0f && + fopAcM_searchPlayerDistanceXZ2(this) < std::pow(500.0f, 2.0f); } /* 801598E8-8015994C 154228 0064+00 1/1 0/0 0/0 .text getNpcMdlDataP__10daNpcCd2_cFi */ diff --git a/src/d/actor/d_a_obj_carry.cpp b/src/d/actor/d_a_obj_carry.cpp index e71445a6e9d..937e860954c 100644 --- a/src/d/actor/d_a_obj_carry.cpp +++ b/src/d/actor/d_a_obj_carry.cpp @@ -3693,7 +3693,6 @@ bool daObjCarry_c::cc_damage_proc_kibako() { } /* 80476CE4-80476E04 007D64 0120+00 1/0 0/0 0/0 .text cc_damage_proc_ironball__12daObjCarry_cFv */ -// NONMATCHING - regalloc, equivalent bool daObjCarry_c::cc_damage_proc_ironball() { bool var_r26 = false; bool var_r27 = true; diff --git a/src/d/actor/d_a_obj_riverrock.cpp b/src/d/actor/d_a_obj_riverrock.cpp index 8b98955918a..ccf74d12997 100644 --- a/src/d/actor/d_a_obj_riverrock.cpp +++ b/src/d/actor/d_a_obj_riverrock.cpp @@ -341,10 +341,6 @@ int daObjRIVERROCK_c::Delete() { return 1; } -// /* 80CBD9C4-80CBDA0C 0013E4 0048+00 2/1 0/0 0/0 .text __dt__20daObjRIVERROCK_HIO_cFv */ -// daObjRIVERROCK_HIO_c::~daObjRIVERROCK_HIO_c() { -// } - /* 80CBDB44-80CBDB64 -00001 0020+00 1/0 0/0 0/0 .data l_daObjRIVERROCK_Method */ static actor_method_class l_daObjRIVERROCK_Method = { (process_method_func)daObjRIVERROCK_Create, diff --git a/src/d/actor/d_a_obj_swhang.cpp b/src/d/actor/d_a_obj_swhang.cpp index 0ec57e76d1d..4143ada5c71 100644 --- a/src/d/actor/d_a_obj_swhang.cpp +++ b/src/d/actor/d_a_obj_swhang.cpp @@ -12,8 +12,6 @@ #include "d/d_com_inf_game.h" #include "d/d_s_play.h" -// NONMATCHING - dEvLib_callback_c issues - /* 80CFD1DC-80CFD1F0 000000 0014+00 4/4 0/0 0/0 .rodata l_bmdIdx */ static u32 const l_bmdIdx[5] = { 4, 4, 4, 4, 4, diff --git a/src/d/d_bg_s.cpp b/src/d/d_bg_s.cpp index bfd2f7f952d..e5d497e06cf 100644 --- a/src/d/d_bg_s.cpp +++ b/src/d/d_bg_s.cpp @@ -537,11 +537,12 @@ s32 dBgS::GetRoomPathPntNo(cBgS_PolyInfo const& poly) { /* 80075080-800750D0 06F9C0 0050+00 0/0 2/2 0/0 .text GetGrpSoundId__4dBgSFRC13cBgS_PolyInfo */ int dBgS::GetGrpSoundId(cBgS_PolyInfo const& poly) { int bg_index = poly.GetBgIndex(); - if (m_chk_element[bg_index].ChkUsed()) { - return m_chk_element[bg_index].m_bgw_base_ptr->GetGrpSoundId(poly); + JUT_ASSERT(1761, 0 <= bg_index && bg_index < 256); + if (!m_chk_element[bg_index].ChkUsed()) { + return 0xFF; } - - return 0xFF; + dBgW_Base* r30 = m_chk_element[bg_index].m_bgw_base_ptr; + return r30->GetGrpSoundId(poly); } /* 800750D0-80075100 06FA10 0030+00 0/0 1/1 0/0 .text ChkGrpInf__4dBgSFRC13cBgS_PolyInfoUl */ @@ -576,21 +577,23 @@ s32 dBgS::GetRoomId(cBgS_PolyInfo const& poly) { * GetPolyAttackThrough__4dBgSFRC13cBgS_PolyInfo */ bool dBgS::GetPolyAttackThrough(cBgS_PolyInfo const& poly) { int bg_index = poly.GetBgIndex(); - if (m_chk_element[bg_index].ChkUsed()) { - return m_chk_element[bg_index].m_bgw_base_ptr->GetAttackThrough(poly.GetPolyIndex()) != 0; + JUT_ASSERT(1894, 0 <= bg_index && bg_index < 256); + if (!m_chk_element[bg_index].ChkUsed()) { + return false; } - - return false; + dBgW_Base* r30 = m_chk_element[bg_index].m_bgw_base_ptr; + return r30->GetAttackThrough(poly.GetPolyIndex()) != 0; } /* 800751F8-8007524C 06FB38 0054+00 0/0 1/1 0/0 .text ChkPolyHSStick__4dBgSFRC13cBgS_PolyInfo */ u32 dBgS::ChkPolyHSStick(cBgS_PolyInfo const& poly) { int bg_index = poly.GetBgIndex(); - if (m_chk_element[bg_index].ChkUsed()) { - return m_chk_element[bg_index].m_bgw_base_ptr->GetPolyHSStick(poly.GetPolyIndex()); + JUT_ASSERT(1912, 0 <= bg_index && bg_index < 256); + if (!m_chk_element[bg_index].ChkUsed()) { + return 0; } - - return 0; + dBgW_Base* r30 = m_chk_element[bg_index].m_bgw_base_ptr; + return r30->GetPolyHSStick(poly.GetPolyIndex()); } /* 8007524C-80075374 06FB8C 0128+00 0/0 1/1 0/0 .text WallCorrect__4dBgSFP9dBgS_Acch */ @@ -831,7 +834,7 @@ void dBgS_MoveBGProc_Trans(dBgW* i_bgw, void* i_actor_ptr, cBgS_PolyInfo const& /* 80075B84-80075BF4 0704C4 0070+00 0/0 1/1 2/2 .text * RideCallBack__4dBgSFRC13cBgS_PolyInfoP10fopAc_ac_c */ void dBgS::RideCallBack(cBgS_PolyInfo const& poly, fopAc_ac_c* param_1) { - u16 bg_index = poly.GetBgIndex(); + int bg_index = poly.GetBgIndex(); dBgW_Base* base = m_chk_element[bg_index].m_bgw_base_ptr; if (base->ChkUsed()) { base->CallRideCallBack(m_chk_element[bg_index].m_actor_ptr, param_1); @@ -841,7 +844,7 @@ void dBgS::RideCallBack(cBgS_PolyInfo const& poly, fopAc_ac_c* param_1) { /* 80075BF4-80075C6C 070534 0078+00 0/0 0/0 2/2 .text * ArrowStickCallBack__4dBgSFRC13cBgS_PolyInfoP10fopAc_ac_cR4cXyz */ void dBgS::ArrowStickCallBack(cBgS_PolyInfo const& poly, fopAc_ac_c* param_1, cXyz& param_2) { - u16 bg_index = poly.GetBgIndex(); + int bg_index = poly.GetBgIndex(); dBgW_Base* base = m_chk_element[bg_index].m_bgw_base_ptr; if (base->ChkUsed()) { base->CallArrowStickCallBack(m_chk_element[bg_index].m_actor_ptr, param_1, param_2); @@ -852,18 +855,18 @@ void dBgS::ArrowStickCallBack(cBgS_PolyInfo const& poly, fopAc_ac_c* param_1, cX * PushPullCallBack__4dBgSFRC13cBgS_PolyInfoP10fopAc_ac_csQ29dBgW_Base13PushPullLabel */ fopAc_ac_c* dBgS::PushPullCallBack(cBgS_PolyInfo const& param_0, fopAc_ac_c* i_pushActor, s16 i_angle, dBgW_Base::PushPullLabel i_label) { - u16 bg_index = param_0.GetBgIndex(); + int bg_index = param_0.GetBgIndex(); dBgW_Base* base = m_chk_element[bg_index].m_bgw_base_ptr; if (!base->ChkUsed()) { - return false; + return NULL; } if (m_chk_element[bg_index].m_actor_ptr == NULL) { - return false; + return NULL; } if (base->GetPushPullCallback() == NULL) { - return false; + return NULL; } return base->GetPushPullCallback()(m_chk_element[bg_index].m_actor_ptr, i_pushActor, i_angle, diff --git a/src/d/d_bg_s_acch.cpp b/src/d/d_bg_s_acch.cpp index e071ae90bdc..f5cd7691af1 100644 --- a/src/d/d_bg_s_acch.cpp +++ b/src/d/d_bg_s_acch.cpp @@ -328,9 +328,9 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { JUT_ASSERT(792, pm_pos != NULL); JUT_ASSERT(793, pm_old_pos != NULL); - JUT_ASSERT(833, fpclassify(pm_pos->x) == 1); - JUT_ASSERT(834, fpclassify(pm_pos->y) == 1); - JUT_ASSERT(835, fpclassify(pm_pos->z) == 1); + JUT_ASSERT(833, !isnan(pm_pos->x)); + JUT_ASSERT(834, !isnan(pm_pos->y)); + JUT_ASSERT(835, !isnan(pm_pos->z)); JUT_ASSERT(837, -1.0e32f < pm_pos->x && pm_pos->x < 1.0e32f); JUT_ASSERT(838, -1.0e32f < pm_pos->y); @@ -405,7 +405,7 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { m_roof_height = i_bgs.RoofChk(&m_roof); if (m_roof_height != G_CM3D_F_INF) { - f32 y = GetPos()->y; + f32 y = pm_pos->y; if (y + m_roof_crr_height > m_roof_height) { field_0xcc = m_roof_height - m_roof_crr_height; @@ -419,8 +419,8 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { GroundCheck(i_bgs); GroundRoofProc(i_bgs); } else { - if (field_0xcc < GetPos()->y) { - GetPos()->y = field_0xcc; + if (field_0xcc < pm_pos->y) { + pm_pos->y = field_0xcc; } } @@ -430,42 +430,53 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { m_wtr.SetHeight(-G_CM3D_F_INF); f32 var_f29; - f32 var_f30; + f32 top; f32 temp_f1_5 = m_ground_h; if (temp_f1_5 == -G_CM3D_F_INF) { - var_f29 = GetPos()->y - 50.0f; + var_f29 = pm_pos->y - 50.0f; } else { var_f29 = temp_f1_5; } if (m_wtr_mode == 1) { - var_f30 = var_f29 + m_wtr_chk_offset; + top = var_f29 + m_wtr_chk_offset; } else { dBgS_RoofChk roof_chk; roof_chk.SetUnderwaterRoof(); roof_chk.SetPos(*pm_pos); - var_f30 = i_bgs.RoofChk(&roof_chk); - if (var_f30 == G_CM3D_F_INF) { - var_f30 = GetPos()->y + 1000000.0f; + top = i_bgs.RoofChk(&roof_chk); + if (top == G_CM3D_F_INF) { + top = pm_pos->y + 1000000.0f; } } - cXyz wtr_pos; - wtr_pos = *pm_pos; - wtr_pos.y = var_f29; + cXyz ground; + ground = *pm_pos; + ground.y = var_f29; - m_wtr.Set(wtr_pos, var_f30); + m_wtr.Set(ground, top); m_wtr.SetPassChkInfo(*this); if (i_bgs.WaterChk(&m_wtr)) { SetWaterHit(); - if (m_wtr.GetHeight() > GetPos()->y) { + if (m_wtr.GetHeight() > pm_pos->y) { SetWaterIn(); } + + JUT_ASSERT(1095, m_wtr.GetHeight() >= ground.y); + JUT_ASSERT(1096, m_wtr.GetHeight() <= top); } } + + JUT_ASSERT(1124, !isnan(pm_pos->x)); + JUT_ASSERT(1125, !isnan(pm_pos->y)); + JUT_ASSERT(1126, !isnan(pm_pos->z)); + + JUT_ASSERT(1128, -1.0e32f < pm_pos->x && pm_pos->x < 1.0e32f); + JUT_ASSERT(1129, -1.0e32f < pm_pos->y && pm_pos->y < 1.0e32f); + JUT_ASSERT(1130, -1.0e32f < pm_pos->z && pm_pos->z < 1.0e32f); } } diff --git a/src/d/d_bg_s_lin_chk.cpp b/src/d/d_bg_s_lin_chk.cpp index bb5e75b74ae..5e8a7547fa9 100644 --- a/src/d/d_bg_s_lin_chk.cpp +++ b/src/d/d_bg_s_lin_chk.cpp @@ -10,8 +10,6 @@ #define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f); -static const f32 INF = 2000000000.0f; - /* 80077C68-80077CDC 0725A8 0074+00 8/8 3/3 388/388 .text __ct__11dBgS_LinChkFv */ dBgS_LinChk::dBgS_LinChk() { SetPolyPassChk(GetPolyPassChkInfo()); diff --git a/src/d/d_bg_w.cpp b/src/d/d_bg_w.cpp index 216c42c63ae..ac30796b4dc 100644 --- a/src/d/d_bg_w.cpp +++ b/src/d/d_bg_w.cpp @@ -839,7 +839,7 @@ void cBgW::GetTrans(cXyz* o_trans) const { /* 8007B1B4-8007B240 075AF4 008C+00 2/0 1/0 0/0 .text * GetTriPnt__4cBgWCFRC13cBgS_PolyInfoP4cXyzP4cXyzP4cXyz */ bool cBgW::GetTriPnt(cBgS_PolyInfo const& poly, cXyz* o_pntA, cXyz* o_pntB, cXyz* o_pntC) const { - u16 poly_index = poly.GetPolyIndex(); + int poly_index = poly.GetPolyIndex(); cBgD_Tri_t* tri = &pm_bgd->m_t_tbl[poly_index]; o_pntA->set(pm_vtx_tbl[tri->m_vtx_idx0]); @@ -857,7 +857,8 @@ void cBgW::GetTopUnder(f32* o_top, f32* o_under) const { /* 8007B270-8007B2B0 075BB0 0040+00 2/0 1/0 0/0 .text GetTriPla__4cBgWCFRC13cBgS_PolyInfo */ cM3dGPla cBgW::GetTriPla(cBgS_PolyInfo const& poly) const { - u16 poly_index = poly.GetPolyIndex(); + int poly_index = poly.GetPolyIndex(); + JUT_ASSERT(1956, 0 <= poly_index && poly_index < pm_bgd->m_t_num); return pm_tri[poly_index].m_plane; } @@ -1256,8 +1257,8 @@ bool dBgW::RwgWallCorrect(dBgS_Acch* pwi, u16 i_poly_idx) { if (spE0 < spE4) { if (!(spE0 > spDC) && !(fabsf(spE0 - spDC) < 0.008f)) { - JUT_ASSERT(0, !(fpclassify(cx0) == 1)); - JUT_ASSERT(0, !(fpclassify(cy0) == 1)); + JUT_ASSERT(0, !isnan(cx0)); + JUT_ASSERT(0, !isnan(cy0)); f32 spF0, spF4; cM2d_CrossCirLin(*pwi->GetWallCirP(cir_index), cx0, cy0, @@ -1265,8 +1266,8 @@ bool dBgW::RwgWallCorrect(dBgS_Acch* pwi, u16 i_poly_idx) { pwi->GetPos()->x += cx0 - spF0; pwi->GetPos()->z += cy0 - spF4; - JUT_ASSERT(0, !(fpclassify(pwi->GetPos()->x) == 1)); - JUT_ASSERT(0, !(fpclassify(pwi->GetPos()->z) == 1)); + JUT_ASSERT(0, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0, !isnan(pwi->GetPos()->z)); pwi->CalcMovePosWork(); pwi->SetWallCirHit(cir_index); @@ -1278,8 +1279,8 @@ bool dBgW::RwgWallCorrect(dBgS_Acch* pwi, u16 i_poly_idx) { pwi->SetWallHit(); } } else if (!(spE4 > spDC) && !(fabsf(spE4 - spDC) < 0.008f)) { - JUT_ASSERT(0, !(fpclassify(cx1) == 1)); - JUT_ASSERT(0, !(fpclassify(cy1) == 1)); + JUT_ASSERT(0, !isnan(cx1)); + JUT_ASSERT(0, !isnan(cy1)); f32 spF8, spFC; cM2d_CrossCirLin(*pwi->GetWallCirP(cir_index), cx1, cy1, @@ -1287,8 +1288,8 @@ bool dBgW::RwgWallCorrect(dBgS_Acch* pwi, u16 i_poly_idx) { pwi->GetPos()->x += cx1 - spF8; pwi->GetPos()->z += cy1 - spFC; - JUT_ASSERT(0, !(fpclassify(pwi->GetPos()->x) == 1)); - JUT_ASSERT(0, !(fpclassify(pwi->GetPos()->z) == 1)); + JUT_ASSERT(0, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0, !isnan(pwi->GetPos()->z)); pwi->CalcMovePosWork(); pwi->SetWallCirHit(cir_index); @@ -1693,8 +1694,8 @@ bool dBgW::WallCorrectSort(dBgS_Acch* pwi) { if (spE0 < spE4) { if (!(spE0 > spDC) && !(fabsf(spE0 - spDC) < 0.008f)) { - JUT_ASSERT(0, !(fpclassify(cx0) == 1)); - JUT_ASSERT(0, !(fpclassify(cy0) == 1)); + JUT_ASSERT(0, !isnan(cx0)); + JUT_ASSERT(0, !isnan(cy0)); f32 spF0, spF4; cM2d_CrossCirLin(*pwi->GetWallCirP(cir_index), cx0, cy0, @@ -1702,8 +1703,8 @@ bool dBgW::WallCorrectSort(dBgS_Acch* pwi) { pwi->GetPos()->x += cx0 - spF0; pwi->GetPos()->z += cy0 - spF4; - JUT_ASSERT(0, !(fpclassify(pwi->GetPos()->x) == 1)); - JUT_ASSERT(0, !(fpclassify(pwi->GetPos()->z) == 1)); + JUT_ASSERT(0, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0, !isnan(pwi->GetPos()->z)); pwi->CalcMovePosWork(); pwi->SetWallCirHit(cir_index); @@ -1715,8 +1716,8 @@ bool dBgW::WallCorrectSort(dBgS_Acch* pwi) { pwi->SetWallHit(); } } else if (!(spE4 > spDC) && !(fabsf(spE4 - spDC) < 0.008f)) { - JUT_ASSERT(0, !(fpclassify(cx1) == 1)); - JUT_ASSERT(0, !(fpclassify(cy1) == 1)); + JUT_ASSERT(0, !isnan(cx1)); + JUT_ASSERT(0, !isnan(cy1)); f32 spF8, spFC; cM2d_CrossCirLin(*pwi->GetWallCirP(cir_index), cx1, cy1, onx, @@ -1724,8 +1725,8 @@ bool dBgW::WallCorrectSort(dBgS_Acch* pwi) { pwi->GetPos()->x += cx1 - spF8; pwi->GetPos()->z += cy1 - spFC; - JUT_ASSERT(0, !(fpclassify(pwi->GetPos()->x) == 1)); - JUT_ASSERT(0, !(fpclassify(pwi->GetPos()->z) == 1)); + JUT_ASSERT(0, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0, !isnan(pwi->GetPos()->z)); pwi->CalcMovePosWork(); pwi->SetWallCirHit(cir_index); diff --git a/src/d/d_bg_w_kcol.cpp b/src/d/d_bg_w_kcol.cpp index 59c3b8bdaf4..7fb27f18e04 100644 --- a/src/d/d_bg_w_kcol.cpp +++ b/src/d/d_bg_w_kcol.cpp @@ -154,7 +154,7 @@ cM3dGAab* dBgWKCol::GetBnd() const { /* 8007EB30-8007EB6C 079470 003C+00 1/0 0/0 0/0 .text GetGrpInf__8dBgWKColCFRC13cBgS_PolyInfo */ u32 dBgWKCol::GetGrpInf(const cBgS_PolyInfo& poly) const { - u16 poly_index = poly.GetPolyIndex(); + int poly_index = poly.GetPolyIndex(); KC_PrismData* pd = getPrismData(poly_index); return m_code.getGrpCode(pd->attribute); @@ -388,10 +388,10 @@ bool dBgWKCol::LineCheck(cBgS_LinChk* plinchk) { u32 block = (u32)m_pkc_head->m_block_data; u32 shift = m_pkc_head->m_block_width_shift; s32 offset = (((u32)z_sp40 >> shift) << m_pkc_head->m_area_xy_blocks_shift | - ((u32)y_sp3C >> shift) << m_pkc_head->m_area_x_blocks_shift | - (u32)x_sp38 >> shift) << 2; + ((u32)y_sp3C >> shift) << m_pkc_head->m_area_x_blocks_shift | + (u32)x_sp38 >> shift) << 2; - while (offset = *(u32*)(block + offset), offset >= 0) { + while ((offset = *(u32*)(block + offset)) >= 0) { block += offset; shift--; offset = (((u32)z_sp40 >> shift & 1) << 2 | @@ -510,26 +510,18 @@ bool dBgWKCol::LineCheck(cBgS_LinChk* plinchk) { *pcross = sp9C; sp120 = sp9C; - JUT_ASSERT(0x2e2, - fpclassify(pcross->x) != - FP_QNAN); - JUT_ASSERT(0x2e3, - fpclassify(pcross->y) != - FP_QNAN); - JUT_ASSERT(0x2e4, - fpclassify(pcross->z) != - FP_QNAN); - JUT_ASSERT( - 0x2e9, + JUT_ASSERT(738, !isnan(pcross->x)); + JUT_ASSERT(739, !isnan(pcross->y)); + JUT_ASSERT(740, !isnan(pcross->z)); + JUT_ASSERT(745, -FP_INFINITE < pcross->x && pcross->x < FP_INFINITE); - JUT_ASSERT( - 0x2eb, + JUT_ASSERT(747, -FP_INFINITE < pcross->y && pcross->y < FP_INFINITE); - // JUT_ASSERT(0x2ed, -FP_INFINITE < - // pcross->z && pcross->z < - // FP_INFINITE); + JUT_ASSERT(749, + -FP_INFINITE < pcross->z && + pcross->z < FP_INFINITE); plinchk->SetPolyIndex(sp28[0]); } @@ -562,7 +554,6 @@ bool dBgWKCol::LineCheck(cBgS_LinChk* plinchk) { /* 8007F628-8007F9A4 079F68 037C+00 1/0 0/0 0/0 .text GroundCross__8dBgWKColFP11cBgS_GndChk */ // NONMATCHING bool dBgWKCol::GroundCross(cBgS_GndChk* i_chk) { - KC_PrismData* sp18; cXyz* point_p = (cXyz*)&i_chk->GetPointP(); cXyz sp58; @@ -600,18 +591,18 @@ bool dBgWKCol::GroundCross(cBgS_GndChk* i_chk) { int sp20 = 4 * (((u32)sp34 >> shift) << m_pkc_head->m_area_xy_blocks_shift | ((u32)sp30 >> shift) << m_pkc_head->m_area_x_blocks_shift | (u32)sp38 >> shift); - while ((sp20 = (*(s32*)(block + sp20))), sp20 >= 0) { + while ((sp20 = (*(s32*)(block + sp20))) >= 0) { block += sp20; shift--; - sp20 = 4 * ((4 * ((u32)sp34 >> shift)) & 4 | - (2 * ((u32)sp30 >> shift)) & 2 | - (1 * ((u32)sp38 >> shift)) & 1); + sp20 = (((u32)sp34 >> shift & 1) << 2 | + ((u32)sp30 >> shift & 1) << 1 | + ((u32)sp38 >> shift & 1) << 0) << 2; } u16* sp1C = (u16*)(block + (sp20 & 0x7FFFFFFF)); while (*++sp1C != 0) { - sp18 = &m_pkc_head->m_prism_data[sp1C[0]]; + KC_PrismData* sp18 = getPrismData(sp1C[0]); Vec* sp14 = &m_pkc_head->m_nrm_data[sp18->fnrm_i]; if (!(sp14->y < 0.014f) && !cM3d_IsZero(sp14->y) && (!cBgW_CheckBWall(sp14->y) || i_chk->GetWallPrecheck())) { @@ -631,12 +622,12 @@ bool dBgWKCol::GroundCross(cBgS_GndChk* i_chk) { if (!chkPolyThrough(&sp64, i_chk->GetPolyPassChk(), i_chk->GetGrpPassChk(), sp40)) { f32 tmp_height_kcw = sp4C.y + sp10->y; - f32 now_y = i_chk->GetNowY(); - - if (now_y < tmp_height_kcw && point_p->y > tmp_height_kcw) { + if (i_chk->GetNowY() < tmp_height_kcw && point_p->y > tmp_height_kcw) { i_chk->SetPolyIndex(sp1C[0]); i_chk->SetNowY(tmp_height_kcw); var_r24 = 1; + JUT_ASSERT(934, !isnan(tmp_height_kcw)); + JUT_ASSERT(937, -INF < tmp_height_kcw && tmp_height_kcw < INF); sp2C = (u32)(tmp_height_kcw - m_pkc_head->m_area_min_pos.y); } } @@ -645,7 +636,9 @@ bool dBgWKCol::GroundCross(cBgS_GndChk* i_chk) { } } - sp30 &= ~((1 << shift) - 1); + shift = 1 << shift; + u32 sp0C = shift - 1; + sp30 &= ~sp0C; sp30--; } while (sp30 >= sp2C); @@ -900,7 +893,7 @@ bool dBgWKCol::ChkShdwDrawThrough(dBgPc* pcode) { /* 8007FF1C-80080330 07A85C 0414+00 1/0 0/0 0/0 .text CaptPoly__8dBgWKColFR13dBgS_CaptPoly */ // NONMATCHING void dBgWKCol::CaptPoly(dBgS_CaptPoly& i_captpoly) { - cM3dGAab* pbounds = i_captpoly.GetBndP(); + const cM3dGAab* pbounds = i_captpoly.GetBndP(); cXyz min(*pbounds->GetMinP()); cXyz max(*pbounds->GetMaxP()); @@ -972,13 +965,12 @@ void dBgWKCol::CaptPoly(dBgS_CaptPoly& i_captpoly) { 4 * (((u32)sp24 >> sp20) << m_pkc_head->m_area_xy_blocks_shift | ((u32)sp20 >> sp20) << m_pkc_head->m_area_x_blocks_shift | (u32)sp1C >> sp20); - while ((sp14 = (*(s32*)((s32)block_18 + sp14))), sp14 >= 0) { + while ((sp14 = (*(s32*)((s32)block_18 + sp14))) >= 0) { block_18 = (u16*)((s32)block_18 + sp14); sp20--; - - sp14 = 4 * ((4 * ((u32)sp24 >> sp20)) & 4 | - (2 * ((u32)sp20 >> sp20)) & 2 | - (1 * ((u32)sp1C >> sp20)) & 1); + sp14 = (((u32)sp24 >> sp20 & 1) << 2 | + ((u32)sp20 >> sp20 & 1) << 1 | + ((u32)sp1C >> sp20 & 1) << 0) << 2; } block_18 = (u16*)((s32)block_18 + (sp14 & 0x7FFFFFFF)); @@ -1053,12 +1045,6 @@ struct wcs_data { static wcs_data l_wcsbuf[84]; -/* 80452730-80452738 000D30 0008+00 2/2 0/0 0/0 .sdata2 @5298 */ -SECTION_SDATA2 static f64 lit_5298 = 0.5f; - -/* 80452738-80452740 000D38 0008+00 2/2 0/0 0/0 .sdata2 @5299 */ -SECTION_SDATA2 static f64 lit_5299 = 3.0f; - /* 80452740-80452748 000D40 0008+00 2/2 0/0 0/0 .sdata2 @5300 */ SECTION_SDATA2 static u8 lit_5300[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1430,8 +1416,8 @@ bool dBgWKCol::WallCorrectSort(dBgS_Acch* pwi) { pwi->GetPos()->x += sp_38 * sp_98->x; pwi->GetPos()->z += sp_38 * sp_98->z; - JUT_ASSERT(0x77e, !(fpclassify(pwi->GetPos()->x) == FP_QNAN)); - JUT_ASSERT(0x77f, !(fpclassify(pwi->GetPos()->z) == FP_QNAN)); + JUT_ASSERT(0x77e, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0x77f, !isnan(pwi->GetPos()->z)); JUT_ASSERT(0x782, -INFINITY < pwi->GetPos()->x && pwi->GetPos()->x < INFINITY); JUT_ASSERT(0x784, -INFINITY < pwi->GetPos()->z && @@ -1474,8 +1460,8 @@ bool dBgWKCol::WallCorrectSort(dBgS_Acch* pwi) { f32 sp_1c; f32 sp_18; - JUT_ASSERT(0x7b3, !(fpclassify(cx0_60) == FP_QNAN)); - JUT_ASSERT(0x7b4, !(fpclassify(cy0_5c) == FP_QNAN)); + JUT_ASSERT(0x7b3, !isnan(cx0_60)); + JUT_ASSERT(0x7b4, !isnan(cy0_5c)); cM2d_CrossCirLin(*pwi->GetWallCirP(cir_index_8c), cx1_58, cy1_54, onx_2c, ony_28, &sp_1c, &sp_18); @@ -1483,8 +1469,8 @@ bool dBgWKCol::WallCorrectSort(dBgS_Acch* pwi) { pwi->GetPos()->x += (cx0_60 - sp_1c); pwi->GetPos()->z += (cy0_5c - sp_18); - JUT_ASSERT(0x7bf, !(fpclassify(pwi->GetPos()->x) == FP_QNAN)); - JUT_ASSERT(0x7c0, !(fpclassify(pwi->GetPos()->z) == FP_QNAN)); + JUT_ASSERT(0x7bf, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0x7c0, !isnan(pwi->GetPos()->z)); JUT_ASSERT(0x7c3, -INFINITY < pwi->GetPos()->x && pwi->GetPos()->x < INFINITY) JUT_ASSERT(0x7c5, -INFINITY < pwi->GetPos()->z && @@ -1500,21 +1486,21 @@ bool dBgWKCol::WallCorrectSort(dBgS_Acch* pwi) { } else if (!(sp_30 > sp_3c || fabsf(sp_30 - sp_3c) < 0.008f)) { f32 sp_1c; f32 sp_18; - JUT_ASSERT(0x7e2, !(fpclassify(cx1_58) == FP_QNAN)); - JUT_ASSERT(0x7e3, !(fpclassify(cy1_54) == FP_QNAN)); + JUT_ASSERT(0x7e2, !isnan(cx1_58)); + JUT_ASSERT(0x7e3, !isnan(cy1_54)); cM2d_CrossCirLin(*pwi->GetWallCirP(cir_index_8c), cx1_58, cy1_54, onx_2c, ony_28, &sp_1c, &sp_18); pwi->GetPos()->x += (cx1_58 - sp_1c); pwi->GetPos()->z += (cy1_54 - sp_18); - JUT_ASSERT(0x7ed, !(fpclassify(pwi->GetPos()->x) == FP_QNAN)); - JUT_ASSERT(0x7ed, !(fpclassify(pwi->GetPos()->z) == FP_QNAN)); + JUT_ASSERT(0x7ed, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0x7ed, !isnan(pwi->GetPos()->z)); - JUT_ASSERT(0x7f1, -INFINITY < pwi->GetPos()->x && - pwi->GetPos()->x < INFINITY) - JUT_ASSERT(0x7f1, -INFINITY < pwi->GetPos()->z && - pwi->GetPos()->z < INFINITY) + JUT_ASSERT(0x7f1, -INF < pwi->GetPos()->x && + pwi->GetPos()->x < INF) + JUT_ASSERT(0x7f1, -INF < pwi->GetPos()->z && + pwi->GetPos()->z < INF) pwi->CalcMovePosWork(); pwi->SetWallCirHit(cir_index_8c); @@ -1833,8 +1819,8 @@ bool dBgWKCol::WallCorrect(dBgS_Acch* pwi) { } pwi->GetPos()->x += sp38 * sp98->x; pwi->GetPos()->z += sp38 * sp98->z; - JUT_ASSERT(0x989, fpclassify(pwi->GetPos()->x) != FP_QNAN); - JUT_ASSERT(0x98a, fpclassify(pwi->GetPos()->z) != FP_QNAN); + JUT_ASSERT(0x989, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0x98a, !isnan(pwi->GetPos()->z)); JUT_ASSERT(0x98d, -INFINITY < pwi->GetPos()->x && pwi->GetPos()->x < INFINITY); JUT_ASSERT(0x98f, -INFINITY < pwi->GetPos()->z && pwi->GetPos()->z < INFINITY); pwi->CalcMovePosWork(); @@ -1861,16 +1847,16 @@ bool dBgWKCol::WallCorrect(dBgS_Acch* pwi) { continue; } - JUT_ASSERT(0x9be, !(fpclassify(cx0) == FP_QNAN)); - JUT_ASSERT(0x9bf, !(fpclassify(cy0) == FP_QNAN)); + JUT_ASSERT(0x9be, !isnan(cx0)); + JUT_ASSERT(0x9bf, !isnan(cy0)); f32 sp24; f32 sp20; cM2d_CrossCirLin(*pwi->GetWallCirP(sp8C), cx0, cy0, onx, ony, &sp24, &sp20); pwi->GetPos()->x += cx0 - sp24; pwi->GetPos()->z += cy0 - sp20; - JUT_ASSERT(0x9d1, !(fpclassify(pwi->GetPos()->x) == FP_QNAN)); - JUT_ASSERT(0x9d2, !(fpclassify(pwi->GetPos()->z) == FP_QNAN)); + JUT_ASSERT(0x9d1, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0x9d2, !isnan(pwi->GetPos()->z)); JUT_ASSERT(0x9d5, -INFINITY < pwi->GetPos()->x && pwi->GetPos()->x < INFINITY); @@ -1889,16 +1875,16 @@ bool dBgWKCol::WallCorrect(dBgS_Acch* pwi) { continue; } - JUT_ASSERT(0x9f4, !(fpclassify(cx1) == FP_QNAN)); - JUT_ASSERT(0x9f5, !(fpclassify(cy1) == FP_QNAN)); + JUT_ASSERT(0x9f4, !isnan(cx1)); + JUT_ASSERT(0x9f5, !isnan(cy1)); f32 sp1C; f32 sp18; cM2d_CrossCirLin(*pwi->GetWallCirP(sp8C), cx1, cy1, onx, ony, &sp1C, &sp18); pwi->GetPos()->x += cx1 - sp1C; pwi->GetPos()->z += cy1 - sp18; - JUT_ASSERT(0xa06, !(fpclassify(pwi->GetPos()->x) == FP_QNAN)); - JUT_ASSERT(0xa07, !(fpclassify(pwi->GetPos()->z) == FP_QNAN)); + JUT_ASSERT(0xa06, !isnan(pwi->GetPos()->x)); + JUT_ASSERT(0xa07, !isnan(pwi->GetPos()->z)); JUT_ASSERT(0xa0a, -INFINITY < pwi->GetPos()->x && pwi->GetPos()->x < INFINITY); @@ -2028,7 +2014,7 @@ bool dBgWKCol::RoofChk(dBgS_RoofChk* param_0) { param_0->SetPolyIndex(*sp20); param_0->SetNowY(tmp_height_kcw); sp0A = true; - JUT_ASSERT(0xac8, fpclassify(tmp_height_kcw) != FP_QNAN); + JUT_ASSERT(0xac8, !isnan(tmp_height_kcw)); JUT_ASSERT(0xacb, -FP_INFINITE < tmp_height_kcw && tmp_height_kcw < FP_INFINITE); bool sp08 = true; if (!(tmp_height_kcw - m_pkc_head->m_area_min_pos.y >= 0.0f)) { @@ -2148,7 +2134,7 @@ bool dBgWKCol::SplGrpChk(dBgS_SplGrpChk* param_0) { sp09 = true; - JUT_ASSERT(0xb73, fpclassify(tmp_height_kcw) != FP_QNAN); + JUT_ASSERT(0xb73, !isnan(tmp_height_kcw)); JUT_ASSERT(0xb76, -FP_INFINITE < tmp_height_kcw && tmp_height_kcw < FP_INFINITE); } diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index b2239a9c4e5..1e20a11c2b0 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -9947,15 +9947,15 @@ static void store(camera_process_class* i_camera) { error = true; OS_REPORT("camera: ERROR: bad direction !!\n"); } - if (fovy < 0.0f || fpclassify(fovy) == FP_QNAN) { + if (fovy < 0.0f || isnan(fovy)) { error = true; OS_REPORT("camera: ERROR: bad fovy !!\n"); } - if (fpclassify(eye.x) == FP_QNAN || fpclassify(eye.y) == FP_QNAN || fpclassify(eye.z) == FP_QNAN) { + if (isnan(eye.x) || isnan(eye.y) || isnan(eye.z)) { error = true; OS_REPORT("camera: ERROR: bad eye !!\n"); } - if (fpclassify(center.x) == FP_QNAN || fpclassify(center.y) == FP_QNAN || fpclassify(center.z) == FP_QNAN) { + if (isnan(center.x) || isnan(center.y) || isnan(center.z)) { error = true; OS_REPORT("camera: ERROR: bad eye !!\n"); } diff --git a/src/f_op/f_op_actor.cpp b/src/f_op/f_op_actor.cpp index 406fa12309e..cfe339885cf 100644 --- a/src/f_op/f_op_actor.cpp +++ b/src/f_op/f_op_actor.cpp @@ -308,9 +308,9 @@ static int fopAc_Execute(void* i_this) { l_HIO.field_0x7 = l_HIO.mStopExecute; - JUT_ASSERT(662, !(fpclassify(actor->current.pos.x) == 1)); - JUT_ASSERT(663, !(fpclassify(actor->current.pos.y) == 1)); - JUT_ASSERT(664, !(fpclassify(actor->current.pos.z) == 1)); + JUT_ASSERT(662, !isnan(actor->current.pos.x)); + JUT_ASSERT(663, !isnan(actor->current.pos.y)); + JUT_ASSERT(664, !isnan(actor->current.pos.z)); if (!(-1.0e32f < actor->current.pos.x && actor->current.pos.x < 1.0e32f && -1.0e32f < actor->current.pos.y && actor->current.pos.y < 1.0e32f && -1.0e32f < actor->current.pos.z && actor->current.pos.z < 1.0e32f)) { @@ -358,9 +358,9 @@ static int fopAc_Execute(void* i_this) { fopAcM_delete(actor); } - JUT_ASSERT(750, !(fpclassify(actor->current.pos.x) == 1)); - JUT_ASSERT(751, !(fpclassify(actor->current.pos.y) == 1)); - JUT_ASSERT(752, !(fpclassify(actor->current.pos.z) == 1)); + JUT_ASSERT(750, !isnan(actor->current.pos.x)); + JUT_ASSERT(751, !isnan(actor->current.pos.y)); + JUT_ASSERT(752, !isnan(actor->current.pos.z)); if (actor->current.pos.y < -1e31f) { actor->current.pos.y = -1e31f;