From 44eb6260cc099d7ce5ef1e527a810acffecb0bf5 Mon Sep 17 00:00:00 2001 From: Philipp AUER Date: Wed, 2 Aug 2023 02:10:18 +0300 Subject: [PATCH] [battle, anim] woodhammer animation overhaul (#3192) * [battle, anim] woodhammer animation overhaul * squashme: timings --------- Co-authored-by: sbird --- data/battle_anim_scripts.s | 43 +++--- .../sprites/wood_hammer_hammer.png | Bin 0 -> 400 bytes include/constants/battle_anim.h | 1 + include/graphics.h | 2 + src/battle_anim_effects_1.c | 126 +++++++++++++++++- src/data/battle_anim.h | 2 + src/data/pokemon/level_up_learnsets.h | 1 + src/graphics.c | 3 + 8 files changed, 153 insertions(+), 25 deletions(-) create mode 100644 graphics/battle_anims/sprites/wood_hammer_hammer.png diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index f41f541a1..95d7c1bc6 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -4051,31 +4051,34 @@ Move_CHARGE_BEAM: end Move_WOOD_HAMMER: + loadspritegfx ANIM_TAG_WOOD_HAMMER + loadspritegfx ANIM_TAG_WOOD_HAMMER_HAMMER loadspritegfx ANIM_TAG_IMPACT - monbg ANIM_TARGET - setalpha 12, 8 playsewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 18, 6, 2, 4 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 12, 4, 2, 4 + createsprite gWoodHammerHammerSpriteTemplate, ANIM_TARGET, 2 + delay 60 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 3, 0, 12, 4 + delay 18 + createvisualtask AnimTask_SquishTarget, 0x2 + delay 6 + call WoodHammerImpact waitforvisualfinish - createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 20, 0, 0, 4 - delay 3 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, 0, 10, 0, 0 - createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 4, -10, 0, 1, 0 - playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET - delay 1 - createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -16, 0, 0, 4 - waitforvisualfinish - createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 - waitforvisualfinish - delay 2 - createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 5 - delay 3 - createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 7 - waitforvisualfinish - clearmonbg ANIM_TARGET - blendoff end +WoodHammerImpact: + playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 2 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 0, 0, 20, 24, 14, 1 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 5, 0, -20, 24, 14, 0 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 0, 5, 20, -24, 14, 1 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, -5, 0, -20, -24, 14, 0 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 0, 0, 20, 24, 20, 2 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 5, 0, -20, 24, 20, 2 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 0, 5, 20, -24, 20, 2 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, -5, 0, -20, -24, 20, 2 + return + Move_AQUA_JET: loadspritegfx ANIM_TAG_SPARKLE_6 loadspritegfx ANIM_TAG_ROUND_SHADOW diff --git a/graphics/battle_anims/sprites/wood_hammer_hammer.png b/graphics/battle_anims/sprites/wood_hammer_hammer.png new file mode 100644 index 0000000000000000000000000000000000000000..00296d4c461b290f43871301e83164afb2f14eb3 GIT binary patch literal 400 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!7>k44ofy`glX(f`7zFr)xB}^W zQR5EdfP>}wLCWz6 zhRF5T&+T_}$@)_oE85JnBtbx$%{fZJYT3fdOA1-LemqfJvh(Jn;#>hMQMQOQc_FsK za^(-ROgMH1yYpsQHkTBAsOLSnbjrQJ<~p9=DYR`z+UUD22MV6vfanw8>@ zPA-nQDQU?{c6}QhIC@LM!*^X*JjFk+Eq#ue$*IRL?y)|P*b_M={3+|ny?llD^6I#j zDF*)k94Mi2YH?D`V)iD*!=Lp<_OjajeAA!vG47G{)Cvx%Z`(i2a&Qo>lgxUbSdw84 c0Z;cZeozxAuqm0%2=qOJr>mdKI;Vst06?>;Q~&?~ literal 0 HcmV?d00001 diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index 01d4b6809..29c39b689 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -397,6 +397,7 @@ #define ANIM_TAG_STEEL_BEAM (ANIM_SPRITES_START + 383) #define ANIM_TAG_POLTERGEIST (ANIM_SPRITES_START + 384) #define ANIM_TAG_TEAPOT (ANIM_SPRITES_START + 385) +#define ANIM_TAG_WOOD_HAMMER_HAMMER (ANIM_SPRITES_START + 386) // battlers diff --git a/include/graphics.h b/include/graphics.h index 2d94fd726..25b3fd501 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -10161,6 +10161,8 @@ extern const u32 gBattleAnimSpriteGfx_ZMoveSymbol[]; extern const u32 gBattleAnimSpritePal_ZMoveSymbol[]; extern const u32 gBattleAnimSpriteGfx_Teapot[]; extern const u32 gBattleAnimSpritePal_Teapot[]; +extern const u32 gBattleAnimSpriteGfx_WoodHammerHammer[]; +extern const u32 gBattleAnimSpritePal_WoodHammerHammer[]; extern const u32 gBattleAnimBgImage_Dark[]; extern const u32 gBattleAnimBgImage_Ghost[]; diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 7e3a6dc20..63aea3f80 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -147,6 +147,9 @@ static void AnimGrassKnotStep(struct Sprite *); static void AnimGrassKnot(struct Sprite *); static void AnimWoodHammerSmall(struct Sprite *); static void AnimWoodHammerBig(struct Sprite *); +static void AnimWoodHammerHammer(struct Sprite *); +static void AnimWoodHammerHammer_WaitForPunch(struct Sprite *); +static void AnimWoodHammerHammer_WaitForDestruction(struct Sprite *); static void AnimTask_DoubleTeam_Step(u8); static void AnimDoubleTeam(struct Sprite *); static void AnimNightSlash(struct Sprite *); @@ -2847,24 +2850,67 @@ const union AffineAnimCmd *const gWoodHammerBigAffineAnims[] = gWoodHammerBigAffineAnimCmd_2, }; -const union AnimCmd gWoodHammerSmallAnimCmd_1[] = +#define WOOD_HAMMER_SCALE_STEP 5 +#define WOOD_HAMMER_CC_ROTATION_STEP 2 +#define WOOD_HAMMER_BACKWARDS_DURATION 40 +#define WOOD_HAMMER_ROTATED_AMOUNT (WOOD_HAMMER_CC_ROTATION_STEP * WOOD_HAMMER_BACKWARDS_DURATION) +#define WOOD_HAMMER_SCALED_AMOUNT (WOOD_HAMMER_SCALE_STEP * WOOD_HAMMER_BACKWARDS_DURATION) + +const union AffineAnimCmd gWoodHammerHammerAffineAnimCmd_BackwardsRotateAndScale[] = { - ANIMCMD_FRAME(32, 1), - ANIMCMD_END, + AFFINEANIMCMD_FRAME(WOOD_HAMMER_SCALE_STEP, WOOD_HAMMER_SCALE_STEP, WOOD_HAMMER_CC_ROTATION_STEP, WOOD_HAMMER_BACKWARDS_DURATION), + AFFINEANIMCMD_END }; -const union AnimCmd gWoodHammerSmallAnimCmd_2[] = +const union AffineAnimCmd gWoodHammerHammerAffineAnimCmd_BackwardsRotateAndScaleFlipped[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(-WOOD_HAMMER_SCALE_STEP, WOOD_HAMMER_SCALE_STEP, -WOOD_HAMMER_CC_ROTATION_STEP, WOOD_HAMMER_BACKWARDS_DURATION), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd gWoodHammerHammerAffineAnimCmd_PunchClockwise[] = +{ + AFFINEANIMCMD_FRAME(0x100 + WOOD_HAMMER_SCALED_AMOUNT, 0x100 + WOOD_HAMMER_SCALED_AMOUNT, WOOD_HAMMER_ROTATED_AMOUNT, 0), + AFFINEANIMCMD_FRAME(0, 0, -16, 7), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd gWoodHammerHammerAffineAnimCmd_PunchCounterClockwise[] = +{ + AFFINEANIMCMD_FRAME(-0x100 - WOOD_HAMMER_SCALED_AMOUNT, 0x100 + WOOD_HAMMER_SCALED_AMOUNT, -WOOD_HAMMER_ROTATED_AMOUNT, 0), + AFFINEANIMCMD_FRAME(0, 0, 16, 7), + AFFINEANIMCMD_END +}; + +// Animations 0, 2 are for the player side attacking +// Animations 1, 3 are for the opponent side attacking (flipped) +const union AffineAnimCmd *const gWoodHammerHammerAffineAnims[] = +{ + gWoodHammerHammerAffineAnimCmd_BackwardsRotateAndScale, + gWoodHammerHammerAffineAnimCmd_BackwardsRotateAndScaleFlipped, + gWoodHammerHammerAffineAnimCmd_PunchClockwise, + gWoodHammerHammerAffineAnimCmd_PunchCounterClockwise, +}; + +const union AnimCmd gWoodHammerSmallAnimCmd_1[] = { ANIMCMD_FRAME(48, 1), ANIMCMD_END, }; -const union AnimCmd gWoodHammerSmallAnimCmd_3[] = +const union AnimCmd gWoodHammerSmallAnimCmd_2[] = { ANIMCMD_FRAME(64, 1), ANIMCMD_END, }; +const union AnimCmd gWoodHammerSmallAnimCmd_3[] = +{ + ANIMCMD_FRAME(80, 1), + ANIMCMD_END, +}; + const union AnimCmd *const gWoodHammerSmallAnims[] = { gWoodHammerSmallAnimCmd_1, @@ -2905,6 +2951,17 @@ const struct SpriteTemplate gWoodHammerSmallSpriteTemplate = .callback = AnimWoodHammerSmall, }; +const struct SpriteTemplate gWoodHammerHammerSpriteTemplate = +{ + .tileTag = ANIM_TAG_WOOD_HAMMER_HAMMER, + .paletteTag = ANIM_TAG_WOOD_HAMMER_HAMMER, + .oam = &gOamData_AffineDouble_ObjNormal_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gWoodHammerHammerAffineAnims, + .callback = AnimWoodHammerHammer, +}; + const struct SpriteTemplate gJudgmentGrayOutwardSpikesTemplate = { .tileTag = ANIM_TAG_GREEN_SPIKE, @@ -3022,6 +3079,65 @@ static void AnimWoodHammerSmall(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); } +#define HAMMER_X_OFFSET 40 +#define HAMMER_PUNCH_WAIT_FRAMES 37 + +static void AnimWoodHammerHammer(struct Sprite *sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + sprite->x += HAMMER_X_OFFSET; + StartSpriteAffineAnim(sprite, 1); + } + else + { + sprite->x -= HAMMER_X_OFFSET; + StartSpriteAffineAnim(sprite, 0); + } + sprite->data[6] = HAMMER_PUNCH_WAIT_FRAMES; + sprite->callback = AnimWoodHammerHammer_WaitForPunch; +} + +static void AnimWoodHammerHammer_WaitForPunch(struct Sprite *sprite) +{ + if (!sprite->affineAnimEnded) + return; + + if (sprite->data[6] != 0) + { + sprite->data[6]--; + if (sprite->data[6] & 1) + { + if ((sprite->data[6] / 2) & 1) + sprite->x2++; + else + sprite->x2--; + } + return; + } + + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + StartSpriteAffineAnim(sprite, 3); + } + else + { + StartSpriteAffineAnim(sprite, 2); + } + sprite->callback = AnimWoodHammerHammer_WaitForDestruction; +} + +static void AnimWoodHammerHammer_WaitForDestruction(struct Sprite *sprite) +{ + if (sprite->affineAnimEnded) + { + DestroySpriteAndMatrix(sprite); + } +} + +#undef HAMMER_X_OFFSET +#undef HAMMER_PUNCH_WAIT_FRAMES + // Animates the falling particles that horizontally wave back and forth. // Used by Sleep Powder, Stun Spore, and Poison Powder. // arg 0: initial x pixel offset diff --git a/src/data/battle_anim.h b/src/data/battle_anim.h index be1c7f07c..0a3c5d647 100644 --- a/src/data/battle_anim.h +++ b/src/data/battle_anim.h @@ -1451,6 +1451,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Orbs, 0x0180, ANIM_TAG_STEEL_BEAM}, {gBattleAnimSpriteGfx_AuraSphere, 0x200, ANIM_TAG_POLTERGEIST}, {gBattleAnimSpriteGfx_Teapot, 0x1800, ANIM_TAG_TEAPOT}, + {gBattleAnimSpriteGfx_WoodHammerHammer, 0x800, ANIM_TAG_WOOD_HAMMER_HAMMER}, }; const struct CompressedSpritePalette gBattleAnimPaletteTable[] = @@ -1902,6 +1903,7 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_SteelBeam, ANIM_TAG_STEEL_BEAM}, {gBattleAnimSpritePal_Poltergeist, ANIM_TAG_POLTERGEIST}, {gBattleAnimSpritePal_Teapot, ANIM_TAG_TEAPOT}, + {gBattleAnimSpritePal_WoodHammerHammer, ANIM_TAG_WOOD_HAMMER_HAMMER}, }; const struct BattleAnimBackground gBattleAnimBackgroundTable[] = diff --git a/src/data/pokemon/level_up_learnsets.h b/src/data/pokemon/level_up_learnsets.h index 17af6b888..c29d77b03 100644 --- a/src/data/pokemon/level_up_learnsets.h +++ b/src/data/pokemon/level_up_learnsets.h @@ -15,6 +15,7 @@ static const struct LevelUpMove sBulbasaurLevelUpLearnset[] = { LEVEL_UP_MOVE(31, MOVE_WORRY_SEED), LEVEL_UP_MOVE(33, MOVE_SYNTHESIS), LEVEL_UP_MOVE(37, MOVE_SEED_BOMB), + LEVEL_UP_MOVE(56, MOVE_WOOD_HAMMER), LEVEL_UP_END }; diff --git a/src/graphics.c b/src/graphics.c index de65ac1c1..74feb5246 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -449,6 +449,9 @@ const u32 gBattleAnimSpriteGfx_SpinningBall[] = INCBIN_U32("graphics/battle_anim const u32 gBattleAnimSpritePal_SpinningBall[] = INCBIN_U32("graphics/battle_anims/unused/spinning_ball.gbapal.lz"); const u32 gBattleAnimSpritePal_SpinningBall2[] = INCBIN_U32("graphics/battle_anims/unused/spinning_ball_2.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_WoodHammerHammer[] = INCBIN_U32("graphics/battle_anims/sprites/wood_hammer_hammer.4bpp.lz"); +const u32 gBattleAnimSpritePal_WoodHammerHammer[] = INCBIN_U32("graphics/battle_anims/sprites/wood_hammer_hammer.gbapal.lz"); + // old battle interface data, unused const u32 gOldBattleInterfaceGfx[] = INCBIN_U32("graphics/unused/obi1.4bpp.lz");