Harmonize engine/menus with pokegold

This commit is contained in:
Rangi 2020-06-18 10:11:12 -04:00
parent 50e182e831
commit ed3bcf6fa2
7 changed files with 116 additions and 98 deletions

View File

@ -13,7 +13,7 @@ _DeleteSaveData:
call VerticalMenu call VerticalMenu
ret c ret c
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
cp $1 cp 1
ret z ret z
farcall EmptyAllSRAMBanks farcall EmptyAllSRAMBanks
ret ret

View File

@ -1,4 +1,4 @@
_MainMenu: Intro_MainMenu:
ld de, MUSIC_NONE ld de, MUSIC_NONE
call PlayMusic call PlayMusic
call DelayFrame call DelayFrame
@ -54,8 +54,8 @@ MysteryGift:
farcall DoMysteryGift farcall DoMysteryGift
ret ret
OptionsMenu: Option:
farcall _OptionsMenu farcall _Option
ret ret
NewGame: NewGame:
@ -66,7 +66,8 @@ NewGame:
call AreYouABoyOrAreYouAGirl call AreYouABoyOrAreYouAGirl
call OakSpeech call OakSpeech
call InitializeWorld call InitializeWorld
ld a, 1
ld a, LANDMARK_NEW_BARK_TOWN
ld [wPrevLandmark], a ld [wPrevLandmark], a
ld a, SPAWN_HOME ld a, SPAWN_HOME
@ -77,7 +78,7 @@ NewGame:
jp FinishContinueFunction jp FinishContinueFunction
AreYouABoyOrAreYouAGirl: AreYouABoyOrAreYouAGirl:
farcall Mobile_AlwaysReturnNotCarry ; some mobile stuff farcall Mobile_AlwaysReturnNotCarry ; mobile
jr c, .ok jr c, .ok
farcall InitGender farcall InitGender
ret ret
@ -780,7 +781,7 @@ NamePlayer:
.Kris: .Kris:
db "KRIS@@@@@@@" db "KRIS@@@@@@@"
Unreferenced_Function60e9: Unreferenced_GSShowPlayerNamingChoices:
call LoadMenuHeader call LoadMenuHeader
call VerticalMenu call VerticalMenu
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
@ -910,7 +911,7 @@ ShrinkFrame:
Intro_PlacePlayerSprite: Intro_PlacePlayerSprite:
farcall GetPlayerIcon farcall GetPlayerIcon
ld c, $c ld c, 12
ld hl, vTiles0 ld hl, vTiles0
call Request2bpp call Request2bpp
@ -939,7 +940,7 @@ Intro_PlacePlayerSprite:
.male .male
ld a, b ld a, b
ld [hli], a ld [hli], a ; attributes
dec c dec c
jr nz, .loop jr nz, .loop
ret ret
@ -952,7 +953,7 @@ Intro_PlacePlayerSprite:
db 10 * 8 + 4, 9 * 8, 2 db 10 * 8 + 4, 9 * 8, 2
db 10 * 8 + 4, 10 * 8, 3 db 10 * 8 + 4, 10 * 8, 3
CrystalIntroSequence: IntroSequence:
callfar Copyright_GameFreakPresents callfar Copyright_GameFreakPresents
jr c, StartTitleScreen jr c, StartTitleScreen
farcall CrystalIntro farcall CrystalIntro
@ -1008,10 +1009,10 @@ StartTitleScreen:
jp hl jp hl
.dw .dw
dw _MainMenu dw Intro_MainMenu
dw DeleteSaveData dw DeleteSaveData
dw CrystalIntroSequence dw IntroSequence
dw CrystalIntroSequence dw IntroSequence
dw ResetClock dw ResetClock
.TitleScreen: .TitleScreen:
@ -1258,12 +1259,12 @@ Unreferenced_Function639b:
ret nz ret nz
ld bc, wSpriteAnim10 ld bc, wSpriteAnim10
ld hl, SPRITEANIMSTRUCT_FRAME ld hl, SPRITEANIMSTRUCT_FRAME
add hl, bc ; over-the-top compicated way to load wc3ae into hl add hl, bc
ld l, [hl] ld l, [hl]
ld h, 0 ld h, 0
add hl, hl add hl, hl
add hl, hl add hl, hl
ld de, .Data63ca ld de, .Data_63ca
add hl, de add hl, de
; If bit 2 of [wTitleScreenTimer] is set, get the second dw; else, get the first dw ; If bit 2 of [wTitleScreenTimer] is set, get the second dw; else, get the first dw
ld a, [wTitleScreenTimer] ld a, [wTitleScreenTimer]
@ -1283,7 +1284,7 @@ Unreferenced_Function639b:
call InitSpriteAnimStruct call InitSpriteAnimStruct
ret ret
.Data63ca: .Data_63ca:
; frame 0 y, x; frame 1 y, x ; frame 0 y, x; frame 1 y, x
db 11 * 8 + 4, 10 * 8, 0 * 8, 0 * 8 db 11 * 8 + 4, 10 * 8, 0 * 8, 0 * 8
db 11 * 8 + 4, 13 * 8, 11 * 8 + 4, 11 * 8 db 11 * 8 + 4, 13 * 8, 11 * 8 + 4, 11 * 8
@ -1333,4 +1334,4 @@ GameInit::
ld a, $90 ld a, $90
ldh [hWY], a ldh [hWY], a
call WaitBGMap call WaitBGMap
jp CrystalIntroSequence jp IntroSequence

View File

@ -1,7 +1,29 @@
; MainMenuItems indexes
const_def
const MAINMENU_NEW_GAME ; 0
const MAINMENU_CONTINUE ; 1
const MAINMENU_MOBILE_MYSTERY ; 2
const MAINMENU_MOBILE ; 3
const MAINMENU_MOBILE_STUDIUM ; 4
const MAINMENU_MYSTERY_MOBILE_STUDIUM ; 5
const MAINMENU_MYSTERY ; 6
const MAINMENU_MYSTERY_STUDIUM ; 7
const MAINMENU_STUDIUM ; 8
; MainMenu.Strings and MainMenu.Jumptable indexes
const_def
const MAINMENUITEM_CONTINUE ; 0
const MAINMENUITEM_NEW_GAME ; 1
const MAINMENUITEM_OPTION ; 2
const MAINMENUITEM_MYSTERY_GIFT ; 3
const MAINMENUITEM_MOBILE ; 4
const MAINMENUITEM_MOBILE_STUDIUM ; 5
MobileMenuGFX: MobileMenuGFX:
INCBIN "gfx/mobile/mobile_menu.2bpp" INCBIN "gfx/mobile/mobile_menu.2bpp"
MainMenu: MainMenu:
.loop
xor a xor a
ld [wDisableTextAcceleration], a ld [wDisableTextAcceleration], a
call ClearTilemapEtc call ClearTilemapEtc
@ -22,7 +44,7 @@ MainMenu:
ld a, [wMenuSelection] ld a, [wMenuSelection]
ld hl, .Jumptable ld hl, .Jumptable
rst JumpTable rst JumpTable
jr MainMenu jr .loop
.quit .quit
ret ret
@ -41,6 +63,7 @@ MainMenu:
dw .Strings dw .Strings
.Strings: .Strings:
; entries correspond to MAINMENUITEM_* constants
db "CONTINUE@" db "CONTINUE@"
db "NEW GAME@" db "NEW GAME@"
db "OPTION@" db "OPTION@"
@ -49,94 +72,89 @@ MainMenu:
db "MOBILE STUDIUM@" db "MOBILE STUDIUM@"
.Jumptable: .Jumptable:
; entries correspond to MAINMENUITEM_* constants
dw MainMenu_Continue dw MainMenu_Continue
dw MainMenu_NewGame dw MainMenu_NewGame
dw MainMenu_Options dw MainMenu_Option
dw MainMenu_MysteryGift dw MainMenu_MysteryGift
dw MainMenu_Mobile dw MainMenu_Mobile
dw MainMenu_MobileStudium dw MainMenu_MobileStudium
CONTINUE EQU 0
NEW_GAME EQU 1
OPTION EQU 2
MYSTERY_GIFT EQU 3
MOBILE EQU 4
MOBILE_STUDIUM EQU 5
MainMenuItems: MainMenuItems:
; entries correspond to MAINMENU_* constants
NewGameMenu: ; MAINMENU_NEW_GAME
db 2 db 2
db NEW_GAME db MAINMENUITEM_NEW_GAME
db OPTION db MAINMENUITEM_OPTION
db -1 db -1
ContinueMenu: ; MAINMENU_CONTINUE
db 3 db 3
db CONTINUE db MAINMENUITEM_CONTINUE
db NEW_GAME db MAINMENUITEM_NEW_GAME
db OPTION db MAINMENUITEM_OPTION
db -1 db -1
MobileMysteryMenu: ; MAINMENU_MOBILE_MYSTERY
db 5 db 5
db CONTINUE db MAINMENUITEM_CONTINUE
db NEW_GAME db MAINMENUITEM_NEW_GAME
db OPTION db MAINMENUITEM_OPTION
db MYSTERY_GIFT db MAINMENUITEM_MYSTERY_GIFT
db MOBILE db MAINMENUITEM_MOBILE
db -1 db -1
MobileMenu: ; MAINMENU_MOBILE
db 4 db 4
db CONTINUE db MAINMENUITEM_CONTINUE
db NEW_GAME db MAINMENUITEM_NEW_GAME
db OPTION db MAINMENUITEM_OPTION
db MOBILE db MAINMENUITEM_MOBILE
db -1 db -1
MobileStudiumMenu: ; MAINMENU_MOBILE_STUDIUM
db 5 db 5
db CONTINUE db MAINMENUITEM_CONTINUE
db NEW_GAME db MAINMENUITEM_NEW_GAME
db OPTION db MAINMENUITEM_OPTION
db MOBILE db MAINMENUITEM_MOBILE
db MOBILE_STUDIUM db MAINMENUITEM_MOBILE_STUDIUM
db -1 db -1
MysteryMobileStudiumMenu: ; MAINMENU_MYSTERY_MOBILE_STUDIUM
db 6 db 6
db CONTINUE db MAINMENUITEM_CONTINUE
db NEW_GAME db MAINMENUITEM_NEW_GAME
db OPTION db MAINMENUITEM_OPTION
db MYSTERY_GIFT db MAINMENUITEM_MYSTERY_GIFT
db MOBILE db MAINMENUITEM_MOBILE
db MOBILE_STUDIUM db MAINMENUITEM_MOBILE_STUDIUM
db -1 db -1
MysteryMenu: ; MAINMENU_MYSTERY
db 4 db 4
db CONTINUE db MAINMENUITEM_CONTINUE
db NEW_GAME db MAINMENUITEM_NEW_GAME
db OPTION db MAINMENUITEM_OPTION
db MYSTERY_GIFT db MAINMENUITEM_MYSTERY_GIFT
db -1 db -1
MysteryStudiumMenu: ; MAINMENU_MYSTERY_STUDIUM
db 5 db 5
db CONTINUE db MAINMENUITEM_CONTINUE
db NEW_GAME db MAINMENUITEM_NEW_GAME
db OPTION db MAINMENUITEM_OPTION
db MYSTERY_GIFT db MAINMENUITEM_MYSTERY_GIFT
db MOBILE_STUDIUM db MAINMENUITEM_MOBILE_STUDIUM
db -1 db -1
StudiumMenu: ; MAINMENU_STUDIUM
db 4 db 4
db CONTINUE db MAINMENUITEM_CONTINUE
db NEW_GAME db MAINMENUITEM_NEW_GAME
db OPTION db MAINMENUITEM_OPTION
db MOBILE_STUDIUM db MAINMENUITEM_MOBILE_STUDIUM
db -1 db -1
MainMenu_GetWhichMenu: MainMenu_GetWhichMenu:
@ -146,13 +164,13 @@ MainMenu_GetWhichMenu:
ld a, [wSaveFileExists] ld a, [wSaveFileExists]
and a and a
jr nz, .next jr nz, .next
ld a, $0 ; New Game ld a, MAINMENU_NEW_GAME
ret ret
.next .next
ldh a, [hCGB] ldh a, [hCGB]
cp $1 cp TRUE
ld a, $1 ld a, MAINMENU_CONTINUE
ret nz ret nz
ld a, BANK(sNumDailyMysteryGiftPartnerIDs) ld a, BANK(sNumDailyMysteryGiftPartnerIDs)
call OpenSRAM call OpenSRAM
@ -163,7 +181,7 @@ MainMenu_GetWhichMenu:
; This check makes no difference. ; This check makes no difference.
ld a, [wStatusFlags] ld a, [wStatusFlags]
bit STATUSFLAGS_MAIN_MENU_MOBILE_CHOICES_F, a bit STATUSFLAGS_MAIN_MENU_MOBILE_CHOICES_F, a
ld a, $1 ; Continue ld a, MAINMENU_CONTINUE
jr z, .ok jr z, .ok
jr .ok jr .ok
@ -171,7 +189,7 @@ MainMenu_GetWhichMenu:
jr .ok2 jr .ok2
.ok2 .ok2
ld a, $1 ; Continue ld a, MAINMENU_CONTINUE
ret ret
.mystery_gift .mystery_gift
@ -185,7 +203,7 @@ MainMenu_GetWhichMenu:
jr .ok4 jr .ok4
.ok4 .ok4
ld a, $6 ; Mystery Gift ld a, MAINMENU_MYSTERY
ret ret
MainMenuJoypadLoop: MainMenuJoypadLoop:
@ -232,7 +250,7 @@ MainMenu_PrintCurrentTimeAndDay:
.PlaceBox: .PlaceBox:
call CheckRTCStatus call CheckRTCStatus
and $80 and %10000000 ; Day count exceeded 16383
jr nz, .TimeFail jr nz, .TimeFail
hlcoord 0, 14 hlcoord 0, 14
ld b, 2 ld b, 2
@ -255,7 +273,7 @@ MainMenu_PrintCurrentTimeAndDay:
call GetWeekday call GetWeekday
ld b, a ld b, a
decoord 1, 15 decoord 1, 15
call .PlaceCurrentDay call .PrintDayOfWeek
decoord 4, 16 decoord 4, 16
ldh a, [hHours] ldh a, [hHours]
ld c, a ld c, a
@ -284,7 +302,7 @@ MainMenu_PrintCurrentTimeAndDay:
text_far _MainMenuTimeUnknownText text_far _MainMenuTimeUnknownText
text_end text_end
.PlaceCurrentDay: .PrintDayOfWeek:
push de push de
ld hl, .Days ld hl, .Days
ld a, b ld a, b
@ -323,8 +341,8 @@ MainMenu_NewGame:
farcall NewGame farcall NewGame
ret ret
MainMenu_Options: MainMenu_Option:
farcall OptionsMenu farcall Option
ret ret
MainMenu_Continue: MainMenu_Continue:

View File

@ -277,7 +277,6 @@ Unreferenced_Function241d5:
.loop .loop
call Move2DMenuCursor call Move2DMenuCursor
call HDMATransferTilemapToWRAMBank3 ; BUG: This function is in another bank. call HDMATransferTilemapToWRAMBank3 ; BUG: This function is in another bank.
; Pointer in current bank (9) is bogus.
call .loop2 call .loop2
jr nc, .done jr nc, .done
call _2DMenuInterpretJoypad call _2DMenuInterpretJoypad
@ -300,7 +299,6 @@ Unreferenced_Function241d5:
ld c, 1 ld c, 1
ld b, 3 ld b, 3
call AdvanceMobileInactivityTimerAndCheckExpired ; BUG: This function is in another bank. call AdvanceMobileInactivityTimerAndCheckExpired ; BUG: This function is in another bank.
; Pointer in current bank (9) is bogus.
ret c ret c
farcall Function100337 farcall Function100337
ret c ret c
@ -566,8 +564,8 @@ _PushWindow::
ld d, [hl] ld d, [hl]
push de push de
ld b, $10 ld b, wMenuHeaderEnd - wMenuHeader
ld hl, wMenuFlags ld hl, wMenuHeader
.loop .loop
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a

View File

@ -193,7 +193,7 @@ NamingScreen:
.LoadSprite: .LoadSprite:
push de push de
ld hl, vTiles0 tile $00 ld hl, vTiles0 tile $00
ld c, $4 ld c, 4
push bc push bc
call Request2bpp call Request2bpp
pop bc pop bc
@ -698,7 +698,7 @@ NamingScreen_AdvanceCursor_CheckEndOfString:
scf scf
ret ret
; unused Unreferenced_AddDakutenToCharacter:
ld a, [wNamingScreenCurNameLength] ld a, [wNamingScreenCurNameLength]
and a and a
ret z ret z
@ -711,7 +711,7 @@ NamingScreen_AdvanceCursor_CheckEndOfString:
.loop .loop
ld a, [hli] ld a, [hli]
cp $ff cp -1
jr z, NamingScreen_AdvanceCursor_CheckEndOfString jr z, NamingScreen_AdvanceCursor_CheckEndOfString
cp c cp c
jr z, .done jr z, .done
@ -975,7 +975,7 @@ INCBIN "gfx/icons/mail_big.2bpp"
ld [wNamingScreenMaxNameLength], a ld [wNamingScreenMaxNameLength], a
ret ret
.UnusedString11f7a: .Unreferenced_PleaseWriteAMailString:
db "メールを かいてね@" db "メールを かいてね@"
.InitCharset: .InitCharset:

View File

@ -10,7 +10,7 @@
const OPT_CANCEL ; 7 const OPT_CANCEL ; 7
NUM_OPTIONS EQU const_value ; 8 NUM_OPTIONS EQU const_value ; 8
_OptionsMenu: _Option:
ld hl, hInMenu ld hl, hInMenu
ld a, [hl] ld a, [hl]
push af push af

View File

@ -433,10 +433,11 @@ StartMenu_Save:
call BufferScreen call BufferScreen
farcall SaveMenu farcall SaveMenu
jr nc, .asm_12919 jr nc, .saved
ld a, 0 ld a, 0
ret ret
.asm_12919
.saved
ld a, 1 ld a, 1
ret ret
@ -444,7 +445,7 @@ StartMenu_Option:
; Game options. ; Game options.
call FadeToMenu call FadeToMenu
farcall OptionsMenu farcall Option
ld a, 6 ld a, 6
ret ret
@ -460,13 +461,13 @@ StartMenu_Status:
StartMenu_Pokedex: StartMenu_Pokedex:
ld a, [wPartyCount] ld a, [wPartyCount]
and a and a
jr z, .asm_12949 jr z, .empty
call FadeToMenu call FadeToMenu
farcall Pokedex farcall Pokedex
call CloseSubmenu call CloseSubmenu
.asm_12949 .empty
ld a, 0 ld a, 0
ret ret