diff --git a/Scripts/song_select/dan_doors.lua b/Scripts/song_select/dan_doors.lua index a6fbc2c..a9c0124 100644 --- a/Scripts/song_select/dan_doors.lua +++ b/Scripts/song_select/dan_doors.lua @@ -359,7 +359,25 @@ end -- ── half 1: SONG_SELECT (close + stamp) ───────────────────────────────────── -- 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() + if off_screen() then return false end local u = M.progress() if not u then return false end @@ -476,6 +494,7 @@ local INTRO_FROM = 5 -- clip label `in` local REVEAL_F = OPEN_FROM -- 182 function M.draw_open() + if off_screen() then __hss_dan_intro = nil; return false end local req = __hss_dan_intro if req ~= nil then __hss_dan_intro = nil