From 2b5ec56cacc96de06f59ba2f6740263494ecf12f Mon Sep 17 00:00:00 2001 From: Rose <83477269+AreaZR@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:44:28 -0400 Subject: [PATCH] KeepPanInRange has one arg --- include/battle_anim.h | 2 +- src/battle_anim.c | 4 +--- src/battle_anim_sound_tasks.c | 19 ++++++++----------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/battle_anim.h b/include/battle_anim.h index 455bf5f4cd84..cac5ce9f8183 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -62,7 +62,7 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) bool8 IsContest(void); s8 BattleAnimAdjustPanning(s8 pan); s8 BattleAnimAdjustPanning2(s8 pan); -s16 KeepPanInRange(s16 panArg, int oldPan); +s16 KeepPanInRange(s16 pan); s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan); void RelocateBattleBgPal(u16 paletteNum, u16 *dest, u32 offset, bool8 largeScreen); void ResetBattleAnimBg(bool8); diff --git a/src/battle_anim.c b/src/battle_anim.c index e6e049c37051..facc0a61734f 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1319,10 +1319,8 @@ s8 BattleAnimAdjustPanning2(s8 pan) return pan; } -s16 KeepPanInRange(s16 panArg, int oldPan) +s16 KeepPanInRange(s16 pan) { - s16 pan = panArg; - if (pan > SOUND_PAN_TARGET) pan = SOUND_PAN_TARGET; else if (pan < SOUND_PAN_ATTACKER) diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c index 1fde3a982394..0f1b7458d6e6 100644 --- a/src/battle_anim_sound_tasks.c +++ b/src/battle_anim_sound_tasks.c @@ -57,7 +57,7 @@ static void SoundTask_FireBlast_Step1(u8 taskId) PlaySE12WithPanning(gTasks[taskId].data[0], pan); } pan += panIncrement; - gTasks[taskId].data[2] = KeepPanInRange(pan, panIncrement); + gTasks[taskId].data[2] = KeepPanInRange(pan); } } @@ -105,6 +105,8 @@ void SoundTask_LoopSEAdjustPanning(u8 taskId) static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId) { + s8 unusedVar = gTasks[taskId].data[3]; + if (gTasks[taskId].data[12]++ == gTasks[taskId].data[6]) { gTasks[taskId].data[12] = 0; @@ -118,12 +120,9 @@ static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId) if (gTasks[taskId].data[10]++ == gTasks[taskId].data[5]) { - u16 dPan, oldPan; gTasks[taskId].data[10] = 0; - dPan = gTasks[taskId].data[3]; - oldPan = gTasks[taskId].data[11]; - gTasks[taskId].data[11] = dPan + oldPan; - gTasks[taskId].data[11] = KeepPanInRange(gTasks[taskId].data[11], oldPan); + gTasks[taskId].data[11] += gTasks[taskId].data[3]; + gTasks[taskId].data[11] = KeepPanInRange(gTasks[taskId].data[11]); } } @@ -390,15 +389,13 @@ void SoundTask_AdjustPanningVar(u8 taskId) static void SoundTask_AdjustPanningVar_Step(u8 taskId) { - u16 panIncrement = gTasks[taskId].data[3]; + s8 unusedVar = gTasks[taskId].data[3]; if (gTasks[taskId].data[10]++ == gTasks[taskId].data[5]) { - u16 oldPan; gTasks[taskId].data[10] = 0; - oldPan = gTasks[taskId].data[11]; - gTasks[taskId].data[11] = panIncrement + oldPan; - gTasks[taskId].data[11] = KeepPanInRange(gTasks[taskId].data[11], oldPan); + gTasks[taskId].data[11] += gTasks[taskId].data[3]; + gTasks[taskId].data[11] = KeepPanInRange(gTasks[taskId].data[11]); } gAnimCustomPanning = gTasks[taskId].data[11];