This commit is contained in:
bryanthaboi
2026-08-18 04:52:00 -04:00
parent 7b1e796c48
commit cfa8406306
7 changed files with 313 additions and 46 deletions
@@ -0,0 +1,92 @@
return function(game)
local U = dofile("tests/drivers/util.lua")
local DIR = os.getenv("SHOT_DIR") or "/tmp/bug1412"
local Pokemon = require("src.pokemon.Pokemon")
local Evolution = require("src.pokemon.Evolution")
local Screens = require("src.ui.Screens")
local TradeAnim = require("src.ui.TradeAnim")
local TextBox = require("src.render.TextBox")
local function check(label, ok)
U.log(ok and "PASS" or "FAIL", label)
return ok
end
U.log("Issue #1412: mon pics must be mirrored on the evolution and trade")
U.log("screens, and only there; battle keeps the raw orientation.")
U.teleport(game, "ROUTE_1", 5, 5, "down")
U.wait(10)
check("the overworld fixture is ready", game.overworld ~= nil)
local mon = Pokemon.new(game.data, "PIKACHU", 20)
game.save.party = { mon }
-- engine/movie/evolution.asm:103
Evolution.evolve(game, mon, "RAICHU", nil, "ITEM")
U.wait(12)
local top = game.stack:top()
check("the evolution screen opened",
top and top.screenId == "EvolutionState")
U.shot(game, DIR .. "/bug1412_evo_old_pikachu.png")
for _ = 1, 600 do
if top.done then break end
U.wait(1)
end
check("the evolution finished", top.done and not top.canceled)
U.wait(2)
U.shot(game, DIR .. "/bug1412_evo_new_raichu.png")
for _ = 1, 60 do
if game.stack:top() == game.overworld then break end
U.tap(game, "a")
U.wait(4)
end
-- engine/movie/trade.asm:751
local sent = Pokemon.new(game.data, "SPEAROW", 10)
local recv = Pokemon.new(game.data, "FARFETCHD", 10)
recv.nickname = "DUX"
recv.traded = true
recv.ot = "TRAINER"
U.teleport(game, "ROUTE_1", 5, 5, "down")
local anim = Screens.push(game, "TradeAnim", {
sent = sent, received = recv, enemyName = "TRAINER",
})
check("the trade cinematic opened", getmetatable(anim) == TradeAnim)
for _ = 1, 200 do
if anim.sub == "hold" then break end
U.wait(1)
end
check("the sent SPEAROW pic is on screen",
anim.phase == "show_player" and anim.sub == "hold" and anim.monVisible)
U.shot(game, DIR .. "/bug1412_trade_sent_spearow.png")
local function topIsText()
return getmetatable(game.stack:top()) == TextBox
end
for _ = 1, 8000 do
if anim.phase == "show_enemy" and anim.monVisible then break end
if anim.phase == "done" then break end
if anim.waitingText or topIsText() then
U.wait(1)
else
anim:update(1 / 60)
end
end
U.wait(2)
check("the received FARFETCH'D pic is on screen",
anim.phase == "show_enemy" and anim.monVisible)
U.shot(game, DIR .. "/bug1412_trade_recv_farfetchd.png")
U.log("shots in", DIR)
U.log("Right: all four pics are mirrored left-right compared to the same")
U.log("mon's battle front sprite (compare the hardware capture on #1412:")
U.log("PIKACHU's face points the other way than it does in battle).")
U.log("Wrong: any of the four matches the battle orientation.")
U.log("Battle, pokedex, title, Hall of Fame, League PC, credits, and the")
U.log("museum fossils are untouched and must still match the cart.")
while true do
coroutine.yield()
end
end
+94
View File
@@ -0,0 +1,94 @@
-- data/moves/sfx.asm:46, data/moves/animations.asm:448, audio/engine_2.asm:1077
return function(game)
local U = dofile("tests/drivers/util.lua")
local Pokemon = require("src.pokemon.Pokemon")
local BattleState = require("src.battle.BattleState")
local DIR = os.getenv("SHOT_DIR") or "/tmp/shots"
local function check(label, ok)
U.log(ok and "PASS" or "FAIL", label)
return ok
end
local opts = game.save.options or {}
check(("sfx volume %d (needs > 0 to hear anything)"):format(opts.sfxVol or 7),
(opts.sfxVol or 7) > 0)
check("battle animations are on", opts.animations ~= false)
local mdef = game.data.moves.LEER
check("LEER is in the move table", mdef ~= nil)
local anim = mdef and mdef.anim
check(("LEER maps to %s pitch %s tempo %s (wants Battle_31 255 64)"):format(
anim and tostring(anim.sound) or "?",
anim and tostring(anim.pitch) or "?",
anim and tostring(anim.tempo) or "?"),
anim ~= nil and anim.sound == "Battle_31"
and anim.pitch == 255 and anim.tempo == 64)
local lead = Pokemon.new(game.data, "CHARMANDER", 20)
lead.moves = { { id = "LEER", pp = 30 } }
game.save.party = { lead }
U.teleport(game, "ROUTE_1", 5, 5, "down")
U.wait(15)
local ow = game.overworld
check("standing on ROUTE_1", ow.map.id == "ROUTE_1")
local ChipAudio = require("src.core.ChipAudio")
local renders = {}
local origNewSfx = ChipAudio.newSfx
ChipAudio.newSfx = function(data, name, pitch, tempo, header, plain)
renders[#renders + 1] = { name = name, pitch = pitch, tempo = tempo,
plain = plain }
return origNewSfx(data, name, pitch, tempo, header, plain)
end
local battle = BattleState.newWild(game, "PIDGEY", 8)
battle.onFinish = function() end
ow:pushBattle(battle)
local function waitPhase(phase, tries)
for _ = 1, tries do
if battle.phase == phase then return true end
U.tap(game, "a")
U.wait(6)
end
return battle.phase == phase
end
U.log("")
U.log("LISTEN: the cart's LEER opens with a short PIERCING high tone")
U.log(" (about a third of a second, while the seed-drop noise is still")
U.log(" running) and only then falls to the slow low buzz. Before the")
U.log(" fix the recomp skipped the piercing part and played the whole")
U.log(" sound as the low buzz.")
U.log("")
for round = 1, 3 do
check(("round %d: menu is up"):format(round), waitPhase("menu", 150))
U.tap(game, "a")
check(("round %d: move list is up"):format(round),
waitPhase("moveSelect", 12))
U.tap(game, "a")
U.wait(150)
if round == 1 then U.shot(game, DIR .. "/bug1414_leer.png") end
end
ChipAudio.newSfx = origNewSfx
local sawPlain, sawSeed = false, false
for _, r in ipairs(renders) do
if r.name == "Battle_31" and r.pitch == 255 and r.tempo == 64
and (r.plain or 0) > 0 then
sawPlain = true
end
if r.name == "Battle_1B" then sawSeed = true end
end
check("the seed-drop noise (Battle_1B) rendered", sawSeed)
check("LEER's Battle_31 rendered with an unmodified opening"
.. " while the noise still ran", sawPlain)
for _, r in ipairs(renders) do
U.log((" rendered %s pitch=%s tempo=%s plainFrames=%s"):format(
r.name, tostring(r.pitch), tostring(r.tempo), tostring(r.plain)))
end
U.log("done; the window stays open, pick LEER again to re-listen")
end