2018-10-25 02:01:40 +02:00
|
|
|
#include "global.h"
|
|
|
|
#include "battle_anim.h"
|
|
|
|
#include "constants/rgb.h"
|
2018-12-08 13:25:17 +01:00
|
|
|
#include "constants/songs.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "task.h"
|
|
|
|
#include "trig.h"
|
2018-10-25 02:01:40 +02:00
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
static void AnimFireSpiralInward(struct Sprite *);
|
2020-02-14 22:05:43 +01:00
|
|
|
static void AnimFireSpread(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFirePlume(struct Sprite *);
|
|
|
|
static void AnimLargeFlame(struct Sprite *);
|
2018-12-08 13:25:17 +01:00
|
|
|
static void sub_8109028(struct Sprite *);
|
|
|
|
static void sub_8109064(struct Sprite *);
|
|
|
|
static void sub_81090D8(struct Sprite *);
|
2020-02-20 02:22:53 +01:00
|
|
|
static void AnimSunlight(struct Sprite *);
|
2018-12-08 13:25:17 +01:00
|
|
|
static void AnimEmberFlare(struct Sprite *);
|
2020-02-20 05:13:54 +01:00
|
|
|
static void AnimBurnFlame(struct Sprite *);
|
2018-12-08 13:25:17 +01:00
|
|
|
static void AnimFireRing(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFireRing_Step1(struct Sprite *);
|
|
|
|
static void AnimFireRing_Step2(struct Sprite *);
|
|
|
|
static void AnimFireRing_Step3(struct Sprite *);
|
2018-12-08 13:25:17 +01:00
|
|
|
static void UpdateFireRingCircleOffset(struct Sprite *);
|
|
|
|
static void AnimFireCross(struct Sprite *);
|
2020-02-15 00:11:04 +01:00
|
|
|
static void AnimFireSpiralOutward(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFireSpiralOutward_Step1(struct Sprite *);
|
|
|
|
static void AnimFireSpiralOutward_Step2(struct Sprite *);
|
|
|
|
static void AnimTask_EruptionLaunchRocks_Step(u8 taskId);
|
2020-02-21 18:38:20 +01:00
|
|
|
static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3);
|
|
|
|
static void AnimEruptionLaunchRock(struct Sprite *);
|
|
|
|
static u16 GetEruptionLaunchRockInitialYPos(u8 spriteId);
|
|
|
|
static void InitEruptionLaunchRockCoordData(struct Sprite *sprite, s16 x, s16 y);
|
|
|
|
static void UpdateEruptionLaunchRockPos(struct Sprite *);
|
2020-02-15 00:11:04 +01:00
|
|
|
static void AnimEruptionFallingRock(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimEruptionFallingRock_Step(struct Sprite *);
|
2020-02-20 02:22:53 +01:00
|
|
|
static void AnimWillOWispOrb(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimWillOWispOrb_Step(struct Sprite *);
|
2020-02-20 02:22:53 +01:00
|
|
|
static void AnimWillOWispFire(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_MoveHeatWaveTargets_Step(u8 taskId);
|
2020-02-29 13:59:41 +01:00
|
|
|
static void AnimLavaPlumeOrbitScatter(struct Sprite *sprite);
|
2019-07-12 19:05:16 +02:00
|
|
|
static void AnimLavaPlumeOrbitScatterStep(struct Sprite *sprite);
|
2018-10-25 02:01:40 +02:00
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_FireSpiralSpread_0[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(16, 4),
|
|
|
|
ANIMCMD_FRAME(32, 4),
|
|
|
|
ANIMCMD_FRAME(48, 4),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_FireSpiralSpread_1[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(16, 4, .vFlip = TRUE, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(32, 4, .vFlip = TRUE, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(48, 4, .vFlip = TRUE, .hFlip = TRUE),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const sAnims_FireSpiralSpread[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_FireSpiralSpread_0,
|
|
|
|
sAnim_FireSpiralSpread_1,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
const struct SpriteTemplate gFireSpiralInwardSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_FireSpiralSpread,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-15 00:11:04 +01:00
|
|
|
.callback = AnimFireSpiralInward,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
const struct SpriteTemplate gFireSpreadSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_FireSpiralSpread,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-14 22:05:43 +01:00
|
|
|
.callback = AnimFireSpread,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_LargeFlame[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 3),
|
|
|
|
ANIMCMD_FRAME(16, 3),
|
|
|
|
ANIMCMD_FRAME(32, 3),
|
|
|
|
ANIMCMD_FRAME(48, 3),
|
|
|
|
ANIMCMD_FRAME(64, 3),
|
|
|
|
ANIMCMD_FRAME(80, 3),
|
|
|
|
ANIMCMD_FRAME(96, 3),
|
|
|
|
ANIMCMD_FRAME(112, 3),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const sAnims_LargeFlame[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_LargeFlame,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_FirePlume[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 5),
|
|
|
|
ANIMCMD_FRAME(16, 5),
|
|
|
|
ANIMCMD_FRAME(32, 5),
|
|
|
|
ANIMCMD_FRAME(48, 5),
|
|
|
|
ANIMCMD_FRAME(64, 5),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const sAnims_FirePlume[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_FirePlume,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd sAffineAnim_LargeFlame[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x32, 0x100, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x20, 0x0, 0, 7),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd *const sAffineAnims_LargeFlame[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAffineAnim_LargeFlame,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
const struct SpriteTemplate gLargeFlameSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_FIRE,
|
|
|
|
.paletteTag = ANIM_TAG_FIRE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_LargeFlame,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
2020-02-21 18:38:20 +01:00
|
|
|
.affineAnims = sAffineAnims_LargeFlame,
|
2020-02-20 22:22:33 +01:00
|
|
|
.callback = AnimLargeFlame,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
const struct SpriteTemplate gLargeFlameScatterSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_FIRE,
|
|
|
|
.paletteTag = ANIM_TAG_FIRE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_LargeFlame,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 22:22:33 +01:00
|
|
|
.callback = AnimLargeFlame,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
const struct SpriteTemplate gFirePlumeSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_FIRE_PLUME,
|
|
|
|
.paletteTag = ANIM_TAG_FIRE_PLUME,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_FirePlume,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 22:22:33 +01:00
|
|
|
.callback = AnimFirePlume,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
// Unused
|
2018-10-25 02:01:40 +02:00
|
|
|
const struct SpriteTemplate gUnknown_08595440 =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_FirePlume,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 22:22:33 +01:00
|
|
|
.callback = AnimFirePlume,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd gUnknown_08595458[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(16, 6),
|
|
|
|
ANIMCMD_FRAME(32, 6),
|
|
|
|
ANIMCMD_FRAME(48, 6),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const gUnknown_08595468[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
gUnknown_08595458,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
// Unused
|
2018-10-25 02:01:40 +02:00
|
|
|
const struct SpriteTemplate gUnknown_0859546C =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gUnknown_08595468,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = sub_8109064,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd sAffineAnim_SunlightRay[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x50, 0x50, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x2, 0x2, 10, 1),
|
|
|
|
AFFINEANIMCMD_JUMP(1),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd *const sAffineAnims_SunlightRay[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAffineAnim_SunlightRay,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 05:13:54 +01:00
|
|
|
const struct SpriteTemplate gSunlightRaySpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SUNLIGHT,
|
|
|
|
.paletteTag = ANIM_TAG_SUNLIGHT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjBlend_32x32,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2020-02-21 18:38:20 +01:00
|
|
|
.affineAnims = sAffineAnims_SunlightRay,
|
2020-02-20 02:22:53 +01:00
|
|
|
.callback = AnimSunlight,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_BasicFire[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 4),
|
|
|
|
ANIMCMD_FRAME(16, 4),
|
|
|
|
ANIMCMD_FRAME(32, 4),
|
|
|
|
ANIMCMD_FRAME(48, 4),
|
|
|
|
ANIMCMD_FRAME(64, 4),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
const union AnimCmd *const gAnims_BasicFire[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_BasicFire,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const struct SpriteTemplate gEmberSpriteTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = TranslateAnimSpriteToTargetMonLocation,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct SpriteTemplate gEmberFlareSpriteTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = gAnims_BasicFire,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-08 13:25:17 +01:00
|
|
|
.callback = AnimEmberFlare,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2019-05-10 15:12:33 +02:00
|
|
|
const union AnimCmd gIncinerateAnim1[] =
|
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 2),
|
|
|
|
ANIMCMD_FRAME(16, 4),
|
|
|
|
ANIMCMD_FRAME(32, 2),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
|
|
|
const union AnimCmd *const gIncinerateAnims[] =
|
|
|
|
{
|
|
|
|
gIncinerateAnim1,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct SpriteTemplate gIncinerateSpriteTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-19 17:47:55 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2019-05-10 15:12:33 +02:00
|
|
|
.anims = gIncinerateAnims,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = TranslateAnimSpriteToTargetMonLocation,
|
|
|
|
};
|
|
|
|
|
2020-02-20 05:13:54 +01:00
|
|
|
const struct SpriteTemplate gBurnFlameSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = gAnims_BasicFire,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 05:13:54 +01:00
|
|
|
.callback = AnimBurnFlame,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
const struct SpriteTemplate gFireBlastRingSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = gAnims_BasicFire,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-08 13:25:17 +01:00
|
|
|
.callback = AnimFireRing,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_FireBlastCross[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(32, 6),
|
|
|
|
ANIMCMD_FRAME(48, 6),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const sAnims_FireBlastCross[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_FireBlastCross,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd gUnknown_08595544[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 1),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd gUnknown_08595554[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0xA0, 0xA0, 0, 0),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
// Unused
|
|
|
|
static const union AffineAnimCmd *const gUnknown_08595564[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
gUnknown_08595544,
|
|
|
|
gUnknown_08595554,
|
|
|
|
};
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
const struct SpriteTemplate gFireBlastCrossSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_FireBlastCross,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-08 13:25:17 +01:00
|
|
|
.callback = AnimFireCross,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
const struct SpriteTemplate gFireSpiralOutwardSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = gAnims_BasicFire,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-15 00:11:04 +01:00
|
|
|
.callback = AnimFireSpiralOutward,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gWeatherBallFireDownSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = gAnims_BasicFire,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 02:22:53 +01:00
|
|
|
.callback = AnimWeatherBallDown,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
const struct SpriteTemplate gEruptionLaunchRockSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_WARM_ROCK,
|
|
|
|
.paletteTag = ANIM_TAG_WARM_ROCK,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-21 18:38:20 +01:00
|
|
|
.callback = AnimEruptionLaunchRock,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const s16 sEruptionLaunchRockCoords[][2] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
{-2, -5},
|
|
|
|
{-1, -1},
|
|
|
|
{ 3, -6},
|
|
|
|
{ 4, -2},
|
|
|
|
{ 2, -8},
|
|
|
|
{-5, -5},
|
|
|
|
{ 4, -7},
|
|
|
|
};
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
const struct SpriteTemplate gEruptionFallingRockSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_WARM_ROCK,
|
|
|
|
.paletteTag = ANIM_TAG_WARM_ROCK,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-15 00:11:04 +01:00
|
|
|
.callback = AnimEruptionFallingRock,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_WillOWispOrb_0[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 5),
|
|
|
|
ANIMCMD_FRAME(4, 5),
|
|
|
|
ANIMCMD_FRAME(8, 5),
|
|
|
|
ANIMCMD_FRAME(12, 5),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_WillOWispOrb_1[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(16, 5),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_WillOWispOrb_2[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(20, 5),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_WillOWispOrb_3[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(20, 5),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const sAnims_WillOWispOrb[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_WillOWispOrb_0,
|
|
|
|
sAnim_WillOWispOrb_1,
|
|
|
|
sAnim_WillOWispOrb_2,
|
|
|
|
sAnim_WillOWispOrb_3,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gWillOWispOrbSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_WISP_ORB,
|
|
|
|
.paletteTag = ANIM_TAG_WISP_ORB,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_WillOWispOrb,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 02:22:53 +01:00
|
|
|
.callback = AnimWillOWispOrb,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_WillOWispFire[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 5),
|
|
|
|
ANIMCMD_FRAME(16, 5),
|
|
|
|
ANIMCMD_FRAME(32, 5),
|
|
|
|
ANIMCMD_FRAME(48, 5),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const sAnims_WillOWispFire[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_WillOWispFire,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gWillOWispFireSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_WISP_FIRE,
|
|
|
|
.paletteTag = ANIM_TAG_WISP_FIRE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_WillOWispFire,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 02:22:53 +01:00
|
|
|
.callback = AnimWillOWispFire,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
// Directions for shaking up/down or left/right in AnimTask_ShakeTargetInPattern
|
|
|
|
// Only first 10 values are ever accessed.
|
|
|
|
// First pattern results in larger shakes, second results in faster oscillation
|
|
|
|
static const s8 sShakeDirsPattern0[16] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
-1, -1, 0, 1, 1, 0, 0, -1, -1, 1, 1, 0, 0, -1, 0, 1,
|
|
|
|
};
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
static const s8 sShakeDirsPattern1[16] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
-1, 0, 1, 0, -1, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, 1,
|
|
|
|
};
|
2018-12-08 10:45:52 +01:00
|
|
|
|
2019-07-12 19:05:16 +02:00
|
|
|
const union AffineAnimCmd gLavaPlumeAffineAnimCmd[] =
|
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 1),
|
|
|
|
AFFINEANIMCMD_JUMP(1),
|
|
|
|
};
|
|
|
|
|
|
|
|
const union AffineAnimCmd *const gLavaPlumeAffineAnims[] =
|
|
|
|
{
|
|
|
|
gLavaPlumeAffineAnimCmd,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct SpriteTemplate gLavaPlumeSpriteTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_FIRE_PLUME,
|
|
|
|
.paletteTag = ANIM_TAG_FIRE_PLUME,
|
2019-10-19 17:47:55 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-29 13:59:41 +01:00
|
|
|
.anims = sAnims_FirePlume,
|
2019-07-12 19:05:16 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gLavaPlumeAffineAnims,
|
|
|
|
.callback = AnimLavaPlumeOrbitScatter,
|
|
|
|
};
|
|
|
|
|
2020-02-29 13:59:41 +01:00
|
|
|
static void AnimLavaPlumeOrbitScatter(struct Sprite *sprite)
|
2019-07-12 19:05:16 +02:00
|
|
|
{
|
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
|
|
|
|
sprite->data[0] = Sin(gBattleAnimArgs[0], 10);
|
|
|
|
sprite->data[1] = Cos(gBattleAnimArgs[0], 7);
|
|
|
|
sprite->callback = AnimLavaPlumeOrbitScatterStep;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void AnimLavaPlumeOrbitScatterStep(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
sprite->pos2.x += sprite->data[0];
|
|
|
|
sprite->pos2.y += sprite->data[1];
|
|
|
|
if (sprite->pos1.x + sprite->pos2.x + 16 > 272u || sprite->pos1.y + sprite->pos2.y > 160 || sprite->pos1.y + sprite->pos2.y < -16)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
// For the first stage of Fire Punch
|
|
|
|
static void AnimFireSpiralInward(struct Sprite *sprite)
|
2018-12-08 10:45:52 +01:00
|
|
|
{
|
|
|
|
sprite->data[0] = gBattleAnimArgs[0];
|
|
|
|
sprite->data[1] = 0x3C;
|
|
|
|
sprite->data[2] = 0x9;
|
|
|
|
sprite->data[3] = 0x1E;
|
|
|
|
sprite->data[4] = 0xFE00;
|
|
|
|
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
|
|
|
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->callback = TranslateSpriteInGrowingCircleOverDuration;
|
2018-12-08 10:45:52 +01:00
|
|
|
sprite->callback(sprite);
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
// For the impact spread of fire sprites for moves like Blaze Kick or Fire Punch
|
|
|
|
static void AnimFireSpread(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
2018-12-20 04:13:26 +01:00
|
|
|
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
2020-04-17 17:44:28 +02:00
|
|
|
sprite->data[0] = gBattleAnimArgs[4]; // duration
|
|
|
|
sprite->data[1] = gBattleAnimArgs[2]; // x
|
|
|
|
sprite->data[2] = gBattleAnimArgs[3]; // y
|
2018-12-08 13:25:17 +01:00
|
|
|
|
2019-02-06 20:17:09 +01:00
|
|
|
sprite->callback = TranslateSpriteLinearFixedPoint;
|
2018-12-08 13:25:17 +01:00
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFirePlume(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
SetSpriteCoordsToAnimAttackerCoords(sprite);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker))
|
|
|
|
{
|
|
|
|
sprite->pos1.x -= gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
|
|
|
sprite->data[2] = -gBattleAnimArgs[4];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->pos1.x += gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[4];
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[1] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[4] = gBattleAnimArgs[3];
|
|
|
|
sprite->data[3] = gBattleAnimArgs[5];
|
|
|
|
|
|
|
|
sprite->callback = sub_8109028;
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimLargeFlame(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker))
|
|
|
|
{
|
|
|
|
sprite->pos1.x -= gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[4];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->pos1.x += gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
|
|
|
sprite->data[2] = -gBattleAnimArgs[4];
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[1] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[4] = gBattleAnimArgs[3];
|
|
|
|
sprite->data[3] = gBattleAnimArgs[5];
|
|
|
|
|
|
|
|
sprite->callback = sub_8109028;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_8109028(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (++sprite->data[0] < sprite->data[4])
|
|
|
|
{
|
|
|
|
sprite->pos2.x += sprite->data[2];
|
|
|
|
sprite->pos2.y += sprite->data[3];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite->data[0] == sprite->data[1])
|
2018-12-18 05:08:08 +01:00
|
|
|
DestroySpriteAndMatrix(sprite);
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_8109064(struct Sprite *sprite)
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
SetSpriteCoordsToAnimAttackerCoords(sprite);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker))
|
|
|
|
{
|
|
|
|
sprite->pos1.x -= gBattleAnimArgs[0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->pos1.x += gBattleAnimArgs[0];
|
|
|
|
sprite->subpriority = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
|
|
|
sprite->data[0] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[1] = gBattleAnimArgs[3];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[4];
|
|
|
|
sprite->data[3] = gBattleAnimArgs[5];
|
|
|
|
sprite->data[4] = gBattleAnimArgs[6];
|
|
|
|
sprite->data[5] = 0;
|
|
|
|
|
|
|
|
sprite->callback = sub_81090D8;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81090D8(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (sprite->data[3])
|
|
|
|
{
|
|
|
|
if(sprite->data[5] > 10000)
|
|
|
|
sprite->subpriority = 1;
|
|
|
|
|
|
|
|
sprite->pos2.x = Sin(sprite->data[0], sprite->data[1] + (sprite->data[5] >> 8));
|
|
|
|
sprite->pos2.y = Cos(sprite->data[0], sprite->data[1] + (sprite->data[5] >> 8));
|
|
|
|
|
|
|
|
sprite->data[0] += sprite->data[2];
|
|
|
|
sprite->data[5] += sprite->data[4];
|
|
|
|
|
|
|
|
if (sprite->data[0] > 255)
|
|
|
|
sprite->data[0] -= 256;
|
|
|
|
else if (sprite->data[0] < 0)
|
|
|
|
sprite->data[0] += 256;
|
|
|
|
|
|
|
|
sprite->data[3]--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
DestroySpriteAndMatrix(sprite);
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 05:13:54 +01:00
|
|
|
// Sunlight from Sunny Day / sunny weather
|
2020-02-20 02:22:53 +01:00
|
|
|
static void AnimSunlight(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
sprite->pos1.x = 0;
|
|
|
|
sprite->pos1.y = 0;
|
|
|
|
sprite->data[0] = 60;
|
|
|
|
sprite->data[2] = 140;
|
|
|
|
sprite->data[4] = 80;
|
|
|
|
sprite->callback = StartAnimLinearTranslation;
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
//fire 2
|
|
|
|
|
|
|
|
// Animates the secondary effect of MOVE_EMBER, where the flames grow and slide
|
|
|
|
// horizontally a bit.
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
|
|
|
// arg 2: target x pixel offset
|
|
|
|
// arg 3: target y pixel offset
|
|
|
|
// arg 4: duration
|
|
|
|
// arg 5: ? (todo: something related to which mon the pixel offsets are based on)
|
|
|
|
// arg 6: ? (todo: something related to which mon the pixel offsets are based on)
|
|
|
|
static void AnimEmberFlare(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget)
|
|
|
|
&& (gBattleAnimAttacker == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)
|
|
|
|
|| gBattleAnimAttacker == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)))
|
|
|
|
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
sprite->callback = AnimTravelDiagonally;
|
2018-12-08 13:25:17 +01:00
|
|
|
sprite->callback(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 05:13:54 +01:00
|
|
|
static void AnimBurnFlame(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
|
|
|
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
sprite->callback = AnimTravelDiagonally;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Animates the a fire sprite in the first-half of the MOVE_FIRE_BLAST
|
|
|
|
// animation. The fire sprite first moves in a circle around the mon,
|
|
|
|
// and then it is translated towards the target mon, while still rotating.
|
|
|
|
// Lastly, it moves in a circle around the target mon.
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
|
|
|
// arg 2: initial wave offset
|
|
|
|
//void AnimFireRing(struct Sprite *sprite)
|
|
|
|
void AnimFireRing(struct Sprite *sprite)
|
|
|
|
{
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimAttacker(sprite, 1);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
sprite->data[7] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimFireRing_Step1;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFireRing_Step1(struct Sprite *sprite)
|
2019-05-10 15:12:33 +02:00
|
|
|
{
|
2018-12-08 13:25:17 +01:00
|
|
|
UpdateFireRingCircleOffset(sprite);
|
|
|
|
|
|
|
|
if (++sprite->data[0] == 0x12)
|
|
|
|
{
|
|
|
|
sprite->data[0] = 0x19;
|
|
|
|
sprite->data[1] = sprite->pos1.x;
|
|
|
|
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
|
|
|
|
sprite->data[3] = sprite->pos1.y;
|
|
|
|
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
|
|
|
|
|
|
|
|
InitAnimLinearTranslation(sprite);
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimFireRing_Step2;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFireRing_Step2(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
2018-12-20 04:13:26 +01:00
|
|
|
if (AnimTranslateLinear(sprite))
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
|
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
|
|
|
|
sprite->pos2.y = 0;
|
|
|
|
sprite->pos2.x = 0;
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimFireRing_Step3;
|
2018-12-08 13:25:17 +01:00
|
|
|
sprite->callback(sprite);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->pos2.x += Sin(sprite->data[7], 28);
|
|
|
|
sprite->pos2.y += Cos(sprite->data[7], 28);
|
|
|
|
|
|
|
|
sprite->data[7] = (sprite->data[7] + 20) & 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFireRing_Step3(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
UpdateFireRingCircleOffset(sprite);
|
|
|
|
|
|
|
|
if (++sprite->data[0] == 0x1F)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void UpdateFireRingCircleOffset(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
sprite->pos2.x = Sin(sprite->data[7], 28);
|
|
|
|
sprite->pos2.y = Cos(sprite->data[7], 28);
|
|
|
|
|
|
|
|
sprite->data[7] = (sprite->data[7] + 20) & 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
|
|
|
// arg 2: duration
|
|
|
|
// arg 3: x delta
|
2019-05-10 15:12:33 +02:00
|
|
|
// arg 4: y delta
|
2018-12-08 13:25:17 +01:00
|
|
|
// AnimFireCross(struct Sprite *sprite)
|
|
|
|
static void AnimFireCross(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
sprite->pos1.x += gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[1] = gBattleAnimArgs[3];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[4];
|
|
|
|
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
|
|
|
|
2019-02-06 20:17:09 +01:00
|
|
|
sprite->callback = TranslateSpriteLinear;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
static void AnimFireSpiralOutward(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimAttacker(sprite, 1);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
sprite->data[1] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[0] = gBattleAnimArgs[3];
|
|
|
|
|
|
|
|
sprite->invisible = TRUE;
|
|
|
|
sprite->callback = WaitAnimForDuration;
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
StoreSpriteCallbackInData6(sprite, AnimFireSpiralOutward_Step1);
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFireSpiralOutward_Step1(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
sprite->invisible = FALSE;
|
|
|
|
|
|
|
|
sprite->data[0] = sprite->data[1];
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimFireSpiralOutward_Step2;
|
2018-12-08 13:25:17 +01:00
|
|
|
sprite->callback(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFireSpiralOutward_Step2(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
sprite->pos2.x = Sin(sprite->data[1], sprite->data[2] >> 8);
|
|
|
|
sprite->pos2.y = Cos(sprite->data[1], sprite->data[2] >> 8);
|
|
|
|
|
|
|
|
sprite->data[1] = (sprite->data[1] + 10) & 0xFF;
|
|
|
|
sprite->data[2] += 0xD0;
|
|
|
|
|
|
|
|
if (--sprite->data[0] == -1)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
// Animates first stage of Eruption where the attacker squishes and launches rocks away from themself
|
|
|
|
void AnimTask_EruptionLaunchRocks(u8 taskId)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
task->data[15] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
task->data[0] = 0;
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 0;
|
|
|
|
task->data[4] = gSprites[task->data[15]].pos1.y;
|
|
|
|
task->data[5] = GetBattlerSide(gBattleAnimAttacker);
|
|
|
|
task->data[6] = 0;
|
|
|
|
|
2018-12-18 05:08:08 +01:00
|
|
|
PrepareBattlerSpriteForRotScale(task->data[15], ST_OAM_OBJ_NORMAL);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_EruptionLaunchRocks_Step;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTION?
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
sub_80A805C(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 0x20);
|
|
|
|
|
|
|
|
task->data[0]++;
|
|
|
|
case 1:
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
|
|
|
|
if (++task->data[2] & 0x1)
|
|
|
|
gSprites[task->data[15]].pos2.x = 3;
|
|
|
|
else
|
|
|
|
gSprites[task->data[15]].pos2.x = -3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (task->data[5])
|
|
|
|
{
|
|
|
|
if (++task->data[3] > 4)
|
|
|
|
{
|
|
|
|
task->data[3] = 0;
|
|
|
|
gSprites[task->data[15]].pos1.y++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!sub_80A80C8(task))
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
SetBattlerSpriteYOffsetFromYScale(task->data[15]);
|
2018-12-08 13:25:17 +01:00
|
|
|
gSprites[task->data[15]].pos2.x = 0;
|
|
|
|
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (++task->data[1] > 4)
|
|
|
|
{
|
|
|
|
if (task->data[5])
|
|
|
|
sub_80A805C(task, task->data[15], 0xE0, 0x200, 0x180, 0xF0, 0x6);
|
|
|
|
else
|
|
|
|
sub_80A805C(task, task->data[15], 0xE0, 0x200, 0x180, 0xC0, 0x6);
|
|
|
|
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (!sub_80A80C8(task))
|
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
CreateEruptionLaunchRocks(task->data[15], taskId, 6);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
|
|
|
|
if (++task->data[2] & 1)
|
|
|
|
gSprites[task->data[15]].pos2.y += 3;
|
|
|
|
else
|
|
|
|
gSprites[task->data[15]].pos2.y -= 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++task->data[3] > 0x18)
|
|
|
|
{
|
|
|
|
if (task->data[5])
|
|
|
|
sub_80A805C(task, task->data[15], 0x180, 0xF0, 0x100, 0x100, 0x8);
|
|
|
|
else
|
|
|
|
sub_80A805C(task, task->data[15], 0x180, 0xC0, 0x100, 0x100, 0x8);
|
|
|
|
|
|
|
|
if (task->data[2] & 1)
|
|
|
|
gSprites[task->data[15]].pos2.y -= 3;
|
|
|
|
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
if (task->data[5])
|
|
|
|
gSprites[task->data[15]].pos1.y--;
|
|
|
|
|
|
|
|
if (!sub_80A80C8(task))
|
|
|
|
{
|
|
|
|
gSprites[task->data[15]].pos1.y = task->data[4];
|
2018-12-18 05:08:08 +01:00
|
|
|
ResetSpriteRotScale(task->data[15]);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
if (!task->data[6])
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
2019-06-26 14:13:38 +02:00
|
|
|
break;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
u16 i, j;
|
|
|
|
s8 sign;
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
u16 y = GetEruptionLaunchRockInitialYPos(spriteId);
|
2018-12-08 13:25:17 +01:00
|
|
|
u16 x = gSprites[spriteId].pos1.x;
|
|
|
|
|
|
|
|
if(!GetBattlerSide(gBattleAnimAttacker))
|
|
|
|
{
|
|
|
|
x -= 0xC;
|
|
|
|
sign = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x += 0x10;
|
|
|
|
sign = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0, j = 0; i <= 6; i++)
|
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
u8 spriteId = CreateSprite(&gEruptionLaunchRockSpriteTemplate, x, y, 2);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
if (spriteId != 0x40)
|
|
|
|
{
|
|
|
|
gSprites[spriteId].oam.tileNum += j * 4 + 0x40;
|
|
|
|
|
|
|
|
if (++j >= 5)
|
|
|
|
j = 0;
|
2020-02-21 18:38:20 +01:00
|
|
|
|
|
|
|
InitEruptionLaunchRockCoordData(&gSprites[spriteId], sEruptionLaunchRockCoords[i][0] * sign, sEruptionLaunchRockCoords[i][1]);
|
2018-12-08 13:25:17 +01:00
|
|
|
gSprites[spriteId].data[6] = taskId;
|
|
|
|
gSprites[spriteId].data[7] = a3;
|
|
|
|
|
|
|
|
gTasks[taskId].data[a3]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static void AnimEruptionLaunchRock(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
UpdateEruptionLaunchRockPos(sprite);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
if (sprite->invisible)
|
|
|
|
{
|
|
|
|
gTasks[sprite->data[6]].data[sprite->data[7]]--;
|
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static u16 GetEruptionLaunchRockInitialYPos(u8 spriteId)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
u16 y = gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y + gSprites[spriteId].centerToCornerVecY;
|
2018-12-08 13:25:17 +01:00
|
|
|
|
2019-09-04 23:06:59 +02:00
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
y = ((y << 16) + 0x4A0000) >> 16;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
y = ((y << 16) + 0x2C0000) >> 16;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
return y;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static void InitEruptionLaunchRockCoordData(struct Sprite *sprite, s16 x, s16 y)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[2] = (u16)sprite->pos1.x * 8;
|
|
|
|
sprite->data[3] = (u16)sprite->pos1.y * 8;
|
|
|
|
sprite->data[4] = x * 8;
|
|
|
|
sprite->data[5] = y * 8;
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static void UpdateEruptionLaunchRockPos(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
int var1;
|
|
|
|
if (++sprite->data[0] > 2)
|
|
|
|
{
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
++sprite->data[1];
|
|
|
|
var1 = (u16)sprite->data[1] * (u16)sprite->data[1];
|
|
|
|
sprite->data[3] += var1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[2] += sprite->data[4];
|
|
|
|
sprite->pos1.x = sprite->data[2] >> 3;
|
|
|
|
sprite->data[3] += sprite->data[5];
|
|
|
|
sprite->pos1.y = sprite->data[3] >> 3;
|
|
|
|
|
|
|
|
if (sprite->pos1.x < -8 || sprite->pos1.x > 0xf8 || sprite->pos1.y < -8 || sprite->pos1.y > 120)
|
|
|
|
sprite->invisible = TRUE;
|
|
|
|
}
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
static void AnimEruptionFallingRock(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
sprite->pos1.x = gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y = gBattleAnimArgs[1];
|
|
|
|
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[2] = 0;
|
|
|
|
sprite->data[6] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[7] = gBattleAnimArgs[3];
|
|
|
|
|
|
|
|
sprite->oam.tileNum += gBattleAnimArgs[4] * 16;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimEruptionFallingRock_Step;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimEruptionFallingRock_Step(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (sprite->data[6] != 0)
|
|
|
|
{
|
|
|
|
sprite->data[6]--;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[0]++;
|
|
|
|
// fall through
|
|
|
|
case 1:
|
|
|
|
sprite->pos1.y += 8;
|
|
|
|
if (sprite->pos1.y >= sprite->data[7])
|
|
|
|
{
|
|
|
|
sprite->pos1.y = sprite->data[7];
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (++sprite->data[1] > 1)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
if ((++sprite->data[2] & 1) != 0)
|
|
|
|
{
|
|
|
|
sprite->pos2.y = -3;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->pos2.y = 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++sprite->data[3] > 16)
|
|
|
|
{
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
static void AnimWillOWispOrb(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimAttacker(sprite, 0);
|
2018-12-08 13:25:17 +01:00
|
|
|
StartSpriteAnim(sprite, gBattleAnimArgs[2]);
|
|
|
|
sprite->data[7] = gBattleAnimArgs[2];
|
|
|
|
|
2019-09-04 23:06:59 +02:00
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
sprite->data[4] = 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->data[4] = -4;
|
|
|
|
}
|
|
|
|
|
2018-12-20 04:13:26 +01:00
|
|
|
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget);
|
2018-12-08 13:25:17 +01:00
|
|
|
sprite->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sprite->data[1] += 192;
|
2019-09-04 23:06:59 +02:00
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
sprite->pos2.y = -(sprite->data[1] >> 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->pos2.y = sprite->data[1] >> 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->pos2.x = Sin(sprite->data[2], sprite->data[4]);
|
|
|
|
sprite->data[2] = (sprite->data[2] + 4) & 0xFF;
|
|
|
|
|
|
|
|
if (++sprite->data[3] == 1)
|
|
|
|
{
|
|
|
|
sprite->data[3] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprite->pos2.x = Sin(sprite->data[2], sprite->data[4]);
|
|
|
|
sprite->data[2] = (sprite->data[2] + 4) & 0xFF;
|
2019-05-10 15:12:33 +02:00
|
|
|
|
2018-12-08 13:25:17 +01:00
|
|
|
if (++sprite->data[3] == 31)
|
|
|
|
{
|
|
|
|
sprite->pos1.x += sprite->pos2.x;
|
|
|
|
sprite->pos1.y += sprite->pos2.y;
|
|
|
|
sprite->pos2.y = 0;
|
|
|
|
sprite->pos2.x = 0;
|
|
|
|
|
|
|
|
sprite->data[0] = 256;
|
|
|
|
sprite->data[1] = sprite->pos1.x;
|
|
|
|
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
|
|
|
|
sprite->data[3] = sprite->pos1.y;
|
|
|
|
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
|
|
|
|
|
|
|
|
sub_80A6FD4(sprite);
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimWillOWispOrb_Step;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimWillOWispOrb_Step(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
s16 initialData5;
|
|
|
|
s16 newData5;
|
|
|
|
|
2018-12-20 04:13:26 +01:00
|
|
|
if (!AnimTranslateLinear(sprite))
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
sprite->pos2.x += Sin(sprite->data[5], 16);
|
|
|
|
initialData5 = sprite->data[5];
|
|
|
|
sprite->data[5] = (sprite->data[5] + 4) & 0xFF;
|
|
|
|
newData5 = sprite->data[5];
|
|
|
|
|
|
|
|
if ((initialData5 == 0 || initialData5 > 196) && newData5 > 0 && sprite->data[7] == 0)
|
|
|
|
{
|
2020-02-20 06:04:42 +01:00
|
|
|
PlaySE12WithPanning(SE_W172, gAnimCustomPanning);
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
static void AnimWillOWispFire(struct Sprite *sprite)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
if (!sprite->data[0])
|
|
|
|
{
|
|
|
|
sprite->data[1] = gBattleAnimArgs[0];
|
|
|
|
sprite->data[0] += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[3] += 0xC0 * 2;
|
|
|
|
sprite->data[4] += 0xA0;
|
|
|
|
|
|
|
|
sprite->pos2.x = Sin(sprite->data[1], sprite->data[3] >> 8);
|
|
|
|
sprite->pos2.y = Cos(sprite->data[1], sprite->data[4] >> 8);
|
|
|
|
|
|
|
|
sprite->data[1] = (sprite->data[1] + 7) & 0xFF;
|
|
|
|
|
|
|
|
if (!IsContest())
|
|
|
|
{
|
|
|
|
if (sprite->data[1] < 64 || sprite->data[1] > 195)
|
2018-12-20 04:13:26 +01:00
|
|
|
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget);
|
2018-12-08 13:25:17 +01:00
|
|
|
else
|
2018-12-20 04:13:26 +01:00
|
|
|
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget) + 1;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sprite->data[1] < 64 || sprite->data[1] > 195)
|
|
|
|
sprite->subpriority = 0x1D;
|
|
|
|
else
|
|
|
|
sprite->subpriority = 0x1F;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++sprite->data[2] > 0x14)
|
|
|
|
sprite->invisible ^= 1;
|
|
|
|
|
|
|
|
if (sprite->data[2] == 0x1E)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
void AnimTask_MoveHeatWaveTargets(u8 taskId)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
task->data[12] = !GetBattlerSide(gBattleAnimAttacker) ? 1 : -1;
|
|
|
|
task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ 2) + 1;
|
2020-02-15 00:11:04 +01:00
|
|
|
task->data[14] = GetAnimBattlerSpriteId(ANIM_TARGET);
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER);
|
2018-12-08 13:25:17 +01:00
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_MoveHeatWaveTargets_Step;
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_MoveHeatWaveTargets_Step(u8 taskId)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
task->data[10] += task->data[12] * 2;
|
|
|
|
if (++task->data[1] >= 2)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2]++;
|
|
|
|
if (task->data[2] & 1)
|
|
|
|
task->data[11] = 2;
|
|
|
|
else
|
|
|
|
task->data[11] = -2;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (task->data[3] = 0; task->data[3] < task->data[13]; task->data[3]++)
|
|
|
|
{
|
|
|
|
gSprites[task->data[task->data[3] + 14]].pos2.x = task->data[10] + task->data[11];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++task->data[9] == 16)
|
|
|
|
{
|
|
|
|
task->data[9] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++task->data[1] >= 5)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2]++;
|
|
|
|
|
|
|
|
if (task->data[2] & 1)
|
|
|
|
task->data[11] = 2;
|
|
|
|
else
|
|
|
|
task->data[11] = -2;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (task->data[3] = 0; task->data[3] < task->data[13]; task->data[3]++)
|
|
|
|
{
|
|
|
|
gSprites[task->data[task->data[3] + 14]].pos2.x = task->data[10] + task->data[11];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++task->data[9] == 96)
|
|
|
|
{
|
|
|
|
task->data[9] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
task->data[10] -= task->data[12] * 2;
|
|
|
|
|
|
|
|
if (++task->data[1] >= 2)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2]++;
|
|
|
|
|
|
|
|
if (task->data[2] & 1)
|
|
|
|
task->data[11] = 2;
|
|
|
|
else
|
|
|
|
task->data[11] = -2;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (task->data[3] = 0; task->data[3] < task->data[13]; task->data[3]++)
|
|
|
|
{
|
|
|
|
gSprites[task->data[task->data[3] + 14]].pos2.x = task->data[10] + task->data[11];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++task->data[9] == 16)
|
|
|
|
{
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
for (task->data[3] = 0; task->data[3] < task->data[13]; task->data[3]++)
|
|
|
|
{
|
|
|
|
gSprites[task->data[task->data[3] + 14]].pos2.x = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used to add a color mask to the battle interface / HUD in Heat Wave.
|
|
|
|
// arg 0: opacity
|
|
|
|
// arg 1: color code
|
|
|
|
void AnimTask_BlendBackground(u8 taskId)
|
|
|
|
{
|
2019-02-06 20:17:09 +01:00
|
|
|
struct BattleAnimBgData animBg;
|
|
|
|
sub_80A6B30(&animBg);
|
|
|
|
BlendPalette(animBg.paletteId * 16, 16, gBattleAnimArgs[0], gBattleAnimArgs[1]); // u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor
|
2018-12-08 13:25:17 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
#define tShakeNum data[0]
|
|
|
|
#define tMaxShakes data[1]
|
|
|
|
#define tShakeOffset data[2] // Never read, gBattleAnimArgs[1] is used directly instead
|
|
|
|
#define tVertical data[3]
|
|
|
|
#define tPatternId data[4]
|
|
|
|
|
|
|
|
// Shakes target horizontally or vertically tMaxShakes times, following a set pattern of alternations
|
|
|
|
void AnimTask_ShakeTargetInPattern(u8 taskId)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
2020-02-20 06:04:42 +01:00
|
|
|
s8 dir;
|
2018-12-08 13:25:17 +01:00
|
|
|
u8 spriteId;
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
if (gTasks[taskId].tShakeNum == 0)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
2020-02-20 06:04:42 +01:00
|
|
|
gTasks[taskId].tMaxShakes = gBattleAnimArgs[0];
|
|
|
|
gTasks[taskId].tShakeOffset = gBattleAnimArgs[1];
|
|
|
|
gTasks[taskId].tVertical = gBattleAnimArgs[2];
|
|
|
|
gTasks[taskId].tPatternId = gBattleAnimArgs[3];
|
2018-12-08 13:25:17 +01:00
|
|
|
}
|
2020-02-20 06:04:42 +01:00
|
|
|
gTasks[taskId].tShakeNum++;
|
2018-12-08 13:25:17 +01:00
|
|
|
|
|
|
|
spriteId = gBattlerSpriteIds[gBattleAnimTarget];
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
if (gTasks[taskId].tPatternId == 0)
|
|
|
|
dir = sShakeDirsPattern0[gTasks[taskId].tShakeNum % 10];
|
2018-12-08 13:25:17 +01:00
|
|
|
else
|
2020-02-20 06:04:42 +01:00
|
|
|
dir = sShakeDirsPattern1[gTasks[taskId].tShakeNum % 10];
|
2018-12-08 13:25:17 +01:00
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
if (gTasks[taskId].tVertical == TRUE)
|
|
|
|
gSprites[spriteId].pos2.y = gBattleAnimArgs[1] * dir < 0 ? -(gBattleAnimArgs[1] * dir) : gBattleAnimArgs[1] * dir;
|
2018-12-08 13:25:17 +01:00
|
|
|
else
|
2020-02-20 06:04:42 +01:00
|
|
|
gSprites[spriteId].pos2.x = gBattleAnimArgs[1] * dir;
|
2018-12-08 13:25:17 +01:00
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
if (gTasks[taskId].tShakeNum == gTasks[taskId].tMaxShakes)
|
2018-12-08 13:25:17 +01:00
|
|
|
{
|
|
|
|
gSprites[spriteId].pos2.x = 0;
|
|
|
|
gSprites[spriteId].pos2.y = 0;
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
2018-12-20 04:19:54 +01:00
|
|
|
}
|