From 1a494d70ad252b08185342cbfaae018740fcde30 Mon Sep 17 00:00:00 2001 From: Ash Ketchum Date: Wed, 15 Jul 2026 15:01:08 +0200 Subject: EXPLORE: animate the approach to map edges instead of hard-jumping At a map boundary, smooth-scroll the remaining (even) distance up to the edge, then either cross into the connected map (one unavoidable instant load) or, with no connection, stop smoothly at the edge. Previously any edge move hard-jumped a whole screen; now only crossing from exactly on a boundary snaps. --- engine/slop_menu.asm | 94 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 62 insertions(+), 32 deletions(-) diff --git a/engine/slop_menu.asm b/engine/slop_menu.asm index acad203c..36654111 100644 --- a/engine/slop_menu.asm +++ b/engine/slop_menu.asm @@ -349,10 +349,7 @@ SlopExplore: ld a, [wYCoord] sub SLOP_PAGE_Y jp nc, .moveUp - ld hl, wNorthConnectedMap - ld de, wNorthConnectedMapYAlignment - ld a, 0 ; clamp target = top - jp .crossV + jp .edgeUp .ckDown bit B_PAD_DOWN, d jr z, .ckLeft @@ -364,20 +361,14 @@ SlopExplore: cp b jp c, .moveDown jp z, .moveDown - ld hl, wSouthConnectedMap - ld de, wSouthConnectedMapYAlignment - ld a, b ; clamp target = max Y - jp .crossV + jp .edgeDown .ckLeft bit B_PAD_LEFT, d jr z, .ckRight ld a, [wXCoord] sub SLOP_PAGE_X jp nc, .moveLeft - ld hl, wWestConnectedMap - ld de, wWestConnectedMapYAlignment - ld a, 0 - jp .crossH + jp .edgeLeft .ckRight bit B_PAD_RIGHT, d jp z, .input @@ -389,10 +380,7 @@ SlopExplore: cp b jp c, .moveRight jp z, .moveRight - ld hl, wEastConnectedMap - ld de, wEastConnectedMapYAlignment - ld a, b - jp .crossH + jp .edgeRight ; in-map page moves: smooth-scroll one screen, then just redraw the arrows ; (the scroll already left the destination view on screen in rotated VRAM). .moveUp @@ -411,13 +399,63 @@ SlopExplore: ld c, SLOP_PAGE_X call SlopScrollRight jp .renderArrows -; vertical cross (up/down): hl -> connected-map byte, de -> its YAlignment, -; a = Y to clamp to when there is no connection. +; ---- map-edge handling ---- +; A full page won't fit before the edge, so smooth-scroll the remaining (even) +; distance right up to the edge, then either cross into the connected map (one +; unavoidable instant load) or, if there's no connection that way, just stop at +; the edge. This keeps the motion smooth instead of hard-jumping a whole screen. +.edgeUp + ld a, [wYCoord] + and $fe ; even coords remaining to the top edge + jr z, .edgeUpCross + ld c, a + call SlopScrollUp +.edgeUpCross + ld hl, wNorthConnectedMap + ld de, wNorthConnectedMapYAlignment + jp .crossV +.edgeDown + ld a, [wCurrentMapHeight2] + dec a ; max Y + ld hl, wYCoord + sub [hl] ; maxY - wYCoord + and $fe + jr z, .edgeDownCross + ld c, a + call SlopScrollDown +.edgeDownCross + ld hl, wSouthConnectedMap + ld de, wSouthConnectedMapYAlignment + jp .crossV +.edgeLeft + ld a, [wXCoord] + and $fe + jr z, .edgeLeftCross + ld c, a + call SlopScrollLeft +.edgeLeftCross + ld hl, wWestConnectedMap + ld de, wWestConnectedMapYAlignment + jp .crossH +.edgeRight + ld a, [wCurrentMapWidth2] + dec a ; max X + ld hl, wXCoord + sub [hl] ; maxX - wXCoord + and $fe + jr z, .edgeRightCross + ld c, a + call SlopScrollRight +.edgeRightCross + ld hl, wEastConnectedMap + ld de, wEastConnectedMapYAlignment + jp .crossH +; vertical cross: hl -> connected-map byte, de -> its YAlignment. With no +; connection we're already scrolled to the edge, so just redraw the arrows. .crossV - ld b, a ld a, [hl] inc a - jr z, .clampY ; $ff -> no connection + jr z, .clampArrows ; $ff -> no connection ld a, [de] ; YAlignment -> new Y (absolute) ld c, a inc de @@ -432,17 +470,11 @@ SlopExplore: ld [wCurMap], a call LoadMapData jp .renderView -.clampY - ld a, b - ld [wYCoord], a - jp .renderView -; horizontal cross (left/right): hl -> connected-map byte, de -> its YAlignment, -; a = X to clamp to when there is no connection. +; horizontal cross: hl -> connected-map byte, de -> its YAlignment. .crossH - ld b, a ld a, [hl] inc a - jr z, .clampX + jr z, .clampArrows ld a, [de] ; YAlignment -> added to Y ld c, a inc de @@ -455,10 +487,8 @@ SlopExplore: ld [wCurMap], a call LoadMapData jp .renderView -.clampX - ld a, b - ld [wXCoord], a - jp .renderView +.clampArrows + jp .renderArrows ; ---- A: warp the player to the walkable tile nearest the screen centre ---- ; the centre tile is wTileMap(col 8,row 9) = coord (wYCoord,wXCoord); a coord ; offset (dy,dx) maps to wTileMap(8+2dx, 9+2dy). Scan outward for a passable tile. -- cgit v1.3.1-sl0p