2018-10-25 22:46:23 +01:00
|
|
|
#include "global.h"
|
|
|
|
#include "battle_anim.h"
|
2018-11-25 23:00:18 +00:00
|
|
|
#include "gpu_regs.h"
|
|
|
|
#include "graphics.h"
|
|
|
|
#include "palette.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "task.h"
|
|
|
|
#include "trig.h"
|
2018-10-25 22:46:23 +01:00
|
|
|
#include "constants/rgb.h"
|
2018-11-25 23:00:18 +00:00
|
|
|
#include "constants/songs.h"
|
2018-10-25 22:46:23 +01:00
|
|
|
|
2020-02-20 21:22:33 +00:00
|
|
|
static void AnimTask_Rollout_Step(u8 taskId);
|
2020-02-16 22:49:24 +00:00
|
|
|
static void AnimRolloutParticle(struct Sprite *);
|
|
|
|
static void AnimRockTomb(struct Sprite *);
|
2020-02-20 21:22:33 +00:00
|
|
|
static void AnimRockTomb_Step(struct Sprite *sprite);
|
2020-02-20 01:22:53 +00:00
|
|
|
static void AnimRockScatter(struct Sprite *);
|
2020-02-20 21:22:33 +00:00
|
|
|
static void AnimRockScatter_Step(struct Sprite *sprite);
|
|
|
|
static void AnimParticleInVortex_Step(struct Sprite *sprite);
|
|
|
|
static void AnimTask_LoadSandstormBackground_Step(u8 taskId);
|
2021-02-27 23:41:30 +00:00
|
|
|
static void CreateRolloutDirtSprite(struct Task *task);
|
2019-07-12 18:05:16 +01:00
|
|
|
static void AnimStealthRockStep2(struct Sprite *sprite);
|
|
|
|
static void AnimStealthRockStep(struct Sprite *sprite);
|
2020-02-29 12:59:41 +00:00
|
|
|
static void AnimStealthRock(struct Sprite *sprite);
|
2020-02-16 22:49:24 +00:00
|
|
|
static u8 GetRolloutCounter(void);
|
2018-11-25 23:00:18 +00:00
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
static const union AnimCmd sAnim_FlyingRock_0[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(32, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
static const union AnimCmd sAnim_FlyingRock_1[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(48, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
static const union AnimCmd sAnim_FlyingRock_2[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(64, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-11-29 14:22:31 +00:00
|
|
|
const union AnimCmd *const gAnims_FlyingRock[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
2020-02-21 17:38:20 +00:00
|
|
|
sAnim_FlyingRock_0,
|
|
|
|
sAnim_FlyingRock_1,
|
|
|
|
sAnim_FlyingRock_2,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gFallingRockSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROCKS,
|
|
|
|
.paletteTag = ANIM_TAG_ROCKS,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-11-29 14:22:31 +00:00
|
|
|
.anims = gAnims_FlyingRock,
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-16 22:49:24 +00:00
|
|
|
.callback = AnimFallingRock,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gRockFragmentSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROCKS,
|
|
|
|
.paletteTag = ANIM_TAG_ROCKS,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-11-29 14:22:31 +00:00
|
|
|
.anims = gAnims_FlyingRock,
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-16 22:49:24 +00:00
|
|
|
.callback = AnimRockFragment,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gSwirlingDirtSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_MUD_SAND,
|
|
|
|
.paletteTag = ANIM_TAG_MUD_SAND,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-10-25 22:46:23 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-16 22:49:24 +00:00
|
|
|
.callback = AnimParticleInVortex,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
static const union AffineAnimCmd sAffineAnim_Whirlpool[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0xC0, 0xC0, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x2, 0xFFFD, 0, 5),
|
|
|
|
AFFINEANIMCMD_FRAME(0xFFFE, 0x3, 0, 5),
|
|
|
|
AFFINEANIMCMD_JUMP(1),
|
|
|
|
};
|
|
|
|
|
2020-05-25 07:37:32 +01:00
|
|
|
const union AffineAnimCmd *const gAffineAnims_Whirlpool[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
2020-02-21 17:38:20 +00:00
|
|
|
sAffineAnim_Whirlpool,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gWhirlpoolSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_WATER_ORB,
|
|
|
|
.paletteTag = ANIM_TAG_WATER_ORB,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineNormal_ObjBlend_16x16,
|
2020-02-21 17:38:20 +00:00
|
|
|
.anims = gAnims_WaterMudOrb,
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
2020-05-25 07:37:32 +01:00
|
|
|
.affineAnims = gAffineAnims_Whirlpool,
|
2020-02-16 22:49:24 +00:00
|
|
|
.callback = AnimParticleInVortex,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-14 23:11:04 +00:00
|
|
|
const struct SpriteTemplate gFireSpinSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_EMBER,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_EMBER,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 17:38:20 +00:00
|
|
|
.anims = gAnims_BasicFire,
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-16 22:49:24 +00:00
|
|
|
.callback = AnimParticleInVortex,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gFlyingSandCrescentSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_FLYING_DIRT,
|
|
|
|
.paletteTag = ANIM_TAG_FLYING_DIRT,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x16,
|
2018-10-25 22:46:23 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-21 17:38:20 +00:00
|
|
|
.callback = AnimFlyingSandCrescent,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
static const struct Subsprite sFlyingSandSubsprites[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
2019-12-05 02:00:45 +00:00
|
|
|
{.x = -16, .y = 0, .shape = SPRITE_SHAPE(32x16), .size = SPRITE_SIZE(32x16), .tileOffset = 0, .priority = 1},
|
|
|
|
{.x = 16, .y = 0, .shape = SPRITE_SHAPE(32x16), .size = SPRITE_SIZE(32x16), .tileOffset = 8, .priority = 1},
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
static const struct SubspriteTable sFlyingSandSubspriteTable[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
2020-02-21 17:38:20 +00:00
|
|
|
{ARRAY_COUNT(sFlyingSandSubsprites), sFlyingSandSubsprites},
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2021-03-05 20:13:08 +00:00
|
|
|
static const union AnimCmd sAnim_Rock_Biggest[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2021-03-05 20:13:08 +00:00
|
|
|
static const union AnimCmd sAnim_Rock_Bigger[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(16, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2021-03-05 20:13:08 +00:00
|
|
|
static const union AnimCmd sAnim_Rock_Big[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(32, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2021-03-05 20:13:08 +00:00
|
|
|
static const union AnimCmd sAnim_Rock_Small[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(48, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2021-03-05 20:13:08 +00:00
|
|
|
static const union AnimCmd sAnim_Rock_Smaller[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(64, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2021-03-05 20:13:08 +00:00
|
|
|
static const union AnimCmd sAnim_Rock_Smallest[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(80, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
static const union AnimCmd *const sAnims_BasicRock[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
2021-03-05 20:13:08 +00:00
|
|
|
sAnim_Rock_Biggest,
|
|
|
|
sAnim_Rock_Bigger,
|
|
|
|
sAnim_Rock_Big,
|
|
|
|
sAnim_Rock_Small,
|
|
|
|
sAnim_Rock_Smaller,
|
|
|
|
sAnim_Rock_Smallest,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-14 21:05:43 +00:00
|
|
|
const struct SpriteTemplate gAncientPowerRockSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROCKS,
|
|
|
|
.paletteTag = ANIM_TAG_ROCKS,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 17:38:20 +00:00
|
|
|
.anims = sAnims_BasicRock,
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-11-25 23:00:18 +00:00
|
|
|
.callback = AnimRaiseSprite,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gRolloutMudSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_MUD_SAND,
|
|
|
|
.paletteTag = ANIM_TAG_MUD_SAND,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-10-25 22:46:23 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-16 22:49:24 +00:00
|
|
|
.callback = AnimRolloutParticle,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gRolloutRockSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROCKS,
|
|
|
|
.paletteTag = ANIM_TAG_ROCKS,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-10-25 22:46:23 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-16 22:49:24 +00:00
|
|
|
.callback = AnimRolloutParticle,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gRockTombRockSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROCKS,
|
|
|
|
.paletteTag = ANIM_TAG_ROCKS,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 17:38:20 +00:00
|
|
|
.anims = sAnims_BasicRock,
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-16 22:49:24 +00:00
|
|
|
.callback = AnimRockTomb,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
static const union AffineAnimCmd sAffineAnim_BasicRock_0[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x0, 0x0, -5, 5),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
static const union AffineAnimCmd sAffineAnim_BasicRock_1[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x0, 0x0, 5, 5),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-05-25 07:37:32 +01:00
|
|
|
const union AffineAnimCmd *const gAffineAnims_BasicRock[] =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
2020-02-21 17:38:20 +00:00
|
|
|
sAffineAnim_BasicRock_0,
|
|
|
|
sAffineAnim_BasicRock_1,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gRockBlastRockSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROCKS,
|
|
|
|
.paletteTag = ANIM_TAG_ROCKS,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2020-02-21 17:38:20 +00:00
|
|
|
.anims = sAnims_BasicRock,
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
2020-05-25 07:37:32 +01:00
|
|
|
.affineAnims = gAffineAnims_BasicRock,
|
2020-02-16 22:49:24 +00:00
|
|
|
.callback = AnimRockBlastRock,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
const struct SpriteTemplate gRockScatterSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROCKS,
|
|
|
|
.paletteTag = ANIM_TAG_ROCKS,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2020-02-21 17:38:20 +00:00
|
|
|
.anims = sAnims_BasicRock,
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
2020-05-25 07:37:32 +01:00
|
|
|
.affineAnims = gAffineAnims_BasicRock,
|
2020-02-20 01:22:53 +00:00
|
|
|
.callback = AnimRockScatter,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-21 17:38:20 +00:00
|
|
|
const struct SpriteTemplate gTwisterRockSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROCKS,
|
|
|
|
.paletteTag = ANIM_TAG_ROCKS,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2021-03-05 20:13:08 +00:00
|
|
|
.anims = &sAnims_BasicRock[4],
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
2020-05-25 07:37:32 +01:00
|
|
|
.affineAnims = gAffineAnims_BasicRock,
|
2018-11-25 23:00:18 +00:00
|
|
|
.callback = AnimMoveTwisterParticle,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
|
|
|
|
2020-02-20 01:22:53 +00:00
|
|
|
const struct SpriteTemplate gWeatherBallRockDownSpriteTemplate =
|
2018-10-25 22:46:23 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROCKS,
|
|
|
|
.paletteTag = ANIM_TAG_ROCKS,
|
2019-10-15 00:26:47 +01:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2020-05-28 16:50:13 +01:00
|
|
|
.anims = &sAnims_BasicRock[2],
|
2018-10-25 22:46:23 +01:00
|
|
|
.images = NULL,
|
2020-05-25 07:37:32 +01:00
|
|
|
.affineAnims = gAffineAnims_BasicRock,
|
2020-02-20 01:22:53 +00:00
|
|
|
.callback = AnimWeatherBallDown,
|
2018-10-25 22:46:23 +01:00
|
|
|
};
|
2018-11-25 23:00:18 +00:00
|
|
|
|
2019-07-12 18:05:16 +01:00
|
|
|
const struct SpriteTemplate gStoneEdgeSpriteTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_STONE_EDGE,
|
|
|
|
.paletteTag = ANIM_TAG_STONE_EDGE,
|
2019-10-19 16:47:55 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-29 12:59:41 +00:00
|
|
|
.anims = gAnims_BasicFire,
|
2019-07-12 18:05:16 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-29 12:59:41 +00:00
|
|
|
.callback = AnimParticleInVortex,
|
2019-07-12 18:05:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const struct SpriteTemplate gStealthRockSpriteTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_STEALTH_ROCK,
|
|
|
|
.paletteTag = ANIM_TAG_STEALTH_ROCK,
|
2019-10-19 16:47:55 +01:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2019-07-12 18:05:16 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = AnimStealthRock,
|
|
|
|
};
|
|
|
|
|
2020-05-04 05:09:03 +01:00
|
|
|
static const union AffineAnimCmd sSpriteAffineAnim_CrushGripHandEnemyAttack[] =
|
|
|
|
{
|
2024-08-27 00:55:54 +01:00
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 96, 1), //180 degree turn
|
|
|
|
AFFINEANIMCMD_END
|
2020-05-04 05:09:03 +01:00
|
|
|
};
|
|
|
|
static const union AffineAnimCmd sSpriteAffineAnim_DoNothing[] =
|
|
|
|
{
|
2024-08-27 00:55:54 +01:00
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 0, 1), //Do nothing
|
|
|
|
AFFINEANIMCMD_END
|
2020-05-04 05:09:03 +01:00
|
|
|
};
|
|
|
|
static const union AffineAnimCmd* const sSpriteAffineAnimTable_CrushGripHand[] =
|
|
|
|
{
|
2024-08-27 00:55:54 +01:00
|
|
|
sSpriteAffineAnim_DoNothing,
|
|
|
|
sSpriteAffineAnim_CrushGripHandEnemyAttack,
|
2020-05-04 05:09:03 +01:00
|
|
|
};
|
|
|
|
const struct SpriteTemplate gCrushGripHandTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_PURPLE_HAND_OUTLINE,
|
2022-09-08 18:25:43 +01:00
|
|
|
.paletteTag = ANIM_TAG_ACUPRESSURE,
|
2020-05-04 05:09:03 +01:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
|
|
|
.anims = sAnims_BasicRock,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = sSpriteAffineAnimTable_CrushGripHand,
|
|
|
|
.callback = AnimRockBlastRock
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct SpriteTemplate gSeedFlareGreenWavesTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_FLYING_DIRT,
|
|
|
|
.paletteTag = ANIM_TAG_LEAF,
|
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x16,
|
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = AnimFlyingSandCrescent
|
|
|
|
};
|
|
|
|
|
new animations for many moves more details in description (#5367)
New: Me First, Zippy Zap, Splishy Splash, Floaty Fall, Pika Papow, Bouncy Bubble, Buzzy Buzz, Sizzly Slide, Glitzy Glow, Baddy Bad, Sappy Seed, Freezy Frost, Sparkly Swirl, Veevee Volley, Snap Trap, Astral Barrage, Burning Bulwark
Updated: Aura Sphere, Dark Void, Spirit Shackle
Fixed: Springtide Storm, Bleakwind Storm, Wildbolt Storm, Sandsear Storm, Clangorous Soul(Blaze)
2024-09-15 07:22:40 +01:00
|
|
|
const struct SpriteTemplate gMakingItRainTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_COIN,
|
|
|
|
.paletteTag = ANIM_TAG_COIN,
|
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
|
|
|
|
.anims = gCoinAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = AnimFallingRock,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct SpriteTemplate gFallingSeedSpriteTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SEED,
|
|
|
|
.paletteTag = ANIM_TAG_SEED,
|
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = AnimFallingRock,
|
|
|
|
};
|
|
|
|
|
2020-02-29 12:59:41 +00:00
|
|
|
static void AnimStealthRock(struct Sprite *sprite)
|
2019-07-12 18:05:16 +01:00
|
|
|
{
|
2023-10-13 17:39:35 +01:00
|
|
|
s16 x, y;
|
2019-07-12 18:05:16 +01:00
|
|
|
|
|
|
|
InitSpritePosToAnimAttacker(sprite, TRUE);
|
|
|
|
SetAverageBattlerPositions(gBattleAnimTarget, FALSE, &x, &y);
|
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[4];
|
|
|
|
sprite->data[2] = x + gBattleAnimArgs[2];
|
|
|
|
sprite->data[4] = y + gBattleAnimArgs[3];
|
|
|
|
sprite->data[5] = -50;
|
|
|
|
|
|
|
|
InitAnimArcTranslation(sprite);
|
|
|
|
sprite->callback = AnimStealthRockStep;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void AnimStealthRockStep(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (TranslateAnimHorizontalArc(sprite))
|
|
|
|
{
|
|
|
|
sprite->data[0] = 30;
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->callback = WaitAnimForDuration;
|
|
|
|
StoreSpriteCallbackInData6(sprite, AnimStealthRockStep2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void AnimStealthRockStep2(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (sprite->data[1] & 1)
|
|
|
|
sprite->invisible ^= 1;
|
|
|
|
|
|
|
|
if (++sprite->data[1] == 16)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-05-25 07:37:32 +01:00
|
|
|
void AnimFallingRock(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
if (gBattleAnimArgs[3] != 0)
|
2022-07-25 19:59:14 +01:00
|
|
|
SetAverageBattlerPositions(gBattleAnimTarget, FALSE, &sprite->x, &sprite->y);
|
2018-11-25 23:00:18 +00:00
|
|
|
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x += gBattleAnimArgs[0];
|
|
|
|
sprite->y += 14;
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
StartSpriteAnim(sprite, gBattleAnimArgs[1]);
|
|
|
|
AnimateSprite(sprite);
|
|
|
|
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[2] = 4;
|
|
|
|
sprite->data[3] = 16;
|
|
|
|
sprite->data[4] = -70;
|
|
|
|
sprite->data[5] = gBattleAnimArgs[2];
|
|
|
|
|
2020-02-20 21:22:33 +00:00
|
|
|
StoreSpriteCallbackInData6(sprite, AnimFallingRock_Step);
|
2021-11-08 18:18:58 +00:00
|
|
|
sprite->callback = TranslateSpriteInEllipse;
|
2018-11-25 23:00:18 +00:00
|
|
|
sprite->callback(sprite);
|
|
|
|
}
|
|
|
|
|
2020-05-25 07:37:32 +01:00
|
|
|
void AnimFallingRock_Step(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x += sprite->data[5];
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
sprite->data[0] = 192;
|
|
|
|
sprite->data[1] = sprite->data[5];
|
|
|
|
sprite->data[2] = 4;
|
|
|
|
sprite->data[3] = 32;
|
|
|
|
sprite->data[4] = -24;
|
|
|
|
|
2018-12-18 04:08:08 +00:00
|
|
|
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
|
2021-11-08 18:18:58 +00:00
|
|
|
sprite->callback = TranslateSpriteInEllipse;
|
2018-11-25 23:00:18 +00:00
|
|
|
sprite->callback(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
// Animates the rock particles that are shown on the impact for Rock Blast / Rock Smash
|
2021-10-14 15:47:39 +01:00
|
|
|
void AnimRockFragment(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
StartSpriteAnim(sprite, gBattleAnimArgs[5]);
|
|
|
|
AnimateSprite(sprite);
|
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x -= gBattleAnimArgs[0];
|
2018-11-25 23:00:18 +00:00
|
|
|
else
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x += gBattleAnimArgs[0];
|
2018-11-25 23:00:18 +00:00
|
|
|
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->y += gBattleAnimArgs[1];
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[4];
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->data[1] = sprite->x;
|
|
|
|
sprite->data[2] = sprite->x + gBattleAnimArgs[2];
|
|
|
|
sprite->data[3] = sprite->y;
|
|
|
|
sprite->data[4] = sprite->y + gBattleAnimArgs[3];
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
InitSpriteDataForLinearTranslation(sprite);
|
|
|
|
sprite->data[3] = 0;
|
|
|
|
sprite->data[4] = 0;
|
|
|
|
|
2019-02-06 19:17:09 +00:00
|
|
|
sprite->callback = TranslateSpriteLinearFixedPoint;
|
2018-12-18 04:08:08 +00:00
|
|
|
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
|
2018-11-25 23:00:18 +00:00
|
|
|
}
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
// Swirls particle in vortex. Used for moves like Fire Spin or Sand Tomb
|
2020-05-25 07:37:32 +01:00
|
|
|
void AnimParticleInVortex(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
2024-11-25 18:57:22 +00:00
|
|
|
if (IsDoubleBattle()
|
|
|
|
&& (gAnimMoveIndex == MOVE_BLEAKWIND_STORM
|
new animations for many moves more details in description (#5367)
New: Me First, Zippy Zap, Splishy Splash, Floaty Fall, Pika Papow, Bouncy Bubble, Buzzy Buzz, Sizzly Slide, Glitzy Glow, Baddy Bad, Sappy Seed, Freezy Frost, Sparkly Swirl, Veevee Volley, Snap Trap, Astral Barrage, Burning Bulwark
Updated: Aura Sphere, Dark Void, Spirit Shackle
Fixed: Springtide Storm, Bleakwind Storm, Wildbolt Storm, Sandsear Storm, Clangorous Soul(Blaze)
2024-09-15 07:22:40 +01:00
|
|
|
|| gAnimMoveIndex == MOVE_SANDSEAR_STORM
|
|
|
|
|| gAnimMoveIndex == MOVE_SPRINGTIDE_STORM
|
|
|
|
|| gAnimMoveIndex == MOVE_WILDBOLT_STORM))
|
|
|
|
InitSpritePosToAnimTargetsCentre(sprite, FALSE);
|
|
|
|
else
|
2024-11-25 18:57:22 +00:00
|
|
|
InitSpritePosToAnimBattler(gBattleAnimArgs[6], sprite, FALSE);
|
|
|
|
|
2018-11-25 23:00:18 +00:00
|
|
|
sprite->data[0] = gBattleAnimArgs[3];
|
|
|
|
sprite->data[1] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[4];
|
|
|
|
sprite->data[3] = gBattleAnimArgs[5];
|
|
|
|
|
2020-02-20 21:22:33 +00:00
|
|
|
sprite->callback = AnimParticleInVortex_Step;
|
2018-11-25 23:00:18 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 21:22:33 +00:00
|
|
|
static void AnimParticleInVortex_Step(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
sprite->data[4] += sprite->data[1];
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->y2 = -(sprite->data[4] >> 8);
|
|
|
|
sprite->x2 = Sin(sprite->data[5], sprite->data[3]);
|
2018-11-25 23:00:18 +00:00
|
|
|
sprite->data[5] = (sprite->data[5] + sprite->data[2]) & 0xFF;
|
|
|
|
|
|
|
|
if (--sprite->data[0] == -1)
|
|
|
|
{
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_LoadSandstormBackground(u8 taskId)
|
|
|
|
{
|
|
|
|
int var0;
|
2019-02-06 19:17:09 +00:00
|
|
|
struct BattleAnimBgData animBg;
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
var0 = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | 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-27 23:41:30 +00:00
|
|
|
GetBattleAnimBg1Data(&animBg);
|
2020-02-21 17:38:20 +00:00
|
|
|
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Sandstorm, animBg.tilesOffset);
|
2021-10-04 15:21:03 +01:00
|
|
|
AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Sandstorm, FALSE);
|
2022-08-19 15:29:35 +01:00
|
|
|
LoadCompressedPalette(gBattleAnimSpritePal_FlyingDirt, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
var0 = 1;
|
|
|
|
|
|
|
|
gTasks[taskId].data[0] = var0;
|
2020-02-20 21:22:33 +00:00
|
|
|
gTasks[taskId].func = AnimTask_LoadSandstormBackground_Step;
|
2018-11-25 23:00:18 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 21:22:33 +00:00
|
|
|
static void AnimTask_LoadSandstormBackground_Step(u8 taskId)
|
2018-11-26 20:54:51 +00:00
|
|
|
{
|
2019-02-06 19:17:09 +00:00
|
|
|
struct BattleAnimBgData animBg;
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
if (gTasks[taskId].data[0] == 0)
|
|
|
|
gBattle_BG1_X += -6;
|
|
|
|
else
|
|
|
|
gBattle_BG1_X += 6;
|
|
|
|
|
|
|
|
gBattle_BG1_Y += -1;
|
|
|
|
|
|
|
|
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] == 7)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[12]++;
|
|
|
|
gTasks[taskId].data[11] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++gTasks[taskId].data[11] == 101)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[11] = 7;
|
|
|
|
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-27 23:41:30 +00:00
|
|
|
GetBattleAnimBg1Data(&animBg);
|
|
|
|
ClearBattleAnimBg(animBg.bgId);
|
2018-11-25 23:00:18 +00:00
|
|
|
gTasks[taskId].data[12]++;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (!IsContest())
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
|
|
|
|
|
|
|
|
gBattle_BG1_X = 0;
|
|
|
|
gBattle_BG1_Y = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Animates the sprites that fly diagonally across the screen
|
|
|
|
// in Sandstorm and Heat Wave.
|
|
|
|
// arg 0: initial y pixel offset
|
|
|
|
// arg 1: projectile speed
|
|
|
|
// arg 2: y pixel drop
|
|
|
|
// arg 3: ??? unknown (possibly a color bit)
|
2020-05-25 07:37:32 +01:00
|
|
|
void AnimFlyingSandCrescent(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
if (sprite->data[0] == 0)
|
|
|
|
{
|
|
|
|
if (gBattleAnimArgs[3] != 0 && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
{
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x = DISPLAY_WIDTH + 64;
|
2018-11-25 23:00:18 +00:00
|
|
|
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
|
|
|
sprite->data[5] = 1;
|
2019-08-10 17:09:06 +01:00
|
|
|
sprite->oam.matrixNum = ST_OAM_HFLIP;
|
2018-11-25 23:00:18 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x = -64;
|
2018-11-25 23:00:18 +00:00
|
|
|
}
|
|
|
|
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->y = gBattleAnimArgs[0];
|
2020-02-21 17:38:20 +00:00
|
|
|
SetSubspriteTables(sprite, sFlyingSandSubspriteTable);
|
2018-11-25 23:00:18 +00:00
|
|
|
sprite->data[1] = gBattleAnimArgs[1];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->data[3] += sprite->data[1];
|
|
|
|
sprite->data[4] += sprite->data[2];
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x2 += (sprite->data[3] >> 8);
|
|
|
|
sprite->y2 += (sprite->data[4] >> 8);
|
2018-11-25 23:00:18 +00:00
|
|
|
sprite->data[3] &= 0xFF;
|
|
|
|
sprite->data[4] &= 0xFF;
|
|
|
|
|
|
|
|
if (sprite->data[5] == 0)
|
|
|
|
{
|
2021-07-07 14:11:52 +01:00
|
|
|
if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 32)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
sprite->callback = DestroyAnimSprite;
|
|
|
|
}
|
|
|
|
}
|
2021-07-07 14:11:52 +01:00
|
|
|
else if (sprite->x + sprite->x2 < -32)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
sprite->callback = DestroyAnimSprite;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Animates the rising rocks in Ancient Power.
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
|
|
|
// arg 2: terminal y offset
|
|
|
|
// arg 3: duration
|
|
|
|
// arg 4: sprite size [1,5]
|
2020-05-25 07:37:32 +01:00
|
|
|
void AnimRaiseSprite(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
StartSpriteAnim(sprite, gBattleAnimArgs[4]);
|
2022-07-25 19:59:14 +01:00
|
|
|
InitSpritePosToAnimAttacker(sprite, FALSE);
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[3];
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->data[2] = sprite->x;
|
|
|
|
sprite->data[4] = sprite->y + gBattleAnimArgs[2];
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
sprite->callback = StartAnimLinearTranslation;
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
|
|
|
}
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
void AnimTask_Rollout(u8 taskId)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
u16 var0, var1, var2, var3;
|
2020-02-16 22:49:24 +00:00
|
|
|
u8 rolloutCounter;
|
2018-11-25 23:00:18 +00:00
|
|
|
s16 pan1, pan2;
|
|
|
|
struct Task *task;
|
|
|
|
|
|
|
|
task = &gTasks[taskId];
|
|
|
|
|
2021-11-08 16:46:38 +00:00
|
|
|
var0 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
var1 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 24;
|
|
|
|
var2 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
|
|
|
var3 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 24;
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
if (BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget)
|
|
|
|
var3 = var1;
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
rolloutCounter = GetRolloutCounter();
|
|
|
|
if (rolloutCounter == 1)
|
2018-11-25 23:00:18 +00:00
|
|
|
task->data[8] = 32;
|
|
|
|
else
|
2020-02-16 22:49:24 +00:00
|
|
|
task->data[8] = 48 - (rolloutCounter * 8);
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
task->data[0] = 0;
|
|
|
|
task->data[11] = 0;
|
|
|
|
task->data[9] = 0;
|
|
|
|
task->data[12] = 1;
|
2024-03-08 15:19:04 +00:00
|
|
|
task->data[10] = (task->data[8] / 8) - 1;
|
2018-11-25 23:00:18 +00:00
|
|
|
task->data[2] = var0 * 8;
|
|
|
|
task->data[3] = var1 * 8;
|
|
|
|
task->data[4] = ((var2 - var0) * 8) / task->data[8];
|
|
|
|
task->data[5] = ((var3 - var1) * 8) / task->data[8];
|
|
|
|
task->data[6] = 0;
|
|
|
|
task->data[7] = 0;
|
|
|
|
|
2022-08-16 18:00:28 +01:00
|
|
|
pan1 = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
|
|
|
|
pan2 = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
task->data[13] = pan1;
|
|
|
|
task->data[14] = (pan2 - pan1) / task->data[8];
|
2020-02-16 22:49:24 +00:00
|
|
|
task->data[1] = rolloutCounter;
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
2018-11-25 23:00:18 +00:00
|
|
|
|
2020-02-20 21:22:33 +00:00
|
|
|
task->func = AnimTask_Rollout_Step;
|
2018-11-25 23:00:18 +00:00
|
|
|
}
|
|
|
|
|
2020-11-29 14:22:31 +00:00
|
|
|
void AnimTask_TectonicRageRollout(u8 taskId)
|
|
|
|
{
|
|
|
|
u16 var0, var1, var2, var3;
|
|
|
|
int var5;
|
|
|
|
s16 pan1, pan2;
|
|
|
|
struct Task *task;
|
|
|
|
u8 rolloutCounter = 1;
|
|
|
|
|
|
|
|
task = &gTasks[taskId];
|
|
|
|
|
|
|
|
var0 = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
|
|
|
|
var1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 24;
|
|
|
|
var2 = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
|
|
|
|
var3 = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 24;
|
|
|
|
|
|
|
|
if (BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget)
|
|
|
|
var3 = var1;
|
|
|
|
|
|
|
|
task->data[8] = 48 - (rolloutCounter * 8); //rollout speed
|
|
|
|
task->data[0] = 0;
|
|
|
|
task->data[11] = 0;
|
|
|
|
task->data[9] = 0;
|
|
|
|
task->data[12] = 1;
|
|
|
|
|
|
|
|
var5 = task->data[8];
|
|
|
|
if (var5 < 0)
|
|
|
|
var5 += 7;
|
|
|
|
|
|
|
|
task->data[10] = (var5 >> 3) - 1;
|
|
|
|
|
|
|
|
task->data[2] = var0 * 8;
|
|
|
|
task->data[3] = var1 * 8;
|
|
|
|
task->data[4] = ((var2 - var0) * 8) / task->data[8];
|
|
|
|
task->data[5] = ((var3 - var1) * 8) / task->data[8];
|
|
|
|
task->data[6] = 0;
|
|
|
|
task->data[7] = 0;
|
|
|
|
|
|
|
|
pan1 = BattleAnimAdjustPanning(-64);
|
|
|
|
pan2 = BattleAnimAdjustPanning(63);
|
|
|
|
|
|
|
|
task->data[13] = pan1;
|
|
|
|
task->data[14] = (pan2 - pan1) / task->data[8];
|
|
|
|
task->data[1] = rolloutCounter;
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
|
|
|
|
|
|
|
task->func = AnimTask_Rollout_Step;
|
|
|
|
}
|
|
|
|
|
2020-02-20 21:22:33 +00:00
|
|
|
static void AnimTask_Rollout_Step(u8 taskId)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
struct Task *task;
|
|
|
|
|
|
|
|
task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
task->data[6] -= task->data[4];
|
|
|
|
task->data[7] -= task->data[5];
|
2021-07-07 14:11:52 +01:00
|
|
|
gSprites[task->data[15]].x2 = task->data[6] >> 3;
|
|
|
|
gSprites[task->data[15]].y2 = task->data[7] >> 3;
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
if (++task->data[9] == 10)
|
|
|
|
{
|
|
|
|
task->data[11] = 20;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
|
2020-08-20 23:02:00 +01:00
|
|
|
PlaySE12WithPanning(SE_M_HEADBUTT, task->data[13]);
|
2018-11-25 23:00:18 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (--task->data[11] == 0)
|
|
|
|
task->data[0]++;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (--task->data[9] != 0)
|
|
|
|
{
|
|
|
|
task->data[6] += task->data[4];
|
|
|
|
task->data[7] += task->data[5];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[6] = 0;
|
|
|
|
task->data[7] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
|
2021-07-07 14:11:52 +01:00
|
|
|
gSprites[task->data[15]].x2 = task->data[6] >> 3;
|
|
|
|
gSprites[task->data[15]].y2 = task->data[7] >> 3;
|
2018-11-25 23:00:18 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
task->data[2] += task->data[4];
|
|
|
|
task->data[3] += task->data[5];
|
|
|
|
if (++task->data[9] >= task->data[10])
|
|
|
|
{
|
|
|
|
task->data[9] = 0;
|
2021-02-27 23:41:30 +00:00
|
|
|
CreateRolloutDirtSprite(task);
|
2018-11-25 23:00:18 +00:00
|
|
|
task->data[13] += task->data[14];
|
2020-08-20 23:02:00 +01:00
|
|
|
PlaySE12WithPanning(SE_M_DIG, task->data[13]);
|
2018-11-25 23:00:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (--task->data[8] == 0)
|
|
|
|
{
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (task->data[11] == 0)
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-27 23:41:30 +00:00
|
|
|
static void CreateRolloutDirtSprite(struct Task *task)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
const struct SpriteTemplate *spriteTemplate;
|
2020-02-16 22:49:24 +00:00
|
|
|
int tileOffset;
|
2018-11-25 23:00:18 +00:00
|
|
|
u16 x, y;
|
|
|
|
u8 spriteId;
|
|
|
|
|
|
|
|
switch (task->data[1])
|
|
|
|
{
|
|
|
|
case 1:
|
2020-02-16 22:49:24 +00:00
|
|
|
spriteTemplate = &gRolloutMudSpriteTemplate;
|
|
|
|
tileOffset = 0;
|
2018-11-25 23:00:18 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 3:
|
2020-02-16 22:49:24 +00:00
|
|
|
spriteTemplate = &gRolloutRockSpriteTemplate;
|
|
|
|
tileOffset = 80;
|
2018-11-25 23:00:18 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2020-02-16 22:49:24 +00:00
|
|
|
spriteTemplate = &gRolloutRockSpriteTemplate;
|
|
|
|
tileOffset = 64;
|
2018-11-25 23:00:18 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2020-02-16 22:49:24 +00:00
|
|
|
spriteTemplate = &gRolloutRockSpriteTemplate;
|
|
|
|
tileOffset = 48;
|
2018-11-25 23:00:18 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = task->data[2] >> 3;
|
|
|
|
y = task->data[3] >> 3;
|
|
|
|
x += (task->data[12] * 4);
|
|
|
|
|
|
|
|
spriteId = CreateSprite(spriteTemplate, x, y, 35);
|
2018-11-26 20:54:51 +00:00
|
|
|
if (spriteId != MAX_SPRITES)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
gSprites[spriteId].data[0] = 18;
|
|
|
|
gSprites[spriteId].data[2] = ((task->data[12] * 20) + x) + (task->data[1] * 3);
|
|
|
|
gSprites[spriteId].data[4] = y;
|
|
|
|
gSprites[spriteId].data[5] = -16 - (task->data[1] * 2);
|
2020-02-16 22:49:24 +00:00
|
|
|
gSprites[spriteId].oam.tileNum += tileOffset;
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
InitAnimArcTranslation(&gSprites[spriteId]);
|
|
|
|
task->data[11]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
task->data[12] *= -1;
|
|
|
|
}
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
static void AnimRolloutParticle(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
2019-02-06 19:17:09 +00:00
|
|
|
if (TranslateAnimHorizontalArc(sprite))
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
2020-02-20 21:22:33 +00:00
|
|
|
u8 taskId = FindTaskIdByFunc(AnimTask_Rollout_Step);
|
2021-02-20 04:22:26 +00:00
|
|
|
if (taskId != TASK_NONE)
|
2018-11-25 23:00:18 +00:00
|
|
|
gTasks[taskId].data[11]--;
|
|
|
|
|
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
static u8 GetRolloutCounter(void)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
u8 retVal = gAnimDisableStructPtr->rolloutTimerStartValue - gAnimDisableStructPtr->rolloutTimer;
|
|
|
|
u8 var0 = retVal - 1;
|
|
|
|
if (var0 > 4)
|
|
|
|
retVal = 1;
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
|
2020-02-16 22:49:24 +00:00
|
|
|
static void AnimRockTomb(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
StartSpriteAnim(sprite, gBattleAnimArgs[4]);
|
|
|
|
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x2 = gBattleAnimArgs[0];
|
2018-11-25 23:00:18 +00:00
|
|
|
sprite->data[2] = gBattleAnimArgs[1];
|
|
|
|
sprite->data[3] -= gBattleAnimArgs[2];
|
|
|
|
sprite->data[0] = 3;
|
|
|
|
sprite->data[1] = gBattleAnimArgs[3];
|
2020-02-20 21:22:33 +00:00
|
|
|
sprite->callback = AnimRockTomb_Step;
|
|
|
|
sprite->invisible = TRUE;
|
2018-11-25 23:00:18 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 21:22:33 +00:00
|
|
|
static void AnimRockTomb_Step(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
2020-02-20 21:22:33 +00:00
|
|
|
sprite->invisible = FALSE;
|
2018-11-25 23:00:18 +00:00
|
|
|
if (sprite->data[3] != 0)
|
|
|
|
{
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->y2 = sprite->data[2] + sprite->data[3];
|
2018-11-25 23:00:18 +00:00
|
|
|
sprite->data[3] += sprite->data[0];
|
|
|
|
sprite->data[0]++;
|
|
|
|
if (sprite->data[3] > 0)
|
|
|
|
{
|
|
|
|
sprite->data[3] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (--sprite->data[1] == 0)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-21 18:19:54 +01:00
|
|
|
void AnimRockBlastRock(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
|
|
|
|
StartSpriteAffineAnim(sprite, 1);
|
|
|
|
|
|
|
|
TranslateAnimSpriteToTargetMonLocation(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 01:22:53 +00:00
|
|
|
static void AnimRockScatter(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
2021-11-08 16:46:38 +00:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x += gBattleAnimArgs[0];
|
|
|
|
sprite->y += gBattleAnimArgs[1];
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
sprite->data[1] = gBattleAnimArgs[0];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[1];
|
|
|
|
sprite->data[5] = gBattleAnimArgs[2];
|
|
|
|
|
|
|
|
StartSpriteAnim(sprite, gBattleAnimArgs[3]);
|
2020-02-20 21:22:33 +00:00
|
|
|
sprite->callback = AnimRockScatter_Step;
|
2018-11-25 23:00:18 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 21:22:33 +00:00
|
|
|
static void AnimRockScatter_Step(struct Sprite *sprite)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
sprite->data[0] += 8;
|
|
|
|
sprite->data[3] += sprite->data[1];
|
|
|
|
sprite->data[4] += sprite->data[2];
|
|
|
|
|
2021-07-07 14:11:52 +01:00
|
|
|
sprite->x2 += sprite->data[3] / 40;
|
|
|
|
sprite->y2 -= Sin(sprite->data[0], sprite->data[5]);
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
if (sprite->data[0] > 140)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_GetSeismicTossDamageLevel(u8 taskId)
|
|
|
|
{
|
|
|
|
if (gAnimMoveDmg < 33)
|
2020-02-19 18:13:28 +00:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = 0;
|
2018-11-25 23:00:18 +00:00
|
|
|
if ((u32)gAnimMoveDmg - 33 < 33)
|
2020-02-19 18:13:28 +00:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = 1;
|
2018-11-25 23:00:18 +00:00
|
|
|
if (gAnimMoveDmg > 65)
|
2020-02-19 18:13:28 +00:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = 2;
|
2018-11-25 23:00:18 +00:00
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 05:04:42 +00:00
|
|
|
void AnimTask_MoveSeismicTossBg(u8 taskId)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
if (gTasks[taskId].data[0] == 0)
|
|
|
|
{
|
2021-02-27 17:04:45 +00:00
|
|
|
UpdateAnimBg3ScreenSize(FALSE);
|
2018-11-25 23:00:18 +00:00
|
|
|
gTasks[taskId].data[1] = 200;
|
|
|
|
}
|
|
|
|
|
|
|
|
gBattle_BG3_Y += gTasks[taskId].data[1] / 10;
|
|
|
|
gTasks[taskId].data[1] -= 3;
|
|
|
|
|
|
|
|
if (gTasks[taskId].data[0] == 120)
|
|
|
|
{
|
2021-02-27 17:04:45 +00:00
|
|
|
UpdateAnimBg3ScreenSize(TRUE);
|
2018-11-25 23:00:18 +00:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
|
2020-02-20 05:04:42 +00:00
|
|
|
void AnimTask_SeismicTossBgAccelerateDownAtEnd(u8 taskId)
|
2018-11-25 23:00:18 +00:00
|
|
|
{
|
|
|
|
if (gTasks[taskId].data[0] == 0)
|
|
|
|
{
|
2021-02-27 17:04:45 +00:00
|
|
|
UpdateAnimBg3ScreenSize(FALSE);
|
2018-11-25 23:00:18 +00:00
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
gTasks[taskId].data[2] = gBattle_BG3_Y;
|
|
|
|
}
|
|
|
|
|
|
|
|
gTasks[taskId].data[1] += 80;
|
|
|
|
gTasks[taskId].data[1] &= 0xFF;
|
|
|
|
gBattle_BG3_Y = gTasks[taskId].data[2] + Cos(4, gTasks[taskId].data[1]);
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[7] == 0xFFF)
|
|
|
|
{
|
|
|
|
gBattle_BG3_Y = 0;
|
2021-02-27 17:04:45 +00:00
|
|
|
UpdateAnimBg3ScreenSize(TRUE);
|
2018-11-25 23:00:18 +00:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|