From 5f7b5ba453a8f5313aba9116866136ca2e091f48 Mon Sep 17 00:00:00 2001 From: Karathan Date: Tue, 2 Jul 2019 06:22:05 +0200 Subject: [PATCH] add feint and pluck animation sprites and implementations --- data/battle_anim_scripts.s | 36 ++++- graphics/battle_anims/sprites/feint-punch.png | Bin 0 -> 236 bytes graphics/battle_anims/sprites/seed-new.png | Bin 0 -> 238 bytes include/constants/battle_anim.h | 8 +- include/graphics.h | 4 + src/battle_anim.c | 4 + src/battle_anim_effects_1.c | 141 ++++++++++++++++++ src/graphics.c | 5 + 8 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 graphics/battle_anims/sprites/feint-punch.png create mode 100644 graphics/battle_anims/sprites/seed-new.png diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index d83802964..e093b6d69 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -134,7 +134,7 @@ gBattleAnims_Moves:: .4byte Move_FOCUS_ENERGY .4byte Move_BIDE .4byte Move_METRONOME - .4byte Move_MIRROR_MOVE @ doesn´t have an actual animation + .4byte Move_MIRROR_MOVE @ doesn�t have an actual animation .4byte Move_SELF_DESTRUCT .4byte Move_EGG_BOMB .4byte Move_LICK @@ -894,9 +894,43 @@ Move_NATURAL_GIFT: end Move_FEINT: + loadspritegfx ANIM_TAG_FEINT + createsprite gFeintSwipeSpriteTemplate, ANIM_ATTACKER, 10, -32, 0, 15 + playsewithpan SE_W013B, SOUND_PAN_ATTACKER + delay 15 + playsewithpan SE_W013B, SOUND_PAN_ATTACKER + delay 15 + waitforvisualfinish + delay 5 + createsprite gFeintZoomSpriteTemplate, ANIM_ATTACKER, 10, 0, 0 + playsewithpan SE_W025B, SOUND_PAN_TARGET + waitforvisualfinish end Move_PLUCK: + loadspritegfx ANIM_TAG_SEED_BROWN + loadspritegfx ANIM_TAG_IMPACT + playsewithpan SE_W077, SOUND_PAN_ATTACKER + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, -10, -5, 1, 2 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, 3, 0, 30, 2, 1 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, 7, 1, 20, 1, 1 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, -3, 5, 40, 2, -1 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, 4, -4, 50, 3, -1 + delay 30 + playsewithpan SE_W077, SOUND_PAN_ATTACKER + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 5, 10, 1, 2 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, 3, -4, 30, 1, 1 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, 7, -6, 20, 0, 1 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, -3, -9, 40, 1, -1 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, 4, -4, 50, 2, -1 + delay 30 + playsewithpan SE_W077, SOUND_PAN_ATTACKER + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 1, 2 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, -3, -4, 30, 1, 1 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, 7, -6, 50, 0, 1 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, -4, -10, 40, 1, 1 + createsprite gPluckParticleSpriteTemplate, ANIM_ATTACKER, 2, 4, -4, 40, 1, 2 + waitforvisualfinish end Move_TAILWIND: diff --git a/graphics/battle_anims/sprites/feint-punch.png b/graphics/battle_anims/sprites/feint-punch.png new file mode 100644 index 0000000000000000000000000000000000000000..5769415193f8436787b8da3cefbd02d0e6fc6b03 GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|e{s5m4*VGbSATu*7tEH~}|Ns9Y zKa8IP`HUq&e!&b5&u*lFI7!~_E({&4vK~MVXMsm#F#`j)FbFd;%$g$s6l5>)^mS!_ z%+AEZ%qo$5qa7#|=IP=X;&D7VL4tKLgLHz33mcP3pu&Dzq(#-`_>Hw>%niic3>7^s)dDPJgX}e8JPdLI^a~>NJ2M^Um$__g@nLa#J_%%M zNswPK!+%t8AfVeBC>P-A;us<^b?$jC8leBs_&k|nkLtDf%Qg#{U&X}1g{52vlZOvjkpBa5>2P*!CR5LOhVtn6T Sb4(a$HiM_DpUXO@geCw0HB>_Y literal 0 HcmV?d00001 diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index add0fbbae..921677d3e 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -300,9 +300,11 @@ #define ANIM_TAG_PURPLE_JAB (ANIM_SPRITES_START + 290) #define ANIM_TAG_TOXIC_SPIKES (ANIM_SPRITES_START + 291) #define ANIM_TAG_ENERGY_BALL (ANIM_SPRITES_START + 292) -#define ANIM_TAG_MEGA_STONE (ANIM_SPRITES_START + 293) -#define ANIM_TAG_MEGA_SYMBOL (ANIM_SPRITES_START + 294) -#define ANIM_TAG_MEGA_PARTICLES (ANIM_SPRITES_START + 295) +#define ANIM_TAG_SEED_BROWN (ANIM_SPRITES_START + 293) +#define ANIM_TAG_FEINT (ANIM_SPRITES_START + 294) +#define ANIM_TAG_MEGA_STONE (ANIM_SPRITES_START + 295) +#define ANIM_TAG_MEGA_SYMBOL (ANIM_SPRITES_START + 296) +#define ANIM_TAG_MEGA_PARTICLES (ANIM_SPRITES_START + 297) // battlers #define ANIM_ATTACKER 0 diff --git a/include/graphics.h b/include/graphics.h index 20963d425..a6772fc72 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4137,6 +4137,8 @@ extern const u32 gBattleAnimSpriteGfx_AirWave[]; extern const u32 gBattleAnimSpriteGfx_Orb[]; extern const u32 gBattleAnimSpriteGfx_Sword[]; extern const u32 gBattleAnimSpriteGfx_Seed[]; +extern const u32 gBattleAnimSpriteGfx_SeedBrown[]; +extern const u32 gBattleAnimSpriteGfx_Feint[]; extern const u32 gBattleAnimSpriteGfx_Explosion6[]; extern const u32 gBattleAnimSpriteGfx_PinkOrb[]; extern const u32 gBattleAnimSpriteGfx_Gust[]; @@ -4417,6 +4419,8 @@ extern const u32 gBattleAnimSpritePal_AirWave[]; extern const u32 gBattleAnimSpritePal_Orb[]; extern const u32 gBattleAnimSpritePal_Sword[]; extern const u32 gBattleAnimSpritePal_Seed[]; +extern const u32 gBattleAnimSpritePal_SeedBrown[]; +extern const u32 gBattleAnimSpritePal_Feint[]; extern const u32 gBattleAnimSpritePal_Explosion6[]; extern const u32 gBattleAnimSpritePal_PinkOrb[]; extern const u32 gBattleAnimSpritePal_Gust[]; diff --git a/src/battle_anim.c b/src/battle_anim.c index 7442a04cf..fd65e40cb 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1418,6 +1418,8 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_PurpleJab, 0x0100, ANIM_TAG_PURPLE_JAB}, {gBattleAnimSpriteGfx_Spikes, 0x0080, ANIM_TAG_TOXIC_SPIKES}, {gBattleAnimSpriteGfx_EnergyBall, 0x0200, ANIM_TAG_ENERGY_BALL}, + {gBattleAnimSpriteGfx_SeedBrown, 0x0080, ANIM_TAG_SEED_BROWN}, + {gBattleAnimSpriteGfx_Feint, 0x0800, ANIM_TAG_FEINT}, {gBattleAnimSpriteGfx_MegaStone, 0x800, ANIM_TAG_MEGA_STONE}, {gBattleAnimSpriteGfx_MegaSymbol, 0x0200, ANIM_TAG_MEGA_SYMBOL}, {gBattleAnimSpriteGfx_MegaParticles, 0x0180, ANIM_TAG_MEGA_PARTICLES}, @@ -1718,6 +1720,8 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_PurpleJab, ANIM_TAG_PURPLE_JAB}, {gBattleAnimSpritePal_ToxicSpikes, ANIM_TAG_TOXIC_SPIKES}, {gBattleAnimSpritePal_EnergyBall, ANIM_TAG_ENERGY_BALL}, + {gBattleAnimSpritePal_SeedBrown, ANIM_TAG_SEED_BROWN}, + {gBattleAnimSpritePal_Feint, ANIM_TAG_FEINT}, {gBattleAnimSpritePal_MegaStone, ANIM_TAG_MEGA_STONE}, {gBattleAnimSpritePal_MegaSymbol, ANIM_TAG_MEGA_SYMBOL}, {gBattleAnimSpritePal_MegaParticles, ANIM_TAG_MEGA_PARTICLES}, diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 600b59b8b..cfcdca6d2 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -29,6 +29,7 @@ void AnimPetalDanceBigFlower(struct Sprite *); void AnimPetalDanceSmallFlower(struct Sprite *); void AnimRazorLeafParticle(struct Sprite *); void AnimLeechSeed(struct Sprite *); +static void AnimPluck(struct Sprite *); void AnimTranslateLinearSingleSineWave(struct Sprite *); void AnimMoveTwisterParticle(struct Sprite *); void AnimConstrictBinding(struct Sprite *); @@ -153,6 +154,8 @@ static void sub_8103300(struct Sprite *); static void sub_8103320(struct Sprite *); static void sub_81033F0(struct Sprite *); static void sub_810342C(struct Sprite *); +static void AnimMoveFeintSwipe(struct Sprite *); +static void AnimMoveFeintZoom(struct Sprite *); const union AnimCmd gUnknown_085920F0[] = { @@ -172,6 +175,40 @@ const union AnimCmd *const gUnknown_08592114[] = gUnknown_085920F0, }; +static const union AffineAnimCmd sFeintAffineSwipe[] = { AFFINEANIMCMD_END }; +static const union AffineAnimCmd sFeintAffineZoom[] = +{ + AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0), + AFFINEANIMCMD_FRAME(-30, -30, 0, 10), + AFFINEANIMCMD_END, +}; + +static const union AffineAnimCmd * const sFeintAffineAnims[] = { + sFeintAffineZoom, +}; + +const struct SpriteTemplate gFeintSwipeSpriteTemplate = +{ + .tileTag = ANIM_TAG_FEINT, + .paletteTag = ANIM_TAG_FEINT, + .oam = &gUnknown_0852497C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimMoveFeintSwipe, +}; + +const struct SpriteTemplate gFeintZoomSpriteTemplate = +{ + .tileTag = ANIM_TAG_FEINT, + .paletteTag = ANIM_TAG_FEINT, + .oam = &gUnknown_0852497C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sFeintAffineAnims, + .callback = AnimMoveFeintZoom, +}; + const struct SpriteTemplate gSleepPowderParticleSpriteTemplate = { .tileTag = ANIM_TAG_SLEEP_POWDER, @@ -404,6 +441,17 @@ const struct SpriteTemplate gLeechSeedSpriteTemplate = .callback = AnimLeechSeed, }; +const struct SpriteTemplate gPluckParticleSpriteTemplate = +{ + .tileTag = ANIM_TAG_SEED_BROWN, + .paletteTag = ANIM_TAG_SEED_BROWN, + .oam = &gUnknown_0852490C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimPluck, +}; + const union AnimCmd gUnknown_085922D4[] = { ANIMCMD_FRAME(0, 1), @@ -2636,6 +2684,99 @@ static void AnimHyperBeamOrbStep(struct Sprite* sprite) } } +static void AnimPluckParticle(struct Sprite* sprite) +{ + if(sprite->data[0] > 0) + { + s16 yVelocity = sprite->data[5]; + s16 xVelocity = sprite->data[2]; + sprite->pos1.y -= yVelocity; + sprite->pos1.x += xVelocity; + if((sprite->data[0] % 7) == 0) + { + sprite->data[5] = yVelocity-1; + } + sprite->data[0]--; + } + else + { + sprite->callback = DestroyAnimSprite; + } +} + +// brown seed particle (jumps up, falls down.) +// used by Pluck. +// arg 0: initial x offset from target +// arg 1: initial y offset from target +// arg 2: lifetime of the particle +// arg 3: upward velocity initial (decreases over time) +// arg 4: horizontal velocity (stays the same) +static void AnimPluck(struct Sprite* sprite) +{ + InitSpritePosToAnimTarget(sprite, TRUE); + + sprite->data[0] = gBattleAnimArgs[2]; //lifetime of the particle + sprite->data[5] = gBattleAnimArgs[3]; //upward velocity + sprite->data[2] = gBattleAnimArgs[4]; //horizontal velocity + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->callback = AnimPluckParticle; +} + +static void AnimMoveFeintSwipeStep(struct Sprite* sprite) +{ + switch(sprite->data[5]) + { + case 0: + if(AnimTranslateLinear(sprite)) + { + //Not the most elegant solution here, but it works without messing up the sprites coordinates + sprite->pos2.x = 0; + sprite->pos1.x += 64; + sprite->data[5]++; + sprite->data[0] = sprite->data[6]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = sprite->pos1.x - 64; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = sprite->pos1.y; + InitAnimLinearTranslation(sprite); + } + break; + case 1: + if(AnimTranslateLinear(sprite)) + { + sprite->callback = DestroyAnimSprite; + } + break; + } + +} + +static void AnimMoveFeintSwipe(struct Sprite* sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + gBattleAnimArgs[0] = -gBattleAnimArgs[0]; + } + InitSpritePosToAnimTarget(sprite, TRUE); + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[6] = gBattleAnimArgs[2]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = sprite->pos1.x + 64; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = sprite->pos1.y; + sprite->data[5] = 0; + InitAnimLinearTranslation(sprite); + sprite->callback = AnimMoveFeintSwipeStep; +} + +static void AnimMoveFeintZoom(struct Sprite* sprite) +{ + InitSpritePosToAnimTarget(sprite, TRUE); + StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); + sprite->callback = RunStoredCallbackWhenAffineAnimEnds; +} + // seed (sprouts a sapling from a seed.) // Used by Leech Seed. // arg 0: initial x pixel offset diff --git a/src/graphics.c b/src/graphics.c index 93bf9a7b5..4d5c2f753 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -48,6 +48,7 @@ const u32 gBattleAnimSpriteGfx_AirWave[] = INCBIN_U32("graphics/battle_anims/spr const u32 gBattleAnimSpriteGfx_Orb[] = INCBIN_U32("graphics/battle_anims/sprites/orb.4bpp.lz"); const u32 gBattleAnimSpriteGfx_Sword[] = INCBIN_U32("graphics/battle_anims/sprites/sword.4bpp.lz"); const u32 gBattleAnimSpriteGfx_Seed[] = INCBIN_U32("graphics/battle_anims/sprites/seed.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_SeedBrown[] = INCBIN_U32("graphics/battle_anims/sprites/seed-new.4bpp.lz"); const u32 gBattleAnimSpritePal_RainDrops[] = INCBIN_U32("graphics/battle_anims/sprites/rain_drops.gbapal.lz"); const u32 gBattleAnimSpritePal_Bone[] = INCBIN_U32("graphics/battle_anims/sprites/bone.gbapal.lz"); @@ -55,6 +56,7 @@ const u32 gBattleAnimSpritePal_AirWave[] = INCBIN_U32("graphics/battle_anims/spr const u32 gBattleAnimSpritePal_Orb[] = INCBIN_U32("graphics/battle_anims/sprites/orb.gbapal.lz"); const u32 gBattleAnimSpritePal_Sword[] = INCBIN_U32("graphics/battle_anims/sprites/sword.gbapal.lz"); const u32 gBattleAnimSpritePal_Seed[] = INCBIN_U32("graphics/battle_anims/sprites/seed.gbapal.lz"); +const u32 gBattleAnimSpritePal_SeedBrown[] = INCBIN_U32("graphics/battle_anims/sprites/seed-new.gbapal.lz"); const u32 gBattleAnimSpriteGfx_Needle[] = INCBIN_U32("graphics/battle_anims/sprites/needle.4bpp.lz"); const u32 gBattleAnimSpritePal_Needle[] = INCBIN_U32("graphics/battle_anims/sprites/needle.gbapal.lz"); @@ -114,6 +116,9 @@ const u32 gBattleAnimSpritePal_Hit2[] = INCBIN_U32("graphics/battle_anims/sprite const u32 gBattleAnimSpritePal_WavingHand[] = INCBIN_U32("graphics/battle_anims/sprites/waving_hand.gbapal.lz"); const u32 gBattleAnimSpriteGfx_WavingHand[] = INCBIN_U32("graphics/battle_anims/sprites/waving_hand.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_Feint[] = INCBIN_U32("graphics/battle_anims/sprites/feint-punch.4bpp.lz"); +const u32 gBattleAnimSpritePal_Feint[] = INCBIN_U32("graphics/battle_anims/sprites/feint-punch.gbapal.lz"); + const u32 gBattleAnimSpriteGfx_ClosingEye[] = INCBIN_U32("graphics/battle_anims/sprites/closing_eye.4bpp.lz"); const u32 gBattleAnimSpritePal_ClosingEye[] = INCBIN_U32("graphics/battle_anims/sprites/closing_eye.gbapal.lz");