From 2ec8f27811888cfb9968112c2dc130da2734400a Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 16 Aug 2022 13:00:28 -0400 Subject: [PATCH 1/2] Add missing usage of SOUND_PAN_* --- src/battle_anim_effects_1.c | 10 +++++----- src/battle_anim_effects_2.c | 6 +++--- src/battle_anim_effects_3.c | 20 ++++++++++---------- src/battle_anim_electric.c | 2 +- src/battle_anim_psychic.c | 2 +- src/battle_anim_rock.c | 4 ++-- src/battle_anim_utility_funcs.c | 4 ++-- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 0387d3929..0ae945c0c 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -3184,14 +3184,14 @@ static void AnimItemSteal_Step3(struct Sprite *sprite) sprite->y2 = Sin(sprite->data[0] + 0x80, 30 - sprite->data[1] * 8); if (sprite->y2 == 0) - PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(63)); + PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_TARGET)); if (moveAlongLinearPath(sprite)) { sprite->y2 = 0; sprite->data[0] = 0; sprite->callback = AnimItemSteal_Step2; - PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64)); + PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER)); } } @@ -4264,7 +4264,7 @@ static void AnimLockOnTarget_Step1(struct Sprite *sprite) sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step2); sprite->data[5] += 0x100; - PlaySE12WithPanning(SE_M_LOCK_ON, BattleAnimAdjustPanning(63)); + PlaySE12WithPanning(SE_M_LOCK_ON, BattleAnimAdjustPanning(SOUND_PAN_TARGET)); break; } @@ -4350,7 +4350,7 @@ static void AnimLockOnTarget_Step4(struct Sprite *sprite) sprite->data[2]++; pal = sprite->oam.paletteNum; LoadPalette(&gPlttBufferUnfaded[0x108 + pal * 16], pal * 16 | 0x101, 4); - PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(63)); + PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(SOUND_PAN_TARGET)); } else if (sprite->data[1] == 0) { @@ -4812,7 +4812,7 @@ static void AnimSharpenSphere(struct Sprite *sprite) sprite->data[2] = 0; sprite->data[3] = 0; sprite->data[4] = 0; - sprite->data[5] = BattleAnimAdjustPanning(-64); + sprite->data[5] = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER); sprite->callback = AnimSharpenSphere_Step; } diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 33065c0dd..82f3b77d5 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -1642,7 +1642,7 @@ static void AirCutterProjectileStep1(u8 taskId) gTasks[taskId].data[gTasks[taskId].data[1] + 13] = spriteId; gTasks[taskId].data[0] = gTasks[taskId].data[3]; gTasks[taskId].data[1]++; - PlaySE12WithPanning(SE_M_BLIZZARD2, BattleAnimAdjustPanning(-63)); + PlaySE12WithPanning(SE_M_BLIZZARD2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER + 1)); if (gTasks[taskId].data[1] > 2) gTasks[taskId].func = AirCutterProjectileStep2; } @@ -1839,7 +1839,7 @@ static void AnimBulletSeed_Step1(struct Sprite *sprite) int i; u16 rand; s16 *ptr; - PlaySE12WithPanning(SE_M_HORN_ATTACK, BattleAnimAdjustPanning(63)); + PlaySE12WithPanning(SE_M_HORN_ATTACK, BattleAnimAdjustPanning(SOUND_PAN_TARGET)); sprite->x += sprite->x2; sprite->y += sprite->y2; sprite->y2 = 0; @@ -2485,7 +2485,7 @@ static void AnimPencil(struct Sprite *sprite) sprite->data[3] = 16; sprite->data[4] = 0; sprite->data[5] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT) + 2; - sprite->data[6] = BattleAnimAdjustPanning(63); + sprite->data[6] = BattleAnimAdjustPanning(SOUND_PAN_TARGET); sprite->callback = AnimPencil_Step; } diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 6fca60369..f613ff597 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -1646,7 +1646,7 @@ static void AnimClappingHand_Step(struct Sprite *sprite) sprite->data[2]++; if (sprite->data[3] == 0) { - PlaySE1WithPanning(SE_M_ENCORE, BattleAnimAdjustPanning(-64)); + PlaySE1WithPanning(SE_M_ENCORE, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER)); } } } @@ -1930,7 +1930,7 @@ static void TormentAttacker_Step(u8 taskId) y = task->data[3] + task->data[5]; spriteId = CreateSprite(&gThoughtBubbleSpriteTemplate, x, y, 6 - task->data[1]); - PlaySE12WithPanning(SE_M_METRONOME, BattleAnimAdjustPanning(-64)); + PlaySE12WithPanning(SE_M_METRONOME, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER)); if (spriteId != MAX_SPRITES) { @@ -2411,7 +2411,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId) gTasks[taskId].data[11] = gBattle_BG1_Y; gTasks[taskId].data[0]++; - PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(-64)); + PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER)); break; case 1: if (gTasks[taskId].data[4]++ > 0) @@ -2446,7 +2446,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId) { gTasks[taskId].data[3] = 0; gTasks[taskId].data[0] = 1; - PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(-64)); + PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER)); } break; case 4: @@ -4845,7 +4845,7 @@ static void AnimTask_MonToSubstituteDoll(u8 taskId) if (gSprites[spriteId].y2 == 0) { - PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64)); + PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER)); gTasks[taskId].data[10] -= 0x800; gTasks[taskId].data[0]++; } @@ -4867,7 +4867,7 @@ static void AnimTask_MonToSubstituteDoll(u8 taskId) if (gSprites[spriteId].y2 == 0) { - PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64)); + PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER)); DestroyAnimVisualTask(taskId); } break; @@ -4904,7 +4904,7 @@ static void AnimBlockX_Step(struct Sprite *sprite) sprite->y2 += 10; if (sprite->y2 >= 0) { - PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(63)); + PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(SOUND_PAN_TARGET)); sprite->y2 = 0; sprite->data[0]++; } @@ -4914,7 +4914,7 @@ static void AnimBlockX_Step(struct Sprite *sprite) sprite->y2 = -(gSineTable[sprite->data[1]] >> 3); if (sprite->data[1] > 0x7F) { - PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(63)); + PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(SOUND_PAN_TARGET)); sprite->data[1] = 0; sprite->y2 = 0; sprite->data[0]++; @@ -4933,7 +4933,7 @@ static void AnimBlockX_Step(struct Sprite *sprite) case 3: if (++sprite->data[1] > 8) { - PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(63)); + PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(SOUND_PAN_TARGET)); sprite->data[1] = 0; sprite->data[0]++; } @@ -5227,7 +5227,7 @@ static void AnimUnusedItemBagSteal(struct Sprite *sprite) case 0: if (gBattleAnimArgs[7] == -1) { - PlaySE12WithPanning(SE_M_VITAL_THROW, BattleAnimAdjustPanning(63)); + PlaySE12WithPanning(SE_M_VITAL_THROW, BattleAnimAdjustPanning(SOUND_PAN_TARGET)); sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 16; sprite->data[0] = -32; sprite->data[7]++; diff --git a/src/battle_anim_electric.c b/src/battle_anim_electric.c index ce1c5b199..6a92fd607 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -1159,7 +1159,7 @@ void AnimTask_ShockWaveProgressingBolt(u8 taskId) task->data[4] = 7; task->data[5] = -1; task->data[11] = 12; - task->data[12] = BattleAnimAdjustPanning(task->data[11] - 76); + task->data[12] = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER); task->data[13] = BattleAnimAdjustPanning(SOUND_PAN_TARGET); task->data[14] = task->data[12]; task->data[15] = (task->data[13] - task->data[12]) / 3; diff --git a/src/battle_anim_psychic.c b/src/battle_anim_psychic.c index aebf76cc0..c68ec5d8a 100644 --- a/src/battle_anim_psychic.c +++ b/src/battle_anim_psychic.c @@ -1137,7 +1137,7 @@ static void AnimPsychoBoost(struct Sprite *sprite) case 1: if (sprite->affineAnimEnded) { - PlaySE12WithPanning(SE_M_TELEPORT, BattleAnimAdjustPanning(-64)); + PlaySE12WithPanning(SE_M_TELEPORT, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER)); ChangeSpriteAffineAnim(sprite, 1); sprite->data[0]++; } diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index e2ea43fb6..287a332b5 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -596,8 +596,8 @@ void AnimTask_Rollout(u8 taskId) task->data[6] = 0; task->data[7] = 0; - pan1 = BattleAnimAdjustPanning(-64); - pan2 = BattleAnimAdjustPanning(63); + pan1 = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER); + pan2 = BattleAnimAdjustPanning(SOUND_PAN_TARGET); task->data[13] = pan1; task->data[14] = (pan2 - pan1) / task->data[8]; diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 688a6e5ae..4071ce9b9 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -535,9 +535,9 @@ static void StatsChangeAnimation_Step2(u8 taskId) gTasks[taskId].func = StatsChangeAnimation_Step3; if (sAnimStatsChangeData->data[0] == 0) - PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(-64)); + PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER)); else - PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(-64)); + PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER)); } static void StatsChangeAnimation_Step3(u8 taskId) From c2d5dd2a1fd85b48c3dec49e89f5a26ed3bc4a44 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 17 Aug 2022 11:44:20 -0400 Subject: [PATCH 2/2] Additional battle anim sync --- data/battle_anim_scripts.s | 20 +++++++++--------- include/battle_anim.h | 2 +- include/battle_interface.h | 11 ++++++---- src/battle_anim_effects_1.c | 6 +++--- src/battle_anim_effects_2.c | 7 ++----- src/battle_anim_effects_3.c | 14 ++++++------- src/battle_anim_electric.c | 2 +- src/battle_anim_fight.c | 4 ++-- src/battle_anim_fire.c | 4 ++-- src/battle_anim_flying.c | 8 +++---- src/battle_anim_ice.c | 32 +++++++++++++++------------- src/battle_anim_mon_movement.c | 37 ++++++++++++--------------------- src/battle_anim_mons.c | 30 +++++++++++++------------- src/battle_anim_psychic.c | 6 ++---- src/battle_anim_sound_tasks.c | 4 ++-- src/battle_anim_throw.c | 14 ++++++------- src/battle_anim_utility_funcs.c | 2 +- 17 files changed, 97 insertions(+), 106 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index eff53de84..8eaff7c07 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -798,14 +798,14 @@ Move_DOUBLE_EDGE: createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, -10, 0, ANIM_TARGET, 0 createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -32, 0, 0, 3 waitforvisualfinish - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 0, 0 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 0 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_ATTACKER, 0 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_TARGET, 0 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 4, 0, 12, 1 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_WHITE waitforvisualfinish - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 0, 1 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 1 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_ATTACKER, 1 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_TARGET, 1 waitforvisualfinish createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 5 delay 3 @@ -2441,7 +2441,7 @@ Move_HORN_ATTACK: Move_FURY_ATTACK: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_HORN_HIT - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 256, 0, 2 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 256, ANIM_ATTACKER, 2 choosetwoturnanim FuryAttackRight, FuryAttackLeft FuryAttackContinue: createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 @@ -2590,7 +2590,7 @@ Move_LOW_KICK: createsprite gSlidingKickSpriteTemplate, ANIM_TARGET, 2, -24, 28, 40, 8, 160, 0 delay 4 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, -8, 8, ANIM_TARGET, 2 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 6, 384, 1, 2 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 6, 384, ANIM_TARGET, 2 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 1, 4 @@ -2835,7 +2835,7 @@ SkullBashSetUpHeadDown: createsprite gSlideMonToOffsetAndBackSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, -24, 0, 0, 10, 0 playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER waitforvisualfinish - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 16, 96, 0, 2 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 16, 96, ANIM_ATTACKER, 2 waitforvisualfinish createsprite gSlideMonToOffsetAndBackSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 24, 0, 0, 10, 1 waitforvisualfinish @@ -3958,7 +3958,7 @@ Move_MIST_BALL: createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 1, 1, RGB(23, 16, 31), 16, RGB_WHITE, 16 delay 0 playsewithpan SE_M_HAZE, 0 - createvisualtask AnimTask_LoadMistTiles, 5 + createvisualtask AnimTask_MistBallFog, 5 createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 3, 0, 16, RGB_WHITE delay 8 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 4, 0, 70, 0 @@ -8570,14 +8570,14 @@ Move_ARM_THRUST: loadspritegfx ANIM_TAG_IMPACT splitbgprio ANIM_TARGET setalpha 12, 8 - createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, 0, 0 + createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, ANIM_ATTACKER, 0 delay 6 createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 3 delay 4 playsewithpan SE_M_SWAGGER, SOUND_PAN_TARGET createsprite gArmThrustHandSpriteTemplate, ANIM_TARGET, 2, 10, -8, 14, 3 waitforvisualfinish - createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, 0, 1 + createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, ANIM_ATTACKER, 1 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET choosetwoturnanim ArmThrustRight, ArmThrustLeft ArmThrustContinue: diff --git a/include/battle_anim.h b/include/battle_anim.h index 5ac512346..0fe0d1898 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -120,7 +120,7 @@ void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode); void SetBattlerSpriteYOffsetFromRotation(u8 spriteId); u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, bool8 attackerPartner, bool8 targetPartner, bool8 anim1, bool8 anim2); u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight); -u8 AnimDummyReturnArg(u8 battler); +u8 GetSpritePalIdxByBattler(u8 battler); s16 CloneBattlerSpriteWithBlend(u8); void DestroySpriteWithActiveSheet(struct Sprite *); u8 CreateInvisibleSpriteCopy(int, u8, int); diff --git a/include/battle_interface.h b/include/battle_interface.h index c4816e8da..ed71b8845 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -34,16 +34,19 @@ enum #define TAG_HEALTHBAR_PLAYER2_TILE 0xD706 #define TAG_HEALTHBAR_OPPONENT2_TILE 0xD707 +#define TAG_HEALTHBOX_PALS_1 0xD709 +#define TAG_HEALTHBOX_PALS_2 0xD70A #define TAG_HEALTHBOX_SAFARI_TILE 0xD70B - #define TAG_STATUS_SUMMARY_BAR_TILE 0xD70C -#define TAG_STATUS_SUMMARY_BALLS_TILE 0xD714 -#define TAG_HEALTHBOX_PAL 0xD6FF -#define TAG_HEALTHBAR_PAL 0xD704 #define TAG_STATUS_SUMMARY_BAR_PAL 0xD710 #define TAG_STATUS_SUMMARY_BALLS_PAL 0xD712 +#define TAG_STATUS_SUMMARY_BALLS_TILE 0xD714 + +#define TAG_HEALTHBAR_PAL TAG_HEALTHBAR_PLAYER1_TILE +#define TAG_HEALTHBOX_PAL TAG_HEALTHBOX_PLAYER1_TILE + enum { HEALTHBOX_ALL, diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 0ae945c0c..757576efa 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -84,7 +84,7 @@ static void AnimMilkBottle(struct Sprite *); static void AnimMilkBottle_Step1(struct Sprite *); static void AnimMilkBottle_Step2(struct Sprite *, int, int); static void AnimGrantingStars(struct Sprite *); -static void AnimSparkingStars(struct Sprite *); +static void AnimSparklingStars(struct Sprite *); static void AnimBubbleBurst(struct Sprite *); static void AnimBubbleBurst_Step(struct Sprite *); static void AnimSleepLetterZ(struct Sprite *); @@ -1416,7 +1416,7 @@ const struct SpriteTemplate gSparklingStarsSpriteTemplate = .anims = gGrantingStarsAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimSparkingStars, + .callback = AnimSparklingStars, }; static const union AnimCmd sAnim_BubbleBurst[] = @@ -4137,7 +4137,7 @@ static void AnimGrantingStars(struct Sprite *sprite) sprite->callback = TranslateSpriteLinearFixedPoint; } -static void AnimSparkingStars(struct Sprite *sprite) +static void AnimSparklingStars(struct Sprite *sprite) { u8 battler; if (!gBattleAnimArgs[2]) diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 82f3b77d5..5bd28acea 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -3043,9 +3043,7 @@ void AnimTask_FreeMusicNotesPals(u8 taskId) static void SetMusicNotePalette(struct Sprite *sprite, u8 a, u8 b) { - u8 tile; - tile = (b & 1); - tile = ((-tile | tile) >> 31) & 32; + u8 tile = (b & 1) ? 32 : 0; sprite->oam.tileNum += tile + (a << 2); sprite->oam.paletteNum = IndexOfSpritePaletteTag(sMusicNotePaletteTagsTable[b >> 1]); } @@ -3792,8 +3790,7 @@ static void AnimPerishSongMusicNote_Step2(struct Sprite *sprite) if (sprite->data[4] > 3) { - int var1 = sprite->data[2]; - sprite->invisible = var1 - (((s32)(var1 + ((u32)var1 >> 31)) >> 1) << 1); + sprite->invisible = sprite->data[2] % 2; DestroyAnimSprite(sprite); } diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index f613ff597..c0f400a55 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -2107,7 +2107,7 @@ static void AnimWishStar(struct Sprite *sprite) if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) sprite->x = -16; else - sprite->x = 256; + sprite->x = DISPLAY_WIDTH + 16; sprite->y = 0; sprite->callback = AnimWishStar_Step; @@ -2136,7 +2136,7 @@ static void AnimWishStar_Step(struct Sprite *sprite) } newX = sprite->x + sprite->x2 + 32; - if (newX > 304) + if (newX > DISPLAY_WIDTH + 64) DestroyAnimSprite(sprite); } @@ -3183,7 +3183,7 @@ static void AnimReversalOrb_Step(struct Sprite *sprite) // Copies the target mon's sprite, and makes a white silhouette that shrinks away. void AnimTask_RolePlaySilhouette(u8 taskId) { - u8 isBackPic; + bool8 isBackPic; u32 personality; u32 otId; u16 species; @@ -3206,7 +3206,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId) { if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) { - isBackPic = 0; + isBackPic = FALSE; personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY); otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID); if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE) @@ -3226,7 +3226,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId) } else { - isBackPic = 1; + isBackPic = TRUE; personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY); otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID); if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE) @@ -5097,7 +5097,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId) gTasks[taskId].data[1] &= 0xFF; x = gSprites[spriteId].x + gSprites[spriteId].x2; - if ((u16)(x + 32) > 304) + if (x < -32 || x > DISPLAY_WIDTH + 32) { gTasks[taskId].data[1] = 0; gTasks[taskId].data[0]++; @@ -5180,7 +5180,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId) } } - if ((u16)(x + 32) > 304) + if (x < -32 || x > DISPLAY_WIDTH + 32) { gTasks[taskId].data[1] = 0; gTasks[taskId].data[0]++; diff --git a/src/battle_anim_electric.c b/src/battle_anim_electric.c index 6a92fd607..b6a82b8d9 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -583,7 +583,7 @@ static void AnimZapCannonSpark(struct Sprite *sprite) sprite->data[7] = gBattleAnimArgs[4]; sprite->oam.tileNum += gBattleAnimArgs[6] * 4; sprite->callback = AnimZapCannonSpark_Step; - AnimZapCannonSpark_Step(sprite); + sprite->callback(sprite); } static void AnimZapCannonSpark_Step(struct Sprite *sprite) diff --git a/src/battle_anim_fight.c b/src/battle_anim_fight.c index dc668e6ff..0d7b977e9 100644 --- a/src/battle_anim_fight.c +++ b/src/battle_anim_fight.c @@ -500,7 +500,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[1]; sprite->data[7] = CreateSprite(&gBasicHitSplatSpriteTemplate, sprite->x, sprite->y, sprite->subpriority + 1); - if (sprite->data[7] != 64) + if (sprite->data[7] != MAX_SPRITES) { StartSpriteAffineAnim(&gSprites[sprite->data[7]], 0); gSprites[sprite->data[7]].callback = SpriteCallbackDummy; @@ -513,7 +513,7 @@ static void AnimFistOrFootRandomPos_Step(struct Sprite *sprite) { if (sprite->data[0] == 0) { - if (sprite->data[7] != 64) + if (sprite->data[7] != MAX_SPRITES) { FreeOamMatrix(gSprites[sprite->data[7]].oam.matrixNum); DestroySprite(&gSprites[sprite->data[7]]); diff --git a/src/battle_anim_fire.c b/src/battle_anim_fire.c index cbfe21c60..72d802f19 100644 --- a/src/battle_anim_fire.c +++ b/src/battle_anim_fire.c @@ -1227,8 +1227,8 @@ void AnimTask_MoveHeatWaveTargets(u8 taskId) { struct Task *task = &gTasks[taskId]; - task->data[12] = !GetBattlerSide(gBattleAnimAttacker) ? 1 : -1; - task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ 2) + 1; + task->data[12] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1; + task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ BIT_FLANK) + 1; task->data[14] = GetAnimBattlerSpriteId(ANIM_TARGET); task->data[15] = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER); diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 59474eae3..8609a8e17 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -528,8 +528,8 @@ static void AnimFlyBallAttack_Step(struct Sprite *sprite) } if (sprite->x + sprite->x2 < -32 - || sprite->x + sprite->x2 > DISPLAY_WIDTH + 32 - || sprite->y + sprite->y2 > DISPLAY_HEIGHT) + || sprite->x + sprite->x2 > DISPLAY_WIDTH + 32 + || sprite->y + sprite->y2 > DISPLAY_HEIGHT) { gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = FALSE; DestroyAnimSprite(sprite); @@ -1215,8 +1215,8 @@ void AnimSkyAttackBird_Step(struct Sprite *sprite) sprite->x = sprite->data[4] >> 4; sprite->y = sprite->data[5] >> 4; - if (sprite->x > 285 || sprite->x < -45 - || sprite->y > 157 || sprite->y < -45) + if (sprite->x > DISPLAY_WIDTH + 45 || sprite->x < -45 + || sprite->y > 157 || sprite->y < -45) DestroySpriteAndMatrix(sprite); } diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index 6a0ff1154..433a7daf0 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -45,7 +45,7 @@ static void AnimThrowIceBall(struct Sprite *); static void InitIceBallParticle(struct Sprite *); static void AnimIceBallParticle(struct Sprite *); static void AnimTask_HazeScrollingFog_Step(u8); -static void AnimTask_LoadMistTiles_Step(u8); +static void AnimTask_MistBallFog_Step(u8); static void AnimTask_Hail2(u8); static bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId, u8 c); @@ -353,7 +353,7 @@ const struct SpriteTemplate gMistBallSpriteTemplate = .callback = AnimThrowMistBall, }; -static const u8 wMistBlendAmounts[] = +static const u8 sMistBlendAmounts[] = { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, }; @@ -696,7 +696,8 @@ static void AnimSwirlingSnowball(struct Sprite *sprite) sprite->data[0] = 1; AnimFastTranslateLinear(sprite); - if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32 + if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16 + || sprite->x + sprite->x2 < -16 || sprite->y + sprite->y2 > DISPLAY_HEIGHT || sprite->y + sprite->y2 < -16) break; @@ -762,7 +763,8 @@ static void AnimSwirlingSnowball_End(struct Sprite *sprite) sprite->data[0] = 1; AnimFastTranslateLinear(sprite); - if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32 + if (sprite->x + sprite->x2 > 256 + || sprite->x + sprite->x2 < -16 || sprite->y + sprite->y2 > 256 || sprite->y + sprite->y2 < -16) DestroyAnimSprite(sprite); @@ -816,7 +818,8 @@ static void AnimMoveParticleBeyondTarget(struct Sprite *sprite) { sprite->data[0] = 1; AnimFastTranslateLinear(sprite); - if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32 + if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16 + || sprite->x + sprite->x2 < -16 || sprite->y + sprite->y2 > DISPLAY_HEIGHT || sprite->y + sprite->y2 < -16) break; @@ -846,7 +849,8 @@ static void AnimWiggleParticleTowardsTarget(struct Sprite *sprite) sprite->data[7] = (sprite->data[7] + sprite->data[6]) & 0xFF; if (sprite->data[0] == 1) { - if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32 + if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16 + || sprite->x + sprite->x2 < -16 || sprite->y + sprite->y2 > DISPLAY_HEIGHT || sprite->y + sprite->y2 < -16) DestroyAnimSprite(sprite); @@ -1086,7 +1090,7 @@ static void AnimThrowMistBall(struct Sprite *sprite) } // Displays misty background in Mist Ball. -void AnimTask_LoadMistTiles(u8 taskId) +void AnimTask_MistBallFog(u8 taskId) { struct BattleAnimBgData animBg; @@ -1109,10 +1113,10 @@ void AnimTask_LoadMistTiles(u8 taskId) LoadPalette(&gFogPalette, animBg.paletteId * 16, 32); gTasks[taskId].data[15] = -1; - gTasks[taskId].func = AnimTask_LoadMistTiles_Step; + gTasks[taskId].func = AnimTask_MistBallFog_Step; } -static void AnimTask_LoadMistTiles_Step(u8 taskId) +static void AnimTask_MistBallFog_Step(u8 taskId) { struct BattleAnimBgData animBg; @@ -1123,7 +1127,7 @@ static void AnimTask_LoadMistTiles_Step(u8 taskId) { case 0: gTasks[taskId].data[9] += 1; - gTasks[taskId].data[11] = wMistBlendAmounts[gTasks[taskId].data[9]]; + gTasks[taskId].data[11] = sMistBlendAmounts[gTasks[taskId].data[9]]; SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 17 - gTasks[taskId].data[11])); if (gTasks[taskId].data[11] == 5) { @@ -1410,14 +1414,14 @@ static bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId, } else { - battlerX = (sHailCoordData[hailStructId].x); - battlerY = (sHailCoordData[hailStructId].y); + battlerX = sHailCoordData[hailStructId].x; + battlerY = sHailCoordData[hailStructId].y; } } else { - battlerX = (sHailCoordData[hailStructId].x); - battlerY = (sHailCoordData[hailStructId].y); + battlerX = sHailCoordData[hailStructId].x; + battlerY = sHailCoordData[hailStructId].y; } spriteX = battlerX - ((battlerY + 8) / 2); id = CreateSprite(&gHailParticleSpriteTemplate, spriteX, -8, 18); diff --git a/src/battle_anim_mon_movement.c b/src/battle_anim_mon_movement.c index 77e50c9a4..09393a2a7 100644 --- a/src/battle_anim_mon_movement.c +++ b/src/battle_anim_mon_movement.c @@ -5,7 +5,6 @@ #include "task.h" #include "trig.h" -// This file's functions. static void AnimTask_ShakeMon_Step(u8 taskId); static void AnimTask_ShakeMon2_Step(u8 taskId); static void AnimTask_ShakeMonInPlace_Step(u8 taskId); @@ -108,7 +107,7 @@ void AnimTask_ShakeMon(u8 taskId) gTasks[taskId].data[4] = gBattleAnimArgs[1]; gTasks[taskId].data[5] = gBattleAnimArgs[2]; gTasks[taskId].func = AnimTask_ShakeMon_Step; - AnimTask_ShakeMon_Step(taskId); + gTasks[taskId].func(taskId); } static void AnimTask_ShakeMon_Step(u8 taskId) @@ -156,17 +155,14 @@ static void AnimTask_ShakeMon_Step(u8 taskId) void AnimTask_ShakeMon2(u8 taskId) { u8 spriteId; - bool8 destroy = FALSE; + bool8 abort = FALSE; u8 battlerId; if (gBattleAnimArgs[0] < MAX_BATTLERS_COUNT) { spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); if (spriteId == SPRITE_NONE) - { - DestroyAnimVisualTask(taskId); - return; - } + abort = TRUE; } else if (gBattleAnimArgs[0] != 8) { @@ -188,7 +184,7 @@ void AnimTask_ShakeMon2(u8 taskId) } if (IsBattlerSpriteVisible(battlerId) == FALSE) - destroy = TRUE; + abort = TRUE; spriteId = gBattlerSpriteIds[battlerId]; } @@ -197,7 +193,7 @@ void AnimTask_ShakeMon2(u8 taskId) spriteId = gBattlerSpriteIds[gBattleAnimAttacker]; } - if (destroy) + if (abort) { DestroyAnimVisualTask(taskId); return; @@ -332,10 +328,8 @@ void AnimTask_ShakeAndSinkMon(u8 taskId) static void AnimTask_ShakeAndSinkMon_Step(u8 taskId) { - s16 x; - u8 spriteId; - spriteId = gTasks[taskId].data[0]; - x = gTasks[taskId].data[1]; + u8 spriteId = gTasks[taskId].data[0]; + s16 x = gTasks[taskId].data[1]; if (gTasks[taskId].data[2] == gTasks[taskId].data[8]++) { gTasks[taskId].data[8] = 0; @@ -365,11 +359,8 @@ static void AnimTask_ShakeAndSinkMon_Step(u8 taskId) void AnimTask_TranslateMonElliptical(u8 taskId) { u8 i; - u8 spriteId; - u8 wavePeriod; - - wavePeriod = 1; - spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + u8 wavePeriod = 1; + u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); if (gBattleAnimArgs[4] > 5) gBattleAnimArgs[4] = 5; @@ -742,7 +733,7 @@ static void AnimTask_SlideOffScreen_Step(u8 taskId) { u8 spriteId = gTasks[taskId].data[0]; gSprites[spriteId].x2 += gTasks[taskId].data[1]; - if (gSprites[spriteId].x2 + gSprites[spriteId].x + 0x20 > 0x130u) + if (gSprites[spriteId].x2 + gSprites[spriteId].x < -32 || gSprites[spriteId].x2 + gSprites[spriteId].x > DISPLAY_WIDTH + 32) { DestroyAnimVisualTask(taskId); return; @@ -831,8 +822,7 @@ static void AnimTask_SwayMonStep(u8 taskId) // arg 4: sprite object mode void AnimTask_ScaleMonAndRestore(u8 taskId) { - u8 spriteId; - spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]); + u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]); PrepareBattlerSpriteForRotScale(spriteId, gBattleAnimArgs[4]); gTasks[taskId].data[0] = gBattleAnimArgs[0]; gTasks[taskId].data[1] = gBattleAnimArgs[1]; @@ -893,7 +883,7 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId) } else { - if (gBattleAnimArgs[2] == 0) + if (gBattleAnimArgs[2] == ANIM_ATTACKER) { gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimAttacker); } @@ -916,8 +906,7 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId) // Rotates mon to side and back to original position. For Peck and when a held item activates void AnimTask_RotateMonToSideAndRestore(u8 taskId) { - u8 spriteId; - spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); + u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL); gTasks[taskId].data[1] = 0; gTasks[taskId].data[2] = gBattleAnimArgs[0]; diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 05b0daf3f..4ce33251a 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -81,7 +81,7 @@ static const u8 sCastformBackSpriteYCoords[NUM_CASTFORM_FORMS] = #define TAG_MOVE_EFFECT_MON_1 55125 #define TAG_MOVE_EFFECT_MON_2 55126 -static const struct SpriteTemplate sSpriteTemplate_MoveEffectMons[] = +static const struct SpriteTemplate sSpriteTemplates_MoveEffectMons[] = { { .tileTag = TAG_MOVE_EFFECT_MON_1, @@ -103,7 +103,7 @@ static const struct SpriteTemplate sSpriteTemplate_MoveEffectMons[] = } }; -static const struct SpriteSheet sSpriteSheet_MoveEffectMons[] = +static const struct SpriteSheet sSpriteSheets_MoveEffectMons[] = { { gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_1, }, { gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_2, }, @@ -440,7 +440,7 @@ void SetCallbackToStoredInData6(struct Sprite *sprite) #define sAmplitudeX sAmplitude #define sAmplitudeY data[4] -// TranslateSpriteInWavePattern +// TranslateSpriteInLissajousCurve #define sCirclePosX sCirclePos #define sCircleSpeedX sCircleSpeed #define sCirclePosY data[4] @@ -487,7 +487,7 @@ void TranslateSpriteInGrowingCircle(struct Sprite *sprite) // Unused // Exact shape depends on arguments. Can move in a figure-8-like pattern, or circular, etc. -static void TranslateSpriteInWavePattern(struct Sprite *sprite) +static void TranslateSpriteInLissajousCurve(struct Sprite *sprite) { if (sprite->sDuration) { @@ -1508,13 +1508,13 @@ u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLef return selectedPalettes; } -// Presumably something commented here, just returns arg -u8 AnimDummyReturnArg(u8 battler) +u8 GetSpritePalIdxByBattler(u8 battler) { return battler; } -static u8 GetBattlerAtPosition_(u8 position) +// Unused +static u8 GetSpritePalIdxByPosition(u8 position) { return GetBattlerAtPosition(position); } @@ -1552,20 +1552,20 @@ void AnimSpriteOnMonPos(struct Sprite *sprite) // arg 5: lower 8 bits = location on attacking mon, upper 8 bits = location on target mon pick to target void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite) { - bool8 v1; + bool8 respectMonPicOffsets; u8 coordType; if (!(gBattleAnimArgs[5] & 0xff00)) - v1 = TRUE; + respectMonPicOffsets = TRUE; else - v1 = FALSE; + respectMonPicOffsets = FALSE; if (!(gBattleAnimArgs[5] & 0xff)) coordType = BATTLER_COORD_Y_PIC_OFFSET; else coordType = BATTLER_COORD_Y; - InitSpritePosToAnimAttacker(sprite, v1); + InitSpritePosToAnimAttacker(sprite, respectMonPicOffsets); if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) gBattleAnimArgs[2] = -gBattleAnimArgs[2]; @@ -2097,8 +2097,8 @@ u8 GetBattlerSpriteBGPriorityRank(u8 battlerId) u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm) { u8 spriteId; - u16 sheet = LoadSpriteSheet(&sSpriteSheet_MoveEffectMons[id]); - u16 palette = AllocSpritePalette(sSpriteTemplate_MoveEffectMons[id].paletteTag); + u16 sheet = LoadSpriteSheet(&sSpriteSheets_MoveEffectMons[id]); + u16 palette = AllocSpritePalette(sSpriteTemplates_MoveEffectMons[id].paletteTag); if (gMonSpritesGfxPtr != NULL && gMonSpritesGfxPtr->buffer == NULL) gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000); @@ -2139,9 +2139,9 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer); if (!isBackpic) - spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonFrontPicCoords[species].y_offset, subpriority); + spriteId = CreateSprite(&sSpriteTemplates_MoveEffectMons[id], x, y + gMonFrontPicCoords[species].y_offset, subpriority); else - spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonBackPicCoords[species].y_offset, subpriority); + spriteId = CreateSprite(&sSpriteTemplates_MoveEffectMons[id], x, y + gMonBackPicCoords[species].y_offset, subpriority); if (IsContest()) { diff --git a/src/battle_anim_psychic.c b/src/battle_anim_psychic.c index c68ec5d8a..976682821 100644 --- a/src/battle_anim_psychic.c +++ b/src/battle_anim_psychic.c @@ -818,7 +818,7 @@ static void AnimTask_ImprisonOrbs_Step(u8 taskId) { for (i = 8; i < 13; i++) { - if (task->data[i] != 64) + if (task->data[i] != MAX_SPRITES) DestroySprite(&gSprites[task->data[i]]); } @@ -997,12 +997,10 @@ void AnimTask_ExtrasensoryDistortion(u8 taskId) scanlineParams.dmaDest = ®_BG2HOFS; } - i = task->data[14]; - while (i <= task->data[14] + 64) + for (i = task->data[14]; i <= task->data[14] + 64; i++) { gScanlineEffectRegBuffers[0][i] = task->data[10]; gScanlineEffectRegBuffers[1][i] = task->data[10]; - i++; } scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT; diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c index f329ea210..1fde3a982 100644 --- a/src/battle_anim_sound_tasks.c +++ b/src/battle_anim_sound_tasks.c @@ -100,7 +100,7 @@ void SoundTask_LoopSEAdjustPanning(u8 taskId) gTasks[taskId].data[12] = r9; gTasks[taskId].func = SoundTask_LoopSEAdjustPanning_Step; - SoundTask_LoopSEAdjustPanning_Step(taskId); + gTasks[taskId].func(taskId); } static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId) @@ -385,7 +385,7 @@ void SoundTask_AdjustPanningVar(u8 taskId) gTasks[taskId].data[11] = sourcePan; gTasks[taskId].func = SoundTask_AdjustPanningVar_Step; - SoundTask_AdjustPanningVar_Step(taskId); + gTasks[taskId].func(taskId); } static void SoundTask_AdjustPanningVar_Step(u8 taskId) diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index b02995142..d81b532c5 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -550,8 +550,8 @@ static void LoadHealthboxPalsForLevelUp(u8 *paletteId1, u8 *paletteId2, u8 battl healthBoxSpriteId = gHealthboxSpriteIds[battler]; spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam; spriteId2 = gSprites[healthBoxSpriteId].data[5]; - *paletteId1 = AllocSpritePalette(0xD709); - *paletteId2 = AllocSpritePalette(0xD70A); + *paletteId1 = AllocSpritePalette(TAG_HEALTHBOX_PALS_1); + *paletteId2 = AllocSpritePalette(TAG_HEALTHBOX_PALS_2); offset1 = (gSprites[healthBoxSpriteId].oam.paletteNum * 16) + 0x100; offset2 = (gSprites[spriteId2].oam.paletteNum * 16) + 0x100; @@ -580,10 +580,10 @@ static void FreeHealthboxPalsForLevelUp(u8 battler) spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam; spriteId2 = gSprites[healthBoxSpriteId].data[5]; - FreeSpritePaletteByTag(0xD709); - FreeSpritePaletteByTag(0xD70A); - paletteId1 = IndexOfSpritePaletteTag(0xD6FF); - paletteId2 = IndexOfSpritePaletteTag(0xD704); + FreeSpritePaletteByTag(TAG_HEALTHBOX_PALS_1); + FreeSpritePaletteByTag(TAG_HEALTHBOX_PALS_2); + paletteId1 = IndexOfSpritePaletteTag(TAG_HEALTHBOX_PAL); + paletteId2 = IndexOfSpritePaletteTag(TAG_HEALTHBAR_PAL); gSprites[healthBoxSpriteId].oam.paletteNum = paletteId1; gSprites[spriteId1].oam.paletteNum = paletteId1; gSprites[spriteId2].oam.paletteNum = paletteId2; @@ -611,7 +611,7 @@ static void AnimTask_FlashHealthboxOnLevelUp_Step(u8 taskId) if (gTasks[taskId].data[0]++ >= gTasks[taskId].data[11]) { gTasks[taskId].data[0] = 0; - paletteNum = IndexOfSpritePaletteTag(0xD709); + paletteNum = IndexOfSpritePaletteTag(TAG_HEALTHBOX_PALS_1); colorOffset = gTasks[taskId].data[10] == 0 ? 6 : 2; switch (gTasks[taskId].data[1]) { diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 4071ce9b9..403939f88 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -97,7 +97,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId) for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++) { if (battler != animBattlers[0] && battler != animBattlers[1] && IsBattlerSpriteVisible(battler)) - selectedPalettes |= 0x10000 << AnimDummyReturnArg(battler); + selectedPalettes |= 0x10000 << GetSpritePalIdxByBattler(battler); } StartBlendAnimSpriteColor(taskId, selectedPalettes);