2015-12-13 22:11:58 +00:00
|
|
|
MonMenuOptionStrings: ; 24caf
|
|
|
|
db "STATS@"
|
|
|
|
db "SWITCH@"
|
|
|
|
db "ITEM@"
|
|
|
|
db "CANCEL@"
|
|
|
|
db "MOVE@"
|
|
|
|
db "MAIL@"
|
|
|
|
db "ERROR!@"
|
|
|
|
; 24cd9
|
|
|
|
|
|
|
|
MonMenuOptions: ; 24cd9
|
2017-12-09 05:50:59 +00:00
|
|
|
; moves
|
2015-12-13 22:11:58 +00:00
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_CUT, CUT
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_FLY, FLY
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_SURF, SURF
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_STRENGTH, STRENGTH
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_FLASH, FLASH
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_WATERFALL, WATERFALL
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_WHIRLPOOL, WHIRLPOOL
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_DIG, DIG
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_TELEPORT, TELEPORT
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_SOFTBOILED, SOFTBOILED
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_HEADBUTT, HEADBUTT
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_ROCKSMASH, ROCK_SMASH
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_MILKDRINK, MILK_DRINK
|
|
|
|
db MONMENU_FIELD_MOVE, MONMENU_SWEETSCENT, SWEET_SCENT
|
2017-12-09 05:50:59 +00:00
|
|
|
; options
|
2015-12-13 22:11:58 +00:00
|
|
|
db MONMENU_MENUOPTION, MONMENU_STATS, 1 ; STATS
|
|
|
|
db MONMENU_MENUOPTION, MONMENU_SWITCH, 2 ; SWITCH
|
|
|
|
db MONMENU_MENUOPTION, MONMENU_ITEM, 3 ; ITEM
|
|
|
|
db MONMENU_MENUOPTION, MONMENU_CANCEL, 4 ; CANCEL
|
|
|
|
db MONMENU_MENUOPTION, MONMENU_MOVE, 5 ; MOVE
|
|
|
|
db MONMENU_MENUOPTION, MONMENU_MAIL, 6 ; MAIL
|
|
|
|
db MONMENU_MENUOPTION, MONMENU_ERROR, 7 ; ERROR!
|
|
|
|
db -1
|
|
|
|
; 24d19
|
|
|
|
|
|
|
|
MonSubmenu: ; 24d19
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call GetMonSubmenuItems
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall FreezeMonIcons
|
2015-12-13 22:11:58 +00:00
|
|
|
ld hl, .MenuDataHeader
|
|
|
|
call LoadMenuDataHeader
|
|
|
|
call .GetTopCoord
|
|
|
|
call PopulateMonMenu
|
|
|
|
|
|
|
|
ld a, 1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call MonMenuLoop
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMenuSelection], a
|
2015-12-13 22:11:58 +00:00
|
|
|
|
|
|
|
call ExitMenu
|
|
|
|
ret
|
|
|
|
; 24d3f
|
|
|
|
|
|
|
|
.MenuDataHeader: ; 24d3f
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 6, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2015-12-13 22:11:58 +00:00
|
|
|
dw 0
|
|
|
|
db 1 ; default option
|
|
|
|
; 24d47
|
|
|
|
|
|
|
|
.GetTopCoord: ; 24d47
|
|
|
|
; TopCoord = 1 + BottomCoord - 2 * (NumSubmenuItems + 1)
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer1]
|
2015-12-13 22:11:58 +00:00
|
|
|
inc a
|
|
|
|
add a
|
|
|
|
ld b, a
|
|
|
|
ld a, [wMenuBorderBottomCoord]
|
|
|
|
sub b
|
|
|
|
inc a
|
|
|
|
ld [wMenuBorderTopCoord], a
|
|
|
|
call MenuBox
|
|
|
|
ret
|
|
|
|
; 24d59
|
|
|
|
|
|
|
|
MonMenuLoop: ; 24d59
|
|
|
|
.loop
|
2018-01-15 04:43:51 +00:00
|
|
|
ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags
|
2015-12-13 22:11:58 +00:00
|
|
|
ld [wMenuData2Flags], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer1] ; items
|
2015-12-13 22:11:58 +00:00
|
|
|
ld [wMenuData2Items], a
|
2015-12-15 23:59:49 +00:00
|
|
|
call InitVerticalMenuCursor
|
2015-12-19 19:48:30 +00:00
|
|
|
ld hl, w2DMenuFlags1
|
2015-12-13 22:11:58 +00:00
|
|
|
set 6, [hl]
|
2015-12-15 23:59:49 +00:00
|
|
|
call StaticMenuJoypad
|
2015-12-13 22:11:58 +00:00
|
|
|
ld de, SFX_READ_TEXT_2
|
|
|
|
call PlaySFX
|
|
|
|
ld a, [hJoyPressed]
|
2017-12-30 17:35:50 +00:00
|
|
|
bit A_BUTTON_F, a
|
2015-12-13 22:11:58 +00:00
|
|
|
jr nz, .select
|
2017-12-30 17:35:50 +00:00
|
|
|
bit B_BUTTON_F, a
|
2015-12-13 22:11:58 +00:00
|
|
|
jr nz, .cancel
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.cancel
|
|
|
|
ld a, MONMENU_CANCEL ; CANCEL
|
|
|
|
ret
|
|
|
|
|
|
|
|
.select
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-13 22:11:58 +00:00
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wBuffer2
|
2015-12-13 22:11:58 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ret
|
|
|
|
; 24d91
|
|
|
|
|
|
|
|
PopulateMonMenu: ; 24d91
|
|
|
|
call MenuBoxCoord2Tile
|
|
|
|
ld bc, $2a ; 42
|
|
|
|
add hl, bc
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wBuffer2
|
2015-12-13 22:11:58 +00:00
|
|
|
.loop
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp -1
|
|
|
|
ret z
|
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
call GetMonMenuString
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ld bc, $28 ; 40
|
|
|
|
add hl, bc
|
|
|
|
pop de
|
|
|
|
jr .loop
|
|
|
|
; 24db0
|
|
|
|
|
|
|
|
GetMonMenuString: ; 24db0
|
|
|
|
ld hl, MonMenuOptions + 1
|
|
|
|
ld de, 3
|
|
|
|
call IsInArray
|
|
|
|
dec hl
|
|
|
|
ld a, [hli]
|
|
|
|
cp 1
|
|
|
|
jr z, .NotMove
|
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wd265], a
|
|
|
|
call GetMoveName
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NotMove:
|
2015-12-13 22:11:58 +00:00
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
|
|
|
dec a
|
|
|
|
ld hl, MonMenuOptionStrings
|
|
|
|
call GetNthString
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ret
|
|
|
|
; 24dd4
|
|
|
|
|
|
|
|
GetMonSubmenuItems: ; 24dd4
|
|
|
|
call ResetMonSubmenu
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-12-13 22:11:58 +00:00
|
|
|
cp EGG
|
|
|
|
jr z, .egg
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
and a
|
|
|
|
jr nz, .skip_moves
|
|
|
|
ld a, MON_MOVES
|
|
|
|
call GetPartyParamLocation
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld c, NUM_MOVES
|
|
|
|
.loop
|
|
|
|
push bc
|
|
|
|
push de
|
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
jr z, .next
|
|
|
|
push hl
|
|
|
|
call IsFieldMove
|
|
|
|
pop hl
|
|
|
|
jr nc, .next
|
|
|
|
call AddMonMenuItem
|
|
|
|
|
|
|
|
.next
|
|
|
|
pop de
|
|
|
|
inc de
|
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
.skip_moves
|
|
|
|
ld a, MONMENU_STATS
|
|
|
|
call AddMonMenuItem
|
|
|
|
ld a, MONMENU_SWITCH
|
|
|
|
call AddMonMenuItem
|
|
|
|
ld a, MONMENU_MOVE
|
|
|
|
call AddMonMenuItem
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
and a
|
|
|
|
jr nz, .skip2
|
|
|
|
push hl
|
|
|
|
ld a, MON_ITEM
|
|
|
|
call GetPartyParamLocation
|
|
|
|
ld d, [hl]
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ItemIsMail
|
2015-12-13 22:11:58 +00:00
|
|
|
pop hl
|
|
|
|
ld a, MONMENU_MAIL
|
|
|
|
jr c, .ok
|
|
|
|
ld a, MONMENU_ITEM
|
|
|
|
|
|
|
|
.ok
|
|
|
|
call AddMonMenuItem
|
|
|
|
|
|
|
|
.skip2
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer1]
|
2017-12-09 05:50:59 +00:00
|
|
|
cp NUM_MONMENU_ITEMS
|
2015-12-13 22:11:58 +00:00
|
|
|
jr z, .ok2
|
|
|
|
ld a, MONMENU_CANCEL
|
|
|
|
call AddMonMenuItem
|
|
|
|
|
|
|
|
.ok2
|
|
|
|
call TerminateMonSubmenu
|
|
|
|
ret
|
|
|
|
|
|
|
|
.egg
|
|
|
|
ld a, MONMENU_STATS
|
|
|
|
call AddMonMenuItem
|
|
|
|
ld a, MONMENU_SWITCH
|
|
|
|
call AddMonMenuItem
|
|
|
|
ld a, MONMENU_CANCEL
|
|
|
|
call AddMonMenuItem
|
|
|
|
call TerminateMonSubmenu
|
|
|
|
ret
|
|
|
|
; 24e52
|
|
|
|
|
|
|
|
IsFieldMove: ; 24e52
|
|
|
|
ld b, a
|
|
|
|
ld hl, MonMenuOptions
|
|
|
|
.next
|
|
|
|
ld a, [hli]
|
|
|
|
cp -1
|
|
|
|
jr z, .nope
|
|
|
|
cp MONMENU_MENUOPTION
|
|
|
|
jr z, .nope
|
|
|
|
ld d, [hl]
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr nz, .next
|
|
|
|
ld a, d
|
|
|
|
scf
|
|
|
|
|
|
|
|
.nope
|
|
|
|
ret
|
|
|
|
; 24e68
|
|
|
|
|
|
|
|
ResetMonSubmenu: ; 24e68
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer1], a
|
|
|
|
ld hl, wBuffer2
|
2017-12-09 05:50:59 +00:00
|
|
|
ld bc, NUM_MONMENU_ITEMS + 1
|
2015-12-13 22:11:58 +00:00
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
; 24e76
|
|
|
|
|
|
|
|
TerminateMonSubmenu: ; 24e76
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer1]
|
2015-12-13 22:11:58 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wBuffer2
|
2015-12-13 22:11:58 +00:00
|
|
|
add hl, de
|
|
|
|
ld [hl], -1
|
|
|
|
ret
|
|
|
|
; 24e83
|
|
|
|
|
|
|
|
AddMonMenuItem: ; 24e83
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer1]
|
2015-12-13 22:11:58 +00:00
|
|
|
ld e, a
|
|
|
|
inc a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer1], a
|
2015-12-13 22:11:58 +00:00
|
|
|
ld d, $0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wBuffer2
|
2015-12-13 22:11:58 +00:00
|
|
|
add hl, de
|
|
|
|
pop af
|
|
|
|
ld [hl], a
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 24e99
|
|
|
|
|
|
|
|
BattleMonMenu: ; 24e99
|
|
|
|
ld hl, MenuDataHeader_0x24ed4
|
|
|
|
call CopyMenuDataHeader
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call MenuBox
|
|
|
|
call UpdateSprites
|
2015-12-15 23:59:49 +00:00
|
|
|
call PlaceVerticalMenuItems
|
2015-12-13 22:11:58 +00:00
|
|
|
call WaitBGMap
|
|
|
|
call CopyMenuData2
|
|
|
|
ld a, [wMenuData2Flags]
|
|
|
|
bit 7, a
|
|
|
|
jr z, .set_carry
|
2015-12-15 23:59:49 +00:00
|
|
|
call InitVerticalMenuCursor
|
2015-12-19 19:48:30 +00:00
|
|
|
ld hl, w2DMenuFlags1
|
2015-12-13 22:11:58 +00:00
|
|
|
set 6, [hl]
|
2015-12-15 23:59:49 +00:00
|
|
|
call StaticMenuJoypad
|
2015-12-13 22:11:58 +00:00
|
|
|
ld de, SFX_READ_TEXT_2
|
|
|
|
call PlaySFX
|
|
|
|
ld a, [hJoyPressed]
|
|
|
|
bit B_BUTTON_F, a
|
|
|
|
jr z, .clear_carry
|
|
|
|
ret z
|
|
|
|
|
|
|
|
.set_carry
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.clear_carry
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 24ed4
|
|
|
|
|
|
|
|
MenuDataHeader_0x24ed4: ; 24ed4
|
2018-01-14 10:59:56 +00:00
|
|
|
db 0 ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 11, 11, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2015-12-13 22:11:58 +00:00
|
|
|
dw MenuData2_0x24edc
|
|
|
|
db 1 ; default option
|
|
|
|
; 24edc
|
|
|
|
|
|
|
|
MenuData2_0x24edc: ; 24edc
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-12-13 22:11:58 +00:00
|
|
|
db 3 ; items
|
|
|
|
db "SWITCH@"
|
|
|
|
db "STATS@"
|
|
|
|
db "CANCEL@"
|
|
|
|
; 24ef2
|