pokeemerald/src/battle_anim_effects_2.c

3840 lines
108 KiB
C
Raw Normal View History

2018-12-18 04:56:34 +01:00
#include "global.h"
#include "malloc.h"
2018-12-18 04:56:34 +01:00
#include "battle_anim.h"
#include "battle_interface.h"
#include "decompress.h"
#include "gpu_regs.h"
#include "graphics.h"
#include "main.h"
#include "math_util.h"
#include "palette.h"
#include "random.h"
#include "scanline_effect.h"
#include "sound.h"
#include "trig.h"
#include "util.h"
#include "constants/rgb.h"
#include "constants/songs.h"
static void AnimCirclingFinger(struct Sprite *);
static void AnimBouncingMusicNote(struct Sprite *);
static void AnimBouncingMusicNote_Step(struct Sprite *);
static void AnimVibrateBattlerBack(struct Sprite *);
static void AnimMovingClamp(struct Sprite *);
static void AnimMovingClamp_Step(struct Sprite *);
static void AnimMovingClamp_End(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimKinesisZapEnergy(struct Sprite *);
static void AnimSwordsDanceBlade(struct Sprite *);
static void AnimSwordsDanceBlade_Step(struct Sprite *);
static void AnimSonicBoomProjectile(struct Sprite *);
static void AnimAirWaveProjectile(struct Sprite *);
static void AnimAirWaveProjectile_Step1(struct Sprite *sprite);
static void AnimAirWaveProjectile_Step2(struct Sprite *sprite);
static void AnimVoidLines(struct Sprite *);
static void AnimVoidLines_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimCoinThrow(struct Sprite *);
static void AnimFallingCoin(struct Sprite *);
2019-10-20 10:47:56 +02:00
static void AnimFallingCoin_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimBulletSeed(struct Sprite *);
2019-10-20 10:47:56 +02:00
static void AnimBulletSeed_Step1(struct Sprite *);
static void AnimBulletSeed_Step2(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimRazorWindTornado(struct Sprite *);
static void AnimViceGripPincer(struct Sprite *);
static void AnimViceGripPincer_Step(struct Sprite *);
static void AnimGuillotinePincer(struct Sprite *);
static void AnimGuillotinePincer_Step1(struct Sprite *);
static void AnimGuillotinePincer_Step2(struct Sprite *);
static void AnimGuillotinePincer_Step3(struct Sprite *);
static void AnimBreathPuff(struct Sprite *);
static void AnimAngerMark(struct Sprite *);
static void AnimPencil(struct Sprite *);
2019-10-20 11:01:12 +02:00
static void AnimPencil_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimBlendThinRing(struct Sprite *);
static void AnimHyperVoiceRing(struct Sprite *);
static void AnimUproarRing(struct Sprite *);
static void AnimSoftBoiledEgg(struct Sprite *);
2019-10-20 11:16:45 +02:00
static void AnimSoftBoiledEgg_Step1(struct Sprite *);
static void AnimSoftBoiledEgg_Step2(struct Sprite *);
static void AnimSoftBoiledEgg_Step3(struct Sprite *);
static void AnimSoftBoiledEgg_Step3_Callback1(struct Sprite *);
static void AnimSoftBoiledEgg_Step3_Callback2(struct Sprite *);
static void AnimSoftBoiledEgg_Step4(struct Sprite *);
static void AnimSoftBoiledEgg_Step4_Callback(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimSpeedDust(struct Sprite *);
static void AnimHealBellMusicNote(struct Sprite *);
static void AnimMagentaHeart(struct Sprite *);
static void AnimRedHeartProjectile(struct Sprite *);
2019-10-20 11:55:02 +02:00
static void AnimRedHeartProjectile_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimRedHeartRising(struct Sprite *);
2019-10-20 11:55:02 +02:00
static void AnimRedHeartRising_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimOrbitFast(struct Sprite *);
static void AnimOrbitFast_Step(struct Sprite *);
static void AnimOrbitScatter(struct Sprite *);
static void AnimOrbitScatter_Step(struct Sprite *);
static void AnimSpitUpOrb(struct Sprite *);
static void AnimSpitUpOrb_Step(struct Sprite *sprite);
static void AnimEyeSparkle(struct Sprite *);
static void AnimEyeSparkle_Step(struct Sprite *sprite);
static void AnimAngel(struct Sprite *);
static void AnimPinkHeart(struct Sprite *);
static void AnimDevil(struct Sprite *);
static void AnimFurySwipes(struct Sprite *);
2020-03-27 14:50:15 +01:00
static void AnimMovementWaves(struct Sprite *);
static void AnimMovementWaves_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimJaggedMusicNote(struct Sprite *);
2019-10-20 16:22:53 +02:00
static void AnimJaggedMusicNote_Step(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimPerishSongMusicNote2(struct Sprite *);
static void AnimPerishSongMusicNote(struct Sprite *);
2019-10-20 16:22:53 +02:00
static void AnimPerishSongMusicNote_Step1(struct Sprite *);
static void AnimPerishSongMusicNote_Step2(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimGuardRing(struct Sprite *);
static void AnimTask_Withdraw_Step(u8);
static void AnimTask_GrowAndGrayscale_Step(u8);
2020-02-20 22:22:33 +01:00
static void AnimTask_Minimize_Step(u8);
static void CreateMinimizeSprite(struct Task *, u8);
static void ClonedMinizeSprite_Step(struct Sprite *);
static void AnimTask_Splash_Step(u8);
static void AnimTask_GrowAndShrink_Step(u8);
static void AnimTask_ThrashMoveMonHorizontal_Step(u8);
static void AnimTask_ThrashMoveMonVertical_Step(u8);
static void AnimTask_SketchDrawMon_Step(u8);
static void AnimTask_AttackerStretchAndDisappear_Step(u8);
static void AnimTask_ExtremeSpeedImpact_Step(u8);
static void AnimTask_ExtremeSpeedMonReappear_Step(u8);
static void AnimTask_SpeedDust_Step(u8);
static void AnimTask_FakeOut_Step1(u8);
static void AnimTask_FakeOut_Step2(u8);
static void AnimTask_HeartsBackground_Step(u8);
static void AnimTask_ScaryFace_Step(u8);
static void AnimTask_UproarDistortion_Step(u8);
2018-12-18 04:56:34 +01:00
2019-10-20 10:47:56 +02:00
// Unused
static const struct SpriteTemplate sCirclingFingerSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_FINGER,
.paletteTag = ANIM_TAG_FINGER,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimCirclingFinger,
2018-12-18 04:56:34 +01:00
};
static const union AnimCmd sAnim_BouncingMusicNote[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(4, 1),
ANIMCMD_END,
};
// Unused (association assumed)
static const union AnimCmd *const sAnims_BouncingMusicNote[] =
2018-12-18 04:56:34 +01:00
{
sAnim_BouncingMusicNote,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
// Unused
static const struct SpriteTemplate sBouncingMusicNoteSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_MUSIC_NOTES,
.paletteTag = ANIM_TAG_MUSIC_NOTES,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimBouncingMusicNote,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
// Unused
static const struct SpriteTemplate sVibrateBattlerBackSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gDummyOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimVibrateBattlerBack,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
// Unused
static const struct SpriteTemplate sMovingClampSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_CLAMP,
.paletteTag = ANIM_TAG_CLAMP,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2020-02-21 18:38:20 +01:00
.affineAnims = gAffineAnims_Bite,
.callback = AnimMovingClamp,
2018-12-18 04:56:34 +01:00
};
static const union AnimCmd sAnim_SmallExplosion[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 9),
ANIMCMD_FRAME(16, 3),
ANIMCMD_FRAME(32, 3),
ANIMCMD_FRAME(48, 3),
ANIMCMD_END,
};
static const union AnimCmd *const sAnims_SmallExplosion[] =
2018-12-18 04:56:34 +01:00
{
sAnim_SmallExplosion,
2018-12-18 04:56:34 +01:00
};
static const union AffineAnimCmd sAffineAnim_SmallExplosion[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x50, 0x50, 0, 0),
AFFINEANIMCMD_FRAME(0x9, 0x9, 0, 18),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd *const sAffineAnims_SmallExplosion[] =
2018-12-18 04:56:34 +01:00
{
sAffineAnim_SmallExplosion,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
// Unused
static const struct SpriteTemplate sSmallExplosionSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
2019-04-06 16:32:02 +02:00
.tileTag = ANIM_TAG_EXPLOSION_6,
.paletteTag = ANIM_TAG_EXPLOSION_6,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
.anims = sAnims_SmallExplosion,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = sAffineAnims_SmallExplosion,
2019-10-20 16:22:53 +02:00
.callback = AnimSpriteOnMonPos,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const union AnimCmd gKinesisZapEnergyAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 3, .hFlip = TRUE),
ANIMCMD_FRAME(8, 3, .hFlip = TRUE),
ANIMCMD_FRAME(16, 3, .hFlip = TRUE),
ANIMCMD_FRAME(24, 3, .hFlip = TRUE),
ANIMCMD_FRAME(32, 3, .hFlip = TRUE),
ANIMCMD_FRAME(40, 3, .hFlip = TRUE),
ANIMCMD_FRAME(48, 3, .hFlip = TRUE),
ANIMCMD_LOOP(1),
ANIMCMD_END,
};
2019-10-20 10:47:56 +02:00
const union AnimCmd *const gKinesisZapEnergyAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 10:47:56 +02:00
gKinesisZapEnergyAnimCmds,
2018-12-18 04:56:34 +01:00
};
2018-12-18 05:08:08 +01:00
const struct SpriteTemplate gKinesisZapEnergySpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_ALERT,
.paletteTag = ANIM_TAG_ALERT,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x16,
2019-10-20 10:47:56 +02:00
.anims = gKinesisZapEnergyAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 22:22:33 +01:00
.callback = AnimKinesisZapEnergy,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd gSwordsDanceBladeAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x10, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(0x14, 0x0, 0, 12),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 32),
AFFINEANIMCMD_END,
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd *const gSwordsDanceBladeAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 10:47:56 +02:00
gSwordsDanceBladeAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2018-12-18 05:08:08 +01:00
const struct SpriteTemplate gSwordsDanceBladeSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_SWORD,
.paletteTag = ANIM_TAG_SWORD,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjBlend_32x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 10:47:56 +02:00
.affineAnims = gSwordsDanceBladeAffineAnimTable,
2020-02-20 22:22:33 +01:00
.callback = AnimSwordsDanceBlade,
2018-12-18 04:56:34 +01:00
};
const struct SpriteTemplate gSonicBoomSpriteTemplate =
{
.tileTag = ANIM_TAG_AIR_WAVE,
.paletteTag = ANIM_TAG_AIR_WAVE,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_32x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSonicBoomProjectile,
};
2019-10-20 10:47:56 +02:00
const struct SpriteTemplate gAirWaveProjectileSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_AIR_WAVE,
.paletteTag = ANIM_TAG_AIR_WAVE,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjBlend_32x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 15:54:16 +02:00
.callback = AnimAirWaveProjectile,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd gGrowingRingAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x20, 0x20, 0, 0),
AFFINEANIMCMD_FRAME(0x7, 0x7, 0, -56),
AFFINEANIMCMD_END,
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd gWaterPulseRingAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x5, 0x5, 0, 10),
AFFINEANIMCMD_FRAME(0xFFF6, 0xFFF6, 0, 10),
AFFINEANIMCMD_FRAME(0xA, 0xA, 0, 10),
AFFINEANIMCMD_FRAME(0xFFF6, 0xFFF6, 0, 10),
AFFINEANIMCMD_FRAME(0xA, 0xA, 0, 10),
AFFINEANIMCMD_FRAME(0xFFF6, 0xFFF6, 0, 10),
AFFINEANIMCMD_FRAME(0xA, 0xA, 0, 10),
AFFINEANIMCMD_END,
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd *const gGrowingRingAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 10:47:56 +02:00
gGrowingRingAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd *const gWaterPulseRingAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 10:47:56 +02:00
gWaterPulseRingAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2020-02-16 23:49:24 +01:00
const struct SpriteTemplate gSupersonicRingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_GOLD_RING,
.paletteTag = ANIM_TAG_GOLD_RING,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x32,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 10:47:56 +02:00
.affineAnims = gGrowingRingAffineAnimTable,
2018-12-18 04:56:34 +01:00
.callback = TranslateAnimSpriteToTargetMonLocation,
};
2020-02-16 23:49:24 +01:00
const struct SpriteTemplate gScreechRingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_PURPLE_RING,
.paletteTag = ANIM_TAG_PURPLE_RING,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x32,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 10:47:56 +02:00
.affineAnims = gGrowingRingAffineAnimTable,
2018-12-18 04:56:34 +01:00
.callback = TranslateAnimSpriteToTargetMonLocation,
};
2019-10-20 10:47:56 +02:00
const struct SpriteTemplate gMetalSoundSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_METAL_SOUND_WAVES,
.paletteTag = ANIM_TAG_METAL_SOUND_WAVES,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_32x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 10:47:56 +02:00
.affineAnims = gGrowingRingAffineAnimTable,
2018-12-18 04:56:34 +01:00
.callback = TranslateAnimSpriteToTargetMonLocation,
};
2019-10-20 10:47:56 +02:00
const struct SpriteTemplate gWaterPulseRingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_BLUE_RING_2,
.paletteTag = ANIM_TAG_BLUE_RING_2,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x32,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 10:47:56 +02:00
.affineAnims = gWaterPulseRingAffineAnimTable,
.callback = AnimWaterPulseRing,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const struct SpriteTemplate gEggThrowSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_LARGE_FRESH_EGG,
.paletteTag = ANIM_TAG_LARGE_FRESH_EGG,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 10:47:56 +02:00
.callback = AnimThrowProjectile,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
// Unused
static const struct SpriteTemplate sVoidLinesSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
2019-04-06 16:32:02 +02:00
.tileTag = ANIM_TAG_VOID_LINES,
.paletteTag = ANIM_TAG_VOID_LINES,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjBlend_64x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimVoidLines,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const union AnimCmd gCoinAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(8, 1),
ANIMCMD_END,
};
2019-10-20 10:47:56 +02:00
const union AnimCmd *const gCoinAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 10:47:56 +02:00
gCoinAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd gFallingCoinAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x0, 0x0, 10, 1),
AFFINEANIMCMD_JUMP(0),
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd *const gFallingCoinAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 10:47:56 +02:00
gFallingCoinAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const struct SpriteTemplate gCoinThrowSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_COIN,
.paletteTag = ANIM_TAG_COIN,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2019-10-20 10:47:56 +02:00
.anims = gCoinAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 10:47:56 +02:00
.callback = AnimCoinThrow,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const struct SpriteTemplate gFallingCoinSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_COIN,
.paletteTag = ANIM_TAG_COIN,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2019-10-20 10:47:56 +02:00
.anims = gCoinAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
2019-10-20 10:47:56 +02:00
.affineAnims = gFallingCoinAffineAnimTable,
.callback = AnimFallingCoin,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd gBulletSeedAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x0, 0x0, 20, 1),
AFFINEANIMCMD_JUMP(0),
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd *const gBulletSeedAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 10:47:56 +02:00
gBulletSeedAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const struct SpriteTemplate gBulletSeedSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_SEED,
.paletteTag = ANIM_TAG_SEED,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 10:47:56 +02:00
.affineAnims = gBulletSeedAffineAnimTable,
.callback = AnimBulletSeed,
2018-12-18 04:56:34 +01:00
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd gRazorWindTornadoAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x10, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(0x4, 0x0, 0, 40),
AFFINEANIMCMD_END,
};
2019-10-20 10:47:56 +02:00
const union AffineAnimCmd *const gRazorWindTornadoAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 10:47:56 +02:00
gRazorWindTornadoAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2018-12-18 05:08:08 +01:00
const struct SpriteTemplate gRazorWindTornadoSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_GUST,
.paletteTag = ANIM_TAG_GUST,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_32x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 10:47:56 +02:00
.affineAnims = gRazorWindTornadoAffineAnimTable,
2019-10-20 11:01:12 +02:00
.callback = AnimRazorWindTornado,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:01:12 +02:00
const union AnimCmd gViceGripAnimCmds1[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 3),
ANIMCMD_FRAME(16, 3),
ANIMCMD_FRAME(32, 20),
ANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const union AnimCmd gViceGripAnimCmds2[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 3, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(16, 3, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(32, 20, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const union AnimCmd *const gViceGripAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:01:12 +02:00
gViceGripAnimCmds1,
gViceGripAnimCmds2,
2018-12-18 04:56:34 +01:00
};
2018-12-18 05:08:08 +01:00
const struct SpriteTemplate gViceGripSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_CUT,
.paletteTag = ANIM_TAG_CUT,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjBlend_32x32,
2019-10-20 11:01:12 +02:00
.anims = gViceGripAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:01:12 +02:00
.callback = AnimViceGripPincer,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:01:12 +02:00
const union AnimCmd gGuillotineAnimCmds1[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 2),
ANIMCMD_FRAME(16, 2),
ANIMCMD_FRAME(32, 1),
ANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const union AnimCmd gGuillotineAnimCmds2[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(16, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(32, 1, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const union AnimCmd *const gGuillotineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:01:12 +02:00
gGuillotineAnimCmds1,
gGuillotineAnimCmds2,
2018-12-18 04:56:34 +01:00
};
2018-12-18 05:08:08 +01:00
const struct SpriteTemplate gGuillotineSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_CUT,
.paletteTag = ANIM_TAG_CUT,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjBlend_32x32,
2019-10-20 11:01:12 +02:00
.anims = gGuillotineAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:01:12 +02:00
.callback = AnimGuillotinePincer,
2018-12-18 04:56:34 +01:00
};
2018-12-18 05:08:08 +01:00
const union AffineAnimCmd gSplashEffectAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(-6, 4, 0, 8),
AFFINEANIMCMD_FRAME(10, -10, 0, 8),
AFFINEANIMCMD_FRAME(-4, 6, 0, 8),
AFFINEANIMCMD_END,
};
2018-12-18 05:08:08 +01:00
const union AffineAnimCmd gGrowAndShrinkAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(-4, -5, 0, 12),
AFFINEANIMCMD_FRAME(0, 0, 0, 24),
AFFINEANIMCMD_FRAME(4, 5, 0, 12),
AFFINEANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const union AnimCmd gBreathPuffAnimCmds1[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 4, .hFlip = TRUE),
ANIMCMD_FRAME(4, 40, .hFlip = TRUE),
ANIMCMD_FRAME(8, 4, .hFlip = TRUE),
ANIMCMD_FRAME(12, 4, .hFlip = TRUE),
ANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const union AnimCmd gBreathPuffAnimCmds2[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(4, 40),
ANIMCMD_FRAME(8, 4),
ANIMCMD_FRAME(12, 4),
ANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const union AnimCmd *const gBreathPuffAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:01:12 +02:00
gBreathPuffAnimCmds1,
gBreathPuffAnimCmds2,
2018-12-18 04:56:34 +01:00
};
2018-12-18 05:08:08 +01:00
const struct SpriteTemplate gBreathPuffSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_BREATH,
.paletteTag = ANIM_TAG_BREATH,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2019-10-20 11:01:12 +02:00
.anims = gBreathPuffAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:01:12 +02:00
.callback = AnimBreathPuff,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:01:12 +02:00
const union AffineAnimCmd gAngerMarkAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0xB, 0xB, 0, 8),
AFFINEANIMCMD_FRAME(0xFFF5, 0xFFF5, 0, 8),
AFFINEANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const union AffineAnimCmd *const gAngerMarkAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:01:12 +02:00
gAngerMarkAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2018-12-18 05:08:08 +01:00
const struct SpriteTemplate gAngerMarkSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_ANGER,
.paletteTag = ANIM_TAG_ANGER,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 11:01:12 +02:00
.affineAnims = gAngerMarkAffineAnimTable,
.callback = AnimAngerMark,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:01:12 +02:00
const union AffineAnimCmd gThrashMoveMonAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(-10, 9, 0, 7),
AFFINEANIMCMD_FRAME(20, -20, 0, 7),
AFFINEANIMCMD_FRAME(-20, 20, 0, 7),
AFFINEANIMCMD_FRAME(10, -9, 0, 7),
AFFINEANIMCMD_LOOP(2),
AFFINEANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const struct SpriteTemplate gPencilSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_PENCIL,
.paletteTag = ANIM_TAG_PENCIL,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:01:12 +02:00
.callback = AnimPencil,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:01:12 +02:00
const struct SpriteTemplate gSnoreZSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_SNORE_Z,
.paletteTag = ANIM_TAG_SNORE_Z,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-15 00:11:04 +01:00
.callback = AnimTravelDiagonally,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:01:12 +02:00
const union AnimCmd gExplosionAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_FRAME(16, 5),
ANIMCMD_FRAME(32, 5),
ANIMCMD_FRAME(48, 5),
ANIMCMD_END,
};
2019-10-20 11:01:12 +02:00
const union AnimCmd *const gExplosionAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:01:12 +02:00
gExplosionAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:01:12 +02:00
const struct SpriteTemplate gExplosionSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_EXPLOSION,
.paletteTag = ANIM_TAG_EXPLOSION,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2019-10-20 11:01:12 +02:00
.anims = gExplosionAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 16:22:53 +02:00
.callback = AnimSpriteOnMonPos,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:16:45 +02:00
const union AffineAnimCmd gSoftBoiledEggAffineAnimCmds1[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 2),
AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 4),
AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 2),
AFFINEANIMCMD_JUMP(0),
};
2019-10-20 11:16:45 +02:00
const union AffineAnimCmd gSoftBoiledEggAffineAnimCmds2[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_END,
};
2019-10-20 11:16:45 +02:00
const union AffineAnimCmd gSoftBoiledEggAffineAnimCmds3[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0xFFF8, 0x4, 0, 8),
AFFINEANIMCMD_LOOP(0),
AFFINEANIMCMD_FRAME(0x10, 0xFFF8, 0, 8),
AFFINEANIMCMD_FRAME(0xFFF0, 0x8, 0, 8),
AFFINEANIMCMD_LOOP(1),
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 15),
AFFINEANIMCMD_END,
};
2019-10-20 11:16:45 +02:00
const union AffineAnimCmd *const gSoftBoiledEggAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:16:45 +02:00
gSoftBoiledEggAffineAnimCmds1,
gSoftBoiledEggAffineAnimCmds2,
gSoftBoiledEggAffineAnimCmds3,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:16:45 +02:00
const struct SpriteTemplate gSoftBoiledEggSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_BREAKING_EGG,
.paletteTag = ANIM_TAG_BREAKING_EGG,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_32x32,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 11:16:45 +02:00
.affineAnims = gSoftBoiledEggAffineAnimTable,
.callback = AnimSoftBoiledEgg,
2018-12-18 04:56:34 +01:00
};
2019-10-20 19:03:34 +02:00
const union AffineAnimCmd gThinRingExpandingAffineAnimCmds1[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0),
AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 30),
AFFINEANIMCMD_END_ALT(1),
};
2019-10-20 19:03:34 +02:00
const union AffineAnimCmd gThinRingExpandingAffineAnimCmds2[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0),
AFFINEANIMCMD_FRAME(0x20, 0x20, 0, 15),
AFFINEANIMCMD_END_ALT(1),
};
2019-10-20 11:16:45 +02:00
const union AffineAnimCmd gHyperVoiceRingAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0),
AFFINEANIMCMD_FRAME(0xB, 0xB, 0, 45),
AFFINEANIMCMD_END_ALT(1),
};
2019-10-20 19:03:34 +02:00
const union AffineAnimCmd *const gThinRingExpandingAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 19:03:34 +02:00
gThinRingExpandingAffineAnimCmds1,
gThinRingExpandingAffineAnimCmds2,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:16:45 +02:00
const union AffineAnimCmd *const gHyperVoiceRingAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:16:45 +02:00
gHyperVoiceRingAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:16:45 +02:00
const struct SpriteTemplate gThinRingExpandingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_THIN_RING,
.paletteTag = ANIM_TAG_THIN_RING,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_64x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 19:03:34 +02:00
.affineAnims = gThinRingExpandingAffineAnimTable,
2019-10-20 16:22:53 +02:00
.callback = AnimSpriteOnMonPos,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:16:45 +02:00
2019-10-20 19:03:34 +02:00
const union AffineAnimCmd gThinRingShrinkingAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0),
AFFINEANIMCMD_FRAME(0xFFF0, 0xFFF0, 0, 30),
AFFINEANIMCMD_END_ALT(1),
};
2019-10-20 19:03:34 +02:00
const union AffineAnimCmd *const gThinRingShrinkingAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 19:03:34 +02:00
gThinRingShrinkingAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 19:03:34 +02:00
const struct SpriteTemplate gThinRingShrinkingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_THIN_RING,
.paletteTag = ANIM_TAG_THIN_RING,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_64x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 19:03:34 +02:00
.affineAnims = gThinRingShrinkingAffineAnimTable,
2019-10-20 16:22:53 +02:00
.callback = AnimSpriteOnMonPos,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:16:45 +02:00
const struct SpriteTemplate gBlendThinRingExpandingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_THIN_RING,
.paletteTag = ANIM_TAG_THIN_RING,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_64x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 19:03:34 +02:00
.affineAnims = gThinRingExpandingAffineAnimTable,
2019-10-20 11:16:45 +02:00
.callback = AnimBlendThinRing,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:16:45 +02:00
const struct SpriteTemplate gHyperVoiceRingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_THIN_RING,
.paletteTag = ANIM_TAG_THIN_RING,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_64x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 11:16:45 +02:00
.affineAnims = gHyperVoiceRingAffineAnimTable,
.callback = AnimHyperVoiceRing,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:16:45 +02:00
const struct SpriteTemplate gUproarRingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_THIN_RING,
.paletteTag = ANIM_TAG_THIN_RING,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_64x64,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 19:03:34 +02:00
.affineAnims = gThinRingExpandingAffineAnimTable,
2019-10-20 11:16:45 +02:00
.callback = AnimUproarRing,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const union AffineAnimCmd gStretchAttackerAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(96, -13, 0, 8),
AFFINEANIMCMD_END,
};
2019-10-20 11:16:45 +02:00
const union AnimCmd gSpeedDustAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 3),
ANIMCMD_FRAME(4, 3),
ANIMCMD_FRAME(8, 3),
ANIMCMD_FRAME(4, 3),
ANIMCMD_FRAME(0, 3),
ANIMCMD_END,
};
2019-10-20 11:16:45 +02:00
const union AnimCmd *const gSpeedDustAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:16:45 +02:00
gSpeedDustAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:16:45 +02:00
const struct SpriteTemplate gSpeedDustSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_SPEED_DUST,
.paletteTag = ANIM_TAG_SPEED_DUST,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2019-10-20 11:16:45 +02:00
.anims = gSpeedDustAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:16:45 +02:00
.callback = AnimSpeedDust,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const s8 gSpeedDustPosTable[][2] =
2018-12-18 04:56:34 +01:00
{
{30, 28},
{-20, 24},
{16, 26},
{-10, 28},
};
2019-10-20 11:55:02 +02:00
const union AnimCmd gBellAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 6),
ANIMCMD_FRAME(16, 6),
ANIMCMD_FRAME(32, 15),
ANIMCMD_FRAME(16, 6),
ANIMCMD_FRAME(0, 6),
ANIMCMD_FRAME(16, 6, .hFlip = TRUE),
ANIMCMD_FRAME(32, 15, .hFlip = TRUE),
ANIMCMD_FRAME(16, 6, .hFlip = TRUE),
ANIMCMD_FRAME(0, 6),
ANIMCMD_FRAME(16, 6),
ANIMCMD_FRAME(32, 15),
ANIMCMD_FRAME(16, 6),
ANIMCMD_FRAME(0, 6),
ANIMCMD_END,
};
2019-10-20 11:55:02 +02:00
const union AnimCmd *const gBellAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:55:02 +02:00
gBellAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gBellSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_BELL,
.paletteTag = ANIM_TAG_BELL,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2019-10-20 11:55:02 +02:00
.anims = gBellAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 16:22:53 +02:00
.callback = AnimSpriteOnMonPos,
2018-12-18 04:56:34 +01:00
};
2020-02-15 00:11:04 +01:00
#define NUM_MUSIC_NOTE_PAL_TAGS 3
static const u16 sMusicNotePaletteTagsTable[NUM_MUSIC_NOTE_PAL_TAGS] =
2018-12-18 04:56:34 +01:00
{
ANIM_TAG_MUSIC_NOTES_2,
ANIM_SPRITES_START - 1,
ANIM_SPRITES_START - 2,
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gHealBellMusicNoteSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_MUSIC_NOTES_2,
.paletteTag = ANIM_TAG_MUSIC_NOTES_2,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:55:02 +02:00
.callback = AnimHealBellMusicNote,
2018-12-18 04:56:34 +01:00
};
2019-04-02 08:36:22 +02:00
const struct SpriteTemplate gMagentaHeartSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_MAGENTA_HEART,
.paletteTag = ANIM_TAG_MAGENTA_HEART,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:55:02 +02:00
.callback = AnimMagentaHeart,
2018-12-18 04:56:34 +01:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnims_StretchBattlerUp[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x000A, 0xFFF3, 0x00, 0x0A),
AFFINEANIMCMD_FRAME(0xFFF6, 0x000D, 0x00, 0x0A),
AFFINEANIMCMD_END,
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gRedHeartProjectileSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_RED_HEART,
.paletteTag = ANIM_TAG_RED_HEART,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:55:02 +02:00
.callback = AnimRedHeartProjectile,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gRedHeartBurstSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_RED_HEART,
.paletteTag = ANIM_TAG_RED_HEART,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 22:22:33 +01:00
.callback = AnimParticleBurst,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gRedHeartRisingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_RED_HEART,
.paletteTag = ANIM_TAG_RED_HEART,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:55:02 +02:00
.callback = AnimRedHeartRising,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const union AffineAnimCmd gHiddenPowerOrbAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0),
AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 1),
AFFINEANIMCMD_JUMP(1),
};
2019-10-20 11:55:02 +02:00
const union AffineAnimCmd *const gHiddenPowerOrbAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:55:02 +02:00
gHiddenPowerOrbAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
const struct SpriteTemplate gHiddenPowerOrbSpriteTemplate =
{
.tileTag = ANIM_TAG_RED_ORB,
.paletteTag = ANIM_TAG_RED_ORB,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 11:55:02 +02:00
.affineAnims = gHiddenPowerOrbAffineAnimTable,
2018-12-18 04:56:34 +01:00
.callback = AnimOrbitFast,
};
const struct SpriteTemplate gHiddenPowerOrbScatterSpriteTemplate =
{
.tileTag = ANIM_TAG_RED_ORB,
.paletteTag = ANIM_TAG_RED_ORB,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 11:55:02 +02:00
.affineAnims = gHiddenPowerOrbAffineAnimTable,
2018-12-18 04:56:34 +01:00
.callback = AnimOrbitScatter,
};
2019-10-20 11:55:02 +02:00
const union AffineAnimCmd gSpitUpOrbAffineAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0),
AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 1),
AFFINEANIMCMD_JUMP(1),
};
2019-10-20 11:55:02 +02:00
const union AffineAnimCmd *const gSpitUpOrbAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:55:02 +02:00
gSpitUpOrbAffineAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gSpitUpOrbSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_RED_ORB_2,
.paletteTag = ANIM_TAG_RED_ORB_2,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_8x8,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 11:55:02 +02:00
.affineAnims = gSpitUpOrbAffineAnimTable,
.callback = AnimSpitUpOrb,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const union AnimCmd gEyeSparkleAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(4, 4),
ANIMCMD_FRAME(8, 4),
ANIMCMD_FRAME(4, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_END,
};
2019-10-20 11:55:02 +02:00
const union AnimCmd *const gEyeSparkleAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:55:02 +02:00
gEyeSparkleAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gEyeSparkleSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_EYE_SPARKLE,
.paletteTag = ANIM_TAG_EYE_SPARKLE,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2019-10-20 11:55:02 +02:00
.anims = gEyeSparkleAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:55:02 +02:00
.callback = AnimEyeSparkle,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const union AnimCmd gAngelSpriteAnimCmds[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 24),
ANIMCMD_END,
};
2019-10-20 11:55:02 +02:00
const union AnimCmd *const gAngelSpriteAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:55:02 +02:00
gAngelSpriteAnimCmds,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gAngelSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_ANGEL,
.paletteTag = ANIM_TAG_ANGEL,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2019-10-20 11:55:02 +02:00
.anims = gAngelSpriteAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:55:02 +02:00
.callback = AnimAngel,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gPinkHeartSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_PINK_HEART,
.paletteTag = ANIM_TAG_PINK_HEART,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:55:02 +02:00
.callback = AnimPinkHeart,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const union AnimCmd gDevilAnimCmds1[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 3),
ANIMCMD_JUMP(0),
};
2019-10-20 11:55:02 +02:00
const union AnimCmd gDevilAnimCmds2[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(16, 3),
ANIMCMD_JUMP(0),
};
2019-10-20 11:55:02 +02:00
const union AnimCmd *const gDevilAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:55:02 +02:00
gDevilAnimCmds1,
gDevilAnimCmds2,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gDevilSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_DEVIL,
.paletteTag = ANIM_TAG_DEVIL,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2019-10-20 11:55:02 +02:00
.anims = gDevilAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:55:02 +02:00
.callback = AnimDevil,
2018-12-18 04:56:34 +01:00
};
static const union AnimCmd sAnim_FurySwipes[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(32, 4),
ANIMCMD_FRAME(48, 4),
ANIMCMD_END,
};
static const union AnimCmd sAnim_FurySwipes_Flipped[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 4, .hFlip = TRUE),
ANIMCMD_FRAME(16, 4, .hFlip = TRUE),
ANIMCMD_FRAME(32, 4, .hFlip = TRUE),
ANIMCMD_FRAME(48, 4, .hFlip = TRUE),
ANIMCMD_END,
};
static const union AnimCmd *const sAnims_FurySwipes[] =
2018-12-18 04:56:34 +01:00
{
sAnim_FurySwipes,
sAnim_FurySwipes_Flipped,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const struct SpriteTemplate gFurySwipesSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_SWIPE,
.paletteTag = ANIM_TAG_SWIPE,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_FurySwipes,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 11:55:02 +02:00
.callback = AnimFurySwipes,
2018-12-18 04:56:34 +01:00
};
2019-10-20 11:55:02 +02:00
const union AnimCmd gMovementWavesAnimCmds1[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(0, 8),
ANIMCMD_FRAME(16, 8),
ANIMCMD_FRAME(32, 8),
ANIMCMD_FRAME(16, 8),
ANIMCMD_END,
};
2019-10-20 11:55:02 +02:00
const union AnimCmd gMovementWavesAnimCmds2[] =
2018-12-18 04:56:34 +01:00
{
ANIMCMD_FRAME(16, 8, .hFlip = TRUE),
ANIMCMD_FRAME(32, 8, .hFlip = TRUE),
ANIMCMD_FRAME(16, 8, .hFlip = TRUE),
ANIMCMD_FRAME(0, 8, .hFlip = TRUE),
ANIMCMD_END,
};
2019-10-20 11:55:02 +02:00
const union AnimCmd *const gMovementWavesAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 11:55:02 +02:00
gMovementWavesAnimCmds1,
gMovementWavesAnimCmds2,
2018-12-18 04:56:34 +01:00
};
2019-10-20 19:03:34 +02:00
const struct SpriteTemplate gMovementWavesSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_MOVEMENT_WAVES,
.paletteTag = ANIM_TAG_MOVEMENT_WAVES,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2019-10-20 11:55:02 +02:00
.anims = gMovementWavesAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-03-27 14:50:15 +01:00
.callback = AnimMovementWaves,
2018-12-18 04:56:34 +01:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnims_UproarDistortion[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(-12, 8, 0, 4),
AFFINEANIMCMD_FRAME(20, -20, 0, 4),
AFFINEANIMCMD_FRAME(-8, 12, 0, 4),
AFFINEANIMCMD_END,
};
2019-10-20 15:54:16 +02:00
const struct SpriteTemplate gJaggedMusicNoteSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_JAGGED_MUSIC_NOTE,
.paletteTag = ANIM_TAG_JAGGED_MUSIC_NOTE,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 15:54:16 +02:00
.callback = AnimJaggedMusicNote,
2018-12-18 04:56:34 +01:00
};
2019-10-20 15:54:16 +02:00
const union AffineAnimCmd gPerishSongMusicNoteAffineAnimCmds1[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 5),
AFFINEANIMCMD_END,
};
2019-10-20 15:54:16 +02:00
const union AffineAnimCmd gPerishSongMusicNoteAffineAnimCmds2[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 16),
AFFINEANIMCMD_END_ALT(1),
};
2019-10-20 15:54:16 +02:00
const union AffineAnimCmd gPerishSongMusicNoteAffineAnimCmds3[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 16),
AFFINEANIMCMD_END_ALT(1),
};
2019-10-20 15:54:16 +02:00
const union AffineAnimCmd *const gPerishSongMusicNoteAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 15:54:16 +02:00
gPerishSongMusicNoteAffineAnimCmds1,
gPerishSongMusicNoteAffineAnimCmds2,
gPerishSongMusicNoteAffineAnimCmds3,
2018-12-18 04:56:34 +01:00
};
extern const union AnimCmd *const gMusicNotesAnimTable[];
2019-10-20 15:54:16 +02:00
const struct SpriteTemplate gPerishSongMusicNoteSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_MUSIC_NOTES_2,
.paletteTag = ANIM_TAG_MUSIC_NOTES_2,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
.anims = gMusicNotesAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
2019-10-20 15:54:16 +02:00
.affineAnims = gPerishSongMusicNoteAffineAnimTable,
.callback = AnimPerishSongMusicNote,
2018-12-18 04:56:34 +01:00
};
2019-10-20 15:54:16 +02:00
const struct SpriteTemplate gPerishSongMusicNote2SpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_MUSIC_NOTES_2,
.paletteTag = ANIM_TAG_MUSIC_NOTES_2,
2019-10-16 19:26:08 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
.anims = gMusicNotesAnimTable,
2018-12-18 04:56:34 +01:00
.images = NULL,
2019-10-20 15:54:16 +02:00
.affineAnims = gPerishSongMusicNoteAffineAnimTable,
.callback = AnimPerishSongMusicNote2,
2018-12-18 04:56:34 +01:00
};
2019-10-20 15:54:16 +02:00
const union AffineAnimCmd gGuardRingAffineAnimCmds1[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_END,
};
2019-10-20 15:54:16 +02:00
const union AffineAnimCmd gGuardRingAffineAnimCmds2[] =
2018-12-18 04:56:34 +01:00
{
AFFINEANIMCMD_FRAME(0x200, 0x100, 0, 0),
AFFINEANIMCMD_END,
};
2019-10-20 15:54:16 +02:00
const union AffineAnimCmd *const gGuardRingAffineAnimTable[] =
2018-12-18 04:56:34 +01:00
{
2019-10-20 15:54:16 +02:00
gGuardRingAffineAnimCmds1,
gGuardRingAffineAnimCmds2,
2018-12-18 04:56:34 +01:00
};
2019-10-20 15:54:16 +02:00
const struct SpriteTemplate gGuardRingSpriteTemplate =
2018-12-18 04:56:34 +01:00
{
.tileTag = ANIM_TAG_GUARD_RING,
.paletteTag = ANIM_TAG_GUARD_RING,
2019-10-16 19:32:02 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_64x32,
2018-12-18 04:56:34 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2019-10-20 15:54:16 +02:00
.affineAnims = gGuardRingAffineAnimTable,
.callback = AnimGuardRing,
2018-12-18 04:56:34 +01:00
};
2021-11-08 19:18:58 +01:00
#define sAmplitudeX data[1]
#define sCircleSpeed data[2]
#define sMoveSteps data[3]
#define sAmplitudeY data[4]
static void AnimCirclingFinger(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
SetSpriteCoordsToAnimAttackerCoords(sprite);
2018-12-20 04:13:26 +01:00
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
2021-07-07 15:11:52 +02:00
sprite->y += gBattleAnimArgs[1];
2021-11-08 19:18:58 +01:00
sprite->sAmplitudeX = gBattleAnimArgs[2];
sprite->sCircleSpeed = gBattleAnimArgs[4];
sprite->sMoveSteps = gBattleAnimArgs[5];
sprite->sAmplitudeY = gBattleAnimArgs[3];
2018-12-18 05:08:08 +01:00
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
2021-11-08 19:18:58 +01:00
sprite->callback = TranslateSpriteInEllipse;
2018-12-18 04:56:34 +01:00
sprite->callback(sprite);
}
2021-11-08 19:18:58 +01:00
#undef sAmplitudeX
#undef sCircleSpeed
#undef sMoveSteps
#undef sAmplitudeY
static void AnimBouncingMusicNote(struct Sprite *sprite)
2018-12-18 04:56:34 +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-18 04:56:34 +01:00
sprite->data[0] = 0;
sprite->data[1] = 0;
sprite->callback = AnimBouncingMusicNote_Step;
2018-12-18 04:56:34 +01:00
}
static void AnimBouncingMusicNote_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
switch (sprite->data[0])
{
case 0:
2021-07-07 15:11:52 +02:00
sprite->y2 -= 3;
2018-12-18 04:56:34 +01:00
if (++sprite->data[1] == 6)
sprite->data[0]++;
break;
case 1:
2021-07-07 15:11:52 +02:00
sprite->y2 += 3;
2018-12-18 04:56:34 +01:00
if (--sprite->data[1] == 0)
sprite->data[0]++;
break;
case 2:
if (++sprite->data[1] == 64)
DestroyAnimSprite(sprite);
break;
}
}
static void AnimVibrateBattlerBack_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
s16 temp;
2021-07-07 15:11:52 +02:00
gSprites[sprite->data[2]].x2 += sprite->data[1];
2018-12-18 04:56:34 +01:00
temp = sprite->data[1];
sprite->data[1] = -temp;
if (sprite->data[0] == 0)
{
2021-07-07 15:11:52 +02:00
gSprites[sprite->data[2]].x2 = 0;
2018-12-18 05:08:08 +01:00
DestroySpriteAndMatrix(sprite);
2018-12-18 04:56:34 +01:00
}
sprite->data[0]--;
}
static void AnimVibrateBattlerBack(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
u8 spriteId;
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-18 04:56:34 +01:00
spriteId = gBattlerSpriteIds[gBattleAnimTarget];
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
sprite->x -= gBattleAnimArgs[0];
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
2018-12-18 04:56:34 +01:00
2021-07-07 15:11:52 +02:00
sprite->y += gBattleAnimArgs[1];
2018-12-18 04:56:34 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[2] = spriteId;
sprite->callback = AnimVibrateBattlerBack_Step;
2020-02-20 22:22:33 +01:00
sprite->invisible = TRUE;
2018-12-18 04:56:34 +01:00
}
static void AnimMovingClamp(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-12-18 04:56:34 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[5] = gBattleAnimArgs[4];
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData6(sprite, AnimMovingClamp_Step);
2018-12-18 04:56:34 +01:00
}
static void AnimMovingClamp_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
sprite->data[0] = sprite->data[1];
2021-07-07 15:11:52 +02:00
sprite->data[2] = sprite->x;
sprite->data[4] = sprite->y + 15;
2018-12-18 04:56:34 +01:00
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, AnimMovingClamp_End);
2018-12-18 04:56:34 +01:00
}
static void AnimMovingClamp_End(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->data[5] == 0)
DestroyAnimSprite(sprite);
else
sprite->data[5]--;
}
2018-12-18 05:08:08 +01:00
// Rotates the attacking mon sprite downwards and then back upwards to its original position.
// No args.
void AnimTask_Withdraw(u8 taskId)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
PrepareBattlerSpriteForRotScale(gBattlerSpriteIds[gBattleAnimAttacker], ST_OAM_OBJ_NORMAL);
2020-02-20 22:22:33 +01:00
gTasks[taskId].func = AnimTask_Withdraw_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_Withdraw_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
u8 spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
s16 rotation;
2018-12-18 05:08:08 +01:00
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
2018-12-18 04:56:34 +01:00
rotation = -gTasks[taskId].data[0];
else
rotation = gTasks[taskId].data[0];
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(spriteId, 0x100, 0x100, rotation);
2018-12-18 04:56:34 +01:00
if (gTasks[taskId].data[1] == 0)
{
gTasks[taskId].data[0] += 0xB0;
2018-12-18 05:08:08 +01:00
// this y position update gets overwritten by SetBattlerSpriteYOffsetFromRotation()
2021-07-07 15:11:52 +02:00
gSprites[spriteId].y2++;
2018-12-18 04:56:34 +01:00
}
else if (gTasks[taskId].data[1] == 1)
{
if (++gTasks[taskId].data[3] == 30)
gTasks[taskId].data[1] = 2;
return;
}
else
{
gTasks[taskId].data[0] -= 0xB0;
2018-12-18 05:08:08 +01:00
// this y position update gets overwritten by SetBattlerSpriteYOffsetFromRotation()
2021-07-07 15:11:52 +02:00
gSprites[spriteId].y2--;
2018-12-18 04:56:34 +01:00
}
2018-12-18 05:08:08 +01:00
SetBattlerSpriteYOffsetFromRotation(spriteId);
2018-12-18 04:56:34 +01:00
if (gTasks[taskId].data[0] == 0xF20 || gTasks[taskId].data[0] == 0)
{
if (gTasks[taskId].data[1] == 2)
{
2018-12-18 05:08:08 +01:00
ResetSpriteRotScale(spriteId);
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
else
{
gTasks[taskId].data[1]++;
}
}
}
2019-03-01 00:08:37 +01:00
// Animates a "zap of energy" used in KINESIS.
2018-12-18 05:08:08 +01:00
// arg 0: x pixel offset
// arg 1: y pixel offset
// arg 2: vertical flip
2020-02-20 22:22:33 +01:00
static void AnimKinesisZapEnergy(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
SetSpriteCoordsToAnimAttackerCoords(sprite);
2018-12-18 04:56:34 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
sprite->x -= gBattleAnimArgs[0];
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
2018-12-18 04:56:34 +01:00
2021-07-07 15:11:52 +02:00
sprite->y += gBattleAnimArgs[1];
2018-12-18 04:56:34 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{
sprite->hFlip = 1;
if (gBattleAnimArgs[2])
sprite->vFlip = 1;
}
else
{
if (gBattleAnimArgs[2])
sprite->vFlip = 1;
}
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-12-18 04:56:34 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2018-12-18 05:08:08 +01:00
// Animates a sword that rises into the air after a brief pause.
// arg 0: x pixel offset
// arg 1: y pixel offset
2020-02-20 22:22:33 +01:00
static void AnimSwordsDanceBlade(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, FALSE);
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAffineAnimEnds;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimSwordsDanceBlade_Step);
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSwordsDanceBlade_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
sprite->data[0] = 6;
2021-07-07 15:11:52 +02:00
sprite->data[2] = sprite->x;
sprite->data[4] = sprite->y - 32;
2018-12-18 04:56:34 +01:00
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
// Moves a projectile towards the target mon. The sprite is rotated to be pointing
// in the same direction it's moving.
// 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
2020-02-20 22:22:33 +01:00
static void AnimSonicBoomProjectile(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
s16 targetXPos;
s16 targetYPos;
u16 rotation;
if (IsContest())
{
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
}
else if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
2018-12-18 04:56:34 +01:00
{
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
}
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2021-11-08 17:46:38 +01:00
targetXPos = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
targetYPos = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
2021-07-07 15:11:52 +02:00
rotation = ArcTan2Neg(targetXPos - sprite->x, targetYPos - sprite->y);
2018-12-18 04:56:34 +01:00
rotation += 0xF000;
if (IsContest())
rotation -= 0x6000;
2018-12-18 05:08:08 +01:00
TrySetSpriteRotScale(sprite, FALSE, 0x100, 0x100, rotation);
2018-12-18 04:56:34 +01:00
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = targetXPos;
sprite->data[4] = targetYPos;
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2019-10-20 15:54:16 +02:00
static void AnimAirWaveProjectile_Step2(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->data[0]-- <= 0)
{
gTasks[sprite->data[7]].data[1]--;
DestroySprite(sprite);
}
}
2019-10-20 15:54:16 +02:00
static void AnimAirWaveProjectile_Step1(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[sprite->data[7]];
if (sprite->data[0] > task->data[5])
{
sprite->data[5] += sprite->data[3];
sprite->data[6] += sprite->data[4];
}
else
{
sprite->data[5] -= sprite->data[3];
sprite->data[6] -= sprite->data[4];
}
sprite->data[1] += sprite->data[5];
sprite->data[2] += sprite->data[6];
if (1 & task->data[7])
2021-07-07 15:11:52 +02:00
sprite->x2 = ((u16)sprite->data[1] >> 8) * -1;
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->x2 = (u16)sprite->data[1] >> 8;
2018-12-18 04:56:34 +01:00
if (1 & task->data[8])
2021-07-07 15:11:52 +02:00
sprite->y2 = ((u16)sprite->data[2] / 256u) * -1;
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->y2 = (u16)sprite->data[2] / 256u;
2018-12-18 04:56:34 +01:00
if (sprite->data[0]-- <= 0)
{
sprite->data[0] = 30;
2019-10-20 15:54:16 +02:00
sprite->callback = AnimAirWaveProjectile_Step2;
2018-12-18 04:56:34 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimAirWaveProjectile(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
s16 a;
s16 b;
s16 c;
struct Task* task = &gTasks[sprite->data[7]];
sprite->data[1] += (-2 & task->data[7]);
sprite->data[2] += (-2 & task->data[8]);
if (1 & task->data[7])
2021-07-07 15:11:52 +02:00
sprite->x2 = ((u16)sprite->data[1] >> 8) * -1;
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->x2 = (u16)sprite->data[1] >> 8;
2018-12-18 04:56:34 +01:00
if (1 & task->data[8])
2021-07-07 15:11:52 +02:00
sprite->y2 = ((u16)sprite->data[2] / 256u) * -1;
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->y2 = (u16)sprite->data[2] / 256u;
2018-12-18 04:56:34 +01:00
if (sprite->data[0]-- <= 0)
{
sprite->data[0] = 8;
task->data[5] = 4;
2020-05-20 21:23:21 +02:00
a = MathUtil_Inv16(Q_8_8(16));
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->y2 = 0;
sprite->x2 = 0;
if (task->data[11] >= sprite->x)
b = (task->data[11] - sprite->x) << 8;
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
b = (sprite->x - task->data[11]) << 8;
2018-12-18 04:56:34 +01:00
2021-07-07 15:11:52 +02:00
if (task->data[12] >= sprite->y)
c = (task->data[12] - sprite->y) << 8;
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
c = (sprite->y - task->data[12]) << 8;
2018-12-18 04:56:34 +01:00
sprite->data[2] = 0;
sprite->data[1] = 0;
sprite->data[6] = 0;
sprite->data[5] = 0;
2020-05-20 21:23:21 +02:00
sprite->data[3] = MathUtil_Mul16(MathUtil_Mul16(b, a), MathUtil_Inv16(Q_8_8(1.75)));
sprite->data[4] = MathUtil_Mul16(MathUtil_Mul16(c, a), MathUtil_Inv16(Q_8_8(1.75)));
2019-10-20 15:54:16 +02:00
sprite->callback = AnimAirWaveProjectile_Step1;
2019-03-01 00:08:37 +01:00
}
2018-12-18 04:56:34 +01:00
}
2019-10-20 10:47:56 +02:00
static void AirCutterProjectileStep2(u8 taskId)
2018-12-18 04:56:34 +01:00
{
if (gTasks[taskId].data[1] == 0)
DestroyAnimVisualTask(taskId);
}
2019-10-20 10:47:56 +02:00
static void AirCutterProjectileStep1(u8 taskId)
2018-12-18 04:56:34 +01:00
{
if (gTasks[taskId].data[0]-- <= 0)
{
u8 spriteId;
struct Sprite *sprite;
2019-10-20 10:47:56 +02:00
spriteId = CreateSprite(&gAirWaveProjectileSpriteTemplate, gTasks[taskId].data[9], gTasks[taskId].data[10], gTasks[taskId].data[2] - gTasks[taskId].data[1]);
2018-12-18 04:56:34 +01:00
sprite = &gSprites[spriteId];
switch (gTasks[taskId].data[4])
{
case 1:
sprite->oam.matrixNum |= (ST_OAM_HFLIP | ST_OAM_VFLIP);
2018-12-18 04:56:34 +01:00
break;
case 2:
sprite->oam.matrixNum = ST_OAM_HFLIP;
2018-12-18 04:56:34 +01:00
break;
}
sprite->data[0] = gTasks[taskId].data[5] - gTasks[taskId].data[6];
sprite->data[7] = taskId;
gTasks[taskId].data[gTasks[taskId].data[1] + 13] = spriteId;
gTasks[taskId].data[0] = gTasks[taskId].data[3];
gTasks[taskId].data[1]++;
2020-08-21 00:02:00 +02:00
PlaySE12WithPanning(SE_M_BLIZZARD2, BattleAnimAdjustPanning(-63));
2018-12-18 04:56:34 +01:00
if (gTasks[taskId].data[1] > 2)
2019-10-20 10:47:56 +02:00
gTasks[taskId].func = AirCutterProjectileStep2;
2018-12-18 04:56:34 +01:00
}
}
2019-10-20 10:47:56 +02:00
void AnimTask_AirCutterProjectile(u8 taskId)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
s16 attackerY = 0;
s16 attackerX = 0;
s16 targetX = 0;
s16 targetY = 0;
s16 xDiff, yDiff;
2018-12-18 04:56:34 +01:00
if (IsContest())
{
gTasks[taskId].data[4] = 2;
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
if (gBattleAnimArgs[2] & 1)
gBattleAnimArgs[2] &= ~1;
else
gBattleAnimArgs[2] |= 1;
}
else
{
2019-09-04 23:45:04 +02:00
if ((gBattlerPositions[gBattleAnimTarget] & BIT_SIDE) == B_SIDE_PLAYER)
2018-12-18 04:56:34 +01:00
{
gTasks[taskId].data[4] = 1;
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
if (gBattleAnimArgs[2] & 1)
gBattleAnimArgs[2] &= ~1;
else
gBattleAnimArgs[2] |= 1;
}
}
2018-12-18 05:08:08 +01:00
attackerX = gTasks[taskId].data[9] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
attackerY = gTasks[taskId].data[10] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
2018-12-18 04:56:34 +01:00
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
&& IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)))
{
2018-12-18 05:08:08 +01:00
SetAverageBattlerPositions(gBattleAnimTarget, 0, &targetX, &targetY);
2018-12-18 04:56:34 +01:00
}
else
{
2018-12-18 05:08:08 +01:00
targetX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
targetY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
2018-12-18 04:56:34 +01:00
}
2018-12-18 05:08:08 +01:00
targetX = gTasks[taskId].data[11] = targetX + gBattleAnimArgs[0];
targetY = gTasks[taskId].data[12] = targetY + gBattleAnimArgs[1];
if (targetX >= attackerX)
xDiff = targetX - attackerX;
2018-12-18 04:56:34 +01:00
else
2018-12-18 05:08:08 +01:00
xDiff = attackerX - targetX;
2018-12-18 04:56:34 +01:00
2020-05-20 20:22:41 +02:00
gTasks[taskId].data[5] = MathUtil_Mul16(xDiff, MathUtil_Inv16(gBattleAnimArgs[2] & ~1));
2020-05-20 21:23:21 +02:00
gTasks[taskId].data[6] = MathUtil_Mul16(gTasks[taskId].data[5], Q_8_8(0.5));
2018-12-18 04:56:34 +01:00
gTasks[taskId].data[7] = gBattleAnimArgs[2];
2018-12-18 05:08:08 +01:00
if (targetY >= attackerY)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
yDiff = targetY - attackerY;
2020-05-20 20:22:41 +02:00
gTasks[taskId].data[8] = MathUtil_Mul16(yDiff, MathUtil_Inv16(gTasks[taskId].data[5])) & ~1;
2018-12-18 04:56:34 +01:00
}
else
{
2018-12-18 05:08:08 +01:00
yDiff = attackerY - targetY;
2020-05-20 20:22:41 +02:00
gTasks[taskId].data[8] = MathUtil_Mul16(yDiff, MathUtil_Inv16(gTasks[taskId].data[5])) | 1;
2018-12-18 04:56:34 +01:00
}
gTasks[taskId].data[3] = gBattleAnimArgs[3];
if (gBattleAnimArgs[4] & 0x80)
{
gBattleAnimArgs[4] ^= 0x80;
if (gBattleAnimArgs[4] >= 64)
{
2018-12-18 05:08:08 +01:00
u16 var = GetBattlerSpriteSubpriority(gBattleAnimTarget) + (gBattleAnimArgs[4] - 64);
2018-12-18 04:56:34 +01:00
gTasks[taskId].data[2] = var;
}
else
{
2018-12-18 05:08:08 +01:00
u16 var = GetBattlerSpriteSubpriority(gBattleAnimTarget) - gBattleAnimArgs[4];
2018-12-18 04:56:34 +01:00
gTasks[taskId].data[2] = var;
}
}
else
{
if (gBattleAnimArgs[4] >= 64)
{
2018-12-18 05:08:08 +01:00
u16 var = GetBattlerSpriteSubpriority(gBattleAnimTarget) + (gBattleAnimArgs[4] - 64);
2018-12-18 04:56:34 +01:00
gTasks[taskId].data[2] = var;
}
else
{
2018-12-18 05:08:08 +01:00
u16 var = GetBattlerSpriteSubpriority(gBattleAnimTarget) - gBattleAnimArgs[4];
2018-12-18 04:56:34 +01:00
gTasks[taskId].data[2] = var;
}
}
if (gTasks[taskId].data[2] < 3)
gTasks[taskId].data[2] = 3;
2019-10-20 10:47:56 +02:00
gTasks[taskId].func = AirCutterProjectileStep1;
2018-12-18 04:56:34 +01:00
}
static void AnimVoidLines(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, FALSE);
sprite->data[0] = 0x100 + (IndexOfSpritePaletteTag(sVoidLinesSpriteTemplate.paletteTag) << 4);
sprite->callback = AnimVoidLines_Step;
2018-12-18 04:56:34 +01:00
}
static void AnimVoidLines_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2019-04-10 20:49:10 +02:00
u16 id, val;
2018-12-18 04:56:34 +01:00
int i;
2019-04-10 20:49:10 +02:00
2018-12-18 04:56:34 +01:00
if (++sprite->data[1] == 2)
{
sprite->data[1] = 0;
2019-04-10 20:49:10 +02:00
id = sprite->data[0];
val = gPlttBufferFaded[8 + id];
for (i = 8; i < 16; i++)
gPlttBufferFaded[i + id] = gPlttBufferFaded[i + id + 1];
gPlttBufferFaded[id + 15] = val;
2018-12-18 04:56:34 +01:00
if (++sprite->data[2] == 24)
DestroyAnimSprite(sprite);
}
}
2020-02-20 22:22:33 +01:00
static void AnimCoinThrow(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
s16 r6;
s16 r7;
u16 var;
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2021-11-08 17:46:38 +01:00
r6 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
r7 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
2018-12-18 04:56:34 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
r6 += gBattleAnimArgs[2];
2021-07-07 15:11:52 +02:00
var = ArcTan2Neg(r6 - sprite->x, r7 - sprite->y);
2018-12-18 04:56:34 +01:00
var += 0xC000;
2018-12-18 05:08:08 +01:00
TrySetSpriteRotScale(sprite, FALSE, 0x100, 0x100, var);
2018-12-18 04:56:34 +01:00
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = r6;
sprite->data[4] = r7;
2021-01-23 06:40:46 +01:00
sprite->callback = InitAnimLinearTranslationWithSpeedAndPos;
2018-12-18 04:56:34 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2020-02-20 22:22:33 +01:00
static void AnimFallingCoin(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
sprite->data[2] = -16;
2021-07-07 15:11:52 +02:00
sprite->y += 8;
2019-10-20 10:47:56 +02:00
sprite->callback = AnimFallingCoin_Step;
2018-12-18 04:56:34 +01:00
}
2019-10-20 10:47:56 +02:00
static void AnimFallingCoin_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
sprite->data[0] += 0x80;
2021-07-07 15:11:52 +02:00
sprite->x2 = sprite->data[0] >> 8;
2018-12-18 04:56:34 +01:00
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
sprite->x2 = -sprite->x2;
2018-12-18 04:56:34 +01:00
2021-07-07 15:11:52 +02:00
sprite->y2 = Sin(sprite->data[1], sprite->data[2]);
2018-12-18 04:56:34 +01:00
sprite->data[1] += 5;
if (sprite->data[1] > 126)
{
sprite->data[1] = 0;
sprite->data[2] /= 2;
if (++sprite->data[3] == 2)
DestroyAnimSprite(sprite);
}
}
2020-02-20 22:22:33 +01:00
static void AnimBulletSeed(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-12-18 04:56:34 +01:00
sprite->data[0] = 20;
2018-12-18 05:08:08 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-18 04:56:34 +01:00
sprite->callback = StartAnimLinearTranslation;
sprite->affineAnimPaused = 1;
2019-10-20 10:47:56 +02:00
StoreSpriteCallbackInData6(sprite, AnimBulletSeed_Step1);
2018-12-18 04:56:34 +01:00
}
2019-10-20 10:47:56 +02:00
static void AnimBulletSeed_Step1(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
int i;
u16 rand;
s16* ptr;
2020-08-21 00:02:00 +02:00
PlaySE12WithPanning(SE_M_HORN_ATTACK, BattleAnimAdjustPanning(63));
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->y2 = 0;
sprite->x2 = 0;
2018-12-18 04:56:34 +01:00
ptr = &sprite->data[7];
for (i = 0; i < 8; i++)
ptr[i - 7] = 0;
rand = Random2();
sprite->data[6] = 0xFFF4 - (rand & 7);
rand = Random2();
sprite->data[7] = (rand % 0xA0) + 0xA0;
2019-10-20 10:47:56 +02:00
sprite->callback = AnimBulletSeed_Step2;
2018-12-18 04:56:34 +01:00
sprite->affineAnimPaused = 0;
}
2019-10-20 10:47:56 +02:00
static void AnimBulletSeed_Step2(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
sprite->data[0] += sprite->data[7];
2021-07-07 15:11:52 +02:00
sprite->x2 = sprite->data[0] >> 8;
2018-12-18 04:56:34 +01:00
if (sprite->data[7] & 1)
2021-07-07 15:11:52 +02:00
sprite->x2 = -sprite->x2;
2018-12-18 04:56:34 +01:00
2021-07-07 15:11:52 +02:00
sprite->y2 = Sin(sprite->data[1], sprite->data[6]);
2018-12-18 04:56:34 +01:00
sprite->data[1] += 8;
if (sprite->data[1] > 126)
{
sprite->data[1] = 0;
sprite->data[2] /= 2;
if (++sprite->data[3] == 1)
DestroyAnimSprite(sprite);
}
}
2018-12-18 05:08:08 +01:00
// Moves a tornado in a circlular motion.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: wave amplitude
// arg 3: unused
// arg 4: initial wave offset
// arg 5: wave period (higher means faster wave)
// arg 6: duration
2020-02-20 22:22:33 +01:00
static void AnimRazorWindTornado(struct Sprite *sprite)
2018-12-18 05:08:08 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, FALSE);
2018-12-18 04:56:34 +01:00
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
2021-07-07 15:11:52 +02:00
sprite->y += 16;
2018-12-18 04:56:34 +01:00
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[1] = gBattleAnimArgs[2];
sprite->data[2] = gBattleAnimArgs[5];
sprite->data[3] = gBattleAnimArgs[6];
sprite->data[4] = gBattleAnimArgs[3];
2021-11-08 19:18:58 +01:00
sprite->callback = TranslateSpriteInCircle;
2018-12-18 04:56:34 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
sprite->callback(sprite);
}
2018-12-18 05:08:08 +01:00
// Animates a single pincer line that extends towards the center of the target mon.
// arg 0: invert
2020-02-20 22:22:33 +01:00
static void AnimViceGripPincer(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
s16 startXOffset = 32;
s16 startYOffset = -32;
s16 endXOffset = 16;
s16 endYOffset = -16;
2018-12-18 04:56:34 +01:00
if (gBattleAnimArgs[0])
{
2018-12-18 05:08:08 +01:00
startXOffset = -32;
startYOffset = 32;
endXOffset = -16;
endYOffset = 16;
2018-12-18 04:56:34 +01:00
StartSpriteAnim(sprite, 1);
}
2021-07-07 15:11:52 +02:00
sprite->x += startXOffset;
sprite->y += startYOffset;
2018-12-18 04:56:34 +01:00
sprite->data[0] = 6;
2018-12-18 05:08:08 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + endXOffset;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + endYOffset;
2018-12-18 04:56:34 +01:00
sprite->callback = StartAnimLinearTranslation;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimViceGripPincer_Step);
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimViceGripPincer_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
if (sprite->animEnded)
2018-12-18 04:56:34 +01:00
DestroyAnimSprite(sprite);
}
2018-12-18 05:08:08 +01:00
// Animates a single pincer line that extends towards the center of the target mon, and then back out.
// arg 0: animation id
2020-02-20 22:22:33 +01:00
static void AnimGuillotinePincer(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
s16 startXOffset = 32;
s16 startYOffset = -32;
s16 endXOffset = 16;
s16 endYOffset = -16;
if (gBattleAnimArgs[0])
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
startXOffset = -32;
startYOffset = 32;
endXOffset = -16;
endYOffset = 16;
2018-12-18 04:56:34 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[0]);
}
2021-07-07 15:11:52 +02:00
sprite->x += startXOffset;
sprite->y += startYOffset;
2018-12-18 04:56:34 +01:00
sprite->data[0] = 6;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2018-12-18 05:08:08 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + endXOffset;
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2018-12-18 05:08:08 +01:00
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + endYOffset;
2018-12-18 04:56:34 +01:00
InitAnimLinearTranslation(sprite);
sprite->data[5] = gBattleAnimArgs[0];
sprite->data[6] = sprite->data[0];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimGuillotinePincer_Step1;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimGuillotinePincer_Step1(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
if (AnimTranslateLinear(sprite) && sprite->animEnded)
2018-12-18 04:56:34 +01:00
{
SeekSpriteAnim(sprite, 0);
sprite->animPaused = 1;
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 2;
sprite->y2 = -2;
2018-12-18 04:56:34 +01:00
sprite->data[0] = sprite->data[6];
sprite->data[1] ^= 1;
sprite->data[2] ^= 1;
sprite->data[4] = 0;
sprite->data[3] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimGuillotinePincer_Step2;
2018-12-18 04:56:34 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimGuillotinePincer_Step2(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->data[3])
{
2021-07-07 15:11:52 +02:00
sprite->x2 = -sprite->x2;
sprite->y2 = -sprite->y2;
2018-12-18 04:56:34 +01:00
}
sprite->data[3] ^= 1;
if (++sprite->data[4] == 51)
{
2021-07-07 15:11:52 +02:00
sprite->y2 = 0;
sprite->x2 = 0;
2018-12-18 04:56:34 +01:00
sprite->data[4] = 0;
sprite->data[3] = 0;
sprite->animPaused = 0;
StartSpriteAnim(sprite, sprite->data[5] ^ 1);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimGuillotinePincer_Step3;
2018-12-18 04:56:34 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimGuillotinePincer_Step3(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
if (AnimTranslateLinear(sprite))
2018-12-18 04:56:34 +01:00
DestroyAnimSprite(sprite);
}
// Scales up the target mon sprite, and sets the palette to grayscale.
2018-12-18 05:08:08 +01:00
// Used in MOVE_DISABLE.
// No args.
void AnimTask_GrowAndGrayscale(u8 taskId)
2018-12-18 04:56:34 +01:00
{
u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
2018-12-18 05:08:08 +01:00
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_BLEND);
SetSpriteRotScale(spriteId, 0xD0, 0xD0, 0);
SetGrayscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, FALSE);
2018-12-18 04:56:34 +01:00
gTasks[taskId].data[0] = 80;
gTasks[taskId].func = AnimTask_GrowAndGrayscale_Step;
2018-12-18 04:56:34 +01:00
}
static void AnimTask_GrowAndGrayscale_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
if (--gTasks[taskId].data[0] == -1)
{
u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
2018-12-18 05:08:08 +01:00
ResetSpriteRotScale(spriteId);
SetGrayscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, TRUE);
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
}
2018-12-18 05:08:08 +01:00
// Shrinks and grows the attacking mon several times. Also creates transparent versions of the
// mon's sprite while it is shrinking.
// No args.
void AnimTask_Minimize(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
task->data[0] = spriteId;
2018-12-18 05:08:08 +01:00
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
2018-12-18 04:56:34 +01:00
task->data[1] = 0;
task->data[2] = 0;
task->data[3] = 0;
task->data[4] = 0x100;
task->data[5] = 0;
task->data[6] = 0;
2018-12-18 05:08:08 +01:00
task->data[7] = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_Minimize_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_Minimize_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
switch (task->data[1])
{
case 0:
if (task->data[2] == 0 || task->data[2] == 3 || task->data[2] == 6)
2018-12-18 05:08:08 +01:00
CreateMinimizeSprite(task, taskId);
2018-12-18 04:56:34 +01:00
task->data[2]++;
task->data[4] += 0x28;
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(task->data[0], task->data[4], task->data[4], 0);
SetBattlerSpriteYOffsetFromYScale(task->data[0]);
2018-12-18 04:56:34 +01:00
if (task->data[2] == 32)
{
task->data[5]++;
task->data[1]++;
}
break;
case 1:
if (task->data[6] == 0)
{
if (task->data[5] == 3)
{
task->data[2] = 0;
task->data[1] = 3;
}
else
{
task->data[2] = 0;
task->data[3] = 0;
task->data[4] = 0x100;
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(task->data[0], task->data[4], task->data[4], 0);
SetBattlerSpriteYOffsetFromYScale(task->data[0]);
2018-12-18 04:56:34 +01:00
task->data[1] = 2;
}
}
break;
case 2:
task->data[1] = 0;
break;
case 3:
if (++task->data[2] > 32)
{
task->data[2] = 0;
task->data[1]++;
}
break;
case 4:
task->data[2] += 2;
task->data[4] -= 0x50;
2018-12-18 05:08:08 +01:00
SetSpriteRotScale(task->data[0], task->data[4], task->data[4], 0);
SetBattlerSpriteYOffsetFromYScale(task->data[0]);
2018-12-18 04:56:34 +01:00
if (task->data[2] == 32)
{
task->data[2] = 0;
task->data[1]++;
}
break;
case 5:
2018-12-18 05:08:08 +01:00
ResetSpriteRotScale(task->data[0]);
2021-07-07 15:11:52 +02:00
gSprites[task->data[15]].y2 = 0;
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
break;
}
}
2018-12-18 05:08:08 +01:00
static void CreateMinimizeSprite(struct Task* task, u8 taskId)
2018-12-18 04:56:34 +01:00
{
u16 matrixNum;
2018-12-18 05:08:08 +01:00
s16 spriteId = CloneBattlerSpriteWithBlend(ANIM_ATTACKER);
2018-12-18 04:56:34 +01:00
if (spriteId >= 0)
{
if ((matrixNum = AllocOamMatrix()) == 0xFF)
{
2021-11-01 17:41:21 +01:00
DestroySpriteWithActiveSheet(&gSprites[spriteId]);
2018-12-18 04:56:34 +01:00
}
else
{
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_DOUBLE;
gSprites[spriteId].affineAnimPaused = TRUE;
gSprites[spriteId].oam.matrixNum = matrixNum;
gSprites[spriteId].subpriority = task->data[7] - task->data[3];
task->data[3]++;
task->data[6]++;
gSprites[spriteId].data[0] = 16;
gSprites[spriteId].data[1] = taskId;
gSprites[spriteId].data[2] = 6;
2018-12-18 05:08:08 +01:00
gSprites[spriteId].callback = ClonedMinizeSprite_Step;
SetSpriteRotScale(spriteId, task->data[4], task->data[4], 0);
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
2018-12-18 04:56:34 +01:00
CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode);
}
}
}
2018-12-18 05:08:08 +01:00
static void ClonedMinizeSprite_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (--sprite->data[0] == 0)
{
gTasks[sprite->data[1]].data[sprite->data[2]]--;
FreeOamMatrix(sprite->oam.matrixNum);
2021-11-01 17:41:21 +01:00
DestroySpriteWithActiveSheet(sprite);
2018-12-18 04:56:34 +01:00
}
}
// Task to facilitate expanding and hopping effect seen in Splash.
// arg 0: anim battler
// arg 1: num hops
void AnimTask_Splash(u8 taskId)
{
struct Task* task = &gTasks[taskId];
if (gBattleAnimArgs[1] == 0)
{
DestroyAnimVisualTask(taskId);
}
else
{
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
task->data[0] = spriteId;
task->data[1] = 0;
task->data[2] = gBattleAnimArgs[1];
task->data[3] = 0;
task->data[4] = 0;
2018-12-18 05:08:08 +01:00
PrepareAffineAnimInTaskData(task, spriteId, gSplashEffectAffineAnimCmds);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_Splash_Step;
2018-12-18 04:56:34 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimTask_Splash_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
switch (task->data[1])
{
case 0:
2018-12-18 05:08:08 +01:00
RunAffineAnimFromTaskData(task);
2018-12-18 04:56:34 +01:00
task->data[4] += 3;
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].y2 += task->data[4];
2018-12-18 04:56:34 +01:00
if (++task->data[3] > 7)
{
task->data[3] = 0;
task->data[1]++;
}
break;
case 1:
2018-12-18 05:08:08 +01:00
RunAffineAnimFromTaskData(task);
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].y2 += task->data[4];
2018-12-18 04:56:34 +01:00
if (++task->data[3] > 7)
{
task->data[3] = 0;
task->data[1]++;
}
break;
case 2:
if (task->data[4] != 0)
{
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].y2 -= 2;
2018-12-18 04:56:34 +01:00
task->data[4] -= 2;
}
else
task->data[1]++;
break;
case 3:
2018-12-18 05:08:08 +01:00
if (!RunAffineAnimFromTaskData(task))
2018-12-18 04:56:34 +01:00
{
if (--task->data[2] == 0)
{
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].y2 = 0;
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
else
{
2018-12-18 05:08:08 +01:00
PrepareAffineAnimInTaskData(task, task->data[0], gSplashEffectAffineAnimCmds);
2018-12-18 04:56:34 +01:00
task->data[1] = 0;
}
}
break;
}
}
2018-12-18 05:08:08 +01:00
// Grows, pauses, then shrinks the attacking mon.
// Used by MOVE_SWAGGER and MOVE_BULK_UP
// No args.
void AnimTask_GrowAndShrink(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
2018-12-18 05:08:08 +01:00
PrepareAffineAnimInTaskData(task, spriteId, gGrowAndShrinkAffineAnimCmds);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_GrowAndShrink_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_GrowAndShrink_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
2018-12-18 05:08:08 +01:00
if (!RunAffineAnimFromTaskData(task))
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
2018-12-18 05:08:08 +01:00
// Animates a little puff of the mon's breath.
// Used by MOVE_SWAGGER and MOVE_BULK_UP
// No args.
2020-02-20 22:22:33 +01:00
static void AnimBreathPuff(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
2018-12-18 04:56:34 +01:00
{
StartSpriteAnim(sprite, 0);
2021-07-07 15:11:52 +02:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + 32;
2018-12-18 04:56:34 +01:00
sprite->data[1] = 64;
}
else
{
StartSpriteAnim(sprite, 1);
2021-07-07 15:11:52 +02:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) - 32;
2018-12-18 04:56:34 +01:00
sprite->data[1] = -64;
}
2021-07-07 15:11:52 +02:00
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-18 04:56:34 +01:00
sprite->data[0] = 52;
sprite->data[2] = 0;
sprite->data[3] = 0;
sprite->data[4] = 0;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
2019-02-06 20:17:09 +01:00
sprite->callback = TranslateSpriteLinearFixedPoint;
2018-12-18 04:56:34 +01:00
}
2018-12-18 05:08:08 +01:00
// Animates an "angry" mark above a mon's head.
// arg 0: target mon (0 = attacker, 1 = target)
// arg 1: x pixel offset
// arg 2: y pixel offset
2020-02-20 22:22:33 +01:00
static void AnimAngerMark(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
u8 battler;
2018-12-18 05:08:08 +01:00
if (!gBattleAnimArgs[0])
2018-12-18 04:56:34 +01:00
battler = gBattleAnimAttacker;
else
battler = gBattleAnimTarget;
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
gBattleAnimArgs[1] *= -1;
2021-07-07 15:11:52 +02:00
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
if (sprite->y < 8)
sprite->y = 8;
2018-12-18 04:56:34 +01:00
2018-12-18 05:08:08 +01:00
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
sprite->callback = RunStoredCallbackWhenAffineAnimEnds;
2018-12-18 04:56:34 +01:00
}
// left/right movements
2019-10-20 15:54:16 +02:00
void AnimTask_ThrashMoveMonHorizontal(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
task->data[0] = spriteId;
task->data[1] = 0;
2019-10-20 11:01:12 +02:00
PrepareAffineAnimInTaskData(task, spriteId, gThrashMoveMonAffineAnimCmds);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_ThrashMoveMonHorizontal_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_ThrashMoveMonHorizontal_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
2018-12-18 05:08:08 +01:00
if (!RunAffineAnimFromTaskData(task))
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
// up/down movements
2019-10-20 15:54:16 +02:00
void AnimTask_ThrashMoveMonVertical(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
task->data[0] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
task->data[1] = 0;
task->data[2] = 4;
task->data[3] = 7;
task->data[4] = 3;
2021-07-07 15:11:52 +02:00
task->data[5] = gSprites[task->data[0]].x;
task->data[6] = gSprites[task->data[0]].y;
2018-12-18 04:56:34 +01:00
task->data[7] = 0;
task->data[8] = 0;
task->data[9] = 2;
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
task->data[2] *= -1;
2020-02-20 22:22:33 +01:00
task->func = AnimTask_ThrashMoveMonVertical_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_ThrashMoveMonVertical_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
if (++task->data[7] > 2)
{
task->data[7] = 0;
task->data[8]++;
if (task->data[8] & 1)
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].y += task->data[9];
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].y -= task->data[9];
2018-12-18 04:56:34 +01:00
}
switch (task->data[1])
{
case 0:
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].x += task->data[2];
2018-12-18 04:56:34 +01:00
if (--task->data[3] == 0)
{
task->data[3] = 14;
task->data[1] = 1;
}
break;
case 1:
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].x -= task->data[2];
2018-12-18 04:56:34 +01:00
if (--task->data[3] == 0)
{
task->data[3] = 7;
task->data[1] = 2;
}
break;
case 2:
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].x += task->data[2];
2018-12-18 04:56:34 +01:00
if (--task->data[3] == 0)
{
if (--task->data[4] != 0)
{
task->data[3] = 7;
task->data[1] = 0;
}
else
{
if ((task->data[8] & 1) != 0)
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].y -= task->data[9];
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
}
break;
}
}
2020-02-16 23:49:24 +01:00
void AnimTask_SketchDrawMon(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
struct ScanlineEffectParams params;
s16 i;
task->data[0] = GetBattlerYCoordWithElevation(gBattleAnimTarget) + 32;
task->data[1] = 4;
task->data[2] = 0;
task->data[3] = 0;
task->data[4] = 0;
task->data[5] = 0;
2018-12-30 17:58:42 +01:00
task->data[15] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT);
2018-12-18 04:56:34 +01:00
2018-12-20 04:13:26 +01:00
if (GetBattlerSpriteBGPriorityRank(gBattleAnimTarget) == 1)
2018-12-18 04:56:34 +01:00
{
task->data[6] = gBattle_BG1_X;
2021-11-10 23:01:21 +01:00
params.dmaDest = &REG_BG1HOFS;
2018-12-18 04:56:34 +01:00
}
else
{
task->data[6] = gBattle_BG2_X;
2021-11-10 23:01:21 +01:00
params.dmaDest = &REG_BG2HOFS;
2018-12-18 04:56:34 +01:00
}
for (i = task->data[0] - 0x40; i <= task->data[0]; i++)
{
if (i >= 0)
{
gScanlineEffectRegBuffers[0][i] = task->data[6] + 0xF0;
gScanlineEffectRegBuffers[1][i] = task->data[6] + 0xF0;
}
}
params.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT;
params.initState = 1;
params.unused9 = 0;
ScanlineEffect_SetParams(params);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_SketchDrawMon_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_SketchDrawMon_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
switch (task->data[4])
{
case 0:
if (++task->data[5] > 20)
task->data[4]++;
break;
case 1:
if (++task->data[1] > 3)
{
task->data[1] = 0;
task->data[2] = task->data[3] & 3;
task->data[5] = task->data[0] - task->data[3];
switch (task->data[2])
{
case 0:
break;
case 1:
task->data[5] -= 2;
break;
case 2:
task->data[5] += 1;
break;
case 3:
task->data[5] += 1;
break;
}
if (task->data[5] >= 0)
{
gScanlineEffectRegBuffers[0][task->data[5]] = task->data[6];
gScanlineEffectRegBuffers[1][task->data[5]] = task->data[6];
}
if (++task->data[3] >= task->data[15])
{
gScanlineEffect.state = 3;
DestroyAnimVisualTask(taskId);
}
}
break;
}
}
2020-02-20 22:22:33 +01:00
static void AnimPencil(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) - 16;
2021-07-07 15:11:52 +02:00
sprite->y = GetBattlerYCoordWithElevation(gBattleAnimTarget) + 16;
2018-12-18 04:56:34 +01:00
sprite->data[0] = 0;
sprite->data[1] = 0;
sprite->data[2] = 0;
sprite->data[3] = 16;
sprite->data[4] = 0;
2018-12-30 17:58:42 +01:00
sprite->data[5] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT) + 2;
2018-12-18 04:56:34 +01:00
sprite->data[6] = BattleAnimAdjustPanning(63);
2019-10-20 11:01:12 +02:00
sprite->callback = AnimPencil_Step;
2018-12-18 04:56:34 +01:00
}
2019-10-20 11:01:12 +02:00
static void AnimPencil_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
switch (sprite->data[0])
{
case 0:
if (++sprite->data[2] > 1)
{
sprite->data[2] = 0;
sprite->invisible = !sprite->invisible;
}
if (++sprite->data[1] > 16)
{
2020-02-20 22:22:33 +01:00
sprite->invisible = FALSE;
2018-12-18 04:56:34 +01:00
sprite->data[0]++;
}
break;
case 1:
if (++sprite->data[1] > 3 && sprite->data[2] < sprite->data[5])
{
sprite->data[1] = 0;
2021-07-07 15:11:52 +02:00
sprite->y -= 1;
2018-12-18 04:56:34 +01:00
sprite->data[2]++;
if (sprite->data[2] % 10 == 0)
2020-08-21 00:02:00 +02:00
PlaySE12WithPanning(SE_M_SKETCH, sprite->data[6]);
2018-12-18 04:56:34 +01:00
}
sprite->data[4] += sprite->data[3];
if (sprite->data[4] > 31)
{
sprite->data[4] = 0x40 - sprite->data[4];
sprite->data[3] *= -1;
}
else if (sprite->data[4] <= -32)
{
sprite->data[4] = -0x40 - sprite->data[4];
sprite->data[3] *= -1;
}
2021-07-07 15:11:52 +02:00
sprite->x2 = sprite->data[4];
2018-12-18 04:56:34 +01:00
if (sprite->data[5] == sprite->data[2])
{
sprite->data[1] = 0;
sprite->data[2] = 0;
sprite->data[0]++;
}
break;
case 2:
if (++sprite->data[2] > 1)
{
sprite->data[2] = 0;
sprite->invisible = !sprite->invisible;
}
if (++sprite->data[1] > 16)
{
2020-02-20 22:22:33 +01:00
sprite->invisible = FALSE;
2018-12-18 04:56:34 +01:00
DestroyAnimSprite(sprite);
}
break;
}
}
2020-02-20 22:22:33 +01:00
static void AnimBlendThinRing(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
u8 battler = 0;
u16 sp0 = 0;
u16 sp1 = 0;
u8 r4;
if (gBattleAnimArgs[2] == 0)
battler = gBattleAnimAttacker;
else
battler = gBattleAnimTarget;
r4 = gBattleAnimArgs[3] ^ 1;
if (IsDoubleBattle() && IsBattlerSpriteVisible(BATTLE_PARTNER(battler)))
{
SetAverageBattlerPositions(battler, r4, &sp0, &sp1);
if (r4 == 0)
2021-11-08 17:46:38 +01:00
r4 = GetBattlerSpriteCoord(battler, BATTLER_COORD_X);
2018-12-18 04:56:34 +01:00
else
2021-11-08 17:46:38 +01:00
r4 = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2);
2018-12-18 04:56:34 +01:00
if (GetBattlerSide(battler) != B_SIDE_PLAYER)
gBattleAnimArgs[0] -= (sp0 - r4) - gBattleAnimArgs[0]; // This is weird.
else
gBattleAnimArgs[0] = sp0 - r4;
}
2019-10-20 16:22:53 +02:00
sprite->callback = AnimSpriteOnMonPos;
2018-12-18 04:56:34 +01:00
sprite->callback(sprite);
}
2021-01-23 06:40:46 +01:00
static void AnimHyperVoiceRing_WaitEnd(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
if (AnimTranslateLinear(sprite))
2018-12-18 04:56:34 +01:00
{
FreeSpriteOamMatrix(sprite);
DestroyAnimSprite(sprite);
}
}
2020-02-20 22:22:33 +01:00
static void AnimHyperVoiceRing(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2021-11-08 17:46:38 +01:00
u16 startX = 0;
u16 startY = 0;
s16 x = 0;
s16 y = 0;
u8 yCoordType;
2018-12-18 04:56:34 +01:00
u8 battler1;
u8 battler2;
2021-11-08 17:46:38 +01:00
u8 xCoordType;
2018-12-18 04:56:34 +01:00
if (gBattleAnimArgs[5] == 0)
{
battler1 = gBattleAnimAttacker;
battler2 = gBattleAnimTarget;
}
else
{
battler1 = gBattleAnimTarget;
battler2 = gBattleAnimAttacker;
}
if (!gBattleAnimArgs[6])
{
2021-11-08 17:46:38 +01:00
xCoordType = BATTLER_COORD_X;
yCoordType = BATTLER_COORD_Y;
2018-12-18 04:56:34 +01:00
}
else
{
2021-11-08 17:46:38 +01:00
xCoordType = BATTLER_COORD_X_2;
yCoordType = BATTLER_COORD_Y_PIC_OFFSET;
2018-12-18 04:56:34 +01:00
}
if (GetBattlerSide(battler1) != B_SIDE_PLAYER)
{
2021-11-08 17:46:38 +01:00
startX = GetBattlerSpriteCoord(battler1, xCoordType) + gBattleAnimArgs[0];
2018-12-18 04:56:34 +01:00
if (IsBattlerSpriteVisible(BATTLE_PARTNER(battler2)))
sprite->subpriority = gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler2)]].subpriority - 1;
else
sprite->subpriority = gSprites[gBattlerSpriteIds[battler2]].subpriority - 1;
}
else
{
2021-11-08 17:46:38 +01:00
startX = GetBattlerSpriteCoord(battler1, xCoordType) - gBattleAnimArgs[0];
2018-12-18 04:56:34 +01:00
if (!IsContest() && IsBattlerSpriteVisible(BATTLE_PARTNER(battler1)))
{
2021-07-07 15:11:52 +02:00
if (gSprites[gBattlerSpriteIds[battler1]].x < gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler1)]].x)
2018-12-18 04:56:34 +01:00
sprite->subpriority = gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler1)]].subpriority + 1;
else
sprite->subpriority = gSprites[gBattlerSpriteIds[battler1]].subpriority - 1;
}
else
{
sprite->subpriority = gSprites[gBattlerSpriteIds[battler1]].subpriority - 1;
}
}
2021-11-08 17:46:38 +01:00
startY = GetBattlerSpriteCoord(battler1, yCoordType) + gBattleAnimArgs[1];
2018-12-18 04:56:34 +01:00
if (!IsContest() && IsBattlerSpriteVisible(BATTLE_PARTNER(battler2)))
{
2021-11-08 17:46:38 +01:00
SetAverageBattlerPositions(battler2, gBattleAnimArgs[6], &x, &y);
2018-12-18 04:56:34 +01:00
}
else
{
2021-11-08 17:46:38 +01:00
x = GetBattlerSpriteCoord(battler2, xCoordType);
y = GetBattlerSpriteCoord(battler2, yCoordType);
2018-12-18 04:56:34 +01:00
}
if (GetBattlerSide(battler2))
2021-11-08 17:46:38 +01:00
x += gBattleAnimArgs[3];
2018-12-18 04:56:34 +01:00
else
2021-11-08 17:46:38 +01:00
x -= gBattleAnimArgs[3];
2018-12-18 04:56:34 +01:00
2021-11-08 17:46:38 +01:00
y += gBattleAnimArgs[4];
sprite->x = sprite->data[1] = startX;
sprite->y = sprite->data[3] = startY;
sprite->data[2] = x;
sprite->data[4] = y;
2018-12-18 04:56:34 +01:00
sprite->data[0] = gBattleAnimArgs[0];
InitAnimLinearTranslation(sprite);
2021-01-23 06:40:46 +01:00
sprite->callback = AnimHyperVoiceRing_WaitEnd;
2018-12-18 04:56:34 +01:00
sprite->callback(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimUproarRing(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
u8 index = IndexOfSpritePaletteTag(ANIM_TAG_THIN_RING);
if (index != 0xFF)
{
BlendPalette(((index << 20) + 0x1010000) >> 16, 15, gBattleAnimArgs[5], gBattleAnimArgs[4]);
}
StartSpriteAffineAnim(sprite, 1);
2019-10-20 16:22:53 +02:00
sprite->callback = AnimSpriteOnMonPos;
2018-12-18 04:56:34 +01:00
sprite->callback(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimSoftBoiledEgg(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
s16 r1;
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, FALSE);
2018-12-18 04:56:34 +01:00
r1 = GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER ? -160 : 160;
sprite->data[0] = 0x380;
sprite->data[1] = r1;
sprite->data[7] = gBattleAnimArgs[2];
2019-10-20 11:16:45 +02:00
sprite->callback = AnimSoftBoiledEgg_Step1;
2018-12-18 04:56:34 +01:00
}
2019-10-20 11:16:45 +02:00
static void AnimSoftBoiledEgg_Step1(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
s16 add;
2021-07-07 15:11:52 +02:00
sprite->y2 -= (sprite->data[0] >> 8);
sprite->x2 = sprite->data[1] >> 8;
2018-12-18 04:56:34 +01:00
sprite->data[0] -= 32;
add = GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER ? -160 : 160;
sprite->data[1] += add;
2021-07-07 15:11:52 +02:00
if (sprite->y2 > 0)
2018-12-18 04:56:34 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->y += sprite->y2;
sprite->x += sprite->x2;
sprite->y2 = 0;
sprite->x2 = 0;
2018-12-18 04:56:34 +01:00
sprite->data[0] = 0;
StartSpriteAffineAnim(sprite, 1);
2019-10-20 11:16:45 +02:00
sprite->callback = AnimSoftBoiledEgg_Step2;
2018-12-18 04:56:34 +01:00
}
}
2019-10-20 11:16:45 +02:00
static void AnimSoftBoiledEgg_Step2(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->data[0]++ > 19)
{
StartSpriteAffineAnim(sprite, 2);
2019-10-20 11:16:45 +02:00
sprite->callback = AnimSoftBoiledEgg_Step3;
2018-12-18 04:56:34 +01:00
}
}
2019-10-20 11:16:45 +02:00
static void AnimSoftBoiledEgg_Step3(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->affineAnimEnded)
{
StartSpriteAffineAnim(sprite, 1);
sprite->data[0] = 0;
if (sprite->data[7] == 0)
{
sprite->oam.tileNum += 16;
2019-10-20 11:16:45 +02:00
sprite->callback = AnimSoftBoiledEgg_Step3_Callback1;
2018-12-18 04:56:34 +01:00
}
else
{
sprite->oam.tileNum += 32;
2019-10-20 11:16:45 +02:00
sprite->callback = AnimSoftBoiledEgg_Step4;
2018-12-18 04:56:34 +01:00
}
}
}
2019-10-20 11:16:45 +02:00
static void AnimSoftBoiledEgg_Step3_Callback1(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->y2 -= 2;
2018-12-18 04:56:34 +01:00
if (++sprite->data[0] == 9)
{
sprite->data[0] = 16;
sprite->data[1] = 0;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND((u16)sprite->data[0], 0));
2019-10-20 11:16:45 +02:00
sprite->callback = AnimSoftBoiledEgg_Step3_Callback2;
2018-12-18 04:56:34 +01:00
}
}
2019-10-20 11:16:45 +02:00
static void AnimSoftBoiledEgg_Step3_Callback2(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->data[1]++ % 3 == 0)
{
sprite->data[0]--;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[0], 16 - sprite->data[0]));
if (sprite->data[0] == 0)
2019-10-20 11:16:45 +02:00
sprite->callback = AnimSoftBoiledEgg_Step4;
2018-12-18 04:56:34 +01:00
}
}
2019-10-20 11:16:45 +02:00
static void AnimSoftBoiledEgg_Step4(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if ((u16)gBattleAnimArgs[7] == 0xFFFF)
2018-12-18 04:56:34 +01:00
{
2020-02-20 22:22:33 +01:00
sprite->invisible = TRUE;
2018-12-18 04:56:34 +01:00
if (sprite->data[7] == 0)
2019-10-20 11:16:45 +02:00
sprite->callback = AnimSoftBoiledEgg_Step4_Callback;
2018-12-18 04:56:34 +01:00
else
sprite->callback = DestroyAnimSprite;
}
}
2019-10-20 11:16:45 +02:00
static void AnimSoftBoiledEgg_Step4_Callback(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
DestroyAnimSprite(sprite);
}
2020-02-15 00:11:04 +01:00
// Used by Extremespeed
void AnimTask_AttackerStretchAndDisappear(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
task->data[0] = spriteId;
2019-10-20 11:55:02 +02:00
PrepareAffineAnimInTaskData(task, spriteId, gStretchAttackerAffineAnimCmds);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_AttackerStretchAndDisappear_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_AttackerStretchAndDisappear_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
2018-12-18 05:08:08 +01:00
if (!RunAffineAnimFromTaskData(task))
2018-12-18 04:56:34 +01:00
{
2021-07-07 15:11:52 +02:00
gSprites[task->data[0]].y2 = 0;
2020-02-15 00:11:04 +01:00
gSprites[task->data[0]].invisible = TRUE;
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
}
2019-10-20 15:54:16 +02:00
void AnimTask_ExtremeSpeedImpact(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
task->data[0] = 0;
task->data[1] = 0;
task->data[2] = 0;
task->data[3] = 0;
task->data[12] = 3;
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
task->data[13] = 0xFFFF;
task->data[14] = 8;
}
else
{
task->data[13] = 1;
task->data[14] = -8;
}
task->data[15] = GetAnimBattlerSpriteId(ANIM_TARGET);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_ExtremeSpeedImpact_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_ExtremeSpeedImpact_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
switch (task->data[0])
{
case 0:
2021-07-07 15:11:52 +02:00
gSprites[task->data[15]].x2 += task->data[14];
2018-12-18 04:56:34 +01:00
task->data[1] = 0;
task->data[2] = 0;
task->data[3] = 0;
task->data[0]++;
break;
case 1:
if (++task->data[1] > 1)
{
task->data[1] = 0;
task->data[2]++;
if (task->data[2] & 1)
2021-07-07 15:11:52 +02:00
gSprites[task->data[15]].x2 += 6;
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
gSprites[task->data[15]].x2 -= 6;
2018-12-18 04:56:34 +01:00
if (++task->data[3] > 4)
{
if (task->data[2] & 1)
2021-07-07 15:11:52 +02:00
gSprites[task->data[15]].x2 -= 6;
2018-12-18 04:56:34 +01:00
task->data[0]++;
}
}
break;
case 2:
if (--task->data[12] != 0)
task->data[0] = 0;
else
task->data[0]++;
break;
case 3:
2021-07-07 15:11:52 +02:00
gSprites[task->data[15]].x2 += task->data[13];
if (gSprites[task->data[15]].x2 == 0)
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
break;
}
}
2019-10-20 15:54:16 +02:00
void AnimTask_ExtremeSpeedMonReappear(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
task->data[0] = 0;
task->data[1] = 0;
task->data[2] = 0;
task->data[3] = 0;
task->data[4] = 1;
task->data[13] = 14;
task->data[14] = 2;
task->data[15] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_ExtremeSpeedMonReappear_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_ExtremeSpeedMonReappear_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
if (task->data[0] == 0 && ++task->data[1] > task->data[4])
{
task->data[1] = 0;
if (++task->data[2] & 1)
2020-02-20 22:22:33 +01:00
gSprites[task->data[15]].invisible = FALSE;
2018-12-18 04:56:34 +01:00
else
2020-02-20 22:22:33 +01:00
gSprites[task->data[15]].invisible = TRUE;
2018-12-18 04:56:34 +01:00
if (++task->data[3] >= task->data[13])
{
if (++task->data[4] < task->data[14])
{
task->data[1] = 0;
task->data[2] = 0;
task->data[3] = 0;
}
else
{
2020-02-20 22:22:33 +01:00
gSprites[task->data[15]].invisible = FALSE;
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
}
}
}
2019-10-20 11:16:45 +02:00
void AnimTask_SpeedDust(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
task->data[0] = 0;
task->data[1] = 4;
task->data[2] = 0;
task->data[3] = 0;
task->data[4] = 0;
task->data[5] = 0;
task->data[6] = 0;
task->data[7] = 0;
task->data[8] = 0;
task->data[13] = 0;
2021-11-08 17:46:38 +01:00
task->data[14] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
task->data[15] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
2020-02-20 22:22:33 +01:00
task->func = AnimTask_SpeedDust_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_SpeedDust_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
struct Task* task = &gTasks[taskId];
switch (task->data[8])
{
case 0:
if (++task->data[4] > 1)
{
task->data[4] = 0;
task->data[5] = (task->data[5] + 1) & 1;
if (++task->data[6] > 20)
{
if (task->data[7] == 0)
{
task->data[6] = 0;
task->data[8] = 1;
}
else
task->data[8] = 2;
}
}
break;
case 1:
task->data[5] = 0;
if (++task->data[4] > 20)
{
task->data[7] = 1;
task->data[8] = 0;
}
break;
case 2:
task->data[5] = 1;
break;
}
switch (task->data[0])
{
case 0:
if (++task->data[1] > 4)
{
u8 spriteId;
task->data[1] = 0;
2019-10-20 11:16:45 +02:00
spriteId = CreateSprite(&gSpeedDustSpriteTemplate, task->data[14], task->data[15], 0);
2018-12-18 04:56:34 +01:00
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[0] = taskId;
gSprites[spriteId].data[1] = 13;
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = gSpeedDustPosTable[task->data[2]][0];
gSprites[spriteId].y2 = gSpeedDustPosTable[task->data[2]][1];
2018-12-18 04:56:34 +01:00
task->data[13]++;
if (++task->data[2] > 3)
{
task->data[2] = 0;
if (++task->data[3] > 5)
task->data[0]++;
}
}
}
break;
case 1:
if (task->data[13] == 0)
DestroyAnimVisualTask(taskId);
break;
}
}
2020-02-20 22:22:33 +01:00
static void AnimSpeedDust(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
sprite->invisible = gTasks[sprite->data[0]].data[5];
if (sprite->animEnded)
{
gTasks[sprite->data[0]].data[sprite->data[1]]--;
DestroySprite(sprite);
}
}
2020-02-19 19:13:28 +01:00
void AnimTask_LoadMusicNotesPals(u8 taskId)
2018-12-18 04:56:34 +01:00
{
int i;
2020-02-15 00:11:04 +01:00
u8 paletteNums[NUM_MUSIC_NOTE_PAL_TAGS];
2018-12-18 04:56:34 +01:00
paletteNums[0] = IndexOfSpritePaletteTag(ANIM_TAG_MUSIC_NOTES_2);
2020-02-15 00:11:04 +01:00
for (i = 1; i < NUM_MUSIC_NOTE_PAL_TAGS; i++)
2018-12-18 04:56:34 +01:00
paletteNums[i] = AllocSpritePalette(ANIM_SPRITES_START - i);
2020-02-20 06:04:42 +01:00
gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000);
LZDecompressWram(gBattleAnimSpritePal_MusicNotes2, gMonSpritesGfxPtr->buffer);
2020-02-15 00:11:04 +01:00
for (i = 0; i < NUM_MUSIC_NOTE_PAL_TAGS; i++)
2020-02-20 06:04:42 +01:00
LoadPalette(&gMonSpritesGfxPtr->buffer[i * 32], (u16)((paletteNums[i] << 4) + 0x100), 32);
2018-12-18 04:56:34 +01:00
2020-02-20 06:04:42 +01:00
FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer);
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
2020-02-19 19:13:28 +01:00
void AnimTask_FreeMusicNotesPals(u8 taskId)
2018-12-18 04:56:34 +01:00
{
int i;
2020-02-15 00:11:04 +01:00
for (i = 0; i < NUM_MUSIC_NOTE_PAL_TAGS; i++)
FreeSpritePaletteByTag(sMusicNotePaletteTagsTable[i]);
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
2019-10-20 11:55:02 +02:00
static void SetMusicNotePalette(struct Sprite *sprite, u8 a, u8 b)
2018-12-18 04:56:34 +01:00
{
u8 tile;
tile = (b & 1);
tile = ((-tile | tile) >> 31) & 32;
sprite->oam.tileNum += tile + (a << 2);
2020-02-15 00:11:04 +01:00
sprite->oam.paletteNum = IndexOfSpritePaletteTag(sMusicNotePaletteTagsTable[b >> 1]);
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimHealBellMusicNote(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, FALSE);
2018-12-18 04:56:34 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
2021-11-08 17:46:38 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[3];
2018-12-18 04:56:34 +01:00
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
2019-10-20 11:55:02 +02:00
SetMusicNotePalette(sprite, gBattleAnimArgs[5], gBattleAnimArgs[6]);
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimMagentaHeart(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (++sprite->data[0] == 1)
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, FALSE);
2018-12-18 04:56:34 +01:00
2021-07-07 15:11:52 +02:00
sprite->x2 = Sin(sprite->data[1], 8);
sprite->y2 = sprite->data[2] >> 8;
2018-12-18 04:56:34 +01:00
sprite->data[1] = (sprite->data[1] + 7) & 0xFF;
sprite->data[2] -= 0x80;
if (sprite->data[0] == 60)
DestroyAnimSprite(sprite);
}
2019-10-20 11:55:02 +02:00
void AnimTask_FakeOut(u8 taskId)
2018-12-18 04:56:34 +01:00
{
2021-04-15 08:04:01 +02:00
u16 win0h = IsContest() ? 152 : DISPLAY_WIDTH;
2018-12-18 04:56:34 +01:00
u16 win0v = 0;
gBattle_WIN0H = win0h;
2021-04-15 08:04:01 +02:00
gBattle_WIN0V = DISPLAY_HEIGHT;
2018-12-18 04:56:34 +01:00
SetGpuReg(REG_OFFSET_WIN0H, gBattle_WIN0H);
SetGpuReg(REG_OFFSET_WIN0V, gBattle_WIN0V);
2021-04-15 08:43:09 +02:00
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN1_ALL);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_ALL | WINOUT_WINOBJ_ALL);
2018-12-26 13:43:07 +01:00
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_DARKEN);
2021-04-15 09:00:01 +02:00
SetGpuReg(REG_OFFSET_BLDY, 16);
2018-12-18 04:56:34 +01:00
gTasks[taskId].data[0] = win0v;
gTasks[taskId].data[1] = win0h;
2020-02-20 22:22:33 +01:00
gTasks[taskId].func = AnimTask_FakeOut_Step1;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_FakeOut_Step1(u8 taskId)
2018-12-18 04:56:34 +01:00
{
gTasks[taskId].data[0] += 13;
gTasks[taskId].data[1] -= 13;
if (gTasks[taskId].data[0] >= gTasks[taskId].data[1])
{
gBattle_WIN0H = 0;
2020-02-20 22:22:33 +01:00
gTasks[taskId].func = AnimTask_FakeOut_Step2;
2018-12-18 04:56:34 +01:00
}
else
{
2021-04-15 08:04:01 +02:00
gBattle_WIN0H = WIN_RANGE(gTasks[taskId].data[0], gTasks[taskId].data[1]);
2018-12-18 04:56:34 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimTask_FakeOut_Step2(u8 taskId)
2018-12-18 04:56:34 +01:00
{
if (++gTasks[taskId].data[10] == 5)
{
gTasks[taskId].data[11] = 0x88;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_LIGHTEN);
2021-02-28 00:41:30 +01:00
BlendPalettes(GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0), 16, RGB(31, 31, 31));
2018-12-18 04:56:34 +01:00
}
else if (gTasks[taskId].data[10] > 4)
{
gBattle_WIN0H = 0;
gBattle_WIN0V = 0;
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
DestroyAnimVisualTask(taskId);
}
}
2020-02-14 22:05:43 +01:00
void AnimTask_StretchTargetUp(u8 taskId)
2018-12-18 04:56:34 +01:00
{
u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
if (++gTasks[taskId].data[0] == 1)
{
2020-02-21 18:38:20 +01:00
PrepareAffineAnimInTaskData(&gTasks[taskId], GetAnimBattlerSpriteId(ANIM_TARGET), sAffineAnims_StretchBattlerUp);
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = 4;
2018-12-18 04:56:34 +01:00
}
else
{
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = -gSprites[spriteId].x2;
2018-12-18 05:08:08 +01:00
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
2018-12-18 04:56:34 +01:00
{
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = 0;
gSprites[spriteId].y2 = 0;
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
}
}
2020-02-20 02:22:53 +01:00
void AnimTask_StretchAttackerUp(u8 taskId)
2018-12-18 04:56:34 +01:00
{
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
if (++gTasks[taskId].data[0] == 1)
{
2020-02-21 18:38:20 +01:00
PrepareAffineAnimInTaskData(&gTasks[taskId], GetAnimBattlerSpriteId(ANIM_ATTACKER), sAffineAnims_StretchBattlerUp);
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = 4;
2018-12-18 04:56:34 +01:00
}
else
{
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = -gSprites[spriteId].x2;
2018-12-18 05:08:08 +01:00
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
2018-12-18 04:56:34 +01:00
{
2021-07-07 15:11:52 +02:00
gSprites[spriteId].x2 = 0;
gSprites[spriteId].y2 = 0;
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
}
}
2020-02-20 22:22:33 +01:00
static void AnimRedHeartProjectile(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-12-18 04:56:34 +01:00
sprite->data[0] = 95;
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
2021-11-08 17:46:38 +01:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
2021-07-07 15:11:52 +02:00
sprite->data[3] = sprite->y;
2021-11-08 17:46:38 +01:00
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-18 04:56:34 +01:00
InitAnimLinearTranslation(sprite);
2019-10-20 11:55:02 +02:00
sprite->callback = AnimRedHeartProjectile_Step;
2018-12-18 04:56:34 +01:00
}
2019-10-20 11:55:02 +02:00
static void AnimRedHeartProjectile_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
if (!AnimTranslateLinear(sprite))
2018-12-18 04:56:34 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->y2 += Sin(sprite->data[5], 14);
2018-12-18 04:56:34 +01:00
sprite->data[5] = (sprite->data[5] + 4) & 0xFF;
}
else
{
DestroyAnimSprite(sprite);
}
}
2020-02-20 22:22:33 +01:00
void AnimParticleBurst(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->data[0] == 0)
{
sprite->data[1] = gBattleAnimArgs[0];
sprite->data[2] = gBattleAnimArgs[1];
sprite->data[0]++;
}
else
{
sprite->data[4] += sprite->data[1];
2021-07-07 15:11:52 +02:00
sprite->x2 = sprite->data[4] >> 8;
sprite->y2 = Sin(sprite->data[3], sprite->data[2]);
2018-12-18 04:56:34 +01:00
sprite->data[3] = (sprite->data[3] + 3) & 0xFF;
if (sprite->data[3] > 100)
sprite->invisible = sprite->data[3] % 2;
if (sprite->data[3] > 120)
DestroyAnimSprite(sprite);
}
}
2020-02-20 22:22:33 +01:00
static void AnimRedHeartRising(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x = gBattleAnimArgs[0];
sprite->y = DISPLAY_HEIGHT;
2018-12-18 04:56:34 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = gBattleAnimArgs[1];
sprite->callback = WaitAnimForDuration;
2019-10-20 11:55:02 +02:00
StoreSpriteCallbackInData6(sprite, AnimRedHeartRising_Step);
2018-12-18 04:56:34 +01:00
}
2019-10-20 11:55:02 +02:00
static void AnimRedHeartRising_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
s16 y;
sprite->data[2] += sprite->data[1];
2021-07-07 15:11:52 +02:00
sprite->y2 = -((u16)sprite->data[2] >> 8);
sprite->x2 = Sin(sprite->data[3], 4);
2018-12-18 04:56:34 +01:00
sprite->data[3] = (sprite->data[3] + 3) & 0xFF;
2021-07-07 15:11:52 +02:00
y = sprite->y + sprite->y2;
2018-12-18 04:56:34 +01:00
if (y <= 72)
{
sprite->invisible = sprite->data[3] % 2;
if (y <= 64)
DestroyAnimSprite(sprite);
}
}
2019-04-02 08:36:22 +02:00
void AnimTask_HeartsBackground(u8 taskId)
2018-12-18 04:56:34 +01:00
{
2019-02-06 20:17:09 +01:00
struct BattleAnimBgData animBg;
2018-12-18 04:56:34 +01:00
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 3);
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0);
if (!IsContest())
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
2021-02-28 00:41:30 +01:00
GetBattleAnimBg1Data(&animBg);
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Attract, animBg.tilesOffset);
AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Attract, FALSE);
LoadCompressedPalette(gBattleAnimBgPalette_Attract, animBg.paletteId * 16, 32);
2020-02-20 22:22:33 +01:00
gTasks[taskId].func = AnimTask_HeartsBackground_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_HeartsBackground_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
2019-02-06 20:17:09 +01:00
struct BattleAnimBgData animBg;
2018-12-18 04:56:34 +01:00
switch (gTasks[taskId].data[12])
{
case 0:
if (++gTasks[taskId].data[10] == 4)
{
gTasks[taskId].data[10] = 0;
gTasks[taskId].data[11]++;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11]));
if (gTasks[taskId].data[11] == 16)
{
gTasks[taskId].data[12]++;
gTasks[taskId].data[11] = 0;
}
}
break;
case 1:
if (++gTasks[taskId].data[11] == 141)
{
gTasks[taskId].data[11] = 16;
gTasks[taskId].data[12]++;
}
break;
case 2:
if (++gTasks[taskId].data[10] == 4)
{
gTasks[taskId].data[10] = 0;
gTasks[taskId].data[11]--;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11]));
if (gTasks[taskId].data[11] == 0)
{
gTasks[taskId].data[12]++;
gTasks[taskId].data[11] = 0;
}
}
break;
case 3:
2021-02-28 00:41:30 +01:00
GetBattleAnimBg1Data(&animBg);
ClearBattleAnimBg(animBg.bgId);
2018-12-18 04:56:34 +01:00
gTasks[taskId].data[12]++;
break;
case 4:
if (!IsContest())
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
DestroyAnimVisualTask(taskId);
break;
}
}
2019-10-20 16:22:53 +02:00
void AnimTask_ScaryFace(u8 taskId)
2018-12-18 04:56:34 +01:00
{
2019-02-06 20:17:09 +01:00
struct BattleAnimBgData animBg;
2018-12-18 04:56:34 +01:00
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0);
if (!IsContest())
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
2021-02-28 00:41:30 +01:00
GetBattleAnimBg1Data(&animBg);
2018-12-18 04:56:34 +01:00
if (IsContest())
2021-10-04 16:21:03 +02:00
AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_ScaryFaceContest, FALSE);
2018-12-18 04:56:34 +01:00
else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT)
2021-10-04 16:21:03 +02:00
AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_ScaryFacePlayer, FALSE);
2018-12-18 04:56:34 +01:00
else
2021-10-04 16:21:03 +02:00
AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_ScaryFaceOpponent, FALSE);
2018-12-18 04:56:34 +01:00
2020-02-21 18:38:20 +01:00
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_ScaryFace, animBg.tilesOffset);
LoadCompressedPalette(gBattleAnimBgPalette_ScaryFace, animBg.paletteId * 16, 32);
2020-02-20 22:22:33 +01:00
gTasks[taskId].func = AnimTask_ScaryFace_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_ScaryFace_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
2019-02-06 20:17:09 +01:00
struct BattleAnimBgData animBg;
2018-12-18 04:56:34 +01:00
switch (gTasks[taskId].data[12])
{
case 0:
if (++gTasks[taskId].data[10] == 2)
{
gTasks[taskId].data[10] = 0;
gTasks[taskId].data[11]++;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11]));
if (gTasks[taskId].data[11] == 14)
{
gTasks[taskId].data[12]++;
gTasks[taskId].data[11] = 0;
}
}
break;
case 1:
if (++gTasks[taskId].data[11] == 21)
{
gTasks[taskId].data[11] = 14;
gTasks[taskId].data[12]++;
}
break;
case 2:
if (++gTasks[taskId].data[10] == 2)
{
gTasks[taskId].data[10] = 0;
gTasks[taskId].data[11]--;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11]));
if (gTasks[taskId].data[11] == 0)
{
gTasks[taskId].data[12]++;
gTasks[taskId].data[11] = 0;
}
}
break;
case 3:
2021-02-28 00:41:30 +01:00
GetBattleAnimBg1Data(&animBg);
ClearBattleAnimBg(1);
ClearBattleAnimBg(2);
2018-12-18 04:56:34 +01:00
gTasks[taskId].data[12]++;
// fall through
case 4:
if (!IsContest())
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
DestroyAnimVisualTask(taskId);
break;
}
}
// Orbits a sphere in an ellipse around the mon.
// Used by MOVE_HIDDEN_POWER
// arg 0: duration
// arg 1: initial wave offset
2020-02-20 22:22:33 +01:00
static void AnimOrbitFast(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-18 04:56:34 +01:00
sprite->affineAnimPaused = 1;
sprite->data[0] = gBattleAnimArgs[0];
sprite->data[1] = gBattleAnimArgs[1];
2018-12-18 05:08:08 +01:00
sprite->data[7] = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimOrbitFast_Step;
2018-12-18 04:56:34 +01:00
sprite->callback(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimOrbitFast_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2019-03-01 00:08:37 +01:00
if (sprite->data[1] >= 64 && sprite->data[1] <= 191)
2018-12-18 04:56:34 +01:00
sprite->subpriority = sprite->data[7] + 1;
else
sprite->subpriority = sprite->data[7] - 1;
2021-07-07 15:11:52 +02:00
sprite->x2 = Sin(sprite->data[1], sprite->data[2] >> 8);
sprite->y2 = Cos(sprite->data[1], sprite->data[3] >> 8);
2018-12-18 04:56:34 +01:00
sprite->data[1] = (sprite->data[1] + 9) & 0xFF;
switch (sprite->data[5])
{
case 1:
sprite->data[2] -= 0x400;
sprite->data[3] -= 0x100;
if (++sprite->data[4] == sprite->data[0])
{
sprite->data[5] = 2;
return;
}
break;
case 0:
sprite->data[2] += 0x400;
sprite->data[3] += 0x100;
if (++sprite->data[4] == sprite->data[0])
{
sprite->data[4] = 0;
sprite->data[5] = 1;
}
break;
}
if ((u16)gBattleAnimArgs[7] == 0xFFFF)
2018-12-18 04:56:34 +01:00
DestroyAnimSprite(sprite);
}
// Moves orbs away from the mon, based on where they are in their orbit.
// Used in MOVE_HIDDEN_POWER.
// arg 0: initial wave offset
2020-02-20 22:22:33 +01:00
static void AnimOrbitScatter(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-18 04:56:34 +01:00
sprite->data[0] = Sin(gBattleAnimArgs[0], 10);
sprite->data[1] = Cos(gBattleAnimArgs[0], 7);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimOrbitScatter_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimOrbitScatter_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x2 += sprite->data[0];
sprite->y2 += sprite->data[1];
if (sprite->x + sprite->x2 + 16 > ((u32)DISPLAY_WIDTH + 32)
2021-07-07 15:11:52 +02:00
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT || sprite->y + sprite->y2 < -16)
2018-12-18 04:56:34 +01:00
DestroyAnimSprite(sprite);
}
2019-10-20 11:55:02 +02:00
static void AnimSpitUpOrb_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2021-07-07 15:11:52 +02:00
sprite->x2 += sprite->data[0];
sprite->y2 += sprite->data[1];
2018-12-18 04:56:34 +01:00
if (sprite->data[3]++ >= sprite->data[2])
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimSpitUpOrb(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-18 04:56:34 +01:00
sprite->data[0] = Sin(gBattleAnimArgs[0], 10);
sprite->data[1] = Cos(gBattleAnimArgs[0], 7);
sprite->data[2] = gBattleAnimArgs[1];
2019-10-20 11:55:02 +02:00
sprite->callback = AnimSpitUpOrb_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimEyeSparkle_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->animEnded)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimEyeSparkle(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimEyeSparkle_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimAngel(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
s16 var0;
if (!sprite->data[0])
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-18 04:56:34 +01:00
}
sprite->data[0]++;
var0 = (sprite->data[0] * 10) & 0xFF;
2021-07-07 15:11:52 +02:00
sprite->x2 = Sin(var0, 80) >> 8;
2018-12-18 04:56:34 +01:00
if (sprite->data[0] < 80)
2021-07-07 15:11:52 +02:00
sprite->y2 = (sprite->data[0] / 2) + (Cos(var0, 80) >> 8);
2018-12-18 04:56:34 +01:00
if (sprite->data[0] > 90)
{
sprite->data[2]++;
2021-07-07 15:11:52 +02:00
sprite->x2 -= sprite->data[2] / 2;
2018-12-18 04:56:34 +01:00
}
if (sprite->data[0] > 100)
DestroyAnimSprite(sprite);
}
2021-01-23 06:40:46 +01:00
static void AnimPinkHeart_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
sprite->data[5]++;
2021-07-07 15:11:52 +02:00
sprite->x2 = Sin(sprite->data[3], 5);
sprite->y2 = sprite->data[5] / 2;
2018-12-18 04:56:34 +01:00
sprite->data[3] = (sprite->data[3] + 3) & 0xFF;
if (sprite->data[5] > 20)
sprite->invisible = sprite->data[5] % 2;
if (sprite->data[5] > 30)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimPinkHeart(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->data[0] == 0)
{
sprite->data[1] = gBattleAnimArgs[0];
sprite->data[2] = gBattleAnimArgs[1];
sprite->data[0]++;
}
else
{
sprite->data[4] += sprite->data[1];
2021-07-07 15:11:52 +02:00
sprite->x2 = sprite->data[4] >> 8;
sprite->y2 = Sin(sprite->data[3], sprite->data[2]);
2018-12-18 04:56:34 +01:00
sprite->data[3] = (sprite->data[3] + 3) & 0xFF;
if (sprite->data[3] > 70)
{
2021-01-23 06:40:46 +01:00
sprite->callback = AnimPinkHeart_Step;
2021-07-07 15:11:52 +02:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 0;
sprite->y2 = 0;
2018-12-18 04:56:34 +01:00
sprite->data[3] = Random2() % 180;
}
}
}
2020-02-20 22:22:33 +01:00
static void AnimDevil(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->data[3] == 0)
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-18 04:56:34 +01:00
StartSpriteAnim(sprite, 0);
2018-12-18 05:08:08 +01:00
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimTarget) - 1;
2018-12-18 04:56:34 +01:00
sprite->data[2] = 1;
}
sprite->data[0] += sprite->data[2];
sprite->data[1] = (sprite->data[0] * 4) % 256;
if (sprite->data[1] < 0)
sprite->data[1] = 0;
2021-07-07 15:11:52 +02:00
sprite->x2 = Cos(sprite->data[1], 30 - sprite->data[0] / 4);
sprite->y2 = Sin(sprite->data[1], 10 - sprite->data[0] / 8);
2018-12-18 04:56:34 +01:00
if (sprite->data[1] > 128 && sprite->data[2] > 0)
sprite->data[2] = -1;
if (sprite->data[1] == 0 && sprite->data[2] < 0)
sprite->data[2] = 1;
sprite->data[3]++;
if (sprite->data[3] < 10 || sprite->data[3] > 80)
sprite->invisible = sprite->data[0] % 2;
else
sprite->invisible = FALSE;
if (sprite->data[3] > 90)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimFurySwipes(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->data[0] == 0)
{
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-18 04:56:34 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[2]);
sprite->data[0]++;
}
else if (sprite->animEnded)
{
DestroyAnimSprite(sprite);
}
}
2020-03-27 14:50:15 +01:00
static void AnimMovementWaves(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (!gBattleAnimArgs[2])
{
DestroyAnimSprite(sprite);
}
else
{
if (!gBattleAnimArgs[0])
{
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-12-18 04:56:34 +01:00
}
else
{
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);
2018-12-18 04:56:34 +01:00
}
if (!gBattleAnimArgs[1])
2021-07-07 15:11:52 +02:00
sprite->x += 32;
2018-12-18 04:56:34 +01:00
else
2021-07-07 15:11:52 +02:00
sprite->x -= 32;
2018-12-18 04:56:34 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = gBattleAnimArgs[1];
StartSpriteAnim(sprite, sprite->data[1]);
2020-03-27 14:50:15 +01:00
sprite->callback = AnimMovementWaves_Step;
2018-12-18 04:56:34 +01:00
}
}
2020-03-27 14:50:15 +01:00
static void AnimMovementWaves_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (sprite->animEnded)
{
if (--sprite->data[0])
StartSpriteAnim(sprite, sprite->data[1]);
else
DestroyAnimSprite(sprite);
}
}
2019-10-20 16:22:53 +02:00
void AnimTask_UproarDistortion(u8 taskId)
2018-12-18 04:56:34 +01:00
{
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
2020-02-21 18:38:20 +01:00
PrepareAffineAnimInTaskData(&gTasks[taskId], spriteId, sAffineAnims_UproarDistortion);
2020-02-20 22:22:33 +01:00
gTasks[taskId].func = AnimTask_UproarDistortion_Step;
2018-12-18 04:56:34 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimTask_UproarDistortion_Step(u8 taskId)
2018-12-18 04:56:34 +01:00
{
2018-12-18 05:08:08 +01:00
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
2020-02-20 22:22:33 +01:00
static void AnimJaggedMusicNote(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
int var1;
u8 battler = !gBattleAnimArgs[0] ? gBattleAnimAttacker : gBattleAnimTarget;
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
gBattleAnimArgs[1] *= -1;
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
2018-12-18 04:56:34 +01:00
sprite->data[0] = 0;
2021-07-07 15:11:52 +02:00
sprite->data[1] = (u16)sprite->x << 3;
sprite->data[2] = (u16)sprite->y << 3;
2018-12-18 04:56:34 +01:00
var1 = gBattleAnimArgs[1] << 3;
if (var1 < 0)
var1 += 7;
sprite->data[3] = var1 >> 3;
var1 = gBattleAnimArgs[2] << 3;
if (var1 < 0)
var1 += 7;
sprite->data[4] = var1 >> 3;
sprite->oam.tileNum += gBattleAnimArgs[3] * 16;
2019-10-20 16:22:53 +02:00
sprite->callback = AnimJaggedMusicNote_Step;
2018-12-18 04:56:34 +01:00
}
2019-10-20 16:22:53 +02:00
static void AnimJaggedMusicNote_Step(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
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] >> 3;
sprite->y = sprite->data[2] >> 3;
2018-12-18 04:56:34 +01:00
if (++sprite->data[0] > 16)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimPerishSongMusicNote2(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (!sprite->data[0])
{
sprite->data[1] = 120 - gBattleAnimArgs[0];
2020-02-20 22:22:33 +01:00
sprite->invisible = TRUE;
2018-12-18 04:56:34 +01:00
}
if (++sprite->data[0] == sprite->data[1])
SetGrayscaleOrOriginalPalette(sprite->oam.paletteNum + 16, 0);
2018-12-18 04:56:34 +01:00
if (sprite->data[0] == sprite->data[1] + 80)
DestroyAnimSprite(sprite);
}
2020-02-20 22:22:33 +01:00
static void AnimPerishSongMusicNote(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
int index;
int var2;
if (!sprite->data[0])
{
2021-07-07 15:11:52 +02:00
sprite->x = 120;
sprite->y = (gBattleAnimArgs[0] + (((u16)gBattleAnimArgs[0]) >> 31)) / 2 - 15;
2018-12-18 04:56:34 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[1]);
sprite->data[5] = 120;
sprite->data[3] = gBattleAnimArgs[2];
}
sprite->data[0]++;
sprite->data[1] = (sprite->data[0] + ((u16)sprite->data[0] >> 31)) / 2;
index = ((sprite->data[0] * 3) + (u16)sprite->data[3]);
var2 = 0xFF;
sprite->data[6] = (sprite->data[6] + 10) & 0xFF;
index &= var2;
2021-07-07 15:11:52 +02:00
sprite->x2 = Cos(index, 100);
2018-12-18 04:56:34 +01:00
2021-07-07 15:11:52 +02:00
sprite->y2 = sprite->data[1] + Sin(index, 10) + Cos(sprite->data[6], 4);
2018-12-18 04:56:34 +01:00
if (sprite->data[0] > sprite->data[5])
{
2019-10-20 16:22:53 +02:00
sprite->callback = AnimPerishSongMusicNote_Step1;
2018-12-18 04:56:34 +01:00
sprite->data[0] = 0;
2019-02-06 20:17:09 +01:00
SetSpritePrimaryCoordsFromSecondaryCoords(sprite);
2018-12-18 04:56:34 +01:00
sprite->data[2] = 5;
sprite->data[4] = 0;
sprite->data[3] = 0;
StartSpriteAffineAnim(sprite, 1);
}
}
2019-10-20 16:22:53 +02:00
static void AnimPerishSongMusicNote_Step1(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if (++sprite->data[0] > 10)
{
sprite->data[0] = 0;
2019-10-20 16:22:53 +02:00
sprite->callback = AnimPerishSongMusicNote_Step2;
2018-12-18 04:56:34 +01:00
}
}
2019-10-20 16:22:53 +02:00
static void AnimPerishSongMusicNote_Step2(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
sprite->data[3] += sprite->data[2];
2021-07-07 15:11:52 +02:00
sprite->y2 = sprite->data[3];
2018-12-18 04:56:34 +01:00
sprite->data[2]++;
if (sprite->data[3] > 48 && sprite->data[2] > 0)
{
sprite->data[2] = sprite->data[4] - 5;
sprite->data[4]++;
}
if (sprite->data[4] > 3)
{
int var1 = sprite->data[2];
sprite->invisible = var1 - (((s32)(var1 + ((u32)var1 >> 31)) >> 1) << 1);
DestroyAnimSprite(sprite);
}
if (sprite->data[4] == 4)
{
DestroyAnimSprite(sprite);
}
}
2020-02-20 22:22:33 +01:00
static void AnimGuardRing(struct Sprite *sprite)
2018-12-18 04:56:34 +01:00
{
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)))
{
2021-07-07 15:11:52 +02:00
SetAverageBattlerPositions(gBattleAnimAttacker, 0, &sprite->x, &sprite->y);
sprite->y += 40;
2018-12-18 04:56:34 +01:00
StartSpriteAffineAnim(sprite, 1);
}
else
{
2021-11-08 17:46:38 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 40;
2018-12-18 04:56:34 +01:00
}
sprite->data[0] = 13;
2021-07-07 15:11:52 +02:00
sprite->data[2] = sprite->x;
sprite->data[4] = sprite->y - 72;
2018-12-18 04:56:34 +01:00
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
void AnimTask_IsFuryCutterHitRight(u8 taskId)
{
2020-02-19 19:13:28 +01:00
gBattleAnimArgs[ARG_RET_ID] = gAnimDisableStructPtr->furyCutterCounter & 1;
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}
void AnimTask_GetFuryCutterHitCount(u8 taskId)
{
2020-02-19 19:13:28 +01:00
gBattleAnimArgs[ARG_RET_ID] = gAnimDisableStructPtr->furyCutterCounter;
2018-12-18 04:56:34 +01:00
DestroyAnimVisualTask(taskId);
}