Port Fly, Dig, Teleport and the Escape Rope

FLY opens _FlyMap in the party menu: the region's Town Map with "Where?",
the visited flypoints in turn and the Fly user's icon, then FlyScript flies
the icon off along SpriteAnimFunc_FlyFrom's path, enters the spawn point and
lands it with SpriteAnimFunc_FlyTo. Teleport returns to the last Pokémon
Center's town through IsSpawnPoint. Dig and the Escape Rope lead out of a
cave to the warp EnterMapWarp's SaveDigWarp recorded, which saves now keep.

newloadmap stops its script as StopScript does and the world resumes it on
the new map, which the landing and return movements need. A destination
that is not ported yet gives a notice.

Closes #25

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-10-02 11:18:57 +02:00
1 parent c4cc0e756c
commit a7aceda089
21 files changed
+1166 -97

No files matched your search

+24 -4
View File
@@ -36,6 +36,7 @@ These paths refer to the pinned [PRET source](https://github.com/pret/pokecrysta
| `game/scripts/pokegear.ts` | `engine/pokegear/pokegear.asm`, `engine/phone/phone.asm`, `engine/phone/scripts/mom.asm`, `elm.asm`, `engine/rtc/print_hours_mins.asm` | `PokeGear` with each card's joypad handling: the clock (`Pokegear_UpdateClock`, `PrintHoursMins`), the map card's landmark cursor (`TownMap_InitCursorAndPlayerIconPositions`, `TownMap_GetKantoLandmarkLimits`), the phone list (`PokegearPhone_UpdateDisplayList`, `GetCallerClassAndName`, `PokegearPhoneContactSubmenu`, `CheckCanDeletePhoneNumber`) and calls (`MakePhoneCallFromPokegear`, `CheckPhoneContactTimeOfDay`, `GetMapPhoneService`, `HangUp`). Callee scripts run in the event interpreter on the start menu's draft. Screens are native; the radio's stations are not ported. |
| `game/scripts/trainer-card.ts` | `engine/menus/trainer_card.asm`, `engine/gfx/player_gfx.asm` (`GetCardPic`), `engine/gfx/cgb_layouts.asm` (`_CGB_TrainerCard`), `home/game_time.asm` | `TrainerCard`'s two reachable pages with their joypad rules, strings from `.Name_Money`, `.Dex_PlayTime` and `.Badges`, the caught count, and the badges from `TrainerCard_JohtoBadgesOAM` with their eight-frame steps. `rendering/trainer-card.ts` draws the card picture, leader faces and badges from the ROM with the card's palettes and attribute map. `world/game-time.ts` is `GameTimer` (capped at 999:59:59). Text is native; the blinking colon's and badges' phase start at the page load. |
| `game/scripts/options.ts` | `engine/menus/options_menu.asm`, `data/default_options.asm`, `engine/battle/core.asm` (`CheckWhetherToAskSwitch`), `engine/menus/start_menu.asm` | `_Option` with `OptionsControl` and each option's routine on the four option bytes, `DefaultOptions`, and the two settings consumed so far: `BATTLE_SHIFT` and `MENU_ACCOUNT`. Strings come from the ROM; the screen is native. |
| `game/scripts/fly-map.ts` | `engine/pokegear/pokegear.asm` (`_FlyMap`, `FlyMap`, `TownMapBubble`, `CheckIfVisitedFlypoint`), `data/maps/flypoints.asm`, `engine/events/field_moves.asm` (`FlyFromAnim`, `FlyToAnim`), `engine/sprite_anims/functions.asm` | The Fly map's region choice (Kanto only after Indigo Plateau, without the player's icon otherwise), the default flypoint and up/down scrolling over visited flypoints (`wVisitedSpawns` through the ROM's `EngineFlags`). The flights follow `SpriteAnimFunc_FlyFrom` and `SpriteAnimFunc_FlyTo` frame by frame with the party icon. The Town Map, bubble and icons are drawn natively; the leaves are not presented. |
| `game/scripts/evolution.ts` | `engine/pokemon/evolve.asm`, `engine/pokemon/learn.asm`, `engine/movie/evolution_animation.asm`, `engine/pokemon/party_menu.asm` | `EvolveAfterBattle`/`EvolvePokemon` over the raw evolution bytes, the evolution texts and a timed, B-stoppable picture sequence, `UpdateSpeciesNameIfNotNicknamed`, `CalcMonStats` and the HP rise, `LearnLevelMoves`, `LearnMove`/`ForgetMove` outside battle and `PlacePartyMonEvoStoneCompatibility`. |
| `game/rom/pokemon.ts` | `data/pokemon/base_stats`, `evos_attacks.asm`, `data/moves/moves.asm`, `data/items/attributes.asm`, `engine/gfx/load_pics.asm` | Species, move and item names, base data, evolution lists, learnsets, move PP, item pockets, growth-rate exp and front pictures (`FixPicBank`, `PadFrontpic`). Starter pictures match rebuilt bytes; all 251 evolution lists match the pinned source. |
| `game/party` | `engine/pokemon/move_mon.asm`, `engine/pokemon/caught_data.asm`, `engine/items/items.asm` | `GeneratePartyMonStats` for script gifts: DVs, `FillMoves`, PP, exp, `CalcMonStatC`, happiness and caught data. `PutItemInPocket`, key items and `TossItem`. `SendMonIntoBox`, `SendGetMonIntoFromBox` (deposit and withdraw), `RestorePPOfDepositedPokemon` and `CalcLevel` for the PC's boxes and item storage. TMs and HMs are refused. |
@@ -400,8 +401,11 @@ Badge, forced cycling, already surfing, water permission, `CheckDirection`
and `CheckFacingObject`), `StrengthFunction`, `FlashFunction`
(`SpecialAerodactylChamber` by map attributes, which sets
`EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER`, or `DARKNESS_PALSET`),
`TryWhirlpoolMenu`, `CheckMapCanWaterfall`, and the checks of Fly, Dig,
Teleport, Headbutt and Rock Smash. A success queues `Script_CutFromMenu`,
`TryWhirlpoolMenu`, `CheckMapCanWaterfall`, `FlyFunction` (the Storm
Badge, an outdoor map, then the Fly map), `EscapeRopeOrDig` (a cave or
dungeon with a `wDigWarpNumber`) and `TeleportFunction` (an outdoor map and
`IsSpawnPoint` on `wLastSpawnMapGroup`), and the checks of Headbutt and Rock
Smash. A success queues `Script_CutFromMenu`,
`SurfFromMenuScript`, `Script_StrengthFromMenu`, `Script_UseFlash`,
`Script_WhirlpoolFromMenu`, `Script_WaterfallFromMenu` or
`SweetScentFromMenu.SweetScent` with the field-move context the interpreter
@@ -409,8 +413,24 @@ already reads (`GetPartyNickname`, the replacement block, the surfing
state). New interpreter support: `callasm BlindingFlash` (sets the Flash
flag), `callasm SweetScentEncounter` (the encounter the world drew with
`CanEncounterWildMon`, `GetMapEncounterRate` and `ChooseWildEncounter`, no
rate roll) and `UseFlashTextScript`'s sound-only `text_asm`. Fly's map, Dig
and Teleport's warps, `TreeMonEncounter` and `RockMonEncounter` are not
rate roll) and `UseFlashTextScript`'s sound-only `text_asm`.
`FlyFunction.FlyScript`, `TeleportFunction.TeleportScript` and
`EscapeRopeOrDig.UsedDigScript` run with the chosen `wDefaultSpawnpoint` or
the dig warp's position. `newloadmap` handles `MAPSETUP_WARP`,
`MAPSETUP_TELEPORT` and `MAPSETUP_FLY` (`EnterMapSpawnPoint` from
`SpawnPoints`) and `MAPSETUP_DOOR` (`EnterMapWarp` to the warp Dig copies
into `wNextWarp`; the player keeps facing unless `CheckWarpFacingDown`),
then stops the script, which resumes on the new map. `EnterMapWarp`'s
`SaveDigWarp` records any warp from an outdoor map into an indoor one
(`CheckIndoorMap`), except from Mount Moon Square and Tin Tower's roof; saves
keep it as `digWarp`. `FlyFromAnim`, `FlyToAnim`, `HideSprites`,
`SkipUpdateMapSprites`, `.ReturnFromFly` and `WaitSFX` are accepted, the Fly
animations as timed `fly` effects (65 and 33 ticks). The Escape Rope
(`EscapeRopeEffect`) runs `EscapeRopeOrDig` from the pack, opening the Kabuto
chamber's wall there (`SpecialKabutoChamber`) and using up one rope; a
failure prints nothing before Oak's warning. `JumpRoamMons` (no roaming
Pokémon yet) and the fades are not modelled. A destination map that is not
ported gives a notice. `TreeMonEncounter` and `RockMonEncounter` are not
ported and give a notice after their checks.
`Softboiled_MilkDrinkFunction` runs in the menu with `GetOneFifthMaxHP`,
`RemoveHP` and `RestoreHealth`, refusing the user itself and Pokémon that