Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heart Swap Move Animation #5460

Merged
merged 18 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions data/battle_anim_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,44 @@ gBattleAnimMove_ToxicSpikes::
end

gBattleAnimMove_HeartSwap::
loadspritegfx ANIM_TAG_RED_HEART
loadspritegfx ANIM_TAG_PINKVIO_ORB
loadspritegfx ANIM_TAG_SPARKLE_2
createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 0, 8, RGB(31, 24, 26)
createvisualtask AnimTask_HeartSwap, 3, ANIM_TARGET
createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_TARGET, RGB_WHITE, 12, 3, 1
loopsewithpan SE_M_TAIL_WHIP, SOUND_PAN_ATTACKER, 10, 8
delay 16
createvisualtask AnimTask_HeartSwap, 3, ANIM_ATTACKER
createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_ATTACKER, RGB_WHITE, 12, 3, 1
waitforvisualfinish
createsprite gGrantingStarsSpriteTemplate, ANIM_ATTACKER, 2, -15, 0, 0, 0, 32, 60
createsprite gGrantingStarsSpriteTemplate, ANIM_TARGET, 2, -15, 0, 0, 0, 32, 60
delay 8
createsprite gGrantingStarsSpriteTemplate, ANIM_ATTACKER, 2, 12, -5, 0, 0, 32, 60
createsprite gGrantingStarsSpriteTemplate, ANIM_TARGET, 2, 12, -5, 0, 0, 32, 60
delay 4
playsewithpan SE_SHINY, SOUND_PAN_ATTACKER
createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_ATTACKER, RGB(31, 25, 27), 12, 3, 1
createvisualtask AnimTask_ScaleMonAndRestore, 5, -3, -3, 16, ANIM_ATTACKER, 0
createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_TARGET, RGB(31, 25, 27), 12, 3, 1
createvisualtask AnimTask_ScaleMonAndRestore, 5, -3, -3, 16, ANIM_TARGET, 0
createsprite gRedHeartBurstSpriteTemplate, ANIM_TARGET, 3, 160, -32
createsprite gRedHeartBurstSpriteTemplate, ANIM_TARGET, 3, -256, -40
createsprite gRedHeartBurstSpriteTemplate, ANIM_TARGET, 3, 128, -16
createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 8, 0, RGB(31, 24, 26)
createsprite gRedHeartCharmSpriteTemplate, ANIM_ATTACKER, 3, 0, 20
playsewithpan SE_M_MORNING_SUN, SOUND_PAN_ATTACKER
delay 15
createsprite gRedHeartCharmSpriteTemplate, ANIM_ATTACKER, 3, -20, 20
playsewithpan SE_M_CHARM, SOUND_PAN_ATTACKER
delay 15
createsprite gRedHeartCharmSpriteTemplate, ANIM_ATTACKER, 3, 20, 20
playsewithpan SE_M_CHARM, SOUND_PAN_ATTACKER
waitforvisualfinish
clearmonbg ANIM_ATTACKER
clearmonbg ANIM_TARGET
blendoff
end

gBattleAnimMove_AquaRing::
Expand Down
Binary file added graphics/battle_anims/sprites/pinkvio_orb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions include/constants/battle_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@
#define ANIM_TAG_BEAM (ANIM_SPRITES_START + 402)
#define ANIM_TAG_RED_EXPLOSION (ANIM_SPRITES_START + 403)
#define ANIM_TAG_PURPLE_CHAIN (ANIM_SPRITES_START + 404)
#define ANIM_TAG_PINKVIO_ORB (ANIM_SPRITES_START + 405)

// battlers
#define ANIM_ATTACKER 0
Expand Down
2 changes: 2 additions & 0 deletions include/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -2887,6 +2887,8 @@ extern const u32 gBattleAnimSpritePal_IvyCudgelGrass[];
extern const u32 gBattleAnimSpritePal_IvyCudgelFire[];
extern const u32 gBattleAnimSpritePal_IvyCudgelRock[];
extern const u32 gBattleAnimSpritePal_IvyCudgelWater[];
extern const u32 gBattleAnimSpriteGfx_PinkVioletOrb[];
extern const u32 gBattleAnimSpritePal_PinkVioletOrb[];

extern const u32 gBattleAnimBgImage_Dark[];
extern const u32 gBattleAnimBgImage_Ghost[];
Expand Down
12 changes: 12 additions & 0 deletions src/battle_anim_effects_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,18 @@ const struct SpriteTemplate gRedHeartRisingSpriteTemplate =
.callback = AnimRedHeartRising,
};

// New struct that's just a copy of 'gMagentaHeartSpriteTemplate', without need to make new anim tags
const struct SpriteTemplate gRedHeartCharmSpriteTemplate =
{
.tileTag = ANIM_TAG_RED_HEART,
.paletteTag = ANIM_TAG_RED_HEART,
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimMagentaHeart,
};

const union AffineAnimCmd gHiddenPowerOrbAffineAnimCmds[] =
{
AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0),
Expand Down
100 changes: 99 additions & 1 deletion src/battle_anim_psychic.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static void AnimTask_MeditateStretchAttacker_Step(u8);
static void AnimTask_Teleport_Step(u8);
static void AnimTask_ImprisonOrbs_Step(u8);
static void AnimTask_SkillSwap_Step(u8);
static void AnimTask_HeartSwap_Step(u8);
static void AnimTask_ExtrasensoryDistortion_Step(u8);
static void AnimTask_TransparentCloneGrowAndShrink_Step(u8);
static void AnimateZenHeadbutt(struct Sprite *sprite);
Expand Down Expand Up @@ -359,6 +360,18 @@ const struct SpriteTemplate gSkillSwapOrbSpriteTemplate =
.callback = AnimSkillSwapOrb,
};

// Pink version of the Skill Swap orbs
const struct SpriteTemplate gHeartSwapOrbSpriteTemplate =
{
.tileTag = ANIM_TAG_PINKVIO_ORB,
.paletteTag = ANIM_TAG_PINKVIO_ORB,
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = sAffineAnims_SkillSwapOrb,
.callback = AnimSkillSwapOrb,
};

static const union AffineAnimCmd sAffineAnim_LusterPurgeCircle[] =
{
AFFINEANIMCMD_FRAME(0x20, 0x20, 0, 0),
Expand Down Expand Up @@ -1001,7 +1014,7 @@ void AnimTask_SkillSwap(u8 taskId)
}
else
{
if (gBattleAnimArgs[0] == 1)
if (gBattleAnimArgs[0] == ANIM_TARGET)
{
task->data[10] = -10;
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_LEFT) + 8;
Expand All @@ -1023,6 +1036,55 @@ void AnimTask_SkillSwap(u8 taskId)
task->func = AnimTask_SkillSwap_Step;
}

hedara90 marked this conversation as resolved.
Show resolved Hide resolved
// Copy of Skill Swap's function to get position of the user and target
// arg 0: move target
void AnimTask_HeartSwap(u8 taskId)
{
struct Task *task = &gTasks[taskId];

if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_TARGET)
{
task->data[10] = -10;
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_RIGHT) - 8;
task->data[12] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_TOP) + 8;
task->data[13] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_RIGHT) - 8;
task->data[14] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP) + 8;
}
else
{
task->data[10] = 10;
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_LEFT) + 8;
task->data[12] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_BOTTOM) - 8;
task->data[13] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_LEFT) + 8;
task->data[14] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_BOTTOM) - 8;
}
}
else
{
if (gBattleAnimArgs[0] == ANIM_TARGET)
{
task->data[10] = -10;
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_LEFT) + 8;
task->data[12] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_TOP) + 8;
task->data[13] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_LEFT) + 8;
task->data[14] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP) + 8;
}
else
{
task->data[10] = 10;
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_RIGHT) - 8;
task->data[12] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_BOTTOM) - 8;
task->data[13] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_RIGHT) - 8;
task->data[14] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_BOTTOM) - 8;
}
}

task->data[1] = 6;
task->func = AnimTask_HeartSwap_Step;
}

static void AnimTask_SkillSwap_Step(u8 taskId)
{
u8 spriteId;
Expand Down Expand Up @@ -1057,6 +1119,42 @@ static void AnimTask_SkillSwap_Step(u8 taskId)
}
}

// Copy of Skill Swap's function to vault the series of orbs between the user and target
// CreateSprite modified so it uses the pink orbs instead of the blue/green ones
static void AnimTask_HeartSwap_Step(u8 taskId)
{
u8 spriteId;
struct Task *task = &gTasks[taskId];

switch (task->data[0])
{
case 0:
if (++task->data[1] > 6)
{
task->data[1] = 0;
spriteId = CreateSprite(&gHeartSwapOrbSpriteTemplate, task->data[11], task->data[12], 0);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[0] = 16;
gSprites[spriteId].data[2] = task->data[13];
gSprites[spriteId].data[4] = task->data[14];
gSprites[spriteId].data[5] = task->data[10];

InitAnimArcTranslation(&gSprites[spriteId]);
StartSpriteAffineAnim(&gSprites[spriteId], task->data[2] & 3);
}

if (++task->data[2] == 12)
task->data[0]++;
}
break;
case 1:
if (++task->data[1] > 17)
DestroyAnimVisualTask(taskId);
break;
}
}

static void AnimSkillSwapOrb(struct Sprite *sprite)
{
if (TranslateAnimHorizontalArc(sprite))
Expand Down
2 changes: 2 additions & 0 deletions src/data/battle_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_RedExplosion, 0x0800, ANIM_TAG_RED_EXPLOSION},
{gBattleAnimSpriteGfx_Beam, 0x0800, ANIM_TAG_BEAM},
{gBattleAnimSpriteGfx_PurpleChain, 0x1000, ANIM_TAG_PURPLE_CHAIN},
{gBattleAnimSpriteGfx_PinkVioletOrb, 0x0080, ANIM_TAG_PINKVIO_ORB},
};

const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
Expand Down Expand Up @@ -1931,6 +1932,7 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_RedExplosion, ANIM_TAG_RED_EXPLOSION},
{gBattleAnimSpritePal_Beam, ANIM_TAG_BEAM},
{gBattleAnimSpritePal_PurpleChain, ANIM_TAG_PURPLE_CHAIN},
{gBattleAnimSpritePal_PinkVioletOrb, ANIM_TAG_PINKVIO_ORB},
};

const struct BattleAnimBackground gBattleAnimBackgroundTable[] =
Expand Down
3 changes: 3 additions & 0 deletions src/graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,9 @@ const u32 gBattleAnimSpriteGfx_XSign[] = INCBIN_U32("graphics/battle_anims/sprit
const u32 gBattleAnimSpriteGfx_BluegreenOrb[] = INCBIN_U32("graphics/battle_anims/sprites/bluegreen_orb.4bpp.lz");
const u32 gBattleAnimSpritePal_BluegreenOrb[] = INCBIN_U32("graphics/battle_anims/sprites/bluegreen_orb.gbapal.lz");

const u32 gBattleAnimSpriteGfx_PinkVioletOrb[] = INCBIN_U32("graphics/battle_anims/sprites/pinkvio_orb.4bpp.lz");
const u32 gBattleAnimSpritePal_PinkVioletOrb[] = INCBIN_U32("graphics/battle_anims/sprites/pinkvio_orb.gbapal.lz");

const u32 gBattleAnimSpriteGfx_PawPrint[] = INCBIN_U32("graphics/battle_anims/sprites/paw_print.4bpp.lz");
const u32 gBattleAnimSpritePal_PawPrint[] = INCBIN_U32("graphics/battle_anims/sprites/paw_print.gbapal.lz");

Expand Down
Loading