summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorpetrie911 <69443847+petrie911@users.noreply.github.com>2021-11-01 18:29:47 -0500
committerGitHub <noreply@github.com>2021-11-01 19:29:47 -0400
commitcb43f256f3660dba99ba9fb9f435181b3d52fb47 (patch)
tree869b6e55ce1963c1b62c372221632c95d134cbb1 /src/code
parent8e57f3bca3ed0a8c7490b7132aaea98850386999 (diff)
Clean up some float literals (#972)
* floats are fun * more cleanup * one more bit * format * merge kankyo * Update src/overlays/actors/ovl_En_Horse/z_en_horse.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/actors/ovl_En_Mm/z_en_mm.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Diffstat (limited to 'src/code')
-rw-r--r--src/code/audio_playback.c6
-rw-r--r--src/code/code_800EC960.c16
-rw-r--r--src/code/z_eff_blure.c2
3 files changed, 12 insertions, 12 deletions
diff --git a/src/code/audio_playback.c b/src/code/audio_playback.c
index bc4eea75a..573c0d810 100644
--- a/src/code/audio_playback.c
+++ b/src/code/audio_playback.c
@@ -79,7 +79,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
} else if (gAudioContext.soundMode == 3) {
sub->bitField0.s.stereoHeadsetEffects = false;
sub->bitField0.s.usesHeadsetPanEffects = false;
- volLeft = 0.707f;
+ volLeft = 0.707f; // approx 1/sqrt(2)
volRight = 0.707f;
} else {
sub->bitField0.s.stereoStrongRight = sp24.strongRight;
@@ -91,8 +91,8 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
vel = 0.0f > vel ? 0.0f : vel;
vel = 1.0f < vel ? 1.0f : vel;
- sub->targetVolLeft = (s32)((vel * volLeft) * 4095.999f);
- sub->targetVolRight = (s32)((vel * volRight) * 4095.999f);
+ sub->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f));
+ sub->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f));
sub->unk_2 = attrs->unk_1;
sub->filter = attrs->filter;
diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c
index 5ec471850..74d20e6b8 100644
--- a/src/code/code_800EC960.c
+++ b/src/code/code_800EC960.c
@@ -189,7 +189,7 @@ u8 sPrevOcarinaNoteVal = 0;
u8 sCurOcarinaBtnIdx = 0; // note index?
u8 sLearnSongLastBtn = 0;
f32 D_80130F24 = 1.0f;
-f32 D_80130F28 = 0.68503934f;
+f32 D_80130F28 = 87.0f / 127.0f;
s8 D_80130F2C = 0; // pitch?
s8 D_80130F30 = 0x57;
s8 D_80130F34 = 0;
@@ -2783,16 +2783,16 @@ f32 func_800F3188(u8 bankIdx, u8 entryIdx) {
} else {
switch (bankEntry->sfxParams & 3) {
case 1:
- phi_f0 = 666.6667f;
+ phi_f0 = 10000.0f / 15.0f;
break;
case 2:
- phi_f0 = 952.381f;
+ phi_f0 = 10000.0f / 10.5f;
break;
case 3:
- phi_f0 = 3846.154f;
+ phi_f0 = 10000.0f / 2.6f;
break;
default:
- phi_f0 = 500.0f;
+ phi_f0 = 10000.0f / 20.0f;
break;
}
@@ -2876,7 +2876,7 @@ s8 Audio_ComputeSoundPanSigned(f32 x, f32 z, u8 arg2) {
pan = 1.0f - pan;
}
} else {
- pan = (x / (5.0769234f * absZ)) + 0.5f;
+ pan = (x / (5.0769234f * absZ)) + 0.5f; // about 66 / 13
}
if (absZ < 50.0f) {
@@ -2982,9 +2982,9 @@ u8 func_800F37B8(f32 arg0, SoundBankEntry* arg1, s8 arg2) {
break;
}
- phi_f12 = CLAMP_MAX(arg1->dist, 1923.077f);
+ phi_f12 = CLAMP_MAX(arg1->dist, 10000.0f / 5.2f);
- return (phi_v1 * 0x10) + (u8)((phi_f0 * phi_f12) / 1923.077f);
+ return (phi_v1 * 0x10) + (u8)((phi_f0 * phi_f12) / (10000.0f / 5.2f));
}
s8 func_800F3990(f32 arg0, u16 sfxParams) {
diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c
index 301f0adab..c983175af 100644
--- a/src/code/z_eff_blure.c
+++ b/src/code/z_eff_blure.c
@@ -289,7 +289,7 @@ void EffectBlure_UpdateFlags(EffectBlureElement* elem) {
Math3D_CosOut(&sp4C, &sp40, &sp2C)) {
elem->flags &= ~3;
elem->flags |= 0;
- } else if ((sp34 <= -0.5f) || (sp30 <= -0.5f) || (sp2C <= 0.7071f)) {
+ } else if ((sp34 <= -0.5f) || (sp30 <= -0.5f) || (sp2C <= 0.7071f)) { // cos(45 degrees)
elem->flags &= ~3;
elem->flags |= 0;
} else {