Skip to content

Commit

Permalink
fix genie storm move anims for both targets, add AnimEllipticalGustCe…
Browse files Browse the repository at this point in the history
…ntered, AnimParticleInVortex handles multiple targets, add dynamic pals based on move target in UnpackSelectedBattlePalettes (rh-hideout#3895)

Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
  • Loading branch information
2 people authored and PCG06 committed Jan 25, 2024
1 parent b71fb46 commit 2b5f4b7
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 65 deletions.
122 changes: 63 additions & 59 deletions data/battle_anim_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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


Expand All @@ -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


Expand All @@ -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


Expand Down
1 change: 1 addition & 0 deletions include/battle_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions src/battle_anim_flying.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand All @@ -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,
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/battle_anim_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
17 changes: 17 additions & 0 deletions src/battle_anim_normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 1 addition & 5 deletions src/battle_anim_rock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 2b5f4b7

Please sign in to comment.