Move abs and fabsf to std namespace

This commit is contained in:
LagoLunatic
2024-08-07 12:55:30 -04:00
parent d2b9d15efb
commit d287e79ab0
40 changed files with 99 additions and 106 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
#include "dolphin/mtx/mtx.h"
inline bool cLib_IsZero(f32 value) {
return fabsf(value) < 8e-11f;
return std::fabsf(value) < 8e-11f;
}
void cLib_memCpy(void* dst, const void* src, unsigned long size);
+1 -5
View File
@@ -89,11 +89,7 @@ void cM3d_CrawVec(const Vec&, const Vec&, Vec*);
void cM3d_UpMtx_Base(const Vec&, const Vec&, MtxP);
inline bool cM3d_IsZero(f32 f) {
return fabsf(f) < G_CM3D_F_ABS_MIN;
}
// this is the inline cM3d_IsZero but inverted. Sometimes this will get a match where the regular cM3d_IsZero inline won't
inline bool cM3d_IsZero_inverted(f32 param_0) {
return !(fabsf(param_0) < G_CM3D_F_ABS_MIN);
return std::fabsf(f) < G_CM3D_F_ABS_MIN;
}
inline void cM3d_VectorProduct(const Vec* p01, const Vec* p02, Vec* pDst) {
+2 -2
View File
@@ -8,8 +8,8 @@
#include "JSystem/JMath/JMATrigonometric.h"
#include "dolphin/types.h"
static void dummy() {
fabsf(1.0f);
static f32 dummy() {
return 1.0f;
}
/* 8025991C-802599A0 .text JPAGetYZRotateMtx__FssPA4_f */
@@ -32,12 +32,6 @@ extern float __fabsf(float);
inline double fabs(double f) {
return __fabs(f);
}
inline double fabsf2(float f) {
return __fabsf(f);
}
inline float fabsf(float f) {
return fabsf2(f);
}
double floor(double);
double fmod(double, double);
@@ -107,6 +101,12 @@ inline float i_cosf(float x) {
#ifdef __cplusplus
};
namespace std {
inline float fabsf(float f) { return fabs(f); }
inline float abs(float f) { return fabsf(f); }
}; // namespace std
#endif
#endif
+2 -4
View File
@@ -152,7 +152,6 @@ void cBgW::ClassifyPlane() {
return;
s32 i = 0;
f32 eps = G_CM3D_F_ABS_MIN;
int roof, wall, ground;
for (; i < pm_bgd->m_b_num; i++) {
@@ -174,9 +173,8 @@ void cBgW::ClassifyPlane() {
for (s32 j = startTri; j <= lastTri; j++) {
cBgW_TriElm* tri_elm = &pm_tri[j];
/* cM3d_isZero */
f32 ny = tri_elm->m_plane.mNormal.y;
if (fabsf(tri_elm->m_plane.mNormal.x) < eps && fabsf(tri_elm->m_plane.mNormal.y) < eps && fabsf(tri_elm->m_plane.mNormal.z) < eps)
f32 ny = tri_elm->m_plane.GetNP()->y;
if (cM3d_IsZero(tri_elm->m_plane.GetNP()->x) && cM3d_IsZero(tri_elm->m_plane.GetNP()->y) && cM3d_IsZero(tri_elm->m_plane.GetNP()->z))
continue;
if (cBgW_CheckBGround(ny)) {
+1 -1
View File
@@ -260,7 +260,7 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos
if (obj1->GetStts()->GetActor() != NULL && obj1->GetStts()->GetActor() == obj2->GetStts()->GetActor()) {
return;
}
if (fabsf(cross_len) < (1.0f / 125.0f)) {
if (std::fabsf(cross_len) < (1.0f / 125.0f)) {
return;
}
+1 -1
View File
@@ -50,7 +50,7 @@ f32 cLib_addCalc(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) {
}
}
}
return fabsf(target - *pValue);
return std::fabsf(target - *pValue);
}
/* 802529A4-802529E8 .text cLib_addCalc2__FPffff */
+9 -9
View File
@@ -130,7 +130,7 @@ f32 cM3d_SignedLenPlaAndPos(const cM3dGPla* plane, const Vec* pos) {
void cM3d_CalcPla(const Vec* p0, const Vec* p1, const Vec* p2, Vec* pDst, f32* pT) {
cM3d_VectorProduct(p0, p1, p2, pDst);
f32 t = VECMag(pDst);
if (fabsf(t) >= 0.02f) {
if (std::fabsf(t) >= 0.02f) {
VECScale(pDst, pDst, 1.0f / t);
*pT = -VECDotProduct(pDst, p0);
} else {
@@ -232,7 +232,7 @@ int cM3d_Check_LinLin(const cM3dGLin* lin_a, const cM3dGLin* lin_b, f32* dst_a,
f32 tmpF = -VECDotProduct(&linAVec, &linBVec);
f32 tmpF2 = VECDotProduct(&tmp, &linAVec);
VECSquareMag(&tmp); // result not used
f32 tmpF3 = fabsf(1.0f - (tmpF * tmpF));
f32 tmpF3 = std::fabsf(1.0f - (tmpF * tmpF));
if (!cM3d_IsZero(tmpF3)) {
f32 tmpF4 = -VECDotProduct(&tmp, &linBVec);
f32 tmpF7 = 1.0f / tmpF3;
@@ -424,9 +424,9 @@ bool cM3d_Cross_LinTri(const cM3dGLin* lin, const cM3dGTri* tri, Vec* dst, bool
if (!cM3d_Cross_LinPla(lin, tri, dst, a, b)) {
return false;
}
if ((fabsf(tri->GetNP()->x) < 0.008f || cM3d_CrossX_Tri(tri, dst)) &&
(fabsf(tri->GetNP()->y) < 0.008f || cM3d_CrossY_Tri(tri, dst)) &&
(fabsf(tri->GetNP()->z) < 0.008f || cM3d_CrossZ_Tri(tri, dst))
if ((std::fabsf(tri->GetNP()->x) < 0.008f || cM3d_CrossX_Tri(tri, dst)) &&
(std::fabsf(tri->GetNP()->y) < 0.008f || cM3d_CrossY_Tri(tri, dst)) &&
(std::fabsf(tri->GetNP()->z) < 0.008f || cM3d_CrossZ_Tri(tri, dst))
) {
return true;
} else {
@@ -658,9 +658,9 @@ int cM3d_2PlaneCrossLine(const cM3dGPla& pPlaneA, const cM3dGPla& pPlaneB, cM3dG
if (cM3d_IsZero(tmp.x) && cM3d_IsZero(tmp.y) && cM3d_IsZero(tmp.z)) {
return 0;
} else {
f32 absTX = fabsf(tmp.x);
f32 absTY = fabsf(tmp.y);
f32 absTZ = fabsf(tmp.z);
f32 absTX = std::fabsf(tmp.x);
f32 absTY = std::fabsf(tmp.y);
f32 absTZ = std::fabsf(tmp.z);
if (absTX >= absTY && absTX >= absTZ) {
cM3d_PlaneCrossLineProcWork(pPlaneA.GetNP()->y, pPlaneA.GetNP()->z, pPlaneB.GetNP()->y,
pPlaneB.GetNP()->z, tmp.x, pPlaneA.GetD(), pPlaneB.GetD(),
@@ -753,7 +753,7 @@ int cM3d_2PlaneLinePosNearPos(const cM3dGPla& p0, const cM3dGPla& p1, const Vec*
/* 80251C44-80251CC4 .text cM3d_CrawVec__FRC3VecRC3VecP3Vec */
void cM3d_CrawVec(const Vec& v0, const Vec& v1, Vec* pDst) {
Vec tmp;
f32 sq = fabsf(v1.x * v0.x + v1.y * v0.y + v1.z * v0.z);
f32 sq = std::fabsf(v1.x * v0.x + v1.y * v0.y + v1.z * v0.z);
VECScale(&v0, &tmp, sq);
VECAdd(&tmp, &v1, pDst);
}
+3 -3
View File
@@ -117,13 +117,13 @@ u16 U_GetAtanTable(float f0, float f1) {
/* 802460D0-80246270 .text cM_atan2s__Fff */
s16 cM_atan2s(float f0, float f1) {
u32 retVar;
if (fabsf(f0) < G_CM3D_F_ABS_MIN) {
if (cM3d_IsZero(f0)) {
if (f1 >= 0.0f) {
retVar = 0;
} else {
retVar = 0x8000;
}
} else if (fabsf(f1) < G_CM3D_F_ABS_MIN) {
} else if (cM3d_IsZero(f1)) {
if (f0 >= 0.0f) {
retVar = 0x4000;
} else {
@@ -178,7 +178,7 @@ float cM_rnd(void) {
r0 = (r0 * 0xAB) % 0x763D;
r1 = (r1 * 0xAC) % 0x7663;
r2 = (r2 * 0xAA) % 0x7673;
return fabsf(fmod(r0 / 30269.0f + r1 / 30307.0f + r2 / 30323.0f, 1.0));
return std::fabsf(fmod(r0 / 30269.0f + r1 / 30307.0f + r2 / 30323.0f, 1.0));
}
/* 802463B0-802463E8 .text cM_rndF__Ff */
+3 -2
View File
@@ -141,8 +141,9 @@ bool cXyz::operator!=(const Vec& vec) const {
/* 80245CE4-80245D48 .text isZero__4cXyzCFv */
bool cXyz::isZero(void) const {
return fabsf(this->x) < 3.8146972e-06f && fabsf(this->y) < 3.8146972e-06f &&
fabsf(this->z) < 3.8146972e-06f;
return std::fabsf(this->x) < 3.8146972e-06f &&
std::fabsf(this->y) < 3.8146972e-06f &&
std::fabsf(this->z) < 3.8146972e-06f;
}
// Unused, but must be in .rodata to match
+3 -3
View File
@@ -62,7 +62,7 @@ BOOL ice_bg_check(enemyice* ei) {
}
if (ei->mBgAcch.ChkWallHit()) {
if (fabsf(ei->mSpeedF) > 10.0f) {
if (std::fabsf(ei->mSpeedF) > 10.0f) {
ret = TRUE;
}
ei->mSpeedF *= 0.5f;
@@ -187,7 +187,7 @@ BOOL enemy_ice(enemyice* ei) {
if (ei->mParticleScale < 0.1f) {
ei->mParticleScale = 1.0f;
}
if (fabsf(ei->mYOffset) < 0.1f) {
if (std::fabsf(ei->mYOffset) < 0.1f) {
ei->mYOffset = 80.0f;
}
ei->mState = 1;
@@ -282,7 +282,7 @@ BOOL enemy_ice(enemyice* ei) {
ac->current.pos += *ccMove;
}
if (fabsf(ei->mSpeedF) > 5.0f) {
if (std::fabsf(ei->mSpeedF) > 5.0f) {
ei->mCyl.OnAtSetBit();
} else {
ei->mCyl.OffAtSetBit();
+5 -5
View File
@@ -1336,9 +1336,9 @@ BOOL daAgbsw0_c::ExeSubB() {
cXyz rel;
fpoAcM_relativePos(this, &agb->current.pos, &rel);
rel.y = rel.y - scale.y / 2.0f + 5.0f;
f32 x_diff = scale.x - fabsf(rel.x);
f32 y_diff = (scale.y / 2.0f) - fabsf(rel.y) + 50.0f; //some register oddity here
f32 z_diff = scale.z - fabsf(rel.z);
f32 x_diff = scale.x - std::abs(rel.x);
f32 y_diff = (scale.y / 2.0f) - std::abs(rel.y) + 50.0f; //some register oddity here
f32 z_diff = scale.z - std::abs(rel.z);
if(y_diff < x_diff && y_diff < z_diff) {
if(agb->current.pos.y < current.pos.y + scale.y / 2.0f) {
agb->home.pos.y = current.pos.y - 6.0f;
@@ -1611,7 +1611,7 @@ BOOL daAgbsw0_c::HitCheck(fopAc_ac_c* param_1) {
if(mNonCircular == false) {
f32 y_diff = param_1->current.pos.y - current.pos.y;
if(-10.0f <= y_diff && y_diff <= scale.y) {
f32 x_diff = fabsf(param_1->current.pos.x - current.pos.x);
f32 x_diff = std::abs(param_1->current.pos.x - current.pos.x);
if(x_diff < scale.x) {
f32 z_diff = fabs(param_1->current.pos.z - current.pos.z);
if(z_diff < scale.x && x_diff * x_diff + z_diff * z_diff < scale.x * scale.x) {
@@ -1623,7 +1623,7 @@ BOOL daAgbsw0_c::HitCheck(fopAc_ac_c* param_1) {
else {
cXyz pos;
fpoAcM_relativePos(this, &param_1->current.pos, &pos);
if(-10.0f <= pos.y && pos.y <= scale.y && fabsf(pos.x) < scale.x && fabsf(pos.z) < scale.z) {
if(-10.0f <= pos.y && pos.y <= scale.y && std::abs(pos.x) < scale.x && std::abs(pos.z) < scale.z) {
return true;
}
}
+2 -4
View File
@@ -301,9 +301,8 @@ BOOL daBFlower_c::actLive() {
init_bck_anm(VBAKH_BCK_VBAKH);
}
// TODO: std::abs
// Play animation if player walks by bomb flower
if (dist < 50.0f && fabsf(mPrevPlayerDist - dist) > 2.0f && fabsf(player->current.pos.y - current.pos.y) < 10.0f) {
if (dist < 50.0f && std::abs(mPrevPlayerDist - dist) > 2.0f && std::abs(player->current.pos.y - current.pos.y) < 10.0f) {
init_bck_anm(VBAKH_BCK_VBAKH);
}
@@ -400,9 +399,8 @@ BOOL daBFlower_c::actDead() {
mAnimTimer -= 1;
}
// TODO: std::abs
// Play animation if player walks by bomb flower
if (dist < 50.0f && fabsf(mPrevPlayerDist - dist) > 2.0f) {
if (dist < 50.0f && std::abs(mPrevPlayerDist - dist) > 2.0f) {
init_bck_anm(VBAKH_BCK_VBAHX);
}
+13 -13
View File
@@ -697,7 +697,7 @@ static fpc_ProcID search_wepon(bk_class* i_this) {
sp18.z = r25->current.pos.z - i_this->eyePos.z;
f32 f4 = sqrtf(sp18.x*sp18.x + sp18.z*sp18.z);
if (f4 < f29 && !daBk_other_bg_check(i_this, r25)) {
if (fabsf(r25->current.pos.y + 50.0f - i_this->eyePos.y) <= l_bkHIO.m038) {
if (std::fabsf(r25->current.pos.y + 50.0f - i_this->eyePos.y) <= l_bkHIO.m038) {
s16 angleDiff = i_this->m0330 - cM_atan2s(sp18.x, sp18.z);
if (angleDiff < 0) {
angleDiff = -angleDiff;
@@ -708,8 +708,8 @@ static fpc_ProcID search_wepon(bk_class* i_this) {
cMtx_YrotS(*calc_mtx, -i_this->current.angle.y);
cXyz sp0C;
MtxPosition(&sp18, &sp0C);
if (fabsf(sp0C.x) < l_bkHIO.m03C &&
fabsf(sp0C.y) < l_bkHIO.m040 &&
if (std::fabsf(sp0C.x) < l_bkHIO.m03C &&
std::fabsf(sp0C.y) < l_bkHIO.m040 &&
sp0C.z > l_bkHIO.m048 &&
sp0C.z < l_bkHIO.m044
) {
@@ -780,7 +780,7 @@ static fopAc_ac_c* search_bomb(bk_class* i_this, BOOL r26) {
!(daBk_other_bg_check(i_this, r24) && r26)
) {
if (r26) {
if (fabsf(r24->current.pos.y + 50.0f - i_this->eyePos.y) <= l_bkHIO.m038) {
if (std::fabsf(r24->current.pos.y + 50.0f - i_this->eyePos.y) <= l_bkHIO.m038) {
s16 angleDiff = i_this->m0330 - cM_atan2s(sp28.x, sp28.z);
if (angleDiff < 0) {
angleDiff = -angleDiff;
@@ -791,8 +791,8 @@ static fopAc_ac_c* search_bomb(bk_class* i_this, BOOL r26) {
cMtx_YrotS(*calc_mtx, -i_this->current.angle.y);
cXyz sp10;
MtxPosition(&sp28, &sp10);
if (fabsf(sp10.x) < l_bkHIO.m03C &&
fabsf(sp10.y) < l_bkHIO.m040 &&
if (std::fabsf(sp10.x) < l_bkHIO.m03C &&
std::fabsf(sp10.y) < l_bkHIO.m040 &&
sp10.z > l_bkHIO.m048 &&
sp10.z < l_bkHIO.m044
) {
@@ -855,7 +855,7 @@ static BOOL daBk_player_bg_check(bk_class* i_this, cXyz* r22) {
if (search_sp != 0 || i_this->mType == 0xA) {
return FALSE;
}
if (i_this->dr.m713 == 0 && fabsf(player->speedF) < 0.1f && player->checkGrabWear()) {
if (i_this->dr.m713 == 0 && std::fabsf(player->speedF) < 0.1f && player->checkGrabWear()) {
return TRUE;
}
dBgS_LinChk linChk;
@@ -881,7 +881,7 @@ static BOOL daBk_player_view_check(bk_class* i_this, cXyz* r30, s16 r27, s16 r31
if (daBk_player_bg_check(i_this, r30)) {
return FALSE;
}
if (fabsf(player->current.pos.y + 50.0f - i_this->eyePos.y) > l_bkHIO.m038) {
if (std::fabsf(player->current.pos.y + 50.0f - i_this->eyePos.y) > l_bkHIO.m038) {
return FALSE;
}
s16 angleDiff = i_this->m0330 - r27;
@@ -899,8 +899,8 @@ static BOOL daBk_player_view_check(bk_class* i_this, cXyz* r30, s16 r27, s16 r31
sp14.z = r30->z - i_this->current.pos.z;
cXyz sp08;
MtxPosition(& sp14, &sp08);
if (fabsf(sp08.x) < l_bkHIO.m03C &&
fabsf(sp08.y) < l_bkHIO.m040 &&
if (std::fabsf(sp08.x) < l_bkHIO.m03C &&
std::fabsf(sp08.y) < l_bkHIO.m040 &&
sp08.z > l_bkHIO.m048 &&
sp08.z < l_bkHIO.m044
) {
@@ -1870,7 +1870,7 @@ static void fight_run(bk_class* i_this) {
i_this->m0300[1] = 20.0f + cM_rndF(20.0f);
break;
}
if ((i_this->m02DD & 0xC) == 0 && fabsf(stickPosX) > 0.1f) {
if ((i_this->m02DD & 0xC) == 0 && std::fabsf(stickPosX) > 0.1f) {
if (i_this->m0B30 != 0 || i_this->m11F3 != 0) {
anm_init(i_this, BK_BCK_BK_WALK2, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_WALK2);
} else {
@@ -2063,7 +2063,7 @@ static void fight_run(bk_class* i_this) {
}
i_this->m02DD = ground_4_check(i_this, 4, i_this->current.angle.y, 90.0f + REG6_F(7));
if (i_this->m0314 != 0) {
if (fabsf(i_this->speedF) < 30.0f) {
if (std::fabsf(i_this->speedF) < 30.0f) {
if (i_this->m0318 == 0) {
i_this->dr.m710 = 3;
} else if (i_this->m0318 == 1) {
@@ -2452,7 +2452,7 @@ static BOOL daBk_Execute(bk_class* i_this) {
if (r23 == NULL) {
i_this->m0300[0] = 50;
i_this->m0310 = 20;
if (fabsf(i_this->speedF) > 10.0f) {
if (std::fabsf(i_this->speedF) > 10.0f) {
another_hit = 1;
} else {
i_this->scale.x = i_this->scale.y = i_this->scale.z = 0.5f;
+1 -1
View File
@@ -679,7 +679,7 @@ namespace daBomb2 {
f28 = 1.0f;
}
mWindVec = sp48 * f31 + hitNormal * f28 * f30;
if (fabsf(mWindVec.y) < 5.0f) {
if (std::fabsf(mWindVec.y) < 5.0f) {
mWindVec.y += attr().field_0x38*f31 + f29*(attr().field_0x3C*f28);
}
field_0x7A8 = 2;
+1 -1
View File
@@ -1158,7 +1158,7 @@ void daBomb_c::set_wind_vec() {
f28 = 1.0f;
}
mWindVec = sp48 * f31 + hitNormal * f28 * f30;
if (fabsf(mWindVec.y) < 5.0f) {
if (std::fabsf(mWindVec.y) < 5.0f) {
mWindVec.y += f29*(100.0f*f28) + 140.0f*f31;
}
}
+2 -2
View File
@@ -450,13 +450,13 @@ bool daStandItem_c::actionFobj05() {
/* 800E45E0-800E4770 .text actionFobj06__13daStandItem_cFv */
bool daStandItem_c::actionFobj06() {
/* Nonmatching */
/* Nonmatching - *1.0f gets optimized out */
cXyz wind = dKyw_get_AllWind_vecpow(&current.pos);
f32 windStrength = wind.absXZ();
cXyz zero(0.0f, 0.0f, 0.0f);
s16 angle = cLib_targetAngleY(&zero, &wind);
cLib_distanceAngleS(angle, current.angle.y);
m6C4 += fabsf(windStrength * 1.0f);
m6C4 += fabs(windStrength * 1.0f);
if (m6C4 > 4.0f) {
m6C4 = 4.0f;
}
+1 -1
View File
@@ -121,7 +121,7 @@ BOOL daGhostship_c::_pathMove(cXyz* curPos, cXyz* p_curPntPos, cXyz* p_nextPntPo
s16 targetAngleY = cM_atan2s(delta.x, delta.z);
s16 angleLeftToTarget = cLib_addCalcAngleS(&current.angle.y, targetAngleY, 8, 0x200, 8);
f32 step = speedF * fabsf(cM_scos(angleLeftToTarget));
f32 step = speedF * std::fabsf(cM_scos(angleLeftToTarget));
cLib_chasePosXZ(curPos, mNextPntPos, step);
if((*curPos - mNextPntPos).absXZ() < step * (REG12_F(5) + 1.0f) || (*curPos - mNextPntPos).absXZ() == 0.0f) {
return TRUE;
+1 -1
View File
@@ -1121,7 +1121,7 @@ void daItem_c::set_bound_se() {
return;
}
u32 temp = fabsf(field_0x650) * 2.0f;
u32 temp = std::fabsf(field_0x650) * 2.0f;
if (temp > 100) {
temp = 100;
}
+3 -3
View File
@@ -151,7 +151,7 @@ calc_012:
*r28 += pt.x;
*r27 += pt.z;
cLib_addCalc2(&*r26, i_this->mGroundY, REG0_F(6) + 0.3f, REG0_F(7) + 20.0f);
if (fabsf(*r26 - i_this->mGroundY) < 1.0f) {
if (std::fabsf(*r26 - i_this->mGroundY) < 1.0f) {
*r26 = i_this->mGroundY;
i_this->mState = 10;
}
@@ -183,7 +183,7 @@ calc_012:
*r28 += pt.x;
*r27 += pt.z;
cLib_addCalc2(&*r26, i_this->mTargetPos.y, REG0_F(6) + 0.5f, REG0_F(7) + 20.0f);
if (fabsf(*r26 - i_this->mTargetPos.y) < 1.0f) {
if (std::fabsf(*r26 - i_this->mTargetPos.y) < 1.0f) {
i_this->mState = 20;
i_this->mSpeedLerp = 0.0f;
}
@@ -197,7 +197,7 @@ calc_012:
cLib_addCalc2(&*r27, i_this->mTargetPos.z, 1.0f, i_this->mSpeedLerp);
cLib_addCalc2(&i_this->mSpeedLerp, 1000.0f, 1.0f, REG0_F(16) + 10.0f);
cLib_addCalcAngleS2(&i_this->current.angle.y, player->shape_angle.y, 2, 0x1000);
if (fabsf(*r26 - i_this->mTargetPos.y) > 1.0f)
if (std::fabsf(*r26 - i_this->mTargetPos.y) > 1.0f)
dispWing = true;
if (CPad_CHECK_TRIG_LEFT(0)) {
i_this->mState = 0;
+4 -4
View File
@@ -31,22 +31,22 @@ void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) {
cLib_addCalcAngleS2(&i_ac->current.angle.x, z, 10, 0x800);
cLib_addCalcAngleS2(&i_ac->current.angle.z, x, 10, 0x800);
f32 dist = (REG0_F(4) + 50.0f) * fabsf(pos1.z - pos2.z);
f32 dist = (REG0_F(4) + 50.0f) * std::fabsf(pos1.z - pos2.z);
if (pActor->m2BC.x < dist) {
pActor->m2BC.x = dist;
}
dist = (REG0_F(4) + 50.0f) * fabsf(pos1.x - pos2.x);
dist = (REG0_F(4) + 50.0f) * std::fabsf(pos1.x - pos2.x);
if (pActor->m2BC.z < dist) {
pActor->m2BC.z = dist;
}
dist = (REG0_F(8) + 5.0f) * fabsf(pos1.x - pos2.x);
dist = (REG0_F(8) + 5.0f) * std::fabsf(pos1.x - pos2.x);
if (dist > 10.0f && pActor->m2B0.x < dist) {
cLib_addCalc2(&pActor->m2B0.x, dist, 1.0f, REG0_F(7) + 1.2f);
}
dist = (REG0_F(8) + 5.0f) * fabsf(pos1.z - pos2.z);
dist = (REG0_F(8) + 5.0f) * std::fabsf(pos1.z - pos2.z);
if (dist > 10.0f && pActor->m2B0.z < dist) {
cLib_addCalc2(&pActor->m2B0.z, dist, 1.0f, REG0_F(7) + 1.2f);
}
+1 -1
View File
@@ -2088,7 +2088,7 @@ BOOL daNpc_Ji1_c::teachSPRollCutAction(void*) {
f32 what = temp.absXZ();
s32 cutType = player->getCutType();
f32 y_diff = fabsf(temp.y);
f32 y_diff = std::fabsf(temp.y);
if(cutType == 9 && y_diff < 20.0f) {
dComIfGs_onEventBit(0xB20);
dComIfGs_offTmpBit(0x402);
+1 -1
View File
@@ -1219,7 +1219,7 @@ BOOL daNpc_Md_c::checkCollision(int r30) {
sp3C.y = 0.0f;
sp3C.normalizeZP();
s16 sp08;
if (fabsf(sp3C.x) < 0.001f && fabsf(sp3C.z) < 0.001f) {
if (std::abs(sp3C.x) < 0.001f && std::abs(sp3C.z) < 0.001f) {
sp08 = 0;
} else {
sp08 = cM_atan2s(sp3C.x, sp3C.z);
+1 -1
View File
@@ -8118,7 +8118,7 @@ BOOL daNpcPeople_c::checkPig() {
if(pPig && pPig->m408 == 0) {
f32 temp;
dNpc_calc_DisXZ_AngY(current.pos, pPig->current.pos, &temp, NULL);
if(temp < 400.0f && fabsf(current.pos.y - pPig->current.pos.y) <= 10.0f) {
if(temp < 400.0f && std::abs(current.pos.y - pPig->current.pos.y) <= 10.0f) {
pPig->taura_pos_set(current.pos);
m78D = 2;
m758 |= 0x80;
+1 -1
View File
@@ -478,7 +478,7 @@ void daObjFerris::Act_c::make_lean() {
delta.normalizeRS();
f32 z = -delta.z;
f32 h = fabsf(-(z * pt0.x + delta.x * pt0.z) + (z * mRidePos.x + delta.x * mRidePos.z)) / 162.0f;
f32 h = std::fabsf(-(z * pt0.x + delta.x * pt0.z) + (z * mRidePos.x + delta.x * mRidePos.z)) / 162.0f;
if (delta.x * delta2.z - delta.z * delta2.x < 0.0f) {
mRideWaveTarget[i] = h * 550.0f;
} else {
+1 -1
View File
@@ -206,7 +206,7 @@ BOOL daPy_lk_c::procFoodSet() {
seStartOnlyReverb(JA_SE_LK_HYOI_SET);
}
if (fabsf(frameCtrl.getRate()) < 0.01f) {
if (std::abs(frameCtrl.getRate()) < 0.01f) {
if (mDemo.getDemoType() != 5) {
dComIfGp_evmng_cutEnd(mStaffIdx);
} else if (m34D0 < 0) {
+1 -1
View File
@@ -814,7 +814,7 @@ BOOL daPy_lk_c::draw() {
) {
cXyz sp18;
mDoLib_pos2camera(&current.pos, &sp18);
f32 f2 = fabsf(cM_ssin(g_Counter.mTimer * 0x800));
f32 f2 = std::abs(cM_ssin(g_Counter.mTimer * 0x800));
if (daPy_dmEcallBack_c::checkCurse() || checkConfuse()) {
tevStr.mFogColor.r = 0x80;
tevStr.mFogColor.g = 0x00;
+1 -1
View File
@@ -173,7 +173,7 @@ void daPy_npc_c::drawDamageFog() {
cXyz camPos;
mDoLib_pos2camera(&current.pos, &camPos);
f32 adjust = fabsf(cM_ssin(g_Counter.mTimer * 0x800));
f32 adjust = std::abs(cM_ssin(g_Counter.mTimer * 0x800));
tevStr.mFogColor.r = 255;
tevStr.mFogColor.g = 60;
tevStr.mFogColor.b = 60;
+1 -1
View File
@@ -416,7 +416,7 @@ void action_dousa(pw_class* i_this) {
}
if (i_this->m37C == 0 && i_this->mState < 0x5A) {
if (i_this->mState == 0x0E || i_this->mState == 0x10 || i_this->mState == 0x14) {
if (!hani_check(i_this) && fopAcM_searchPlayerDistance(i_this) < 500.0f && fabsf(i_this->current.pos.y - player->current.pos.y) < 100.0f) {
if (!hani_check(i_this) && fopAcM_searchPlayerDistance(i_this) < 500.0f && std::fabsf(i_this->current.pos.y - player->current.pos.y) < 100.0f) {
if (!Line_check(i_this, i_this->current.pos, 1) && (i_this->m346 == 1 || !TORITUKI_ON)) {
i_this->mAction = 1;
i_this->mState = 0x1E;
+1 -1
View File
@@ -90,7 +90,7 @@ namespace daTagWaterlevel {
M_now = 1.0f;
}
} else {
if (fabsf(target - get_now()) < attr().field_0x0c) {
if (std::fabsf(target - get_now()) < attr().field_0x0c) {
M_now = target;
field_0x290 = 0.0f;
} else {
+1 -1
View File
@@ -58,7 +58,7 @@ BOOL daTama_c::_execute() {
bool del = true;
if (partner != NULL) {
f32 distXZ = fopAcM_searchActorDistanceXZ(this, partner);
f32 distY = fabsf(current.pos.y - partner->current.pos.y);
f32 distY = std::fabsf(current.pos.y - partner->current.pos.y);
if (distXZ < mDis && distY < 400.0f) {
del = false;
speed.y = speedF * cM_ssin(current.angle.x);
+1 -1
View File
@@ -66,7 +66,7 @@ BOOL daItem_c::releaseLock() {
/* 800689A8-800689F0 .text checkActionNow__8daItem_cFv */
BOOL daItem_c::checkActionNow() {
if (fabsf(speedF) < 0.1f && fabsf(old.pos.y - current.pos.y) < 1.0f) {
if (std::abs(speedF) < 0.1f && std::abs(old.pos.y - current.pos.y) < 1.0f) {
return FALSE;
}
return TRUE;
+3 -3
View File
@@ -107,9 +107,9 @@ namespace daObj {
f32 dz = delta.z;
cXyz result(dx * param_4, dy * param_4, dz * param_4);
result.x += fabsf(dx) * dx * param_5;
result.y += fabsf(dy) * dy * param_5;
result.z += fabsf(dz) * dz * param_5;
result.x += std::fabsf(dx) * dx * param_5;
result.y += std::fabsf(dy) * dy * param_5;
result.z += std::fabsf(dz) * dz * param_5;
result *= -1.0f;
*pDst = result;
+1 -1
View File
@@ -700,7 +700,7 @@ f32 cM_rnd_c::get() {
m0 = (m0 * 171) % 30269;
m4 = (m4 * 172) % 30307;
m8 = (m8 * 170) % 30323;
return fabsf(fmod((m0 / 30269.0f) + (m4 / 30307.0f) + (m8 / 30323.0f), 1.0f));
return std::fabsf(fmod((m0 / 30269.0f) + (m4 / 30307.0f) + (m8 / 30323.0f), 1.0f));
}
f32 cM_rnd_c::getF(f32 m) {
+3 -3
View File
@@ -150,7 +150,7 @@ BOOL JntHit_c::Cyl2HitPosAngleOffset(cXyz* r27, csXyz* r29, cXyz* r30, csXyz* r3
cXyz r1_7C;
cXyz r1_70(x, -sinX, z);
f32 f1 = r1_70.inprod(r1_88);
if (!(fabsf(f1) < cXyz::getNearZeroValue())) { // TODO: is this an inline?
if (!cLib_IsZero(f1)) {
if (f1 > 0.0f) {
f1 = -f30 / f1;
} else {
@@ -315,7 +315,7 @@ s32 JntHit_c::searchJntHitPosAngleOffset(cXyz* r18, csXyz* r28, cXyz* r29, csXyz
f31 = f4;
hitIndex = i;
hitPosIndex = posIndex;
if (fabsf(f5) < cXyz::getNearZeroValue() && fabsf(f29) < cXyz::getNearZeroValue()) {
if (cLib_IsZero(f5) && cLib_IsZero(f29)) {
if (!isThrow(*pShapeType)) {
if (*pShapeType == 0) {
CylHitPosAngleOffset(&r1_1A0, r28, r29, r30, r1_17C, r1_170, *pRadius);
@@ -344,7 +344,7 @@ s32 JntHit_c::searchJntHitPosAngleOffset(cXyz* r18, csXyz* r28, cXyz* r29, csXyz
f31 = temp;
hitIndex = i;
hitPosIndex = posIndex;
if (fabsf(f31) < cXyz::getNearZeroValue()) {
if (cLib_IsZero(f31)) {
SphHitPosAngleOffset(&r1_1A0, r28, r29, r30, r1_140, *pRadius);
if (isDelete(*pShapeType)) {
jointIndex = -3;
+6 -6
View File
@@ -166,14 +166,14 @@ void dKyr_kamome_move() {
}
oldTarget.x = cM_ssin(pWind->mKamomeEff[i].mAngleY) * 7000.0f;
oldTarget.y = fabsf(cM_ssin(pWind->mKamomeEff[i].mAngleX) * 3200.0f);
oldTarget.y = std::fabsf(cM_ssin(pWind->mKamomeEff[i].mAngleX) * 3200.0f);
oldTarget.z = cM_scos(pWind->mKamomeEff[i].mAngleY) * 7000.0f;
pWind->mKamomeEff[i].mAngleY += pWind->mKamomeEff[i].mAngleYSpeed * pWind->mKamomeEff[i].mScale;
pWind->mKamomeEff[i].mAngleX += 15;
newTarget.x = cM_ssin(pWind->mKamomeEff[i].mAngleY) * 7000.0f;
newTarget.y = fabsf(cM_ssin(pWind->mKamomeEff[i].mAngleX) * 3200.0f);
newTarget.y = std::fabsf(cM_ssin(pWind->mKamomeEff[i].mAngleX) * 3200.0f);
newTarget.z = cM_scos(pWind->mKamomeEff[i].mAngleY) * 7000.0f;
newPos.x = pCamera->mLookat.mEye.x + newTarget.x;
@@ -824,7 +824,7 @@ void dKyr_star_move() {
dKankyo_star_Packet* pPkt = g_env_light.mpStarPacket;
pPkt->mCount = g_env_light.mStarCount;
if (pPkt->mCount != 0) {
f32 wave = fabsf(cM_fsin(pPkt->mStarEff[0].mAnimCounter));
f32 wave = std::fabsf(cM_fsin(pPkt->mStarEff[0].mAnimCounter));
pPkt->mStarEff[0].mAnimCounter += 0.01f;
pPkt->mStarEff[0].mSin = wave;
cLib_addCalc(&pPkt->mStarEff[0].mSin, wave, 0.5f, 0.1f, 0.01f);
@@ -934,8 +934,8 @@ void wave_move() {
vectle_calc(&deltaXZ, &vectle);
pPkt->mSkewDir = cM3d_VectorProduct2d(0.0f, 0.0f, -windPowVec2.x, -windPowVec2.z, vectle.x, vectle.z);
pPkt->mSkewWidth = windPow * (1.0f - fabsf(windPowVec2.y)) * (1.0f - fabsf(windPowVec2.x * vectle.x + windPowVec2.z * vectle.z));
pPkt->mSkewWidth *= 0.6f * fabsf(pPkt->mSkewDir);
pPkt->mSkewWidth = windPow * (1.0f - std::fabsf(windPowVec2.y)) * (1.0f - std::fabsf(windPowVec2.x * vectle.x + windPowVec2.z * vectle.z));
pPkt->mSkewWidth *= 0.6f * std::fabsf(pPkt->mSkewDir);
for (s32 i = 0; i < g_env_light.mWaveChan.mWaveCount; i++) {
if (g_env_light.mWaveChan.mWaveReset)
@@ -2034,7 +2034,7 @@ void drawPoison(Mtx drawMtx, u8** pImg) {
GXLoadTexObj(&texObj, GX_TEXMAP0);
f32 cosR = fabsf(cM_scos(envLight.mpPoisonPacket->mCount * 500.0f + i * 4000));
f32 cosR = std::fabsf(cM_scos(envLight.mpPoisonPacket->mCount * 500.0f + i * 4000));
cosR *= cosR;
reg0.r = 95.0f + -50.0f * cosR;
+2 -2
View File
@@ -262,7 +262,7 @@ bool dLib_checkPlayerInCircle(cXyz center, f32 radius, f32 halfHeight) {
/* 80057F78-80058098 .text dLib_checkActorInCircle__F4cXyzP10fopAc_ac_cff */
bool dLib_checkActorInCircle(cXyz center, fopAc_ac_c* actor, f32 radius, f32 halfHeight) {
f32 distXZ = (center - actor->current.pos).absXZ();
f32 distY = fabsf(center.y - actor->current.pos.y);
f32 distY = std::fabsf(center.y - actor->current.pos.y);
if (distXZ < radius && distY < halfHeight) {
return true;
}
@@ -272,7 +272,7 @@ bool dLib_checkActorInCircle(cXyz center, fopAc_ac_c* actor, f32 radius, f32 hal
/* 80058098-8005820C .text dLib_checkActorInFan__F4cXyzP10fopAc_ac_cssff */
bool dLib_checkActorInFan(cXyz center, fopAc_ac_c* actor, s16 angleY, s16 fanSpreadAngle, f32 radius, f32 halfHeight) {
f32 distXZ = (center - actor->current.pos).absXZ();
f32 distY = fabsf(center.y - actor->current.pos.y);
f32 distY = std::fabsf(center.y - actor->current.pos.y);
s16 targetY = cLib_targetAngleY(&center, &actor->current.pos);
int angleDistY = cLib_distanceAngleS(angleY, targetY);
if (distXZ < radius && distY < halfHeight && angleDistY < fanSpreadAngle) {
+1 -1
View File
@@ -421,7 +421,7 @@ f32 dMagma_packet_c::checkYpos(cXyz& pos) {
if (floor->mpBalls == NULL)
continue;
if (fabsf(pos.y - floor->mPos.y) <= 236.803879f && fabsf(pos.x - floor->mPos.x) <= floor->mScaleX * 500.0f && fabsf(pos.z - floor->mPos.z) <= floor->mScaleZ * 500.0f) {
if (std::fabsf(pos.y - floor->mPos.y) <= 236.803879f && std::fabsf(pos.x - floor->mPos.x) <= floor->mScaleX * 500.0f && std::fabsf(pos.z - floor->mPos.z) <= floor->mScaleZ * 500.0f) {
dMagma_ball_c** ball = floor->mpBalls;
for (s32 j = 0; j < floor->mBallNum; ball++, j++) {
f32 y;
+6 -6
View File
@@ -224,8 +224,8 @@ void dNpc_EventCut_c::cutTurnToActorProc() {
s16 tAngle = cLib_targetAngleY(&mpActor->current.pos, &mPos);
int temp2 = tAngle - mpActor->current.angle.y;
f32 temp = fabsf(temp2);
if(field_0x44 == temp && fabsf(temp2) < 5376.0f) {
f32 temp = std::fabsf(temp2);
if(field_0x44 == temp && std::fabsf(temp2) < 5376.0f) {
cLib_calcTimer(&mTimer);
}
@@ -234,7 +234,7 @@ void dNpc_EventCut_c::cutTurnToActorProc() {
dComIfGp_evmng_cutEnd(mEvtStaffId);
}
field_0x44 = fabsf(tAngle - mpActor->current.angle.y);
field_0x44 = std::fabsf(tAngle - mpActor->current.angle.y);
}
/* 8021D51C-8021D730 .text cutMoveToActorStart__15dNpc_EventCut_cFv */
@@ -462,8 +462,8 @@ void dNpc_EventCut_c::cutTurnToPosProc() {
}
int temp2 = tAngle - mpActor->current.angle.y;
f32 temp = fabsf(temp2);
if(field_0x44 == temp && fabsf(temp2) < 5376.0f) {
f32 temp = std::fabsf(temp2);
if(field_0x44 == temp && std::fabsf(temp2) < 5376.0f) {
cLib_calcTimer(&mTimer);
}
@@ -472,7 +472,7 @@ void dNpc_EventCut_c::cutTurnToPosProc() {
dComIfGp_evmng_cutEnd(mEvtStaffId);
}
field_0x44 = fabsf(tAngle - mpActor->current.angle.y);
field_0x44 = std::fabsf(tAngle - mpActor->current.angle.y);
}
/* 8021DFB0-8021E168 .text cutMoveToPosStart__15dNpc_EventCut_cFv */
+1 -1
View File
@@ -884,7 +884,7 @@ void dPa_waveEcallBack::executeAfter(JPABaseEmitter* emitter) {
rot.z = 0;
emitter->setGlobalRotation(rot);
if (fabsf(speed - mVel) > mVelSpeed) {
if (std::fabsf(speed - mVel) > mVelSpeed) {
if (speed - mVel > 0.0f) {
speed = mVel + mVelSpeed;
} else {