Angle Conversions (#1216)

* Angle Conversions

* Format

* namefixer

* Renames in ObjHsStump_Appear

* Format

* once more

* Explicit cast in EnSsh

* Update src/overlays/actors/ovl_En_Fishing/z_en_fishing.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

---------

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
Derek Hensley 2023-04-18 13:34:58 -07:00 committed by GitHub
parent a67d086add
commit 823746d495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 128 additions and 112 deletions

View File

@ -114,13 +114,28 @@ typedef struct {
#define IS_ZERO(f) (fabsf(f) < 0.008f)
// Casting a float to an integer, when the float value is larger than what the integer type can hold,
// leads to undefined behavior. For example (f32)0x8000 doesn't fit in a s16, so it cannot be cast to s16.
// This isn't an issue with IDO, but is one with for example GCC.
// A partial workaround is to cast to s32 then s16, hoping all binang values used will fit a s32.
#define TRUNCF_BINANG(f) (s16)(s32)(f)
// Angle conversion macros
#define DEG_TO_BINANG(degrees) (s16)((degrees) * (0x8000 / 180.0f))
#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_TO_RAD(binang) ((f32)binang * (M_PI / 0x8000))
#define BINANG_TO_RAD_ALT(binang) (((f32)binang / 0x8000) * M_PI)
#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f))
#define DEG_TO_BINANG(degrees) TRUNCF_BINANG((degrees) * (0x8000 / 180.0f))
#define DEG_TO_BINANG_ALT(degrees) TRUNCF_BINANG(((degrees) / 180.0f) * 0x8000)
#define DEG_TO_BINANG_ALT2(degrees) TRUNCF_BINANG(((degrees) * 0x10000) / 360.0f)
#define DEG_TO_BINANG_ALT3(degrees) ((degrees) * (0x8000 / 180.0f))
#define RAD_TO_DEG(radians) ((radians) * (180.0f / M_PI))
#define RAD_TO_BINANG(radians) TRUNCF_BINANG((radians) * (0x8000 / M_PI))
#define RAD_TO_BINANG_ALT(radians) TRUNCF_BINANG(((radians) / M_PI) * 0x8000)
#define RAD_TO_BINANG_ALT2(radians) TRUNCF_BINANG(((radians) * 0x8000) / M_PI)
#define BINANG_TO_DEG(binang) ((f32)(binang) * (180.0f / 0x8000))
#define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PI / 0x8000))
#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * M_PI)
#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PI) / 0x8000)
// Angle arithmetic macros
#define BINANG_ROT180(angle) ((s16)(angle + 0x8000))

View File

@ -66,7 +66,7 @@ f32 pow_int(f32 base, s32 exp) {
* Takes an angle in radians and returns the sine.
*/
f32 sin_rad(f32 rad) {
return sins(RADF_TO_BINANG(rad)) * SHT_MINV;
return sins(RAD_TO_BINANG(rad)) * SHT_MINV;
}
// Rename to Math_CosF
@ -74,7 +74,7 @@ f32 sin_rad(f32 rad) {
* Takes an angle in radians and returns the cosine.
*/
f32 cos_rad(f32 rad) {
return coss(RADF_TO_BINANG(rad)) * SHT_MINV;
return coss(RAD_TO_BINANG(rad)) * SHT_MINV;
}
/**

View File

@ -127,7 +127,7 @@ s16 Math_Atan2S(f32 y, f32 x) {
}
f32 Math_Atan2F(f32 y, f32 x) {
return Math_Atan2S(y, x) * (M_PI / 0x8000);
return BINANG_TO_RAD(Math_Atan2S(y, x));
}
// Match the OoT implementation of Math_Atan2S

View File

@ -444,8 +444,8 @@ void Matrix_RotateXFApply(f32 x) {
if (x != 0.0f) {
cmf = sCurrentMatrix;
sin = sins(RADF_TO_BINANG(x)) * SHT_MINV;
cos = coss(RADF_TO_BINANG(x)) * SHT_MINV;
sin = sins(RAD_TO_BINANG(x)) * SHT_MINV;
cos = coss(RAD_TO_BINANG(x)) * SHT_MINV;
tempY = cmf->xy;
tempZ = cmf->xz;

View File

@ -123,14 +123,14 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) {
if ((dist == 0.0f) && (vec->y == 0.0f)) {
sph.pitch = 0;
} else {
sph.pitch = CAM_DEG_TO_BINANG(RADF_TO_DEGF(func_80086B30(dist, vec->y)));
sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(dist, vec->y)));
}
sph.r = sqrtf(SQ(vec->y) + distSquared);
if ((vec->x == 0.0f) && (vec->z == 0.0f)) {
sph.yaw = 0;
} else {
sph.yaw = CAM_DEG_TO_BINANG(RADF_TO_DEGF(func_80086B30(vec->x, vec->z)));
sph.yaw = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(vec->x, vec->z)));
}
*dest = sph;
@ -220,8 +220,8 @@ Vec3f* OLib_Vec3fDiffDegF(Vec3f* dest, Vec3f* a, Vec3f* b) {
OLib_Vec3fDiffRad(&anglesRad, a, b);
anglesDegrees.x = RADF_TO_DEGF(anglesRad.x);
anglesDegrees.y = RADF_TO_DEGF(anglesRad.y);
anglesDegrees.x = RAD_TO_DEG(anglesRad.x);
anglesDegrees.y = RAD_TO_DEG(anglesRad.y);
anglesDegrees.z = 0.0f;
*dest = anglesDegrees;
@ -238,8 +238,8 @@ Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b) {
OLib_Vec3fDiffRad(&anglesRad, a, b);
anglesBinAng.x = CAM_DEG_TO_BINANG(RADF_TO_DEGF(anglesRad.x));
anglesBinAng.y = CAM_DEG_TO_BINANG(RADF_TO_DEGF(anglesRad.y));
anglesBinAng.x = CAM_DEG_TO_BINANG(RAD_TO_DEG(anglesRad.x));
anglesBinAng.y = CAM_DEG_TO_BINANG(RAD_TO_DEG(anglesRad.y));
anglesBinAng.z = 0.0f;
*dest = anglesBinAng;

View File

@ -825,9 +825,9 @@ void Distortion_Update(void) {
screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep);
View_SetDistortionOrientation(&sDistortionRequest.play->view,
Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor),
Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor),
Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor));
Math_CosS(depthPhase) * (DEG_TO_RAD(rotX) * xyScaleFactor),
Math_SinS(depthPhase) * (DEG_TO_RAD(rotY) * xyScaleFactor),
Math_SinS(screenPlanePhase) * (DEG_TO_RAD(rotZ) * zScaleFactor));
View_SetDistortionScale(&sDistortionRequest.play->view,
(Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f,
(Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f,

View File

@ -577,7 +577,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) {
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
if (((px * actor->world.pos.x) + (pz * actor->world.pos.z) + d) > 0.0f) {
reached = true;
}
@ -1023,13 +1023,13 @@ s16 SubS_ComputeTrackPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f3
f32 step;
f32 prevRotStep;
step = (f32)(target - *rot) * (360.0f / (f32)0x10000);
step = BINANG_TO_DEG(target - *rot);
step *= gFramerateDivisorHalf;
prevRotStep = step;
if (step >= 0.0f) {
step /= slowness;
step = CLAMP(step, stepMin, stepMax);
*rot += (s16)((step * (f32)0x10000) / 360.0f);
*rot += DEG_TO_BINANG_ALT2(step);
if (prevRotStep < stepMin) {
*rot = target;
}
@ -1039,7 +1039,7 @@ s16 SubS_ComputeTrackPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f3
} else {
step = (step / slowness) * -1.0f;
step = CLAMP(step, stepMin, stepMax);
*rot -= (s16)((step * (f32)0x10000) / 360.0f);
*rot -= DEG_TO_BINANG_ALT2(step);
if (-stepMin < prevRotStep) {
*rot = target;
}

View File

@ -5,7 +5,7 @@
* Creates a rotation/parallel translation modelling matrix (floating point)
*/
void guPositionF(f32 mf[4][4], f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z) {
static f32 D_80134D00 = M_PI / 180.0;
static f32 D_80134D00 = M_PI / 180.0f;
f32 sinr, sinp, sinh;
f32 cosr, cosp, cosh;

View File

@ -408,7 +408,7 @@ void func_80A2A444(BgDblueMovebg* this, PlayState* play) {
sp20 = Math_StepToS(&this->unk_18A, 900, this->unk_188);
temp_v0 = this->unk_18A * this->unk_17E;
this->dyna.actor.shape.rot.y =
(s32)((this->unk_18C + temp_v0) * 0.1f * (0x10000 / 360.0f)) + this->dyna.actor.home.rot.y;
(s32)DEG_TO_BINANG_ALT3((this->unk_18C + temp_v0) * 0.1f) + this->dyna.actor.home.rot.y;
if ((player->stateFlags2 & PLAYER_STATE2_10) && (this->unk_184 > 0.0f)) {
player->actor.world.pos.x =
@ -495,8 +495,7 @@ void func_80A2A7F8(BgDblueMovebg* this, PlayState* play) {
sp28 = Math_StepToS(&this->unk_18A, 900, this->unk_188);
sp26 = this->unk_18A * this->unk_17E;
this->dyna.actor.shape.rot.y =
(s32)((this->unk_18C + sp26) * 0.1f * (0x10000 / 360.0f)) + this->dyna.actor.home.rot.y;
this->dyna.actor.shape.rot.y = (s32)DEG_TO_BINANG_ALT3((this->unk_18C + sp26) * 0.1f) + this->dyna.actor.home.rot.y;
if ((player->stateFlags2 & PLAYER_STATE2_10) && (this->unk_184 > 0.0f)) {
player->actor.world.pos.x =

View File

@ -2440,7 +2440,7 @@ void Boss03_DrawEffects(PlayState* play) {
Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW);
if (eff->type == GYORG_EFFECT_DROPLET) {
Matrix_RotateYF(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) * (M_PI / 0x8000), MTXMODE_APPLY);
Matrix_RotateYF(BINANG_TO_RAD(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY);
} else { // GYORG_EFFECT_SPLASH
Matrix_ReplaceRotation(&play->billboardMtxF);
}

View File

@ -572,7 +572,7 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) {
}
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY);
Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -644,7 +644,7 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) {
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY);
Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View File

@ -179,7 +179,7 @@ s32 func_80BECD10(EnAkindonuts* this, Path* path, s32 arg2) {
phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
sp50 = true;
}

View File

@ -1835,7 +1835,7 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) {
} else {
Matrix_Push();
Matrix_Translate(0.0f, 2000.0f, -2000.0f, MTXMODE_APPLY);
Matrix_RotateZS(D_80A993D0[this->unk_384].z * (0x10000 / 360.0f), MTXMODE_APPLY);
Matrix_RotateZS(DEG_TO_BINANG(D_80A993D0[this->unk_384].z), MTXMODE_APPLY);
Matrix_Scale(D_80A993AC[this->unk_384].x, D_80A993AC[this->unk_384].y, 0.0f, MTXMODE_APPLY);
if (this->unk_374 & 0x800) {
gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_PrimColor(play->state.gfxCtx, 0x80, 255, 255, 255, 255));
@ -1846,7 +1846,7 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) {
gSPDisplayList(POLY_XLU_DISP++, gBeaverYoungerBrotherTailVortexDL);
Matrix_Pop();
Matrix_Translate(0.0f, 2000.0f, -2100.0f, MTXMODE_APPLY);
Matrix_RotateZS(D_80A993D0[this->unk_384].z * (0x10000 / 360.0f), MTXMODE_APPLY);
Matrix_RotateZS(DEG_TO_BINANG(D_80A993D0[this->unk_384].z), MTXMODE_APPLY);
Matrix_Scale(D_80A993D0[this->unk_384].x, D_80A993D0[this->unk_384].y, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gBeaverYoungerBrotherTailSplashDL);

View File

@ -269,7 +269,7 @@ void EnBombal_DrawEffects(EnBombal* this, PlayState* play) {
gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY);
Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, &gSunSparkleModelDL);

View File

@ -410,9 +410,9 @@ void EnBubble_Draw(Actor* thisx, PlayState* play) {
Math_SmoothStepToF(&this->modelEllipticity, 0.08f, 0.2f, 1000.0f, 0.0f);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(this->modelWidth + 1.0f, this->modelHeight + 1.0f, 1.0f, MTXMODE_APPLY);
Matrix_RotateZF(DEGF_TO_RADF((f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY);
Matrix_RotateZF(DEG_TO_RAD((f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY);
Matrix_Scale(this->modelEllipticity + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
Matrix_RotateZF(DEGF_TO_RADF(-(f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY);
Matrix_RotateZF(DEG_TO_RAD(-(f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gBubbleDL);

View File

@ -281,7 +281,7 @@ s32 EnDg_HasReachedPoint(EnDg* this, Path* path, s32 pointIndex) {
diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z;
}
func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
@ -310,7 +310,7 @@ s16 EnDg_GetYRotation(Path* path, s32 index, Vec3f* pos, f32* distSq) {
*distSq = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
/**

View File

@ -767,8 +767,8 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) {
* rotToNorm.x = func_80086B30(nz, ny) * 0x8000 / M_PI;
* rotToNorm.z = func_80086B30(-nx, sqrtf(1.0f - SQ(nx))) * 0x8000 / M_PI;
*/
rotToNorm.x = -func_80086B30(-nz * ny, 1.0f) * 0x8000 / M_PI;
rotToNorm.z = func_80086B30(-nx * ny, 1.0f) * 0x8000 / M_PI;
rotToNorm.x = RAD_TO_BINANG_ALT2(-func_80086B30(-nz * ny, 1.0f));
rotToNorm.z = RAD_TO_BINANG_ALT2(func_80086B30(-nx * ny, 1.0f));
if ((this->actor.world.pos.y - 50.0f) <= player->actor.world.pos.y) {
EnEgol_SpawnEffect(this, &hitPos, &rotToNorm, 100, 0.02f, EYEGORE_EFFECT_IMPACT);

View File

@ -284,7 +284,7 @@ void EnEncount2_DrawEffects(EnEncount2* this, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY);
Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL);
}

View File

@ -195,9 +195,9 @@ void EnEstone_Draw(Actor* thisx, PlayState* play2) {
OPEN_DISPS(play->state.gfxCtx);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Matrix_RotateXFApply(this->rot.x * (M_PI / 180.0f));
Matrix_RotateYF(this->rot.y * (M_PI / 180.0f), MTXMODE_APPLY);
Matrix_RotateZF(this->rot.z * (M_PI / 180.0f), MTXMODE_APPLY);
Matrix_RotateXFApply(DEG_TO_RAD(this->rot.x));
Matrix_RotateYF(DEG_TO_RAD(this->rot.y), MTXMODE_APPLY);
Matrix_RotateZF(DEG_TO_RAD(this->rot.z), MTXMODE_APPLY);
Matrix_Scale(this->scale, this->scale, this->scale, MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255);

View File

@ -1325,9 +1325,9 @@ void EnFishing_DrawEffects(FishingEffect* effect, PlayState* play) {
effect = firstEffect;
if (effect->type == FS_EFF_OWNER_HAT) {
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_RotateYF((sEffOwnerHatRot.y * M_PI) / 32768, MTXMODE_APPLY);
Matrix_RotateXFApply((sEffOwnerHatRot.x * M_PI) / 32768);
Matrix_RotateZF((sEffOwnerHatRot.z * M_PI) / 32768, MTXMODE_APPLY);
Matrix_RotateYF(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.y), MTXMODE_APPLY);
Matrix_RotateXFApply(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.x));
Matrix_RotateZF(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.z), MTXMODE_APPLY);
Matrix_Scale(effect->unk_30, effect->unk_30, effect->unk_30, MTXMODE_APPLY);
Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateXFApply(M_PI / 2);
@ -1659,7 +1659,7 @@ void EnFishing_UpdateSinkingLure(PlayState* play) {
}
if (D_8090CD14 == 5) {
Matrix_RotateYF(player->actor.shape.rot.y * (M_PI / 32768), MTXMODE_NEW);
Matrix_RotateYF(BINANG_TO_RAD(player->actor.shape.rot.y), MTXMODE_NEW);
sp94.x = 5.0f;
sp94.y = 0.0f;
sp94.z = 3.0f;
@ -1772,7 +1772,7 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot)
sLurePos = sFishingHookedFish->fishMouthPos;
if ((D_8090CD14 == 5) && (D_80917206 == 2)) {
Matrix_RotateYF(player->actor.shape.rot.y * (M_PI / 32768), MTXMODE_NEW);
Matrix_RotateYF(BINANG_TO_RAD(player->actor.shape.rot.y), MTXMODE_NEW);
posSrc.x = 2.0f;
posSrc.y = 0.0f;
posSrc.z = 0.0f;
@ -2457,9 +2457,9 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
}
Math_ApproachZeroF(&D_809101B4, 1.0f, 0.3f);
Math_ApproachS(&D_809101B8, (D_809101B0 * 32768.0f) / M_PI, 3, spDC);
Math_ApproachS(&D_809101B8, RAD_TO_BINANG_ALT2(D_809101B0), 3, spDC);
sLureRot.y = (D_809101B8 / 32768.0f) * M_PI;
sLureRot.y = BINANG_TO_RAD_ALT(D_809101B8);
sp90.x = 0.0f;
sp90.y = 0.0f;
@ -2715,7 +2715,7 @@ void func_809038A4(EnFishing* this, Input* input) {
sp24 = SQ(sp34.x) + SQ(sp34.y) + SQ(sp34.z);
if ((D_8090CD14 == 3) && (this->unk_19A == 0) && (D_8090CD0C == 0)) {
Matrix_RotateYF((-this->actor.shape.rot.y / 32768.0f) * M_PI, MTXMODE_NEW);
Matrix_RotateYF(BINANG_TO_RAD_ALT(-this->actor.shape.rot.y), MTXMODE_NEW);
Matrix_MultVec3f(&sp34, &sp28);
if ((sp28.z > 0.0f) || (this->unk_1A4 < 40.0f)) {
@ -3600,8 +3600,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
for (spA2 = 0; spA2 < 100; spA2++) {
Matrix_RotateYF(randPlusMinusPoint5Scaled(2.3561945f) +
(((this->actor.yawTowardsPlayer + 0x8000) / 32768.0f) * M_PI),
Matrix_RotateYF(randPlusMinusPoint5Scaled(0.75f * M_PI) +
BINANG_TO_RAD_ALT(this->actor.yawTowardsPlayer + 0x8000),
MTXMODE_NEW);
Matrix_MultVec3f(&sp10C, &sp100);
@ -3805,7 +3805,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
sp10C.y = 10.0f;
sp10C.z = 50.0f;
}
Matrix_RotateYF((player->actor.shape.rot.y / 32768.0f) * M_PI, MTXMODE_NEW);
Matrix_RotateYF(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW);
Matrix_MultVec3f(&sp10C, &sSubCamEye);
sSubCamEye.x += player->actor.world.pos.x;
@ -4228,20 +4228,20 @@ void EnFishing_DrawFish(Actor* thisx, PlayState* play) {
func_8012C28C(play->state.gfxCtx);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Matrix_RotateYF(((this->unk_15A + this->actor.shape.rot.y) / 32768.0f) * M_PI, MTXMODE_APPLY);
Matrix_RotateXFApply(((this->unk_158 + this->actor.shape.rot.x) / 32768.0f) * M_PI);
Matrix_RotateZF(((this->unk_15C + this->actor.shape.rot.z) / 32768.0f) * M_PI, MTXMODE_APPLY);
Matrix_RotateYF(BINANG_TO_RAD_ALT(this->unk_15A + this->actor.shape.rot.y), MTXMODE_APPLY);
Matrix_RotateXFApply(BINANG_TO_RAD_ALT(this->unk_158 + this->actor.shape.rot.x));
Matrix_RotateZF(BINANG_TO_RAD_ALT(this->unk_15C + this->actor.shape.rot.z), MTXMODE_APPLY);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
if (this->unk_148 == 0) {
Matrix_RotateYF((this->unk_164 * (M_PI / 32768)) - (M_PI / 2), MTXMODE_APPLY);
Matrix_RotateYF(BINANG_TO_RAD(this->unk_164) - (M_PI / 2), MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, this->unk_164 * 10.0f * 0.01f, MTXMODE_APPLY);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnFishing_FishOverrideLimbDraw, EnFishing_FishPostLimbDraw, &this->actor);
} else {
Matrix_Translate(0.0f, 0.0f, 3000.0f, MTXMODE_APPLY);
Matrix_RotateYF(this->unk_164 * (M_PI / 32768), MTXMODE_APPLY);
Matrix_RotateYF(BINANG_TO_RAD(this->unk_164), MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, -3000.0f, MTXMODE_APPLY);
Matrix_RotateYF(-(M_PI / 2), MTXMODE_APPLY);
@ -4411,7 +4411,7 @@ void EnFishing_DrawPondProps(PlayState* play) {
if (prop->shouldDraw) {
Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW);
Matrix_Scale(prop->scale, 1.0f, prop->scale, MTXMODE_APPLY);
Matrix_RotateYF(prop->lilyPadAngle * (M_PI / 32768), MTXMODE_APPLY);
Matrix_RotateYF(BINANG_TO_RAD(prop->lilyPadAngle), MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, 20.0f, MTXMODE_APPLY);
Matrix_RotateYF(prop->rotY, MTXMODE_APPLY);
@ -4663,8 +4663,8 @@ void EnFishing_DrawGroupFishes(PlayState* play) {
if (fish->shouldDraw) {
Matrix_Translate(fish->pos.x, fish->pos.y, fish->pos.z, MTXMODE_NEW);
Matrix_RotateYF(((f32)fish->unk_3E * M_PI) / 32768.0f, MTXMODE_APPLY);
Matrix_RotateXFApply((-(f32)fish->unk_3C * M_PI) / 32768.0f);
Matrix_RotateYF(BINANG_TO_RAD_ALT2(fish->unk_3E), MTXMODE_APPLY);
Matrix_RotateXFApply(BINANG_TO_RAD_ALT2(-(f32)fish->unk_3C));
Matrix_Scale(fish->unk_2C * scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),

View File

@ -310,7 +310,7 @@ s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_) {
phi_f14 = points[arg2 + 1].z - points[arg2 - 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;

View File

@ -374,7 +374,7 @@ s32 func_80B50C78(EnGk* this, Path* path, s32 arg2_) {
phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;

View File

@ -349,8 +349,8 @@ f32 func_80998334(EnGs* this, PlayState* play, f32* arg2, f32* arg3, s16* arg4,
if (arg9 == 0) {
sp2C = Math_SmoothStepToF(arg2, *arg3, arg5, arg6, arg7);
this->unk_1B0[0].x = (sinf(DEGF_TO_RADF((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2) + 1.0f;
this->unk_1B0[0].y = 1.0f - (sinf(DEGF_TO_RADF((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2);
this->unk_1B0[0].x = (sinf(DEG_TO_RAD((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2) + 1.0f;
this->unk_1B0[0].y = 1.0f - (sinf(DEG_TO_RAD((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2);
(*arg4)++;
}
return sp2C;
@ -648,7 +648,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) {
if (this->unk_19D == 1) {
Math_SmoothStepToF(&this->unk_1E4, this->unk_1E8, 1.0f, 0.1f, 0.001f);
sp48 = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 1.0f, this->unk_1E4, 0.001f);
this->unk_19E[0].y += (s32)(this->unk_1DC * (0x10000 / 360.0f));
this->unk_19E[0].y += (s32)DEG_TO_BINANG_ALT3(this->unk_1DC);
if (sp48 == 0.0f) {
this->unk_1D4 = 0;
this->unk_19D = 2;
@ -656,7 +656,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) {
}
if (this->unk_19D == 2) {
this->unk_19E[0].y += (s32)(this->unk_1DC * (0x10000 / 360.0f));
this->unk_19E[0].y += (s32)DEG_TO_BINANG_ALT3(this->unk_1DC);
if (this->unk_1D4++ > 40) {
this->unk_1DC = this->unk_1B0[0].y - 1.0f;
this->unk_1E0 = 1.5f;
@ -725,8 +725,8 @@ s32 func_80998F9C(EnGs* this, PlayState* play) {
sp40 = Math_SmoothStepToF(&this->unk_1EC, this->unk_1F0, 0.8f, 0.02f, 0.001f);
this->unk_1B0[0].x = this->unk_1E4 + 1.0f;
this->unk_1B0[0].y = this->unk_1DC + 1.0f;
this->unk_1B0[0].x += sinf(DEGF_TO_RADF((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC;
this->unk_1B0[0].y += sinf(DEGF_TO_RADF((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC;
this->unk_1B0[0].x += sinf(DEG_TO_RAD((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC;
this->unk_1B0[0].y += sinf(DEG_TO_RAD((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC;
this->unk_1D4++;
if ((sp48 == 0.0f) && (sp44 == 0.0f) && (sp40 == 0.0f)) {
this->unk_216 = 0;

View File

@ -215,7 +215,7 @@ s16 EnJg_GetWalkingYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ
*distSQ = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) {
@ -242,7 +242,7 @@ s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) {
diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z;
}
func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;

View File

@ -1005,7 +1005,7 @@ void func_80B2F37C(Actor* thisx, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 170, 255, this->unk_197);
gDPSetEnvColor(POLY_XLU_DISP++, this->unk_194, this->unk_195, this->unk_196, 255);
Matrix_RotateYF((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * (M_PI / 32768), MTXMODE_APPLY);
Matrix_RotateYF(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, object_po_DL_003850);

View File

@ -288,7 +288,7 @@ s16 EnRacedog_GetYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ)
}
*distSQ = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Atan2F_XY(diffZRand, diffXRand));
return RAD_TO_BINANG(Math_Atan2F_XY(diffZRand, diffXRand));
}
void EnRacedog_GetFloorRot(EnRacedog* this, Vec3f* floorRot) {

View File

@ -331,7 +331,7 @@ void EnRat_ChooseDirection(EnRat* this) {
}
angle = CLAMP(angle, -0x800, 0x800);
Matrix_RotateAxisF(angle * (M_PI / 0x8000), &this->axisUp, MTXMODE_NEW);
Matrix_RotateAxisF(BINANG_TO_RAD(angle), &this->axisUp, MTXMODE_NEW);
Matrix_MultVec3f(&this->axisForwards, &newAxisForwards);
Math_Vec3f_Copy(&this->axisForwards, &newAxisForwards);
Math3D_CrossProduct(&this->axisUp, &this->axisForwards, &this->axisLeft);

View File

@ -163,7 +163,7 @@ s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIn
}
}
func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
@ -198,7 +198,7 @@ s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32
}
}
func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}

View File

@ -192,7 +192,7 @@ s32 func_80BCD334(EnScopecrow* this, Path* path, s32 pointIndex) {
phi_fa1 = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x);
if (((this->actor.world.pos.x * sp3C.z) + (sp3C.y * this->actor.world.pos.z) + sp3C.x) > 0.0f) {
ret = true;

View File

@ -654,7 +654,7 @@ s32 func_80BCC2AC(EnScopenuts* this, Path* path, s32 arg2_) {
phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
sp50 = true;

View File

@ -916,7 +916,7 @@ s32 func_80ADCE4C(EnSellnuts* this, Path* path, s32 arg2) {
pointY = points[var + 1].z - points[var - 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(pointX, pointY)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(pointX, pointY)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
}

View File

@ -1286,7 +1286,7 @@ s16 EnSob1_GetDistSqAndOrient(Path* path, s32 pointIndex, Vec3f* pos, f32* distS
diffZ = 0.0f;
}
*distSq = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
void EnSob1_GetCutscenes(EnSob1* this) {

View File

@ -419,7 +419,7 @@ void EnSsh_Sway(EnSsh* this) {
}
temp_f20 = (this->swayTimer * (1.0f / 6));
swayAngle = Math_SinS(this->swayAngle) * (temp_f20 * (0x10000 / 360.0f));
swayAngle = (f32)DEG_TO_BINANG_ALT3(temp_f20) * Math_SinS(this->swayAngle);
temp_f20 = this->actor.world.pos.y - this->ceilingPos.y;
swayVecBase.x = Math_SinS(swayAngle) * temp_f20;
@ -428,7 +428,7 @@ void EnSsh_Sway(EnSsh* this) {
Matrix_Push();
Matrix_Translate(this->ceilingPos.x, this->ceilingPos.y, this->ceilingPos.z, MTXMODE_NEW);
Matrix_RotateYF(this->actor.world.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
Matrix_RotateYF(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_APPLY);
Matrix_MultVec3f(&swayVecBase, &swayVec);
Matrix_Pop();

View File

@ -563,7 +563,7 @@ s16 EnSuttari_GetDistSqAndOrient(Path* path, s32 index, Vec3f* pos, f32* distSq)
}
*distSq = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
s32 func_80BAB758(EnSuttari* this, Path* path, s32 arg2) {
@ -589,7 +589,7 @@ s32 func_80BAB758(EnSuttari* this, Path* path, s32 arg2) {
sp54 = sp5C[index + 1].x - sp5C[index - 1].x;
sp48 = sp5C[index + 1].z - sp5C[index - 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C);
if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
}
@ -619,7 +619,7 @@ s32 func_80BAB8F4(EnSuttari* this, Path* path, s32 arg2) {
sp54 = sp5C[index - 1].x - sp5C[index + 1].x;
sp48 = sp5C[index - 1].z - sp5C[index + 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C);
if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
}

View File

@ -592,7 +592,7 @@ s32 func_80AD475C(EnTrt2* this, Path* path, s32 arg2) {
phi_f14 = points[arg + 1].z - points[arg - 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
@ -615,7 +615,7 @@ s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3) {
phi_f12 = 0.0f;
}
*arg3 = SQ(phi_f14) + SQ(phi_f12);
return RADF_TO_BINANG(Math_Atan2F_XY(phi_f12, phi_f14));
return RAD_TO_BINANG(Math_Atan2F_XY(phi_f12, phi_f14));
}
f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {

View File

@ -301,7 +301,7 @@ s32 func_80B76600(EnTruMt* this, Path* path, s32 arg2) {
phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z;
}
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
sp50 = true;
}

View File

@ -208,10 +208,9 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) {
// why are we getting player home rotation from the room data? doesnt player have home.rot.y?
// especially because we are converting from deg to binang, but isnt home.rot.y already in binang??
Play_SetRespawnData(
&play->state, 0, entrance, play->setupEntranceList[playerSpawnIndex].room, playerParams,
&newRespawnPos,
((((playerActorEntry->rot.y >> 7) & 0x1FF) / 180.0f) * 32768.0f)); // DEG_TO_BINANG ?
Play_SetRespawnData(&play->state, 0, entrance, play->setupEntranceList[playerSpawnIndex].room,
playerParams, &newRespawnPos,
DEG_TO_BINANG_ALT((playerActorEntry->rot.y >> 7) & 0x1FF));
func_80169EFC(&play->state);
gSaveContext.respawnFlag = -5;

View File

@ -119,7 +119,7 @@ u32 func_80BB9A1C(ObjChan* this, f32 arg1) {
sp20 = Math_SinS(this->unk1D4) * this->unk1D0;
temp_f6 = (Math_CosS(this->unk1D4) * 0.03834952f * this->unk1D0) + arg1;
if (temp_f6 != 0.0f) {
this->unk1D4 = RADF_TO_BINANG(func_80086B30(sp20 * 0.03834952f, temp_f6));
this->unk1D4 = RAD_TO_BINANG(func_80086B30(sp20 * 0.03834952f, temp_f6));
} else if (sp20 >= 0.0f) {
this->unk1D4 = 0x4000;
} else {
@ -175,7 +175,7 @@ void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) {
for (i = 0; i < 5; i++) {
ObjChan_CalculatePotPosition(&childPos, &childRot, &this->actor.world.pos, &this->actor.shape.rot,
(s32)(i * 360.0f / 5.0f * (65536.0f / 360.0f)) + this->rotation);
(s32)DEG_TO_BINANG_ALT3(i * 360.0f / 5.0f) + this->rotation);
temp_v0 = (ObjChan*)Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_OBJ_CHAN, childPos.x, childPos.y,
childPos.z, childRot.x, childRot.y, childRot.z,
(this->actor.params & 0xFFF) | 0x1000, this->actor.cutscene,
@ -251,7 +251,7 @@ void ObjChan_ChandelierAction(ObjChan* this2, PlayState* play) {
temp = this->pots[i];
if (temp != NULL) {
ObjChan_CalculatePotPosition(&sp60, &sp58, &this->actor.world.pos, &this->actor.shape.rot,
(s32)(i * 360.0f / 5.0f * (65536.0f / 360.0f)) + this->rotation);
(s32)DEG_TO_BINANG_ALT3(i * 360.0f / 5.0f) + this->rotation);
Math_Vec3f_Copy(&temp->actor.world.pos, &sp60);
Math_Vec3s_Copy(&temp->actor.shape.rot, &this->actor.shape.rot);
temp->actor.shape.rot.y = this->rotation;

View File

@ -288,7 +288,7 @@ void ObjDora_UpdateCollision(ObjDora* this, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR);
itemDrop = Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_BLUE);
itemDrop->world.rot.y = this->actor.world.rot.y;
itemDrop->world.rot.y += (s32)(Rand_Centered() * 90.0f * (0x10000 / 360.0f));
itemDrop->world.rot.y += (s32)DEG_TO_BINANG_ALT3(Rand_Centered() * 90.0f);
itemDrop->velocity.y = 5.0f;
itemDrop->gravity = -1.0f;
this->rupeeDropTimer = 40;

View File

@ -89,14 +89,14 @@ void ObjHsStump_Appear(ObjHsStump* this, PlayState* play) {
}
if (this->framesAppeared <= 10) {
if (this->framesAppeared == 0) {
s32 pad;
s32 i;
f32 angleDeg;
s16 numDirections = 4;
Vec3f iceSmokePosOffset;
Vec3f iceSmokeVelOffset;
s16 offsetAngle;
s16 iceSmokeAngle;
Vec3f iceSmokeVel;
f32 angleBrad;
f32 baseAngle;
Vec3f iceSmokePos;
iceSmokePosOffset.x = 1.0f;
@ -107,14 +107,13 @@ void ObjHsStump_Appear(ObjHsStump* this, PlayState* play) {
iceSmokeVelOffset.y = 0.5f;
iceSmokeVelOffset.z = 0.0f;
angleDeg = (360.0f / numDirections);
angleBrad = (s32)(angleDeg * (0x10000 / 360.0f));
baseAngle = (s32)DEG_TO_BINANG_ALT3(360.0f / numDirections);
for (i = 0; i < numDirections; i++) {
offsetAngle = i * angleBrad;
Lib_Vec3f_TranslateAndRotateY(&this->dyna.actor.world.pos, offsetAngle, &iceSmokePosOffset,
iceSmokeAngle = i * baseAngle;
Lib_Vec3f_TranslateAndRotateY(&this->dyna.actor.world.pos, iceSmokeAngle, &iceSmokePosOffset,
&iceSmokePos);
Lib_Vec3f_TranslateAndRotateY(&gZeroVec3f, offsetAngle, &iceSmokeVelOffset, &iceSmokeVel);
Lib_Vec3f_TranslateAndRotateY(&gZeroVec3f, iceSmokeAngle, &iceSmokeVelOffset, &iceSmokeVel);
EffectSsIceSmoke_Spawn(play, &iceSmokePos, &iceSmokeVel, &sIceSmokeAccel, 100);
}
}
@ -123,7 +122,7 @@ void ObjHsStump_Appear(ObjHsStump* this, PlayState* play) {
Math_SmoothStepToF(&this->dyna.actor.scale.x, 18.0f * 0.01f, 1.0f, 0.01f, 0.001f);
Actor_SetScale(&this->dyna.actor, this->dyna.actor.scale.x);
}
if (this->dyna.actor.scale.x == 18.0f * 0.01f) {
if (this->dyna.actor.scale.x == (18.0f * 0.01f)) {
this->isHidden = false;
func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId);
ObjHsStump_SetupIdle(this, play);

View File

@ -179,11 +179,11 @@ void ObjWarpstone_Draw(Actor* thisx, PlayState* play2) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 200, this->dyna.actor.home.rot.x);
gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 255);
Matrix_RotateZF((((play->gameplayFrames * 1500) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY);
Matrix_RotateZF(BINANG_TO_RAD_ALT2((play->gameplayFrames * 1500) & 0xFFFF), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL);
Matrix_Pop();
Matrix_RotateZF((~((play->gameplayFrames * 1200) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY);
Matrix_RotateZF(BINANG_TO_RAD_ALT2(~((play->gameplayFrames * 1200) & 0xFFFF)), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL);
CLOSE_DISPS(play->state.gfxCtx);

View File

@ -107,7 +107,7 @@ void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this) {
temp2 = Math_SinS(yawDiff);
dist = Math_Vec3f_DistXZ(&scale, &this->vec) / (this->rReg10 * 0.1f);
Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, MTXMODE_APPLY);
Matrix_RotateZF(DEGF_TO_RADF(temp2 * this->rReg2 * dist), MTXMODE_APPLY);
Matrix_RotateZF(DEG_TO_RAD(temp2 * this->rReg2 * dist), MTXMODE_APPLY);
temp2 = 1.0f - ((f32)(this->life + 1) / this->rLifespan);
temp2 = 1.0f - SQ(temp2);
scale.x = scale.y = scale.z = temp2 * (this->rScale * (0.001f * 0.01f));

View File

@ -60,7 +60,7 @@ void EffectSsSolderSrchBall_Draw(PlayState* play, u32 index, EffectSs* this) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, 255);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZF(DEGF_TO_RADF(20.0f * play->state.frames), MTXMODE_APPLY);
Matrix_RotateZF(DEG_TO_RAD(20.0f * play->state.frames), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL);

View File

@ -874,6 +874,10 @@ wordReplace = {
"ICHAIN_F32_DIV1000(minVelocityY,": "ICHAIN_F32_DIV1000(terminalVelocity,",
"ICHAIN_F32(minVelocityY,": "ICHAIN_F32(terminalVelocity,",
"RADF_TO_BINANG": "RAD_TO_BINANG",
"RADF_TO_DEGF": "RAD_TO_DEG",
"DEGF_TO_RADF": "DEG_TO_RAD",
"ACTORCTX_FLAG_2": "ACTORCTX_FLAG_PICTO_BOX_ON",
"ACTOR_FLAG_100": "ACTOR_FLAG_TALK_REQUESTED",