1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 15:04:31 +00:00

Angle cleanup - miscellaneous (#1159)

* Add `BINANG_TO_RAD_ALT2`

* Few hex constants in place of decimal cardinal angles

* Use `BINANG_TO_DEGF` more

* Use `DEG_TO_RAD(int)` for angle literals

* `BINANG_TO_RAD_ALT(literal)` -> use `BINANG_TO_RAD`

* Somewhat arbitrary literal angles cleanup
This commit is contained in:
Dragorn421 2022-04-03 20:32:18 +02:00 committed by GitHub
parent 791d9018c0
commit 3ce701cfd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 36 additions and 34 deletions

View file

@ -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(sp104.pitch * 0.00549325f, &D_8012D0E4[11], 4);
DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.pitch), &D_8012D0E4[11], 4);
func_8006376C(0xF, 0x17, 3, D_8012D0E4);
DbCamera_SetTextValue(sp104.yaw * 0.00549325f, &D_8012D0F8[11], 4);
DbCamera_SetTextValue(BINANG_TO_DEGF(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(spFC.pitch * 0.00549325f, &D_8012D0E4[10], 4);
DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.pitch), &D_8012D0E4[10], 4);
func_8006376C(3, 0x17, 3, D_8012D0E4);
DbCamera_SetTextValue(spFC.yaw * 0.00549325f, &D_8012D0F8[10], 4);
DbCamera_SetTextValue(BINANG_TO_DEGF(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(spFC.pitch * 0.00549325f, &D_8012D0E4[10], 4);
DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.pitch), &D_8012D0E4[10], 4);
func_8006376C(0x1C, 0x17, 3, D_8012D0E4);
DbCamera_SetTextValue(spFC.yaw * 0.00549325f, &D_8012D0F8[10], 4);
DbCamera_SetTextValue(BINANG_TO_DEGF(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(sp104.pitch * 0.00549325f, &D_8012D0E4[11], 4);
DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.pitch), &D_8012D0E4[11], 4);
func_8006376C(0xF, 0x17, 3, D_8012D0E4);
DbCamera_SetTextValue(sp104.yaw * 0.00549325f, &D_8012D0F8[11], 4);
DbCamera_SetTextValue(BINANG_TO_DEGF(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);

View file

@ -39,9 +39,9 @@ f32 Math_PowF(f32 base, s32 exp) {
}
f32 Math_SinF(f32 angle) {
return sins((s16)(angle * (32767.0f / M_PI))) * SHT_MINV;
return sins((s16)(angle * (0x7FFF / M_PI))) * SHT_MINV;
}
f32 Math_CosF(f32 angle) {
return coss((s16)(angle * (32767.0f / M_PI))) * SHT_MINV;
return coss((s16)(angle * (0x7FFF / M_PI))) * SHT_MINV;
}

View file

@ -1921,13 +1921,13 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 200, alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 255);
Matrix_RotateZ(((globalCtx->gameplayFrames * 1500) & 0xFFFF) * M_PI / 32768.0f, MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT2((globalCtx->gameplayFrames * 1500) & 0xFFFF), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5458),
G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL);
Matrix_Pop();
Matrix_RotateZ(~((globalCtx->gameplayFrames * 1200) & 0xFFFF) * M_PI / 32768.0f, MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT2(~((globalCtx->gameplayFrames * 1200) & 0xFFFF)), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5463),
G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);