pokeemerald/src/battle_anim_fight.c

1036 lines
29 KiB
C
Raw Normal View History

2018-10-25 23:46:23 +02:00
#include "global.h"
#include "battle_anim.h"
2018-11-26 17:25:51 +01:00
#include "gpu_regs.h"
#include "random.h"
#include "task.h"
#include "trig.h"
2018-10-25 23:46:23 +02:00
#include "constants/rgb.h"
2021-04-11 19:21:22 +02:00
static void AnimUnusedHumanoidFoot(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimSlideHandOrFootToTarget(struct Sprite *);
2020-02-15 00:11:04 +01:00
static void AnimJumpKick(struct Sprite *);
static void AnimBasicFistOrFoot(struct Sprite *);
static void AnimFistOrFootRandomPos(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimFistOrFootRandomPos_Step(struct Sprite *);
2020-02-15 00:11:04 +01:00
static void AnimCrossChopHand(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimCrossChopHand_Step(struct Sprite *);
static void AnimSlidingKick(struct Sprite *);
static void AnimSlidingKick_Step(struct Sprite *);
2020-02-15 00:11:04 +01:00
static void AnimSpinningKickOrPunch(struct Sprite *);
static void AnimStompFoot(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimStompFoot_Step(struct Sprite *);
static void AnimStompFoot_End(struct Sprite *);
2020-02-15 00:11:04 +01:00
static void AnimDizzyPunchDuck(struct Sprite *);
2020-02-20 06:04:42 +01:00
static void AnimBrickBreakWall(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimBrickBreakWall_Step(struct Sprite *);
2020-02-20 06:04:42 +01:00
static void AnimBrickBreakWallShard(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimBrickBreakWallShard_Step(struct Sprite *);
2020-02-20 02:22:53 +01:00
static void AnimSuperpowerOrb(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimSuperpowerOrb_Step(struct Sprite *);
2020-02-20 02:22:53 +01:00
static void AnimSuperpowerRock(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimSuperpowerRock_Step1(struct Sprite *);
static void AnimSuperpowerRock_Step2(struct Sprite *);
2020-02-20 02:22:53 +01:00
static void AnimSuperpowerFireball(struct Sprite *);
2020-02-14 22:05:43 +01:00
static void AnimArmThrustHit(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimArmThrustHit_Step(struct Sprite *sprite);
static void AnimRevengeScratch(struct Sprite *);
2020-02-15 00:11:04 +01:00
static void AnimFocusPunchFist(struct Sprite *);
2018-11-26 17:25:51 +01:00
static void AnimSpinningKickOrPunchFinish(struct Sprite *);
extern struct SpriteTemplate gBasicHitSplatSpriteTemplate;
2018-10-25 23:46:23 +02:00
2020-02-21 18:38:20 +01:00
// Unused
2021-04-11 19:21:22 +02:00
static const struct SpriteTemplate sUnusedHumanoidFootSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HUMANOID_FOOT,
.paletteTag = ANIM_TAG_HUMANOID_FOOT,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2018-10-25 23:46:23 +02:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2021-04-11 19:21:22 +02:00
.callback = AnimUnusedHumanoidFoot,
2018-10-25 23:46:23 +02:00
};
static const union AnimCmd sAnim_Fist[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
static const union AnimCmd sAnim_FootWide[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(16, 1),
ANIMCMD_END,
};
static const union AnimCmd sAnim_FootTall[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(32, 1),
ANIMCMD_END,
};
static const union AnimCmd sAnim_HandLeft[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(48, 1),
ANIMCMD_END,
};
static const union AnimCmd sAnim_HandRight[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(48, 1, .hFlip = TRUE),
ANIMCMD_END,
};
static const union AnimCmd *const sAnims_HandsAndFeet[] =
2018-10-25 23:46:23 +02:00
{
sAnim_Fist,
sAnim_FootWide,
sAnim_FootTall,
sAnim_HandLeft,
sAnim_HandRight,
2018-10-25 23:46:23 +02:00
};
2020-02-16 23:49:24 +01:00
const struct SpriteTemplate gKarateChopSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandsAndFeet,
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 22:22:33 +01:00
.callback = AnimSlideHandOrFootToTarget,
2018-10-25 23:46:23 +02:00
};
2020-02-15 00:11:04 +01:00
const struct SpriteTemplate gJumpKickSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandsAndFeet,
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-15 00:11:04 +01:00
.callback = AnimJumpKick,
2018-10-25 23:46:23 +02:00
};
const struct SpriteTemplate gFistFootSpriteTemplate =
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandsAndFeet,
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-11-26 17:25:51 +01:00
.callback = AnimBasicFistOrFoot,
2018-10-25 23:46:23 +02:00
};
2020-02-15 00:11:04 +01:00
const struct SpriteTemplate gFistFootRandomPosSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandsAndFeet,
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-15 00:11:04 +01:00
.callback = AnimFistOrFootRandomPos,
2018-10-25 23:46:23 +02:00
};
2020-02-15 00:11:04 +01:00
const struct SpriteTemplate gCrossChopHandSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = &sAnims_HandsAndFeet[3],
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-15 00:11:04 +01:00
.callback = AnimCrossChopHand,
2018-10-25 23:46:23 +02:00
};
2020-02-16 23:49:24 +01:00
const struct SpriteTemplate gSlidingKickSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = &sAnims_HandsAndFeet[1],
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 22:22:33 +01:00
.callback = AnimSlidingKick,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnim_SpinningHandOrFoot[] =
2018-10-25 23:46:23 +02:00
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(0xFFF8, 0xFFF8, 20, 1),
AFFINEANIMCMD_JUMP(1),
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd *const sAffineAnims_SpinningHandOrFoot[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAffineAnim_SpinningHandOrFoot,
2018-10-25 23:46:23 +02:00
};
2020-02-14 22:05:43 +01:00
// Blaze Kick / Meteor Mash
const struct SpriteTemplate gSpinningHandOrFootSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_32x32,
.anims = sAnims_HandsAndFeet,
2018-10-25 23:46:23 +02:00
.images = NULL,
2020-02-21 18:38:20 +01:00
.affineAnims = sAffineAnims_SpinningHandOrFoot,
2018-11-26 17:25:51 +01:00
.callback = AnimSpinningKickOrPunch,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnim_MegaPunchKick[] =
2018-10-25 23:46:23 +02:00
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(0xFFFC, 0xFFFC, 20, 1),
AFFINEANIMCMD_JUMP(1),
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd *const sAffineAnims_MegaPunchKick[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAffineAnim_MegaPunchKick,
2018-10-25 23:46:23 +02:00
};
const struct SpriteTemplate gMegaPunchKickSpriteTemplate =
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_32x32,
.anims = sAnims_HandsAndFeet,
2018-10-25 23:46:23 +02:00
.images = NULL,
2020-02-21 18:38:20 +01:00
.affineAnims = sAffineAnims_MegaPunchKick,
2018-11-26 17:25:51 +01:00
.callback = AnimSpinningKickOrPunch,
2018-10-25 23:46:23 +02:00
};
2020-02-20 02:22:53 +01:00
const struct SpriteTemplate gStompFootSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = &sAnims_HandsAndFeet[1],
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2018-11-26 17:25:51 +01:00
.callback = AnimStompFoot,
2018-10-25 23:46:23 +02:00
};
2020-02-15 00:11:04 +01:00
const struct SpriteTemplate gDizzyPunchDuckSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_DUCK,
.paletteTag = ANIM_TAG_DUCK,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-10-25 23:46:23 +02:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-15 00:11:04 +01:00
.callback = AnimDizzyPunchDuck,
2018-10-25 23:46:23 +02:00
};
2020-02-20 06:04:42 +01:00
const struct SpriteTemplate gBrickBreakWallSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_BLUE_LIGHT_WALL,
.paletteTag = ANIM_TAG_BLUE_LIGHT_WALL,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjBlend_64x64,
2018-10-25 23:46:23 +02:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 06:04:42 +01:00
.callback = AnimBrickBreakWall,
2018-10-25 23:46:23 +02:00
};
2020-02-20 06:04:42 +01:00
const struct SpriteTemplate gBrickBreakWallShardSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_TORN_METAL,
.paletteTag = ANIM_TAG_TORN_METAL,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2018-10-25 23:46:23 +02:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 06:04:42 +01:00
.callback = AnimBrickBreakWallShard,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnim_SuperpowerOrb[] =
2018-10-25 23:46:23 +02:00
{
AFFINEANIMCMD_FRAME(0x20, 0x20, 0, 0),
AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 64),
AFFINEANIMCMD_FRAME(0xFFFA, 0xFFFA, 0, 8),
AFFINEANIMCMD_FRAME(0x6, 0x6, 0, 8),
AFFINEANIMCMD_JUMP(2),
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd *const sAffineAnims_SuperpowerOrb[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAffineAnim_SuperpowerOrb,
2018-10-25 23:46:23 +02:00
};
2020-02-20 02:22:53 +01:00
const struct SpriteTemplate gSuperpowerOrbSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_CIRCLE_OF_LIGHT,
.paletteTag = ANIM_TAG_CIRCLE_OF_LIGHT,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineDouble_ObjBlend_64x64,
2018-10-25 23:46:23 +02:00
.anims = gDummySpriteAnimTable,
.images = NULL,
2020-02-21 18:38:20 +01:00
.affineAnims = sAffineAnims_SuperpowerOrb,
2020-02-20 02:22:53 +01:00
.callback = AnimSuperpowerOrb,
2018-10-25 23:46:23 +02:00
};
2020-02-20 02:22:53 +01:00
const struct SpriteTemplate gSuperpowerRockSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_FLAT_ROCK,
.paletteTag = ANIM_TAG_FLAT_ROCK,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x16,
2018-10-25 23:46:23 +02:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 02:22:53 +01:00
.callback = AnimSuperpowerRock,
2018-10-25 23:46:23 +02:00
};
2020-02-20 02:22:53 +01:00
const struct SpriteTemplate gSuperpowerFireballSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_METEOR,
.paletteTag = ANIM_TAG_METEOR,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_64x64,
2018-10-25 23:46:23 +02:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 02:22:53 +01:00
.callback = AnimSuperpowerFireball,
2018-10-25 23:46:23 +02:00
};
2020-02-14 22:05:43 +01:00
const struct SpriteTemplate gArmThrustHandSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandsAndFeet,
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-14 22:05:43 +01:00
.callback = AnimArmThrustHit,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_RevengeSmallScratch_0[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(32, 4),
ANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_RevengeSmallScratch_1[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(0, 4, .vFlip = TRUE),
ANIMCMD_FRAME(16, 4, .vFlip = TRUE),
ANIMCMD_FRAME(32, 4, .vFlip = TRUE),
ANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_RevengeSmallScratch_2[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(0, 4, .hFlip = TRUE),
ANIMCMD_FRAME(16, 4, .hFlip = TRUE),
ANIMCMD_FRAME(32, 4, .hFlip = TRUE),
ANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd *const sAnims_RevengeSmallScratch[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAnim_RevengeSmallScratch_0,
sAnim_RevengeSmallScratch_1,
sAnim_RevengeSmallScratch_2,
2018-10-25 23:46:23 +02:00
};
2020-02-16 23:49:24 +01:00
const struct SpriteTemplate gRevengeSmallScratchSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_PURPLE_SCRATCH,
.paletteTag = ANIM_TAG_PURPLE_SCRATCH,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_32x32,
2020-02-21 18:38:20 +01:00
.anims = sAnims_RevengeSmallScratch,
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 22:22:33 +01:00
.callback = AnimRevengeScratch,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_RevengeBigScratch_0[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(0, 6),
ANIMCMD_FRAME(64, 6),
ANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_RevengeBigScratch_1[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(0, 6, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(64, 6, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_RevengeBigScratch_2[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(0, 6, .hFlip = TRUE),
ANIMCMD_FRAME(64, 6, .hFlip = TRUE),
ANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd *const sAnims_RevengeBigScratch[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAnim_RevengeBigScratch_0,
sAnim_RevengeBigScratch_1,
sAnim_RevengeBigScratch_2,
2018-10-25 23:46:23 +02:00
};
2020-02-16 23:49:24 +01:00
const struct SpriteTemplate gRevengeBigScratchSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_PURPLE_SWIPE,
.paletteTag = ANIM_TAG_PURPLE_SWIPE,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_64x64,
2020-02-21 18:38:20 +01:00
.anims = sAnims_RevengeBigScratch,
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2020-02-20 22:22:33 +01:00
.callback = AnimRevengeScratch,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnim_FocusPunchFist[] =
2018-10-25 23:46:23 +02:00
{
AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0),
AFFINEANIMCMD_FRAME(0xFFE0, 0xFFE0, 0, 8),
AFFINEANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd *const sAffineAnims_FocusPunchFist[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAffineAnim_FocusPunchFist,
2018-10-25 23:46:23 +02:00
};
2020-02-15 00:11:04 +01:00
const struct SpriteTemplate gFocusPunchFistSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_32x32,
.anims = sAnims_HandsAndFeet,
2018-10-25 23:46:23 +02:00
.images = NULL,
2020-02-21 18:38:20 +01:00
.affineAnims = sAffineAnims_FocusPunchFist,
2020-02-15 00:11:04 +01:00
.callback = AnimFocusPunchFist,
2018-10-25 23:46:23 +02:00
};
2018-11-26 17:25:51 +01:00
2021-04-11 19:21:22 +02:00
static void AnimUnusedHumanoidFoot(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
2018-12-20 04:13:26 +01:00
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
2018-11-26 17:25:51 +01:00
sprite->pos1.y += gBattleAnimArgs[1];
sprite->data[0] = 15;
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2020-02-20 22:22:33 +01:00
static void AnimSlideHandOrFootToTarget(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (gBattleAnimArgs[7] == 1 && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
2018-11-26 17:25:51 +01:00
{
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
}
StartSpriteAnim(sprite, gBattleAnimArgs[6]);
gBattleAnimArgs[6] = 0;
2020-02-15 00:11:04 +01:00
AnimTravelDiagonally(sprite);
2018-11-26 17:25:51 +01:00
}
2020-02-15 00:11:04 +01:00
static void AnimJumpKick(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (IsContest())
{
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
}
2020-02-20 22:22:33 +01:00
AnimSlideHandOrFootToTarget(sprite);
2018-11-26 17:25:51 +01:00
}
// Displays a basic fist or foot sprite for a given duration.
// Used by many fighting moves (and elemental "punch" moves).
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: duration
// arg 3: ? (todo: related to initial pixel offsets)
// arg 4: anim num
2020-02-15 00:11:04 +01:00
static void AnimBasicFistOrFoot(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
StartSpriteAnim(sprite, gBattleAnimArgs[4]);
if (gBattleAnimArgs[3] == 0)
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, 1);
2018-11-26 17:25:51 +01:00
else
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, TRUE);
2018-11-26 17:25:51 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2020-02-15 00:11:04 +01:00
static void AnimFistOrFootRandomPos(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
u8 battler;
s16 xMod, yMod;
s16 x, y;
if (gBattleAnimArgs[0] == 0)
battler = gBattleAnimAttacker;
else
battler = gBattleAnimTarget;
if (gBattleAnimArgs[2] < 0)
gBattleAnimArgs[2] = Random2() % 5;
StartSpriteAnim(sprite, gBattleAnimArgs[2]);
sprite->pos1.x = GetBattlerSpriteCoord(battler, 2);
sprite->pos1.y = GetBattlerSpriteCoord(battler, 3);
2018-12-30 17:58:42 +01:00
xMod = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_WIDTH) / 2;
yMod = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 4;
2018-11-26 17:25:51 +01:00
x = Random2() % xMod;
y = Random2() % yMod;
if (Random2() & 1)
x *= -1;
if (Random2() & 1)
y *= -1;
if ((gBattlerPositions[battler] & BIT_SIDE) == B_SIDE_PLAYER)
y += 0xFFF0;
sprite->pos1.x += x;
sprite->pos1.y += y;
sprite->data[0] = gBattleAnimArgs[1];
sprite->data[7] = CreateSprite(&gBasicHitSplatSpriteTemplate, sprite->pos1.x, sprite->pos1.y, sprite->subpriority + 1);
if (sprite->data[7] != 64)
{
StartSpriteAffineAnim(&gSprites[sprite->data[7]], 0);
gSprites[sprite->data[7]].callback = SpriteCallbackDummy;
}
2020-02-20 22:22:33 +01:00
sprite->callback = AnimFistOrFootRandomPos_Step;
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimFistOrFootRandomPos_Step(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (sprite->data[0] == 0)
{
if (sprite->data[7] != 64)
{
FreeOamMatrix(gSprites[sprite->data[7]].oam.matrixNum);
DestroySprite(&gSprites[sprite->data[7]]);
}
DestroyAnimSprite(sprite);
}
else
{
sprite->data[0]--;
}
}
2020-02-15 00:11:04 +01:00
static void AnimCrossChopHand(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, TRUE);
2018-11-26 17:25:51 +01:00
sprite->data[0] = 30;
if (gBattleAnimArgs[2] == 0)
{
sprite->data[2] = sprite->pos1.x - 20;
}
else
{
sprite->data[2] = sprite->pos1.x + 20;
sprite->hFlip = 1;
}
sprite->data[4] = sprite->pos1.y - 20;
sprite->callback = StartAnimLinearTranslation;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimCrossChopHand_Step);
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimCrossChopHand_Step(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (++sprite->data[5] == 11)
{
sprite->data[2] = sprite->pos1.x - sprite->pos2.x;
sprite->data[4] = sprite->pos1.y - sprite->pos2.y;
sprite->data[0] = 8;
sprite->pos1.x += sprite->pos2.x;
sprite->pos1.y += sprite->pos2.y;
sprite->pos2.y = 0;
sprite->pos2.x = 0;
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
}
2020-02-20 22:22:33 +01:00
// Rolling Kick / Low Kick
static void AnimSlidingKick(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget && GetBattlerPosition(gBattleAnimTarget) < B_POSITION_PLAYER_RIGHT)
gBattleAnimArgs[0] *= -1;
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, TRUE);
2018-11-26 17:25:51 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[3];
sprite->data[1] = sprite->pos1.x;
sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[2];
sprite->data[3] = sprite->pos1.y;
sprite->data[4] = sprite->pos1.y;
InitAnimLinearTranslation(sprite);
sprite->data[5] = gBattleAnimArgs[5];
sprite->data[6] = gBattleAnimArgs[4];
sprite->data[7] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSlidingKick_Step;
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSlidingKick_Step(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
2018-12-20 04:13:26 +01:00
if (!AnimTranslateLinear(sprite))
2018-11-26 17:25:51 +01:00
{
sprite->pos2.y += Sin(sprite->data[7] >> 8, sprite->data[5]);
sprite->data[7] += sprite->data[6];
}
else
{
DestroyAnimSprite(sprite);
}
}
// Animates the spinning, shrinking kick or punch, which then
// reappears at full size. Used by moves such as MOVE_MEGA_PUNCH and MOVE_MEGA_KICK.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: anim num
// arg 3: spin duration
2020-02-15 00:11:04 +01:00
static void AnimSpinningKickOrPunch(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, TRUE);
2018-11-26 17:25:51 +01:00
StartSpriteAnim(sprite, gBattleAnimArgs[2]);
sprite->data[0] = gBattleAnimArgs[3];
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData6(sprite, AnimSpinningKickOrPunchFinish);
}
static void AnimSpinningKickOrPunchFinish(struct Sprite *sprite)
{
StartSpriteAffineAnim(sprite, 0);
sprite->affineAnimPaused = 1;
sprite->data[0] = 20;
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
// Animates MOVE_STOMP's foot that slides downward.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: initial wait duration
2020-02-15 00:11:04 +01:00
static void AnimStompFoot(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, TRUE);
2018-11-26 17:25:51 +01:00
sprite->data[0] = gBattleAnimArgs[2];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimStompFoot_Step;
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimStompFoot_Step(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (--sprite->data[0] == -1)
{
sprite->data[0] = 6;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->callback = StartAnimLinearTranslation;
2020-02-20 22:22:33 +01:00
StoreSpriteCallbackInData6(sprite, AnimStompFoot_End);
2018-11-26 17:25:51 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimStompFoot_End(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
sprite->data[0] = 15;
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2020-02-15 00:11:04 +01:00
static void AnimDizzyPunchDuck(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (sprite->data[0] == 0)
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, TRUE);
2018-11-26 17:25:51 +01:00
sprite->data[1] = gBattleAnimArgs[2];
sprite->data[2] = gBattleAnimArgs[3];
sprite->data[0]++;
}
else
{
sprite->data[4] += sprite->data[1];
sprite->pos2.x = sprite->data[4] >> 8;
sprite->pos2.y = Sin(sprite->data[3], sprite->data[2]);
sprite->data[3] = (sprite->data[3] + 3) & 0xFF;
if (sprite->data[3] > 100)
sprite->invisible = sprite->data[3] % 2;
if (sprite->data[3] > 120)
DestroyAnimSprite(sprite);
}
}
2020-02-20 06:04:42 +01:00
// The wall that appears when Brick Break is going to shatter the target's defensive wall
static void AnimBrickBreakWall(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
2020-02-20 06:04:42 +01:00
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
2018-11-26 17:25:51 +01:00
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
}
else
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
}
sprite->pos1.x += gBattleAnimArgs[1];
sprite->pos1.y += gBattleAnimArgs[2];
sprite->data[0] = 0;
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[2] = gBattleAnimArgs[4];
sprite->data[3] = 0;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBrickBreakWall_Step;
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimBrickBreakWall_Step(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
switch (sprite->data[0])
{
case 0:
if (--sprite->data[1] == 0)
{
if (sprite->data[2] == 0)
DestroyAnimSprite(sprite);
else
sprite->data[0]++;
}
break;
case 1:
if (++sprite->data[1] > 1)
{
sprite->data[1] = 0;
sprite->data[3]++;
if (sprite->data[3] & 1)
sprite->pos2.x = 2;
else
sprite->pos2.x = -2;
}
if (--sprite->data[2] == 0)
DestroyAnimSprite(sprite);
break;
}
}
2020-02-20 06:04:42 +01:00
// Piece of shattered defensive wall flies off. Used by Brick Break when the target has a defensive wall
static void AnimBrickBreakWallShard(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
2020-02-20 06:04:42 +01:00
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
2018-11-26 17:25:51 +01:00
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[2];
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[3];
}
else
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[2];
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[3];
}
sprite->oam.tileNum += gBattleAnimArgs[1] * 16;
sprite->data[0] = 0;
switch (gBattleAnimArgs[1])
{
case 0:
sprite->data[6] = -3;
sprite->data[7] = -3;
break;
case 1:
sprite->data[6] = 3;
sprite->data[7] = -3;
break;
case 2:
sprite->data[6] = -3;
sprite->data[7] = 3;
break;
case 3:
sprite->data[6] = 3;
sprite->data[7] = 3;
break;
default:
DestroyAnimSprite(sprite);
return;
}
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBrickBreakWallShard_Step;
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimBrickBreakWallShard_Step(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
sprite->pos1.x += sprite->data[6];
sprite->pos1.y += sprite->data[7];
if (++sprite->data[0] > 40)
DestroyAnimSprite(sprite);
}
2020-02-20 02:22:53 +01:00
static void AnimSuperpowerOrb(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
2020-02-20 02:22:53 +01:00
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
2018-11-26 17:25:51 +01:00
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattlerAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattlerAttacker, 3);
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
2018-11-26 17:25:51 +01:00
sprite->data[7] = gBattleAnimTarget;
}
else
{
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget);
2018-11-26 17:25:51 +01:00
sprite->data[7] = gBattleAnimAttacker;
}
sprite->data[0] = 0;
sprite->data[1] = 12;
sprite->data[2] = 8;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSuperpowerOrb_Step;
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSuperpowerOrb_Step(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (++sprite->data[0] == 180)
{
SetGpuReg(REG_OFFSET_BLDCNT, 0);
sprite->data[0] = 16;
sprite->data[1] = sprite->pos1.x;
sprite->data[2] = GetBattlerSpriteCoord(sprite->data[7], 2);
sprite->data[3] = sprite->pos1.y;
sprite->data[4] = GetBattlerSpriteCoord(sprite->data[7], 3);
InitAnimLinearTranslation(sprite);
2018-12-18 05:08:08 +01:00
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
2021-01-23 06:40:46 +01:00
sprite->callback = AnimTranslateLinear_WaitEnd;
2018-11-26 17:25:51 +01:00
}
}
2020-02-20 02:22:53 +01:00
// Floating rock that flies off to hit the target. Used by Superpower
static void AnimSuperpowerRock(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
sprite->pos1.x = gBattleAnimArgs[0];
sprite->pos1.y = 120;
sprite->data[0] = gBattleAnimArgs[3];
2018-12-18 05:08:08 +01:00
StorePointerInVars(&sprite->data[4], &sprite->data[5], (void *)(sprite->pos1.y << 8));
2018-11-26 17:25:51 +01:00
sprite->data[6] = gBattleAnimArgs[1];
sprite->oam.tileNum += gBattleAnimArgs[2] * 4;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSuperpowerRock_Step1;
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSuperpowerRock_Step1(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
void *var0;
if (sprite->data[0] != 0)
{
2018-12-18 05:08:08 +01:00
var0 = LoadPointerFromVars(sprite->data[4], sprite->data[5]);
2018-11-26 17:25:51 +01:00
var0 -= sprite->data[6];
2018-12-18 05:08:08 +01:00
StorePointerInVars(&sprite->data[4], &sprite->data[5], var0);
2018-11-26 17:25:51 +01:00
var0 = (void *)(((intptr_t)var0) >> 8);
sprite->pos1.y = (intptr_t)var0;
if (sprite->pos1.y < -8)
DestroyAnimSprite(sprite);
else
sprite->data[0]--;
}
else
{
s16 pos0 = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
s16 pos1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
s16 pos2 = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
s16 pos3 = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[0] = pos2 - pos0;
sprite->data[1] = pos3 - pos1;
sprite->data[2] = sprite->pos1.x << 4;
sprite->data[3] = sprite->pos1.y << 4;
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSuperpowerRock_Step2;
2018-11-26 17:25:51 +01:00
}
}
2020-02-20 22:22:33 +01:00
static void AnimSuperpowerRock_Step2(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
u16 edgeX;
sprite->data[2] += sprite->data[0];
sprite->data[3] += sprite->data[1];
sprite->pos1.x = sprite->data[2] >> 4;
sprite->pos1.y = sprite->data[3] >> 4;
edgeX = sprite->pos1.x + 8;
if (edgeX > 256 || sprite->pos1.y < -8 || sprite->pos1.y > 120)
DestroyAnimSprite(sprite);
}
2020-02-20 02:22:53 +01:00
static void AnimSuperpowerFireball(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
u8 battler;
2020-02-20 02:22:53 +01:00
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
2018-11-26 17:25:51 +01:00
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattlerAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattlerAttacker, 3);
battler = gBattleAnimTarget;
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
2018-11-26 17:25:51 +01:00
}
else
{
battler = gBattleAnimAttacker;
2018-12-20 04:13:26 +01:00
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget);
2018-11-26 17:25:51 +01:00
}
if (IsContest())
sprite->oam.matrixNum |= ST_OAM_HFLIP;
2018-11-26 17:25:51 +01:00
else if (GetBattlerSide(battler) == B_SIDE_PLAYER)
sprite->oam.matrixNum |= (ST_OAM_HFLIP | ST_OAM_VFLIP);
2018-11-26 17:25:51 +01:00
sprite->data[0] = 16;
sprite->data[1] = sprite->pos1.x;
sprite->data[2] = GetBattlerSpriteCoord(battler, 2);
sprite->data[3] = sprite->pos1.y;
sprite->data[4] = GetBattlerSpriteCoord(battler, 3);
InitAnimLinearTranslation(sprite);
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
2021-01-23 06:40:46 +01:00
sprite->callback = AnimTranslateLinear_WaitEnd;
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimArmThrustHit_Step(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (sprite->data[0] == sprite->data[4])
DestroyAnimSprite(sprite);
sprite->data[0]++;
}
2020-02-14 22:05:43 +01:00
static void AnimArmThrustHit(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
u8 turn;
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[2] = gBattleAnimArgs[0];
sprite->data[3] = gBattleAnimArgs[1];
sprite->data[4] = gBattleAnimArgs[2];
turn = gAnimMoveTurn;
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
turn++;
if (turn & 1)
{
sprite->data[2] = -sprite->data[2];
sprite->data[1]++;
}
StartSpriteAnim(sprite, sprite->data[1]);
sprite->pos2.x = sprite->data[2];
sprite->pos2.y = sprite->data[3];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimArmThrustHit_Step;
2018-11-26 17:25:51 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimRevengeScratch(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
2020-02-20 22:22:33 +01:00
if (gBattleAnimArgs[2] == ANIM_ATTACKER)
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimAttacker(sprite, 0);
2018-11-26 17:25:51 +01:00
else
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, FALSE);
2018-11-26 17:25:51 +01:00
if (IsContest())
{
StartSpriteAnim(sprite, 2);
}
else if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{
StartSpriteAnim(sprite, 1);
}
2018-12-18 05:08:08 +01:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-11-26 17:25:51 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2020-02-15 00:11:04 +01:00
// Fist shrinks toward target and shakes
static void AnimFocusPunchFist(struct Sprite *sprite)
2018-11-26 17:25:51 +01:00
{
if (sprite->affineAnimEnded)
{
sprite->data[1] = (sprite->data[1] + 40) & 0xFF;
sprite->pos2.x = Sin(sprite->data[1], 2);
if (++sprite->data[0] > 40)
DestroyAnimSprite(sprite);
}
}
2020-02-16 23:49:24 +01:00
void AnimTask_MoveSkyUppercutBg(u8 taskId)
2018-11-26 17:25:51 +01:00
{
struct Task *task = &gTasks[taskId];
switch (task->data[0])
{
case 0:
UpdateAnimBg3ScreenSize(FALSE);
2018-11-26 17:25:51 +01:00
task->data[8] = gBattleAnimArgs[0];
task->data[0]++;
break;
case 1:
if (--task->data[8] == -1)
task->data[0]++;
break;
case 2:
default:
task->data[9] += 1280;
break;
}
task->data[10] += 2816;
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
gBattle_BG3_X += task->data[9] >> 8;
else
gBattle_BG3_X -= task->data[9] >> 8;
gBattle_BG3_Y += task->data[10] >> 8;
task->data[9] &= 0xFF;
task->data[10] &= 0xFF;
if (gBattleAnimArgs[7] == -1)
2018-11-26 17:25:51 +01:00
{
gBattle_BG3_X = 0;
gBattle_BG3_Y = 0;
UpdateAnimBg3ScreenSize(TRUE);
2018-11-26 17:25:51 +01:00
DestroyAnimVisualTask(taskId);
}
}