ResultPlayer = {} ResultPlayer.__index = ResultPlayer local GAUGE_SCALE = 0.7 -- arcade places tamashii_gage at 0.7 on the result board local CLEAR_LABEL_X = { 513, 580, 658, 1460, 1527, 1605 } local CLEAR_LABEL_Y = 232 local GAUGE_CELLS = 50 -- the cabinet's gauge is 50 cells (kMaxGage_), like the game HUD local GAUGE_UNIT = 21 * GAUGE_SCALE -- one 21 px cell of the groove, at the board's 0.7 local OPTION_PITCH = 43 local FRAME_MS = 1000 / 120 local WAIT_GAUGE_MS = 100 * FRAME_MS -- 833.3 fade-in done -> gauge starts filling local GAUGE_MS_UNIT = 7 * FRAME_MS -- 58.33 ms per cell local WAIT_SCORE_MS = 100 * FRAME_MS -- 833.3 gauge full -> score display local SCORE_TO_CROWN = 500 * FRAME_MS -- 4166.7 UpdateScore state length local CROWN_TO_ACTION = 150 * FRAME_MS -- 1250.0 Crown state length local RANK_STATE_MS = 77.5 * (1000 / 60) -- 1291.7 ScoreRank state length (direct feed 9IFeX9JifHE: rank plate 9.29 s -> crown 10.58 s) local ClipPlayer = require("game/clip_player") require("global/course_guide") require("result/result_medal") -- score_rank_mc / score_rank_kiwami_mc placements inside the 1920x1080 result stage local RANK_POS = { L = { 181.1, 500.7 }, R = { 1126.9, 501.0 } } local KIWAMI_POS = { L = { 198.1, 505.7 }, R = { 1144.0, 506.0 } } local RANK_SHAPES = { 74, 76, 78, 80, 82, 84, 86 } -- rank 1..7 plates inside score_rank local RANK_THRESHOLDS = { 500000, 600000, 700000, 800000, 900000, 950000, 1000000 } local function rank_of(score) local r = 0 for i, t in ipairs(RANK_THRESHOLDS) do if score >= t then r = i end end return r end -- the score_rank clip for rank 1..7 at this seat (nil when it can't load) local function rank_clip(rank, is_2p) local side = is_2p and "R" or "L" local pos = (rank == 7) and KIWAMI_POS[side] or RANK_POS[side] local clip = (rank == 7) and "rank_result_kiwami" or "rank_result" local obj = ClipPlayer.new("game/ending_anim/" .. clip, "game", clip .. "_anim", pos[1], pos[2]) if obj then obj.hold_last = true if rank < 7 then obj.shape_map = { [74] = RANK_SHAPES[rank], [76] = RANK_SHAPES[rank] } end -- clip uses plate 74 then 76 end return obj end local function lerp(f, f0, f1, v0, v1) if f <= f0 then return v0 end if f >= f1 then return v1 end return v0 + (v1 - v0) * (f - f0) / (f1 - f0) end local function ease_in(u) return u * u end local function ease_out(u) return 1 - (1 - u) ^ 2 end local function success_fade_alpha(t0, now_ms) if not t0 then return nil end return lerp((now_ms - t0) * 0.06, 0, 9, 0, 1) end -- Fever flame: cel 0 grows in over 4 frames, then cels 1..7 cycle every 3 frames from frame 13 -- until frame 34, where the loop restarts at frame 10. local FIRE_START, FIRE_LOOP, FIRE_END = 1, 10, 34 local FIRE_SHEEN_A = 0.6016 -- flame cel, alpha and sheen alpha at (now - t0) ms since the gauge maxed local function fire_state(t0, now_ms) if not t0 or t0 < 0 then return nil end local f = FIRE_START + (now_ms - t0) * 0.06 if f < FIRE_LOOP then return 0, ease_out(lerp(f, 1, 5, 0, 1)), lerp(f, 1, 5, 0, FIRE_SHEEN_A) end f = FIRE_LOOP + (f - FIRE_LOOP) % (FIRE_END - FIRE_LOOP) local sheen = ((math.floor(f) - FIRE_LOOP) % 4 < 2) and FIRE_SHEEN_A or 0.0 return math.min(7, math.floor((f - FIRE_LOOP) / 3)), 1.0, sheen end -- a row pops from the frame it lands on: curve(frame) until frame f1, then rest at 1 local function pop_scale(curve, f0, f1, land_ms, now_ms) if not land_ms then return 1.0 end local f = f0 + (now_ms - land_ms) * 0.06 if f > f1 then return 1.0 end return curve(f) end local function judge_pop(f) return lerp(f, 25, 29, 1.3, 1) end local function score_pop(f) if f < 31 then return 0.9 + 0.5 * ease_out((f - 25) / 6) end if f < 36 then return 1.4 - 0.4 * ease_in((f - 31) / 5) end if f < 40 then return 1.0 - 0.1 * ease_in((f - 36) / 4) end return 0.9 + 0.1 * ease_out((f - 40) / 4) end function ResultPlayer.new(player_num, is_2p, has_2p, gauge_length, difficulty, selected_difficulty, crown_type, score_diff, score_method, mod_display, mod_inverse, mod_random, mod_speed) local self = setmetatable({}, ResultPlayer) self.player_num = player_num -- seat is the actual cabinet seat (player_num), not `is_2p`: result.cpp always passes -- is_2p=false, so a single player seated as P2 must still get the 2P board/Don/nameplate. self.right = self.player_num == 2 local timing = tex.timing_offset(player_num) if timing then self.timing_text = text.create_raw_text(timing, 20 * tex.get_screen_scale(), {255, 255, 255, 255}, {0, 0, 0, 255}, false, 3.0) end self.is_2p = is_2p self.has_2p = has_2p self.gauge_length = gauge_length self.gauge_cells = math.floor(gauge_length * GAUGE_CELLS / 87 + 1e-4) -- 87-unit display -> 50-cell gauge self.difficulty = difficulty self.selected_difficulty = selected_difficulty self.crown_type = crown_type self.score_diff = score_diff self.score_method = score_method self.mod_display = mod_display self.mod_inverse = mod_inverse self.mod_random = mod_random self.mod_speed = mod_speed local ART = { [0] = 0, [1] = 1, [2] = 1, [3] = 2 } local NORMA = { [0] = 6000, [1] = 7000, [2] = 7000, [3] = 8000 } local d = math.min(math.max(difficulty, 0), 3) self.art_index = ART[d] self.norma = NORMA[d] if gauge_length == 87 then self.gauge_state = 2 elseif gauge_length / 87.0 * 10000.0 >= self.norma - 0.5 then self.gauge_state = 1 else self.gauge_state = 0 end if self.art_index >= 2 then self.diff_str = "_hard" elseif self.art_index >= 1 then self.diff_str = "_normal" else self.diff_str = "_easy" end local p = tostring(player_num) .. "p" self.player_str = p self.score, self.good, self.ok, self.bad, self.max_combo, self.total_drumroll = "", "", "", "", "", "" self.fade_in_finished_flag = false self.gauge_started = false self.gauge_start_ms = -1 self.gauge_shown = 0 -- cells currently filled (animates up to gauge_cells) self.gauge_done = false self.score_delay = nil self.fade_in_started = false -- read by C++: starts the score roll self.rainbow_start_ms = -1.0 self.rainbow_frac = 0.0 self.crown_at = nil self.msg_at = nil -- MoveResultAction: message bubble + success backdrop + Don pose self.skipped = false self.reveal_end_ms = 0 self.count_up_instant = true self.count_up_row_ms = 50 * FRAME_MS self.count_up_score_ms = 100 * FRAME_MS self.count_up_row_sound = "count_stop" self.count_up_score_sound = "don_big" self.count_up_sound_1p_only = true self.seat_c = has_2p and (is_2p and "_r" or "_l") or "_c" self.seat_lr = self.right and "_r" or "_l" self.count_loop_on = false self.achieve_played = false self.skip_don_big_played = false -- per-row landing times, for the arcade digit pop (see draw_score_info / draw_total_score) self.row_land_ms = {} self.score_land_ms = nil self.crown_obj = nil self.crown_msg_obj = nil self.high_score_obj = nil self.fade_in_bottom = tex.get_animation(1, "result") -- success bg fade (fallback) self.tamashii_fire = tex.get_animation(20, "result") -- background success overlay (1P full / 2P halves) self.t_success = tex.get_texture(has_2p and "result/background/footer_2p" or "result/background/footer_1p") -- board self.t_board = tex.get_texture("result/score/overlay") -- frames: 0 = left board, 1 = right board self.t_difficulty = tex.get_texture("result/score/difficulty") -- 5 frames + course name self.t_opt_bg = tex.get_texture("result/score/mod_sanbai") -- option pill, frame = icon count-1 self.t_mod_doron = tex.get_texture("result/score/mod_doron") self.t_mod_abekobe = tex.get_texture("result/score/mod_abekobe") self.t_mod_kimagure = tex.get_texture("result/score/mod_kimagure") self.t_mod_detarame = tex.get_texture("result/score/mod_detarame") self.t_mod_speed = tex.get_texture("result/score/mod_baisaku") -- 14 frames x1.1 .. x4 self.t_judge_labels = tex.get_texture("result/score/max_combo") -- whole 良/可/不可/連打数/最大コンボ数 block (ja/en) self.t_judge_num = tex.get_texture("result/score/judge_num") self.score_lbl = text.create_text("result_score_text", { 255, 255, 255, 255 }, { 0, 0, 0, 0 }, false, 0, 0) self.t_score_num = tex.get_texture("result/score/score_num") self.t_donback = tex.get_texture("result/bottom/chara_0") -- frames: 0 = 1P red, 1 = 2P blue -- gauge (HUD bakes, drawn at 0.7) self.t_gauge_unfilled = tex.get_texture("result/gauge/" .. p .. "_unfilled" .. self.diff_str) self.t_gauge_bar = tex.get_texture("result/gauge/" .. p .. "_bar") self.t_gauge_rainbow = tex.get_texture("result/gauge/rainbow" .. self.diff_str) self.t_gauge_overlay = tex.get_texture("result/gauge/overlay" .. self.diff_str) local clear_lbl = tex.skin_text("gauge_clear_label") local function clear_text(fill) return text.create_raw_text(clear_lbl, 24, fill, { 0, 0, 0, 255 }, false, 4, 2.0, 1.0) end self.gauge_clear_text = clear_text({ 255, 255, 255, 255 }) self.gauge_clear_text_dark = clear_text({ 128, 128, 128, 255 }) self.t_gauge_bar_clear_transition = tex.get_texture("result/gauge/bar_clear_transition") self.t_gauge_bar_clear_top = tex.get_texture("result/gauge/bar_clear_top") self.t_gauge_bar_clear_bottom = tex.get_texture("result/gauge/bar_clear_bottom") self.t_gauge_tamashii = tex.get_texture("result/gauge/tamashii") self.t_gauge_tamashii_dark = tex.get_texture("result/gauge/tamashii_dark") self.t_gauge_tamashii_fire = tex.get_texture("result/gauge/tamashii_fire") self.t_gauge_tamashii_overlay = tex.get_texture("result/gauge/tamashii_overlay") -- digit pitches are fixed by the arcade digit MCs (digit4 pitch 31, digit7 pitch 46), not skin_config self.sc_score_info_margin = 31 self.sc_result_score_margin = 46 -- option icon list (arcade order: speed, doron, abekobe, random) self.options = {} if mod_speed > 10 then local speeds = { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30, 35, 40 } local best, bi = 1e9, 1 for i, s in ipairs(speeds) do if math.abs(s - mod_speed) < best then best, bi = math.abs(s - mod_speed), i end end table.insert(self.options, { self.t_mod_speed, bi - 1 }) end if mod_display then table.insert(self.options, { self.t_mod_doron, 0 }) end if mod_inverse then table.insert(self.options, { self.t_mod_abekobe, 0 }) end if mod_random == 1 then table.insert(self.options, { self.t_mod_kimagure, 0 }) elseif mod_random == 2 then table.insert(self.options, { self.t_mod_detarame, 0 }) end return self end -- Z-DON AI battle: the AI's half of the result is silent function ResultPlayer:sfx(name, preset, loop) if self.is_2p and tex.ai_active and tex.ai_active() then return end audio.play_sound(name, preset, loop) end function ResultPlayer:update(current_ms, fade_in_finished, score, good, ok, bad, max_combo, total_drumroll, is_skipped) self.fade_in_finished_flag = fade_in_finished self.now_ms = current_ms local prev = { self.good, self.ok, self.bad, self.total_drumroll, self.max_combo } self.score, self.good, self.ok, self.bad = score, good, ok, bad local ai = require("global.ai_battle") if ai.up and ai.up.screen == "AI_RESULT" and tonumber(score) then ai.up.total_score = tonumber(score) end -- YataiDON's detail page self.max_combo, self.total_drumroll = max_combo, total_drumroll local now_rows = { good, ok, bad, total_drumroll, max_combo } -- a failed song (gauge under the clear mark): once the last row has landed the Don drops to the tinted miss pose -- (direct feed 2EWGAtPd0MM: the failed result's Don is the dark blue one) for i = 1, 5 do if prev[i] == "" and now_rows[i] ~= "" and not self.row_land_ms[i] then self.row_land_ms[i] = current_ms end end if self.score ~= "" and not self.score_land_ms then self.score_land_ms = current_ms end -- isEffectSkip_ (ResultMain): every remaining state collapses at once. if is_skipped and not self.skipped then self.skipped = true self.gauge_shown = self.gauge_cells if self.count_loop_on then self.count_loop_on = false if audio.stop_sound then audio.stop_sound("count_up_loop" .. self.seat_c) end end if self.player_num == 1 and not self.skip_don_big_played then self.skip_don_big_played = true audio.play_sound("don_big", "sound") end end -- AI battle (screen option ai_result_reveal_at_once): the gauge is already full when the board comes up -- and everything else lands together (arcade capture MBAZD6xA1D8) if self.ai_once == nil then self.ai_once = (tex.get_option("ai_result_reveal_at_once") and tex.ai_active and tex.ai_active()) and true or false end if (fade_in_finished or self.ai_once) and not self.gauge_started then self.gauge_started = true self.gauge_start_ms = current_ms self.tamashii_fire:start() end if self.gauge_started then self.tamashii_fire:update(current_ms) local target = self.gauge_cells -- WaitUpdateTamashiiGage: 100 frames of nothing, then 7 frames per arcade unit local elapsed = current_ms - self.gauge_start_ms - WAIT_GAUGE_MS if self.skipped or self.ai_once then self.gauge_shown = target elseif elapsed > 0 then if not self.count_loop_on and not self.gauge_done then self.count_loop_on = true self:sfx("count_up_loop" .. self.seat_c, "sound", true) end self.gauge_shown = math.min(target, math.floor(elapsed / GAUGE_MS_UNIT)) if not self.achieve_played and self.gauge_state == 2 and self.gauge_shown >= GAUGE_CELLS then self.achieve_played = true self:sfx("achieve_tamashii" .. self.seat_lr, "sound") end end if self.gauge_shown >= target and not self.gauge_done and (self.skipped or (elapsed > 0 and not self.ai_once)) then self.gauge_done = true self.score_delay = current_ms + (self.skipped and 0 or WAIT_SCORE_MS) if self.count_loop_on then self.count_loop_on = false if audio.stop_sound then audio.stop_sound("count_up_loop" .. self.seat_c) end end end if self.gauge_state == 2 and self.gauge_shown >= GAUGE_CELLS then if self.rainbow_start_ms < 0 then self.rainbow_start_ms = current_ms end self.rainbow_frac = math.fmod((current_ms - self.rainbow_start_ms) / (1000 / 12), 8.0) end end self.fade_in_bottom:update(current_ms) -- publish the success cross-fade for the live backdrop (1P only) if not self.has_2p then local sfa = success_fade_alpha(self.success_fade_t0, current_ms) or self.fade_in_bottom.attribute __hss_result_bg_clear = (self.gauge_state >= 1) and sfa or 0.0 end if self.score_delay ~= nil and current_ms > self.score_delay and not self.fade_in_started then self.fade_in_started = true self.crown_at = current_ms + SCORE_TO_CROWN self.msg_at = self.crown_at + ((self.gauge_state >= 1) and CROWN_TO_ACTION or 0) end if self.skipped and self.fade_in_started then -- the rank plate lands on its last frame like every other skipped state (no sound), -- once the score it depends on is in if not self.rank_settled and self.score ~= "" then self.rank_settled = true self.rank_done = true local rank = rank_of(math.floor(tonumber(self.score) or 0)) if rank > 0 then self.rank_obj = self.rank_obj or rank_clip(rank, self.right) if self.rank_obj then self.rank_obj:start(current_ms - self.rank_obj.data.nframes * (1000 / 60)) -- clips run at 60 fps end end end self.crown_at = math.min(self.crown_at or current_ms, current_ms) self.msg_at = math.min(self.msg_at or current_ms, current_ms) end if self.crown_at and current_ms >= self.crown_at and not self.rank_done then self.rank_done = true local rank = rank_of(math.floor(tonumber(self.score) or 0)) if rank > 0 then self.rank_obj = rank_clip(rank, self.right) if self.rank_obj then self.rank_obj:start(current_ms) -- se_result `scorerank_NN_`: one sample for every rank, seat like the crown self:sfx("scorerank" .. (self.has_2p and (self.right and "_r" or "_l") or "_c"), "sound") self.crown_at = current_ms + RANK_STATE_MS if self.msg_at then self.msg_at = self.msg_at + RANK_STATE_MS end end end end -- Crown state entry: StartCrownDisplay (crownMc_ GotoAndPlay "start" + crown__c) if self.crown_at and current_ms >= self.crown_at and self.gauge_state >= 1 and not self.crown_obj then self.crown_obj = ResultCrown.new(self.crown_type, self.right, self.has_2p) if self.crown_type == 1 or self.crown_type == 2 then self:sfx("full_combo_voice_" .. tostring(self.player_num) .. "p", "voice") end end if self.crown_obj then self.crown_obj:update(current_ms) end if self.msg_at and current_ms >= self.msg_at and not self.crown_msg_obj then local frame if self.gauge_state == 2 then frame = 3 -- perfect elseif self.gauge_state >= 1 then frame = 2 -- success elseif self.gauge_length > 87 * 0.3 then frame = 1 -- near else frame = 0 end -- miss self.crown_msg_obj = ResultCrownMessage.new(frame, self.right) local voices = { [0] = "max_fail_voice_", [1] = "fail_voice_", [2] = "clear_voice_", [3] = "max_clear_voice_" } self:sfx(voices[frame] .. tostring(self.player_num) .. "p", "voice") if self.gauge_state >= 1 then self.fade_in_bottom:start() -- success background self.success_fade_t0 = current_ms self:sfx("atmos_clear" .. self.seat_c, "sound") end end if self.crown_msg_obj then self.crown_msg_obj:update(current_ms) end if self.reveal_end_ms == 0 and self.msg_at and current_ms >= self.msg_at then self.reveal_end_ms = self.msg_at end -- DisplayHiscoreEffect runs inside the same branch that lands the total score. if not self.high_score_obj and self.score_diff > 0 and self.score ~= "" then self.high_score_obj = HighScoreIndicator.new(self.score_diff, self.right) end if self.high_score_obj then self.high_score_obj:update(current_ms) end end function ResultPlayer:draw() -- Z-DON AI battle: the AI's half is the cabinet's VS panel, not a board if self.player_num == 2 and require("global.ai_battle").active() then require("global.ai_battle").draw_result(self.rank_done == true) return end local p_idx = self.right and 1 or 0 -- success background cross-fade local success_a = success_fade_alpha(self.success_fade_t0, tex.get_current_ms()) or self.fade_in_bottom.attribute -- (not in an AI battle: the cabinet's result background shows behind the board) if self.gauge_state >= 1 and success_a > 0 and self.t_success and not require("global.ai_battle").plain_result() then tex.draw_texture(self.t_success, { frame = self.has_2p and p_idx or 0, index = p_idx, fade = success_a }) end -- board frame (opaque white body), then the red/blue donback panel on top of it, then the difficulty tab if self.t_board then tex.draw_texture(self.t_board, { frame = p_idx, index = p_idx }) end if self.t_donback then tex.draw_texture(self.t_donback, { frame = p_idx, index = p_idx }) end if self.timing_text then local info = tex.get_texture_info("bottom", "chara_0") if info and info.x[p_idx + 1] then local pad = 6 * tex.get_screen_scale() self.timing_text:draw({ x = info.x[p_idx + 1] + pad, y = info.y[p_idx + 1] + pad }) end end if self.t_difficulty then tex.draw_texture(self.t_difficulty, { frame = self.selected_difficulty, index = p_idx }) end -- option icons if #self.options > 0 then if self.t_opt_bg then tex.draw_texture(self.t_opt_bg, { frame = #self.options - 1, index = p_idx }) end for i, o in ipairs(self.options) do if o[1] then tex.draw_texture(o[1], { frame = o[2], x = (i - 1) * OPTION_PITCH, index = p_idx }) end end end -- judge table labels if self.t_judge_labels then tex.draw_texture(self.t_judge_labels, { index = p_idx }) end self:draw_score_info() self:draw_total_score() if self.high_score_obj then self.high_score_obj:draw() end if self.rank_obj then self.rank_obj:draw(tex.get_current_ms()) end if self.crown_obj then self.crown_obj:draw() end -- (not in an AI battle: the direct feed has no comment bubble; the win-count window takes that spot) if self.crown_msg_obj and not require("global.ai_battle").plain_result() then self.crown_msg_obj:draw() end -- Z-DON AI battle: the match result, drawn by the last board (2P) so neither board covers it if self.player_num == 2 then require("global.ai_battle").draw_result(self.rank_done == true) end end local CHARA_SCALE = 0.865 -- direct feed: drum ~236 x 190 px; the model drawn at 1.0 is ~274 x 228 local CHARA_X = 238 local CHARA_Y = 919 local CHARA_X_2P = 1682 function ResultPlayer:chara_pos() if self.player_num == 2 and require("global.ai_battle").active() then return { -4000, -4000, 0.01 } end return { self.right and CHARA_X_2P or CHARA_X, CHARA_Y, CHARA_SCALE } end -- P2's Don is mirrored so both Dons face inward (Nijiiro-specific; other skins leave this unset). function ResultPlayer:chara_mirror() return self.right end local NAMEPLATE_X = 2 local NAMEPLATE_Y = 922 local NAMEPLATE_X_2P = 1509 function ResultPlayer:nameplate_pos() if self.player_num == 2 and require("global.ai_battle").active() then return { -4000, -4000, 0 } end return { self.right and NAMEPLATE_X_2P or NAMEPLATE_X, NAMEPLATE_Y } end -- Song number, title and subtitle across the top of the screen. info = { title, subtitle, number }; -- subtitle is "" when the chart hides it. local WHITE, BLACK, RED = { 255, 255, 255, 255 }, { 0, 0, 0, 255 }, { 255, 0, 0, 255 } local SONG_FONT = "FOT-Seurat_Pro_B.otf" -- song number / max, the game HUD's face (MS UI Gothic record) local function cached_text(self, slot, str, size, color, thickness, font, max_w) local key = str .. "\0" .. size .. "\0" .. (font or "") local entry = self._song_info_texts[slot] if not entry or entry.key ~= key then local t = text.create_raw_text(str, size, WHITE, color, false, thickness, 2.0, 1.0, font) if max_w and t.width > max_w then -- en / ko "Song N" is wider than the CJK chip it replaces t = text.create_raw_text(str, math.max(12, math.floor(size * max_w / t.width)), WHITE, color, false, thickness, 2.0, 1.0, font) end entry = { key = key, text = t } self._song_info_texts[slot] = entry end return entry.text end -- Z-DON AI battle: the reward windows lie over the Don (drawn after it), on the human's board function ResultPlayer:draw_front() if self.player_num == 1 and require("global.ai_battle").active() then require("global.ai_battle").draw_result_front() elseif self.rank_done and not require("global.ai_battle").active() then local now = tex.get_current_ms() self.guide = self.guide or CourseGuide.new() self.guide_ms = self.guide_ms or now self.guide:draw_confirm(self.right and 1447 or 491, 1035, math.min(1, (now - self.guide_ms) / 500)) if self.medals then self.medal = self.medal or ResultMedal.new(self.medals, self.right) self.medal:draw(self.right and 1447 or 491, 784) end end end -- chip glyph cell origins on the result screen (song select CHIP_L / CHIP_S layout, moved to the arcade result's chip) local CHIP_RL = { y = 20, num_x = 1678, adv = 32, ku_x = 1716.5, me_x = 1748, pad = 6 } local CHIP_RS = { y = 29, num_x = 1823, adv = 24, ku_x = 1854, pad = 5 } function ResultPlayer:draw_song_info(info) self._song_info_texts = self._song_info_texts or {} local s = tex.get_screen_scale() local NUM_X, NUM_Y = 1655, 22 local TITLE_X, TITLE_Y, TITLE_W, TITLE_FONT = 95, 103, 1730, 56 -- strict audit: the arcade title's ink centre is y 97.5 (ours was 76.5) local SUB_Y, SUB_FONT = 109.5, 33 -- "Song {0}": outlined red on the last song of a limited session self.num_cfg = self.num_cfg or tex.get_skin_config("song_num") or { font_size = 0, outline = -1 } local num_cfg = self.num_cfg local fmt = tex.skin_text("song_num") if fmt == "" then fmt = "{0}" end local limit = tex.song_limit() local num = cached_text(self, "number", fmt:gsub("{0}", tostring(info.number)), num_cfg.font_size, (limit > 0 and limit == info.number) and RED or BLACK, num_cfg.outline >= 0 and num_cfg.outline or 5.0, SONG_FONT, 120) -- strict audit (YKjsle7VBCI / MBAZD6xA1D8 1080p): "N曲目" ends at x 1777 (ink), centre y 43; the "M曲" half sits -- on the plate's blue part, its ink ending at 1877 -- strict round 8: the cabinet's chip is its jp_32_DB bitmap glyphs (full-width digits + 曲 / 目; the same baked -- sprites the song select chip uses, copied to result/chip); ja / zh only, other languages keep the text if self._chip_ok == nil then local lang = tex.language() self._chip_l = tex.get_texture("result/chip/chip_l") self._chip_s = tex.get_texture("result/chip/chip_s") self._chip_ok = (type(lang) == "string" and (lang:find("^ja") ~= nil or lang:find("^zh") ~= nil or lang == "tw" or lang == "cn")) and self._chip_l ~= nil and self._chip_s ~= nil end if self._chip_ok then local function digits(t, num_x, adv, y, pad, n) local s = tostring(n) for i = #s, 1, -1 do tex.draw_texture(t, { frame = s:byte(i) - 48, x = math.floor(num_x - adv * (#s - i) - pad + 0.5), y = math.floor(y - pad + 0.5) }) end end digits(self._chip_l, CHIP_RL.num_x, CHIP_RL.adv, CHIP_RL.y, CHIP_RL.pad, info.number) tex.draw_texture(self._chip_l, { frame = 10, x = math.floor(CHIP_RL.ku_x - CHIP_RL.pad + 0.5), y = math.floor(CHIP_RL.y - CHIP_RL.pad + 0.5) }) tex.draw_texture(self._chip_l, { frame = 11, x = math.floor(CHIP_RL.me_x - CHIP_RL.pad + 0.5), y = math.floor(CHIP_RL.y - CHIP_RL.pad + 0.5) }) if limit > 0 then digits(self._chip_s, CHIP_RS.num_x, CHIP_RS.adv, CHIP_RS.y, CHIP_RS.pad, limit) tex.draw_texture(self._chip_s, { frame = 10, x = math.floor(CHIP_RS.ku_x - CHIP_RS.pad + 0.5), y = math.floor(CHIP_RS.y - CHIP_RS.pad + 0.5) }) end else num:draw({ x = 1782 - num.width, y = NUM_Y + 4, fade = 1.0 }) end if limit > 0 and not self._chip_ok then local mx = tex.get_skin_config("song_num_max") or { font_size = 27, outline = 2.0 } local mfmt = tex.skin_text("song_num_max") if mfmt == "" then mfmt = "{0}" end local mt = cached_text(self, "number_max", mfmt:gsub("{0}", tostring(limit)), mx.font_size or 24, BLACK, mx.outline and mx.outline >= 0 and mx.outline or 2.0, SONG_FONT, 88) mt:draw({ x = 1882 - mt.width, y = 45 - mt.height / 2, fade = 1.0 }) end local title = cached_text(self, "title", info.title, TITLE_FONT, BLACK, 5) local title_max = TITLE_W > 0 and TITLE_W or (TITLE_X - 24) local title_scale = (title_max > 0 and title.width > title_max) and title_max / title.width or 1.0 local title_w = title.width * title_scale local title_x = TITLE_W > 0 and TITLE_X + (TITLE_W - title_w) / 2 or TITLE_X - title_w title:draw({ x = title_x, y = TITLE_Y - title.height * title_scale / 2, scale = title_scale, fade = 1.0 }) if info.subtitle ~= "" then local sub = cached_text(self, "subtitle", info.subtitle, SUB_FONT, BLACK, 5) local sub_x = TITLE_W > 0 and TITLE_X + (TITLE_W - sub.width) / 2 or TITLE_X - sub.width sub:draw({ x = sub_x, y = SUB_Y - sub.height / 2, fade = 1.0 }) end end function ResultPlayer:draw_gauge() if self.player_num == 2 and require("global.ai_battle").active() then return end -- Z-DON AI battle if not self.gauge_started then return end local p_idx = self.right and 1 or 0 local scale = GAUGE_SCALE local base_fade = 1.0 local gl_int = self.gauge_shown local clear_pts = { 30, 35, 40 } -- easy / normal+hard / oni norma cells local clear_pt = clear_pts[self.art_index + 1] local u = GAUGE_UNIT if self.t_gauge_unfilled then tex.draw_texture(self.t_gauge_unfilled, { scale = scale, fade = base_fade, index = p_idx }) end if self.gauge_state == 2 and gl_int >= GAUGE_CELLS then if self.t_gauge_rainbow then local fa = math.floor(self.rainbow_frac) % 8 local fb = (fa + 1) % 8 local t = self.rainbow_frac - math.floor(self.rainbow_frac) tex.draw_texture(self.t_gauge_rainbow, { frame = fa, scale = scale, fade = base_fade, index = p_idx }) tex.draw_texture(self.t_gauge_rainbow, { frame = fb, scale = scale, fade = base_fade * t, index = p_idx }) end else if gl_int > 0 and self.t_gauge_bar then local n = math.min(gl_int, clear_pt - 1) tex.draw_texture(self.t_gauge_bar, { scale = scale, x2 = (n - 1) * u, fade = base_fade, index = p_idx }) end if gl_int >= clear_pt - 1 and self.gauge_state >= 1 and self.t_gauge_bar_clear_transition then tex.draw_texture(self.t_gauge_bar_clear_transition, { scale = scale, x = (clear_pt - 1) * u, fade = base_fade, index = p_idx }) end if gl_int > clear_pt and self.gauge_state >= 1 then local extra = (gl_int - clear_pt - 1) * u if self.t_gauge_bar_clear_top then tex.draw_texture(self.t_gauge_bar_clear_top, { scale = scale, x = clear_pt * u, x2 = extra, fade = base_fade, index = p_idx }) end if self.t_gauge_bar_clear_bottom then tex.draw_texture(self.t_gauge_bar_clear_bottom, { scale = scale, x = clear_pt * u, x2 = extra, fade = base_fade, index = p_idx }) end end end if self.t_gauge_overlay then tex.draw_texture(self.t_gauge_overlay, { scale = scale, fade = math.min(0.15, base_fade), index = p_idx }) end local clear_idx = self.art_index + p_idx * 3 if gl_int >= clear_pt - 1 and self.gauge_state >= 1 then self:draw_clear_label(self.gauge_clear_text, clear_idx, scale, base_fade) local fire_sheen = nil if self.gauge_state == 2 and gl_int >= GAUGE_CELLS and self.t_gauge_tamashii_fire then local ff, fa2, sheen_a = fire_state(self.rainbow_start_ms, tex.get_current_ms()) if ff then fire_sheen = sheen_a tex.draw_texture(self.t_gauge_tamashii_fire, { frame = ff, scale = 0.8 * scale, fade = fa2 * base_fade, index = p_idx }) else -- fail-soft: engine animation ladder local fire_f = math.floor(self.tamashii_fire.attribute) tex.draw_texture(self.t_gauge_tamashii_fire, { frame = fire_f, scale = 0.8 * scale, fade = base_fade, index = p_idx }) end end if self.t_gauge_tamashii then tex.draw_texture(self.t_gauge_tamashii, { scale = scale, fade = base_fade, index = p_idx }) end if self.gauge_state == 2 and gl_int >= GAUGE_CELLS and self.t_gauge_tamashii_overlay then if fire_sheen ~= nil then if fire_sheen > 0.0 then tex.draw_texture(self.t_gauge_tamashii_overlay, { scale = scale, fade = math.min(fire_sheen, base_fade), index = p_idx }) end else local f = math.floor(self.tamashii_fire.attribute) if f == 0 or f == 1 or f == 4 or f == 5 then tex.draw_texture(self.t_gauge_tamashii_overlay, { scale = scale, fade = math.min(0.5, base_fade), index = p_idx }) end end end else self:draw_clear_label(self.gauge_clear_text_dark, clear_idx, scale, base_fade) if self.t_gauge_tamashii_dark then tex.draw_texture(self.t_gauge_tamashii_dark, { scale = scale, fade = base_fade, index = p_idx }) end end end function ResultPlayer:draw_clear_label(t, idx, scale, fade) t:draw({ x = CLEAR_LABEL_X[idx + 1], y = CLEAR_LABEL_Y - t.height * scale / 2, scale = scale, fade = fade }) end function ResultPlayer:draw_score_info() -- judge rows top-down: good, ok, bad, drumroll, max combo local scores = { self.good, self.ok, self.bad, self.total_drumroll, self.max_combo } local p_idx = self.right and 1 or 0 for j, s in ipairs(scores) do if s ~= "" and self.t_judge_num then local pop = pop_scale(judge_pop, 25, 29, self.row_land_ms[j], self.now_ms or 0) local n = math.floor(tonumber(s) or 0) local str = tostring(n) for i = 1, #str do local d = tonumber(string.sub(str, #str - i + 1, #str - i + 1)) or 0 tex.draw_texture(self.t_judge_num, { frame = d, x = -((i - 1) * self.sc_score_info_margin), index = (j - 1) + p_idx * 5, scale = pop, center = true, }) end end end end function ResultPlayer:draw_total_score() local p_idx = self.right and 1 or 0 local lbl = self.score_lbl if lbl then -- create_text already offsets it by result_score_text's x / y (the caption's centre) lbl:draw({ x = math.floor(p_idx * 956 - lbl.width / 2 + 0.5), y = math.floor(-lbl.height / 2 + 0.5) }) end if not self.fade_in_finished_flag then return end if self.score ~= "" and self.t_score_num then local pop = pop_scale(score_pop, 25, 44, self.score_land_ms, self.now_ms or 0) local n = math.floor(tonumber(self.score) or 0) local str = tostring(n) -- score_num frames 0..9 outline, 10..19 fill for layer = 0, 10, 10 do for i = 1, #str do local d = tonumber(string.sub(str, #str - i + 1, #str - i + 1)) or 0 tex.draw_texture(self.t_score_num, { frame = d + layer, x = -((i - 1) * self.sc_result_score_margin), index = p_idx, scale = pop, center = true, }) end end end end