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

+51
View File
@@ -966,3 +966,54 @@ No emulator comparison; no CI or physical-device run.
Next: the Fly map and Teleport/Dig/Escape Rope warps (board #25), which
need script commands after a warp; then Headbutt and Rock Smash (#26).
The options increment was committed as `c4cc0e7` (`Closes #24`). Not pushed.
## Fly, Dig, Teleport and the Escape Rope: 2026-10-02
Resumed with "continue" on a clean tree after `c4cc0e7`, taking board card
#25.
- `src/game/scripts/fly-map.ts` (`flyMap`): `_FlyMap`/`FlyMap` inside the
start menu run, before the world queues `FlyFunction.FlyScript`. Region
by the current landmark (Kanto only with Indigo Plateau's flypoint, else
Johto without the player icon), default New Bark/Indigo, up/down over
visited flypoints with wrapping (refused if none is visited, where the
original hangs), A returns the spawn, B goes back to the party menu.
`flymap` effect answered with buttons (`FLY_MAP_BUTTONS`).
- Visits: `assets.spawnEngineFlag` inverts the ROM's `EngineFlags` over
`wVisitedSpawns` (Union Cave and the Fast Ship have no flag).
`assets.spawnPoint`/`spawnIndex` read `SpawnPoints` (`IsSpawnPoint`).
- Interpreter: `newloadmap` handles `MAPSETUP_WARP`/`TELEPORT`/`FLY`
(spawn from `fieldMove.spawn` or `GetWhiteoutSpawn`) and `MAPSETUP_DOOR`
(`fieldMove.warp`, resolved by the world), then stops; the `warp` effect
carries `resume` unless only `end`/`endall` follows, and refuses inside a
call. The world's `finishScript` starts the rest of the script right after
entering the map, with the same field-move context (`ActiveScript.fieldMove`).
`door` warps keep the facing unless `FACE_DOWN_ON_WARP`.
`FieldMoveContext` is now one exported type.
- `fly` effect (`FlyFromAnim` 65 ticks, `FlyToAnim` 33): `poses()` is empty,
`world.flyingIcon` replays `SpriteAnimFunc_FlyFrom`/`FlyTo` with the
ROM sine table, and the renderer draws `assets.monIcon` with
`RED_WALK`'s nine-frame flaps in object palette 0. Leaves not drawn.
- World: `SaveDigWarp` in `prepareWarp` (outdoor to `CheckIndoorMap`, not
from 15:10/15:12); `digWarpMove` for Dig and the Escape Rope (with
`SpecialKabutoChamber`); Teleport through `IsSpawnPoint`; an unported
destination gives a notice. Saves gained `digWarp` (absent → null).
- Start menu: `{ flyMap: true }` verdict, `host.flyTo`, `host.escapeRope`
(`MENU.EscapeRopeEffect`: `UseDisposableItem` only on success; failure
falls to Oak's warning), `host.visitedSpawn`.
- UI: `#fly-map` with the bubble and the Town Map (`drawTownMap` takes an
optional `player` and a `species` icon). Checked visually at desktop and
390px widths, including the flight and landing.
Checks: 423 unit tests with the local ROM (134 passed, 289 skipped without
it; new `tests/fly-dig-teleport.test.ts`); 121 Chromium/WebKit browser tests
passed, 19 skipped intentionally (a new Fly flow in both browsers, with a
"fly" fixture room); native and reference builds; reference, vendor and
release checks; `git diff --check`. No emulator comparison of the flight
paths or warps; no CI or physical-device run. None of it is reachable in
normal play yet (no Storm Badge, caves or further flypoints); Teleport
works after a Pokémon Center visit for a Pokémon that knows it.
Next: Headbutt and Rock Smash encounters (board #26).