From 8be2d491a1a22bdffb465ced7f43885ef1e05cbc Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 3 Apr 2022 21:07:17 +0200 Subject: [PATCH] `BINANG_TO_DEGF` -> `BINANG_TO_DEG_ALT` (it may even be warranted to name it _approx instead of _alt, unsure) --- include/z64math.h | 2 +- src/code/db_camera.c | 16 ++++++++-------- src/code/z_camera.c | 12 ++++++------ src/code/z_onepointdemo.c | 4 ++-- .../ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/z64math.h b/include/z64math.h index 17f5b2ff36..a73293d5d2 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -101,7 +101,7 @@ typedef struct { #define RADF_TO_BINANG(radf) (s16)((radf) * (0x8000 / M_PI)) #define RADF_TO_DEGF(radf) ((radf) * (180.0f / M_PI)) #define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f)) -#define BINANG_TO_DEGF(binang) ((f32)(binang) * (360.0001525f / 65535.0f)) +#define BINANG_TO_DEG_ALT(binang) ((f32)(binang) * (360.0001525f / 65535.0f)) #define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PI / 0x8000)) #define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / (f32)0x8000) * M_PI) #define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PI) / 0x8000) diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 0fd8655dfa..65c3e1df51 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1090,9 +1090,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_3C = false; if (dbCamera->sub.mode != 1) { func_8006376C(0xD, 0x18, 3, !D_80161144 ? D_8012CF04 : D_8012CF08); - DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.pitch), &D_8012D0E4[11], 4); + DbCamera_SetTextValue(BINANG_TO_DEG_ALT(sp104.pitch), &D_8012D0E4[11], 4); func_8006376C(0xF, 0x17, 3, D_8012D0E4); - DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.yaw), &D_8012D0F8[11], 4); + DbCamera_SetTextValue(BINANG_TO_DEG_ALT(sp104.yaw), &D_8012D0F8[11], 4); func_8006376C(0xF, 0x18, 3, D_8012D0F8); DbCamera_SetTextValue(sp104.r, &D_8012D0D4[8], 6); func_8006376C(0xF, 0x19, 3, D_8012D0D4); @@ -1363,9 +1363,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { : !D_80161144 ? 4 : 3, D_8012CF30); - DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.pitch), &D_8012D0E4[10], 4); + DbCamera_SetTextValue(BINANG_TO_DEG_ALT(spFC.pitch), &D_8012D0E4[10], 4); func_8006376C(3, 0x17, 3, D_8012D0E4); - DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.yaw), &D_8012D0F8[10], 4); + DbCamera_SetTextValue(BINANG_TO_DEG_ALT(spFC.yaw), &D_8012D0F8[10], 4); func_8006376C(3, 0x18, 3, D_8012D0F8); DbCamera_SetTextValue(spFC.r, &D_8012D0D4[7], 6); func_8006376C(3, 0x19, 3, D_8012D0D4); @@ -1376,9 +1376,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { : D_80161144 ? 4 : 3, D_8012CF34); - DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.pitch), &D_8012D0E4[10], 4); + DbCamera_SetTextValue(BINANG_TO_DEG_ALT(spFC.pitch), &D_8012D0E4[10], 4); func_8006376C(0x1C, 0x17, 3, D_8012D0E4); - DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.yaw), &D_8012D0F8[10], 4); + DbCamera_SetTextValue(BINANG_TO_DEG_ALT(spFC.yaw), &D_8012D0F8[10], 4); func_8006376C(0x1C, 0x18, 3, D_8012D0F8); DbCamera_SetTextValue(spFC.r, &D_8012D0D4[7], 6); func_8006376C(0x1C, 0x19, 3, D_8012D0D4); @@ -1451,9 +1451,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { DbCamera_SetTextValue(dbCamera->eye.z, &sp111, 6); func_8006376C(0x1E, 0x19, 2, &sp110); func_8006376C(0xD, 0x18, 3, !D_80161144 ? D_8012CF04 : D_8012CF08); - DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.pitch), &D_8012D0E4[11], 4); + DbCamera_SetTextValue(BINANG_TO_DEG_ALT(sp104.pitch), &D_8012D0E4[11], 4); func_8006376C(0xF, 0x17, 3, D_8012D0E4); - DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.yaw), &D_8012D0F8[11], 4); + DbCamera_SetTextValue(BINANG_TO_DEG_ALT(sp104.yaw), &D_8012D0F8[11], 4); func_8006376C(0xF, 0x18, 3, D_8012D0F8); DbCamera_SetTextValue(sp104.r, &D_8012D0D4[8], 6); func_8006376C(0xF, 0x19, 3, D_8012D0D4); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 48b07f1870..f7011a8a03 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -2881,7 +2881,7 @@ s32 Camera_Battle1(Camera* camera) { } anim->animTimer--; } else if (ABS(tmpAng1) > DEGF_TO_BINANG(swingAngle)) { - spFC = BINANG_TO_DEGF(tmpAng1); + spFC = BINANG_TO_DEG_ALT(tmpAng1); temp_f2_2 = swingAngle + (spF8 - swingAngle) * (OLib_ClampMaxDist(atToTargetDir.r, spB4.r) / spB4.r); temp_f12_2 = ((temp_f2_2 * temp_f2_2) - 2.0f) / (temp_f2_2 - 360.0f); var2 = ((temp_f12_2 * spFC) + (2.0f - (360.0f * temp_f12_2))); @@ -3207,7 +3207,7 @@ s32 Camera_KeepOn1(Camera* camera) { } anim->unk_16--; } else if (ABS(spE2) > DEGF_TO_BINANG(spEC)) { - spF4 = BINANG_TO_DEGF(spE2); + spF4 = BINANG_TO_DEG_ALT(spE2); t2 = spEC + (spF0 - spEC) * (OLib_ClampMaxDist(spD0.r, spD8.r) / spD8.r); temp_f12_2 = ((SQ(t2) - 2.0f) / (t2 - 360.0f)); t1 = (temp_f12_2 * spF4) + (2.0f - (360.0f * temp_f12_2)); @@ -7498,7 +7498,7 @@ Vec3s Camera_Update(Camera* camera) { OLib_Vec3fDiffToVecSphGeo(&eyeAtAngle, &viewEye, &viewAt); Camera_CalcUpFromPitchYawRoll(&viewUp, eyeAtAngle.pitch + quake.rotZ, eyeAtAngle.yaw + quake.unk_1A, camera->roll); - viewFov = camera->fov + BINANG_TO_DEGF(quake.zoom); + viewFov = camera->fov + BINANG_TO_DEG_ALT(quake.zoom); } else { viewAt = camera->at; viewEye = camera->eye; @@ -7537,9 +7537,9 @@ Vec3s Camera_Update(Camera* camera) { if (PREG(81)) { osSyncPrintf("dir (%d) %d(%f) %d(%f) 0(0) \n", sUpdateCameraDirection, camera->inputDir.x, - BINANG_TO_DEGF(camera->inputDir.x), camera->inputDir.y, BINANG_TO_DEGF(camera->inputDir.y)); + BINANG_TO_DEG_ALT(camera->inputDir.x), camera->inputDir.y, BINANG_TO_DEG_ALT(camera->inputDir.y)); osSyncPrintf("real (%d) %d(%f) %d(%f) 0(0) \n", sUpdateCameraDirection, camera->camDir.x, - BINANG_TO_DEGF(camera->camDir.x), camera->camDir.y, BINANG_TO_DEGF(camera->camDir.y)); + BINANG_TO_DEG_ALT(camera->camDir.x), camera->camDir.y, BINANG_TO_DEG_ALT(camera->camDir.y)); } if (camera->timer != -1 && CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_DRIGHT)) { @@ -7550,7 +7550,7 @@ Vec3s Camera_Update(Camera* camera) { osSyncPrintf("camera: out (%f %f %f) (%f %f %f)\n", camera->at.x, camera->at.y, camera->at.z, camera->eye.x, camera->eye.y, camera->eye.z); osSyncPrintf("camera: dir (%f %d(%f) %d(%f)) (%f)\n", eyeAtAngle.r, eyeAtAngle.pitch, - BINANG_TO_DEGF(eyeAtAngle.pitch), eyeAtAngle.yaw, BINANG_TO_DEGF(eyeAtAngle.yaw), camera->fov); + BINANG_TO_DEG_ALT(eyeAtAngle.pitch), eyeAtAngle.yaw, BINANG_TO_DEG_ALT(eyeAtAngle.yaw), camera->fov); if (camera->player != NULL) { osSyncPrintf("camera: foot(%f %f %f) dist (%f)\n", curPlayerPosRot.pos.x, curPlayerPosRot.pos.y, curPlayerPosRot.pos.z, camera->dist); diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 056c47cd0b..493bb3be47 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -95,7 +95,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act D_80120964[0].eyeTargetInit = globalCtx->view.eye; D_80120964[0].fovTargetInit = globalCtx->view.fovy; OLib_Vec3fDiffToVecSphGeo(&spD0, &mainCam->at, &mainCam->eye); - D_80120964[1].eyeTargetInit.y = BINANG_TO_DEGF(spD0.yaw); + D_80120964[1].eyeTargetInit.y = BINANG_TO_DEG_ALT(spD0.yaw); D_80120964[1].timerInit = timer - 1; csInfo->keyFrames = D_80120964; @@ -310,7 +310,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act case 2210: OLib_Vec3fDiffToVecSphGeo(&spD0, &player->actor.world.pos, &actor->world.pos); D_801213B4[0].eyeTargetInit.y = D_801213B4[1].eyeTargetInit.y = D_801213B4[2].eyeTargetInit.y = - D_801213B4[2].atTargetInit.y = BINANG_TO_DEGF(spD0.yaw); + D_801213B4[2].atTargetInit.y = BINANG_TO_DEG_ALT(spD0.yaw); if (Rand_ZeroOne() < 0.0f) { D_801213B4[3].eyeTargetInit.x = -D_801213B4[3].eyeTargetInit.x; } diff --git a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c index 541f00494b..597f6c65e1 100644 --- a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c @@ -290,7 +290,7 @@ void func_808AD450(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot02_objects.c", 736); if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[2] != NULL) { - u16 temp_v1 = BINANG_TO_DEGF(globalCtx->csCtx.npcActions[2]->urot.z); + u16 temp_v1 = BINANG_TO_DEG_ALT(globalCtx->csCtx.npcActions[2]->urot.z); if (this->unk_170 != temp_v1) { if (this->unk_170 == 0xFFFF) {