From 975c0ce1d0742fcc5f3605386537c1e0ee43ec9c Mon Sep 17 00:00:00 2001 From: Sewef Date: Mon, 14 Oct 2019 23:27:12 +0200 Subject: [PATCH] Label battle_anim_effects_1 --- data/battle_anim_scripts.s | 12 +++---- src/battle_anim_effects_1.c | 72 ++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 8933ff7510..ef6521c573 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -2549,7 +2549,7 @@ Move_THRASH: Move_SING: loadspritegfx ANIM_TAG_MUSIC_NOTES monbg ANIM_DEF_PARTNER - createvisualtask sub_8102BE8, 2 + createvisualtask AnimTask_MusicNotesRainbowBlend, 2 waitforvisualfinish panse_1B SE_W047, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 createsprite gWavingMusicNotesSpriteTemplate, ANIM_TARGET, 2, 7, 0, 12 @@ -2578,7 +2578,7 @@ Move_SING: delay 4 waitforvisualfinish clearmonbg ANIM_DEF_PARTNER - createvisualtask sub_8102CA0, 2 + createvisualtask AnimTask_MusicNotesClearRainbowBlend, 2 waitforvisualfinish end @@ -4229,7 +4229,7 @@ Move_GRASS_WHISTLE: loadspritegfx ANIM_TAG_MUSIC_NOTES createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 4, RGB(18, 31, 12) waitforvisualfinish - createvisualtask sub_8102BE8, 2 + createvisualtask AnimTask_MusicNotesRainbowBlend, 2 waitforvisualfinish panse_1B SE_W320, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 createsprite gWavingMusicNotesSpriteTemplate, ANIM_TARGET, 2, 7, 1, 0 @@ -4257,7 +4257,7 @@ Move_GRASS_WHISTLE: createsprite gWavingMusicNotesSpriteTemplate, ANIM_TARGET, 2, 5, 1, 0 delay 4 waitforvisualfinish - createvisualtask sub_8102CA0, 2 + createvisualtask AnimTask_MusicNotesClearRainbowBlend, 2 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 4, 0, RGB(18, 31, 12) waitforvisualfinish end @@ -4577,7 +4577,7 @@ Move_HARDEN: Move_BELLY_DRUM: loadspritegfx ANIM_TAG_MUSIC_NOTES loadspritegfx ANIM_TAG_PURPLE_HAND_OUTLINE - createvisualtask sub_8102BE8, 2 + createvisualtask AnimTask_MusicNotesRainbowBlend, 2 waitforvisualfinish call BellyDrum1 createsprite gSlowFlyingMusicNotesSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 0, 0 @@ -4603,7 +4603,7 @@ Move_BELLY_DRUM: createsprite gSlowFlyingMusicNotesSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 3, 0 playsewithpan SE_W187, SOUND_PAN_ATTACKER waitforvisualfinish - createvisualtask sub_8102CA0, 2 + createvisualtask AnimTask_MusicNotesClearRainbowBlend, 2 waitforvisualfinish end diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 0c1e2dca4b..67b996feb9 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -44,7 +44,7 @@ void AnimTrickBag(struct Sprite *); void AnimFlyingParticle(struct Sprite *); void AnimNeedleArmSpike(struct Sprite *); void sub_81009F8(struct Sprite *); -void sub_8100A50(struct Sprite *); +void AnimWhipHit(struct Sprite *); void sub_8100A94(struct Sprite *); void AnimCuttingSlice(struct Sprite *); void AnimAirCutterSlice(struct Sprite *); @@ -93,8 +93,8 @@ static void AnimTranslateLinearSingleSineWaveStep(struct Sprite *); static void AnimMoveTwisterParticleStep(struct Sprite *); static void AnimConstrictBindingStep1(struct Sprite *); static void AnimConstrictBindingStep2(struct Sprite *); -static void AnimTask_ShrinkMonSpriteToPosStep1(u8); -static void AnimTask_ShrinkMonSpriteToPosStep2(u8); +static void AnimTask_DuplicateAndShrinkToPosStep1(u8); +static void AnimTask_DuplicateAndShrinkToPosStep2(u8); static void AnimItemStealStep(struct Sprite *); static void AnimRootFlickerOut(struct Sprite *); static void AnimTrickBagStep1(struct Sprite *); @@ -1091,7 +1091,7 @@ const struct SpriteTemplate gSlamHitSpriteTemplate = .anims = gWhipAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100A50, + .callback = AnimWhipHit, }; const struct SpriteTemplate gVineWhipSpriteTemplate = @@ -1102,7 +1102,7 @@ const struct SpriteTemplate gVineWhipSpriteTemplate = .anims = gWhipAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100A50, + .callback = AnimWhipHit, }; const union AnimCmd gUnknown_08592900[] = @@ -2810,11 +2810,11 @@ void sub_80FF458(u8 taskId) gTasks[taskId].data[0] = gBattleAnimArgs[0]; gTasks[taskId].data[1] = gBattleAnimArgs[1]; gTasks[taskId].data[11] = 0x100; - gTasks[taskId].func = AnimTask_ShrinkMonSpriteToPosStep1; + gTasks[taskId].func = AnimTask_DuplicateAndShrinkToPosStep1; } } -static void AnimTask_ShrinkMonSpriteToPosStep1(u8 taskId) +static void AnimTask_DuplicateAndShrinkToPosStep1(u8 taskId) { u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET); gTasks[taskId].data[10] += gTasks[taskId].data[0]; @@ -2828,11 +2828,11 @@ static void AnimTask_ShrinkMonSpriteToPosStep1(u8 taskId) if (--gTasks[taskId].data[1] == 0) { gTasks[taskId].data[0] = 0; - gTasks[taskId].func = AnimTask_ShrinkMonSpriteToPosStep2; + gTasks[taskId].func = AnimTask_DuplicateAndShrinkToPosStep2; } } -static void AnimTask_ShrinkMonSpriteToPosStep2(u8 taskId) +static void AnimTask_DuplicateAndShrinkToPosStep2(u8 taskId) { if ((u16)gBattleAnimArgs[7] == 0xFFFF) { @@ -2988,34 +2988,34 @@ static void sub_80FF9B8(struct Sprite* sprite, s16 c) sprite->data[7] = c; } -bool8 sub_80FF9E0(struct Sprite* sprite) +bool8 moveAlongLinearPath(struct Sprite* sprite) { - u16 r10 = (u8)(sprite->data[5] >> 8); - u16 r9 = (u8)sprite->data[5]; - s32 r2 = (u8)(sprite->data[6] >> 8); - s32 r4 = (u8)sprite->data[6]; - s16 r6 = sprite->data[7] >> 8; - s16 r3 = sprite->data[7] & 0xFF; - s16 r4_2; + u16 xStartPos = (u8)(sprite->data[5] >> 8); + u16 yStartPos = (u8)sprite->data[5]; + s32 xEndPos = (u8)(sprite->data[6] >> 8); + s32 yEndPos = (u8)sprite->data[6]; + s16 totalTime = sprite->data[7] >> 8; + s16 currentTime = sprite->data[7] & 0xFF; + s16 yEndPos_2; s16 r0; s32 var1; - s32 var2; + s32 vaxEndPos; - if (r2 == 0) - r2 = -32; - else if (r2 == 255) - r2 = 272; + if (xEndPos == 0) + xEndPos = -32; + else if (xEndPos == 255) + xEndPos = 272; - r4_2 = r4 - r9; - r0 = r2 - r10; - var1 = r0 * r3 / r6; - var2 = r4_2 * r3 / r6; - sprite->pos1.x = var1 + r10; - sprite->pos1.y = var2 + r9; - if (++r3 == r6) + yEndPos_2 = yEndPos - yStartPos; + r0 = xEndPos - xStartPos; + var1 = r0 * currentTime / totalTime; + vaxEndPos = yEndPos_2 * currentTime / totalTime; + sprite->pos1.x = var1 + xStartPos; + sprite->pos1.y = vaxEndPos + yStartPos; + if (++currentTime == totalTime) return TRUE; - sprite->data[7] = (r6 << 8) | r3; + sprite->data[7] = (totalTime << 8) | currentTime; return FALSE; } @@ -3039,7 +3039,7 @@ static void sub_80FFAB4(struct Sprite* sprite) } sprite->pos2.y = Sin(sprite->data[0] + 128, 30 - sprite->data[1] * 8); - if (sub_80FF9E0(sprite)) + if (moveAlongLinearPath(sprite)) { sprite->pos2.y = 0; sprite->data[0] = 0; @@ -3085,7 +3085,7 @@ static void sub_80FFB90(struct Sprite* sprite) } sprite->pos2.y = Sin(sprite->data[0] + 0x80, 30 - sprite->data[1] * 8); - if (sub_80FF9E0(sprite)) + if (moveAlongLinearPath(sprite)) { sprite->pos2.y = zero; sprite->data[0] = zero; @@ -3179,7 +3179,7 @@ static void AnimItemStealStep(struct Sprite* sprite) if (sprite->pos2.y == 0) PlaySE12WithPanning(SE_W145B, BattleAnimAdjustPanning(63)); - if (sub_80FF9E0(sprite)) + if (moveAlongLinearPath(sprite)) { sprite->pos2.y = 0; sprite->data[0] = 0; @@ -3753,7 +3753,7 @@ void sub_81009F8(struct Sprite* sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } -void sub_8100A50(struct Sprite* sprite) +void AnimWhipHit(struct Sprite* sprite) { if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) StartSpriteAnim(sprite, 1); @@ -5237,7 +5237,7 @@ void AnimSuperFang(struct Sprite* sprite) sprite->callback = RunStoredCallbackWhenAnimEnds; } -void sub_8102BE8(u8 taskId) +void AnimTask_MusicNotesRainbowBlend(u8 taskId) { u16 i; u16 j; @@ -5265,7 +5265,7 @@ void sub_8102BE8(u8 taskId) } // clears the rainbow effect for musical notes. -void sub_8102CA0(u8 taskId) +void AnimTask_MusicNotesClearRainbowBlend(u8 taskId) { u16 i; for (i = 1; i < ARRAY_COUNT(gParticlesColorBlendTable); i++)