summaryrefslogtreecommitdiff
path: root/src/code/z_camera.c
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2023-06-06 12:16:34 +1000
committerGitHub <noreply@github.com>2023-06-05 22:16:34 -0400
commit7f5087d0b2014dc1ba2bbfc7ce858f0059a8a7cb (patch)
treea56edb9e5d173d9e24bdce4a373e9fe38253cb34 /src/code/z_camera.c
parentf92a61db27ed8ee213072df11169777c6794bc1b (diff)
sys_math.c Rename (#1258)
* rename via comments * missed a comment * math header * name boot_80086760.c functions * PR Review * rm cam comment * Elliptic review * alphabetical
Diffstat (limited to 'src/code/z_camera.c')
-rw-r--r--src/code/z_camera.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/code/z_camera.c b/src/code/z_camera.c
index bd23308c3..ce09f7c4d 100644
--- a/src/code/z_camera.c
+++ b/src/code/z_camera.c
@@ -875,7 +875,7 @@ void func_800CC938(Camera* camera) {
* Calculates the angle between points `from` and `to`
*/
s16 Camera_CalcXZAngle(Vec3f* to, Vec3f* from) {
- return CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(from->x - to->x, from->z - to->z)));
+ return CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(from->x - to->x, from->z - to->z)));
}
// BSS
@@ -964,8 +964,8 @@ s16 Camera_GetPitchAdjFromFloorHeightDiffs(Camera* camera, s16 viewYaw, s16 shou
floorYDiffNear = (sFloorYNear - camera->focalActorFloorHeight) * 0.8f;
floorYDiffFar = (sFloorYFar - camera->focalActorFloorHeight) * (20.0f * 0.01f);
- pitchNear = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(floorYDiffNear, nearDist)));
- pitchFar = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(floorYDiffFar, farDist)));
+ pitchNear = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(floorYDiffNear, nearDist)));
+ pitchFar = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(floorYDiffFar, farDist)));
return pitchNear + pitchFar;
}
@@ -1457,9 +1457,8 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecGeo* arg1, f32 yOffset, f32 xzOf
deltaY = focalActorPosRot->pos.y - *focalActorPosY;
eyeAtDistXZ = OLib_Vec3fDistXZ(at, &camera->eye);
- // Math_FTanF
// Get the height based on 80% of the fov
- fovHeight = func_80086760(DEG_TO_RAD(camera->fov * (0.8f * 0.5f))) * eyeAtDistXZ;
+ fovHeight = Math_FTanF(DEG_TO_RAD(camera->fov * (0.8f * 0.5f))) * eyeAtDistXZ;
if (deltaY > fovHeight) {
//! FAKE
@@ -1539,8 +1538,8 @@ s32 Camera_CalcAtForFriendlyLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targ
deltaY = focalActorPosRot->pos.y - *yPosOffset;
sp50 = OLib_Vec3fDistXZ(at, &camera->eye);
phi_f16 = sp50;
- func_80086B30(deltaY, sp50);
- fovHeight = func_80086760(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16;
+ Math_FAtan2F(deltaY, sp50);
+ fovHeight = Math_FTanF(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16;
if (fovHeight < deltaY) {
*yPosOffset += deltaY - fovHeight;
@@ -1552,12 +1551,12 @@ s32 Camera_CalcAtForFriendlyLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targ
focalActorAtOffsetTarget.y -= deltaY;
} else {
deltaY = focalActorPosRot->pos.y - *yPosOffset;
- temp_f0_6 = func_80086B30(deltaY, OLib_Vec3fDistXZ(at, &camera->eye));
+ temp_f0_6 = Math_FAtan2F(deltaY, OLib_Vec3fDistXZ(at, &camera->eye));
if (temp_f0_6 > 0.34906584f) { // (M_PI / 9)
- phi_f16 = 1.0f - sin_rad(temp_f0_6 - 0.34906584f);
+ phi_f16 = 1.0f - Math_SinF(temp_f0_6 - 0.34906584f);
} else if (temp_f0_6 < -0.17453292f) { // (M_PI / 18)
- phi_f16 = 1.0f - sin_rad(-0.17453292f - temp_f0_6);
+ phi_f16 = 1.0f - Math_SinF(-0.17453292f - temp_f0_6);
} else {
phi_f16 = 1.0f;
}
@@ -1625,10 +1624,10 @@ s32 Camera_CalcAtForEnemyLockOn(Camera* camera, f32* arg1, s32 arg2, f32 yOffset
new_var2 = *arg1;
sp4C = new_var2;
deltaY = focalActorPosRot->pos.y - *arg6;
- temp_f0_3 = func_80086B30(deltaY, sp4C);
+ temp_f0_3 = Math_FAtan2F(deltaY, sp4C);
if (!(flags & 0x80)) {
- fovHeight = func_80086760(DEG_TO_RAD(camera->fov * 0.4f)) * sp4C;
+ fovHeight = Math_FTanF(DEG_TO_RAD(camera->fov * 0.4f)) * sp4C;
if (fovHeight < deltaY) {
*arg6 += deltaY - fovHeight;
@@ -1641,9 +1640,9 @@ s32 Camera_CalcAtForEnemyLockOn(Camera* camera, f32* arg1, s32 arg2, f32 yOffset
focalActorAtOffsetTarget.y -= deltaY;
} else {
if (temp_f0_3 > 0.34906584f) { // (M_PI / 9)
- phi_f14 = 1.0f - sin_rad(temp_f0_3 - 0.34906584f);
+ phi_f14 = 1.0f - Math_SinF(temp_f0_3 - 0.34906584f);
} else if (temp_f0_3 < -0.17453292f) { // (M_PI / 18)
- phi_f14 = 1.0f - sin_rad(-0.17453292f - temp_f0_3);
+ phi_f14 = 1.0f - Math_SinF(-0.17453292f - temp_f0_3);
} else {
phi_f14 = 1.0f;
}
@@ -6343,8 +6342,8 @@ s32 Camera_Demo4(Camera* camera) {
// Camera fixed on human player as the mask moves from the pocket to the face
// Camera rolls left and right
if (rwData->timer >= 12) {
- rwData->unk_0C = (rwData->timer - 12) * 10.384615f;
- sin = sin_rad(DEG_TO_RAD(rwData->unk_0C));
+ rwData->unk_0C = (rwData->timer - 12) * (135.0f / 13.0f);
+ sin = Math_SinF(DEG_TO_RAD(rwData->unk_0C));
rwData->unk_0C = ((rwData->unk_10 < 0.0f) ? -1.0f : 1.0f) * sin;
if (rwData->timer == 12) {
Distortion_Request(DISTORTION_TYPE_MASK_TRANSFORM_1);
@@ -6516,7 +6515,7 @@ s32 Camera_Demo5(Camera* camera) {
// Camera zooms out while rolling back and forth
rwData->unk_0C = rwData->timer * (180.0f / 23.0f);
sp58 = DEG_TO_RAD(rwData->unk_0C);
- sin = sin_rad(sp58);
+ sin = Math_SinF(sp58);
rwData->unk_0C = ((rwData->unk_10 < 0.0f) ? -1.0f : 1.0f) * sin;
new_var = (46 - rwData->timer) * (5.0f / 46.0f);
focalActorFocus.pos.x = (Math_SinS(rwData->unk_24) * new_var * rwData->unk_0C) + focalActorPosRot->pos.x;