diff options
| -rw-r--r-- | engine/slop_menu.asm | 92 |
1 files changed, 90 insertions, 2 deletions
diff --git a/engine/slop_menu.asm b/engine/slop_menu.asm index 38c5bdcf..fbcd222a 100644 --- a/engine/slop_menu.asm +++ b/engine/slop_menu.asm @@ -8,7 +8,7 @@ ; To add an entry: add a "NAME" line to SlopMenuText, a `dw Handler` to ; SlopMenuHandlers, and bump SLOP_MENU_COUNT. -DEF SLOP_MENU_COUNT EQU 12 +DEF SLOP_MENU_COUNT EQU 13 SECTION "Slop Menu", ROMX @@ -120,7 +120,8 @@ SlopMenuText: next "HMS" next "ITEMS" next "NOWILD" - next "REPEL@" + next "REPEL" + next "EXPLORE@" SlopOnText: db "ON@" SlopMenuHandlers: @@ -136,6 +137,7 @@ SlopMenuHandlers: dw GiveItemSubmenu dw SlopToggleNoWild dw SlopRepel + dw SlopExplore ; =========================================================================== @@ -214,6 +216,92 @@ WarpMapTable: ; =========================================================================== +; EXPLORE (P1): overworld map-connection browser. Renders the current map (no +; NPCs), and U/D/L/R jump to the connected map in that direction if one exists +; (via wCurMapConnections + the connection headers). B restores the original +; map and returns to the SL0P menu. No warping yet - read-only browse. +; =========================================================================== +SlopExplore: +; save origin map + coords on the stack + ld a, [wYCoord] + ld b, a + ld a, [wXCoord] + ld c, a + push bc + ld a, [wCurMap] + push af +.render +; seed safe coords (0,0 is in-bounds for any map), load the map to get its real +; dimensions + connections, then re-render centered on the map. + xor a + ld [wYCoord], a + ld [wXCoord], a + call LoadMapData + ld a, [wCurMapHeight] + ld [wYCoord], a + ld a, [wCurMapWidth] + ld [wXCoord], a + call LoadMapData ; render centered + ldh a, [rLCDC] ; hide ALL sprites (player + actors) via LCDC + res B_LCDC_OBJS, a + ldh [rLCDC], a + ld a, $90 + ldh [hWY], a ; window off-screen -> the BG map is visible +.input + call DelayFrame + call JoypadLowSensitivity + ldh a, [hJoyPressed] + ld d, a + bit B_PAD_B, d + jr nz, .exit + bit B_PAD_UP, d + jr z, .chkDown + ld a, [wCurMapConnections] + bit NORTH_F, a + jr z, .input + ld a, [wNorthConnectedMap] + ld [wCurMap], a + jr .render +.chkDown + bit B_PAD_DOWN, d + jr z, .chkLeft + ld a, [wCurMapConnections] + bit SOUTH_F, a + jr z, .input + ld a, [wSouthConnectedMap] + ld [wCurMap], a + jr .render +.chkLeft + bit B_PAD_LEFT, d + jr z, .chkRight + ld a, [wCurMapConnections] + bit WEST_F, a + jr z, .input + ld a, [wWestConnectedMap] + ld [wCurMap], a + jr .render +.chkRight + bit B_PAD_RIGHT, d + jr z, .input + ld a, [wCurMapConnections] + bit EAST_F, a + jr z, .input + ld a, [wEastConnectedMap] + ld [wCurMap], a + jr .render +.exit + pop af + ld [wCurMap], a ; restore origin map + pop bc + ld a, b + ld [wYCoord], a + ld a, c + ld [wXCoord], a + call LoadMapData ; reload the origin map + and a ; carry clear -> back to SL0P menu + ret + +; =========================================================================== ; ITEMS submenu: give 99 of the chosen item (stacks via GiveItem) ; =========================================================================== DEF GIVE_COUNT EQU 12 |
