mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-26 15:31:15 +02:00
CLOSES #1478, CLOSES #1479, CLOSES #1488, CLOSES #1510, CLOSES #1511, CLOSES #1514, CLOSES #1521, CLOSES #1522, CLOSES #1545, CLOSES #1557, CLOSES #1563, CLOSES #1565, CLOSES #1566, CLOSES #1577, CLOSES #1594, CLOSES #1596, CLOSES #1606, CLOSES #1608
This commit is contained in:
@@ -2967,25 +2967,24 @@ function OverworldState:openPC(onDone)
|
||||
self:openOaksPC(done)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- PKMN LEAGUE sits between PROF.OAK's PC and LOG OFF once wNumHoFTeams
|
||||
-- is nonzero (engine/pokemon/bills_pc.asm:5, :49)
|
||||
if #(Game.save.hallOfFame or {}) > 0 then
|
||||
table.insert(items, {
|
||||
label = Strings("<PK><MN>LEAGUE"),
|
||||
keepOpen = true,
|
||||
onSelect = function()
|
||||
-- pc.asm PKMNLeague plays SFX_ENTER_PC, then PKMNLeaguePC prints
|
||||
-- AccessedHoFPCText (engine/menus/pc.asm:67, league_pc.asm:2)
|
||||
require("src.core.Sound").play(Game.data, "Enter_PC")
|
||||
Game.stack:push(TextBox.new(Game,
|
||||
romText(Game.data, "_AccessedHoFPCText",
|
||||
"Accessed POKéMON\nLEAGUE's site.\fAccessed the HALL\nOF FAME List."),
|
||||
function() Screens.push(Game, "LeaguePC") end))
|
||||
done()
|
||||
end,
|
||||
})
|
||||
-- engine/pokemon/bills_pc.asm:48-60 PKMN LEAGUE row (#1566)
|
||||
if #(Game.save.hallOfFame or {}) > 0 then
|
||||
table.insert(items, {
|
||||
label = Strings("<PK><MN>LEAGUE"),
|
||||
keepOpen = true,
|
||||
onSelect = function()
|
||||
-- pc.asm PKMNLeague plays SFX_ENTER_PC, then PKMNLeaguePC prints
|
||||
-- AccessedHoFPCText (engine/menus/pc.asm:67, league_pc.asm:2)
|
||||
require("src.core.Sound").play(Game.data, "Enter_PC")
|
||||
Game.stack:push(TextBox.new(Game,
|
||||
romText(Game.data, "_AccessedHoFPCText",
|
||||
"Accessed POKéMON\nLEAGUE's site.\fAccessed the HALL\nOF FAME List."),
|
||||
function() Screens.push(Game, "LeaguePC") end))
|
||||
done()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local hooked = Runtime.call("ui.pc.items", sameItems, Game, items)
|
||||
@@ -3320,7 +3319,8 @@ end
|
||||
-- the approach walk and then EngageMapTrainer with no further text: the
|
||||
-- caller already showed the box, so the battle starts without a second
|
||||
-- one (#869).
|
||||
function OverworldState:engageTrainer(npc, onDone, endBattleText, skipBattleText)
|
||||
function OverworldState:engageTrainer(npc, onDone, endBattleText, skipBattleText,
|
||||
endBattleSound, endBattleIsReward)
|
||||
local d = npc.def
|
||||
Runtime.emit("world.trainer_engaged", { npc = npc, trainerClass = d.trainerClass,
|
||||
partyIndex = d.trainerParty })
|
||||
@@ -3376,6 +3376,13 @@ function OverworldState:engageTrainer(npc, onDone, endBattleText, skipBattleText
|
||||
-- cuts (#282). Substituted here because BattleState:say takes finished
|
||||
-- text, while TextBox expanded the {PLAYER}/{RIVAL} tokens itself.
|
||||
battle.endBattleText = wonText and TextBox.substitute(Game, wonText) or nil
|
||||
-- the badge jingle rides the armed line's first page on the battle
|
||||
-- screen (sound_get_item_1 in _TX_PRE dialogue; see gyms.lua) (#1606)
|
||||
battle.endBattleSound = endBattleText ~= nil and endBattleSound or nil
|
||||
-- one truth for both checkVictoryRewards call sites; endBattleIsReward
|
||||
-- = false marks an armed line that is NOT the victories dialogue (#1606)
|
||||
battle.rewardDialogueShown = endBattleText ~= nil
|
||||
and endBattleIsReward ~= false
|
||||
battle.onFinish = function(result)
|
||||
if result == "win" then
|
||||
Game.save.defeatedTrainers[npc.id] = true
|
||||
@@ -3386,7 +3393,7 @@ function OverworldState:engageTrainer(npc, onDone, endBattleText, skipBattleText
|
||||
-- onVictory script UNDER whatever runs next, so the player still sees
|
||||
-- EndBattle (now inside the battle), then the reward, then AfterBattle
|
||||
self:checkVictoryRewards(d.trainerClass, d.trainerParty,
|
||||
endBattleText ~= nil)
|
||||
battle.rewardDialogueShown)
|
||||
self:afterBattle(result, battle)
|
||||
if onDone then onDone() end
|
||||
else
|
||||
@@ -4449,7 +4456,7 @@ function OverworldState:restoreBattleContinuation(battle, origin)
|
||||
game.save.defeatedTrainers[origin.npcId] = true
|
||||
if origin.event then game.save.flags[origin.event] = true end
|
||||
self:checkVictoryRewards(battle.oppClass, battle.partyIndex,
|
||||
battle.endBattleText ~= nil)
|
||||
battle.rewardDialogueShown)
|
||||
end
|
||||
self:afterBattle(result, battle)
|
||||
self.engaging = false
|
||||
|
||||
@@ -6017,8 +6017,14 @@ function World:trainerWinLossText()
|
||||
if not vm then return nil, nil end
|
||||
local obj = vm.trainerObject or {}
|
||||
local text = self.text or {}
|
||||
local winKey = vm.winTextOverride or obj.winText
|
||||
local lossKey = vm.lossTextOverride or obj.lossText
|
||||
-- `winlosstext` writes BOTH pointers; a 0 argument destroys the struct
|
||||
-- value rather than falling back to it (engine/overworld/scripting.asm:651)
|
||||
local winKey, lossKey
|
||||
if vm.winLossArmed then
|
||||
winKey, lossKey = vm.winTextOverride, vm.lossTextOverride
|
||||
else
|
||||
winKey, lossKey = obj.winText, obj.lossText
|
||||
end
|
||||
return winKey and text[winKey] or nil, lossKey and text[lossKey] or nil
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user