Add SQUARE macro to improve readibility for distances

This commit is contained in:
LagoLunatic
2025-08-08 21:51:30 -04:00
parent b24d8574cd
commit 5802571a56
37 changed files with 107 additions and 106 deletions
+3 -3
View File
@@ -104,7 +104,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 = std::sqrtf(delta.x * delta.x + delta.z * delta.z);
f32 distXZ = std::sqrtf(SQUARE(delta.x) + SQUARE(delta.z));
targetY = cM_atan2s(delta.x, delta.z);
r23 = cM_atan2s(delta.y, distXZ);
} else {
@@ -422,7 +422,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 y_mag = param_2 * SQUARE(diff.y);
f32 dist = std::sqrtf(y_mag + xz_mag);
if(max_dist > dist) {
@@ -629,7 +629,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 = std::sqrtf(diff.x * diff.x + diff.z * diff.z);
f32 dist = std::sqrtf(SQUARE(diff.x) + SQUARE(diff.z));
*param_3 = dist;
}