From 3cf091d63583786e14350dc3335e2e6f758f9a84 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 26 Jun 2020 23:28:46 +0200 Subject: [PATCH] Improve animations of moves hitting all foes --- data/battle_anim_scripts.s | 153 +++++++++++++++++++++++++++---------- include/battle_anim.h | 1 + src/battle_anim.c | 13 +++- src/battle_anim_electric.c | 3 +- src/battle_anim_mons.c | 48 +++++++++++- src/battle_anim_normal.c | 8 +- 6 files changed, 175 insertions(+), 51 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 95fdd37c25..157920bfea 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -3085,32 +3085,80 @@ Move_DISCHARGE: waitforvisualfinish createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_IMPACT, 0, 12, 12, RGB(0, 0, 23) waitforvisualfinish - createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 1, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_TARGET, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_TARGET, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_TARGET, 2 createvisualtask SoundTask_PlaySE1WithPanning, 5, 215, SOUND_PAN_TARGET delay 3 - createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 1, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_TARGET, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_DEF_PARTNER, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_ATK_PARTNER, 2 createvisualtask SoundTask_PlaySE1WithPanning, 5, 215, SOUND_PAN_TARGET delay 3 - createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 1, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_TARGET, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_DEF_PARTNER, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_ATK_PARTNER, 2 createvisualtask SoundTask_PlaySE1WithPanning, 5, 215, SOUND_PAN_TARGET delay 3 - createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 1, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_TARGET, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_DEF_PARTNER, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_ATK_PARTNER, 2 createvisualtask SoundTask_PlaySE1WithPanning, 5, 215, SOUND_PAN_TARGET delay 3 - createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 1, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_TARGET, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_DEF_PARTNER, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_ATK_PARTNER, 2 createvisualtask SoundTask_PlaySE1WithPanning, 5, 215, SOUND_PAN_TARGET delay 3 - createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 1, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_TARGET, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_DEF_PARTNER, 2 + createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, ANIM_ATK_PARTNER, 2 createvisualtask SoundTask_PlaySE1WithPanning, 5, 215, SOUND_PAN_TARGET waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 16, 0, RGB_WHITEALPHA - createvisualtask AnimTask_HorizontalShake, 5, 1, 5, 14 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 5, 14 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_DEF_PARTNER, 5, 14 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_ATK_PARTNER, 5, 14 waitforvisualfinish clearmonbg ANIM_ATTACKER blendoff - call ElectricityEffect + call DischargeElectrify waitforvisualfinish end +DischargeElectrify: + playsewithpan SE_W085B, SOUND_PAN_TARGET + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 5, 0, 5, 0, ANIM_TARGET + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 5, 0, 5, 0, ANIM_DEF_PARTNER + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 5, 0, 5, 0, ANIM_ATK_PARTNER + delay 2 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1, ANIM_TARGET + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1, ANIM_DEF_PARTNER + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1, ANIM_ATK_PARTNER + delay 2 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 15, 20, 5, 2, ANIM_TARGET + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 15, 20, 5, 2, ANIM_DEF_PARTNER + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 15, 20, 5, 2, ANIM_ATK_PARTNER + delay 2 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0, ANIM_TARGET + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0, ANIM_DEF_PARTNER + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0, ANIM_ATK_PARTNER + delay 2 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 25, 0, 5, 1, ANIM_TARGET + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 25, 0, 5, 1, ANIM_DEF_PARTNER + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 25, 0, 5, 1, ANIM_ATK_PARTNER + delay 2 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2, ANIM_TARGET + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2, ANIM_DEF_PARTNER + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2, ANIM_ATK_PARTNER + delay 2 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 2, -8, 5, 0, ANIM_TARGET + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 2, -8, 5, 0, ANIM_DEF_PARTNER + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 2, -8, 5, 0, ANIM_ATK_PARTNER + delay 2 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -20, 15, 5, 1, ANIM_TARGET + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -20, 15, 5, 1, ANIM_DEF_PARTNER + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -20, 15, 5, 1, ANIM_ATK_PARTNER + return Move_LAVA_PLUME: loadspritegfx ANIM_TAG_FIRE_PLUME @@ -6854,20 +6902,20 @@ TechnoBlastElectric: playsewithpan SE_W052, SOUND_PAN_ATTACKER launchtask AnimTask_ShakeMon2 0x2 0x5 0x1 0x4 0x0 0x5 0x1 launchtemplate gTechnoBlastYellowSmokeTemplate 0x82, 0x4, 0x8 0x8 0x1 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1, ANIM_TARGET delay 0x2 launchtemplate gTechnoBlastYellowSmokeTemplate 0x82, 0x4, 0xfff8 0xfff8 0x1 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0, ANIM_TARGET delay 0x2 launchtemplate gTechnoBlastYellowSmokeTemplate 0x82, 0x4, 0x8 0xfff8 0x1 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2, ANIM_TARGET delay 0x2 launchtemplate gTechnoBlastYellowSmokeTemplate 0x82, 0x4, 0xfff8 0x8 0x1 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1, ANIM_TARGET waitforvisualfinish launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x1 0xC 0x0 0x0 waitforvisualfinish @@ -8520,23 +8568,23 @@ Move_ELECTRIFY:: playsewithpan SE_W085B, SOUND_PAN_TARGET launchtemplate gElectrifyYellowRingTemplate 0x3 0x6 0x0 0x0 0x1 0x0 0x1f 0x8 launchtask AnimTask_ShakeMon 0x5 0x5 ANIM_TARGET 0x4 0x0 0x6 0x1 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0, ANIM_TARGET delay 0x1 launchtemplate gElectrifyYellowRingTemplate 0x3 0x6 0x0 0x0 0x1 0x0 0x1f 0x8 delay 0x1 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1, ANIM_TARGET launchtemplate gElectrifyYellowRingTemplate 0x3 0x6 0x0 0x0 0x1 0x0 0x1f 0x8 delay 0x1 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0, ANIM_TARGET delay 0x2 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1, ANIM_TARGET delay 0x2 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2, ANIM_TARGET delay 0x2 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0, ANIM_TARGET delay 0x2 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1, ANIM_TARGET waitforvisualfinish launchtask AnimTask_BlendBattleAnimPal 0xA 0x5 ANIM_PAL_DEF 0x2 0xB 0x0 0x039B launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x1 0x3 0x0 0x039B @@ -8656,14 +8704,16 @@ Move_MOONBLAST: Move_BOOMBURST: loadspritegfx ANIM_TAG_EXPLOSION loadspritegfx ANIM_TAG_THIN_RING - createvisualtask AnimTask_InvertScreenColor, 2, 0x1 | 0x2 | 0x4 | 0x8 + createvisualtask AnimTask_InvertScreenColor, 2, 0x1 | 0x4 | 0x8 | 0x10 createvisualtask SoundTask_PlayCryWithEcho, 5 createvisualtask AnimTask_ScaleMonAndRestore, 5, -5, -5, 5, ANIM_ATTACKER, 0 createsprite gHyperVoiceRingSpriteTemplate, ANIM_ATTACKER, 0, 45, 0, 0, 0, 0, 0, 1 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 6, 1 createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 1, 0, 6, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATK_PARTNER, 1, 0, 6, 1 createvisualtask SoundTask_WaitForCry, 2, 1, 0, 6, 1 delay 20 + jumpifdoublebattle Boomburst_Doubles playsewithpan SE_W153, SOUND_PAN_ATTACKER createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 1, 1 delay 4 @@ -8678,10 +8728,29 @@ Move_BOOMBURST: delay 4 playsewithpan SE_W153, SOUND_PAN_ATTACKER createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 16, 16, 1, 1 +Boomburst_Last: delay 4 - createvisualtask AnimTask_InvertScreenColor, 2, 0x1 | 0x2 | 0x4 | 0x8 + createvisualtask AnimTask_InvertScreenColor, 2, 0x1 | 0x4 | 0x8 | 0x10 waitforvisualfinish end +Boomburst_Doubles: + playsewithpan SE_W153, SOUND_PAN_ATTACKER + createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 1, 1 + createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 2, 1 + delay 4 + playsewithpan SE_W153, SOUND_PAN_ATTACKER + createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 24, -24, 1, 1 + delay 4 + playsewithpan SE_W153, SOUND_PAN_ATTACKER + createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, -16, 16, 1, 1 + delay 4 + playsewithpan SE_W153, SOUND_PAN_ATTACKER + createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, -24, -12, 1, 1 + createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, -24, -12, 2, 1 + delay 4 + playsewithpan SE_W153, SOUND_PAN_ATTACKER + createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 16, 16, 1, 1 + goto Boomburst_Last Move_FAIRY_LOCK:: loadspritegfx ANIM_TAG_CHAIN_LINK @Chain Colour @@ -9033,20 +9102,20 @@ Move_EERIE_IMPULSE:: waitforvisualfinish playsewithpan SE_W085B, SOUND_PAN_ATTACKER launchtemplate gEerieImpulseImpactTemplate 0x2 0x6 0x0 0xfffb 0x1 0x0 0x20 0x10 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1, ANIM_TARGET delay 0x7 launchtemplate gEerieImpulseImpactTemplate 0x2 0x6 0xfff1 0xa 0x1 0x0 0x20 0x10 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0, ANIM_TARGET delay 0x7 launchtemplate gEerieImpulseImpactTemplate 0x2 0x6 0xfff1 0xfff1 0x1 0x0 0x20 0x10 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2, ANIM_TARGET delay 0x7 launchtemplate gEerieImpulseImpactTemplate 0x2 0x6 0xa 0xfffb 0x1 0x0 0x20 0x10 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1, ANIM_TARGET waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -23682,21 +23751,21 @@ WaterBubblesEffectLong: ElectricityEffect: playsewithpan SE_W085B, SOUND_PAN_TARGET ElectricityEffectNoSound: - createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 5, 0, 5, 0 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 5, 0, 5, 0, ANIM_TARGET delay 2 - createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1, ANIM_TARGET delay 2 - createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 15, 20, 5, 2 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 15, 20, 5, 2, ANIM_TARGET delay 2 - createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0, ANIM_TARGET delay 2 - createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 25, 0, 5, 1 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 25, 0, 5, 1, ANIM_TARGET delay 2 - createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2, ANIM_TARGET delay 2 - createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 2, -8, 5, 0 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 2, -8, 5, 0, ANIM_TARGET delay 2 - createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -20, 15, 5, 1 + createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -20, 15, 5, 1, ANIM_TARGET return ConfusionEffect: diff --git a/include/battle_anim.h b/include/battle_anim.h index b0a54c62b2..149e2e5d3b 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -87,6 +87,7 @@ void DestroySpriteAndMatrix(struct Sprite *sprite); void TranslateSpriteLinearFixedPoint(struct Sprite *sprite); void InitSpritePosToAnimAttacker(struct Sprite *sprite, bool8 respectMonPicOffsets); void InitSpritePosToAnimTarget(struct Sprite *sprite, bool8 respectMonPicOffsets); +bool32 InitSpritePosToAnimBattler(u32 animBattlerId, struct Sprite *sprite, bool8 respectMonPicOffsets); void StartAnimLinearTranslation(struct Sprite *sprite); void InitAnimArcTranslation(struct Sprite *sprite); bool8 AnimTranslateLinear(struct Sprite *sprite); diff --git a/src/battle_anim.c b/src/battle_anim.c index 835e7b2992..bf239efe48 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1404,7 +1404,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_NewPokeball, 0x0080, ANIM_TAG_POKEBALL}, #else {gBattleAnimSpriteGfx_Pokeball, 0x0080, ANIM_TAG_POKEBALL}, - #endif + #endif {gBattleAnimSpriteGfx_Spotlight, 0x0800, ANIM_TAG_SPOTLIGHT}, {gBattleAnimSpriteGfx_LetterZ, 0x0200, ANIM_TAG_LETTER_Z}, {gBattleAnimSpriteGfx_RapidSpin, 0x0300, ANIM_TAG_RAPID_SPIN}, @@ -1422,7 +1422,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = #if NEW_MORNING_SUN_STAR_PARTICLE {gBattleAnimSpriteGfx_NewGreenStar, 0x0200, ANIM_TAG_GREEN_STAR}, #else - {gBattleAnimSpriteGfx_GreenStar, 0x0200, ANIM_TAG_GREEN_STAR}, + {gBattleAnimSpriteGfx_GreenStar, 0x0200, ANIM_TAG_GREEN_STAR}, #endif {gBattleAnimSpriteGfx_PinkCloud, 0x0200, ANIM_TAG_PINK_CLOUD}, {gBattleAnimSpriteGfx_SweatDrop, 0x0020, ANIM_TAG_SWEAT_DROP}, @@ -2184,6 +2184,15 @@ void DoMoveAnim(u16 move) { gBattleAnimAttacker = gBattlerAttacker; gBattleAnimTarget = gBattlerTarget; + // Make sure the anim target of moves hitting everyone is at the opposite side. + if (gBattleMoves[move].target & MOVE_TARGET_FOES_AND_ALLY && IsDoubleBattle()) + { + while (GET_BATTLER_SIDE(gBattleAnimAttacker) == GET_BATTLER_SIDE(gBattleAnimTarget)) + { + if (++gBattleAnimTarget >= MAX_BATTLERS_COUNT) + gBattleAnimTarget = 0; + } + } LaunchBattleAnimation(gBattleAnims_Moves, move, TRUE); } diff --git a/src/battle_anim_electric.c b/src/battle_anim_electric.c index 8d96e88f14..9c84c9555a 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -760,7 +760,8 @@ static void AnimSparkElectricityFlashing_Step(struct Sprite *sprite) // Electricity arcs around the target. Used for Paralysis and various electric move hits static void AnimElectricity(struct Sprite *sprite) { - InitSpritePosToAnimTarget(sprite, FALSE); + if (!InitSpritePosToAnimBattler(gBattleAnimArgs[4], sprite, FALSE)) + return; sprite->oam.tileNum += gBattleAnimArgs[3] * 4; if (gBattleAnimArgs[3] == 1) diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 1e1482dabe..7c286f36ff 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -793,6 +793,46 @@ void InitSpritePosToAnimAttacker(struct Sprite *sprite, bool8 respectMonPicOffse sprite->pos1.y += gBattleAnimArgs[1]; } +void InitSpritePosToAnimAttackerPartner(struct Sprite *sprite, bool8 respectMonPicOffsets) +{ + if (!respectMonPicOffsets) + { + sprite->pos1.x = GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_X); + sprite->pos1.y = GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_Y); + } + else + { + sprite->pos1.x = GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_X_2); + sprite->pos1.y = GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_Y_PIC_OFFSET); + } + SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]); + sprite->pos1.y += gBattleAnimArgs[1]; +} + +bool32 InitSpritePosToAnimBattler(u32 animBattlerId, struct Sprite *sprite, bool8 respectMonPicOffsets) +{ + u32 battlerId = GetAnimBattlerId(animBattlerId); + if (GetAnimBattlerSpriteId(animBattlerId) == 0xFF || !IsBattlerSpriteVisible(battlerId)) + { + DestroyAnimSprite(sprite); + return FALSE; + } + + if (!respectMonPicOffsets) + { + sprite->pos1.x = GetBattlerSpriteCoord2(battlerId, BATTLER_COORD_X); + sprite->pos1.y = GetBattlerSpriteCoord2(battlerId, BATTLER_COORD_Y); + } + else if (animBattlerId != ANIM_TARGET) + { + sprite->pos1.x = GetBattlerSpriteCoord2(battlerId, BATTLER_COORD_X_2); + sprite->pos1.y = GetBattlerSpriteCoord2(battlerId, BATTLER_COORD_Y_PIC_OFFSET); + } + SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]); + sprite->pos1.y += gBattleAnimArgs[1]; + return TRUE; +} + u8 GetBattlerSide(u8 battlerId) { return GET_BATTLER_SIDE2(battlerId); @@ -1466,10 +1506,14 @@ void AnimSpriteOnMonPos(struct Sprite *sprite) var = TRUE; else var = FALSE; - if (!gBattleAnimArgs[2]) + + if (gBattleAnimArgs[2] == 0) InitSpritePosToAnimAttacker(sprite, var); - else + else if (gBattleAnimArgs[2] == 1) InitSpritePosToAnimTarget(sprite, var); + else if (gBattleAnimArgs[2] == 2) + InitSpritePosToAnimAttackerPartner(sprite, var); + sprite->data[0]++; } diff --git a/src/battle_anim_normal.c b/src/battle_anim_normal.c index fefa405627..0e45fe644c 100644 --- a/src/battle_anim_normal.c +++ b/src/battle_anim_normal.c @@ -813,6 +813,8 @@ void AnimTask_InvertScreenColor(u8 taskId) selectedPalettes |= (0x10000 << gBattleAnimTarget); if (gBattleAnimArgs[0] & 0x8 && IsBattlerAlive(BATTLE_PARTNER(gBattleAnimTarget))) selectedPalettes |= (0x10000 << BATTLE_PARTNER(gBattleAnimTarget)); + if (gBattleAnimArgs[0] & 0x10 && IsBattlerAlive(BATTLE_PARTNER(gBattleAnimAttacker))) + selectedPalettes |= (0x10000 << BATTLE_PARTNER(gBattleAnimAttacker)); InvertPlttBuffer(selectedPalettes); DestroyAnimVisualTask(taskId); @@ -1050,11 +1052,9 @@ void AnimHitSplatRandom(struct Sprite *sprite) if (gBattleAnimArgs[1] == -1) gBattleAnimArgs[1] = Random2() & 3; + if (!InitSpritePosToAnimBattler(gBattleAnimArgs[0], sprite, FALSE)) + return; StartSpriteAffineAnim(sprite, gBattleAnimArgs[1]); - if (gBattleAnimArgs[0] == ANIM_ATTACKER) - InitSpritePosToAnimAttacker(sprite, 0); - else - InitSpritePosToAnimTarget(sprite, FALSE); sprite->pos2.x += (Random2() % 48) - 24; sprite->pos2.y += (Random2() % 24) - 12;