Read the Pyramid's floor names and Ever Grande City's fly destinations from the script cache

The map name popup prints a Battle Pyramid floor's name through RomText.refIr(), and the region map reads Ever Grande City's two fly destinations by sEverGrandeCityNames' labels, so both follow a text override.
This commit is contained in:
thibautbus
2026-10-03 22:29:50 +02:00
parent 6eb2b6413b
commit 09ace425f4
3 changed files with 26 additions and 3 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ local function rsePrint()
local idx = pyramid.location(sess) == pyramid.LOCATION.TOP and #headers or
(tonumber(pyramid.frontier(sess).curChallengeBattleNum) or 0) + 1
local ref = headers[idx]
if ref then name = require("src.core.game3.scripting.text_ir").toPlain(ref.ir) end
if ref then name = require("src.core.game3.scripting.text_ir").toPlain(RomText.refIr(ref)) end
elseif sec == rseConstants():id("region_map_sections", "MAPSEC_SECRET_BASE") then
-- pokeemerald/src/secret_base.c:735
local sb = R.system("secretBase")
+9 -2
View File
@@ -353,14 +353,21 @@ local function newState(opts)
end
RegionMap.newState = newState
-- pokeemerald/src/region_map.c:349: the name list each multi-name
-- destination points at, which the script cache keys by its label.
local MULTI_NAME_TABLES = { "sEverGrandeCityNames" }
-- pokeemerald/src/region_map.c:1760
function RegionMap.updateFlyText(s)
s.flyText = nil
if s.mapSecType > TYPE.NONE then
for _, m in ipairs(RegionMap.manifest().multiNameFlyDestinations) do
for i, m in ipairs(RegionMap.manifest().multiNameFlyDestinations) do
if s.mapSecId == m.mapSecId then
if flagSet(s, m.flag) then
s.flyText = { tall = true, name = s.mapSecName, sub = m.names[s.posWithinMapSec + 1] or "" }
local sub = m.names[s.posWithinMapSec + 1] or ""
local key = MULTI_NAME_TABLES[i] and RomText.key(MULTI_NAME_TABLES[i], s.posWithinMapSec)
if key and RomText.has(key) then sub = RomText.plain(key) end
s.flyText = { tall = true, name = s.mapSecName, sub = sub }
end
break
end
@@ -72,6 +72,22 @@ check(PyramidBag.description() == "Retourner au jeu", "the bag's return line nam
BUNDLE.text.gText_TheField = nil
check(PyramidBag.description() == "Retourner the field", "a place missing from the cache keeps the copy")
-- Ever Grande City's fly destinations (pokeemerald/src/region_map.c:343).
local RegionMap = require("src.ui.game3.rse.region_map")
RegionMap.manifest = function()
return { multiNameFlyDestinations = { { names = { "POKéMON LEAGUE", "POKéMON CENTER" }, mapSecId = 5, flag = 2100 } } }
end
local function flySub()
local s = { mapSecType = RegionMap.TYPE.CITY_CANFLY, mapSecId = 5, posWithinMapSec = 1, mapSecName = "EVER GRANDE",
session = { flags = { [2100] = true } } }
RegionMap.updateFlyText(s)
return s.flyText.sub
end
BUNDLE.text = { ["sEverGrandeCityNames[1]"] = ir("CENTRE POKéMON") }
check(flySub() == "CENTRE POKéMON", "a fly destination reads its name from the cache")
BUNDLE.text = {}
check(flySub() == "POKéMON CENTER", "a fly destination missing from the cache keeps the copy")
if failed > 0 then
print(failed .. " check(s) failed")
os.exit(1)