From 9faa5294ced5dc6684bfe2138caf75faf280f777 Mon Sep 17 00:00:00 2001 From: Linathan <35115312+LinathanZel@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:14:42 -0400 Subject: [PATCH] =?UTF-8?q?Wild=20Pok=C3=A9mon=20animate=20after=20breakin?= =?UTF-8?q?g=20out=20of=20Pok=C3=A9=20Ball=20(#7339)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asm/macros/battle_script.inc | 3 ++- data/battle_scripts_2.s | 3 +++ include/battle_controllers.h | 1 + include/config/battle.h | 31 ++++++++++++++++--------------- src/battle_controllers.c | 9 +++++++++ src/battle_script_commands.c | 10 +++++++--- 6 files changed, 38 insertions(+), 19 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index c906938b93..c2a10b175c 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -842,8 +842,9 @@ .byte 0x95 .endm - .macro unused_96 + .macro animatewildpokemonafterfailedpokeball battler:req .byte 0x96 + .byte \battler .endm .macro tryinfatuating failInstr:req diff --git a/data/battle_scripts_2.s b/data/battle_scripts_2.s index 0e0f43893e..b46b30a443 100644 --- a/data/battle_scripts_2.s +++ b/data/battle_scripts_2.s @@ -211,6 +211,9 @@ BattleScript_WallyBallThrow:: finishturn BattleScript_ShakeBallThrow:: + animatewildpokemonafterfailedpokeball BS_TARGET + waitstate + waitmessage B_WAIT_TIME_LONG printfromtable gBallEscapeStringIds waitmessage B_WAIT_TIME_LONG jumpifword CMP_NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_SAFARI, BattleScript_ShakeBallThrowEnd diff --git a/include/battle_controllers.h b/include/battle_controllers.h index d5166ce6f8..4db4aea969 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -426,6 +426,7 @@ void LinkPartnerBufferExecCompleted(u32 battler); void TrySetBattlerShadowSpriteCallback(u32 battler); +void AnimateMonAfterPokeBallFail(u32 battler); void TryShinyAnimAfterMonAnim(u32 battler); void WaitForMonAnimAfterLoad(u32 battler); void BtlController_HandleSwitchInWaitAndEnd(u32 battler); diff --git a/include/config/battle.h b/include/config/battle.h index a58b174b46..d09698c634 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -267,21 +267,22 @@ #define B_NEW_TERRAIN_BACKGROUNDS FALSE // If set to TRUE, uses new terrain backgrounds for Electric, Misty, Grassy and Psychic Terrain. // Interface settings -#define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle. -#define B_FAST_INTRO_PKMN_TEXT TRUE // If set to TRUE, battle intro texts print at the same time as animation of a Pokémon, as opposing to waiting for the animation to end. -#define B_FAST_INTRO_NO_SLIDE FALSE // If set to TRUE, the slide animation that happens at the beginning of the battle is skipped. -#define B_FAST_HP_DRAIN TRUE // If set to TRUE, HP bars will move faster. -#define B_FAST_EXP_GROW TRUE // If set to TRUE, EXP bars will move faster. -#define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move. -#define B_SHOW_CATEGORY_ICON TRUE // If set to TRUE, it will show an icon in the summary and move relearner showing the move's category. -#define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations. -#define B_WAIT_TIME_MULTIPLIER 16 // This determines how long text pauses in battle last. Vanilla is 16. Lower values result in faster battles. -#define B_QUICK_MOVE_CURSOR_TO_RUN FALSE // If set to TRUE, pushing B in the battle options against a wild encounter will move the cursor to the run option -#define B_RUN_TRAINER_BATTLE TRUE // If set to TRUE, players can run from Trainer battles. This is treated as a whiteout. -#define B_MOVE_DESCRIPTION_BUTTON L_BUTTON // If set to a button other than B_LAST_USED_BALL_BUTTON, pressing this button will open the move description menu -#define B_SHOW_USELESS_Z_MOVE_INFO FALSE // If set to TRUE, Z-moves without additional effects like newer gen status moves will say "no additional effect" -#define B_ANIMATE_MON_AFTER_KO TRUE // If set to TRUE, if a Pokémon on the opposite site faints, the non-fainted Pokemon will display a victory animation. -#define B_SHOW_DYNAMAX_MESSAGE FALSE // If set to TRUE, an additional battle message is shown after completing Dynamaxing/Gigantamaxing. +#define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle. +#define B_FAST_INTRO_PKMN_TEXT TRUE // If set to TRUE, battle intro texts print at the same time as animation of a Pokémon, as opposing to waiting for the animation to end. +#define B_FAST_INTRO_NO_SLIDE FALSE // If set to TRUE, the slide animation that happens at the beginning of the battle is skipped. +#define B_FAST_HP_DRAIN TRUE // If set to TRUE, HP bars will move faster. +#define B_FAST_EXP_GROW TRUE // If set to TRUE, EXP bars will move faster. +#define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move. +#define B_SHOW_CATEGORY_ICON TRUE // If set to TRUE, it will show an icon in the summary and move relearner showing the move's category. +#define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations. +#define B_WAIT_TIME_MULTIPLIER 16 // This determines how long text pauses in battle last. Vanilla is 16. Lower values result in faster battles. +#define B_QUICK_MOVE_CURSOR_TO_RUN FALSE // If set to TRUE, pushing B in the battle options against a wild encounter will move the cursor to the run option +#define B_RUN_TRAINER_BATTLE TRUE // If set to TRUE, players can run from Trainer battles. This is treated as a whiteout. +#define B_MOVE_DESCRIPTION_BUTTON L_BUTTON // If set to a button other than B_LAST_USED_BALL_BUTTON, pressing this button will open the move description menu +#define B_SHOW_USELESS_Z_MOVE_INFO FALSE // If set to TRUE, Z-moves without additional effects like newer gen status moves will say "no additional effect" +#define B_ANIMATE_MON_AFTER_KO TRUE // If set to TRUE, if a Pokémon on the opposite site faints, the non-fainted Pokemon will display a victory animation. +#define B_ANIMATE_MON_AFTER_FAILED_POKEBALL TRUE // If set to TRUE, if a Pokémon on the opposite side breaks out of a thrown Poké Ball, the wild Pokémon will display its animation. +#define B_SHOW_DYNAMAX_MESSAGE FALSE // If set to TRUE, an additional battle message is shown after completing Dynamaxing/Gigantamaxing. // Catching settings #define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 193248ce27..d0e6117433 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -2860,6 +2860,15 @@ void BtlController_HandleBattleAnimation(u32 battler) } } +void AnimateMonAfterPokeBallFail(u32 battler) +{ + if (B_ANIMATE_MON_AFTER_FAILED_POKEBALL == FALSE) + return; + + LaunchKOAnimation(battler, ReturnAnimIdForBattler(TRUE, battler), TRUE); + TryShinyAnimation(gBattlerTarget, GetBattlerMon(gBattlerTarget)); +} + static void AnimateMonAfterKnockout(u32 battler) { if (B_ANIMATE_MON_AFTER_KO == FALSE) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e615c9d2d1..9c4da75feb 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -486,7 +486,7 @@ static void Cmd_setlightscreen(void); static void Cmd_tryKO(void); static void Cmd_checknonvolatiletrigger(void); static void Cmd_copybidedmg(void); -static void Cmd_unused_96(void); +static void Cmd_animatewildpokemonafterfailedpokeball(void); static void Cmd_tryinfatuating(void); static void Cmd_updatestatusicon(void); static void Cmd_setmist(void); @@ -745,7 +745,7 @@ void (*const gBattleScriptingCommandsTable[])(void) = Cmd_tryKO, //0x93 Cmd_checknonvolatiletrigger, //0x94 Cmd_copybidedmg, //0x95 - Cmd_unused_96, //0x96 + Cmd_animatewildpokemonafterfailedpokeball, //0x96 Cmd_tryinfatuating, //0x97 Cmd_updatestatusicon, //0x98 Cmd_setmist, //0x99 @@ -11016,8 +11016,12 @@ static void Cmd_copybidedmg(void) gBattlescriptCurrInstr = cmd->nextInstr; } -static void Cmd_unused_96(void) +static void Cmd_animatewildpokemonafterfailedpokeball(void) { + CMD_ARGS(u8 battler); + u8 battler = GetBattlerForBattleScript(cmd->battler); + AnimateMonAfterPokeBallFail(battler); + gBattlescriptCurrInstr = cmd->nextInstr; } static void Cmd_tryinfatuating(void)