Simplify comments

This commit is contained in:
thibautbus
2026-08-11 15:23:32 +02:00
parent cc43bd77d2
commit ab94b96a79
4 changed files with 28 additions and 54 deletions
+4 -5
View File
@@ -2194,11 +2194,10 @@ function BattleState:openOldManBag()
self.afterQueue = "menu"
self:ui(function()
local list
-- The canned one-item bag (POKE_BALL, neither reading from the real
-- inventory) differs by version: pokered's OldManItemList (core.asm
-- :2212-2214) is quantity 50; pokeyellow's SimulatedInputBattleItemList
-- (core.asm:2316-2319), shared by both the Viridian old man's demo and
-- Oak's Pikachu catch, dropped that to quantity 1.
-- 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 = qty },
+8 -17
View File
@@ -280,19 +280,13 @@ function Commands.save_end_battle_text(ctx, textId)
ctx.endBattleText = TextBox.substitute(ctx.game, text or textId)
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. InitWildBattle calls DoBattleTransitionAndInitBattleVariables
-- unconditionally (core.asm:6699) -- there is no BATTLE_TYPE_OLD_MAN or
-- BATTLE_TYPE_PIKACHU special case -- so the old-man tutorial and Oak's
-- Pikachu catch get the wipe like any other wild battle, same as every
-- scripted trainer (gym leaders, the rival, Giovanni). ctx.overworld can
-- be a test double without the full OverworldState metatable, so this
-- falls back to a bare push; that fallback silently skips the wipe and
-- the battle-theme start, so it's worth a log rather than a quiet
-- behavior change.
-- 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)
@@ -334,10 +328,7 @@ function Commands.start_battle(ctx, kind, a, b)
end
runner:resume()
end
-- 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.
-- A direct stack push would skip the battle-entry transition.
Commands.pushBattle(ctx, battle)
runner:yield()
end
+4 -6
View File
@@ -453,12 +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 whatever cutscene song is
-- already playing going into the lab instead of cutting to it
-- (BIT_NO_MAP_MUSIC in wStatusFlags7) -- MUSIC_MUSEUM_GUY in Yellow
-- (started in escortToLab when Oak begins walking), MUSIC_MEET_PROF_OAK
-- in Red/Blue (pokered never switches songs for this walk); 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