diff --git a/include/SSystem/SComponent/c_xyz.h b/include/SSystem/SComponent/c_xyz.h index c8c17bf8e..c924fae83 100644 --- a/include/SSystem/SComponent/c_xyz.h +++ b/include/SSystem/SComponent/c_xyz.h @@ -131,10 +131,10 @@ struct cXyz : Vec { cXyz tmp2(other.x, 0, other.z); return tmp.abs2(tmp2); } - f32 abs() const { return sqrtf(this->abs2()); } - f32 abs(const Vec& other) const { return sqrtf(this->abs2(other)); } - f32 absXZ() const { return sqrtf(this->abs2XZ()); } - f32 absXZ(const Vec& other) const { return sqrtf(this->abs2XZ(other)); } + f32 abs() const { return std::sqrtf(this->abs2()); } + f32 abs(const Vec& other) const { return std::sqrtf(this->abs2(other)); } + f32 absXZ() const { return std::sqrtf(this->abs2XZ()); } + f32 absXZ(const Vec& other) const { return std::sqrtf(this->abs2XZ(other)); } f32 getMagXZ() const { return cXyz(this->x, 0, this->z).getSquareMag(); } f32 getDotProduct(const Vec& other) const { return VECDotProduct(this, &other); } diff --git a/src/JAZelAudio/JAIZelBasic.cpp b/src/JAZelAudio/JAIZelBasic.cpp index c5c012bb5..bb3944a0b 100644 --- a/src/JAZelAudio/JAIZelBasic.cpp +++ b/src/JAZelAudio/JAIZelBasic.cpp @@ -1655,7 +1655,7 @@ int JAIZelBasic::checkOnOuterSea(f32* r4) { f32 f6 = sp0C.field_0x0 - (mAudioCamera->field_0x0->x - islandX * 100000.0f); f32 f0 = sp0C.field_0x8 - (mAudioCamera->field_0x0->z - islandY * 100000.0f); *r4 = f6*f6 + f0*f0; - *r4 = sqrtf(*r4); + *r4 = std::sqrtf(*r4); if (*r4 <= sp0C.field_0xC) { return 0; diff --git a/src/JSystem/J3DGraphAnimator/J3DCluster.cpp b/src/JSystem/J3DGraphAnimator/J3DCluster.cpp index 72488ca2c..c8deddc0a 100644 --- a/src/JSystem/J3DGraphAnimator/J3DCluster.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DCluster.cpp @@ -199,7 +199,7 @@ void J3DDeformer::deform(J3DVertexBuffer* vtx, u16 idx, f32* weightList) { /* 802F3FA8-802F4064 .text normalize__11J3DDeformerFPf */ void J3DDeformer::normalize(f32* vec) { - f32 inv = 1.0f / sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); + f32 inv = 1.0f / std::sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); vec[0] *= inv; vec[1] *= inv; vec[2] *= inv; diff --git a/src/JSystem/J3DGraphBase/J3DTransform.cpp b/src/JSystem/J3DGraphBase/J3DTransform.cpp index 35ed52316..b89f51af7 100644 --- a/src/JSystem/J3DGraphBase/J3DTransform.cpp +++ b/src/JSystem/J3DGraphBase/J3DTransform.cpp @@ -33,9 +33,9 @@ f32 J3DCalcZValue(MtxP m, Vec v) { /* 802DA120-802DA2E0 .text J3DCalcBBoardMtx__FPA4_f */ void J3DCalcBBoardMtx(Mtx mtx) { - f32 sx = sqrtf(mtx[0][0]*mtx[0][0] + mtx[1][0]*mtx[1][0] + mtx[2][0]*mtx[2][0]); - f32 sy = sqrtf(mtx[0][1]*mtx[0][1] + mtx[1][1]*mtx[1][1] + mtx[2][1]*mtx[2][1]); - f32 sz = sqrtf(mtx[0][2]*mtx[0][2] + mtx[1][2]*mtx[1][2] + mtx[2][2]*mtx[2][2]); + f32 sx = std::sqrtf(mtx[0][0]*mtx[0][0] + mtx[1][0]*mtx[1][0] + mtx[2][0]*mtx[2][0]); + f32 sy = std::sqrtf(mtx[0][1]*mtx[0][1] + mtx[1][1]*mtx[1][1] + mtx[2][1]*mtx[2][1]); + f32 sz = std::sqrtf(mtx[0][2]*mtx[0][2] + mtx[1][2]*mtx[1][2] + mtx[2][2]*mtx[2][2]); mtx[0][0] = sx; mtx[0][1] = 0.0f; @@ -53,9 +53,9 @@ void J3DCalcBBoardMtx(Mtx mtx) { /* 802DA2E0-802DA584 .text J3DCalcYBBoardMtx__FPA4_f */ void J3DCalcYBBoardMtx(Mtx mtx) { /* Nonmatching */ - f32 sx = sqrtf(mtx[0][0]*mtx[0][0] + mtx[1][0]*mtx[1][0] + mtx[2][0]*mtx[2][0]); - f32 sy = sqrtf(mtx[0][1]*mtx[0][1] + mtx[1][1]*mtx[1][1] + mtx[2][1]*mtx[2][1]); - f32 sz = sqrtf(mtx[0][2]*mtx[0][2] + mtx[1][2]*mtx[1][2] + mtx[2][2]*mtx[2][2]); + f32 sx = std::sqrtf(mtx[0][0]*mtx[0][0] + mtx[1][0]*mtx[1][0] + mtx[2][0]*mtx[2][0]); + f32 sy = std::sqrtf(mtx[0][1]*mtx[0][1] + mtx[1][1]*mtx[1][1] + mtx[2][1]*mtx[2][1]); + f32 sz = std::sqrtf(mtx[0][2]*mtx[0][2] + mtx[1][2]*mtx[1][2] + mtx[2][2]*mtx[2][2]); Vec axisX, axisY, axisZ; diff --git a/src/JSystem/JUtility/JUTGamePad.cpp b/src/JSystem/JUtility/JUTGamePad.cpp index fb9dd1c1a..e0f7c9f09 100644 --- a/src/JSystem/JUtility/JUTGamePad.cpp +++ b/src/JSystem/JUtility/JUTGamePad.cpp @@ -305,7 +305,7 @@ u32 JUTGamePad::CStick::update(s8 x_val, s8 y_val, EStickMode mode, EWhichStick field_0xf = y_val; mPosX = (f32)x_val / (f32)clamp; mPosY = (f32)y_val / (f32)clamp; - mValue = sqrtf((mPosX * mPosX) + (mPosY * mPosY)); + mValue = std::sqrtf((mPosX * mPosX) + (mPosY * mPosY)); if (mValue > 1.0f) { if (mode == STICK_MODE_1) { 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 0898a54a9..0490f76c3 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 @@ -49,21 +49,6 @@ inline double sqrt_step(double tmpd, float mag) { return tmpd * 0.5 * (3.0 - mag * (tmpd * tmpd)); } -extern inline float sqrtf(float x) { - const double _half = .5; - const double _three = 3.0; - volatile float y; - if (x > 0.0f) { - double guess = __frsqrte((double)x); // returns an approximation to - guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits - guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits - guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits - y = (float)(x * guess); - return y; - } - return x; -} - extern inline double sqrt(double x) { if(x > 0.0) { @@ -93,6 +78,22 @@ inline float fmodf(float x, float y) { return fmod(x, y); } inline float atan2f(float y, float x) { return (float)atan2(y, x); } inline float sinf(float x) { return sin(x); } inline float cosf(float x) { return cos(x); } + +extern inline float sqrtf(float x) { + const double _half = .5; + const double _three = 3.0; + volatile float y; + if (x > 0.0f) { + double guess = __frsqrte((double)x); // returns an approximation to + guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits + guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits + guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits + y = (float)(x * guess); + return y; + } + return x; +} + }; // namespace std #endif diff --git a/src/SSystem/SComponent/c_cc_s.cpp b/src/SSystem/SComponent/c_cc_s.cpp index d6f1fc1dd..8465e3cd0 100644 --- a/src/SSystem/SComponent/c_cc_s.cpp +++ b/src/SSystem/SComponent/c_cc_s.cpp @@ -318,12 +318,12 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos objsDist.x = ppos2->x - ppos1->x; objsDist.y = ppos2->y - ppos1->y; objsDist.z = ppos2->z - ppos1->z; - objDistLen = sqrtf(objsDist.x*objsDist.x + objsDist.y*objsDist.y + objsDist.z*objsDist.z); + objDistLen = std::sqrtf(objsDist.x*objsDist.x + objsDist.y*objsDist.y + objsDist.z*objsDist.z); } else { objsDist.x = ppos2->x - ppos1->x; objsDist.y = 0.0f; objsDist.z = ppos2->z - ppos1->z; - objDistLen = sqrtf(objsDist.x*objsDist.x + objsDist.z*objsDist.z); + objDistLen = std::sqrtf(objsDist.x*objsDist.x + objsDist.z*objsDist.z); } if (!cM3d_IsZero(objDistLen)) { if (correctY) { diff --git a/src/SSystem/SComponent/c_m2d.cpp b/src/SSystem/SComponent/c_m2d.cpp index f3fe3a907..99da666f7 100644 --- a/src/SSystem/SComponent/c_m2d.cpp +++ b/src/SSystem/SComponent/c_m2d.cpp @@ -31,9 +31,9 @@ void cM2d_CrossCirLin(cM2dGCir& circle, f32 x0, f32 y0, f32 x1, f32 y1, f32* pDs if (dVar10 < 0.0f) { } else { f32 fVar2 = 1.0f / (2.0f * dVar13); - f32 fVar15 = sqrtf(dVar10); + f32 fVar15 = std::sqrtf(dVar10); fVar15 = fVar2 * (-dVar14 + fVar15); - f32 fVar16 = sqrtf(dVar10); + f32 fVar16 = std::sqrtf(dVar10); f32 fVar4 = fVar2 * (-dVar14 - fVar16); if (fVar15 > fVar4) { t = fVar15; diff --git a/src/SSystem/SComponent/c_m2d_g_box.cpp b/src/SSystem/SComponent/c_m2d_g_box.cpp index c20f794c4..89a70ac99 100644 --- a/src/SSystem/SComponent/c_m2d_g_box.cpp +++ b/src/SSystem/SComponent/c_m2d_g_box.cpp @@ -46,12 +46,12 @@ f32 cM2dGBox::GetLen(const cXy& p) const { // Diagonally above and to the left of the box. distX = p.x - mP0.x; distY = p.y - mP0.y; - return sqrtf(distX * distX + distY * distY); + return std::sqrtf(distX * distX + distY * distY); } else { // Diagonally below and to the left of the box. distX = p.x - mP0.x; distY = p.y - mP1.y; - return sqrtf(distX * distX + distY * distY); + return std::sqrtf(distX * distX + distY * distY); } } else { f32 distY; @@ -60,12 +60,12 @@ f32 cM2dGBox::GetLen(const cXy& p) const { // Diagonally above and to the right of the box. distX = p.x - mP1.x; distY = p.y - mP0.y; - return sqrtf(distX * distX + distY * distY); + return std::sqrtf(distX * distX + distY * distY); } else { // Diagonally below and to the right of the box. distX = p.x - mP1.x; distY = p.y - mP1.y; - return sqrtf(distX * distX + distY * distY); + return std::sqrtf(distX * distX + distY * distY); } } } diff --git a/src/SSystem/SComponent/c_m3d.cpp b/src/SSystem/SComponent/c_m3d.cpp index 2d86f81b4..7d6ddd0c1 100644 --- a/src/SSystem/SComponent/c_m3d.cpp +++ b/src/SSystem/SComponent/c_m3d.cpp @@ -604,7 +604,7 @@ bool cM3d_Cross_CpsSph(const cM3dGCps& param_1, const cM3dGSph& param_2, Vec* pa } Vec auStack_34; if (cM3d_Len3dSqPntAndSegLine(¶m_1, param_2.GetCP(), &auStack_34, &local_38) != 0) { - if (sqrtf(local_38) < param_1.GetR() + param_2.GetR()) { + if (std::sqrtf(local_38) < param_1.GetR() + param_2.GetR()) { cM3d_Cross_CpsSph_CrossPos(param_1, param_2, auStack_34, param_3); return true; } @@ -635,7 +635,7 @@ void cM3d_CalcVecAngle(const Vec& vec, s16* a, s16* b) { /* 80251560-80251634 .text cM3d_CalcVecZAngle__FRC3VecP5csXyz */ void cM3d_CalcVecZAngle(const Vec& param_0, csXyz* param_1) { - param_1->x = -cM_atan2s(param_0.y, sqrtf(param_0.x * param_0.x + param_0.z * param_0.z));; + param_1->x = -cM_atan2s(param_0.y, std::sqrtf(param_0.x * param_0.x + param_0.z * param_0.z));; param_1->y = cM_atan2s(param_0.x, param_0.z); param_1->z = 0; } diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index d88001fe2..8b16d2c94 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -505,7 +505,7 @@ void enemy_fire(enemyfire* ef) { ef->mDirection.y = 0.2f + REG0_F(11); - f32 speed = sqrtf(vel.x * vel.x + vel.y * vel.y + vel.z * vel.z); + f32 speed = std::sqrtf(vel.x * vel.x + vel.y * vel.y + vel.z * vel.z); speed = (0.03f + REG0_F(12)) * speed + 1.0f; if (speed > 1.5f + REG0_F(13)) { speed = 1.5f + REG0_F(13); diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index 73627bc6e..8ddbdde30 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -458,7 +458,7 @@ static void medama_move(am_class* i_this) { i_this->mTargetEyeRot.y = 0x71C; } - i_this->mTargetEyeRot.x = cM_atan2s(diffY, sqrtf(diffX*diffX + diffZ*diffZ)); + i_this->mTargetEyeRot.x = cM_atan2s(diffY, std::sqrtf(diffX*diffX + diffZ*diffZ)); if (i_this->mTargetEyeRot.x < -0x38E) { i_this->mTargetEyeRot.x = -0x38E; } else if (i_this->mTargetEyeRot.x > 0x38E) { @@ -487,7 +487,7 @@ static void action_dousa(am_class* i_this) { fopAcM_OnStatus(i_this, fopAcStts_SHOWMAP_e); if (fopAcM_searchPlayerDistance(i_this) < 1000.0f) { f32 yDist = player->current.pos.y - i_this->current.pos.y; - yDist = sqrtf(yDist*yDist); // ??? + yDist = std::sqrtf(yDist*yDist); // ??? if (yDist > 300.0f) { break; } @@ -532,7 +532,7 @@ static void action_dousa(am_class* i_this) { if (i_this->mType & 1) { f32 xDist = i_this->current.pos.x - i_this->mSpawnPos.x; f32 zDist = i_this->current.pos.z - i_this->mSpawnPos.z; - f32 xzDist = sqrtf(xDist*xDist + zDist*zDist); + f32 xzDist = std::sqrtf(xDist*xDist + zDist*zDist); if (xzDist > i_this->mAreaRadius) { i_this->mAction = ACTION_MODORU_MOVE; i_this->mState = 0x14; @@ -544,7 +544,7 @@ static void action_dousa(am_class* i_this) { break; } f32 yDist = player->current.pos.y - i_this->current.pos.y; - yDist = sqrtf(yDist*yDist); // ??? + yDist = std::sqrtf(yDist*yDist); // ??? if (yDist > 300.0f) { i_this->mState = 9; break; @@ -690,7 +690,7 @@ static void action_modoru_move(am_class* i_this) { i_this->mTargetAngleY = cM_atan2s(xDistToSpawn, zDistToSpawn); } - f32 xzDist = sqrtf(xDistToSpawn*xDistToSpawn + zDistToSpawn*zDistToSpawn); + f32 xzDist = std::sqrtf(xDistToSpawn*xDistToSpawn + zDistToSpawn*zDistToSpawn); if (xzDist < 20.0f) { i_this->mTargetAngleY = i_this->mSpawnRotY; i_this->speedF = 0.0f; diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index 480f17f72..439df602f 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -695,7 +695,7 @@ static fpc_ProcID search_wepon(bk_class* i_this) { sp18.x = r25->current.pos.x - i_this->eyePos.x; sp18.y = 50.0f + r25->current.pos.y - i_this->eyePos.y; sp18.z = r25->current.pos.z - i_this->eyePos.z; - f32 f4 = sqrtf(sp18.x*sp18.x + sp18.z*sp18.z); + f32 f4 = std::sqrtf(sp18.x*sp18.x + sp18.z*sp18.z); if (f4 < f29 && !daBk_other_bg_check(i_this, r25)) { 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); @@ -774,8 +774,8 @@ static fopAc_ac_c* search_bomb(bk_class* i_this, BOOL r26) { cXyz sp1C; sp1C.x = r24->current.pos.x - i_this->current.pos.x; sp1C.z = r24->current.pos.z - i_this->current.pos.z; - f32 f0 = sqrtf(sp28.x*sp28.x + sp28.z*sp28.z); - f32 f5 = sqrtf(sp1C.x*sp1C.x + sp1C.z*sp1C.z); + f32 f0 = std::sqrtf(sp28.x*sp28.x + sp28.z*sp28.z); + f32 f5 = std::sqrtf(sp1C.x*sp1C.x + sp1C.z*sp1C.z); if (f0 < f29 && !(f5 > 30.0f + i_this->mPlayerDistance) && !(daBk_other_bg_check(i_this, r24) && r26) ) { @@ -999,7 +999,7 @@ static void path_check(bk_class* i_this, u8 r19) { f32 distX = i_this->current.pos.x - pnt->mPos.x; f32 distY = i_this->current.pos.y - pnt->mPos.y; f32 distZ = i_this->current.pos.z - pnt->mPos.z; - if (sqrtf(distX*distX + distY*distY + distZ*distZ) < f0) { + if (std::sqrtf(distX*distX + distY*distY + distZ*distZ) < f0) { if (r19) { i_this->m1216 = j; } else { @@ -1101,7 +1101,7 @@ static void jyunkai(bk_class* i_this) { i_this->dr.m4D0 = cM_atan2s(sp10.x, sp10.z); if (i_this->m1215 != 0 && (i_this->m0B30 != 0 || i_this->m11F3 != 0)) { - if (sqrtf(sp10.x*sp10.x + sp10.z*sp10.z) < f31 * 0.25f * 2.0f) { + if (std::sqrtf(sp10.x*sp10.x + sp10.z*sp10.z) < f31 * 0.25f * 2.0f) { if (i_this->ppd->mpPnt[i_this->m1216].mArg3 == 3) { wait_set(i_this); i_this->dr.m004 = 2; @@ -1109,7 +1109,7 @@ static void jyunkai(bk_class* i_this) { i_this->dr.m004 = -1; } } - } else if (sqrtf(sp10.x*sp10.x + sp10.z*sp10.z) < f31 * 0.25f * 2.0f || + } else if (std::sqrtf(sp10.x*sp10.x + sp10.z*sp10.z) < f31 * 0.25f * 2.0f || ( i_this->m0300[2] == 0 && ( i_this->dr.mAcch.ChkWallHit() || @@ -1331,7 +1331,7 @@ static void stand(bk_class* i_this) { case 0x34: sp28 = i_this->home.pos - i_this->current.pos; i_this->dr.m4D0 = cM_atan2s(sp28.x, sp28.z); - if (sqrtf(sp28.x*sp28.x + sp28.z*sp28.z) < l_bkHIO.m054 * 0.25f * 5.0f) { + if (std::sqrtf(sp28.x*sp28.x + sp28.z*sp28.z) < l_bkHIO.m054 * 0.25f * 5.0f) { i_this->dr.m004 = 0; } cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->dr.m4D0, 4, 0x1000); @@ -1546,7 +1546,7 @@ static void stand2(bk_class* i_this) { sp24 = i_this->home.pos - i_this->current.pos; temp_568: i_this->dr.m4D0 = cM_atan2s(sp24.x, sp24.z); - if (sqrtf(sp24.x*sp24.x + sp24.z*sp24.z) < l_bkHIO.m054 * 0.25f * 5.0f) { + if (std::sqrtf(sp24.x*sp24.x + sp24.z*sp24.z) < l_bkHIO.m054 * 0.25f * 5.0f) { if (i_this->dr.m004 == 0x3C) { i_this->dr.m004 = 0; } else if (i_this->m1216 == 0) { @@ -1623,7 +1623,7 @@ static void path_run(bk_class* i_this) { sp0C.z = z - i_this->current.pos.z; i_this->dr.m4D0 = cM_atan2s(sp0C.x, sp0C.z); - if (sqrtf(sp0C.x*sp0C.x + sp0C.z*sp0C.z) < 100.0f) { + if (std::sqrtf(sp0C.x*sp0C.x + sp0C.z*sp0C.z) < 100.0f) { i_this->m1216 += i_this->m1217; if (i_this->m1216 >= (s8)i_this->ppd->m_num) { i_this->m1216 = i_this->ppd->m_num - 1; diff --git a/src/d/actor/d_a_bomb2.cpp b/src/d/actor/d_a_bomb2.cpp index 882f5bcee..2397077d1 100644 --- a/src/d/actor/d_a_bomb2.cpp +++ b/src/d/actor/d_a_bomb2.cpp @@ -651,7 +651,7 @@ namespace daBomb2 { cXyz sp48 = *mSph.GetTgRVecP(); f32 f31 = sp48.abs2(); if (f31 > f30*f30) { - sp48 *= f30 / sqrtf(f31);; + sp48 *= f30 / std::sqrtf(f31);; } cCcD_ShapeAttr* hitShapeAttr = hitObj->GetShapeAttr(); cXyz hitNormal = cXyz::Zero; diff --git a/src/d/actor/d_a_bomb3.inc b/src/d/actor/d_a_bomb3.inc index aef29dc3e..0f199a1f1 100644 --- a/src/d/actor/d_a_bomb3.inc +++ b/src/d/actor/d_a_bomb3.inc @@ -1130,7 +1130,7 @@ void daBomb_c::set_wind_vec() { cXyz sp48 = *mSph.GetTgRVecP(); f32 f31 = sp48.abs2(); if (f31 > 180.0f*180.0f) { - sp48 *= 180.0f / sqrtf(f31);; + sp48 *= 180.0f / std::sqrtf(f31);; } cCcD_ShapeAttr* hitShapeAttr = hitObj->GetShapeAttr(); cXyz hitNormal = cXyz::Zero; diff --git a/src/d/actor/d_a_bwdg.cpp b/src/d/actor/d_a_bwdg.cpp index 969ea0dc2..390ac7735 100644 --- a/src/d/actor/d_a_bwdg.cpp +++ b/src/d/actor/d_a_bwdg.cpp @@ -130,7 +130,7 @@ static void wave_cont(bwdg_class* i_this, u8 r4) { sp24.x = posVtx->x - sp30.x; sp24.z = posVtx->z - sp30.z; - f32 f0 = sqrtf(sp24.x*sp24.x + sp24.z*sp24.z); + f32 f0 = std::sqrtf(sp24.x*sp24.x + sp24.z*sp24.z); f32 f1 = 3000.0f - f0; f32 f3; f32 f4 = f1; diff --git a/src/d/actor/d_a_kt.cpp b/src/d/actor/d_a_kt.cpp index 04633a964..bf1d0d4bd 100644 --- a/src/d/actor/d_a_kt.cpp +++ b/src/d/actor/d_a_kt.cpp @@ -56,14 +56,14 @@ void kotori_move(kt_class* i_this) { f32 dx = player->current.pos.x - *(r28 = &i_this->current.pos.x); f32 dz = player->current.pos.z - *(r27 = &i_this->current.pos.z); - f32 dist_xz = sqrtf(dx*dx + dz*dz); + f32 dist_xz = std::sqrtf(dx*dx + dz*dz); cLib_addCalcAngleS2(&i_this->mAngleRoll, 0, 2, REG0_S(4) + 0x1000); f32 vx = i_this->mTargetPos.x - *r28; f32 vy = i_this->mTargetPos.y - *(r26 = &i_this->current.pos.y); f32 vz = i_this->mTargetPos.z - *r27; s16 angleX = cM_atan2s(vx, vz); - s16 angleY = -cM_atan2s(vy, sqrtf(vx*vx + vz*vz)); + s16 angleY = -cM_atan2s(vy, std::sqrtf(vx*vx + vz*vz)); cXyz offs; cXyz pt; @@ -115,7 +115,7 @@ void kotori_move(kt_class* i_this) { cLib_addCalc2(&i_this->mSpeedLerp, 1.0f, 1.0f, 0.1f); goto calc_012; case 1: - dist = sqrtf(vx*vx + vy*vy + vz*vz); + dist = std::sqrtf(vx*vx + vy*vy + vz*vz); if (dist < REG0_F(1) * 10.0f + 800.0f) { i_this->mState = 8; } @@ -161,7 +161,7 @@ void kotori_move(kt_class* i_this) { case 2: i_this->mTargetPos = headTopPos; i_this->mTargetPos.y += 200.0f; - dist = sqrtf(vx*vx + vy*vy + vz*vz); + dist = std::sqrtf(vx*vx + vy*vy + vz*vz); if (dist < REG0_F(1) * 10.0f + 800.0f) { i_this->mState = 9; } diff --git a/src/d/actor/d_a_kytag02.cpp b/src/d/actor/d_a_kytag02.cpp index 5b8753168..92dc5c683 100644 --- a/src/d/actor/d_a_kytag02.cpp +++ b/src/d/actor/d_a_kytag02.cpp @@ -50,7 +50,7 @@ dPath* get_nearpos_rail(kytag02_class* i_this, dPath* i_path, cXyz* pos, int* i_ for (s32 i = 0; i < path->m_num; i++) { f32 dx = path->mpPnt[i].mPos.x - pos->x; f32 dz = path->mpPnt[i].mPos.z - pos->z; - f32 dist = sqrtf(dx*dx + dz*dz); + f32 dist = std::sqrtf(dx*dx + dz*dz); if (best > dist) { bestPath = path; bestIdx = i; diff --git a/src/d/actor/d_a_msw.cpp b/src/d/actor/d_a_msw.cpp index d43c951d2..f4de35a46 100644 --- a/src/d/actor/d_a_msw.cpp +++ b/src/d/actor/d_a_msw.cpp @@ -63,7 +63,7 @@ void chain_Draw(msw_class* i_this) { angle1 = -cM_atan2s(tmp.y, tmp.z); // TODO: std::sqrtf(float) - angle2 = cM_atan2s(tmp.x, sqrtf(tmp.y * tmp.y + tmp.z * tmp.z)); + angle2 = cM_atan2s(tmp.x, std::sqrtf(tmp.y * tmp.y + tmp.z * tmp.z)); MtxTrans(i_this->m2E0[i].x, i_this->m2E0[i].y, i_this->m2E0[i].z, false); diff --git a/src/d/actor/d_a_npc_btsw2.cpp b/src/d/actor/d_a_npc_btsw2.cpp index 284eeebba..158f96ef7 100644 --- a/src/d/actor/d_a_npc_btsw2.cpp +++ b/src/d/actor/d_a_npc_btsw2.cpp @@ -212,7 +212,7 @@ bool daNpc_Btsw2_c::chkAttention(cXyz pos, s16 facingAngleY) { cXyz delta; delta.x = player->current.pos.x - pos.x; delta.z = player->current.pos.z - pos.z; - f32 distXZ = sqrtf(delta.x*delta.x + delta.z*delta.z); + f32 distXZ = std::sqrtf(delta.x*delta.x + delta.z*delta.z); s16 targetAngleY = cM_atan2s(delta.x, delta.z); if (mHasAttention) { // Increase the attention range when we're already looking at the player so it sticks slightly out of range. diff --git a/src/d/actor/d_a_npc_ji1.cpp b/src/d/actor/d_a_npc_ji1.cpp index f0371e6e9..bf77bef21 100644 --- a/src/d/actor/d_a_npc_ji1.cpp +++ b/src/d/actor/d_a_npc_ji1.cpp @@ -3601,7 +3601,7 @@ BOOL daNpc_Ji1_c::chkAttention(cXyz param_1, s16 param_2) { temp4.x = player->current.pos.x - param_1.x; temp4.z = player->current.pos.z - param_1.z; - f32 dist = sqrtf(temp4.x * temp4.x + temp4.z * temp4.z); + f32 dist = std::sqrtf(temp4.x * temp4.x + temp4.z * temp4.z); s16 angle = cM_atan2s(temp4.x, temp4.z); if(field_0xD7A != 0) { diff --git a/src/d/actor/d_a_npc_md.cpp b/src/d/actor/d_a_npc_md.cpp index 842d95ec0..b10454c47 100644 --- a/src/d/actor/d_a_npc_md.cpp +++ b/src/d/actor/d_a_npc_md.cpp @@ -574,7 +574,7 @@ static BOOL hairCross(cXyz* i_r3, cXyz* i_r4, cXyz* i_r5) { f32 f30 = r1_e4.abs(); cXyz r1_108 = (r1_138 - r1_120); r1_108.normalizeZP(); - r1_108 = r1_108 * sqrtf(f30 * f30 - f31 * f31); + r1_108 = r1_108 * std::sqrtf(f30 * f30 - f31 * f31); *i_r5 = r1_120 + r1_108; return TRUE; } @@ -588,7 +588,7 @@ static BOOL hairCross(cXyz* i_r3, cXyz* i_r4, cXyz* i_r5) { f32 f30 = r1_e4.abs(); cXyz r1_108 = (r1_138 - r1_120); r1_108.normalizeZP(); - r1_108 = r1_108 * sqrtf(f30 * f30 - f31 * f31); + r1_108 = r1_108 * std::sqrtf(f30 * f30 - f31 * f31); *i_r5 = r1_120 + r1_108; return TRUE; } diff --git a/src/d/actor/d_a_npc_os.cpp b/src/d/actor/d_a_npc_os.cpp index 456ef948b..afaf118c3 100644 --- a/src/d/actor/d_a_npc_os.cpp +++ b/src/d/actor/d_a_npc_os.cpp @@ -996,7 +996,7 @@ f32 daNpc_Os_c::checkForwardGroundY(s16 param_1) { f32 daNpc_Os_c::checkWallJump(s16 param_1) { f32 delta = checkForwardGroundY(param_1) - current.pos.y; if(0.0f < delta && delta < 80.0f) { - delta = sqrtf(delta) * 3.6f; + delta = std::sqrtf(delta) * 3.6f; } else { delta = -1.0f; @@ -1773,7 +1773,7 @@ BOOL daNpc_Os_c::chkAttention(cXyz param_1, s16 param_2) { cXyz delta; delta.x = player->current.pos.x - param_1.x; delta.z = player->current.pos.z - param_1.z; - f32 dist = sqrtf(delta.x*delta.x + delta.z*delta.z); + f32 dist = std::sqrtf(delta.x*delta.x + delta.z*delta.z); s16 angle = cM_atan2s(delta.x, delta.z); if(field_0x7A4) { @@ -1798,7 +1798,7 @@ bool daNpc_Os_c::chkArea(cXyz* param_1) { cXyz delta; delta.x = player->current.pos.x - param_1->x; delta.z = player->current.pos.z - param_1->z; - f32 dist = sqrtf(delta.x*delta.x + delta.z*delta.z); + f32 dist = std::sqrtf(delta.x*delta.x + delta.z*delta.z); maxDist += 40.0f; return maxDist > dist; diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index 9a1d728bc..961daac9b 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -1248,7 +1248,7 @@ namespace daObjMovebox { f3 = movebox->i_attr()->m30; f4 = movebox->i_attr()->m74 * movebox->i_attr()->m48; } - f32 f6 = sqrtf(deltaX*deltaX + deltaZ*deltaZ); + f32 f6 = std::sqrtf(deltaX*deltaX + deltaZ*deltaZ); f6 = 1.0f - f6 * attr->m74; f6 = f6 * 0.9f + 0.1f; if (f6 < 0.0f) { @@ -1405,7 +1405,7 @@ namespace daObjMovebox { mBgc.chk_wall_touch2(this, bgcSrc, bgcSrcCount, M_dir_base[3]); if (f31 > f30) { - f32 temp = i_attr()->m4C / sqrtf(f31); + f32 temp = i_attr()->m4C / std::sqrtf(f31); m60C *= temp; m610 *= temp; } diff --git a/src/d/actor/d_a_pw.cpp b/src/d/actor/d_a_pw.cpp index 23fe85410..af9f099a2 100644 --- a/src/d/actor/d_a_pw.cpp +++ b/src/d/actor/d_a_pw.cpp @@ -346,7 +346,7 @@ void action_dousa(pw_class* i_this) { f32 delta_x = pnt->mPos.x - i_this->current.pos.x; f32 delta_z = pnt->mPos.z - i_this->current.pos.z; i_this->m38C = cM_atan2s(delta_x, delta_z); - f32 dist_xz = sqrtf(delta_x*delta_x + delta_z*delta_z); + f32 dist_xz = std::sqrtf(delta_x*delta_x + delta_z*delta_z); if (dist_xz < 80.0f) { i_this->mPathPntIdx++; if (i_this->mPathPntIdx >= i_this->mpPath->m_num) { diff --git a/src/d/d_a_obj.cpp b/src/d/d_a_obj.cpp index e7248bd48..0d4aacf3e 100644 --- a/src/d/d_a_obj.cpp +++ b/src/d/d_a_obj.cpp @@ -171,7 +171,7 @@ namespace daObj { } pActor->speed.set(x, y, z); - pActor->speedF = sqrtf(x * x + z * z); + pActor->speedF = std::sqrtf(x * x + z * z); pActor->current.angle.y = cM_atan2s(spf, grav); fopAcM_posMove(pActor, pAddVel); } diff --git a/src/d/d_bg_s_acch.cpp b/src/d/d_bg_s_acch.cpp index b308a10eb..f2ad3cdde 100644 --- a/src/d/d_bg_s_acch.cpp +++ b/src/d/d_bg_s_acch.cpp @@ -200,7 +200,7 @@ void dBgS_Acch::LineCheck(dBgS& i_bgs) { cM3dGPla* pla = i_bgs.GetTriPla(linChk); if (!(pla->GetNP()->y >= 0.5f)) { VECAdd(pm_pos, pla->GetNP(), pm_pos); - if (!cM3d_IsZero(sqrtf(pla->GetNP()->x*pla->GetNP()->x + pla->GetNP()->z*pla->GetNP()->z))) + if (!cM3d_IsZero(std::sqrtf(pla->GetNP()->x*pla->GetNP()->x + pla->GetNP()->z*pla->GetNP()->z))) pm_acch_cir[i].SetWallHDirect(pm_pos->y); pm_pos->y -= pm_acch_cir[i].GetWallH(); diff --git a/src/d/d_cc_s.cpp b/src/d/d_cc_s.cpp index de05ed925..95ed2c225 100644 --- a/src/d/d_cc_s.cpp +++ b/src/d/d_cc_s.cpp @@ -218,12 +218,12 @@ void dCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos objsDist.x = ppos2->x - ppos1->x; objsDist.y = ppos2->y - ppos1->y; objsDist.z = ppos2->z - ppos1->z; - objDistLen = sqrtf(objsDist.x*objsDist.x + objsDist.y*objsDist.y + objsDist.z*objsDist.z); + objDistLen = std::sqrtf(objsDist.x*objsDist.x + objsDist.y*objsDist.y + objsDist.z*objsDist.z); } else { objsDist.x = ppos2->x - ppos1->x; objsDist.y = 0.0f; objsDist.z = ppos2->z - ppos1->z; - objDistLen = sqrtf(objsDist.x*objsDist.x + objsDist.z*objsDist.z); + objDistLen = std::sqrtf(objsDist.x*objsDist.x + objsDist.z*objsDist.z); } if (!cM3d_IsZero(objDistLen)) { if (correctY) { diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 5bddb7934..3ce9ebb7a 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -1642,13 +1642,13 @@ u8 setShadowRealMtx(Mtx r26, Mtx r27, Mtx r28, cXyz* r6, cXyz* r29, f32 f30, f32 local_64.x *= tmp; local_64.z *= tmp; } - f32 tmp2 = sqrtf(local_64.abs2()); + f32 tmp2 = std::sqrtf(local_64.abs2()); if (tmp2 != 0.0f) { f32 tmp3 = (local_64.y / tmp2); if (tmp3 < 1.5f) { local_64.y = 1.5f * tmp2; tmp2 = local_64.abs2(); - tmp2 = sqrtf(tmp2); + tmp2 = std::sqrtf(tmp2); } tmp2 = (f30 * 0.5f) / tmp2; } @@ -1828,7 +1828,7 @@ void dDlst_shadowSimple_c::set(cXyz* pos, f32 y, f32 param_3, cXyz* floorNrm, s1 mDoMtx_stack_c::scaleM(param_3, offsetY + offsetY + 16.0f, param_3 * param_6); mDoMtx_concat(j3dSys.getViewMtx(), mDoMtx_stack_c::get(), mVolumeMtx); - f32 xs = sqrtf(1.0f - floorNrm->x * floorNrm->x); + f32 xs = std::sqrtf(1.0f - floorNrm->x * floorNrm->x); f32 yy; f32 zz; if (xs != 0.0f) { diff --git a/src/d/d_grass.cpp b/src/d/d_grass.cpp index 1d154af0c..f7accd8c6 100644 --- a/src/d/d_grass.cpp +++ b/src/d/d_grass.cpp @@ -51,7 +51,7 @@ void dGrass_data_c::WorkCo(fopAc_ac_c* other, u32, int roomNo) { delta.y = mPos.y - other->current.pos.y; s16 rotY = cM_atan2s(delta.x, delta.z); - f32 dist = sqrtf(distSq); + f32 dist = std::sqrtf(distSq); dGrass_anm_c* anm; if (mAnimIdx < 8) { if (other->speedF > 16.0f) { diff --git a/src/d/d_jnt_hit.cpp b/src/d/d_jnt_hit.cpp index d4d527e80..b8ee337a9 100644 --- a/src/d/d_jnt_hit.cpp +++ b/src/d/d_jnt_hit.cpp @@ -98,7 +98,7 @@ BOOL JntHit_c::CylHitPosAngleOffset(cXyz* r27, csXyz* r28, cXyz* r29, csXyz* r30 f32 temp = f31*f31 + f28*f28 - r1_DC.abs2(); if (temp < 0.0f) temp = 0.0f; - r1_E8 = r1_C4 * (-f31 - sqrtf(temp)); + r1_E8 = r1_C4 * (-f31 - std::sqrtf(temp)); r1_E8 += *r27; if (temp == 0.0f) { cXyz r1_AC = r1_E8; @@ -197,7 +197,7 @@ BOOL JntHit_c::SphHitPosAngleOffset(cXyz* r27, csXyz* r29, cXyz* r30, csXyz* r31 if (temp < 0.0f) temp = 0.0f; - cXyz r1_28 = r1_34 * (-f31 - sqrtf(temp)); + cXyz r1_28 = r1_34 * (-f31 - std::sqrtf(temp)); r1_28 += *r27; if (r1_28.abs() > f30) { r1_28.normalizeZP(); @@ -309,7 +309,7 @@ s32 JntHit_c::searchJntHitPosAngleOffset(cXyz* r18, csXyz* r28, cXyz* r29, csXyz f5 = 0.0f; } } - f32 f4 = sqrtf(f5*f5 + f29*f29); + f32 f4 = std::sqrtf(f5*f5 + f29*f29); if (f4 <= f31) { jointIndex = *pJointIndex; f31 = f4; diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index 5e8d241d0..fcdf25210 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -2830,7 +2830,7 @@ void dKy_Itemgetcol_chg_move() { cXyz camfwd; dKyr_get_vectle_calc(&camera->mLookat.mEye, &camera->mLookat.mCenter, &camfwd); - f32 cam_distXZ = sqrtf(camfwd.x*camfwd.x + camfwd.z*camfwd.z); + f32 cam_distXZ = std::sqrtf(camfwd.x*camfwd.x + camfwd.z*camfwd.z); s16 angle = cM_atan2s(camfwd.x, camfwd.z) - offsAngle; camfwd.x = cM_scos(0) * cM_ssin(angle); camfwd.y = cM_ssin(0); diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index 86ef24918..0155a576e 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -373,7 +373,7 @@ void dKyr_wind_move() { windEff.mState = 1; } - f32 windVec_absXZ = sqrtf(windVec.x*windVec.x + windVec.z*windVec.z); + f32 windVec_absXZ = std::sqrtf(windVec.x*windVec.x + windVec.z*windVec.z); windEff.mAngleXZ = cM_atan2s(windVec.x, windVec.z); windEff.mAngleY = cM_atan2s(windVec.y, windVec_absXZ); @@ -401,7 +401,7 @@ void dKyr_wind_move() { if (windEff.field_0x28 > 60535) windEff.field_0x32 = 0; } else { - f32 windVec_absXZ = sqrtf(windVec.x*windVec.x + windVec.z*windVec.z); + f32 windVec_absXZ = std::sqrtf(windVec.x*windVec.x + windVec.z*windVec.z); s16 targetAngleXZ = cM_atan2s(windVec.x, windVec.z); s16 targetAngleY = cM_atan2s(windVec.y, windVec_absXZ); cLib_addCalcAngleS(&windEff.mAngleY, targetAngleY, 10, 1000, 1); @@ -1476,11 +1476,11 @@ void dKyr_drawSun(Mtx drawMtx, cXyz* pPos, GXColor& reg0, u8** pImg) { snap_sunmoon_proc(&moonPos2, texidx); dKyr_get_vectle_calc(&pCamera->mLookat.mEye, &pCamera->mLookat.mCenter, &camfwd); - f32 cam_distXZ = sqrtf(camfwd.x*camfwd.x + camfwd.z*camfwd.z); + f32 cam_distXZ = std::sqrtf(camfwd.x*camfwd.x + camfwd.z*camfwd.z); f32 cam_theta = std::atan2f(camfwd.x, camfwd.z); f32 cam_phi = std::atan2f(camfwd.y, cam_distXZ); - f32 moon_distXZ = sqrtf(moonPos.x*moonPos.x + moonPos.z*moonPos.z); + f32 moon_distXZ = std::sqrtf(moonPos.x*moonPos.x + moonPos.z*moonPos.z); f32 moon_theta = std::atan2f(moonPos.x, moonPos.z); f32 moon_phi = std::atan2f(moonPos.y, moon_distXZ); @@ -1574,13 +1574,13 @@ void dKyr_drawSun(Mtx drawMtx, cXyz* pPos, GXColor& reg0, u8** pImg) { cXyz camfwd; snap_sunmoon_proc(&sunPos, 9); - f32 sun_distXZ = sqrtf(sunPos.x*sunPos.x + sunPos.z*sunPos.z); + f32 sun_distXZ = std::sqrtf(sunPos.x*sunPos.x + sunPos.z*sunPos.z); f32 sun_theta = std::atan2f(sunPos.x, sunPos.z); f32 sun_phi = std::atan2f(sunPos.y, sun_distXZ); dKyr_get_vectle_calc(&pCamera->mLookat.mEye, &pCamera->mLookat.mCenter, &camfwd); - f32 cam_distXZ = sqrtf(camfwd.x*camfwd.x + camfwd.z*camfwd.z); + f32 cam_distXZ = std::sqrtf(camfwd.x*camfwd.x + camfwd.z*camfwd.z); f32 cam_theta = std::atan2f(camfwd.x, camfwd.z); f32 cam_phi = std::atan2f(camfwd.y, cam_distXZ); diff --git a/src/d/d_ky_thunder.cpp b/src/d/d_ky_thunder.cpp index 44fda1007..a630ebcf1 100644 --- a/src/d/d_ky_thunder.cpp +++ b/src/d/d_ky_thunder.cpp @@ -174,7 +174,7 @@ s32 dThunder_c::create() { mScale.z = 1.0f; dKyr_get_vectle_calc(&pCamera->mLookat.mEye, &pCamera->mLookat.mCenter, &fwd); - f32 distXZ = sqrtf(fwd.x * fwd.x + fwd.z * fwd.z); + f32 distXZ = std::sqrtf(fwd.x * fwd.x + fwd.z * fwd.z); s16 rotX = cM_atan2s(fwd.x, fwd.z); s16 rotY = cM_atan2s(fwd.y, distXZ); diff --git a/src/d/d_magma.cpp b/src/d/d_magma.cpp index 5982d1074..6d745f027 100644 --- a/src/d/d_magma.cpp +++ b/src/d/d_magma.cpp @@ -121,7 +121,7 @@ BOOL dMagma_ball_c::rangeCheck(cXyz& pos, f32* dst) { f32 rad1 = mScale * 243.6414f; if (distSq < rad1*rad1) { f32 rad2 = mScale * 800.0f; - f32 dist = sqrtf(rad2 * rad2 - distSq); + f32 dist = std::sqrtf(rad2 * rad2 - distSq); f32 temp = (mPos.y - (rad2 - 47.999146f)); temp += dist; *dst = temp; diff --git a/src/d/d_npc.cpp b/src/d/d_npc.cpp index 484579a31..b08da24bb 100644 --- a/src/d/d_npc.cpp +++ b/src/d/d_npc.cpp @@ -107,7 +107,7 @@ void dNpc_JntCtrl_c::lookAtTarget(s16* outY, cXyz* pDstPos, cXyz srcPos, s16 def delta.x = pDstPos->x - srcPos.x; delta.y = pDstPos->y - srcPos.y; delta.z = pDstPos->z - srcPos.z; - f32 distXZ = sqrtf(delta.x * delta.x + delta.z * delta.z); + f32 distXZ = std::sqrtf(delta.x * delta.x + delta.z * delta.z); targetY = cM_atan2s(delta.x, delta.z); r23 = cM_atan2s(delta.y, distXZ); } else { @@ -426,7 +426,7 @@ bool dNpc_PathRun_c::setNearPathIndx(cXyz* param_1, f32 param_2) { cXyz diff = (*param_1 - point); f32 xz_mag = diff.abs2XZ(); f32 y_mag = param_2 * (diff.y * diff.y); - f32 dist = sqrtf(y_mag + xz_mag); + f32 dist = std::sqrtf(y_mag + xz_mag); if(max_dist > dist) { max_dist = dist; @@ -632,7 +632,7 @@ void dNpc_calc_DisXZ_AngY(cXyz param_1, cXyz param_2, float* param_3, s16* param diff.z = param_2.z - param_1.z; if(param_3 != 0) { - f32 dist = sqrtf(diff.x * diff.x + diff.z * diff.z); + f32 dist = std::sqrtf(diff.x * diff.x + diff.z * diff.z); *param_3 = dist; } diff --git a/src/d/d_npc_event_cut.inc b/src/d/d_npc_event_cut.inc index 8896e697e..b7a977041 100644 --- a/src/d/d_npc_event_cut.inc +++ b/src/d/d_npc_event_cut.inc @@ -543,7 +543,7 @@ void dNpc_EventCut_c::cutMoveToPosProc() { dComIfGp_evmng_cutEnd(mEvtStaffId); } - f32 dist = sqrtf((temp - mpActor->current.pos).abs2XZ()); + f32 dist = std::sqrtf((temp - mpActor->current.pos).abs2XZ()); cLib_addCalc2(&mpActor->current.pos.x, temp.x, 0.1f, mSpeed); cLib_addCalc2(&mpActor->current.pos.z, temp.z, 0.1f, mSpeed); diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index b77a83df9..46e4810c2 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -94,7 +94,7 @@ void dPa_J3DmodelEmitter_c::draw() { f32 sq = mtx1[0][1]*mtx1[0][1] + mtx1[1][1]*mtx1[1][1] + mtx1[2][1]*mtx1[2][1]; if (!cM3d_IsZero(sq)) { if (!cM3d_IsZero(sq)) { - f32 mag = sqrtf(sq); + f32 mag = std::sqrtf(sq); mtx1[0][1] *= mag; mtx1[1][1] *= mag; mtx1[2][1] *= mag; diff --git a/src/f_op/f_op_msg_mng.cpp b/src/f_op/f_op_msg_mng.cpp index c930c9327..08bc656fe 100644 --- a/src/f_op/f_op_msg_mng.cpp +++ b/src/f_op/f_op_msg_mng.cpp @@ -1167,7 +1167,7 @@ f32 fopMsgM_valueIncrease(int max, int value, u8 mode) { f32 v = ((f32)value) / ((f32)max); switch (mode) { case 0: ret = v * v; break; - case 1: ret = sqrtf(v); break; + case 1: ret = std::sqrtf(v); break; case 2: default: ret = v; break; case 3: ret = (v * 2.0f - 1.0f) * 2.0f - 1.0f; break; case 4: ret = JMASSin(v * 32768.0f * 0.5f) * JMASSin(v * 32768.0f * 0.5f); break; diff --git a/src/m_Do/m_Do_mtx.cpp b/src/m_Do/m_Do_mtx.cpp index fa1c82f89..db3139aa5 100644 --- a/src/m_Do/m_Do_mtx.cpp +++ b/src/m_Do/m_Do_mtx.cpp @@ -268,7 +268,7 @@ void mDoMtx_MtxToRot(const Mtx m, csXyz* o_rot) { f31 *= f31; f32 f30 = m[2][2]; f31 += f30 * f30; - f31 = sqrtf(f31); + f31 = std::sqrtf(f31); o_rot->x = cM_atan2s(-m[1][2], f31); if (o_rot->x == 0x4000 || o_rot->x == -0x4000) {