From 2b5f4b7f934f7d83ab5fa4ca30fd7c1ede1f611e Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Tue, 2 Jan 2024 17:46:07 -0500 Subject: [PATCH] fix genie storm move anims for both targets, add AnimEllipticalGustCentered, AnimParticleInVortex handles multiple targets, add dynamic pals based on move target in UnpackSelectedBattlePalettes (#3895) Co-authored-by: ghoulslash --- data/battle_anim_scripts.s | 122 +++++++++++++++++++------------------ include/battle_anim.h | 1 + src/battle_anim_flying.c | 21 +++++++ src/battle_anim_new.c | 2 +- src/battle_anim_normal.c | 17 ++++++ src/battle_anim_rock.c | 6 +- 6 files changed, 104 insertions(+), 65 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 88a142eada44..18b5684e592b 100755 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -7014,6 +7014,10 @@ HurricaneGust: createsprite gEllipticalGustSpriteTemplate, ANIM_ATTACKER, 2, 0, -16 createvisualtask AnimTask_AnimateGustTornadoPalette, 5, 1, 70 return +HurricaneGustCentered: + createsprite gEllipticalGustCenteredSpriteTemplate, ANIM_ATTACKER, 2, 0, -16 + createvisualtask AnimTask_AnimateGustTornadoPalette, 5, 1, 70 + return Move_HEAD_CHARGE: loadspritegfx ANIM_TAG_IMPACT @@ -15904,36 +15908,36 @@ Move_SPRINGTIDE_STORM:: loadspritegfx ANIM_TAG_GUST loadspritegfx ANIM_TAG_RED_HEART playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 88, 1 - createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 6, 0, 11, RGB(31, 22, 30) - call HurricaneGust + createvisualtaskontargets AnimTask_ShakeMon2, 2, 0, ANIM_TARGET, 0, 4, 0x58, 1 + createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_TARGET, 0x2, 0x6, 0x0, 0xB, 0x7ADF + call HurricaneGustCentered call SpringtideStormHeartSwirl - call HurricaneGust + call HurricaneGustCentered call SpringtideStormHeartSwirl - call HurricaneGust + call HurricaneGustCentered call SpringtideStormHeartSwirl - call HurricaneGust + call HurricaneGustCentered call SpringtideStormHeartSwirl - call HurricaneGust + call HurricaneGustCentered call SpringtideStormHeartSwirl - call HurricaneGust + call HurricaneGustCentered call SpringtideStormHeartSwirl waitforvisualfinish stopsound end SpringtideStormHeartSwirl: - createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x20, 0x210, 0x1e, 0xa, 0x32, ANIM_TARGET + createspriteontargets gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 6, 0x0, 0x20, 0x210, 0x1e, 0xa, 0x32, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x24, 0x1e0, 0x14, 0xd, 0xffd2, ANIM_TARGET + createspriteontargets gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 6, 0x0, 0x24, 0x1e0, 0x14, 0xd, 0xffd2, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x25, 0x240, 0x14, 0x5, 0x2a, ANIM_TARGET + createspriteontargets gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 6, 0x0, 0x25, 0x240, 0x14, 0x5, 0x2a, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x23, 0x190, 0x19, 0x8, 0xffd6, ANIM_TARGET + createspriteontargets gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 6, 0x0, 0x23, 0x190, 0x19, 0x8, 0xffd6, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x20, 0x200, 0x19, 0xd, 0x2e, ANIM_TARGET + createspriteontargets gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 6, 0x0, 0x20, 0x200, 0x19, 0xd, 0x2e, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x25, 0x1d0, 0x1e, 0xc, 0xffce, ANIM_TARGET + createspriteontargets gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 6, 0x0, 0x25, 0x1d0, 0x1e, 0xc, 0xffce, ANIM_TARGET return @@ -16474,37 +16478,37 @@ Move_BLEAKWIND_STORM:: loadspritegfx ANIM_TAG_GUST loadspritegfx ANIM_TAG_ICE_CRYSTALS playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 88, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x7FFF - call HurricaneGust + createvisualtaskontargets AnimTask_ShakeMon2, 2, 0, ANIM_TARGET, 0, 4, 0x58, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x7FFF + call HurricaneGustCentered call BleakwindStormIceSwirl - call HurricaneGust + call HurricaneGustCentered call BleakwindStormIceSwirl - call HurricaneGust + call HurricaneGustCentered call BleakwindStormIceSwirl - call HurricaneGust + call HurricaneGustCentered call BleakwindStormIceSwirl - call HurricaneGust + call HurricaneGustCentered call BleakwindStormIceSwirl - call HurricaneGust + call HurricaneGustCentered call BleakwindStormIceSwirl waitforvisualfinish stopsound - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x7FFF + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x7FFF waitforvisualfinish end BleakwindStormIceSwirl: - createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x20, 0x210, 0x1e, 0xa, 0x32, ANIM_TARGET + createspriteontargets gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 6, 0x0, 0x20, 0x210, 0x1e, 0xa, 0x32, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x24, 0x1e0, 0x14, 0xd, 0xffd2, ANIM_TARGET + createspriteontargets gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 6, 0x0, 0x24, 0x1e0, 0x14, 0xd, 0xffd2, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x25, 0x240, 0x14, 0x5, 0x2a, ANIM_TARGET + createspriteontargets gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 6, 0x0, 0x25, 0x240, 0x14, 0x5, 0x2a, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x23, 0x190, 0x19, 0x8, 0xffd6, ANIM_TARGET + createspriteontargets gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 6, 0x0, 0x23, 0x190, 0x19, 0x8, 0xffd6, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x20, 0x200, 0x19, 0xd, 0x2e, ANIM_TARGET + createspriteontargets gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 6, 0x0, 0x20, 0x200, 0x19, 0xd, 0x2e, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x25, 0x1d0, 0x1e, 0xc, 0xffce, ANIM_TARGET + createspriteontargets gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 6, 0x0, 0x25, 0x1d0, 0x1e, 0xc, 0xffce, ANIM_TARGET return @@ -16517,39 +16521,39 @@ Move_WILDBOLT_STORM:: createvisualtask AnimTask_StartSlidingBg, 0x5, 0xff00, 0x0, 0x1, 0xffff waitbgfadein playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 88, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x07FE - call HurricaneGust + createvisualtaskontargets AnimTask_ShakeMon2, 2, 0, ANIM_TARGET, 0, 4, 0x58, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x07FE + call HurricaneGustCentered call WildboltStormSparkSwirl - call HurricaneGust + call HurricaneGustCentered call WildboltStormSparkSwirl - call HurricaneGust + call HurricaneGustCentered call WildboltStormSparkSwirl - call HurricaneGust + call HurricaneGustCentered call WildboltStormSparkSwirl - call HurricaneGust + call HurricaneGustCentered call WildboltStormSparkSwirl - call HurricaneGust + call HurricaneGustCentered call WildboltStormSparkSwirl waitforvisualfinish stopsound - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x07FE + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x07FE call UnsetPsychicBg waitforvisualfinish end WildboltStormSparkSwirl: - createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x20, 0x210, 0x1e, 0xa, 0x32, ANIM_TARGET + createspriteontargets gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 6, 0x0, 0x20, 0x210, 0x1e, 0xa, 0x32, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x24, 0x1e0, 0x14, 0xd, 0xffd2, ANIM_TARGET + createspriteontargets gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 6, 0x0, 0x24, 0x1e0, 0x14, 0xd, 0xffd2, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x25, 0x240, 0x14, 0x5, 0x2a, ANIM_TARGET + createspriteontargets gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 6, 0x0, 0x25, 0x240, 0x14, 0x5, 0x2a, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x23, 0x190, 0x19, 0x8, 0xffd6, ANIM_TARGET + createspriteontargets gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 6, 0x0, 0x23, 0x190, 0x19, 0x8, 0xffd6, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x20, 0x200, 0x19, 0xd, 0x2e, ANIM_TARGET + createspriteontargets gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 6, 0x0, 0x20, 0x200, 0x19, 0xd, 0x2e, ANIM_TARGET delay 0x2 - createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x25, 0x1d0, 0x1e, 0xc, 0xffce, ANIM_TARGET + createspriteontargets gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 6, 0x0, 0x25, 0x1d0, 0x1e, 0xc, 0xffce, ANIM_TARGET return @@ -16559,38 +16563,38 @@ Move_SANDSEAR_STORM:: loadspritegfx ANIM_TAG_SMALL_EMBER createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_GUST, 0x0, 0xA, 0xA, 0x190B playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 88, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x1F - call HurricaneGust + createvisualtaskontargets AnimTask_ShakeMon2, 2, 0, ANIM_TARGET, 0, 4, 0x58, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x1F + call HurricaneGustCentered call SandsearStormFireSpin - call HurricaneGust + call HurricaneGustCentered call SandsearStormFireSpin - call HurricaneGust + call HurricaneGustCentered call SandsearStormFireSpin - call HurricaneGust + call HurricaneGustCentered call SandsearStormFireSpin - call HurricaneGust + call HurricaneGustCentered call SandsearStormFireSpin - call HurricaneGust + call HurricaneGustCentered call SandsearStormFireSpin waitforvisualfinish stopsound - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x1F + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x1F waitforvisualfinish end SandsearStormFireSpin: - createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x1c, 0x210, 0x1e, 0xd, 0x32, ANIM_TARGET + createspriteontargets gFireSpinSpriteTemplate, ANIM_TARGET, 2, 6, 0x0, 0x1c, 0x210, 0x1e, 0xd, 0x32, ANIM_TARGET delay 0x2 - createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x20, 0x1e0, 0x14, 0x10, 0xffd2, ANIM_TARGET + createspriteontargets gFireSpinSpriteTemplate, ANIM_TARGET, 2, 6, 0x0, 0x20, 0x1e0, 0x14, 0x10, 0xffd2, ANIM_TARGET delay 0x2 - createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x21, 0x240, 0x14, 0x8, 0x2a, ANIM_TARGET + createspriteontargets gFireSpinSpriteTemplate, ANIM_TARGET, 2, 6, 0x0, 0x21, 0x240, 0x14, 0x8, 0x2a, ANIM_TARGET delay 0x2 - createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x1f, 0x190, 0x19, 0xb, 0xffd6, ANIM_TARGET + createspriteontargets gFireSpinSpriteTemplate, ANIM_TARGET, 2, 6, 0x0, 0x1f, 0x190, 0x19, 0xb, 0xffd6, ANIM_TARGET delay 0x2 - createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x1c, 0x200, 0x19, 0x10, 0x2e, ANIM_TARGET + createspriteontargets gFireSpinSpriteTemplate, ANIM_TARGET, 2, 6, 0x0, 0x1c, 0x200, 0x19, 0x10, 0x2e, ANIM_TARGET delay 0x2 - createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x21, 0x1d0, 0x1e, 0xf, 0xffce, ANIM_TARGET + createspriteontargets gFireSpinSpriteTemplate, ANIM_TARGET, 2, 6, 0x0, 0x21, 0x1d0, 0x1e, 0xf, 0xffce, ANIM_TARGET return diff --git a/include/battle_anim.h b/include/battle_anim.h index 7aaa09951809..f8f0dff96969 100755 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -548,5 +548,6 @@ void AnimOutrageFlame(struct Sprite *sprite); // battle_anim_new.c void CoreEnforcerLoadBeamTarget(struct Sprite *sprite); void SpriteCB_RandomCentredHits(struct Sprite *sprite); +void InitSpritePosToAnimTargetsCentre(struct Sprite *sprite, bool32 respectMonPicOffsets); #endif // GUARD_BATTLE_ANIM_H diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 91ac5e7841f9..f58aa97ee282 100755 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -10,6 +10,7 @@ extern const struct SpriteTemplate gFlashingHitSplatSpriteTemplate; +static void AnimEllipticalGustCentered(struct Sprite *sprite); static void AnimEllipticalGust_Step(struct Sprite *); static void AnimGustToTarget(struct Sprite *); static void AnimGustToTarget_Step(struct Sprite *); @@ -32,6 +33,17 @@ static void AnimSkyAttackBird_Step(struct Sprite *); static void AnimTask_AnimateGustTornadoPalette_Step(u8); static void AnimTask_LoadWindstormBackground_Step(u8 taskId); +const struct SpriteTemplate gEllipticalGustCenteredSpriteTemplate = +{ + .tileTag = ANIM_TAG_GUST, + .paletteTag = ANIM_TAG_GUST, + .oam = &gOamData_AffineOff_ObjNormal_32x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimEllipticalGustCentered, +}; + const struct SpriteTemplate gEllipticalGustSpriteTemplate = { .tileTag = ANIM_TAG_GUST, @@ -344,6 +356,15 @@ const struct SpriteTemplate gSkyAttackBirdSpriteTemplate = .callback = AnimSkyAttackBird, }; +// same as AnimEllipticalGust but centered on targets +static void AnimEllipticalGustCentered(struct Sprite *sprite) +{ + InitSpritePosToAnimTargetsCentre(sprite, FALSE); + sprite->y += 20; + sprite->data[1] = 191; + sprite->callback = AnimEllipticalGust_Step; + sprite->callback(sprite); +} void AnimEllipticalGust(struct Sprite *sprite) { diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 281b3087cc2b..b29520b8bee4 100755 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -7247,7 +7247,7 @@ static void InitSpritePosToGivenTarget(struct Sprite *sprite, u8 target) sprite->y2 = gBattleAnimArgs[1]; } -static void InitSpritePosToAnimTargetsCentre(struct Sprite *sprite, bool8 respectMonPicOffsets) +void InitSpritePosToAnimTargetsCentre(struct Sprite *sprite, bool32 respectMonPicOffsets) { if (!respectMonPicOffsets) { diff --git a/src/battle_anim_normal.c b/src/battle_anim_normal.c index f710409229c9..3b2de5ddbbd5 100755 --- a/src/battle_anim_normal.c +++ b/src/battle_anim_normal.c @@ -413,6 +413,23 @@ u32 UnpackSelectedBattlePalettes(s16 selector) bool8 targetPartner = (selector >> 4) & 1; bool8 anim1 = (selector >> 5) & 1; bool8 anim2 = (selector >> 6) & 1; + u32 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gAnimMoveIndex); + + switch (moveTarget) + { + case MOVE_TARGET_BOTH: + if (target) { + targetPartner |= 1; + } + break; + case MOVE_TARGET_FOES_AND_ALLY: + if (target) { + targetPartner |= 1; + attackerPartner |= 1; + } + break; + } + return GetBattlePalettesMask(battleBackground, attacker, target, attackerPartner, targetPartner, anim1, anim2); } diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index 6811c857b365..7a84757cd9a1 100755 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -456,11 +456,7 @@ void AnimRockFragment(struct Sprite *sprite) // Swirls particle in vortex. Used for moves like Fire Spin or Sand Tomb void AnimParticleInVortex(struct Sprite *sprite) { - if (gBattleAnimArgs[6] == ANIM_ATTACKER) - InitSpritePosToAnimAttacker(sprite, FALSE); - else - InitSpritePosToAnimTarget(sprite, FALSE); - + InitSpritePosToAnimBattler(gBattleAnimArgs[6], sprite, FALSE); sprite->data[0] = gBattleAnimArgs[3]; sprite->data[1] = gBattleAnimArgs[2]; sprite->data[2] = gBattleAnimArgs[4];