summaryrefslogtreecommitdiff
path: root/home/scrolling_menu.asm
diff options
context:
space:
mode:
authorentrpntr <12521136+entrpntr@users.noreply.github.com>2020-05-15 12:57:29 -0400
committerGitHub <noreply@github.com>2020-05-15 12:57:29 -0400
commit88d7e9a34a8b610b358cec1ccc6660634ca9ce80 (patch)
tree709f2f908d9e1c2f7a882d628ff09b80de3c9e8b /home/scrolling_menu.asm
parenta7e3a999ff21ecac0bfbe7f091f9ff901075a323 (diff)
parent6231351906960364a5ad2f34efefd809cceb0eb8 (diff)
Merge pull request #19 from libjet/home-cleanup
Home and HRAM cleanup
Diffstat (limited to 'home/scrolling_menu.asm')
-rwxr-xr-xhome/scrolling_menu.asm61
1 files changed, 61 insertions, 0 deletions
diff --git a/home/scrolling_menu.asm b/home/scrolling_menu.asm
new file mode 100755
index 00000000..6b8c1595
--- /dev/null
+++ b/home/scrolling_menu.asm
@@ -0,0 +1,61 @@
+ScrollingMenu::
+ call CopyMenuData
+ ldh a, [hROMBank]
+ push af
+
+ ld a, BANK(_ScrollingMenu) ; aka BANK(_InitScrollingMenu)
+ rst Bankswitch
+
+ call _InitScrollingMenu
+ call .UpdatePalettes
+ call _ScrollingMenu
+
+ pop af
+ rst Bankswitch
+
+ ld a, [wMenuJoypad]
+ ret
+
+.UpdatePalettes:
+ ld hl, wVramState
+ bit 0, [hl]
+ jp nz, UpdateTimePals
+ jp SetPalettes
+
+InitScrollingMenu::
+ ld a, [wMenuBorderTopCoord]
+ dec a
+ ld b, a
+ ld a, [wMenuBorderBottomCoord]
+ sub b
+ ld d, a
+ ld a, [wMenuBorderLeftCoord]
+ dec a
+ ld c, a
+ ld a, [wMenuBorderRightCoord]
+ sub c
+ ld e, a
+ push de
+ call Coord2Tile
+ pop bc
+ jp Textbox
+
+JoyTextDelay_ForcehJoyDown::
+ call DelayFrame
+
+ ldh a, [hInMenu]
+ push af
+ ld a, $1
+ ldh [hInMenu], a
+ call JoyTextDelay
+ pop af
+ ldh [hInMenu], a
+
+ ldh a, [hJoyLast]
+ and D_RIGHT + D_LEFT + D_UP + D_DOWN
+ ld c, a
+ ldh a, [hJoyPressed]
+ and A_BUTTON + B_BUTTON + SELECT + START
+ or c
+ ld c, a
+ ret \ No newline at end of file