1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 14:31:17 +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

@ -689,9 +689,9 @@ void BossTw_FlyTo(BossTw* this, GlobalContext* globalCtx) {
yDiff = this->targetPos.y - this->actor.world.pos.y;
zDiff = this->targetPos.z - this->actor.world.pos.z;
yawTarget = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
yawTarget = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
pitchTarget = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
pitchTarget = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
Math_ApproachS(&this->actor.world.rot.x, pitchTarget, 0xA, this->rotateSpeed);
Math_ApproachS(&this->actor.world.rot.y, yawTarget, 0xA, this->rotateSpeed);
@ -2370,8 +2370,8 @@ void BossTw_DeathBall(BossTw* this, GlobalContext* globalCtx) {
yDiff = this->targetPos.y - this->actor.world.pos.y;
zDiff = this->targetPos.z - this->actor.world.pos.z;
yaw = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
Math_ApproachS(&this->actor.world.rot.x, RADF_TO_BINANG(Math_FAtan2F(yDiff, sqrtf(SQ(xDiff) + SQ(zDiff)))), 5,
yaw = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
Math_ApproachS(&this->actor.world.rot.x, RAD_TO_BINANG(Math_FAtan2F(yDiff, sqrtf(SQ(xDiff) + SQ(zDiff)))), 5,
this->rotateSpeed);
Math_ApproachS(&this->actor.world.rot.y, yaw, 5, this->rotateSpeed);
func_8002D908(&this->actor);
@ -3934,10 +3934,10 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) {
yDiff = (player->actor.world.pos.y + 30.0f) - this->actor.world.pos.y;
zDiff = player->actor.world.pos.z - this->actor.world.pos.z;
// yaw
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
// pitch
distXZ = sqrtf(SQ(xDiff) + SQ(zDiff));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, distXZ));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(yDiff, distXZ));
this->actor.speedXZ = 20.0f;
for (i = 0; i < 50; i++) {
@ -4124,9 +4124,9 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) {
xDiff = player->actor.world.pos.x - this->actor.world.pos.x;
yDiff = (player->actor.world.pos.y + 30.0f) - this->actor.world.pos.y;
zDiff = player->actor.world.pos.z - this->actor.world.pos.z;
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
this->actor.speedXZ = 20.0f;
for (i = 0; i < 50; i++) {
this->blastTailPos[i] = this->actor.world.pos;
@ -5393,9 +5393,9 @@ void BossTw_TwinrovaSetupFly(BossTw* this, GlobalContext* globalCtx) {
this->actionFunc = BossTw_TwinrovaFly;
this->rotateSpeed = 0.0f;
this->actor.speedXZ = 0.0f;
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -10.0f);
}
@ -5412,9 +5412,9 @@ void BossTw_TwinrovaFly(BossTw* this, GlobalContext* globalCtx) {
xDiff = this->targetPos.x - this->actor.world.pos.x;
yDiff = this->targetPos.y - this->actor.world.pos.y;
zDiff = this->targetPos.z - this->actor.world.pos.z;
yaw = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
yaw = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
Math_ApproachS(&this->actor.world.rot.x, (f32)RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist)), 0xA, this->rotateSpeed);
Math_ApproachS(&this->actor.world.rot.x, (f32)RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist)), 0xA, this->rotateSpeed);
Math_ApproachS(&this->actor.world.rot.y, yaw, 0xA, this->rotateSpeed);
Math_ApproachS(&this->actor.shape.rot.y, yaw, 0xA, this->rotateSpeed);
Math_ApproachF(&this->rotateSpeed, 2000.0f, 1.0f, 100.0f);