pokeemerald/src/battle_anim_effects_1.c

5617 lines
156 KiB
C
Raw Normal View History

2018-12-16 18:35:10 +01:00
#include "global.h"
#include "malloc.h"
2018-12-16 18:35:10 +01:00
#include "battle_anim.h"
#include "battle_interface.h"
2018-12-18 04:56:34 +01:00
#include "decompress.h"
2018-12-16 18:35:10 +01:00
#include "gpu_regs.h"
2018-12-18 04:56:34 +01:00
#include "graphics.h"
#include "main.h"
#include "math_util.h"
2018-12-16 18:35:10 +01:00
#include "palette.h"
#include "random.h"
2018-12-18 04:56:34 +01:00
#include "scanline_effect.h"
2018-12-16 18:35:10 +01:00
#include "sound.h"
#include "trig.h"
#include "util.h"
#include "constants/rgb.h"
#include "constants/songs.h"
2021-04-13 08:45:16 +02:00
struct {
s16 startX;
s16 startY;
s16 targetX;
s16 targetY;
} static EWRAM_DATA sFrenzyPlantRootData = {0}; // Debug? Written to but never read.
2018-12-16 18:35:10 +01:00
2020-02-20 22:22:33 +01:00
static void AnimMovePowderParticle(struct Sprite *);
static void AnimMovePowderParticle_Step(struct Sprite *);
static void AnimPowerAbsorptionOrb(struct Sprite *);
2021-11-01 22:36:35 +01:00
static void AnimSolarBeamBigOrb(struct Sprite *);
static void AnimSolarBeamSmallOrb(struct Sprite *);
static void AnimSolarBeamSmallOrb_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimAbsorptionOrb(struct Sprite *);
static void AnimAbsorptionOrb_Step(struct Sprite *);
static void AnimHyperBeamOrb(struct Sprite *);
static void AnimHyperBeamOrb_Step(struct Sprite *);
static void AnimSporeParticle(struct Sprite *);
static void AnimSporeParticle_Step(struct Sprite *);
static void AnimPetalDanceBigFlower(struct Sprite *);
static void AnimPetalDanceBigFlower_Step(struct Sprite *);
static void AnimPetalDanceSmallFlower(struct Sprite *);
static void AnimPetalDanceSmallFlower_Step(struct Sprite *);
static void AnimRazorLeafParticle(struct Sprite *);
static void AnimRazorLeafParticle_Step1(struct Sprite *);
static void AnimRazorLeafParticle_Step2(struct Sprite *);
static void AnimLeechSeed(struct Sprite *);
static void AnimLeechSeed_Step(struct Sprite *);
2018-12-16 18:35:10 +01:00
static void AnimLeechSeedSprouts(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimTranslateLinearSingleSineWave(struct Sprite *);
static void AnimTranslateLinearSingleSineWave_Step(struct Sprite *);
static void AnimConstrictBinding(struct Sprite *);
static void AnimConstrictBinding_Step1(struct Sprite *);
static void AnimConstrictBinding_Step2(struct Sprite *);
static void AnimMimicOrb(struct Sprite *);
static void AnimIngrainRoot(struct Sprite *);
static void AnimFrenzyPlantRoot(struct Sprite *);
2018-12-20 04:13:26 +01:00
static void AnimRootFlickerOut(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimIngrainOrb(struct Sprite *);
static void AnimPresent(struct Sprite *);
static void AnimKnockOffItem(struct Sprite *);
static void AnimPresentHealParticle(struct Sprite *);
static void AnimItemSteal(struct Sprite *);
static void AnimItemSteal_Step1(struct Sprite *);
static void AnimItemSteal_Step2(struct Sprite *);
static void AnimItemSteal_Step3(struct Sprite *);
static void AnimTrickBag(struct Sprite *);
static void AnimTrickBag_Step1(struct Sprite *);
static void AnimTrickBag_Step2(struct Sprite *);
static void AnimTrickBag_Step3(struct Sprite *);
static void AnimFlyingParticle(struct Sprite *);
static void AnimFlyingParticle_Step(struct Sprite *);
static void AnimNeedleArmSpike(struct Sprite *);
static void AnimNeedleArmSpike_Step(struct Sprite *);
2021-04-13 08:45:16 +02:00
static void AnimSlidingHit(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimWhipHit(struct Sprite *);
2021-04-13 08:45:16 +02:00
static void AnimFlickeringPunch(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimCuttingSlice(struct Sprite *);
static void AnimAirCutterSlice(struct Sprite *);
static void AnimSlice_Step(struct Sprite *);
2021-04-13 08:45:16 +02:00
static void AnimCirclingMusicNote(struct Sprite *);
static void AnimCirclingMusicNote_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimProtect(struct Sprite *);
static void AnimProtect_Step(struct Sprite *);
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 *);
2021-04-13 08:45:16 +02:00
static void AnimBubbleBurst(struct Sprite *);
static void AnimBubbleBurst_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimSleepLetterZ(struct Sprite *);
static void AnimSleepLetterZ_Step(struct Sprite *);
static void AnimLockOnTarget(struct Sprite *);
static void AnimLockOnTarget_Step1(struct Sprite *);
static void AnimLockOnTarget_Step2(struct Sprite *);
static void AnimLockOnTarget_Step3(struct Sprite *);
static void AnimLockOnTarget_Step4(struct Sprite *);
static void AnimLockOnTarget_Step5(struct Sprite *);
static void AnimLockOnTarget_Step6(struct Sprite *);
static void AnimLockOnMoveTarget(struct Sprite *);
static void AnimBowMon(struct Sprite *);
static void AnimBowMon_Step1(struct Sprite *);
static void AnimBowMon_Step1_Callback(struct Sprite *);
static void AnimBowMon_Step2(struct Sprite *);
static void AnimBowMon_Step3(struct Sprite *);
static void AnimBowMon_Step4(struct Sprite *);
static void AnimBowMon_Step3_Callback(struct Sprite *);
2021-04-13 08:45:16 +02:00
static void AnimTipMon(struct Sprite *);
static void AnimTipMon_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimSlashSlice(struct Sprite *);
static void AnimFalseSwipeSlice(struct Sprite *);
static void AnimFalseSwipeSlice_Step1(struct Sprite *);
static void AnimFalseSwipeSlice_Step2(struct Sprite *);
static void AnimFalseSwipeSlice_Step3(struct Sprite *);
static void AnimFalseSwipePositionedSlice(struct Sprite *);
static void AnimEndureEnergy(struct Sprite *);
static void AnimEndureEnergy_Step(struct Sprite *);
static void AnimSharpenSphere(struct Sprite *);
static void AnimSharpenSphere_Step(struct Sprite *);
static void AnimConversion(struct Sprite *);
static void AnimConversion2(struct Sprite *);
static void AnimConversion2_Step(struct Sprite *);
static void AnimMoon(struct Sprite *);
static void AnimMoon_Step(struct Sprite *);
static void AnimMoonlightSparkle(struct Sprite *);
static void AnimMoonlightSparkle_Step(struct Sprite *);
static void AnimHornHit(struct Sprite *);
static void AnimHornHit_Step(struct Sprite *);
static void AnimSuperFang(struct Sprite *);
static void AnimWavyMusicNotes(struct Sprite *);
static void AnimWavyMusicNotes_Step(struct Sprite *);
static void AnimWavyMusicNotesGetNextPos(s16, s16, s16 *, s16 *, s8);
static void AnimFlyingMusicNotes(struct Sprite *);
static void AnimFlyingMusicNotes_Step(struct Sprite *);
static void AnimBellyDrumHand(struct Sprite *);
static void AnimSlowFlyingMusicNotes(struct Sprite *);
static void AnimSlowFlyingMusicNotes_Step(struct Sprite *);
static void AnimThoughtBubble(struct Sprite *);
static void AnimThoughtBubble_Step(struct Sprite *);
static void AnimMetronomeFinger(struct Sprite *);
static void AnimMetronomeFinger_Step(struct Sprite *);
static void AnimFollowMeFinger(struct Sprite *);
static void AnimFollowMeFinger_Step1(struct Sprite *);
static void AnimFollowMeFinger_Step2(struct Sprite *);
static void AnimTauntFinger(struct Sprite *);
static void AnimTauntFinger_Step1(struct Sprite *);
static void AnimTauntFinger_Step2(struct Sprite *);
static void AnimMoveTwisterParticle_Step(struct Sprite *);
static void AnimTask_MoonlightEndFade_Step(u8 taskId);
static void AnimTask_LeafBlade_Step(u8);
static void AnimTask_DuplicateAndShrinkToPos_Step1(u8);
static void AnimTask_DuplicateAndShrinkToPos_Step2(u8);
static s16 LeafBladeGetPosFactor(struct Sprite *);
static void AnimTask_LeafBlade_Step2(struct Task *, u8);
static void AnimTask_LeafBlade_Step2_Callback(struct Sprite *);
static void AnimTask_SkullBashPositionSet(u8);
static void AnimTask_SkullBashPositionReset(u8);
2020-02-20 22:22:33 +01:00
static void AnimTask_DoubleTeam_Step(u8);
static void AnimDoubleTeam(struct Sprite *);
2018-12-16 18:35:10 +01:00
const union AnimCmd gPowderParticlesAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_FRAME(2, 5),
ANIMCMD_FRAME(4, 5),
ANIMCMD_FRAME(6, 5),
ANIMCMD_FRAME(8, 5),
ANIMCMD_FRAME(10, 5),
ANIMCMD_FRAME(12, 5),
ANIMCMD_FRAME(14, 5),
ANIMCMD_JUMP(0),
};
const union AnimCmd *const gPowderParticlesAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gPowderParticlesAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSleepPowderParticleSpriteTemplate =
{
.tileTag = ANIM_TAG_SLEEP_POWDER,
.paletteTag = ANIM_TAG_SLEEP_POWDER,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x16,
.anims = gPowderParticlesAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimMovePowderParticle,
};
const struct SpriteTemplate gStunSporeParticleSpriteTemplate =
{
.tileTag = ANIM_TAG_STUN_SPORE,
.paletteTag = ANIM_TAG_STUN_SPORE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x16,
.anims = gPowderParticlesAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimMovePowderParticle,
};
const struct SpriteTemplate gPoisonPowderParticleSpriteTemplate =
{
.tileTag = ANIM_TAG_POISON_POWDER,
.paletteTag = ANIM_TAG_POISON_POWDER,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x16,
.anims = gPowderParticlesAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimMovePowderParticle,
};
2021-11-01 22:36:35 +01:00
const union AnimCmd gSolarBeamBigOrbAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
2021-11-01 22:36:35 +01:00
const union AnimCmd gSolarBeamBigOrbAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(1, 1),
ANIMCMD_END,
};
2021-11-01 22:36:35 +01:00
const union AnimCmd gSolarBeamBigOrbAnimCmds3[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(2, 1),
ANIMCMD_END,
};
2021-11-01 22:36:35 +01:00
const union AnimCmd gSolarBeamBigOrbAnimCmds4[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(3, 1),
ANIMCMD_END,
};
2021-11-01 22:36:35 +01:00
const union AnimCmd gSolarBeamBigOrbAnimCmds5[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(4, 1),
ANIMCMD_END,
};
2021-11-01 22:36:35 +01:00
const union AnimCmd gSolarBeamBigOrbAnimCmds6[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(5, 1),
ANIMCMD_END,
};
2021-11-01 22:36:35 +01:00
const union AnimCmd gSolarBeamBigOrbAnimCmds7[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(6, 1),
ANIMCMD_END,
};
2021-11-01 22:36:35 +01:00
const union AnimCmd gSolarBeamSmallOrbAnimCms[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(7, 1),
ANIMCMD_END,
};
const union AnimCmd gPowerAbsorptionOrbAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(8, 1),
ANIMCMD_END,
};
2021-11-01 22:36:35 +01:00
const union AnimCmd *const gSolarBeamBigOrbAnimTable[] =
2018-12-16 18:35:10 +01:00
{
2021-11-01 22:36:35 +01:00
gSolarBeamBigOrbAnimCmds1,
gSolarBeamBigOrbAnimCmds2,
gSolarBeamBigOrbAnimCmds3,
gSolarBeamBigOrbAnimCmds4,
gSolarBeamBigOrbAnimCmds5,
gSolarBeamBigOrbAnimCmds6,
gSolarBeamBigOrbAnimCmds7,
2018-12-16 18:35:10 +01:00
};
2021-11-01 22:36:35 +01:00
const union AnimCmd *const gSolarBeamSmallOrbAnimTable[] =
2018-12-16 18:35:10 +01:00
{
2021-11-01 22:36:35 +01:00
gSolarBeamSmallOrbAnimCms,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd *const gPowerAbsorptionOrbAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gPowerAbsorptionOrbAnimCmds,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gPowerAbsorptionOrbAffineAnimCmds[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(-5, -5, 0, 1),
AFFINEANIMCMD_JUMP(0),
};
const union AffineAnimCmd *const gPowerAbsorptionOrbAffineAnimTable[] = {
gPowerAbsorptionOrbAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gPowerAbsorptionOrbSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ORBS,
.paletteTag = ANIM_TAG_ORBS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjBlend_16x16,
.anims = gPowerAbsorptionOrbAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gPowerAbsorptionOrbAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimPowerAbsorptionOrb,
2018-12-16 18:35:10 +01:00
};
2021-11-01 22:36:35 +01:00
const struct SpriteTemplate gSolarBeamBigOrbSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ORBS,
.paletteTag = ANIM_TAG_ORBS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x8,
2021-11-01 22:36:35 +01:00
.anims = gSolarBeamBigOrbAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2021-11-01 22:36:35 +01:00
.callback = AnimSolarBeamBigOrb,
2018-12-16 18:35:10 +01:00
};
2021-11-01 22:36:35 +01:00
const struct SpriteTemplate gSolarBeamSmallOrbSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ORBS,
.paletteTag = ANIM_TAG_ORBS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x8,
2021-11-01 22:36:35 +01:00
.anims = gSolarBeamSmallOrbAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2021-11-01 22:36:35 +01:00
.callback = AnimSolarBeamSmallOrb,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gStockpileAbsorptionOrbAffineCmds[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(320, 320, 0, 0),
AFFINEANIMCMD_FRAME(-14, -14, 0, 1),
AFFINEANIMCMD_JUMP(1),
};
const union AffineAnimCmd *const gStockpileAbsorptionOrbAffineAnimTable[] = {
gStockpileAbsorptionOrbAffineCmds,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gStockpileAbsorptionOrbSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_GRAY_ORB,
.paletteTag = ANIM_TAG_GRAY_ORB,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_8x8,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gStockpileAbsorptionOrbAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimPowerAbsorptionOrb,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gAbsorptionOrbAffineAnimCmds[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(-5, -5, 0, 1),
AFFINEANIMCMD_JUMP(0),
};
const union AffineAnimCmd *const gAbsorptionOrbAffineAnimTable[] = {
gAbsorptionOrbAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gAbsorptionOrbSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ORBS,
.paletteTag = ANIM_TAG_ORBS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjBlend_16x16,
.anims = gPowerAbsorptionOrbAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gAbsorptionOrbAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimAbsorptionOrb,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gHyperBeamOrbSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ORBS,
.paletteTag = ANIM_TAG_ORBS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x8,
2021-11-01 22:36:35 +01:00
.anims = gSolarBeamBigOrbAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimHyperBeamOrb,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gLeechSeedAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
const union AnimCmd gLeechSeedAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(4, 7),
ANIMCMD_FRAME(8, 7),
ANIMCMD_JUMP(0),
};
const union AnimCmd *const gLeechSeedAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gLeechSeedAnimCmds1,
gLeechSeedAnimCmds2,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gLeechSeedSpriteTemplate =
{
.tileTag = ANIM_TAG_SEED,
.paletteTag = ANIM_TAG_SEED,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gLeechSeedAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimLeechSeed,
};
const union AnimCmd gSporeParticleAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
const union AnimCmd gSporeParticleAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(4, 7),
ANIMCMD_END,
};
const union AnimCmd *const gSporeParticleAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gSporeParticleAnimCmds1,
gSporeParticleAnimCmds2,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gSporeParticleSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SPORE,
.paletteTag = ANIM_TAG_SPORE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gSporeParticleAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimSporeParticle,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gPetalDanceBigFlowerAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
const union AnimCmd gPetalDanceSmallFlowerAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(4, 1),
ANIMCMD_END,
};
const union AnimCmd *const gPetalDanceBigFlowerAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gPetalDanceBigFlowerAnimCmds,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd *const gPetalDanceSmallFlowerAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gPetalDanceSmallFlowerAnimCmds,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gPetalDanceBigFlowerSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_FLOWER,
.paletteTag = ANIM_TAG_FLOWER,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gPetalDanceBigFlowerAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimPetalDanceBigFlower,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gPetalDanceSmallFlowerSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_FLOWER,
.paletteTag = ANIM_TAG_FLOWER,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x8,
.anims = gPetalDanceSmallFlowerAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimPetalDanceSmallFlower,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gRazorLeafParticleAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_FRAME(4, 5),
ANIMCMD_FRAME(8, 5),
ANIMCMD_FRAME(12, 5),
ANIMCMD_FRAME(16, 5),
ANIMCMD_FRAME(20, 5),
ANIMCMD_FRAME(16, 5),
ANIMCMD_FRAME(12, 5),
ANIMCMD_FRAME(8, 5),
ANIMCMD_FRAME(4, 5),
ANIMCMD_JUMP(0),
};
const union AnimCmd gRazorLeafParticleAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(24, 5),
ANIMCMD_FRAME(28, 5),
ANIMCMD_FRAME(32, 5),
ANIMCMD_END,
};
const union AnimCmd *const gRazorLeafParticleAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gRazorLeafParticleAnimCmds1,
gRazorLeafParticleAnimCmds2,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gRazorLeafParticleSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_LEAF,
.paletteTag = ANIM_TAG_LEAF,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gRazorLeafParticleAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimRazorLeafParticle,
2018-12-16 18:35:10 +01:00
};
2020-02-21 18:38:20 +01:00
const struct SpriteTemplate gTwisterLeafSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_LEAF,
.paletteTag = ANIM_TAG_LEAF,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gRazorLeafParticleAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimMoveTwisterParticle,
};
const union AnimCmd gRazorLeafCutterAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 3),
ANIMCMD_FRAME(0, 3, .hFlip = TRUE),
ANIMCMD_FRAME(0, 3, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(0, 3, .vFlip = TRUE),
ANIMCMD_JUMP(0),
};
const union AnimCmd *const gRazorLeafCutterAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gRazorLeafCutterAnimCmds,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gRazorLeafCutterSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_RAZOR_LEAF,
.paletteTag = ANIM_TAG_RAZOR_LEAF,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x16,
.anims = gRazorLeafCutterAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimTranslateLinearSingleSineWave,
};
const union AffineAnimCmd gSwiftStarAffineAnimCmds[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(0, 0, 0, 1),
AFFINEANIMCMD_JUMP(0),
};
const union AffineAnimCmd *const gSwiftStarAffineAnimTable[] = {
gSwiftStarAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSwiftStarSpriteTemplate =
{
.tileTag = ANIM_TAG_YELLOW_STAR,
.paletteTag = ANIM_TAG_YELLOW_STAR,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gSwiftStarAffineAnimTable,
2018-12-16 18:35:10 +01:00
.callback = AnimTranslateLinearSingleSineWave,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_ConstrictBinding[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(32, 4),
ANIMCMD_FRAME(64, 4),
ANIMCMD_FRAME(96, 4),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_ConstrictBinding_Flipped[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 4, .hFlip = TRUE),
ANIMCMD_FRAME(32, 4, .hFlip = TRUE),
ANIMCMD_FRAME(64, 4, .hFlip = TRUE),
ANIMCMD_FRAME(96, 4, .hFlip = TRUE),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd *const sAnims_ConstrictBinding[] =
2018-12-16 18:35:10 +01:00
{
2021-04-13 08:45:16 +02:00
sAnim_ConstrictBinding,
sAnim_ConstrictBinding_Flipped,
2018-12-16 18:35:10 +01:00
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_ConstrictBinding[] = {
2018-12-20 04:13:26 +01:00
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(-11, 0, 0, 6),
AFFINEANIMCMD_FRAME(11, 0, 0, 6),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_ConstrictBinding_Flipped[] = {
2018-12-20 04:13:26 +01:00
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(11, 0, 0, 6),
AFFINEANIMCMD_FRAME(-11, 0, 0, 6),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd *const sAffineAnims_ConstrictBinding[] = {
sAffineAnim_ConstrictBinding,
sAffineAnim_ConstrictBinding_Flipped,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gConstrictBindingSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_TENDRILS,
.paletteTag = ANIM_TAG_TENDRILS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_64x32,
2021-04-13 08:45:16 +02:00
.anims = sAnims_ConstrictBinding,
2018-12-16 18:35:10 +01:00
.images = NULL,
2021-04-13 08:45:16 +02:00
.affineAnims = sAffineAnims_ConstrictBinding,
2018-12-20 04:13:26 +01:00
.callback = AnimConstrictBinding,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gMimicOrbAffineAnimCmds1[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(0, 0, 0, 0),
AFFINEANIMCMD_FRAME(48, 48, 0, 14),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gMimicOrbAffineAnimCmds2[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(-16, -16, 0, 1),
AFFINEANIMCMD_JUMP(0),
};
const union AffineAnimCmd *const gMimicOrbAffineAnimTable[] = {
gMimicOrbAffineAnimCmds1,
gMimicOrbAffineAnimCmds2,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gMimicOrbSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ORBS,
.paletteTag = ANIM_TAG_ORBS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
.anims = gPowerAbsorptionOrbAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gMimicOrbAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimMimicOrb,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gIngrainRootAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 7),
ANIMCMD_FRAME(16, 7),
ANIMCMD_FRAME(32, 7),
ANIMCMD_FRAME(48, 7),
ANIMCMD_END,
};
const union AnimCmd gIngrainRootAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 7, .hFlip = TRUE),
ANIMCMD_FRAME(16, 7, .hFlip = TRUE),
ANIMCMD_FRAME(32, 7, .hFlip = TRUE),
ANIMCMD_FRAME(48, 7, .hFlip = TRUE),
ANIMCMD_END,
};
const union AnimCmd gIngrainRootAnimCmds3[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 7),
ANIMCMD_FRAME(16, 7),
ANIMCMD_FRAME(32, 7),
ANIMCMD_END,
};
const union AnimCmd gIngrainRootAnimCmds4[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 7, .hFlip = TRUE),
ANIMCMD_FRAME(16, 7, .hFlip = TRUE),
ANIMCMD_FRAME(32, 7, .hFlip = TRUE),
ANIMCMD_END,
};
const union AnimCmd *const gIngrainRootAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gIngrainRootAnimCmds1,
gIngrainRootAnimCmds2,
gIngrainRootAnimCmds3,
gIngrainRootAnimCmds4,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gIngrainRootSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ROOTS,
.paletteTag = ANIM_TAG_ROOTS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gIngrainRootAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimIngrainRoot,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gFrenzyPlantRootSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ROOTS,
.paletteTag = ANIM_TAG_ROOTS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gIngrainRootAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimFrenzyPlantRoot,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gIngrainOrbAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(3, 3),
ANIMCMD_FRAME(0, 5),
ANIMCMD_JUMP(0),
};
const union AnimCmd *const gIngrainOrbAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gIngrainOrbAnimCmds,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gIngrainOrbSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ORBS,
.paletteTag = ANIM_TAG_ORBS,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x8,
.anims = gIngrainOrbAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimIngrainOrb,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gFallingBagAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 30),
ANIMCMD_END,
};
const union AnimCmd *const gFallingBagAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gFallingBagAnimCmds,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gFallingBagAffineAnimCmds1[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(0, 0, -4, 10),
AFFINEANIMCMD_FRAME(0, 0, 4, 20),
AFFINEANIMCMD_FRAME(0, 0, -4, 10),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gFallingBagAffineAnimCmds2[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(0, 0, -1, 2),
AFFINEANIMCMD_FRAME(0, 0, 1, 4),
AFFINEANIMCMD_FRAME(0, 0, -1, 4),
AFFINEANIMCMD_FRAME(0, 0, 1, 4),
AFFINEANIMCMD_FRAME(0, 0, -1, 4),
AFFINEANIMCMD_FRAME(0, 0, 1, 2),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd *const gFallingBagAffineAnimTable[] = {
gFallingBagAffineAnimCmds1,
gFallingBagAffineAnimCmds2,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gPresentSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ITEM_BAG,
.paletteTag = ANIM_TAG_ITEM_BAG,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
.anims = gFallingBagAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gFallingBagAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimPresent,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gKnockOffItemSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ITEM_BAG,
.paletteTag = ANIM_TAG_ITEM_BAG,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
.anims = gFallingBagAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gFallingBagAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimKnockOffItem,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gPresentHealParticleAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(4, 4),
ANIMCMD_FRAME(8, 4),
ANIMCMD_FRAME(12, 4),
ANIMCMD_END,
};
const union AnimCmd *const gPresentHealParticleAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gPresentHealParticleAnimCmds,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gPresentHealParticleSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_GREEN_SPARKLE,
.paletteTag = ANIM_TAG_GREEN_SPARKLE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gPresentHealParticleAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimPresentHealParticle,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gItemStealSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ITEM_BAG,
.paletteTag = ANIM_TAG_ITEM_BAG,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
.anims = gFallingBagAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gFallingBagAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimItemSteal,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gTrickBagAffineAnimCmds1[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(0, 0, 0, 3),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gTrickBagAffineAnimCmds2[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(0, -10, 0, 3),
AFFINEANIMCMD_FRAME(0, -6, 0, 3),
AFFINEANIMCMD_FRAME(0, -2, 0, 3),
AFFINEANIMCMD_FRAME(0, 0, 0, 3),
AFFINEANIMCMD_FRAME(0, 2, 0, 3),
AFFINEANIMCMD_FRAME(0, 6, 0, 3),
AFFINEANIMCMD_FRAME(0, 10, 0, 3),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd *const gTrickBagAffineAnimTable[] = {
gTrickBagAffineAnimCmds1,
gTrickBagAffineAnimCmds2,
gFallingBagAffineAnimCmds1,
gFallingBagAffineAnimCmds2,
2018-12-16 18:35:10 +01:00
};
2018-12-20 04:13:26 +01:00
const struct SpriteTemplate gTrickBagSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_ITEM_BAG,
.paletteTag = ANIM_TAG_ITEM_BAG,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
.anims = gFallingBagAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gTrickBagAffineAnimTable,
2018-12-20 04:13:26 +01:00
.callback = AnimTrickBag,
2018-12-16 18:35:10 +01:00
};
const s8 gTrickBagCoordinates[][3] =
2018-12-16 18:35:10 +01:00
{
{5, 24, 1},
{0, 4, 0},
{8, 16, -1},
{0, 2, 0},
{8, 16, 1},
{0, 2, 0},
{8, 16, 1},
{0, 2, 0},
{8, 16, 1},
{0, 16, 0},
{0, 0, 127},
};
2019-10-16 19:10:39 +02:00
const union AnimCmd gLeafBladeAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(28, 1),
ANIMCMD_END,
};
2019-10-16 19:10:39 +02:00
const union AnimCmd gLeafBladeAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(32, 1),
ANIMCMD_END,
};
2019-10-16 19:10:39 +02:00
const union AnimCmd gLeafBladeAnimCmds3[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(20, 1),
ANIMCMD_END,
};
2019-10-16 19:10:39 +02:00
const union AnimCmd gLeafBladeAnimCmds4[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(28, 1, .hFlip = TRUE),
ANIMCMD_END,
};
2019-10-16 19:10:39 +02:00
const union AnimCmd gLeafBladeAnimCmds5[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(16, 1),
ANIMCMD_END,
};
2019-10-16 19:10:39 +02:00
const union AnimCmd gLeafBladeAnimCmds6[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(16, 1, .hFlip = TRUE),
ANIMCMD_END,
};
2019-10-16 19:10:39 +02:00
const union AnimCmd gLeafBladeAnimCmds7[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(28, 1),
ANIMCMD_END,
};
2019-10-16 19:10:39 +02:00
const union AnimCmd *const gLeafBladeAnimTable[] =
2018-12-16 18:35:10 +01:00
{
2019-10-16 19:10:39 +02:00
gLeafBladeAnimCmds1,
gLeafBladeAnimCmds2,
gLeafBladeAnimCmds3,
gLeafBladeAnimCmds4,
gLeafBladeAnimCmds5,
gLeafBladeAnimCmds6,
gLeafBladeAnimCmds7,
2018-12-16 18:35:10 +01:00
};
2019-10-16 19:10:39 +02:00
const struct SpriteTemplate gLeafBladeSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_LEAF,
.paletteTag = ANIM_TAG_LEAF,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2019-10-16 19:10:39 +02:00
.anims = gLeafBladeAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
const union AffineAnimCmd gAromatherapyBigFlowerAffineAnimCmds[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_FRAME(0, 0, 4, 1),
AFFINEANIMCMD_JUMP(1),
};
const union AffineAnimCmd *const gAromatherapyBigFlowerAffineAnimTable[] = {
gAromatherapyBigFlowerAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gAromatherapySmallFlowerSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_FLOWER,
.paletteTag = ANIM_TAG_FLOWER,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x8,
.anims = gPetalDanceSmallFlowerAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimFlyingParticle,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gAromatherapyBigFlowerSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_FLOWER,
.paletteTag = ANIM_TAG_FLOWER,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
.anims = gPetalDanceBigFlowerAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gAromatherapyBigFlowerAffineAnimTable,
.callback = AnimFlyingParticle,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gSilverWindBigSparkAffineAnimCmds[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_FRAME(0, 0, -10, 1),
AFFINEANIMCMD_JUMP(1),
};
const union AffineAnimCmd gSilverWindMediumSparkAffineAnimCmds[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(192, 192, 0, 0),
AFFINEANIMCMD_FRAME(0, 0, -12, 1),
AFFINEANIMCMD_JUMP(1),
};
const union AffineAnimCmd gSilverWindSmallSparkAffineAnimCmds[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(143, 143, 0, 0),
AFFINEANIMCMD_FRAME(0, 0, -15, 1),
AFFINEANIMCMD_JUMP(1),
};
const union AffineAnimCmd *const gSilverWindBigSparkAffineAnimTable[] = {
gSilverWindBigSparkAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd *const gSilverWindMediumSparkAffineAnimTable[] = {
gSilverWindMediumSparkAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd *const gSilverWindSmallSparkAffineAnimTable[] = {
gSilverWindSmallSparkAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSilverWindBigSparkSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SPARKLE_6,
.paletteTag = ANIM_TAG_SPARKLE_6,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gSilverWindBigSparkAffineAnimTable,
.callback = AnimFlyingParticle,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSilverWindMediumSparkSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SPARKLE_6,
.paletteTag = ANIM_TAG_SPARKLE_6,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gSilverWindMediumSparkAffineAnimTable,
.callback = AnimFlyingParticle,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSilverWindSmallSparkSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SPARKLE_6,
.paletteTag = ANIM_TAG_SPARKLE_6,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gSilverWindSmallSparkAffineAnimTable,
.callback = AnimFlyingParticle,
2018-12-16 18:35:10 +01:00
};
const u16 gMagicalLeafBlendColors[] =
{
RGB(31, 0, 0),
RGB(31, 19, 0),
RGB(31, 31, 0),
RGB(0, 31, 0),
RGB(5, 14, 31),
RGB(22, 10, 31),
RGB(22, 21, 31),
};
const struct SpriteTemplate gNeedleArmSpikeSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_GREEN_SPIKE,
.paletteTag = ANIM_TAG_GREEN_SPIKE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-14 21:17:38 +02:00
.callback = AnimNeedleArmSpike,
2018-12-16 18:35:10 +01:00
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_Whip[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(64, 3),
ANIMCMD_FRAME(80, 3),
ANIMCMD_FRAME(96, 3),
ANIMCMD_FRAME(112, 6),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_Whip_Flipped[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(64, 3, .hFlip = TRUE),
ANIMCMD_FRAME(80, 3, .hFlip = TRUE),
ANIMCMD_FRAME(96, 3, .hFlip = TRUE),
ANIMCMD_FRAME(112, 6, .hFlip = TRUE),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd *const sAnims_Whip[] =
2018-12-16 18:35:10 +01:00
{
2021-04-13 08:45:16 +02:00
sAnim_Whip,
sAnim_Whip_Flipped,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSlamHitSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SLAM_HIT,
.paletteTag = ANIM_TAG_SLAM_HIT,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2021-04-13 08:45:16 +02:00
.anims = sAnims_Whip,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-14 23:27:12 +02:00
.callback = AnimWhipHit,
2018-12-16 18:35:10 +01:00
};
2019-04-02 08:36:22 +02:00
const struct SpriteTemplate gVineWhipSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_WHIP_HIT,
.paletteTag = ANIM_TAG_WHIP_HIT,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2021-04-13 08:45:16 +02:00
.anims = sAnims_Whip,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-14 23:27:12 +02:00
.callback = AnimWhipHit,
2018-12-16 18:35:10 +01:00
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_SlidingHit[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(32, 4),
ANIMCMD_FRAME(48, 4),
ANIMCMD_FRAME(64, 5),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd *const sAnims_SlidingHit[] =
2018-12-16 18:35:10 +01:00
{
2021-04-13 08:45:16 +02:00
sAnim_SlidingHit,
2018-12-16 18:35:10 +01:00
};
// Unused
2021-04-13 08:45:16 +02:00
static const struct SpriteTemplate sSlidingHit1SpriteTemplate =
2018-12-16 18:35:10 +01:00
{
2019-04-06 16:32:02 +02:00
.tileTag = ANIM_TAG_HIT,
.paletteTag = ANIM_TAG_HIT,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2021-04-13 08:45:16 +02:00
.anims = sAnims_SlidingHit,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2021-04-13 08:45:16 +02:00
.callback = AnimSlidingHit,
2018-12-16 18:35:10 +01:00
};
// Unused
2021-04-13 08:45:16 +02:00
static const struct SpriteTemplate sSlidingHit2SpriteTemplate =
2018-12-16 18:35:10 +01:00
{
2019-04-06 16:32:02 +02:00
.tileTag = ANIM_TAG_HIT_2,
.paletteTag = ANIM_TAG_HIT_2,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2021-04-13 08:45:16 +02:00
.anims = sAnims_SlidingHit,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2021-04-13 08:45:16 +02:00
.callback = AnimSlidingHit,
2018-12-16 18:35:10 +01:00
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_FlickeringPunch_Normal[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_FlickeringPunch_TurnedTopLeft[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, 32, 0),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_FlickeringPunch_TurnedLeft[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, 64, 0),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_FlickeringPunch_TurnedBottomLeft[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, 96, 0),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_FlickeringPunch_UpsideDown[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, -128, 0),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_FlickeringPunch_TurnedBottomRight[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, -96, 0),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_FlickeringPunch_TurnedRight[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, -64, 0),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd sAffineAnim_FlickeringPunch_TurnedTopRight[] = {
2018-12-16 18:35:10 +01:00
AFFINEANIMCMD_FRAME(256, 256, -32, 0),
AFFINEANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AffineAnimCmd *const sAffineAnims_FlickeringPunch[] = {
sAffineAnim_FlickeringPunch_Normal,
sAffineAnim_FlickeringPunch_TurnedTopLeft,
sAffineAnim_FlickeringPunch_TurnedLeft,
sAffineAnim_FlickeringPunch_TurnedBottomLeft,
sAffineAnim_FlickeringPunch_UpsideDown,
sAffineAnim_FlickeringPunch_TurnedBottomRight,
sAffineAnim_FlickeringPunch_TurnedRight,
sAffineAnim_FlickeringPunch_TurnedTopRight,
2018-12-16 18:35:10 +01:00
};
// Unused
2021-04-13 08:45:16 +02:00
static const struct SpriteTemplate sFlickeringPunchSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2021-04-13 08:45:16 +02:00
.affineAnims = sAffineAnims_FlickeringPunch,
.callback = AnimFlickeringPunch,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gCuttingSliceAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_FRAME(16, 5),
ANIMCMD_FRAME(32, 5),
ANIMCMD_FRAME(48, 5),
ANIMCMD_END,
};
const union AnimCmd *const gCuttingSliceAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gCuttingSliceAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gCuttingSliceSpriteTemplate =
{
.tileTag = ANIM_TAG_CUT,
.paletteTag = ANIM_TAG_CUT,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjBlend_32x32,
.anims = gCuttingSliceAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimCuttingSlice,
};
const struct SpriteTemplate gAirCutterSliceSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_CUT,
.paletteTag = ANIM_TAG_CUT,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjBlend_32x32,
.anims = gCuttingSliceAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimAirCutterSlice,
2018-12-16 18:35:10 +01:00
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_Eighth[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_BeamedEighth[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(4, 1),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_SlantedBeamedEighth[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(8, 1),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_Quarter[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(12, 1),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_QuarterRest[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(16, 1),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_EighthRest[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(20, 1),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_Eighth_Flipped[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 1, .vFlip = TRUE),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_BeamedEighth_Flipped[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(4, 1, .vFlip = TRUE),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_SlantedBeamedEighth_Flipped[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(8, 1, .vFlip = TRUE),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_CirclingMusicNote_Quarter_Flipped[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(12, 1, .vFlip = TRUE),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd *const sAnims_CirclingMusicNote[] =
2018-12-16 18:35:10 +01:00
{
2021-04-13 08:45:16 +02:00
sAnim_CirclingMusicNote_Eighth,
sAnim_CirclingMusicNote_BeamedEighth,
sAnim_CirclingMusicNote_SlantedBeamedEighth,
sAnim_CirclingMusicNote_Quarter,
sAnim_CirclingMusicNote_QuarterRest,
sAnim_CirclingMusicNote_EighthRest,
sAnim_CirclingMusicNote_Eighth_Flipped,
sAnim_CirclingMusicNote_BeamedEighth_Flipped,
sAnim_CirclingMusicNote_SlantedBeamedEighth_Flipped,
sAnim_CirclingMusicNote_Quarter_Flipped,
2018-12-16 18:35:10 +01:00
};
// Unused
2021-04-13 08:45:16 +02:00
static const struct SpriteTemplate sCirclingMusicNoteSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_MUSIC_NOTES,
.paletteTag = ANIM_TAG_MUSIC_NOTES,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2021-04-13 08:45:16 +02:00
.anims = sAnims_CirclingMusicNote,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2021-04-13 08:45:16 +02:00
.callback = AnimCirclingMusicNote,
2018-12-16 18:35:10 +01:00
};
2020-02-16 23:49:24 +01:00
const struct SpriteTemplate gProtectSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_PROTECT,
.paletteTag = ANIM_TAG_PROTECT,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjBlend_64x64,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimProtect,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gMilkBottleAffineAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gMilkBottleAffineAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(0x0, 0x0, 2, 12),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 6),
AFFINEANIMCMD_FRAME(0x0, 0x0, -2, 24),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 6),
AFFINEANIMCMD_FRAME(0x0, 0x0, 2, 12),
AFFINEANIMCMD_JUMP(0),
};
const union AffineAnimCmd *const gMilkBottleAffineAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gMilkBottleAffineAnimCmds1,
gMilkBottleAffineAnimCmds2,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gMilkBottleSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_MILK_BOTTLE,
.paletteTag = ANIM_TAG_MILK_BOTTLE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjBlend_32x32,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gMilkBottleAffineAnimTable,
2019-10-14 21:17:38 +02:00
.callback = AnimMilkBottle,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gGrantingStarsAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 7),
ANIMCMD_FRAME(16, 7),
ANIMCMD_FRAME(32, 7),
ANIMCMD_FRAME(48, 7),
ANIMCMD_FRAME(64, 7),
ANIMCMD_FRAME(80, 7),
ANIMCMD_FRAME(96, 7),
ANIMCMD_FRAME(112, 7),
ANIMCMD_JUMP(0),
};
const union AnimCmd *const gGrantingStarsAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gGrantingStarsAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gGrantingStarsSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SPARKLE_2,
.paletteTag = ANIM_TAG_SPARKLE_2,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gGrantingStarsAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimGrantingStars,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSparklingStarsSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SPARKLE_2,
.paletteTag = ANIM_TAG_SPARKLE_2,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gGrantingStarsAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSparkingStars,
2018-12-16 18:35:10 +01:00
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_BubbleBurst[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 10),
ANIMCMD_FRAME(4, 10),
ANIMCMD_FRAME(8, 10),
ANIMCMD_FRAME(12, 10),
ANIMCMD_FRAME(16, 26),
ANIMCMD_FRAME(16, 5),
ANIMCMD_FRAME(20, 5),
ANIMCMD_FRAME(24, 15),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd sAnim_BubbleBurst_Flipped[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 10, .hFlip = TRUE),
ANIMCMD_FRAME(4, 10, .hFlip = TRUE),
ANIMCMD_FRAME(8, 10, .hFlip = TRUE),
ANIMCMD_FRAME(12, 10, .hFlip = TRUE),
ANIMCMD_FRAME(16, 26, .hFlip = TRUE),
ANIMCMD_FRAME(16, 5, .hFlip = TRUE),
ANIMCMD_FRAME(20, 5, .hFlip = TRUE),
ANIMCMD_FRAME(24, 15, .hFlip = TRUE),
ANIMCMD_END,
};
2021-04-13 08:45:16 +02:00
static const union AnimCmd *const sAnims_BubbleBurst[] =
2018-12-16 18:35:10 +01:00
{
2021-04-13 08:45:16 +02:00
sAnim_BubbleBurst,
sAnim_BubbleBurst_Flipped,
2018-12-16 18:35:10 +01:00
};
// Unused
2021-04-13 08:45:16 +02:00
static const struct SpriteTemplate sBubbleBurstSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
2019-04-06 16:32:02 +02:00
.tileTag = ANIM_TAG_BUBBLE_BURST,
.paletteTag = ANIM_TAG_BUBBLE_BURST,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2021-04-13 08:45:16 +02:00
.anims = sAnims_BubbleBurst,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2021-04-13 08:45:16 +02:00
.callback = AnimBubbleBurst,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gSleepLetterZAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 40),
ANIMCMD_END,
};
const union AnimCmd *const gSleepLetterZAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gSleepLetterZAnimCmds,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gSleepLetterZAffineAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(0x14, 0x14, -30, 0),
AFFINEANIMCMD_FRAME(0x8, 0x8, 1, 24),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gSleepLetterZAffineAnimCmds1_2[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_LOOP(0),
AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 24),
AFFINEANIMCMD_LOOP(10),
};
const union AffineAnimCmd gSleepLetterZAffineAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(0x14, 0x14, 30, 0),
AFFINEANIMCMD_FRAME(0x8, 0x8, -1, 24),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gSleepLetterZAffineAnimCmds2_2[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_LOOP(0),
AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 24),
AFFINEANIMCMD_LOOP(10),
};
const union AffineAnimCmd *const gSleepLetterZAffineAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gSleepLetterZAffineAnimCmds1,
gSleepLetterZAffineAnimCmds2,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSleepLetterZSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_LETTER_Z,
.paletteTag = ANIM_TAG_LETTER_Z,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
.anims = gSleepLetterZAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gSleepLetterZAffineAnimTable,
.callback = AnimSleepLetterZ,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gLockOnTargetSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_LOCK_ON,
.paletteTag = ANIM_TAG_LOCK_ON,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimLockOnTarget,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gLockOnMoveTargetSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_LOCK_ON,
.paletteTag = ANIM_TAG_LOCK_ON,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-14 21:17:38 +02:00
.callback = AnimLockOnMoveTarget,
2018-12-16 18:35:10 +01:00
};
const s8 gInclineMonCoordTable[][2] =
2018-12-16 18:35:10 +01:00
{
{ 64, 64},
{ 0, -64},
{-64, 64},
{ 32, -32},
};
2019-10-16 19:10:39 +02:00
const struct SpriteTemplate gBowMonSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gDummyOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-16 19:10:39 +02:00
.callback = AnimBowMon,
2018-12-16 18:35:10 +01:00
};
// Unused
2021-04-13 08:45:16 +02:00
// Same as BowMon above but without backing up
static const struct SpriteTemplate sTipMonSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gDummyOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2021-04-13 08:45:16 +02:00
.callback = AnimTipMon,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gSlashSliceAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(32, 4),
ANIMCMD_FRAME(48, 4),
ANIMCMD_END,
};
const union AnimCmd gSlashSliceAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(48, 4),
ANIMCMD_END,
};
const union AnimCmd *const gSlashSliceAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gSlashSliceAnimCmds1,
gSlashSliceAnimCmds2,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSlashSliceSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SLASH,
.paletteTag = ANIM_TAG_SLASH,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gSlashSliceAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSlashSlice,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gFalseSwipeSliceSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SLASH_2,
.paletteTag = ANIM_TAG_SLASH_2,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gSlashSliceAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimFalseSwipeSlice,
2018-12-16 18:35:10 +01:00
};
2019-10-16 19:10:39 +02:00
const struct SpriteTemplate gFalseSwipePositionedSliceSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SLASH_2,
.paletteTag = ANIM_TAG_SLASH_2,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gSlashSliceAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-16 19:21:58 +02:00
.callback = AnimFalseSwipePositionedSlice,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gEndureEnergyAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(8, 12),
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(24, 4),
ANIMCMD_END,
};
const union AnimCmd *const gEndureEnergyAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gEndureEnergyAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gEndureEnergySpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_FOCUS_ENERGY,
.paletteTag = ANIM_TAG_FOCUS_ENERGY,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x32,
.anims = gEndureEnergyAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimEndureEnergy,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gSharpenSphereAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 18),
ANIMCMD_FRAME(0, 6),
ANIMCMD_FRAME(16, 18),
ANIMCMD_FRAME(0, 6),
ANIMCMD_FRAME(16, 6),
ANIMCMD_FRAME(32, 18),
ANIMCMD_FRAME(16, 6),
ANIMCMD_FRAME(32, 6),
ANIMCMD_FRAME(48, 18),
ANIMCMD_FRAME(32, 6),
ANIMCMD_FRAME(48, 6),
ANIMCMD_FRAME(64, 18),
ANIMCMD_FRAME(48, 6),
ANIMCMD_FRAME(64, 54),
ANIMCMD_END,
};
const union AnimCmd *const gSharpenSphereAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gSharpenSphereAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSharpenSphereSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_SPHERE_TO_CUBE,
.paletteTag = ANIM_TAG_SPHERE_TO_CUBE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gSharpenSphereAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSharpenSphere,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gOctazookaBallSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_BLACK_BALL,
.paletteTag = ANIM_TAG_BLACK_BALL,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_8x8,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = TranslateAnimSpriteToTargetMonLocation,
};
const union AnimCmd gOctazookaAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 3),
ANIMCMD_FRAME(16, 3),
ANIMCMD_FRAME(32, 3),
ANIMCMD_FRAME(48, 3),
ANIMCMD_FRAME(64, 3),
ANIMCMD_END,
};
const union AnimCmd *const gOctazookaAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gOctazookaAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gOctazookaSmokeSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_GRAY_SMOKE,
.paletteTag = ANIM_TAG_GRAY_SMOKE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gOctazookaAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 16:22:53 +02:00
.callback = AnimSpriteOnMonPos,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gConversionAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(3, 5),
ANIMCMD_FRAME(2, 5),
ANIMCMD_FRAME(1, 5),
ANIMCMD_FRAME(0, 5),
ANIMCMD_END,
};
const union AnimCmd *const gConversionAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gConversionAnimCmds,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gConversionAffineAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd *const gConversionAffineAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gConversionAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gConversionSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_CONVERSION,
.paletteTag = ANIM_TAG_CONVERSION,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_8x8,
.anims = gConversionAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gConversionAffineAnimTable,
.callback = AnimConversion,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gConversion2AnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_FRAME(1, 5),
ANIMCMD_FRAME(2, 5),
ANIMCMD_FRAME(3, 5),
ANIMCMD_END,
};
const union AnimCmd *const gConversion2AnimTable[] =
2018-12-16 18:35:10 +01:00
{
gConversion2AnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gConversion2SpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_CONVERSION,
.paletteTag = ANIM_TAG_CONVERSION,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_8x8,
.anims = gConversion2AnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gConversionAffineAnimTable,
2019-10-14 21:17:38 +02:00
.callback = AnimConversion2,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gMoonSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_MOON,
.paletteTag = ANIM_TAG_MOON,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjBlend_64x64,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimMoon,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gMoonlightSparkleAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 8),
ANIMCMD_FRAME(4, 8),
ANIMCMD_FRAME(8, 8),
ANIMCMD_FRAME(12, 8),
ANIMCMD_JUMP(0),
};
const union AnimCmd *const gMoonlightSparkleAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gMoonlightSparkleAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gMoonlightSparkleSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_GREEN_SPARKLE,
.paletteTag = ANIM_TAG_GREEN_SPARKLE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gMoonlightSparkleAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimMoonlightSparkle,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gHealingBlueStarAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 2),
ANIMCMD_FRAME(16, 2),
ANIMCMD_FRAME(32, 2),
ANIMCMD_FRAME(48, 3),
ANIMCMD_FRAME(64, 5),
ANIMCMD_FRAME(80, 3),
ANIMCMD_FRAME(96, 2),
ANIMCMD_FRAME(0, 2),
ANIMCMD_END,
};
const union AnimCmd *const gHealingBlueStarAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gHealingBlueStarAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gHealingBlueStarSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_BLUE_STAR,
.paletteTag = ANIM_TAG_BLUE_STAR,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gHealingBlueStarAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 16:22:53 +02:00
.callback = AnimSpriteOnMonPos,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gHornHitSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_HORN_HIT,
.paletteTag = ANIM_TAG_HORN_HIT,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimHornHit,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gSuperFangAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 2),
ANIMCMD_FRAME(16, 2),
ANIMCMD_FRAME(32, 2),
ANIMCMD_FRAME(48, 2),
ANIMCMD_END,
};
const union AnimCmd *const gSuperFangAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gSuperFangAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSuperFangSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_FANG_ATTACK,
.paletteTag = ANIM_TAG_FANG_ATTACK,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gSuperFangAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSuperFang,
2018-12-16 18:35:10 +01:00
};
2019-10-16 19:26:08 +02:00
const union AnimCmd gWavyMusicNotesAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 10),
ANIMCMD_END,
};
2019-10-16 19:26:08 +02:00
const union AnimCmd gWavyMusicNotesAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(4, 10),
ANIMCMD_END,
};
2019-10-16 19:26:08 +02:00
const union AnimCmd gWavyMusicNotesAnimCmds3[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(8, 41),
ANIMCMD_END,
};
2019-10-16 19:26:08 +02:00
const union AnimCmd gWavyMusicNotesAnimCmds4[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(12, 10),
ANIMCMD_END,
};
2019-10-16 19:26:08 +02:00
const union AnimCmd gWavyMusicNotesAnimCmds5[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(16, 10),
ANIMCMD_END,
};
2019-10-16 19:26:08 +02:00
const union AnimCmd gWavyMusicNotesAnimCmds6[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(20, 10),
ANIMCMD_END,
};
2019-10-16 19:26:08 +02:00
const union AnimCmd gWavyMusicNotesAnimCmds7[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 10, .vFlip = TRUE),
ANIMCMD_END,
};
2019-10-16 19:26:08 +02:00
const union AnimCmd gWavyMusicNotesAnimCmds8[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(4, 10, .vFlip = TRUE),
ANIMCMD_END,
};
const union AnimCmd *const gMusicNotesAnimTable[] =
2018-12-16 18:35:10 +01:00
{
2019-10-16 19:26:08 +02:00
gWavyMusicNotesAnimCmds1,
gWavyMusicNotesAnimCmds2,
gWavyMusicNotesAnimCmds3,
gWavyMusicNotesAnimCmds4,
gWavyMusicNotesAnimCmds5,
gWavyMusicNotesAnimCmds6,
gWavyMusicNotesAnimCmds7,
gWavyMusicNotesAnimCmds8,
2018-12-16 18:35:10 +01:00
};
2019-10-16 19:26:08 +02:00
const union AffineAnimCmd gWavyMusicNotesAffineAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(0xC, 0xC, 0, 16),
AFFINEANIMCMD_FRAME(0xFFF4, 0xFFF4, 0, 16),
AFFINEANIMCMD_JUMP(0),
};
const union AffineAnimCmd *const gMusicNotesAffineAnimTable[] =
2018-12-16 18:35:10 +01:00
{
2019-10-16 19:26:08 +02:00
gWavyMusicNotesAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
2019-10-16 19:10:39 +02:00
const struct SpriteTemplate gWavyMusicNotesSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_MUSIC_NOTES,
.paletteTag = ANIM_TAG_MUSIC_NOTES,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
.anims = gMusicNotesAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gMusicNotesAffineAnimTable,
2019-10-16 19:26:08 +02:00
.callback = AnimWavyMusicNotes,
2018-12-16 18:35:10 +01:00
};
const u16 gParticlesColorBlendTable[][6] =
2018-12-16 18:35:10 +01:00
{
{ANIM_TAG_MUSIC_NOTES, RGB(31, 31, 31), RGB(31, 26, 28), RGB(31, 22, 26), RGB(31, 17, 24), RGB(31, 13, 22)},
{ANIM_TAG_BENT_SPOON, RGB(31, 31, 31), RGB(25, 31, 26), RGB(20, 31, 21), RGB(15, 31, 16), RGB(10, 31, 12)},
{ANIM_TAG_SPHERE_TO_CUBE, RGB(31, 31, 31), RGB(31, 31, 24), RGB(31, 31, 17), RGB(31, 31, 10), RGB(31, 31, 3)},
{ANIM_TAG_LARGE_FRESH_EGG, RGB(31, 31, 31), RGB(26, 28, 31), RGB(21, 26, 31), RGB(16, 24, 31), RGB(12, 22, 31)},
};
const struct SpriteTemplate gFastFlyingMusicNotesSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_MUSIC_NOTES,
.paletteTag = ANIM_TAG_MUSIC_NOTES,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
.anims = gMusicNotesAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gMusicNotesAffineAnimTable,
.callback = AnimFlyingMusicNotes,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gBellyDrumHandSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_PURPLE_HAND_OUTLINE,
.paletteTag = ANIM_TAG_PURPLE_HAND_OUTLINE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimBellyDrumHand,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gSlowFlyingMusicNotesAffineAnimCmds[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(0xA0, 0xA0, 0, 0),
AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 1),
AFFINEANIMCMD_JUMP(1),
};
const union AffineAnimCmd *const gSlowFlyingMusicNotesAffineAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gSlowFlyingMusicNotesAffineAnimCmds,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gSlowFlyingMusicNotesSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_MUSIC_NOTES,
.paletteTag = ANIM_TAG_MUSIC_NOTES,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
.anims = gMusicNotesAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gSlowFlyingMusicNotesAffineAnimTable,
.callback = AnimSlowFlyingMusicNotes,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gMetronomeThroughtBubbleAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 2, .hFlip = TRUE),
ANIMCMD_FRAME(16, 2, .hFlip = TRUE),
ANIMCMD_FRAME(32, 2, .hFlip = TRUE),
ANIMCMD_FRAME(48, 2, .hFlip = TRUE),
ANIMCMD_END,
};
const union AnimCmd gMetronomeThroughtBubbleAnimCmds3[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(48, 2, .hFlip = TRUE),
ANIMCMD_FRAME(32, 2, .hFlip = TRUE),
ANIMCMD_FRAME(16, 2, .hFlip = TRUE),
ANIMCMD_FRAME(0, 2, .hFlip = TRUE),
ANIMCMD_END,
};
const union AnimCmd gMetronomeThroughtBubbleAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 2),
ANIMCMD_FRAME(16, 2),
ANIMCMD_FRAME(32, 2),
ANIMCMD_FRAME(48, 2),
ANIMCMD_END,
};
const union AnimCmd gMetronomeThroughtBubbleAnimCmds4[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(48, 2),
ANIMCMD_FRAME(32, 2),
ANIMCMD_FRAME(16, 2),
ANIMCMD_FRAME(0, 2),
ANIMCMD_END,
};
const union AnimCmd *const gMetronomeThroughtBubbleAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gMetronomeThroughtBubbleAnimCmds1,
gMetronomeThroughtBubbleAnimCmds2,
gMetronomeThroughtBubbleAnimCmds3,
gMetronomeThroughtBubbleAnimCmds4,
2018-12-16 18:35:10 +01:00
};
2019-10-16 19:10:39 +02:00
const struct SpriteTemplate gThoughtBubbleSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_THOUGHT_BUBBLE,
.paletteTag = ANIM_TAG_THOUGHT_BUBBLE,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gMetronomeThroughtBubbleAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-16 19:10:39 +02:00
.callback = AnimThoughtBubble,
2018-12-16 18:35:10 +01:00
};
const union AffineAnimCmd gMetronomeFingerAffineAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0),
AFFINEANIMCMD_FRAME(0x1E, 0x1E, 0, 8),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gMetronomeFingerAffineAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(0x0, 0x0, 4, 11),
AFFINEANIMCMD_FRAME(0x0, 0x0, -4, 11),
AFFINEANIMCMD_LOOP(2),
AFFINEANIMCMD_FRAME(0xFFE2, 0xFFE2, 0, 8),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gMetronomeFingerAffineAnimCmds2_2[] =
2018-12-16 18:35:10 +01:00
{
AFFINEANIMCMD_FRAME(16, 16, 0, 0),
AFFINEANIMCMD_FRAME(30, 30, 0, 8),
AFFINEANIMCMD_FRAME(0, 0, 0, 16),
AFFINEANIMCMD_LOOP(0),
AFFINEANIMCMD_FRAME(0, 0, 4, 11),
AFFINEANIMCMD_FRAME(0, 0, -4, 11),
AFFINEANIMCMD_LOOP(2),
AFFINEANIMCMD_FRAME(-30, -30, 0, 8),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd *const gMetronomeFingerAffineAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gMetronomeFingerAffineAnimCmds1,
gMetronomeFingerAffineAnimCmds2,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gMetronomeFingerSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_FINGER,
.paletteTag = ANIM_TAG_FINGER,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_32x32,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gMetronomeFingerAffineAnimTable,
2019-10-14 21:17:38 +02:00
.callback = AnimMetronomeFinger,
2018-12-16 18:35:10 +01:00
};
2019-10-14 21:17:38 +02:00
const struct SpriteTemplate gFollowMeFingerSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_FINGER,
.paletteTag = ANIM_TAG_FINGER,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
2018-12-16 18:35:10 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gMetronomeFingerAffineAnimTable,
2019-10-14 21:17:38 +02:00
.callback = AnimFollowMeFinger,
2018-12-16 18:35:10 +01:00
};
const union AnimCmd gTauntFingerAnimCmds1[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
const union AnimCmd gTauntFingerAnimCmds2[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 1, .hFlip = TRUE),
ANIMCMD_END,
};
const union AnimCmd gTauntFingerAnimCmds3[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(32, 4),
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(32, 4),
ANIMCMD_END,
};
const union AnimCmd gTauntFingerAnimCmds4[] =
2018-12-16 18:35:10 +01:00
{
ANIMCMD_FRAME(0, 4, .hFlip = TRUE),
ANIMCMD_FRAME(16, 4, .hFlip = TRUE),
ANIMCMD_FRAME(32, 4, .hFlip = TRUE),
ANIMCMD_FRAME(16, 4, .hFlip = TRUE),
ANIMCMD_FRAME(0, 4, .hFlip = TRUE),
ANIMCMD_FRAME(16, 4, .hFlip = TRUE),
ANIMCMD_FRAME(32, 4, .hFlip = TRUE),
ANIMCMD_END,
};
const union AnimCmd *const gTauntFingerAnimTable[] =
2018-12-16 18:35:10 +01:00
{
gTauntFingerAnimCmds1,
gTauntFingerAnimCmds2,
gTauntFingerAnimCmds3,
gTauntFingerAnimCmds4,
2018-12-16 18:35:10 +01:00
};
const struct SpriteTemplate gTauntFingerSpriteTemplate =
2018-12-16 18:35:10 +01:00
{
.tileTag = ANIM_TAG_FINGER_2,
.paletteTag = ANIM_TAG_FINGER_2,
2019-10-16 19:21:58 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = gTauntFingerAnimTable,
2018-12-16 18:35:10 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimTauntFinger,
2018-12-16 18:35:10 +01:00
};
// Animates the falling particles that horizontally wave back and forth.
// Used by Sleep Powder, Stun Spore, and Poison Powder.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: total duration in frames
// arg 3: vertical movement speed (sub-pixel value)
// arg 4: wave amplitude
// arg 5: wave speed
2020-02-20 22:22:33 +01:00
static void AnimMovePowderParticle(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = gBattleAnimArgs[3];
if (GetBattlerSide(gBattleAnimAttacker))
{
sprite->data[3] = -gBattleAnimArgs[4];
}
else
{
sprite->data[3] = gBattleAnimArgs[4];
}
sprite->data[4] = gBattleAnimArgs[5];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimMovePowderParticle_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimMovePowderParticle_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0] > 0)
{
sprite->data[0]--;
2021-07-07 15:11:52 +02:00
sprite->y2 = sprite->data[2] >> 8;
2018-12-16 18:35:10 +01:00
sprite->data[2] += sprite->data[1];
2021-07-07 15:11:52 +02:00
sprite->x2 = Sin(sprite->data[5], sprite->data[3]);
2018-12-16 18:35:10 +01:00
sprite->data[5] = (sprite->data[5] + sprite->data[4]) & 0xFF;
}
else
{
DestroyAnimSprite(sprite);
}
}
2018-12-20 04:13:26 +01:00
// Moves an energy orb towards the center of the mon.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: duration
2020-02-20 22:22:33 +01:00
static void AnimPowerAbsorptionOrb(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[2];
2018-12-20 04:13:26 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
sprite->callback = StartAnimLinearTranslation;
2018-12-18 05:08:08 +01:00
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
2018-12-16 18:35:10 +01:00
}
2018-12-20 04:13:26 +01:00
// Moves an orb in a straight line towards the target mon.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: duration
// arg 3: sprite anim number
2021-11-01 22:36:35 +01:00
static void AnimSolarBeamBigOrb(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[3]);
sprite->data[0] = gBattleAnimArgs[2];
2018-12-20 04:13:26 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2018-12-20 04:13:26 +01:00
// Moves a small orb in a wavy pattern towards the target mon.
2021-11-01 22:36:35 +01:00
// The small orb "circles" the big orbs in AnimSolarBeamBigOrb.
2018-12-20 04:13:26 +01:00
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: duration
// arg 3: initial wave offset
2021-11-01 22:36:35 +01:00
static void AnimSolarBeamSmallOrb(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[2];
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-20 04:13:26 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-20 04:13:26 +01:00
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
InitAnimLinearTranslation(sprite);
sprite->data[5] = gBattleAnimArgs[3];
2021-11-01 22:36:35 +01:00
sprite->callback = AnimSolarBeamSmallOrb_Step;
2018-12-16 18:35:10 +01:00
sprite->callback(sprite);
}
2021-11-01 22:36:35 +01:00
static void AnimSolarBeamSmallOrb_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
if (AnimTranslateLinear(sprite))
2018-12-16 18:35:10 +01:00
{
DestroySprite(sprite);
}
else
{
if (sprite->data[5] > 0x7F)
2018-12-18 05:08:08 +01:00
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimTarget) + 1;
2018-12-16 18:35:10 +01:00
else
2018-12-18 05:08:08 +01:00
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimTarget) + 6;
2018-12-16 18:35:10 +01:00
2021-07-07 15:11:52 +02:00
sprite->x2 += Sin(sprite->data[5], 5);
sprite->y2 += Cos(sprite->data[5], 14);
2018-12-16 18:35:10 +01:00
sprite->data[5] = (sprite->data[5] + 15) & 0xFF;
}
}
2021-11-01 22:36:35 +01:00
// Creates 15 small secondary orbs used in the SolarBeam anim effect.
2018-12-20 04:13:26 +01:00
// There is a 7-frame delay between each of them.
// No args.
2021-11-01 22:36:35 +01:00
void AnimTask_CreateSmallSolarBeamOrbs(u8 taskId)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
if (--gTasks[taskId].data[0] == -1)
2018-12-16 18:35:10 +01:00
{
gTasks[taskId].data[1]++;
gTasks[taskId].data[0] = 6;
gBattleAnimArgs[0] = 15;
gBattleAnimArgs[1] = 0;
gBattleAnimArgs[2] = 80;
gBattleAnimArgs[3] = 0;
2021-11-01 22:36:35 +01:00
CreateSpriteAndAnimate(&gSolarBeamSmallOrbSpriteTemplate, 0, 0, GetBattlerSpriteSubpriority(gBattleAnimTarget) + 1);
2018-12-16 18:35:10 +01:00
}
if (gTasks[taskId].data[1] == 15)
DestroyAnimVisualTask(taskId);
}
2018-12-20 04:13:26 +01:00
// Moves an orb from the target mon to the attacking mon in an arc-like fashion.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: wave amplitude
// arg 3: wave period (lower means faster wave)
2020-02-20 22:22:33 +01:00
static void AnimAbsorptionOrb(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, TRUE);
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[3];
2018-12-20 04:13:26 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
sprite->data[5] = gBattleAnimArgs[2];
InitAnimArcTranslation(sprite);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimAbsorptionOrb_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimAbsorptionOrb_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-12-16 18:35:10 +01:00
DestroyAnimSprite(sprite);
}
2018-12-20 04:13:26 +01:00
// Moves an orb in a wave-like fashion towards the target mon. The wave's
// properties and the sprite anim are randomly determined.
2020-02-20 22:22:33 +01:00
static void AnimHyperBeamOrb(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
u16 speed;
u16 animNum = Random2();
2019-04-02 08:36:22 +02:00
2018-12-20 04:13:26 +01:00
StartSpriteAnim(sprite, animNum % 8);
2021-07-07 15:11:52 +02:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-20 04:13:26 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
sprite->x -= 20;
2018-12-16 18:35:10 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->x += 20;
2018-12-16 18:35:10 +01:00
2018-12-20 04:13:26 +01:00
speed = Random2();
sprite->data[0] = (speed & 31) + 64;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-20 04:13:26 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-20 04:13:26 +01:00
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
InitAnimFastLinearTranslationWithSpeed(sprite);
2018-12-16 18:35:10 +01:00
sprite->data[5] = Random2() & 0xFF;
sprite->data[6] = sprite->subpriority;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimHyperBeamOrb_Step;
2018-12-16 18:35:10 +01:00
sprite->callback(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimHyperBeamOrb_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
if (AnimFastTranslateLinear(sprite))
2018-12-16 18:35:10 +01:00
{
DestroyAnimSprite(sprite);
}
else
{
2021-07-07 15:11:52 +02:00
sprite->y2 += Cos(sprite->data[5], 12);
2018-12-16 18:35:10 +01:00
if (sprite->data[5] < 0x7F)
sprite->subpriority = sprite->data[6];
else
sprite->subpriority = sprite->data[6] + 1;
2018-12-20 04:13:26 +01:00
sprite->data[5] += 24;
sprite->data[5] &= 0xFF;
2018-12-16 18:35:10 +01:00
}
}
// seed (sprouts a sapling from a seed.)
// Used by Leech Seed.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: target x pixel offset
// arg 3: target y pixel offset
// arg 4: duration
// arg 5: wave amplitude
2020-02-20 22:22:33 +01:00
static void AnimLeechSeed(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
2018-12-16 18:35:10 +01:00
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
2018-12-20 04:13:26 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + gBattleAnimArgs[3];
2018-12-16 18:35:10 +01:00
sprite->data[5] = gBattleAnimArgs[5];
InitAnimArcTranslation(sprite);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimLeechSeed_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimLeechSeed_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-12-16 18:35:10 +01:00
{
2020-02-20 22:22:33 +01:00
sprite->invisible = TRUE;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 10;
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData6(sprite, AnimLeechSeedSprouts);
}
}
static void AnimLeechSeedSprouts(struct Sprite* sprite)
{
2020-02-20 22:22:33 +01:00
sprite->invisible = FALSE;
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, 1);
sprite->data[0] = 60;
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2018-12-20 04:13:26 +01:00
// Moves a spore particle in a halo around the target mon.
// The sprite's priority is updated to give the effect of going
// behind the mon's sprite.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: initial wave offset
// arg 3: duration
// arg 4: blend (0 = off, 1 = on)
2020-02-20 22:22:33 +01:00
static void AnimSporeParticle(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, TRUE);
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[4]);
if (gBattleAnimArgs[4] == 1)
sprite->oam.objMode = ST_OAM_OBJ_BLEND;
sprite->data[0] = gBattleAnimArgs[3];
sprite->data[1] = gBattleAnimArgs[2];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSporeParticle_Step;
2018-12-16 18:35:10 +01:00
sprite->callback(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimSporeParticle_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x2 = Sin(sprite->data[1], 32);
sprite->y2 = Cos(sprite->data[1], -3) + ((sprite->data[2] += 24) >> 8);
2018-12-16 18:35:10 +01:00
if ((u16)(sprite->data[1] - 0x40) < 0x80)
{
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget);
2018-12-16 18:35:10 +01:00
}
else
{
2018-12-20 04:13:26 +01:00
u8 priority = GetBattlerSpriteBGPriority(gBattleAnimTarget) + 1;
2018-12-16 18:35:10 +01:00
if (priority > 3)
priority = 3;
sprite->oam.priority = priority;
}
2018-12-20 04:13:26 +01:00
sprite->data[1] += 2;
sprite->data[1] &= 0xFF;
2018-12-16 18:35:10 +01:00
if (--sprite->data[0] == -1)
DestroyAnimSprite(sprite);
}
2018-12-20 04:13:26 +01:00
// In a double battle, Updates the mon sprite background priorities to allow
// the circling effect controlled by AnimSporeParticle.
// No args.
void AnimTask_SporeDoubleBattle(u8 taskId)
2018-12-16 18:35:10 +01:00
{
if (IsContest() || !IsDoubleBattle())
{
DestroyAnimVisualTask(taskId);
}
else
{
2018-12-20 04:13:26 +01:00
if (GetBattlerSpriteBGPriorityRank(gBattleAnimTarget) == 1)
2018-12-16 18:35:10 +01:00
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 3);
else
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
DestroyAnimVisualTask(taskId);
}
}
2018-12-20 04:13:26 +01:00
// Rotates a big flower around the attacking mon, and slowly floats
// downward.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: target y pixel offset
// arg 3: duration
2020-02-20 22:22:33 +01:00
static void AnimPetalDanceBigFlower(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, FALSE);
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[3];
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
sprite->data[2] = sprite->x;
sprite->data[3] = sprite->y;
2018-12-20 04:13:26 +01:00
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
2018-12-16 18:35:10 +01:00
InitAnimLinearTranslation(sprite);
sprite->data[5] = 0x40;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimPetalDanceBigFlower_Step;
2018-12-16 18:35:10 +01:00
sprite->callback(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimPetalDanceBigFlower_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
if (!AnimTranslateLinear(sprite))
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x2 += Sin(sprite->data[5], 32);
sprite->y2 += Cos(sprite->data[5], -5);
2018-12-16 18:35:10 +01:00
if ((u16)(sprite->data[5] - 0x40) < 0x80)
2018-12-18 05:08:08 +01:00
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 1;
2018-12-16 18:35:10 +01:00
else
2018-12-18 05:08:08 +01:00
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) + 1;
2018-12-16 18:35:10 +01:00
sprite->data[5] = (sprite->data[5] + 5) & 0xFF;
}
else
{
DestroyAnimSprite(sprite);
}
}
2018-12-20 04:13:26 +01:00
// Slowly floats a small flower downard, while swaying from right to left.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: target y pixel offset
// arg 3: duration
2020-02-20 22:22:33 +01:00
static void AnimPetalDanceSmallFlower(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[3];
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
sprite->data[2] = sprite->x;
sprite->data[3] = sprite->y;
2021-11-08 17:46:38 +01:00
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
2018-12-16 18:35:10 +01:00
InitAnimLinearTranslation(sprite);
sprite->data[5] = 0x40;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimPetalDanceSmallFlower_Step;
2018-12-16 18:35:10 +01:00
sprite->callback(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimPetalDanceSmallFlower_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
if (!AnimTranslateLinear(sprite))
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x2 += Sin(sprite->data[5], 8);
2018-12-16 18:35:10 +01:00
if ((u16)(sprite->data[5] - 59) < 5 || (u16)(sprite->data[5] - 187) < 5)
sprite->oam.matrixNum ^= ST_OAM_HFLIP;
2018-12-16 18:35:10 +01:00
2018-12-20 04:13:26 +01:00
sprite->data[5] += 5;
sprite->data[5] &= 0xFF;
2018-12-16 18:35:10 +01:00
}
else
{
DestroyAnimSprite(sprite);
}
}
2018-12-20 04:13:26 +01:00
// Shoots a leaf upward, then floats it downward while swaying back and forth.
// arg 0: upward x delta per frame
// arg 1: upward y delta per frame
// arg 2: upward duration
2020-02-20 22:22:33 +01:00
static void AnimRazorLeafParticle(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[0];
sprite->data[1] = gBattleAnimArgs[1];
sprite->data[2] = gBattleAnimArgs[2];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimRazorLeafParticle_Step1;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimRazorLeafParticle_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (!sprite->data[2])
{
if (sprite->data[1] & 1)
{
sprite->data[0] = 0x80;
sprite->data[1] = 0;
sprite->data[2] = 0;
}
else
{
2018-12-20 04:13:26 +01:00
sprite->data[0] = 0;
sprite->data[1] = 0;
sprite->data[2] = 0;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
sprite->callback = AnimRazorLeafParticle_Step2;
2018-12-16 18:35:10 +01:00
}
else
{
sprite->data[2]--;
2021-07-07 15:11:52 +02:00
sprite->x += sprite->data[0];
sprite->y += sprite->data[1];
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimRazorLeafParticle_Step2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (GetBattlerSide(gBattleAnimAttacker))
2021-07-07 15:11:52 +02:00
sprite->x2 = -Sin(sprite->data[0], 25);
2018-12-16 18:35:10 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->x2 = Sin(sprite->data[0], 25);
2018-12-16 18:35:10 +01:00
2018-12-20 04:13:26 +01:00
sprite->data[0] += 2;
sprite->data[0] &= 0xFF;
2018-12-16 18:35:10 +01:00
sprite->data[1]++;
if (!(sprite->data[1] & 1))
2021-07-07 15:11:52 +02:00
sprite->y2++;
2018-12-16 18:35:10 +01:00
if (sprite->data[1] > 80)
DestroyAnimSprite(sprite);
}
// Animates a sprite that moves linearly from one location to another, with a
// single-cycle sine wave added to the y position along the way.
// Used by Razor Leaf and Magical Leaf.
// arg 0: initial x offset
// arg 1: initial y offset
// arg 2: target x offset
// arg 3: target y offset
// arg 4: translation duration
// arg 5: wave amplitude
// arg 6: target between double battle opponents (boolean)
2020-02-20 22:22:33 +01:00
static void AnimTranslateLinearSingleSineWave(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-12-16 18:35:10 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
if (!gBattleAnimArgs[6])
{
2018-12-20 04:13:26 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
2018-12-16 18:35:10 +01:00
}
else
{
2018-12-20 04:13:26 +01:00
SetAverageBattlerPositions(gBattleAnimTarget, TRUE, &sprite->data[2], &sprite->data[4]);
2018-12-16 18:35:10 +01:00
sprite->data[2] += gBattleAnimArgs[2];
sprite->data[4] += gBattleAnimArgs[3];
}
sprite->data[5] = gBattleAnimArgs[5];
InitAnimArcTranslation(sprite);
if (GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
sprite->data[0] = 1;
else
sprite->data[0] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimTranslateLinearSingleSineWave_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTranslateLinearSingleSineWave_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
bool8 destroy = FALSE;
s16 a = sprite->data[0];
s16 b = sprite->data[7];
s16 r0;
2019-04-02 08:36:22 +02:00
2018-12-16 18:35:10 +01:00
sprite->data[0] = 1;
2019-02-06 20:17:09 +01:00
TranslateAnimHorizontalArc(sprite);
2018-12-16 18:35:10 +01:00
r0 = sprite->data[7];
sprite->data[0] = a;
if (b > 200 && r0 < 56 && sprite->oam.affineParam == 0)
sprite->oam.affineParam++;
if (sprite->oam.affineParam && sprite->data[0])
{
sprite->invisible ^= 1;
sprite->oam.affineParam++;
if (sprite->oam.affineParam == 30)
destroy = TRUE;
}
2019-04-02 08:36:22 +02:00
2021-07-07 15:11:52 +02:00
if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16
|| sprite->x + sprite->x2 < -16
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT
|| sprite->y + sprite->y2 < -16)
2018-12-16 18:35:10 +01:00
destroy = TRUE;
if (destroy)
DestroyAnimSprite(sprite);
}
// Animates particles in the Twister move animation.
// arg 0: duration
// arg 1: total y delta (the particles rise upward)
// arg 2: wave period (higher means faster wave)
// arg 3: wave amplitude
// arg 4: speedup frame (particles move faster at the end of the animation)
void AnimMoveTwisterParticle(struct Sprite* sprite)
{
if (IsDoubleBattle() == TRUE)
2021-07-07 15:11:52 +02:00
SetAverageBattlerPositions(gBattleAnimTarget, 1, &sprite->x, &sprite->y);
2018-12-16 18:35:10 +01:00
2021-07-07 15:11:52 +02:00
sprite->y += 32;
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[0];
sprite->data[1] = gBattleAnimArgs[1];
sprite->data[2] = gBattleAnimArgs[2];
sprite->data[3] = gBattleAnimArgs[3];
sprite->data[4] = gBattleAnimArgs[4];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimMoveTwisterParticle_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimMoveTwisterParticle_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[1] == 0xFF)
{
2021-07-07 15:11:52 +02:00
sprite->y -= 2;
2018-12-16 18:35:10 +01:00
}
else if (sprite->data[1] > 0)
{
2021-07-07 15:11:52 +02:00
sprite->y -= 2;
2018-12-16 18:35:10 +01:00
sprite->data[1] -= 2;
}
sprite->data[5] += sprite->data[2];
if (sprite->data[0] < sprite->data[4])
sprite->data[5] += sprite->data[2];
sprite->data[5] &= 0xFF;
2021-07-07 15:11:52 +02:00
sprite->x2 = Cos(sprite->data[5], sprite->data[3]);
sprite->y2 = Sin(sprite->data[5], 5);
2018-12-16 18:35:10 +01:00
if (sprite->data[5] < 0x80)
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget) - 1;
2018-12-16 18:35:10 +01:00
else
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget) + 1;
2018-12-16 18:35:10 +01:00
if (--sprite->data[0] == 0)
DestroyAnimSprite(sprite);
}
2018-12-20 04:13:26 +01:00
// Squeezes a constricting "rope" several times via affine animations.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: affine anim num
// arg 3: num squeezes
2020-02-20 22:22:33 +01:00
static void AnimConstrictBinding(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, FALSE);
2018-12-16 18:35:10 +01:00
sprite->affineAnimPaused = 1;
StartSpriteAffineAnim(sprite, gBattleAnimArgs[2]);
sprite->data[6] = gBattleAnimArgs[2];
sprite->data[7] = gBattleAnimArgs[3];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimConstrictBinding_Step1;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimConstrictBinding_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
u8 spriteId;
if ((u16)gBattleAnimArgs[7] == 0xFFFF)
2018-12-16 18:35:10 +01:00
{
sprite->affineAnimPaused = 0;
2018-12-20 04:13:26 +01:00
spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
2018-12-16 18:35:10 +01:00
sprite->data[0] = 0x100;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimConstrictBinding_Step2;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimConstrictBinding_Step2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
2018-12-16 18:35:10 +01:00
if (!sprite->data[2])
sprite->data[0] += 11;
else
sprite->data[0] -= 11;
if (++sprite->data[1] == 6)
{
sprite->data[1] = 0;
sprite->data[2] ^= 1;
}
if (sprite->affineAnimEnded)
{
if (--sprite->data[7] > 0)
StartSpriteAffineAnim(sprite, sprite->data[6]);
else
DestroyAnimSprite(sprite);
}
}
2020-02-16 23:49:24 +01:00
void AnimTask_ShrinkTargetCopy(u8 taskId)
2018-12-16 18:35:10 +01:00
{
u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
if (gSprites[spriteId].invisible)
{
DestroyAnimVisualTask(taskId);
}
else
{
2018-12-18 05:08:08 +01:00
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_BLEND);
2018-12-16 18:35:10 +01:00
gTasks[taskId].data[14] = gSprites[spriteId].oam.priority;
2018-12-20 04:13:26 +01:00
gSprites[spriteId].oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget);
2018-12-16 18:35:10 +01:00
spriteId = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER);
gTasks[taskId].data[15] = gSprites[spriteId].oam.priority;
2018-12-20 04:13:26 +01:00
gSprites[spriteId].oam.priority = GetBattlerSpriteBGPriority(BATTLE_PARTNER(gBattleAnimTarget));
2018-12-16 18:35:10 +01:00
gTasks[taskId].data[0] = gBattleAnimArgs[0];
gTasks[taskId].data[1] = gBattleAnimArgs[1];
2018-12-20 04:13:26 +01:00
gTasks[taskId].data[11] = 0x100;
2020-02-20 22:22:33 +01:00
gTasks[taskId].func = AnimTask_DuplicateAndShrinkToPos_Step1;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimTask_DuplicateAndShrinkToPos_Step1(u8 taskId)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
2018-12-16 18:35:10 +01:00
gTasks[taskId].data[10] += gTasks[taskId].data[0];
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = gTasks[taskId].data[10] >> 8;
2018-12-20 04:13:26 +01:00
if (GetBattlerSide(gBattleAnimTarget) != B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = -gSprites[spriteId].x2;
2018-12-16 18:35:10 +01:00
gTasks[taskId].data[11] += 16;
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(spriteId, gTasks[taskId].data[11], gTasks[taskId].data[11], 0);
SetBattlerSpriteYOffsetFromYScale(spriteId);
2018-12-16 18:35:10 +01:00
if (--gTasks[taskId].data[1] == 0)
{
gTasks[taskId].data[0] = 0;
2020-02-20 22:22:33 +01:00
gTasks[taskId].func = AnimTask_DuplicateAndShrinkToPos_Step2;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimTask_DuplicateAndShrinkToPos_Step2(u8 taskId)
2018-12-16 18:35:10 +01:00
{
if ((u16)gBattleAnimArgs[7] == 0xFFFF)
2018-12-16 18:35:10 +01:00
{
if (gTasks[taskId].data[0] == 0)
{
u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
2018-12-18 05:08:08 +01:00
ResetSpriteRotScale(spriteId);
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = 0;
gSprites[spriteId].y2 = 0;
2018-12-16 18:35:10 +01:00
gSprites[spriteId].oam.priority = gTasks[taskId].data[14];
spriteId = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER);
gSprites[spriteId].oam.priority = gTasks[taskId].data[15];
gTasks[taskId].data[0]++;
return;
}
}
else
{
if (gTasks[taskId].data[0] == 0)
return;
}
gTasks[taskId].data[0]++;
if (gTasks[taskId].data[0] == 3)
DestroyAnimVisualTask(taskId);
}
2018-12-20 04:13:26 +01:00
// Moves an orb from the target mon to the attacking mon.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
2020-02-20 22:22:33 +01:00
static void AnimMimicOrb(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
switch (sprite->data[0])
{
case 0:
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
gBattleAnimArgs[0] *= -1;
2021-07-07 15:11:52 +02:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + gBattleAnimArgs[1];
2020-02-20 22:22:33 +01:00
sprite->invisible = TRUE;
2018-12-16 18:35:10 +01:00
sprite->data[0]++;
break;
case 1:
2020-02-20 22:22:33 +01:00
sprite->invisible = FALSE;
2018-12-16 18:35:10 +01:00
if (sprite->affineAnimEnded)
{
ChangeSpriteAffineAnim(sprite, 1);
sprite->data[0] = 25;
2018-12-20 04:13:26 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
sprite->callback = InitAndRunAnimFastLinearTranslation;
2018-12-16 18:35:10 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
break;
}
}
}
2018-12-20 04:13:26 +01:00
// Animates a root that flickers away after some time.
// arg 0: x pixel offset
// arg 1: y pixel offset
// arg 2: sprite subpriority offset
// arg 3: sprite anim num
// arg 4: duration
2020-02-20 22:22:33 +01:00
static void AnimIngrainRoot(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (!sprite->data[0])
{
2021-07-07 15:11:52 +02:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
sprite->x2 = gBattleAnimArgs[0];
sprite->y2 = gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->subpriority = gBattleAnimArgs[2] + 30;
StartSpriteAnim(sprite, gBattleAnimArgs[3]);
sprite->data[2] = gBattleAnimArgs[4];
sprite->data[0]++;
2021-07-07 15:11:52 +02:00
if (sprite->y + sprite->y2 > 120)
sprite->y += sprite->y2 + sprite->y - 120;
2018-12-16 18:35:10 +01:00
}
2018-12-20 04:13:26 +01:00
sprite->callback = AnimRootFlickerOut;
2018-12-16 18:35:10 +01:00
}
2018-12-20 04:13:26 +01:00
// Places a root on the path to the target mon that flickers away after some time.
// arg 0: percent along the path to the target mon
// arg 1: x pixel offset
// arg 2: y pixel offset
// arg 3: sprite subpriority offset
// arg 4: sprite anum num
// arg 5: duration
2020-02-20 22:22:33 +01:00
static void AnimFrenzyPlantRoot(struct Sprite *sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
s16 attackerX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
s16 attackerY = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
s16 targetX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
s16 targetY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
2018-12-20 04:13:26 +01:00
targetX -= attackerX;
targetY -= attackerY;
2021-07-07 15:11:52 +02:00
sprite->x = attackerX + targetX * gBattleAnimArgs[0] / 100;
sprite->y = attackerY + targetY * gBattleAnimArgs[0] / 100;
sprite->x2 = gBattleAnimArgs[1];
sprite->y2 = gBattleAnimArgs[2];
2018-12-16 18:35:10 +01:00
sprite->subpriority = gBattleAnimArgs[3] + 30;
StartSpriteAnim(sprite, gBattleAnimArgs[4]);
sprite->data[2] = gBattleAnimArgs[5];
2018-12-20 04:13:26 +01:00
sprite->callback = AnimRootFlickerOut;
2021-07-07 15:11:52 +02:00
sFrenzyPlantRootData.startX = sprite->x;
sFrenzyPlantRootData.startY = sprite->y;
2021-04-13 08:45:16 +02:00
sFrenzyPlantRootData.targetX = targetX;
sFrenzyPlantRootData.targetY = targetY;
2018-12-16 18:35:10 +01:00
}
2018-12-20 04:13:26 +01:00
static void AnimRootFlickerOut(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[0] > (sprite->data[2] - 10))
sprite->invisible = sprite->data[0] % 2;
if (sprite->data[0] > sprite->data[2])
DestroyAnimSprite(sprite);
}
2018-12-20 04:13:26 +01:00
// Moves an orb in a fast wavy path.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: horizontal velocity
// arg 3: wave amplitude
// arg 4: duration
2020-02-20 22:22:33 +01:00
static void AnimIngrainOrb(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (!sprite->data[0])
{
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[1] = gBattleAnimArgs[2];
sprite->data[2] = gBattleAnimArgs[3];
sprite->data[3] = gBattleAnimArgs[4];
}
sprite->data[0]++;
2021-07-07 15:11:52 +02:00
sprite->x2 = sprite->data[1] * sprite->data[0];
sprite->y2 = Sin((sprite->data[0] * 20) & 0xFF, sprite->data[2]);
2018-12-16 18:35:10 +01:00
if (sprite->data[0] > sprite->data[3])
DestroyAnimSprite(sprite);
}
2021-04-13 08:45:16 +02:00
static void InitItemBagData(struct Sprite* sprite, s16 c)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
int a = (sprite->x << 8) | sprite->y;
2018-12-20 04:13:26 +01:00
int b = (sprite->data[6] << 8) | sprite->data[7];
c <<= 8;
2018-12-16 18:35:10 +01:00
sprite->data[5] = a;
sprite->data[6] = b;
sprite->data[7] = c;
}
2019-10-14 23:27:12 +02:00
bool8 moveAlongLinearPath(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2019-10-14 23:27:12 +02:00
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;
2018-12-16 18:35:10 +01:00
s16 r0;
s32 var1;
2019-10-14 23:27:12 +02:00
s32 vaxEndPos;
if (xEndPos == 0)
xEndPos = -32;
else if (xEndPos == 255)
2021-04-13 08:45:16 +02:00
xEndPos = DISPLAY_WIDTH + 32;
2019-10-14 23:27:12 +02:00
yEndPos_2 = yEndPos - yStartPos;
r0 = xEndPos - xStartPos;
var1 = r0 * currentTime / totalTime;
vaxEndPos = yEndPos_2 * currentTime / totalTime;
2021-07-07 15:11:52 +02:00
sprite->x = var1 + xStartPos;
sprite->y = vaxEndPos + yStartPos;
2019-10-14 23:27:12 +02:00
if (++currentTime == totalTime)
2018-12-16 18:35:10 +01:00
return TRUE;
2019-10-14 23:27:12 +02:00
sprite->data[7] = (totalTime << 8) | currentTime;
2018-12-16 18:35:10 +01:00
return FALSE;
}
2020-02-20 22:22:33 +01:00
static void AnimItemSteal_Step2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0] == 10)
StartSpriteAffineAnim(sprite, 1);
sprite->data[0]++;
if (sprite->data[0] > 50)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimItemSteal_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[0] += sprite->data[3] * 128 / sprite->data[4];
if (sprite->data[0] >= 128)
{
sprite->data[1]++;
sprite->data[0] = 0;
}
2021-07-07 15:11:52 +02:00
sprite->y2 = Sin(sprite->data[0] + 128, 30 - sprite->data[1] * 8);
2019-10-14 23:27:12 +02:00
if (moveAlongLinearPath(sprite))
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->y2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimItemSteal_Step2;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimPresent(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
s16 targetX;
s16 targetY;
InitSpritePosToAnimAttacker(sprite, FALSE);
targetX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
targetY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
2018-12-16 18:35:10 +01:00
if (BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget)
{
2018-12-20 04:13:26 +01:00
sprite->data[6] = targetX;
sprite->data[7] = targetY + 10;
2021-04-13 08:45:16 +02:00
InitItemBagData(sprite, 60);
2018-12-16 18:35:10 +01:00
sprite->data[3] = 1;
}
else
{
2018-12-20 04:13:26 +01:00
sprite->data[6] = targetX;
sprite->data[7] = targetY + 10;
2021-04-13 08:45:16 +02:00
InitItemBagData(sprite, 60);
2018-12-16 18:35:10 +01:00
sprite->data[3] = 3;
}
sprite->data[4] = 60;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimItemSteal_Step1;
2018-12-16 18:35:10 +01:00
}
2021-01-23 06:40:46 +01:00
static void AnimKnockOffOpponentsItem(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
int zero;
sprite->data[0] += ((sprite->data[3] * 128) / sprite->data[4]);
zero = 0;
if (sprite->data[0] > 0x7F)
{
sprite->data[1]++;
sprite->data[0] = zero;
}
2021-07-07 15:11:52 +02:00
sprite->y2 = Sin(sprite->data[0] + 0x80, 30 - sprite->data[1] * 8);
2019-10-14 23:27:12 +02:00
if (moveAlongLinearPath(sprite))
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->y2 = zero;
2018-12-16 18:35:10 +01:00
sprite->data[0] = zero;
DestroyAnimSprite(sprite);
}
}
2020-02-20 22:22:33 +01:00
static void AnimKnockOffItem(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
s16 targetY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
2018-12-16 18:35:10 +01:00
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
sprite->data[6] = 0;
2018-12-20 04:13:26 +01:00
sprite->data[7] = targetY + 10;
2021-04-13 08:45:16 +02:00
InitItemBagData(sprite, 40);
2018-12-16 18:35:10 +01:00
sprite->data[3] = 3;
2018-12-20 04:13:26 +01:00
sprite->data[4] = 60;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimItemSteal_Step1;
2018-12-16 18:35:10 +01:00
}
else
{
sprite->data[6] = 255;
2018-12-20 04:13:26 +01:00
sprite->data[7] = targetY + 10;
2018-12-16 18:35:10 +01:00
if (IsContest())
sprite->data[6] = 0;
2021-04-13 08:45:16 +02:00
InitItemBagData(sprite, 40);
2018-12-16 18:35:10 +01:00
sprite->data[3] = 3;
2018-12-20 04:13:26 +01:00
sprite->data[4] = 60;
2021-01-23 06:40:46 +01:00
sprite->callback = AnimKnockOffOpponentsItem;
2018-12-16 18:35:10 +01:00
}
}
2018-12-20 04:13:26 +01:00
// Animates a heal particle upward.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: vertical velocity
// arg 3: unused
2020-02-20 22:22:33 +01:00
static void AnimPresentHealParticle(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
if (!sprite->data[0])
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, FALSE);
2018-12-16 18:35:10 +01:00
sprite->data[1] = gBattleAnimArgs[2];
}
sprite->data[0]++;
2021-07-07 15:11:52 +02:00
sprite->y2 = sprite->data[1] * sprite->data[0];
2018-12-16 18:35:10 +01:00
if (sprite->animEnded)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimItemSteal(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
s16 attackerX;
s16 attackerY;
InitSpritePosToAnimTarget(sprite, FALSE);
attackerX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
attackerY = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
2018-12-16 18:35:10 +01:00
if (BATTLE_PARTNER(gBattleAnimTarget) == gBattleAnimAttacker)
{
2018-12-20 04:13:26 +01:00
sprite->data[6] = attackerX;
sprite->data[7] = attackerY + 10;
2021-04-13 08:45:16 +02:00
InitItemBagData(sprite, 60);
2018-12-16 18:35:10 +01:00
sprite->data[3] = 1;
}
else
{
2018-12-20 04:13:26 +01:00
sprite->data[6] = attackerX;
sprite->data[7] = attackerY + 10;
2021-04-13 08:45:16 +02:00
InitItemBagData(sprite, 60);
2018-12-16 18:35:10 +01:00
sprite->data[3] = 3;
}
sprite->data[4] = 60;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimItemSteal_Step3;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimItemSteal_Step3(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
int zero;
sprite->data[0] += ((sprite->data[3] * 128) / sprite->data[4]);
zero = 0;
if (sprite->data[0] > 127)
{
sprite->data[1]++;
sprite->data[0] = zero;
}
2021-07-07 15:11:52 +02:00
sprite->y2 = Sin(sprite->data[0] + 0x80, 30 - sprite->data[1] * 8);
if (sprite->y2 == 0)
2020-08-21 00:02:00 +02:00
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(63));
2018-12-16 18:35:10 +01:00
2019-10-14 23:27:12 +02:00
if (moveAlongLinearPath(sprite))
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->y2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimItemSteal_Step2;
2020-08-21 00:02:00 +02:00
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64));
2018-12-16 18:35:10 +01:00
}
}
2018-12-20 04:13:26 +01:00
// Moves a bag in a circular motion.
// arg 0: y position
// arg 1: initial wave offset
2020-02-20 22:22:33 +01:00
static void AnimTrickBag(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
int a;
int b;
if (!sprite->data[0])
{
if (!IsContest())
{
sprite->data[1] = gBattleAnimArgs[1];
2021-07-07 15:11:52 +02:00
sprite->x = 120;
2018-12-16 18:35:10 +01:00
}
else
{
a = gBattleAnimArgs[1] - 32;
if (a < 0)
b = gBattleAnimArgs[1] + 0xDF;
else
b = a;
sprite->data[1] = a - ((b >> 8) << 8);
2021-07-07 15:11:52 +02:00
sprite->x = 70;
2018-12-16 18:35:10 +01:00
}
2021-07-07 15:11:52 +02:00
sprite->y = gBattleAnimArgs[0];
2018-12-16 18:35:10 +01:00
sprite->data[2] = gBattleAnimArgs[0];
sprite->data[4] = 20;
2021-07-07 15:11:52 +02:00
sprite->x2 = Cos(sprite->data[1], 60);
sprite->y2 = Sin(sprite->data[1], 20);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimTrickBag_Step1;
2018-12-16 18:35:10 +01:00
if (sprite->data[1] > 0 && sprite->data[1] < 192)
sprite->subpriority = 31;
else
sprite->subpriority = 29;
}
}
2020-02-20 22:22:33 +01:00
static void AnimTrickBag_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
switch (sprite->data[3])
{
case 0:
if (sprite->data[2] > 78)
{
sprite->data[3] = 1;
StartSpriteAffineAnim(sprite, 1);
break;
}
else
{
sprite->data[2] += sprite->data[4] / 10;
sprite->data[4] += 3;
2021-07-07 15:11:52 +02:00
sprite->y = sprite->data[2];
2018-12-16 18:35:10 +01:00
break;
}
break;
case 1:
if (sprite->data[3] && sprite->affineAnimEnded)
{
sprite->data[0] = 0;
sprite->data[2] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimTrickBag_Step2;
2018-12-16 18:35:10 +01:00
}
break;
}
}
2020-02-20 22:22:33 +01:00
static void AnimTrickBag_Step2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[2] == gTrickBagCoordinates[sprite->data[0]][1])
2018-12-16 18:35:10 +01:00
{
if (gTrickBagCoordinates[sprite->data[0]][2] == 127)
2018-12-16 18:35:10 +01:00
{
sprite->data[0] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimTrickBag_Step3;
2018-12-16 18:35:10 +01:00
}
sprite->data[2] = 0;
sprite->data[0]++;
}
else
{
sprite->data[2]++;
sprite->data[1] = (gTrickBagCoordinates[sprite->data[0]][0] * gTrickBagCoordinates[sprite->data[0]][2] + sprite->data[1]) & 0xFF;
2018-12-16 18:35:10 +01:00
if (!IsContest())
{
if ((u16)(sprite->data[1] - 1) < 191)
sprite->subpriority = 31;
else
sprite->subpriority = 29;
}
2021-07-07 15:11:52 +02:00
sprite->x2 = Cos(sprite->data[1], 60);
sprite->y2 = Sin(sprite->data[1], 20);
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimTrickBag_Step3(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0] > 20)
DestroyAnimSprite(sprite);
sprite->invisible = sprite->data[0] % 2;
sprite->data[0]++;
}
void AnimTask_LeafBlade(u8 taskId)
2018-12-16 18:35:10 +01:00
{
struct Task *task = &gTasks[taskId];
2018-12-18 05:08:08 +01:00
task->data[4] = GetBattlerSpriteSubpriority(gBattleAnimTarget) - 1;
2021-11-08 17:46:38 +01:00
task->data[6] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
task->data[7] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-30 17:58:42 +01:00
task->data[10] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_WIDTH);
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT);
2018-12-16 18:35:10 +01:00
task->data[5] = (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT) ? 1 : -1;
task->data[9] = 56 - (task->data[5] * 64);
task->data[8] = task->data[7] - task->data[9] + task->data[6];
2019-10-16 19:10:39 +02:00
task->data[2] = CreateSprite(&gLeafBladeSpriteTemplate, task->data[8], task->data[9], task->data[4]);
2018-12-16 18:35:10 +01:00
if (task->data[2] == MAX_SPRITES)
DestroyAnimVisualTask(taskId);
gSprites[task->data[2]].data[0] = 10;
gSprites[task->data[2]].data[1] = task->data[8];
gSprites[task->data[2]].data[2] = task->data[6] - (task->data[10] / 2 + 10) * task->data[5];
gSprites[task->data[2]].data[3] = task->data[9];
gSprites[task->data[2]].data[4] = task->data[7] + (task->data[11] / 2 + 10) * task->data[5];
2019-10-16 19:10:39 +02:00
gSprites[task->data[2]].data[5] = LeafBladeGetPosFactor(&gSprites[task->data[2]]);
2018-12-16 18:35:10 +01:00
InitAnimArcTranslation(&gSprites[task->data[2]]);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_LeafBlade_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_LeafBlade_Step(u8 taskId)
2018-12-16 18:35:10 +01:00
{
struct Task* task = &gTasks[taskId];
struct Sprite* sprite = &gSprites[task->data[2]];
int a = task->data[0];
switch (a)
{
case 4:
2020-02-20 22:22:33 +01:00
AnimTask_LeafBlade_Step2(task, taskId);
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-12-16 18:35:10 +01:00
{
task->data[15] = 5;
task->data[0] = 0xFF;
}
break;
case 8:
2020-02-20 22:22:33 +01:00
AnimTask_LeafBlade_Step2(task, taskId);
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-12-16 18:35:10 +01:00
{
task->data[15] = 9;
task->data[0] = 0xFF;
}
break;
case 0:
2020-02-20 22:22:33 +01:00
AnimTask_LeafBlade_Step2(task, taskId);
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-12-16 18:35:10 +01:00
{
task->data[15] = 1;
task->data[0] = 0xFF;
}
break;
case 1:
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 0;
sprite->y2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 10;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-16 18:35:10 +01:00
sprite->data[2] = task->data[6];
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-16 18:35:10 +01:00
sprite->data[4] = task->data[7];
2019-10-16 19:10:39 +02:00
sprite->data[5] = LeafBladeGetPosFactor(sprite);
2018-12-16 18:35:10 +01:00
task->data[4] += 2;
task->data[3] = a;
sprite->subpriority = task->data[4];
StartSpriteAnim(sprite, task->data[3]);
InitAnimArcTranslation(sprite);
task->data[0]++;
break;
case 2:
2020-02-20 22:22:33 +01:00
AnimTask_LeafBlade_Step2(task, taskId);
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-12-16 18:35:10 +01:00
{
task->data[15] = 3;
task->data[0] = 0xFF;
}
break;
case 3:
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 0;
sprite->y2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 10;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-16 18:35:10 +01:00
sprite->data[2] = task->data[6] - ((task->data[10] / 2) + 10) * task->data[5];
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-16 18:35:10 +01:00
sprite->data[4] = task->data[7] - ((task->data[11] / 2) + 10) * task->data[5];
2019-10-16 19:10:39 +02:00
sprite->data[5] = LeafBladeGetPosFactor(sprite);
2018-12-16 18:35:10 +01:00
task->data[3] = 2;
sprite->subpriority = task->data[4];
StartSpriteAnim(sprite, task->data[3]);
InitAnimArcTranslation(sprite);
task->data[0]++;
break;
case 5:
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 0;
sprite->y2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 10;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-16 18:35:10 +01:00
sprite->data[2] = task->data[6] + ((task->data[10] / 2) + 10) * task->data[5];
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-16 18:35:10 +01:00
sprite->data[4] = task->data[7] + ((task->data[11] / 2) + 10) * task->data[5];
2019-10-16 19:10:39 +02:00
sprite->data[5] = LeafBladeGetPosFactor(sprite);
2018-12-16 18:35:10 +01:00
task->data[4] -= 2;
task->data[3] = 3;
sprite->subpriority = task->data[4];
StartSpriteAnim(sprite, task->data[3]);
InitAnimArcTranslation(sprite);
task->data[0]++;
break;
case 6:
2020-02-20 22:22:33 +01:00
AnimTask_LeafBlade_Step2(task, taskId);
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-12-16 18:35:10 +01:00
{
task->data[15] = 7;
task->data[0] = 0xFF;
}
break;
case 7:
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 0;
sprite->y2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 10;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-16 18:35:10 +01:00
sprite->data[2] = task->data[6];
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-16 18:35:10 +01:00
sprite->data[4] = task->data[7];
2019-10-16 19:10:39 +02:00
sprite->data[5] = LeafBladeGetPosFactor(sprite);
2018-12-16 18:35:10 +01:00
task->data[4] += 2;
task->data[3] = 4;
sprite->subpriority = task->data[4];
StartSpriteAnim(sprite, task->data[3]);
InitAnimArcTranslation(sprite);
task->data[0]++;
break;
case 9:
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 0;
sprite->y2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 10;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-16 18:35:10 +01:00
sprite->data[2] = task->data[6] - ((task->data[10] / 2) + 10) * task->data[5];
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-16 18:35:10 +01:00
sprite->data[4] = task->data[7] + ((task->data[11] / 2) + 10) * task->data[5];
2019-10-16 19:10:39 +02:00
sprite->data[5] = LeafBladeGetPosFactor(sprite);
2018-12-16 18:35:10 +01:00
task->data[3] = 5;
sprite->subpriority = task->data[4];
StartSpriteAnim(sprite, task->data[3]);
InitAnimArcTranslation(sprite);
task->data[0]++;
break;
case 10:
2020-02-20 22:22:33 +01:00
AnimTask_LeafBlade_Step2(task, taskId);
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-12-16 18:35:10 +01:00
{
task->data[15] = 11;
task->data[0] = 0xFF;
}
break;
case 11:
{
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 0;
sprite->y2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 10;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-16 18:35:10 +01:00
sprite->data[2] = task->data[8];
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-16 18:35:10 +01:00
sprite->data[4] = task->data[9];
2019-10-16 19:10:39 +02:00
sprite->data[5] = LeafBladeGetPosFactor(sprite);
2018-12-16 18:35:10 +01:00
task->data[4] -= 2;
task->data[3] = 6;
sprite->subpriority = task->data[4];
StartSpriteAnim(sprite, task->data[3]);
InitAnimArcTranslation(sprite);
task->data[0]++;
break;
}
case 12:
2020-02-20 22:22:33 +01:00
AnimTask_LeafBlade_Step2(task, taskId);
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-12-16 18:35:10 +01:00
{
DestroySprite(sprite);
task->data[0]++;
}
break;
case 13:
if (task->data[12] == 0)
DestroyAnimVisualTask(taskId);
break;
case 0xFF:
if (++task->data[1] > 5)
{
task->data[1] = 0;
task->data[0] = task->data[15];
}
break;
}
}
2019-10-16 19:10:39 +02:00
static s16 LeafBladeGetPosFactor(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
s16 var = 8;
2021-07-07 15:11:52 +02:00
if (sprite->data[4] < sprite->y)
2018-12-16 18:35:10 +01:00
var = -var;
return var;
}
2020-02-20 22:22:33 +01:00
static void AnimTask_LeafBlade_Step2(struct Task* task, u8 taskId)
2018-12-16 18:35:10 +01:00
{
task->data[14]++;
if (task->data[14] > 0)
{
u8 spriteId;
s16 spriteX;
s16 spriteY;
task->data[14] = 0;
2021-07-07 15:11:52 +02:00
spriteX = gSprites[task->data[2]].x + gSprites[task->data[2]].x2;
spriteY = gSprites[task->data[2]].y + gSprites[task->data[2]].y2;
2019-10-16 19:10:39 +02:00
spriteId = CreateSprite(&gLeafBladeSpriteTemplate, spriteX, spriteY, task->data[4]);
2018-12-16 18:35:10 +01:00
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[6] = taskId;
gSprites[spriteId].data[7] = 12;
gTasks[taskId].data[12]++;
gSprites[spriteId].data[0] = task->data[13] & 1;
gTasks[taskId].data[13]++;
StartSpriteAnim(&gSprites[spriteId], task->data[3]);
gSprites[spriteId].subpriority = task->data[4];
2020-02-20 22:22:33 +01:00
gSprites[spriteId].callback = AnimTask_LeafBlade_Step2_Callback;
2018-12-16 18:35:10 +01:00
}
}
}
2020-02-20 22:22:33 +01:00
static void AnimTask_LeafBlade_Step2_Callback(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[0]++;
if (sprite->data[0] > 1)
{
sprite->data[0] = 0;
sprite->invisible ^= 1;
sprite->data[1]++;
if (sprite->data[1] > 8)
{
gTasks[sprite->data[6]].data[sprite->data[7]]--;
DestroySprite(sprite);
}
}
}
2020-02-20 22:22:33 +01:00
static void AnimFlyingParticle(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
u8 battler;
if (!gBattleAnimArgs[6])
battler = gBattleAnimAttacker;
else
battler = gBattleAnimTarget;
if (GetBattlerSide(battler) != B_SIDE_PLAYER)
2018-12-16 18:35:10 +01:00
{
sprite->data[4] = 0;
sprite->data[2] = gBattleAnimArgs[3];
2021-07-07 15:11:52 +02:00
sprite->x = 0xFFF0;
2018-12-16 18:35:10 +01:00
}
else
{
sprite->data[4] = 1;
sprite->data[2] = -gBattleAnimArgs[3];
2021-07-07 15:11:52 +02:00
sprite->x = 0x100;
2018-12-16 18:35:10 +01:00
}
sprite->data[1] = gBattleAnimArgs[1];
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[3] = gBattleAnimArgs[4];
switch (gBattleAnimArgs[5])
{
case 0:
2021-07-07 15:11:52 +02:00
sprite->y = gBattleAnimArgs[0];
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(battler);
2018-12-16 18:35:10 +01:00
break;
case 1:
2021-07-07 15:11:52 +02:00
sprite->y = gBattleAnimArgs[0];
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
2018-12-16 18:35:10 +01:00
break;
case 2:
2021-11-08 17:46:38 +01:00
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[0];
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(battler);
2018-12-16 18:35:10 +01:00
break;
case 3:
2021-11-08 17:46:38 +01:00
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[0];
2018-12-16 18:35:10 +01:00
GetAnimBattlerSpriteId(ANIM_TARGET);
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
2018-12-16 18:35:10 +01:00
break;
}
2020-02-20 22:22:33 +01:00
sprite->callback = AnimFlyingParticle_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimFlyingParticle_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
int a = sprite->data[7];
sprite->data[7]++;
2021-07-07 15:11:52 +02:00
sprite->y2 = (sprite->data[1] * gSineTable[sprite->data[0]]) >> 8;
sprite->x2 = sprite->data[2] * a;
2018-12-16 18:35:10 +01:00
sprite->data[0] = (sprite->data[3] * a) & 0xFF;
if (!sprite->data[4])
{
2021-07-07 15:11:52 +02:00
if (sprite->x2 + sprite->x <= 0xF7)
2018-12-16 18:35:10 +01:00
return;
}
else
{
2021-07-07 15:11:52 +02:00
if (sprite->x2 + sprite->x > -16)
2018-12-16 18:35:10 +01:00
return;
}
2018-12-18 05:08:08 +01:00
DestroySpriteAndMatrix(sprite);
2018-12-16 18:35:10 +01:00
}
2020-02-16 23:49:24 +01:00
void AnimTask_CycleMagicalLeafPal(u8 taskId)
2018-12-16 18:35:10 +01:00
{
struct Task* task = &gTasks[taskId];
switch (task->data[0])
{
case 0:
task->data[8] = IndexOfSpritePaletteTag(ANIM_TAG_LEAF) * 16 + 256;
task->data[12] = IndexOfSpritePaletteTag(ANIM_TAG_RAZOR_LEAF) * 16 + 256;
task->data[0]++;
break;
case 1:
if (++task->data[9] >= 0)
{
task->data[9] = 0;
BlendPalette(task->data[8], 16, task->data[10], gMagicalLeafBlendColors[task->data[11]]);
BlendPalette(task->data[12], 16, task->data[10], gMagicalLeafBlendColors[task->data[11]]);
if (++task->data[10] == 17)
{
task->data[10] = 0;
if (++task->data[11] == 7)
task->data[11] = 0;
}
}
break;
}
if (gBattleAnimArgs[7] == -1)
2018-12-16 18:35:10 +01:00
DestroyAnimVisualTask(taskId);
}
2020-02-20 22:22:33 +01:00
static void AnimNeedleArmSpike(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
u8 a;
u8 b;
u16 c;
u16 x;
u16 y;
if (gBattleAnimArgs[4] == 0)
{
DestroyAnimSprite(sprite);
}
else
{
if (gBattleAnimArgs[0] == 0)
{
2021-11-08 17:46:38 +01:00
a = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
b = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
}
else
{
2021-11-08 17:46:38 +01:00
a = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
b = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
}
sprite->data[0] = gBattleAnimArgs[4];
if (gBattleAnimArgs[1] == 0)
{
2021-07-07 15:11:52 +02:00
sprite->x = gBattleAnimArgs[2] + a;
sprite->y = gBattleAnimArgs[3] + b;
2018-12-16 18:35:10 +01:00
sprite->data[5] = a;
sprite->data[6] = b;
}
else
{
2021-07-07 15:11:52 +02:00
sprite->x = a;
sprite->y = b;
2018-12-16 18:35:10 +01:00
sprite->data[5] = gBattleAnimArgs[2] + a;
sprite->data[6] = gBattleAnimArgs[3] + b;
}
2021-07-07 15:11:52 +02:00
x = sprite->x;
2018-12-16 18:35:10 +01:00
sprite->data[1] = x * 16;
2021-07-07 15:11:52 +02:00
y = sprite->y;
2018-12-16 18:35:10 +01:00
sprite->data[2] = y * 16;
2021-07-07 15:11:52 +02:00
sprite->data[3] = (sprite->data[5] - sprite->x) * 16 / gBattleAnimArgs[4];
sprite->data[4] = (sprite->data[6] - sprite->y) * 16 / gBattleAnimArgs[4];
2018-12-16 18:35:10 +01:00
c = ArcTan2Neg(sprite->data[5] - x, sprite->data[6] - y);
if (IsContest())
c -= 0x8000;
2018-12-18 05:08:08 +01:00
TrySetSpriteRotScale(sprite, 0, 0x100, 0x100, c);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimNeedleArmSpike_Step;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimNeedleArmSpike_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0])
{
sprite->data[1] += sprite->data[3];
sprite->data[2] += sprite->data[4];
2021-07-07 15:11:52 +02:00
sprite->x = sprite->data[1] >> 4 ;
sprite->y = sprite->data[2] >> 4 ;
2018-12-16 18:35:10 +01:00
sprite->data[0]--;
}
else
{
2018-12-18 05:08:08 +01:00
DestroySpriteAndMatrix(sprite);
2018-12-16 18:35:10 +01:00
}
}
2021-01-23 06:40:46 +01:00
static void AnimWhipHit_WaitEnd(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->animEnded)
DestroyAnimSprite(sprite);
}
2021-04-13 08:45:16 +02:00
static void AnimSlidingHit(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x -= gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
}
else
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
}
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-12-16 18:35:10 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2020-02-20 22:22:33 +01:00
static void AnimWhipHit(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2019-04-02 08:36:22 +02:00
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, 1);
2021-01-23 06:40:46 +01:00
sprite->callback = AnimWhipHit_WaitEnd;
2018-12-20 04:13:26 +01:00
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
2021-07-07 15:11:52 +02:00
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
}
2021-04-13 08:45:16 +02:00
static void AnimFlickeringPunch(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[3] = gBattleAnimArgs[4];
sprite->data[5] = gBattleAnimArgs[5];
StartSpriteAffineAnim(sprite, gBattleAnimArgs[6]);
2018-12-18 05:08:08 +01:00
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
2019-02-06 20:17:09 +01:00
sprite->callback = TranslateSpriteLinearAndFlicker;
2018-12-16 18:35:10 +01:00
}
// Moves the sprite in a diagonally slashing motion across the target mon.
2019-04-02 08:36:22 +02:00
// Used by moves such as MOVE_CUT and MOVE_AERIAL_ACE.
2018-12-16 18:35:10 +01:00
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: slice direction; 0 = right-to-left, 1 = left-to-right
2020-02-20 22:22:33 +01:00
static void AnimCuttingSlice(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
2018-12-16 18:35:10 +01:00
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
sprite->y += 8;
2018-12-16 18:35:10 +01:00
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSlice_Step;
2018-12-16 18:35:10 +01:00
if (gBattleAnimArgs[2] == 0)
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
2018-12-16 18:35:10 +01:00
}
else
{
2021-07-07 15:11:52 +02:00
sprite->x -= gBattleAnimArgs[0];
2018-12-16 18:35:10 +01:00
sprite->hFlip = 1;
}
2021-07-07 15:11:52 +02:00
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[1] -= 0x400;
sprite->data[2] += 0x400;
sprite->data[5] = gBattleAnimArgs[2];
if (sprite->data[5] == 1)
sprite->data[1] = -sprite->data[1];
}
2020-02-20 22:22:33 +01:00
static void AnimAirCutterSlice(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-11-08 17:46:38 +01:00
u8 x, y;
2018-12-16 18:35:10 +01:00
switch (gBattleAnimArgs[3])
{
case 1:
2021-11-08 17:46:38 +01:00
x = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_X);
y = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_Y);
2018-12-16 18:35:10 +01:00
break;
case 2:
2021-11-08 17:46:38 +01:00
x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
2018-12-16 18:35:10 +01:00
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)))
{
2021-11-08 17:46:38 +01:00
x = (GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_X) + x) / 2;
y = (GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_Y) + y) / 2;
2018-12-16 18:35:10 +01:00
}
break;
case 0:
default:
2021-11-08 17:46:38 +01:00
x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
2018-12-16 18:35:10 +01:00
break;
}
2021-11-08 17:46:38 +01:00
sprite->x = x;
sprite->y = y;
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
sprite->y += 8;
2018-12-16 18:35:10 +01:00
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSlice_Step;
2018-12-16 18:35:10 +01:00
if (gBattleAnimArgs[2] == 0)
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
2018-12-16 18:35:10 +01:00
}
else
{
2021-07-07 15:11:52 +02:00
sprite->x -= gBattleAnimArgs[0];
2018-12-16 18:35:10 +01:00
sprite->hFlip = 1;
}
2021-07-07 15:11:52 +02:00
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[1] -= 0x400;
sprite->data[2] += 0x400;
sprite->data[5] = gBattleAnimArgs[2];
if (sprite->data[5] == 1)
sprite->data[1] = -sprite->data[1];
}
2020-02-20 22:22:33 +01:00
static void AnimSlice_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[3] += sprite->data[1];
sprite->data[4] += sprite->data[2];
if (sprite->data[5] == 0)
sprite->data[1] += 0x18;
else
sprite->data[1] -= 0x18;
sprite->data[2] -= 0x18;
2021-07-07 15:11:52 +02:00
sprite->x2 = sprite->data[3] >> 8;
sprite->y2 = sprite->data[4] >> 8;
2018-12-16 18:35:10 +01:00
sprite->data[0]++;
if (sprite->data[0] == 20)
{
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
sprite->data[0] = 3;
sprite->callback = WaitAnimForDuration;
}
}
2021-04-13 08:45:16 +02:00
static void UnusedFlickerAnim(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[2] > 1)
{
if (sprite->data[3] & 1)
{
2020-02-20 22:22:33 +01:00
sprite->invisible = FALSE;
gSprites[sprite->data[0]].invisible = FALSE;
gSprites[sprite->data[1]].invisible = FALSE;
2018-12-16 18:35:10 +01:00
}
else
{
2020-02-20 22:22:33 +01:00
sprite->invisible = TRUE;
gSprites[sprite->data[0]].invisible = TRUE;
gSprites[sprite->data[1]].invisible = TRUE;
2018-12-16 18:35:10 +01:00
}
sprite->data[2] = 0;
sprite->data[3]++;
}
else
{
sprite->data[2]++;
}
if (sprite->data[3] == 10)
{
DestroySprite(&gSprites[sprite->data[0]]);
DestroySprite(&gSprites[sprite->data[1]]);
DestroyAnimSprite(sprite);
}
}
2021-04-13 08:45:16 +02:00
static void AnimCirclingMusicNote(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[0] = gBattleAnimArgs[2];
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
sprite->x -= gBattleAnimArgs[0];
2018-12-16 18:35:10 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[5]);
sprite->data[1] = -gBattleAnimArgs[3];
2021-07-07 15:11:52 +02:00
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[3] = gBattleAnimArgs[4];
2021-04-13 08:45:16 +02:00
sprite->callback = AnimCirclingMusicNote_Step;
2018-12-16 18:35:10 +01:00
sprite->callback(sprite);
}
2021-04-13 08:45:16 +02:00
static void AnimCirclingMusicNote_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x2 = Cos(sprite->data[0], 100);
sprite->y2 = Sin(sprite->data[0], 20);
2018-12-16 18:35:10 +01:00
if (sprite->data[0] < 128)
sprite->subpriority = 0;
else
sprite->subpriority = 14;
sprite->data[0] = (sprite->data[0] + sprite->data[1]) & 0xFF;
2021-04-13 08:45:16 +02:00
sprite->data[5] += 130;
2021-07-07 15:11:52 +02:00
sprite->y2 += sprite->data[5] >> 8;
2018-12-16 18:35:10 +01:00
sprite->data[2]++;
if (sprite->data[2] == sprite->data[3])
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimProtect(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (IsContest())
gBattleAnimArgs[1] += 8;
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER || IsContest())
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker) + 1;
2018-12-16 18:35:10 +01:00
else
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[2] = (IndexOfSpritePaletteTag(ANIM_TAG_PROTECT) << 4) + 0x100;
sprite->data[7] = 16;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - sprite->data[7], sprite->data[7]));
2020-02-20 22:22:33 +01:00
sprite->callback = AnimProtect_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimProtect_Step(struct Sprite *sprite)
2018-12-16 18:35:10 +01:00
{
int i, id, savedPal;
2018-12-16 18:35:10 +01:00
sprite->data[5] += 96;
2021-07-07 15:11:52 +02:00
sprite->x2 = -(sprite->data[5] >> 8);
2018-12-16 18:35:10 +01:00
if (++sprite->data[1] > 1)
{
sprite->data[1] = 0;
savedPal = gPlttBufferFaded[sprite->data[2] + 1];
2018-12-16 18:35:10 +01:00
i = 0;
while (i < 6)
2018-12-16 18:35:10 +01:00
{
id = sprite->data[2] + ++i;
gPlttBufferFaded[id] = gPlttBufferFaded[id + 1];
}
2018-12-16 18:35:10 +01:00
gPlttBufferFaded[sprite->data[2] + 7] = savedPal;
2018-12-16 18:35:10 +01:00
}
if (sprite->data[7] > 6 && sprite->data[0] >0 && ++sprite->data[6] > 1)
2018-12-16 18:35:10 +01:00
{
sprite->data[6] = 0;
sprite->data[7] -= 1;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - sprite->data[7], sprite->data[7]));
}
if (sprite->data[0] > 0)
{
sprite->data[0] -= 1;
}
else if (++sprite->data[6] > 1)
{
sprite->data[6] = 0;
sprite->data[7]++;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - sprite->data[7], sprite->data[7]));
if (sprite->data[7] == 16)
{
2020-02-20 22:22:33 +01:00
sprite->invisible = TRUE;
2019-02-06 20:17:09 +01:00
sprite->callback = DestroyAnimSpriteAndDisableBlend;
2018-12-16 18:35:10 +01:00
}
}
}
2020-02-20 22:22:33 +01:00
static void AnimMilkBottle(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + 0xFFE8;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 0;
sprite->data[1] = 0;
sprite->data[2] = 0;
sprite->data[3] = 0;
sprite->data[4] = 0;
sprite->data[6] = 0;
sprite->data[7] = 16;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7]));
2020-02-20 22:22:33 +01:00
sprite->callback = AnimMilkBottle_Step1;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimMilkBottle_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
switch (sprite->data[0])
{
case 0:
if (++sprite->data[2] > 0)
{
sprite->data[2] = 0;
if (((++sprite->data[1]) & 1) != 0)
{
if (sprite->data[6] <= 15)
sprite->data[6]++;
}
else if (sprite->data[7] > 0)
sprite->data[7]--;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7]));
if (sprite->data[6] == 16 && sprite->data[7] == 0)
{
sprite->data[1] = 0;
sprite->data[0]++;
}
}
break;
case 1:
if (++sprite->data[1] > 8)
{
sprite->data[1] = 0;
StartSpriteAffineAnim(sprite, 1);
sprite->data[0]++;
}
break;
case 2:
2020-02-20 22:22:33 +01:00
AnimMilkBottle_Step2(sprite, 16, 4);
2018-12-16 18:35:10 +01:00
if (++sprite->data[1] > 2)
{
sprite->data[1] = 0;
2021-07-07 15:11:52 +02:00
sprite->y++;
2018-12-16 18:35:10 +01:00
}
if (++sprite->data[2] <= 29)
break;
if (sprite->data[2] & 1)
{
if (sprite->data[6] > 0)
sprite->data[6]--;
}
else if (sprite->data[7] <= 15)
{
sprite->data[7]++;
}
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7]));
if (sprite->data[6] == 0 && sprite->data[7] == 16)
{
sprite->data[1] = 0;
sprite->data[2] = 0;
sprite->data[0]++;
}
break;
case 3:
2020-02-20 22:22:33 +01:00
sprite->invisible = TRUE;
2018-12-16 18:35:10 +01:00
sprite->data[0]++;
break;
case 4:
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0));
DestroyAnimSprite(sprite);
break;
}
}
2020-02-20 22:22:33 +01:00
static void AnimMilkBottle_Step2(struct Sprite* sprite, int unk1, int unk2)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[3] <= 11)
sprite->data[4] += 2;
if ((u16)(sprite->data[3] - 0x12) <= 0x17)
sprite->data[4] -= 2;
if ((sprite->data[3]) > 0x2F)
sprite->data[4] += 2;
2021-07-07 15:11:52 +02:00
sprite->x2 = sprite->data[4] / 9;
sprite->y2 = sprite->data[4] / 14;
if (sprite->y2 < 0)
sprite->y2 *= -1;
2018-12-16 18:35:10 +01:00
sprite->data[3]++;
if (sprite->data[3] > 0x3B)
sprite->data[3] = 0;
}
2020-02-20 22:22:33 +01:00
static void AnimGrantingStars(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (!gBattleAnimArgs[2])
2018-12-18 05:08:08 +01:00
SetSpriteCoordsToAnimAttackerCoords(sprite);
2018-12-16 18:35:10 +01:00
2018-12-20 04:13:26 +01:00
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
2021-07-07 15:11:52 +02:00
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[0] = gBattleAnimArgs[5];
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[2] = gBattleAnimArgs[4];
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
2019-02-06 20:17:09 +01:00
sprite->callback = TranslateSpriteLinearFixedPoint;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSparkingStars(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
u8 battler;
if (!gBattleAnimArgs[2])
battler = gBattleAnimAttacker;
else
battler = gBattleAnimTarget;
if (IsDoubleBattle() && IsBattlerSpriteVisible(BATTLE_PARTNER(battler)))
{
2021-07-07 15:11:52 +02:00
SetAverageBattlerPositions(battler, gBattleAnimArgs[6], &sprite->x, &sprite->y);
2018-12-20 04:13:26 +01:00
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
2021-07-07 15:11:52 +02:00
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
}
else
{
if (!gBattleAnimArgs[6])
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y) + gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
}
else
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
}
2018-12-20 04:13:26 +01:00
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
2018-12-16 18:35:10 +01:00
}
sprite->data[0] = gBattleAnimArgs[5];
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[2] = gBattleAnimArgs[4];
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
2019-02-06 20:17:09 +01:00
sprite->callback = TranslateSpriteLinearFixedPoint;
2018-12-16 18:35:10 +01:00
}
2021-04-13 08:45:16 +02:00
static void AnimBubbleBurst(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-18 05:08:08 +01:00
SetSpriteCoordsToAnimAttackerCoords(sprite);
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
}
else
{
2021-07-07 15:11:52 +02:00
sprite->x -= gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, 1);
}
2021-04-13 08:45:16 +02:00
sprite->callback = AnimBubbleBurst_Step;
2018-12-16 18:35:10 +01:00
}
2021-04-13 08:45:16 +02:00
static void AnimBubbleBurst_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[0] > 30)
{
2021-07-07 15:11:52 +02:00
sprite->y2 = (30 - sprite->data[0]) / 3;
sprite->x2 = Sin(sprite->data[1] * 4, 3);
2018-12-16 18:35:10 +01:00
sprite->data[1]++;
}
if (sprite->animEnded)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimSleepLetterZ(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-18 05:08:08 +01:00
SetSpriteCoordsToAnimAttackerCoords(sprite);
2018-12-16 18:35:10 +01:00
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[3] = 1;
}
else
{
2021-07-07 15:11:52 +02:00
sprite->x -= gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[3] = 0xFFFF;
StartSpriteAffineAnim(sprite, 1);
}
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSleepLetterZ_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSleepLetterZ_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->y2 = -(sprite->data[0] / 0x28);
sprite->x2 = sprite->data[4] / 10;
2018-12-16 18:35:10 +01:00
sprite->data[4] += sprite->data[3] * 2;
sprite->data[0] += sprite->data[1];
if (++sprite->data[1] > 60)
2018-12-18 05:08:08 +01:00
DestroySpriteAndMatrix(sprite);
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimLockOnTarget(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x -= 32;
sprite->y -= 32;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 20;
sprite->callback = WaitAnimForDuration;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step1);
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimLockOnTarget_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
switch (sprite->data[5] & 1)
{
case 0:
sprite->data[0] = 1;
sprite->callback = WaitAnimForDuration;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step1);
2018-12-16 18:35:10 +01:00
break;
case 1:
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->y2 = 0;
sprite->x2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 8;
2021-07-07 15:11:52 +02:00
sprite->data[2] = sprite->x + gInclineMonCoordTable[sprite->data[5] >> 8][0];
sprite->data[4] = sprite->y + gInclineMonCoordTable[sprite->data[5] >> 8][1];
2018-12-16 18:35:10 +01:00
sprite->callback = StartAnimLinearTranslation;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step2);
2018-12-16 18:35:10 +01:00
sprite->data[5] += 0x100;
2020-08-21 00:02:00 +02:00
PlaySE12WithPanning(SE_M_LOCK_ON, BattleAnimAdjustPanning(63));
2018-12-16 18:35:10 +01:00
break;
}
sprite->data[5] ^= 1;
}
2020-02-20 22:22:33 +01:00
static void AnimLockOnTarget_Step2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if ((sprite->data[5] >> 8) == 4)
{
sprite->data[0] = 10;
sprite->callback = WaitAnimForDuration;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step3);
2018-12-16 18:35:10 +01:00
}
else
{
2020-02-20 22:22:33 +01:00
sprite->callback = AnimLockOnTarget_Step1;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimLockOnTarget_Step3(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
s16 a;
s16 b;
if (sprite->oam.affineParam == 0)
{
sprite->data[0] = 3;
sprite->data[1] = 0;
sprite->data[2] = 0;
sprite->callback = WaitAnimForDuration;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step4);
2018-12-16 18:35:10 +01:00
}
else
{
switch (sprite->oam.affineParam)
{
case 1:
a = -8;
b = -8;
break;
case 2:
a = -8;
b = 8;
break;
case 3:
a = 8;
b = -8;
break;
default:
a = 8;
b = 8;
break;
}
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->y2 = 0;
sprite->x2 = 0;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 6;
2021-11-08 19:18:58 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + a;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + b;
2018-12-16 18:35:10 +01:00
sprite->callback = StartAnimLinearTranslation;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step5);
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimLockOnTarget_Step4(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[2] == 0)
{
if ((sprite->data[1] += 3) > 16)
sprite->data[1] = 16;
}
else if ((sprite->data[1] -= 3) < 0)
{
sprite->data[1] = 0;
}
2021-02-28 00:41:30 +01:00
BlendPalettes(GetBattleBgPalettesMask(1, 1, 1, 1, 1, 0, 0), sprite->data[1], RGB(31, 31, 31));
2018-12-16 18:35:10 +01:00
if (sprite->data[1] == 16)
{
int pal;
sprite->data[2]++;
pal = sprite->oam.paletteNum;
LoadPalette(&gPlttBufferUnfaded[0x108 + pal * 16], pal * 16 | 0x101, 4);
2020-08-21 00:02:00 +02:00
PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(63));
2018-12-16 18:35:10 +01:00
}
else if (sprite->data[1] == 0)
{
2020-02-20 22:22:33 +01:00
sprite->callback = AnimLockOnTarget_Step5;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimLockOnTarget_Step5(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if ((u16)gBattleAnimArgs[7] == 0xFFFF)
2018-12-16 18:35:10 +01:00
{
sprite->data[1] = 0;
sprite->data[0] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimLockOnTarget_Step6;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimLockOnTarget_Step6(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0] % 3 == 0)
{
sprite->data[1]++;
sprite->invisible ^= 1;
}
sprite->data[0]++;
if (sprite->data[1] == 8)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimLockOnMoveTarget(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->oam.affineParam = gBattleAnimArgs[0];
if ((s16)sprite->oam.affineParam == 1)
{
2021-07-07 15:11:52 +02:00
sprite->x -= 0x18;
sprite->y -= 0x18;
2018-12-16 18:35:10 +01:00
}
else if ((s16)sprite->oam.affineParam == 2)
{
2021-07-07 15:11:52 +02:00
sprite->x -= 0x18;
sprite->y += 0x18;
sprite->oam.matrixNum = ST_OAM_VFLIP;
2018-12-16 18:35:10 +01:00
}
else if ((s16)sprite->oam.affineParam == 3)
{
2021-07-07 15:11:52 +02:00
sprite->x += 0x18;
sprite->y -= 0x18;
sprite->oam.matrixNum = ST_OAM_HFLIP;
2018-12-16 18:35:10 +01:00
}
else
{
2021-07-07 15:11:52 +02:00
sprite->x += 0x18;
sprite->y += 0x18;
sprite->oam.matrixNum = ST_OAM_HFLIP | ST_OAM_VFLIP;
2018-12-16 18:35:10 +01:00
}
sprite->oam.tileNum = (sprite->oam.tileNum + 16);
sprite->callback = AnimLockOnTarget;
2018-12-16 18:35:10 +01:00
sprite->callback(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimBowMon(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2020-02-20 22:22:33 +01:00
sprite->invisible = TRUE;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 0;
switch (gBattleAnimArgs[0])
{
case 0:
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBowMon_Step1;
2018-12-16 18:35:10 +01:00
break;
case 1:
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBowMon_Step2;
2018-12-16 18:35:10 +01:00
break;
case 2:
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBowMon_Step3;
2018-12-16 18:35:10 +01:00
break;
default:
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBowMon_Step4;
2018-12-16 18:35:10 +01:00
break;
}
}
2020-02-20 22:22:33 +01:00
static void AnimBowMon_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[0] = 6;
sprite->data[1] = (GetBattlerSide(gBattleAnimAttacker)) ? 2 : -2;
sprite->data[2] = 0;
sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker];
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimBowMon_Step1_Callback);
2021-11-01 17:41:21 +01:00
sprite->callback = TranslateSpriteLinearById;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimBowMon_Step1_Callback(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0] == 0)
{
sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker];
2018-12-18 05:08:08 +01:00
PrepareBattlerSpriteForRotScale(sprite->data[3], ST_OAM_OBJ_NORMAL);
2020-07-27 18:47:08 +02:00
sprite->data[4] = (sprite->data[6] = GetBattlerSide(gBattleAnimAttacker)) ? 0x300 : 0xFFFFFD00;
2018-12-16 18:35:10 +01:00
sprite->data[5] = 0;
}
sprite->data[5] += sprite->data[4];
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(sprite->data[3], 0x100, 0x100, sprite->data[5]);
SetBattlerSpriteYOffsetFromRotation(sprite->data[3]);
2018-12-16 18:35:10 +01:00
if (++sprite->data[0] > 3)
{
sprite->data[0] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBowMon_Step4;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimBowMon_Step2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[0] = 4;
sprite->data[1] = (GetBattlerSide(gBattleAnimAttacker)) ? -3 : 3;
sprite->data[2] = 0;
sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker];
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimBowMon_Step4);
2021-11-01 17:41:21 +01:00
sprite->callback = TranslateSpriteLinearById;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimBowMon_Step3(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[0] > 8)
{
sprite->data[0] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBowMon_Step3_Callback;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimBowMon_Step3_Callback(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0] == 0)
{
sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker];
sprite->data[6] = GetBattlerSide(gBattleAnimAttacker);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{
sprite->data[4] = 0xFC00;
sprite->data[5] = 0xC00;
}
else
{
sprite->data[4] = 0x400;
sprite->data[5] = 0xF400;
}
}
sprite->data[5] += sprite->data[4];
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(sprite->data[3], 0x100, 0x100, sprite->data[5]);
SetBattlerSpriteYOffsetFromRotation(sprite->data[3]);
2018-12-16 18:35:10 +01:00
if (++sprite->data[0] > 2)
{
2018-12-18 05:08:08 +01:00
ResetSpriteRotScale(sprite->data[3]);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBowMon_Step4;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimBowMon_Step4(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
DestroyAnimSprite(sprite);
}
2021-04-13 08:45:16 +02:00
static void AnimTipMon(struct Sprite *sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[0] = 0;
2021-04-13 08:45:16 +02:00
sprite->callback = AnimTipMon_Step;
2018-12-16 18:35:10 +01:00
}
2021-04-13 08:45:16 +02:00
static void AnimTipMon_Step(struct Sprite *sprite)
2018-12-16 18:35:10 +01:00
{
switch (sprite->data[0])
{
case 0:
sprite->data[1] = 0;
sprite->data[2] = gBattlerSpriteIds[gBattleAnimAttacker];
sprite->data[3] = GetBattlerSide(gBattleAnimAttacker);
sprite->data[4] = (sprite->data[3] != B_SIDE_PLAYER) ? 0x200 : -0x200;
sprite->data[5] = 0;
2018-12-18 05:08:08 +01:00
PrepareBattlerSpriteForRotScale(sprite->data[2], ST_OAM_OBJ_NORMAL);
2018-12-16 18:35:10 +01:00
sprite->data[0]++;
// fall through
case 1:
sprite->data[5] += sprite->data[4];
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(sprite->data[2], 0x100, 0x100, sprite->data[5]);
SetBattlerSpriteYOffsetFromRotation(sprite->data[2]);
2018-12-16 18:35:10 +01:00
if (++sprite->data[1] > 3)
{
sprite->data[1] = 0;
sprite->data[4] *= -1;
sprite->data[0]++;
}
break;
case 2:
sprite->data[5] += sprite->data[4];
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(sprite->data[2], 0x100, 0x100, sprite->data[5]);
SetBattlerSpriteYOffsetFromRotation(sprite->data[2]);
2018-12-16 18:35:10 +01:00
if (++sprite->data[1] > 3)
{
2018-12-18 05:08:08 +01:00
ResetSpriteRotScale(sprite->data[2]);
2018-12-16 18:35:10 +01:00
DestroyAnimSprite(sprite);
}
break;
}
}
void AnimTask_SkullBashPosition(u8 taskId)
2018-12-16 18:35:10 +01:00
{
u8 a;
gTasks[taskId].data[0] = gBattlerSpriteIds[gBattleAnimAttacker];
a = GetBattlerSide(gBattleAnimAttacker);
gTasks[taskId].data[1] = a;
gTasks[taskId].data[2] = 0;
switch (gBattleAnimArgs[0])
{
default:
DestroyAnimVisualTask(taskId);
break;
case 0:
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = 8;
gTasks[taskId].data[4] = 0;
gTasks[taskId].data[5] = 3;
if (a == 0)
gTasks[taskId].data[5] *= -1;
gTasks[taskId].func = AnimTask_SkullBashPositionSet;
2018-12-16 18:35:10 +01:00
break;
case 1:
gTasks[taskId].data[3] = 8;
gTasks[taskId].data[4] = 0x600;
gTasks[taskId].data[5] = 0xC0;
if (a == 0)
{
gTasks[taskId].data[4] = -gTasks[taskId].data[4];
gTasks[taskId].data[5] = -gTasks[taskId].data[5];
}
gTasks[taskId].func = AnimTask_SkullBashPositionReset;
2018-12-16 18:35:10 +01:00
break;
}
}
static void AnimTask_SkullBashPositionSet(u8 taskId)
2018-12-16 18:35:10 +01:00
{
struct Task *task = &gTasks[taskId];
switch (task->data[2])
{
case 0:
if (task->data[3])
{
task->data[4] += task->data[5];
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].x2 = task->data[4];
2018-12-16 18:35:10 +01:00
task->data[3]--;
}
else
{
task->data[3] = 8;
task->data[4] = 0;
task->data[5] = (task->data[1] == 0) ? -0xC0 : 0xC0;
2018-12-18 05:08:08 +01:00
PrepareBattlerSpriteForRotScale(task->data[0], ST_OAM_OBJ_NORMAL);
2018-12-16 18:35:10 +01:00
task->data[2]++;
}
break;
case 1:
if (task->data[3])
{
task->data[4] += task->data[5];
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(task->data[0], 0x100, 0x100, task->data[4]);
SetBattlerSpriteYOffsetFromRotation(task->data[0]);
2018-12-16 18:35:10 +01:00
task->data[3]--;
}
else
{
task->data[3] = 8;
2021-07-07 15:11:52 +02:00
task->data[4] = gSprites[task->data[0]].x2;
2018-12-16 18:35:10 +01:00
task->data[5] = (task->data[1] == 0) ? 0x2 : -0x2;
task->data[6] = 1;
task->data[2]++;
}
break;
case 2:
if (task->data[3])
{
if (task->data[6])
{
task->data[6]--;
}
else
{
if (task->data[3] & 1)
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].x2 = task->data[4] + task->data[5];
2018-12-16 18:35:10 +01:00
else
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].x2 = task->data[4] - task->data[5];
2018-12-16 18:35:10 +01:00
task->data[6] = 1;
task->data[3]--;
}
}
else
{
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].x2 = task->data[4];
2018-12-16 18:35:10 +01:00
task->data[3] = 12;
task->data[2]++;
}
break;
case 3:
if (task->data[3])
{
task->data[3]--;
}
else
{
task->data[3] = 3;
2021-07-07 15:11:52 +02:00
task->data[4] = gSprites[task->data[0]].x2;
2018-12-16 18:35:10 +01:00
task->data[5] = (task->data[1] == 0) ? 8 : -8;
task->data[2]++;
}
break;
case 4:
if (task->data[3])
{
task->data[4] += task->data[5];
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].x2 = task->data[4];
2018-12-16 18:35:10 +01:00
task->data[3]--;
}
else
{
DestroyAnimVisualTask(taskId);
}
break;
}
}
static void AnimTask_SkullBashPositionReset(u8 taskId)
2018-12-16 18:35:10 +01:00
{
struct Task* task = &gTasks[taskId];
if (task->data[3])
{
task->data[4] -= task->data[5];
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(task->data[0], 0x100, 0x100, task->data[4]);
SetBattlerSpriteYOffsetFromRotation(task->data[0]);
2018-12-16 18:35:10 +01:00
task->data[3]--;
}
else
{
2018-12-18 05:08:08 +01:00
ResetSpriteRotScale(task->data[0]);
2018-12-16 18:35:10 +01:00
DestroyAnimVisualTask(taskId);
}
}
2020-02-20 22:22:33 +01:00
static void AnimSlashSlice(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (gBattleAnimArgs[0] == 0)
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
2018-12-16 18:35:10 +01:00
}
else
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
2018-12-16 18:35:10 +01:00
}
sprite->data[0] = 0;
sprite->data[1] = 0;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimFalseSwipeSlice_Step3);
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimFalseSwipeSlice(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + 0xFFD0;
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimFalseSwipeSlice_Step1);
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimFalseSwipePositionedSlice(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-11-08 19:18:58 +01:00
sprite->x = sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + 0xFFD0 + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, 1);
sprite->data[0] = 0;
sprite->data[1] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimFalseSwipeSlice_Step3;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimFalseSwipeSlice_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[0] > 8)
{
sprite->data[0] = 12;
sprite->data[1] = 8;
sprite->data[2] = 0;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimFalseSwipeSlice_Step2);
2019-02-06 20:17:09 +01:00
sprite->callback = TranslateSpriteLinear;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimFalseSwipeSlice_Step2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[0] = 0;
sprite->data[1] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimFalseSwipeSlice_Step3;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimFalseSwipeSlice_Step3(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[0] > 1)
{
sprite->data[0] = 0;
sprite->invisible = !sprite->invisible;
if (++sprite->data[1] > 8)
DestroyAnimSprite(sprite);
}
}
2020-02-20 22:22:33 +01:00
static void AnimEndureEnergy(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (gBattleAnimArgs[0] == 0)
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[2];
2018-12-16 18:35:10 +01:00
}
else
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + gBattleAnimArgs[2];
2018-12-16 18:35:10 +01:00
}
sprite->data[0] = 0;
sprite->data[1] = gBattleAnimArgs[3];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimEndureEnergy_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimEndureEnergy_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[0] > sprite->data[1])
{
sprite->data[0] = 0;
2021-07-07 15:11:52 +02:00
sprite->y--;
2018-12-16 18:35:10 +01:00
}
2021-07-07 15:11:52 +02:00
sprite->y -= sprite->data[0];
2018-12-16 18:35:10 +01:00
if (sprite->animEnded)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimSharpenSphere(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) - 12;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 0;
sprite->data[1] = 2;
sprite->data[2] = 0;
sprite->data[3] = 0;
sprite->data[4] = 0;
sprite->data[5] = BattleAnimAdjustPanning(-64);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSharpenSphere_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSharpenSphere_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[0] >= sprite->data[1])
{
sprite->invisible = !sprite->invisible;
if (!sprite->invisible)
{
sprite->data[4]++;
if (!(sprite->data[4] & 1))
2020-08-21 00:02:00 +02:00
PlaySE12WithPanning(SE_M_SWAGGER2, sprite->data[5]);
2018-12-16 18:35:10 +01:00
}
sprite->data[0] = 0;
if (++sprite->data[2] > 1)
{
sprite->data[2] = 0;
sprite->data[1]++;
}
}
if (sprite->animEnded && sprite->data[1] > 16 && sprite->invisible)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimConversion(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0] == 0)
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
if (IsContest())
2021-07-07 15:11:52 +02:00
sprite->y += 10;
2018-12-16 18:35:10 +01:00
sprite->data[0]++;
}
if ((u16)gBattleAnimArgs[7] == 0xFFFF)
2018-12-16 18:35:10 +01:00
DestroyAnimSprite(sprite);
}
2019-10-14 22:51:45 +02:00
void AnimTask_ConversionAlphaBlend(u8 taskId)
2018-12-16 18:35:10 +01:00
{
if (gTasks[taskId].data[2] == 1)
{
gBattleAnimArgs[7] = 0xFFFF;
2018-12-16 18:35:10 +01:00
gTasks[taskId].data[2]++;
}
else if (gTasks[taskId].data[2] == 2)
{
DestroyAnimVisualTask(taskId);
}
else
{
if (++gTasks[taskId].data[0] == 4)
{
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1]++;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - gTasks[taskId].data[1], gTasks[taskId].data[1]));
if (gTasks[taskId].data[1] == 16)
gTasks[taskId].data[2]++;
}
}
}
2020-02-20 22:22:33 +01:00
static void AnimConversion2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, FALSE);
2018-12-16 18:35:10 +01:00
sprite->animPaused = 1;
sprite->data[0] = gBattleAnimArgs[2];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimConversion2_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimConversion2_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0])
{
sprite->data[0]--;
}
else
{
sprite->animPaused = 0;
sprite->data[0] = 30;
2021-11-08 19:18:58 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
}
2019-10-14 22:51:45 +02:00
void AnimTask_Conversion2AlphaBlend(u8 taskId)
2018-12-16 18:35:10 +01:00
{
if (++gTasks[taskId].data[0] == 4)
{
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1]++;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[1], 16 - gTasks[taskId].data[1]));
if (gTasks[taskId].data[1] == 16)
DestroyAnimVisualTask(taskId);
}
}
2021-04-13 08:45:16 +02:00
// Unused
static void AnimTask_HideBattlersHealthbox(u8 taskId)
2018-12-16 18:35:10 +01:00
{
u8 i;
for (i = 0; i < gBattlersCount; i++)
{
2021-04-13 08:45:16 +02:00
if (gBattleAnimArgs[0] == TRUE && GetBattlerSide(i) == B_SIDE_PLAYER)
2018-12-16 18:35:10 +01:00
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[i]);
2021-04-13 08:45:16 +02:00
if (gBattleAnimArgs[1] == TRUE && GetBattlerSide(i) == B_SIDE_OPPONENT)
2018-12-16 18:35:10 +01:00
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[i]);
}
DestroyAnimVisualTask(taskId);
}
2021-04-13 08:45:16 +02:00
// Unused
static void AnimTask_ShowBattlersHealthbox(u8 taskId)
2018-12-16 18:35:10 +01:00
{
u8 i;
for (i = 0; i < gBattlersCount; i++)
SetHealthboxSpriteVisible(gHealthboxSpriteIds[i]);
DestroyAnimVisualTask(taskId);
}
2020-02-20 22:22:33 +01:00
static void AnimMoon(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (IsContest())
{
2021-07-07 15:11:52 +02:00
sprite->x = 48;
sprite->y = 40;
2018-12-16 18:35:10 +01:00
}
else
{
2021-07-07 15:11:52 +02:00
sprite->x = gBattleAnimArgs[0];
sprite->y = gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
}
sprite->oam.shape = SPRITE_SHAPE(64x64);
sprite->oam.size = SPRITE_SIZE(64x64);
2018-12-16 18:35:10 +01:00
sprite->data[0] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimMoon_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimMoon_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (sprite->data[0])
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimMoonlightSparkle(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[0];
2021-07-07 15:11:52 +02:00
sprite->y = gBattleAnimArgs[1];
2018-12-16 18:35:10 +01:00
sprite->data[0] = 0;
sprite->data[1] = 0;
sprite->data[2] = 0;
sprite->data[3] = 0;
sprite->data[4] = 1;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimMoonlightSparkle_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimMoonlightSparkle_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[1] > 1)
{
sprite->data[1] = 0;
if (sprite->data[2] < 120)
{
2021-07-07 15:11:52 +02:00
sprite->y++;
2018-12-16 18:35:10 +01:00
sprite->data[2]++;
}
}
if (sprite->data[0])
DestroyAnimSprite(sprite);
}
2020-02-20 06:04:42 +01:00
void AnimTask_MoonlightEndFade(u8 taskId)
2018-12-16 18:35:10 +01:00
{
2021-02-28 00:41:30 +01:00
int a = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF;
2018-12-16 18:35:10 +01:00
int b;
int c;
int d;
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = a;
gTasks[taskId].data[4] = 0;
gTasks[taskId].data[5] = 0;
gTasks[taskId].data[6] = 0;
gTasks[taskId].data[7] = 13;
gTasks[taskId].data[8] = 14;
gTasks[taskId].data[9] = 15;
2021-02-28 00:41:30 +01:00
b = GetBattleMonSpritePalettesMask(1, 1, 1, 1);
2018-12-16 18:35:10 +01:00
c = a | b;
2018-12-18 05:08:08 +01:00
StorePointerInVars(&gTasks[taskId].data[14], &gTasks[taskId].data[15], (void*)c);
2018-12-16 18:35:10 +01:00
b = b | (0x10000 << IndexOfSpritePaletteTag(ANIM_TAG_MOON));
d = IndexOfSpritePaletteTag(ANIM_TAG_GREEN_SPARKLE);
BeginNormalPaletteFade((0x10000 << d) | b, 0, 0, 16, RGB(27, 29, 31));
2020-02-20 22:22:33 +01:00
gTasks[taskId].func = AnimTask_MoonlightEndFade_Step;
2018-12-16 18:35:10 +01:00
gTasks[taskId].func(taskId);
}
2020-02-20 22:22:33 +01:00
static void AnimTask_MoonlightEndFade_Step(u8 taskId)
2018-12-16 18:35:10 +01:00
{
struct Task* task = &gTasks[taskId];
switch (task->data[0])
{
case 0:
if (++task->data[1] > 0)
{
u16 color;
u16 bitmask;
u16 r3;
u16 i;
u16 j;
task->data[1] = 0;
if (++task->data[2] <= 15)
{
u16 red;
u16 green;
u16 blue;
task->data[4] += task->data[7];
task->data[5] += task->data[8];
task->data[6] += task->data[9];
red = task->data[4] >> 3;
green = task->data[5] >> 3;
blue = task->data[6] >> 3;
color = RGB(red, green, blue);
}
else
{
color = RGB(27, 29, 31);
task->data[0]++;
}
bitmask = 1;
r3 = 0;
for (i = 0; i <= 15; i++)
{
if (task->data[3] & bitmask)
{
for (j = 1; j <= 15; j++)
{
gPlttBufferFaded[r3 + j] = color;
}
}
bitmask <<= 1;
r3 += 16;
}
}
break;
case 1:
if (!gPaletteFade.active)
{
u8 spriteId;
for (spriteId = 0; spriteId < MAX_SPRITES; spriteId++)
{
if (gSprites[spriteId].template == &gMoonSpriteTemplate || gSprites[spriteId].template == &gMoonlightSparkleSpriteTemplate)
2018-12-16 18:35:10 +01:00
gSprites[spriteId].data[0] = 1;
}
task->data[1] = 0;
task->data[0]++;
}
break;
case 2:
if (++task->data[1] > 30)
{
2018-12-18 05:08:08 +01:00
BeginNormalPaletteFade((u32)LoadPointerFromVars(task->data[14], task->data[15]), 0, 16, 0, RGB(27, 29, 31));
2018-12-16 18:35:10 +01:00
task->data[0]++;
}
break;
case 3:
if (!gPaletteFade.active)
DestroyAnimVisualTask(taskId);
break;
}
}
2020-02-20 22:22:33 +01:00
static void AnimHornHit(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (gBattleAnimArgs[2] < 2)
gBattleAnimArgs[2] = 2;
if (gBattleAnimArgs[2] > 0x7F)
gBattleAnimArgs[2] = 0x7F;
sprite->data[0] = 0;
sprite->data[1] = gBattleAnimArgs[2];
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[1];
2021-07-07 15:11:52 +02:00
sprite->data[6] = sprite->x;
sprite->data[7] = sprite->y;
2018-12-16 18:35:10 +01:00
if (IsContest())
{
sprite->oam.matrixNum = ST_OAM_HFLIP;
2021-07-07 15:11:52 +02:00
sprite->x += 40;
sprite->y += 20;
sprite->data[2] = sprite->x << 7;
2018-12-16 18:35:10 +01:00
sprite->data[3] = -0x1400 / sprite->data[1];
2021-07-07 15:11:52 +02:00
sprite->data[4] = sprite->y << 7;
2018-12-16 18:35:10 +01:00
sprite->data[5] = -0xA00 / sprite->data[1];
}
else if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
{
2021-07-07 15:11:52 +02:00
sprite->x -= 40;
sprite->y += 20;
sprite->data[2] = sprite->x << 7;
2018-12-16 18:35:10 +01:00
sprite->data[3] = 0x1400 / sprite->data[1];
2021-07-07 15:11:52 +02:00
sprite->data[4] = sprite->y << 7;
2018-12-16 18:35:10 +01:00
sprite->data[5] = -0xA00 / sprite->data[1];
}
else
{
2021-07-07 15:11:52 +02:00
sprite->x += 40;
sprite->y -= 20;
sprite->data[2] = sprite->x << 7;
2018-12-16 18:35:10 +01:00
sprite->data[3] = -0x1400 / sprite->data[1];
2021-07-07 15:11:52 +02:00
sprite->data[4] = sprite->y << 7;
2018-12-16 18:35:10 +01:00
sprite->data[5] = 0xA00 / sprite->data[1];
sprite->oam.matrixNum = (ST_OAM_HFLIP | ST_OAM_VFLIP);
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
sprite->callback = AnimHornHit_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimHornHit_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[2] += sprite->data[3];
sprite->data[4] += sprite->data[5];
2021-07-07 15:11:52 +02:00
sprite->x = sprite->data[2] >> 7;
sprite->y = sprite->data[4] >> 7;
2018-12-16 18:35:10 +01:00
if (--sprite->data[1] == 1)
{
2021-07-07 15:11:52 +02:00
sprite->x = sprite->data[6];
sprite->y = sprite->data[7];
2018-12-16 18:35:10 +01:00
}
if (sprite->data[1] == 0)
DestroyAnimSprite(sprite);
}
void AnimTask_DoubleTeam(u8 taskId)
2018-12-16 18:35:10 +01:00
{
u16 i;
int obj;
u16 r3;
u16 r4;
struct Task* task = &gTasks[taskId];
task->data[0] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
task->data[1] = AllocSpritePalette(ANIM_TAG_BENT_SPOON);
r3 = (task->data[1] * 16) + 0x100;
r4 = (gSprites[task->data[0]].oam.paletteNum + 16) << 4;
for (i = 1; i < 16; i++)
gPlttBufferUnfaded[r3 + i] = gPlttBufferUnfaded[r4 + i];
BlendPalette(r3, 16, 11, RGB(0, 0, 0));
task->data[3] = 0;
i = 0;
2018-12-18 05:08:08 +01:00
while (i < 2 && (obj = CloneBattlerSpriteWithBlend(0)) >= 0)
2018-12-16 18:35:10 +01:00
{
gSprites[obj].oam.paletteNum = task->data[1];
gSprites[obj].data[0] = 0;
gSprites[obj].data[1] = i << 7;
gSprites[obj].data[2] = taskId;
2020-02-20 22:22:33 +01:00
gSprites[obj].callback = AnimDoubleTeam;
2018-12-16 18:35:10 +01:00
task->data[3]++;
i++;
}
2020-02-20 22:22:33 +01:00
task->func = AnimTask_DoubleTeam_Step;
2018-12-20 04:13:26 +01:00
if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1)
2018-12-16 18:35:10 +01:00
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON);
else
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON);
}
2020-02-20 22:22:33 +01:00
static void AnimTask_DoubleTeam_Step(u8 taskId)
2018-12-16 18:35:10 +01:00
{
struct Task* task = &gTasks[taskId];
if (!task->data[3])
{
2018-12-20 04:13:26 +01:00
if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1)
2018-12-16 18:35:10 +01:00
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON);
else
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON);
FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON);
DestroyAnimVisualTask(taskId);
}
}
2020-02-20 22:22:33 +01:00
static void AnimDoubleTeam(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[3] > 1)
{
sprite->data[3] = 0;
sprite->data[0]++;
}
if (sprite->data[0] > 64)
{
gTasks[sprite->data[2]].data[3]--;
2021-11-01 17:41:21 +01:00
DestroySpriteWithActiveSheet(sprite);
2018-12-16 18:35:10 +01:00
}
else
{
sprite->data[4] = gSineTable[sprite->data[0]] / 6;
sprite->data[5] = gSineTable[sprite->data[0]] / 13;
sprite->data[1] = (sprite->data[1] + sprite->data[5]) & 0xFF;
2021-07-07 15:11:52 +02:00
sprite->x2 = Sin(sprite->data[1], sprite->data[4]);
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimSuperFang(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-12-16 18:35:10 +01:00
}
2019-10-14 23:27:12 +02:00
void AnimTask_MusicNotesRainbowBlend(u8 taskId)
2018-12-16 18:35:10 +01:00
{
u16 i;
u16 j;
u16 index;
index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[0][0]);
2018-12-16 18:35:10 +01:00
if (index != 0xFF)
{
index = (index << 4) + 0x100;
for (i = 1; i < ARRAY_COUNT(gParticlesColorBlendTable[0]); i++)
gPlttBufferFaded[index + i] = gParticlesColorBlendTable[0][i];
2018-12-16 18:35:10 +01:00
}
for (j = 1; j < ARRAY_COUNT(gParticlesColorBlendTable); j++)
2018-12-16 18:35:10 +01:00
{
index = AllocSpritePalette(gParticlesColorBlendTable[j][0]);
2018-12-16 18:35:10 +01:00
if (index != 0xFF)
{
index = (index << 4) + 0x100;
for (i = 1; i < ARRAY_COUNT(gParticlesColorBlendTable[0]); i++)
gPlttBufferFaded[index + i] = gParticlesColorBlendTable[j][i];
2018-12-16 18:35:10 +01:00
}
}
DestroyAnimVisualTask(taskId);
}
// clears the rainbow effect for musical notes.
2019-10-14 23:27:12 +02:00
void AnimTask_MusicNotesClearRainbowBlend(u8 taskId)
2018-12-16 18:35:10 +01:00
{
u16 i;
for (i = 1; i < ARRAY_COUNT(gParticlesColorBlendTable); i++)
FreeSpritePaletteByTag(gParticlesColorBlendTable[i][0]);
2018-12-16 18:35:10 +01:00
DestroyAnimVisualTask(taskId);
}
2020-02-20 22:22:33 +01:00
static void AnimWavyMusicNotes(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
u8 index;
u8 a;
u8 b;
2018-12-18 05:08:08 +01:00
SetSpriteCoordsToAnimAttackerCoords(sprite);
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[0]);
if ((index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[gBattleAnimArgs[1]][0])) != 0xFF)
2018-12-16 18:35:10 +01:00
sprite->oam.paletteNum = index;
sprite->data[1] = gBattleAnimArgs[1];
sprite->data[2] = 0;
sprite->data[3] = gBattleAnimArgs[2];
if (IsContest())
{
a = 48;
b = 40;
}
else
{
2021-11-08 19:18:58 +01:00
a = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
b = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-16 18:35:10 +01:00
}
2021-07-07 15:11:52 +02:00
sprite->data[4] = sprite->x << 4;
sprite->data[5] = sprite->y << 4;
AnimWavyMusicNotesGetNextPos(a - sprite->x, b - sprite->y, &sprite->data[6], &sprite->data[7], 40);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimWavyMusicNotes_Step;
2018-12-16 18:35:10 +01:00
}
2019-10-16 19:10:39 +02:00
static void AnimWavyMusicNotesGetNextPos(s16 a, s16 b, s16* c, s16* d, s8 e)
2018-12-16 18:35:10 +01:00
{
int f;
int g;
if (a < 0)
e = -e;
f = a << 8;
g = f / e;
if (g == 0)
g = 1;
*c = f / g;
*d = (b << 8) / g;
}
2020-02-20 22:22:33 +01:00
static void AnimWavyMusicNotes_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2019-07-30 15:08:49 +02:00
s16 y, yDelta;
2018-12-16 18:35:10 +01:00
u8 index;
2019-07-30 15:08:49 +02:00
2018-12-16 18:35:10 +01:00
sprite->data[0]++;
2019-07-30 15:08:49 +02:00
yDelta = sprite->data[0] * 5 - ((sprite->data[0] * 5 / 256) << 8);
2018-12-16 18:35:10 +01:00
sprite->data[4] += sprite->data[6];
sprite->data[5] += sprite->data[7];
2021-07-07 15:11:52 +02:00
sprite->x = sprite->data[4] >> 4;
sprite->y = sprite->data[5] >> 4;
sprite->y2 = Sin(yDelta, 15);
2018-12-16 18:35:10 +01:00
2021-07-07 15:11:52 +02:00
y = sprite->y;
if (sprite->x < -16 || sprite->x > 256 || y < -16 || y > 128)
2018-12-16 18:35:10 +01:00
{
2018-12-18 05:08:08 +01:00
DestroySpriteAndMatrix(sprite);
2018-12-16 18:35:10 +01:00
}
else
{
if (sprite->data[3] && ++sprite->data[2] > sprite->data[3])
{
sprite->data[2] = 0;
if (++sprite->data[1] > 3)
sprite->data[1] = 0;
index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[sprite->data[1]][0]);
2018-12-16 18:35:10 +01:00
if (index != 0xFF)
sprite->oam.paletteNum = index;
}
}
}
2020-02-20 22:22:33 +01:00
static void AnimFlyingMusicNotes(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
2019-07-30 15:08:49 +02:00
gBattleAnimArgs[1] *= -1;
2018-12-16 18:35:10 +01:00
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[0]);
sprite->data[2] = 0;
sprite->data[3] = 0;
2021-07-07 15:11:52 +02:00
sprite->data[4] = sprite->x << 4;
sprite->data[5] = sprite->y << 4;
2018-12-16 18:35:10 +01:00
sprite->data[6] = (gBattleAnimArgs[1] << 4) / 5;
sprite->data[7] = (gBattleAnimArgs[2] << 7) / 5;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimFlyingMusicNotes_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimFlyingMusicNotes_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
sprite->data[4] += sprite->data[6];
sprite->data[5] += sprite->data[7];
2021-07-07 15:11:52 +02:00
sprite->x = sprite->data[4] >> 4;
sprite->y = sprite->data[5] >> 4;
2018-12-16 18:35:10 +01:00
if (sprite->data[0] > 5 && sprite->data[3] == 0)
{
sprite->data[2] = (sprite->data[2] + 16) & 0xFF;
2021-07-07 15:11:52 +02:00
sprite->x2 = Cos(sprite->data[2], 18);
sprite->y2 = Sin(sprite->data[2], 18);
2018-12-16 18:35:10 +01:00
if (sprite->data[2] == 0)
sprite->data[3] = 1;
}
if (++sprite->data[0] == 48)
2018-12-18 05:08:08 +01:00
DestroySpriteAndMatrix(sprite);
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimBellyDrumHand(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
s16 a;
if (gBattleAnimArgs[0] == 1)
{
sprite->oam.matrixNum = ST_OAM_HFLIP;
2018-12-16 18:35:10 +01:00
a = 16;
}
else
{
a = -16;
}
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + a;
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + 8;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 8;
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
void AnimSlowFlyingMusicNotes(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
s16 xDiff;
u8 index;
2018-12-18 05:08:08 +01:00
SetSpriteCoordsToAnimAttackerCoords(sprite);
2021-07-07 15:11:52 +02:00
sprite->y += 8;
2018-12-16 18:35:10 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[1]);
index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[gBattleAnimArgs[2]][0]);
2018-12-16 18:35:10 +01:00
if (index != 0xFF)
sprite->oam.paletteNum = index;
xDiff = (gBattleAnimArgs[0] == 0) ? -32 : 32;
sprite->data[0] = 40;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-16 18:35:10 +01:00
sprite->data[2] = xDiff + sprite->data[1];
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-16 18:35:10 +01:00
sprite->data[4] = sprite->data[3] - 40;
InitAnimLinearTranslation(sprite);
sprite->data[5] = gBattleAnimArgs[3];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSlowFlyingMusicNotes_Step;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSlowFlyingMusicNotes_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2018-12-20 04:13:26 +01:00
if (AnimTranslateLinear(sprite) == 0)
2018-12-16 18:35:10 +01:00
{
s16 xDiff;
xDiff = Sin(sprite->data[5], 8);
2021-07-07 15:11:52 +02:00
if (sprite->x2 < 0)
2018-12-16 18:35:10 +01:00
xDiff = -xDiff;
2021-07-07 15:11:52 +02:00
sprite->x2 += xDiff;
sprite->y2 += Sin(sprite->data[5], 4);
2018-12-16 18:35:10 +01:00
sprite->data[5] = (sprite->data[5] + 8) & 0xFF;
}
else
{
DestroyAnimSprite(sprite);
}
}
2019-10-14 22:51:45 +02:00
void SetSpriteNextToMonHead(u8 battler, struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
sprite->x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_RIGHT) + 8;
2018-12-16 18:35:10 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_LEFT) - 8;
2018-12-16 18:35:10 +01:00
2021-11-08 19:18:58 +01:00
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) - (s16)GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 4;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimThoughtBubble(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
u8 a;
u8 battler;
if (gBattleAnimArgs[0] == 0)
battler = gBattleAnimAttacker;
else
battler = gBattleAnimTarget;
2019-10-14 22:51:45 +02:00
SetSpriteNextToMonHead(battler, sprite);
2018-12-16 18:35:10 +01:00
a = (GetBattlerSide(battler) == B_SIDE_PLAYER) ? 0 : 1;
sprite->data[0] = gBattleAnimArgs[1];
sprite->data[1] = a + 2;
StartSpriteAnim(sprite, a);
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimThoughtBubble_Step);
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimThoughtBubble_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (--sprite->data[0] == 0)
{
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
StartSpriteAnim(sprite, sprite->data[1]);
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimMetronomeFinger(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
u8 battler;
if (gBattleAnimArgs[0] == 0)
battler = gBattleAnimAttacker;
else
battler = gBattleAnimTarget;
2019-10-14 22:51:45 +02:00
SetSpriteNextToMonHead(battler, sprite);
2018-12-16 18:35:10 +01:00
sprite->data[0] = 0;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimMetronomeFinger_Step);
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAffineAnimEnds;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimMetronomeFinger_Step(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[0] > 16)
{
StartSpriteAffineAnim(sprite, 1);
2018-12-18 05:08:08 +01:00
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
sprite->callback = RunStoredCallbackWhenAffineAnimEnds;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimFollowMeFinger(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
u8 battler;
if (gBattleAnimArgs[0] == 0)
battler = gBattleAnimAttacker;
else
battler = gBattleAnimTarget;
2021-11-08 19:18:58 +01:00
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X);
2021-07-07 15:11:52 +02:00
sprite->y = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_TOP);
if (sprite->y <= 9)
sprite->y = 10;
2018-12-16 18:35:10 +01:00
sprite->data[0] = 1;
sprite->data[1] = 0;
sprite->data[2] = sprite->subpriority;
sprite->data[3] = sprite->subpriority + 4;
sprite->data[4] = 0;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimFollowMeFinger_Step1);
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAffineAnimEnds;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimFollowMeFinger_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[4] > 12)
2020-02-20 22:22:33 +01:00
sprite->callback = AnimFollowMeFinger_Step2;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimFollowMeFinger_Step2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2019-07-30 15:08:49 +02:00
s16 x1, x2;
2018-12-16 18:35:10 +01:00
sprite->data[1] += 4;
if (sprite->data[1] > 254)
{
if (--sprite->data[0] == 0)
{
2021-07-07 15:11:52 +02:00
sprite->x2 = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimMetronomeFinger_Step;
2018-12-16 18:35:10 +01:00
return;
}
else
{
sprite->data[1] &= 0xFF;
}
}
if (sprite->data[1] > 0x4F)
sprite->subpriority = sprite->data[3];
if (sprite->data[1] > 0x9F)
sprite->subpriority = sprite->data[2];
2019-07-30 15:08:49 +02:00
x1 = gSineTable[sprite->data[1]];
x2 = x1 >> 3;
2021-07-07 15:11:52 +02:00
sprite->x2 = (x1 >> 3) + (x2 >> 1);
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTauntFinger(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
2019-07-30 15:08:49 +02:00
u8 battler;
2018-12-16 18:35:10 +01:00
if (gBattleAnimArgs[0] == 0)
2019-07-30 15:08:49 +02:00
battler = gBattleAnimAttacker;
2018-12-16 18:35:10 +01:00
else
2019-07-30 15:08:49 +02:00
battler = gBattleAnimTarget;
2018-12-16 18:35:10 +01:00
2019-10-14 22:51:45 +02:00
SetSpriteNextToMonHead(battler, sprite);
2019-07-30 15:08:49 +02:00
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
2018-12-16 18:35:10 +01:00
{
StartSpriteAnim(sprite, 0);
sprite->data[0] = 2;
}
else
{
StartSpriteAnim(sprite, 1);
sprite->data[0] = 3;
}
2020-02-20 22:22:33 +01:00
sprite->callback = AnimTauntFinger_Step1;
2018-12-16 18:35:10 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTauntFinger_Step1(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[1] > 10)
{
sprite->data[1] = 0;
StartSpriteAnim(sprite, sprite->data[0]);
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimTauntFinger_Step2);
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-12-16 18:35:10 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimTauntFinger_Step2(struct Sprite* sprite)
2018-12-16 18:35:10 +01:00
{
if (++sprite->data[1] > 5)
DestroyAnimSprite(sprite);
}