From 1aa0e368812c3c8daea18370a2fbb17b220d4d6a Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sat, 20 Dec 2025 21:20:20 -0500 Subject: [PATCH] Match d_a_obj_ice_s rideCallBack Co-authored-by: Cuyler36 --- configure.py | 2 +- include/d/actor/d_a_obj_ice_s.h | 2 +- .../MSL/MSL_C/MSL_Common/Include/float.h | 22 +++++++++++-------- .../MSL/MSL_C/MSL_Common/Include/math.h | 11 +++++----- .../MSL/MSL_C/MSL_Common/Src/float.c | 8 +++---- src/d/actor/d_a_obj_ice_l.cpp | 5 +++-- src/d/actor/d_a_obj_ice_s.cpp | 11 ++++------ 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/configure.py b/configure.py index f29f1d87628..744d286e8e1 100755 --- a/configure.py +++ b/configure.py @@ -2429,7 +2429,7 @@ config.libs = [ ActorRel(MatchingFor(ALL_GCN), "d_a_obj_hfuta"), ActorRel(MatchingFor(ALL_GCN), "d_a_obj_hsTarget"), ActorRel(MatchingFor(ALL_GCN), "d_a_obj_ice_l"), - ActorRel(NonMatching, "d_a_obj_ice_s"), + ActorRel(MatchingFor(ALL_GCN), "d_a_obj_ice_s"), ActorRel(MatchingFor(ALL_GCN), "d_a_obj_iceblock"), ActorRel(MatchingFor(ALL_GCN), "d_a_obj_iceleaf"), ActorRel(MatchingFor(ALL_GCN), "d_a_obj_ihasi"), diff --git a/include/d/actor/d_a_obj_ice_s.h b/include/d/actor/d_a_obj_ice_s.h index e59ed016bfc..8c27b58c752 100644 --- a/include/d/actor/d_a_obj_ice_s.h +++ b/include/d/actor/d_a_obj_ice_s.h @@ -21,7 +21,7 @@ public: void initBaseMtx(); void setBaseMtx(); inline int create(); - inline int CreateHeap(); + int CreateHeap(); int Create(); int Execute(Mtx**); int Draw(); 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 a72e809c18a..418b52a88ee 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 @@ -12,10 +12,16 @@ #define FP_NAN FP_QNAN +#if __REVOLUTION_SDK__ #define fpclassify(x) \ ((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : \ (sizeof(x) == sizeof(double)) ? __fpclassifyd((double)(x)) : \ __fpclassifyl((long double)(x)) ) +#else +#define fpclassify(x) \ + ((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : \ + __fpclassifyd((double)(x)) ) +#endif #define signbit(x) ((sizeof(x) == sizeof(float)) ? __signbitf(x) : __signbitd(x)) #define isfinite(x) ((fpclassify(x) > FP_INFINITE)) #define isnan(x) (fpclassify(x) == FP_NAN) @@ -26,27 +32,25 @@ // TODO: OK? #define __signbitd(x) ((int)(__HI(x) & 0x80000000)) -extern unsigned long __float_nan[]; -extern unsigned long __float_huge[]; -extern unsigned long __float_max[]; -extern unsigned long __float_epsilon[]; +extern int __float_nan[]; +extern int __float_huge[]; +extern int __float_max[]; +extern int __float_epsilon[]; #ifdef __cplusplus extern "C" { #endif inline int __fpclassifyf(float __value) { - unsigned long integer = *(unsigned long*)&__value; - - switch (integer & 0x7f800000) { + switch (*(int*)&__value & 0x7f800000) { case 0x7f800000: - if ((integer & 0x7fffff) != 0) { + if ((*(int*)&__value & 0x7fffff) != 0) { return FP_QNAN; } return FP_INFINITE; case 0: - if ((integer & 0x7fffff) != 0) { + if ((*(int*)&__value & 0x7fffff) != 0) { return FP_SUBNORMAL; } return FP_ZERO; 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 5a329d6752a..dcfd960ab23 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 @@ -98,11 +98,12 @@ inline float sqrtf(float mag) { static const double _three = 3.0; #endif if (mag > 0.0f) { - double tmpd = __frsqrte(mag); - tmpd = tmpd * _half * (_three - mag * (tmpd * tmpd)); - tmpd = tmpd * _half * (_three - mag * (tmpd * tmpd)); - tmpd = tmpd * _half * (_three - mag * (tmpd * tmpd)); - return mag * tmpd; + double dmag = (double)mag; + double tmpd = __frsqrte(dmag); + tmpd = _half * tmpd * (_three - tmpd * tmpd * dmag); + tmpd = _half * tmpd * (_three - tmpd * tmpd * dmag); + tmpd = _half * tmpd * (_three - tmpd * tmpd * dmag); + return (float)(dmag * tmpd); } else if (mag < 0.0) { return NAN; } else if (isnan(mag)) { diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c index 3455dbf930b..5abb35f27c1 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c @@ -1,13 +1,13 @@ #include "float.h" -unsigned long __float_nan[] = {0x7FFFFFFF}; +int __float_nan[] = {0x7FFFFFFF}; -unsigned long __float_huge[] = {0x7F800000}; +int __float_huge[] = {0x7F800000}; #if !__REVOLUTION_SDK__ -unsigned long __float_max[] = {0x7F7FFFFF}; +int __float_max[] = {0x7F7FFFFF}; -unsigned long __float_epsilon[] = {0x34000000}; +int __float_epsilon[] = {0x34000000}; #endif #if DEBUG diff --git a/src/d/actor/d_a_obj_ice_l.cpp b/src/d/actor/d_a_obj_ice_l.cpp index c210405bc5b..3e390e98d4c 100644 --- a/src/d/actor/d_a_obj_ice_l.cpp +++ b/src/d/actor/d_a_obj_ice_l.cpp @@ -67,10 +67,11 @@ void daObjIce_l_c::setBaseMtx() { } static void rideCallBack(dBgW* param_0, fopAc_ac_c* param_1, fopAc_ac_c* param_2) { + (void)param_0; + daObjIce_l_c* ice_p = (daObjIce_l_c*)param_1; daPy_py_c* player_p = daPy_getPlayerActorClass(); cXyz* ball_pos = player_p->getIronBallCenterPos(); cXyz& player_pos = fopAcM_GetPosition(player_p); - daObjIce_l_c* ice_p = static_cast(param_1); //!@bug Missing parentheses causes this comparison to always evaluate to false if (!fopAcM_GetName(param_2) == PROC_ALINK) { @@ -81,7 +82,7 @@ static void rideCallBack(dBgW* param_0, fopAc_ac_c* param_1, fopAc_ac_c* param_2 ice_p->Check_RideOn(player_pos); } - cXyz* ice_pos = &fopAcM_GetPosition(ice_p); + cXyz* ice_pos = &fopAcM_GetPosition(param_1); if (ball_pos != NULL && ice_pos != NULL && ice_pos->absXZ(*ball_pos) < ice_p->field_0x5b4.x * 600.0f) { diff --git a/src/d/actor/d_a_obj_ice_s.cpp b/src/d/actor/d_a_obj_ice_s.cpp index 95c74a38c20..57ded9e3e88 100644 --- a/src/d/actor/d_a_obj_ice_s.cpp +++ b/src/d/actor/d_a_obj_ice_s.cpp @@ -17,7 +17,7 @@ class daOBJ_ICE_S_HIO_c : public JORReflexible { public: daOBJ_ICE_S_HIO_c(); - virtual ~daOBJ_ICE_S_HIO_c(); + virtual ~daOBJ_ICE_S_HIO_c() {} void genMessage(JORMContext*); @@ -28,8 +28,6 @@ public: static char* l_arcName = "V_Ice_s"; -daOBJ_ICE_S_HIO_c::~daOBJ_ICE_S_HIO_c() {} - daOBJ_ICE_S_HIO_c::daOBJ_ICE_S_HIO_c() { mId = -1; mSlopeMagnitude = 5000.0f; @@ -119,12 +117,11 @@ void daObjIce_s_c::setBaseMtx() { cMtx_copy(mDoMtx_stack_c::get(), mBgMtx); } -// NONMATCHING - regalloc, equivalent static void rideCallBack(dBgW* param_1, fopAc_ac_c* param_2, fopAc_ac_c* param_3) { (void)param_1; daObjIce_s_c* ice = (daObjIce_s_c*)param_2; daPy_py_c* player = daPy_getPlayerActorClass(); - cXyz* playerPos = (cXyz*)&fopAcM_GetPosition(player); + cXyz* playerPos = &fopAcM_GetPosition(player); cXyz* pBallCenter = player->getIronBallCenterPos(); // !@bug misplaced ! operator. This condition is probably always false @@ -137,7 +134,7 @@ static void rideCallBack(dBgW* param_1, fopAc_ac_c* param_2, fopAc_ac_c* param_3 ice->Check_LinkRideOn(*playerPos); } - cXyz* icePos = (cXyz*)&fopAcM_GetPosition(param_2); + cXyz* icePos = &fopAcM_GetPosition(param_2); if (pBallCenter != NULL && icePos != NULL && icePos->absXZ(*pBallCenter) < ice->field_0x5c8.x * 600.0f) { @@ -230,7 +227,7 @@ inline int daObjIce_s_c::create() { return rv; } -inline int daObjIce_s_c::CreateHeap() { +int daObjIce_s_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, "Ice_s.bmd"); JUT_ASSERT(157, modelData != NULL); mModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);