Files
YataiDONNijiiro/Scripts/background/bg_collabs/funassyi.lua
T
2026-09-30 15:29:22 -04:00

157 lines
5.7 KiB
Lua

-- YataiDON-HSS override of PyTaikoGreen/background/bg_collabs/funassyi.lua: overlay second-copy offset uses overlay_info.x2[1]
local DonBG4 = require("background/bg_objects/donbg/4")
local BGNormal = require("background/bg_objects/bg_normal")
local Fever = require("background/bg_objects/fever")
local Footer = require("background/bg_objects/footer")
local Dancer = require("background/bg_objects/dancer")
local RendaController = require("background/bg_objects/renda")
local ChibiController = require("background/bg_objects/chibi")
local DancerModel = require("background/bg_objects/collab_dancer_model")
local COLLAB_PATH = "background/collab/funassyi"
local MAX_DANCERS = 5
-- BGFever: animated slide-in using anims 16-17, then horizontal tile scroll
local FunassyiBGFever = {}
FunassyiBGFever.__index = FunassyiBGFever
function FunassyiBGFever.new()
local self = setmetatable({}, FunassyiBGFever)
self.name = "bg_fever_0"
tex.load_folder(COLLAB_PATH, "bg_fever/" .. self.name)
self.transitioned = false
self.horizontal_move = tex.get_animation(16)
self.bg_texture_move = tex.get_animation(17)
local overlay_info = tex.get_texture_info(self.name, "overlay")
self.overlay_width = overlay_info and overlay_info.x2[1] or 0
self._id_bg = tex.get_texture(COLLAB_PATH .. "/" .. self.name .. "/background") or 0
self._id_overlay = tex.get_texture(COLLAB_PATH .. "/" .. self.name .. "/overlay") or 0
return self
end
function FunassyiBGFever:start()
self.bg_texture_move:start()
end
function FunassyiBGFever:reset()
self.transitioned = false
end
function FunassyiBGFever:update(current_time_ms)
self.bg_texture_move:update(current_time_ms)
if self.bg_texture_move.is_finished and not self.transitioned then
self.transitioned = true
self.horizontal_move:restart()
end
if self.transitioned then
self.horizontal_move:update(current_time_ms)
end
end
function FunassyiBGFever:draw()
local y = self.bg_texture_move.attribute
tex.draw_texture(self._id_bg, { y = y })
tex.draw_texture(self._id_overlay, { x = -self.horizontal_move.attribute, y = y })
tex.draw_texture(self._id_overlay, { x = self.overlay_width - self.horizontal_move.attribute, y = y })
end
function FunassyiBGFever:destroy()
tex.unload_folder(COLLAB_PATH, "bg_fever/" .. self.name)
end
-- Background
local FunassyiBackground = {}
FunassyiBackground.__index = FunassyiBackground
function FunassyiBackground.new(player_num, bpm)
local self = setmetatable({}, FunassyiBackground)
self.donbg = DonBG4.new(1, player_num, COLLAB_PATH)
self.bg_normal = BGNormal.Base.new(0, COLLAB_PATH)
self.bg_fever = FunassyiBGFever.new()
-- funassyi ships no footer/fever/renda art; use inert stubs.
self.footer = Footer.new(COLLAB_PATH, -1)
self.fever = {
start = function() end, stop = function() end,
update = function() end, draw = function() end,
is_visible = function() return false end,
alpha = function() return 0 end, destroy = function() end,
}
self.dancer = Dancer.BaseDancerGroup.new(0, bpm, MAX_DANCERS, COLLAB_PATH)
self.renda = {
add_renda = function() end, update = function() end,
draw = function() end, destroy = function() end,
}
self.chibi = ChibiController.new(bpm, COLLAB_PATH, 0)
self.is_clear = false
self.is_rainbow = false
-- reference dance_b_* count model
self.dancer_model = DancerModel.new(MAX_DANCERS)
return self
end
function FunassyiBackground:update(current_ms, bpm)
self.donbg:update(current_ms)
self.bg_fever:update(current_ms)
self.fever:update(current_ms, bpm)
self.dancer:update(current_ms, bpm)
self.renda:update(current_ms)
self.chibi:update(current_ms, bpm)
end
function FunassyiBackground:handle_good(player_num) self.chibi:add_chibi(player_num, false) end
function FunassyiBackground:handle_ok(player_num) self.chibi:add_chibi(player_num, false) end
function FunassyiBackground:handle_bad(player_num) self.chibi:add_chibi(player_num, true) end
function FunassyiBackground:handle_drumroll(player_num) self.renda:add_renda() end
function FunassyiBackground:handle_balloon(player_num) end
function FunassyiBackground:handle_gauge(player_num, progress, is_clear, is_rainbow, clear_progress)
self.donbg:set_clear(is_clear)
if is_clear and not self.is_clear then self.bg_fever:start() end
if not is_clear and self.is_clear and self.bg_fever.reset then self.bg_fever:reset() end
if is_rainbow and not self.is_rainbow then self.fever:start() end
if not is_rainbow and self.is_rainbow and self.fever.stop then self.fever:stop() end
self.is_clear = is_clear
self.is_rainbow = is_rainbow
self.dancer_model:apply(self.dancer, progress, is_clear, clear_progress)
end
function FunassyiBackground:draw_back()
if self.is_clear then
if not self.bg_fever.transitioned then
self.bg_normal:draw()
self.bg_fever:draw()
else
self.bg_fever:draw()
end
else
self.bg_normal:draw()
end
self.donbg:draw()
self.renda:draw()
self.dancer:draw()
self.footer:draw()
if self.fever.is_visible and self.fever:is_visible() then self.fever:draw() end
self.chibi:draw()
end
function FunassyiBackground:draw_fore() end
function FunassyiBackground:destroy()
self.donbg:destroy()
self.bg_normal:destroy()
self.bg_fever:destroy()
self.fever:destroy()
self.dancer:destroy()
self.footer:destroy()
self.renda:destroy()
self.chibi:destroy()
end
return FunassyiBackground