diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index eca8d65f93..0d05554f2a 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1336,9 +1336,87 @@ Move_COPYCAT: end Move_POWER_SWAP: + loadspritegfx ANIM_TAG_COLORED_ORBS + playsewithpan SE_W104, 0 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 0, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 0, 42, -32 + delay 2 + playsewithpan SE_W104, 0 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 0, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 1, 42, 32 + + waitforvisualfinish + playsewithpan SE_W104, 0 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 0, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 0, 42, -32 + delay 2 + playsewithpan SE_W104, 0 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 0, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 1, 42, 32 + delay 2 + waitforvisualfinish end Move_GUARD_SWAP: + loadspritegfx ANIM_TAG_COLORED_ORBS + playsewithpan SE_W104, 0 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 2, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 0, 42, -32 + delay 2 + playsewithpan SE_W104, 0 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 2, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 1, 42, 32 + + waitforvisualfinish + playsewithpan SE_W104, 0 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 2, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 0, 42, -32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 0, 42, -32 + delay 2 + playsewithpan SE_W104, 0 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 2, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 1, 42, 32 + delay 2 + createsprite gPowerSwapGuardSwapSpriteTemplate, ANIM_TARGET, 3, 0, 0, 3, 1, 42, 32 + delay 2 + waitforvisualfinish end Move_PUNISHMENT: @@ -1348,6 +1426,17 @@ Move_LAST_RESORT: end Move_WORRY_SEED: + loadspritegfx ANIM_TAG_WORRY_SEED + loadspritegfx ANIM_TAG_SMALL_CLOUD + playsewithpan SE_W077, SOUND_PAN_ATTACKER + createsprite gWorrySeedSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 32, -32 + waitforvisualfinish + playsewithpan SE_W028, SOUND_PAN_TARGET + createsprite gSmallCloudTemplate, ANIM_ATTACKER, 3, -2, -1, 0, -1, -1 + createsprite gSmallCloudTemplate, ANIM_ATTACKER, 3, 3, 1, 1, 2, -1 + createsprite gSmallCloudTemplate, ANIM_ATTACKER, 3, -2, 1, 2, 1, -2 + createsprite gSmallCloudTemplate, ANIM_ATTACKER, 3, 3, -2, 1, -1, -2 + waitforvisualfinish end Move_SUCKER_PUNCH: diff --git a/graphics/battle_anims/sprites/colored_orbs.png b/graphics/battle_anims/sprites/colored_orbs.png new file mode 100644 index 0000000000..3bd3a55dd3 Binary files /dev/null and b/graphics/battle_anims/sprites/colored_orbs.png differ diff --git a/graphics/battle_anims/sprites/small_cloud.png b/graphics/battle_anims/sprites/small_cloud.png new file mode 100644 index 0000000000..2733a71dca Binary files /dev/null and b/graphics/battle_anims/sprites/small_cloud.png differ diff --git a/graphics/battle_anims/sprites/worry_seed.png b/graphics/battle_anims/sprites/worry_seed.png new file mode 100644 index 0000000000..2f6d68b294 Binary files /dev/null and b/graphics/battle_anims/sprites/worry_seed.png differ diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index 48b921bd06..cf0fa16f7d 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -309,6 +309,9 @@ #define ANIM_TAG_TRUMP_CARD_PARTICLES (ANIM_SPRITES_START + 299) #define ANIM_TAG_ACCUPRESSURE (ANIM_SPRITES_START + 300) #define ANIM_TAG_WRING_OUT (ANIM_SPRITES_START + 301) +#define ANIM_TAG_COLORED_ORBS (ANIM_SPRITES_START + 302) +#define ANIM_TAG_WORRY_SEED (ANIM_SPRITES_START + 303) +#define ANIM_TAG_SMALL_CLOUD (ANIM_SPRITES_START + 304) // battlers #define ANIM_ATTACKER 0 diff --git a/include/graphics.h b/include/graphics.h index ab012b3475..ad8eaf3762 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4415,6 +4415,9 @@ extern const u32 gBattleAnimSpriteGfx_TrumpCard[]; extern const u32 gBattleAnimSpriteGfx_TrumpCardParticles[]; extern const u32 gBattleAnimSpriteGfx_Accupressure[]; extern const u32 gBattleAnimSpriteGfx_WringOut[]; +extern const u32 gBattleAnimSpriteGfx_ColoredOrbs[]; +extern const u32 gBattleAnimSpriteGfx_WorrySeed[]; +extern const u32 gBattleAnimSpriteGfx_SmallCloud[]; extern const u32 gBattleAnimSpritePal_Bone[]; extern const u32 gBattleAnimSpritePal_Spark[]; @@ -4704,6 +4707,9 @@ extern const u32 gBattleAnimSpritePal_TrumpCard[]; extern const u32 gBattleAnimSpritePal_TrumpCardParticles[]; extern const u32 gBattleAnimSpritePal_Accupressure[]; extern const u32 gBattleAnimSpritePal_WringOut[]; +extern const u32 gBattleAnimSpritePal_ColoredOrbs[]; +extern const u32 gBattleAnimSpritePal_WorrySeed[]; +extern const u32 gBattleAnimSpritePal_SmallCloud[]; extern const u32 gBattleAnimBgImage_Dark[]; extern const u32 gBattleAnimBgImage_Ghost[]; diff --git a/src/battle_anim.c b/src/battle_anim.c index bfbe10520a..0d4f4bf799 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1427,6 +1427,9 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_TrumpCardParticles, 0x0060, ANIM_TAG_TRUMP_CARD_PARTICLES}, {gBattleAnimSpriteGfx_Accupressure, 0x0200, ANIM_TAG_ACCUPRESSURE}, {gBattleAnimSpriteGfx_WringOut, 0x0200, ANIM_TAG_WRING_OUT}, + {gBattleAnimSpriteGfx_ColoredOrbs, 0x0300, ANIM_TAG_COLORED_ORBS}, + {gBattleAnimSpriteGfx_WorrySeed, 0x0080, ANIM_TAG_WORRY_SEED}, + {gBattleAnimSpriteGfx_SmallCloud, 0x0080, ANIM_TAG_SMALL_CLOUD}, }; const struct CompressedSpritePalette gBattleAnimPaletteTable[] = @@ -1732,7 +1735,10 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_TrumpCard, ANIM_TAG_TRUMP_CARD}, {gBattleAnimSpritePal_TrumpCardParticles, ANIM_TAG_TRUMP_CARD_PARTICLES}, {gBattleAnimSpritePal_Accupressure, ANIM_TAG_ACCUPRESSURE}, - {gBattleAnimSpritePal_WringOut, ANIM_TAG_WRING_OUT} + {gBattleAnimSpritePal_WringOut, ANIM_TAG_WRING_OUT}, + {gBattleAnimSpritePal_ColoredOrbs, ANIM_TAG_COLORED_ORBS}, + {gBattleAnimSpritePal_WorrySeed, ANIM_TAG_WORRY_SEED}, + {gBattleAnimSpritePal_SmallCloud, ANIM_TAG_SMALL_CLOUD}, }; const struct BattleAnimBackground gBattleAnimBackgroundTable[] = diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 537230d196..94ec21a801 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -160,6 +160,8 @@ static void AnimMoveTrumpCard(struct Sprite *); static void AnimMoveTrumpCardParticle(struct Sprite* sprite); static void AnimMoveAccupressure(struct Sprite* sprite); static void AnimMoveWringOut(struct Sprite* sprite); +static void AnimMoveWorrySeed(struct Sprite* sprite); +static void AnimMoveSmallCloud(struct Sprite* sprite); const union AnimCmd gUnknown_085920F0[] = { @@ -300,6 +302,64 @@ static const union AffineAnimCmd * const sAccupressureAffineAnims[] = sAccupressureTurn }; +static const union AffineAnimCmd sSmallCloundsInit[] = +{ + AFFINEANIMCMD_FRAME(0x100,0x100, 0, 0), + AFFINEANIMCMD_END, +}; + +static const union AffineAnimCmd sSmallCloudsVariant0[] = +{ + AFFINEANIMCMD_FRAME(0x100,0x100, 0, 0), + AFFINEANIMCMD_FRAME(-10, -10, 0, 15), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSmallCloudsVariant1[] = +{ + AFFINEANIMCMD_FRAME(0x180,0x180, 0, 0), + AFFINEANIMCMD_FRAME(-18, -18, 0, 21), + AFFINEANIMCMD_END +}; + + +static const union AffineAnimCmd sSmallCloudsVariant2[] = +{ + AFFINEANIMCMD_FRAME(0xC0, 0xC0, 0, 0), + AFFINEANIMCMD_FRAME(-6, -6, 0, 15), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd * const sSmallCloudSpriteAffineAnimTable[] = +{ + sSmallCloundsInit, + sSmallCloudsVariant0, + sSmallCloudsVariant1, + sSmallCloudsVariant2, +}; + +const struct SpriteTemplate gWorrySeedSpriteTemplate = +{ + .tileTag = ANIM_TAG_WORRY_SEED, + .paletteTag = ANIM_TAG_WORRY_SEED, + .oam = &gUnknown_0852490C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimMoveWorrySeed +}; + +const struct SpriteTemplate gSmallCloudTemplate = +{ + .tileTag = ANIM_TAG_SMALL_CLOUD, + .paletteTag = ANIM_TAG_SMALL_CLOUD, + .oam = &gUnknown_0852496C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSmallCloudSpriteAffineAnimTable, + .callback = AnimMoveSmallCloud +}; + const struct SpriteTemplate gAccupressureSpriteTemplate = { .tileTag = ANIM_TAG_ACCUPRESSURE, @@ -2841,6 +2901,56 @@ static void AnimHyperBeamOrbStep(struct Sprite* sprite) } } +static void AnimMoveWorrySeedWait(struct Sprite* sprite) +{ + if (TranslateAnimHorizontalArc(sprite)) + DestroyAnimSprite(sprite); +} + +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: wave period +// arg 3: wave amplitude +static void AnimMoveWorrySeed(struct Sprite* sprite) +{ + InitSpritePosToAnimAttacker(sprite, TRUE); + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y); + + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[5] = gBattleAnimArgs[3]; + InitAnimArcTranslation(sprite); + sprite->callback = AnimMoveWorrySeedWait; +} + +static void AnimMoveSmallCloudAnimate(struct Sprite* sprite) +{ + sprite->pos2.x += sprite->data[0]; + sprite->pos2.y += sprite->data[1]; + + if(sprite->affineAnimEnded) + { + DestroyAnimSprite(sprite); + } + +} +#define ONE_IF_ZERO(x) ((x) > 0 ? (x) : 1) + +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: cloud type animation [0..2] +// arg 3: horizontal velocity +// arg 4: vertical velocity +// arg 5: duration +static void AnimMoveSmallCloud(struct Sprite* sprite) +{ + InitSpritePosToAnimTarget(sprite, TRUE); + sprite->data[0] = gBattleAnimArgs[3]; + sprite->data[1] = gBattleAnimArgs[4]; + sprite->callback = AnimMoveSmallCloudAnimate; + StartSpriteAffineAnim(sprite, gBattleAnimArgs[2]+1); +} + static void AnimPluckParticle(struct Sprite* sprite) { if(sprite->data[0] > 0) diff --git a/src/graphics.c b/src/graphics.c index 6419ab66f6..7fd71cf731 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -166,6 +166,15 @@ const u32 gBattleAnimSpriteGfx_Lightning2[] = INCBIN_U32("graphics/battle_anims/ const u32 gBattleAnimSpriteGfx_Lightning[] = INCBIN_U32("graphics/battle_anims/sprites/lightning.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_ColoredOrbs[] = INCBIN_U32("graphics/battle_anims/sprites/colored_orbs.4bpp.lz"); +const u32 gBattleAnimSpritePal_ColoredOrbs[] = INCBIN_U32("graphics/battle_anims/sprites/colored_orbs.gbapal.lz"); + +const u32 gBattleAnimSpriteGfx_WorrySeed[] = INCBIN_U32("graphics/battle_anims/sprites/worry_seed.4bpp.lz"); +const u32 gBattleAnimSpritePal_WorrySeed[] = INCBIN_U32("graphics/battle_anims/sprites/worry_seed.gbapal.lz"); + +const u32 gBattleAnimSpriteGfx_SmallCloud[] = INCBIN_U32("graphics/battle_anims/sprites/small_cloud.4bpp.lz"); +const u32 gBattleAnimSpritePal_SmallCloud[] = INCBIN_U32("graphics/battle_anims/sprites/small_cloud.gbapal.lz"); + const u32 gUnknownGfx_C06D98[] = INCBIN_U32("graphics/unknown/unknown_C06D98.4bpp.lz"); const u32 gUnknownPal_C06D98[] = INCBIN_U32("graphics/unknown/unknown_C06D98.gbapal.lz"); const u32 gUnknownPal_C06D98_2[] = INCBIN_U32("graphics/unknown/unknown_C06D98_2.gbapal.lz"); diff --git a/src/normal.c b/src/normal.c index 2b592e1998..293d1931ce 100644 --- a/src/normal.c +++ b/src/normal.c @@ -35,6 +35,7 @@ static void sub_81161F4(void); static void sub_81162F8(u8); static void sub_81163D0(struct Sprite *); static void sub_81165E4(struct Sprite *); +static void AnimMovePowerSwapGuardSwap(struct Sprite *); const union AnimCmd gUnknown_0859722C[] = { @@ -93,6 +94,63 @@ const struct SpriteTemplate gComplexPaletteBlendSpriteTemplate = .callback = sub_81158A4, }; +static const union AnimCmd sPowerSwapGuardSwapFrame0[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd sPowerSwapGuardSwapFrame1[] = +{ + ANIMCMD_FRAME(4, 0), + ANIMCMD_END +}; + +static const union AnimCmd sPowerSwapGuardSwapFrame2[] = +{ + ANIMCMD_FRAME(8, 0), + ANIMCMD_END +}; + +static const union AnimCmd sPowerSwapGuardSwapFrame3[] = +{ + ANIMCMD_FRAME(12, 0), + ANIMCMD_END +}; + +static const union AnimCmd sPowerSwapGuardSwapFrame4[] = +{ + ANIMCMD_FRAME(16, 0), + ANIMCMD_END +}; + +static const union AnimCmd sPowerSwapGuardSwapFrame5[] = +{ + ANIMCMD_FRAME(20, 0), + ANIMCMD_END +}; + +static const union AnimCmd * const sPowerSwapGuardSwapAnimTable[] = +{ + sPowerSwapGuardSwapFrame0, + sPowerSwapGuardSwapFrame1, + sPowerSwapGuardSwapFrame2, + sPowerSwapGuardSwapFrame3, + sPowerSwapGuardSwapFrame4, + sPowerSwapGuardSwapFrame5 +}; + +const struct SpriteTemplate gPowerSwapGuardSwapSpriteTemplate = +{ + .tileTag = ANIM_TAG_COLORED_ORBS, + .paletteTag = ANIM_TAG_COLORED_ORBS, + .oam = &gUnknown_0852490C, + .anims = sPowerSwapGuardSwapAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimMovePowerSwapGuardSwap +}; + const union AnimCmd gUnknown_085972A4[] = { ANIMCMD_FRAME(0, 3), @@ -253,6 +311,39 @@ const struct SpriteTemplate gUnknown_08597400 = .callback = sub_81163D0, }; +static void AnimMovePowerSwapGuardSwapWait(struct Sprite* sprite) +{ + if (TranslateAnimHorizontalArc(sprite)) + DestroyAnimSprite(sprite); +} + +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: orb type (0..5) - color and size +// arg 3: from user to target / target to user +// arg 4: wave period +// arg 5: wave amplitude +static void AnimMovePowerSwapGuardSwap(struct Sprite* sprite) +{ + StartSpriteAnim(sprite, gBattleAnimArgs[2]); + if(gBattleAnimArgs[3] == 0) + { + InitSpritePosToAnimAttacker(sprite, TRUE); + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y); + } + else + { + InitSpritePosToAnimTarget(sprite, TRUE); + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y); + } + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[5] = gBattleAnimArgs[5]; + InitAnimArcTranslation(sprite); + sprite->callback = AnimMovePowerSwapGuardSwapWait; +} + // Moves a spinning duck around the mon's head. // arg 0: initial x pixel offset // arg 1: initial y pixel offset