summaryrefslogtreecommitdiff
path: root/home/scrolling_menu.asm
blob: 2ea69ef503999c77292d700cd491977ff076c84f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
INCLUDE "constants.asm"

SECTION "home/scrolling_menu.asm", ROM0

Function3810::
	ld e, [hl]
	inc hl
	ld d, [hl]
	inc hl
	push hl
	ld h, d
	ld l, e
	call CopyMenuHeader
	pop hl
	ld e, [hl]
	inc hl
	ld d, [hl]
	inc hl
	ld a, [de]
	ld [wMenuCursorBuffer], a
	push de
	ld e, [hl]
	inc hl
	ld d, [hl]
	inc hl
	ld a, [de]
	ld [wMenuScrollPosition], a
	push de
	call ScrollingMenu
	pop de
	ld a, [wMenuScrollPosition]
	ld [de], a
	pop de
	ld a, [wMenuCursorY]
	ld [de], a
	ld a, [wMenuJoypad]
	ret

ScrollingMenu::
	call CopyMenuData
	ldh a, [hROMBank]
	push af

	ld a, BANK(_InitScrollingMenu) ; and BANK(_ScrollingMenu)
	call Bankswitch

	call _InitScrollingMenu
	call SetPalettes
	call _ScrollingMenu

	pop af
	call Bankswitch

	ld a, [wMenuJoypad]
	ret

Function385a::
	push hl
	jr asm_3865

Function385d::
	callab Function_8f1cb
asm_3865:
	pop hl
	call MenuTextBox
	ld c, $0
	call Function3872
	call CloseWindow
	ret

Function3872::
	push bc
	jr asm_387d

Function3875::
	callab PlaySpriteAnimationsAndDelayFrame
asm_387d:
	pop bc
	call GetJoypad
	ldh a, [hJoyDown]
	and A_BUTTON | B_BUTTON
	jr nz, .done
	ld a, c
	and a
	jr z, Function3872
	dec c
	jr z, Function3872
.done:
	ret