aboutsummaryrefslogtreecommitdiffstats
path: root/engine/events/hidden_objects/bookshelves.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-07-03 13:23:51 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-07-03 13:23:51 -0400
commite882708b85e19cf30e05fcf31ccedc5f03367702 (patch)
tree05d84be6cc3b04ccabdc4071f601a9761e845775 /engine/events/hidden_objects/bookshelves.asm
parentReorganize home header (diff)
downloadpokeyellow-e882708b85e19cf30e05fcf31ccedc5f03367702.tar.gz
pokeyellow-e882708b85e19cf30e05fcf31ccedc5f03367702.tar.xz
pokeyellow-e882708b85e19cf30e05fcf31ccedc5f03367702.zip
Split up engine/events/hidden_object_functions
Diffstat (limited to 'engine/events/hidden_objects/bookshelves.asm')
-rw-r--r--engine/events/hidden_objects/bookshelves.asm39
1 files changed, 39 insertions, 0 deletions
diff --git a/engine/events/hidden_objects/bookshelves.asm b/engine/events/hidden_objects/bookshelves.asm
new file mode 100644
index 00000000..82cd8843
--- /dev/null
+++ b/engine/events/hidden_objects/bookshelves.asm
@@ -0,0 +1,39 @@
+; prints text for bookshelves in buildings without sign events
+PrintBookshelfText::
+ ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
+ cp SPRITE_FACING_UP
+ jr nz, .noMatch
+; facing up
+ ld a, [wCurMapTileset]
+ ld b, a
+ aCoord 8, 7
+ ld c, a
+ ld hl, BookshelfTileIDs
+.loop
+ ld a, [hli]
+ cp $ff
+ jr z, .noMatch
+ cp b
+ jr nz, .nextBookshelfEntry1
+ ld a, [hli]
+ cp c
+ jr nz, .nextBookshelfEntry2
+ ld a, [hl]
+ push af
+ call EnableAutoTextBoxDrawing
+ pop af
+ call PrintPredefTextID
+ xor a
+ ld [$ffdb], a
+ ret
+.nextBookshelfEntry1
+ inc hl
+.nextBookshelfEntry2
+ inc hl
+ jr .loop
+.noMatch
+ ld a, $ff
+ ld [$ffdb], a
+ jpba PrintCardKeyText
+
+INCLUDE "data/tilesets/bookshelf_tile_ids.asm"