2018-12-19 02:03:26 +01:00
|
|
|
#include "global.h"
|
2019-09-09 03:07:54 +02:00
|
|
|
#include "malloc.h"
|
2018-12-19 02:03:26 +01:00
|
|
|
#include "battle.h"
|
|
|
|
#include "battle_anim.h"
|
|
|
|
#include "bg.h"
|
|
|
|
#include "contest.h"
|
2019-04-04 23:53:06 +02:00
|
|
|
#include "data.h"
|
2018-12-19 02:03:26 +01:00
|
|
|
#include "decompress.h"
|
|
|
|
#include "dma3.h"
|
|
|
|
#include "gpu_regs.h"
|
|
|
|
#include "graphics.h"
|
|
|
|
#include "palette.h"
|
|
|
|
#include "pokemon_icon.h"
|
|
|
|
#include "random.h"
|
|
|
|
#include "scanline_effect.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "sprite.h"
|
|
|
|
#include "task.h"
|
|
|
|
#include "trig.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "constants/battle_anim.h"
|
|
|
|
#include "constants/rgb.h"
|
|
|
|
#include "constants/songs.h"
|
2018-12-29 18:07:46 +01:00
|
|
|
#include "constants/weather.h"
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2019-10-16 19:10:39 +02:00
|
|
|
extern const struct SpriteTemplate gThoughtBubbleSpriteTemplate;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimBlackSmoke(struct Sprite *);
|
|
|
|
static void AnimBlackSmoke_Step(struct Sprite *);
|
|
|
|
static void AnimWhiteHalo(struct Sprite *);
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimWhiteHalo_Step1(struct Sprite *);
|
|
|
|
static void AnimWhiteHalo_Step2(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTealAlert(struct Sprite *);
|
|
|
|
static void AnimMeanLookEye(struct Sprite *);
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimMeanLookEye_Step1(struct Sprite *);
|
|
|
|
static void AnimMeanLookEye_Step2(struct Sprite *);
|
|
|
|
static void AnimMeanLookEye_Step3(struct Sprite *);
|
|
|
|
static void AnimMeanLookEye_Step4(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSpikes(struct Sprite *);
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimSpikes_Step1(struct Sprite *);
|
|
|
|
static void AnimSpikes_Step2(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimLeer(struct Sprite *);
|
|
|
|
static void AnimLetterZ(struct Sprite *);
|
|
|
|
static void AnimFang(struct Sprite *);
|
|
|
|
static void AnimSpotlight(struct Sprite *);
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimSpotlight_Step1(struct Sprite *);
|
|
|
|
static void AnimSpotlight_Step2(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimClappingHand(struct Sprite *);
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimClappingHand_Step(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimClappingHand2(struct Sprite *);
|
|
|
|
static void AnimRapidSpin(struct Sprite *);
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimRapidSpin_Step(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTriAttackTriangle(struct Sprite *);
|
|
|
|
static void AnimBatonPassPokeball(struct Sprite *);
|
|
|
|
static void AnimWishStar(struct Sprite *);
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimWishStar_Step(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimMiniTwinklingStar(struct Sprite *);
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimMiniTwinklingStar_Step(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSwallowBlueOrb(struct Sprite *);
|
|
|
|
static void AnimGreenStar(struct Sprite *);
|
2019-10-21 18:36:45 +02:00
|
|
|
static void AnimGreenStar_Step1(struct Sprite *);
|
|
|
|
static void AnimGreenStar_Step2(struct Sprite *);
|
|
|
|
static void AnimGreenStar_Callback(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimWeakFrustrationAngerMark(struct Sprite *);
|
|
|
|
static void AnimSweetScentPetal(struct Sprite *);
|
|
|
|
static void AnimSweetScentPetal_Step(struct Sprite *);
|
|
|
|
static void AnimPainSplitProjectile(struct Sprite *);
|
|
|
|
static void AnimFlatterConfetti(struct Sprite *);
|
|
|
|
static void AnimFlatterConfetti_Step(struct Sprite *);
|
|
|
|
static void AnimFlatterSpotlight(struct Sprite *);
|
|
|
|
static void AnimFlatterSpotlight_Step(struct Sprite *);
|
|
|
|
static void AnimReversalOrb(struct Sprite *);
|
|
|
|
static void AnimReversalOrb_Step(struct Sprite *);
|
|
|
|
static void AnimYawnCloud(struct Sprite *);
|
|
|
|
static void AnimYawnCloud_Step(struct Sprite *);
|
|
|
|
static void AnimSmokeBallEscapeCloud(struct Sprite *);
|
|
|
|
static void AnimFacadeSweatDrop(struct Sprite *);
|
|
|
|
static void AnimRoarNoiseLine(struct Sprite *);
|
|
|
|
static void AnimRoarNoiseLine_Step(struct Sprite *);
|
|
|
|
static void AnimGlareEyeDot(struct Sprite *);
|
|
|
|
static void AnimAssistPawprint(struct Sprite *);
|
|
|
|
static void AnimSmellingSaltsHand(struct Sprite *);
|
|
|
|
static void AnimSmellingSaltsHand_Step(struct Sprite *);
|
|
|
|
static void AnimSmellingSaltExclamation(struct Sprite *);
|
|
|
|
static void AnimSmellingSaltExclamation_Step(struct Sprite *);
|
|
|
|
static void AnimHelpingHandClap(struct Sprite *);
|
|
|
|
static void AnimHelpingHandClap_Step(struct Sprite *);
|
|
|
|
static void AnimForesightMagnifyingGlass(struct Sprite *);
|
|
|
|
static void AnimForesightMagnifyingGlass_Step(struct Sprite *);
|
|
|
|
static void AnimMeteorMashStar(struct Sprite *);
|
|
|
|
static void AnimMeteorMashStar_Step(struct Sprite *sprite);
|
|
|
|
static void AnimBlockX(struct Sprite *);
|
|
|
|
static void AnimBlockX_Step(struct Sprite *);
|
2021-04-13 09:28:03 +02:00
|
|
|
static void AnimUnusedItemBagSteal(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimKnockOffStrike(struct Sprite *);
|
|
|
|
static void AnimKnockOffStrike_Step(struct Sprite *sprite);
|
|
|
|
static void AnimRecycle(struct Sprite *);
|
|
|
|
static void AnimRecycle_Step(struct Sprite *);
|
|
|
|
static void SetPsychicBackground_Step(u8);
|
|
|
|
static void FadeScreenToWhite_Step(u8);
|
|
|
|
static void RapinSpinMonElevation_Step(u8);
|
|
|
|
static void TormentAttacker_Step(u8);
|
|
|
|
static void TormentAttacker_Callback(struct Sprite *);
|
|
|
|
static void AnimTask_RockMonBackAndForth_Step(u8);
|
|
|
|
static void AnimTask_FlailMovement_Step(u8);
|
|
|
|
static void AnimTask_RolePlaySilhouette_Step1(u8);
|
|
|
|
static void AnimTask_RolePlaySilhouette_Step2(u8);
|
|
|
|
static void AnimTask_AcidArmor_Step(u8);
|
|
|
|
static void AnimTask_DeepInhale_Step(u8);
|
|
|
|
static void AnimTask_SquishAndSweatDroplets_Step(u8);
|
2018-12-31 18:01:37 +01:00
|
|
|
static void CreateSweatDroplets(u8, bool8);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_FacadeColorBlend_Step(u8);
|
|
|
|
static void AnimTask_GlareEyeDots_Step(u8);
|
2018-12-31 18:01:37 +01:00
|
|
|
static void GetGlareEyeDotCoords(s16, s16, s16, s16, u8, u8, s16 *, s16 *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_BarrageBall_Step(u8);
|
|
|
|
static void AnimTask_SmellingSaltsSquish_Step(u8);
|
|
|
|
static void AnimTask_HelpingHandAttackerMovement_Step(u8);
|
2018-12-30 17:58:42 +01:00
|
|
|
static void AnimTask_MonToSubstituteDoll(u8);
|
|
|
|
static void AnimTask_OdorSleuthMovementWaitFinish(u8);
|
|
|
|
static void MoveOdorSleuthClone(struct Sprite *);
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_TeeterDanceMovement_Step(u8);
|
|
|
|
static void AnimTask_SlackOffSquish_Step(u8);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const union AnimCmd gScratchAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 4),
|
|
|
|
ANIMCMD_FRAME(16, 4),
|
|
|
|
ANIMCMD_FRAME(32, 4),
|
|
|
|
ANIMCMD_FRAME(48, 4),
|
|
|
|
ANIMCMD_FRAME(64, 4),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const union AnimCmd *const gScratchAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:01:18 +02:00
|
|
|
gScratchAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const struct SpriteTemplate gScratchSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SCRATCH,
|
|
|
|
.paletteTag = ANIM_TAG_SCRATCH,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjBlend_32x32,
|
2019-10-21 18:01:18 +02:00
|
|
|
.anims = gScratchAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-20 16:22:53 +02:00
|
|
|
.callback = AnimSpriteOnMonPos,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const struct SpriteTemplate gBlackSmokeSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_BLACK_SMOKE,
|
|
|
|
.paletteTag = ANIM_TAG_BLACK_SMOKE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x16,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:01:18 +02:00
|
|
|
.callback = AnimBlackSmoke,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const struct SpriteTemplate gBlackBallSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_BLACK_BALL,
|
|
|
|
.paletteTag = ANIM_TAG_BLACK_BALL,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-20 10:47:56 +02:00
|
|
|
.callback = AnimThrowProjectile,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const union AnimCmd gOpeningEyeAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 40),
|
|
|
|
ANIMCMD_FRAME(16, 8),
|
|
|
|
ANIMCMD_FRAME(32, 40),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const union AnimCmd *const gOpeningEyeAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:01:18 +02:00
|
|
|
gOpeningEyeAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const struct SpriteTemplate gOpeningEyeSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_OPENING_EYE,
|
|
|
|
.paletteTag = ANIM_TAG_OPENING_EYE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2019-10-21 18:01:18 +02:00
|
|
|
.anims = gOpeningEyeAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-20 16:22:53 +02:00
|
|
|
.callback = AnimSpriteOnMonPos,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const struct SpriteTemplate gWhiteHaloSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ROUND_WHITE_HALO,
|
|
|
|
.paletteTag = ANIM_TAG_ROUND_WHITE_HALO,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjBlend_64x64,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:01:18 +02:00
|
|
|
.callback = AnimWhiteHalo,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const struct SpriteTemplate gTealAlertSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_TEAL_ALERT,
|
|
|
|
.paletteTag = ANIM_TAG_TEAL_ALERT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:01:18 +02:00
|
|
|
.callback = AnimTealAlert,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const union AffineAnimCmd gMeanLookEyeAffineAnimCmds1[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x180, 0x180, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(-0x20, 0x18, 0, 5),
|
|
|
|
AFFINEANIMCMD_FRAME(0x18, -0x20, 0, 5),
|
|
|
|
AFFINEANIMCMD_JUMP(1),
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const union AffineAnimCmd gMeanLookEyeAffineAnimCmds2[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x30, 0x30, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x20, 0x20, 0, 6),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const union AffineAnimCmd *const gMeanLookEyeAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:01:18 +02:00
|
|
|
gMeanLookEyeAffineAnimCmds1,
|
|
|
|
gMeanLookEyeAffineAnimCmds2,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:01:18 +02:00
|
|
|
const struct SpriteTemplate gMeanLookEyeSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_EYE,
|
|
|
|
.paletteTag = ANIM_TAG_EYE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineDouble_ObjBlend_64x64,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2019-10-21 18:01:18 +02:00
|
|
|
.affineAnims = gMeanLookEyeAffineAnimTable,
|
|
|
|
.callback = AnimMeanLookEye,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const struct SpriteTemplate gSpikesSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPIKES,
|
|
|
|
.paletteTag = ANIM_TAG_SPIKES,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:19:07 +02:00
|
|
|
.callback = AnimSpikes,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AnimCmd gLeerAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 3),
|
|
|
|
ANIMCMD_FRAME(16, 3),
|
|
|
|
ANIMCMD_FRAME(32, 3),
|
|
|
|
ANIMCMD_FRAME(48, 3),
|
|
|
|
ANIMCMD_FRAME(64, 3),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AnimCmd *const gLeerAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:19:07 +02:00
|
|
|
gLeerAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const struct SpriteTemplate gLeerSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_LEER,
|
|
|
|
.paletteTag = ANIM_TAG_LEER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2019-10-21 18:19:07 +02:00
|
|
|
.anims = gLeerAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:19:07 +02:00
|
|
|
.callback = AnimLeer,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AnimCmd gLetterZAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 3),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AnimCmd *const gLetterZAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:19:07 +02:00
|
|
|
gLetterZAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AffineAnimCmd gLetterZAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(-7, -7, -3, 16),
|
|
|
|
AFFINEANIMCMD_FRAME(7, 7, 3, 16),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AffineAnimCmd *const gLetterZAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:19:07 +02:00
|
|
|
gLetterZAffineAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const struct SpriteTemplate gLetterZSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_LETTER_Z,
|
|
|
|
.paletteTag = ANIM_TAG_LETTER_Z,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2019-10-21 18:19:07 +02:00
|
|
|
.anims = gLetterZAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
2019-10-21 18:19:07 +02:00
|
|
|
.affineAnims = gLetterZAffineAnimTable,
|
2019-11-23 11:57:39 +01:00
|
|
|
.callback = AnimLetterZ,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AnimCmd gFangAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 8),
|
|
|
|
ANIMCMD_FRAME(16, 16),
|
|
|
|
ANIMCMD_FRAME(32, 4),
|
|
|
|
ANIMCMD_FRAME(48, 4),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AnimCmd *const gFangAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:19:07 +02:00
|
|
|
gFangAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AffineAnimCmd gFangAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(-0x20, -0x20, 0, 8),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AffineAnimCmd *const gFangAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:19:07 +02:00
|
|
|
gFangAffineAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const struct SpriteTemplate gFangSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_FANG_ATTACK,
|
|
|
|
.paletteTag = ANIM_TAG_FANG_ATTACK,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineDouble_ObjNormal_32x32,
|
2019-10-21 18:19:07 +02:00
|
|
|
.anims = gFangAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
2019-10-21 18:19:07 +02:00
|
|
|
.affineAnims = gFangAffineAnimTable,
|
|
|
|
.callback = AnimFang,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AffineAnimCmd gSpotlightAffineAnimCmds1[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x0, 0x180, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0x10, 0x0, 0, 20),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AffineAnimCmd gSpotlightAffineAnimCmds2[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x140, 0x180, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(-0x10, 0x0, 0, 19),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AffineAnimCmd *const gSpotlightAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:19:07 +02:00
|
|
|
gSpotlightAffineAnimCmds1,
|
|
|
|
gSpotlightAffineAnimCmds2,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const struct SpriteTemplate gSpotlightSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPOTLIGHT,
|
|
|
|
.paletteTag = ANIM_TAG_SPOTLIGHT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineDouble_ObjNormal_64x64,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2019-10-21 18:19:07 +02:00
|
|
|
.affineAnims = gSpotlightAffineAnimTable,
|
|
|
|
.callback = AnimSpotlight,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const struct SpriteTemplate gClappingHandSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_TAG_HAND,
|
|
|
|
.paletteTag = ANIM_TAG_TAG_HAND,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:19:07 +02:00
|
|
|
.callback = AnimClappingHand,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const struct SpriteTemplate gClappingHand2SpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_TAG_HAND,
|
|
|
|
.paletteTag = ANIM_TAG_TAG_HAND,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:19:07 +02:00
|
|
|
.callback = AnimClappingHand2,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AnimCmd gRapidSpinAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 2),
|
|
|
|
ANIMCMD_FRAME(8, 2),
|
|
|
|
ANIMCMD_FRAME(16, 2),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const union AnimCmd *const gRapidSpinAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:19:07 +02:00
|
|
|
gRapidSpinAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:19:07 +02:00
|
|
|
const struct SpriteTemplate gRapidSpinSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_RAPID_SPIN,
|
|
|
|
.paletteTag = ANIM_TAG_RAPID_SPIN,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x16,
|
2019-10-21 18:19:07 +02:00
|
|
|
.anims = gRapidSpinAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:19:07 +02:00
|
|
|
.callback = AnimRapidSpin,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2021-04-13 09:28:03 +02:00
|
|
|
static const union AffineAnimCmd sAffineAnims_Torment[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(-12, 8, 0, 4),
|
|
|
|
AFFINEANIMCMD_FRAME(20, -20, 0, 4),
|
|
|
|
AFFINEANIMCMD_FRAME(-8, 12, 0, 4),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-11-23 15:51:08 +01:00
|
|
|
const union AnimCmd gTriAttackTriangleAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 8),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-11-23 15:51:08 +01:00
|
|
|
const union AnimCmd *const gTriAttackTriangleAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-11-23 15:51:08 +01:00
|
|
|
gTriAttackTriangleAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-11-23 15:51:08 +01:00
|
|
|
const union AffineAnimCmd gTriAttackTriangleAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 5, 40),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 10, 10),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 15, 10),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 20, 40),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2019-11-23 15:51:08 +01:00
|
|
|
const union AffineAnimCmd *const gTriAttackTriangleAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-11-23 15:51:08 +01:00
|
|
|
gTriAttackTriangleAffineAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-11-23 15:51:08 +01:00
|
|
|
const struct SpriteTemplate gTriAttackTriangleSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-11-23 15:51:08 +01:00
|
|
|
.tileTag = ANIM_TAG_TRI_ATTACK_TRIANGLE,
|
|
|
|
.paletteTag = ANIM_TAG_TRI_ATTACK_TRIANGLE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineDouble_ObjNormal_64x64,
|
2019-11-23 15:51:08 +01:00
|
|
|
.anims = gTriAttackTriangleAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
2019-11-23 15:51:08 +01:00
|
|
|
.affineAnims = gTriAttackTriangleAffineAnimTable,
|
|
|
|
.callback = AnimTriAttackTriangle,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const union AnimCmd gEclipsingOrbAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 3),
|
|
|
|
ANIMCMD_FRAME(16, 3),
|
|
|
|
ANIMCMD_FRAME(32, 3),
|
|
|
|
ANIMCMD_FRAME(48, 3),
|
|
|
|
ANIMCMD_FRAME(32, 3, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(16, 3, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(0, 3, .hFlip = TRUE),
|
|
|
|
ANIMCMD_LOOP(1),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const union AnimCmd *const gEclipsingOrbAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:29:59 +02:00
|
|
|
gEclipsingOrbAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const struct SpriteTemplate gEclipsingOrbSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ECLIPSING_ORB,
|
|
|
|
.paletteTag = ANIM_TAG_ECLIPSING_ORB,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2019-10-21 18:29:59 +02:00
|
|
|
.anims = gEclipsingOrbAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-20 16:22:53 +02:00
|
|
|
.callback = AnimSpriteOnMonPos,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const union AffineAnimCmd DefenseCurlDeformMonAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(-12, 20, 0, 8),
|
|
|
|
AFFINEANIMCMD_FRAME(12, -20, 0, 8),
|
|
|
|
AFFINEANIMCMD_LOOP(2),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const struct SpriteTemplate gBatonPassPokeballSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_POKEBALL,
|
|
|
|
.paletteTag = ANIM_TAG_POKEBALL,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:29:59 +02:00
|
|
|
.callback = AnimBatonPassPokeball,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const struct SpriteTemplate gWishStarSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_GOLD_STARS,
|
|
|
|
.paletteTag = ANIM_TAG_GOLD_STARS,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:29:59 +02:00
|
|
|
.callback = AnimWishStar,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const struct SpriteTemplate gMiniTwinklingStarSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_GOLD_STARS,
|
|
|
|
.paletteTag = ANIM_TAG_GOLD_STARS,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-30 17:58:42 +01:00
|
|
|
.callback = AnimMiniTwinklingStar,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const union AffineAnimCmd gStockpileDeformMonAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(8, -8, 0, 12),
|
|
|
|
AFFINEANIMCMD_FRAME(-16, 16, 0, 12),
|
|
|
|
AFFINEANIMCMD_FRAME(8, -8, 0, 12),
|
|
|
|
AFFINEANIMCMD_LOOP(1),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const union AffineAnimCmd gSpitUpDeformMonAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, 6, 0, 20),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 0, 20),
|
|
|
|
AFFINEANIMCMD_FRAME(0, -18, 0, 6),
|
|
|
|
AFFINEANIMCMD_FRAME(-18, -18, 0, 3),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 0, 15),
|
|
|
|
AFFINEANIMCMD_FRAME(4, 4, 0, 13),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const struct SpriteTemplate gSwallowBlueOrbSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_BLUE_ORB,
|
|
|
|
.paletteTag = ANIM_TAG_BLUE_ORB,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:29:59 +02:00
|
|
|
.callback = AnimSwallowBlueOrb,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
const union AffineAnimCmd gSwallowDeformMonAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, 6, 0, 20),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 0, 20),
|
|
|
|
AFFINEANIMCMD_FRAME(7, -30, 0, 6),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 0, 20),
|
|
|
|
AFFINEANIMCMD_FRAME(-2, 3, 0, 20),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
const s8 gMorningSunLightBeamCoordsTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-24 21:59:05 +01:00
|
|
|
0xE8,
|
|
|
|
0x18,
|
|
|
|
0xFC,
|
2018-12-19 02:03:26 +01:00
|
|
|
0x00,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
const union AnimCmd gGreenStarAnimCmds1[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 6),
|
|
|
|
ANIMCMD_FRAME(4, 6),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
const union AnimCmd gGreenStarAnimCmds2[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(8, 6),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
const union AnimCmd gGreenStarAnimCmds3[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(12, 6),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
const union AnimCmd *const gGreenStarAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-10-21 18:36:45 +02:00
|
|
|
gGreenStarAnimCmds1,
|
|
|
|
gGreenStarAnimCmds2,
|
|
|
|
gGreenStarAnimCmds3,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
const struct SpriteTemplate gGreenStarSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_GREEN_STAR,
|
|
|
|
.paletteTag = ANIM_TAG_GREEN_STAR,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2019-10-21 18:36:45 +02:00
|
|
|
.anims = gGreenStarAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-10-21 18:36:45 +02:00
|
|
|
.callback = AnimGreenStar,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
const s8 gDoomDesireLightBeamCoordTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
0x78,
|
|
|
|
0x50,
|
|
|
|
0x28,
|
|
|
|
0x00,
|
|
|
|
};
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
const u8 gDoomDesireLightBeamDelayTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
50,
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gStrongFrustrationAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, -15, 0, 7),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 15, 0, 7),
|
|
|
|
AFFINEANIMCMD_LOOP(2),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gWeakFrustrationAngerMarkSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ANGER,
|
|
|
|
.paletteTag = ANIM_TAG_ANGER,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimWeakFrustrationAngerMark,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AnimCmd gSweetScentPetalAnimCmds1[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 8),
|
|
|
|
ANIMCMD_FRAME(1, 8),
|
|
|
|
ANIMCMD_FRAME(2, 8),
|
|
|
|
ANIMCMD_FRAME(3, 8),
|
|
|
|
ANIMCMD_FRAME(3, 8, .vFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(2, 8, .vFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(0, 8, .vFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(1, 8, .vFlip = TRUE),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AnimCmd gSweetScentPetalAnimCmds2[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 8, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(1, 8, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(2, 8, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(3, 8, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(3, 8, .vFlip = TRUE, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(2, 8, .vFlip = TRUE, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(0, 8, .vFlip = TRUE, .hFlip = TRUE),
|
|
|
|
ANIMCMD_FRAME(1, 8, .vFlip = TRUE, .hFlip = TRUE),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AnimCmd gSweetScentPetalAnimCmds3[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 8),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AnimCmd *const gSweetScentPetalAnimCmdTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
gSweetScentPetalAnimCmds1,
|
|
|
|
gSweetScentPetalAnimCmds2,
|
|
|
|
gSweetScentPetalAnimCmds3,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gSweetScentPetalSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_PINK_PETAL,
|
|
|
|
.paletteTag = ANIM_TAG_PINK_PETAL,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-12-31 18:01:37 +01:00
|
|
|
.anims = gSweetScentPetalAnimCmdTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimSweetScentPetal,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2021-10-26 22:52:23 +02:00
|
|
|
static const u16 sUnusedPalette[] = INCBIN_U16("graphics/battle_anims/unused/unknown.gbapal");
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AnimCmd gPainSplitAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 5),
|
|
|
|
ANIMCMD_FRAME(4, 9),
|
|
|
|
ANIMCMD_FRAME(8, 5),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AnimCmd *const gPainSplitAnimCmdTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
gPainSplitAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gPainSplitProjectileSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_PAIN_SPLIT,
|
|
|
|
.paletteTag = ANIM_TAG_PAIN_SPLIT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2018-12-31 18:01:37 +01:00
|
|
|
.anims = gPainSplitAnimCmdTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimPainSplitProjectile,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gFlatterConfettiSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_CONFETTI,
|
|
|
|
.paletteTag = ANIM_TAG_CONFETTI,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimFlatterConfetti,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gFlatterSpotlightSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SPOTLIGHT,
|
|
|
|
.paletteTag = ANIM_TAG_SPOTLIGHT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineDouble_ObjNormal_64x64,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2019-10-21 18:19:07 +02:00
|
|
|
.affineAnims = gSpotlightAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimFlatterSpotlight,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gReversalOrbSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_BLUE_ORB,
|
|
|
|
.paletteTag = ANIM_TAG_BLUE_ORB,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimReversalOrb,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gDeepInhaleAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(16, 0, 0, 4),
|
|
|
|
AFFINEANIMCMD_FRAME(0, -3, 0, 16),
|
|
|
|
AFFINEANIMCMD_FRAME(4, 0, 0, 4),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 0, 24),
|
|
|
|
AFFINEANIMCMD_FRAME(-5, 3, 0, 16),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gYawnCloudAffineAnimCmds1[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(-8, -8, 0, 8),
|
|
|
|
AFFINEANIMCMD_FRAME(8, 8, 0, 8),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gYawnCloudAffineAnimCmds2[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0xC0, 0xC0, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(8, 8, 0, 8),
|
|
|
|
AFFINEANIMCMD_FRAME(-8, -8, 0, 8),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gYawnCloudAffineAnimCmds3[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(8, 8, 0, 8),
|
|
|
|
AFFINEANIMCMD_FRAME(-8, -8, 0, 8),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd *const gYawnCloudAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
gYawnCloudAffineAnimCmds1,
|
|
|
|
gYawnCloudAffineAnimCmds2,
|
|
|
|
gYawnCloudAffineAnimCmds3,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gYawnCloudSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_PINK_CLOUD,
|
|
|
|
.paletteTag = ANIM_TAG_PINK_CLOUD,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2018-12-31 18:01:37 +01:00
|
|
|
.affineAnims = gYawnCloudAffineAnimTable,
|
|
|
|
.callback = AnimYawnCloud,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gSmokeBallEscapeCloudAffineAnimCmds1[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(-4, -6, 0, 16),
|
|
|
|
AFFINEANIMCMD_FRAME(4, 6, 0, 16),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gSmokeBallEscapeCloudAffineAnimCmds2[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0xC0, 0xC0, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(4, 6, 0, 16),
|
|
|
|
AFFINEANIMCMD_FRAME(-4, -6, 0, 16),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gSmokeBallEscapeCloudAffineAnimCmds3[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(4, 6, 0, 16),
|
|
|
|
AFFINEANIMCMD_FRAME(-4, -6, 0, 16),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gSmokeBallEscapeCloudAffineAnimCmds4[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(8, 10, 0, 30),
|
|
|
|
AFFINEANIMCMD_FRAME(-8, -10, 0, 16),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd *const gSmokeBallEscapeCloudAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
gSmokeBallEscapeCloudAffineAnimCmds1,
|
|
|
|
gSmokeBallEscapeCloudAffineAnimCmds2,
|
|
|
|
gSmokeBallEscapeCloudAffineAnimCmds3,
|
|
|
|
gSmokeBallEscapeCloudAffineAnimCmds4,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gSmokeBallEscapeCloudSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_PINK_CLOUD,
|
|
|
|
.paletteTag = ANIM_TAG_PINK_CLOUD,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineDouble_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2018-12-31 18:01:37 +01:00
|
|
|
.affineAnims = gSmokeBallEscapeCloudAffineAnimTable,
|
|
|
|
.callback = AnimSmokeBallEscapeCloud,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gFacadeSquishAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(-16, 16, 0, 6),
|
|
|
|
AFFINEANIMCMD_FRAME(16, -16, 0, 12),
|
|
|
|
AFFINEANIMCMD_FRAME(-16, 16, 0, 6),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
const struct SpriteTemplate gFacadeSweatDropSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SWEAT_DROP,
|
|
|
|
.paletteTag = ANIM_TAG_SWEAT_DROP,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2019-11-23 11:57:39 +01:00
|
|
|
.callback = AnimFacadeSweatDrop,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const u16 gFacadeBlendColors[] = {
|
|
|
|
RGB(28, 25, 1),
|
|
|
|
RGB(28, 21, 5),
|
|
|
|
RGB(27, 18, 8),
|
|
|
|
RGB(27, 14, 11),
|
|
|
|
RGB(26, 10, 15),
|
|
|
|
RGB(26, 7, 18),
|
|
|
|
RGB(25, 3, 21),
|
|
|
|
RGB(25, 0, 25),
|
|
|
|
RGB(25, 0, 23),
|
|
|
|
RGB(25, 0, 20),
|
|
|
|
RGB(25, 0, 16),
|
|
|
|
RGB(25, 0, 13),
|
|
|
|
RGB(26, 0, 10),
|
|
|
|
RGB(26, 0, 6),
|
|
|
|
RGB(26, 0, 3),
|
|
|
|
RGB(27, 0, 0),
|
|
|
|
RGB(27, 1, 0),
|
|
|
|
RGB(27, 5, 0),
|
|
|
|
RGB(27, 9, 0),
|
|
|
|
RGB(27, 12, 0),
|
|
|
|
RGB(28, 16, 0),
|
|
|
|
RGB(28, 19, 0),
|
|
|
|
RGB(28, 23, 0),
|
|
|
|
RGB(29, 27, 0),
|
|
|
|
};
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AnimCmd gRoarNoiseLineAnimCmds1[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 3),
|
|
|
|
ANIMCMD_FRAME(16, 3),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AnimCmd gRoarNoiseLineAnimCmds2[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(32, 3),
|
|
|
|
ANIMCMD_FRAME(48, 3),
|
|
|
|
ANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AnimCmd *const gRoarNoiseLineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
gRoarNoiseLineAnimCmds1,
|
|
|
|
gRoarNoiseLineAnimCmds2,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gRoarNoiseLineSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_NOISE_LINE,
|
|
|
|
.paletteTag = ANIM_TAG_NOISE_LINE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-12-31 18:01:37 +01:00
|
|
|
.anims = gRoarNoiseLineAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimRoarNoiseLine,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gGlareEyeDotSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMALL_RED_EYE,
|
|
|
|
.paletteTag = ANIM_TAG_SMALL_RED_EYE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_8x8,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimGlareEyeDot,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gAssistPawprintSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_PAW_PRINT,
|
|
|
|
.paletteTag = ANIM_TAG_PAW_PRINT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimAssistPawprint,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gBarrageBallAffineAnimCmds1[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, -4, 24),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gBarrageBallAffineAnimCmds2[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x100, 0x100, -64, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 4, 24),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd *const gBarrageBallAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
gBarrageBallAffineAnimCmds1,
|
|
|
|
gBarrageBallAffineAnimCmds2,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gBarrageBallSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_RED_BALL,
|
|
|
|
.paletteTag = ANIM_TAG_RED_BALL,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2018-12-31 18:01:37 +01:00
|
|
|
.affineAnims = gBarrageBallAffineAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.callback = SpriteCallbackDummy,
|
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const struct SpriteTemplate gSmellingSaltsHandSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_TAG_HAND,
|
|
|
|
.paletteTag = ANIM_TAG_TAG_HAND,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-31 18:01:37 +01:00
|
|
|
.callback = AnimSmellingSaltsHand,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
const union AffineAnimCmd gSmellingSaltsSquishAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, -16, 0, 6),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 16, 0, 6),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const struct SpriteTemplate gSmellingSaltExclamationSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SMELLINGSALT_EFFECT,
|
|
|
|
.paletteTag = ANIM_TAG_SMELLINGSALT_EFFECT,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-30 17:58:42 +01:00
|
|
|
.callback = AnimSmellingSaltExclamation,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const struct SpriteTemplate gHelpingHandClapSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_TAG_HAND,
|
|
|
|
.paletteTag = ANIM_TAG_TAG_HAND,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-30 17:58:42 +01:00
|
|
|
.callback = AnimHelpingHandClap,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const struct SpriteTemplate gForesightMagnifyingGlassSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_MAGNIFYING_GLASS,
|
|
|
|
.paletteTag = ANIM_TAG_MAGNIFYING_GLASS,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjBlend_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-30 17:58:42 +01:00
|
|
|
.callback = AnimForesightMagnifyingGlass,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const struct SpriteTemplate gMeteorMashStarSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_GOLD_STARS,
|
|
|
|
.paletteTag = ANIM_TAG_GOLD_STARS,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-30 17:58:42 +01:00
|
|
|
.callback = AnimMeteorMashStar,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2021-04-13 09:28:03 +02:00
|
|
|
static const struct SpriteTemplate sUnusedStarBurstSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_GOLD_STARS,
|
|
|
|
.paletteTag = ANIM_TAG_GOLD_STARS,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_16x16,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-02-20 22:22:33 +01:00
|
|
|
.callback = AnimParticleBurst,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const struct SpriteTemplate gBlockXSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_X_SIGN,
|
|
|
|
.paletteTag = ANIM_TAG_X_SIGN,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_64x64,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2018-12-30 17:58:42 +01:00
|
|
|
.callback = AnimBlockX,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2021-04-13 09:28:03 +02:00
|
|
|
static const struct SpriteTemplate sUnusedItemBagStealSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_ITEM_BAG,
|
|
|
|
.paletteTag = ANIM_TAG_ITEM_BAG,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2021-04-13 09:28:03 +02:00
|
|
|
.callback = AnimUnusedItemBagSteal,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const union AnimCmd gKnockOffStrikeAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 4),
|
|
|
|
ANIMCMD_FRAME(64, 4),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const union AnimCmd *const gKnockOffStrikeAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-30 17:58:42 +01:00
|
|
|
gKnockOffStrikeAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const union AffineAnimCmd gKnockOffStrikeAffineanimCmds1[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, -4, 8),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const union AffineAnimCmd gKnockOffStrikeAffineanimCmds2[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 4, 8),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const union AffineAnimCmd *const gKnockOffStrikeAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-30 17:58:42 +01:00
|
|
|
gKnockOffStrikeAffineanimCmds1,
|
|
|
|
gKnockOffStrikeAffineanimCmds2,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const struct SpriteTemplate gKnockOffStrikeSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_SLAM_HIT_2,
|
|
|
|
.paletteTag = ANIM_TAG_SLAM_HIT_2,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjNormal_64x64,
|
2018-12-30 17:58:42 +01:00
|
|
|
.anims = gKnockOffStrikeAnimTable,
|
2018-12-19 02:03:26 +01:00
|
|
|
.images = NULL,
|
2018-12-30 17:58:42 +01:00
|
|
|
.affineAnims = gKnockOffStrikeAffineAnimTable,
|
|
|
|
.callback = AnimKnockOffStrike,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const union AffineAnimCmd gRecycleSpriteAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, -4, 64),
|
|
|
|
AFFINEANIMCMD_JUMP(0),
|
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const union AffineAnimCmd *const gRecycleSpriteAffineAnimTable[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-30 17:58:42 +01:00
|
|
|
gRecycleSpriteAffineAnimCmds,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const struct SpriteTemplate gRecycleSpriteTemplate =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
.tileTag = ANIM_TAG_RECYCLE,
|
|
|
|
.paletteTag = ANIM_TAG_RECYCLE,
|
2019-10-15 01:26:47 +02:00
|
|
|
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
|
2018-12-19 02:03:26 +01:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
2018-12-30 17:58:42 +01:00
|
|
|
.affineAnims = gRecycleSpriteAffineAnimTable,
|
|
|
|
.callback = AnimRecycle,
|
2018-12-19 02:03:26 +01:00
|
|
|
};
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
const union AffineAnimCmd gSlackOffSquishAffineAnimCmds[] =
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, 16, 0, 4),
|
|
|
|
AFFINEANIMCMD_FRAME(-2, 0, 0, 8),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 4, 0, 4),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 0, 24),
|
|
|
|
AFFINEANIMCMD_FRAME(1, -5, 0, 16),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimBlackSmoke(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += gBattleAnimArgs[0];
|
|
|
|
sprite->y += gBattleAnimArgs[1];
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (!gBattleAnimArgs[3])
|
|
|
|
sprite->data[0] = gBattleAnimArgs[2];
|
|
|
|
else
|
|
|
|
sprite->data[0] = -gBattleAnimArgs[2];
|
|
|
|
|
|
|
|
sprite->data[1] = gBattleAnimArgs[4];
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimBlackSmoke_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimBlackSmoke_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (sprite->data[1] > 0)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = sprite->data[2] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[2] += sprite->data[0];
|
|
|
|
sprite->invisible ^= 1;
|
|
|
|
sprite->data[1]--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
void AnimTask_SmokescreenImpact(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-11-23 11:57:39 +01:00
|
|
|
SmokescreenImpact(
|
2021-11-08 17:46:38 +01:00
|
|
|
GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + 8,
|
|
|
|
GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + 8,
|
2022-06-01 18:41:57 +02:00
|
|
|
FALSE);
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimWhiteHalo(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[0] = 90;
|
|
|
|
sprite->callback = WaitAnimForDuration;
|
|
|
|
sprite->data[1] = 7;
|
2019-11-23 11:57:39 +01:00
|
|
|
StoreSpriteCallbackInData6(sprite, AnimWhiteHalo_Step1);
|
2018-12-19 02:03:26 +01:00
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[1], 16 - sprite->data[1]));
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimWhiteHalo_Step1(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[1], 16 - sprite->data[1]));
|
|
|
|
if (--sprite->data[1] < 0)
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimWhiteHalo_Step2;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimWhiteHalo_Step2(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTealAlert(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u16 rotation;
|
2021-11-08 17:46:38 +01:00
|
|
|
u8 x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
|
|
|
u8 y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimTarget(sprite, TRUE);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
rotation = ArcTan2Neg(sprite->x - x, sprite->y - y);
|
2018-12-19 02:03:26 +01:00
|
|
|
rotation += 0x6000;
|
|
|
|
if (IsContest())
|
|
|
|
rotation += 0x4000;
|
|
|
|
|
|
|
|
TrySetSpriteRotScale(sprite, FALSE, 0x100, 0x100, rotation);
|
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[2] = x;
|
|
|
|
sprite->data[4] = y;
|
|
|
|
sprite->callback = StartAnimLinearTranslation;
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimMeanLookEye(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
|
|
|
|
sprite->data[0] = 4;
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimMeanLookEye_Step1;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimMeanLookEye_Step1(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[0], 16 - sprite->data[0]));
|
|
|
|
|
|
|
|
if (sprite->data[1])
|
|
|
|
sprite->data[0]--;
|
|
|
|
else
|
|
|
|
sprite->data[0]++;
|
|
|
|
|
|
|
|
if (sprite->data[0] == 15 || sprite->data[0] == 4)
|
|
|
|
sprite->data[1] ^= 1;
|
|
|
|
|
|
|
|
if (sprite->data[2]++ > 70)
|
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
|
|
|
StartSpriteAffineAnim(sprite, 1);
|
|
|
|
sprite->data[2] = 0;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->affineAnimPaused = 1;
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimMeanLookEye_Step2;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimMeanLookEye_Step2(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (sprite->data[2]++ > 9)
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->affineAnimPaused = 0;
|
|
|
|
if (sprite->affineAnimEnded)
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimMeanLookEye_Step3;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimMeanLookEye_Step3(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[3])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case 1:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = 1;
|
|
|
|
sprite->y2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 3:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = -1;
|
|
|
|
sprite->y2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
case 5:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = 0;
|
|
|
|
sprite->y2 = 1;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
default:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = 0;
|
|
|
|
sprite->y2 = -1;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++sprite->data[3] > 7)
|
|
|
|
sprite->data[3] = 0;
|
|
|
|
|
|
|
|
if (sprite->data[4]++ > 15)
|
|
|
|
{
|
|
|
|
sprite->data[0] = 16;
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[0], 0));
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimMeanLookEye_Step4;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimMeanLookEye_Step4(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[0], 16 - sprite->data[0]));
|
|
|
|
|
|
|
|
if (sprite->data[1]++ > 1)
|
|
|
|
{
|
|
|
|
sprite->data[0]--;
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite->data[0] == 0)
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (sprite->data[0] < 0)
|
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
void AnimTask_SetPsychicBackground(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-11-23 11:57:39 +01:00
|
|
|
gTasks[taskId].func = SetPsychicBackground_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
gAnimVisualTaskCount--;
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void SetPsychicBackground_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u16 lastColor;
|
2019-11-24 18:00:51 +01:00
|
|
|
u8 paletteIndex = GetBattleBgPaletteNum();
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (++gTasks[taskId].data[5] == 4)
|
|
|
|
{
|
2023-05-23 19:16:18 +02:00
|
|
|
lastColor = gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + 11];
|
2018-12-19 02:03:26 +01:00
|
|
|
for (i = 10; i > 0; i--)
|
2023-05-23 19:16:18 +02:00
|
|
|
gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + i + 1] = gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + i];
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2023-05-23 19:16:18 +02:00
|
|
|
gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + 1] = lastColor;
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[5] = 0;
|
|
|
|
}
|
|
|
|
|
2020-02-23 19:18:54 +01:00
|
|
|
if ((u16)gBattleAnimArgs[7] == 0xFFFF)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyTask(taskId);
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
void AnimTask_FadeScreenToWhite(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-11-23 11:57:39 +01:00
|
|
|
gTasks[taskId].func = FadeScreenToWhite_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
gAnimVisualTaskCount--;
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void FadeScreenToWhite_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u16 lastColor;
|
2019-11-24 18:00:51 +01:00
|
|
|
u8 paletteIndex = GetBattleBgPaletteNum();
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (++gTasks[taskId].data[5] == 4)
|
|
|
|
{
|
2023-05-23 19:16:18 +02:00
|
|
|
lastColor = gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + 11];
|
2018-12-19 02:03:26 +01:00
|
|
|
for (i = 10; i > 0; i--)
|
2023-05-23 19:16:18 +02:00
|
|
|
gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + i + 1] = gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + i];
|
|
|
|
gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + 1] = lastColor;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2023-05-23 19:16:18 +02:00
|
|
|
lastColor = gPlttBufferUnfaded[BG_PLTT_ID(paletteIndex) + 11];
|
2018-12-19 02:03:26 +01:00
|
|
|
for (i = 10; i > 0; i--)
|
2023-05-23 19:16:18 +02:00
|
|
|
gPlttBufferUnfaded[BG_PLTT_ID(paletteIndex) + i + 1] = gPlttBufferUnfaded[BG_PLTT_ID(paletteIndex) + i];
|
|
|
|
gPlttBufferUnfaded[BG_PLTT_ID(paletteIndex) + 1] = lastColor;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
gTasks[taskId].data[5] = 0;
|
|
|
|
}
|
|
|
|
|
2020-02-23 19:18:54 +01:00
|
|
|
if ((u16)gBattleAnimArgs[7] == 0xFFFF)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSpikes(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u16 x;
|
|
|
|
u16 y;
|
|
|
|
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimAttacker(sprite, TRUE);
|
2018-12-19 02:03:26 +01:00
|
|
|
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);
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimSpikes_Step1;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimSpikes_Step1(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-02-06 20:17:09 +01:00
|
|
|
if (TranslateAnimHorizontalArc(sprite))
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[0] = 30;
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->callback = WaitAnimForDuration;
|
2019-11-23 11:57:39 +01:00
|
|
|
StoreSpriteCallbackInData6(sprite, AnimSpikes_Step2);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimSpikes_Step2(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (sprite->data[1] & 1)
|
|
|
|
sprite->invisible ^= 1;
|
|
|
|
|
|
|
|
if (++sprite->data[1] == 16)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimLeer(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetSpriteCoordsToAnimAttackerCoords(sprite);
|
2018-12-20 04:13:26 +01:00
|
|
|
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y += gBattleAnimArgs[1];
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->callback = RunStoredCallbackWhenAnimEnds;
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimLetterZ(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
int var0;
|
|
|
|
if (sprite->data[0] == 0)
|
|
|
|
{
|
|
|
|
SetSpriteCoordsToAnimAttackerCoords(sprite);
|
2018-12-20 04:13:26 +01:00
|
|
|
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (!IsContest())
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
sprite->data[1] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[3];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-29 19:31:04 +01:00
|
|
|
sprite->data[1] = -1 * gBattleAnimArgs[2];
|
|
|
|
sprite->data[2] = -1 * gBattleAnimArgs[3];
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-29 19:31:04 +01:00
|
|
|
sprite->data[1] = -1 * gBattleAnimArgs[2];
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[2] = gBattleAnimArgs[3];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[0]++;
|
|
|
|
var0 = (sprite->data[0] * 20) & 0xFF;
|
|
|
|
sprite->data[3] += sprite->data[1];
|
|
|
|
sprite->data[4] += sprite->data[2];
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = sprite->data[3] / 2;
|
|
|
|
sprite->y2 = Sin(var0 & 0xFF, 5) + (sprite->data[4] / 2);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
if ((u16)(sprite->x + sprite->x2) > DISPLAY_WIDTH)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFang(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (sprite->animEnded)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_IsTargetPlayerSide(u8 taskId)
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_IsHealingMove(u8 taskId)
|
|
|
|
{
|
|
|
|
if (gAnimMoveDmg > 0)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSpotlight(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ);
|
|
|
|
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON);
|
|
|
|
gBattle_WIN0H = 0;
|
|
|
|
gBattle_WIN0V = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_WIN0H, gBattle_WIN0H);
|
|
|
|
SetGpuReg(REG_OFFSET_WIN0V, gBattle_WIN0V);
|
|
|
|
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimTarget(sprite, FALSE);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
sprite->oam.objMode = ST_OAM_OBJ_WINDOW;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimSpotlight_Step1;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimSpotlight_Step1(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (sprite->affineAnimEnded)
|
|
|
|
sprite->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
sprite->data[1] += 117;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = sprite->data[1] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++sprite->data[2] == 21)
|
|
|
|
{
|
|
|
|
sprite->data[2] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprite->data[1] -= 117;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = sprite->data[1] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++sprite->data[2] == 41)
|
|
|
|
{
|
|
|
|
sprite->data[2] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
ChangeSpriteAffineAnim(sprite, 1);
|
|
|
|
sprite->data[0]++;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
if (sprite->affineAnimEnded)
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimSpotlight_Step2;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimSpotlight_Step2(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
|
|
|
|
SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON);
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimClappingHand(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (gBattleAnimArgs[3] == 0)
|
|
|
|
{
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += gBattleAnimArgs[0];
|
|
|
|
sprite->y += gBattleAnimArgs[1];
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->oam.tileNum += 16;
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[2] == 0)
|
|
|
|
{
|
2019-08-10 18:09:06 +02:00
|
|
|
sprite->oam.matrixNum = ST_OAM_HFLIP;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = -12;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = 12;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = -2;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[4];
|
|
|
|
|
|
|
|
if (sprite->data[3] != 255)
|
|
|
|
sprite->data[3] = gBattleAnimArgs[2];
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimClappingHand_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimClappingHand_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (sprite->data[2] == 0)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 += sprite->data[1];
|
|
|
|
if (sprite->x2 == 0)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[2]++;
|
|
|
|
if (sprite->data[3] == 0)
|
|
|
|
{
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE1WithPanning(SE_M_ENCORE, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 -= sprite->data[1];
|
|
|
|
if (abs(sprite->x2) == 12)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[0]--;
|
|
|
|
sprite->data[2]--;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite->data[0] == 0)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimClappingHand2(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->oam.objMode = ST_OAM_OBJ_WINDOW;
|
|
|
|
sprite->data[3] = 255;
|
2019-10-21 18:19:07 +02:00
|
|
|
AnimClappingHand(sprite);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
void AnimTask_CreateSpotlight(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (IsContest())
|
|
|
|
{
|
2021-04-15 08:04:01 +02:00
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ);
|
|
|
|
gBattle_WIN1H = WIN_RANGE(152, DISPLAY_WIDTH);
|
|
|
|
gBattle_WIN1V = WIN_RANGE(0, DISPLAY_HEIGHT);
|
2018-12-19 02:03:26 +01:00
|
|
|
SetGpuReg(REG_OFFSET_WIN1H, gBattle_WIN0H);
|
|
|
|
SetGpuReg(REG_OFFSET_WIN1V, gBattle_WIN0V);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ);
|
2021-04-15 08:04:01 +02:00
|
|
|
gBattle_WIN1H = WIN_RANGE(0, DISPLAY_WIDTH);
|
|
|
|
gBattle_WIN1V = WIN_RANGE(120, DISPLAY_HEIGHT);
|
|
|
|
SetGpuReg(REG_OFFSET_WIN1H, gBattle_WIN1H);
|
2018-12-19 02:03:26 +01:00
|
|
|
SetGpuReg(REG_OFFSET_WIN1V, gBattle_WIN1V);
|
|
|
|
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON);
|
|
|
|
}
|
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
void AnimTask_RemoveSpotlight(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
|
|
|
|
gBattle_WIN1H = 0;
|
|
|
|
gBattle_WIN1V = 0;
|
|
|
|
if (!IsContest())
|
|
|
|
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON);
|
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimRapidSpin(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (gBattleAnimArgs[0] == 0)
|
|
|
|
{
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[1];
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) + gBattleAnimArgs[1];
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = gBattleAnimArgs[2];
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->data[0] = (sprite->y2 > gBattleAnimArgs[3]);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[2] = gBattleAnimArgs[4];
|
|
|
|
sprite->data[3] = gBattleAnimArgs[5];
|
|
|
|
sprite->data[4] = gBattleAnimArgs[3];
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimRapidSpin_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimRapidSpin_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[1] = (sprite->data[1] + sprite->data[2]) & 0xFF;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = gSineTable[sprite->data[1]] >> 4;
|
|
|
|
sprite->y2 += sprite->data[3];
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (sprite->data[0])
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->y2 < sprite->data[4])
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->y2 > sprite->data[4])
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
void AnimTask_RapinSpinMonElevation(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
s16 var0;
|
|
|
|
u8 toBG2;
|
|
|
|
s16 var2;
|
|
|
|
int var3;
|
|
|
|
int var4;
|
|
|
|
s16 i;
|
|
|
|
struct ScanlineEffectParams scanlineParams;
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
if (!gBattleAnimArgs[0])
|
|
|
|
{
|
|
|
|
var0 = GetBattlerYCoordWithElevation(gBattleAnimAttacker);
|
2018-12-20 04:13:26 +01:00
|
|
|
toBG2 = GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var0 = GetBattlerYCoordWithElevation(gBattleAnimTarget);
|
2018-12-20 04:13:26 +01:00
|
|
|
toBG2 = GetBattlerSpriteBGPriorityRank(gBattleAnimTarget);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
task->data[0] = var0 + 36;
|
|
|
|
task->data[1] = task->data[0];
|
|
|
|
task->data[2] = var0 - 33;
|
|
|
|
if (task->data[2] < 0)
|
|
|
|
task->data[2] = 0;
|
|
|
|
|
|
|
|
task->data[3] = task->data[0];
|
|
|
|
task->data[4] = 8;
|
|
|
|
task->data[5] = gBattleAnimArgs[1];
|
|
|
|
task->data[6] = 0;
|
|
|
|
task->data[7] = 0;
|
|
|
|
|
|
|
|
if (toBG2 == 1)
|
|
|
|
{
|
|
|
|
var3 = gBattle_BG1_X;
|
|
|
|
task->data[8] = var3;
|
2021-04-15 08:04:01 +02:00
|
|
|
var4 = var3 + DISPLAY_WIDTH;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var3 = gBattle_BG2_X;
|
|
|
|
task->data[8] = var3;
|
2021-04-15 08:04:01 +02:00
|
|
|
var4 = var3 + DISPLAY_WIDTH;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
task->data[9] = var4;
|
|
|
|
task->data[10] = gBattleAnimArgs[2];
|
|
|
|
|
|
|
|
if (!gBattleAnimArgs[2])
|
|
|
|
{
|
|
|
|
task->data[11] = var4;
|
|
|
|
var2 = task->data[8];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[11] = var3;
|
|
|
|
var2 = task->data[9];
|
|
|
|
}
|
|
|
|
|
|
|
|
task->data[15] = 0;
|
|
|
|
|
|
|
|
i = task->data[2];
|
|
|
|
while (i <= task->data[3])
|
|
|
|
{
|
|
|
|
gScanlineEffectRegBuffers[0][i] = var2;
|
|
|
|
gScanlineEffectRegBuffers[1][i] = var2;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (toBG2 == 1)
|
|
|
|
scanlineParams.dmaDest = ®_BG1HOFS;
|
|
|
|
else
|
|
|
|
scanlineParams.dmaDest = ®_BG2HOFS;
|
|
|
|
|
|
|
|
scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT;
|
|
|
|
scanlineParams.initState = 1;
|
|
|
|
scanlineParams.unused9 = 0;
|
|
|
|
ScanlineEffect_SetParams(scanlineParams);
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
task->func = RapinSpinMonElevation_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void RapinSpinMonElevation_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
s16 i;
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
task->data[0] -= task->data[5];
|
|
|
|
if (task->data[0] < task->data[2])
|
|
|
|
task->data[0] = task->data[2];
|
|
|
|
|
|
|
|
if (task->data[4] == 0)
|
|
|
|
{
|
|
|
|
task->data[1] -= task->data[5];
|
|
|
|
if (task->data[1] < task->data[2])
|
|
|
|
{
|
|
|
|
task->data[1] = task->data[2];
|
|
|
|
task->data[15] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[4]--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++task->data[6] > 1)
|
|
|
|
{
|
|
|
|
task->data[6] = 0;
|
|
|
|
task->data[7] = task->data[7] == 0 ? 1 : 0;
|
|
|
|
|
|
|
|
if (task->data[7])
|
|
|
|
task->data[12] = task->data[8];
|
|
|
|
else
|
2018-12-24 21:59:05 +01:00
|
|
|
task->data[12] = task->data[9];
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
i = task->data[0];
|
|
|
|
while (i < task->data[1])
|
|
|
|
{
|
|
|
|
gScanlineEffectRegBuffers[0][i] = task->data[12];
|
|
|
|
gScanlineEffectRegBuffers[1][i] = task->data[12];
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = task->data[1];
|
|
|
|
while (i <= task->data[3])
|
|
|
|
{
|
|
|
|
gScanlineEffectRegBuffers[0][i] = task->data[11];
|
|
|
|
gScanlineEffectRegBuffers[1][i] = task->data[11];
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (task->data[15])
|
|
|
|
{
|
|
|
|
if (task->data[10])
|
|
|
|
gScanlineEffect.state = 3;
|
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
void AnimTask_TormentAttacker(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
task->data[0] = 0;
|
|
|
|
task->data[1] = 0;
|
2021-11-08 17:46:38 +01:00
|
|
|
task->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
task->data[3] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-19 02:03:26 +01:00
|
|
|
task->data[4] = 32;
|
|
|
|
task->data[5] = -20;
|
|
|
|
task->data[6] = 0;
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
2019-11-23 11:57:39 +01:00
|
|
|
task->func = TormentAttacker_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void TormentAttacker_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
int var0, var1;
|
|
|
|
s16 x, y;
|
|
|
|
u16 i, j;
|
|
|
|
u8 spriteId;
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
var0 = task->data[2];
|
|
|
|
if (task->data[1] & 1)
|
|
|
|
{
|
|
|
|
var1 = task->data[4];
|
|
|
|
x = var0 - var1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var1 = task->data[4];
|
|
|
|
x = var0 + var1;
|
|
|
|
}
|
|
|
|
|
|
|
|
y = task->data[3] + task->data[5];
|
2019-10-16 19:10:39 +02:00
|
|
|
spriteId = CreateSprite(&gThoughtBubbleSpriteTemplate, x, y, 6 - task->data[1]);
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE12WithPanning(SE_M_METRONOME, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (spriteId != MAX_SPRITES)
|
|
|
|
{
|
|
|
|
gSprites[spriteId].hFlip = task->data[1] & 1;
|
|
|
|
gSprites[spriteId].callback = SpriteCallbackDummy;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (task->data[1] & 1)
|
|
|
|
{
|
|
|
|
task->data[4] -= 6;
|
|
|
|
task->data[5] -= 6;
|
|
|
|
}
|
|
|
|
|
2021-04-13 09:28:03 +02:00
|
|
|
PrepareAffineAnimInTaskData(task, task->data[15], sAffineAnims_Torment);
|
2018-12-19 02:03:26 +01:00
|
|
|
task->data[1]++;
|
|
|
|
task->data[0] = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (!RunAffineAnimFromTaskData(task))
|
|
|
|
{
|
|
|
|
if (task->data[1] == 6)
|
|
|
|
{
|
|
|
|
task->data[6] = 8;
|
|
|
|
task->data[0] = 3;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (task->data[1] <= 2)
|
|
|
|
task->data[6] = 10;
|
|
|
|
else
|
|
|
|
task->data[6] = 0;
|
|
|
|
|
|
|
|
task->data[0] = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (task->data[6] != 0)
|
|
|
|
task->data[6]--;
|
|
|
|
else
|
|
|
|
task->data[0] = 0;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (task->data[6] != 0)
|
|
|
|
task->data[6]--;
|
|
|
|
else
|
|
|
|
task->data[0] = 4;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
for (i = 0, j = 0; i < MAX_SPRITES; i++)
|
|
|
|
{
|
2019-10-16 19:10:39 +02:00
|
|
|
if (gSprites[i].template == &gThoughtBubbleSpriteTemplate)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
gSprites[i].data[0] = taskId;
|
|
|
|
gSprites[i].data[1] = 6;
|
|
|
|
StartSpriteAnim(&gSprites[i], 2);
|
2019-11-23 11:57:39 +01:00
|
|
|
gSprites[i].callback = TormentAttacker_Callback;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (++j == 6)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task->data[6] = j;
|
|
|
|
task->data[0] = 5;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
if (task->data[6] == 0)
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void TormentAttacker_Callback(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (sprite->animEnded)
|
|
|
|
{
|
|
|
|
gTasks[sprite->data[0]].data[sprite->data[1]]--;
|
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTriAttackTriangle(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (sprite->data[0] == 0)
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimAttacker(sprite, FALSE);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (++sprite->data[0] < 40)
|
|
|
|
{
|
|
|
|
u16 var = sprite->data[0];
|
|
|
|
if ((var & 1) == 0)
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite->data[0] > 30)
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (sprite->data[0] == 61)
|
|
|
|
{
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += sprite->x2;
|
|
|
|
sprite->y += sprite->y2;
|
|
|
|
sprite->x2 = 0;
|
|
|
|
sprite->y2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[0] = 20;
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
|
|
|
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->callback = StartAnimLinearTranslation;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
void AnimTask_DefenseCurlDeformMon(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
switch (gTasks[taskId].data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2019-10-21 18:29:59 +02:00
|
|
|
PrepareAffineAnimInTaskData(&gTasks[taskId], GetAnimBattlerSpriteId(ANIM_ATTACKER), DefenseCurlDeformMonAffineAnimCmds);
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimBatonPassPokeball(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
|
|
|
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-19 02:03:26 +01:00
|
|
|
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
|
|
|
|
sprite->data[1] = 256;
|
|
|
|
sprite->data[2] = 256;
|
|
|
|
sprite->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sprite->data[1] += 96;
|
|
|
|
sprite->data[2] -= 26;
|
|
|
|
SetSpriteRotScale(spriteId, sprite->data[1], sprite->data[2], 0);
|
|
|
|
|
|
|
|
if (++sprite->data[3] == 5)
|
|
|
|
sprite->data[0]++;
|
|
|
|
// fall through
|
|
|
|
case 2:
|
|
|
|
sprite->data[1] += 96;
|
|
|
|
sprite->data[2] += 48;
|
|
|
|
SetSpriteRotScale(spriteId, sprite->data[1], sprite->data[2], 0);
|
|
|
|
|
|
|
|
if (++sprite->data[3] == 9)
|
|
|
|
{
|
|
|
|
sprite->data[3] = 0;
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[spriteId].invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
ResetSpriteRotScale(spriteId);
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 -= 6;
|
|
|
|
if (sprite->y + sprite->y2 < -32)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimWishStar(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = -16;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2022-08-17 17:44:20 +02:00
|
|
|
sprite->x = DISPLAY_WIDTH + 16;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y = 0;
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimWishStar_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimWishStar_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u32 newX;
|
|
|
|
|
|
|
|
sprite->data[0] += 72;
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = sprite->data[0] >> 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = -(sprite->data[0] >> 4);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
sprite->data[1] += 16;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 += sprite->data[1] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (++sprite->data[2] % 3 == 0)
|
|
|
|
{
|
|
|
|
CreateSpriteAndAnimate(
|
2018-12-30 17:58:42 +01:00
|
|
|
&gMiniTwinklingStarSpriteTemplate,
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x + sprite->x2,
|
|
|
|
sprite->y + sprite->y2,
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->subpriority + 1);
|
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
newX = sprite->x + sprite->x2 + 32;
|
2022-08-17 17:44:20 +02:00
|
|
|
if (newX > DISPLAY_WIDTH + 64)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimMiniTwinklingStar(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 rand;
|
|
|
|
s8 y;
|
|
|
|
|
|
|
|
rand = Random2() & 3;
|
|
|
|
if (rand == 0)
|
|
|
|
sprite->oam.tileNum += 4;
|
|
|
|
else
|
|
|
|
sprite->oam.tileNum += 5;
|
|
|
|
|
|
|
|
y = Random2() & 7;
|
|
|
|
if (y > 3)
|
|
|
|
y = -y;
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = y;
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimMiniTwinklingStar_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimMiniTwinklingStar_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (++sprite->data[0] < 30)
|
|
|
|
{
|
|
|
|
if (++sprite->data[1] == 2)
|
|
|
|
{
|
|
|
|
sprite->invisible ^= 1;
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sprite->data[1] == 2)
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (sprite->data[1] == 3)
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[1]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite->data[0] > 60)
|
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
void AnimTask_StockpileDeformMon(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (!gTasks[taskId].data[0])
|
|
|
|
{
|
2019-10-21 18:29:59 +02:00
|
|
|
PrepareAffineAnimInTaskData(&gTasks[taskId], GetAnimBattlerSpriteId(ANIM_ATTACKER), gStockpileDeformMonAffineAnimCmds);
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
void AnimTask_SpitUpDeformMon(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (!gTasks[taskId].data[0])
|
|
|
|
{
|
2019-10-21 18:29:59 +02:00
|
|
|
PrepareAffineAnimInTaskData(&gTasks[taskId], GetAnimBattlerSpriteId(ANIM_ATTACKER), gSpitUpDeformMonAffineAnimCmds);
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSwallowBlueOrb(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimAttacker(sprite, FALSE);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = 0x900;
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 -= sprite->data[1] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] -= 96;
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->y + sprite->y2 > sprite->data[2])
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-21 18:29:59 +02:00
|
|
|
void AnimTask_SwallowDeformMon(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (!gTasks[taskId].data[0])
|
|
|
|
{
|
2019-10-21 18:29:59 +02:00
|
|
|
PrepareAffineAnimInTaskData(&gTasks[taskId], GetAnimBattlerSpriteId(ANIM_ATTACKER), gSwallowDeformMonAffineAnimCmds);
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
void AnimTask_TransformMon(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
u8 position;
|
2019-02-06 20:17:09 +01:00
|
|
|
struct BattleAnimBgData animBg;
|
2018-12-19 02:03:26 +01:00
|
|
|
u8 *dest;
|
|
|
|
u8 *src;
|
2019-02-06 20:17:09 +01:00
|
|
|
u16 *bgTilemap;
|
2018-12-19 02:03:26 +01:00
|
|
|
u16 stretch;
|
|
|
|
|
|
|
|
switch (gTasks[taskId].data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
SetGpuReg(REG_OFFSET_MOSAIC, 0);
|
2018-12-20 04:13:26 +01:00
|
|
|
if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1)
|
2018-12-19 02:03:26 +01:00
|
|
|
SetAnimBgAttribute(1, BG_ANIM_MOSAIC, 1);
|
|
|
|
else
|
|
|
|
SetAnimBgAttribute(2, BG_ANIM_MOSAIC, 1);
|
|
|
|
|
|
|
|
gTasks[taskId].data[10] = gBattleAnimArgs[0];
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (gTasks[taskId].data[2]++ > 1)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[2] = 0;
|
|
|
|
gTasks[taskId].data[1]++;
|
|
|
|
stretch = gTasks[taskId].data[1];
|
|
|
|
SetGpuReg(REG_OFFSET_MOSAIC, (stretch << 4) | stretch);
|
|
|
|
if (stretch == 15)
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
HandleSpeciesGfxDataChange(gBattleAnimAttacker, gBattleAnimTarget, gTasks[taskId].data[10]);
|
2021-11-08 19:18:58 +01:00
|
|
|
GetBgDataForTransform(&animBg, gBattleAnimAttacker);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (IsContest())
|
2021-10-03 05:47:59 +02:00
|
|
|
position = B_POSITION_PLAYER_LEFT;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
|
|
|
position = GetBattlerPosition(gBattleAnimAttacker);
|
|
|
|
|
2020-09-19 19:37:24 +02:00
|
|
|
src = gMonSpritesGfxPtr->sprites.ptr[position] + (gBattleMonForms[gBattleAnimAttacker] << 11);
|
2019-02-06 20:17:09 +01:00
|
|
|
dest = animBg.bgTiles;
|
2021-03-29 15:38:19 +02:00
|
|
|
CpuCopy32(src, dest, MON_PIC_SIZE);
|
2019-02-06 20:17:09 +01:00
|
|
|
LoadBgTiles(1, animBg.bgTiles, 0x800, animBg.tilesOffset);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (IsContest())
|
|
|
|
{
|
2020-08-14 01:10:23 +02:00
|
|
|
if (IsSpeciesNotUnown(gContestResources->moveAnim->species) != IsSpeciesNotUnown(gContestResources->moveAnim->targetSpecies))
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-02-06 20:17:09 +01:00
|
|
|
bgTilemap = (u16 *)animBg.bgTilemap;
|
2018-12-19 02:03:26 +01:00
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < 4; j++)
|
|
|
|
{
|
2019-02-06 20:17:09 +01:00
|
|
|
u16 temp = bgTilemap[j + i * 0x20];
|
|
|
|
bgTilemap[j + i * 0x20] = bgTilemap[(7 - j) + i * 0x20];
|
|
|
|
bgTilemap[(7 - j) + i * 0x20] = temp;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < 8; j++)
|
|
|
|
{
|
2019-02-06 20:17:09 +01:00
|
|
|
bgTilemap[j + i * 0x20] ^= 0x400;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-14 01:10:23 +02:00
|
|
|
if (IsSpeciesNotUnown(gContestResources->moveAnim->targetSpecies))
|
2021-04-25 05:29:49 +02:00
|
|
|
gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteContest;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-01-23 05:22:37 +01:00
|
|
|
gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteOpponentSide;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-04-25 05:29:49 +02:00
|
|
|
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], BATTLER_AFFINE_NORMAL);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (gTasks[taskId].data[2]++ > 1)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[2] = 0;
|
|
|
|
gTasks[taskId].data[1]--;
|
|
|
|
stretch = gTasks[taskId].data[1];
|
|
|
|
SetGpuReg(REG_OFFSET_MOSAIC, (stretch << 4) | stretch);
|
|
|
|
|
|
|
|
if (stretch == 0)
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
SetGpuReg(REG_OFFSET_MOSAIC, 0);
|
2018-12-20 04:13:26 +01:00
|
|
|
if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1)
|
2018-12-19 02:03:26 +01:00
|
|
|
SetAnimBgAttribute(1, BG_ANIM_MOSAIC, 0);
|
|
|
|
else
|
|
|
|
SetAnimBgAttribute(2, BG_ANIM_MOSAIC, 0);
|
|
|
|
|
|
|
|
if (!IsContest())
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
|
|
|
|
{
|
|
|
|
if (gTasks[taskId].data[10] == 0)
|
|
|
|
SetBattlerShadowSpriteCallback(gBattleAnimAttacker, gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
void AnimTask_IsMonInvisible(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].invisible;
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 05:13:54 +01:00
|
|
|
void AnimTask_CastformGfxDataChange(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
HandleSpeciesGfxDataChange(gBattleAnimAttacker, gBattleAnimTarget, TRUE);
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
void AnimTask_MorningSunLightBeam(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-02-06 20:17:09 +01:00
|
|
|
struct BattleAnimBgData animBg;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
switch (gTasks[taskId].data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_BG1);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0);
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
|
|
|
if (!IsContest())
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
GetBattleAnimBg1Data(&animBg);
|
2021-10-04 16:21:03 +02:00
|
|
|
AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimMaskTilemap_LightBeam, FALSE);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (IsContest())
|
|
|
|
{
|
|
|
|
gBattle_BG1_X = -56;
|
|
|
|
gBattle_BG1_Y = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
gBattle_BG1_X = -135;
|
|
|
|
else
|
|
|
|
gBattle_BG1_X = -10;
|
|
|
|
|
|
|
|
gBattle_BG1_Y = 0;
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimMaskImage_LightBeam, animBg.tilesOffset);
|
2022-08-19 16:29:35 +02:00
|
|
|
LoadCompressedPalette(gBattleAnimMaskPalette_LightBeam, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
gTasks[taskId].data[10] = gBattle_BG1_X;
|
|
|
|
gTasks[taskId].data[11] = gBattle_BG1_Y;
|
|
|
|
|
|
|
|
gTasks[taskId].data[0]++;
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (gTasks[taskId].data[4]++ > 0)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[4] = 0;
|
|
|
|
if (++gTasks[taskId].data[1] > 12)
|
|
|
|
gTasks[taskId].data[1] = 12;
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2018-12-19 02:03:26 +01:00
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[1], 16 - gTasks[taskId].data[1]));
|
|
|
|
|
|
|
|
if (gTasks[taskId].data[1] == 12)
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (--gTasks[taskId].data[1] < 0)
|
|
|
|
gTasks[taskId].data[1] = 0;
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[1], 16 - gTasks[taskId].data[1]));
|
|
|
|
|
|
|
|
if (!gTasks[taskId].data[1])
|
|
|
|
{
|
2019-10-21 18:36:45 +02:00
|
|
|
gBattle_BG1_X = gMorningSunLightBeamCoordsTable[gTasks[taskId].data[2]] + gTasks[taskId].data[10];
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++gTasks[taskId].data[2] == 4)
|
|
|
|
gTasks[taskId].data[0] = 4;
|
|
|
|
else
|
|
|
|
gTasks[taskId].data[0] = 3;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (++gTasks[taskId].data[3] == 4)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[3] = 0;
|
|
|
|
gTasks[taskId].data[0] = 1;
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
2021-02-28 00:41:30 +01:00
|
|
|
GetBattleAnimBg1Data(&animBg);
|
|
|
|
ClearBattleAnimBg(animBg.bgId);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (!IsContest())
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
|
|
|
|
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
|
|
|
gBattle_BG1_X = 0;
|
|
|
|
gBattle_BG1_Y = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimGreenStar(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
s16 xOffset;
|
|
|
|
u8 spriteId1;
|
|
|
|
u8 spriteId2;
|
|
|
|
|
|
|
|
xOffset = Random2();
|
|
|
|
xOffset &= 0x3F;
|
|
|
|
if (xOffset > 31)
|
|
|
|
xOffset = 32 - xOffset;
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + xOffset;
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 32;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = gBattleAnimArgs[0];
|
|
|
|
sprite->data[2] = gBattleAnimArgs[1];
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
spriteId1 = CreateSprite(&gGreenStarSpriteTemplate, sprite->x, sprite->y, sprite->subpriority + 1);
|
|
|
|
spriteId2 = CreateSprite(&gGreenStarSpriteTemplate, sprite->x, sprite->y, sprite->subpriority + 1);
|
2018-12-19 02:03:26 +01:00
|
|
|
StartSpriteAnim(&gSprites[spriteId1], 1);
|
|
|
|
StartSpriteAnim(&gSprites[spriteId2], 2);
|
|
|
|
|
|
|
|
gSprites[spriteId1].data[1] = gBattleAnimArgs[0];
|
|
|
|
gSprites[spriteId1].data[2] = gBattleAnimArgs[1];
|
|
|
|
gSprites[spriteId2].data[1] = gBattleAnimArgs[0];
|
|
|
|
gSprites[spriteId2].data[2] = gBattleAnimArgs[1];
|
|
|
|
gSprites[spriteId1].data[7] = -1;
|
|
|
|
gSprites[spriteId2].data[7] = -1;
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[spriteId1].invisible = TRUE;
|
|
|
|
gSprites[spriteId2].invisible = TRUE;
|
2019-10-21 18:36:45 +02:00
|
|
|
gSprites[spriteId1].callback = AnimGreenStar_Callback;
|
|
|
|
gSprites[spriteId2].callback = AnimGreenStar_Callback;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
sprite->data[6] = spriteId1;
|
|
|
|
sprite->data[7] = spriteId2;
|
2019-10-21 18:36:45 +02:00
|
|
|
sprite->callback = AnimGreenStar_Step1;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
static void AnimGreenStar_Step1(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-07-30 15:08:49 +02:00
|
|
|
s16 delta = sprite->data[3] + sprite->data[2];
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 -= delta >> 8;
|
2019-07-30 15:08:49 +02:00
|
|
|
sprite->data[3] += sprite->data[2];
|
|
|
|
sprite->data[3] &= 0xFF;
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->data[4] == 0 && sprite->y2 < -8)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[sprite->data[6]].invisible = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[4]++;
|
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->data[4] == 1 && sprite->y2 < -16)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[sprite->data[7]].invisible = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[4]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (--sprite->data[1] == -1)
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2019-10-21 18:36:45 +02:00
|
|
|
sprite->callback = AnimGreenStar_Step2;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
static void AnimGreenStar_Step2(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (gSprites[sprite->data[6]].callback == SpriteCallbackDummy
|
|
|
|
&& gSprites[sprite->data[7]].callback == SpriteCallbackDummy)
|
|
|
|
{
|
|
|
|
DestroySprite(&gSprites[sprite->data[6]]);
|
|
|
|
DestroySprite(&gSprites[sprite->data[7]]);
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
static void AnimGreenStar_Callback(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (!sprite->invisible)
|
|
|
|
{
|
2019-07-30 15:08:49 +02:00
|
|
|
s16 delta = sprite->data[3] + sprite->data[2];
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 -= delta >> 8;
|
2019-07-30 15:08:49 +02:00
|
|
|
sprite->data[3] += sprite->data[2];
|
|
|
|
sprite->data[3] &= 0xFF;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (--sprite->data[1] == -1)
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->callback = SpriteCallbackDummy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-21 18:36:45 +02:00
|
|
|
void AnimTask_DoomDesireLightBeam(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2019-02-06 20:17:09 +01:00
|
|
|
struct BattleAnimBgData animBg;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
switch (gTasks[taskId].data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_BG1);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(3, 13));
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0);
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
|
|
|
if (!IsContest())
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
GetBattleAnimBg1Data(&animBg);
|
2021-10-04 16:21:03 +02:00
|
|
|
AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimMaskTilemap_LightBeam, FALSE);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (IsContest())
|
|
|
|
{
|
|
|
|
gBattle_BG1_X = -56;
|
|
|
|
gBattle_BG1_Y = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
u8 position = GetBattlerPosition(gBattleAnimTarget);
|
|
|
|
if (IsDoubleBattle() == TRUE)
|
|
|
|
{
|
|
|
|
if (position == B_POSITION_OPPONENT_LEFT)
|
|
|
|
gBattle_BG1_X = -155;
|
|
|
|
if (position == B_POSITION_OPPONENT_RIGHT)
|
|
|
|
gBattle_BG1_X = -115;
|
|
|
|
if (position == B_POSITION_PLAYER_LEFT)
|
|
|
|
gBattle_BG1_X = 14;
|
|
|
|
if (position == B_POSITION_PLAYER_RIGHT)
|
|
|
|
gBattle_BG1_X = -20;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (position == B_POSITION_OPPONENT_LEFT)
|
|
|
|
gBattle_BG1_X = -135;
|
|
|
|
if (position == B_POSITION_PLAYER_LEFT)
|
|
|
|
gBattle_BG1_X = -10;
|
|
|
|
}
|
|
|
|
|
|
|
|
gBattle_BG1_Y = 0;
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:38:20 +01:00
|
|
|
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimMaskImage_LightBeam, animBg.tilesOffset);
|
2022-08-19 16:29:35 +02:00
|
|
|
LoadCompressedPalette(gBattleAnimMaskPalette_LightBeam, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[10] = gBattle_BG1_X;
|
|
|
|
gTasks[taskId].data[11] = gBattle_BG1_Y;
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
gTasks[taskId].data[3] = 0;
|
|
|
|
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT)
|
2019-10-21 18:36:45 +02:00
|
|
|
gBattle_BG1_X = gTasks[taskId].data[10] + gDoomDesireLightBeamCoordTable[gTasks[taskId].data[2]];
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2019-10-21 18:36:45 +02:00
|
|
|
gBattle_BG1_X = gTasks[taskId].data[10] - gDoomDesireLightBeamCoordTable[gTasks[taskId].data[2]];
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (++gTasks[taskId].data[2] == 5)
|
|
|
|
gTasks[taskId].data[0] = 5;
|
|
|
|
else
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (--gTasks[taskId].data[1] <= 4)
|
|
|
|
gTasks[taskId].data[1] = 5;
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(3, gTasks[taskId].data[1]));
|
|
|
|
if (gTasks[taskId].data[1] == 5)
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 3:
|
2019-10-21 18:36:45 +02:00
|
|
|
if (++gTasks[taskId].data[3] > gDoomDesireLightBeamDelayTable[gTasks[taskId].data[2]])
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (++gTasks[taskId].data[1] > 13)
|
|
|
|
gTasks[taskId].data[1] = 13;
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(3, gTasks[taskId].data[1]));
|
|
|
|
if (gTasks[taskId].data[1] == 13)
|
|
|
|
gTasks[taskId].data[0] = 1;
|
|
|
|
break;
|
|
|
|
case 5:
|
2021-02-28 00:41:30 +01:00
|
|
|
GetBattleAnimBg1Data(&animBg);
|
|
|
|
ClearBattleAnimBg(animBg.bgId);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (!IsContest())
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2018-12-19 02:03:26 +01:00
|
|
|
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
|
|
|
gBattle_BG1_X = 0;
|
|
|
|
gBattle_BG1_Y = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Briefly vertically grows and shrinks the attacking mon's sprite.
|
|
|
|
// No args.
|
|
|
|
void AnimTask_StrongFrustrationGrowAndShrink(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (gTasks[taskId].data[0] == 0)
|
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
PrepareAffineAnimInTaskData(&gTasks[taskId], GetAnimBattlerSpriteId(ANIM_ATTACKER), gStrongFrustrationAffineAnimCmds);
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Animates an anger mark near the mon's head.
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimWeakFrustrationAngerMark(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (sprite->data[0] == 0)
|
|
|
|
{
|
2022-07-25 20:59:14 +02:00
|
|
|
InitSpritePosToAnimAttacker(sprite, FALSE);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
else if (sprite->data[0]++ > 20)
|
|
|
|
{
|
|
|
|
sprite->data[1] += 160;
|
|
|
|
sprite->data[2] += 128;
|
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = -(sprite->data[1] >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = sprite->data[1] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 += sprite->data[2] >> 8;
|
|
|
|
if (sprite->y2 > 64)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Rocks the mon back and forth. This is done on a pivot so it is done via rotation.
|
|
|
|
// arg 0: which battler
|
|
|
|
// arg 1: number of rocks
|
|
|
|
// arg 2: rotation speed increase
|
|
|
|
void AnimTask_RockMonBackAndForth(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 side;
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
if (!gBattleAnimArgs[1])
|
|
|
|
{
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[2] < 0)
|
|
|
|
gBattleAnimArgs[2] = 0;
|
|
|
|
if (gBattleAnimArgs[2] > 2)
|
|
|
|
gBattleAnimArgs[2] = 2;
|
|
|
|
|
|
|
|
task->data[0] = 0;
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 8 - (2 * gBattleAnimArgs[2]);
|
|
|
|
task->data[4] = 0x100 + (gBattleAnimArgs[2] * 128);
|
|
|
|
task->data[5] = gBattleAnimArgs[2] + 2;
|
|
|
|
task->data[6] = gBattleAnimArgs[1] - 1;
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-19 02:03:26 +01:00
|
|
|
side = GetBattlerSide(gBattleAnimAttacker);
|
|
|
|
else
|
|
|
|
side = GetBattlerSide(gBattleAnimTarget);
|
|
|
|
|
|
|
|
if (side == B_SIDE_OPPONENT)
|
|
|
|
{
|
|
|
|
task->data[4] *= -1;
|
|
|
|
task->data[5] *= -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
PrepareBattlerSpriteForRotScale(task->data[15], ST_OAM_OBJ_NORMAL);
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_RockMonBackAndForth_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_RockMonBackAndForth_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 += task->data[5];
|
2018-12-19 02:03:26 +01:00
|
|
|
task->data[2] -= task->data[4];
|
|
|
|
SetSpriteRotScale(task->data[15], 0x100, 0x100, task->data[2]);
|
|
|
|
SetBattlerSpriteYOffsetFromRotation(task->data[15]);
|
|
|
|
if (++task->data[1] >= task->data[3])
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 -= task->data[5];
|
2018-12-19 02:03:26 +01:00
|
|
|
task->data[2] += task->data[4];
|
|
|
|
SetSpriteRotScale(task->data[15], 0x100, 0x100, task->data[2]);
|
|
|
|
SetBattlerSpriteYOffsetFromRotation(task->data[15]);
|
|
|
|
if (++task->data[1] >= task->data[3] * 2)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 += task->data[5];
|
2018-12-19 02:03:26 +01:00
|
|
|
task->data[2] -= task->data[4];
|
|
|
|
SetSpriteRotScale(task->data[15], 0x100, 0x100, task->data[2]);
|
|
|
|
SetBattlerSpriteYOffsetFromRotation(task->data[15]);
|
|
|
|
if (++task->data[1] >= task->data[3])
|
|
|
|
{
|
|
|
|
if (task->data[6])
|
|
|
|
{
|
|
|
|
task->data[6]--;
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
ResetSpriteRotScale(task->data[15]);
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Floats a petal across the screen towards the target mon's side.
|
|
|
|
// arg 0: initial y pixel offset
|
|
|
|
// arg 1: sprite anim num
|
|
|
|
// arg 2: unused
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSweetScentPetal(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = 0;
|
|
|
|
sprite->y = gBattleAnimArgs[0];
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = DISPLAY_WIDTH;
|
|
|
|
sprite->y = gBattleAnimArgs[0] - 30;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[2] = gBattleAnimArgs[2];
|
|
|
|
StartSpriteAnim(sprite, gBattleAnimArgs[1]);
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimSweetScentPetal_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSweetScentPetal_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[0] += 3;
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += 5;
|
|
|
|
sprite->y -= 1;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->x > DISPLAY_WIDTH)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = Sin(sprite->data[0] & 0xFF, 16);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x -= 5;
|
|
|
|
sprite->y += 1;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->x < 0)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = Cos(sprite->data[0] & 0xFF, 16);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Moves the mon sprite in a flailing back-and-forth motion.
|
|
|
|
// arg 0: which battler
|
|
|
|
void AnimTask_FlailMovement(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
task->data[0] = 0;
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 0;
|
|
|
|
task->data[12] = 0x20;
|
|
|
|
task->data[13] = 0x40;
|
|
|
|
task->data[14] = 0x800;
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
|
|
|
|
|
|
|
|
PrepareBattlerSpriteForRotScale(task->data[15], ST_OAM_OBJ_NORMAL);
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_FlailMovement_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_FlailMovement_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
int temp;
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
task->data[2] += 0x200;
|
|
|
|
if (task->data[2] >= task->data[14])
|
|
|
|
{
|
|
|
|
s16 diff = task->data[14] - task->data[2];
|
|
|
|
s16 div = diff / (task->data[14] * 2);
|
|
|
|
s16 mod = diff % (task->data[14] * 2);
|
|
|
|
|
|
|
|
if ((div & 1) == 0)
|
|
|
|
{
|
|
|
|
task->data[2] = task->data[14] - mod;
|
|
|
|
task->data[0] = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[2] = mod - task->data[14];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
task->data[2] -= 0x200;
|
|
|
|
if (task->data[2] <= -task->data[14])
|
|
|
|
{
|
|
|
|
s16 diff = task->data[14] - task->data[2];
|
|
|
|
s16 div = diff / (task->data[14] * 2);
|
|
|
|
s16 mod = diff % (task->data[14] * 2);
|
|
|
|
|
|
|
|
if ((1 & div) == 0)
|
|
|
|
{
|
|
|
|
task->data[2] = mod - task->data[14];
|
|
|
|
task->data[0] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[2] = task->data[14] - mod;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
ResetSpriteRotScale(task->data[15]);
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetSpriteRotScale(task->data[15], 0x100, 0x100, task->data[2]);
|
|
|
|
SetBattlerSpriteYOffsetFromRotation(task->data[15]);
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = -(((temp = task->data[2]) >= 0 ? task->data[2] : temp + 63) >> 6);
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++task->data[1] > 8)
|
|
|
|
{
|
|
|
|
if (task->data[12])
|
|
|
|
{
|
|
|
|
task->data[12]--;
|
|
|
|
task->data[14] -= task->data[13];
|
|
|
|
if (task->data[14] < 16)
|
|
|
|
task->data[14] = 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[0] = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Makes a spark-like projectile fall on top of the mon.
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
|
|
|
// arg 2: which battler
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimPainSplitProjectile(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (!sprite->data[0])
|
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
if (gBattleAnimArgs[2] == ANIM_ATTACKER)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += gBattleAnimArgs[0];
|
|
|
|
sprite->y += gBattleAnimArgs[1];
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = 0x80;
|
|
|
|
sprite->data[2] = 0x300;
|
|
|
|
sprite->data[3] = gBattleAnimArgs[1];
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = sprite->data[1] >> 8;
|
|
|
|
sprite->y2 += sprite->data[2] >> 8;
|
|
|
|
if (sprite->data[4] == 0 && sprite->y2 > -sprite->data[3])
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[4] = 1;
|
|
|
|
sprite->data[2] = (-sprite->data[2] / 3) * 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[1] += 192;
|
|
|
|
sprite->data[2] += 128;
|
|
|
|
if (sprite->animEnded)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Performs one of several affine transformations on the mon sprite.
|
|
|
|
// arg 0: which battler
|
|
|
|
// arg 1: which transformation
|
|
|
|
void AnimTask_PainSplitMovement(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 spriteId;
|
|
|
|
|
|
|
|
if (gTasks[taskId].data[0] == 0)
|
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[11] = gBattleAnimAttacker;
|
|
|
|
else
|
|
|
|
gTasks[taskId].data[11] = gBattleAnimTarget;
|
|
|
|
|
|
|
|
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
|
|
|
|
gTasks[taskId].data[10] = spriteId;
|
|
|
|
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
|
|
|
|
|
|
|
|
switch (gBattleAnimArgs[1])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
SetSpriteRotScale(spriteId, 0xE0, 0x140, 0);
|
|
|
|
SetBattlerSpriteYOffsetFromYScale(spriteId);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
SetSpriteRotScale(spriteId, 0xD0, 0x130, 0xF00);
|
|
|
|
SetBattlerSpriteYOffsetFromYScale(spriteId);
|
|
|
|
if (IsContest() || GetBattlerSide(gTasks[taskId].data[11]) == B_SIDE_PLAYER)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].y2 += 16;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
SetSpriteRotScale(spriteId, 0xD0, 0x130, 0xF100);
|
|
|
|
SetBattlerSpriteYOffsetFromYScale(spriteId);
|
|
|
|
if (IsContest() || GetBattlerSide(gTasks[taskId].data[11]) == B_SIDE_PLAYER)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].y2 += 16;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 = 2;
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
spriteId = gTasks[taskId].data[10];
|
|
|
|
if (++gTasks[taskId].data[2] == 3)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[2] = 0;
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 = -gSprites[spriteId].x2;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (++gTasks[taskId].data[1] == 13)
|
|
|
|
{
|
|
|
|
ResetSpriteRotScale(spriteId);
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 = 0;
|
|
|
|
gSprites[spriteId].y2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Move a piece of confetti in a slightly-random speed across the screen.
|
|
|
|
// arg 0: which battler the confetti starts from
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFlatterConfetti(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 tileOffset;
|
|
|
|
int rand1;
|
|
|
|
int rand2;
|
|
|
|
|
|
|
|
tileOffset = Random2() % 12;
|
|
|
|
sprite->oam.tileNum += tileOffset;
|
|
|
|
rand1 = Random2() & 0x1FF;
|
|
|
|
rand2 = Random2() & 0xFF;
|
|
|
|
|
|
|
|
if (rand1 & 1)
|
|
|
|
sprite->data[0] = 0x5E0 + rand1;
|
|
|
|
else
|
|
|
|
sprite->data[0] = 0x5E0 - rand1;
|
|
|
|
|
|
|
|
if (rand2 & 1)
|
|
|
|
sprite->data[1] = 0x480 + rand2;
|
|
|
|
else
|
|
|
|
sprite->data[1] = 0x480 - rand2;
|
|
|
|
|
|
|
|
sprite->data[2] = gBattleAnimArgs[0];
|
2018-12-31 18:01:37 +01:00
|
|
|
if (sprite->data[2] == ANIM_ATTACKER)
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = -8;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = 248;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y = 104;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimFlatterConfetti_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFlatterConfetti_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (sprite->data[2] == 0)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 += sprite->data[0] >> 8;
|
|
|
|
sprite->y2 -= sprite->data[1] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 -= sprite->data[0] >> 8;
|
|
|
|
sprite->y2 -= sprite->data[1] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[0] -= 22;
|
|
|
|
sprite->data[1] -= 48;
|
|
|
|
if (sprite->data[0] < 0)
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
|
|
|
|
if (++sprite->data[3] == 31)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Uses a spotlight sprite as a light mask to illuminate the target mon. The spotlight grows and shrinks.
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
|
|
|
// arg 2: duration of fully-opened spotlight
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFlatterSpotlight(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ);
|
|
|
|
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON);
|
|
|
|
gBattle_WIN0H = 0;
|
|
|
|
gBattle_WIN0V = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_WIN0H, gBattle_WIN0H);
|
|
|
|
SetGpuReg(REG_OFFSET_WIN0V, gBattle_WIN0V);
|
|
|
|
|
|
|
|
sprite->data[0] = gBattleAnimArgs[2];
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimTarget(sprite, FALSE);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->oam.objMode = ST_OAM_OBJ_WINDOW;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
|
|
|
sprite->callback = AnimFlatterSpotlight_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFlatterSpotlight_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[1])
|
|
|
|
{
|
|
|
|
case 0:
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (sprite->affineAnimEnded)
|
|
|
|
sprite->data[1]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (--sprite->data[0] == 0)
|
|
|
|
{
|
|
|
|
ChangeSpriteAffineAnim(sprite, 1);
|
|
|
|
sprite->data[1]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (sprite->affineAnimEnded)
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
|
2018-12-31 18:01:37 +01:00
|
|
|
SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON);
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Spins an orb around the attacking mon, while its path radius grows and shrinks.
|
|
|
|
// arg 0: duration
|
|
|
|
// arg 1: initial wave offset
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimReversalOrb(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[0] = gBattleAnimArgs[0];
|
|
|
|
sprite->data[1] = gBattleAnimArgs[1];
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimReversalOrb_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->callback(sprite);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimReversalOrb_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = Sin(sprite->data[1], sprite->data[2] >> 8);
|
|
|
|
sprite->y2 = Cos(sprite->data[1], sprite->data[3] >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = (sprite->data[1] + 9) & 0xFF;
|
|
|
|
|
|
|
|
if ((u16)sprite->data[1] < 64 || sprite->data[1] > 195)
|
|
|
|
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 1;
|
|
|
|
else
|
|
|
|
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) + 1;
|
|
|
|
|
|
|
|
if (!sprite->data[5])
|
|
|
|
{
|
|
|
|
sprite->data[2] += 0x400;
|
|
|
|
sprite->data[3] += 0x100;
|
|
|
|
sprite->data[4]++;
|
|
|
|
if (sprite->data[4] == sprite->data[0])
|
|
|
|
{
|
|
|
|
sprite->data[4] = 0;
|
|
|
|
sprite->data[5] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sprite->data[5] == 1)
|
|
|
|
{
|
|
|
|
sprite->data[2] -= 0x400;
|
|
|
|
sprite->data[3] -= 0x100;
|
|
|
|
sprite->data[4]++;
|
|
|
|
if (sprite->data[4] == sprite->data[0])
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Copies the target mon's sprite, and makes a white silhouette that shrinks away.
|
|
|
|
void AnimTask_RolePlaySilhouette(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-08-17 17:44:20 +02:00
|
|
|
bool8 isBackPic;
|
2018-12-19 02:03:26 +01:00
|
|
|
u32 personality;
|
|
|
|
u32 otId;
|
|
|
|
u16 species;
|
|
|
|
s16 xOffset;
|
|
|
|
u32 priority;
|
|
|
|
u8 spriteId;
|
|
|
|
s16 coord1, coord2;
|
|
|
|
|
|
|
|
GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
|
|
|
if (IsContest())
|
|
|
|
{
|
2020-08-14 01:10:23 +02:00
|
|
|
isBackPic = TRUE;
|
|
|
|
personality = gContestResources->moveAnim->targetPersonality;
|
|
|
|
otId = gContestResources->moveAnim->otId;
|
|
|
|
species = gContestResources->moveAnim->targetSpecies;
|
2018-12-19 02:03:26 +01:00
|
|
|
xOffset = 20;
|
2018-12-20 04:13:26 +01:00
|
|
|
priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
{
|
2022-08-17 17:44:20 +02:00
|
|
|
isBackPic = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY);
|
|
|
|
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID);
|
|
|
|
if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE)
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
|
|
|
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_SPECIES);
|
|
|
|
else
|
|
|
|
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_SPECIES);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
species = gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies;
|
|
|
|
}
|
|
|
|
|
|
|
|
xOffset = 20;
|
2018-12-20 04:13:26 +01:00
|
|
|
priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-08-17 17:44:20 +02:00
|
|
|
isBackPic = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY);
|
|
|
|
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID);
|
|
|
|
if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE)
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
|
|
|
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_SPECIES);
|
|
|
|
else
|
|
|
|
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_SPECIES);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
species = gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies;
|
|
|
|
}
|
|
|
|
|
|
|
|
xOffset = -20;
|
2018-12-20 04:13:26 +01:00
|
|
|
priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 17:46:38 +01:00
|
|
|
coord1 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
|
|
|
|
coord2 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
|
2021-01-23 05:22:37 +01:00
|
|
|
spriteId = CreateAdditionalMonSpriteForMoveAnim(species, isBackPic, 0, coord1 + xOffset, coord2, 5, personality, otId, gBattleAnimTarget, TRUE);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
gSprites[spriteId].oam.priority = priority;
|
|
|
|
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
2022-08-19 16:29:35 +02:00
|
|
|
FillPalette(RGB_WHITE, OBJ_PLTT_ID(gSprites[spriteId].oam.paletteNum), PLTT_SIZE_4BPP);
|
2018-12-19 02:03:26 +01:00
|
|
|
gSprites[spriteId].oam.priority = priority;
|
2018-12-26 13:43:07 +01:00
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
|
2018-12-19 02:03:26 +01:00
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[1], 16 - gTasks[taskId].data[1]));
|
|
|
|
|
|
|
|
gTasks[taskId].data[0] = spriteId;
|
2020-02-20 22:22:33 +01:00
|
|
|
gTasks[taskId].func = AnimTask_RolePlaySilhouette_Step1;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_RolePlaySilhouette_Step1(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (gTasks[taskId].data[10]++ > 1)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[10] = 0;
|
|
|
|
gTasks[taskId].data[1]++;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[1], 16 - gTasks[taskId].data[1]));
|
|
|
|
if (gTasks[taskId].data[1] == 10)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[10] = 256;
|
|
|
|
gTasks[taskId].data[11] = 256;
|
2020-02-20 22:22:33 +01:00
|
|
|
gTasks[taskId].func = AnimTask_RolePlaySilhouette_Step2;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_RolePlaySilhouette_Step2(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 spriteId = gTasks[taskId].data[0];
|
|
|
|
gTasks[taskId].data[10] -= 16;
|
|
|
|
gTasks[taskId].data[11] += 128;
|
|
|
|
gSprites[spriteId].oam.affineMode |= ST_OAM_AFFINE_DOUBLE_MASK;
|
|
|
|
TrySetSpriteRotScale(&gSprites[spriteId], TRUE, gTasks[taskId].data[10], gTasks[taskId].data[11], 0);
|
|
|
|
if (++gTasks[taskId].data[12] == 9)
|
|
|
|
{
|
2021-02-27 18:04:45 +01:00
|
|
|
ResetSpriteRotScale_PreserveAffine(&gSprites[spriteId]);
|
2018-12-30 17:58:42 +01:00
|
|
|
DestroySpriteAndFreeResources_(&gSprites[spriteId]);
|
2018-12-31 18:01:37 +01:00
|
|
|
gTasks[taskId].func = DestroyAnimVisualTaskAndDisableBlend;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Performs a wavy transformation on the mon's sprite, and fades out.
|
|
|
|
// arg 0: which battler
|
|
|
|
void AnimTask_AcidArmor(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 battler;
|
|
|
|
u16 bgX, bgY;
|
|
|
|
s16 y, i;
|
|
|
|
struct ScanlineEffectParams scanlineParams;
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-19 02:03:26 +01:00
|
|
|
battler = gBattleAnimAttacker;
|
|
|
|
else
|
|
|
|
battler = gBattleAnimTarget;
|
|
|
|
|
|
|
|
task->data[0] = 0;
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 16;
|
|
|
|
task->data[4] = 0;
|
|
|
|
task->data[5] = battler;
|
|
|
|
task->data[6] = 32;
|
|
|
|
task->data[7] = 0;
|
|
|
|
task->data[8] = 24;
|
|
|
|
|
|
|
|
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
|
|
|
task->data[8] *= -1;
|
|
|
|
|
|
|
|
task->data[13] = GetBattlerYCoordWithElevation(battler) - 34;
|
|
|
|
if (task->data[13] < 0)
|
|
|
|
task->data[13] = 0;
|
|
|
|
|
|
|
|
task->data[14] = task->data[13] + 66;
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
|
2018-12-20 04:13:26 +01:00
|
|
|
if (GetBattlerSpriteBGPriorityRank(battler) == 1)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
scanlineParams.dmaDest = ®_BG1HOFS;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_BG1);
|
|
|
|
bgX = gBattle_BG1_X;
|
|
|
|
bgY = gBattle_BG1_Y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scanlineParams.dmaDest = ®_BG2HOFS;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_BG2);
|
|
|
|
bgX = gBattle_BG2_X;
|
|
|
|
bgY = gBattle_BG2_Y;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (y = 0, i = 0; y < 160; y++, i += 2)
|
|
|
|
{
|
|
|
|
gScanlineEffectRegBuffers[0][i] = bgX;
|
|
|
|
gScanlineEffectRegBuffers[1][i] = bgX;
|
|
|
|
gScanlineEffectRegBuffers[0][i + 1] = bgY;
|
|
|
|
gScanlineEffectRegBuffers[1][i + 1] = bgY;
|
|
|
|
}
|
|
|
|
|
|
|
|
scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_32BIT;
|
|
|
|
scanlineParams.initState = 1;
|
|
|
|
scanlineParams.unused9 = 0;
|
|
|
|
ScanlineEffect_SetParams(scanlineParams);
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_AcidArmor_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_AcidArmor_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task;
|
|
|
|
s16 var1;
|
|
|
|
s16 var2;
|
|
|
|
s16 bgX, bgY;
|
|
|
|
s16 offset;
|
|
|
|
s16 var0;
|
|
|
|
s16 i;
|
|
|
|
s16 sineIndex;
|
|
|
|
s16 var3;
|
|
|
|
|
|
|
|
task = &gTasks[taskId];
|
2018-12-20 04:13:26 +01:00
|
|
|
if (GetBattlerSpriteBGPriorityRank(task->data[5]) == 1)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
bgX = gBattle_BG1_X;
|
|
|
|
bgY = gBattle_BG1_Y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bgX = gBattle_BG2_X;
|
|
|
|
bgY = gBattle_BG2_Y;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
offset = task->data[14] * 2;
|
|
|
|
var1 = 0;
|
|
|
|
var2 = 0;
|
|
|
|
i = 0;
|
|
|
|
task->data[1] = (task->data[1] + 2) & 0xFF;
|
|
|
|
sineIndex = task->data[1];
|
|
|
|
task->data[9] = 0x7E0 / task->data[6];
|
|
|
|
task->data[10] = -((task->data[7] * 2) / task->data[9]);
|
|
|
|
task->data[11] = task->data[7];
|
|
|
|
var3 = task->data[11] >> 5;
|
|
|
|
task->data[12] = var3;
|
|
|
|
var0 = task->data[14];
|
|
|
|
while (var0 > task->data[13])
|
|
|
|
{
|
|
|
|
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][offset + 1] = (i - var2) + bgY;
|
|
|
|
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][offset] = bgX + var3 + (gSineTable[sineIndex] >> 5);
|
|
|
|
sineIndex = (sineIndex + 10) & 0xFF;
|
|
|
|
task->data[11] += task->data[10];
|
|
|
|
var3 = task->data[11] >> 5;
|
|
|
|
task->data[12] = var3;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
offset -= 2;
|
|
|
|
var1 += task->data[6];
|
|
|
|
var2 = var1 >> 5;
|
|
|
|
var0--;
|
|
|
|
}
|
|
|
|
|
|
|
|
var0 *= 2;
|
|
|
|
while (var0 >= 0)
|
|
|
|
{
|
|
|
|
gScanlineEffectRegBuffers[0][var0] = bgX + 240;
|
|
|
|
gScanlineEffectRegBuffers[1][var0] = bgX + 240;
|
|
|
|
var0 -= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++task->data[6] > 63)
|
|
|
|
{
|
|
|
|
task->data[6] = 64;
|
|
|
|
task->data[2]++;
|
|
|
|
if (task->data[2] & 1)
|
|
|
|
task->data[3]--;
|
|
|
|
else
|
|
|
|
task->data[4]++;
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[3], task->data[4]));
|
|
|
|
if (task->data[3] == 0 && task->data[4] == 16)
|
|
|
|
{
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[7] += task->data[8];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++task->data[2] > 12)
|
|
|
|
{
|
|
|
|
gScanlineEffect.state = 3;
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
task->data[2]++;
|
|
|
|
if (task->data[2] & 1)
|
|
|
|
task->data[3]++;
|
|
|
|
else
|
|
|
|
task->data[4]--;
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[3], task->data[4]));
|
|
|
|
if (task->data[3] == 16 && task->data[4] == 0)
|
|
|
|
{
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Runs an affine animation that makes it look like the mon is inhaling deeply.
|
|
|
|
// arg 0: which battler
|
|
|
|
void AnimTask_DeepInhale(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
task->data[0] = 0;
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
|
2018-12-31 18:01:37 +01:00
|
|
|
PrepareAffineAnimInTaskData(&gTasks[taskId], task->data[15], gDeepInhaleAffineAnimCmds);
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_DeepInhale_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_DeepInhale_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u16 var0;
|
|
|
|
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
var0 = task->data[0];
|
|
|
|
task->data[0]++;
|
|
|
|
var0 -= 20;
|
|
|
|
if (var0 < 23)
|
|
|
|
{
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2]++;
|
|
|
|
if (task->data[2] & 1)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = 1;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = -1;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
static void InitYawnCloudPosition(struct Sprite *sprite, s16 startX, s16 startY, s16 destX, s16 destY, u16 duration)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = startX;
|
|
|
|
sprite->y = startY;
|
2018-12-31 18:01:37 +01:00
|
|
|
sprite->data[4] = startX << 4;
|
|
|
|
sprite->data[5] = startY << 4;
|
|
|
|
sprite->data[6] = ((destX - startX) << 4) / duration;
|
|
|
|
sprite->data[7] = ((destY - startY) << 4) / duration;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
static void UpdateYawnCloudPosition(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[4] += sprite->data[6];
|
|
|
|
sprite->data[5] += sprite->data[7];
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = sprite->data[4] >> 4;
|
|
|
|
sprite->y = sprite->data[5] >> 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Drifts a cloud in a wavy path towards the target mon.
|
|
|
|
// arg 0: which affine anim
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimYawnCloud(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
s16 destX = sprite->x;
|
|
|
|
s16 destY = sprite->y;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
SetSpriteCoordsToAnimAttackerCoords(sprite);
|
|
|
|
StartSpriteAffineAnim(sprite, gBattleAnimArgs[0]);
|
2021-07-07 15:11:52 +02:00
|
|
|
InitYawnCloudPosition(sprite, sprite->x, sprite->y, destX, destY, 64);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[0] = 0;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimYawnCloud_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimYawnCloud_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
int index;
|
|
|
|
|
|
|
|
sprite->data[0]++;
|
|
|
|
index = (sprite->data[0] * 8) & 0xFF;
|
2018-12-31 18:01:37 +01:00
|
|
|
UpdateYawnCloudPosition(sprite);
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = Sin(index, 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (sprite->data[0] > 58)
|
|
|
|
{
|
|
|
|
if (++sprite->data[1] > 1)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[2]++;
|
|
|
|
sprite->invisible = sprite->data[2] & 1;
|
|
|
|
if (sprite->data[2] > 3)
|
|
|
|
DestroySpriteAndMatrix(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Animates a cloud coming from the smoke ball.
|
|
|
|
// arg 0: ?
|
|
|
|
// arg 1: initial x pixel offset
|
|
|
|
// arg 2: initial y pixel offset
|
2020-02-22 00:22:18 +01:00
|
|
|
// arg 3: time until destroyed
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSmokeBallEscapeCloud(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[0] = gBattleAnimArgs[3];
|
|
|
|
StartSpriteAffineAnim(sprite, gBattleAnimArgs[0]);
|
|
|
|
if (GetBattlerSide(gBattleAnimTarget) != B_SIDE_PLAYER)
|
|
|
|
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[1];
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
|
2020-02-22 00:22:18 +01:00
|
|
|
sprite->callback = DestroyAnimSpriteAfterTimer;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2021-04-13 09:28:03 +02:00
|
|
|
static void AnimTask_SlideMonForFocusBand_Step2(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u16 var0 = 0;
|
|
|
|
u16 var1 = 0;
|
|
|
|
|
|
|
|
gTasks[taskId].data[0]--;
|
|
|
|
if ((gTasks[taskId].data[6] & 0x8000) && (--gTasks[taskId].data[1] == -1))
|
|
|
|
{
|
|
|
|
if (gTasks[taskId].data[9] == 0)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[9] = gTasks[taskId].data[4];
|
|
|
|
gTasks[taskId].data[4] = -gTasks[taskId].data[4];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[9] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gTasks[taskId].data[10] == 0)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[10] = gTasks[taskId].data[5];
|
|
|
|
gTasks[taskId].data[5] = -gTasks[taskId].data[5];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[10] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gTasks[taskId].data[1] = gTasks[taskId].data[13];
|
|
|
|
}
|
|
|
|
|
|
|
|
var0 = gTasks[taskId].data[7];
|
|
|
|
var1 = gTasks[taskId].data[8];
|
|
|
|
if (gTasks[taskId].data[2] & 0x8000)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[gTasks[taskId].data[15]].x2 = gTasks[taskId].data[9] - (var0 >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[gTasks[taskId].data[15]].x2 = gTasks[taskId].data[9] + (var0 >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (gTasks[taskId].data[3] & 0x8000)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[gTasks[taskId].data[15]].y2 = gTasks[taskId].data[10] - (var1 >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[gTasks[taskId].data[15]].y2 = gTasks[taskId].data[10] + (var1 >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (gTasks[taskId].data[0] < 1)
|
|
|
|
{
|
|
|
|
DestroyTask(taskId);
|
|
|
|
gAnimVisualTaskCount--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-13 09:28:03 +02:00
|
|
|
static void AnimTask_SlideMonForFocusBand_Step1(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u16 var0 = 0;
|
|
|
|
u16 var1 = 0;
|
|
|
|
|
|
|
|
gTasks[taskId].data[0]--;
|
|
|
|
if ((gTasks[taskId].data[6] & 0x8000) && (--gTasks[taskId].data[1] == -1))
|
|
|
|
{
|
|
|
|
if (gTasks[taskId].data[9] == 0)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[9] = gTasks[taskId].data[4];
|
|
|
|
gTasks[taskId].data[4] = -gTasks[taskId].data[4];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[9] = var0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gTasks[taskId].data[10] == 0)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[10] = gTasks[taskId].data[5];
|
|
|
|
gTasks[taskId].data[5] = -gTasks[taskId].data[5];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[10] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gTasks[taskId].data[1] = gTasks[taskId].data[13];
|
|
|
|
}
|
|
|
|
|
|
|
|
var0 = (gTasks[taskId].data[2] & 0x7FFF) + gTasks[taskId].data[7];
|
|
|
|
var1 = (gTasks[taskId].data[3] & 0x7FFF) + gTasks[taskId].data[8];
|
|
|
|
if (gTasks[taskId].data[2] & 0x8000)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[gTasks[taskId].data[15]].x2 = gTasks[taskId].data[9] - (var0 >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[gTasks[taskId].data[15]].x2 = gTasks[taskId].data[9] + (var0 >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (gTasks[taskId].data[3] & 0x8000)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[gTasks[taskId].data[15]].y2 = gTasks[taskId].data[10] - (var1 >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[gTasks[taskId].data[15]].y2 = gTasks[taskId].data[10] + (var1 >> 8);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
gTasks[taskId].data[7] = var0;
|
|
|
|
gTasks[taskId].data[8] = var1;
|
|
|
|
if (gTasks[taskId].data[0] < 1)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[0] = 30;
|
|
|
|
gTasks[taskId].data[13] = 0;
|
2021-04-13 09:28:03 +02:00
|
|
|
gTasks[taskId].func = AnimTask_SlideMonForFocusBand_Step2;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 05:13:54 +01:00
|
|
|
void AnimTask_SlideMonForFocusBand(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].data[15] = gBattlerSpriteIds[gBattleAnimAttacker];
|
|
|
|
gTasks[taskId].data[14] = gBattleAnimArgs[0];
|
|
|
|
gTasks[taskId].data[0] = gBattleAnimArgs[0];
|
|
|
|
gTasks[taskId].data[13] = gBattleAnimArgs[6];
|
|
|
|
if (gBattleAnimArgs[3])
|
|
|
|
gTasks[taskId].data[6] = gTasks[taskId].data[6] | -0x8000;
|
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[2] = gBattleAnimArgs[1];
|
|
|
|
gTasks[taskId].data[3] = gBattleAnimArgs[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (gBattleAnimArgs[1] & 0x8000)
|
|
|
|
gTasks[taskId].data[2] = gBattleAnimArgs[1] & 0x7FFF;
|
|
|
|
else
|
|
|
|
gTasks[taskId].data[2] = gBattleAnimArgs[1] | -0x8000;
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[2] & 0x8000)
|
|
|
|
gTasks[taskId].data[3] = gBattleAnimArgs[2] & 0x7FFF;
|
|
|
|
else
|
|
|
|
gTasks[taskId].data[3] = gBattleAnimArgs[2] | -0x8000;
|
|
|
|
}
|
|
|
|
|
|
|
|
gTasks[taskId].data[8] = 0;
|
|
|
|
gTasks[taskId].data[7] = 0;
|
|
|
|
gTasks[taskId].data[4] = gBattleAnimArgs[4];
|
|
|
|
gTasks[taskId].data[5] = gBattleAnimArgs[5];
|
2021-04-13 09:28:03 +02:00
|
|
|
gTasks[taskId].func = AnimTask_SlideMonForFocusBand_Step1;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
#define IDX_ACTIVE_SPRITES 2 // Used by the sprite callback to modify the number of active sprites
|
|
|
|
|
|
|
|
// Task data for AnimTask_SquishAndSweatDroplets
|
|
|
|
#define tState data[0]
|
|
|
|
#define tTimer data[1]
|
|
|
|
#define tActiveSprites data[IDX_ACTIVE_SPRITES]
|
|
|
|
#define tNumSquishes data[3]
|
|
|
|
#define tBaseX data[4]
|
|
|
|
#define tBaseY data[5]
|
|
|
|
#define tSubpriority data[6]
|
|
|
|
// data[7]-data[15] used by PrepareAffineAnimInTaskData
|
|
|
|
#define tBattlerSpriteId data[15]
|
|
|
|
|
|
|
|
// Sprite data for AnimFacadeSweatDrop
|
|
|
|
#define sTimer data[0]
|
|
|
|
#define sVelocX data[1]
|
|
|
|
#define sVelocY data[2]
|
|
|
|
#define sTaskId data[3]
|
|
|
|
#define sActiveSpritesIdx data[4]
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Squishes the mon vertically and emits sweat droplets a few times.
|
|
|
|
// arg 0: battler
|
|
|
|
// arg 1: num squishes
|
|
|
|
void AnimTask_SquishAndSweatDroplets(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 battler;
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
if (!gBattleAnimArgs[1])
|
|
|
|
DestroyAnimVisualTask(taskId);
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tState = 0;
|
|
|
|
task->tTimer = 0;
|
|
|
|
task->tActiveSprites = 0;
|
|
|
|
task->tNumSquishes = gBattleAnimArgs[1];
|
2018-12-31 18:01:37 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-19 02:03:26 +01:00
|
|
|
battler = gBattleAnimAttacker;
|
|
|
|
else
|
|
|
|
battler = gBattleAnimTarget;
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tBaseX = GetBattlerSpriteCoord(battler, BATTLER_COORD_X);
|
|
|
|
task->tBaseY = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y);
|
|
|
|
task->tSubpriority = GetBattlerSpriteSubpriority(battler);
|
|
|
|
task->tBattlerSpriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
|
|
|
|
PrepareAffineAnimInTaskData(task, task->tBattlerSpriteId, gFacadeSquishAffineAnimCmds);
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_SquishAndSweatDroplets_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_SquishAndSweatDroplets_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
switch (task->tState)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
case 0:
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tTimer++;
|
|
|
|
if (task->tTimer == 6)
|
2018-12-31 18:01:37 +01:00
|
|
|
CreateSweatDroplets(taskId, TRUE);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
if (task->tTimer == 18)
|
2018-12-31 18:01:37 +01:00
|
|
|
CreateSweatDroplets(taskId, FALSE);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (!RunAffineAnimFromTaskData(task))
|
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
if (--task->tNumSquishes == 0)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
// Animation is finished
|
|
|
|
task->tState++;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
// Animation continues, more droplet sprites to create
|
|
|
|
task->tTimer = 0;
|
|
|
|
PrepareAffineAnimInTaskData(task, task->tBattlerSpriteId, gFacadeSquishAffineAnimCmds);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2022-05-21 21:21:50 +02:00
|
|
|
// Wait for sprites to be destroyed before ending task
|
|
|
|
if (task->tActiveSprites == 0)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
static void CreateSweatDroplets(u8 taskId, bool8 lowerDroplets)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
s8 xOffset, yOffset;
|
|
|
|
struct Task *task;
|
|
|
|
s16 xCoords[4];
|
|
|
|
s16 yCoords[2];
|
|
|
|
|
|
|
|
task = &gTasks[taskId];
|
2022-05-21 21:21:50 +02:00
|
|
|
if (!lowerDroplets)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
xOffset = 18;
|
|
|
|
yOffset = -20;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xOffset = 30;
|
|
|
|
yOffset = 20;
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
xCoords[0] = task->tBaseX - xOffset;
|
|
|
|
xCoords[1] = task->tBaseX - xOffset - 4;
|
|
|
|
xCoords[2] = task->tBaseX + xOffset;
|
|
|
|
xCoords[3] = task->tBaseX + xOffset + 4;
|
|
|
|
yCoords[0] = task->tBaseY + yOffset;
|
|
|
|
yCoords[1] = task->tBaseY + yOffset + 6;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
u8 spriteId = CreateSprite(&gFacadeSweatDropSpriteTemplate, xCoords[i], yCoords[i & 1], task->tSubpriority - 5);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (spriteId != MAX_SPRITES)
|
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
gSprites[spriteId].sTimer = 0;
|
|
|
|
gSprites[spriteId].sVelocX = i < 2 ? -2 : 2; // First two travel left, remaining travel right
|
|
|
|
gSprites[spriteId].sVelocY = -1;
|
|
|
|
gSprites[spriteId].sTaskId = taskId;
|
|
|
|
gSprites[spriteId].sActiveSpritesIdx = IDX_ACTIVE_SPRITES;
|
|
|
|
task->tActiveSprites++;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimFacadeSweatDrop(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
sprite->x += sprite->sVelocX;
|
|
|
|
sprite->y += sprite->sVelocY;
|
|
|
|
if (++sprite->sTimer > 6)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
gTasks[sprite->sTaskId].data[sprite->sActiveSpritesIdx]--;
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
#undef IDX_ACTIVE_SPRITES
|
|
|
|
#undef tState
|
|
|
|
#undef tTimer
|
|
|
|
#undef tActiveSprites
|
|
|
|
#undef tNumSquishes
|
|
|
|
#undef tBaseX
|
|
|
|
#undef tBaseY
|
|
|
|
#undef tSubpriority
|
|
|
|
#undef tBattlerSpriteId
|
|
|
|
#undef sTimer
|
|
|
|
#undef sVelocX
|
|
|
|
#undef sVelocY
|
|
|
|
#undef sTaskId
|
|
|
|
#undef sActiveSpritesIdx
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Blends the mon sprite's color with a rotating set of colors.
|
|
|
|
// arg 0: battler
|
|
|
|
// arg 1: duration
|
|
|
|
void AnimTask_FacadeColorBlend(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 spriteId;
|
|
|
|
|
|
|
|
gTasks[taskId].data[0] = 0;
|
|
|
|
gTasks[taskId].data[1] = gBattleAnimArgs[1];
|
|
|
|
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
|
2022-08-19 16:29:35 +02:00
|
|
|
gTasks[taskId].data[2] = OBJ_PLTT_ID(gSprites[spriteId].oam.paletteNum);
|
2020-02-20 22:22:33 +01:00
|
|
|
gTasks[taskId].func = AnimTask_FacadeColorBlend_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_FacadeColorBlend_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (gTasks[taskId].data[1])
|
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
BlendPalette(gTasks[taskId].data[2], 16, 8, gFacadeBlendColors[gTasks[taskId].data[0]]);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++gTasks[taskId].data[0] > 23)
|
|
|
|
gTasks[taskId].data[0] = 0;
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[1]--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-07-31 21:33:14 +02:00
|
|
|
BlendPalette(gTasks[taskId].data[2], 16, 0, RGB_BLACK);
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
// The sliding circle effect used by Refresh and Aromatherapy
|
|
|
|
void AnimTask_StatusClearedEffect(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
StartMonScrollingBgMask(
|
2018-12-19 02:03:26 +01:00
|
|
|
taskId,
|
|
|
|
0,
|
|
|
|
0x1A0,
|
|
|
|
gBattleAnimAttacker,
|
|
|
|
gBattleAnimArgs[0],
|
|
|
|
10,
|
|
|
|
2,
|
|
|
|
30,
|
2018-12-31 18:01:37 +01:00
|
|
|
gCureBubblesGfx,
|
|
|
|
gCureBubblesTilemap,
|
|
|
|
gCureBubblesPal);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Moves a noise line from the mon.
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
|
|
|
// arg 2: which direction (0 = upward, 1 = downward, 2 = horizontal)
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimRoarNoiseLine(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
|
|
|
|
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[0];
|
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[1];
|
2018-12-19 02:03:26 +01:00
|
|
|
if (gBattleAnimArgs[2] == 0)
|
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
sprite->data[0] = 0x280;
|
|
|
|
sprite->data[1] = -0x280;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else if (gBattleAnimArgs[2] == 1)
|
|
|
|
{
|
|
|
|
sprite->vFlip = 1;
|
2018-12-31 18:01:37 +01:00
|
|
|
sprite->data[0] = 0x280;
|
|
|
|
sprite->data[1] = 0x280;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StartSpriteAnim(sprite, 1);
|
2018-12-31 18:01:37 +01:00
|
|
|
sprite->data[0] = 0x280;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
sprite->data[0] = -sprite->data[0];
|
|
|
|
sprite->hFlip = 1;
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimRoarNoiseLine_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimRoarNoiseLine_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[6] += sprite->data[0];
|
|
|
|
sprite->data[7] += sprite->data[1];
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = sprite->data[6] >> 8;
|
|
|
|
sprite->y2 = sprite->data[7] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++sprite->data[5] == 14)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
#define IDX_ACTIVE_SPRITES 10 // Used by the sprite callback to modify the number of active sprites
|
|
|
|
|
|
|
|
// Task data for AnimTask_GlareEyeDots
|
|
|
|
#define tState data[0]
|
|
|
|
#define tTimer data[1]
|
|
|
|
#define tPairNum data[2]
|
|
|
|
#define tPairMax data[5]
|
|
|
|
#define tDotOffset data[6]
|
|
|
|
#define tIsContest data[7]
|
|
|
|
#define tActiveSprites data[IDX_ACTIVE_SPRITES]
|
|
|
|
#define tStartX data[11]
|
|
|
|
#define tStartY data[12]
|
|
|
|
#define tEndX data[13]
|
|
|
|
#define tEndY data[14]
|
|
|
|
|
|
|
|
// Sprite data for AnimGlareEyeDot
|
|
|
|
#define sTimer data[0]
|
|
|
|
#define sTaskId data[1]
|
|
|
|
#define sActiveSpritesIdx data[2]
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Makes a series of dots in a trail from the attacker to the target.
|
|
|
|
// arg 0: unused
|
|
|
|
void AnimTask_GlareEyeDots(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
if (IsContest())
|
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tPairMax = 8;
|
|
|
|
task->tDotOffset = 3;
|
|
|
|
task->tIsContest = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tPairMax = 12;
|
|
|
|
task->tDotOffset = 3;
|
|
|
|
task->tIsContest = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tStartX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tStartX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tStartY = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4;
|
|
|
|
task->tEndX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
|
|
|
task->tEndY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_GlareEyeDots_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_GlareEyeDots_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
s16 x, y;
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
switch (task->tState)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
case 0:
|
2022-05-21 21:21:50 +02:00
|
|
|
// Wait to create next pair of dots
|
|
|
|
if (++task->tTimer > 3)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tTimer = 0;
|
2018-12-31 18:01:37 +01:00
|
|
|
GetGlareEyeDotCoords(
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tStartX,
|
|
|
|
task->tStartY,
|
|
|
|
task->tEndX,
|
|
|
|
task->tEndY,
|
|
|
|
task->tPairMax,
|
|
|
|
task->tPairNum,
|
2018-12-19 02:03:26 +01:00
|
|
|
&x,
|
|
|
|
&y);
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
// Create dot pair
|
2018-12-19 02:03:26 +01:00
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
u8 spriteId = CreateSprite(&gGlareEyeDotSpriteTemplate, x, y, 35);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (spriteId != MAX_SPRITES)
|
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
if (!task->tIsContest)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (i == 0)
|
2022-05-21 21:21:50 +02:00
|
|
|
gSprites[spriteId].x2 = gSprites[spriteId].y2 = -task->tDotOffset;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2022-05-21 21:21:50 +02:00
|
|
|
gSprites[spriteId].x2 = gSprites[spriteId].y2 = task->tDotOffset;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (i == 0)
|
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
gSprites[spriteId].x2 = -task->tDotOffset;
|
|
|
|
gSprites[spriteId].y2 = task->tDotOffset;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
gSprites[spriteId].x2 = task->tDotOffset;
|
|
|
|
gSprites[spriteId].y2 = -task->tDotOffset;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
gSprites[spriteId].sTimer = 0;
|
|
|
|
gSprites[spriteId].sTaskId = taskId;
|
|
|
|
gSprites[spriteId].sActiveSpritesIdx = IDX_ACTIVE_SPRITES;
|
|
|
|
task->tActiveSprites++;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
if (task->tPairNum == task->tPairMax)
|
|
|
|
task->tState++;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
task->tPairNum++;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2022-05-21 21:21:50 +02:00
|
|
|
// Wait for sprites to be destroyed before ending task
|
|
|
|
if (task->tActiveSprites == 0)
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
static void GetGlareEyeDotCoords(s16 startX, s16 startY, s16 endX, s16 endY, u8 pairMax, u8 pairNum, s16 *x, s16 *y)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
int x2;
|
|
|
|
int y2;
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
if (pairNum == 0)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
*x = startX;
|
|
|
|
*y = startY;
|
2018-12-19 02:03:26 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
if (pairNum >= pairMax)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
*x = endX;
|
|
|
|
*y = endY;
|
2018-12-19 02:03:26 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
pairMax--;
|
|
|
|
x2 = (startX << 8) + pairNum * (((endX - startX) << 8) / pairMax);
|
|
|
|
y2 = (startY << 8) + pairNum * (((endY - startY) << 8) / pairMax);
|
2018-12-19 02:03:26 +01:00
|
|
|
*x = x2 >> 8;
|
|
|
|
*y = y2 >> 8;
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimGlareEyeDot(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
if (++sprite->sTimer > 36)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-05-21 21:21:50 +02:00
|
|
|
gTasks[sprite->sTaskId].data[sprite->sActiveSpritesIdx]--;
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 21:21:50 +02:00
|
|
|
#undef IDX_ACTIVE_SPRITES
|
|
|
|
#undef tState
|
|
|
|
#undef tTimer
|
|
|
|
#undef tPairNum
|
|
|
|
#undef tPairMax
|
|
|
|
#undef tDotOffset
|
|
|
|
#undef tIsContest
|
|
|
|
#undef tActiveSprites
|
|
|
|
#undef tStartX
|
|
|
|
#undef tStartY
|
|
|
|
#undef tEndX
|
|
|
|
#undef tEndY
|
|
|
|
#undef sTimer
|
|
|
|
#undef sTaskId
|
|
|
|
#undef sActiveSpritesIdx
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Moves a pawprint in a straight line.
|
|
|
|
// arg 0: initial x position
|
|
|
|
// arg 1: initial y position
|
|
|
|
// arg 2: destination x position
|
|
|
|
// arg 3: destination y position
|
|
|
|
// arg 4: duration
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimAssistPawprint(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = gBattleAnimArgs[0];
|
|
|
|
sprite->y = gBattleAnimArgs[1];
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[2] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[4] = gBattleAnimArgs[3];
|
|
|
|
sprite->data[0] = gBattleAnimArgs[4];
|
|
|
|
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
2018-12-20 04:13:26 +01:00
|
|
|
sprite->callback = InitAndRunAnimFastLinearTranslation;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Moves a ball in an arc twoards the target, and rotates the ball while arcing.
|
|
|
|
// No args.
|
|
|
|
void AnimTask_BarrageBall(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
task->data[12] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
|
|
|
task->data[13] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
|
|
|
task->data[14] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT) / 4;
|
|
|
|
task->data[15] = CreateSprite(&gBarrageBallSpriteTemplate, task->data[11], task->data[12], GetBattlerSpriteSubpriority(gBattleAnimTarget) - 5);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (task->data[15] != MAX_SPRITES)
|
|
|
|
{
|
|
|
|
gSprites[task->data[15]].data[0] = 16;
|
|
|
|
gSprites[task->data[15]].data[2] = task->data[13];
|
|
|
|
gSprites[task->data[15]].data[4] = task->data[14];
|
|
|
|
gSprites[task->data[15]].data[5] = -32;
|
|
|
|
InitAnimArcTranslation(&gSprites[task->data[15]]);
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
|
|
|
|
StartSpriteAffineAnim(&gSprites[task->data[15]], 1);
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_BarrageBall_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_BarrageBall_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
2019-02-06 20:17:09 +01:00
|
|
|
TranslateAnimHorizontalArc(&gSprites[task->data[15]]);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++task->data[2] > 7)
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2019-02-06 20:17:09 +01:00
|
|
|
if (TranslateAnimHorizontalArc(&gSprites[task->data[15]]))
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2]++;
|
|
|
|
gSprites[task->data[15]].invisible = task->data[2] & 1;
|
|
|
|
if (task->data[2] == 16)
|
|
|
|
{
|
|
|
|
FreeOamMatrix(gSprites[task->data[15]].oam.matrixNum);
|
|
|
|
DestroySprite(&gSprites[task->data[15]]);
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
// Moves a hand back and forth in a squishing motion.
|
|
|
|
// arg 0: which battler
|
|
|
|
// arg 1: horizontal flip
|
|
|
|
// arg 2: num squishes
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSmellingSaltsHand(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 battler;
|
|
|
|
|
2018-12-31 18:01:37 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-19 02:03:26 +01:00
|
|
|
battler = gBattleAnimAttacker;
|
|
|
|
else
|
|
|
|
battler = gBattleAnimTarget;
|
|
|
|
|
|
|
|
sprite->oam.tileNum += 16;
|
|
|
|
sprite->data[6] = gBattleAnimArgs[2];
|
|
|
|
sprite->data[7] = gBattleAnimArgs[1] == 0 ? -1 : 1;
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (gBattleAnimArgs[1] == 0)
|
|
|
|
{
|
2019-08-10 18:09:06 +02:00
|
|
|
sprite->oam.matrixNum |= ST_OAM_HFLIP;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_LEFT) - 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_RIGHT) + 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
sprite->callback = AnimSmellingSaltsHand_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-23 11:57:39 +01:00
|
|
|
static void AnimSmellingSaltsHand_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (++sprite->data[1] > 1)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 += sprite->data[7];
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++sprite->data[2] == 12)
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++sprite->data[1] == 8)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 -= sprite->data[7] * 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++sprite->data[1] == 6)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 += sprite->data[7] * 3;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++sprite->data[1] == 8)
|
|
|
|
{
|
|
|
|
if (--sprite->data[6])
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Squishes the mon horizontally a few times.
|
|
|
|
// arg 0: which mon
|
|
|
|
// arg 1: number of squishes
|
2018-12-31 18:01:37 +01:00
|
|
|
void AnimTask_SmellingSaltsSquish(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-30 17:58:42 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[0] = gBattleAnimArgs[1];
|
|
|
|
gTasks[taskId].data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
|
2018-12-31 18:01:37 +01:00
|
|
|
PrepareAffineAnimInTaskData(&gTasks[taskId], gTasks[taskId].data[15], gSmellingSaltsSquishAffineAnimCmds);
|
2020-02-20 22:22:33 +01:00
|
|
|
gTasks[taskId].func = AnimTask_SmellingSaltsSquish_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_SmellingSaltsSquish_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
if (!(task->data[2] & 1))
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = 2;
|
2018-12-19 02:03:26 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = -2;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!RunAffineAnimFromTaskData(task))
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (--task->data[0])
|
|
|
|
{
|
2018-12-31 18:01:37 +01:00
|
|
|
PrepareAffineAnimInTaskData(&gTasks[taskId], gTasks[taskId].data[15], gSmellingSaltsSquishAffineAnimCmds);
|
2018-12-19 02:03:26 +01:00
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Blinks an exclamation image over the mon a few times.
|
|
|
|
// arg 0: which mon
|
|
|
|
// arg 1: blink delay
|
|
|
|
// arg 2: number of blinks
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSmellingSaltExclamation(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-30 17:58:42 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_TOP);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->y < 8)
|
|
|
|
sprite->y = 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->data[1] = gBattleAnimArgs[1];
|
|
|
|
sprite->data[2] = 0;
|
|
|
|
sprite->data[3] = gBattleAnimArgs[2];
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimSmellingSaltExclamation_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimSmellingSaltExclamation_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (++sprite->data[0] >= sprite->data[1])
|
|
|
|
{
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->data[2] = (sprite->data[2] + 1) & 1;
|
|
|
|
sprite->invisible = sprite->data[2];
|
|
|
|
if (sprite->data[2] && --sprite->data[3] == 0)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Claps a hand several times.
|
|
|
|
// arg 0: which hand
|
2019-07-30 13:48:12 +02:00
|
|
|
// arg 1:
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimHelpingHandClap(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (gBattleAnimArgs[0] == 0)
|
|
|
|
{
|
2019-08-10 18:09:06 +02:00
|
|
|
sprite->oam.matrixNum |= ST_OAM_HFLIP;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = 100;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[7] = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = 140;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[7] = -1;
|
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y = 56;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimHelpingHandClap_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimHelpingHandClap_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y -= sprite->data[7] * 2;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (sprite->data[1] & 1)
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x -= sprite->data[7] * 2;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (++sprite->data[1] == 9)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++sprite->data[1] == 4)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprite->data[1]++;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y += sprite->data[7] * 3;
|
|
|
|
sprite->x2 = sprite->data[7] * (gSineTable[sprite->data[1] * 10] >> 3);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (sprite->data[1] == 12)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (++sprite->data[1] == 2)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
sprite->data[1]++;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y -= sprite->data[7] * 3;
|
|
|
|
sprite->x2 = sprite->data[7] * (gSineTable[sprite->data[1] * 10] >> 3);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (sprite->data[1] == 12)
|
|
|
|
sprite->data[0]++;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
sprite->data[1]++;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y += sprite->data[7] * 3;
|
|
|
|
sprite->x2 = sprite->data[7] * (gSineTable[sprite->data[1] * 10] >> 3);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (sprite->data[1] == 15)
|
|
|
|
sprite->oam.tileNum += 16;
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2018-12-19 02:03:26 +01:00
|
|
|
if (sprite->data[1] == 18)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += sprite->data[7] * 6;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++sprite->data[1] == 9)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += sprite->data[7] * 2;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++sprite->data[1] == 1)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 8:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x -= sprite->data[7] * 3;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++sprite->data[1] == 5)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Repeatedly moves the attacking mon in a horizontal lunging motion.
|
|
|
|
// No args.
|
|
|
|
void AnimTask_HelpingHandAttackerMovement(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
|
|
|
if (!IsContest())
|
|
|
|
{
|
|
|
|
if (IsDoubleBattle() == TRUE)
|
|
|
|
{
|
2021-11-08 17:46:38 +01:00
|
|
|
int attackerX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
|
|
|
|
int partnerX = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_X);
|
|
|
|
if (attackerX > partnerX)
|
2018-12-19 02:03:26 +01:00
|
|
|
task->data[14] = 1;
|
|
|
|
else
|
|
|
|
task->data[14] = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
|
|
|
task->data[14] = -1;
|
|
|
|
else
|
|
|
|
task->data[14] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[14] = 1;
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_HelpingHandAttackerMovement_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_HelpingHandAttackerMovement_Step(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (++task->data[1] == 13)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 -= task->data[14] * 3;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++task->data[1] == 6)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 += task->data[14] * 3;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++task->data[1] == 6)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (++task->data[1] == 2)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
if (task->data[2] == 0)
|
|
|
|
{
|
|
|
|
task->data[2]++;
|
|
|
|
task->data[0] = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 += task->data[14];
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++task->data[1] == 3)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
if (++task->data[1] == 6)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 -= task->data[14] * 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++task->data[1] == 5)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 += task->data[14] * 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (++task->data[1] == 5)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 8:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Moves a magnifying glass around in straight lines.
|
|
|
|
// arg 0: magnifying glass target mon
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimForesightMagnifyingGlass(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-30 17:58:42 +01:00
|
|
|
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-20 04:13:26 +01:00
|
|
|
InitSpritePosToAnimAttacker(sprite, TRUE);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[7] = gBattleAnimAttacker;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->data[7] = gBattleAnimTarget;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GetBattlerSide(sprite->data[7]) == B_SIDE_OPPONENT)
|
2019-08-10 18:09:06 +02:00
|
|
|
sprite->oam.matrixNum = ST_OAM_HFLIP;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2018-12-20 04:13:26 +01:00
|
|
|
sprite->oam.priority = GetBattlerSpriteBGPriority(sprite->data[7]);
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->oam.objMode = ST_OAM_OBJ_BLEND;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimForesightMagnifyingGlass_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimForesightMagnifyingGlass_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u16 x, y;
|
|
|
|
|
|
|
|
switch (sprite->data[5])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
switch (sprite->data[6])
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
sprite->data[6] = 0;
|
|
|
|
case 0:
|
|
|
|
case 4:
|
2021-11-08 17:46:38 +01:00
|
|
|
x = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_RIGHT) - 4;
|
|
|
|
y = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_BOTTOM) - 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
case 1:
|
2021-11-08 17:46:38 +01:00
|
|
|
x = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_RIGHT) - 4;
|
|
|
|
y = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_TOP) + 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-11-08 17:46:38 +01:00
|
|
|
x = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_LEFT) + 4;
|
|
|
|
y = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_BOTTOM) - 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-11-08 17:46:38 +01:00
|
|
|
x = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_LEFT) + 4;
|
|
|
|
y = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_TOP) - 4;
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
case 5:
|
2021-11-08 17:46:38 +01:00
|
|
|
x = GetBattlerSpriteCoord(sprite->data[7], BATTLER_COORD_X_2);
|
|
|
|
y = GetBattlerSpriteCoord(sprite->data[7], BATTLER_COORD_Y_PIC_OFFSET);
|
2018-12-19 02:03:26 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite->data[6] == 4)
|
|
|
|
sprite->data[0] = 24;
|
|
|
|
else if (sprite->data[6] == 5)
|
|
|
|
sprite->data[0] = 6;
|
|
|
|
else
|
|
|
|
sprite->data[0] = 12;
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->data[1] = sprite->x;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[2] = x;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->data[3] = sprite->y;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[4] = y;
|
|
|
|
InitAnimLinearTranslation(sprite);
|
|
|
|
sprite->data[5]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
2018-12-20 04:13:26 +01:00
|
|
|
if (AnimTranslateLinear(sprite))
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[6])
|
|
|
|
{
|
|
|
|
default:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += sprite->x2;
|
|
|
|
sprite->y += sprite->y2;
|
|
|
|
sprite->y2 = 0;
|
|
|
|
sprite->x2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->data[5]++;
|
|
|
|
sprite->data[6]++;
|
|
|
|
break;
|
|
|
|
case 4:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += sprite->x2;
|
|
|
|
sprite->y += sprite->y2;
|
|
|
|
sprite->y2 = 0;
|
|
|
|
sprite->x2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[5] = 0;
|
|
|
|
sprite->data[6]++;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->data[1] = 16;
|
|
|
|
sprite->data[2] = 0;
|
|
|
|
sprite->data[5] = 3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (++sprite->data[0] == 4)
|
|
|
|
sprite->data[5] = 0;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (!(sprite->data[0] & 1))
|
|
|
|
sprite->data[1]--;
|
|
|
|
else
|
|
|
|
sprite->data[2]++;
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[1], sprite->data[2]));
|
|
|
|
if (++sprite->data[0] == 32)
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[5]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimMeteorMashStar_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = ((sprite->data[2] - sprite->data[0]) * sprite->data[5]) / sprite->data[4];
|
|
|
|
sprite->y2 = ((sprite->data[3] - sprite->data[1]) * sprite->data[5]) / sprite->data[4];
|
2018-12-19 02:03:26 +01:00
|
|
|
if (!(sprite->data[5] & 1))
|
|
|
|
{
|
|
|
|
CreateSprite(
|
2018-12-30 17:58:42 +01:00
|
|
|
&gMiniTwinklingStarSpriteTemplate,
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x + sprite->x2,
|
|
|
|
sprite->y + sprite->y2, 5);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2018-12-19 02:03:26 +01:00
|
|
|
if (sprite->data[5] == sprite->data[4])
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
|
|
|
|
sprite->data[5]++;
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Moves a shooting star across the screen that leaves little twinkling stars behind its path.
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
|
|
|
// arg 2: destination x pixel offset
|
|
|
|
// arg 3: destination y pixel offset
|
|
|
|
// arg 4: duration
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimMeteorMashStar(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-30 17:58:42 +01:00
|
|
|
s16 y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); // unused local variable
|
|
|
|
s16 x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); // unused local variable
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER || IsContest())
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->data[0] = sprite->x - gBattleAnimArgs[0];
|
|
|
|
sprite->data[2] = sprite->x - gBattleAnimArgs[2];
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->data[0] = sprite->x + gBattleAnimArgs[0];
|
|
|
|
sprite->data[2] = sprite->x + gBattleAnimArgs[2];
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->data[1] = sprite->y + gBattleAnimArgs[1];
|
|
|
|
sprite->data[3] = sprite->y + gBattleAnimArgs[3];
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[4] = gBattleAnimArgs[4];
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = sprite->data[0];
|
|
|
|
sprite->y = sprite->data[1];
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimMeteorMashStar_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_MonToSubstitute(u8 taskId)
|
|
|
|
{
|
|
|
|
int i;
|
2018-12-30 17:58:42 +01:00
|
|
|
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (gTasks[taskId].data[0] == 0)
|
|
|
|
{
|
2019-12-05 03:00:45 +01:00
|
|
|
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[1] = 0x100;
|
|
|
|
gTasks[taskId].data[2] = 0x100;
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
else if (gTasks[taskId].data[0] == 1)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[1] += 0x60;
|
|
|
|
gTasks[taskId].data[2] -= 0xD;
|
|
|
|
SetSpriteRotScale(spriteId, gTasks[taskId].data[1], gTasks[taskId].data[2], 0);
|
|
|
|
if (++gTasks[taskId].data[3] == 9)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[3] = 0;
|
|
|
|
ResetSpriteRotScale(spriteId);
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[spriteId].invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-07-25 20:59:14 +02:00
|
|
|
LoadBattleMonGfxAndAnimate(gBattleAnimAttacker, FALSE, spriteId);
|
2018-12-19 02:03:26 +01:00
|
|
|
if (IsContest())
|
|
|
|
{
|
2021-04-25 05:29:49 +02:00
|
|
|
gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteContest;
|
|
|
|
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], BATTLER_AFFINE_NORMAL);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2021-04-13 09:28:03 +02:00
|
|
|
for (i = 0; i < NUM_TASK_DATA; i++)
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[i] = 0;
|
2018-12-24 21:59:05 +01:00
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
gTasks[taskId].func = AnimTask_MonToSubstituteDoll;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
static void AnimTask_MonToSubstituteDoll(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
|
|
|
|
|
|
|
switch (gTasks[taskId].data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].y2 = -200;
|
|
|
|
gSprites[spriteId].x2 = 200;
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[spriteId].invisible = FALSE;
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[10] = 0;
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
gTasks[taskId].data[10] += 112;
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].y2 += gTasks[taskId].data[10] >> 8;
|
|
|
|
if (gSprites[spriteId].y + gSprites[spriteId].y2 >= -32)
|
|
|
|
gSprites[spriteId].x2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
if (gSprites[spriteId].y2 > 0)
|
|
|
|
gSprites[spriteId].y2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
if (gSprites[spriteId].y2 == 0)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
|
2018-12-19 02:03:26 +01:00
|
|
|
gTasks[taskId].data[10] -= 0x800;
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
gTasks[taskId].data[10] -= 112;
|
|
|
|
if (gTasks[taskId].data[10] < 0)
|
|
|
|
gTasks[taskId].data[10] = 0;
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].y2 -= gTasks[taskId].data[10] >> 8;
|
2018-12-19 02:03:26 +01:00
|
|
|
if (gTasks[taskId].data[10] == 0)
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
gTasks[taskId].data[10] += 112;
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].y2 += gTasks[taskId].data[10] >> 8;
|
|
|
|
if (gSprites[spriteId].y2 > 0)
|
|
|
|
gSprites[spriteId].y2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
if (gSprites[spriteId].y2 == 0)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Moves down an X that flickers and disappears.
|
|
|
|
// No args.
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimBlockX(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2018-12-30 17:58:42 +01:00
|
|
|
s16 y;
|
2018-12-19 02:03:26 +01:00
|
|
|
|
|
|
|
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimTarget) - 2;
|
2018-12-30 17:58:42 +01:00
|
|
|
y = -144;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimTarget) + 2;
|
2018-12-30 17:58:42 +01:00
|
|
|
y = -96;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2021-11-08 17:46:38 +01:00
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = y;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimBlockX_Step;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimBlockX_Step(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 += 10;
|
|
|
|
if (sprite->y2 >= 0)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sprite->data[1] += 4;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = -(gSineTable[sprite->data[1]] >> 3);
|
2018-12-30 17:58:42 +01:00
|
|
|
if (sprite->data[1] > 0x7F)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = 0;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprite->data[1] += 6;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = -(gSineTable[sprite->data[1]] >> 4);
|
2018-12-30 17:58:42 +01:00
|
|
|
if (sprite->data[1] > 0x7F)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = 0;
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (++sprite->data[1] > 8)
|
|
|
|
{
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
|
2018-12-19 02:03:26 +01:00
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (++sprite->data[1] > 8)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[2]++;
|
|
|
|
sprite->invisible = sprite->data[2] & 1;
|
|
|
|
if (sprite->data[2] == 7)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Quickly moves two clones of the target mon back and forth.
|
|
|
|
// No args.
|
|
|
|
void AnimTask_OdorSleuthMovement(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
s16 spriteId1, spriteId2;
|
|
|
|
|
|
|
|
if (IsContest())
|
|
|
|
{
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
spriteId1 = CloneBattlerSpriteWithBlend(ANIM_TARGET);
|
|
|
|
if (spriteId1 < 0)
|
|
|
|
{
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
spriteId2 = CloneBattlerSpriteWithBlend(ANIM_TARGET);
|
|
|
|
if (spriteId2 < 0)
|
|
|
|
{
|
2021-11-01 17:41:21 +01:00
|
|
|
DestroySpriteWithActiveSheet(&gSprites[spriteId1]);
|
2018-12-19 02:03:26 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId2].x2 += 24;
|
|
|
|
gSprites[spriteId1].x2 -= 24;
|
2018-12-19 02:03:26 +01:00
|
|
|
gSprites[spriteId2].data[0] = 0;
|
|
|
|
gSprites[spriteId1].data[0] = 0;
|
|
|
|
gSprites[spriteId2].data[1] = 0;
|
|
|
|
gSprites[spriteId1].data[1] = 0;
|
|
|
|
gSprites[spriteId2].data[2] = 0;
|
|
|
|
gSprites[spriteId1].data[2] = 0;
|
|
|
|
gSprites[spriteId2].data[3] = 16;
|
|
|
|
gSprites[spriteId1].data[3] = -16;
|
|
|
|
gSprites[spriteId2].data[4] = 0;
|
|
|
|
gSprites[spriteId1].data[4] = 128;
|
|
|
|
gSprites[spriteId2].data[5] = 24;
|
|
|
|
gSprites[spriteId1].data[5] = 24;
|
|
|
|
gSprites[spriteId2].data[6] = taskId;
|
|
|
|
gSprites[spriteId1].data[6] = taskId;
|
|
|
|
gSprites[spriteId2].data[7] = 0;
|
|
|
|
gSprites[spriteId1].data[7] = 0;
|
|
|
|
gTasks[taskId].data[0] = 2;
|
|
|
|
|
|
|
|
if (!gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].invisible)
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[spriteId2].invisible = FALSE;
|
|
|
|
gSprites[spriteId1].invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
gSprites[spriteId2].invisible = TRUE;
|
|
|
|
gSprites[spriteId1].invisible = TRUE;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
gSprites[spriteId2].oam.objMode = ST_OAM_OBJ_NORMAL;
|
|
|
|
gSprites[spriteId1].oam.objMode = ST_OAM_OBJ_NORMAL;
|
2018-12-30 17:58:42 +01:00
|
|
|
gSprites[spriteId2].callback = MoveOdorSleuthClone;
|
|
|
|
gSprites[spriteId1].callback = MoveOdorSleuthClone;
|
|
|
|
gTasks[taskId].func = AnimTask_OdorSleuthMovementWaitFinish;
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
static void AnimTask_OdorSleuthMovementWaitFinish(u8 taskId)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (gTasks[taskId].data[0] == 0)
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
static void MoveOdorSleuthClone(struct Sprite *sprite)
|
2018-12-19 02:03:26 +01:00
|
|
|
{
|
|
|
|
if (++sprite->data[1] > 1)
|
|
|
|
{
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
if (!gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].invisible)
|
|
|
|
sprite->invisible ^= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[4] = sprite->data[4] + sprite->data[3];
|
|
|
|
sprite->data[4] &= 0xFF;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = Cos(sprite->data[4], sprite->data[5]);
|
2018-12-19 02:03:26 +01:00
|
|
|
switch (sprite->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (++sprite->data[2] == 60)
|
|
|
|
{
|
|
|
|
sprite->data[2] = 0;
|
|
|
|
sprite->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++sprite->data[2] > 0)
|
|
|
|
{
|
|
|
|
sprite->data[2] = 0;
|
|
|
|
sprite->data[5] -= 2;
|
|
|
|
if (sprite->data[5] < 0)
|
|
|
|
{
|
|
|
|
gTasks[sprite->data[6]].data[sprite->data[7]]--;
|
2021-11-01 17:41:21 +01:00
|
|
|
DestroySpriteWithActiveSheet(sprite);
|
2018-12-19 02:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-12-24 21:59:05 +01:00
|
|
|
|
|
|
|
void AnimTask_GetReturnPowerLevel(u8 taskId)
|
|
|
|
{
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = 0;
|
2018-12-24 21:59:05 +01:00
|
|
|
if (gAnimFriendship < 60)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = 0;
|
2018-12-24 21:59:05 +01:00
|
|
|
if (gAnimFriendship > 60 && gAnimFriendship < 92)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = 1;
|
2018-12-24 21:59:05 +01:00
|
|
|
if (gAnimFriendship > 91 && gAnimFriendship < 201)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = 2;
|
2018-12-24 21:59:05 +01:00
|
|
|
if (gAnimFriendship > 200)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = 3;
|
2018-12-24 21:59:05 +01:00
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
2018-12-29 18:07:46 +01:00
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Makes the mon run out of screen, run past the opposing mon, and return to its original position.
|
|
|
|
// No args.
|
|
|
|
void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
u8 spriteId, spriteId2;
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
int personality;
|
|
|
|
int otId;
|
2018-12-29 18:07:46 +01:00
|
|
|
u16 species;
|
|
|
|
u8 subpriority;
|
2020-08-20 16:49:53 +02:00
|
|
|
bool8 isBackPic;
|
2018-12-29 18:07:46 +01:00
|
|
|
s16 x;
|
|
|
|
|
|
|
|
switch (gTasks[taskId].data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
|
|
|
gTasks[taskId].data[1] += 0x800;
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 += (gTasks[taskId].data[1] >> 8);
|
2018-12-29 18:07:46 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 -= (gTasks[taskId].data[1] >> 8);
|
2018-12-29 18:07:46 +01:00
|
|
|
|
2018-12-29 19:31:04 +01:00
|
|
|
gTasks[taskId].data[1] &= 0xFF;
|
2021-07-07 15:11:52 +02:00
|
|
|
x = gSprites[spriteId].x + gSprites[spriteId].x2;
|
2022-08-17 17:44:20 +02:00
|
|
|
if (x < -32 || x > DISPLAY_WIDTH + 32)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].data[1] = 0;
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (IsContest())
|
|
|
|
{
|
2020-08-14 01:10:23 +02:00
|
|
|
personality = gContestResources->moveAnim->personality;
|
|
|
|
otId = gContestResources->moveAnim->otId;
|
|
|
|
species = gContestResources->moveAnim->species;
|
2018-12-29 18:07:46 +01:00
|
|
|
subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
|
2020-08-20 16:49:53 +02:00
|
|
|
isBackPic = FALSE;
|
2018-12-29 18:07:46 +01:00
|
|
|
x = -32;
|
|
|
|
}
|
2020-08-20 16:49:53 +02:00
|
|
|
else
|
|
|
|
{
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_PERSONALITY);
|
|
|
|
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_OT_ID);
|
|
|
|
if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies == SPECIES_NONE)
|
|
|
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_SPECIES);
|
|
|
|
else
|
|
|
|
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
|
|
|
|
|
|
|
|
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1;
|
2020-11-03 00:43:11 +01:00
|
|
|
isBackPic = FALSE;
|
2021-04-15 08:04:01 +02:00
|
|
|
x = DISPLAY_WIDTH + 32;
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
}
|
2018-12-29 18:07:46 +01:00
|
|
|
else
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
{
|
|
|
|
personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_PERSONALITY);
|
|
|
|
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_OT_ID);
|
|
|
|
if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies == SPECIES_NONE)
|
|
|
|
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_SPECIES);
|
|
|
|
else
|
|
|
|
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
|
2018-12-29 18:07:46 +01:00
|
|
|
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority - 1;
|
2020-11-03 00:43:11 +01:00
|
|
|
isBackPic = TRUE;
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
x = -32;
|
|
|
|
}
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
|
2021-01-23 05:22:37 +01:00
|
|
|
spriteId2 = CreateAdditionalMonSpriteForMoveAnim(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, FALSE);
|
2018-12-29 18:07:46 +01:00
|
|
|
if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies != SPECIES_NONE)
|
2022-08-19 16:29:35 +02:00
|
|
|
BlendPalette(OBJ_PLTT_ID(gSprites[spriteId2].oam.paletteNum), 16, 6, RGB_WHITE);
|
2018-12-29 19:31:04 +01:00
|
|
|
|
2018-12-29 18:07:46 +01:00
|
|
|
gTasks[taskId].data[15] = spriteId2;
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
spriteId2 = gTasks[taskId].data[15];
|
|
|
|
gTasks[taskId].data[1] += 0x800;
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId2].x2 -= (gTasks[taskId].data[1] >> 8);
|
2018-12-29 18:07:46 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId2].x2 += (gTasks[taskId].data[1] >> 8);
|
2018-12-29 18:07:46 +01:00
|
|
|
|
2018-12-29 19:31:04 +01:00
|
|
|
gTasks[taskId].data[1] &= 0xFF;
|
2021-07-07 15:11:52 +02:00
|
|
|
x = gSprites[spriteId2].x + gSprites[spriteId2].x2;
|
2018-12-29 18:07:46 +01:00
|
|
|
if (gTasks[taskId].data[14] == 0)
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
if (x < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[14]++;
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
gBattleAnimArgs[7] = 0xFFFF;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (x > GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[14]++;
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
gBattleAnimArgs[7] = 0xFFFF;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-17 17:44:20 +02:00
|
|
|
if (x < -32 || x > DISPLAY_WIDTH + 32)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].data[1] = 0;
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
|
|
|
spriteId2 = gTasks[taskId].data[15];
|
2018-12-30 17:58:42 +01:00
|
|
|
DestroySpriteAndFreeResources_(&gSprites[spriteId2]);
|
2018-12-29 18:07:46 +01:00
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 = -gSprites[spriteId].x - 32;
|
2018-12-29 18:07:46 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 = DISPLAY_WIDTH + 32 - gSprites[spriteId].x;
|
2018-12-29 18:07:46 +01:00
|
|
|
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
|
|
|
gTasks[taskId].data[1] += 0x800;
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 += (gTasks[taskId].data[1] >> 8);
|
|
|
|
if (gSprites[spriteId].x2 + gSprites[spriteId].x >= GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X))
|
|
|
|
gSprites[spriteId].x2 = 0;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 -= (gTasks[taskId].data[1] >> 8);
|
|
|
|
if (gSprites[spriteId].x2 + gSprites[spriteId].x <= GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X))
|
|
|
|
gSprites[spriteId].x2 = 0;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
|
2020-08-20 16:49:53 +02:00
|
|
|
gTasks[taskId].data[1] &= 0xFF;
|
2021-07-07 15:11:52 +02:00
|
|
|
if (gSprites[spriteId].x2 == 0)
|
2018-12-29 18:07:46 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-13 09:28:03 +02:00
|
|
|
static void AnimUnusedItemBagSteal(struct Sprite *sprite)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[7])
|
|
|
|
{
|
|
|
|
case 0:
|
2020-02-23 19:18:54 +01:00
|
|
|
if (gBattleAnimArgs[7] == -1)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
2022-08-16 19:00:28 +02:00
|
|
|
PlaySE12WithPanning(SE_M_VITAL_THROW, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 16;
|
2018-12-29 18:07:46 +01:00
|
|
|
sprite->data[0] = -32;
|
|
|
|
sprite->data[7]++;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = FALSE;
|
2018-12-29 18:07:46 +01:00
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT && !IsContest())
|
|
|
|
sprite->subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->invisible = TRUE;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = Sin(sprite->data[1], sprite->data[0]);
|
2018-12-29 18:07:46 +01:00
|
|
|
sprite->data[1] += 5;
|
|
|
|
if (sprite->data[1] > 0x7F)
|
|
|
|
{
|
|
|
|
sprite->data[0] = sprite->data[0] / 2;
|
|
|
|
sprite->data[3]++;
|
|
|
|
sprite->data[1] -= 0x7F;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[2] += 0x100;
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 -= (sprite->data[2] >> 8);
|
2018-12-29 18:07:46 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 += (sprite->data[2] >> 8);
|
2018-12-29 18:07:46 +01:00
|
|
|
|
|
|
|
sprite->data[2] &= 0xFF;
|
|
|
|
if (sprite->data[3] == 2)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Quickly moves the mon towards its partner and back.
|
|
|
|
// No args.
|
|
|
|
void AnimTask_SnatchPartnerMove(u8 taskId)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
s16 attackerX, targetX;
|
|
|
|
u8 spriteId;
|
|
|
|
|
|
|
|
switch (gTasks[taskId].data[15])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
attackerX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
|
|
|
|
targetX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
|
|
|
|
gTasks[taskId].data[0] = 6;
|
|
|
|
if (attackerX > targetX)
|
|
|
|
gTasks[taskId].data[0] *= -1;
|
|
|
|
|
|
|
|
gTasks[taskId].data[1] = attackerX;
|
|
|
|
gTasks[taskId].data[2] = targetX;
|
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 += gTasks[taskId].data[0];
|
2018-12-29 18:07:46 +01:00
|
|
|
if (gTasks[taskId].data[0] > 0)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
if (gSprites[spriteId].x + gSprites[spriteId].x2 >= gTasks[taskId].data[2])
|
2018-12-29 18:07:46 +01:00
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
if (gSprites[spriteId].x + gSprites[spriteId].x2 <= gTasks[taskId].data[2])
|
2018-12-29 18:07:46 +01:00
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
gTasks[taskId].data[0] *= -1;
|
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 += gTasks[taskId].data[0];
|
2018-12-29 18:07:46 +01:00
|
|
|
if (gTasks[taskId].data[0] < 0)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
if (gSprites[spriteId].x + gSprites[spriteId].x2 <= gTasks[taskId].data[1])
|
2018-12-29 18:07:46 +01:00
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
if (gSprites[spriteId].x + gSprites[spriteId].x2 >= gTasks[taskId].data[1])
|
2018-12-29 18:07:46 +01:00
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
default:
|
|
|
|
spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[spriteId].x2 = 0;
|
2018-12-29 18:07:46 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Moves the mon's sprite back and forth in an unpredictable swaying motion.
|
|
|
|
// No args.
|
|
|
|
void AnimTask_TeeterDanceMovement(u8 taskId)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
task->data[3] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
|
|
|
task->data[4] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1;
|
2021-07-07 15:11:52 +02:00
|
|
|
task->data[6] = gSprites[task->data[3]].y;
|
|
|
|
task->data[5] = gSprites[task->data[3]].x;
|
2018-12-29 18:07:46 +01:00
|
|
|
task->data[9] = 0;
|
|
|
|
task->data[11] = 0;
|
|
|
|
task->data[10] = 1;
|
|
|
|
task->data[12] = 0;
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_TeeterDanceMovement_Step;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_TeeterDanceMovement_Step(u8 taskId)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
task->data[11] += 8;
|
|
|
|
task->data[11] &= 0xFF;
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[3]].x2 = gSineTable[task->data[11]] >> 5;
|
2018-12-29 18:07:46 +01:00
|
|
|
task->data[9] += 2;
|
|
|
|
task->data[9] &= 0xFF;
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[3]].x = (gSineTable[task->data[9]] >> 3) * task->data[4] + task->data[5];
|
2018-12-29 18:07:46 +01:00
|
|
|
if (task->data[9] == 0)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[3]].x = task->data[5];
|
2018-12-29 18:07:46 +01:00
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
task->data[11] += 8;
|
|
|
|
task->data[11] &= 0xFF;
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[3]].x2 = gSineTable[task->data[11]] >> 5;
|
2018-12-29 18:07:46 +01:00
|
|
|
if (task->data[11] == 0)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[3]].x2 = 0;
|
2018-12-29 18:07:46 +01:00
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimKnockOffStrike_Step(struct Sprite *sprite)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
// These two cases are identical.
|
|
|
|
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
sprite->data[1] += sprite->data[0];
|
|
|
|
sprite->data[1] &= 0xFF;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->data[1] += sprite->data[0];
|
|
|
|
sprite->data[1] &= 0xFF;
|
|
|
|
}
|
2018-12-29 19:31:04 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x2 = Cos(sprite->data[1], 20);
|
|
|
|
sprite->y2 = Sin(sprite->data[1], 20);
|
2018-12-29 18:07:46 +01:00
|
|
|
if (sprite->animEnded)
|
|
|
|
DestroyAnimSprite(sprite);
|
|
|
|
|
|
|
|
sprite->data[2]++;
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Animates a strike that swipes downard at the target mon.
|
|
|
|
// arg 0: initial x pixel offset
|
|
|
|
// arg 1: initial y pixel offset
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimKnockOffStrike(struct Sprite *sprite)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x -= gBattleAnimArgs[0];
|
|
|
|
sprite->y += gBattleAnimArgs[1];
|
2018-12-29 18:07:46 +01:00
|
|
|
sprite->data[0] = -11;
|
|
|
|
sprite->data[1] = 192;
|
|
|
|
StartSpriteAffineAnim(sprite, 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->data[0] = 11;
|
|
|
|
sprite->data[1] = 192;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += gBattleAnimArgs[0];
|
|
|
|
sprite->y += gBattleAnimArgs[1];
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimKnockOffStrike_Step;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Gradually fades a rotating recyle arrow sprite in and back out.
|
|
|
|
// No args.
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimRecycle(struct Sprite *sprite)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
|
|
|
sprite->y = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP);
|
|
|
|
if (sprite->y < 16)
|
|
|
|
sprite->y = 16;
|
2018-12-29 18:07:46 +01:00
|
|
|
|
|
|
|
sprite->data[6] = 0;
|
|
|
|
sprite->data[7] = 16;
|
2020-02-20 22:22:33 +01:00
|
|
|
sprite->callback = AnimRecycle_Step;
|
2018-12-29 18:07:46 +01:00
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7]));
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimRecycle_Step(struct Sprite *sprite)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
switch (sprite->data[2])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (++sprite->data[0] > 1)
|
|
|
|
{
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
if (!(sprite->data[1] & 1))
|
|
|
|
{
|
|
|
|
if (sprite->data[6] < 16)
|
|
|
|
sprite->data[6]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sprite->data[7] != 0)
|
|
|
|
sprite->data[7]--;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[1]++;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7]));
|
|
|
|
if (sprite->data[7] == 0)
|
|
|
|
sprite->data[2]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++sprite->data[0] == 10)
|
|
|
|
{
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
sprite->data[1] = 0;
|
|
|
|
sprite->data[2]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (++sprite->data[0] > 1)
|
|
|
|
{
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
if (!(sprite->data[1] & 1))
|
|
|
|
{
|
|
|
|
if (sprite->data[6] != 0)
|
|
|
|
sprite->data[6]--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sprite->data[7] < 16)
|
|
|
|
sprite->data[7]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->data[1]++;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7]));
|
|
|
|
if (sprite->data[7] == 16)
|
|
|
|
sprite->data[2]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
DestroySpriteAndMatrix(sprite);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_GetWeather(u8 taskId)
|
|
|
|
{
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_NONE;
|
2021-09-30 12:08:20 +02:00
|
|
|
if (gWeatherMoveAnim & B_WEATHER_SUN)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_SUN;
|
2021-09-30 12:08:20 +02:00
|
|
|
else if (gWeatherMoveAnim & B_WEATHER_RAIN)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_RAIN;
|
2021-09-30 12:08:20 +02:00
|
|
|
else if (gWeatherMoveAnim & B_WEATHER_SANDSTORM)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_SANDSTORM;
|
2021-09-30 12:08:20 +02:00
|
|
|
else if (gWeatherMoveAnim & B_WEATHER_HAIL)
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_HAIL;
|
2018-12-29 18:07:46 +01:00
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2018-12-30 17:58:42 +01:00
|
|
|
// Squishes the mon sprite vertically, and shakes it back and forth.
|
|
|
|
// arg 0: which battler
|
|
|
|
void AnimTask_SlackOffSquish(u8 taskId)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
task->data[0] = 0;
|
|
|
|
task->data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
|
2018-12-30 17:58:42 +01:00
|
|
|
PrepareAffineAnimInTaskData(task, task->data[15], gSlackOffSquishAffineAnimCmds);
|
2020-02-20 22:22:33 +01:00
|
|
|
task->func = AnimTask_SlackOffSquish_Step;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
static void AnimTask_SlackOffSquish_Step(u8 taskId)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
2018-12-29 19:31:04 +01:00
|
|
|
|
|
|
|
gTasks[taskId].data[0]++;
|
|
|
|
if (gTasks[taskId].data[0] > 16 && gTasks[taskId].data[0] < 40)
|
2018-12-29 18:07:46 +01:00
|
|
|
{
|
|
|
|
if (++task->data[1] > 2)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
2018-12-29 19:31:04 +01:00
|
|
|
task->data[2]++;
|
|
|
|
if (!(task->data[2] & 1))
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = -1;
|
2018-12-29 18:07:46 +01:00
|
|
|
else
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = 1;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
gSprites[task->data[15]].x2 = 0;
|
2018-12-29 18:07:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!RunAffineAnimFromTaskData(&gTasks[taskId]))
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|