Merge pull request #1086 from thibautbus/fix/yellow-pallet-oak-music

Bring Oak's Pallet Town cutscene in line with the original Yellow game
This commit is contained in:
bryanthaboi
2026-08-11 21:21:36 -04:00
committed by GitHub
7 changed files with 376 additions and 33 deletions
+6 -1
View File
@@ -2203,8 +2203,13 @@ function BattleState:openOldManBag()
self.afterQueue = "menu"
self:ui(function()
local list
-- The canned bag (POKE_BALL, not read from the player's real
-- inventory) differs by version: pokered's OldManItemList has 50
-- POKé BALLs; pokeyellow's SimulatedInputBattleItemList, shared by
-- the Viridian tutorial and Oak's catch, has one.
local qty = require("src.core.GameVersion").isYellow() and "x1" or "x50"
list = ListMenu.new(game, "ITEMS", {
{ value = "POKE_BALL", label = Strings("POKé BALL"), right = "x50" },
{ value = "POKE_BALL", label = Strings("POKé BALL"), right = qty },
}, {
script = function(l)
l.scriptTimer = (l.scriptTimer or 0) + 1
+19 -22
View File
@@ -280,6 +280,22 @@ function Commands.save_end_battle_text(ctx, textId)
ctx.endBattleText = TextBox.substitute(ctx.game, text or textId)
end
-- Route scripted battles through the standard entry transition. In the
-- originals, InitWildBattle (engine/battle/init_battle.asm) always calls
-- DoBattleTransitionAndInitBattleVariables (engine/battle/core.asm), with
-- no old-man or Pikachu-demo exception; BattleTransition then selects the
-- wipe for the battle kind. Some tests provide only a partial overworld
-- double, so retain a logged fallback even though it skips the transition
-- and battle music.
function Commands.pushBattle(ctx, battle)
if ctx.overworld and ctx.overworld.pushBattle then
ctx.overworld:pushBattle(battle)
else
Logger.warn("pushBattle: no overworld:pushBattle, skipping the transition wipe")
ctx.game.stack:push(battle)
end
end
-- start_battle "wild" species level | start_battle "trainer" OPP_CLASS partyIndex
function Commands.start_battle(ctx, kind, a, b)
local BattleState = require("src.battle.BattleState")
@@ -312,19 +328,8 @@ function Commands.start_battle(ctx, kind, a, b)
end
runner:resume()
end
-- 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
-- A direct stack push would skip the battle-entry transition.
Commands.pushBattle(ctx, battle)
runner:yield()
end
@@ -818,15 +823,7 @@ function Commands.old_man_demo(ctx, outcome)
local battle = BattleState.newWild(ctx.game, om.species, om.level)
battle:makeOldManDemo(nil, outcome == "fail")
battle.onFinish = function() runner:resume() end
-- 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
Commands.pushBattle(ctx, battle)
runner:yield()
end
+4 -3
View File
@@ -453,9 +453,10 @@ function OverworldState:setMap(mapId, x, y, facing, opts)
-- walks out of the warp, not beside him (#863)
require("src.world.PikachuFollower").onMapEntered(Game, self, opts, true)
-- opts.keepMusic: the Oak-escort warp keeps MUSIC_MEET_PROF_OAK
-- playing into the lab (BIT_NO_MAP_MUSIC in wStatusFlags7);
-- keepMusicOnce is the play_music opts.keep one-shot of the same bit
-- opts.keepMusic preserves the Oak-escort song across the lab warp,
-- matching BIT_NO_MAP_MUSIC: MUSIC_MUSEUM_GUY in Yellow and
-- MUSIC_MEET_PROF_OAK in Red/Blue. keepMusicOnce is the equivalent
-- one-shot set by play_music opts.keep.
local keepMusic = (opts and opts.keepMusic) or self.keepMusicOnce
self.keepMusicOnce = nil
if not keepMusic then