math header

This commit is contained in:
Derek Hensley
2024-05-21 18:06:36 -07:00
parent 88868ee2f2
commit e2b4b1bbd1
57 changed files with 237 additions and 236 deletions
+5 -4
View File
@@ -1,10 +1,11 @@
#ifndef LIBC_MATH_H
#define LIBC_MATH_H
#define M_PI 3.14159265358979323846f
#define M_SQRT2 1.41421356237309504880f
#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
#define FLT_MAX 340282346638528859811704183484516925440.0f
#define F_PI 3.14159265358979323846f
#define F_SQRT2 1.41421356237309504880f
#define F_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
#define FLT_MAX 3.40282347e+38f
#define SHT_MAX 32767.0f
#define SHT_MINV (1.0f / SHT_MAX)
+8 -8
View File
@@ -168,21 +168,21 @@ typedef union {
#define TRUNCF_BINANG(f) (s16)(s32)(f)
// Angle conversion macros
#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f))
#define DEG_TO_RAD(degrees) ((degrees) * (F_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 RAD_TO_DEG(radians) ((radians) * (180.0f / F_PI))
#define RAD_TO_BINANG(radians) TRUNCF_BINANG((radians) * (0x8000 / F_PI))
#define RAD_TO_BINANG_ALT(radians) TRUNCF_BINANG(((radians) / F_PI) * 0x8000)
#define RAD_TO_BINANG_ALT2(radians) TRUNCF_BINANG(((radians) * 0x8000) / F_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)
#define BINANG_TO_RAD(binang) ((f32)(binang) * (F_PI / 0x8000))
#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * F_PI)
#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * F_PI) / 0x8000)
// Angle arithmetic macros
#define BINANG_ROT180(angle) ((s16)(angle + 0x8000))
+11 -11
View File
@@ -91,14 +91,14 @@ f32 Math_FAtanTaylorF(f32 x) {
return qNaN0x10000;
}
if (t <= M_SQRT2 - 1.0f) {
if (t <= F_SQRT2 - 1.0f) {
return Math_FAtanTaylorQF(x);
}
if (t >= M_SQRT2 + 1.0f) {
q = M_PI / 2 - Math_FAtanTaylorQF(1.0f / t);
if (t >= F_SQRT2 + 1.0f) {
q = F_PI / 2 - Math_FAtanTaylorQF(1.0f / t);
} else { // in the interval (\sqrt{2} - 1, \sqrt{2} + 1)
q = M_PI / 4 - Math_FAtanTaylorQF((1.0f - t) / (1.0f + t));
q = F_PI / 4 - Math_FAtanTaylorQF((1.0f - t) / (1.0f + t));
}
if (x > 0.0f) {
@@ -145,9 +145,9 @@ f32 Math_FAtanContFracF(f32 x) {
if (sector == 0) {
return conv;
} else if (sector > 0) {
return M_PI / 2 - conv;
return F_PI / 2 - conv;
} else {
return -M_PI / 2 - conv;
return -F_PI / 2 - conv;
}
}
@@ -171,18 +171,18 @@ f32 Math_FAtan2F(f32 y, f32 x) {
if (y == 0.0f) {
return 0.0f;
} else if (y > 0.0f) {
return M_PI / 2;
return F_PI / 2;
} else if (y < 0.0f) {
return -M_PI / 2;
return -F_PI / 2;
} else {
return qNaN0x10000;
}
} else if (x >= 0.0f) {
return Math_FAtanF(y / x);
} else if (y < 0.0f) {
return Math_FAtanF(y / x) - M_PI;
return Math_FAtanF(y / x) - F_PI;
} else {
return M_PI - Math_FAtanF(-(y / x));
return F_PI - Math_FAtanF(-(y / x));
}
}
@@ -191,5 +191,5 @@ f32 Math_FAsinF(f32 x) {
}
f32 Math_FAcosF(f32 x) {
return M_PI / 2 - Math_FAsinF(x);
return F_PI / 2 - Math_FAsinF(x);
}
+9 -9
View File
@@ -4064,7 +4064,7 @@ void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type) {
if ((i % 2) != 0) {
rotZStep = 2.0f * entry->chainAngle;
} else {
rotZStep = M_PI - (2.0f * entry->chainAngle);
rotZStep = F_PI - (2.0f * entry->chainAngle);
}
chainRotZ += rotZStep;
@@ -4902,11 +4902,11 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[]
Matrix_Scale(frozenScale, frozenScale, frozenScale, MTXMODE_APPLY);
if (bodyPartIndex & 1) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
}
if (bodyPartIndex & 2) {
Matrix_RotateZF(M_PI, MTXMODE_APPLY);
Matrix_RotateZF(F_PI, MTXMODE_APPLY);
}
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
@@ -4984,7 +4984,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[]
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0,
((bodyPartIndex * 10 + gameplayFrames) * -20) & 0x1FF, 32, 128));
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
currentMatrix->mf[3][0] = bodyPartsPos->x;
currentMatrix->mf[3][1] = bodyPartsPos->y;
currentMatrix->mf[3][2] = bodyPartsPos->z;
@@ -5026,7 +5026,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[]
// Apply and draw a light orb over each body part of frozen actor
for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) {
Matrix_RotateZF(Rand_CenteredFloat(2 * M_PI), MTXMODE_APPLY);
Matrix_RotateZF(Rand_CenteredFloat(2 * F_PI), MTXMODE_APPLY);
currentMatrix->mf[3][0] = bodyPartsPos->x;
currentMatrix->mf[3][1] = bodyPartsPos->y;
currentMatrix->mf[3][2] = bodyPartsPos->z;
@@ -5065,8 +5065,8 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[]
// Every body part draws two electric sparks at random orientations
for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) {
// first electric spark
Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI));
Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
Matrix_RotateXFApply(Rand_ZeroFloat(2 * F_PI));
Matrix_RotateZF(Rand_ZeroFloat(2 * F_PI), MTXMODE_APPLY);
currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->x;
currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->y;
currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->z;
@@ -5077,8 +5077,8 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[]
gSPDisplayList(POLY_XLU_DISP++, gElectricSparkModelDL);
// second electric spark
Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI));
Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
Matrix_RotateXFApply(Rand_ZeroFloat(2 * F_PI));
Matrix_RotateZF(Rand_ZeroFloat(2 * F_PI), MTXMODE_APPLY);
currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->x;
currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->y;
currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->z;
+4 -4
View File
@@ -1536,9 +1536,9 @@ s32 Camera_CalcAtForFriendlyLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targ
deltaY = focalActorPosRot->pos.y - *yPosOffset;
temp_f0_6 = Math_FAtan2F(deltaY, OLib_Vec3fDistXZ(at, &camera->eye));
if (temp_f0_6 > 0.34906584f) { // (M_PI / 9)
if (temp_f0_6 > 0.34906584f) { // (F_PI / 9)
phi_f16 = 1.0f - Math_SinF(temp_f0_6 - 0.34906584f);
} else if (temp_f0_6 < -0.17453292f) { // (M_PI / 18)
} else if (temp_f0_6 < -0.17453292f) { // (F_PI / 18)
phi_f16 = 1.0f - Math_SinF(-0.17453292f - temp_f0_6);
} else {
phi_f16 = 1.0f;
@@ -1616,9 +1616,9 @@ s32 Camera_CalcAtForEnemyLockOn(Camera* camera, VecGeo* arg1, Vec3f* arg2, f32 y
focalActorAtOffsetTarget.y -= deltaY;
} else {
if (temp_f0_3 > 0.34906584f) { // (M_PI / 9)
if (temp_f0_3 > 0.34906584f) { // (F_PI / 9)
temp = 1.0f - Math_SinF(temp_f0_3 - 0.34906584f);
} else if (temp_f0_3 < -0.17453292f) { // (M_PI / 18)
} else if (temp_f0_3 < -0.17453292f) { // (F_PI / 18)
temp = 1.0f - Math_SinF(-0.17453292f - temp_f0_3);
} else {
temp = 1.0f;
+2 -2
View File
@@ -1812,9 +1812,9 @@ void Player_AdjustSingleLeg(PlayState* play, Player* player, SkelAnime* skelAnim
temp_f20 = (temp_f20 < 0.0f) ? 0.0f : sqrtf(temp_f20);
sp48 = Math_FAtan2F(temp_f20, sp58);
phi_t1 = (M_PI - (Math_FAtan2F(sp54, temp_f20) + ((M_PI / 2.0f) - sp48))) * (0x8000 / M_PI);
phi_t1 = (F_PI - (Math_FAtan2F(sp54, temp_f20) + ((F_PI / 2.0f) - sp48))) * (0x8000 / F_PI);
phi_t1 = -skelAnime->jointTable[shinLimbIndex].z + phi_t1;
temp_f8 = (sp48 - sp4C) * (0x8000 / M_PI);
temp_f8 = (sp48 - sp4C) * (0x8000 / F_PI);
if ((s16)(ABS_ALT(skelAnime->jointTable[shinLimbIndex].x) + ABS_ALT(skelAnime->jointTable[shinLimbIndex].y)) <
0) {
+1 -1
View File
@@ -14,7 +14,7 @@ static const du P[] = {
{ 0.000002605780637968037 },
};
static const du rpi = { 1 / 3.14159265358979323846 }; // 1/M_PI, "reciprocal of pi"
static const du rpi = { 1 / 3.14159265358979323846 }; // 1/F_PI, "reciprocal of pi"
// pihi + pilo is the closest double to pi, this representation allows more precise calculations since pi itself is not
// an exact float
+1 -1
View File
@@ -6,7 +6,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.0f;
static f32 D_80134D00 = F_PI / 180.0f;
f32 sinr;
f32 sinp;
f32 sinh;
+1 -1
View File
@@ -2,7 +2,7 @@
#include "libc/math.h"
void guRotateF(float m[4][4], float a, float x, float y, float z) {
static float dtor = M_PI / 180.0f;
static float dtor = F_PI / 180.0f;
float sine;
float cosine;
float ab;
+1 -1
View File
@@ -14,7 +14,7 @@ static const du P[] = {
{ 0.000002605780637968037 },
};
static const du rpi = { 1 / 3.14159265358979323846 }; // 1/M_PI, "reciprocal of pi"
static const du rpi = { 1 / 3.14159265358979323846 }; // 1/F_PI, "reciprocal of pi"
// pihi + pilo is the closest double to pi, this representation allows more precise calculations since pi itself is not
// an exact float
@@ -65,10 +65,10 @@ void func_808D75F0(BgF40Flift* this, PlayState* play) {
this->timer--;
if (this->dyna.actor.params == 1) {
this->dyna.actor.world.pos.y =
(Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f) + this->dyna.actor.home.pos.y;
(Math_SinF(this->timer * (F_PI / 24.0f)) * 5.0f) + this->dyna.actor.home.pos.y;
} else {
this->dyna.actor.world.pos.y =
(Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f) + (926.8f + this->dyna.actor.home.pos.y);
(Math_SinF(this->timer * (F_PI / 24.0f)) * 5.0f) + (926.8f + this->dyna.actor.home.pos.y);
}
}
}
@@ -77,7 +77,7 @@ void func_808D7714(BgF40Flift* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
this->dyna.actor.world.pos.y =
(((Math_CosF(this->timer * (M_PI / 96.0f)) * this->dyna.actor.params) + 1.0f) * 463.4f) +
(((Math_CosF(this->timer * (F_PI / 96.0f)) * this->dyna.actor.params) + 1.0f) * 463.4f) +
this->dyna.actor.home.pos.y;
} else {
this->dyna.actor.params = -this->dyna.actor.params;
@@ -105,7 +105,7 @@ void BgF40Swlift_Update(Actor* thisx, PlayState* play2) {
}
this->timer--;
this->dyna.actor.world.pos.y =
sHeights[this->dyna.actor.params] + (Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f);
sHeights[this->dyna.actor.params] + (Math_SinF(this->timer * (F_PI / 24.0f)) * 5.0f);
}
}
@@ -127,7 +127,7 @@ void func_80AC4C34(BgIcefloe* this, PlayState* play) {
func_80AC4CF0(this);
} else {
this->dyna.actor.world.pos.y =
(Math_SinF(this->timer * (M_PI / 30.0f)) * 3.0f) + (this->dyna.actor.home.pos.y + 10.0f);
(Math_SinF(this->timer * (F_PI / 30.0f)) * 3.0f) + (this->dyna.actor.home.pos.y + 10.0f);
}
}
@@ -55,7 +55,7 @@ void func_80AD6830(BgLotus* this) {
f32 temp_fv1;
if (this->dyna.actor.params == 0) {
temp_fv1 = Math_SinF(this->unk166 * (M_PI / 4)) * ((0.014f * (this->unk166 / (80.0f * 0.1f))) + 0.01f);
temp_fv1 = Math_SinF(this->unk166 * (F_PI / 4)) * ((0.014f * (this->unk166 / (80.0f * 0.1f))) + 0.01f);
this->dyna.actor.scale.x = (1.0f + temp_fv1) * 0.1f;
this->dyna.actor.scale.z = (1.0f - temp_fv1) * 0.1f;
}
@@ -65,7 +65,7 @@ void func_80AD68DC(BgLotus* this, PlayState* play) {
f32 sp34;
this->unk168--;
sp34 = Math_SinF(this->unk168 * (M_PI / 48)) * 6.0f;
sp34 = Math_SinF(this->unk168 * (F_PI / 48)) * 6.0f;
if (this->dyna.actor.params == 0) {
this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.actor.world.rot.y) * sp34) + this->dyna.actor.home.pos.x;
@@ -324,7 +324,7 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) {
}
this->dyna.actor.world.pos.y =
(Math_SinF(this->unk_162 * (M_PI / 6)) * this->unk_164) + this->dyna.actor.home.pos.y;
(Math_SinF(this->unk_162 * (F_PI / 6)) * this->unk_164) + this->dyna.actor.home.pos.y;
Math_ApproachZeroF(&this->unk_164, 1.0f, 0.8f);
if (this->unk_162 == 4) {
+8 -8
View File
@@ -205,7 +205,7 @@ static Vec3f sFallingBlockSfxPos = { 0.0f, 1000.0f, 0.0f };
/**
* Odolwa's sword trail is a circular arc, and this variable is used to determine the angular range of this arc (and
* thus the total size of the trail). The trail consists of 10 segments in an arc, and the angle of each of those
* segments is M_PI / sSwordTrailAngularRangeDivisor; in other words, as this variable decreases, Odolwa's sword trail
* segments is F_PI / sSwordTrailAngularRangeDivisor; in other words, as this variable decreases, Odolwa's sword trail
* covers a larger angular range, and as it increaes, the sword trail covers a smaller angular range.
*/
static f32 sSwordTrailAngularRangeDivisor = 10.0f;
@@ -1723,7 +1723,7 @@ void Boss01_VerticalSlash(Boss01* this, PlayState* play) {
sOdolwaSwordTrailPosY = 90.0f;
sOdolwaSwordTrailPosZ = -70.0f;
sOdolwaSwordTrailRotX = 0.4712388f;
sOdolwaSwordTrailRotY = M_PI;
sOdolwaSwordTrailRotY = F_PI;
sOdolwaSwordTrailRotZ = 1.7278761f;
if (Animation_OnFrame(&this->skelAnime, 12.0f)) {
@@ -2614,13 +2614,13 @@ void Boss01_DrawSwordTrail(Boss01* this, PlayState* play) {
vtx = Lib_SegmentedToVirtual(&gOdolwaSwordTrailVtx);
for (i = 0; i < ARRAY_COUNT(sSwordTrailOuterVertexIndices); i++) {
vtx[sSwordTrailOuterVertexIndices[i]].v.ob[0] = cosf((i * M_PI) / sSwordTrailAngularRangeDivisor) * 200.0f;
vtx[sSwordTrailOuterVertexIndices[i]].v.ob[0] = cosf((i * F_PI) / sSwordTrailAngularRangeDivisor) * 200.0f;
vtx[sSwordTrailOuterVertexIndices[i]].v.ob[1] = 0;
vtx[sSwordTrailOuterVertexIndices[i]].v.ob[2] = sinf((i * M_PI) / sSwordTrailAngularRangeDivisor) * 200.0f;
vtx[sSwordTrailOuterVertexIndices[i]].v.ob[2] = sinf((i * F_PI) / sSwordTrailAngularRangeDivisor) * 200.0f;
vtx[sSwordTrailInnerVertexIndices[i]].v.ob[0] = cosf((i * M_PI) / sSwordTrailAngularRangeDivisor) * 100.0f;
vtx[sSwordTrailInnerVertexIndices[i]].v.ob[0] = cosf((i * F_PI) / sSwordTrailAngularRangeDivisor) * 100.0f;
vtx[sSwordTrailInnerVertexIndices[i]].v.ob[1] = 0;
vtx[sSwordTrailInnerVertexIndices[i]].v.ob[2] = sinf((i * M_PI) / sSwordTrailAngularRangeDivisor) * 100.0f;
vtx[sSwordTrailInnerVertexIndices[i]].v.ob[2] = sinf((i * F_PI) / sSwordTrailAngularRangeDivisor) * 100.0f;
}
gSPSegment(
@@ -3571,11 +3571,11 @@ void Boss01_DrawEffects(PlayState* play) {
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 64, 1, 0,
((effect->timer + (i * 10)) * -20) & 0x1FF, 32, 128));
Matrix_RotateYF(i * (M_PI / 16.0f), MTXMODE_APPLY);
Matrix_RotateYF(i * (F_PI / 16.0f), MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, KREG(49) + 200.0f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
if (Boss01_RandZeroOne() < 0.5f) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
}
Matrix_Scale(KREG(48) * 0.0001f + 0.018f,
+7 -7
View File
@@ -1030,7 +1030,7 @@ void func_809DAB78(Boss02* this, PlayState* play) {
Math_Vec3f_Copy(&this->unk_01BC[i], &this->actor.world.pos);
this->unk_0B1C[i].y += this->unk_0164;
Math_ApproachF(&this->unk_0B1C[i].x, -(M_PI / 2), 0.1f, 0.07f);
Math_ApproachF(&this->unk_0B1C[i].x, -(F_PI / 2), 0.1f, 0.07f);
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, UPDBGCHECKINFO_FLAG_4);
@@ -1057,13 +1057,13 @@ void func_809DAB78(Boss02* this, PlayState* play) {
case 23:
i = (this->unk_014E + 196) % ARRAY_COUNT(this->unk_01BC);
Math_Vec3f_Copy(&this->unk_01BC[i], &this->actor.world.pos);
Math_ApproachF(&this->unk_0B1C[i].x, -(M_PI / 2), 0.05f, 0.07f);
Math_ApproachF(&this->unk_0B1C[i].x, -(F_PI / 2), 0.05f, 0.07f);
if (this->unk_0146[0] & 1) {
sp9C = Rand_ZeroFloat(M_PI);
sp9C = Rand_ZeroFloat(F_PI);
for (i = 0; i < 15; i++) {
Matrix_RotateYF(((2.0f * (i * M_PI)) / 15.0f) + sp9C, MTXMODE_NEW);
Matrix_RotateYF(((2.0f * (i * F_PI)) / 15.0f) + sp9C, MTXMODE_NEW);
Matrix_MultVecZ((10 - this->unk_0146[0]) * (sGiantModeScaleFactor * 300.0f) * 0.1f, &sp90);
spD0.x = this->unk_0170.x + sp90.x;
spD0.y = this->unk_0170.y + (1000.0f * sGiantModeScaleFactor);
@@ -1404,7 +1404,7 @@ void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play2) {
sp98 = 3100.0f;
}
sp9C = this->unk_0152 * (M_PI / 4) * (1.0f / 15);
sp9C = this->unk_0152 * (F_PI / 4) * (1.0f / 15);
if (this->unk_0144 < 20) {
spAC = Math_SinS(this->unk_014C * 0x2200) * sp9C * 0.5f;
spA8 = Math_CosS(this->unk_014C * 0x3200) * sp9C;
@@ -1450,8 +1450,8 @@ void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play2) {
Matrix_RotateXFApply(spA4 - this->unk_0B1C[phi_v0].x);
Matrix_RotateZF(this->unk_0B1C[phi_v0].z, MTXMODE_APPLY);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYF(M_PI / 2, MTXMODE_APPLY);
Matrix_RotateXFApply(-(M_PI / 2));
Matrix_RotateYF(F_PI / 2, MTXMODE_APPLY);
Matrix_RotateXFApply(-(F_PI / 2));
Matrix_ToMtx(mtx);
gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+10 -10
View File
@@ -161,7 +161,7 @@ void Boss03_SpawnEffectDroplet(PlayState* play, Vec3f* pos) {
eff->accel.y = -2.0f;
eff->unk_34.x = 0.1f;
eff->unk_34.y = 0.0f;
eff->unk_34.z = Rand_ZeroFloat(2 * M_PI);
eff->unk_34.z = Rand_ZeroFloat(2 * F_PI);
eff->unk_02 = Rand_ZeroFloat(100.0f);
eff->velocity.x = Rand_CenteredFloat(25.0f);
eff->velocity.z = Rand_CenteredFloat(25.0f);
@@ -187,7 +187,7 @@ void Boss03_SpawnEffectSplash(PlayState* play, Vec3f* pos, Vec3f* velocity) {
temp_f2 = Rand_ZeroFloat(0.02f) + 0.02f;
eff->unk_34.y = temp_f2;
eff->unk_34.x = temp_f2;
eff->unk_34.z = Rand_ZeroFloat(2 * M_PI);
eff->unk_34.z = Rand_ZeroFloat(2 * F_PI);
eff->unk_02 = Rand_ZeroFloat(100.0f);
return;
}
@@ -489,7 +489,7 @@ void Boss03_Init(Actor* thisx, PlayState* play2) {
f32 rand;
rand = Boss03_RandZeroOne();
Matrix_RotateYF((rand * M_PI * 0.2f) + ((2.0f * M_PI / 5.0f) * i), MTXMODE_NEW);
Matrix_RotateYF((rand * F_PI * 0.2f) + ((2.0f * F_PI / 5.0f) * i), MTXMODE_NEW);
rand = Boss03_RandZeroOne();
Matrix_MultVecZ((rand * 800.0f) + 400.0f, &sp70);
@@ -584,7 +584,7 @@ void func_809E34B8(Boss03* this, PlayState* play) {
Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100);
Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (F_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
if ((this->workTimer[WORK_TIMER_UNK2_A] == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) {
Matrix_MultVecZ(-500.0f, &this->unk_268);
@@ -672,7 +672,7 @@ void Boss03_ChasePlayer(Boss03* this, PlayState* play) {
Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100);
Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (F_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
Actor_MoveWithoutGravityReverse(&this->actor);
Math_ApproachS(&this->actor.shape.rot.x, this->actor.world.rot.x, 2, this->unk_274 * 2);
@@ -769,7 +769,7 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) {
5, 0x100);
Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100);
Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (F_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
Actor_MoveWithoutGravityReverse(&this->actor);
Math_ApproachS(&this->actor.shape.rot.x, this->actor.world.rot.x, 2, this->unk_274 * 2);
Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, this->unk_274 * 2);
@@ -873,7 +873,7 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) {
-0.5f,
5, 0x100);
Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (F_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
switch (this->unk_242) {
case 0:
@@ -1037,7 +1037,7 @@ void Boss03_Charge(Boss03* this, PlayState* play) {
this->actor.shape.rot = this->actor.world.rot;
Math_ApproachF(&this->actor.speed, 25.0f, 1.0f, 3.0f);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (F_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
Actor_MoveWithoutGravityReverse(&this->actor);
if (this->actor.speed >= 20.0f) {
@@ -2140,7 +2140,7 @@ void Boss03_Update(Actor* thisx, PlayState* play2) {
i++;
}
yRot += ((2.0f * M_PI) / 50.0f);
yRot += ((2.0f * F_PI) / 50.0f);
if (j >= 50) {
break;
}
@@ -2360,7 +2360,7 @@ void Boss03_UpdateEffects(PlayState* play) {
eff->alphaDelta = Rand_ZeroFloat(4.0f) + 5.0f;
for (j = 0; j < 4; j++) {
Matrix_RotateYF((2.0f * (j * M_PI)) / 6.0f, MTXMODE_NEW);
Matrix_RotateYF((2.0f * (j * F_PI)) / 6.0f, MTXMODE_NEW);
sp94.x = 0.0f;
sp94.y = Rand_ZeroFloat(4.0f) + 2.0f;
sp94.z = Rand_ZeroFloat(1.5f) + 1.5f;
+4 -4
View File
@@ -465,10 +465,10 @@ void Boss06_Update(Actor* thisx, PlayState* play) {
temp_f22 = (((sinf(phi_f24) * this->unk_1D4) + 1.0f) * ((sinf(phi_f26) * this->unk_1D0) + this->unk_1D0)) +
this->unk_1CC;
phi_f26 += (M_PI / 64);
phi_f26 += (F_PI / 64);
phi_f24 += 0.030679617f;
Matrix_RotateZF(i * (M_PI / 512), MTXMODE_NEW);
Matrix_RotateZF(i * (F_PI / 512), MTXMODE_NEW);
Matrix_MultVecY(temp_f22, &sp7C);
sp7C.x += 32.0f + this->unk_1BC;
@@ -612,10 +612,10 @@ void Boss06_Draw(Actor* thisx, PlayState* play2) {
Matrix_Translate((D_809F4370[i].x - 32.0f) * -2.4f, (D_809F4370[i].y - 32.0f) * -2.4f, 0.0f,
MTXMODE_APPLY);
Matrix_RotateZF(i * (M_PI / 64), MTXMODE_APPLY);
Matrix_RotateZF(i * (F_PI / 64), MTXMODE_APPLY);
if (func_809F2140() < 0.5f) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
}
Matrix_Scale(-0.02f / 10.0f, -this->unk_1D8, 1.0f, MTXMODE_APPLY);
@@ -684,7 +684,7 @@ void BossHakugin_StepVector(Vec3f* norm, Vec3f* targetNorm, f32 angleStep) {
maxAngle = 0.0f;
} else {
// Either the dot product is exactly -1.0f, or a non-unit vector was passed into this function.
maxAngle = M_PI;
maxAngle = F_PI;
}
angleStep = CLAMP_MAX(angleStep, maxAngle);
@@ -2390,7 +2390,7 @@ void BossHakugin_DeathCutsceneRun(BossHakugin* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.home.rot.y, this->baseRotY, 5, 0x800, 0x100);
this->timer--;
this->actor.shape.rot.y =
(s32)(Math_SinF(this->timer * (M_PI / 18.0f)) * this->runOffsetRot) + this->actor.home.rot.y;
(s32)(Math_SinF(this->timer * (F_PI / 18.0f)) * this->runOffsetRot) + this->actor.home.rot.y;
if (this->timer == 0) {
if (this->runOffsetRot > 0) {
@@ -2403,10 +2403,10 @@ void BossHakugin_DeathCutsceneRun(BossHakugin* this, PlayState* play) {
this->deathCutsceneRandomHeadRot = Rand_ZeroFloat(6144.0f);
}
this->headRot.z = (8192.0f * Math_SinS(this->deathCutsceneRandomHeadRot)) * Math_SinF(this->timer * (M_PI / 9));
this->headRot.y = (8192.0f * Math_CosS(this->deathCutsceneRandomHeadRot)) * Math_SinF(this->timer * (M_PI / 9));
this->headRot.z = (8192.0f * Math_SinS(this->deathCutsceneRandomHeadRot)) * Math_SinF(this->timer * (F_PI / 9));
this->headRot.y = (8192.0f * Math_CosS(this->deathCutsceneRandomHeadRot)) * Math_SinF(this->timer * (F_PI / 9));
this->actor.shape.rot.z = Math_SinF(this->timer * (M_PI / 18)) * -(this->runOffsetRot * 0.3f);
this->actor.shape.rot.z = Math_SinF(this->timer * (F_PI / 18)) * -(this->runOffsetRot * 0.3f);
this->actor.world.rot.y = this->actor.shape.rot.y;
subCamAt.x = (Math_SinS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.x;
@@ -2909,7 +2909,7 @@ void BossHakugin_UpdateElectricBalls(BossHakugin* this, PlayState* play) {
} else if (this->electricBallState == GOHT_ELECTRIC_BALL_STATE_FLY_TOWARDS_PLAYER) {
angleStep =
BINANG_TO_RAD(Math3D_Vec3fDistSq(firstBallPos, &player->actor.world.pos) * (1.0f / SQ(120.0f)) * 32.0f);
angleStep = CLAMP_MAX(angleStep, M_PI / 4.0f);
angleStep = CLAMP_MAX(angleStep, F_PI / 4.0f);
Math_Vec3f_Diff(&player->actor.world.pos, firstBallPos, &targetRot);
@@ -97,7 +97,7 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, PlayState* play) {
this->effects[i].scale = 0.1f;
// speedClock is angles in radians,
// should have used Rand_ZeroOne() * 2 * M_PI
// should have used Rand_ZeroOne() * 2 * F_PI
// however, due to properties of sine waves, this is effectively still random
this->effects[i].speedClock.x = Rand_ZeroOne() * 360.0f;
this->effects[i].speedClock.y = Rand_ZeroOne() * 360.0f;
@@ -335,7 +335,7 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, PlayState* play) {
this->effects[i].scale = 0.2f;
// speedClock is angles in radians,
// should have used Rand_ZeroOne() * 2 * M_PI
// should have used Rand_ZeroOne() * 2 * F_PI
// however, due to properties of sine waves, this is effectively still random
this->effects[i].speedClock.x = Rand_ZeroOne() * 360.0f;
this->effects[i].speedClock.y = Rand_ZeroOne() * 360.0f;
+1 -1
View File
@@ -150,7 +150,7 @@ void func_80A1F9AC(DmHina* this, PlayState* play) {
this->actor.world.pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(this->unk14C * 20.0f, this->unk14C * 20.0f, this->unk14C * 20.0f, MTXMODE_APPLY);
Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
Matrix_RotateZF(Rand_ZeroFloat(2 * F_PI), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gLightOrbModelDL);
@@ -708,10 +708,10 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) {
Math_Vec3f_Yaw(&play->view.eye, &this->slidingDoor.dyna.actor.world.pos);
if (ABS_ALT(yaw) < 0x4000) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
}
} else if (this->slidingDoor.dyna.actor.room == transitionEntry->sides[0].room) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
}
} else if (this->doorType == 5) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_808A22DC[this->slidingDoor.unk_15E]));
@@ -604,7 +604,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec
MTXMODE_APPLY);
}
} else if (this->actionFunc == EnBigokuta_SuckInPlayer) {
f32 sin = Math_SinF(this->timer * (M_PI / 3.0f)) * 0.5f;
f32 sin = Math_SinF(this->timer * (F_PI / 3.0f)) * 0.5f;
Matrix_Scale(((this->timer * (2 / 90.0f)) * (0.5f + sin)) + 1.0f,
((this->timer * (2 / 90.0f)) * (0.5f - sin)) + 1.0f, 1.0f - ((this->timer * 0.3f) / 9.0f),
@@ -613,7 +613,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec
if (this->timer == 0) {
Matrix_Scale(0.9f, 0.9f, 1.15f, MTXMODE_APPLY);
} else if (this->timer > 0) {
f32 sin = Math_SinF(this->timer * (M_PI / 3.0f)) * 0.5f;
f32 sin = Math_SinF(this->timer * (F_PI / 3.0f)) * 0.5f;
Matrix_Scale(((0.5f + sin) * 0.2f) + 1.0f, ((0.5f - sin) * 0.2f) + 1.0f, 0.7f, MTXMODE_APPLY);
} else {
@@ -562,7 +562,7 @@ void EnBigpo_IdleFlying(EnBigpo* this, PlayState* play) {
// flight position calculations
this->hoverHeightCycleTimer = (this->hoverHeightCycleTimer == 0) ? 40 : (this->hoverHeightCycleTimer - 1);
Math_StepToF(&this->savedHeight, player->actor.world.pos.y + 100.0f, 1.5f);
this->actor.world.pos.y = (Math_SinF(this->hoverHeightCycleTimer * (M_PI / 20)) * 10.0f) + this->savedHeight;
this->actor.world.pos.y = (Math_SinF(this->hoverHeightCycleTimer * (F_PI / 20)) * 10.0f) + this->savedHeight;
Math_StepToF(&this->actor.speed, 3.0f, 0.2f);
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG);
if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) {
@@ -834,7 +834,7 @@ void EnBigpo_ScoopSoulIdle(EnBigpo* this, PlayState* play) {
EnBigpo_SetupScoopSoulLeaving(this);
} else {
Actor_OfferGetItem(&this->actor, play, GI_MAX, 35.0f, 60.0f);
this->actor.world.pos.y = (Math_SinF(this->idleTimer * (M_PI / 20)) * 5.0f) + this->savedHeight;
this->actor.world.pos.y = (Math_SinF(this->idleTimer * (F_PI / 20)) * 5.0f) + this->savedHeight;
}
}
@@ -658,7 +658,7 @@ void EnBigslime_AddWavySurface(EnBigslime* this) {
randFloat = (Rand_ZeroOne() * 40.0f) + 50.0f;
}
this->vtxSurfacePerturbation[i] = Math_SinF((randInt + i) * (M_PI / 3)) * randFloat * 0.001f;
this->vtxSurfacePerturbation[i] = Math_SinF((randInt + i) * (F_PI / 3)) * randFloat * 0.001f;
}
}
@@ -674,7 +674,7 @@ void EnBigslime_UpdateWavySurface(EnBigslime* this) {
}
this->wavySurfaceTimer--;
vtxSurfaceWave = Math_SinF(this->wavySurfaceTimer * (M_PI / 12));
vtxSurfaceWave = Math_SinF(this->wavySurfaceTimer * (F_PI / 12));
for (i = 0; i < BIGSLIME_NUM_VTX; i++) {
staticVtx = &sBigslimeStaticVtx[i];
dynamicVtx = &sBigslimeDynamicVtx[this->dynamicVtxState][i];
@@ -1170,7 +1170,7 @@ void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this) {
s32 j;
for (i = 0; i < BIGSLIME_NUM_RING_FACES / 2; i++) {
vtxY = (((Math_CosF(i * (M_PI / 6)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F;
vtxY = (((Math_CosF(i * (F_PI / 6)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F;
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@@ -1189,7 +1189,7 @@ void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this) {
}
for (; i < BIGSLIME_NUM_RING_VTX; i++) {
vtxY = ((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 16)) * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F;
vtxY = ((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (F_PI / 16)) * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F;
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@@ -1302,7 +1302,7 @@ void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this) {
sBigslimeTargetVtx[0].n.ob[2] = 0;
for (i = 1; i < BIGSLIME_NUM_RING_FACES / 2; i++) {
upperSphereCos = (((Math_CosF((i - 1) * (M_PI / 5)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F;
upperSphereCos = (((Math_CosF((i - 1) * (F_PI / 5)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F;
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@@ -1319,7 +1319,7 @@ void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this) {
}
for (; i < BIGSLIME_NUM_RING_FACES; i++) {
lowerSphereCos = Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / BIGSLIME_NUM_RING_FACES));
lowerSphereCos = Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (F_PI / BIGSLIME_NUM_RING_FACES));
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@@ -1362,7 +1362,7 @@ void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this) {
sBigslimeTargetVtx[0].n.ob[2] = 0;
for (i = 1; i < BIGSLIME_NUM_RING_FACES / 2; i++) {
upperSphereCos = Math_CosF((i - 1) * (M_PI / 10));
upperSphereCos = Math_CosF((i - 1) * (F_PI / 10));
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@@ -1375,7 +1375,7 @@ void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this) {
for (; i < BIGSLIME_NUM_RING_FACES; i++) {
lowerSphereCos =
(((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 5)) + 1) * 0.925f) + -1.0f) * BIGSLIME_RADIUS_F;
(((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (F_PI / 5)) + 1) * 0.925f) + -1.0f) * BIGSLIME_RADIUS_F;
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@@ -1646,7 +1646,7 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, PlayState* play) {
* This unit vector has the following spherical coordinates:
* - radius = 1
* - yaw (azimuthal angle) = this->actor.world.rot.y
* - pitch (polar/zenith angle) = M_PI / 4
* - pitch (polar/zenith angle) = F_PI / 4
*
* This unit normal vector is converted into x-y-z coordinates and dot-producted with
* the model coordinates of each individual vertex. The surface perturbation is then
@@ -1657,15 +1657,15 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, PlayState* play) {
void EnBigslime_SetupWindupThrowPlayer(EnBigslime* this) {
Vtx* dynamicVtx;
f32 dotXYZ;
f32 unitVecX = Math_SinS(this->actor.world.rot.y) * M_SQRT1_2;
f32 unitVecZ = Math_CosS(this->actor.world.rot.y) * M_SQRT1_2;
f32 unitVecX = Math_SinS(this->actor.world.rot.y) * F_SQRT1_2;
f32 unitVecZ = Math_CosS(this->actor.world.rot.y) * F_SQRT1_2;
s32 i;
for (i = 0; i < BIGSLIME_NUM_VTX; i++) {
dynamicVtx = &sBigslimeDynamicVtx[this->dynamicVtxState][i];
// vector dot product between each dynamicVtx and the unit normal vector describing player's thrown direction
dotXYZ = (dynamicVtx->n.ob[0] * unitVecX + dynamicVtx->n.ob[1] * M_SQRT1_2 + dynamicVtx->n.ob[2] * unitVecZ) *
dotXYZ = (dynamicVtx->n.ob[0] * unitVecX + dynamicVtx->n.ob[1] * F_SQRT1_2 + dynamicVtx->n.ob[2] * unitVecZ) *
0.001f;
if (dotXYZ < 0.01f) {
this->vtxSurfacePerturbation[i] = 0.0f;
@@ -1693,7 +1693,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) {
EnBigslime_UpdateCameraGrabPlayer(this, play);
if (this->windupPunchTimer > 0) {
invWindupPunchTimer = 1.0f / this->windupPunchTimer;
scale = Math_CosF(this->windupPunchTimer * (M_PI / 27)) + 1.0f;
scale = Math_CosF(this->windupPunchTimer * (F_PI / 27)) + 1.0f;
player->actor.world.pos.y = this->actor.world.pos.y + (this->actor.scale.y * -500.0f);
// Linearly interpolate gekkoRot.y --> this->actor.world.rot.y
@@ -1706,7 +1706,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) {
EnBigslime_GekkoSfxInsideBigslime(this, NA_SE_EN_FROG_PUNCH1);
}
scale = 0.5f - Math_CosF(-this->windupPunchTimer * (M_PI / 5)) * 0.5f;
scale = 0.5f - Math_CosF(-this->windupPunchTimer * (F_PI / 5)) * 0.5f;
if (this->windupPunchTimer == -5) {
if (player->stateFlags2 & PLAYER_STATE2_80) {
player->actor.parent = NULL;
@@ -2467,7 +2467,7 @@ void EnBigslime_FrogSpawn(EnBigslime* this, PlayState* play) {
// Zoom the camera in and out at the newly spawned red frog
subCamZoom =
Math_SinF(this->spawnFrogTimer * (M_PI / 5)) * ((0.04f * (this->spawnFrogTimer * 0.1f)) + 0.02f) + 1.0f;
Math_SinF(this->spawnFrogTimer * (F_PI / 5)) * ((0.04f * (this->spawnFrogTimer * 0.1f)) + 0.02f) + 1.0f;
subCamEye.x = subCam->at.x + (this->subCamDistToFrog.x * subCamZoom);
subCamEye.z = subCam->at.z + (this->subCamDistToFrog.z * subCamZoom);
subCamEye.y = subCam->at.y + (this->subCamDistToFrog.y * subCamZoom);
+2 -2
View File
@@ -386,10 +386,10 @@ void EnBom_Explode(EnBom* this, PlayState* play) {
}
if ((this->timer & 1) == 0) {
spCC = Rand_ZeroFloat(M_PI);
spCC = Rand_ZeroFloat(F_PI);
for (i = 0; i < 15; i++) {
Matrix_RotateYF(((2.0f * (i * M_PI)) / 15.0f) + spCC, MTXMODE_NEW);
Matrix_RotateYF(((2.0f * (i * F_PI)) / 15.0f) + spCC, MTXMODE_NEW);
Matrix_MultVecZ((10 - this->timer) * 300.0f * 0.1f, &spC0);
spB4.x = this->actor.world.pos.x + spC0.x;
spB4.y = this->actor.world.pos.y + 500.0f;
@@ -131,8 +131,8 @@ void EnClearTag_CreateDebrisEffect(EnClearTag* this, Vec3f* pos, Vec3f* velocity
effect->scale = scale;
// Set the debris effects to spawn in a circle.
effect->rotationY = Rand_ZeroFloat(M_PI * 2);
effect->rotationX = Rand_ZeroFloat(M_PI * 2);
effect->rotationY = Rand_ZeroFloat(F_PI * 2);
effect->rotationX = Rand_ZeroFloat(F_PI * 2);
effect->effectsTimer = effect->bounces = 0;
@@ -439,8 +439,8 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) {
for (i = 0; i < 54; i++) {
lightRayMaxScale =
sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]);
Matrix_RotateYF(Rand_ZeroFloat(M_PI * 2), MTXMODE_NEW);
Matrix_RotateXFApply(Rand_ZeroFloat(M_PI * 2));
Matrix_RotateYF(Rand_ZeroFloat(F_PI * 2), MTXMODE_NEW);
Matrix_RotateXFApply(Rand_ZeroFloat(F_PI * 2));
Matrix_MultVecZ(lightRayMaxScale, &velocity);
accel.x = velocity.x * -0.03f;
accel.y = velocity.y * -0.03f;
@@ -512,8 +512,8 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) {
pos = this->actor.world.pos;
for (i = 0; i < 44; i++) {
lightRayMaxScale = sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]);
Matrix_RotateYF(Rand_ZeroFloat(2 * M_PI), MTXMODE_NEW);
Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI));
Matrix_RotateYF(Rand_ZeroFloat(2 * F_PI), MTXMODE_NEW);
Matrix_RotateXFApply(Rand_ZeroFloat(2 * F_PI));
Matrix_MultVecZ(lightRayMaxScale, &velocity);
accel.x = velocity.x * -0.03f;
accel.y = velocity.y * -0.03f;
@@ -750,7 +750,7 @@ void EnClearTag_UpdateEffects(EnClearTag* this, PlayState* play) {
}
} else if (effect->type == CLEAR_TAG_EFFECT_LIGHT_RAYS) {
// Rotate the light ray effect.
effect->rotationZ += Rand_ZeroFloat(M_PI / 2) + (M_PI / 2);
effect->rotationZ += Rand_ZeroFloat(F_PI / 2) + (F_PI / 2);
// Fade the light ray effects.
effect->lightRayAlpha -= effect->lightRayAlphaDecrementSpeed;
@@ -968,7 +968,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
Matrix_RotateXFApply(effect->rotationX);
Matrix_RotateZF(effect->rotationZ, MTXMODE_APPLY);
Matrix_Scale(effect->scale * 0.5f, effect->scale * 0.5f, effect->maxScale * effect->scale, MTXMODE_APPLY);
Matrix_RotateXFApply(M_PI / 2);
Matrix_RotateXFApply(F_PI / 2);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gClearTagLightRayEffectDL);
}
@@ -988,7 +988,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
// Apply material 16 times along a circle to give the appearance of a splash
for (j = 0; j < 16; j++) {
Matrix_RotateYF(2.0f * (j * M_PI) * (1.0f / 16.0f), MTXMODE_NEW);
Matrix_RotateYF(2.0f * (j * F_PI) * (1.0f / 16.0f), MTXMODE_NEW);
Matrix_MultVecZ(effect->maxScale, &vec);
/**
* Get the water surface at point (`x`, `ySurface`, `z`). `ySurface` doubles as position y input
@@ -1001,7 +1001,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
if ((effect->pos.y - ySurface) < 200.0f) {
// Draw the splash effect.
Matrix_Translate(effect->pos.x + vec.x, ySurface, effect->pos.z + vec.z, MTXMODE_NEW);
Matrix_RotateYF(2.0f * (j * M_PI) * (1.0f / 16.0f), MTXMODE_APPLY);
Matrix_RotateYF(2.0f * (j * F_PI) * (1.0f / 16.0f), MTXMODE_APPLY);
Matrix_RotateXFApply(effect->rotationX);
Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+2 -2
View File
@@ -549,9 +549,9 @@ s32 EnCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if (this->actor.colChkInfo.health != 0) {
if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) {
rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4)));
rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (F_PI / 4)));
} else if (limbIndex == OBJECT_CROW_LIMB_TAIL) {
rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4)));
rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (F_PI / 4)));
}
}
return false;
@@ -385,7 +385,7 @@ void EnDekubaba_Grow(EnDekubaba* this, PlayState* play) {
this->size * 0.01f * (0.5f + (15 - this->timer) * 0.5f / 15.0f);
Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x800);
headDistVertical = Math_SinF(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * M_PI) * 32.0f + 14.0f;
headDistVertical = Math_SinF(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * F_PI) * 32.0f + 14.0f;
if (this->actor.shape.rot.x < -0x38E3) {
headDistHorizontal = 0.0f;
@@ -469,7 +469,7 @@ void EnDekubaba_Retract(EnDekubaba* this, PlayState* play) {
this->size * 0.01f * (0.5f + this->timer * (1.0f / 30));
Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x300);
headDistVertical = (Math_SinF(CLAMP_MAX(this->timer * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f;
headDistVertical = (Math_SinF(CLAMP_MAX(this->timer * 0.033f, 0.7f) * F_PI) * 32.0f) + 14.0f;
if (this->actor.shape.rot.x < -0x38E3) {
headDistHorizontal = 0.0f;
@@ -1109,7 +1109,7 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) {
for (i = 6; i < end; i++) {
dim = &this->colliderJntSph.elements[i].dim;
temp_s3 = (s32)(Math_CosF((this->unk_290 + ((i - 5) << 1)) * (M_PI / 20)) * 0x2C00) + this->actor.shape.rot.y;
temp_s3 = (s32)(Math_CosF((this->unk_290 + ((i - 5) << 1)) * (F_PI / 20)) * 0x2C00) + this->actor.shape.rot.y;
dim->worldSphere.center.x =
(s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].x + (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z);
@@ -1245,9 +1245,9 @@ void func_8089D42C(EnDinofos* this, PlayState* play) {
if ((this->actionFunc == func_8089B834) && (this->unk_290 != 0)) {
Math_ScaledStepToS(&this->unk_28E, Math_SinS(this->unk_290 * 1400) * 0x2C00, 0x300);
} else if (this->actionFunc == func_8089CA74) {
Math_ScaledStepToS(&this->unk_28E, Math_CosF(M_PI) * 0x2C00, 0x2C00 / 20);
Math_ScaledStepToS(&this->unk_28E, Math_CosF(F_PI) * 0x2C00, 0x2C00 / 20);
} else if (this->actionFunc == func_8089CBEC) {
this->unk_28E = Math_CosF(this->unk_290 * (M_PI / 20)) * 0x2C00;
this->unk_28E = Math_CosF(this->unk_290 * (F_PI / 20)) * 0x2C00;
} else if (!Play_InCsMode(play)) {
temp_v0_2 = this->unk_28E + this->actor.shape.rot.y;
temp_v0_2 = BINANG_SUB(this->actor.yawTowardsPlayer, temp_v0_2);
+2 -2
View File
@@ -788,8 +788,8 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) {
/*! @bug The following is supposed to calculate the rotation from vertical to the collision poly normal.
* However, the calculation is performed incorrectly. The correct calculation is
* rotToNorm.x = Math_FAtan2F(nz, ny) * 0x8000 / M_PI;
* rotToNorm.z = Math_FAtan2F(-nx, sqrtf(1.0f - SQ(nx))) * 0x8000 / M_PI;
* rotToNorm.x = Math_FAtan2F(nz, ny) * 0x8000 / F_PI;
* rotToNorm.z = Math_FAtan2F(-nx, sqrtf(1.0f - SQ(nx))) * 0x8000 / F_PI;
*/
rotToNorm.x = RAD_TO_BINANG_ALT2(-Math_FAtan2F(-nz * ny, 1.0f));
rotToNorm.z = RAD_TO_BINANG_ALT2(Math_FAtan2F(-nx * ny, 1.0f));
@@ -750,7 +750,7 @@ void EnFishing_InitPondProps(EnFishing* this, PlayState* play) {
if (prop->type == FS_PROP_REED) {
prop->scale = (EnFishing_RandZeroOne() * 0.25f) + 0.75f;
prop->reedAngle = Rand_ZeroFloat(2 * M_PI);
prop->reedAngle = Rand_ZeroFloat(2 * F_PI);
if (sLinkAge == 1) {
prop->scale *= 0.6f;
}
@@ -763,7 +763,7 @@ void EnFishing_InitPondProps(EnFishing* this, PlayState* play) {
EnFishing_SetColliderElement(i, &sFishingMain->collider, &colliderPos, prop->scale * 3.5f);
} else if (prop->type == FS_PROP_LILY_PAD) {
prop->scale = (EnFishing_RandZeroOne() * 0.3f) + 0.5f;
prop->rotY = Rand_ZeroFloat(2 * M_PI);
prop->rotY = Rand_ZeroFloat(2 * F_PI);
if (sLinkAge == 1) {
if ((i % 4) != 0) {
prop->scale *= 0.6f;
@@ -773,7 +773,7 @@ void EnFishing_InitPondProps(EnFishing* this, PlayState* play) {
}
} else {
prop->scale = (EnFishing_RandZeroOne() * 0.1f) + 0.3f;
prop->rotY = Rand_ZeroFloat(2 * M_PI);
prop->rotY = Rand_ZeroFloat(2 * F_PI);
prop->drawDistance = 1000.0f;
EnFishing_SetColliderElement(i, &sFishingMain->collider, &prop->pos, prop->scale);
}
@@ -1309,7 +1309,7 @@ void EnFishing_DrawEffects(FishingEffect* effect, PlayState* play) {
if (Rand_ZeroOne() < 0.5f) {
rotY = 0.0f;
} else {
rotY = M_PI;
rotY = F_PI;
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
@@ -1332,7 +1332,7 @@ void EnFishing_DrawEffects(FishingEffect* effect, PlayState* play) {
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);
Matrix_RotateXFApply(F_PI / 2);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHatDL);
@@ -1584,12 +1584,12 @@ void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookI
Matrix_RotateYF(sLureHookRotY[hookIndex], MTXMODE_APPLY);
Matrix_RotateXFApply(rx);
Matrix_Scale(0.0039999997f, 0.0039999997f, 0.005f, MTXMODE_APPLY);
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL);
Matrix_RotateZF(M_PI / 2, MTXMODE_APPLY);
Matrix_RotateZF(F_PI / 2, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL);
@@ -1618,7 +1618,7 @@ void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookI
Matrix_Pop();
Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateXFApply(M_PI / 2);
Matrix_RotateXFApply(F_PI / 2);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHatDL);
@@ -1784,7 +1784,7 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot)
}
} else if (D_8090CD14 == 0) {
sLurePos = sReelLinePos[LINE_SEG_COUNT - 1];
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI;
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + F_PI;
if ((player->actor.speed == 0.0f) && (D_80917200 == 0)) {
Math_ApproachF(&sLureRot.y, sReelLineRot[LINE_SEG_COUNT - 2].y, 0.1f, 0.2f);
@@ -1799,8 +1799,8 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot)
Matrix_RotateXFApply(sLureRot.x);
Matrix_Scale(0.0039999997f, 0.0039999997f, 0.0039999997f, MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, D_80917258, MTXMODE_APPLY);
Matrix_RotateZF(M_PI / 2, MTXMODE_APPLY);
Matrix_RotateYF(M_PI / 2, MTXMODE_APPLY);
Matrix_RotateZF(F_PI / 2, MTXMODE_APPLY);
Matrix_RotateYF(F_PI / 2, MTXMODE_APPLY);
Gfx_SetupDL25_Opa(play->state.gfxCtx);
@@ -2008,7 +2008,7 @@ void EnFishing_DrawRod(PlayState* play) {
Matrix_RotateXFApply(-0.6283185f);
Matrix_RotateZF((player->unk_B08 * 0.5f) + 0.4712389f, MTXMODE_APPLY);
Matrix_RotateXFApply((D_8090CD40 + 20.0f) * 0.01f * M_PI);
Matrix_RotateXFApply((D_8090CD40 + 20.0f) * 0.01f * F_PI);
Matrix_Scale(0.70000005f, 0.70000005f, 0.70000005f, MTXMODE_APPLY);
spC0 = (D_8090CD3C * (((player->unk_B0C - 1.0f) * -0.25f) + 0.5f)) + (D_8090CD2C + D_8090CD38);
@@ -2160,7 +2160,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
Message_CloseTextbox(play);
}
} else {
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI;
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + F_PI;
sLureRot.y = sReelLineRot[LINE_SEG_COUNT - 2].y;
if (D_80917204 == 18) {
@@ -2208,11 +2208,11 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
spD0 = sLurePos.z - sRodTipPos.z;
if (D_80917202 != 0) {
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI;
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + F_PI;
sLureRot.y = sReelLineRot[LINE_SEG_COUNT - 2].y;
} else {
sLureRot.x = 0.0f;
sLureRot.y = Math_Atan2F_XY(spD0, spD8) + M_PI;
sLureRot.y = Math_Atan2F_XY(spD0, spD8) + F_PI;
}
phi_f16 = sqrtf(SQ(spD8) + SQ(spD4) + SQ(spD0));
@@ -2418,7 +2418,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
s8 requiredScopeTemp;
spDC = 0x500;
D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + F_PI;
sLureRot.x = 0.0f;
D_8091725C = 0.5f;
if (D_80917206 == 2) {
@@ -2429,8 +2429,8 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
}
} else {
if (D_809101C0 > 150.0f) {
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI;
D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + F_PI;
D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + F_PI;
D_809101C0 += 2.0f;
}
}
@@ -2439,7 +2439,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
if (sLurePos.y <= spE4) {
sLurePos.y = spE4;
spDC = 0x500;
D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + F_PI;
sLureRot.x = 0.0f;
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
D_809101C0 += 6.0f;
@@ -2447,8 +2447,8 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
}
} else {
if (D_809101C0 > 150.0f) {
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI;
D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + F_PI;
D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + F_PI;
D_809101C0 += 2.0f;
}
}
@@ -3601,7 +3601,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
for (spA2 = 0; spA2 < 100; spA2++) {
Matrix_RotateYF(Rand_CenteredFloat(0.75f * M_PI) +
Matrix_RotateYF(Rand_CenteredFloat(0.75f * F_PI) +
BINANG_TO_RAD_ALT(this->actor.yawTowardsPlayer + 0x8000),
MTXMODE_NEW);
Matrix_MultVec3f(&sp10C, &sp100);
@@ -4241,7 +4241,7 @@ void EnFishing_DrawFish(Actor* thisx, PlayState* play) {
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
if (this->unk_148 == 0) {
Matrix_RotateYF(BINANG_TO_RAD(this->unk_164) - (M_PI / 2), MTXMODE_APPLY);
Matrix_RotateYF(BINANG_TO_RAD(this->unk_164) - (F_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,
@@ -4250,7 +4250,7 @@ void EnFishing_DrawFish(Actor* thisx, PlayState* play) {
Matrix_Translate(0.0f, 0.0f, 3000.0f, 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);
Matrix_RotateYF(-(F_PI / 2), MTXMODE_APPLY);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnFishing_LoachOverrideLimbDraw, EnFishing_LoachPostLimbDraw, &this->actor);
@@ -5581,7 +5581,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) {
rot.x = 1.6707964f;
rot.y = 1.0f;
rot.z = (Camera_GetInputDirYaw(mainCam) * -(M_PI / 0x8000)) + rot.y;
rot.z = (Camera_GetInputDirYaw(mainCam) * -(F_PI / 0x8000)) + rot.y;
for (i = 0; i < (u8)D_8090CCD0; i++) {
pos.x = Rand_CenteredFloat(700.0f) + play->view.eye.x;
@@ -1198,8 +1198,8 @@ void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s*
} else if (limbIndex == WALLMASTER_LIMB_HAND) {
Matrix_Push();
Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY);
Matrix_RotateYF(M_PI / 3, MTXMODE_APPLY);
Matrix_RotateZF(M_PI / 12, MTXMODE_APPLY);
Matrix_RotateYF(F_PI / 3, MTXMODE_APPLY);
Matrix_RotateZF(F_PI / 12, MTXMODE_APPLY);
Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY);
gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+2 -2
View File
@@ -699,8 +699,8 @@ s32 func_80998F9C(EnGs* this, PlayState* play) {
this->unk_1B0[0].x = this->unk_1E4 + 1.0f;
this->unk_1B0[0].y = this->unk_1DC + 1.0f;
if (sp48 == 0.0f) {
this->unk_1DC = 2.0f * M_PI / 9.0000002;
this->unk_1E0 = M_PI / 9.0000002;
this->unk_1DC = 2.0f * F_PI / 9.0000002;
this->unk_1E0 = F_PI / 9.0000002;
this->unk_19D = 4;
}
}
@@ -325,7 +325,7 @@ void EnHakurock_Stalactite_StuckInGround(EnHakurock* this, PlayState* play) {
if (this->timer > 0) {
this->timer--;
if ((this->timer % 2) == 0) {
this->actor.world.pos.y = (Math_SinF(this->timer * (M_PI / 20)) * 4.0f) + this->actor.floorHeight;
this->actor.world.pos.y = (Math_SinF(this->timer * (F_PI / 20)) * 4.0f) + this->actor.floorHeight;
} else {
this->actor.world.pos.y = this->actor.floorHeight;
}
+1 -1
View File
@@ -334,7 +334,7 @@ void EnHoll_Draw(Actor* thisx, PlayState* play) {
}
gfx = Gfx_SetupDL(gfx, setupDListIndex);
if (this->playerSide == EN_HOLL_BEHIND) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
}
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, this->alpha);
+2 -2
View File
@@ -499,7 +499,7 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) {
if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 23.0f)) {
this->colliderQuad.base.atFlags |= AT_ON;
if (this->drawArmorFlags != 0) {
this->actor.speed = Math_SinF((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f;
this->actor.speed = Math_SinF((this->skelAnime.curFrame - 13.0f) * (F_PI / 20)) * 10.0f;
}
} else {
this->colliderQuad.base.atFlags &= ~AT_ON;
@@ -562,7 +562,7 @@ void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) {
} else {
phi_f2 = this->skelAnime.curFrame - 1.0f;
}
this->actor.speed = Math_SinF((M_PI / 8) * phi_f2) * 4.5f;
this->actor.speed = Math_SinF((F_PI / 8) * phi_f2) * 4.5f;
}
this->colliderQuad.base.atFlags |= AT_ON;
} else {
@@ -908,14 +908,14 @@ static Gfx* sDisplayLists[] = {
#include "z_en_kanban_gfx.c"
static f32 sCutAngles[] = {
/* CUT_POST */ 0.50f * M_PI,
/* CUT_VERT_L */ 0.00f * M_PI,
/* CUT_HORIZ */ 0.50f * M_PI,
/* CUT_DIAG_L */ 0.66f * M_PI,
/* CUT_DIAG_R */ 0.34f * M_PI,
/* CUT_VERT_R */ 0.00f * M_PI,
/* */ 0.00f * M_PI,
/* */ 0.00f * M_PI,
/* CUT_POST */ 0.50f * F_PI,
/* CUT_VERT_L */ 0.00f * F_PI,
/* CUT_HORIZ */ 0.50f * F_PI,
/* CUT_DIAG_L */ 0.66f * F_PI,
/* CUT_DIAG_R */ 0.34f * F_PI,
/* CUT_VERT_R */ 0.00f * F_PI,
/* */ 0.00f * F_PI,
/* */ 0.00f * F_PI,
};
#include "overlays/ovl_En_Kanban/ovl_En_Kanban.c"
@@ -1025,7 +1025,7 @@ void EnKanban_Draw(Actor* thisx, PlayState* play) {
Matrix_Scale(this->actor.scale.x, 0.0f, this->actor.scale.z, MTXMODE_APPLY);
if (this->actionState == ENKANBAN_SIGN) {
Matrix_RotateXFApply(-M_PI / 5);
Matrix_RotateXFApply(-F_PI / 5);
}
Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY);
@@ -189,7 +189,7 @@ void EnLight_Draw(Actor* thisx, PlayState* play) {
Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y), MTXMODE_APPLY);
if (ENLIGHT_GET_1(&this->actor)) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
}
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
@@ -396,8 +396,8 @@ void EnMinislime_GrowAndShrink(EnMinislime* this, PlayState* play) {
this->growShrinkTimer--;
scaleFactor = (this->growShrinkTimer / 6) + 1.0f;
this->actor.scale.z = this->actor.scale.x =
((Math_CosF(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * (2.0f / 30.0f))) + 1.5f) * 0.1f;
this->actor.scale.y = ((Math_SinF(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * 0.05f)) + 0.75f) * 0.1f;
((Math_CosF(this->growShrinkTimer * (F_PI / 3)) * (scaleFactor * (2.0f / 30.0f))) + 1.5f) * 0.1f;
this->actor.scale.y = ((Math_SinF(this->growShrinkTimer * (F_PI / 3)) * (scaleFactor * 0.05f)) + 0.75f) * 0.1f;
if (this->actor.params == MINISLIME_SETUP_GEKKO_THROW) {
EnMinislime_SetupMoveToGekko(this);
} else if ((this->actor.xzDistToPlayer < 150.0f) && (this->growShrinkTimer < 38)) {
@@ -419,11 +419,11 @@ void EnMinislime_Idle(EnMinislime* this, PlayState* play) {
f32 speedXZ;
this->idleTimer--;
speedXZ = Math_SinF(this->idleTimer * (M_PI / 10));
speedXZ = Math_SinF(this->idleTimer * (F_PI / 10));
this->actor.speed = speedXZ * 1.5f;
this->actor.speed = CLAMP_MIN(this->actor.speed, 0.0f);
Math_StepToF(&this->actor.scale.x, ((0.14f * speedXZ) + 1.5f) * 0.1f, 0.010000001f);
Math_StepToF(&this->actor.scale.y, ((Math_CosF(this->idleTimer * (M_PI / 10)) * 0.07f) + 0.75f) * 0.1f,
Math_StepToF(&this->actor.scale.y, ((Math_CosF(this->idleTimer * (F_PI / 10)) * 0.07f) + 0.75f) * 0.1f,
0.010000001f);
Math_StepToF(&this->actor.scale.z, 0.3f - this->actor.scale.x, 0.010000001f);
if (this->idleTimer == 0) {
@@ -531,13 +531,13 @@ void EnMinislime_Knockback(EnMinislime* this, PlayState* play) {
this->knockbackTimer--;
Math_StepToF(&this->actor.speed, 0.0f, 1.0f);
sqrtFrozenTimer = sqrtf(this->knockbackTimer);
this->actor.scale.x = ((Math_CosF(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.15f;
this->actor.scale.x = ((Math_CosF(this->knockbackTimer * (F_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.15f;
this->actor.scale.z = this->actor.scale.x;
if (this->knockbackTimer == 15) {
this->collider.base.acFlags |= AC_ON;
}
this->actor.scale.y = ((Math_SinF(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.075f;
this->actor.scale.y = ((Math_SinF(this->knockbackTimer * (F_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.075f;
if (this->actor.params == MINISLIME_SETUP_GEKKO_THROW) {
EnMinislime_SetupMoveToGekko(this);
} else if (this->knockbackTimer == 0) {
@@ -569,9 +569,9 @@ void EnMinislime_DefeatIdle(EnMinislime* this, PlayState* play) {
f32 xzScale;
this->idleTimer--;
xzScale = Math_SinF(this->idleTimer * (M_PI / 10));
xzScale = Math_SinF(this->idleTimer * (F_PI / 10));
Math_StepToF(&this->actor.scale.x, ((0.14f * xzScale) + 1.5f) * 0.1f, 0.010000001f);
Math_StepToF(&this->actor.scale.y, ((0.07f * Math_CosF(this->idleTimer * (M_PI / 10))) + 0.75f) * 0.1f,
Math_StepToF(&this->actor.scale.y, ((0.07f * Math_CosF(this->idleTimer * (F_PI / 10))) + 0.75f) * 0.1f,
0.010000001f);
Math_StepToF(&this->actor.scale.z, 0.3f - this->actor.scale.x, 0.010000001f);
if (this->idleTimer == 0) {
@@ -665,9 +665,9 @@ void EnMinislime_GekkoThrow(EnMinislime* this, PlayState* play) {
f32 xzScale;
this->throwTimer--;
xzScale = Math_SinF(this->throwTimer * (M_PI / 5));
xzScale = Math_SinF(this->throwTimer * (F_PI / 5));
this->actor.scale.x = ((0.3f * xzScale) + 1.5f) * 0.1f;
this->actor.scale.y = ((Math_CosF(this->throwTimer * (M_PI / 5)) * 0.2f) + 0.75f) * 0.1f;
this->actor.scale.y = ((Math_CosF(this->throwTimer * (F_PI / 5)) * 0.2f) + 0.75f) * 0.1f;
this->actor.scale.z = 0.3f - this->actor.scale.x;
if (this->throwTimer == 0) {
this->throwTimer = 10;
+5 -5
View File
@@ -274,7 +274,7 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) {
Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer, 0x400);
}
this->actor.shape.rot.y =
(s32)(Math_SinF(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speed)) + this->unk_150;
(s32)(Math_SinF(this->unk_14E * ((2 * F_PI) / 15)) * (614.4f * this->actor.speed)) + this->unk_150;
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_KUROSUKE_MOVE - SFX_FLAG);
if (sp20) {
this->unk_14B &= ~2;
@@ -379,16 +379,16 @@ void func_80A4E84C(EnMkk* this) {
this->unk_154.y = this->actor.world.pos.y;
this->unk_154.x = this->actor.world.pos.x -
10.0f * Math_SinS(this->actor.shape.rot.y +
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5))));
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (F_PI / 5))));
this->unk_154.z = this->actor.world.pos.z -
10.0f * Math_CosS(this->actor.shape.rot.y +
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5))));
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (F_PI / 5))));
this->unk_160.x = this->unk_154.x -
12.0f * Math_SinS(this->actor.shape.rot.y -
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5))));
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (F_PI / 5))));
this->unk_160.z = this->unk_154.z -
12.0f * Math_CosS(this->actor.shape.rot.y -
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5))));
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (F_PI / 5))));
}
}
+1 -1
View File
@@ -976,7 +976,7 @@ void EnNiw_UpdateFeather(EnNiw* this, PlayState* play) {
feather->velocity.y = -0.5f;
}
feather->zRot = Math_SinS(feather->zRotStart * 0xBB8) * M_PI * 0.2f;
feather->zRot = Math_SinS(feather->zRotStart * 0xBB8) * F_PI * 0.2f;
if (feather->life < feather->timer) {
feather->isEnabled = false;
@@ -524,7 +524,7 @@ void EnPametfrog_FallOffSnapper(EnPametfrog* this, PlayState* play) {
this->timer--;
}
sin = Math_SinF(this->timer * (M_PI / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f;
sin = Math_SinF(this->timer * (F_PI / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f;
EnPametfrog_ShakeCamera(this, play, 300.0f * sin, 100.0f * sin);
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
EnPametfrog_StopCutscene(this, play);
@@ -663,10 +663,10 @@ void EnPametfrog_SetupWallPause(EnPametfrog* this) {
this->actor.speed = 0.0f;
this->skelAnime.playSpeed = 1.5f;
if (this->timer != 0) {
this->wallRotation = this->unk_2E8.y > 0.0f ? (M_PI / 30) : (-M_PI / 30);
this->wallRotation = this->unk_2E8.y > 0.0f ? (F_PI / 30) : (-F_PI / 30);
} else {
randFloat = Rand_ZeroFloat(0x2000);
this->wallRotation = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (0x1000 + randFloat) * (M_PI / (15 * 0x8000));
this->wallRotation = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (0x1000 + randFloat) * (F_PI / (15 * 0x8000));
}
this->timer = 15;
Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_RUNAWAY2);
@@ -982,7 +982,7 @@ void EnPametfrog_SpawnFrog(EnPametfrog* this, PlayState* play) {
f32 magShake;
this->timer--;
magShake = (Math_SinF(this->timer * (M_PI / 5)) * ((0.04f * (this->timer * 0.1f)) + 0.02f)) + 1.0f;
magShake = (Math_SinF(this->timer * (F_PI / 5)) * ((0.04f * (this->timer * 0.1f)) + 0.02f)) + 1.0f;
EnPametfrog_ShakeCamera(this, play, 75.0f * magShake, 10.0f * magShake);
if (this->timer == 0) {
EnPametfrog_StopCutscene(this, play);
+4 -4
View File
@@ -948,14 +948,14 @@ void EnRat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gBombCapDL);
if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON) {
redModifier = fabsf(Math_CosF(this->timer * (M_PI / 30.f)));
redModifier = fabsf(Math_CosF(this->timer * (F_PI / 30.f)));
} else {
if (this->timer >= 120) {
redModifier = fabsf(Math_CosF((this->timer % 30) * (M_PI / 30.0f)));
redModifier = fabsf(Math_CosF((this->timer % 30) * (F_PI / 30.0f)));
} else if (this->timer >= 30) {
redModifier = fabsf(Math_CosF((this->timer % 6) * (M_PI / 6.0f)));
redModifier = fabsf(Math_CosF((this->timer % 6) * (F_PI / 6.0f)));
} else {
redModifier = fabsf(Math_CosF((this->timer % 3) * (M_PI / 3.0f)));
redModifier = fabsf(Math_CosF((this->timer % 3) * (F_PI / 3.0f)));
}
}
+15 -15
View File
@@ -310,11 +310,11 @@ void EnSlime_Idle(EnSlime* this, PlayState* play) {
timerFactor = sqrtf(this->timer) * 0.2f;
EnSlime_Blink(this);
scale = ((Math_SinF(this->timer * (2.0f * M_PI / 5.0f)) * (0.13f * timerFactor)) + 1.0f) * 0.01f;
scale = ((Math_SinF(this->timer * (2.0f * F_PI / 5.0f)) * (0.13f * timerFactor)) + 1.0f) * 0.01f;
this->actor.scale.x = scale;
this->actor.scale.z = scale;
if (this->timer < 24) {
this->actor.scale.y = ((Math_CosF(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * timerFactor)) + 1.0f) * 0.01f;
this->actor.scale.y = ((Math_CosF(this->timer * (2.0f * F_PI / 5.0f)) * (0.05f * timerFactor)) + 1.0f) * 0.01f;
}
this->actor.shape.rot.x = Rand_CenteredFloat(0x200) * timerFactor;
@@ -372,7 +372,7 @@ void EnSlime_MoveInDirection(EnSlime* this, PlayState* play) {
}
// Update actor scale, xz speed, and rotation to provide amorphous effect
sinFactor = fabsf(Math_SinF(this->timer * (M_PI / 24)));
sinFactor = fabsf(Math_SinF(this->timer * (F_PI / 24)));
Math_StepToF(&this->actor.scale.z, ((0.15f * sinFactor) + 1.0f) * 0.01f, 0.0002f);
Math_StepToF(&this->actor.scale.x, (1.0f - (0.2f * sinFactor)) * 0.01f, 0.0002f);
Math_StepToF(&this->actor.scale.y, (1.0f - (0.1f * sinFactor)) * 0.01f, 0.0002f);
@@ -425,7 +425,7 @@ void EnSlime_MoveToHome(EnSlime* this, PlayState* play) {
this->idleRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos);
}
timerFactor = fabsf(Math_SinF(this->timer * (M_PI / 24)));
timerFactor = fabsf(Math_SinF(this->timer * (F_PI / 24)));
Math_StepToF(&this->actor.scale.z, ((0.15f * timerFactor) + 1.0f) * 0.01f, 0.0002f);
Math_StepToF(&this->actor.scale.x, (1.0f - (0.2f * timerFactor)) * 0.01f, 0.0002f);
Math_StepToF(&this->actor.scale.y, (1.0f - (0.1f * timerFactor)) * 0.01f, 0.0002f);
@@ -549,11 +549,11 @@ void EnSlime_Land(EnSlime* this, PlayState* play) {
this->timer--;
scaleY = ((this->timer / 5) + 1) * 1.6f;
rotXZ = sqrtf(this->timer) * 0.2f;
scaleXZ = ((Math_CosF(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * scaleY)) + 1.0f) * 0.01f;
scaleXZ = ((Math_CosF(this->timer * (2.0f * F_PI / 5.0f)) * (0.05f * scaleY)) + 1.0f) * 0.01f;
this->actor.scale.x = scaleXZ;
this->actor.scale.z = scaleXZ;
if (this->timer < 15) {
this->actor.scale.y = (1.0f - (Math_SinF(this->timer * (2.0f * M_PI / 5.0f)) * (0.04f * scaleY))) * 0.01f;
this->actor.scale.y = (1.0f - (Math_SinF(this->timer * (2.0f * F_PI / 5.0f)) * (0.04f * scaleY))) * 0.01f;
}
this->actor.shape.rot.x = Rand_CenteredFloat(0x200) * rotXZ;
this->actor.shape.rot.z = Rand_CenteredFloat(0x200) * rotXZ;
@@ -605,14 +605,14 @@ void EnSlime_ReactToBluntHit(EnSlime* this, PlayState* play) {
Math_StepToF(&this->actor.speed, 0.0f, 1.0f);
timerFactor = sqrtf(this->timer);
if (this->timer < 30) {
scale = ((Math_CosF(this->timer * (2.0f * M_PI / 5.0f)) * (0.08f * timerFactor)) + 1.0f) * 0.01f;
scale = ((Math_CosF(this->timer * (2.0f * F_PI / 5.0f)) * (0.08f * timerFactor)) + 1.0f) * 0.01f;
this->actor.scale.x = scale;
this->actor.scale.z = scale;
}
if (this->timer == 15) {
this->collider.base.acFlags |= AC_ON;
}
this->actor.scale.y = ((Math_SinF((f32)this->timer * (2.0f * M_PI / 5.0f)) * (0.07f * timerFactor)) + 1.0f) * 0.01f;
this->actor.scale.y = ((Math_SinF((f32)this->timer * (2.0f * F_PI / 5.0f)) * (0.07f * timerFactor)) + 1.0f) * 0.01f;
this->actor.shape.rot.x = Rand_CenteredFloat(0x200) * timerFactor;
this->actor.shape.rot.z = Rand_CenteredFloat(0x200) * timerFactor;
@@ -652,8 +652,8 @@ void EnSlime_SetupDamaged(EnSlime* this, PlayState* play, s32 arg2) {
this->eyeTexIndex = EN_SLIME_EYETEX_OPEN;
Actor_SetScale(&this->actor, 0.01f);
this->wobbleRot.x = Rand_ZeroOne() * (M_PI * 2.0f);
this->wobbleRot.z = Rand_ZeroOne() * (M_PI * 2.0f);
this->wobbleRot.x = Rand_ZeroOne() * (F_PI * 2.0f);
this->wobbleRot.z = Rand_ZeroOne() * (F_PI * 2.0f);
ySin = Math_SinS(this->actor.world.rot.y) * 10.0f;
yCos = Math_CosS(this->actor.world.rot.y) * 10.0f;
effectPos.x = this->actor.world.pos.x + ySin;
@@ -691,8 +691,8 @@ void EnSlime_Damaged(EnSlime* this, PlayState* play) {
this->timer--;
Math_StepToF(&this->actor.speed, 0.0f, 1.0f);
if ((this->timer % 5) == 0) {
this->wobbleRot.x = Rand_ZeroOne() * (M_PI * 2.0f);
this->wobbleRot.z = Rand_ZeroOne() * (M_PI * 2.0f);
this->wobbleRot.x = Rand_ZeroOne() * (F_PI * 2.0f);
this->wobbleRot.z = Rand_ZeroOne() * (F_PI * 2.0f);
}
if (this->timer == 0) {
if (this->actor.colChkInfo.health != 0) {
@@ -1186,9 +1186,9 @@ void EnSlime_Draw(Actor* thisx, PlayState* play) {
}
if (this->actionFunc == EnSlime_Damaged) {
wobbleScale.x = 1.0f - (Math_SinF((f32)this->timer * (M_PI / 2.0f)) * 0.3f);
wobbleScale.y = (Math_SinF((f32)this->timer * (M_PI / 2.0f)) * 0.3f) + 1.0f;
wobbleScale.z = 1.0f - (Math_CosF((f32)this->timer * (M_PI / 2.0f)) * 0.3f);
wobbleScale.x = 1.0f - (Math_SinF((f32)this->timer * (F_PI / 2.0f)) * 0.3f);
wobbleScale.y = (Math_SinF((f32)this->timer * (F_PI / 2.0f)) * 0.3f) + 1.0f;
wobbleScale.z = 1.0f - (Math_CosF((f32)this->timer * (F_PI / 2.0f)) * 0.3f);
Matrix_RotateXFApply(this->wobbleRot.x);
Matrix_RotateZF(this->wobbleRot.z, MTXMODE_APPLY);
@@ -292,9 +292,9 @@ s32 EnSyatekiCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList,
EnSyatekiCrow* this = THIS;
if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) {
rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4)));
rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (F_PI / 4)));
} else if (limbIndex == OBJECT_CROW_LIMB_TAIL) {
rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4)));
rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (F_PI / 4)));
}
return false;
@@ -469,7 +469,7 @@ void EnSyatekiOkuta_UpdateHeadScale(EnSyatekiOkuta* this) {
}
} else if (this->actionFunc == EnSyatekiOkuta_Float) {
this->headScale.x = this->headScale.z = 1.0f;
this->headScale.y = (Math_SinF((M_PI / 16) * curFrame) * 0.2f) + 1.0f;
this->headScale.y = (Math_SinF((F_PI / 16) * curFrame) * 0.2f) + 1.0f;
} else if (this->actionFunc == EnSyatekiOkuta_Hide) {
if (curFrame < 3.0f) {
this->headScale.y = 1.0f;
@@ -509,7 +509,7 @@ s32 EnSyatekiOkuta_GetSnoutScale(EnSyatekiOkuta* this, f32 curFrame, Vec3f* scal
if (this->actionFunc == EnSyatekiOkuta_Appear) {
scale->y = 1.0f;
scale->z = 1.0f;
scale->x = (Math_SinF((M_PI / 16) * curFrame) * 0.4f) + 1.0f;
scale->x = (Math_SinF((F_PI / 16) * curFrame) * 0.4f) + 1.0f;
} else if (this->actionFunc == EnSyatekiOkuta_Die) {
if ((curFrame >= 35.0f) || (curFrame < 25.0f)) {
return false;
@@ -98,7 +98,7 @@ void EnTanron3_CreateEffect(PlayState* play, Vec3f* effectPos) {
effectPtr->accel.y = -2.0f;
effectPtr->unk_34.x = 0.1f;
effectPtr->unk_34.y = 0.0f;
effectPtr->unk_34.z = Rand_ZeroFloat(2 * M_PI);
effectPtr->unk_34.z = Rand_ZeroFloat(2 * F_PI);
effectPtr->unk_02 = Rand_ZeroFloat(100.0f);
effectPtr->velocity.x = Rand_CenteredFloat(25.0f);
effectPtr->velocity.z = Rand_CenteredFloat(25.0f);
@@ -135,8 +135,8 @@ void EnTanron3_SpawnBubbles(EnTanron3* this, PlayState* play) {
Vec3f acceleration;
for (i = 0; i < 20; i++) {
Matrix_RotateYF(Rand_ZeroFloat(2 * M_PI), MTXMODE_NEW);
Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI));
Matrix_RotateYF(Rand_ZeroFloat(2 * F_PI), MTXMODE_NEW);
Matrix_RotateXFApply(Rand_ZeroFloat(2 * F_PI));
Matrix_MultVecZ(Rand_ZeroFloat(3.0f) + 2.0f, &velocity);
acceleration.x = velocity.x * -0.05f;
acceleration.y = velocity.y * -0.05f;
@@ -57,7 +57,7 @@ void func_80A587A0(EnWaterEffect* this, Vec3f* arg1, u8 arg2) {
ptr->unk_1C = sZeroVec;
ptr->unk_2C.x = 0.1f;
ptr->unk_2C.y = 0.0f;
ptr->unk_2C.z = Rand_ZeroFloat(M_PI * 2);
ptr->unk_2C.z = Rand_ZeroFloat(F_PI * 2);
ptr->unk_01 = Rand_ZeroFloat(100.0f);
ptr->unk_2A = arg2;
break;
@@ -78,7 +78,7 @@ void func_80A58908(EnWaterEffect* this, Vec3f* arg1, Vec3f* arg2, u8 arg3) {
ptr->unk_1C = sp2C;
ptr->unk_2C.y = Rand_ZeroFloat(0.02f) + 0.02f;
ptr->unk_2C.x = ptr->unk_2C.y;
ptr->unk_2C.z = Rand_ZeroFloat(M_PI * 2);
ptr->unk_2C.z = Rand_ZeroFloat(F_PI * 2);
ptr->unk_01 = Rand_ZeroFloat(100.0f);
ptr->unk_2A = arg3;
break;
@@ -236,7 +236,7 @@ void EnWaterEffect_Update(Actor* thisx, PlayState* play2) {
}
for (j = 0; j < 12; j++) {
Matrix_RotateYF((2.0f * (j * M_PI)) / 5.5f, MTXMODE_NEW);
Matrix_RotateYF((2.0f * (j * F_PI)) / 5.5f, MTXMODE_NEW);
Matrix_MultVecZ(Rand_ZeroFloat(1.5f) + 1.5f, &spA4);
spA4.y = Rand_ZeroFloat(4.0f) + 2.0f;
func_80A58908(this, &ptr->unk_04, &spA4, ptr->unk_2A);
@@ -552,7 +552,7 @@ void func_80A5A184(Actor* thisx, PlayState* play2) {
Matrix_Scale(ptr->unk_2C.x, ptr->unk_2C.y, 1.0f, MTXMODE_APPLY);
if ((i & 1) != 0) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
}
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -301,7 +301,7 @@ void EnWdhand_Vec3fToVec3s(Vec3s* dst, Vec3f* src) {
}
s16 EnWdhand_GetLimbXRotation(EnWdhand* this, s32 limbIndex) {
return this->limbRotations[limbIndex].z * Math_SinF((this->timer - limbIndex * 20) * (M_PI / 40));
return this->limbRotations[limbIndex].z * Math_SinF((this->timer - limbIndex * 20) * (F_PI / 40));
}
void EnWdhand_SetupIdle(EnWdhand* this) {
@@ -510,9 +510,9 @@ void EnWdhand_GrabbedPlayer(EnWdhand* this, PlayState* play) {
for (i = 0; i < ARRAY_COUNT(this->limbRotations); i++) {
if (this->timer < 76) {
this->limbRotations[i].x = this->limbRotations[i].z * Math_SinF(t * (M_PI / 8));
this->limbRotations[i].x = this->limbRotations[i].z * Math_SinF(t * (F_PI / 8));
} else {
Math_ScaledStepToS(&this->limbRotations[i].x, this->limbRotations[i].z * Math_SinF(t * (M_PI / 8)), 0x400);
Math_ScaledStepToS(&this->limbRotations[i].x, this->limbRotations[i].z * Math_SinF(t * (F_PI / 8)), 0x400);
}
if (t % 16 == 0) {
if (t == 16) {
@@ -682,10 +682,10 @@ void EnWdhand_Die(EnWdhand* this, PlayState* play) {
t = this->timer;
for (i = 0; i < limbIndex; i++) {
if (this->timer > 0) {
Math_ScaledStepToS(&this->limbRotations[i].x, this->limbRotations[i].z * Math_SinF(t * (2 * M_PI / 7)),
Math_ScaledStepToS(&this->limbRotations[i].x, this->limbRotations[i].z * Math_SinF(t * (2 * F_PI / 7)),
0x200);
} else if (Rand_ZeroOne() < 0.65f) {
this->limbRotations[i].x = this->limbRotations[i].z * Math_SinF(t * (2 * M_PI / 7));
this->limbRotations[i].x = this->limbRotations[i].z * Math_SinF(t * (2 * F_PI / 7));
}
if (t % 7 == 0) {
if (i != 0) {
@@ -121,16 +121,16 @@ u32 func_80BB9A1C(ObjChan* this, f32 arg1) {
f32 sp20;
sp20 = Math_SinS(this->unk1D4) * this->unk1D0;
temp_f6 = (Math_CosS(this->unk1D4) * (400 * M_PI / 0x8000) * this->unk1D0) + arg1;
temp_f6 = (Math_CosS(this->unk1D4) * (400 * F_PI / 0x8000) * this->unk1D0) + arg1;
if (temp_f6 != 0.0f) {
this->unk1D4 = RAD_TO_BINANG(Math_FAtan2F(sp20 * (400 * M_PI / 0x8000), temp_f6));
this->unk1D4 = RAD_TO_BINANG(Math_FAtan2F(sp20 * (400 * F_PI / 0x8000), temp_f6));
} else if (sp20 >= 0.0f) {
this->unk1D4 = 0x4000;
} else {
this->unk1D4 = -0x4000;
}
if (Math_CosS(this->unk1D4) != 0.0f) {
this->unk1D0 = (temp_f6 / (Math_CosS(this->unk1D4) * (400 * M_PI / 0x8000)));
this->unk1D0 = (temp_f6 / (Math_CosS(this->unk1D4) * (400 * F_PI / 0x8000)));
} else {
this->unk1D0 = sp20;
}
@@ -624,7 +624,7 @@ void ObjMine_Water_UpdateLinks(ObjMine* this) {
if (ObjMine_GetUnitVec3fNorm(&tempVec, &diffDir, &diffNorm, &invNorm) && (diffNorm > LINK_SIZE / 3.0f)) {
Math_Vec3f_Copy(&newBasis.y, &waterLink->basis.y);
ObjMine_StepUntilParallel(&newBasis.y, &diffDir, M_PI / 30);
ObjMine_StepUntilParallel(&newBasis.y, &diffDir, F_PI / 30);
tempBasisX = (prevBasisX == NULL) ? &sStandardBasis.x : prevBasisX;
@@ -474,7 +474,7 @@ void func_80B300F4(ObjSpidertent* thisx, PlayState* play, TriNorm* triNorm, Vec3
if (func_80B2FB10(&sp88, &spA0)) {
phi_f22 = 0.0f;
temp_f24 = (2 * M_PI) / sp80->unk_0F;
temp_f24 = (2 * F_PI) / sp80->unk_0F;
for (i = 0; i < sp80->unk_0F; i++) {
temp_f2 = (Rand_ZeroOne() * temp_f24) + phi_f22;
@@ -115,7 +115,7 @@ void OceffSpot_Update(Actor* thisx, PlayState* play) {
f32 temp;
OceffSpot* this = THIS;
temp = (1.0f - cosf(this->unk16C * M_PI)) * 0.5f;
temp = (1.0f - cosf(this->unk16C * F_PI)) * 0.5f;
this->actionFunc(this, play);
switch (GET_PLAYER_FORM) {
@@ -98,7 +98,7 @@ void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this) {
Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
Matrix_RotateZYX(this->rRoll, this->rPitch, this->rYaw, MTXMODE_APPLY);
Matrix_RotateXFApply(1.57f); // (M_PI / 2)
Matrix_RotateXFApply(1.57f); // (F_PI / 2)
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
@@ -72,7 +72,7 @@ void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this) {
Matrix_ReplaceRotation(&play->billboardMtxF);
if ((index % 2) != 0) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
Matrix_RotateYF(F_PI, MTXMODE_APPLY);
}
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);