1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 22:41:14 +00:00

Angle cleanup - macros names (#1193)

* Move binang utility macros out of angle conversion macros block

* `BINANG_TO_DEGF` -> `BINANG_TO_DEG_ALT` (it may even be warranted to name it _approx instead of _alt, unsure)

* Add `BINANG_TO_DEG` (unused by oot) (for completeness)

* `DEGF_TO_BINANG` -> `DEG_TO_BINANG_ALT` (again may even be _approx, or maybe _cam)

* Add `DEG_TO_BINANG` (unused by oot) (for completeness)

* `RADF_TO_BINANG` -> `RAD_TO_BINANG`

* `RADF_TO_DEGF` -> `RAD_TO_DEG`

* Cleanup argument names in angle conversion macros

* Format for angle macros changes

* Run formatter

* Move `DEG_TO_BINANG_ALT`, `BINANG_TO_DEG_ALT` to z64camera.h

* Remove `DEG_TO_BINANG`, `BINANG_TO_DEG`

* Remove `_ALT` from `DEG_TO_BINANG`, `BINANG_TO_DEG`

* Add comment about inaccuracy near `DEG_TO_BINANG`, `BINANG_TO_DEG`

* run formatter

* `CAM_` prefix on `DEG_TO_BINANG`, `BINANG_TO_DEG` macros

* Revert "Remove `DEG_TO_BINANG`, `BINANG_TO_DEG`"

This reverts commit 5321647e5b.
This commit is contained in:
Dragorn421 2022-04-24 16:23:49 +02:00 committed by GitHub
parent ef870bdd11
commit fed9ac3e20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 219 additions and 213 deletions

View file

@ -4221,9 +4221,9 @@ void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) {
yDiff = dorf->unk_1FC.y - this->actor.world.pos.y;
zDiff = dorf->unk_1FC.z - this->actor.world.pos.z;
yRotTarget = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
yRotTarget = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
xRotTarget = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
xRotTarget = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
Math_ApproachS(&this->actor.world.rot.x, xRotTarget, 1, 0x1000);
Math_ApproachS(&this->actor.world.rot.y, yRotTarget, 1, 0x1000);
@ -4348,10 +4348,10 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
xDiff = dorf->unk_278.x - this->actor.world.pos.x;
yDiff = dorf->unk_278.y - this->actor.world.pos.y;
zDiff = dorf->unk_278.z - this->actor.world.pos.z;
sp80 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
sp80 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
xRot = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
xRot = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
sp84 = (xzDist * 700.0f) / 10.0f;
if (sp84 > 6144.0f) {
sp84 = 6144.0f;
@ -4389,7 +4389,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
this->fwork[1] = 255.0f;
this->unk_1F0 = player->actor.world.pos;
new_var = this->unk_1F0.x - this->actor.world.pos.x;
this->actor.shape.rot.y = RADF_TO_BINANG(Math_FAtan2F(new_var, this->unk_1F0.z - this->actor.world.pos.z)) +
this->actor.shape.rot.y = RAD_TO_BINANG(Math_FAtan2F(new_var, this->unk_1F0.z - this->actor.world.pos.z)) +
(this->actor.params << 0xD) - 0x20C000;
// fallthrough
case 11:
@ -4399,8 +4399,8 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
yDiff = (this->unk_1F0.y + 30.0f) - this->actor.world.pos.y;
zDiff = this->unk_1F0.z - this->actor.world.pos.z;
sp80 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, sqrtf(SQ(xDiff) + SQ(zDiff))));
sp80 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(yDiff, sqrtf(SQ(xDiff) + SQ(zDiff))));
Math_ApproachS(&this->actor.shape.rot.y, sp80, 1, this->csCamMaxStepScale);
Math_ApproachF(&this->csCamMaxStepScale, 4096.0f, 1.0f, 256.0f);
}
@ -4489,9 +4489,9 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
yDiff = this->unk_1F0.y - this->actor.world.pos.y;
zDiff = this->unk_1F0.z - this->actor.world.pos.z;
sp80 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
sp80 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
xRot = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
xRot = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
sp84 = (xzDist * 700.0f) / 10.0f;
if (sp84 > 6144.0f) {