-- YataiDON-HSS override of PyTaikoGreen/background/bg_collabs/dan.lua: bg_overlay/bg_overlay_2 tile step + scroll period use x2[1] local DonBGBase = require("background/bg_objects/donbg/base") local BGNormal = require("background/bg_objects/bg_normal") local Footer = require("background/bg_objects/footer") local ChibiController = require("background/bg_objects/chibi") local DanInfo = require("background/bg_objects/dan_info") local COLLAB_PATH = "background/collab/dan" -- Custom DonBG: DonBG6 draw-shape but with extra bg_overlay_2 scroll local DanDonBG = setmetatable({}, { __index = DonBGBase }) DanDonBG.__index = DanDonBG function DanDonBG.new(player_num) local self = setmetatable({}, DanDonBG) local base = DonBGBase.new(1, player_num, COLLAB_PATH) for k, v in pairs(base) do self[k] = v end self.overlay_move = tex.get_animation(2) local bg_overlay_info = tex.get_texture_info(self.name, "bg_overlay") self.bg_overlay_width = bg_overlay_info and bg_overlay_info.x2[1] or 0 local bg_overlay_2_info = tex.get_texture_info(self.name, "bg_overlay_2") self.bg_overlay_2_width = bg_overlay_2_info and bg_overlay_2_info.x2[1] or 0 self.overlay_move_2 = anim.move(8000, { total_distance = -self.bg_overlay_2_width, loop = true }) self._id_bg_overlay = tex.get_id(self.name, "bg_overlay") or 0 self._id_bg_overlay_2 = tex.get_id(self.name, "bg_overlay_2") or 0 self._id_overlay_1 = tex.get_id(self.name, "overlay_1") or 0 self._id_bg_overlay_3 = tex.get_id(self.name, "bg_overlay_3") or 0 self._id_overlay_2 = tex.get_id(self.name, "overlay_2") or 0 self._id_layer_a = tex.get_id(self.name, "layer_a") self._id_layer_b = tex.get_id(self.name, "layer_b") self._id_layer_c = tex.get_id(self.name, "layer_c") self._id_layer_d = tex.get_id(self.name, "layer_d") self._id_petal = tex.get_id(self.name, "petal") -- ROUND 26 (r26-danbg-tiling): DonBGBase:draw() never calls draw_textures -- below (that hook does not exist on the base class and is dead code -- -- true here and in every other bg_collabs/*.lua override, grep shows only -- definitions, zero call sites). What it actually renders is -- self.states.normal, which DonBGBase.new() just populated from -- background/bg_data/donbg.lua's entry for name "0_1" -- generated by -- r13-bg's export script from the ARCADE's *plain gameplay* donbg tile -- (period=496, vx=-93.29 px/s, an 8 px gradient strip meant to scroll and -- wrap every 496 px). Round 19b swapped this folder's `background.png` for -- the unrelated 1920x280 donbg_dojo_1p flatten but never touched this -- table, so draw_layers was tiling the new full-width art at n=ceil(1920/ -- 496)+1=5 copies 496 px apart -- exactly the "4-5 vertical seams / sakura -- clusters cutting off at boundaries" the user's screenshot showed. -- donbg_dojo_1p has no measured scroll (full.py sampled all 10 keyframes -- of MC 29, every shape's matrix is identical across frames -- this movie -- is not animated in the .nulm at all), so the correct list is exactly -- what the dead draw_textures override above already intended: the band -- and bg_overlay_3 (round 7's 段位道場 title) each drawn once, period=0. -- Bypassing the shared generated table here (instead of hand-editing it) -- keeps every OTHER DonBGBase instance -- the plain non-dan gameplay donbg -- pool, which legitimately owns and needs that "0_1" period=496 entry -- -- untouched. -- -- ROUND 76 (r76-gamedan-band-and-autoplay): the "no measured scroll" -- sentence above is WRONG, and so is ROUND 35 point 4 which re-derived it. -- Both sampled the movie's ROOT node (`#28@0`, character 29) -- which has -- only 10 frames and IS constant (tx=960 ty=138 m=[1,0,0,1] on every one of -- frames 0..9) -- and never descended into its children. Dumped in full -- (`lumen_anim_dump --all --leaves --range 0,1759`, 1760 frames, 47 nodes) -- the CHILDREN all scroll, each on its own period: -- #6@1 -> -1.500000 px/frame = -90.0000 px/s, wrap 1920 px, loop 1281 f -- #10@2 -> -1.200750 px/frame = -72.0450 px/s, wrap 1920 px, loop 1600 f -- #16@3 -> -1.091529 px/frame = -65.4918 px/s, wrap 1920 px, loop 1760 f -- #27@6 -> -0.750000 px/frame = -45.0000 px/s, wrap 960 px, loop 1281 f -- #19@4/#19@5 -> two sakura-petal drifters, 320-frame loop, see below -- The picture already changes on FRAME 1 (105,247 px differ from frame 0). -- The band is therefore drawn as the real five-layer parallax it is: an -- opaque navy seigaiha plate, two cloud silhouette bands, a seigaiha-filled -- cloud band, the falling petals, and a sakura-blossom row. -- -- Fail-soft: any layer whose PNG/texture.json entry is missing is simply -- left out; with none of them present this degrades to the bare opaque -- plate (background.png is fully opaque, alpha 255/255 everywhere), never -- to gaps or to the parent's art. local back, front = {}, {} local function add(list, id, period, vx) if id == nil then return end table.insert(list, { id = id, frame = 0, index = 0, period = period, vx = vx, n = (period > 0) and (math.ceil(1920 / period) + 1) or 0, }) end add(back, self._id_bg, 0, 0) -- static plate (donbg_dojo_1p shape rec 0) add(back, self._id_layer_a, 1920, -90.0000) -- #6@1 dark cloud silhouettes add(back, self._id_layer_b, 1920, -72.0450) -- #10@2 outlined cloud bands add(back, self._id_layer_c, 1920, -65.4918) -- #16@3 seigaiha-filled clouds -- petals (#19@4/#19@5) are drawn between these two lists -- they sit at -- root depths 4 and 5, i.e. under #27@6. add(front, self._id_layer_d, 960, -45.0000) -- #27@6 sakura blossom row -- ROUND 92 -- user asked for the 段位道場 title not to appear on the play -- background (「段位道場這四個字不要出現」). ROUND 7's `bg_overlay_3` draw is -- removed rather than the art deleted, so restoring it is one line. self._layers_back = back self._layers_front = front self.states = { normal = {} } for _, l in ipairs(back) do table.insert(self.states.normal, l) end for _, l in ipairs(front) do table.insert(self.states.normal, l) end -- ROUND 60 (r60-collab-fix-all): DonBGBase now routes collab paths through -- the draw_textures contract; dan is the one collab whose correct list is -- the hand-built states above, so it opts back into the layer path. self.use_layers = true return self end -- ROUND 76: the two petal drifters. Root depths 4 and 5 place the SAME shape -- record (480x240, nine sakura petals) 960 px apart and walk both of them from -- (2073,-218) to (675,525) over 320 frames, then snap back -- measured off the -- anim dump, and confirmed by pasting shape record 5 centre-registered at the -- dumped (tx,ty) on top of the plate+tile reconstruction: mean abs error -- against the cabinet's own render drops from 2.08 to 0.10 at frame 120 and -- from 2.61 to 0.37 at frame 1759. -- -- The cabinet clips them to its 1920x276 stage; we have no stage to clip to, so -- the bottom half of a petal cluster would otherwise fall out of the band and -- over the play area for ~1.7 s of every 5.33 s cycle. `src`+`y2` crops the -- draw to the band instead, which is what the stage boundary does. local PETAL_W, PETAL_H = 480, 240 local PETAL_LOOP_FRAMES = 320 local PETAL_X0, PETAL_Y0 = 2073.0, -218.0 local PETAL_DX, PETAL_DY = -4.36875, 2.321875 local PETAL_GAP = 960.0 -- background.png is 1920x280 pasted at screen y 0 and its row 0 is stage row -- -2, so screen y = stage y + 2 and the band's bottom edge is screen y 278. local BAND_Y_CONST = 2.0 local BAND_BOTTOM = 278.0 function DanDonBG:_draw_petals(y) if self._id_petal == nil then return end local f = (self.elapsed / (1000.0 / 60.0)) % PETAL_LOOP_FRAMES local top = (PETAL_Y0 + PETAL_DY * f) - PETAL_H / 2.0 + BAND_Y_CONST + y if top >= BAND_BOTTOM then return end local h = BAND_BOTTOM - top if h > PETAL_H then h = PETAL_H end local cx = PETAL_X0 + PETAL_DX * f for i = 0, 1 do tex.draw_texture(self._id_petal, { x = cx - i * PETAL_GAP - PETAL_W / 2.0, y = top, src = { x = 0, y = 0, width = PETAL_W, height = h }, y2 = h - PETAL_H, }) end end -- ROUND 76: the petals sit between the scrolling cloud bands and the sakura -- row, so the draw is split rather than left to DonBGBase:draw(). Dan has no -- fever state (states.fever is nil), so none of the base's crossfade paths -- applied here anyway. function DanDonBG:draw(y) y = y or 0 self:draw_layers(self._layers_back or {}, 1.0, y) self:_draw_petals(y) self:draw_layers(self._layers_front or {}, 1.0, y) end function DanDonBG:update(current_time_ms) DonBGBase.update(self, current_time_ms) self.overlay_move:update(current_time_ms) self.overlay_move_2:update(current_time_ms) end -- ROUND 19 (r19-dan): `background.png` is now the arcade's own -- `enso_dani/enso/donbg/donbg_dojo_1p.nulm` band (measured/flattened, -- scratchpad/r19dn/bake -- 1920x280, navy seigaiha + sakura petals), not the -- inherited PyTaikoGreen 8px gradient strip. The old tiled overlay draws below -- (bg_overlay/bg_overlay_2/overlay_1/overlay_2, all still PyTaikoGreen's -- orange-diagonal art since no arcade source for THOSE specific layers was -- found) are dropped so they don't paint the wrong pattern back on top; the -- new band is one static image, not a scrolling composite, so nothing here -- depends on `self.move` / `self.overlay_move*` any more. `bg_overlay_3` -- (round 7's 段位道場 title placement) is unchanged and still drawn. -- -- ROUND 26 (r26-danbg-tiling): DEAD CODE -- DonBGBase:draw() (base.lua) only -- ever calls draw_layers(self.states...), it has no call to draw_textures on -- any DonBGBase subclass anywhere in this repo. This method's intent (band + -- bg_overlay_3, each once) is now what DanDonBG.new() builds directly into -- self.states above, which IS on the real draw path. Left in place only so a -- future reader sees what round 19's author meant to happen; do not rely on -- this function running. function DanDonBG:draw_textures(fade, y, frame) tex.draw_texture(self._id_bg, { y = y }) tex.draw_texture(self._id_bg_overlay_3) end -- Background local DanBackground = {} DanBackground.__index = DanBackground function DanBackground.new(player_num, bpm) local self = setmetatable({}, DanBackground) self.donbg = DanDonBG.new(player_num) self.bg_normal = BGNormal.Base.new(0, COLLAB_PATH) self.footer = Footer.new(COLLAB_PATH, 0) self.chibi = ChibiController.new(bpm, COLLAB_PATH, 2) self.dan_info = DanInfo.new() return self end function DanBackground:update(current_ms, bpm) self.donbg:update(current_ms) self.chibi:update(current_ms, bpm) end function DanBackground:handle_good(player_num) self.chibi:add_chibi(player_num, false) end function DanBackground:handle_ok(player_num) self.chibi:add_chibi(player_num, false) end function DanBackground:handle_bad(player_num) self.chibi:add_chibi(player_num, true) end function DanBackground:handle_drumroll(player_num) end function DanBackground:handle_balloon(player_num) end function DanBackground:handle_gauge(player_num, progress, is_clear, is_rainbow) self.donbg:set_clear(is_clear) end -- ROUND 14 engine binding (ENGINE_BINDINGS.md): DanGameScreen::update pushes the -- live 段位道場 exam state here every frame. See background/bg_objects/dan_info.lua -- for what is drawn with it and why the rest of the panel is still the engine's. function DanBackground:handle_dan(player_num, state) self.dan_info:handle(state) end function DanBackground:draw_back() self.bg_normal:draw() self.donbg:draw() self.footer:draw() self.chibi:draw() end -- ROUND 7: the dan soul gauge's separator overlay is drawn by gauge.cpp at a hardcoded -- fade 0.15; the arcade composites the same 6 px black bands at 0.30 (MAPPING_hud ROUND 5c, -- shape 33 colour-transform alpha 77/256). GameDanScreen::draw() runs draw_fore() after the -- gauge, so one more pass at 0.15 composites to 1-(1-0.15)^2 = 0.2775. The overlay is static -- (it does not depend on the fill), so this needs no gauge state - which is just as well, -- because Player::update takes the dan_gauge branch and never calls Background:handle_gauge. function DanBackground:draw_fore() if not self._gauge_overlay then self._gauge_overlay = tex.load_texture("game/gauge_dan/overlay") or 0 end if self._gauge_overlay ~= 0 then tex.draw_texture(self._gauge_overlay, { fade = 0.15 }) end end -- ROUND 90 (r90-danplate-brown-and-place): the 魂ゲージ condition plate MOVED out -- of draw_fore() into the gauge's own draw slot. On the cabinet it is -- `gauge_border`, a child of `gauge_mc` inside tamashii_gauge.nulm, and the reference build's -- datatable/enso_post.bin target 2 puts that whole movie at draw-order row 10 of -- 29 -- below the notes and below every HUD readout. draw_fore() runs after -- Player::draw()'s draw_notes(), so from there the plate painted OVER the notes -- (user report 「魂guage那個白色的景,不應該把音符蓋過去」). -- DanGameScreen::draw() calls Background::draw_gauge(P1) right after -- dan_gauge.draw(); background.lua forwards it here. function DanBackground:draw_gauge(player_num) self.dan_info:draw() end function DanBackground:destroy() self.donbg:destroy() self.bg_normal:destroy() self.footer:destroy() self.chibi:destroy() end return DanBackground