mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-17 19:24:01 +02:00
Fix lingering title music after Resume Game
Continue dropped the player into the overworld with the title screen's song still cross-fading into the map theme over ~1.2s (Music.MAP_FADE), audibly wrong since the player already has control. New Game never showed this because OakSpeech's own unfaded Music.play/playMap masks it before the player is ever placed in the overworld. The same bug was also reachable through F2 quickload (pressed at the title screen, or mid-session -- F2 always jumps straight to the loaded save's map/position with no walking transition, so it needs the same instant swap as Continue rather than an ordinary warp's crossfade either way) and through the checkpoint-resume mod API (RFC 0006's mod.checkpoint:resume). OverworldState:setMap now takes an opts.freshBoot flag: when set, the map's music swaps in at once instead of cross-fading, like every other map's PlayDefaultMusic. It is set by every real hard state teleport -- TitleState's onContinue, New Game's push, F2 quickload, and Game:restoreCheckpointSave (whose only caller is itself title-gated) -- and deliberately kept separate from the pre-existing opts.via == "boot" default, which dev tooling (the console's `warp` verb, hot reload's map rebuild) also reuses for unrelated reasons and must keep its ordinary crossfade.
This commit is contained in:
@@ -462,8 +462,18 @@ function OverworldState:setMap(mapId, x, y, facing, opts)
|
||||
if not keepMusic then
|
||||
-- ..(home/overworld.asm ln 2346)
|
||||
local Music = require("src.core.Music")
|
||||
-- opts.freshBoot: switch instantly instead of cross-fading, like every
|
||||
-- other map's PlayDefaultMusic on real hardware -- set only by
|
||||
-- Game.lua's hard state teleports (onContinue, New Game, F2,
|
||||
-- restoreCheckpointSave). Deliberately separate from opts.via ==
|
||||
-- "boot" itself: dev tooling (src/dev/Console.lua's warp verb,
|
||||
-- src/dev/HotReload.lua's reloadMap) reuses that same default for the
|
||||
-- surf-restore/fresh-npc-pool branches above and must keep the
|
||||
-- ordinary crossfade.
|
||||
local fade = Music.MAP_FADE
|
||||
if opts and opts.freshBoot then fade = nil end
|
||||
Music.playMap(Game.data, mapId, Game.save.onBike, self.player.surfing,
|
||||
Music.MAP_FADE)
|
||||
fade)
|
||||
end
|
||||
|
||||
-- forced bike/surf tiles fire the moment the player is placed on the
|
||||
|
||||
Reference in New Issue
Block a user