diff options
| author | Ash Ketchum <no-reply@sl0p.foo> | 2026-07-15 00:47:51 +0200 |
|---|---|---|
| committer | Ash Ketchum <no-reply@sl0p.foo> | 2026-07-15 00:47:51 +0200 |
| commit | 32933002c9c0dbca782f9e976b9648a639a0cc25 (patch) | |
| tree | 526b624e5f013f6c66d65c54e0899c89b7af141d | |
| parent | warp: SELECT opens quick-warp (B1) + relocate intro-skip to PlayIntro (diff) | |
| download | pokeyellow-32933002c9c0dbca782f9e976b9648a639a0cc25.tar.gz pokeyellow-32933002c9c0dbca782f9e976b9648a639a0cc25.tar.xz pokeyellow-32933002c9c0dbca782f9e976b9648a639a0cc25.zip | |
warp: full quick-warp menu (B2)
SELECT in the overworld now opens a drawn town list (Pallet..Indigo) with a
moving cursor; A warps to the highlighted town via the fly-warp machinery, B
cancels. WarpMenu draws its box into wTileMap then replicates the tail of
DisplayTextIDInit (CopyScreenTileBufferToVRAM + hWY=0 + LoadFontTilePatterns +
hAutoBGTransferEnabled) so the menu is actually pushed to the screen - without
it the box drew into the shadow buffer but the overworld's direct-to-VRAM
scrolled map left it invisible. HandleMenuInput drives selection; the chosen
index maps through WarpMapTable to a map id.
| -rw-r--r-- | engine/warp_menu.asm | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/engine/warp_menu.asm b/engine/warp_menu.asm index 17cc3904..d31aba45 100644 --- a/engine/warp_menu.asm +++ b/engine/warp_menu.asm @@ -1,17 +1,75 @@ ; Quick-warp menu, opened with SELECT in the overworld (hooked in -; home/overworld.asm). Reuses the game's fly-warp machinery: set the -; destination map and the fly-warp flags, then return to the overworld loop, -; which fades out and warps us in at the destination's fly coordinates. +; home/overworld.asm). Draws a town list, and on selection reuses the game's +; fly-warp machinery (wDestinationMap + BIT_FLY_WARP/BIT_USED_FLY); the +; overworld loop then fades out and warps us in at the destination fly coords. + +DEF WARP_COUNT EQU 10 SECTION "Warp Menu", ROMX WarpMenu:: -; B1 (pipeline validation): unconditionally warp to Pallet Town. - ld a, PALLET_TOWN + call SaveScreenTilesToBuffer2 ; stash the overworld so we can restore + hlcoord 0, 0 + lb bc, 11, 11 + call TextBoxBorder + hlcoord 2, 1 + ld de, WarpMenuText + call PlaceString +; push wTileMap to VRAM and switch on the menu/window display (the overworld +; renders the scrolled map straight to VRAM, so without this our box drawn into +; wTileMap would be invisible - mirrors the tail of DisplayTextIDInit) + 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 + inc a ; 1 + ld [wTopMenuItemX], a ; cursor column (text is at column 2) + 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 + bit B_PAD_B, a + jr nz, .cancel +; A pressed: look up the chosen map id and fire the fly-warp + 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] ASSERT wStatusFlags6 + 1 == wStatusFlags7 inc hl set BIT_USED_FLY, [hl] - ret + ret ; overworld loop performs the warp +.cancel + call LoadScreenTilesFromBuffer2 + jp CloseTextDisplay ; redraw the overworld and return + +WarpMenuText: + db "PALLET" + next "VIRIDIAN" + next "PEWTER" + next "CERULEAN" + next "VERMILION" + next "CELADON" + next "FUCHSIA" + next "SAFFRON" + next "CINNABAR" + next "INDIGO@" + +WarpMapTable: + db PALLET_TOWN, VIRIDIAN_CITY, PEWTER_CITY, CERULEAN_CITY, VERMILION_CITY + db CELADON_CITY, FUCHSIA_CITY, SAFFRON_CITY, CINNABAR_ISLAND, INDIGO_PLATEAU |
