This commit is contained in:
bryanthaboi
2026-08-18 11:43:23 -04:00
parent bd1046f398
commit abf95ce1c4
2 changed files with 94 additions and 0 deletions
+7
View File
@@ -329,6 +329,10 @@ function OverworldState:setMap(mapId, x, y, facing, opts)
MapLoader.invalidateAll()
end
self.map = MapLoader.load(Game.data, mapId)
-- EnterMap -> ClearVariablesOnEnterMap zeroes wStepCounter
-- (engine/overworld/clear_variables.asm:7), but a connection crossing
-- never reaches EnterMap (home/overworld.asm:675 .loadNewMap)
if not (opts and opts.seamless) then Game.save.poisonSteps = 0 end
-- STRENGTH deactivates on every real map load (home/overworld.asm
-- EnterMap -> ResetUsingStrengthOutOfBattleBit clears BIT_STRENGTH_ACTIVE
-- of wStatusFlags1). setMap is the single choke point for every map-id
@@ -4296,6 +4300,9 @@ end
-- battle is optional; when given, Oak's Lab OPP_RIVAL1 losses skip the
-- blackout (pret HandlePlayerBlackOut) so the map script can HealParty.
function OverworldState:afterBattle(result, battle)
-- .battleOccurred tail-jumps to EnterMap (home/overworld.asm:353), so
-- ClearVariablesOnEnterMap zeroes wStepCounter on every battle return
Game.save.poisonSteps = 0
if battle and battle.kind == "wild" then
self.wildEncounterGraceSteps = WILD_ENCOUNTER_GRACE_STEPS
end