mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-27 07:07:09 +00:00
Angle cleanup - RADF_TO_BINANG
(#1155)
* Run formatter * Touch up angle macros (parentheses and hex constants) * Use `RADF_TO_BINANG` more
This commit is contained in:
parent
aab5bc9211
commit
61b864a89c
45 changed files with 120 additions and 128 deletions
|
@ -94,15 +94,15 @@ typedef struct {
|
|||
#define IS_ZERO(f) (fabsf(f) < 0.008f)
|
||||
|
||||
// Trig macros
|
||||
#define DEGF_TO_BINANG(degreesf) (s16)(degreesf * 182.04167f + .5f)
|
||||
#define RADF_TO_BINANG(radf) (s16)(radf * (32768.0f / M_PI))
|
||||
#define RADF_TO_DEGF(radf) (radf * (180.0f / M_PI))
|
||||
#define DEGF_TO_RADF(degf) (degf * (M_PI / 180.0f))
|
||||
#define BINANG_ROT180(angle) ((s16)(angle - 0x7FFF))
|
||||
#define BINANG_SUB(a, b) ((s16)(a - b))
|
||||
#define DEGF_TO_BINANG(degreesf) (s16)((degreesf) * 182.04167f + .5f)
|
||||
#define RADF_TO_BINANG(radf) (s16)((radf) * (0x8000 / M_PI))
|
||||
#define RADF_TO_DEGF(radf) ((radf) * (180.0f / M_PI))
|
||||
#define DEGF_TO_RADF(degf) ((degf) * (M_PI / 180.0f))
|
||||
#define BINANG_ROT180(angle) ((s16)((angle) - 0x7FFF))
|
||||
#define BINANG_SUB(a, b) ((s16)((a) - (b)))
|
||||
#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f))
|
||||
#define BINANG_TO_DEGF(binang) ((f32)binang * (360.0001525f / 65535.0f))
|
||||
#define BINANG_TO_RAD(binang) (((f32)binang / 32768.0f) * M_PI)
|
||||
#define BINANG_TO_DEGF(binang) ((f32)(binang) * (360.0001525f / 65535.0f))
|
||||
#define BINANG_TO_RAD(binang) (((f32)(binang) / (f32)0x8000) * M_PI)
|
||||
|
||||
// Vector macros
|
||||
#define SQXZ(vec) ((vec.x) * (vec.x) + (vec.z) * (vec.z))
|
||||
|
|
|
@ -769,17 +769,17 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
|
|||
temp = mf->xz;
|
||||
temp *= temp;
|
||||
temp += SQ(mf->zz);
|
||||
rotDest->x = Math_FAtan2F(-mf->yz, sqrtf(temp)) * (0x8000 / M_PI);
|
||||
rotDest->x = RADF_TO_BINANG(Math_FAtan2F(-mf->yz, sqrtf(temp)));
|
||||
|
||||
if ((rotDest->x == 0x4000) || (rotDest->x == -0x4000)) {
|
||||
rotDest->z = 0;
|
||||
|
||||
rotDest->y = Math_FAtan2F(-mf->zx, mf->xx) * (0x8000 / M_PI);
|
||||
rotDest->y = RADF_TO_BINANG(Math_FAtan2F(-mf->zx, mf->xx));
|
||||
} else {
|
||||
rotDest->y = Math_FAtan2F(mf->xz, mf->zz) * (0x8000 / M_PI);
|
||||
rotDest->y = RADF_TO_BINANG(Math_FAtan2F(mf->xz, mf->zz));
|
||||
|
||||
if (!flag) {
|
||||
rotDest->z = Math_FAtan2F(mf->yx, mf->yy) * (0x8000 / M_PI);
|
||||
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(mf->yx, mf->yy));
|
||||
} else {
|
||||
temp = mf->xx;
|
||||
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
|
||||
* which is the same as in the !flag branch */
|
||||
rotDest->z = Math_FAtan2F(temp, temp2) * (0x8000 / M_PI);
|
||||
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(temp, temp2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -822,16 +822,16 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
|
|||
temp = mf->xx;
|
||||
temp *= temp;
|
||||
temp += SQ(mf->yx);
|
||||
rotDest->y = Math_FAtan2F(-mf->zx, sqrtf(temp)) * (0x8000 / M_PI);
|
||||
rotDest->y = RADF_TO_BINANG(Math_FAtan2F(-mf->zx, sqrtf(temp)));
|
||||
|
||||
if ((rotDest->y == 0x4000) || (rotDest->y == -0x4000)) {
|
||||
rotDest->x = 0;
|
||||
rotDest->z = Math_FAtan2F(-mf->xy, mf->yy) * (0x8000 / M_PI);
|
||||
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(-mf->xy, mf->yy));
|
||||
} else {
|
||||
rotDest->z = Math_FAtan2F(mf->yx, mf->xx) * (0x8000 / M_PI);
|
||||
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(mf->yx, mf->xx));
|
||||
|
||||
if (!flag) {
|
||||
rotDest->x = Math_FAtan2F(mf->zy, mf->zz) * (0x8000 / M_PI);
|
||||
rotDest->x = RADF_TO_BINANG(Math_FAtan2F(mf->zy, mf->zz));
|
||||
} else {
|
||||
// see Matrix_MtxFToYXZRotS
|
||||
temp = mf->xy;
|
||||
|
@ -853,7 +853,7 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
|
|||
temp2 = sqrtf(temp2);
|
||||
temp2 = temp3 / temp2;
|
||||
|
||||
rotDest->x = Math_FAtan2F(temp, temp2) * (0x8000 / M_PI);
|
||||
rotDest->x = RADF_TO_BINANG(Math_FAtan2F(temp, temp2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4179,12 +4179,12 @@ void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) {
|
|||
sp38 = Math_SinS(arg1);
|
||||
sp34 = Math_CosS(arg1);
|
||||
sp28 = (-(floorPolyNormalX * sp38) - (floorPolyNormalZ * sp34));
|
||||
arg2->x = -(s16)(Math_FAtan2F(sp28 * floorPolyNormalY, 1.0f) * (32768 / M_PI));
|
||||
arg2->x = -RADF_TO_BINANG(Math_FAtan2F(sp28 * floorPolyNormalY, 1.0f));
|
||||
|
||||
sp2C = Math_SinS(arg1 - 16375);
|
||||
sp30 = Math_CosS(arg1 - 16375);
|
||||
sp24 = (-(floorPolyNormalX * sp2C) - (floorPolyNormalZ * sp30));
|
||||
arg2->z = -(s16)(Math_FAtan2F(sp24 * floorPolyNormalY, 1.0f) * (32768 / M_PI));
|
||||
arg2->z = -RADF_TO_BINANG(Math_FAtan2F(sp24 * floorPolyNormalY, 1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -951,7 +951,7 @@ s32 func_800458D4(Camera* camera, VecSph* eyeAtDir, f32 arg2, f32* arg3, s16 arg
|
|||
|
||||
if (eyeAtAngle > DEGF_TO_RADF(OREG(32))) {
|
||||
if (1) {}
|
||||
phi_f2 = 1.0f - sinf(DEGF_TO_RADF(eyeAtAngle - OREG(32)));
|
||||
phi_f2 = 1.0f - sinf(eyeAtAngle - DEGF_TO_RADF(OREG(32)));
|
||||
} else if (eyeAtAngle < DEGF_TO_RADF(OREG(33))) {
|
||||
phi_f2 = 1.0f - sinf(DEGF_TO_RADF(OREG(33)) - eyeAtAngle);
|
||||
} else {
|
||||
|
|
|
@ -27,7 +27,7 @@ f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw) {
|
|||
dx = pointPos->x - actor->world.pos.x;
|
||||
dz = pointPos->z - actor->world.pos.z;
|
||||
|
||||
*yaw = Math_FAtan2F(dx, dz) * (32768 / M_PI);
|
||||
*yaw = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
|
||||
|
||||
return SQ(dx) + SQ(dz);
|
||||
}
|
||||
|
|
|
@ -852,14 +852,14 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
|
|||
|
||||
sp50 = Math_FAtan2F(sp58, sp60);
|
||||
|
||||
temp1 = (M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50))) * (0x8000 / M_PI);
|
||||
temp1 = RADF_TO_BINANG(M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50)));
|
||||
temp1 = temp1 - skelAnime->jointTable[shinLimbIndex].z;
|
||||
|
||||
if ((s16)(ABS(skelAnime->jointTable[shinLimbIndex].x) + ABS(skelAnime->jointTable[shinLimbIndex].y)) < 0) {
|
||||
temp1 += 0x8000;
|
||||
}
|
||||
|
||||
temp2 = (sp50 - sp54) * (0x8000 / M_PI);
|
||||
temp2 = RADF_TO_BINANG(sp50 - sp54);
|
||||
rot->z -= temp2;
|
||||
|
||||
skelAnime->jointTable[thighLimbIndex].z = skelAnime->jointTable[thighLimbIndex].z - temp2;
|
||||
|
|
|
@ -694,7 +694,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) {
|
|||
sp48 = sp4C->x - this->actor.world.pos.x;
|
||||
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_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(sp48, sp44) * (0x8000 / M_PI), 5,
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp48, sp44)), 5,
|
||||
(this->unk_1EC * this->unk_1E8), 5);
|
||||
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;
|
||||
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_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(sp4C, sp48) * (0x8000 / M_PI), 5,
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp4C, sp48)), 5,
|
||||
this->unk_1EC * this->unk_1E8, 0);
|
||||
|
||||
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;
|
||||
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_SmoothStepToS(&this->actor.world.rot.y, (Math_FAtan2F(tempSin, tempCos) * (0x8000 / M_PI)), 5,
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(tempSin, tempCos)), 5,
|
||||
(this->unk_1EC * this->unk_1E8), 0);
|
||||
|
||||
if ((fabsf(tempSin) <= 15.0f) && (fabsf(tempCos) <= 15.0f)) {
|
||||
|
|
|
@ -289,8 +289,8 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) {
|
|||
this->fwork[BFD_FLY_WOBBLE_AMP];
|
||||
dz += Math_SinS((1796.0f + this->fwork[BFD_FLY_WOBBLE_RATE]) * this->work[BFD_MOVE_TIMER]) *
|
||||
this->fwork[BFD_FLY_WOBBLE_AMP];
|
||||
angleToTarget = (s16)(Math_FAtan2F(dx, dz) * (0x8000 / M_PI));
|
||||
pitchToTarget = (s16)(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz))) * (0x8000 / M_PI));
|
||||
angleToTarget = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
|
||||
pitchToTarget = RADF_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz))));
|
||||
|
||||
osSyncPrintf("MODE %d\n", this->work[BFD_ACTION_STATE]);
|
||||
|
||||
|
|
|
@ -844,7 +844,7 @@ void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) {
|
|||
vecToLink.z = playerx->world.pos.z - thisx->world.pos.z;
|
||||
thisx->world.rot.y = thisx->shape.rot.y;
|
||||
thisx->world.rot.x =
|
||||
Math_FAtan2F(vecToLink.y, sqrtf(SQ(vecToLink.x) + SQ(vecToLink.z))) * (0x8000 / M_PI);
|
||||
RADF_TO_BINANG(Math_FAtan2F(vecToLink.y, sqrtf(SQ(vecToLink.x) + SQ(vecToLink.z))));
|
||||
}
|
||||
|
||||
func_8002D908(thisx);
|
||||
|
|
|
@ -1277,8 +1277,8 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) {
|
|||
dz = this->targetPos.z - this->cameraEye.z;
|
||||
tempY = Math_FAtan2F(dx, dz);
|
||||
tempX = Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz)));
|
||||
Math_ApproachS(&this->actor.world.rot.y, tempY * (0x8000 / M_PI), 5, this->cameraYawRate);
|
||||
Math_ApproachS(&this->actor.world.rot.x, tempX * (0x8000 / M_PI), 5, this->cameraYawRate);
|
||||
Math_ApproachS(&this->actor.world.rot.y, RADF_TO_BINANG(tempY), 5, this->cameraYawRate);
|
||||
Math_ApproachS(&this->actor.world.rot.x, RADF_TO_BINANG(tempX), 5, this->cameraYawRate);
|
||||
if (this->work[MO_TENT_MOVE_TIMER] == 150) {
|
||||
this->cameraAtVel.x = fabsf(this->cameraAt.x - player->actor.world.pos.x);
|
||||
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;
|
||||
spD8 = this->targetPos.y - this->actor.world.pos.y;
|
||||
spD4 = this->targetPos.z - this->actor.world.pos.z;
|
||||
spCC = (s16)(Math_FAtan2F(spDC, spD4) * (0x8000 / M_PI));
|
||||
spD0 = (s16)(Math_FAtan2F(spD8, sqrtf(SQ(spDC) + SQ(spD4))) * (0x8000 / M_PI));
|
||||
spCC = RADF_TO_BINANG(Math_FAtan2F(spDC, spD4));
|
||||
spD0 = RADF_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.x, spD0, this->tentMaxAngle, this->tentSpeed);
|
||||
func_8002D908(&this->actor);
|
||||
|
|
|
@ -687,9 +687,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 = (s16)(Math_FAtan2F(xDiff, zDiff) * (32768.0f / M_PI));
|
||||
yawTarget = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
|
||||
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
|
||||
pitchTarget = (s16)(Math_FAtan2F(yDiff, xzDist) * (32768.0f / M_PI));
|
||||
pitchTarget = RADF_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);
|
||||
|
@ -2360,8 +2360,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 = Math_FAtan2F(xDiff, zDiff) * (32768 / M_PI);
|
||||
Math_ApproachS(&this->actor.world.rot.x, Math_FAtan2F(yDiff, sqrtf(SQ(xDiff) + SQ(zDiff))) * (32768 / M_PI), 5,
|
||||
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,
|
||||
this->rotateSpeed);
|
||||
Math_ApproachS(&this->actor.world.rot.y, yaw, 5, this->rotateSpeed);
|
||||
func_8002D908(&this->actor);
|
||||
|
@ -3924,10 +3924,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 = Math_FAtan2F(xDiff, zDiff) * (32768 / M_PI);
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
|
||||
// pitch
|
||||
distXZ = sqrtf(SQ(xDiff) + SQ(zDiff));
|
||||
this->actor.world.rot.x = Math_FAtan2F(yDiff, distXZ) * (32768 / M_PI);
|
||||
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, distXZ));
|
||||
this->actor.speedXZ = 20.0f;
|
||||
|
||||
for (i = 0; i < 50; i++) {
|
||||
|
@ -4114,9 +4114,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 = Math_FAtan2F(xDiff, zDiff) * (32768 / M_PI);
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
|
||||
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
|
||||
this->actor.world.rot.x = Math_FAtan2F(yDiff, xzDist) * (32768 / M_PI);
|
||||
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
|
||||
this->actor.speedXZ = 20.0f;
|
||||
for (i = 0; i < 50; i++) {
|
||||
this->blastTailPos[i] = this->actor.world.pos;
|
||||
|
@ -5383,9 +5383,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 = Math_FAtan2F(xDiff, zDiff) * (32768 / M_PI);
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
|
||||
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
|
||||
this->actor.world.rot.x = Math_FAtan2F(yDiff, xzDist) * (32768 / M_PI);
|
||||
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
|
||||
Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -10.0f);
|
||||
}
|
||||
|
||||
|
@ -5402,12 +5402,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;
|
||||
// Convert from radians to degrees, then degrees to binary angle
|
||||
yaw = (s16)(Math_FAtan2F(xDiff, zDiff) * ((180.0f / M_PI) * (65536.0f / 360.0f)));
|
||||
yaw = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
|
||||
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
|
||||
Math_ApproachS(&this->actor.world.rot.x,
|
||||
(f32)(s16)(Math_FAtan2F(yDiff, xzDist) * ((180.0f / M_PI) * (65536.0f / 360.0f))), 0xA,
|
||||
this->rotateSpeed);
|
||||
Math_ApproachS(&this->actor.world.rot.x, (f32)RADF_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);
|
||||
|
|
|
@ -1471,7 +1471,7 @@ void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* glo
|
|||
}
|
||||
|
||||
if (startPos.x != endPos.x || startPos.y != endPos.y || startPos.z != endPos.z) {
|
||||
this->jewelCsRotation.x = Math_Atan2F(endPos.z - startPos.z, -(endPos.x - startPos.x)) * (0x8000 / M_PI);
|
||||
this->jewelCsRotation.x = RADF_TO_BINANG(Math_Atan2F(endPos.z - startPos.z, -(endPos.x - startPos.x)));
|
||||
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 xzDistance = sqrtf(SQ(x) + SQ(z));
|
||||
|
||||
this->actor.shape.rot.y = Math_FAtan2F(x, z) * (32768.0f / M_PI);
|
||||
this->actor.shape.rot.x = Math_FAtan2F(-(endPos.y - startPos.y), xzDistance) * (32768.0f / M_PI);
|
||||
this->actor.shape.rot.y = RADF_TO_BINANG(Math_FAtan2F(x, z));
|
||||
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(-(endPos.y - startPos.y), xzDistance));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -550,10 +550,10 @@ void DemoGj_SetupMovement(DemoGj* this, GlobalContext* globalCtx) {
|
|||
zDistance = player->actor.world.pos.z - pos->z;
|
||||
|
||||
if (xDistance != 0.0f || zDistance != 0.0f) {
|
||||
actor->world.rot.y = (Math_FAtan2F(xDistance, zDistance) * (0x8000 / M_PI));
|
||||
actor->world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDistance, zDistance));
|
||||
}
|
||||
} else {
|
||||
actor->world.rot.y = (Math_FAtan2F(xDistance, zDistance) * (0x8000 / M_PI));
|
||||
actor->world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDistance, zDistance));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
|
|||
(this->unk_222 == 0)) {
|
||||
if (sp74 != NULL) {
|
||||
sp74 = SEGMENTED_TO_VIRTUAL(sp74);
|
||||
sp62 = Math_FAtan2F(sp74->normal.x, sp74->normal.z) * ((f32)0x8000 / M_PI);
|
||||
sp62 = RADF_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z));
|
||||
} else {
|
||||
sp62 = this->actor.world.rot.y + 0x8000;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
|
|||
&sp74, 1, 0, 0, 1);
|
||||
if (sp64 != 0) {
|
||||
sp74 = SEGMENTED_TO_VIRTUAL(sp74);
|
||||
sp60 = Math_FAtan2F(sp74->normal.x, sp74->normal.z) * ((f32)0x8000 / M_PI);
|
||||
sp60 = RADF_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z));
|
||||
if (this->unk_236 != sp60) {
|
||||
if ((s16)(this->actor.yawTowardsPlayer - sp60) >= 0) {
|
||||
this->unk_238 = 0x4000;
|
||||
|
|
|
@ -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
|
||||
// based on the Arwing's direction, and current rotation.
|
||||
worldRotationTargetY = Math_FAtan2F(vectorToTargetX, vectorToTargetZ) * (0x8000 / M_PI);
|
||||
worldRotationTargetY = RADF_TO_BINANG(Math_FAtan2F(vectorToTargetX, vectorToTargetZ));
|
||||
worldRotationTargetX =
|
||||
Math_FAtan2F(vectorToTargetY, sqrtf(SQ(vectorToTargetX) + SQ(vectorToTargetZ))) * (0x8000 / M_PI);
|
||||
RADF_TO_BINANG(Math_FAtan2F(vectorToTargetY, sqrtf(SQ(vectorToTargetX) + SQ(vectorToTargetZ))));
|
||||
if ((worldRotationTargetX < 0) && (this->actor.world.pos.y < this->actor.floorHeight + 20.0f)) {
|
||||
worldRotationTargetX = 0;
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) {
|
|||
EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint);
|
||||
xDiff = pathPos.x - this->actor.world.pos.x;
|
||||
zDiff = pathPos.z - this->actor.world.pos.z;
|
||||
walkAngle1 = Math_FAtan2F(xDiff, zDiff) * (32768.0f / M_PI);
|
||||
walkAngle1 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
|
||||
this->walkAngle = walkAngle1;
|
||||
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);
|
||||
xDiff = pathPos.x - this->actor.world.pos.x;
|
||||
zDiff = pathPos.z - this->actor.world.pos.z;
|
||||
walkAngle2 = Math_FAtan2F(xDiff, zDiff) * (32768.0f / M_PI);
|
||||
walkAngle2 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
|
||||
this->walkAngle = walkAngle2;
|
||||
this->walkDist = sqrtf((xDiff * xDiff) + (zDiff * zDiff));
|
||||
}
|
||||
|
|
|
@ -411,7 +411,7 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) {
|
|||
pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint;
|
||||
dx = pointPos->x - this->actor.world.pos.x;
|
||||
dz = pointPos->z - this->actor.world.pos.z;
|
||||
this->rotYtowardsPath = Math_FAtan2F(dx, dz) * (0x8000 / M_PI);
|
||||
this->rotYtowardsPath = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
|
||||
dxz = sqrtf(SQ(dx) + SQ(dz));
|
||||
if (dxz > 10.0f) {
|
||||
exitLoop = true;
|
||||
|
@ -499,7 +499,7 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, GlobalContext* globalCtx) {
|
|||
Matrix_MultVec3f(&D_809E4148, &vec);
|
||||
gerudoGuard =
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y,
|
||||
this->initPos.z + vec.z, 0, Math_FAtan2F(-vec.x, -vec.z) * (0x8000 / M_PI), 0, 2);
|
||||
this->initPos.z + vec.z, 0, RADF_TO_BINANG(Math_FAtan2F(-vec.x, -vec.z)), 0, 2);
|
||||
|
||||
if (gerudoGuard == NULL) {
|
||||
Actor_Kill(&this->actor);
|
||||
|
@ -526,7 +526,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) {
|
|||
pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint;
|
||||
dx = pointPos->x - this->actor.world.pos.x;
|
||||
dz = pointPos->z - this->actor.world.pos.z;
|
||||
ry = Math_FAtan2F(dx, dz) * (0x8000 / M_PI);
|
||||
ry = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
|
||||
dxz = sqrtf(SQ(dx) + SQ(dz));
|
||||
if (dxz <= 20.88f) {
|
||||
this->waypoint++;
|
||||
|
|
|
@ -364,7 +364,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) {
|
|||
pathPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->waypoint];
|
||||
xDist = pathPos->x - this->actor.world.pos.x;
|
||||
zDist = pathPos->z - this->actor.world.pos.z;
|
||||
runAngle = Math_FAtan2F(xDist, zDist) * (32768.0f / M_PI);
|
||||
runAngle = RADF_TO_BINANG(Math_FAtan2F(xDist, zDist));
|
||||
runDist = sqrtf((xDist * xDist) + (zDist * zDist));
|
||||
|
||||
run = false;
|
||||
|
|
|
@ -342,7 +342,7 @@ void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx) {
|
|||
SkelAnime_Update(&this->skelAnime);
|
||||
dx = this->flowerPos.x - this->actor.world.pos.x;
|
||||
dz = this->flowerPos.z - this->actor.world.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 1, 0xBB8, 0);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
|
||||
this->actor.world.rot.y = this->actor.shape.rot.y;
|
||||
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
|
||||
this->actor.velocity.y = 9.0f;
|
||||
|
|
|
@ -303,7 +303,7 @@ void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx) {
|
|||
SkelAnime_Update(&this->skelAnime);
|
||||
dx = 1340.0f + 3.0f - this->actor.world.pos.x;
|
||||
dz = 0.0f - this->actor.world.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 0x32, 0xBB8, 0);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 0x32, 0xBB8, 0);
|
||||
this->actor.world.rot.y = this->actor.shape.rot.y;
|
||||
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) {
|
||||
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;
|
||||
dz = -180.0f - this->actor.world.pos.z;
|
||||
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 3, 0x1388, 0);
|
||||
if (fabsf(this->actor.shape.rot.y - (s16)(Math_FAtan2F(dx, dz) * (0x8000 / M_PI))) < 20.0f) {
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_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) {
|
||||
this->actor.speedXZ = 1.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 dz = this->targetPos.z - this->actor.world.pos.z;
|
||||
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 1, 0xBB8, 0);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
|
||||
turnMod = 90.0f;
|
||||
}
|
||||
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;
|
||||
return;
|
||||
}
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 1, 0xBB8, 0);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
|
||||
this->actor.world.rot.y = this->actor.shape.rot.y;
|
||||
} else {
|
||||
if (this->timer1 == 1) {
|
||||
|
@ -668,8 +668,8 @@ void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) {
|
|||
dx = player->actor.world.pos.x - this->mouthPos.x;
|
||||
dy = player->actor.world.pos.y + 30.0f - this->mouthPos.y;
|
||||
dz = player->actor.world.pos.z - this->mouthPos.z;
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.x, -(s16)(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz))) * (0x8000 / M_PI)), 3,
|
||||
0x1388, 0);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.x, -RADF_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz)))), 3, 0x1388,
|
||||
0);
|
||||
if ((frame >= this->endFrame) && (this->timer2 == 0)) {
|
||||
this->timer2 = (s16)Rand_ZeroFloat(10.0f) + 10;
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx) {
|
|||
SkelAnime_Update(&this->skelAnime);
|
||||
sp2C = this->flowerPos.x - this->actor.world.pos.x;
|
||||
sp28 = this->flowerPos.z - this->actor.world.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(sp2C, sp28) * (0x8000 / M_PI), 1, 0xBB8, 0);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp2C, sp28)), 1, 0xBB8, 0);
|
||||
if (this->timer5 == 0) {
|
||||
this->timer5 = 10;
|
||||
} else if (!(this->timer5 & 1)) {
|
||||
|
|
|
@ -518,7 +518,7 @@ void EnFd_Land(EnFd* this, GlobalContext* globalCtx) {
|
|||
this->spinTimer = Rand_S16Offset(60, 90);
|
||||
this->runRadius = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos);
|
||||
EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir);
|
||||
this->actor.world.rot.y = Math_FAtan2F(adjPos.x, adjPos.z) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z));
|
||||
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_4);
|
||||
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);
|
||||
EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(adjPos.x, adjPos.z) * (0x8000 / M_PI), 4, 0xFA0, 1);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z)), 4, 0xFA0, 1);
|
||||
this->actor.world.rot = this->actor.shape.rot;
|
||||
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) {
|
||||
|
|
|
@ -150,9 +150,9 @@ void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
dxL = player->actor.world.pos.x - this->actor.world.pos.x;
|
||||
dyL = player->actor.world.pos.y + 30.0f - this->actor.world.pos.y;
|
||||
dzL = player->actor.world.pos.z - this->actor.world.pos.z;
|
||||
this->actor.world.rot.y = Math_FAtan2F(dxL, dzL) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxL, dzL));
|
||||
dxzL = sqrtf(SQ(dxL) + SQ(dzL));
|
||||
this->actor.world.rot.x = Math_FAtan2F(dyL, dxzL) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(dyL, dxzL));
|
||||
this->collider.dim.radius = 40;
|
||||
this->collider.dim.height = 50;
|
||||
this->collider.dim.yShift = -25;
|
||||
|
@ -516,10 +516,9 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
|
|||
this->actor.speedXZ += 1.0f;
|
||||
}
|
||||
}
|
||||
this->actor.world.rot.y = (s16)(Math_FAtan2F(dxPG, dzPG) * (0x8000 / M_PI)) + angleModY;
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxPG, dzPG)) + angleModY;
|
||||
this->actor.world.rot.x =
|
||||
(s16)(Math_FAtan2F(dyPG, sqrtf((dxPG * dxPG) + (dzPG * dzPG))) * (0x8000 / M_PI)) +
|
||||
angleModX;
|
||||
RADF_TO_BINANG(Math_FAtan2F(dyPG, sqrtf((dxPG * dxPG) + (dzPG * dzPG)))) + angleModX;
|
||||
this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_BLUE;
|
||||
this->work[FHGFIRE_FX_TIMER] = 2;
|
||||
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_REFLECT_MG, &player->actor.projectedPos, 4, &D_801333E0,
|
||||
|
@ -537,7 +536,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
|
|||
break;
|
||||
case FHGFIRE_LIGHT_BLUE:
|
||||
if ((bossGnd->flyMode == GND_FLY_RETURN) && (this->work[FHGFIRE_RETURN_COUNT] < 100)) {
|
||||
this->actor.world.rot.y = Math_FAtan2F(dxPG, dzPG) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxPG, dzPG));
|
||||
if ((sqrtf(SQ(dxPG) + SQ(dzPG)) < (150.0f + (this->actor.speedXZ * 8.0f)))) {
|
||||
this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_REFLECT;
|
||||
bossGnd->returnSuccess = true;
|
||||
|
@ -548,8 +547,8 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
|
|||
if ((sqrtf(SQ(dxPG) + SQ(dyPG) + SQ(dzPG)) < 100.0f)) {
|
||||
bossGnd->returnSuccess = true;
|
||||
}
|
||||
this->actor.world.rot.y = Math_FAtan2F(dxPG, dzPG) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.x = Math_FAtan2F(dyPG, sqrtf(SQ(dxPG) + SQ(dzPG))) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxPG, dzPG));
|
||||
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(dyPG, sqrtf(SQ(dxPG) + SQ(dzPG))));
|
||||
}
|
||||
if ((fabsf(dxPG) < 30.0f) && (fabsf(dzPG) < 30.0f) && (fabsf(dyPG) < 45.0f)) {
|
||||
killMode = BALL_IMPACT;
|
||||
|
@ -574,9 +573,9 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
|
|||
EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp88, &sp7C,
|
||||
(s16)(Rand_ZeroOne() * 40.0f) + 80, FHGFLASH_LIGHTBALL_GREEN);
|
||||
}
|
||||
this->actor.world.rot.y = Math_FAtan2F(dxL, dzL) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxL, dzL));
|
||||
dxzL = sqrtf(SQ(dxL) + SQ(dzL));
|
||||
this->actor.world.rot.x = Math_FAtan2F(dyL, dxzL) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(dyL, dxzL));
|
||||
this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_GREEN;
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_REFLECT_MG);
|
||||
this->actor.speedXZ += 2.0f;
|
||||
|
|
|
@ -210,7 +210,7 @@ void EnFr_OrientUnderwater(EnFr* this) {
|
|||
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.rot.y = this->actor.shape.rot.y =
|
||||
(s16)(sLogSpotToFromWater[this->actor.params].yaw * ((f32)0x8000 / M_PI)) + 0x8000;
|
||||
RADF_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw) + 0x8000;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->actor.velocity.y = 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) {
|
||||
if (sEnFrPointers.flags == 12) {
|
||||
this->actor.world.rot.y = ((f32)0x8000 / M_PI) * sLogSpotToFromWater[this->actor.params].yaw;
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw);
|
||||
Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f,
|
||||
Animation_GetLastFrame(&object_fr_Anim_0007BC), ANIMMODE_ONCE, 0.0f);
|
||||
this->actionFunc = EnFr_JumpingBackIntoWater;
|
||||
|
|
|
@ -296,7 +296,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
|
|||
} else {
|
||||
Vec3f sp48;
|
||||
EnFw_GetPosAdjAroundCircle(&sp48, this, this->runRadius, this->runDirection);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, (Math_FAtan2F(sp48.x, sp48.z) * (0x8000 / M_PI)), 4, 0xFA0, 1);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp48.x, sp48.z)), 4, 0xFA0, 1);
|
||||
}
|
||||
|
||||
this->actor.world.rot = this->actor.shape.rot;
|
||||
|
|
|
@ -476,7 +476,7 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) {
|
|||
pointPos += this->unk_218;
|
||||
xDist = pointPos->x - this->actor.world.pos.x;
|
||||
zDist = pointPos->z - this->actor.world.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, (s16)(Math_FAtan2F(xDist, zDist) * ((f32)0x8000 / M_PI)), 10, 1000, 1);
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(xDist, zDist)), 10, 1000, 1);
|
||||
|
||||
if ((SQ(xDist) + SQ(zDist)) < 600.0f) {
|
||||
this->unk_218++;
|
||||
|
|
|
@ -690,8 +690,8 @@ void EnGoma_SetFloorRot(EnGoma* this) {
|
|||
nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x);
|
||||
ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y);
|
||||
nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z);
|
||||
Math_ApproachS(&this->slopePitch, -Math_FAtan2F(-nz * ny, 1.0f) * (0x8000 / M_PI), 1, 1000);
|
||||
Math_ApproachS(&this->slopeRoll, Math_FAtan2F(-nx * ny, 1.0f) * (0x8000 / M_PI), 1, 1000);
|
||||
Math_ApproachS(&this->slopePitch, RADF_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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) {
|
|||
|
||||
pathDiffX = pointPos->x - this->actor.world.pos.x;
|
||||
pathDiffZ = pointPos->z - this->actor.world.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * (0x8000 / M_PI)), 3,
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 3,
|
||||
this->bodyTurnSpeed, 0);
|
||||
|
||||
Math_ApproachF(&this->bodyTurnSpeed, this->bodyTurnSpeedTarget, 1.0f, this->bodyTurnSpeedMax);
|
||||
|
|
|
@ -2936,7 +2936,7 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
floorSlope = Math_FAtan2F(this->yBack - this->yFront, 60.0f) * (0x8000 / M_PI);
|
||||
floorSlope = RADF_TO_BINANG(Math_FAtan2F(this->yBack - this->yFront, 60.0f));
|
||||
if (this->actor.floorPoly != 0) {
|
||||
nx = this->actor.floorPoly->normal.x * 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;
|
||||
}
|
||||
|
||||
*angle = Math_FAtan2F(-curStick->x, curStick->y) * (32768.0f / M_PI);
|
||||
*angle = RADF_TO_BINANG(Math_FAtan2F(-curStick->x, curStick->y));
|
||||
}
|
||||
|
||||
void EnHorse_UpdateStick(EnHorse* this, GlobalContext* globalCtx) {
|
||||
|
@ -3054,9 +3054,8 @@ void EnHorse_ResolveCollision(EnHorse* this, GlobalContext* globalCtx, Collision
|
|||
nx = COLPOLY_GET_NORMAL(colPoly->normal.x);
|
||||
ny = COLPOLY_GET_NORMAL(colPoly->normal.y);
|
||||
nz = COLPOLY_GET_NORMAL(colPoly->normal.z);
|
||||
if (!(Math_CosS(this->actor.world.rot.y -
|
||||
(s16)(Math_FAtan2F(colPoly->normal.x, colPoly->normal.z) * (0x8000 / M_PI)) - 0x7FFF) <
|
||||
0.7071f)) { // cos(45 degrees)
|
||||
if (!(Math_CosS(this->actor.world.rot.y - RADF_TO_BINANG(Math_FAtan2F(colPoly->normal.x, colPoly->normal.z)) -
|
||||
0x7FFF) < 0.7071f)) { // cos(45 degrees)
|
||||
dist = Math3D_DistPlaneToPos(nx, ny, nz, colPoly->dist, &this->actor.world.pos);
|
||||
offset = (1.0f / sqrtf(SQ(nx) + SQ(nz)));
|
||||
offset = (30.0f - dist) * offset;
|
||||
|
@ -3175,7 +3174,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) {
|
|||
if (intersectDist < 30.0f) {
|
||||
EnHorse_ResolveCollision(this, globalCtx, wall);
|
||||
}
|
||||
if ((Math_CosS(this->actor.world.rot.y - (s16)(Math_FAtan2F(wall->normal.x, wall->normal.z) * (0x8000 / M_PI)) -
|
||||
if ((Math_CosS(this->actor.world.rot.y - RADF_TO_BINANG(Math_FAtan2F(wall->normal.x, wall->normal.z)) -
|
||||
0x7FFF) < 0.5f) ||
|
||||
SurfaceType_IsHorseBlocked(&globalCtx->colCtx, wall, bgId) != 0) {
|
||||
return;
|
||||
|
|
|
@ -280,7 +280,7 @@ void func_80A68E14(EnHorseGanon* this, GlobalContext* globalCtx) {
|
|||
temp_ret = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &col, &temp1, &v);
|
||||
|
||||
this->unk_1F4 = temp_ret;
|
||||
this->actor.shape.rot.x = (0x8000 / M_PI) * Math_FAtan2F(this->actor.world.pos.y - temp_ret, 30.0f);
|
||||
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - temp_ret, 30.0f));
|
||||
}
|
||||
|
||||
void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -295,7 +295,7 @@ void EnHorseNormal_FollowPath(EnHorseNormal* this, GlobalContext* globalCtx) {
|
|||
pointPos += this->waypoint;
|
||||
dx = pointPos->x - this->actor.world.pos.x;
|
||||
dz = pointPos->z - this->actor.world.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 0xA, 0x7D0, 1);
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 0xA, 0x7D0, 1);
|
||||
this->actor.shape.rot.y = this->actor.world.rot.y;
|
||||
if (SQ(dx) + SQ(dz) < 600.0f) {
|
||||
this->waypoint++;
|
||||
|
@ -556,7 +556,7 @@ void func_80A6C8E0(EnHorseNormal* this, GlobalContext* globalCtx) {
|
|||
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;
|
||||
this->unk_220 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp38, &sp24, &sp28);
|
||||
this->actor.shape.rot.x = Math_FAtan2F(this->actor.world.pos.y - this->unk_220, 30.0f) * (0x8000 / M_PI);
|
||||
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_220, 30.0f));
|
||||
}
|
||||
|
||||
static EnHorseNormalActionFunc sActionFuncs[] = {
|
||||
|
|
|
@ -223,7 +223,7 @@ void func_80A6DE38(EnHorseZelda* this, GlobalContext* globalCtx) {
|
|||
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;
|
||||
this->unk_1F4 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &pos);
|
||||
this->actor.shape.rot.x = Math_FAtan2F(this->actor.world.pos.y - this->unk_1F4, 30.0f) * (0x8000 / M_PI);
|
||||
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_1F4, 30.0f));
|
||||
}
|
||||
|
||||
void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -694,7 +694,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
|
||||
this->actionState = ENKANBAN_AIR;
|
||||
this->actor.gravity = -1.0f;
|
||||
this->actor.world.rot.y = Math_FAtan2F(dx, dz) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
|
||||
if (this->partCount >= 4) {
|
||||
this->bounceX = (s16)Rand_ZeroFloat(10.0f) + 6;
|
||||
this->bounceZ = (s16)Rand_ZeroFloat(10.0f) + 6;
|
||||
|
|
|
@ -284,7 +284,7 @@ s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) {
|
|||
|
||||
pathDiffX = pointPos->x - this->actor.world.pos.x;
|
||||
pathDiffZ = pointPos->z - this->actor.world.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * (0x8000 / M_PI)), 0xA, 0x3E8, 1);
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 0xA, 0x3E8, 1);
|
||||
|
||||
if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f) {
|
||||
this->waypoint++;
|
||||
|
|
|
@ -117,8 +117,8 @@ void EnNb_UpdatePath(EnNb* this, GlobalContext* globalCtx) {
|
|||
this->finalPos.x = pointPos[1].x;
|
||||
this->finalPos.y = pointPos[1].y;
|
||||
this->finalPos.z = pointPos[1].z;
|
||||
this->pathYaw = (Math_FAtan2F(this->finalPos.x - this->initialPos.x, this->finalPos.z - this->initialPos.z) *
|
||||
(0x8000 / M_PI));
|
||||
this->pathYaw =
|
||||
RADF_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!!!!!!!!!!!!!!"
|
||||
osSyncPrintf("En_Nb_Get_path_info レールデータをゲットだぜ = %d!!!!!!!!!!!!!!\n", path);
|
||||
} else {
|
||||
|
|
|
@ -577,7 +577,7 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) {
|
|||
this->unk_29E = 7;
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(posY, posZ) * (0x8000 / M_PI), 3, this->unk_300, 0);
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(posY, posZ)), 3, this->unk_300, 0);
|
||||
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;
|
||||
pathDiffX = pointPos->x - this->actor.world.pos.x;
|
||||
pathDiffZ = pointPos->z - this->actor.world.pos.z;
|
||||
this->unk_2E4 = Math_FAtan2F(pathDiffX, pathDiffZ) * (0x8000 / M_PI);
|
||||
this->unk_2E4 = RADF_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ));
|
||||
func_80AB6100(this, globalCtx, 2);
|
||||
|
||||
if (fabsf(pathDiffX) < 30.0f && fabsf(pathDiffZ) < 30.0f) {
|
||||
|
@ -839,9 +839,8 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
this->actionFunc = EnNiw_ResetAction;
|
||||
} else {
|
||||
this->unk_2E4 = Math_FAtan2F(this->actor.world.pos.x - player->actor.world.pos.x,
|
||||
this->actor.world.pos.z - player->actor.world.pos.z) *
|
||||
(0x8000 / M_PI);
|
||||
this->unk_2E4 = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.x - player->actor.world.pos.x,
|
||||
this->actor.world.pos.z - player->actor.world.pos.z));
|
||||
func_80AB6100(this, globalCtx, 0);
|
||||
func_80AB5BF8(this, globalCtx, 2);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
// Change her angle so that she is always facing the cuckoo
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(xDistBetween, zDistBetween) * (0x8000 / M_PI), 3,
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(xDistBetween, zDistBetween)), 3,
|
||||
this->unk_27C, 0);
|
||||
Math_ApproachF(&this->unk_27C, 5000.0f, 30.0f, 150.0f);
|
||||
this->actor.world.rot.y = this->actor.shape.rot.y;
|
||||
|
|
|
@ -1058,7 +1058,7 @@ s32 func_80AECF6C(EnRu1* this, GlobalContext* globalCtx) {
|
|||
shapeRotY = &player->actor.shape.rot.y;
|
||||
temp1 = this->actor.world.pos.x - player->actor.world.pos.x;
|
||||
temp2 = this->actor.world.pos.z - player->actor.world.pos.z;
|
||||
temp_f16 = Math_FAtan2F(temp1, temp2) * (0x8000 / M_PI);
|
||||
temp_f16 = RADF_TO_BINANG(Math_FAtan2F(temp1, temp2));
|
||||
if (*shapeRotY != temp_f16) {
|
||||
Math_SmoothStepToS(shapeRotY, temp_f16, 0x14, 0x1838, 0x64);
|
||||
player->actor.world.rot.y = *shapeRotY;
|
||||
|
|
|
@ -142,7 +142,7 @@ void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) {
|
|||
dist2d = sqrtf(SQ(dX) + SQ(dZ));
|
||||
this->applySpeed = true;
|
||||
this->splashTimer = 0;
|
||||
angle = Math_FAtan2F(dX, dZ) * (0x8000 / M_PI);
|
||||
angle = RADF_TO_BINANG(Math_FAtan2F(dX, dZ));
|
||||
dAngle = (player->actor.world.rot.y ^ 0x8000) - angle;
|
||||
player->actor.gravity = 0.0f;
|
||||
player->actor.velocity.y = 0.0f;
|
||||
|
|
|
@ -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) {
|
||||
xzDist = sqrtf(SQ(posDifference.x) + SQ(posDifference.z));
|
||||
yDistWithOffset = player->actor.world.pos.y - (this->actor.world.pos.y - 90.0f);
|
||||
player->windDirection = Math_FAtan2F(-posDifference.x, -posDifference.z) * (0x8000 / M_PI);
|
||||
player->windDirection = RADF_TO_BINANG(Math_FAtan2F(-posDifference.x, -posDifference.z));
|
||||
if (xzDist > 3.0f) {
|
||||
Math_SmoothStepToF(&player->windSpeed, 3.0f, 0.5f, xzDist, 0.0f);
|
||||
} else {
|
||||
|
|
|
@ -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,
|
||||
false, false, true, &sp5C)) {
|
||||
this->actor.wallYaw = Math_FAtan2F(this->unk_430->normal.x, this->unk_430->normal.z) * (0x8000 / M_PI);
|
||||
this->actor.wallYaw = RADF_TO_BINANG(Math_FAtan2F(this->unk_430->normal.x, this->unk_430->normal.z));
|
||||
this->actor.world.pos = sp50;
|
||||
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);
|
||||
|
|
|
@ -328,8 +328,7 @@ void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) {
|
|||
this->unk_294 = 7;
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(tmpf1, tmpf2) * (0x8000 / M_PI), 3, this->unk_2C8.z,
|
||||
0);
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(tmpf1, tmpf2)), 3, this->unk_2C8.z, 0);
|
||||
Math_ApproachF(&this->unk_2C8.z, 10000.0f, 1.0f, 1000.0f);
|
||||
}
|
||||
|
||||
|
@ -475,9 +474,8 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y,
|
||||
(s16)(Math_FAtan2F(player->actor.world.pos.x - this->actor.world.pos.x,
|
||||
player->actor.world.pos.z - this->actor.world.pos.z) *
|
||||
(0x8000 / M_PI)) +
|
||||
RADF_TO_BINANG(Math_FAtan2F(player->actor.world.pos.x - this->actor.world.pos.x,
|
||||
player->actor.world.pos.z - this->actor.world.pos.z)) +
|
||||
phi_f16,
|
||||
5, this->unk_2C8.y, 0);
|
||||
Math_ApproachF(&this->unk_2C8.y, 3000.0f, 1.0f, 500.0f);
|
||||
|
|
|
@ -315,7 +315,7 @@ s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) {
|
|||
dx = point->x - this->actor.world.pos.x;
|
||||
dz = point->z - this->actor.world.pos.z;
|
||||
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 10, 1000, 1);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 10, 1000, 1);
|
||||
this->actor.world.rot = this->actor.shape.rot;
|
||||
|
||||
if (SQ(dx) + SQ(dz) < 10.0f) {
|
||||
|
|
|
@ -228,7 +228,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
newActor->yRotVel = 0.0f;
|
||||
xRotVel = sqrtf(SQ(spawnOffset.x) + SQ(spawnOffset.z));
|
||||
newActor->xRotVel = 0x1000 / 10.0f * xRotVel;
|
||||
newActor->actor.shape.rot.y = Math_FAtan2F(spawnOffset.x, spawnOffset.z) * ((f32)0x8000 / M_PI);
|
||||
newActor->actor.shape.rot.y = RADF_TO_BINANG(Math_FAtan2F(spawnOffset.x, spawnOffset.z));
|
||||
newActor->shadowOpacity = 200.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -754,7 +754,7 @@ void func_80B50304(EnZl2* this, GlobalContext* globalCtx) {
|
|||
this->drawConfig = 1;
|
||||
this->unk_23C = 0.0f;
|
||||
shape->shadowAlpha = 255;
|
||||
this->actor.world.rot.y = shape->rot.y = Math_FAtan2F(actionXDelta, actionZDelta) * (0x8000 / M_PI);
|
||||
this->actor.world.rot.y = shape->rot.y = RADF_TO_BINANG(Math_FAtan2F(actionXDelta, actionZDelta));
|
||||
}
|
||||
|
||||
void func_80B503DC(EnZl2* this, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -1614,7 +1614,7 @@ s32 func_80B57034(EnZl3* this, s32 arg1, s32 arg2) {
|
|||
f32 xDiff = vec2->x - vec1->x;
|
||||
f32 zDiff = vec2->z - vec1->z;
|
||||
|
||||
return ((xDiff == 0.0f) && (zDiff == 0.0f)) ? 0 : (s16)(Math_FAtan2F(xDiff, zDiff) * (0x8000 / M_PI));
|
||||
return ((xDiff == 0.0f) && (zDiff == 0.0f)) ? 0 : RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1627,7 +1627,7 @@ s16 func_80B57104(EnZl3* this, s32 arg1) {
|
|||
f32 zDiff = point->z - this->actor.world.pos.z;
|
||||
|
||||
if ((xDiff != 0.0f) || (zDiff != 0.0f)) {
|
||||
return Math_FAtan2F(xDiff, zDiff) * (0x8000 / M_PI);
|
||||
return RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -1741,7 +1741,7 @@ s32 func_80B57458(EnZl3* this, GlobalContext* globalCtx) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
temp_v0 = (s16)(temp_v1 - (s16)(Math_FAtan2F(temp_f12, temp_f13) * (0x8000 / M_PI)));
|
||||
temp_v0 = (s16)(temp_v1 - RADF_TO_BINANG(Math_FAtan2F(temp_f12, temp_f13)));
|
||||
|
||||
if (temp_v0 < 0x1555) {
|
||||
return 1;
|
||||
|
@ -1828,7 +1828,7 @@ void func_80B577BC(GlobalContext* globalCtx, Vec3f* vec) {
|
|||
f32 posZ = vec->z;
|
||||
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TEST, posX, posY, posZ, 0,
|
||||
(Math_FAtan2F(playerPos->x - posX, playerPos->z - posZ) * (0x8000 / M_PI)), 0, 5);
|
||||
RADF_TO_BINANG(Math_FAtan2F(playerPos->x - posX, playerPos->z - posZ)), 0, 5);
|
||||
}
|
||||
|
||||
void func_80B57858(GlobalContext* globalCtx) {
|
||||
|
|
Loading…
Reference in a new issue