1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-15 11:26:19 +00:00

RADF_TO_BINANG -> RAD_TO_BINANG

This commit is contained in:
Dragorn421 2022-04-03 21:16:17 +02:00
parent a5bae4ea01
commit aff0379da7
No known key found for this signature in database
GPG key ID: C182A3A3996E8201
46 changed files with 118 additions and 118 deletions

View file

@ -99,7 +99,7 @@ typedef struct {
// Angle conversion macros // Angle conversion macros
#define DEG_TO_BINANG(degrees) (s16)((degrees) * (0x8000 / 180.0f)) #define DEG_TO_BINANG(degrees) (s16)((degrees) * (0x8000 / 180.0f))
#define DEG_TO_BINANG_ALT(degreesf) (s16)((degreesf) * 182.04167f + .5f) #define DEG_TO_BINANG_ALT(degreesf) (s16)((degreesf) * 182.04167f + .5f)
#define RADF_TO_BINANG(radf) (s16)((radf) * (0x8000 / M_PI)) #define RAD_TO_BINANG(radf) (s16)((radf) * (0x8000 / M_PI))
#define RADF_TO_DEGF(radf) ((radf) * (180.0f / M_PI)) #define RADF_TO_DEGF(radf) ((radf) * (180.0f / M_PI))
#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f)) #define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f))
#define BINANG_TO_DEG(binang) ((f32)(binang) * (180.0f / 0x8000)) #define BINANG_TO_DEG(binang) ((f32)(binang) * (180.0f / 0x8000))

View file

@ -769,17 +769,17 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
temp = mf->xz; temp = mf->xz;
temp *= temp; temp *= temp;
temp += SQ(mf->zz); temp += SQ(mf->zz);
rotDest->x = RADF_TO_BINANG(Math_FAtan2F(-mf->yz, sqrtf(temp))); rotDest->x = RAD_TO_BINANG(Math_FAtan2F(-mf->yz, sqrtf(temp)));
if ((rotDest->x == 0x4000) || (rotDest->x == -0x4000)) { if ((rotDest->x == 0x4000) || (rotDest->x == -0x4000)) {
rotDest->z = 0; rotDest->z = 0;
rotDest->y = RADF_TO_BINANG(Math_FAtan2F(-mf->zx, mf->xx)); rotDest->y = RAD_TO_BINANG(Math_FAtan2F(-mf->zx, mf->xx));
} else { } else {
rotDest->y = RADF_TO_BINANG(Math_FAtan2F(mf->xz, mf->zz)); rotDest->y = RAD_TO_BINANG(Math_FAtan2F(mf->xz, mf->zz));
if (!flag) { if (!flag) {
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(mf->yx, mf->yy)); rotDest->z = RAD_TO_BINANG(Math_FAtan2F(mf->yx, mf->yy));
} else { } else {
temp = mf->xx; temp = mf->xx;
temp2 = mf->zx; temp2 = mf->zx;
@ -804,7 +804,7 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
/* for a rotation matrix, temp == yx and temp2 == yy /* for a rotation matrix, temp == yx and temp2 == yy
* which is the same as in the !flag branch */ * which is the same as in the !flag branch */
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(temp, temp2)); rotDest->z = RAD_TO_BINANG(Math_FAtan2F(temp, temp2));
} }
} }
} }
@ -822,16 +822,16 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
temp = mf->xx; temp = mf->xx;
temp *= temp; temp *= temp;
temp += SQ(mf->yx); temp += SQ(mf->yx);
rotDest->y = RADF_TO_BINANG(Math_FAtan2F(-mf->zx, sqrtf(temp))); rotDest->y = RAD_TO_BINANG(Math_FAtan2F(-mf->zx, sqrtf(temp)));
if ((rotDest->y == 0x4000) || (rotDest->y == -0x4000)) { if ((rotDest->y == 0x4000) || (rotDest->y == -0x4000)) {
rotDest->x = 0; rotDest->x = 0;
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(-mf->xy, mf->yy)); rotDest->z = RAD_TO_BINANG(Math_FAtan2F(-mf->xy, mf->yy));
} else { } else {
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(mf->yx, mf->xx)); rotDest->z = RAD_TO_BINANG(Math_FAtan2F(mf->yx, mf->xx));
if (!flag) { if (!flag) {
rotDest->x = RADF_TO_BINANG(Math_FAtan2F(mf->zy, mf->zz)); rotDest->x = RAD_TO_BINANG(Math_FAtan2F(mf->zy, mf->zz));
} else { } else {
// see Matrix_MtxFToYXZRotS // see Matrix_MtxFToYXZRotS
temp = mf->xy; temp = mf->xy;
@ -853,7 +853,7 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
temp2 = sqrtf(temp2); temp2 = sqrtf(temp2);
temp2 = temp3 / temp2; temp2 = temp3 / temp2;
rotDest->x = RADF_TO_BINANG(Math_FAtan2F(temp, temp2)); rotDest->x = RAD_TO_BINANG(Math_FAtan2F(temp, temp2));
} }
} }
} }

View file

@ -4179,12 +4179,12 @@ void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) {
sp38 = Math_SinS(arg1); sp38 = Math_SinS(arg1);
sp34 = Math_CosS(arg1); sp34 = Math_CosS(arg1);
sp28 = (-(floorPolyNormalX * sp38) - (floorPolyNormalZ * sp34)); sp28 = (-(floorPolyNormalX * sp38) - (floorPolyNormalZ * sp34));
arg2->x = -RADF_TO_BINANG(Math_FAtan2F(sp28 * floorPolyNormalY, 1.0f)); arg2->x = -RAD_TO_BINANG(Math_FAtan2F(sp28 * floorPolyNormalY, 1.0f));
sp2C = Math_SinS(arg1 - 16375); sp2C = Math_SinS(arg1 - 16375);
sp30 = Math_CosS(arg1 - 16375); sp30 = Math_CosS(arg1 - 16375);
sp24 = (-(floorPolyNormalX * sp2C) - (floorPolyNormalZ * sp30)); sp24 = (-(floorPolyNormalX * sp2C) - (floorPolyNormalZ * sp30));
arg2->z = -RADF_TO_BINANG(Math_FAtan2F(sp24 * floorPolyNormalY, 1.0f)); arg2->z = -RAD_TO_BINANG(Math_FAtan2F(sp24 * floorPolyNormalY, 1.0f));
} }
} }

View file

@ -27,7 +27,7 @@ f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw) {
dx = pointPos->x - actor->world.pos.x; dx = pointPos->x - actor->world.pos.x;
dz = pointPos->z - actor->world.pos.z; dz = pointPos->z - actor->world.pos.z;
*yaw = RADF_TO_BINANG(Math_FAtan2F(dx, dz)); *yaw = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
return SQ(dx) + SQ(dz); return SQ(dx) + SQ(dz);
} }

View file

@ -1014,14 +1014,14 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
sp50 = Math_FAtan2F(sp58, sp60); sp50 = Math_FAtan2F(sp58, sp60);
temp1 = RADF_TO_BINANG(M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50))); temp1 = RAD_TO_BINANG(M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50)));
temp1 = temp1 - skelAnime->jointTable[shinLimbIndex].z; temp1 = temp1 - skelAnime->jointTable[shinLimbIndex].z;
if ((s16)(ABS(skelAnime->jointTable[shinLimbIndex].x) + ABS(skelAnime->jointTable[shinLimbIndex].y)) < 0) { if ((s16)(ABS(skelAnime->jointTable[shinLimbIndex].x) + ABS(skelAnime->jointTable[shinLimbIndex].y)) < 0) {
temp1 += 0x8000; temp1 += 0x8000;
} }
temp2 = RADF_TO_BINANG(sp50 - sp54); temp2 = RAD_TO_BINANG(sp50 - sp54);
rot->z -= temp2; rot->z -= temp2;
skelAnime->jointTable[thighLimbIndex].z = skelAnime->jointTable[thighLimbIndex].z - temp2; skelAnime->jointTable[thighLimbIndex].z = skelAnime->jointTable[thighLimbIndex].z - temp2;

View file

@ -694,7 +694,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) {
sp48 = sp4C->x - this->actor.world.pos.x; sp48 = sp4C->x - this->actor.world.pos.x;
sp44 = sp4C->z - this->actor.world.pos.z; sp44 = sp4C->z - this->actor.world.pos.z;
Math_SmoothStepToF(&this->unk_1E8, 2000.0f, 1.0f, this->unk_1EC * 80.0f, 0.0f); Math_SmoothStepToF(&this->unk_1E8, 2000.0f, 1.0f, this->unk_1EC * 80.0f, 0.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp48, sp44)), 5, Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(sp48, sp44)), 5,
(this->unk_1EC * this->unk_1E8), 5); (this->unk_1EC * this->unk_1E8), 5);
Math_SmoothStepToS(&this->unk_1C4, 0, 2, 2000, 0); Math_SmoothStepToS(&this->unk_1C4, 0, 2, 2000, 0);
@ -771,7 +771,7 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) {
sp4C = sp5C->x - this->actor.world.pos.x; sp4C = sp5C->x - this->actor.world.pos.x;
sp48 = sp5C->z - this->actor.world.pos.z; sp48 = sp5C->z - this->actor.world.pos.z;
Math_SmoothStepToF(&this->unk_1E8, 2000.0f, 1.0f, this->unk_1EC * 100.0f, 0.0f); Math_SmoothStepToF(&this->unk_1E8, 2000.0f, 1.0f, this->unk_1EC * 100.0f, 0.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp4C, sp48)), 5, Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(sp4C, sp48)), 5,
this->unk_1EC * this->unk_1E8, 0); this->unk_1EC * this->unk_1E8, 0);
if (fabsf(sp4C) <= 15.0f && fabsf(sp48) <= 15.0f) { if (fabsf(sp4C) <= 15.0f && fabsf(sp48) <= 15.0f) {
@ -1403,7 +1403,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) {
tempSin = cornerPos->x - this->actor.world.pos.x; tempSin = cornerPos->x - this->actor.world.pos.x;
tempCos = cornerPos->z - this->actor.world.pos.z; tempCos = cornerPos->z - this->actor.world.pos.z;
Math_SmoothStepToF(&this->unk_1E8, 1500.0f, 1.0f, this->unk_1EC * 100.0f, 0.0f); Math_SmoothStepToF(&this->unk_1E8, 1500.0f, 1.0f, this->unk_1EC * 100.0f, 0.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(tempSin, tempCos)), 5, Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(tempSin, tempCos)), 5,
(this->unk_1EC * this->unk_1E8), 0); (this->unk_1EC * this->unk_1E8), 0);
if ((fabsf(tempSin) <= 15.0f) && (fabsf(tempCos) <= 15.0f)) { if ((fabsf(tempSin) <= 15.0f) && (fabsf(tempCos) <= 15.0f)) {

View file

@ -289,8 +289,8 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) {
this->fwork[BFD_FLY_WOBBLE_AMP]; this->fwork[BFD_FLY_WOBBLE_AMP];
dz += Math_SinS((1796.0f + this->fwork[BFD_FLY_WOBBLE_RATE]) * this->work[BFD_MOVE_TIMER]) * dz += Math_SinS((1796.0f + this->fwork[BFD_FLY_WOBBLE_RATE]) * this->work[BFD_MOVE_TIMER]) *
this->fwork[BFD_FLY_WOBBLE_AMP]; this->fwork[BFD_FLY_WOBBLE_AMP];
angleToTarget = RADF_TO_BINANG(Math_FAtan2F(dx, dz)); angleToTarget = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
pitchToTarget = RADF_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz)))); pitchToTarget = RAD_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz))));
osSyncPrintf("MODE %d\n", this->work[BFD_ACTION_STATE]); osSyncPrintf("MODE %d\n", this->work[BFD_ACTION_STATE]);

View file

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

View file

@ -844,7 +844,7 @@ void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) {
vecToLink.z = playerx->world.pos.z - thisx->world.pos.z; vecToLink.z = playerx->world.pos.z - thisx->world.pos.z;
thisx->world.rot.y = thisx->shape.rot.y; thisx->world.rot.y = thisx->shape.rot.y;
thisx->world.rot.x = thisx->world.rot.x =
RADF_TO_BINANG(Math_FAtan2F(vecToLink.y, sqrtf(SQ(vecToLink.x) + SQ(vecToLink.z)))); RAD_TO_BINANG(Math_FAtan2F(vecToLink.y, sqrtf(SQ(vecToLink.x) + SQ(vecToLink.z))));
} }
func_8002D908(thisx); func_8002D908(thisx);

View file

@ -1277,8 +1277,8 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) {
dz = this->targetPos.z - this->cameraEye.z; dz = this->targetPos.z - this->cameraEye.z;
tempY = Math_FAtan2F(dx, dz); tempY = Math_FAtan2F(dx, dz);
tempX = Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz))); tempX = Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz)));
Math_ApproachS(&this->actor.world.rot.y, RADF_TO_BINANG(tempY), 5, this->cameraYawRate); Math_ApproachS(&this->actor.world.rot.y, RAD_TO_BINANG(tempY), 5, this->cameraYawRate);
Math_ApproachS(&this->actor.world.rot.x, RADF_TO_BINANG(tempX), 5, this->cameraYawRate); Math_ApproachS(&this->actor.world.rot.x, RAD_TO_BINANG(tempX), 5, this->cameraYawRate);
if (this->work[MO_TENT_MOVE_TIMER] == 150) { if (this->work[MO_TENT_MOVE_TIMER] == 150) {
this->cameraAtVel.x = fabsf(this->cameraAt.x - player->actor.world.pos.x); this->cameraAtVel.x = fabsf(this->cameraAt.x - player->actor.world.pos.x);
this->cameraAtVel.y = fabsf(this->cameraAt.y - player->actor.world.pos.y); this->cameraAtVel.y = fabsf(this->cameraAt.y - player->actor.world.pos.y);
@ -2130,8 +2130,8 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) {
spDC = this->targetPos.x - this->actor.world.pos.x; spDC = this->targetPos.x - this->actor.world.pos.x;
spD8 = this->targetPos.y - this->actor.world.pos.y; spD8 = this->targetPos.y - this->actor.world.pos.y;
spD4 = this->targetPos.z - this->actor.world.pos.z; spD4 = this->targetPos.z - this->actor.world.pos.z;
spCC = RADF_TO_BINANG(Math_FAtan2F(spDC, spD4)); spCC = RAD_TO_BINANG(Math_FAtan2F(spDC, spD4));
spD0 = RADF_TO_BINANG(Math_FAtan2F(spD8, sqrtf(SQ(spDC) + SQ(spD4)))); spD0 = RAD_TO_BINANG(Math_FAtan2F(spD8, sqrtf(SQ(spDC) + SQ(spD4))));
Math_ApproachS(&this->actor.world.rot.y, spCC, this->tentMaxAngle, this->tentSpeed); Math_ApproachS(&this->actor.world.rot.y, spCC, this->tentMaxAngle, this->tentSpeed);
Math_ApproachS(&this->actor.world.rot.x, spD0, this->tentMaxAngle, this->tentSpeed); Math_ApproachS(&this->actor.world.rot.x, spD0, this->tentMaxAngle, this->tentSpeed);
func_8002D908(&this->actor); func_8002D908(&this->actor);

View file

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

View file

@ -1471,7 +1471,7 @@ void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* glo
} }
if (startPos.x != endPos.x || startPos.y != endPos.y || startPos.z != endPos.z) { if (startPos.x != endPos.x || startPos.y != endPos.y || startPos.z != endPos.z) {
this->jewelCsRotation.x = RADF_TO_BINANG(Math_Atan2F(endPos.z - startPos.z, -(endPos.x - startPos.x))); this->jewelCsRotation.x = RAD_TO_BINANG(Math_Atan2F(endPos.z - startPos.z, -(endPos.x - startPos.x)));
this->jewelCsRotation.y = Math_Vec3f_Yaw(&startPos, &endPos); this->jewelCsRotation.y = Math_Vec3f_Yaw(&startPos, &endPos);
} }
@ -2093,8 +2093,8 @@ void DemoEffect_FaceToCsEndpoint(DemoEffect* this, Vec3f startPos, Vec3f endPos)
f32 z = endPos.z - startPos.z; f32 z = endPos.z - startPos.z;
f32 xzDistance = sqrtf(SQ(x) + SQ(z)); f32 xzDistance = sqrtf(SQ(x) + SQ(z));
this->actor.shape.rot.y = RADF_TO_BINANG(Math_FAtan2F(x, z)); this->actor.shape.rot.y = RAD_TO_BINANG(Math_FAtan2F(x, z));
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(-(endPos.y - startPos.y), xzDistance)); this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(-(endPos.y - startPos.y), xzDistance));
} }
/** /**

View file

@ -550,10 +550,10 @@ void DemoGj_SetupMovement(DemoGj* this, GlobalContext* globalCtx) {
zDistance = player->actor.world.pos.z - pos->z; zDistance = player->actor.world.pos.z - pos->z;
if (xDistance != 0.0f || zDistance != 0.0f) { if (xDistance != 0.0f || zDistance != 0.0f) {
actor->world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDistance, zDistance)); actor->world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDistance, zDistance));
} }
} else { } else {
actor->world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDistance, zDistance)); actor->world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDistance, zDistance));
} }
} }
} }

View file

@ -120,8 +120,8 @@ void EnAnubice_AimFireball(EnAnubice* this, GlobalContext* globalCtx) {
z = player->actor.world.pos.z - this->headPos.z; z = player->actor.world.pos.z - this->headPos.z;
xzDist = sqrtf(SQ(x) + SQ(z)); xzDist = sqrtf(SQ(x) + SQ(z));
this->fireballRot.x = -RADF_TO_BINANG(Math_FAtan2F(y, xzDist)); this->fireballRot.x = -RAD_TO_BINANG(Math_FAtan2F(y, xzDist));
this->fireballRot.y = RADF_TO_BINANG(Math_FAtan2F(x, z)); this->fireballRot.y = RAD_TO_BINANG(Math_FAtan2F(x, z));
} }
void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx) { void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -227,7 +227,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
(this->unk_222 == 0)) { (this->unk_222 == 0)) {
if (sp74 != NULL) { if (sp74 != NULL) {
sp74 = SEGMENTED_TO_VIRTUAL(sp74); sp74 = SEGMENTED_TO_VIRTUAL(sp74);
sp62 = RADF_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z)); sp62 = RAD_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z));
} else { } else {
sp62 = this->actor.world.rot.y + 0x8000; sp62 = this->actor.world.rot.y + 0x8000;
} }
@ -305,7 +305,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
&sp74, 1, 0, 0, 1); &sp74, 1, 0, 0, 1);
if (sp64 != 0) { if (sp64 != 0) {
sp74 = SEGMENTED_TO_VIRTUAL(sp74); sp74 = SEGMENTED_TO_VIRTUAL(sp74);
sp60 = RADF_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z)); sp60 = RAD_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z));
if (this->unk_236 != sp60) { if (this->unk_236 != sp60) {
if ((s16)(this->actor.yawTowardsPlayer - sp60) >= 0) { if ((s16)(this->actor.yawTowardsPlayer - sp60) >= 0) {
this->unk_238 = 0x4000; this->unk_238 = 0x4000;

View file

@ -445,9 +445,9 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) {
// Calculate the direction for the Arwing to fly and the rotation for the Arwing // Calculate the direction for the Arwing to fly and the rotation for the Arwing
// based on the Arwing's direction, and current rotation. // based on the Arwing's direction, and current rotation.
worldRotationTargetY = RADF_TO_BINANG(Math_FAtan2F(vectorToTargetX, vectorToTargetZ)); worldRotationTargetY = RAD_TO_BINANG(Math_FAtan2F(vectorToTargetX, vectorToTargetZ));
worldRotationTargetX = worldRotationTargetX =
RADF_TO_BINANG(Math_FAtan2F(vectorToTargetY, sqrtf(SQ(vectorToTargetX) + SQ(vectorToTargetZ)))); RAD_TO_BINANG(Math_FAtan2F(vectorToTargetY, sqrtf(SQ(vectorToTargetX) + SQ(vectorToTargetZ))));
if ((worldRotationTargetX < 0) && (this->actor.world.pos.y < this->actor.floorHeight + 20.0f)) { if ((worldRotationTargetX < 0) && (this->actor.world.pos.y < this->actor.floorHeight + 20.0f)) {
worldRotationTargetX = 0; worldRotationTargetX = 0;
} }

View file

@ -290,7 +290,7 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) {
EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint); EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint);
xDiff = pathPos.x - this->actor.world.pos.x; xDiff = pathPos.x - this->actor.world.pos.x;
zDiff = pathPos.z - this->actor.world.pos.z; zDiff = pathPos.z - this->actor.world.pos.z;
walkAngle1 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff)); walkAngle1 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->walkAngle = walkAngle1; this->walkAngle = walkAngle1;
this->walkDist = sqrtf((xDiff * xDiff) + (zDiff * zDiff)); this->walkDist = sqrtf((xDiff * xDiff) + (zDiff * zDiff));
@ -305,7 +305,7 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) {
EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint); EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint);
xDiff = pathPos.x - this->actor.world.pos.x; xDiff = pathPos.x - this->actor.world.pos.x;
zDiff = pathPos.z - this->actor.world.pos.z; zDiff = pathPos.z - this->actor.world.pos.z;
walkAngle2 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff)); walkAngle2 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->walkAngle = walkAngle2; this->walkAngle = walkAngle2;
this->walkDist = sqrtf((xDiff * xDiff) + (zDiff * zDiff)); this->walkDist = sqrtf((xDiff * xDiff) + (zDiff * zDiff));
} }

View file

@ -411,7 +411,7 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) {
pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint;
dx = pointPos->x - this->actor.world.pos.x; dx = pointPos->x - this->actor.world.pos.x;
dz = pointPos->z - this->actor.world.pos.z; dz = pointPos->z - this->actor.world.pos.z;
this->rotYtowardsPath = RADF_TO_BINANG(Math_FAtan2F(dx, dz)); this->rotYtowardsPath = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
dxz = sqrtf(SQ(dx) + SQ(dz)); dxz = sqrtf(SQ(dx) + SQ(dz));
if (dxz > 10.0f) { if (dxz > 10.0f) {
exitLoop = true; exitLoop = true;
@ -499,7 +499,7 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, GlobalContext* globalCtx) {
Matrix_MultVec3f(&D_809E4148, &vec); Matrix_MultVec3f(&D_809E4148, &vec);
gerudoGuard = gerudoGuard =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y, Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y,
this->initPos.z + vec.z, 0, RADF_TO_BINANG(Math_FAtan2F(-vec.x, -vec.z)), 0, 2); this->initPos.z + vec.z, 0, RAD_TO_BINANG(Math_FAtan2F(-vec.x, -vec.z)), 0, 2);
if (gerudoGuard == NULL) { if (gerudoGuard == NULL) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
@ -526,7 +526,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) {
pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint;
dx = pointPos->x - this->actor.world.pos.x; dx = pointPos->x - this->actor.world.pos.x;
dz = pointPos->z - this->actor.world.pos.z; dz = pointPos->z - this->actor.world.pos.z;
ry = RADF_TO_BINANG(Math_FAtan2F(dx, dz)); ry = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
dxz = sqrtf(SQ(dx) + SQ(dz)); dxz = sqrtf(SQ(dx) + SQ(dz));
if (dxz <= 20.88f) { if (dxz <= 20.88f) {
this->waypoint++; this->waypoint++;

View file

@ -364,7 +364,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) {
pathPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->waypoint]; pathPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->waypoint];
xDist = pathPos->x - this->actor.world.pos.x; xDist = pathPos->x - this->actor.world.pos.x;
zDist = pathPos->z - this->actor.world.pos.z; zDist = pathPos->z - this->actor.world.pos.z;
runAngle = RADF_TO_BINANG(Math_FAtan2F(xDist, zDist)); runAngle = RAD_TO_BINANG(Math_FAtan2F(xDist, zDist));
runDist = sqrtf((xDist * xDist) + (zDist * zDist)); runDist = sqrtf((xDist * xDist) + (zDist * zDist));
run = false; run = false;

View file

@ -342,7 +342,7 @@ void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
dx = this->flowerPos.x - this->actor.world.pos.x; dx = this->flowerPos.x - this->actor.world.pos.x;
dz = this->flowerPos.z - this->actor.world.pos.z; dz = this->flowerPos.z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0); Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y;
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
this->actor.velocity.y = 9.0f; this->actor.velocity.y = 9.0f;

View file

@ -303,7 +303,7 @@ void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
dx = 1340.0f + 3.0f - this->actor.world.pos.x; dx = 1340.0f + 3.0f - this->actor.world.pos.x;
dz = 0.0f - this->actor.world.pos.z; dz = 0.0f - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 0x32, 0xBB8, 0); Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 0x32, 0xBB8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y;
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
@ -382,8 +382,8 @@ void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx) {
dx = this->flowerPos.x - this->actor.world.pos.x; dx = this->flowerPos.x - this->actor.world.pos.x;
dz = -180.0f - this->actor.world.pos.z; dz = -180.0f - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 3, 0x1388, 0); Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 3, 0x1388, 0);
if (fabsf(this->actor.shape.rot.y - RADF_TO_BINANG(Math_FAtan2F(dx, dz))) < 20.0f) { if (fabsf(this->actor.shape.rot.y - RAD_TO_BINANG(Math_FAtan2F(dx, dz))) < 20.0f) {
this->actor.speedXZ = 1.0f; this->actor.speedXZ = 1.0f;
} }
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) {
@ -453,7 +453,7 @@ void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx) {
f32 dx = this->targetPos.x - this->actor.world.pos.x; f32 dx = this->targetPos.x - this->actor.world.pos.x;
f32 dz = this->targetPos.z - this->actor.world.pos.z; f32 dz = this->targetPos.z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0); Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
turnMod = 90.0f; turnMod = 90.0f;
} }
if ((Rand_ZeroFloat(10.0f + turnMod) < 1.0f) && (this->action != DNT_ACTION_ATTACK)) { if ((Rand_ZeroFloat(10.0f + turnMod) < 1.0f) && (this->action != DNT_ACTION_ATTACK)) {
@ -525,7 +525,7 @@ void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) {
this->actor.speedXZ = 0.0f; this->actor.speedXZ = 0.0f;
return; return;
} }
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0); Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y;
} else { } else {
if (this->timer1 == 1) { if (this->timer1 == 1) {
@ -668,7 +668,7 @@ void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) {
dx = player->actor.world.pos.x - this->mouthPos.x; dx = player->actor.world.pos.x - this->mouthPos.x;
dy = player->actor.world.pos.y + 30.0f - this->mouthPos.y; dy = player->actor.world.pos.y + 30.0f - this->mouthPos.y;
dz = player->actor.world.pos.z - this->mouthPos.z; dz = player->actor.world.pos.z - this->mouthPos.z;
Math_SmoothStepToS(&this->actor.shape.rot.x, -RADF_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz)))), 3, 0x1388, Math_SmoothStepToS(&this->actor.shape.rot.x, -RAD_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz)))), 3, 0x1388,
0); 0);
if ((frame >= this->endFrame) && (this->timer2 == 0)) { if ((frame >= this->endFrame) && (this->timer2 == 0)) {
this->timer2 = (s16)Rand_ZeroFloat(10.0f) + 10; this->timer2 = (s16)Rand_ZeroFloat(10.0f) + 10;
@ -721,7 +721,7 @@ void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
sp2C = this->flowerPos.x - this->actor.world.pos.x; sp2C = this->flowerPos.x - this->actor.world.pos.x;
sp28 = this->flowerPos.z - this->actor.world.pos.z; sp28 = this->flowerPos.z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp2C, sp28)), 1, 0xBB8, 0); Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(sp2C, sp28)), 1, 0xBB8, 0);
if (this->timer5 == 0) { if (this->timer5 == 0) {
this->timer5 = 10; this->timer5 = 10;
} else if (!(this->timer5 & 1)) { } else if (!(this->timer5 & 1)) {

View file

@ -518,7 +518,7 @@ void EnFd_Land(EnFd* this, GlobalContext* globalCtx) {
this->spinTimer = Rand_S16Offset(60, 90); this->spinTimer = Rand_S16Offset(60, 90);
this->runRadius = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); this->runRadius = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos);
EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir); EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir);
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z)); this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z));
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_4);
this->actionFunc = EnFd_SpinAndSpawnFire; this->actionFunc = EnFd_SpinAndSpawnFire;
} }
@ -619,7 +619,7 @@ void EnFd_Run(EnFd* this, GlobalContext* globalCtx) {
} }
Math_SmoothStepToF(&this->runRadius, runRadiusTarget, 0.3f, 100.0f, 0.0f); Math_SmoothStepToF(&this->runRadius, runRadiusTarget, 0.3f, 100.0f, 0.0f);
EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir); EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir);
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z)), 4, 0xFA0, 1); Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z)), 4, 0xFA0, 1);
this->actor.world.rot = this->actor.shape.rot; this->actor.world.rot = this->actor.shape.rot;
func_8002F974(&this->actor, NA_SE_EN_FLAME_RUN - SFX_FLAG); func_8002F974(&this->actor, NA_SE_EN_FLAME_RUN - SFX_FLAG);
if (this->skelAnime.curFrame == 6.0f || this->skelAnime.curFrame == 13.0f || this->skelAnime.curFrame == 28.0f) { if (this->skelAnime.curFrame == 6.0f || this->skelAnime.curFrame == 13.0f || this->skelAnime.curFrame == 28.0f) {

View file

@ -150,9 +150,9 @@ void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx) {
dxL = player->actor.world.pos.x - this->actor.world.pos.x; dxL = player->actor.world.pos.x - this->actor.world.pos.x;
dyL = player->actor.world.pos.y + 30.0f - this->actor.world.pos.y; dyL = player->actor.world.pos.y + 30.0f - this->actor.world.pos.y;
dzL = player->actor.world.pos.z - this->actor.world.pos.z; dzL = player->actor.world.pos.z - this->actor.world.pos.z;
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxL, dzL)); this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxL, dzL));
dxzL = sqrtf(SQ(dxL) + SQ(dzL)); dxzL = sqrtf(SQ(dxL) + SQ(dzL));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(dyL, dxzL)); this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(dyL, dxzL));
this->collider.dim.radius = 40; this->collider.dim.radius = 40;
this->collider.dim.height = 50; this->collider.dim.height = 50;
this->collider.dim.yShift = -25; this->collider.dim.yShift = -25;
@ -516,9 +516,9 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
this->actor.speedXZ += 1.0f; this->actor.speedXZ += 1.0f;
} }
} }
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxPG, dzPG)) + angleModY; this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxPG, dzPG)) + angleModY;
this->actor.world.rot.x = this->actor.world.rot.x =
RADF_TO_BINANG(Math_FAtan2F(dyPG, sqrtf((dxPG * dxPG) + (dzPG * dzPG)))) + angleModX; RAD_TO_BINANG(Math_FAtan2F(dyPG, sqrtf((dxPG * dxPG) + (dzPG * dzPG)))) + angleModX;
this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_BLUE; this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_BLUE;
this->work[FHGFIRE_FX_TIMER] = 2; this->work[FHGFIRE_FX_TIMER] = 2;
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_REFLECT_MG, &player->actor.projectedPos, 4, &D_801333E0, Audio_PlaySoundGeneral(NA_SE_IT_SWORD_REFLECT_MG, &player->actor.projectedPos, 4, &D_801333E0,
@ -536,7 +536,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
break; break;
case FHGFIRE_LIGHT_BLUE: case FHGFIRE_LIGHT_BLUE:
if ((bossGnd->flyMode == GND_FLY_RETURN) && (this->work[FHGFIRE_RETURN_COUNT] < 100)) { if ((bossGnd->flyMode == GND_FLY_RETURN) && (this->work[FHGFIRE_RETURN_COUNT] < 100)) {
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxPG, dzPG)); this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxPG, dzPG));
if ((sqrtf(SQ(dxPG) + SQ(dzPG)) < (150.0f + (this->actor.speedXZ * 8.0f)))) { if ((sqrtf(SQ(dxPG) + SQ(dzPG)) < (150.0f + (this->actor.speedXZ * 8.0f)))) {
this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_REFLECT; this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_REFLECT;
bossGnd->returnSuccess = true; bossGnd->returnSuccess = true;
@ -547,8 +547,8 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
if ((sqrtf(SQ(dxPG) + SQ(dyPG) + SQ(dzPG)) < 100.0f)) { if ((sqrtf(SQ(dxPG) + SQ(dyPG) + SQ(dzPG)) < 100.0f)) {
bossGnd->returnSuccess = true; bossGnd->returnSuccess = true;
} }
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxPG, dzPG)); this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxPG, dzPG));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(dyPG, sqrtf(SQ(dxPG) + SQ(dzPG)))); this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(dyPG, sqrtf(SQ(dxPG) + SQ(dzPG))));
} }
if ((fabsf(dxPG) < 30.0f) && (fabsf(dzPG) < 30.0f) && (fabsf(dyPG) < 45.0f)) { if ((fabsf(dxPG) < 30.0f) && (fabsf(dzPG) < 30.0f) && (fabsf(dyPG) < 45.0f)) {
killMode = BALL_IMPACT; killMode = BALL_IMPACT;
@ -573,9 +573,9 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp88, &sp7C, EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp88, &sp7C,
(s16)(Rand_ZeroOne() * 40.0f) + 80, FHGFLASH_LIGHTBALL_GREEN); (s16)(Rand_ZeroOne() * 40.0f) + 80, FHGFLASH_LIGHTBALL_GREEN);
} }
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxL, dzL)); this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxL, dzL));
dxzL = sqrtf(SQ(dxL) + SQ(dzL)); dxzL = sqrtf(SQ(dxL) + SQ(dzL));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(dyL, dxzL)); this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(dyL, dxzL));
this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_GREEN; this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_GREEN;
Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_REFLECT_MG); Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_REFLECT_MG);
this->actor.speedXZ += 2.0f; this->actor.speedXZ += 2.0f;

View file

@ -210,7 +210,7 @@ void EnFr_OrientUnderwater(EnFr* this) {
this->actor.world.pos.z = this->posLogSpot.z + vec2.z; this->actor.world.pos.z = this->posLogSpot.z + vec2.z;
this->actor.world.pos.y = sLogSpotToFromWater[this->actor.params].yDist + this->posLogSpot.y; this->actor.world.pos.y = sLogSpotToFromWater[this->actor.params].yDist + this->posLogSpot.y;
this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.shape.rot.y =
RADF_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw) + 0x8000; RAD_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw) + 0x8000;
this->actor.speedXZ = 0.0f; this->actor.speedXZ = 0.0f;
this->actor.velocity.y = 0.0f; this->actor.velocity.y = 0.0f;
this->actor.gravity = 0.0f; this->actor.gravity = 0.0f;
@ -445,7 +445,7 @@ void EnFr_OrientOnLogSpot(EnFr* this, GlobalContext* globalCtx) {
void EnFr_ChooseJumpFromLogSpot(EnFr* this, GlobalContext* globalCtx) { void EnFr_ChooseJumpFromLogSpot(EnFr* this, GlobalContext* globalCtx) {
if (sEnFrPointers.flags == 12) { if (sEnFrPointers.flags == 12) {
this->actor.world.rot.y = RADF_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw); this->actor.world.rot.y = RAD_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw);
Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f, Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f,
Animation_GetLastFrame(&object_fr_Anim_0007BC), ANIMMODE_ONCE, 0.0f); Animation_GetLastFrame(&object_fr_Anim_0007BC), ANIMMODE_ONCE, 0.0f);
this->actionFunc = EnFr_JumpingBackIntoWater; this->actionFunc = EnFr_JumpingBackIntoWater;

View file

@ -295,7 +295,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
Vec3f sp48; Vec3f sp48;
EnFw_GetPosAdjAroundCircle(&sp48, this, this->runRadius, this->runDirection); EnFw_GetPosAdjAroundCircle(&sp48, this, this->runRadius, this->runDirection);
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp48.x, sp48.z)), 4, 0xFA0, 1); Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(sp48.x, sp48.z)), 4, 0xFA0, 1);
} }
this->actor.world.rot = this->actor.shape.rot; this->actor.world.rot = this->actor.shape.rot;

View file

@ -476,7 +476,7 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) {
pointPos += this->unk_218; pointPos += this->unk_218;
xDist = pointPos->x - this->actor.world.pos.x; xDist = pointPos->x - this->actor.world.pos.x;
zDist = pointPos->z - this->actor.world.pos.z; zDist = pointPos->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(xDist, zDist)), 10, 1000, 1); Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(xDist, zDist)), 10, 1000, 1);
if ((SQ(xDist) + SQ(zDist)) < 600.0f) { if ((SQ(xDist) + SQ(zDist)) < 600.0f) {
this->unk_218++; this->unk_218++;

View file

@ -690,8 +690,8 @@ void EnGoma_SetFloorRot(EnGoma* this) {
nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x);
ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y);
nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z);
Math_ApproachS(&this->slopePitch, RADF_TO_BINANG(-Math_FAtan2F(-nz * ny, 1.0f)), 1, 1000); Math_ApproachS(&this->slopePitch, RAD_TO_BINANG(-Math_FAtan2F(-nz * ny, 1.0f)), 1, 1000);
Math_ApproachS(&this->slopeRoll, RADF_TO_BINANG(Math_FAtan2F(-nx * ny, 1.0f)), 1, 1000); Math_ApproachS(&this->slopeRoll, RAD_TO_BINANG(Math_FAtan2F(-nx * ny, 1.0f)), 1, 1000);
} }
} }

View file

@ -165,7 +165,7 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) {
pathDiffX = pointPos->x - this->actor.world.pos.x; pathDiffX = pointPos->x - this->actor.world.pos.x;
pathDiffZ = pointPos->z - this->actor.world.pos.z; pathDiffZ = pointPos->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 3, Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 3,
this->bodyTurnSpeed, 0); this->bodyTurnSpeed, 0);
Math_ApproachF(&this->bodyTurnSpeed, this->bodyTurnSpeedTarget, 1.0f, this->bodyTurnSpeedMax); Math_ApproachF(&this->bodyTurnSpeed, this->bodyTurnSpeedTarget, 1.0f, this->bodyTurnSpeedMax);

View file

@ -2936,7 +2936,7 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) {
return; return;
} }
floorSlope = RADF_TO_BINANG(Math_FAtan2F(this->yBack - this->yFront, 60.0f)); floorSlope = RAD_TO_BINANG(Math_FAtan2F(this->yBack - this->yFront, 60.0f));
if (this->actor.floorPoly != 0) { if (this->actor.floorPoly != 0) {
nx = this->actor.floorPoly->normal.x * COLPOLY_NORMAL_FRAC; nx = this->actor.floorPoly->normal.x * COLPOLY_NORMAL_FRAC;
ny = this->actor.floorPoly->normal.y * COLPOLY_NORMAL_FRAC; ny = this->actor.floorPoly->normal.y * COLPOLY_NORMAL_FRAC;
@ -3035,7 +3035,7 @@ void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle) {
*stickMag = *stickMag; *stickMag = *stickMag;
} }
*angle = RADF_TO_BINANG(Math_FAtan2F(-curStick->x, curStick->y)); *angle = RAD_TO_BINANG(Math_FAtan2F(-curStick->x, curStick->y));
} }
void EnHorse_UpdateStick(EnHorse* this, GlobalContext* globalCtx) { void EnHorse_UpdateStick(EnHorse* this, GlobalContext* globalCtx) {
@ -3054,7 +3054,7 @@ void EnHorse_ResolveCollision(EnHorse* this, GlobalContext* globalCtx, Collision
nx = COLPOLY_GET_NORMAL(colPoly->normal.x); nx = COLPOLY_GET_NORMAL(colPoly->normal.x);
ny = COLPOLY_GET_NORMAL(colPoly->normal.y); ny = COLPOLY_GET_NORMAL(colPoly->normal.y);
nz = COLPOLY_GET_NORMAL(colPoly->normal.z); nz = COLPOLY_GET_NORMAL(colPoly->normal.z);
if (!(Math_CosS(this->actor.world.rot.y - RADF_TO_BINANG(Math_FAtan2F(colPoly->normal.x, colPoly->normal.z)) - if (!(Math_CosS(this->actor.world.rot.y - RAD_TO_BINANG(Math_FAtan2F(colPoly->normal.x, colPoly->normal.z)) -
0x7FFF) < 0.7071f)) { // cos(45 degrees) 0x7FFF) < 0.7071f)) { // cos(45 degrees)
dist = Math3D_DistPlaneToPos(nx, ny, nz, colPoly->dist, &this->actor.world.pos); dist = Math3D_DistPlaneToPos(nx, ny, nz, colPoly->dist, &this->actor.world.pos);
offset = (1.0f / sqrtf(SQ(nx) + SQ(nz))); offset = (1.0f / sqrtf(SQ(nx) + SQ(nz)));
@ -3174,7 +3174,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) {
if (intersectDist < 30.0f) { if (intersectDist < 30.0f) {
EnHorse_ResolveCollision(this, globalCtx, wall); EnHorse_ResolveCollision(this, globalCtx, wall);
} }
if ((Math_CosS(this->actor.world.rot.y - RADF_TO_BINANG(Math_FAtan2F(wall->normal.x, wall->normal.z)) - if ((Math_CosS(this->actor.world.rot.y - RAD_TO_BINANG(Math_FAtan2F(wall->normal.x, wall->normal.z)) -
0x7FFF) < 0.5f) || 0x7FFF) < 0.5f) ||
SurfaceType_IsHorseBlocked(&globalCtx->colCtx, wall, bgId) != 0) { SurfaceType_IsHorseBlocked(&globalCtx->colCtx, wall, bgId) != 0) {
return; return;

View file

@ -280,7 +280,7 @@ void func_80A68E14(EnHorseGanon* this, GlobalContext* globalCtx) {
temp_ret = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &col, &temp1, &v); temp_ret = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &col, &temp1, &v);
this->unk_1F4 = temp_ret; this->unk_1F4 = temp_ret;
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - temp_ret, 30.0f)); this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - temp_ret, 30.0f));
} }
void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx) { void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -295,7 +295,7 @@ void EnHorseNormal_FollowPath(EnHorseNormal* this, GlobalContext* globalCtx) {
pointPos += this->waypoint; pointPos += this->waypoint;
dx = pointPos->x - this->actor.world.pos.x; dx = pointPos->x - this->actor.world.pos.x;
dz = pointPos->z - this->actor.world.pos.z; dz = pointPos->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 0xA, 0x7D0, 1); Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 0xA, 0x7D0, 1);
this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.shape.rot.y = this->actor.world.rot.y;
if (SQ(dx) + SQ(dz) < 600.0f) { if (SQ(dx) + SQ(dz) < 600.0f) {
this->waypoint++; this->waypoint++;
@ -556,7 +556,7 @@ void func_80A6C8E0(EnHorseNormal* this, GlobalContext* globalCtx) {
sp28.y = this->actor.world.pos.y + 60.0f; sp28.y = this->actor.world.pos.y + 60.0f;
sp28.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z; sp28.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z;
this->unk_220 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp38, &sp24, &sp28); this->unk_220 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp38, &sp24, &sp28);
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_220, 30.0f)); this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_220, 30.0f));
} }
static EnHorseNormalActionFunc sActionFuncs[] = { static EnHorseNormalActionFunc sActionFuncs[] = {

View file

@ -223,7 +223,7 @@ void func_80A6DE38(EnHorseZelda* this, GlobalContext* globalCtx) {
pos.y = this->actor.world.pos.y + 60.0f; pos.y = this->actor.world.pos.y + 60.0f;
pos.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z; pos.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z;
this->unk_1F4 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &pos); this->unk_1F4 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &pos);
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_1F4, 30.0f)); this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_1F4, 30.0f));
} }
void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx) { void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -694,7 +694,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->actionState = ENKANBAN_AIR; this->actionState = ENKANBAN_AIR;
this->actor.gravity = -1.0f; this->actor.gravity = -1.0f;
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dx, dz)); this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
if (this->partCount >= 4) { if (this->partCount >= 4) {
this->bounceX = (s16)Rand_ZeroFloat(10.0f) + 6; this->bounceX = (s16)Rand_ZeroFloat(10.0f) + 6;
this->bounceZ = (s16)Rand_ZeroFloat(10.0f) + 6; this->bounceZ = (s16)Rand_ZeroFloat(10.0f) + 6;

View file

@ -284,7 +284,7 @@ s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) {
pathDiffX = pointPos->x - this->actor.world.pos.x; pathDiffX = pointPos->x - this->actor.world.pos.x;
pathDiffZ = pointPos->z - this->actor.world.pos.z; pathDiffZ = pointPos->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 0xA, 0x3E8, 1); Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 0xA, 0x3E8, 1);
if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f) { if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f) {
this->waypoint++; this->waypoint++;

View file

@ -118,7 +118,7 @@ void EnNb_UpdatePath(EnNb* this, GlobalContext* globalCtx) {
this->finalPos.y = pointPos[1].y; this->finalPos.y = pointPos[1].y;
this->finalPos.z = pointPos[1].z; this->finalPos.z = pointPos[1].z;
this->pathYaw = this->pathYaw =
RADF_TO_BINANG(Math_FAtan2F(this->finalPos.x - this->initialPos.x, this->finalPos.z - this->initialPos.z)); RAD_TO_BINANG(Math_FAtan2F(this->finalPos.x - this->initialPos.x, this->finalPos.z - this->initialPos.z));
// "En_Nb_Get_path_info Rail Data Get! = %d!!!!!!!!!!!!!!" // "En_Nb_Get_path_info Rail Data Get! = %d!!!!!!!!!!!!!!"
osSyncPrintf("En_Nb_Get_path_info レールデータをゲットだぜ = %d!!!!!!!!!!!!!!\n", path); osSyncPrintf("En_Nb_Get_path_info レールデータをゲットだぜ = %d!!!!!!!!!!!!!!\n", path);
} else { } else {

View file

@ -577,7 +577,7 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) {
this->unk_29E = 7; this->unk_29E = 7;
} }
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(posY, posZ)), 3, this->unk_300, 0); Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(posY, posZ)), 3, this->unk_300, 0);
Math_ApproachF(&this->unk_300, 10000.0f, 1.0f, 1000.0f); Math_ApproachF(&this->unk_300, 10000.0f, 1.0f, 1000.0f);
} }
@ -605,7 +605,7 @@ void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) {
pointPos += this->waypoint; pointPos += this->waypoint;
pathDiffX = pointPos->x - this->actor.world.pos.x; pathDiffX = pointPos->x - this->actor.world.pos.x;
pathDiffZ = pointPos->z - this->actor.world.pos.z; pathDiffZ = pointPos->z - this->actor.world.pos.z;
this->unk_2E4 = RADF_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)); this->unk_2E4 = RAD_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ));
func_80AB6100(this, globalCtx, 2); func_80AB6100(this, globalCtx, 2);
if (fabsf(pathDiffX) < 30.0f && fabsf(pathDiffZ) < 30.0f) { if (fabsf(pathDiffX) < 30.0f && fabsf(pathDiffZ) < 30.0f) {
@ -839,7 +839,7 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) {
} }
this->actionFunc = EnNiw_ResetAction; this->actionFunc = EnNiw_ResetAction;
} else { } else {
this->unk_2E4 = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.x - player->actor.world.pos.x, this->unk_2E4 = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.x - player->actor.world.pos.x,
this->actor.world.pos.z - player->actor.world.pos.z)); this->actor.world.pos.z - player->actor.world.pos.z));
func_80AB6100(this, globalCtx, 0); func_80AB6100(this, globalCtx, 0);
func_80AB5BF8(this, globalCtx, 2); func_80AB5BF8(this, globalCtx, 2);

View file

@ -123,7 +123,7 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) {
} }
// Change her angle so that she is always facing the cuckoo // Change her angle so that she is always facing the cuckoo
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(xDistBetween, zDistBetween)), 3, Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(xDistBetween, zDistBetween)), 3,
this->unk_27C, 0); this->unk_27C, 0);
Math_ApproachF(&this->unk_27C, 5000.0f, 30.0f, 150.0f); Math_ApproachF(&this->unk_27C, 5000.0f, 30.0f, 150.0f);
this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y;

View file

@ -1058,7 +1058,7 @@ s32 func_80AECF6C(EnRu1* this, GlobalContext* globalCtx) {
shapeRotY = &player->actor.shape.rot.y; shapeRotY = &player->actor.shape.rot.y;
temp1 = this->actor.world.pos.x - player->actor.world.pos.x; temp1 = this->actor.world.pos.x - player->actor.world.pos.x;
temp2 = this->actor.world.pos.z - player->actor.world.pos.z; temp2 = this->actor.world.pos.z - player->actor.world.pos.z;
temp_f16 = RADF_TO_BINANG(Math_FAtan2F(temp1, temp2)); temp_f16 = RAD_TO_BINANG(Math_FAtan2F(temp1, temp2));
if (*shapeRotY != temp_f16) { if (*shapeRotY != temp_f16) {
Math_SmoothStepToS(shapeRotY, temp_f16, 0x14, 0x1838, 0x64); Math_SmoothStepToS(shapeRotY, temp_f16, 0x14, 0x1838, 0x64);
player->actor.world.rot.y = *shapeRotY; player->actor.world.rot.y = *shapeRotY;

View file

@ -142,7 +142,7 @@ void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) {
dist2d = sqrtf(SQ(dX) + SQ(dZ)); dist2d = sqrtf(SQ(dX) + SQ(dZ));
this->applySpeed = true; this->applySpeed = true;
this->splashTimer = 0; this->splashTimer = 0;
angle = RADF_TO_BINANG(Math_FAtan2F(dX, dZ)); angle = RAD_TO_BINANG(Math_FAtan2F(dX, dZ));
dAngle = (player->actor.world.rot.y ^ 0x8000) - angle; dAngle = (player->actor.world.rot.y ^ 0x8000) - angle;
player->actor.gravity = 0.0f; player->actor.gravity = 0.0f;
player->actor.velocity.y = 0.0f; player->actor.velocity.y = 0.0f;

View file

@ -91,7 +91,7 @@ void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) {
if (func_80B0B81C(&this->actor.world.pos, &player->actor.world.pos, &posDifference, this->actor.scale.y) != 0) { if (func_80B0B81C(&this->actor.world.pos, &player->actor.world.pos, &posDifference, this->actor.scale.y) != 0) {
xzDist = sqrtf(SQ(posDifference.x) + SQ(posDifference.z)); xzDist = sqrtf(SQ(posDifference.x) + SQ(posDifference.z));
yDistWithOffset = player->actor.world.pos.y - (this->actor.world.pos.y - 90.0f); yDistWithOffset = player->actor.world.pos.y - (this->actor.world.pos.y - 90.0f);
player->windDirection = RADF_TO_BINANG(Math_FAtan2F(-posDifference.x, -posDifference.z)); player->windDirection = RAD_TO_BINANG(Math_FAtan2F(-posDifference.x, -posDifference.z));
if (xzDist > 3.0f) { if (xzDist > 3.0f) {
Math_SmoothStepToF(&player->windSpeed, 3.0f, 0.5f, xzDist, 0.0f); Math_SmoothStepToF(&player->windSpeed, 3.0f, 0.5f, xzDist, 0.0f);
} else { } else {

View file

@ -739,7 +739,7 @@ s32 func_80B0DFFC(EnSw* this, GlobalContext* globalCtx) {
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_484, &sp50, &this->unk_430, true, if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_484, &sp50, &this->unk_430, true,
false, false, true, &sp5C)) { false, false, true, &sp5C)) {
this->actor.wallYaw = RADF_TO_BINANG(Math_FAtan2F(this->unk_430->normal.x, this->unk_430->normal.z)); this->actor.wallYaw = RAD_TO_BINANG(Math_FAtan2F(this->unk_430->normal.x, this->unk_430->normal.z));
this->actor.world.pos = sp50; this->actor.world.pos = sp50;
this->actor.world.pos.x += 6.0f * Math_SinS(this->actor.world.rot.y); this->actor.world.pos.x += 6.0f * Math_SinS(this->actor.world.rot.y);
this->actor.world.pos.z += 6.0f * Math_CosS(this->actor.world.rot.y); this->actor.world.pos.z += 6.0f * Math_CosS(this->actor.world.rot.y);

View file

@ -328,7 +328,7 @@ void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) {
this->unk_294 = 7; this->unk_294 = 7;
} }
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(tmpf1, tmpf2)), 3, this->unk_2C8.z, 0); Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(tmpf1, tmpf2)), 3, this->unk_2C8.z, 0);
Math_ApproachF(&this->unk_2C8.z, 10000.0f, 1.0f, 1000.0f); Math_ApproachF(&this->unk_2C8.z, 10000.0f, 1.0f, 1000.0f);
} }
@ -474,7 +474,7 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) {
} }
Math_SmoothStepToS(&this->actor.world.rot.y, Math_SmoothStepToS(&this->actor.world.rot.y,
RADF_TO_BINANG(Math_FAtan2F(player->actor.world.pos.x - this->actor.world.pos.x, RAD_TO_BINANG(Math_FAtan2F(player->actor.world.pos.x - this->actor.world.pos.x,
player->actor.world.pos.z - this->actor.world.pos.z)) + player->actor.world.pos.z - this->actor.world.pos.z)) +
phi_f16, phi_f16,
5, this->unk_2C8.y, 0); 5, this->unk_2C8.y, 0);

View file

@ -315,7 +315,7 @@ s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) {
dx = point->x - this->actor.world.pos.x; dx = point->x - this->actor.world.pos.x;
dz = point->z - this->actor.world.pos.z; dz = point->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 10, 1000, 1); Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 10, 1000, 1);
this->actor.world.rot = this->actor.shape.rot; this->actor.world.rot = this->actor.shape.rot;
if (SQ(dx) + SQ(dz) < 10.0f) { if (SQ(dx) + SQ(dz) < 10.0f) {

View file

@ -228,7 +228,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) {
newActor->yRotVel = 0.0f; newActor->yRotVel = 0.0f;
xRotVel = sqrtf(SQ(spawnOffset.x) + SQ(spawnOffset.z)); xRotVel = sqrtf(SQ(spawnOffset.x) + SQ(spawnOffset.z));
newActor->xRotVel = 0x1000 / 10.0f * xRotVel; newActor->xRotVel = 0x1000 / 10.0f * xRotVel;
newActor->actor.shape.rot.y = RADF_TO_BINANG(Math_FAtan2F(spawnOffset.x, spawnOffset.z)); newActor->actor.shape.rot.y = RAD_TO_BINANG(Math_FAtan2F(spawnOffset.x, spawnOffset.z));
newActor->shadowOpacity = 200.0f; newActor->shadowOpacity = 200.0f;
} }
} }

View file

@ -754,7 +754,7 @@ void func_80B50304(EnZl2* this, GlobalContext* globalCtx) {
this->drawConfig = 1; this->drawConfig = 1;
this->unk_23C = 0.0f; this->unk_23C = 0.0f;
shape->shadowAlpha = 255; shape->shadowAlpha = 255;
this->actor.world.rot.y = shape->rot.y = RADF_TO_BINANG(Math_FAtan2F(actionXDelta, actionZDelta)); this->actor.world.rot.y = shape->rot.y = RAD_TO_BINANG(Math_FAtan2F(actionXDelta, actionZDelta));
} }
void func_80B503DC(EnZl2* this, GlobalContext* globalCtx) { void func_80B503DC(EnZl2* this, GlobalContext* globalCtx) {

View file

@ -1614,7 +1614,7 @@ s32 func_80B57034(EnZl3* this, s32 arg1, s32 arg2) {
f32 xDiff = vec2->x - vec1->x; f32 xDiff = vec2->x - vec1->x;
f32 zDiff = vec2->z - vec1->z; f32 zDiff = vec2->z - vec1->z;
return ((xDiff == 0.0f) && (zDiff == 0.0f)) ? 0 : RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff)); return ((xDiff == 0.0f) && (zDiff == 0.0f)) ? 0 : RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
} }
return 0; return 0;
} }
@ -1627,7 +1627,7 @@ s16 func_80B57104(EnZl3* this, s32 arg1) {
f32 zDiff = point->z - this->actor.world.pos.z; f32 zDiff = point->z - this->actor.world.pos.z;
if ((xDiff != 0.0f) || (zDiff != 0.0f)) { if ((xDiff != 0.0f) || (zDiff != 0.0f)) {
return RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff)); return RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
} }
} }
return 0; return 0;
@ -1741,7 +1741,7 @@ s32 func_80B57458(EnZl3* this, GlobalContext* globalCtx) {
return 1; return 1;
} }
temp_v0 = (s16)(temp_v1 - RADF_TO_BINANG(Math_FAtan2F(temp_f12, temp_f13))); temp_v0 = (s16)(temp_v1 - RAD_TO_BINANG(Math_FAtan2F(temp_f12, temp_f13)));
if (temp_v0 < 0x1555) { if (temp_v0 < 0x1555) {
return 1; return 1;
@ -1828,7 +1828,7 @@ void func_80B577BC(GlobalContext* globalCtx, Vec3f* vec) {
f32 posZ = vec->z; f32 posZ = vec->z;
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TEST, posX, posY, posZ, 0, Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TEST, posX, posY, posZ, 0,
RADF_TO_BINANG(Math_FAtan2F(playerPos->x - posX, playerPos->z - posZ)), 0, 5); RAD_TO_BINANG(Math_FAtan2F(playerPos->x - posX, playerPos->z - posZ)), 0, 5);
} }
void func_80B57858(GlobalContext* globalCtx) { void func_80B57858(GlobalContext* globalCtx) {