From f109530c5f23a483366593aa385a511747c1db89 Mon Sep 17 00:00:00 2001 From: spiritsnails <307422241+spiritsnails@users.noreply.github.com> Date: Sat, 1 Aug 2026 16:12:29 -0600 Subject: [PATCH] Route scripted battles through pushBattle so the entry wipe actually plays Commands.lua's start_battle and old-man-demo battle commands pushed BattleState straight onto the stack, bypassing pushBattle (and therefore BattleTransition) entirely. Every script-triggered battle -- gym leaders, the rival, Giovanni, the catch tutorial -- cut straight to the battle screen with no transition wipe. Only the walk-up trainer-sight path (OverworldState:engageTrainer) went through pushBattle already. --- src/script/Commands.lua | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/script/Commands.lua b/src/script/Commands.lua index 93ed8869..c8e468d7 100644 --- a/src/script/Commands.lua +++ b/src/script/Commands.lua @@ -281,7 +281,19 @@ function Commands.start_battle(ctx, kind, a, b) end runner:resume() end - ctx.game.stack:push(battle) + -- Every battle enters through the transition wipe, script-driven ones + -- included: BattleTransition (engine/battle/battle_transitions.asm:1) runs + -- from DoBattleTransitionAndInitBattleVariables for all of them, and + -- GetBattleTransitionID_WildOrTrainer picks the style from the battle kind. + -- Pushing the BattleState straight onto the stack skipped the wipe + -- entirely, so every scripted trainer -- gym leaders, the rival, Giovanni -- + -- and every scripted wild battle simply cut to the battle screen. The + -- trainer-sight path already went through pushBattle; this one did not. + if ctx.overworld and ctx.overworld.pushBattle then + ctx.overworld:pushBattle(battle) + else + ctx.game.stack:push(battle) + end runner:yield() end @@ -770,7 +782,15 @@ function Commands.old_man_demo(ctx) local battle = BattleState.newWild(ctx.game, om.species, om.level) battle:makeOldManDemo() battle.onFinish = function() runner:resume() end - ctx.game.stack:push(battle) + -- InitWildBattle calls DoBattleTransitionAndInitBattleVariables + -- unconditionally (core.asm:6699) -- there is no BATTLE_TYPE_OLD_MAN + -- special case -- so the catch tutorial gets the wipe like any other + -- wild battle + if ctx.overworld and ctx.overworld.pushBattle then + ctx.overworld:pushBattle(battle) + else + ctx.game.stack:push(battle) + end runner:yield() end