pokecrystal/engine/menus/main_menu.asm

338 lines
4.4 KiB
NASM
Raw Normal View History

2018-06-24 14:09:41 +00:00
GFX_49c0c:
2015-11-17 03:29:54 +00:00
INCBIN "gfx/unknown/049c0c.2bpp"
2018-06-24 14:09:41 +00:00
MainMenu:
2015-11-17 03:29:54 +00:00
xor a
2016-05-05 19:07:37 +00:00
ld [wDisableTextAcceleration], a
2015-11-17 03:29:54 +00:00
call Function49ed0
2016-06-06 22:23:00 +00:00
ld b, SCGB_DIPLOMA
2015-11-17 03:29:54 +00:00
call GetSGBLayout
call SetPalettes
ld hl, wGameTimerPause
2018-01-23 17:40:29 +00:00
res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
call MainMenu_GetWhichMenu
2015-12-19 01:07:09 +00:00
ld [wWhichIndexSet], a
call MainMenu_PrintCurrentTimeAndDay
ld hl, .MenuHeader
call LoadMenuHeader
call MainMenuJoypadLoop
call CloseWindow
2015-11-17 03:29:54 +00:00
jr c, .quit
call ClearTileMap
2018-01-23 22:39:09 +00:00
ld a, [wMenuSelection]
ld hl, .Jumptable
2015-11-17 03:29:54 +00:00
rst JumpTable
jr MainMenu
.quit
ret
2018-06-24 14:09:41 +00:00
.MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 0, 16, 7
dw .MenuData
2015-11-17 03:29:54 +00:00
db 1 ; default option
2018-06-24 14:09:41 +00:00
.MenuData:
db STATICMENU_CURSOR ; flags
2015-11-17 03:29:54 +00:00
db 0 ; items
dw MainMenuItems
2015-12-13 19:15:16 +00:00
dw PlaceMenuStrings
dw .Strings
2015-11-17 03:29:54 +00:00
2018-06-24 14:09:41 +00:00
.Strings:
2015-11-17 03:29:54 +00:00
db "CONTINUE@"
db "NEW GAME@"
db "OPTION@"
db "MYSTERY GIFT@"
db "MOBILE@"
db "MOBILE STUDIUM@"
.Jumptable:
2015-12-27 02:59:03 +00:00
dw MainMenu_Continue
dw MainMenu_NewGame
dw MainMenu_Options
dw MainMenu_MysteryGift
dw MainMenu_Mobile
dw MainMenu_MobileStudium
2015-11-17 03:29:54 +00:00
CONTINUE EQU 0
NEW_GAME EQU 1
OPTION EQU 2
MYSTERY_GIFT EQU 3
MOBILE EQU 4
MOBILE_STUDIUM EQU 5
MainMenuItems:
NewGameMenu:
2015-11-17 03:29:54 +00:00
db 2
db NEW_GAME
db OPTION
db -1
2015-11-17 03:29:54 +00:00
ContinueMenu:
2015-11-17 03:29:54 +00:00
db 3
db CONTINUE
db NEW_GAME
db OPTION
db -1
2015-11-17 03:29:54 +00:00
MobileMysteryMenu:
2015-11-17 03:29:54 +00:00
db 5
db CONTINUE
db NEW_GAME
db OPTION
db MYSTERY_GIFT
db MOBILE
db -1
2015-11-17 03:29:54 +00:00
MobileMenu:
2015-11-17 03:29:54 +00:00
db 4
db CONTINUE
db NEW_GAME
db OPTION
db MOBILE
db -1
2015-11-17 03:29:54 +00:00
MobileStudiumMenu:
2015-11-17 03:29:54 +00:00
db 5
db CONTINUE
db NEW_GAME
db OPTION
db MOBILE
db MOBILE_STUDIUM
db -1
2015-11-17 03:29:54 +00:00
MysteryMobileStudiumMenu:
2015-11-17 03:29:54 +00:00
db 6
db CONTINUE
db NEW_GAME
db OPTION
db MYSTERY_GIFT
db MOBILE
db MOBILE_STUDIUM
db -1
2015-11-17 03:29:54 +00:00
MysteryMenu:
2015-11-17 03:29:54 +00:00
db 4
db CONTINUE
db NEW_GAME
db OPTION
db MYSTERY_GIFT
db -1
2015-11-17 03:29:54 +00:00
MysteryStudiumMenu:
2015-11-17 03:29:54 +00:00
db 5
db CONTINUE
db NEW_GAME
db OPTION
db MYSTERY_GIFT
db MOBILE_STUDIUM
db -1
2015-11-17 03:29:54 +00:00
StudiumMenu:
2015-11-17 03:29:54 +00:00
db 4
db CONTINUE
db NEW_GAME
db OPTION
db MOBILE_STUDIUM
db -1
2015-11-17 03:29:54 +00:00
2018-06-24 14:09:41 +00:00
MainMenu_GetWhichMenu:
2015-11-17 03:29:54 +00:00
nop
nop
nop
2015-11-18 04:29:14 +00:00
ld a, [wSaveFileExists]
2015-11-17 03:29:54 +00:00
and a
jr nz, .next
ld a, $0 ; New Game
2015-11-17 03:29:54 +00:00
ret
.next
ldh a, [hCGB]
2015-11-17 03:29:54 +00:00
cp $1
ld a, $1
ret nz
2015-11-23 05:21:21 +00:00
ld a, BANK(sNumDailyMysteryGiftPartnerIDs)
2015-11-17 03:29:54 +00:00
call GetSRAMBank
2015-11-23 05:21:21 +00:00
ld a, [sNumDailyMysteryGiftPartnerIDs]
cp -1
2015-11-17 03:29:54 +00:00
call CloseSRAM
jr nz, .mystery_gift
2018-01-22 20:40:43 +00:00
; This check makes no difference.
ld a, [wStatusFlags]
bit STATUSFLAGS_MAIN_MENU_MOBILE_CHOICES_F, a
ld a, $1 ; Continue
2015-11-17 03:29:54 +00:00
jr z, .ok
jr .ok
.ok
jr .ok2
.ok2
ld a, $1 ; Continue
2015-11-17 03:29:54 +00:00
ret
.mystery_gift
2018-01-22 20:40:43 +00:00
; This check makes no difference.
ld a, [wStatusFlags]
bit STATUSFLAGS_MAIN_MENU_MOBILE_CHOICES_F, a
2015-11-17 03:29:54 +00:00
jr z, .ok3
jr .ok3
.ok3
jr .ok4
.ok4
ld a, $6 ; Mystery Gift
2015-11-17 03:29:54 +00:00
ret
2018-06-24 14:09:41 +00:00
MainMenuJoypadLoop:
2015-11-17 03:29:54 +00:00
call SetUpMenu
.loop
call MainMenu_PrintCurrentTimeAndDay
ld a, [w2DMenuFlags1]
2015-11-17 03:29:54 +00:00
set 5, a
ld [w2DMenuFlags1], a
2016-03-02 03:31:21 +00:00
call GetScrollingMenuJoypad
2015-12-15 23:59:49 +00:00
ld a, [wMenuJoypad]
cp B_BUTTON
jr z, .b_button
cp A_BUTTON
jr z, .a_button
jr .loop
2015-11-17 03:29:54 +00:00
.a_button
2015-11-17 03:29:54 +00:00
call PlayClickSFX
and a
ret
.b_button
2015-11-17 03:29:54 +00:00
scf
ret
2018-06-24 14:09:41 +00:00
MainMenu_PrintCurrentTimeAndDay:
2015-11-18 04:29:14 +00:00
ld a, [wSaveFileExists]
2015-11-17 03:29:54 +00:00
and a
ret z
xor a
ldh [hBGMapMode], a
call .PlaceBox
2018-01-23 22:39:09 +00:00
ld hl, wOptions
2015-11-17 03:29:54 +00:00
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
call .PlaceTime
2015-11-17 03:29:54 +00:00
pop af
2018-01-23 22:39:09 +00:00
ld [wOptions], a
2015-11-17 03:29:54 +00:00
ld a, $1
ldh [hBGMapMode], a
2015-11-17 03:29:54 +00:00
ret
2018-06-24 14:09:41 +00:00
.PlaceBox:
2015-11-20 16:47:52 +00:00
call CheckRTCStatus
2015-11-17 03:29:54 +00:00
and $80
jr nz, .TimeFail
2015-11-17 03:29:54 +00:00
hlcoord 0, 14
ld b, 2
ld c, 18
2015-11-17 03:29:54 +00:00
call TextBox
ret
.TimeFail:
2015-11-17 03:29:54 +00:00
call SpeechTextBox
ret
2018-06-24 14:09:41 +00:00
.PlaceTime:
2015-11-18 04:29:14 +00:00
ld a, [wSaveFileExists]
2015-11-17 03:29:54 +00:00
and a
ret z
2015-11-20 16:47:52 +00:00
call CheckRTCStatus
2015-11-17 03:29:54 +00:00
and $80
jp nz, .PrintTimeNotSet
2015-11-17 03:29:54 +00:00
call UpdateTime
call GetWeekday
ld b, a
decoord 1, 15
call .PlaceCurrentDay
2015-11-17 03:29:54 +00:00
decoord 4, 16
ldh a, [hHours]
2015-11-17 03:29:54 +00:00
ld c, a
2017-12-24 17:47:30 +00:00
farcall PrintHour
2015-11-17 03:29:54 +00:00
ld [hl], ":"
inc hl
ld de, hMinutes
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ret
.min
2018-01-02 15:04:21 +00:00
; unused
2015-11-17 03:29:54 +00:00
db "min.@"
2018-06-24 14:09:41 +00:00
.PrintTimeNotSet:
2015-11-17 03:29:54 +00:00
hlcoord 1, 14
ld de, .TimeNotSet
call PlaceString
ret
2018-06-24 14:09:41 +00:00
.TimeNotSet:
2015-11-17 03:29:54 +00:00
db "TIME NOT SET@"
2018-06-24 14:09:41 +00:00
.UnusedText:
; Clock time unknown
text_far UnknownText_0x1c5182
text_end
2015-11-17 03:29:54 +00:00
2018-06-24 14:09:41 +00:00
.PlaceCurrentDay:
2015-11-17 03:29:54 +00:00
push de
ld hl, .Days
ld a, b
call GetNthString
ld d, h
ld e, l
pop hl
call PlaceString
ld h, b
ld l, c
ld de, .Day
call PlaceString
ret
.Days:
2015-11-17 03:29:54 +00:00
db "SUN@"
db "MON@"
db "TUES@"
db "WEDNES@"
db "THURS@"
db "FRI@"
db "SATUR@"
.Day:
2015-11-17 03:29:54 +00:00
db "DAY@"
2018-06-24 14:09:41 +00:00
Function49ed0:
2015-11-17 03:29:54 +00:00
xor a
ldh [hMapAnims], a
2015-11-17 03:29:54 +00:00
call ClearTileMap
call LoadFontsExtra
call LoadStandardFont
call ClearWindowData
2015-11-17 03:29:54 +00:00
ret
2018-06-24 14:09:41 +00:00
MainMenu_NewGame:
2017-12-24 17:47:30 +00:00
farcall NewGame
2015-11-17 03:29:54 +00:00
ret
2018-06-24 14:09:41 +00:00
MainMenu_Options:
2017-12-24 17:47:30 +00:00
farcall OptionsMenu
2015-11-17 03:29:54 +00:00
ret
2018-06-24 14:09:41 +00:00
MainMenu_Continue:
2017-12-24 17:47:30 +00:00
farcall Continue
2015-11-17 03:29:54 +00:00
ret
2018-06-24 14:09:41 +00:00
MainMenu_MysteryGift:
2017-12-24 17:47:30 +00:00
farcall MysteryGift
2015-11-17 03:29:54 +00:00
ret