2013-09-03 22:43:15 +00:00
|
|
|
; Functions used in displaying and handling menus.
|
|
|
|
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
LoadMenuDataHeader::
|
2015-07-15 19:48:44 +00:00
|
|
|
call CopyMenuDataHeader
|
2015-10-24 14:34:19 +00:00
|
|
|
call BackUpTiles
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
CopyMenuDataHeader::
|
2015-11-10 21:53:37 +00:00
|
|
|
ld de, wMenuDataHeader
|
|
|
|
ld bc, wMenuDataHeaderEnd - wMenuDataHeader
|
2013-09-03 22:43:15 +00:00
|
|
|
call CopyBytes
|
|
|
|
ld a, [hROMBank]
|
2015-11-10 21:53:37 +00:00
|
|
|
ld [wMenuDataBank], a
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 0x1d4b
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1d4b:: ; 1d4b
|
2015-11-01 17:44:30 +00:00
|
|
|
ld [wMenuCursorBuffer], a
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1d4f
|
|
|
|
|
|
|
|
|
2015-07-19 03:45:39 +00:00
|
|
|
MenuTextBox:: ; 1d4f
|
2013-09-03 22:43:15 +00:00
|
|
|
push hl
|
2015-07-19 03:45:39 +00:00
|
|
|
call LoadMenuTextBox
|
2013-09-03 22:43:15 +00:00
|
|
|
pop hl
|
|
|
|
jp PrintText
|
|
|
|
; 1d57
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1d57:: ; 1d57
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1d58
|
|
|
|
|
2015-07-19 03:45:39 +00:00
|
|
|
LoadMenuTextBox:: ; 1d58
|
2013-09-03 22:43:15 +00:00
|
|
|
ld hl, MenuDataHeader_0x1d5f
|
|
|
|
call LoadMenuDataHeader
|
|
|
|
ret
|
|
|
|
; 1d5f
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
MenuDataHeader_0x1d5f:: ; 1d5f
|
2013-09-03 22:43:15 +00:00
|
|
|
db $40 ; tile backup
|
|
|
|
db 12, 0 ; start coords
|
|
|
|
db 17, 19 ; end coords
|
|
|
|
dw VTiles0
|
|
|
|
db 0 ; default option
|
|
|
|
; 1d67
|
|
|
|
|
2015-07-19 03:45:39 +00:00
|
|
|
MenuTextBoxBackup:: ; 1d67
|
|
|
|
call MenuTextBox
|
2015-07-15 19:48:44 +00:00
|
|
|
call WriteBackup
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1d6e
|
|
|
|
|
2015-11-11 21:11:08 +00:00
|
|
|
LoadStandardMenuDataHeader:: ; 1d6e
|
2013-09-03 22:43:15 +00:00
|
|
|
ld hl, MenuDataHeader_0x1d75
|
|
|
|
call LoadMenuDataHeader
|
|
|
|
ret
|
|
|
|
; 1d75
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
MenuDataHeader_0x1d75:: ; 1d75
|
2013-09-03 22:43:15 +00:00
|
|
|
db $40 ; tile backup
|
|
|
|
db 0, 0 ; start coords
|
|
|
|
db 17, 19 ; end coords
|
2015-11-02 19:37:02 +00:00
|
|
|
dw 0
|
2013-09-03 22:43:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
; 1d7d
|
|
|
|
|
2015-09-09 23:27:07 +00:00
|
|
|
Call_ExitMenu:: ; 1d7d
|
2015-07-20 07:51:52 +00:00
|
|
|
call ExitMenu
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1d81
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
InterpretMenu2::
|
2013-09-03 22:43:15 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
2015-11-04 19:02:11 +00:00
|
|
|
call MenuBox
|
2015-07-22 19:57:02 +00:00
|
|
|
call UpdateSprites
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1c89
|
2015-11-25 15:16:29 +00:00
|
|
|
call ApplyTilemap
|
2015-11-10 21:53:37 +00:00
|
|
|
call CopyMenuData2
|
2015-11-04 19:02:11 +00:00
|
|
|
ld a, [wMenuData2Flags]
|
2013-09-03 22:43:15 +00:00
|
|
|
bit 7, a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr z, .cancel
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1c10
|
|
|
|
call Function1bc9
|
|
|
|
call Function1ff8
|
|
|
|
bit 1, a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr z, .okay
|
2015-10-16 17:35:43 +00:00
|
|
|
.cancel
|
2013-09-03 22:43:15 +00:00
|
|
|
scf
|
|
|
|
ret
|
2015-10-16 17:35:43 +00:00
|
|
|
.okay
|
2013-09-03 22:43:15 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 0x1dab
|
|
|
|
|
2015-07-19 08:58:31 +00:00
|
|
|
GetMenu2:: ; 1dab
|
2013-09-03 22:43:15 +00:00
|
|
|
call LoadMenuDataHeader
|
2015-07-15 19:48:44 +00:00
|
|
|
call InterpretMenu2
|
|
|
|
call WriteBackup
|
2015-11-04 19:02:11 +00:00
|
|
|
ld a, [MenuSelection2]
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1db8
|
|
|
|
|
2015-11-10 21:53:37 +00:00
|
|
|
CopyNameFromMenu::
|
2013-09-03 22:43:15 +00:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
push af
|
2015-11-10 21:53:37 +00:00
|
|
|
ld hl, wMenuData2Pointer
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 2
|
2013-09-03 22:43:15 +00:00
|
|
|
inc hl
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-09-03 22:43:15 +00:00
|
|
|
pop af
|
|
|
|
call GetNthString
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
call CopyName1
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 0x1dcf
|
|
|
|
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
YesNoBox:: ; 1dcf
|
2015-11-10 21:53:37 +00:00
|
|
|
lb bc, SCREEN_WIDTH - 6, 7
|
2013-09-03 22:43:15 +00:00
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
PlaceYesNoBox:: ; 1dd2
|
2013-12-04 07:49:12 +00:00
|
|
|
jr _YesNoBox
|
2013-09-03 22:43:15 +00:00
|
|
|
|
2015-10-17 21:18:52 +00:00
|
|
|
PlaceGenericTwoOptionBox:: ; 1dd4
|
2013-09-03 22:43:15 +00:00
|
|
|
call LoadMenuDataHeader
|
2015-10-17 21:18:52 +00:00
|
|
|
jr InterpretTwoOptionMenu
|
2013-09-03 22:43:15 +00:00
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
_YesNoBox:: ; 1dd9
|
2013-12-04 07:49:12 +00:00
|
|
|
; Return nc (yes) or c (no).
|
2013-09-03 22:43:15 +00:00
|
|
|
push bc
|
2013-12-04 07:49:12 +00:00
|
|
|
ld hl, YesNoMenuDataHeader
|
2015-07-15 19:48:44 +00:00
|
|
|
call CopyMenuDataHeader
|
2013-09-03 22:43:15 +00:00
|
|
|
pop bc
|
2015-10-17 21:18:52 +00:00
|
|
|
; This seems to be an overflow prevention, but
|
|
|
|
; it was coded wrong.
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, b
|
2015-10-17 21:18:52 +00:00
|
|
|
cp SCREEN_WIDTH - 6
|
|
|
|
jr nz, .okay ; should this be "jr nc"?
|
|
|
|
ld a, SCREEN_WIDTH - 6
|
2013-09-03 22:43:15 +00:00
|
|
|
ld b, a
|
|
|
|
|
2015-10-17 21:18:52 +00:00
|
|
|
.okay
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, b
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderLeftCoord], a
|
2015-11-10 21:53:37 +00:00
|
|
|
add 5
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderRightCoord], a
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, c
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderTopCoord], a
|
2015-11-10 21:53:37 +00:00
|
|
|
add 4
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderBottomCoord], a
|
|
|
|
call BackUpTiles
|
2013-09-03 22:43:15 +00:00
|
|
|
|
2015-10-17 21:18:52 +00:00
|
|
|
InterpretTwoOptionMenu:: ; 1dfe
|
2015-07-15 19:48:44 +00:00
|
|
|
call InterpretMenu2
|
2013-09-03 22:43:15 +00:00
|
|
|
push af
|
|
|
|
ld c, $f
|
|
|
|
call DelayFrames
|
2015-07-15 19:48:44 +00:00
|
|
|
call WriteBackup
|
2013-09-03 22:43:15 +00:00
|
|
|
pop af
|
2015-10-16 17:35:43 +00:00
|
|
|
jr c, .no
|
2015-11-04 19:02:11 +00:00
|
|
|
ld a, [MenuSelection2]
|
2013-12-04 07:49:12 +00:00
|
|
|
cp 2 ; no
|
2015-10-16 17:35:43 +00:00
|
|
|
jr z, .no
|
2013-09-03 22:43:15 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-10-16 17:35:43 +00:00
|
|
|
.no
|
|
|
|
ld a, 2
|
2015-11-04 19:02:11 +00:00
|
|
|
ld [MenuSelection2], a
|
2013-09-03 22:43:15 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 1e1d
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
YesNoMenuDataHeader:: ; 1e1d
|
2013-09-03 22:43:15 +00:00
|
|
|
db $40 ; tile backup
|
|
|
|
db 5, 10 ; start coords
|
|
|
|
db 9, 15 ; end coords
|
2013-12-04 07:49:12 +00:00
|
|
|
dw YesNoMenuData2
|
2013-09-03 22:43:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
; 1e25
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
YesNoMenuData2:: ; 1e25
|
2013-09-03 22:43:15 +00:00
|
|
|
db $c0 ; flags
|
|
|
|
db 2
|
|
|
|
db "YES@"
|
|
|
|
db "NO@"
|
|
|
|
; 1e2e
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1e2e:: ; 1e2e
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1e35
|
2015-10-24 14:34:19 +00:00
|
|
|
call BackUpTiles
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1e35
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1e35:: ; 1e35
|
2013-09-03 22:43:15 +00:00
|
|
|
push de
|
2015-07-15 19:48:44 +00:00
|
|
|
call CopyMenuDataHeader
|
2013-09-03 22:43:15 +00:00
|
|
|
pop de
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wMenuBorderLeftCoord]
|
2013-09-03 22:43:15 +00:00
|
|
|
ld h, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wMenuBorderRightCoord]
|
2013-09-03 22:43:15 +00:00
|
|
|
sub h
|
|
|
|
ld h, a
|
|
|
|
ld a, d
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderLeftCoord], a
|
2013-09-03 22:43:15 +00:00
|
|
|
add h
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderRightCoord], a
|
|
|
|
ld a, [wMenuBorderTopCoord]
|
2013-09-03 22:43:15 +00:00
|
|
|
ld l, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wMenuBorderBottomCoord]
|
2013-09-03 22:43:15 +00:00
|
|
|
sub l
|
|
|
|
ld l, a
|
|
|
|
ld a, e
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderTopCoord], a
|
2013-09-03 22:43:15 +00:00
|
|
|
add l
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderBottomCoord], a
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1e5d
|
|
|
|
|
2015-11-17 02:46:36 +00:00
|
|
|
DoNthMenu:: ; 1e5d
|
2013-09-03 22:43:15 +00:00
|
|
|
call MenuFunc_1e7f
|
|
|
|
call MenuWriteText
|
|
|
|
call Function1eff
|
|
|
|
call Function1f23
|
|
|
|
call Function1bdd
|
|
|
|
call Function1ff8
|
|
|
|
ret
|
|
|
|
; 1e70
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
SetUpMenu:: ; 1e70
|
2013-09-03 22:43:15 +00:00
|
|
|
call MenuFunc_1e7f ; ???
|
|
|
|
call MenuWriteText
|
|
|
|
call Function1eff ; set up selection pointer
|
2015-02-10 23:14:41 +00:00
|
|
|
ld hl, wcfa5
|
2013-09-03 22:43:15 +00:00
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
MenuFunc_1e7f::
|
2015-11-10 21:53:37 +00:00
|
|
|
call CopyMenuData2
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1ebd
|
|
|
|
call Function1ea6
|
2015-11-04 19:02:11 +00:00
|
|
|
call MenuBox
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
MenuWriteText::
|
2013-09-03 22:43:15 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
2015-07-19 03:45:39 +00:00
|
|
|
call Function1ebd ; sort out the text
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1eda ; actually write it
|
|
|
|
call Function2e31
|
|
|
|
ld a, [hOAMUpdate]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [hOAMUpdate], a
|
2015-11-25 15:16:29 +00:00
|
|
|
call ApplyTilemap
|
2013-09-03 22:43:15 +00:00
|
|
|
pop af
|
|
|
|
ld [hOAMUpdate], a
|
|
|
|
ret
|
|
|
|
; 0x1ea6
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1ea6:: ; 1ea6
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wMenuBorderLeftCoord]
|
2013-09-03 22:43:15 +00:00
|
|
|
ld c, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wMenuBorderRightCoord]
|
2013-09-03 22:43:15 +00:00
|
|
|
sub c
|
|
|
|
ld c, a
|
2015-11-04 19:02:11 +00:00
|
|
|
ld a, [wMenuData2Items]
|
2013-09-03 22:43:15 +00:00
|
|
|
add a
|
|
|
|
inc a
|
|
|
|
ld b, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wMenuBorderTopCoord]
|
2013-09-03 22:43:15 +00:00
|
|
|
add b
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderBottomCoord], a
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1ebd
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1ebd:: ; 1ebd
|
2015-02-10 23:14:41 +00:00
|
|
|
ld hl, wcf93
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-02-10 23:14:41 +00:00
|
|
|
ld a, [wcf76]
|
2013-09-03 22:43:15 +00:00
|
|
|
and a
|
|
|
|
jr z, .asm_1ed3
|
|
|
|
ld b, a
|
|
|
|
ld c, $ff
|
|
|
|
.asm_1ecc
|
|
|
|
ld a, [hli]
|
|
|
|
cp c
|
|
|
|
jr nz, .asm_1ecc
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_1ecc
|
|
|
|
|
|
|
|
.asm_1ed3
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld a, [hl]
|
2015-11-04 19:02:11 +00:00
|
|
|
ld [wMenuData2Items], a
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1eda
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1eda:: ; 1eda
|
2015-11-10 21:53:37 +00:00
|
|
|
call MenuBoxCoord2Tile
|
2013-09-03 22:43:15 +00:00
|
|
|
ld bc, $002a
|
|
|
|
add hl, bc
|
|
|
|
.asm_1ee1
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
cp $ff
|
|
|
|
ret z
|
|
|
|
ld [MenuSelection], a
|
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-02-10 23:14:41 +00:00
|
|
|
ld hl, wcf95
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1efb
|
|
|
|
pop hl
|
|
|
|
ld de, $0028
|
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
jr .asm_1ee1
|
|
|
|
; 1efb
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1efb:: ; 1efb
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
jp [hl]
|
|
|
|
; 1eff
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1eff:: ; 1eff
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1c10
|
2015-02-10 23:14:41 +00:00
|
|
|
ld hl, wcfa8
|
2015-11-04 19:02:11 +00:00
|
|
|
ld a, [wMenuData2Flags]
|
2013-09-03 22:43:15 +00:00
|
|
|
bit 3, a
|
|
|
|
jr z, .asm_1f0e
|
|
|
|
set 3, [hl]
|
|
|
|
|
|
|
|
.asm_1f0e
|
2015-11-04 19:02:11 +00:00
|
|
|
ld a, [wMenuData2Flags]
|
2013-09-03 22:43:15 +00:00
|
|
|
bit 2, a
|
|
|
|
jr z, .asm_1f19
|
|
|
|
set 5, [hl]
|
|
|
|
set 4, [hl]
|
|
|
|
|
|
|
|
.asm_1f19
|
|
|
|
ret
|
|
|
|
; 1f1a
|
|
|
|
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1f1a:: ; 1f1a
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1bd3
|
2015-02-10 23:14:41 +00:00
|
|
|
ld hl, wcfa8
|
2013-09-03 22:43:15 +00:00
|
|
|
and [hl]
|
|
|
|
jr Function1f2a
|
|
|
|
; 1f23
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1f23:: ; 1f23
|
2013-09-03 22:43:15 +00:00
|
|
|
xor a
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf73], a
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1bc9
|
|
|
|
; 1f2a
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1f2a:: ; 1f2a
|
2013-09-03 22:43:15 +00:00
|
|
|
bit 0, a
|
|
|
|
jr nz, .asm_1f52
|
|
|
|
bit 1, a
|
|
|
|
jr nz, .asm_1f6d
|
|
|
|
bit 3, a
|
|
|
|
jr nz, .asm_1f6d
|
|
|
|
bit 4, a
|
|
|
|
jr nz, .asm_1f44
|
|
|
|
bit 5, a
|
|
|
|
jr nz, .asm_1f4b
|
|
|
|
xor a
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf73], a
|
2013-09-03 22:43:15 +00:00
|
|
|
jr .asm_1f57
|
|
|
|
|
|
|
|
.asm_1f44
|
|
|
|
ld a, $10
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf73], a
|
2013-09-03 22:43:15 +00:00
|
|
|
jr .asm_1f57
|
|
|
|
|
|
|
|
.asm_1f4b
|
|
|
|
ld a, $20
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf73], a
|
2013-09-03 22:43:15 +00:00
|
|
|
jr .asm_1f57
|
|
|
|
|
|
|
|
.asm_1f52
|
|
|
|
ld a, $1
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf73], a
|
2013-09-03 22:43:15 +00:00
|
|
|
|
|
|
|
.asm_1f57
|
|
|
|
call Function1ebd
|
2015-11-04 19:02:11 +00:00
|
|
|
ld a, [MenuSelection2]
|
2013-09-03 22:43:15 +00:00
|
|
|
ld l, a
|
|
|
|
ld h, $0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [MenuSelection], a
|
2015-11-04 19:02:11 +00:00
|
|
|
ld a, [MenuSelection2]
|
2015-11-01 17:44:30 +00:00
|
|
|
ld [wMenuCursorBuffer], a
|
2013-09-03 22:43:15 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_1f6d
|
|
|
|
ld a, $2
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf73], a
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, $ff
|
|
|
|
ld [MenuSelection], a
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 1f79
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1f79:: ; 1f79
|
2013-09-03 22:43:15 +00:00
|
|
|
push de
|
2015-02-10 23:14:41 +00:00
|
|
|
ld hl, wcf97
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, [MenuSelection]
|
|
|
|
call GetNthString
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
; 1f8d
|
|
|
|
|
2015-11-17 02:46:36 +00:00
|
|
|
PlaceNthMenuStrings:: ; 1f8d
|
2013-09-03 22:43:15 +00:00
|
|
|
push de
|
|
|
|
ld a, [MenuSelection]
|
|
|
|
call Function1fb1
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 2
|
2013-09-03 22:43:15 +00:00
|
|
|
inc hl
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
; 1f9e
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1f9e:: ; 1f9e
|
2013-09-03 22:43:15 +00:00
|
|
|
call Function1fb1
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 2
|
2013-09-03 22:43:15 +00:00
|
|
|
inc hl
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
|
|
|
ret
|
|
|
|
; 1fa7
|
|
|
|
|
2015-11-17 02:46:36 +00:00
|
|
|
MenuJumptable:: ; 1fa7
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [MenuSelection]
|
|
|
|
call Function1fb1
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
jp [hl]
|
|
|
|
; 1fb1
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1fb1:: ; 1fb1
|
2013-09-03 22:43:15 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2015-02-10 23:14:41 +00:00
|
|
|
ld hl, wcf97
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 4
|
2013-09-03 22:43:15 +00:00
|
|
|
add hl, de
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 1fbf
|
|
|
|
|
2015-10-18 00:49:34 +00:00
|
|
|
ResetTextRelatedRAM:: ; 1fbf
|
2015-02-10 23:14:41 +00:00
|
|
|
ld hl, wcf71
|
2015-10-18 00:49:34 +00:00
|
|
|
call .bytefill
|
2015-11-10 21:53:37 +00:00
|
|
|
ld hl, wMenuDataHeader
|
2015-10-18 00:49:34 +00:00
|
|
|
call .bytefill
|
2015-11-04 19:02:11 +00:00
|
|
|
ld hl, wMenuData2Flags
|
2015-10-18 00:49:34 +00:00
|
|
|
call .bytefill
|
2015-02-10 23:14:41 +00:00
|
|
|
ld hl, wcfa1
|
2015-10-18 00:49:34 +00:00
|
|
|
call .bytefill
|
|
|
|
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [rSVBK]
|
|
|
|
push af
|
|
|
|
ld a, $7
|
|
|
|
ld [rSVBK], a
|
2015-10-18 00:49:34 +00:00
|
|
|
|
2013-09-03 22:43:15 +00:00
|
|
|
xor a
|
2015-10-18 00:49:34 +00:00
|
|
|
ld hl, w7_dfff
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 2
|
2013-09-03 22:43:15 +00:00
|
|
|
ld [hld], a
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, l
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf71], a
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, h
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf72], a
|
2015-10-18 00:49:34 +00:00
|
|
|
|
2013-09-03 22:43:15 +00:00
|
|
|
pop af
|
|
|
|
ld [rSVBK], a
|
|
|
|
ret
|
|
|
|
; 1ff0
|
|
|
|
|
2015-10-18 00:49:34 +00:00
|
|
|
.bytefill: ; 1ff0
|
2013-09-03 22:43:15 +00:00
|
|
|
ld bc, $0010
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
; 1ff8
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function1ff8:: ; 1ff8
|
2013-09-03 22:43:15 +00:00
|
|
|
push af
|
|
|
|
and $3
|
2015-10-16 17:35:43 +00:00
|
|
|
jr z, .nosound
|
2015-11-10 21:53:37 +00:00
|
|
|
ld hl, wMenuFlags
|
2013-09-03 22:43:15 +00:00
|
|
|
bit 3, [hl]
|
2015-10-16 17:35:43 +00:00
|
|
|
jr nz, .nosound
|
2013-09-03 22:43:15 +00:00
|
|
|
call PlayClickSFX
|
|
|
|
|
2015-10-16 17:35:43 +00:00
|
|
|
.nosound
|
2013-09-03 22:43:15 +00:00
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
; 2009
|
|
|
|
|
|
|
|
|
2015-07-19 03:45:39 +00:00
|
|
|
PlayClickSFX:: ; 2009
|
2013-09-03 22:43:15 +00:00
|
|
|
push de
|
|
|
|
ld de, SFX_READ_TEXT_2
|
2013-10-08 17:10:36 +00:00
|
|
|
call PlaySFX
|
2013-09-03 22:43:15 +00:00
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
; 0x2012
|
|
|
|
|
2015-11-18 23:35:44 +00:00
|
|
|
MenuTextBoxWaitButton:: ; 2012
|
2015-07-19 03:45:39 +00:00
|
|
|
call MenuTextBox
|
2015-11-25 15:16:29 +00:00
|
|
|
call WaitButton
|
2015-07-20 07:51:52 +00:00
|
|
|
call ExitMenu
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 201c
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function201c:: ; 201c
|
2013-09-03 22:43:15 +00:00
|
|
|
ld [hBuffer], a
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, [hBuffer]
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
call PlaceString
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
ret
|
|
|
|
; 202a
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
InterpretMenu:: ; 202a
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hROMBank]
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf94], a
|
2013-10-02 00:47:54 +00:00
|
|
|
callba Function2400e
|
2015-11-01 17:44:30 +00:00
|
|
|
ld a, [wMenuCursorBuffer]
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 2039
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function2039:: ; 2039
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hROMBank]
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf94], a
|
2013-10-02 00:47:54 +00:00
|
|
|
callba Function24022
|
2015-11-01 17:44:30 +00:00
|
|
|
ld a, [wMenuCursorBuffer]
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 2048
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function2048:: ; 2048
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hROMBank]
|
2015-02-10 23:14:41 +00:00
|
|
|
ld [wcf94], a
|
2013-10-02 00:47:54 +00:00
|
|
|
callba Function2403c
|
2015-11-01 17:44:30 +00:00
|
|
|
ld a, [wMenuCursorBuffer]
|
2013-09-03 22:43:15 +00:00
|
|
|
ret
|
|
|
|
; 2057
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function2057:: ; 2057
|
2013-09-03 22:43:15 +00:00
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
2014-03-03 10:43:25 +00:00
|
|
|
ld a, BANK(Function842db)
|
2013-09-03 22:43:15 +00:00
|
|
|
rst Bankswitch
|
|
|
|
|
2014-03-03 10:43:25 +00:00
|
|
|
call Function842db
|
2013-09-03 22:43:15 +00:00
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
ret
|
|
|
|
; 2063
|