mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-17 19:24:01 +02:00
Keep WIDE battle visible beneath opaque menus
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
-- Visual regression coverage for Professor Oak's scripted Yellow capture Bag
|
||||
-- over the WIDE + FIXED + EXTENDED + WORLD composition.
|
||||
return function(game)
|
||||
local U = dofile("tests/drivers/util.lua")
|
||||
local DIR = os.getenv("SHOT_DIR") or "/tmp/shots"
|
||||
local BattleState = require("src.battle.BattleState")
|
||||
local Pokemon = require("src.pokemon.Pokemon")
|
||||
|
||||
love.window.setMode(2048, 1152, { resizable = true })
|
||||
U.wait(3)
|
||||
|
||||
local options = game.save.options
|
||||
options.battleLayout = "wide"
|
||||
options.battleFit = "fixed"
|
||||
options.battleHud = "extended"
|
||||
options.battleBg = "world"
|
||||
|
||||
game.save.party = { Pokemon.new(game.data, "PIKACHU", 20) }
|
||||
U.teleport(game, "ROUTE_1", 5, 5, "down")
|
||||
U.wait(30)
|
||||
|
||||
local demo = BattleState.newWild(game, "CHARMANDER", 5)
|
||||
demo:makeOldManDemo("PROF.OAK")
|
||||
demo.onFinish = function() end
|
||||
game.overworld:pushBattle(demo)
|
||||
|
||||
for _ = 1, 100 do
|
||||
if demo.phase == "menu" and (demo.demoTimer or 0) > 5 then break end
|
||||
U.tap(game, "a")
|
||||
U.wait(4)
|
||||
end
|
||||
for _ = 1, 180 do
|
||||
if game.stack:top() ~= demo then break end
|
||||
U.wait(1)
|
||||
end
|
||||
U.wait(3)
|
||||
|
||||
local path = DIR .. "/fixed_extended_world_oak_charmander_bag.png"
|
||||
os.remove(path)
|
||||
local ok = game.stack:top() ~= demo and U.shot(game, path)
|
||||
U.log(ok and "FIXED_EXTENDED_WORLD_BAG_PASS"
|
||||
or "FIXED_EXTENDED_WORLD_BAG_FAIL")
|
||||
love.event.quit(ok and 0 or 1)
|
||||
end
|
||||
@@ -92,6 +92,11 @@ local menu = { isOpaque = true } -- PartyMenu / ListMenu
|
||||
local whiteBattle = setmetatable(
|
||||
{ game = { save = { options = { battleBg = "white" } } } },
|
||||
{ __index = BattleState })
|
||||
local wideWhiteBattle = setmetatable(
|
||||
{ game = { save = { options = {
|
||||
battleBg = "white", battleLayout = "wide",
|
||||
} } } },
|
||||
{ __index = BattleState })
|
||||
local function stack(...) return { states = { ... },
|
||||
visibleBase = function(self)
|
||||
for i = #self.states, 1, -1 do
|
||||
@@ -111,7 +116,10 @@ T.eq(s2:visibleBase(), 1, "the battle alone already drew from the overworld")
|
||||
T.eq(Game.drawBaseInStack(s2, s2:visibleBase()), 1, "and still does")
|
||||
local s3 = stack(overworld, whiteBattle, menu)
|
||||
T.eq(Game.drawBaseInStack(s3, s3:visibleBase()), 3,
|
||||
"a white-bg battle has no map to hold, so nothing moves")
|
||||
"a classic white-bg battle has no presentation to hold, so nothing moves")
|
||||
local s3wide = stack(overworld, wideWhiteBattle, menu)
|
||||
T.eq(Game.drawBaseInStack(s3wide, s3wide:visibleBase()), 2,
|
||||
"an opaque WIDE battle still draws beneath its classic menu")
|
||||
local s4 = stack(overworld, menu)
|
||||
T.eq(Game.drawBaseInStack(s4, s4:visibleBase()), 2,
|
||||
"and a menu outside a battle is untouched")
|
||||
|
||||
Reference in New Issue
Block a user