summaryrefslogtreecommitdiff
path: root/home/hidden_objects.asm
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2020-07-07 19:48:22 -0400
committerGitHub <noreply@github.com>2020-07-07 19:48:22 -0400
commit9571c550b6a0dcb3a4f54513c881661a87271024 (patch)
treed73507228a57e4f3cece2fb93fe7df3a9439553f /home/hidden_objects.asm
parentc480632d5494d04f7f5f0298a31877a2293b564e (diff)
parentbbf2f51a02b2544f1bef32a5868503b474ae2fef (diff)
Merge pull request #263 from Rangi42/master
Syncing style with pokecrystal
Diffstat (limited to 'home/hidden_objects.asm')
-rw-r--r--home/hidden_objects.asm39
1 files changed, 39 insertions, 0 deletions
diff --git a/home/hidden_objects.asm b/home/hidden_objects.asm
new file mode 100644
index 00000000..eccf1c8f
--- /dev/null
+++ b/home/hidden_objects.asm
@@ -0,0 +1,39 @@
+UpdateCinnabarGymGateTileBlocks::
+ farjp UpdateCinnabarGymGateTileBlocks_
+
+CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
+ ldh a, [hLoadedROMBank]
+ push af
+ ldh a, [hJoyHeld]
+ bit 0, a ; A button
+ jr z, .nothingFound
+; A button is pressed
+ ld a, BANK(CheckForHiddenObject)
+ ld [MBC1RomBank], a
+ ldh [hLoadedROMBank], a
+ call CheckForHiddenObject
+ ldh a, [hDidntFindAnyHiddenObject]
+ and a
+ jr nz, .hiddenObjectNotFound
+ ld a, [wHiddenObjectFunctionRomBank]
+ ld [MBC1RomBank], a
+ ldh [hLoadedROMBank], a
+ ld de, .returnAddress
+ push de
+ jp hl
+.returnAddress
+ xor a
+ jr .done
+.hiddenObjectNotFound
+ farcall PrintBookshelfText
+ ldh a, [hFFDB]
+ and a
+ jr z, .done
+.nothingFound
+ ld a, $ff
+.done
+ ldh [hItemAlreadyFound], a
+ pop af
+ ld [MBC1RomBank], a
+ ldh [hLoadedROMBank], a
+ ret