2018-01-22 09:03:18 -08:00
|
|
|
; StartMenu.Items indexes
|
|
|
|
const_def
|
|
|
|
const STARTMENUITEM_POKEDEX ; 0
|
|
|
|
const STARTMENUITEM_POKEMON ; 1
|
|
|
|
const STARTMENUITEM_PACK ; 2
|
|
|
|
const STARTMENUITEM_STATUS ; 3
|
|
|
|
const STARTMENUITEM_SAVE ; 4
|
|
|
|
const STARTMENUITEM_OPTION ; 5
|
|
|
|
const STARTMENUITEM_EXIT ; 6
|
|
|
|
const STARTMENUITEM_POKEGEAR ; 7
|
|
|
|
const STARTMENUITEM_QUIT ; 8
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu::
|
2023-08-11 03:28:14 -07:00
|
|
|
call ClearMenuAndWindowData
|
2015-11-11 13:11:08 -08:00
|
|
|
|
|
|
|
ld de, SFX_MENU
|
|
|
|
call PlaySFX
|
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ReanchorBGMap_NoOAMUpdate
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2017-12-28 04:15:46 -08:00
|
|
|
ld hl, wStatusFlags2
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
|
2018-01-23 13:08:43 -08:00
|
|
|
ld hl, .MenuHeader
|
2015-11-11 13:11:08 -08:00
|
|
|
jr z, .GotMenuData
|
2018-01-23 13:08:43 -08:00
|
|
|
ld hl, .ContestMenuHeader
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-25 09:24:18 -07:00
|
|
|
.GotMenuData:
|
2018-01-23 13:08:43 -08:00
|
|
|
call LoadMenuHeader
|
2015-11-11 13:11:08 -08:00
|
|
|
call .SetUpMenuItems
|
2023-08-14 11:09:23 -07:00
|
|
|
ld a, [wStartMenuLastCursorPosition]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wMenuCursorPosition], a
|
2018-07-22 21:13:43 -07:00
|
|
|
call .DrawMenuAccount
|
2016-05-10 09:31:49 -07:00
|
|
|
call DrawVariableLengthMenuBox
|
2015-11-11 13:11:08 -08:00
|
|
|
call .DrawBugContestStatusBox
|
2016-05-10 09:31:49 -07:00
|
|
|
call SafeUpdateSprites
|
2020-02-13 09:30:13 -08:00
|
|
|
call _OpenAndCloseMenu_HDMATransferTilemapAndAttrmap
|
2023-08-11 03:28:14 -07:00
|
|
|
farcall LoadFont_NoOAMUpdate
|
2015-11-11 13:11:08 -08:00
|
|
|
call .DrawBugContestStatus
|
|
|
|
call UpdateTimePals
|
|
|
|
jr .Select
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Reopen:
|
2015-11-11 13:11:08 -08:00
|
|
|
call UpdateSprites
|
|
|
|
call UpdateTimePals
|
|
|
|
call .SetUpMenuItems
|
2023-08-14 11:09:23 -07:00
|
|
|
ld a, [wStartMenuLastCursorPosition]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wMenuCursorPosition], a
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Select:
|
2015-11-11 13:11:08 -08:00
|
|
|
call .GetInput
|
|
|
|
jr c, .Exit
|
2018-07-22 21:13:43 -07:00
|
|
|
call ._DrawMenuAccount
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wMenuCursorPosition]
|
2023-08-14 11:09:23 -07:00
|
|
|
ld [wStartMenuLastCursorPosition], a
|
2015-11-11 13:11:08 -08:00
|
|
|
call PlayClickSFX
|
2015-12-17 19:31:16 -08:00
|
|
|
call PlaceHollowCursor
|
2015-11-11 13:11:08 -08:00
|
|
|
call .OpenMenu
|
|
|
|
|
|
|
|
; Menu items have different return functions.
|
|
|
|
; For example, saving exits the menu.
|
|
|
|
ld hl, .MenuReturns
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
2015-12-26 18:59:03 -08:00
|
|
|
add hl, de
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.MenuReturns:
|
2015-11-11 13:11:08 -08:00
|
|
|
dw .Reopen
|
|
|
|
dw .Exit
|
2015-11-25 07:16:29 -08:00
|
|
|
dw .ExitMenuCallFuncCloseText
|
|
|
|
dw .ExitMenuRunScriptCloseText
|
2015-11-11 13:11:08 -08:00
|
|
|
dw .ExitMenuRunScript
|
|
|
|
dw .ReturnEnd
|
|
|
|
dw .ReturnRedraw
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Exit:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hOAMUpdate]
|
2015-11-11 13:11:08 -08:00
|
|
|
push af
|
|
|
|
ld a, 1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hOAMUpdate], a
|
2023-08-02 10:52:51 -07:00
|
|
|
call LoadFrame
|
2015-11-11 13:11:08 -08:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hOAMUpdate], a
|
2016-04-10 11:42:14 -07:00
|
|
|
.ReturnEnd:
|
2015-11-11 13:11:08 -08:00
|
|
|
call ExitMenu
|
2016-04-10 11:42:14 -07:00
|
|
|
.ReturnEnd2:
|
2015-11-25 07:16:29 -08:00
|
|
|
call CloseText
|
2015-11-11 13:11:08 -08:00
|
|
|
call UpdateTimePals
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.GetInput:
|
2015-11-11 13:11:08 -08:00
|
|
|
; Return carry on exit, and no-carry on selection.
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2018-07-22 21:13:43 -07:00
|
|
|
call ._DrawMenuAccount
|
2015-11-11 13:11:08 -08:00
|
|
|
call SetUpMenu
|
|
|
|
ld a, $ff
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMenuSelection], a
|
2015-11-11 13:11:08 -08:00
|
|
|
.loop
|
|
|
|
call .PrintMenuAccount
|
2016-03-01 19:31:21 -08:00
|
|
|
call GetScrollingMenuJoypad
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuJoypad]
|
2015-11-11 13:11:08 -08:00
|
|
|
cp B_BUTTON
|
|
|
|
jr z, .b
|
|
|
|
cp A_BUTTON
|
|
|
|
jr z, .a
|
|
|
|
jr .loop
|
|
|
|
.a
|
|
|
|
call PlayClickSFX
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
.b
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ExitMenuRunScript:
|
2015-11-11 13:11:08 -08:00
|
|
|
call ExitMenu
|
|
|
|
ld a, HMENURETURN_SCRIPT
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hMenuReturn], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ExitMenuRunScriptCloseText:
|
2015-11-11 13:11:08 -08:00
|
|
|
call ExitMenu
|
|
|
|
ld a, HMENURETURN_SCRIPT
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hMenuReturn], a
|
2015-11-11 13:11:08 -08:00
|
|
|
jr .ReturnEnd2
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ExitMenuCallFuncCloseText:
|
2015-11-11 13:11:08 -08:00
|
|
|
call ExitMenu
|
|
|
|
ld hl, wQueuedScriptAddr
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, [wQueuedScriptBank]
|
|
|
|
rst FarCall
|
|
|
|
jr .ReturnEnd2
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ReturnRedraw:
|
2015-11-11 13:11:08 -08:00
|
|
|
call .Clear
|
|
|
|
jp .Reopen
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Clear:
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearBGPalettes
|
2015-11-11 13:11:08 -08:00
|
|
|
call Call_ExitMenu
|
2015-12-18 17:07:09 -08:00
|
|
|
call ReloadTilesetAndPalettes
|
2018-07-22 21:13:43 -07:00
|
|
|
call .DrawMenuAccount
|
2016-05-10 09:31:49 -07:00
|
|
|
call DrawVariableLengthMenuBox
|
2015-11-11 13:11:08 -08:00
|
|
|
call .DrawBugContestStatus
|
|
|
|
call UpdateSprites
|
2016-01-06 04:44:50 -08:00
|
|
|
call FinishExitMenu
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-01-23 13:08:43 -08:00
|
|
|
.MenuHeader:
|
2018-01-14 02:59:56 -08:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 13:38:14 -08:00
|
|
|
menu_coords 10, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2015-11-11 13:11:08 -08:00
|
|
|
dw .MenuData
|
|
|
|
db 1 ; default selection
|
|
|
|
|
2018-01-23 13:08:43 -08:00
|
|
|
.ContestMenuHeader:
|
2018-01-14 02:59:56 -08:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 13:38:14 -08:00
|
|
|
menu_coords 10, 2, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2015-11-11 13:11:08 -08:00
|
|
|
dw .MenuData
|
|
|
|
db 1 ; default selection
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.MenuData:
|
2018-01-14 02:59:56 -08:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_WRAP | STATICMENU_ENABLE_START ; flags
|
2015-11-11 13:11:08 -08:00
|
|
|
dn 0, 0 ; rows, columns
|
2018-01-23 14:39:09 -08:00
|
|
|
dw wMenuItemsList
|
2015-11-11 13:11:08 -08:00
|
|
|
dw .MenuString
|
|
|
|
dw .Items
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Items:
|
2018-01-22 09:03:18 -08:00
|
|
|
; entries correspond to STARTMENUITEM_* constants
|
2015-11-11 13:11:08 -08:00
|
|
|
dw StartMenu_Pokedex, .PokedexString, .PokedexDesc
|
|
|
|
dw StartMenu_Pokemon, .PartyString, .PartyDesc
|
|
|
|
dw StartMenu_Pack, .PackString, .PackDesc
|
|
|
|
dw StartMenu_Status, .StatusString, .StatusDesc
|
|
|
|
dw StartMenu_Save, .SaveString, .SaveDesc
|
|
|
|
dw StartMenu_Option, .OptionString, .OptionDesc
|
|
|
|
dw StartMenu_Exit, .ExitString, .ExitDesc
|
|
|
|
dw StartMenu_Pokegear, .PokegearString, .PokegearDesc
|
|
|
|
dw StartMenu_Quit, .QuitString, .QuitDesc
|
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
.PokedexString: db "#DEX@"
|
|
|
|
.PartyString: db "#MON@"
|
|
|
|
.PackString: db "PACK@"
|
|
|
|
.StatusString: db "<PLAYER>@"
|
|
|
|
.SaveString: db "SAVE@"
|
|
|
|
.OptionString: db "OPTION@"
|
|
|
|
.ExitString: db "EXIT@"
|
|
|
|
.PokegearString: db "<POKE>GEAR@"
|
|
|
|
.QuitString: db "QUIT@"
|
|
|
|
|
|
|
|
.PokedexDesc:
|
|
|
|
db "#MON"
|
2016-06-07 05:13:08 -07:00
|
|
|
next "database@"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
.PartyDesc:
|
|
|
|
db "Party <PKMN>"
|
2016-06-07 05:13:08 -07:00
|
|
|
next "status@"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
.PackDesc:
|
|
|
|
db "Contains"
|
2016-06-07 05:13:08 -07:00
|
|
|
next "items@"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
.PokegearDesc:
|
|
|
|
db "Trainer's"
|
2016-06-07 05:13:08 -07:00
|
|
|
next "key device@"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
.StatusDesc:
|
|
|
|
db "Your own"
|
2016-06-07 05:13:08 -07:00
|
|
|
next "status@"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
.SaveDesc:
|
|
|
|
db "Save your"
|
2016-06-07 05:13:08 -07:00
|
|
|
next "progress@"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
.OptionDesc:
|
|
|
|
db "Change"
|
2016-06-07 05:13:08 -07:00
|
|
|
next "settings@"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
.ExitDesc:
|
|
|
|
db "Close this"
|
2016-06-07 05:13:08 -07:00
|
|
|
next "menu@"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
.QuitDesc:
|
|
|
|
db "Quit and"
|
2016-06-07 05:13:08 -07:00
|
|
|
next "be judged.@"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.OpenMenu:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-11 13:11:08 -08:00
|
|
|
call .GetMenuAccountTextPointer
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.MenuString:
|
2015-11-11 13:11:08 -08:00
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-11 13:11:08 -08:00
|
|
|
call .GetMenuAccountTextPointer
|
|
|
|
inc hl
|
2015-12-26 18:59:03 -08:00
|
|
|
inc hl
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.MenuDesc:
|
2015-11-11 13:11:08 -08:00
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-11 13:11:08 -08:00
|
|
|
cp $ff
|
|
|
|
jr z, .none
|
|
|
|
call .GetMenuAccountTextPointer
|
|
|
|
rept 4
|
|
|
|
inc hl
|
|
|
|
endr
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
.none
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.GetMenuAccountTextPointer:
|
2015-11-11 13:11:08 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2018-01-23 13:08:43 -08:00
|
|
|
ld hl, wMenuDataPointerTableAddr
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
rept 6
|
|
|
|
add hl, de
|
|
|
|
endr
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.SetUpMenuItems:
|
2015-11-11 13:11:08 -08:00
|
|
|
xor a
|
2015-12-18 17:07:09 -08:00
|
|
|
ld [wWhichIndexSet], a
|
2015-11-11 13:11:08 -08:00
|
|
|
call .FillMenuList
|
|
|
|
|
2017-12-28 04:15:46 -08:00
|
|
|
ld hl, wStatusFlags
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS_POKEDEX_F, [hl]
|
2015-11-11 13:11:08 -08:00
|
|
|
jr z, .no_pokedex
|
2018-01-22 09:03:18 -08:00
|
|
|
ld a, STARTMENUITEM_POKEDEX
|
2015-11-11 13:11:08 -08:00
|
|
|
call .AppendMenuList
|
|
|
|
.no_pokedex
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
jr z, .no_pokemon
|
2018-01-22 09:03:18 -08:00
|
|
|
ld a, STARTMENUITEM_POKEMON
|
2015-11-11 13:11:08 -08:00
|
|
|
call .AppendMenuList
|
|
|
|
.no_pokemon
|
|
|
|
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
and a
|
|
|
|
jr nz, .no_pack
|
2017-12-28 04:15:46 -08:00
|
|
|
ld hl, wStatusFlags2
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
|
2015-11-11 13:11:08 -08:00
|
|
|
jr nz, .no_pack
|
2018-01-22 09:03:18 -08:00
|
|
|
ld a, STARTMENUITEM_PACK
|
2015-11-11 13:11:08 -08:00
|
|
|
call .AppendMenuList
|
|
|
|
.no_pack
|
|
|
|
|
|
|
|
ld hl, wPokegearFlags
|
2018-01-22 09:03:18 -08:00
|
|
|
bit POKEGEAR_OBTAINED_F, [hl]
|
2015-11-11 13:11:08 -08:00
|
|
|
jr z, .no_pokegear
|
2018-01-22 09:03:18 -08:00
|
|
|
ld a, STARTMENUITEM_POKEGEAR
|
2015-11-11 13:11:08 -08:00
|
|
|
call .AppendMenuList
|
|
|
|
.no_pokegear
|
|
|
|
|
2018-01-22 12:40:43 -08:00
|
|
|
ld a, STARTMENUITEM_STATUS
|
2015-11-11 13:11:08 -08:00
|
|
|
call .AppendMenuList
|
|
|
|
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
and a
|
|
|
|
jr nz, .no_save
|
2017-12-28 04:15:46 -08:00
|
|
|
ld hl, wStatusFlags2
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
|
2018-01-22 09:03:18 -08:00
|
|
|
ld a, STARTMENUITEM_QUIT
|
2015-11-11 13:11:08 -08:00
|
|
|
jr nz, .write
|
2018-01-22 09:03:18 -08:00
|
|
|
ld a, STARTMENUITEM_SAVE
|
2015-11-11 13:11:08 -08:00
|
|
|
.write
|
|
|
|
call .AppendMenuList
|
|
|
|
.no_save
|
|
|
|
|
2018-01-22 09:03:18 -08:00
|
|
|
ld a, STARTMENUITEM_OPTION
|
2015-11-11 13:11:08 -08:00
|
|
|
call .AppendMenuList
|
2018-01-22 09:03:18 -08:00
|
|
|
ld a, STARTMENUITEM_EXIT
|
2015-11-11 13:11:08 -08:00
|
|
|
call .AppendMenuList
|
|
|
|
ld a, c
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMenuItemsList], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.FillMenuList:
|
2015-11-11 13:11:08 -08:00
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wMenuItemsList
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [hli], a
|
|
|
|
ld a, -1
|
2018-01-23 14:39:09 -08:00
|
|
|
ld bc, wMenuItemsListEnd - (wMenuItemsList + 1)
|
2015-11-11 13:11:08 -08:00
|
|
|
call ByteFill
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMenuItemsList + 1
|
2015-11-11 13:11:08 -08:00
|
|
|
ld c, 0
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.AppendMenuList:
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
inc c
|
|
|
|
ret
|
|
|
|
|
2018-07-22 21:13:43 -07:00
|
|
|
.DrawMenuAccount:
|
|
|
|
jp ._DrawMenuAccount
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PrintMenuAccount:
|
2015-11-11 13:11:08 -08:00
|
|
|
call .IsMenuAccountOn
|
|
|
|
ret z
|
2018-07-22 21:13:43 -07:00
|
|
|
call ._DrawMenuAccount
|
2015-11-11 13:11:08 -08:00
|
|
|
decoord 0, 14
|
|
|
|
jp .MenuDesc
|
|
|
|
|
2018-07-22 21:13:43 -07:00
|
|
|
._DrawMenuAccount:
|
2015-11-11 13:11:08 -08:00
|
|
|
call .IsMenuAccountOn
|
|
|
|
ret z
|
|
|
|
hlcoord 0, 13
|
|
|
|
lb bc, 5, 10
|
|
|
|
call ClearBox
|
|
|
|
hlcoord 0, 13
|
|
|
|
ld b, 3
|
|
|
|
ld c, 8
|
2019-04-08 05:15:10 -07:00
|
|
|
jp TextboxPalette
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.IsMenuAccountOn:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wOptions2]
|
2018-01-22 09:03:18 -08:00
|
|
|
and 1 << MENU_ACCOUNT
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.DrawBugContestStatusBox:
|
2017-12-28 04:15:46 -08:00
|
|
|
ld hl, wStatusFlags2
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
|
2015-11-11 13:11:08 -08:00
|
|
|
ret z
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall StartMenu_DrawBugContestStatusBox
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.DrawBugContestStatus:
|
2017-12-28 04:15:46 -08:00
|
|
|
ld hl, wStatusFlags2
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
|
2015-11-11 13:11:08 -08:00
|
|
|
jr nz, .contest
|
|
|
|
ret
|
|
|
|
.contest
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall StartMenu_PrintBugContestStatus
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu_Exit:
|
2015-11-11 13:11:08 -08:00
|
|
|
; Exit the menu.
|
|
|
|
|
|
|
|
ld a, 1
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu_Quit:
|
2015-11-11 13:11:08 -08:00
|
|
|
; Retire from the bug catching contest.
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .StartMenuContestEndText
|
2015-11-17 14:56:49 -08:00
|
|
|
call StartMenuYesNo
|
2015-11-11 13:11:08 -08:00
|
|
|
jr c, .DontEndContest
|
|
|
|
ld a, BANK(BugCatchingContestReturnToGateScript)
|
|
|
|
ld hl, BugCatchingContestReturnToGateScript
|
|
|
|
call FarQueueScript
|
|
|
|
ld a, 4
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.DontEndContest:
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 0
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.StartMenuContestEndText:
|
|
|
|
text_far _StartMenuContestEndText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu_Save:
|
2015-11-11 13:11:08 -08:00
|
|
|
; Save the game.
|
|
|
|
|
|
|
|
call BufferScreen
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall SaveMenu
|
2020-06-18 07:11:12 -07:00
|
|
|
jr nc, .saved
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 0
|
|
|
|
ret
|
2020-06-18 07:11:12 -07:00
|
|
|
|
|
|
|
.saved
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 1
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu_Option:
|
2015-11-11 13:11:08 -08:00
|
|
|
; Game options.
|
|
|
|
|
|
|
|
call FadeToMenu
|
2020-06-18 07:11:12 -07:00
|
|
|
farcall Option
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 6
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu_Status:
|
2015-11-11 13:11:08 -08:00
|
|
|
; Player status.
|
|
|
|
|
|
|
|
call FadeToMenu
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall TrainerCard
|
2015-12-01 18:54:11 -08:00
|
|
|
call CloseSubmenu
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 0
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu_Pokedex:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
2020-06-18 07:11:12 -07:00
|
|
|
jr z, .empty
|
2015-11-11 13:11:08 -08:00
|
|
|
|
|
|
|
call FadeToMenu
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall Pokedex
|
2015-12-01 18:54:11 -08:00
|
|
|
call CloseSubmenu
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2020-06-18 07:11:12 -07:00
|
|
|
.empty
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 0
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu_Pokegear:
|
2015-11-11 13:11:08 -08:00
|
|
|
call FadeToMenu
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PokeGear
|
2015-12-01 18:54:11 -08:00
|
|
|
call CloseSubmenu
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 0
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu_Pack:
|
2015-11-11 13:11:08 -08:00
|
|
|
call FadeToMenu
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall Pack
|
2018-01-11 12:36:11 -08:00
|
|
|
ld a, [wPackUsedItem]
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
2015-11-17 14:56:49 -08:00
|
|
|
jr nz, .used_item
|
2015-12-01 18:54:11 -08:00
|
|
|
call CloseSubmenu
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 0
|
|
|
|
ret
|
2015-11-17 14:56:49 -08:00
|
|
|
|
|
|
|
.used_item
|
|
|
|
call ExitAllMenus
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 4
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartMenu_Pokemon:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
jr z, .return
|
|
|
|
|
|
|
|
call FadeToMenu
|
|
|
|
|
|
|
|
.choosemenu
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPartyMenuActionText], a ; Choose a POKéMON.
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearBGPalettes
|
2015-11-11 13:11:08 -08:00
|
|
|
|
|
|
|
.menu
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall LoadPartyMenuGFX
|
|
|
|
farcall InitPartyMenuWithCancel
|
|
|
|
farcall InitPartyMenuGFX
|
2015-11-11 13:11:08 -08:00
|
|
|
|
|
|
|
.menunoreload
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall WritePartyMenuTilemap
|
2023-08-11 03:28:14 -07:00
|
|
|
farcall PlacePartyMenuText
|
2015-11-11 13:11:08 -08:00
|
|
|
call WaitBGMap
|
|
|
|
call SetPalettes ; load regular palettes?
|
|
|
|
call DelayFrame
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PartyMenuSelect
|
2015-11-11 13:11:08 -08:00
|
|
|
jr c, .return ; if cancelled or pressed B
|
|
|
|
|
|
|
|
call PokemonActionSubmenu
|
|
|
|
cp 3
|
|
|
|
jr z, .menu
|
|
|
|
cp 0
|
|
|
|
jr z, .choosemenu
|
|
|
|
cp 1
|
|
|
|
jr z, .menunoreload
|
|
|
|
cp 2
|
|
|
|
jr z, .quit
|
|
|
|
|
|
|
|
.return
|
2015-12-01 18:54:11 -08:00
|
|
|
call CloseSubmenu
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 0
|
|
|
|
ret
|
|
|
|
|
|
|
|
.quit
|
|
|
|
ld a, b
|
|
|
|
push af
|
2015-11-17 14:56:49 -08:00
|
|
|
call ExitAllMenus
|
2015-11-11 13:11:08 -08:00
|
|
|
pop af
|
|
|
|
ret
|