mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-26 13:33:27 -04:00
f07ebfe423
CELADON_TM/MON and GOLDENROD_TM/MON stored each Game Corner row as one hand-padded "NAME COST" literal; a translated name of a different length than the English original shifted or overlapped the price that used to be right-aligned by the padding alone. Split each row into a translatable name and the existing numeric cost field, print them as two separate calls (the cost right-aligned against a fixed priceRight column per counter, the same column-aware approach MartMenu.printPriceOpaque already uses), and clamp the name to the tile budget before the price column with Font.split (glyph-aware, so a <PK><MN> macro or multi-byte UTF-8 character -- including one whose expansion straddles the clamp boundary -- is never cut mid-sequence). TEXTS (SlotMachine.lua) kept a hand-typed English line array next to each entry's Strings.source() template; derive the array from source once at load instead, and cache localizedLines()'s parsed split per source table so the bet/result screens do not re-run the same gmatch split every draw() call. ContestMenu.TEXT.alreadyCaught's line split now uses the same gmatch loop the rest of this file's line-parsing already uses (an anchored ^(.-)\n(.*)$ match assumed exactly one \n and left a nil hole when a translation merges the two lines into one clause). Four of PrizeMenu.TEXTS' Game Corner vendor messages (Celadon's and Goldenrod's prize-vendor intros, Goldenrod's quit line, and the coin vendor's no-COIN-CASE refusal) used \f where the real cart text (poke-corpus GoldSilver, e.g. gs.CeladonGameCornerPrizeRoom. CeladonPrizeRoom_PrizeVendorIntroText) ends in \v: a plain page clear instead of a scroll, so the vendor's last line appeared alone with no lead-in instead of continuing under the previous one. Found and confirmed against the corpus while auditing this branch for the same class of bug as CenterPcMenu.lua's \n-vs-\v fix.
87 lines
2.8 KiB
Lua
87 lines
2.8 KiB
Lua
-- StartMenu:draw drew the OPTION row's description tooltip, the "Change
|
|
-- settings" box under the list, with a raw love.graphics.rectangle at a
|
|
-- flat literal white, never touching GbcPalette. Every other box on this
|
|
-- screen already recoloured correctly with a picked COLORS palette, so
|
|
-- this one sub-region stood out as structurally white/black regardless.
|
|
--
|
|
-- No real shader runs headless, so this can't check a rendered pixel, same
|
|
-- limitation every palette test in this directory notes: force
|
|
-- GbcPalette.available() true and assert on which seam gets called, not
|
|
-- on pixels. tests/drivers/custom_ramp_probe.lua is where a real rendered
|
|
-- screen gets checked by eye.
|
|
package.path = "./?.lua;./?/init.lua;" .. package.path
|
|
|
|
local T = require("tests.harness")
|
|
|
|
love = require("tests.love_stub")
|
|
|
|
require("src.core.Logger").warn = function() end
|
|
|
|
local GbcPalette = require("src.render.GbcPalette")
|
|
local StartMenu = require("src.ui.gen2.StartMenu")
|
|
local Strings = require("src.core.Strings")
|
|
|
|
local calls
|
|
local function spy(name)
|
|
local original = GbcPalette[name]
|
|
GbcPalette[name] = function(...)
|
|
calls[name] = (calls[name] or 0) + 1
|
|
return original(...)
|
|
end
|
|
end
|
|
|
|
-- Minimal fake: draw() only needs #self.items (box height), a list stub,
|
|
-- and a current item with a desc, the same shape start_menu.asm carries
|
|
-- for every row (see StartMenu.lua's ITEMS table).
|
|
local function fakeMenu()
|
|
return {
|
|
items = { { id = "option" } },
|
|
list = {
|
|
draw = function() end,
|
|
current = function() return { desc = { "Change", "settings" } } end,
|
|
},
|
|
phase = nil,
|
|
showDescription = true,
|
|
}
|
|
end
|
|
|
|
do
|
|
GbcPalette.available = function() return true end
|
|
GbcPalette.setCustomRamp({ { 255, 0, 255 }, { 200, 0, 200 }, { 100, 0, 100 },
|
|
{ 0, 0, 0 } })
|
|
calls = {}
|
|
spy("resolve"); spy("use"); spy("with")
|
|
StartMenu.draw(fakeMenu())
|
|
T.check((calls.resolve or 0) > 0 or (calls.use or 0) > 0 or (calls.with or 0) > 0,
|
|
"StartMenu's description tooltip reaches the GbcPalette seam")
|
|
end
|
|
|
|
do
|
|
GbcPalette.available = function() return false end
|
|
calls = {}
|
|
spy("resolve"); spy("use"); spy("with")
|
|
local ok = pcall(StartMenu.draw, fakeMenu())
|
|
T.check(ok, "StartMenu:draw() does not error with no shader available")
|
|
end
|
|
|
|
do
|
|
Strings.load({ strings = {
|
|
["Change\nsettings"] = "Modifier les\nreglages",
|
|
} })
|
|
local save = { party = {}, inventory = {}, options = {} }
|
|
local menu = StartMenu.new({ save = save }, {
|
|
save = save,
|
|
unlocked = { pack = true },
|
|
})
|
|
local option
|
|
for _, item in ipairs(menu.items) do
|
|
if item.value == "option" then option = item end
|
|
end
|
|
T.check(option and option.desc[1] == "Modifier les"
|
|
and option.desc[2] == "reglages",
|
|
"START descriptions use one complete multiline key before splitting")
|
|
Strings.load({})
|
|
end
|
|
|
|
T.finish()
|