mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-19 04:06:10 +02:00
CLOSES #1418
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
-- Gold VOID FILL (#1418): FADE (each map's own border, dissolving across a
|
||||
-- boundary), WATER, TREES, or BLACK. Parks you on Cherrygrove zoomed out so
|
||||
-- the void is most of the window, cycles the four modes, then hands the pad
|
||||
-- over. Do not add POKEPORT_SPEED: the water anim and the dissolve both run
|
||||
-- on the real clock.
|
||||
--
|
||||
-- POKEPORT_IDENTITY=gold-dev POKEPORT_GAME=gold \
|
||||
-- POKEPORT_DRIVER=tests/drivers/gold_void_fill_bug1418_test.lua love .
|
||||
|
||||
local U = require("tests.drivers.util")
|
||||
|
||||
return function(game)
|
||||
local out = os.getenv("POKEPORT_SHOT_DIR") or "/tmp/gold-void-fill"
|
||||
local BorderFill = require("src.world.gen2.BorderFill")
|
||||
local Tilt = require("src.render.Tilt")
|
||||
local Zoom = require("src.render.Zoom")
|
||||
local failures = 0
|
||||
|
||||
local function ok(label, condition, detail)
|
||||
if condition then
|
||||
print("[void] ok " .. label)
|
||||
else
|
||||
failures = failures + 1
|
||||
print("[void] FAIL " .. label .. " " .. tostring(detail))
|
||||
end
|
||||
end
|
||||
|
||||
U.wait(45)
|
||||
local world = game.world
|
||||
assert(world and world.map, "gold world did not boot")
|
||||
|
||||
-- Cherrygrove's header border is water ($35). FADE shows that water,
|
||||
-- TREES replaces it, BLACK drops the sheet. attributes.asm:123.
|
||||
world:setMap("CHERRYGROVE_CITY", 22, 16, "down")
|
||||
U.wait(10)
|
||||
|
||||
Zoom.offset = -3
|
||||
world:rebuildNeighbors()
|
||||
world:rebuildPeople({ seamless = true })
|
||||
Tilt.setLevel(3)
|
||||
for _ = 1, 40 do
|
||||
Tilt.update(1 / 60)
|
||||
U.wait(1)
|
||||
end
|
||||
|
||||
local function show(mode, file, label)
|
||||
BorderFill.setVoidFill(mode)
|
||||
if game.options then game.options.voidFill = mode end
|
||||
if game.save and game.save.options then
|
||||
game.save.options.voidFill = mode
|
||||
end
|
||||
U.wait(8)
|
||||
ok(label, BorderFill.voidFill == mode, BorderFill.voidFill)
|
||||
U.shot(game, out .. "/" .. file)
|
||||
end
|
||||
|
||||
show("fade", "01-fade.png", "FADE is the live fill")
|
||||
show("water", "02-water.png", "WATER forces the water block")
|
||||
show("trees", "03-trees.png", "TREES forces the tree wall")
|
||||
show("black", "04-black.png", "BLACK drops the tiled void")
|
||||
show("fade", "05-fade-again.png", "and FADE restores the map's own border")
|
||||
|
||||
Tilt.setLevel(0)
|
||||
Zoom.offset = 0
|
||||
world:rebuildNeighbors()
|
||||
world:rebuildPeople({ seamless = true })
|
||||
|
||||
if failures > 0 then
|
||||
print(("[driver] FAIL gold void fill: %d check(s)"):format(failures))
|
||||
return
|
||||
end
|
||||
print("[driver] PASS gold void fill in " .. out)
|
||||
U.log("cycled fade/water/trees/black on cherrygrove (#1418).")
|
||||
U.log("OPTION > VOID FILL, zoom out (-) to see the void.")
|
||||
|
||||
while true do
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
@@ -43,6 +43,15 @@ local gold = LauncherSettings.open(hooks, "gold")
|
||||
check(has(gold, "TOUCH PAD"), "Gold's gear offers TOUCH PAD")
|
||||
check(has(gold, "VIBRATION"), "and VIBRATION")
|
||||
check(has(gold, "TOUCH CONTROLS"), "and the layout editor")
|
||||
check(has(gold, "VOID FILL"), "and VOID FILL")
|
||||
|
||||
local voidFill = findRow(gold, "VOID FILL")
|
||||
eq(voidFill.value(), "FADE ", "VOID FILL defaults to FADE")
|
||||
voidFill.step(1)
|
||||
eq(gold.opts.gold.voidFill, "water", "right stores water in the gold block")
|
||||
eq(voidFill.value(), "WATER", "and the row reads WATER")
|
||||
voidFill.step(-1)
|
||||
eq(gold.opts.gold.voidFill, "fade", "left restores fade")
|
||||
|
||||
-- Every write has to land in the gold block: the flat keys beside it are
|
||||
-- Red's, and Gold's boot never reads them (src/core/gen2/Save.lua:299).
|
||||
|
||||
@@ -84,6 +84,63 @@ end
|
||||
local _, _, vw0, vh0 = BorderFill.viewport(0, 0, 160, 144, 0)
|
||||
check(vw0 > 0 and vh0 > 0, "scale 0 falls back to 1 rather than collapsing")
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- VOID FILL (#1418): FADE / WATER / TREES / BLACK
|
||||
-- ---------------------------------------------------------------------------
|
||||
|
||||
eq(BorderFill.voidFill, "fade", "the live fill defaults to FADE")
|
||||
eq(BorderFill.voidFillLabel(), "FADE ", "and prints with a trailing space")
|
||||
|
||||
local johto = { id = "CHERRYGROVE_CITY", tileset = "TILESET_JOHTO",
|
||||
borderBlock = 0x35 }
|
||||
local route = { id = "ROUTE_30", tileset = "TILESET_JOHTO", borderBlock = 0x05 }
|
||||
local kanto = { id = "PALLET_TOWN", tileset = "TILESET_KANTO",
|
||||
borderBlock = 0x0f }
|
||||
local cave = { id = "UNION_CAVE_1F", tileset = "TILESET_CAVE", borderBlock = 0x09 }
|
||||
local house = { id = "PLAYERS_HOUSE_1F", tileset = "TILESET_PLAYERS_HOUSE",
|
||||
borderBlock = 0x00 }
|
||||
|
||||
eq(BorderFill.fillBlock(johto), 0x35, "FADE keeps Cherrygrove's water")
|
||||
eq(BorderFill.fillBlock(route), 0x05, "and Route 30's trees")
|
||||
eq(BorderFill.fillKey(johto), "fade|CHERRYGROVE_CITY",
|
||||
"FADE dissolves per map")
|
||||
eq(BorderFill.fillKey(route) ~= BorderFill.fillKey(johto), true,
|
||||
"so the two maps are different fills")
|
||||
|
||||
BorderFill.setVoidFill("water")
|
||||
eq(BorderFill.fillBlock(johto), 0x35, "WATER uses Cherrygrove's water block")
|
||||
eq(BorderFill.fillBlock(route), 0x35, "on Route 30 too")
|
||||
eq(BorderFill.fillBlock(kanto), 0x43, "and Cinnabar's water on Kanto")
|
||||
eq(BorderFill.fillBlock(cave), 0x09, "but a cave keeps its own border")
|
||||
eq(BorderFill.fillBlock(house), 0x00, "and so does a house")
|
||||
eq(BorderFill.fillKey(johto), BorderFill.fillKey(route),
|
||||
"two Johto maps share one WATER fill")
|
||||
eq(BorderFill.fillKey(johto) ~= BorderFill.fillKey(kanto), true,
|
||||
"Kanto water is a different sheet")
|
||||
|
||||
BorderFill.setVoidFill("trees")
|
||||
eq(BorderFill.fillBlock(johto), 0x05, "TREES uses New Bark's tree wall")
|
||||
eq(BorderFill.fillBlock(kanto), 0x0f, "and Pallet's on Kanto")
|
||||
eq(BorderFill.fillBlock(cave), 0x09, "caves still keep their own")
|
||||
|
||||
BorderFill.setVoidFill("black")
|
||||
eq(BorderFill.fillBlock(johto), false, "BLACK skips the tiled bake")
|
||||
eq(BorderFill.fillBlock(house), false, "indoors too")
|
||||
eq(BorderFill.fillKey(johto), "black", "and is one sheet everywhere")
|
||||
|
||||
BorderFill.setVoidFill("nope")
|
||||
eq(BorderFill.voidFill, "fade", "an unknown mode falls back to FADE")
|
||||
BorderFill.setVoidFill("fade")
|
||||
eq(BorderFill.cycle(1), "water", "cycle steps FADE to WATER")
|
||||
eq(BorderFill.cycle(1), "trees", "then TREES")
|
||||
eq(BorderFill.cycle(1), "black", "then BLACK")
|
||||
eq(BorderFill.cycle(1), "fade", "and wraps to FADE")
|
||||
eq(BorderFill.cycle(-1), "black", "left wraps the other way")
|
||||
BorderFill.applyOptions({ voidFill = "trees" })
|
||||
eq(BorderFill.voidFill, "trees", "applyOptions pushes the saved mode")
|
||||
BorderFill.applyOptions({})
|
||||
eq(BorderFill.voidFill, "fade", "and a missing key restores FADE")
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- The real cache: the map the bug was reported on
|
||||
-- ---------------------------------------------------------------------------
|
||||
|
||||
@@ -213,6 +213,22 @@ previous, alpha = BorderFill.crossfade(owner, trees, "ROUTE_30")
|
||||
check("then it is over", previous, nil)
|
||||
check("and the new block owns the void", alpha, 1)
|
||||
|
||||
-- Forced WATER on two Johto maps shares a fill key, so the dissolve does
|
||||
-- not run identical water against itself.
|
||||
BorderFill.setVoidFill("water")
|
||||
local johtoWater = { id = "CHERRYGROVE_CITY", tileset = "TILESET_JOHTO",
|
||||
borderBlock = 0x35 }
|
||||
local routeTrees = { id = "ROUTE_30", tileset = "TILESET_JOHTO",
|
||||
borderBlock = 0x05 }
|
||||
check("WATER fill keys match across Johto",
|
||||
BorderFill.fillKey(johtoWater), BorderFill.fillKey(routeTrees))
|
||||
local forced = {}
|
||||
BorderFill.crossfade(forced, "water", BorderFill.fillKey(johtoWater))
|
||||
local fromForced = BorderFill.crossfade(forced, "water",
|
||||
BorderFill.fillKey(routeTrees))
|
||||
check("so walking Route 30 does not start a fade", fromForced, nil)
|
||||
BorderFill.setVoidFill("fade")
|
||||
|
||||
-- No key at all (an old caller) is the plain single draw.
|
||||
local bare = {}
|
||||
previous, alpha = BorderFill.crossfade(bare, trees, nil)
|
||||
|
||||
@@ -358,7 +358,7 @@ local options = OptionsMenu.new(optionsGame, {
|
||||
})
|
||||
-- The cart's seven rows, then the port's: CONTROLS, audio, speed, display,
|
||||
-- video mode, the mobile-gated touch three (buildRows), MAX FPS and CANCEL.
|
||||
check("twenty-two rows", #OptionsMenu.ROWS, 22)
|
||||
check("twenty-three rows", #OptionsMenu.ROWS, 23)
|
||||
check("the cart's rows come first", OptionsMenu.ROWS[7].key, "frame")
|
||||
check("then the rebind screen", OptionsMenu.ROWS[8].id, "controls")
|
||||
check("then the port's audio group", OptionsMenu.ROWS[9].key, "musicVol")
|
||||
@@ -861,10 +861,15 @@ check("GBC leaves a palette alone",
|
||||
1)[1], 1)
|
||||
check("and has no present pass", GbcPalette.presentColors(), nil)
|
||||
|
||||
local gbcfxIndex
|
||||
local zoomIndex, gbcfxIndex
|
||||
for i, row in ipairs(OptionsMenu.ROWS) do
|
||||
if row.label == "ZOOM" then zoomIndex = i end
|
||||
if row.label == "GBC FX" then gbcfxIndex = i end
|
||||
end
|
||||
check("VOID FILL follows ZOOM", OptionsMenu.ROWS[zoomIndex + 1].label,
|
||||
"VOID FILL")
|
||||
check("and TILT follows VOID FILL", OptionsMenu.ROWS[zoomIndex + 2].label,
|
||||
"TILT")
|
||||
check("VIDEO MODE follows GBC FX", OptionsMenu.ROWS[gbcfxIndex + 1].label,
|
||||
"VIDEO MODE")
|
||||
check("and TOUCH PAD follows it", OptionsMenu.ROWS[gbcfxIndex + 2].label,
|
||||
@@ -897,6 +902,28 @@ scrollOptions:cycle(videoRow, -1)
|
||||
check("left toggles back to windowed",
|
||||
scrollOptions.options.videoMode, "windowed")
|
||||
|
||||
local voidRow = select(2, rowNamed("VOID FILL"))
|
||||
check("VOID FILL is a row", voidRow ~= nil, true)
|
||||
check("and it defaults to FADE", Save.DEFAULT_OPTIONS.voidFill, "fade")
|
||||
scrollOptions.options.voidFill = "fade"
|
||||
local BorderFill = require("src.world.gen2.BorderFill")
|
||||
BorderFill.setVoidFill("fade")
|
||||
scrollOptions:cycle(voidRow, 1)
|
||||
check("right steps to WATER", scrollOptions.options.voidFill, "water")
|
||||
check("and the live fill tracks it", BorderFill.voidFill, "water")
|
||||
scrollOptions:cycle(voidRow, 1)
|
||||
check("then TREES", scrollOptions.options.voidFill, "trees")
|
||||
scrollOptions:cycle(voidRow, 1)
|
||||
check("then BLACK", scrollOptions.options.voidFill, "black")
|
||||
scrollOptions:cycle(voidRow, 1)
|
||||
check("and wraps back to FADE", scrollOptions.options.voidFill, "fade")
|
||||
check("FADE blanks the longer labels", voidRow.text(scrollOptions.options),
|
||||
"FADE ")
|
||||
scrollOptions.options.voidFill = "water"
|
||||
check("WATER fits the value column", voidRow.text(scrollOptions.options),
|
||||
"WATER")
|
||||
BorderFill.setVoidFill("fade")
|
||||
|
||||
check("text reads WINDOWED", videoRow.text(scrollOptions.options), "WINDOWED")
|
||||
scrollOptions.options.videoMode = "borderless"
|
||||
check("text reads FULL, not BORDERLESS", videoRow.text(scrollOptions.options),
|
||||
|
||||
Reference in New Issue
Block a user