pokeemerald/src/battle_anim_poison.c

537 lines
14 KiB
C
Raw Normal View History

2018-10-25 23:46:23 +02:00
#include "global.h"
#include "battle_anim.h"
2018-11-26 16:13:45 +01:00
#include "trig.h"
2018-10-25 23:46:23 +02:00
#include "constants/rgb.h"
2020-02-20 02:22:53 +01:00
static void AnimSludgeProjectile(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimSludgeProjectile_Step(struct Sprite *);
2020-02-20 02:22:53 +01:00
static void AnimAcidPoisonBubble(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimSludgeBombHitParticle_Step(struct Sprite *);
2020-02-20 02:22:53 +01:00
static void AnimAcidPoisonDroplet(struct Sprite *);
2020-02-20 22:22:33 +01:00
static void AnimBubbleEffect_Step(struct Sprite *);
static void AnimSuckerPunchStep(struct Sprite *sprite);
2020-02-29 13:59:41 +01:00
static void AnimSuckerPunch(struct Sprite *sprite);
static void AnimGunkShotParticlesStep(struct Sprite *sprite);
static void AnimGunkShotParticles(struct Sprite *sprite);
static void AnimGunkShotImpact(struct Sprite *sprite);
2018-10-25 23:46:23 +02:00
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_ToxicBubble[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_FRAME(8, 5),
ANIMCMD_FRAME(16, 5),
ANIMCMD_FRAME(24, 5),
ANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd *const sAnims_ToxicBubble[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAnim_ToxicBubble,
2018-10-25 23:46:23 +02:00
};
2020-02-20 02:22:53 +01:00
const struct SpriteTemplate gToxicBubbleSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_TOXIC_BUBBLE,
.paletteTag = ANIM_TAG_TOXIC_BUBBLE,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineOff_ObjNormal_16x32,
2020-02-21 18:38:20 +01:00
.anims = sAnims_ToxicBubble,
2018-10-25 23:46:23 +02:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
2019-10-20 16:22:53 +02:00
.callback = AnimSpriteOnMonPos,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_PoisonProjectile[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_AcidPoisonDroplet[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(4, 1),
ANIMCMD_END,
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd sAnim_SludgeBombHit[] =
2018-10-25 23:46:23 +02:00
{
ANIMCMD_FRAME(8, 1),
ANIMCMD_END,
};
2020-05-25 08:37:32 +02:00
const union AnimCmd *const gAnims_PoisonProjectile[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAnim_PoisonProjectile,
2018-10-25 23:46:23 +02:00
};
2020-05-25 08:37:32 +02:00
const union AnimCmd *const gAnims_AcidPoisonDroplet[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAnim_AcidPoisonDroplet,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AnimCmd *const sAnims_SludgeBombHit[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAnim_SludgeBombHit,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnim_PoisonProjectile[] =
2018-10-25 23:46:23 +02:00
{
AFFINEANIMCMD_FRAME(0x160, 0x160, 0, 0),
AFFINEANIMCMD_FRAME(0xFFF6, 0xFFF6, 0, 10),
AFFINEANIMCMD_FRAME(0xA, 0xA, 0, 10),
AFFINEANIMCMD_JUMP(0),
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnim_SludgeBombHit[] =
2018-10-25 23:46:23 +02:00
{
AFFINEANIMCMD_FRAME(0xEC, 0xEC, 0, 0),
AFFINEANIMCMD_END,
};
2020-02-29 13:59:41 +01:00
const union AffineAnimCmd *const gAffineAnims_PoisonProjectile[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAffineAnim_PoisonProjectile,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd *const sAffineAnims_SludgeBombHit[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAffineAnim_SludgeBombHit,
2018-10-25 23:46:23 +02:00
};
2020-02-20 02:22:53 +01:00
const struct SpriteTemplate gSludgeProjectileSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_POISON_BUBBLE,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
2020-05-25 08:37:32 +02:00
.anims = gAnims_PoisonProjectile,
2018-10-25 23:46:23 +02:00
.images = NULL,
2020-02-29 13:59:41 +01:00
.affineAnims = gAffineAnims_PoisonProjectile,
2020-02-20 02:22:53 +01:00
.callback = AnimSludgeProjectile,
2018-10-25 23:46:23 +02:00
};
2020-02-14 22:05:43 +01:00
const struct SpriteTemplate gAcidPoisonBubbleSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_POISON_BUBBLE,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
2020-05-25 08:37:32 +02:00
.anims = gAnims_PoisonProjectile,
2018-10-25 23:46:23 +02:00
.images = NULL,
2020-02-29 13:59:41 +01:00
.affineAnims = gAffineAnims_PoisonProjectile,
2020-02-14 22:05:43 +01:00
.callback = AnimAcidPoisonBubble,
2018-10-25 23:46:23 +02:00
};
2020-02-20 02:22:53 +01:00
const struct SpriteTemplate gSludgeBombHitParticleSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_POISON_BUBBLE,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2020-02-21 18:38:20 +01:00
.anims = sAnims_SludgeBombHit,
2018-10-25 23:46:23 +02:00
.images = NULL,
2020-02-21 18:38:20 +01:00
.affineAnims = sAffineAnims_SludgeBombHit,
2020-02-20 02:22:53 +01:00
.callback = AnimSludgeBombHitParticle,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnim_AcidPoisonDroplet[] =
2018-10-25 23:46:23 +02:00
{
AFFINEANIMCMD_FRAME(0xFFF0, 0x10, 0, 6),
AFFINEANIMCMD_FRAME(0x10, 0xFFF0, 0, 6),
AFFINEANIMCMD_JUMP(0),
};
2020-02-21 18:38:20 +01:00
const union AffineAnimCmd *const gAffineAnims_Droplet[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAffineAnim_AcidPoisonDroplet,
2018-10-25 23:46:23 +02:00
};
2020-02-14 22:05:43 +01:00
const struct SpriteTemplate gAcidPoisonDropletSpriteTemplate =
2018-10-25 23:46:23 +02:00
{
.tileTag = ANIM_TAG_POISON_BUBBLE,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
2020-05-25 08:37:32 +02:00
.anims = gAnims_AcidPoisonDroplet,
2018-10-25 23:46:23 +02:00
.images = NULL,
2020-02-21 18:38:20 +01:00
.affineAnims = gAffineAnims_Droplet,
2020-02-14 22:05:43 +01:00
.callback = AnimAcidPoisonDroplet,
2018-10-25 23:46:23 +02:00
};
2020-02-21 18:38:20 +01:00
static const union AffineAnimCmd sAffineAnim_Bubble[] =
2018-10-25 23:46:23 +02:00
{
AFFINEANIMCMD_FRAME(0x9C, 0x9C, 0, 0),
AFFINEANIMCMD_FRAME(0x5, 0x5, 0, 20),
AFFINEANIMCMD_END,
};
2020-11-29 15:22:31 +01:00
const union AffineAnimCmd *const gAffineAnims_Bubble[] =
2018-10-25 23:46:23 +02:00
{
2020-02-21 18:38:20 +01:00
sAffineAnim_Bubble,
2018-10-25 23:46:23 +02:00
};
const struct SpriteTemplate gPoisonBubbleSpriteTemplate =
{
.tileTag = ANIM_TAG_POISON_BUBBLE,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
2020-05-25 08:37:32 +02:00
.anims = gAnims_PoisonProjectile,
2018-10-25 23:46:23 +02:00
.images = NULL,
2020-11-29 15:22:31 +01:00
.affineAnims = gAffineAnims_Bubble,
2018-11-26 16:13:45 +01:00
.callback = AnimBubbleEffect,
2018-10-25 23:46:23 +02:00
};
const struct SpriteTemplate gWaterBubbleSpriteTemplate =
{
.tileTag = ANIM_TAG_SMALL_BUBBLES,
.paletteTag = ANIM_TAG_SMALL_BUBBLES,
2019-10-15 01:26:47 +02:00
.oam = &gOamData_AffineNormal_ObjBlend_16x16,
2020-02-21 18:38:20 +01:00
.anims = gAnims_WaterBubble,
2018-10-25 23:46:23 +02:00
.images = NULL,
2020-11-29 15:22:31 +01:00
.affineAnims = gAffineAnims_Bubble,
2018-11-26 16:13:45 +01:00
.callback = AnimBubbleEffect,
2018-10-25 23:46:23 +02:00
};
2018-11-17 20:15:38 +01:00
const struct SpriteTemplate gGreenPoisonDrip =
{
.tileTag = ANIM_TAG_GREEN_POISON_BUBBLE,
.paletteTag = ANIM_TAG_GREEN_POISON_BUBBLE,
2019-10-19 17:47:55 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
2020-05-25 08:37:32 +02:00
.anims = gAnims_AcidPoisonDroplet,
2018-11-17 20:15:38 +01:00
.images = NULL,
2020-02-29 13:59:41 +01:00
.affineAnims = gAffineAnims_Droplet,
.callback = AnimAcidPoisonDroplet,
2018-11-17 20:15:38 +01:00
};
const struct SpriteTemplate gGreenPoisonBubble =
{
.tileTag = ANIM_TAG_GREEN_POISON_BUBBLE,
.paletteTag = ANIM_TAG_GREEN_POISON_BUBBLE,
2019-10-19 17:47:55 +02:00
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
2020-05-25 08:37:32 +02:00
.anims = gAnims_PoisonProjectile,
2018-11-17 20:15:38 +01:00
.images = NULL,
2020-02-29 13:59:41 +01:00
.affineAnims = gAffineAnims_PoisonProjectile,
.callback = AnimAcidPoisonBubble,
2018-11-17 21:16:48 +01:00
};
2018-11-30 20:46:09 +01:00
const union AnimCmd gSuckerPunchAnimCmd[] =
{
ANIMCMD_FRAME(0, 3),
ANIMCMD_FRAME(0, 3, .hFlip = TRUE),
ANIMCMD_FRAME(0, 3, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(0, 3, .vFlip = TRUE),
ANIMCMD_JUMP(0),
};
const union AnimCmd *const gSuckerPunchAnim[] =
{
gSuckerPunchAnimCmd,
};
const union AnimCmd gGunkShotParticlesAnimCmd[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_FRAME(4, 1),
ANIMCMD_FRAME(8, 1),
ANIMCMD_FRAME(12, 1),
ANIMCMD_JUMP(0),
};
const union AnimCmd *const gGunkShotParticlesAnims[] =
{
gGunkShotParticlesAnimCmd,
};
const union AffineAnimCmd gSuckerPunchImpactAffineAnimCmd_1[] =
{
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gSuckerPunchImpactAffineAnimCmd_2[] =
{
AFFINEANIMCMD_FRAME(0xD8, 0xD8, 0, 0),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gSuckerPunchImpactAffineAnimCmd_3[] =
{
AFFINEANIMCMD_FRAME(0xB0, 0xB0, 0, 0),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gSuckerPunchImpactAffineAnimCmd_4[] =
{
AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd *const gSuckerPunchImpactAffineAnim[] =
{
gSuckerPunchImpactAffineAnimCmd_1,
gSuckerPunchImpactAffineAnimCmd_2,
gSuckerPunchImpactAffineAnimCmd_3,
gSuckerPunchImpactAffineAnimCmd_4,
};
const struct SpriteTemplate gSuckerPunchSpriteTemplate =
{
.tileTag = ANIM_TAG_POISON_JAB,
.paletteTag = ANIM_TAG_POISON_JAB,
2019-10-19 17:47:55 +02:00
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
.anims = gSuckerPunchAnim,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSuckerPunch,
};
const struct SpriteTemplate gGunkShoParticlesSpriteTemplate =
{
.tileTag = ANIM_TAG_WATER_ORB,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
2019-10-19 17:47:55 +02:00
.oam = &gOamData_AffineOff_ObjBlend_16x16,
.anims = gGunkShotParticlesAnims,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimGunkShotParticles,
};
const struct SpriteTemplate gGunkShotImpactSpriteTemplate =
{
.tileTag = ANIM_TAG_WATER_IMPACT,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
2019-10-19 17:47:55 +02:00
.oam = &gOamData_AffineNormal_ObjBlend_32x32,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gSuckerPunchImpactAffineAnim,
.callback = AnimGunkShotImpact,
};
2020-02-29 13:59:41 +01:00
static void AnimGunkShotImpact(struct Sprite *sprite)
{
StartSpriteAffineAnim(sprite, gBattleAnimArgs[3]);
if (gBattleAnimArgs[2] == 0)
InitSpritePosToAnimAttacker(sprite, 1);
else
InitSpritePosToAnimTarget(sprite, TRUE);
sprite->callback = RunStoredCallbackWhenAffineAnimEnds;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2020-02-29 13:59:41 +01:00
static void AnimGunkShotParticles(struct Sprite *sprite)
{
u16 retArg;
InitSpritePosToAnimAttacker(sprite, TRUE);
sprite->data[0] = 30;
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
InitAnimLinearTranslation(sprite);
sprite->data[5] = 0xD200 / sprite->data[0];
sprite->data[7] = gBattleAnimArgs[3];
retArg = gBattleAnimArgs[ARG_RET_ID];
if (gBattleAnimArgs[ARG_RET_ID] > 127)
{
sprite->data[6] = (retArg - 127) * 256;
sprite->data[7] = -sprite->data[7];
}
else
{
sprite->data[6] = retArg * 256;
}
sprite->callback = AnimGunkShotParticlesStep;
sprite->callback(sprite);
}
2020-02-29 13:59:41 +01:00
static void AnimGunkShotParticlesStep(struct Sprite *sprite)
{
if (AnimTranslateLinear(sprite))
DestroyAnimSprite(sprite);
sprite->y2 += Sin(sprite->data[6] >> 8, sprite->data[7]);
if ((sprite->data[6] + sprite->data[5]) >> 8 > 127)
{
sprite->data[6] = 0;
sprite->data[7] = -sprite->data[7];
}
else
{
sprite->data[6] += sprite->data[5];
}
}
2020-02-29 13:59:41 +01:00
static void AnimSuckerPunch(struct Sprite *sprite)
{
if (BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget && GetBattlerPosition(gBattleAnimTarget) < B_POSITION_PLAYER_RIGHT)
gBattleAnimArgs[0] *= -1;
InitSpritePosToAnimTarget(sprite, TRUE);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[3];
sprite->data[1] = sprite->x;
sprite->data[2] = sprite->x + gBattleAnimArgs[2];
sprite->data[3] = sprite->y;
sprite->data[4] = sprite->y;
InitAnimLinearTranslation(sprite);
sprite->data[5] = gBattleAnimArgs[5];
sprite->data[6] = gBattleAnimArgs[4];
sprite->data[7] = 0;
sprite->callback = AnimSuckerPunchStep;
}
static void AnimSuckerPunchStep(struct Sprite *sprite)
{
if (!AnimTranslateLinear(sprite))
{
sprite->y2 += Sin(sprite->data[7] >> 8, sprite->data[5]);
sprite->data[7] += sprite->data[6];
}
else
{
DestroyAnimSprite(sprite);
}
}
2020-02-20 02:22:53 +01:00
static void AnimSludgeProjectile(struct Sprite *sprite)
2018-11-26 16:13:45 +01:00
{
if (!gBattleAnimArgs[3])
StartSpriteAnim(sprite, 2);
2022-07-25 20:59:14 +02:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-11-26 16:13:45 +01:00
sprite->data[0] = gBattleAnimArgs[2];
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-11-26 16:13:45 +01:00
sprite->data[5] = -30;
InitAnimArcTranslation(sprite);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSludgeProjectile_Step;
2018-11-26 16:13:45 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSludgeProjectile_Step(struct Sprite *sprite)
2018-11-26 16:13:45 +01:00
{
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-11-26 16:13:45 +01:00
DestroyAnimSprite(sprite);
}
2020-02-20 02:22:53 +01:00
static void AnimAcidPoisonBubble(struct Sprite *sprite)
2018-11-26 16:13:45 +01:00
{
2020-06-26 22:20:00 +02:00
s16 l1 = 0, l2 = 0;
2018-11-26 16:13:45 +01:00
if (!gBattleAnimArgs[3])
StartSpriteAnim(sprite, 2);
2022-07-25 20:59:14 +02:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2020-06-26 22:20:00 +02:00
if (gBattleAnimArgs[6])
SetAverageBattlerPositions(gBattleAnimTarget, TRUE, &l1, &l2);
2020-06-26 22:20:00 +02:00
else
l1 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2), l2 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
2018-11-26 16:13:45 +01:00
if (GetBattlerSide(gBattleAnimAttacker))
gBattleAnimArgs[4] = -gBattleAnimArgs[4];
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[2] = l1 + gBattleAnimArgs[4];
sprite->data[4] = l2 + gBattleAnimArgs[5];
sprite->data[5] = -30;
InitAnimArcTranslation(sprite);
2020-02-20 22:22:33 +01:00
sprite->callback = AnimAcidPoisonBubble_Step;
2018-11-26 16:13:45 +01:00
}
2020-05-25 08:37:32 +02:00
void AnimAcidPoisonBubble_Step(struct Sprite *sprite)
2018-11-26 16:13:45 +01:00
{
2019-02-06 20:17:09 +01:00
if (TranslateAnimHorizontalArc(sprite))
2018-11-26 16:13:45 +01:00
DestroyAnimSprite(sprite);
}
2020-02-29 13:59:41 +01:00
void AnimSludgeBombHitParticle(struct Sprite *sprite)
2018-11-26 16:13:45 +01:00
{
sprite->data[0] = gBattleAnimArgs[2];
2021-07-07 15:11:52 +02:00
sprite->data[1] = sprite->x;
sprite->data[2] = sprite->x + gBattleAnimArgs[0];
sprite->data[3] = sprite->y;
sprite->data[4] = sprite->y + gBattleAnimArgs[1];
2018-11-26 16:13:45 +01:00
InitSpriteDataForLinearTranslation(sprite);
sprite->data[5] = sprite->data[1] / gBattleAnimArgs[2];
sprite->data[6] = sprite->data[2] / gBattleAnimArgs[2];
2020-02-20 22:22:33 +01:00
sprite->callback = AnimSludgeBombHitParticle_Step;
2018-11-26 16:13:45 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimSludgeBombHitParticle_Step(struct Sprite *sprite)
2018-11-26 16:13:45 +01:00
{
2019-02-06 20:17:09 +01:00
TranslateSpriteLinearFixedPoint(sprite);
2018-11-26 16:13:45 +01:00
sprite->data[1] -= sprite->data[5];
sprite->data[2] -= sprite->data[6];
if (!sprite->data[0])
DestroyAnimSprite(sprite);
}
2020-02-20 02:22:53 +01:00
static void AnimAcidPoisonDroplet(struct Sprite *sprite)
2018-11-26 16:13:45 +01:00
{
if (gBattleAnimArgs[5])
SetAverageBattlerPositions(gBattleAnimTarget, TRUE, &sprite->x, &sprite->y);
2018-11-26 16:13:45 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-11-26 16:13:45 +01:00
sprite->data[0] = gBattleAnimArgs[4];
2021-07-07 15:11:52 +02:00
sprite->data[2] = sprite->x + gBattleAnimArgs[2];
sprite->data[4] = sprite->y + sprite->data[0];
2018-11-26 16:13:45 +01:00
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
// Animates a bubble by rising upward, swaying side to side, and
// enlarging the sprite. This is used as an after-effect by poison-type
// moves, along with MOVE_BUBBLE, and MOVE_BUBBLEBEAM.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: 0 = single-target, 1 = multi-target
2020-11-29 15:22:31 +01:00
void AnimBubbleEffect(struct Sprite *sprite)
2018-11-26 16:13:45 +01:00
{
if (!gBattleAnimArgs[2])
{
2018-12-20 04:13:26 +01:00
InitSpritePosToAnimTarget(sprite, TRUE);
2018-11-26 16:13:45 +01:00
}
else
{
2021-07-07 15:11:52 +02:00
SetAverageBattlerPositions(gBattleAnimTarget, TRUE, &sprite->x, &sprite->y);
2018-11-26 16:13:45 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
2021-07-07 15:11:52 +02:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-11-26 16:13:45 +01:00
}
2020-02-20 22:22:33 +01:00
sprite->callback = AnimBubbleEffect_Step;
2018-11-26 16:13:45 +01:00
}
2020-02-20 22:22:33 +01:00
static void AnimBubbleEffect_Step(struct Sprite *sprite)
2018-11-26 16:13:45 +01:00
{
sprite->data[0] = (sprite->data[0] + 0xB) & 0xFF;
2021-07-07 15:11:52 +02:00
sprite->x2 = Sin(sprite->data[0], 4);
2018-11-26 16:13:45 +01:00
sprite->data[1] += 0x30;
2021-07-07 15:11:52 +02:00
sprite->y2 = -(sprite->data[1] >> 8);
2018-11-26 16:13:45 +01:00
if (sprite->affineAnimEnded)
DestroyAnimSprite(sprite);
}