From bff40a5d90b8759210532d8733bfff94e2b9f721 Mon Sep 17 00:00:00 2001 From: thibautbus <310327033+thibautbus@users.noreply.github.com> Date: Wed, 19 Aug 2026 14:31:09 +0200 Subject: [PATCH] Route OverworldController's field messages through their real ROM text Four message families in OverworldController.lua were plain Lua literals instead of their already-extracted, already-translated ROM text labels: - applyFieldPoison()'s faint message: the third of three collapsed "%s\nfainted!" ROM strings (the other two, in BattleState.lua, are fixed in the previous commit) -- routed through _PokemonFaintedText. - useSoftboiledFieldMove()'s two outcome messages: _ItemUseNoEffectText and _PotionText, the exact labels ItemEffects.lua's real potion message already uses, including _PotionText's second slot (the actual amount healed) the old literal never showed at all. - tryHiddenObject()'s two hidden-item finds: _FoundHiddenItemText. - The normal item-ball pickup path's two finds (one Yellow-only bag-full variant): a comment already named _FoundItemText ("FoundItemText: text_far, sound_get_item_1, text_end"). Both found-item labels lead with a {PLAYER} token that romText auto-fills from a 2-arg call (player name, item name) in the same order the literal already used. The fallback text for both is plain "%s found\n%s!", matching the original literal's shape exactly -- an earlier version of this fix used a "{PLAYER} found\n%s!" fallback that relied on TextBox.new's later TextBox.substitute pass to resolve {PLAYER}, which works but needlessly made the fallback path depend on a downstream call instead of being self-contained. --- src/world/OverworldController.lua | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/world/OverworldController.lua b/src/world/OverworldController.lua index 3af3a100..088fbe84 100644 --- a/src/world/OverworldController.lua +++ b/src/world/OverworldController.lua @@ -846,15 +846,20 @@ function OverworldState:useSoftboiledFieldMove(user, target) if not user or not user.stats or not target or not target.stats or target == user or target.hp <= 0 or target.hp >= target.stats.hp or user.hp <= heal then - Game.stack:push(TextBox.new(Game, Strings("It won't have\nany effect."))) + Game.stack:push(TextBox.new(Game, + romText(Game.data, "_ItemUseNoEffectText", "It won't have\nany effect."))) return false end + local before = target.hp user.hp = user.hp - heal target.hp = math.min(target.stats.hp, target.hp + heal) require("src.core.Sound").play(Game.data, "Heal_HP") local def = Game.data.pokemon[target.species] + -- _PotionText's second slot is the recovered amount, same as + -- ItemEffects.lua's potion message -- the engine fallback never shows it Game.stack:push(TextBox.new(Game, - Strings("%s's HP\nwas restored!", target.nickname or def.name))) + romText(Game.data, "_PotionText", "%s's HP\nwas restored!", + target.nickname or def.name, target.hp - before))) return true end @@ -2126,7 +2131,8 @@ function OverworldState:tryHiddenObject(fx, fy) -- leaves the spot unfound; _CantCarryMoreText is the Toss line (#872) local name = Game.data.items[h.item] and Game.data.items[h.item].name or h.item Game.stack:push(TextBox.new(Game, - Strings("%s found\n%s!", save.player.name, name) .. "\f" + romText(Game.data, "_FoundHiddenItemText", "%s found\n%s!", + save.player.name, name) .. "\f" .. romText(Game.data, "_HiddenItemBagFullText", "But, {PLAYER} has\nno more room for\vother items!"))) return true @@ -2137,7 +2143,8 @@ function OverworldState:tryHiddenObject(fx, fy) -- text_asm tail runs it as PlaySoundWaitForCurrent + -- WaitForSoundToFinish once the box has printed (hidden_items.asm) Game.stack:push(TextBox.new(Game, - Strings("%s found\n%s!", save.player.name, name), + romText(Game.data, "_FoundHiddenItemText", "%s found\n%s!", + save.player.name, name), nil, TextBox.soundOpts(Game, "Get_Item2"))) return true end @@ -2795,8 +2802,8 @@ function OverworldState:talkTo(npc) "No more room for\nitems!") if GameVersion.isYellow() then local name = Game.data.items[d.item] and Game.data.items[d.item].name or d.item - noRoom = Strings("%s found\n%s!", Game.save.player.name, name) - .. "\f" .. noRoom + noRoom = romText(Game.data, "_FoundItemText", "%s found\n%s!", + Game.save.player.name, name) .. "\f" .. noRoom end Game.stack:push(TextBox.new(Game, noRoom)) return @@ -2813,7 +2820,8 @@ function OverworldState:talkTo(npc) local ddef = Game.data.items[d.item] -- FoundItemText: text_far, sound_get_item_1, text_end (pick_up_item.asm) Game.stack:push(TextBox.new(Game, - Strings("%s found\n%s!", Game.save.player.name, name), nil, + romText(Game.data, "_FoundItemText", "%s found\n%s!", + Game.save.player.name, name), nil, TextBox.soundOpts(Game, (ddef and ddef.keyItem) and "Get_Key_Item" or "Get_Item1"))) return @@ -3745,7 +3753,7 @@ function OverworldState:applyFieldPoison() local queue = {} for _, mon in ipairs(fainted) do local name = mon.nickname or Game.data.pokemon[mon.species].name - table.insert(queue, Strings("%s\nfainted!", name)) + table.insert(queue, romText(Game.data, "_PokemonFaintedText", "%s\nfainted!", name)) end local alive = false for _, mon in ipairs(save.party) do