Files
gen1recomp/tests/drivers/gate_gold_untouched.lua
T
bryanthaboi ca4d3d283c Add Pokemon Crystal as a sixth supported version
Crystal boots from a user-supplied ROM, imports a full cache and is playable:
copyright, the Crystal intro movie, the animated title, gender select, Oak,
and out into Johto. 122 of the cart's 169 script specials are implemented.

Import and data
- tools/make_crystal_manifest.py derives the manifest by importing
  make_gold_manifest as a library, with three additive keyword seams. Gold and
  Silver still regenerate byte-identical, which is the standing requirement for
  touching that generator.
- crystal_symbol_deltas.py and crystal_movie_symbols.py carry the symbol delta:
  Crystal renames the credits mons, splits the trainer card, Pokegear and
  pack-pal blocks by gender, and replaces the intro and title outright.
- Crystal-only manifest keys: engineFlagOrder (162 flags to Gold's 93, so the
  badge block sits one higher) and unownCharmap (the main charmap parser stops
  at the first newcharmap so the two cannot contaminate each other).

Extractor
- RomExtractorGen2 becomes three-edition. Crystal corrections: PAL_MAP_BANK
  0x13, a flat PICS_FIX pic bank, audio bank 0x5e, the mapSongs id-100 hole,
  seven NPC trades, a TradeTexts stride of 8, the five Crystal tileset anim
  steps with per-row degrade, and the column-major trainer card portraits.
- New: animated front sprites (frames, bitmasks, play and idle scripts), the
  Battle Tower roster, Kris assets, Mobile System GB art, and the Crystal
  intro and title via src/import/CrystalMovie.lua.

Engine
- GameVersion gains engine(id) and fixes(id). Gold and Silver keep their
  original bugs where the bug is not hardware dependent; Crystal gets the fixes
  Crystal shipped: Lucky Number boxes 10-14, surfing onto an NPC, and the
  Reflect and Light Screen defence overflow.
- Crystal story: Suicune and Eusine, Celebi behind the GS Ball flag, the Ruins
  of Alph chambers, Buena, the Move Tutor, the Poke Seer, and the Battle Tower
  including the wInBattleTowerBattle badge-boost guard.
- Kris and the gender flag, animated fronts in battle and the summary screen,
  and mon caught data.

Verification
- Every extracted asset is pixel-compared against pret's own source PNGs.
- Gold caches are byte-identical before and after, file for file.
- New Crystal suites plus a T2 Gen 2 tier; the full suite passes.
2026-08-23 12:10:28 -04:00

81 lines
3.3 KiB
Lua

-- Gate check: the Crystal wave left Gold alone. No Battle Tower, no Buena's
-- Blue Card, no Ruins of Alph secret chambers, and the three beasts roam.
--
-- POKEPORT_GAME=gold POKEPORT_VERSION=gold \
-- POKEPORT_DRIVER=tests/drivers/gate_gold_untouched.lua love .
local U = require("tests.drivers.util")
local Battle = require("src.battle.gen2.Battle")
local Roamers = require("src.core.gen2.Roamers")
return function(game)
local fails = 0
local function say(line) print("[driver] " .. line); io.stdout:flush() end
local function ok(cond, line)
if not cond then fails = fails + 1 end
say((cond and "OK " or "FAIL ") .. line)
end
U.wait(60)
local world = game.world
assert(world and world.map, "gold world did not boot")
say("version=" .. tostring(game.version) .. " map=" .. tostring(world.map.id))
local order = {}
for _, name in ipairs((world.constants or {}).specialOrder or {}) do
order[name] = true
end
ok(next(order) ~= nil, "the Gold cache names its specials")
for _, name in ipairs({ "BattleTowerBattle", "BattleTowerAction",
"BattleTowerRoomMenu", "LoadOpponentTrainerAndPokemonWithOTSprite",
"BuenasPassword", "BuenaPrize", "AskRememberPassword",
"OmanyteChamber", "HoOhChamber", "CelebiShrineEvent",
"SampleKenjiBreakCountdown", "MoveTutor", "PokeSeer" }) do
ok(not order[name], "Gold has no " .. name .. " special")
end
ok(world.maps.BATTLE_TOWER_1F == nil, "no BATTLE_TOWER_1F map")
ok(world.maps.BATTLE_TOWER_BATTLE_ROOM == nil, "no tower battle room")
ok((world.trainers or {}).battleTower == nil,
"trainers.lua carries no battleTower roster")
ok((world.eventTables or {}).unownWalls == nil,
"events.lua carries no unownWalls table")
-- ../pokecrystal/constants/event_flags.asm:486-489 are Crystal-only.
for _, flag in ipairs({ 806, 807, 808, 809 }) do
ok(not world.events:get(flag), "wall-opened flag " .. flag .. " is clear")
end
-- ../pokecrystal/constants/script_constants.asm:69-74, Crystal-only VARs.
for _, id in ipairs({ 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }) do
ok(world:readVar(id) == 0,
("VAR $%02x reads 0 on Gold"):format(id))
end
-- data/wild/roammon_maps.asm: RAIKOU, ENTEI and SUICUNE, all three.
local roster = Roamers.roster(world.encounters)
say("roamer roster: " .. #roster .. " rows")
for _, row in ipairs(roster) do
say((" %s L%s start=%s"):format(tostring(row.species),
tostring(row.level), tostring(row.map)))
end
ok(#roster == 3, "three beasts in the roster")
local list = Roamers.init(game.save, { encounters = world.encounters, force = true })
local live = 0
for _, slot in ipairs(list or {}) do
if Roamers.active(slot) then live = live + 1 end
end
ok(live == 3, "all three are active after InitRoamMons")
-- pokegold/engine/battle/core.asm:3476-3479: TRAP and FORCESHINY only.
ok(Battle.noEscapeBattleType({ battleType = 9 }) == true, "TRAP: no escape")
ok(Battle.noEscapeBattleType({ battleType = 7 }) == true,
"FORCESHINY: no escape")
ok(Battle.noEscapeBattleType({ battleType = 10 }) == false,
"FORCEITEM: Lugia and Ho-Oh can still be run from on Gold")
ok(Battle.noEscapeBattleType({ battleType = 8 }) == false, "TREE: escapable")
say(fails == 0 and "PASS" or (fails .. " FAILURES"))
love.event.quit(fails == 0 and 0 or 1)
end