From bf910f66bafedf92be60b5457e6ea2621aaabab8 Mon Sep 17 00:00:00 2001 From: Ash Ketchum Date: Wed, 15 Jul 2026 12:23:17 +0200 Subject: explore: hide player (camera) + fix menu close - UpdatePlayerSprite: when wSlopNoclip is set, jump to .disableSprite so the player sprite is hidden -> true free-roam camera (bankable bank, no ROM0 cost). - SlopExplore was returning carry-set into .exitProceed, which bare-returns and assumes a warp will redraw the screen; since noclip doesn't warp, the menu window lingered. Now it closes like the B path (SlopMenuRestoreFlags + push bank + jp CloseTextDisplay) so the overworld is rebuilt cleanly. - SL0P.md: document EXPLORE noclip camera + the hooks. Verified A/B in Pallet: noclip on -> player gone, walls/seams passable; off -> player back, collision restored, menu closes cleanly. --- SL0P.md | 14 ++++++++++---- engine/overworld/movement.asm | 3 +++ engine/slop_menu.asm | 11 +++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/SL0P.md b/SL0P.md index a498a3eb..9501a0d6 100644 --- a/SL0P.md +++ b/SL0P.md @@ -37,17 +37,23 @@ A table-driven cheat menu. Cursor + A to pick, B to back out / close. | **ITEMS** | submenu: give ×99 of balls, Rare Candy, Full Restore, Max Revive, Max Elixer, PP Up, and all five evolution stones | | **NOWILD** | toggle wild encounters off (shows `ON`) | | **REPEL** | refill repel steps | +| **EXPLORE** | toggle noclip free-roam camera: hides the player + disables collision, so you glide through walls/NPCs/ledges and cross map connection seams seamlessly across the whole overworld. Pick it again to turn off. | Everything is in `engine/slop_menu.asm`. Adding a new entry = add a name to `SlopMenuText`, a `dw Handler` to `SlopMenuHandlers`, and bump `SLOP_MENU_COUNT`. Handlers return carry set (a warp/exit was started) or clear (back to the menu), and can be submenus or one-shot actions. -Persistent toggle flags live in `wSlopNoWild` (the repurposed unused `wc5d8`). +Persistent toggle flags: `wUnusedFlag` (NOWILD) and `wSlopNoclip` (EXPLORE, the +repurposed unused `wUnusedObtainedBadges` at D356). -### TODO -- **NOCLIP** (walk-through-walls): prototyped, but its hook lands in the full - home bank (ROM0). Needs ~5 bytes of home budget reclaimed first. +**EXPLORE / noclip** hooks the home `CollisionCheckOnLand` (5-byte early-out when +`wSlopNoclip` is set; ROM0 room was reclaimed by deleting the unreferenced +`Func_0db5` dead farcall in `LoadMapHeader`) and `UpdatePlayerSprite` in +`engine/overworld/movement.asm` (jump to its `.disableSprite` path to hide the +player). The engine's own player-walk + connection-crossing code then carries you +seamlessly across the world -- see `tools/render_overworld.py` for the ground- +truth map that proved connections join maps along shared edges with an offset. ## Build diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 165208eb..e4ff3e05 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -1,6 +1,9 @@ DEF MAP_TILESET_SIZE EQU $60 UpdatePlayerSprite: + ld a, [wSlopNoclip] ; SL0P camera: hide the player sprite while noclipping + and a + jr nz, .disableSprite ld a, [wSpritePlayerStateData2WalkAnimationCounter] and a jr z, .checkIfTextBoxInFrontOfSprite diff --git a/engine/slop_menu.asm b/engine/slop_menu.asm index e3b07fe6..b4b7f78e 100644 --- a/engine/slop_menu.asm +++ b/engine/slop_menu.asm @@ -231,8 +231,15 @@ SlopExplore: ld a, [wSlopNoclip] xor $01 ld [wSlopNoclip], a - scf ; carry set -> close menu, back to overworld - ret +; close the menu the same way the B button does (rebuild the overworld) instead +; of .exitProceed, which only bare-returns and assumes a warp will redraw. + pop hl ; drop the pushed .afterHandler return address + call SlopMenuRestoreFlags + ld a, $01 + ld [wUpdateSpritesEnabled], a + ldh a, [hLoadedROMBank] + push af + jp CloseTextDisplay ; =========================================================================== ; ITEMS submenu: give 99 of the chosen item (stacks via GiveItem) -- cgit v1.3.1-sl0p