main menu progress for the day, still have a bunch more to go.

This commit is contained in:
2Tie 2018-06-17 23:04:49 -06:00
parent b095e62630
commit c557bd6613
8 changed files with 696 additions and 48 deletions

View File

@ -35,3 +35,4 @@ INCLUDE "constants/menu_constants.asm"
INCLUDE "constants/wram_constants.asm"
INCLUDE "constants/sgb_constants.asm"
INCLUDE "constants/map_object_constants.asm"
INCLUDE "constants/main_menu_constants.asm"

View File

@ -0,0 +1,12 @@
const_def
const M_NEW_GAME
const M_CONTINUE
const M_PLAY_GAME
const M_SET_TIME
const_def
const CONTINUE
const NEW_GAME
const OPTION
const PLAY_POKEMON
const SET_TIME

View File

@ -3,26 +3,26 @@ INCLUDE "constants.asm"
SECTION "Debug Menu", ROMX[$4031], BANK[$01]
DebugMenu:: ; $4031
call ClearTileMap
call ClearWindowData
call LoadFont
call LoadFontsBattleExtra
call ClearSprites
call GetMemSGBLayout
xor a
ld [wWhichIndexSet], a
ld hl, DebugMenuData
call LoadMenuHeader
call OpenMenu
call CloseWindow
jp c, TitleSequenceStart
ld a, $41
ld [wce5f], a
ld a, [wMenuSelection]
ld hl, DebugJumpTable1
jp CallJumptable
call ClearTileMap
call ClearWindowData
call LoadFont
call LoadFontsBattleExtra
call ClearSprites
call GetMemSGBLayout
xor a
ld [wWhichIndexSet], a
ld hl, DebugMenuHeader
call LoadMenuHeader
call OpenMenu
call CloseWindow
jp c, TitleSequenceStart
ld a, $41
ld [wce5f], a
ld a, [wMenuSelection]
ld hl, DebugJumpTable
jp CallJumptable
DebugJumpTable1:: ; 4064
DebugJumpTable:: ; 4064
dw DebugMenuOptionFight
dw DebugMenuOptionField
dw Function094c ; sound test
@ -30,7 +30,7 @@ DebugJumpTable1:: ; 4064
dw DebugMenuOptionMonsterTest
dw DebugMenuOptionName
DebugMenuData: ; 4070
DebugMenuHeader: ; 4070
db MENU_BACKUP_TILES ; flags
menu_coords 05, 02, SCREEN_WIDTH - 7, SCREEN_HEIGHT - 1
dw .MenuData
@ -64,7 +64,7 @@ DebugMenuItems:
DebugMenuOptionField:: ; 40A8
ld hl, wDebugFlags
set DEBUG_FIELD_F, [hl] ; set debug mode
jp Function555C
jp StartNewGame
DebugMenuOptionFight:: ; 40B0
ld hl, wDebugFlags

View File

@ -1,8 +1,44 @@
INCLUDE "constants.asm"
SECTION "Main Menu Definition", ROMX[$5418], BANK[$01]
SECTION "Main Menu", ROMX[$53CC], BANK[$01]
MainMenuHeader:
MainMenu:: ; 01:53CC
ld hl, wd4a9
res 0, [hl]
call ClearTileMap
call GetMemSGBLayout
call LoadFontExtra
call LoadFont
call ClearWindowData
call Function5388
ld hl, wce60
bit 0, [hl]
jr nz, .setMenuContinue
xor a
jr .skip
.setMenuContinue
ld a, M_CONTINUE
.skip
ldh a, [hJoyState]
and D_DOWN | B_BUTTON | A_BUTTON
cp D_DOWN | B_BUTTON | A_BUTTON
jr nz, .setMenuPlay
ld a, M_SET_TIME
jr .triggerMenu
.setMenuPlay
ld a, M_PLAY_GAME
.triggerMenu
ld [wWhichIndexSet], a
ld hl, MainMenuHeader
call LoadMenuHeader
call OpenMenu
call CloseWindow
jp c, TitleSequenceStart
ld hl, MainMenuJumptable
ld a, [wMenuSelection]
jp CallJumptable
MainMenuHeader: ; 01:5418
db $40
menu_coords 0, 0, 13, 7
dw .MenuData
@ -23,17 +59,11 @@ MainMenuHeader:
db "じかんセット@"
MainMenuJumptable: ; 01:5457
dw $547c
dw $555c
dw MainMenuOptionContinue
dw StartNewGame
dw $5cf3
dw $555c
dw $5473
CONTINUE EQU 0
NEW_GAME EQU 1
OPTION EQU 2
PLAY_POKEMON EQU 3
SET_TIME EQU 4
dw StartNewGame
dw MainMenuOptionSetTime
MainMenuItems:
@ -62,3 +92,582 @@ PlayPokemonSetTimeMenu:
db OPTION
db SET_TIME
db -1
MainMenuOptionSetTime:: ; 5473
callab SetTime
ret
MainMenuOptionContinue:: ;547C
callab Function14624
call DisplayContinueGameInfo
.loop
call ClearJoypad
call GetJoypad
ldh a, [hJoyState]
bit A_BUTTON_F, a
jr nz, .escape
bit B_BUTTON_F, a
jp nz, MainMenu
jr .loop
.escape
call $5397 ; todo
call $53B0 ; todo
ld hl, wDebugFlags
res DEBUG_FIELD_F, [hl]
set 2, [hl]
set 3, [hl]
ldh a, [hJoyState]
bit SELECT_F, a
jr z, .skip
set 1, [hl]
.skip
call ClearBGPalettes
call ClearTileMap
ld c, $0A
call DelayFrames
jp OverworldStart ; todo
DisplayContinueGameInfo:: ; 54BF
xor a
ldh [hBGMapMode], a
hlcoord 4, 7
ld b, $08
ld c, $0D
call DrawTextBox
hlcoord 5, 9
ld de, PlayerInfoText
call PlaceString
hlcoord 13, 9
ld de, wPlayerName
call PlaceString
hlcoord 14, 11
call PrintNumBadges
hlcoord 13, 13
call PrintNumOwnedMons
hlcoord 12, 15
call PrintPlayTime
ld a, $01
ldh [hBGMapMode], a
ld c, $1E
call DelayFrames
ret
PrintNumBadges:: ;54FA
push hl
ld hl, wd163 ; badges?
ld b, $01
call CountSetBits
pop hl
ld de, wCountSetBitsResult
ld bc, $0102 ; flags and constants for this? 1 byte source, 2 digit display
jp PrintNumber
PrintNumOwnedMons:: ; 550D
push hl
ld hl, wPokedexOwned
ld b, $20 ; flag_array NUM_POKEMON?
call CountSetBits
pop hl
ld de, wCountSetBitsResult
ld bc, $0103 ; 1 byte, 3 digit
jp PrintNumber
PrintPlayTime:: ; 5520
ld de, hRTCHours
ld bc, $0103 ; 1 byte, 3 digit
call PrintNumber
ld [hl], ""
inc hl
ld de, hRTCMinutes
ld bc, $8102 ; PRINTNUM_LEADINGZEROS, 1 byte, 2 digit
jp PrintNumber
PlayerInfoText:
db "しゅじんこう"
next "もっているバッジ    こ"
next "#ずかん    ひき"
next "プレイじかん"
text_end
StartNewGame:: ; 555C
ld de, MUSIC_NONE
call PlayMusic
ld de, MUSIC_OAK_INTRO
call PlayMusic
call LoadFontExtra
xor a
ldh [hBGMapMode], a
callba Function52f9
call ClearTileMap
call ClearWindowData
xor a
ldh [hMapAnims], a
ld a, [wDebugFlags]
bit DEBUG_FIELD_F, a
jp z, DemoStart
call DebugSetUpPlayer ; todo - sets up debug stuff?
jp IntroCleanup ; todo - gives strter & does shrinkydink?
DemoStart:: ; 558D
ld de, $4BD4
ld bc, $1200
call Function5d27
call $5CF7 ; todo
ld hl, OakSpeechDemo ; todo
call PrintText
call RotateThreePalettesRight
call ClearTileMap
ld de, $4D10
ld bc, $1200
call Function5d27
call $5D0E ; todo
ld a, $D0 ; todo
ldh [rOBP0], a
call DemoSetUpPlayer ; todo
jp IntroCleanup ; todo
GameStart:: ; 55BB
ld de, $4BD4
ld bc, $1200
call Function5d27
call $5CF7
ld hl, OakSpeech1
call PrintText
call RotateThreePalettesRight
call ClearTileMap
ld a, $C8
ld [$CB5B], a
ld [$CD78], a
call GetMonHeader
ld hl, $C2F6
ld hl, $C2F6
call PrepMonFrontpic
call $5D0E
ld hl, OakSpeech2
call PrintText
ld a, $C8 ; this should be a constant methinks
call PlayCry
ld hl, OakSpeech3
call PrintText
call RotateThreePalettesRight
call ClearTileMap
ld de, $4D10
ld bc, $1200
call Function5d27
call $5D0E
ld hl, OakSpeech4
call PrintText
call $5B25
call RotateThreePalettesRight
call ClearTileMap
ld de, $4ab7
ld bc, $1200
call Function5d27
call $5CF7
ld hl, OakSpeech5
call PrintText
call $5BA9
call RotateThreePalettesRight
call ClearTileMap
ld de, $4BD4
ld bc, $1200
call Function5d27
call $5CF7
ld hl, OakSpeech6
call PrintText
ld a, $24
ld hl, $4000
call FarCall_hl
call Function04ac
call RotateThreePalettesRight
call ClearTileMap
ld de, $4D10
ld bc, $1200
call Function5d27
call RotateThreePalettesLeft
ld hl, OakSpeech7
call PrintText
ldh a, [hROMBank]
push af
ld a, $20
ld [wMusicFade], a
ld de, MUSIC_NONE
ld a, e
ld [wMusicFadeID], a
ld a, d
ld [$C1A8], a
ld de, $000B ; should be a constant - shrink noise?
call PlaySFX
pop af
call Bankswitch
ld c, $04
call DelayFrames
IntroCleanup:: ; 568E
ld de, $4743
ld bc, $0400
call $5D27
ld c, $04
call DelayFrames
ld de, $479D
ld bc, $0400
call $5D27
ld c, $14
call DelayFrames
ld hl, $C30A
ld b, $07
ld c, $07
call ClearBox
ld c, $14
call DelayFrames
call $5D5D
call LoadFontExtra
ld c, $32
call DelayFrames
call RotateThreePalettesRight
call ClearTileMap
call Function0502
ld a, $00
ld [wd638], a
ld [wd637], a
OverworldStart::
call SetUpGameEntry
ld hl, wDebugFlags
bit 2, [hl] ; ?
call z, Function15b5
ld hl, wd4a9
set 0, [hl]
jp Function2a85
SetUpGameEntry:: ; 56E8
ld a, $04
ld [wd65e], a
ld a, $F2
ldh [hMapEntryMethod], a
ld hl, wDebugFlags
bit 2, [hl] ; ?
ret nz
ld a, $F1
ldh [hMapEntryMethod], a
ld a, $00
ld [wDebugWarpSelection], a
ld hl, GameStartPlacement
ld de, wMapGroup
ld bc, $0008
call CopyBytes
ret
GameStartPlacement:: ; 570D
db $01 ; map group
db $09 ; map
dw $C633 ; screen anchor
db $04 ; metatile x
db $04 ; metatile y
db $00 ; in-metatile x
db $01 ; in-metatile y
DebugSetUpPlayer:: ; 5715
call $5B07
ld a, $0F
ld [wd15d], a
ld a, $42
ld [wd15e], a
ld a, $3F
ld [wd15f], a
ld a, $FF
ld [wd163], a
ld [wd164], a
call GiveRandomJohto
ld a, $03
call Function57eb
call FillTMs
ld de, DebugBagItems
call FillBagWithList
ld hl, wPokedexOwned
call DebugFillPokedex
ld hl, wPokedexSeen
call DebugFillPokedex
ld hl, wAnnonDex
ld [hl], $01
call $40FD
ret
DebugFillPokedex:: ; 5755
ld b, $1F
ld a, $FF
.loop
ld [hl+], a
dec b
jr nz, .loop
ld [hl], $07
ret
FillBagWithList:: ; 5760
ld hl, wNumBagItems
.loop
ld a, [de]
cp $FF
jr z, .yump
ld [wCurItem], a
inc de
ld a, [de]
inc de
ld [wItemQuantity], a
call AddItemToInventory
jr .loop
.yump
ret
DebugBagItems:: ; 5777
db ITEM_IMPORTANT_BAG, $01
db ITEM_BAG, $01
db ITEM_TM_HOLDER, $01
db ITEM_BALL_HOLDER, $01
db ITEM_BICYCLE, $01
db ITEM_MAIL, $06
db ITEM_ULTRA_BALL, $1E
db ITEM_POKE_BALL, $63
db ITEM_POTION, $1E
db ITEM_RARE_CANDY, $14
db ITEM_MOON_STONE, $63
db ITEM_FULL_HEAL, $63
db ITEM_PROTEIN, $63
db ITEM_QUICK_NEEDLE, $63
db ITEM_SNAKESKIN, $63
db ITEM_KINGS_ROCK, $63
db ITEM_FLEE_FEATHER, $63
db ITEM_FOCUS_ORB, $63
db ITEM_SHARP_SCYTHE, $63
db ITEM_DETECT_ORB, $63
db $FF
Function57A0 ; 57A0
and a
ret z
.loop
push af
call RandomOver246
ld b, $0A
call GivePokemon
pop af
dec a
jr nz, .loop
ret
GiveRandomJohto:: ; 57B0
.loop
call Random
and $03
jr z, .loop
dec a
ld b, a
add a, a
add a, b
add a, $98 ; maybe should be a constant - 152, aka the number of kanto pokes
ld b, $08
call GivePokemon
ld a, $8D
ld [wd6b3], a
ret
GiveKantoStarters:: ; 57C8
ld a, $03
ld b, $20
call GivePokemon
ld a, $06
ld b, $24
call GivePokemon
ld a, $09
ld b, $24
call GivePokemon
ret
GivePokemon:: ; 57DE
ld [wMonDexIndex], a
ld a, b
ld [wCurPartyLevel], a
ld a, $10
call Predef
ret
Function57eb ; 57EB
and a
ret z
.loop
push af
xor a
ld [wca44], a
call RandomOver246
ld [wcdd7], a
ld a, $05
ld [wCurPartyLevel], a
callab Function3e043
ld a, [wcdd7]
ld [wMonDexIndex], a
callab Functiondd5c
pop af
dec a
jr nz, .loop
ret
RandomOver246:: ; 5818
.loop
call Random
and a
jr z, .loop
cp $F6
jr nc, .loop
ret
FillTMs:: ; 5823
ld b, $39
ld a, $01
ld hl, wTMsHMs
.loop
ld [hl+], a
dec b
jr nz, .loop
ret
DebugGiveKeyItems:: ; 582F
ld hl, DebugKeyItemsList
ld de, wKeyItems
ld c, $FF
.loop
inc c
ld a, [hl+]
ld [de], a
inc de
cp $FF
jr nz, .loop
ld a, c
ld [wNumKeyItems], a
ret
DebugKeyItemsList:: ; 5844
db ITEM_TM_HOLDER
db ITEM_BALL_HOLDER
db ITEM_BAG
db ITEM_BICYCLE
db $FF
DemoSetUpPlayer:: ; 5849
ld hl, wPlayerName
ld de, DemoPlayerName
call CopyString
ld hl, wRivalName
ld de, DemoRivalName
call CopyString
call $40FD
ld de, DemoItemList
call FillBagWithList
call GiveRandomJohto
ret
DemoItemList:: ; 5868
db ITEM_POKE_BALL, $05
db ITEM_POTION, $0A
db ITEM_FULL_HEAL, $0A
db ITEM_STIMULUS_ORB, $01
db ITEM_FOCUS_ORB, $01
db $FF
DemoPlayerName:: ; 5873
db "サトシ@"
DemoRivalName:: ; 5877
db "シゲル@"
OakSpeechDemo:: ; 587B
text "ようこそ"
line "ポケット モンスターの せかいへ!"
cont "ごぞんじ わしが オーキドじゃ!"
para "きょう きみに きてもらったのは"
line "ほかでもない"
cont "あたらしい ずかんづくりを"
cont "てつだって ほしいのじゃ!"
para "もちろん"
line "きみの パートナーとなる ポケモンと"
cont "りュックは ようい しておる"
para "りュックの なかには"
line "キズぐすりと"
cont "モンスターボールが"
cont "はいっておるから あんしんじゃ!"
para "すでに きみの ライバルは"
line "しゅっぱつ しとる"
para "まけないよう がんばって くれい!"
prompt
OakSpeech1:: ; 5956
text "いやあ またせた!"
para "ポケット モンスターの せかいへ"
line "ようこそ!"
para "わたしの なまえは オーキド"
para "みんなからは # はかせと"
line "したわれて おるよ"
prompt
OakSpeech2:: ; 599F
text "きみも もちろん"
line "しっているとは おもうが"
para "この せかいには"
line "ポケット モンスターと よばれる"
cont "いきもの たちが"
cont "いたるところに すんでいる!"
prompt
OakSpeech3:: ; 59E8
text "その # という いきものを"
line "ひとは ぺットに したり"
cont "しょうぶに つかったり"
cont "そして・・・"
para "わたしは この #の"
line "けんきゅうを してる というわけだ"
prompt
OakSpeech4:: ; 5A35
text "では はじめに きみの なまえを"
line "おしえて もらおう!"
prompt
OakSpeech5:: ; 5A52
text "そして この しょうねんは"
line "きみの おさななじみであり"
cont"ライバルである"
para "・・・えーと?"
line "なまえは なんて いったかな?"
prompt
OakSpeech6:: ; 5A8F
text "さて きみの きねんすべき"
line "たびだちのひを"
cont "きろくしておこう!"
para "じかんも なるべく せいかくにな!"
prompt
OakSpeech7:: ; 5AC2
text "<PLAYER>"
para "いよいよ これから"
line "きみの ものがたりの はじまりだ!"
para "ゆめと ぼうけんと!"
line "ポケット モンスターの せかいへ!"
para "レッツ ゴー!"
done
; 5B07

View File

@ -78,7 +78,7 @@ WaitPressedAny:: ; 369a
CountSetBits:: ; 36b1
; Count the number of bits set in b bytes at hl.
; Return to a, c, and wce37.
; Return to a, c, and wCountSetBitsResult.
ld c, $0
.asm_36b3: ; 00:36b3
ld a, [hli]
@ -94,5 +94,5 @@ CountSetBits:: ; 36b1
dec b
jr nz, .asm_36b3
ld a, c
ld [wce37], a
ld [wCountSetBitsResult], a
ret

View File

@ -244,7 +244,7 @@ ENDM
PrintMomsName:: print_name wMomsName
PrintPlayerName:: print_name wPlayerName
PrintRivalName:: print_name wRivalsName
PrintRivalName:: print_name wRivalName
TrainerChar:: print_name TrainerCharText
TMChar:: print_name TMCharText

View File

@ -5,8 +5,8 @@
01:50B9 Function50b9
01:5190 _UpdateSprites
01:5190 Function5190
01:53CC MainMenu
01:555C Function555C
01:52F9 Function52f9
01:5388 Function5388
01:5D27 Function5d27
01:63D8 ReanchorBGMap_NoOAMUpdate
01:6437 LoadFonts_NoOAMUpdate
@ -84,6 +84,7 @@
05:457A Function1457a
05:45B8 Function145b8
05:45DE Function145de
05:4624 Function14624
05:46DC Function146dc
; Structure:
; byte Map group ($ff = end)
@ -123,6 +124,7 @@
0F:508C Function3d08c
0F:55CE Function3d5ce
0F:567C Function3d67c
0F:6043 Function3e043
0F:61A4 Function3e1a4
0F:6874 Function3e874
0F:691E Function3e91e
@ -423,6 +425,7 @@
36:73E8 MtFujiRoute_MapAttributes
36:7444 FontoRoute5_MapAttributes
36:7530 BullForestRoute3_MapAttributes
36:7AE4 SetTime
38:4000 PikachuMiniGame
39:4000 GameFreakIntro
39:432F OpeningCutscene
@ -448,10 +451,8 @@
3F:67A1 CallSubGameMenu
00:CB6F wPlayerStepDirection
00:CE67 wPlayerName
01:D19E wItems
01:D258 wRivalName
01:D264 wPlayerBikeSurfState
; The starting house's map script number is stored at d29a. Others are probably nearby.
01:D35F wOptions

View File

@ -184,8 +184,12 @@ wEnemyMonNickname:: ds 6 ; c9fc
wPlayerSubStatus3:: db ; ca3d
ds $4
wEnemySubStatus3:: db ; ca42
; ca43
ds $14
wca43:: db ; ca43
wca44:: db ; ca44
ds $12
wTrainerClass:: ; ca57
db
; ca58
@ -470,6 +474,8 @@ wPrevWarp:: db ; cdc1
ds 11
wLinkBattleRNs:: ds 10 ; cdcd
wcdd7:: db ; cdd7
; cddd
SECTION "CE00", WRAM0[$CE00]
@ -549,6 +555,7 @@ wce2e:: ; ce2e
SECTION "CE37", WRAM0[$CE37]
wNamedObjectIndexBuffer::
wCountSetBitsResult::
wce37:: ; ce37
db
@ -573,7 +580,8 @@ SECTION "CE5F", WRAM0[$CE5F]
wce5f:: ; ce5f ; debug menu writes $41 to it
db
SECTION "CE61", WRAM0[$CE61]
wce60:: ; ce60
db ; main menu checks this, maybe states if there's a save present?
wActiveFrame:: db ; ce61
@ -584,7 +592,9 @@ wDebugFlags:: db ; ce63
; |\- debug battle indicator
; \-- debug field indicator
SECTION "Mom's Name", WRAM0[$CE6D]
SECTION "Player And Mom Names", WRAM0[$CE67]
wPlayerName:: ds 6 ; ce67
wMomsName:: ds 6 ; ce6d
SECTION "CE7F", WRAM0[$CE76]
@ -672,7 +682,19 @@ wTimeOfDayPalset:: db ; d158
wCurTimeOfDay:: db ; d159
SECTION "D165", WRAM0[$D165]
SECTION "D15D", WRAM0[$D15D]
wd15d:: db ; d15d
wd15e:: db ; d15e
wd15f:: db ; d15f
SECTION "D163", WRAM0[$D163]
wd163:: db ; d163
wd164:: db ; d164
wTMsHMs:: db ; d165
@ -691,7 +713,7 @@ wNumBallItems:: db ; d1de
wBallQuantities:: db ; d1df
SECTION "Rival's Name", WRAM0[$D258]
wRivalsName:: ds 6 ; d258
wRivalName:: ds 6 ; d258
SECTION "D4AB", WRAM0[$D4A9]
@ -763,7 +785,7 @@ wXCoord:: db ; d65b
wMetatileStandingY:: db ; d65c
wMetatileStandingX:: db ; d65d
; d65f
wd65e:: ; d65e
ds 1 ; TODO
wMapPartial:: ; d65f
@ -812,6 +834,9 @@ wTilesetCollisionAddress:: ; d6a4
ds 4 ; TODO
wTilesetEnd:: ; d6aa
SECTION "D6B3", WRAM0[$D6B3]
wd6b3 :: db ; d6b3
SECTION "PokeDexFlags", WRAM0[$D81A]
@ -827,7 +852,7 @@ wAnnonDex:: ds 26 ; d85a
wAnnonID:: ds 1 ; d874
SECTION "Wild mon buffer", WRAM0[$D91B]
wWildMons:: ; d91b