204 lines
7.1 KiB
Lua
204 lines
7.1 KiB
Lua
-- YataiDON-HSS override of PyTaikoGreen/background/bg_collabs/oshiri.lua: bg tile step/scroll period use bg_texture.x2[1] (no extra *sc)
|
|
local DonBGBase = require("background/bg_objects/donbg/base")
|
|
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/oshiri"
|
|
local MAX_DANCERS = 5
|
|
|
|
-- Custom DonBG: 16*scale wide tiled background + 3 overlay rows per tile
|
|
local OshiriDonBG = setmetatable({}, { __index = DonBGBase })
|
|
OshiriDonBG.__index = OshiriDonBG
|
|
|
|
function OshiriDonBG.new(player_num)
|
|
local self = setmetatable({}, OshiriDonBG)
|
|
local base = DonBGBase.new(1, player_num, COLLAB_PATH)
|
|
for k, v in pairs(base) do self[k] = v end
|
|
local bg_width = self.bg_texture and self.bg_texture.x2[1] or 0
|
|
local sc = tex.get_screen_scale()
|
|
self.move = anim.move(20000, { total_distance = -bg_width * 8, loop = true })
|
|
self._id_overlay = tex.get_texture(COLLAB_PATH .. "/" .. self.name .. "/overlay") or 0
|
|
return self
|
|
end
|
|
|
|
function OshiriDonBG:draw_textures(fade, y, frame)
|
|
local sc = tex.get_screen_scale()
|
|
local bg_width = self.bg_texture and self.bg_texture.x2[1] or 0
|
|
for i = 0, math.floor(16 * sc) - 1 do
|
|
tex.draw_texture(self._id_bg, {
|
|
frame = frame,
|
|
fade = fade,
|
|
x = (i * bg_width) + self.move.attribute,
|
|
y = y
|
|
})
|
|
for j = 0, 2 do
|
|
tex.draw_texture(self._id_overlay, {
|
|
frame = frame,
|
|
fade = fade,
|
|
x = (i * bg_width) + self.move.attribute,
|
|
y = y + (j * 70 * sc)
|
|
})
|
|
end
|
|
end
|
|
end
|
|
|
|
-- BGFever: looping 3-frame overlay; immediately transitioned on start
|
|
local OshiriBGFever = {}
|
|
OshiriBGFever.__index = OshiriBGFever
|
|
|
|
function OshiriBGFever.new()
|
|
local self = setmetatable({}, OshiriBGFever)
|
|
self.name = "bg_fever_0"
|
|
tex.load_folder(COLLAB_PATH, "bg_fever/" .. self.name)
|
|
self.transitioned = false
|
|
self.overlay_texture_change = anim.texture_change(2049, {
|
|
{ 0, 683, 0 }, { 683, 1366, 1 }, { 1366, 2049, 2 }
|
|
}, { loop = true })
|
|
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 OshiriBGFever:start()
|
|
self.transitioned = true
|
|
end
|
|
|
|
function OshiriBGFever:update(current_time_ms)
|
|
self.overlay_texture_change:update(current_time_ms)
|
|
end
|
|
|
|
function OshiriBGFever:draw()
|
|
tex.draw_texture(self._id_bg)
|
|
tex.draw_texture(self._id_overlay, { frame = self.overlay_texture_change.attribute })
|
|
end
|
|
|
|
function OshiriBGFever:destroy()
|
|
tex.unload_folder(COLLAB_PATH, "bg_fever/" .. self.name)
|
|
end
|
|
|
|
-- Custom DancerGroup: fixed variant assignment (0, 1, 1, 1, 1), no shuffle
|
|
local OshiriDancerGroup = setmetatable({}, { __index = Dancer.BaseDancerGroup })
|
|
OshiriDancerGroup.__index = OshiriDancerGroup
|
|
|
|
function OshiriDancerGroup.new(bpm)
|
|
local self = setmetatable({}, OshiriDancerGroup)
|
|
self.name = "dancer_0"
|
|
self.active_count = 0
|
|
self.path = COLLAB_PATH
|
|
tex.load_folder(COLLAB_PATH, "dancer/" .. self.name)
|
|
self.spawn_positions = { 2, 1, 3, 0, 4 }
|
|
self.active_dancers = {}
|
|
self.max_dancers = MAX_DANCERS
|
|
local BaseDancer = Dancer.Base
|
|
self.dancers = {
|
|
BaseDancer.new(self.name, 0, bpm, self.path),
|
|
BaseDancer.new(self.name, 1, bpm, self.path),
|
|
BaseDancer.new(self.name, 1, bpm, self.path),
|
|
BaseDancer.new(self.name, 1, bpm, self.path),
|
|
BaseDancer.new(self.name, 1, bpm, self.path),
|
|
}
|
|
self.needs_initial_dancer = true
|
|
return self
|
|
end
|
|
|
|
function OshiriDancerGroup:update(current_time_ms, bpm)
|
|
if self.needs_initial_dancer then
|
|
self.needs_initial_dancer = false
|
|
self:add_dancer()
|
|
end
|
|
Dancer.BaseDancerGroup.update(self, current_time_ms, bpm)
|
|
end
|
|
|
|
-- Background
|
|
|
|
local OshiriBackground = {}
|
|
OshiriBackground.__index = OshiriBackground
|
|
|
|
function OshiriBackground.new(player_num, bpm)
|
|
local self = setmetatable({}, OshiriBackground)
|
|
self.donbg = OshiriDonBG.new(player_num)
|
|
self.bg_normal = BGNormal.Base.new(0, COLLAB_PATH)
|
|
self.bg_fever = OshiriBGFever.new()
|
|
self.footer = Footer.new(COLLAB_PATH, 0)
|
|
-- class Fever3, folder fever_0
|
|
self.fever = Fever.Fever3.new(0, bpm, COLLAB_PATH)
|
|
self.dancer = OshiriDancerGroup.new(bpm)
|
|
self.renda = RendaController.new(COLLAB_PATH, 0)
|
|
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 OshiriBackground: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 OshiriBackground:handle_good(player_num) self.chibi:add_chibi(player_num, false) end
|
|
|
|
function OshiriBackground:handle_ok(player_num) self.chibi:add_chibi(player_num, false) end
|
|
|
|
function OshiriBackground:handle_bad(player_num) self.chibi:add_chibi(player_num, true) end
|
|
|
|
function OshiriBackground:handle_drumroll(player_num) self.renda:add_renda() end
|
|
|
|
function OshiriBackground:handle_balloon(player_num) end
|
|
|
|
function OshiriBackground: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 OshiriBackground: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 OshiriBackground:draw_fore() end
|
|
|
|
function OshiriBackground: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 OshiriBackground
|