; Quick-warp menu, opened with SELECT in the overworld (hooked in ; home/overworld.asm). Hides the overworld sprites, clears the screen, and draws ; a single-spaced destination list. On selection it reuses the fly-warp ; machinery (wDestinationMap + BIT_FLY_WARP) to warp in at the destination's ; fly coordinates. BIT_USED_FLY is deliberately NOT set, so arrival uses the ; teleport-in animation (the departure bird is redirected to a plain fade in ; engine/overworld/player_animations.asm). DEF WARP_COUNT EQU 13 SECTION "Warp Menu", ROMX WarpMenu:: ; single-space the list text ( = 1 row) and the menu cursor ldh a, [hUILayoutFlags] set BIT_SINGLE_SPACED_LINES, a set BIT_DOUBLE_SPACED_MENU, a ldh [hUILayoutFlags], a ; hide the overworld sprites so nothing shows behind the menu ld a, $ff ld [wUpdateSpritesEnabled], a call ClearSprites call ClearScreen ; banner, two centered lines above the box hlcoord 4, 0 ld de, WarpTitleText1 call PlaceString hlcoord 5, 1 ld de, WarpTitleText2 call PlaceString ; horizontally-centered menu box (screen is 20 wide; box is 13) hlcoord 3, 2 lb bc, 13, 11 call TextBoxBorder hlcoord 5, 3 ld de, WarpMenuText call PlaceString ; push wTileMap to VRAM and switch on the menu display (mirrors the tail of ; DisplayTextIDInit); the overworld renders the scrolled map straight to VRAM, ; so our box drawn into wTileMap would otherwise be invisible. ld b, HIGH(vBGMap1) call CopyScreenTileBufferToVRAM xor a ldh [hWY], a call LoadFontTilePatterns ld a, $01 ldh [hAutoBGTransferEnabled], a xor a ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld [wMenuWatchMovingOutOfBounds], a ld [wMenuJoypadPollCount], a ld a, 4 ld [wTopMenuItemX], a ; cursor column (text at column 5) ld a, 3 ld [wTopMenuItemY], a ; first item row ld a, PAD_A | PAD_B ld [wMenuWatchedKeys], a ld a, WARP_COUNT - 1 ld [wMaxMenuItem], a call HandleMenuInput push af ; save pressed keys ldh a, [hUILayoutFlags] ; restore default UI spacing res BIT_SINGLE_SPACED_LINES, a res BIT_DOUBLE_SPACED_MENU, a ldh [hUILayoutFlags], a pop af bit B_PAD_B, a jr nz, .cancel ; A pressed: look up the chosen map id and fire the fly-warp (no BIT_USED_FLY) ld a, [wCurrentMenuItem] ld e, a ld d, 0 ld hl, WarpMapTable add hl, de ld a, [hl] ld [wDestinationMap], a ld hl, wStatusFlags6 set BIT_FLY_WARP, [hl] ret ; overworld loop performs the warp .cancel ld a, $01 ld [wUpdateSpritesEnabled], a ; re-enable overworld sprites call LoadScreenTilesFromBuffer2 jp CloseTextDisplay ; redraw the overworld and return WarpMenuText: db "PALLET" next "VIRIDIAN" next "PEWTER" next "CERULEAN" next "LAVENDER" next "VERMILION" next "CELADON" next "FUCHSIA" next "CINNABAR" next "INDIGO" next "SAFFRON" next "ROUTE 4" next "ROUTE 10@" WarpMapTable: db PALLET_TOWN, VIRIDIAN_CITY, PEWTER_CITY, CERULEAN_CITY, LAVENDER_TOWN db VERMILION_CITY, CELADON_CITY, FUCHSIA_CITY, CINNABAR_ISLAND, INDIGO_PLATEAU db SAFFRON_CITY, ROUTE_4, ROUTE_10 WarpTitleText1: db "SECRET SL0P@" WarpTitleText2: db "WARP MENU@"