mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-26 13:33:27 -04:00
50b29ad83e
messagePages() only split on \n (line) and \f (paragraph), so a translated
message needing a \v scroll-continue break -- the same marker PackMenu and
PrizeMenu's messages already rely on via CommonText.pages -- rendered wrong
here: no line ever scrolled. Delegate to CommonText.pages, the same shared
page-break implementation PackMenu and PrizeMenu already use for their own
messages, instead of a second, incomplete reimplementation local to this
file.
CommonText.pages() also only treats \n as the box's second row, not a page
break, unlike the old local messagePages(), which grouped every two
\n-separated lines into a page regardless of \f. The one BOX_FAILURE_SOURCES
literal with a third line via a second bare \n ("You'll need a\nPOKéMON to
call\nwith.") needed \f instead, the marker every other multi-page message
in this file already uses for the same transition (see RELEASED just
above); pinned with a test.
CenterPcMenu.lua's own TEXT.noMon had the identical \n-vs-\v bug: the
Pokecenter PC's empty-party refusal (_PokecenterPCCantUseText, "ends in
cont" per the comment already on this line) needs \v to scroll "have a #MON
to" up and land "use this!" under it, not a third bare \n line, which
pagesOf() (this screen's own \f/\v-aware paginator, unaffected by the
messagePages() bug above) renders as a lone one-line page instead -- caught
by gen1recomp/dev's own independent fix to the same line while rebasing this
branch onto dev, and confirmed against tests/gen2_pc_screens_test.lua's
scroll assertions. The French/German/Spanish/Italian/Japanese/Korean
overrides already carry the correct \v in their translated values; only the
lookup key needed the same fix, made in gen1recomp-translation-mods
alongside this commit.
22 lines
1.1 KiB
Lua
22 lines
1.1 KiB
Lua
-- BoxMenu.lua's messagePages() used to split only on \n/\f, grouping every
|
|
-- two \n-separated lines into a page regardless of \f; switching it to
|
|
-- CommonText.pages() (shared with PackMenu/PrizeMenu) fixed the missing \v
|
|
-- handling but exposed that CommonText.pages() treats a bare \n only as the
|
|
-- box's second row, not a page break -- a THIRD line needs \f (or \v), not a
|
|
-- second bare \n, or it gets glued onto the second line with no separator.
|
|
-- This pins the one BOX_FAILURE_SOURCES literal that used to rely on the old
|
|
-- "every two \n lines is a page" behavior.
|
|
package.path = "./?.lua;./?/init.lua;" .. package.path
|
|
|
|
local T = require("tests.harness")
|
|
local CommonText = require("src.core.gen2.CommonText")
|
|
|
|
local pages = CommonText.pages("You'll need a\nPOKéMON to call\fwith.")
|
|
T.eq(#pages, 2, "the message splits into two pages")
|
|
T.eq(pages[1][1], "You'll need a", "page 1 top row")
|
|
T.eq(pages[1][2], "POKéMON to call", "page 1 bottom row")
|
|
T.eq(pages[2][1], "with.", "page 2 top row, not glued onto page 1's bottom row")
|
|
T.eq(pages[2][2], nil, "page 2 has no second row")
|
|
|
|
T.finish("box_menu_message_pages_test")
|