2018-10-25 02:01:40 +02:00
|
|
|
#include "global.h"
|
|
|
|
#include "battle_anim.h"
|
|
|
|
#include "constants/rgb.h"
|
2018-12-17 04:23:05 +01:00
|
|
|
#include "trig.h"
|
|
|
|
#include "constants/songs.h"
|
|
|
|
#include "sound.h"
|
2020-05-28 20:19:07 +02:00
|
|
|
#include "constants/moves.h"
|
2018-12-17 04:23:05 +01:00
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
static void AnimLightning(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimLightning_Step(struct Sprite *);
|
2018-12-17 04:23:05 +01:00
|
|
|
static void sub_810A214(struct Sprite *);
|
|
|
|
static void sub_810A258(struct Sprite *);
|
|
|
|
static void sub_810A274(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimZapCannonSpark_Step(struct Sprite *);
|
|
|
|
static void AnimThunderboltOrb(struct Sprite *);
|
|
|
|
static void AnimThunderboltOrb_Step(struct Sprite *);
|
|
|
|
static void AnimSparkElectricityFlashing_Step(struct Sprite *);
|
|
|
|
static void AnimElectricity(struct Sprite *);
|
|
|
|
static void AnimTask_ElectricBolt_Step(u8 taskId);
|
|
|
|
static void AnimElectricBoltSegment(struct Sprite *);
|
|
|
|
static void AnimThunderWave_Step(struct Sprite *);
|
2020-02-21 18:38:20 +01:00
|
|
|
static void AnimTask_ElectricChargingParticles_Step(u8 taskId);
|
|
|
|
static void AnimElectricChargingParticles(struct Sprite *);
|
|
|
|
static void AnimElectricChargingParticles_Step(struct Sprite *);
|
2020-02-20 02:22:53 +01:00
|
|
|
static void AnimVoltTackleOrbSlide(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimVoltTackleOrbSlide_Step(struct Sprite *);
|
2018-12-17 04:23:05 +01:00
|
|
|
static bool8 sub_810B154(struct Task *task, u8 taskId);
|
2020-02-21 18:38:20 +01:00
|
|
|
static void AnimVoltTackleBolt(struct Sprite *);
|
2018-12-17 04:23:05 +01:00
|
|
|
static bool8 sub_810B430(struct Task *task, u8 taskId);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimShockWaveProgressingBolt(struct Sprite *);
|
2018-12-22 20:04:00 +01:00
|
|
|
static bool8 sub_810B614(struct Task *task, u8 taskId);
|
|
|
|
static void sub_810B684(struct Sprite *sprite);
|
2018-10-25 02:01:40 +02:00
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_Lightning[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 5),
|
|
|
|
ANIMCMD_FRAME(16, 5),
|
|
|
|
ANIMCMD_FRAME(32, 8),
|
|
|
|
ANIMCMD_FRAME(48, 5),
|
|
|
|
ANIMCMD_FRAME(64, 5),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const sAnims_Lightning[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_Lightning,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
const struct SpriteTemplate gLightningSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_LIGHTNING,
|
|
|
|
.paletteTag = ANIM_TAG_LIGHTNING,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_Lightning,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-16 23:49:24 +01:00
|
|
|
.callback = AnimLightning,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd gUnknown_085956D8[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 20),
|
|
|
|
AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 60),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd *const gUnknown_085956F8[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
gUnknown_085956D8,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
// Unused
|
2018-10-25 02:01:40 +02:00
|
|
|
const struct SpriteTemplate gUnknown_085956FC =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_HANDS_AND_FEET,
|
|
|
|
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gUnknown_085956F8,
|
|
|
|
.callback = sub_810A214,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd gUnknown_08595714[] =
|
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_FRAME(80, 5),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const gUnknown_08595730[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
gUnknown_08595714,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
// Unused
|
2018-10-25 02:01:40 +02:00
|
|
|
const struct SpriteTemplate gUnknown_08595734 =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SHOCK,
|
|
|
|
.paletteTag = ANIM_TAG_SHOCK,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gUnknown_08595730,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = sub_810A274,
|
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gSparkElectricitySpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPARK_2,
|
|
|
|
.paletteTag = ANIM_TAG_SPARK_2,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 02:22:53 +01:00
|
|
|
.callback = AnimSparkElectricity,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gZapCannonBallSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_BLACK_BALL_2,
|
|
|
|
.paletteTag = ANIM_TAG_BLACK_BALL_2,
|
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,
|
|
|
|
.callback = TranslateAnimSpriteToTargetMonLocation,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd sAffineAnim_FlashingSpark[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x0, 0x0, 20, 1),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
const union AffineAnimCmd *const gAffineAnims_FlashingSpark[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAffineAnim_FlashingSpark,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gZapCannonSparkSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPARK_2,
|
|
|
|
.paletteTag = ANIM_TAG_SPARK_2,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2020-05-25 08:37:32 +02:00
|
|
|
.affineAnims = gAffineAnims_FlashingSpark,
|
2020-02-20 02:22:53 +01:00
|
|
|
.callback = AnimZapCannonSpark,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_ThunderboltOrb[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 6),
|
|
|
|
ANIMCMD_FRAME(16, 6),
|
|
|
|
ANIMCMD_FRAME(32, 6),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
const union AnimCmd *const gAnims_ThunderboltOrb[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_ThunderboltOrb,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd sAffineAnim_ThunderboltOrb[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0xE8, 0xE8, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0xFFF8, 0xFFF8, 0, 10),
|
|
|
|
AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 10),
|
|
|
|
AFFINEANIMCMD_JUMP(1),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd *const sAffineAnims_ThunderboltOrb[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAffineAnim_ThunderboltOrb,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gThunderboltOrbSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SHOCK_3,
|
|
|
|
.paletteTag = ANIM_TAG_SHOCK_3,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2020-05-25 08:37:32 +02:00
|
|
|
.anims = gAnims_ThunderboltOrb,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
2020-02-21 18:38:20 +01:00
|
|
|
.affineAnims = sAffineAnims_ThunderboltOrb,
|
2020-02-20 22:22:33 +01:00
|
|
|
.callback = AnimThunderboltOrb,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gSparkElectricityFlashingSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPARK_2,
|
|
|
|
.paletteTag = ANIM_TAG_SPARK_2,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2020-05-25 08:37:32 +02:00
|
|
|
.affineAnims = gAffineAnims_FlashingSpark,
|
2020-02-20 02:22:53 +01:00
|
|
|
.callback = AnimSparkElectricityFlashing,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const struct SpriteTemplate gElectricitySpriteTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPARK_2,
|
|
|
|
.paletteTag = ANIM_TAG_SPARK_2,
|
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-20 22:22:33 +01:00
|
|
|
.callback = AnimElectricity,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
const struct SpriteTemplate gElectricBoltSegmentSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPARK,
|
|
|
|
.paletteTag = ANIM_TAG_SPARK,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 22:22:33 +01:00
|
|
|
.callback = AnimElectricBoltSegment,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gThunderWaveSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPARK_H,
|
|
|
|
.paletteTag = ANIM_TAG_SPARK_H,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x16,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 02:22:53 +01:00
|
|
|
.callback = AnimThunderWave,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
const struct SpriteTemplate gAnchorShotChainTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_CHAIN_LINK,
|
|
|
|
.paletteTag = ANIM_TAG_CHAIN_LINK,
|
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x16,
|
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = AnimThunderWave
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const s8 sElectricChargingParticleCoordOffsets[][2] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
{ 58, -60},
|
|
|
|
{-56, -36},
|
|
|
|
{ 8, -56},
|
|
|
|
{-16, 56},
|
|
|
|
{ 58, -10},
|
|
|
|
{-58, 10},
|
|
|
|
{ 48, -18},
|
|
|
|
{-8, 56},
|
|
|
|
{ 16, -56},
|
|
|
|
{-58, -42},
|
|
|
|
{ 58, 30},
|
|
|
|
{-48, 40},
|
|
|
|
{ 12, -48},
|
|
|
|
{ 48, -12},
|
|
|
|
{-56, 18},
|
|
|
|
{ 48, 48},
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_ElectricChargingParticles_0[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(3, 1),
|
|
|
|
ANIMCMD_FRAME(2, 1),
|
|
|
|
ANIMCMD_FRAME(1, 1),
|
|
|
|
ANIMCMD_FRAME(0, 1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_ElectricChargingParticles_1[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 5),
|
|
|
|
ANIMCMD_FRAME(1, 5),
|
|
|
|
ANIMCMD_FRAME(2, 5),
|
|
|
|
ANIMCMD_FRAME(3, 5),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
const union AnimCmd *const gAnims_ElectricChargingParticles[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_ElectricChargingParticles_0,
|
|
|
|
sAnim_ElectricChargingParticles_1,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
const struct SpriteTemplate gElectricChargingParticlesSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ELECTRIC_ORBS,
|
|
|
|
.paletteTag = ANIM_TAG_ELECTRIC_ORBS,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2020-05-25 08:37:32 +02:00
|
|
|
.anims = gAnims_ElectricChargingParticles,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = SpriteCallbackDummy,
|
|
|
|
};
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
const struct SpriteTemplate gLightOfRuinGrayChargeTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ELECTRIC_ORBS,
|
|
|
|
.paletteTag = ANIM_TAG_GUST,
|
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
|
|
|
.anims = gAnims_ElectricChargingParticles,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = SpriteCallbackDummy
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd sAffineAnim_GrowingElectricOrb_0[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 60),
|
|
|
|
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
|
|
|
|
AFFINEANIMCMD_LOOP(0),
|
|
|
|
AFFINEANIMCMD_FRAME(0xFFFC, 0xFFFC, 0, 5),
|
|
|
|
AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 5),
|
|
|
|
AFFINEANIMCMD_LOOP(10),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd sAffineAnim_GrowingElectricOrb_1[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 30),
|
|
|
|
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0xFFFC, 0xFFFC, 0, 5),
|
|
|
|
AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 5),
|
|
|
|
AFFINEANIMCMD_JUMP(3),
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd sAffineAnim_GrowingElectricOrb_2[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 30),
|
|
|
|
AFFINEANIMCMD_FRAME(0xFFF8, 0xFFF8, 0, 30),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
const union AffineAnimCmd *const gAffineAnims_GrowingElectricOrb[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAffineAnim_GrowingElectricOrb_0,
|
|
|
|
sAffineAnim_GrowingElectricOrb_1,
|
|
|
|
sAffineAnim_GrowingElectricOrb_2,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
const struct SpriteTemplate gGrowingChargeOrbSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_CIRCLE_OF_LIGHT,
|
|
|
|
.paletteTag = ANIM_TAG_CIRCLE_OF_LIGHT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2020-05-25 08:37:32 +02:00
|
|
|
.affineAnims = gAffineAnims_GrowingElectricOrb,
|
2020-02-16 23:49:24 +01:00
|
|
|
.callback = AnimGrowingChargeOrb,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_ElectricPuff[] =
|
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_END,
|
|
|
|
};
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
const union AnimCmd *const gAnims_ElectricPuff[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_ElectricPuff,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
const struct SpriteTemplate gElectricPuffSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ELECTRICITY,
|
|
|
|
.paletteTag = ANIM_TAG_ELECTRICITY,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2020-05-25 08:37:32 +02:00
|
|
|
.anims = gAnims_ElectricPuff,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-14 22:05:43 +01:00
|
|
|
.callback = AnimElectricPuff,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
const struct SpriteTemplate gVoltTackleOrbSlideSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_CIRCLE_OF_LIGHT,
|
|
|
|
.paletteTag = ANIM_TAG_CIRCLE_OF_LIGHT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2020-05-25 08:37:32 +02:00
|
|
|
.affineAnims = gAffineAnims_GrowingElectricOrb,
|
2020-02-20 02:22:53 +01:00
|
|
|
.callback = AnimVoltTackleOrbSlide,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_VoltTackleBolt_0[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 3),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_VoltTackleBolt_1[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(2, 3),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_VoltTackleBolt_2[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(4, 3),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd sAnim_VoltTackleBolt_3[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(6, 3),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AnimCmd *const sAnims_VoltTackleBolt[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAnim_VoltTackleBolt_0,
|
|
|
|
sAnim_VoltTackleBolt_1,
|
|
|
|
sAnim_VoltTackleBolt_2,
|
|
|
|
sAnim_VoltTackleBolt_3,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd sAffineAnim_VoltTackleBolt[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x100, 0x100, 64, 0),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static const union AffineAnimCmd *const sAffineAnims_VoltTackleBolt[] =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
sAffineAnim_VoltTackleBolt,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
const struct SpriteTemplate gVoltTackleBoltSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPARK,
|
|
|
|
.paletteTag = ANIM_TAG_SPARK,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineDouble_ObjNormal_8x16,
|
2020-02-21 18:38:20 +01:00
|
|
|
.anims = sAnims_VoltTackleBolt,
|
2018-10-25 02:01:40 +02:00
|
|
|
.images = NULL,
|
2020-02-21 18:38:20 +01:00
|
|
|
.affineAnims = sAffineAnims_VoltTackleBolt,
|
|
|
|
.callback = AnimVoltTackleBolt,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
const struct SpriteTemplate gGrowingShockWaveOrbSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_CIRCLE_OF_LIGHT,
|
|
|
|
.paletteTag = ANIM_TAG_CIRCLE_OF_LIGHT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2020-05-25 08:37:32 +02:00
|
|
|
.affineAnims = gAffineAnims_GrowingElectricOrb,
|
2020-02-16 23:49:24 +01:00
|
|
|
.callback = AnimGrowingShockWaveOrb,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
const struct SpriteTemplate gShockWaveProgressingBoltSpriteTemplate =
|
2018-10-25 02:01:40 +02:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPARK,
|
|
|
|
.paletteTag = ANIM_TAG_SPARK,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-10-25 02:01:40 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 22:22:33 +01:00
|
|
|
.callback = AnimShockWaveProgressingBolt,
|
2018-10-25 02:01:40 +02:00
|
|
|
};
|
2018-12-17 04:23:05 +01:00
|
|
|
|
2020-05-04 06:09:03 +02:00
|
|
|
const struct SpriteTemplate gFlashCannonGrayChargeTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_CIRCLE_OF_LIGHT,
|
|
|
|
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
|
|
|
|
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
|
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2020-05-25 08:37:32 +02:00
|
|
|
.affineAnims = gAffineAnims_GrowingElectricOrb,
|
2020-05-04 06:09:03 +02:00
|
|
|
.callback = AnimGrowingChargeOrb
|
|
|
|
};
|
|
|
|
|
|
|
|
static const union AffineAnimCmd sSpriteAffineAnim_JudgmentBall[] =
|
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(16, 16, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(8, 8, 0, 15), //Half size
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 0, 120), //Delay
|
|
|
|
AFFINEANIMCMD_FRAME(24, 24, 0, 5), //Normal size
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 0, 10), //Delay
|
|
|
|
AFFINEANIMCMD_FRAME(-16, -16, 0, 15), //Revert to 1 px
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
static const union AffineAnimCmd* const sSpriteAffineAnimTable_JudgmentBall[] =
|
|
|
|
{
|
|
|
|
sSpriteAffineAnim_JudgmentBall,
|
|
|
|
};
|
|
|
|
const struct SpriteTemplate gJudgmentBlackChargeTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_CIRCLE_OF_LIGHT,
|
|
|
|
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
|
|
|
|
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
|
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = sSpriteAffineAnimTable_JudgmentBall,
|
|
|
|
.callback = AnimGrowingChargeOrb
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct SpriteTemplate gSeedFlareGreenChargeTemplate =
|
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_CIRCLE_OF_LIGHT,
|
|
|
|
.paletteTag = ANIM_TAG_LEAF,
|
|
|
|
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
|
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2020-05-25 08:37:32 +02:00
|
|
|
.affineAnims = gAffineAnims_GrowingElectricOrb,
|
2020-05-04 06:09:03 +02:00
|
|
|
.callback = AnimGrowingChargeOrb
|
|
|
|
};
|
|
|
|
|
|
|
|
// functions
|
2020-02-16 23:49:24 +01:00
|
|
|
static void AnimLightning(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
sprite->pos1.x -= gBattleAnimArgs[0];
|
|
|
|
else
|
|
|
|
sprite->pos1.x += gBattleAnimArgs[0];
|
2018-12-22 18:52:05 +01:00
|
|
|
|
2018-12-17 04:23:05 +01:00
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimLightning_Step;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimLightning_Step(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
if (sprite->animEnded)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_810A214(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
sprite->pos1.x -= gBattleAnimArgs[0];
|
|
|
|
else
|
|
|
|
sprite->pos1.x += gBattleAnimArgs[0];
|
2018-12-22 18:52:05 +01:00
|
|
|
|
2018-12-17 04:23:05 +01:00
|
|
|
sprite->callback = sub_810A258;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_810A258(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (sprite->affineAnimEnded)
|
2018-12-18 05:08:08 +01:00
|
|
|
DestroySpriteAndMatrix(sprite);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_810A274(struct Sprite *sprite)
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-22 18:52:05 +01:00
|
|
|
|
2018-12-17 04:23:05 +01:00
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
sprite->pos1.x -= gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y -= gBattleAnimArgs[1];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->pos1.x += gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
|
|
|
}
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->data[1] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[3];
|
|
|
|
sprite->data[3] = gBattleAnimArgs[4];
|
2018-12-18 05:08:08 +01:00
|
|
|
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
|
|
|
|
sprite->callback = TranslateSpriteInCircleOverDuration;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
void AnimSparkElectricity(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
u8 battler;
|
2018-12-17 04:23:05 +01:00
|
|
|
u32 matrixNum;
|
|
|
|
s16 sineVal;
|
|
|
|
|
|
|
|
switch (gBattleAnimArgs[4])
|
|
|
|
{
|
2020-02-20 02:22:53 +01:00
|
|
|
case ANIM_ATTACKER:
|
2018-12-18 05:08:08 +01:00
|
|
|
battler = gBattleAnimAttacker;
|
2018-12-17 04:23:05 +01:00
|
|
|
break;
|
2020-02-20 02:22:53 +01:00
|
|
|
case ANIM_TARGET:
|
2018-12-17 04:23:05 +01:00
|
|
|
default:
|
2018-12-18 05:08:08 +01:00
|
|
|
battler = gBattleAnimTarget;
|
2018-12-17 04:23:05 +01:00
|
|
|
break;
|
2020-02-20 02:22:53 +01:00
|
|
|
case ANIM_ATK_PARTNER:
|
2018-12-18 05:08:08 +01:00
|
|
|
if (!IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)))
|
|
|
|
battler = gBattleAnimAttacker;
|
2018-12-17 04:23:05 +01:00
|
|
|
else
|
2018-12-18 05:08:08 +01:00
|
|
|
battler = BATTLE_PARTNER(gBattleAnimAttacker);
|
2018-12-17 04:23:05 +01:00
|
|
|
break;
|
2020-02-20 02:22:53 +01:00
|
|
|
case ANIM_DEF_PARTNER:
|
2018-12-18 05:08:08 +01:00
|
|
|
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)))
|
|
|
|
battler = BATTLE_PARTNER(gBattleAnimTarget);
|
2018-12-17 04:23:05 +01:00
|
|
|
else
|
2018-12-18 05:08:08 +01:00
|
|
|
battler = gBattleAnimTarget;
|
2018-12-17 04:23:05 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[5] == 0)
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sprite->pos2.x = (gSineTable[gBattleAnimArgs[0]] * gBattleAnimArgs[1]) >> 8;
|
|
|
|
sprite->pos2.y = (gSineTable[gBattleAnimArgs[0] + 64] * gBattleAnimArgs[1]) >> 8;
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[6] & 1)
|
2018-12-20 04:13:26 +01:00
|
|
|
sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
matrixNum = sprite->oam.matrixNum;
|
|
|
|
sineVal = gSineTable[gBattleAnimArgs[2]];
|
|
|
|
|
|
|
|
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[gBattleAnimArgs[2] + 64];
|
|
|
|
gOamMatrices[matrixNum].b = sineVal;
|
|
|
|
gOamMatrices[matrixNum].c = -sineVal;
|
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[3];
|
2020-02-22 00:22:18 +01:00
|
|
|
sprite->callback = DestroyAnimSpriteAfterTimer;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
void AnimZapCannonSpark(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimAttacker(sprite, 1);
|
2018-12-17 04:23:05 +01:00
|
|
|
sprite->data[0] = gBattleAnimArgs[3];
|
|
|
|
sprite->data[1] = sprite->pos1.x;
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
2018-12-17 04:23:05 +01:00
|
|
|
sprite->data[3] = sprite->pos1.y;
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
InitAnimLinearTranslation(sprite);
|
|
|
|
sprite->data[5] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[6] = gBattleAnimArgs[5];
|
|
|
|
sprite->data[7] = gBattleAnimArgs[4];
|
|
|
|
sprite->oam.tileNum += gBattleAnimArgs[6] * 4;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimZapCannonSpark_Step;
|
|
|
|
AnimZapCannonSpark_Step(sprite);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimZapCannonSpark_Step(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2018-12-20 04:13:26 +01:00
|
|
|
if (!AnimTranslateLinear(sprite))
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
sprite->pos2.x += Sin(sprite->data[7], sprite->data[5]);
|
|
|
|
sprite->pos2.y += Cos(sprite->data[7], sprite->data[5]);
|
|
|
|
sprite->data[7] = (sprite->data[7] + sprite->data[6]) & 0xFF;
|
|
|
|
if(!(sprite->data[7] % 3))
|
|
|
|
sprite->invisible ^= 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimThunderboltOrb_Step(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
if (--sprite->data[5] == -1)
|
|
|
|
{
|
|
|
|
sprite->invisible ^= 1;
|
|
|
|
sprite->data[5] = sprite->data[4];
|
|
|
|
}
|
|
|
|
if (sprite->data[3]-- <= 0)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimThunderboltOrb(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
if (IsContest() || GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
|
|
|
|
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
2018-12-22 18:52:05 +01:00
|
|
|
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[1];
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
|
2018-12-17 04:23:05 +01:00
|
|
|
sprite->data[3] = gBattleAnimArgs[0];
|
|
|
|
sprite->data[4] = gBattleAnimArgs[3];
|
|
|
|
sprite->data[5] = gBattleAnimArgs[3];
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimThunderboltOrb_Step;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
void AnimSparkElectricityFlashing(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
u8 battler;
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[3];
|
|
|
|
if (gBattleAnimArgs[7] & 0x8000)
|
2018-12-18 05:08:08 +01:00
|
|
|
battler = gBattleAnimTarget;
|
2018-12-17 04:23:05 +01:00
|
|
|
else
|
2018-12-18 05:08:08 +01:00
|
|
|
battler = gBattleAnimAttacker;
|
2018-12-17 04:23:05 +01:00
|
|
|
|
2018-12-18 05:08:08 +01:00
|
|
|
if (IsContest() || GetBattlerSide(battler) == B_SIDE_PLAYER)
|
2018-12-17 04:23:05 +01:00
|
|
|
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
|
|
|
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2) + gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[1];
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
sprite->data[4] = gBattleAnimArgs[7] & 0x7FFF;
|
|
|
|
sprite->data[5] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[6] = gBattleAnimArgs[5];
|
|
|
|
sprite->data[7] = gBattleAnimArgs[4];
|
|
|
|
|
|
|
|
sprite->oam.tileNum += gBattleAnimArgs[6] * 4;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimSparkElectricityFlashing_Step;
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->callback(sprite);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSparkElectricityFlashing_Step(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
sprite->pos2.x = Sin(sprite->data[7], sprite->data[5]);
|
|
|
|
sprite->pos2.y = Cos(sprite->data[7], sprite->data[5]);
|
|
|
|
|
|
|
|
sprite->data[7] = (sprite->data[7] + sprite->data[6]) & 0xFF;
|
|
|
|
if (sprite->data[7] % sprite->data[4] == 0)
|
2020-02-20 02:22:53 +01:00
|
|
|
sprite->invisible ^= TRUE;
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
if (sprite->data[0]-- <= 0)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
// Electricity arcs around the target. Used for Paralysis and various electric move hits
|
|
|
|
static void AnimElectricity(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimTarget(sprite, FALSE);
|
2018-12-17 04:23:05 +01:00
|
|
|
sprite->oam.tileNum += gBattleAnimArgs[3] * 4;
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[3] == 1)
|
2019-08-10 18:09:06 +02:00
|
|
|
sprite->oam.matrixNum = ST_OAM_HFLIP;
|
2018-12-17 04:23:05 +01:00
|
|
|
else if (gBattleAnimArgs[3] == 2)
|
2019-08-10 18:09:06 +02:00
|
|
|
sprite->oam.matrixNum = ST_OAM_VFLIP;
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[2];
|
|
|
|
sprite->callback = WaitAnimForDuration;
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
// The vertical falling thunder bolt used in Thunder Wave/Shock/Bolt
|
|
|
|
void AnimTask_ElectricBolt(u8 taskId)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].data[0] = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[0];
|
|
|
|
gTasks[taskId].data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[1];
|
|
|
|
gTasks[taskId].data[2] = gBattleAnimArgs[2];
|
2020-02-20 22:22:33 +01:00
|
|
|
gTasks[taskId].func = AnimTask_ElectricBolt_Step;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_ElectricBolt_Step(u8 taskId)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
u16 r8;
|
2018-12-22 18:52:05 +01:00
|
|
|
u16 r2;
|
2018-12-17 04:23:05 +01:00
|
|
|
s16 r12;
|
|
|
|
u8 spriteId = 0;
|
|
|
|
u8 r7 = 0;
|
|
|
|
u8 sp = gTasks[taskId].data[2];
|
2018-12-22 18:52:05 +01:00
|
|
|
s16 x = gTasks[taskId].data[0];
|
|
|
|
s16 y = gTasks[taskId].data[1];
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
if (!gTasks[taskId].data[2])
|
|
|
|
{
|
|
|
|
r8 = 0;
|
|
|
|
r2 = 1;
|
|
|
|
r12 = 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
r12 = 16;
|
|
|
|
r8 = 8;
|
|
|
|
r2 = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (gTasks[taskId].data[10])
|
|
|
|
{
|
|
|
|
case 0:
|
2018-12-22 18:52:05 +01:00
|
|
|
r12 *= 1;
|
2020-02-20 22:22:33 +01:00
|
|
|
spriteId = CreateSprite(&gElectricBoltSegmentSpriteTemplate, x, y + r12, 2);
|
2018-12-17 04:23:05 +01:00
|
|
|
r7++;
|
|
|
|
break;
|
|
|
|
case 2:
|
2018-12-22 18:52:05 +01:00
|
|
|
r12 *= 2;
|
2018-12-17 04:23:05 +01:00
|
|
|
r8 += r2;
|
2020-02-20 22:22:33 +01:00
|
|
|
spriteId = CreateSprite(&gElectricBoltSegmentSpriteTemplate, x, y + r12, 2);
|
2018-12-17 04:23:05 +01:00
|
|
|
r7++;
|
|
|
|
break;
|
|
|
|
case 4:
|
2018-12-22 18:52:05 +01:00
|
|
|
r12 *= 3;
|
2018-12-17 04:23:05 +01:00
|
|
|
r8 += r2 * 2;
|
2020-02-20 22:22:33 +01:00
|
|
|
spriteId = CreateSprite(&gElectricBoltSegmentSpriteTemplate, x, y + r12, 2);
|
2018-12-17 04:23:05 +01:00
|
|
|
r7++;
|
|
|
|
break;
|
|
|
|
case 6:
|
2018-12-22 18:52:05 +01:00
|
|
|
r12 *= 4;
|
2018-12-17 04:23:05 +01:00
|
|
|
r8 += r2 * 3;
|
2020-02-20 22:22:33 +01:00
|
|
|
spriteId = CreateSprite(&gElectricBoltSegmentSpriteTemplate, x, y + r12, 2);
|
2018-12-17 04:23:05 +01:00
|
|
|
r7++;
|
|
|
|
break;
|
|
|
|
case 8:
|
2018-12-22 18:52:05 +01:00
|
|
|
r12 *= 5;
|
2020-02-20 22:22:33 +01:00
|
|
|
spriteId = CreateSprite(&gElectricBoltSegmentSpriteTemplate, x, y + r12, 2);
|
2018-12-17 04:23:05 +01:00
|
|
|
r7++;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (r7)
|
|
|
|
{
|
|
|
|
gSprites[spriteId].oam.tileNum += r8;
|
|
|
|
gSprites[spriteId].data[0] = sp;
|
|
|
|
gSprites[spriteId].callback(&gSprites[spriteId]);
|
|
|
|
}
|
|
|
|
|
|
|
|
gTasks[taskId].data[10]++;
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimElectricBoltSegment(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
if (!sprite->data[0])
|
|
|
|
{
|
2019-12-05 03:00:45 +01:00
|
|
|
sprite->oam.shape = SPRITE_SHAPE(8x16);
|
|
|
|
sprite->oam.size = SPRITE_SIZE(8x16);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-12-05 03:00:45 +01:00
|
|
|
sprite->oam.shape = SPRITE_SHAPE(16x16);
|
|
|
|
sprite->oam.size = SPRITE_SIZE(16x16);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
if (++sprite->data[1] == 15)
|
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
// The horizontal bands of electricity used in Thunder Wave
|
2020-05-25 08:37:32 +02:00
|
|
|
void AnimThunderWave(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
u8 spriteId;
|
|
|
|
|
|
|
|
sprite->pos1.x += gBattleAnimArgs[0];
|
|
|
|
sprite->pos1.y += gBattleAnimArgs[1];
|
2020-05-28 20:19:07 +02:00
|
|
|
if (gAnimMoveIndex == MOVE_ANCHOR_SHOT)
|
2020-05-25 08:37:32 +02:00
|
|
|
spriteId = CreateSprite(&gAnchorShotChainTemplate, sprite->pos1.x + 32, sprite->pos1.y, sprite->subpriority);
|
|
|
|
else
|
|
|
|
spriteId = CreateSprite(&gThunderWaveSpriteTemplate, sprite->pos1.x + 32, sprite->pos1.y, sprite->subpriority);
|
|
|
|
|
2018-12-17 04:23:05 +01:00
|
|
|
gSprites[spriteId].oam.tileNum += 8;
|
|
|
|
gAnimVisualTaskCount++;
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[spriteId].callback = AnimThunderWave_Step;
|
|
|
|
sprite->callback = AnimThunderWave_Step;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimThunderWave_Step(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
if (++sprite->data[0] == 3)
|
|
|
|
{
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->invisible ^= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++sprite->data[1] == 51)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
// Animates small electric orbs moving from around the battler inward. For Charge/Shock Wave
|
|
|
|
void AnimTask_ElectricChargingParticles(u8 taskId)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
task->data[14] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
task->data[15] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
task->data[14] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
|
|
|
task->data[15] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
task->data[6] = gBattleAnimArgs[1];
|
|
|
|
task->data[7] = 0;
|
|
|
|
task->data[8] = 0;
|
|
|
|
task->data[9] = 0;
|
|
|
|
task->data[10] = 0;
|
|
|
|
task->data[11] = gBattleAnimArgs[3];
|
|
|
|
task->data[12] = 0;
|
|
|
|
task->data[13] = gBattleAnimArgs[2];
|
2020-02-21 18:38:20 +01:00
|
|
|
task->func = AnimTask_ElectricChargingParticles_Step;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static void AnimTask_ElectricChargingParticles_Step(u8 taskId)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
if (task->data[6])
|
|
|
|
{
|
|
|
|
if (++task->data[12] > task->data[13])
|
|
|
|
{
|
|
|
|
u8 spriteId;
|
|
|
|
task->data[12] = 0;
|
2020-05-28 20:19:07 +02:00
|
|
|
if (gAnimMoveIndex == MOVE_FLASH_CANNON || gAnimMoveIndex == MOVE_STEEL_BEAM)
|
2020-05-25 08:37:32 +02:00
|
|
|
spriteId = CreateSprite(&gLightOfRuinGrayChargeTemplate, task->data[14], task->data[15], 2);
|
|
|
|
else
|
|
|
|
spriteId = CreateSprite(&gElectricChargingParticlesSpriteTemplate, task->data[14], task->data[15], 2);
|
|
|
|
|
2018-12-17 04:23:05 +01:00
|
|
|
if (spriteId != MAX_SPRITES)
|
|
|
|
{
|
|
|
|
struct Sprite *sprite = &gSprites[spriteId];
|
2020-02-21 18:38:20 +01:00
|
|
|
sprite->pos1.x += sElectricChargingParticleCoordOffsets[task->data[9]][0];
|
|
|
|
sprite->pos1.y += sElectricChargingParticleCoordOffsets[task->data[9]][1];
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
sprite->data[0] = 40 - task->data[8] * 5;
|
|
|
|
sprite->data[1] = sprite->pos1.x;
|
|
|
|
sprite->data[2] = task->data[14];
|
|
|
|
sprite->data[3] = sprite->pos1.y;
|
|
|
|
sprite->data[4] = task->data[15];
|
|
|
|
sprite->data[5] = taskId;
|
|
|
|
|
|
|
|
InitAnimLinearTranslation(sprite);
|
2020-02-21 18:38:20 +01:00
|
|
|
StoreSpriteCallbackInData6(sprite, AnimElectricChargingParticles);
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->callback = RunStoredCallbackWhenAnimEnds;
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
if (++task->data[9] > 15)
|
|
|
|
task->data[9] = 0;
|
|
|
|
|
|
|
|
if (++task->data[10] >= task->data[11])
|
|
|
|
{
|
|
|
|
task->data[10] = 0;
|
|
|
|
if (task->data[8] <= 5)
|
|
|
|
task->data[8]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
task->data[7]++;
|
|
|
|
task->data[6]--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(task->data[7] == 0)
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static void AnimElectricChargingParticles_Step(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2018-12-20 04:13:26 +01:00
|
|
|
if (AnimTranslateLinear(sprite))
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
gTasks[sprite->data[5]].data[7]--;
|
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static void AnimElectricChargingParticles(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
StartSpriteAnim(sprite, 1);
|
2020-02-21 18:38:20 +01:00
|
|
|
sprite->callback = AnimElectricChargingParticles_Step;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
void AnimGrowingChargeOrb(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2020-02-14 22:05:43 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2018-12-18 05:08:08 +01:00
|
|
|
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
|
|
|
|
sprite->callback = RunStoredCallbackWhenAffineAnimEnds;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
// The quick electric burst at the end of Charge / during the Volt Tackle hit
|
2020-05-25 08:37:32 +02:00
|
|
|
void AnimElectricPuff(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2020-02-14 22:05:43 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sprite->pos2.x = gBattleAnimArgs[1];
|
|
|
|
sprite->pos2.y = gBattleAnimArgs[2];
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->callback = RunStoredCallbackWhenAnimEnds;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 05:13:54 +01:00
|
|
|
// Creates an orb of electricity that grows then slides off-screen. The attacker slides with it
|
2020-02-20 02:22:53 +01:00
|
|
|
static void AnimVoltTackleOrbSlide(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
StartSpriteAffineAnim(sprite, 1);
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2020-02-20 02:22:53 +01:00
|
|
|
sprite->data[6] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
2018-12-17 04:23:05 +01:00
|
|
|
sprite->data[7] = 16;
|
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
|
|
|
|
sprite->data[7] *= -1;
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimVoltTackleOrbSlide_Step;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimVoltTackleOrbSlide_Step(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (++sprite->data[1] > 40)
|
|
|
|
sprite->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sprite->pos1.x += sprite->data[7];
|
|
|
|
gSprites[sprite->data[6]].pos2.x += sprite->data[7];
|
|
|
|
if ((u16)(sprite->pos1.x + 80) > 400)
|
2018-12-18 05:08:08 +01:00
|
|
|
DestroySpriteAndMatrix(sprite);
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
void AnimTask_VoltTackleAttackerReappear(u8 taskId)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2020-02-20 02:22:53 +01:00
|
|
|
task->data[15] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
2018-12-18 05:08:08 +01:00
|
|
|
task->data[14] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
2018-12-17 04:23:05 +01:00
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
task->data[14] = -32;
|
|
|
|
task->data[13] = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[14] = 32;
|
|
|
|
task->data[13] = -2;
|
|
|
|
}
|
|
|
|
|
|
|
|
gSprites[task->data[15]].pos2.x = task->data[14];
|
|
|
|
task->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
gSprites[task->data[15]].invisible ^= 1;
|
|
|
|
|
|
|
|
if (task->data[14])
|
|
|
|
{
|
|
|
|
task->data[14] += task->data[13];
|
|
|
|
gSprites[task->data[15]].pos2.x = task->data[14];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
task->data[0]++;
|
2018-12-22 18:52:05 +01:00
|
|
|
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
gSprites[task->data[15]].invisible ^= 1;
|
|
|
|
|
|
|
|
if (++task->data[2] == 8)
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[task->data[15]].invisible = FALSE;
|
2018-12-17 04:23:05 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 02:22:53 +01:00
|
|
|
// The horizontal bolts of electricity for Volt Tackle
|
|
|
|
void AnimTask_VoltTackleBolt(u8 taskId)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch(task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
task->data[1] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1;
|
|
|
|
|
|
|
|
switch (gBattleAnimArgs[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2018-12-18 05:08:08 +01:00
|
|
|
task->data[3] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
task->data[5] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
task->data[4] = (task->data[1] * 128) + 120;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
task->data[3] = 120 - (task->data[1] * 128);
|
2018-12-18 05:08:08 +01:00
|
|
|
task->data[5] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
|
|
|
task->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) - (task->data[1] * 32);
|
2018-12-17 04:23:05 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if ((gBattleAnimArgs[0] & 1) != 0)
|
|
|
|
{
|
|
|
|
task->data[3] = 256;
|
|
|
|
task->data[4] = -16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[3] = -16;
|
|
|
|
task->data[4] = 256;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (task->data[1] == 1)
|
|
|
|
{
|
|
|
|
task->data[5] = 80 - gBattleAnimArgs[0] * 10;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
u16 temp;
|
|
|
|
task->data[5] = gBattleAnimArgs[0] * 10 + 40;
|
|
|
|
temp = task->data[3];
|
|
|
|
task->data[3] = task->data[4];
|
|
|
|
task->data[4] = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (task->data[3] < task->data[4])
|
|
|
|
{
|
|
|
|
task->data[1] = 1;
|
|
|
|
task->data[6] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[1] = -1;
|
|
|
|
task->data[6] = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
task->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++task->data[2] > 0)
|
|
|
|
{
|
|
|
|
task->data[2] = 0;
|
|
|
|
if (sub_810B154(task, taskId) || sub_810B154(task, taskId))
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (task->data[7] == 0)
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 sub_810B154(struct Task *task, u8 taskId)
|
|
|
|
{
|
2020-02-21 18:38:20 +01:00
|
|
|
u8 spriteId = CreateSprite(&gVoltTackleBoltSpriteTemplate, task->data[3], task->data[5], 35);
|
2018-12-17 04:23:05 +01:00
|
|
|
if (spriteId != MAX_SPRITES)
|
|
|
|
{
|
|
|
|
gSprites[spriteId].data[6] = taskId;
|
|
|
|
gSprites[spriteId].data[7] = 7;
|
|
|
|
task->data[7]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
task->data[6] += task->data[1];
|
|
|
|
if (task->data[6] < 0)
|
|
|
|
task->data[6] = 3;
|
|
|
|
|
|
|
|
if (task->data[6] > 3)
|
|
|
|
task->data[6] = 0;
|
|
|
|
|
|
|
|
task->data[3] += task->data[1] * 16;
|
|
|
|
|
|
|
|
if ((task->data[1] == 1 && task->data[3] >= task->data[4])
|
|
|
|
|| (task->data[1] == -1 && task->data[3] <= task->data[4]))
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
static void AnimVoltTackleBolt(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
if (++sprite->data[0] > 12)
|
|
|
|
{
|
|
|
|
gTasks[sprite->data[6]].data[sprite->data[7]]--;
|
|
|
|
FreeOamMatrix(sprite->oam.matrixNum);
|
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-25 08:37:32 +02:00
|
|
|
void AnimGrowingShockWaveOrb(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2018-12-18 05:08:08 +01:00
|
|
|
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
StartSpriteAffineAnim(sprite, 2);
|
|
|
|
sprite->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (sprite->affineAnimEnded)
|
2018-12-18 05:08:08 +01:00
|
|
|
DestroySpriteAndMatrix(sprite);
|
2018-12-22 18:52:05 +01:00
|
|
|
break;
|
2018-12-17 04:23:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
// Thin bolt of electricity that moves up and down toward the target. Used by Shock Wave
|
|
|
|
void AnimTask_ShockWaveProgressingBolt(u8 taskId)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
2019-04-08 16:48:04 +02:00
|
|
|
u8 target = GetAnimBattlerId(gBattleAnimArgs[0]);
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2018-12-18 05:08:08 +01:00
|
|
|
task->data[6] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
task->data[7] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-17 04:23:05 +01:00
|
|
|
task->data[8] = 4;
|
2019-04-08 16:48:04 +02:00
|
|
|
task->data[10] = GetBattlerSpriteCoord(target, BATTLER_COORD_X_2);
|
2018-12-17 04:23:05 +01:00
|
|
|
task->data[9] = (task->data[10] - task->data[6]) / 5;
|
|
|
|
task->data[4] = 7;
|
|
|
|
task->data[5] = -1;
|
|
|
|
task->data[11] = 12;
|
|
|
|
task->data[12] = BattleAnimAdjustPanning(task->data[11] - 76);
|
|
|
|
task->data[13] = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
|
|
|
|
task->data[14] = task->data[12];
|
|
|
|
task->data[15] = (task->data[13] - task->data[12]) / 3;
|
|
|
|
task->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++task->data[1] > 0)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
if (sub_810B430(task, taskId))
|
|
|
|
{
|
|
|
|
if (task->data[2] == 5)
|
|
|
|
task->data[0] = 3;
|
|
|
|
else
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (task->data[11])
|
|
|
|
task->data[11]--;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (task->data[11])
|
|
|
|
task->data[11]--;
|
|
|
|
|
|
|
|
if (++task->data[1] > 4)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
if (task->data[2] & 1)
|
|
|
|
{
|
|
|
|
task->data[7] = 4;
|
|
|
|
task->data[8] = 68;
|
|
|
|
task->data[4] = 0;
|
|
|
|
task->data[5] = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[7] = 68;
|
|
|
|
task->data[8] = 4;
|
|
|
|
task->data[4] = 7;
|
|
|
|
task->data[5] = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (task->data[11])
|
|
|
|
task->data[0] = 4;
|
|
|
|
else
|
|
|
|
task->data[0] = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (task->data[3] == 0)
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (task->data[11])
|
|
|
|
task->data[11]--;
|
|
|
|
else
|
|
|
|
task->data[0] = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 sub_810B430(struct Task *task, u8 taskId)
|
|
|
|
{
|
2020-02-16 23:49:24 +01:00
|
|
|
u8 spriteId = CreateSprite(&gShockWaveProgressingBoltSpriteTemplate, task->data[6], task->data[7], 35);
|
2018-12-17 04:23:05 +01:00
|
|
|
if (spriteId != MAX_SPRITES)
|
|
|
|
{
|
|
|
|
gSprites[spriteId].oam.tileNum += task->data[4];
|
|
|
|
task->data[4] += task->data[5];
|
|
|
|
if (task->data[4] < 0)
|
|
|
|
task->data[4] = 7;
|
|
|
|
if (task->data[4] > 7)
|
|
|
|
task->data[4] = 0;
|
|
|
|
|
|
|
|
gSprites[spriteId].data[6] = taskId;
|
|
|
|
gSprites[spriteId].data[7] = 3;
|
|
|
|
task->data[3]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (task->data[4] == 0 && task->data[5] > 0)
|
|
|
|
{
|
|
|
|
task->data[14] += task->data[15];
|
|
|
|
PlaySE12WithPanning(SE_W085, task->data[14]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((task->data[5] < 0 && task->data[7] <= task->data[8])
|
|
|
|
|| (task->data[5] > 0 && task->data[7] >= task->data[8]))
|
|
|
|
{
|
|
|
|
task->data[2]++;
|
|
|
|
task->data[6] += task->data[9];
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[7] += task->data[5] * 8;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
// Just runs timer for sprite. See AnimTask_ShockWaveProgressingBolt
|
|
|
|
static void AnimShockWaveProgressingBolt(struct Sprite *sprite)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
if (++sprite->data[0] > 12)
|
|
|
|
{
|
|
|
|
gTasks[sprite->data[6]].data[sprite->data[7]]--;
|
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
void AnimTask_ShockWaveLightning(u8 taskId)
|
2018-12-17 04:23:05 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
2019-04-08 16:48:04 +02:00
|
|
|
u8 target = GetAnimBattlerId(gBattleAnimArgs[0]);
|
2018-12-17 04:23:05 +01:00
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2019-04-08 16:48:04 +02:00
|
|
|
task->data[15] = GetBattlerSpriteCoord(target, BATTLER_COORD_Y) + 32;
|
2018-12-17 04:23:05 +01:00
|
|
|
task->data[14] = task->data[15];
|
|
|
|
while (task->data[14] > 16)
|
|
|
|
{
|
|
|
|
task->data[14] -= 32;
|
|
|
|
}
|
|
|
|
|
2019-04-08 16:48:04 +02:00
|
|
|
task->data[13] = GetBattlerSpriteCoord(target, BATTLER_COORD_X_2);
|
|
|
|
task->data[12] = GetBattlerSpriteSubpriority(target) - 2;
|
2018-12-17 04:23:05 +01:00
|
|
|
task->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
if (sub_810B614(task, taskId))
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (task->data[10] == 0)
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-12-22 20:04:00 +01:00
|
|
|
|
|
|
|
bool8 sub_810B614(struct Task *task, u8 taskId)
|
|
|
|
{
|
2020-02-16 23:49:24 +01:00
|
|
|
u8 spriteId = CreateSprite(&gLightningSpriteTemplate, task->data[13], task->data[14], task->data[12]);
|
2018-12-22 20:04:00 +01:00
|
|
|
if (spriteId != MAX_SPRITES)
|
|
|
|
{
|
|
|
|
gSprites[spriteId].callback = sub_810B684;
|
|
|
|
gSprites[spriteId].data[6] = taskId;
|
|
|
|
gSprites[spriteId].data[7] = 10;
|
|
|
|
task->data[10]++;
|
|
|
|
}
|
|
|
|
if (task->data[14] >= task->data[15])
|
|
|
|
return TRUE;
|
|
|
|
task->data[14] += 32;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_810B684(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (sprite->animEnded)
|
|
|
|
{
|
|
|
|
gTasks[sprite->data[6]].data[sprite->data[7]]--;
|
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
2018-12-23 08:37:00 +01:00
|
|
|
}
|