From 0e49aef88ef94b9d3e80d89e4eb718e9425045df Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Wed, 7 Jan 2026 22:05:37 -0500 Subject: Use macros to enforce "hidden object" constraints, and rename them to "hidden events" (#559) --- home/hidden_events.asm | 39 +++++++++++++++++++++++++++++++++++++++ home/hidden_objects.asm | 39 --------------------------------------- home/overworld.asm | 4 ++-- 3 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 home/hidden_events.asm delete mode 100644 home/hidden_objects.asm (limited to 'home') diff --git a/home/hidden_events.asm b/home/hidden_events.asm new file mode 100644 index 00000000..5acc95d9 --- /dev/null +++ b/home/hidden_events.asm @@ -0,0 +1,39 @@ +UpdateCinnabarGymGateTileBlocks:: + farjp UpdateCinnabarGymGateTileBlocks_ + +CheckForHiddenEventOrBookshelfOrCardKeyDoor:: + ldh a, [hLoadedROMBank] + push af + ldh a, [hJoyHeld] + bit B_PAD_A, a + jr z, .nothingFound +; A button is pressed + ld a, BANK(CheckForHiddenEvent) + ld [rROMB], a + ldh [hLoadedROMBank], a + call CheckForHiddenEvent + ldh a, [hDidntFindAnyHiddenEvent] + and a + jr nz, .hiddenEventNotFound + ld a, [wHiddenEventFunctionRomBank] + ld [rROMB], a + ldh [hLoadedROMBank], a + ld de, .returnAddress + push de + jp hl +.returnAddress + xor a + jr .done +.hiddenEventNotFound + farcall PrintBookshelfText + ldh a, [hInteractedWithBookshelf] + and a + jr z, .done +.nothingFound + ld a, $ff +.done + ldh [hItemAlreadyFound], a + pop af + ld [rROMB], a + ldh [hLoadedROMBank], a + ret diff --git a/home/hidden_objects.asm b/home/hidden_objects.asm deleted file mode 100644 index bb513b9d..00000000 --- a/home/hidden_objects.asm +++ /dev/null @@ -1,39 +0,0 @@ -UpdateCinnabarGymGateTileBlocks:: - farjp UpdateCinnabarGymGateTileBlocks_ - -CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: - ldh a, [hLoadedROMBank] - push af - ldh a, [hJoyHeld] - bit B_PAD_A, a - jr z, .nothingFound -; A button is pressed - ld a, BANK(CheckForHiddenObject) - ld [rROMB], a - ldh [hLoadedROMBank], a - call CheckForHiddenObject - ldh a, [hDidntFindAnyHiddenObject] - and a - jr nz, .hiddenObjectNotFound - ld a, [wHiddenObjectFunctionRomBank] - ld [rROMB], a - ldh [hLoadedROMBank], a - ld de, .returnAddress - push de - jp hl -.returnAddress - xor a - jr .done -.hiddenObjectNotFound - farcall PrintBookshelfText - ldh a, [hInteractedWithBookshelf] - and a - jr z, .done -.nothingFound - ld a, $ff -.done - ldh [hItemAlreadyFound], a - pop af - ld [rROMB], a - ldh [hLoadedROMBank], a - ret diff --git a/home/overworld.asm b/home/overworld.asm index 58550167..a06a32da 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -87,10 +87,10 @@ OverworldLoopLessDelay:: jp nz, .noDirectionButtonsPressed call IsPlayerCharacterBeingControlledByGame jr nz, .checkForOpponent - call CheckForHiddenObjectOrBookshelfOrCardKeyDoor + call CheckForHiddenEventOrBookshelfOrCardKeyDoor ldh a, [hItemAlreadyFound] and a - jp z, OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found + jp z, OverworldLoop ; jump if a hidden event or bookshelf was found, but not if a card key door was found call IsSpriteOrSignInFrontOfPlayer ldh a, [hTextID] and a -- cgit v1.3.1-sl0p