oakie doke

This commit is contained in:
bryanthaboi
2026-10-10 07:34:17 -04:00
parent 8f6360f695
commit 4ee2c8011f
16 changed files with 54 additions and 26 deletions
+1 -1
View File
@@ -285,7 +285,7 @@ M.PALLET_TOWN = {
if oak then oak.facing = x == 10 and "right" or "left" end
hold(2, nil, function()
local battle = BattleState.newWild(game, "PIKACHU", 5)
battle:makeOldManDemo("PROF.OAK")
battle:makeOldManDemo("oak")
battle.onFinish = function()
afterPikaBattle()
end
+7 -11
View File
@@ -1038,8 +1038,7 @@ end
-- scripted cursor hovers FIGHT, hops to ITEM and forces the item menu
-- (one POKé BALL x50). Nothing is kept.
-- Yellow's Pallet intro (BATTLE_TYPE_PIKACHU) is the same simulated
-- script under "PROF.OAK" (pokeyellow core.asm .profOakName), so the
-- displayed thrower name is a parameter.
-- script under .profOakName (pokeyellow core.asm:2117).
-- The throw catches everywhere except Yellow's FIRST Viridian training.
-- ItemUseBall's .oldManBattle branch checks EVENT_INITIAL_CATCH_TRAINING
-- and, when it is set, stores anim data $63 in place of the $43 capture
@@ -1049,16 +1048,13 @@ end
-- closely!" demo resets the event before its battle
-- (ViridianCityOldManStartCatchTrainingScript), so only the initial
-- tutorial passes failThrow -- it stands in for that event (#636).
function BattleState:makeOldManDemo(name, failThrow)
function BattleState:makeOldManDemo(kind, failThrow)
self.demo = true
self.demoName = name or Strings("OLD MAN")
-- pokeyellow engine/battle/core.asm:2109-2121
self.oakDemo = kind == "oak"
self.demoName = self.data.text[self.oakDemo and "DisplayBattleMenu.profOakName"
or "DisplayBattleMenu.oldManName"]
self.demoFails = failThrow and true or false
-- LoadPlayerBackPic and DisplayBattleMenu split on the same wBattleType:
-- BATTLE_TYPE_OLD_MAN gets .oldManName + OldManPicBack, BATTLE_TYPE_PIKACHU
-- gets .profOakName + ProfOakPicBack (pokeyellow core.asm). The thrower
-- name the caller passes IS that distinction here, so it picks the pic too
-- -- data/scripts/story2.lua is the only site that names PROF.OAK (#557).
self.oakDemo = name == "PROF.OAK"
-- Yellow's Pallet intro runs this before the player owns any mon
-- (BATTLE_TYPE_PIKACHU precedes the lab gift), so newWild flagged the
-- battle dead for lack of a party. The demo never sends out, draws, or
@@ -2790,7 +2786,7 @@ function BattleState:oldManThrow()
self.result = "run" -- nothing is kept; wBattleResult only ends the demo
-- engine/items/item_effects.asm:148
self:sayAuto(self:romText("_ItemUseText001", "%s used\n%s!",
self.demoName or Strings("OLD MAN"), self.data.items.POKE_BALL.name))
self.demoName, self.data.items.POKE_BALL.name))
self:act(function()
-- ItemUseBall's beat before the toss chain (like throwBall)
self.nextInsert = (self.nextInsert or 0) + 1
+4 -4
View File
@@ -8,8 +8,8 @@ local GameVersion = require("src.core.GameVersion")
local CacheContract = {}
-- engine/battle/animations.asm:2418
CacheContract.FORMAT = "rom-cache-v12-gen1:"
-- engine/battle/animations.asm:2418, engine/battle/core.asm:2051
CacheContract.FORMAT = "rom-cache-v13-gen1:"
CacheContract.VERSION_FORMAT = {
-- v11: Gen 2 maps carry their object list's ROM address, which a .sav
-- export re-anchoring a save onto another map writes back into
@@ -22,8 +22,8 @@ CacheContract.VERSION_FORMAT = {
crystal = "rom-cache-v15-crystal6:",
-- engine/overworld/map_sprites.asm:181, engine/battle/animations.asm:2600
-- data/pikachu/pikachu_pic_animation.asm:340, engine/movie/title.asm:76
-- engine/pikachu/pikachu_pic_animation.asm:412
yellow = "rom-cache-v12-yellow4:",
-- engine/pikachu/pikachu_pic_animation.asm:412, engine/battle/core.asm:2135-2138
yellow = "rom-cache-v12-yellow5:",
-- v8: M4A tracks retain reachable patterns and explicit entry offsets.
firered = "rom-cache-v25-firered:",
leafgreen = "rom-cache-v10-leafgreen:",
+7
View File
@@ -1523,6 +1523,13 @@ function RomExtractor:extractText()
self:symbol(label), metadata.dynamic[label] or {})
self:tick("Dialogue", index, #metadata.labels)
end
-- pokered engine/battle/core.asm:2051, pokeyellow engine/battle/core.asm:2135-2138
for _, label in ipairs({ "DisplayBattleMenu.oldManName", "DisplayBattleMenu.profOakName" }) do
if label == "DisplayBattleMenu.oldManName" or self.symbols[label] then
local s = self:symbol(label)
texts[label] = self.rom:readString(s.bank, s.address, self.manifest.charmap)
end
end
local trainerHeaders = {}
for mapLabel, headers in pairs(metadata.trainerHeaders) do
local converted = {}
@@ -53,7 +53,7 @@ return function(game)
or BattleState.newWild(game, "DITTO", 10)
b.onFinish = function() end
b.catchAttempt = function() return false, 0 end
if kind == "oldman" then b:makeOldManDemo("OLD MAN", false) end
if kind == "oldman" then b:makeOldManDemo(nil, false) end
if kind == "safari" then b:makeSafari({ balls = 30, steps = 500 }) end
ow:pushBattle(b)
assert(waitFor(function() return b.phase == "menu" end, 2500, true),
@@ -20,7 +20,7 @@ return function(game)
U.wait(30)
local demo = BattleState.newWild(game, "CHARMANDER", 5)
demo:makeOldManDemo("PROF.OAK")
demo:makeOldManDemo("oak")
demo.onFinish = function() end
game.overworld:pushBattle(demo)
@@ -55,7 +55,7 @@ return function(game)
check("it is Oak's pic, not the old man's", backPath == PROF_BACK)
local battle = BattleState.newWild(game, "PIKACHU", 5)
battle:makeOldManDemo("PROF.OAK")
battle:makeOldManDemo("oak")
check("the thrower is named PROF.OAK", battle.demoName == "PROF.OAK")
check("the battle asks for the BATTLE_TYPE_PIKACHU back pic",
battle.oakDemo == true)
+1 -1
View File
@@ -61,7 +61,7 @@ return function(game)
local probe = BattleState.newWild(game, (om and om.species) or "RATTATA",
(om and om.level) or 5)
probe:makeOldManDemo(nil, true)
check("makeOldManDemo(name, true) sets demoFails", probe.demoFails == true)
check("makeOldManDemo(nil, true) sets demoFails", probe.demoFails == true)
probe:makeOldManDemo(nil, false)
check("and without it the demo still catches, for Red and the reruns",
probe.demoFails == false)
@@ -24,7 +24,7 @@ return function(game)
U.wait(10)
local battle = BattleState.newWild(game, "PIKACHU", 5)
battle:makeOldManDemo("PROF.OAK")
battle:makeOldManDemo("oak")
local menuFrames, cursorItemAt = 0, nil
local clearedDuringWait = nil
+11 -4
View File
@@ -4,7 +4,7 @@
-- loads OldManPicBack for BATTLE_TYPE_OLD_MAN but ProfOakPicBack for
-- BATTLE_TYPE_PIKACHU, the Pallet Town catch scene, and DisplayBattleMenu
-- splits the displayed thrower name on the same wBattleType. The port
-- carries that split as makeOldManDemo's name argument.
-- carries that split as makeOldManDemo's kind argument.
--
-- #561: TalkToPikachu's framed portrait draws the chosen PikaPicAnimScript's
-- own base frame (data/pikachu/pikachu_pic_animation.asm), not the battle
@@ -59,12 +59,16 @@ T.eq(Sprites.playerPath(nil, "back", { demo = true, oakDemo = true }),
-- makeOldManDemo only fills fields when a player battler already exists, so
-- a stub with one stays clear of Pokemon.new and the fixture dataset.
local oak = { player = true }
BattleState.makeOldManDemo(oak, "PROF.OAK")
local names = { text = {
["DisplayBattleMenu.oldManName"] = "OLD MAN",
["DisplayBattleMenu.profOakName"] = "PROF.OAK",
} }
local oak = { player = true, data = names }
BattleState.makeOldManDemo(oak, "oak")
T.eq(oak.demoName, "PROF.OAK", "the Yellow demo names PROF.OAK as the thrower")
T.eq(oak.oakDemo, true, "and asks for his back pic")
local oldMan = { player = true }
local oldMan = { player = true, data = names }
BattleState.makeOldManDemo(oldMan)
T.eq(oldMan.demoName, "OLD MAN", "the unnamed demo is still the old man")
T.eq(oldMan.oakDemo, false, "and does not reach for Oak's pic")
@@ -114,6 +118,9 @@ end
T.check(extractor:find('self.symbols["ProfOakPicBack"]', 1, true) ~= nil,
"the extractor gates Oak's back pic on the ProfOakPicBack symbol")
requireSymbols({ "ProfOakPicBack" }, "#557")
requireSymbols({ "DisplayBattleMenu.profOakName" }, "#557 thrower name")
T.check(yellowManifest:find('"DisplayBattleMenu.oldManName"', 1, true) ~= nil,
"rom_manifest_yellow.json carries DisplayBattleMenu.oldManName")
local PikachuPicExtractor = require("src.import.PikachuPicExtractor")
local pikapic = PikachuPicExtractor.symbolNames()
+1 -1
View File
@@ -499,7 +499,7 @@ do
}
fg.save.party = { Pokemon.new(Data, "BULBASAUR", 20) }
local demo = BattleState.newWild(fg, "PIKACHU", 5)
demo:makeOldManDemo("PROF.OAK")
demo:makeOldManDemo("oak")
stack:push(demo)
demo:enter()
for _ = 1, 300 do
+1
View File
@@ -537,6 +537,7 @@ DIRECT_SYMBOLS = {
"BugIconFrame2",
"CircleTile",
"CryData",
"DisplayBattleMenu.oldManName",
"DoorTileIDPointers",
"ED_Tile",
"EvosMovesPointerTable",
+1
View File
@@ -85,6 +85,7 @@ YELLOW_EXTRA_SYMBOLS = (
"YellowIntroCloudGFX",
"PikachuCriesPointerTable",
"CGBBasePalettes",
"DisplayBattleMenu.profOakName",
# Jessie & James share the ROCKET trainer class but battle behind their
# own pic (home/trainers2.asm IsFightingJessieJames) (#439)
"JessieJamesPic",
+4
View File
@@ -20198,6 +20198,10 @@
24,
24418
],
"DisplayBattleMenu.oldManName": [
15,
20242
],
"DittoPicBack": [
11,
17853
+4
View File
@@ -20175,6 +20175,10 @@
24,
24418
],
"DisplayBattleMenu.oldManName": [
15,
20242
],
"DittoPicBack": [
11,
17853
+8
View File
@@ -21333,6 +21333,14 @@
24,
24441
],
"DisplayBattleMenu.oldManName": [
15,
20455
],
"DisplayBattleMenu.profOakName": [
15,
20463
],
"DittoPicBack": [
11,
17853