dan doors: tear down outside SONG_SELECT / DAN_SELECT #9

Merged
Yonokid merged 2 commits from GanYiZhong/YataiDONNijiiro:dan-doors-teardown into main 2026-09-09 17:08:55 +02:00
+19
View File
@@ -359,7 +359,25 @@ end
-- ── half 1: SONG_SELECT (close + stamp) ───────────────────────────────────── -- ── half 1: SONG_SELECT (close + stamp) ─────────────────────────────────────
-- Returns true when it drew anything. -- Returns true when it drew anything.
-- The rig only belongs to SONG_SELECT (close leg) and DAN_SELECT (open leg).
-- Teardown used to rely on SongSelect:draw_top calling set_progress(-1), which never
-- happens when the player backs out of DAN_SELECT straight to TITLE (Esc): the last
-- engine_u stayed put and the global Indicator fallback kept painting the shut doors
-- over the title screen. Drop every bit of state as soon as we are anywhere else.
local function off_screen()
local scr = tex.current_screen and tex.current_screen() or nil
if scr == nil or scr == "SONG_SELECT" or scr == "DAN_SELECT" then return false end
M.engine_u = nil
M.armed = false
M.armed_open = false
M.open_t0 = nil
M.t0 = nil
M.open_held = false
return true
end
function M.draw() function M.draw()
if off_screen() then return false end
local u = M.progress() local u = M.progress()
if not u then return false end if not u then return false end
@@ -476,6 +494,7 @@ local INTRO_FROM = 5 -- clip label `in`
local REVEAL_F = OPEN_FROM -- 182 local REVEAL_F = OPEN_FROM -- 182
function M.draw_open() function M.draw_open()
if off_screen() then __hss_dan_intro = nil; return false end
local req = __hss_dan_intro local req = __hss_dan_intro
if req ~= nil then if req ~= nil then
__hss_dan_intro = nil __hss_dan_intro = nil