diff options
Diffstat (limited to 'engine/menus')
-rw-r--r-- | engine/menus/debug.asm | 188 | ||||
-rw-r--r-- | engine/menus/delete_save.asm | 8 | ||||
-rw-r--r-- | engine/menus/empty_sram.asm | 4 | ||||
-rw-r--r-- | engine/menus/init_gender.asm | 28 | ||||
-rw-r--r-- | engine/menus/intro_menu.asm | 232 | ||||
-rw-r--r-- | engine/menus/main_menu.asm | 82 | ||||
-rw-r--r-- | engine/menus/menu.asm | 104 | ||||
-rw-r--r-- | engine/menus/menu_2.asm | 50 | ||||
-rw-r--r-- | engine/menus/naming_screen.asm | 219 | ||||
-rw-r--r-- | engine/menus/options_menu.asm | 97 | ||||
-rw-r--r-- | engine/menus/save.asm | 222 | ||||
-rw-r--r-- | engine/menus/savemenu_copytilemapatonce.asm | 4 | ||||
-rw-r--r-- | engine/menus/scrolling_menu.asm | 72 | ||||
-rw-r--r-- | engine/menus/start_menu.asm | 320 | ||||
-rw-r--r-- | engine/menus/trainer_card.asm | 72 |
15 files changed, 566 insertions, 1136 deletions
diff --git a/engine/menus/debug.asm b/engine/menus/debug.asm index d148af542..a48322488 100644 --- a/engine/menus/debug.asm +++ b/engine/menus/debug.asm @@ -22,7 +22,7 @@ const DEBUGTEST_E ; $7e const DEBUGTEST_F ; $7f -ColorTest: ; 818ac +ColorTest: ; A debug menu to test monster and trainer palettes at runtime. ld a, [hCGB] @@ -62,15 +62,14 @@ ColorTest: ; 818ac pop af ld [hInMenu], a ret -; 818f4 -Function818f4: ; 818f4 +Function818f4: ld a, [wd002] and a jr nz, Function81911 ld hl, PokemonPalettes -Function818fd: ; 818fd +Function818fd: ld de, wOverworldMapBlocks ld c, NUM_POKEMON + 1 .asm_81902 @@ -85,7 +84,7 @@ Function818fd: ; 818fd jr nz, .asm_81902 ret -Function81911: ; 81911 +Function81911: ld hl, TrainerPalettes ld de, wOverworldMapBlocks ld c, NUM_TRAINER_CLASSES @@ -100,9 +99,8 @@ Function81911: ; 81911 dec c jr nz, .asm_81919 ret -; 81928 -Function81928: ; 81928 +Function81928: ld a, BANK(PokemonPalettes) ; BANK(TrainerPalettes) call GetFarByte ld [de], a @@ -123,9 +121,8 @@ Function81928: ; 81928 ld [de], a inc de ret -; 81948 -Function81948: ; 81948 +Function81948: ld a, $1 ld [rVBK], a ld hl, vTiles0 @@ -148,9 +145,8 @@ Function81948: ; 81948 call ByteFill call ClearSprites ret -; 8197c -Function8197c: ; 8197c +Function8197c: ld hl, DebugColorTestGFX + 1 tiles ld de, vTiles2 tile DEBUGTEST_UP_ARROW ld bc, 22 tiles @@ -171,9 +167,8 @@ Function8197c: ; 8197c or b jr nz, .asm_8199d ret -; 819a7 -Function819a7: ; 819a7 +Function819a7: ld a, [hCGB] and a ret z @@ -214,16 +209,14 @@ Function819a7: ; 819a7 pop af ld [rSVBK], a ret -; 819f4 -Palette_DebugBG: ; 819f4 +Palette_DebugBG: INCLUDE "gfx/debug/bg.pal" -Palette_DebugOB: ; 81a34 +Palette_DebugOB: INCLUDE "gfx/debug/ob.pal" -; 81a74 -Function81a74: ; 81a74 +Function81a74: call JoyTextDelay ld a, [wJumptableIndex] cp $4 @@ -273,9 +266,8 @@ Function81a74: ; 81a74 ld a, $0 ld [wJumptableIndex], a ret -; 81ac3 -Function81ac3: ; 81ac3 +Function81ac3: ; Looping back around the pic set. ld a, [wd002] and a @@ -286,18 +278,16 @@ Function81ac3: ; 81ac3 .asm_81acc ld a, NUM_TRAINER_CLASSES - 1 ; MYSTICALMAN ret -; 81acf -Jumptable_81acf: ; 81acf +Jumptable_81acf: dw Function81adb dw Function81c18 dw Function81c33 dw Function81cc2 dw Function81d8e dw Function81daf -; 81adb -Function81adb: ; 81adb +Function81adb: xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -382,14 +372,12 @@ Function81adb: ; 81adb ld a, $1 ld [wJumptableIndex], a ret -; 81baf String_81baf: db "レア", DEBUGTEST_BLACK, DEBUGTEST_BLACK, "@" ; rare (shiny) String_81bb4: db "ノーマル@" ; normal String_81bb9: db DEBUGTEST_A, "きりかえ▶@" ; (A) switches -; 81bc0 -Function81bc0: ; 81bc0 +Function81bc0: decoord 0, 11, wAttrMap hlcoord 2, 11 ld a, $1 @@ -402,7 +390,7 @@ Function81bc0: ; 81bc0 hlcoord 2, 15 ld a, $3 -Function81bde: ; 81bde +Function81bde: push af ld a, DEBUGTEST_UP_ARROW ld [hli], a @@ -415,9 +403,8 @@ Function81bde: ; 81bde ld bc, $28 call ByteFill ret -; 81bf4 -Function81bf4: ; 81bf4 +Function81bf4: ld a, [wcf66] inc a ld l, a @@ -435,9 +422,8 @@ Function81bf4: ; 81bf4 ld de, wc608 call Function81ea5 ret -; 81c18 -Function81c18: ; 81c18 +Function81c18: ld a, [hCGB] and a jr z, .asm_81c2a @@ -452,9 +438,8 @@ Function81c18: ; 81c18 ld a, $2 ld [wJumptableIndex], a ret -; 81c33 -Function81c33: ; 81c33 +Function81c33: ld a, [hCGB] and a jr z, .asm_81c69 @@ -511,9 +496,8 @@ Function81c33: ; 81c33 ld a, $3 ld [wJumptableIndex], a ret -; 81ca7 -Function81ca7: ; 81ca7 +Function81ca7: inc hl inc hl inc hl @@ -528,14 +512,13 @@ Function81ca7: ; 81ca7 ld a, [de] swap a -Function81cbc: ; 81cbc +Function81cbc: and $f add DEBUGTEST_0 ld [hld], a ret -; 81cc2 -Function81cc2: ; 81cc2 +Function81cc2: ld a, [hJoyLast] and B_BUTTON jr nz, .asm_81cdf @@ -574,16 +557,14 @@ Function81cc2: ; 81cc2 ld a, $0 ld [wJumptableIndex], a ret -; 81d02 -Jumptable_81d02: ; 81d02 +Jumptable_81d02: dw Function81d0a dw Function81d34 dw Function81d46 dw Function81d58 -; 81d0a -Function81d0a: ; 81d0a +Function81d0a: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -610,7 +591,7 @@ Function81d0a: ; 81d0a call Function81ea5 ret -Function81d34: ; 81d34 +Function81d34: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -621,7 +602,7 @@ Function81d34: ; 81d34 ld hl, wc608 + 10 jr Function81d63 -Function81d46: ; 81d46 +Function81d46: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -632,14 +613,14 @@ Function81d46: ; 81d46 ld hl, wc608 + 11 jr Function81d63 -Function81d58: ; 81d58 +Function81d58: ld hl, hJoyLast ld a, [hl] and D_UP jr nz, Function81d84 ld hl, wc608 + 12 -Function81d63: ; 81d63 +Function81d63: ld a, [hJoyLast] and D_RIGHT jr nz, Function81d70 @@ -648,37 +629,36 @@ Function81d63: ; 81d63 jr nz, Function81d77 ret -Function81d70: ; 81d70 +Function81d70: ld a, [hl] cp $1f ret nc inc [hl] jr Function81d7b -Function81d77: ; 81d77 +Function81d77: ld a, [hl] and a ret z dec [hl] -Function81d7b: ; 81d7b +Function81d7b: call Function81e67 ld a, $2 ld [wJumptableIndex], a ret -Function81d84: ; 81d84 +Function81d84: ld hl, wcf64 dec [hl] ret -Function81d89: ; 81d89 +Function81d89: ld hl, wcf64 inc [hl] ret -; 81d8e -Function81d8e: ; 81d8e +Function81d8e: hlcoord 0, 10 ld bc, $a0 ld a, DEBUGTEST_BLACK @@ -692,9 +672,8 @@ Function81d8e: ; 81d8e ld a, $5 ld [wJumptableIndex], a ret -; 81daf -Function81daf: ; 81daf +Function81daf: ld hl, hJoyPressed ld a, [hl] and B_BUTTON @@ -706,15 +685,13 @@ Function81daf: ; 81daf ld a, $0 ld [wJumptableIndex], a ret -; 81dc1 -Function81dc1: ; 81dc1 +Function81dc1: ld hl, wJumptableIndex set 7, [hl] ret -; 81dc7 -Function81dc7: ; 81dc7 +Function81dc7: ld hl, hJoyLast ld a, [hl] and D_UP @@ -749,9 +726,8 @@ Function81dc7: ; 81dc7 ld [wd004], a call Function81df4 ret -; 81df4 -Function81df4: ; 81df4 +Function81df4: hlcoord 10, 11 call Function81e5e hlcoord 10, 12 @@ -783,13 +759,11 @@ Function81df4: ; 81df4 hlcoord 10, 14 call PlaceString ret -; 81e46 String_81e46: db "おぼえられる@" ; can be taught String_81e4d: db "おぼえられない@" ; cannot be taught -; 81e55 -Function81e55: ; 81e55 +Function81e55: cp $32 jr c, .asm_81e5b inc a @@ -798,16 +772,14 @@ Function81e55: ; 81e55 .asm_81e5b add $bf ret -; 81e5e -Function81e5e: ; 81e5e +Function81e5e: ld bc, 10 ld a, DEBUGTEST_BLACK call ByteFill ret -; 81e67 -Function81e67: ; 81e67 +Function81e67: ld a, [wc608 + 10] and $1f ld e, a @@ -843,9 +815,8 @@ Function81e67: ; 81e67 ld a, d ld [wc608 + 1], a ret -; 81ea5 -Function81ea5: ; 81ea5 +Function81ea5: ld a, [de] and $1f ld [wc608 + 10], a @@ -867,9 +838,8 @@ Function81ea5: ; 81ea5 srl a ld [wc608 + 12], a ret -; 81eca -Function81eca: ; 81eca +Function81eca: ld a, [wcf66] inc a ld l, a @@ -884,9 +854,8 @@ Function81eca: ; 81eca ld bc, 4 call CopyBytes ret -; 81ee3 -Function81ee3: ; 81ee3 +Function81ee3: .asm_81ee3 ld a, LOW(PALRGB_WHITE) ld [hli], a @@ -910,9 +879,8 @@ Function81ee3: ; 81ee3 dec c jr nz, .asm_81ee3 ret -; 81efc -Bank20_FillBoxWithByte: ; 81efc +Bank20_FillBoxWithByte: ; For some reason, we have another copy of FillBoxWithByte here .row push bc @@ -928,9 +896,8 @@ Bank20_FillBoxWithByte: ; 81efc dec b jr nz, .row ret -; 81f0c -Function81f0c: ; 81f0c +Function81f0c: ld a, [wcfbe] push af set 7, a @@ -939,9 +906,8 @@ Function81f0c: ; 81f0c pop af ld [wcfbe], a ret -; 81f1d -Function81f1d: ; 81f1d +Function81f1d: ld a, [hl] and $7 ret z @@ -989,9 +955,8 @@ Function81f1d: ; 81f1d dec b jr nz, .asm_81f22 ret -; 81f5e -Function81f5e: ; 81f5e +Function81f5e: ld a, DEBUGTEST_BLACK hlcoord 10, 0 ld [hl], a @@ -1059,19 +1024,16 @@ Function81f5e: ; 81f5e .asm_81fc9 call ClearSprites ret -; 81fcd -String_81fcd: ; 81fcd +String_81fcd: db "おわりますか?" ; Are you finished? next "はい<DOT><DOT><DOT>", DEBUGTEST_A ; YES...(A) next "いいえ<DOT><DOT>", DEBUGTEST_B ; NO..(B) db "@" -; 81fe3 DebugColorTestGFX: INCBIN "gfx/debug/color_test.2bpp" - TilesetColorTest: ret xor a @@ -1122,17 +1084,16 @@ TilesetColorTest: ld a, $40 ld [hWY], a ret -; 821d2 -Function821d2: ; 821d2 +Function821d2: hlcoord 0, 0 call Function821de -Function821d8: ; 821d8 +Function821d8: ld a, [wcf64] hlcoord 0, 0, wAttrMap -Function821de: ; 821de +Function821de: add hl, de rept 4 ld [hli], a @@ -1148,25 +1109,23 @@ rept 4 ld [hli], a endr ret -; 821f4 -Function821f4: ; 821f4 +Function821f4: hlcoord 2, 4 call Function82203 hlcoord 2, 6 call Function82203 hlcoord 2, 8 -Function82203: ; 82203 +Function82203: ld a, DEBUGTEST_UP_ARROW ld [hli], a ld bc, $10 - 1 ld a, DEBUGTEST_TICKS call ByteFill ret -; 8220f -Function8220f: ; 8220f +Function8220f: ld a, [rSVBK] push af ld a, BANK(wBGPals1) @@ -1187,10 +1146,8 @@ Function8220f: ; 8220f pop af ld [rSVBK], a ret -; 82236 - -Function82236: ; 82236 +Function82236: ld hl, hJoyLast ld a, [hl] and SELECT @@ -1247,9 +1204,8 @@ Function82236: ; 82236 xor $d0 ld [hWY], a ret -; 822a3 -Function822a3: ; 822a3 +Function822a3: ld a, [rSVBK] push af ld a, BANK(wBGPals2) @@ -1281,9 +1237,8 @@ Function822a3: ; 822a3 ld [hCGBPalUpdate], a call DelayFrame ret -; 822f0 -Function822f0: ; 822f0 +Function822f0: ld a, [wcf65] and 3 ld e, a @@ -1295,16 +1250,14 @@ Function822f0: ; 822f0 ld h, [hl] ld l, a jp hl -; 82301 -.dw ; 82301 +.dw dw Function82309 dw Function82339 dw Function8234b dw Function8235d -; 82309 -Function82309: ; 82309 +Function82309: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -1339,7 +1292,7 @@ Function82309: ; 82309 call Function81ea5 ret -Function82339: ; 82338 +Function82339: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -1350,7 +1303,7 @@ Function82339: ; 82338 ld hl, wc608 + 10 jr Function82368 -Function8234b: ; 8234b +Function8234b: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -1361,14 +1314,14 @@ Function8234b: ; 8234b ld hl, wc608 + 11 jr Function82368 -Function8235d: ; 8235d +Function8235d: ld hl, hJoyLast ld a, [hl] and D_UP jr nz, Function82387 ld hl, wc608 + 12 -Function82368: ; 82368 +Function82368: ld a, [hJoyLast] and D_RIGHT jr nz, .asm_82375 @@ -1395,18 +1348,17 @@ Function82368: ; 82368 call Function822a3 ret -Function82387: ; 82387 +Function82387: ld hl, wcf65 dec [hl] ret -Function8238c: ; 8238c +Function8238c: ld hl, wcf65 inc [hl] ret -; 82391 -Function82391: ; 82391 +Function82391: ld a, [wc608 + 10] and $1f ld e, a @@ -1437,11 +1389,9 @@ Function82391: ; 82391 ld [hli], a ld [hl], d ret -; 823c6 -Function823c6: ; 823c6 +Function823c6: ret -Function823c7: ; 823c7 +Function823c7: ret -; 823c8 diff --git a/engine/menus/delete_save.asm b/engine/menus/delete_save.asm index a86faf06a..8be78e979 100644 --- a/engine/menus/delete_save.asm +++ b/engine/menus/delete_save.asm @@ -1,4 +1,4 @@ -_DeleteSaveData: ; 4d54c +_DeleteSaveData: farcall BlankScreen ld b, SCGB_DIPLOMA call GetSGBLayout @@ -18,18 +18,18 @@ _DeleteSaveData: ; 4d54c farcall EmptyAllSRAMBanks ret -.Text_ClearAllSaveData: ; 0x4d580 +.Text_ClearAllSaveData: ; Clear all save data? text_jump UnknownText_0x1c564a db "@" -.NoYesMenuHeader: ; 0x4d585 +.NoYesMenuHeader: db 0 ; flags menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -.MenuData: ; 0x4d58d +.MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "NO@" diff --git a/engine/menus/empty_sram.asm b/engine/menus/empty_sram.asm index 8b060f3ef..45a4a8884 100644 --- a/engine/menus/empty_sram.asm +++ b/engine/menus/empty_sram.asm @@ -1,4 +1,4 @@ -EmptyAllSRAMBanks: ; 4cf1f +EmptyAllSRAMBanks: ld a, 0 call .EmptyBank ld a, 1 @@ -9,7 +9,7 @@ EmptyAllSRAMBanks: ; 4cf1f call .EmptyBank ret -.EmptyBank: ; 4cf34 +.EmptyBank: call GetSRAMBank ld hl, SRAM_Begin ld bc, SRAM_End - SRAM_Begin diff --git a/engine/menus/init_gender.asm b/engine/menus/init_gender.asm index 8fd95bc85..21871d0ab 100644 --- a/engine/menus/init_gender.asm +++ b/engine/menus/init_gender.asm @@ -1,4 +1,4 @@ -InitCrystalData: ; 48000 +InitCrystalData: ld a, $1 ld [wd474], a xor a @@ -18,11 +18,10 @@ InitCrystalData: ; 48000 res 1, a ld [wd479], a ret -; 4802f INCLUDE "mobile/mobile_12.asm" -InitGender: ; 48dcb (12:4dcb) +InitGender: call InitGenderScreen call LoadGenderScreenPal call LoadGenderScreenLightBlueTile @@ -41,29 +40,25 @@ InitGender: ; 48dcb (12:4dcb) ld c, 10 call DelayFrames ret -; 48dfc (12:4dfc) -.MenuHeader: ; 0x48dfc +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 4, 12, 9 dw .MenuData db 1 ; default option -; 0x48e04 -.MenuData: ; 0x48e04 +.MenuData: db STATICMENU_CURSOR | STATICMENU_WRAP | STATICMENU_DISABLE_B ; flags db 2 ; items db "Boy@" db "Girl@" -; 0x48e0f -TextJump_AreYouABoyOrAreYouAGirl: ; 0x48e0f +TextJump_AreYouABoyOrAreYouAGirl: ; Are you a boy? Or are you a girl? text_jump Text_AreYouABoyOrAreYouAGirl db "@" -; 0x48e14 -InitGenderScreen: ; 48e14 (12:4e14) +InitGenderScreen: ld a, $10 ld [wMusicFade], a ld a, MUSIC_NONE @@ -85,7 +80,7 @@ InitGenderScreen: ; 48e14 (12:4e14) call ByteFill ret -LoadGenderScreenPal: ; 48e47 (12:4e47) +LoadGenderScreenPal: ld hl, .Palette ld de, wBGPals1 ld bc, 1 palettes @@ -93,19 +88,16 @@ LoadGenderScreenPal: ; 48e47 (12:4e47) call FarCopyWRAM farcall ApplyPals ret -; 48e5c (12:4e5c) -.Palette: ; 48e5c +.Palette: INCLUDE "gfx/new_game/gender_screen.pal" -; 48e64 -LoadGenderScreenLightBlueTile: ; 48e64 (12:4e64) +LoadGenderScreenLightBlueTile: ld de, .LightBlueTile ld hl, vTiles2 tile $00 lb bc, BANK(.LightBlueTile), 1 call Get2bpp ret -; 48e71 (12:4e71) -.LightBlueTile: ; 48e71 +.LightBlueTile: INCBIN "gfx/new_game/gender_screen.2bpp" diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index af6e0c09e..9652dd73e 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -1,4 +1,4 @@ -_MainMenu: ; 5ae8 +_MainMenu: ld de, MUSIC_NONE call PlayMusic call DelayFrame @@ -8,13 +8,11 @@ _MainMenu: ; 5ae8 call PlayMusic farcall MainMenu jp StartTitleScreen -; 5b04 ; unused ret -; 5b05 -PrintDayOfWeek: ; 5b05 +PrintDayOfWeek: push de ld hl, .Days ld a, b @@ -28,9 +26,8 @@ PrintDayOfWeek: ; 5b05 ld de, .Day call PlaceString ret -; 5b1c -.Days: ; 5b1c +.Days: db "SUN@" db "MON@" db "TUES@" @@ -38,13 +35,11 @@ PrintDayOfWeek: ; 5b05 db "THURS@" db "FRI@" db "SATUR@" -; 5b40 -.Day: ; 5b40 +.Day: db "DAY@" -; 5b44 -NewGame_ClearTileMapEtc: ; 5b44 +NewGame_ClearTileMapEtc: xor a ld [hMapAnims], a call ClearTileMap @@ -52,21 +47,18 @@ NewGame_ClearTileMapEtc: ; 5b44 call LoadStandardFont call ClearWindowData ret -; 5b54 -MysteryGift: ; 5b54 +MysteryGift: call UpdateTime farcall DoMysteryGiftIfDayHasPassed farcall DoMysteryGift ret -; 5b64 -OptionsMenu: ; 5b64 +OptionsMenu: farcall _OptionsMenu ret -; 5b6b -NewGame: ; 5b6b +NewGame: xor a ld [wMonStatusFlags], a call ResetWRAM @@ -83,9 +75,8 @@ NewGame: ; 5b6b ld a, MAPSETUP_WARP ld [hMapEntryMethod], a jp FinishContinueFunction -; 5b8f -AreYouABoyOrAreYouAGirl: ; 5b8f +AreYouABoyOrAreYouAGirl: farcall Mobile_AlwaysReturnNotCarry ; some mobile stuff jr c, .ok farcall InitGender @@ -95,17 +86,14 @@ AreYouABoyOrAreYouAGirl: ; 5b8f ld c, 0 farcall InitMobileProfile ; mobile ret -; 5ba7 -ResetWRAM: ; 5ba7 +ResetWRAM: xor a ld [hBGMapMode], a call _ResetWRAM ret -; 5bae - -_ResetWRAM: ; 5bae +_ResetWRAM: ld hl, wVirtualOAM ld bc, wOptions - wVirtualOAM xor a @@ -228,18 +216,16 @@ endc call ResetGameTime ret -; 5ca1 -.InitList: ; 5ca1 +.InitList: ; Loads 0 in the count and -1 in the first item or mon slot. xor a ld [hli], a dec a ld [hl], a ret -; 5ca6 -SetDefaultBoxNames: ; 5ca6 +SetDefaultBoxNames: ld hl, wBoxNames ld c, 0 .loop @@ -270,9 +256,8 @@ SetDefaultBoxNames: ; 5ca6 .Box: db "BOX@" -; 5cd3 -InitializeMagikarpHouse: ; 5cd3 +InitializeMagikarpHouse: ld hl, wBestMagikarpLengthFeet ld a, $3 ld [hli], a @@ -281,13 +266,11 @@ InitializeMagikarpHouse: ; 5cd3 ld de, .Ralph call CopyName2 ret -; 5ce3 -.Ralph: ; 5ce3 +.Ralph: db "RALPH@" -; 5ce9 -InitializeNPCNames: ; 5ce9 +InitializeNPCNames: ld hl, .Rival ld de, wRivalName call .Copy @@ -312,16 +295,14 @@ InitializeNPCNames: ; 5ce9 .Red: db "RED@" .Green: db "GREEN@" .Mom: db "MOM@" -; 5d23 -InitializeWorld: ; 5d23 +InitializeWorld: call ShrinkPlayer farcall SpawnPlayer farcall _InitializeStartDay ret -; 5d33 -LoadOrRegenerateLuckyIDNumber: ; 5d33 +LoadOrRegenerateLuckyIDNumber: ld a, BANK(sLuckyIDNumber) call GetSRAMBank ld a, [wCurDay] @@ -346,9 +327,8 @@ LoadOrRegenerateLuckyIDNumber: ; 5d33 ld [wLuckyIDNumber + 1], a ld [sLuckyIDNumber + 1], a jp CloseSRAM -; 5d65 -Continue: ; 5d65 +Continue: farcall TryLoadSaveFile jr c, .FailToLoad farcall _LoadData @@ -400,22 +380,19 @@ Continue: ; 5d65 ld [wDefaultSpawnpoint], a call PostCreditsSpawn jp FinishContinueFunction -; 5de2 -SpawnAfterRed: ; 5de2 +SpawnAfterRed: ld a, SPAWN_MT_SILVER ld [wDefaultSpawnpoint], a -; 5de7 -PostCreditsSpawn: ; 5de7 +PostCreditsSpawn: xor a ld [wSpawnAfterChampion], a ld a, MAPSETUP_WARP ld [hMapEntryMethod], a ret -; 5df0 -Continue_MobileAdapterMenu: ; 5df0 +Continue_MobileAdapterMenu: farcall Mobile_AlwaysReturnNotCarry ; mobile check ret nc @@ -444,9 +421,8 @@ Continue_MobileAdapterMenu: ; 5df0 ld c, 35 call DelayFrames ret -; 5e34 -ConfirmContinue: ; 5e34 +ConfirmContinue: .loop call DelayFrame call GetJoypad @@ -460,9 +436,8 @@ ConfirmContinue: ; 5e34 .PressA: ret -; 5e48 -Continue_CheckRTC_RestartClock: ; 5e48 +Continue_CheckRTC_RestartClock: call CheckRTCStatus and %10000000 ; Day count exceeded 16383 jr z, .pass @@ -476,9 +451,8 @@ Continue_CheckRTC_RestartClock: ; 5e48 .pass xor a ret -; 5e5d -FinishContinueFunction: ; 5e5d +FinishContinueFunction: .loop xor a ld [wDontPlayMapMusicOnReload], a @@ -497,9 +471,8 @@ FinishContinueFunction: ; 5e5d .AfterRed: call SpawnAfterRed jr .loop -; 5e85 -DisplaySaveInfoOnContinue: ; 5e85 +DisplaySaveInfoOnContinue: call CheckRTCStatus and %10000000 jr z, .clock_ok @@ -511,32 +484,28 @@ DisplaySaveInfoOnContinue: ; 5e85 lb de, 4, 8 call DisplayNormalContinueData ret -; 5e9a -DisplaySaveInfoOnSave: ; 5e9a +DisplaySaveInfoOnSave: lb de, 4, 0 jr DisplayNormalContinueData -; 5e9f -DisplayNormalContinueData: ; 5e9f +DisplayNormalContinueData: call Continue_LoadMenuHeader call Continue_DisplayBadgesDexPlayerName call Continue_PrintGameTime call LoadFontsExtra call UpdateSprites ret -; 5eaf -DisplayContinueDataWithRTCError: ; 5eaf +DisplayContinueDataWithRTCError: call Continue_LoadMenuHeader call Continue_DisplayBadgesDexPlayerName call Continue_UnknownGameTime call LoadFontsExtra call UpdateSprites ret -; 5ebf -Continue_LoadMenuHeader: ; 5ebf +Continue_LoadMenuHeader: xor a ld [hBGMapMode], a ld hl, .MenuHeader_Dex @@ -550,42 +519,36 @@ Continue_LoadMenuHeader: ; 5ebf call MenuBox call PlaceVerticalMenuItems ret -; 5ed9 -.MenuHeader_Dex: ; 5ed9 +.MenuHeader_Dex: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 15, 9 dw .MenuData_Dex db 1 ; default option -; 5ee1 -.MenuData_Dex: ; 5ee1 +.MenuData_Dex: db 0 ; flags db 4 ; items db "PLAYER@" db "BADGES@" db "#DEX@" db "TIME@" -; 5efb -.MenuHeader_NoDex: ; 5efb +.MenuHeader_NoDex: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 15, 9 dw .MenuData_NoDex db 1 ; default option -; 5f03 -.MenuData_NoDex: ; 5f03 +.MenuData_NoDex: db 0 ; flags db 4 ; items db "PLAYER <PLAYER>@" db "BADGES@" db " @" db "TIME@" -; 5f1c - -Continue_DisplayBadgesDexPlayerName: ; 5f1c +Continue_DisplayBadgesDexPlayerName: call MenuBoxCoord2Tile push hl decoord 13, 4, 0 @@ -607,16 +570,14 @@ Continue_DisplayBadgesDexPlayerName: ; 5f1c .Player: db "<PLAYER>@" -; 5f40 -Continue_PrintGameTime: ; 5f40 +Continue_PrintGameTime: decoord 9, 8, 0 add hl, de call Continue_DisplayGameTime ret -; 5f48 -Continue_UnknownGameTime: ; 5f48 +Continue_UnknownGameTime: decoord 9, 8, 0 add hl, de ld de, .three_question_marks @@ -625,9 +586,8 @@ Continue_UnknownGameTime: ; 5f48 .three_question_marks db " ???@" -; 5f58 -Continue_DisplayBadgeCount: ; 5f58 +Continue_DisplayBadgeCount: push hl ld hl, wJohtoBadges ld b, 2 @@ -636,9 +596,8 @@ Continue_DisplayBadgeCount: ; 5f58 ld de, wd265 lb bc, 1, 2 jp PrintNum -; 5f6b -Continue_DisplayPokedexNumCaught: ; 5f6b +Continue_DisplayPokedexNumCaught: ld a, [wStatusFlags] bit STATUSFLAGS_POKEDEX_F, a ret z @@ -654,9 +613,8 @@ endc ld de, wd265 lb bc, 1, 3 jp PrintNum -; 5f84 -Continue_DisplayGameTime: ; 5f84 +Continue_DisplayGameTime: ld de, wGameTimeHours lb bc, 2, 3 call PrintNum @@ -665,10 +623,8 @@ Continue_DisplayGameTime: ; 5f84 ld de, wGameTimeMinutes lb bc, PRINTNUM_LEADINGZEROS | 1, 2 jp PrintNum -; 5f99 - -OakSpeech: ; 0x5f99 +OakSpeech: farcall InitClock call RotateFourPalettesLeft call ClearTileMap @@ -746,11 +702,11 @@ OakSpeech: ; 0x5f99 call PrintText ret -OakText1: ; 0x6045 +OakText1: text_jump _OakText1 db "@" -OakText2: ; 0x604a +OakText2: text_jump _OakText2 start_asm ld a, WOOPER @@ -759,27 +715,27 @@ OakText2: ; 0x604a ld hl, OakText3 ret -OakText3: ; 0x605b +OakText3: text_jump _OakText3 db "@" -OakText4: ; 0x6060 +OakText4: text_jump _OakText4 db "@" -OakText5: ; 0x6065 +OakText5: text_jump _OakText5 db "@" -OakText6: ; 0x606a +OakText6: text_jump _OakText6 db "@" -OakText7: ; 0x606f +OakText7: text_jump _OakText7 db "@" -NamePlayer: ; 0x6074 +NamePlayer: farcall MovePlayerPicRight farcall ShowPlayerNamingChoices ld a, [wMenuCursorY] @@ -823,7 +779,6 @@ NamePlayer: ; 0x6074 db "CHRIS@@@@@@" .Kris: db "KRIS@@@@@@@" -; 60e9 Unreferenced_Function60e9: call LoadMenuHeader @@ -833,9 +788,8 @@ Unreferenced_Function60e9: call CopyNameFromMenu call CloseWindow ret -; 60fa -StorePlayerName: ; 60fa +StorePlayerName: ld a, "@" ld bc, NAME_LENGTH ld hl, wPlayerName @@ -844,10 +798,8 @@ StorePlayerName: ; 60fa ld de, wStringBuffer2 call CopyName2 ret -; 610f - -ShrinkPlayer: ; 610f +ShrinkPlayer: ld a, [hROMBank] push af @@ -898,9 +850,8 @@ ShrinkPlayer: ; 610f call RotateThreePalettesRight call ClearTileMap ret -; 616a -Intro_RotatePalettesLeftFrontpic: ; 616a +Intro_RotatePalettesLeftFrontpic: ld hl, IntroFadePalettes ld b, IntroFadePalettes.End - IntroFadePalettes .loop @@ -911,9 +862,8 @@ Intro_RotatePalettesLeftFrontpic: ; 616a dec b jr nz, .loop ret -; 617c -IntroFadePalettes: ; 0x617c +IntroFadePalettes: db %01010100 db %10101000 db %11111100 @@ -921,9 +871,8 @@ IntroFadePalettes: ; 0x617c db %11110100 db %11100100 .End -; 6182 -Intro_WipeInFrontpic: ; 6182 +Intro_WipeInFrontpic: ld a, $77 ld [hWX], a call DelayFrame @@ -937,9 +886,8 @@ Intro_WipeInFrontpic: ; 6182 ret z ld [hWX], a jr .loop -; 619c -Intro_PrepTrainerPic: ; 619c +Intro_PrepTrainerPic: ld de, vTiles2 farcall GetTrainerPic xor a @@ -948,9 +896,8 @@ Intro_PrepTrainerPic: ; 619c lb bc, 7, 7 predef PlaceGraphic ret -; 61b4 -ShrinkFrame: ; 61b4 +ShrinkFrame: ld de, vTiles2 ld c, 7 * 7 predef DecompressGet2bpp @@ -960,10 +907,8 @@ ShrinkFrame: ; 61b4 lb bc, 7, 7 predef PlaceGraphic ret -; 61cd - -Intro_PlacePlayerSprite: ; 61cd +Intro_PlacePlayerSprite: farcall GetPlayerIcon ld c, $c ld hl, vTiles0 @@ -998,24 +943,21 @@ Intro_PlacePlayerSprite: ; 61cd dec c jr nz, .loop ret -; 61fe -.sprites ; 61fe +.sprites db 4 ; y pxl, x pxl, tile offset db 9 * 8 + 4, 9 * 8, 0 db 9 * 8 + 4, 10 * 8, 1 db 10 * 8 + 4, 9 * 8, 2 db 10 * 8 + 4, 10 * 8, 3 -; 620b - -CrystalIntroSequence: ; 620b +CrystalIntroSequence: callfar Copyright_GFPresents jr c, StartTitleScreen farcall CrystalIntro -StartTitleScreen: ; 6219 +StartTitleScreen: ld a, [rSVBK] push af ld a, BANK(wBGPals1) @@ -1062,7 +1004,6 @@ StartTitleScreen: ; 6219 ld h, [hl] ld l, a jp hl -; 626a .dw dw _MainMenu @@ -1070,15 +1011,12 @@ StartTitleScreen: ; 6219 dw CrystalIntroSequence dw CrystalIntroSequence dw ResetClock -; 6274 - -.TitleScreen: ; 6274 +.TitleScreen: farcall _TitleScreen ret -; 627b -RunTitleScreen: ; 627b +RunTitleScreen: ld a, [wJumptableIndex] bit 7, a jr nz, .done_title @@ -1091,9 +1029,8 @@ RunTitleScreen: ; 627b .done_title scf ret -; 6292 -Unreferenced_Function6292: ; 6292 +Unreferenced_Function6292: ld a, [hVBlankCounter] and $7 ret nz @@ -1103,9 +1040,8 @@ Unreferenced_Function6292: ; 6292 ld bc, 2 * SCREEN_WIDTH call ByteFill ret -; 62a3 -TitleScreenScene: ; 62a3 +TitleScreenScene: ld e, a ld d, 0 ld hl, .scenes @@ -1115,24 +1051,19 @@ TitleScreenScene: ; 62a3 ld h, [hl] ld l, a jp hl -; 62af .scenes dw TitleScreenEntrance dw TitleScreenTimer dw TitleScreenMain dw TitleScreenEnd -; 62b7 .Unreferenced_NextScene: ld hl, wJumptableIndex inc [hl] ret -; 62bc - - -TitleScreenEntrance: ; 62bc +TitleScreenEntrance: ; Animate the logo: ; Move each line by 4 pixels until our count hits 0. ld a, [hSCX] @@ -1178,11 +1109,8 @@ TitleScreenEntrance: ; 62bc ld a, $88 ld [hWY], a ret -; 62f6 - - -TitleScreenTimer: ; 62f6 +TitleScreenTimer: ; Next scene ld hl, wJumptableIndex inc [hl] @@ -1194,10 +1122,8 @@ TitleScreenTimer: ; 62f6 inc hl ld [hl], d ret -; 6304 - -TitleScreenMain: ; 6304 +TitleScreenMain: ; Run the timer down. ld hl, wTitleScreenTimer ld e, [hl] @@ -1296,10 +1222,8 @@ TitleScreenMain: ; 6304 ld hl, wJumptableIndex set 7, [hl] ret -; 6375 - -TitleScreenEnd: ; 6375 +TitleScreenEnd: ; Wait until the music is done fading. ld hl, wTitleScreenTimer @@ -1316,17 +1240,14 @@ TitleScreenEnd: ; 6375 ld hl, wJumptableIndex set 7, [hl] ret -; 6389 -DeleteSaveData: ; 6389 +DeleteSaveData: farcall _DeleteSaveData jp Init -; 6392 -ResetClock: ; 6392 +ResetClock: farcall _ResetClock jp Init -; 639b Unreferenced_Function639b: ; If bit 0 or 1 of [wTitleScreenTimer] is set, we don't need to be here. @@ -1359,9 +1280,8 @@ Unreferenced_Function639b: ld a, SPRITE_ANIM_INDEX_GS_TITLE_TRAIL call _InitSpriteAnimStruct ret -; 63ca -.Data63ca: ; 63ca +.Data63ca: ; frame 0 y, x; frame 1 y, x db 11 * 8 + 4, 10 * 8, 0 * 8, 0 * 8 db 11 * 8 + 4, 13 * 8, 11 * 8 + 4, 11 * 8 @@ -1369,9 +1289,8 @@ Unreferenced_Function639b: db 11 * 8 + 4, 17 * 8, 11 * 8 + 4, 15 * 8 db 0 * 8, 0 * 8, 11 * 8 + 4, 15 * 8 db 0 * 8, 0 * 8, 11 * 8 + 4, 11 * 8 -; 63e2 -Copyright: ; 63e2 +Copyright: call ClearTileMap call LoadFontsExtra ld de, CopyrightGFX @@ -1381,9 +1300,8 @@ Copyright: ; 63e2 hlcoord 2, 7 ld de, CopyrightString jp PlaceString -; 63fd -CopyrightString: ; 63fd +CopyrightString: ; ©1995-2001 Nintendo db $60, $61, $62, $63, $64, $65, $66 db $67, $68, $69, $6a, $6b, $6c @@ -1397,9 +1315,8 @@ CopyrightString: ; 63fd db $73, $74, $75, $76, $77, $78, $79, $7a, $7b, $7c db "@" -; 642e -GameInit:: ; 642e +GameInit:: farcall TryLoadSaveData call ClearWindowData call ClearBGPalettes @@ -1415,4 +1332,3 @@ GameInit:: ; 642e ld [hWY], a call WaitBGMap jp CrystalIntroSequence -; 6454 diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index d83ce873b..d6afda483 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -1,8 +1,7 @@ -GFX_49c0c: ; 49c0c +GFX_49c0c: INCBIN "gfx/unknown/049c0c.2bpp" -; 49cdc -MainMenu: ; 49cdc +MainMenu: xor a ld [wDisableTextAcceleration], a call Function49ed0 @@ -27,24 +26,21 @@ MainMenu: ; 49cdc .quit ret -; 49d14 -.MenuHeader: ; 49d14 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 16, 7 dw .MenuData db 1 ; default option -; 49d1c -.MenuData: ; 49d1c +.MenuData: db STATICMENU_CURSOR ; flags db 0 ; items dw MainMenuItems dw PlaceMenuStrings dw .Strings -; 49d20 -.Strings: ; 49d24 +.Strings: db "CONTINUE@" db "NEW GAME@" db "OPTION@" @@ -52,14 +48,13 @@ MainMenu: ; 49cdc db "MOBILE@" db "MOBILE STUDIUM@" -.Jumptable: ; 0x49d60 +.Jumptable: dw MainMenu_Continue dw MainMenu_NewGame dw MainMenu_Options dw MainMenu_MysteryGift dw MainMenu_Mobile dw MainMenu_MobileStudium -; 0x49d6c CONTINUE EQU 0 NEW_GAME EQU 1 @@ -70,20 +65,20 @@ MOBILE_STUDIUM EQU 5 MainMenuItems: -NewGameMenu: ; 0x49d6c +NewGameMenu: db 2 db NEW_GAME db OPTION db -1 -ContinueMenu: ; 0x49d70 +ContinueMenu: db 3 db CONTINUE db NEW_GAME db OPTION db -1 -MobileMysteryMenu: ; 0x49d75 +MobileMysteryMenu: db 5 db CONTINUE db NEW_GAME @@ -92,7 +87,7 @@ MobileMysteryMenu: ; 0x49d75 db MOBILE db -1 -MobileMenu: ; 0x49d7c +MobileMenu: db 4 db CONTINUE db NEW_GAME @@ -100,7 +95,7 @@ MobileMenu: ; 0x49d7c db MOBILE db -1 -MobileStudiumMenu: ; 0x49d82 +MobileStudiumMenu: db 5 db CONTINUE db NEW_GAME @@ -109,7 +104,7 @@ MobileStudiumMenu: ; 0x49d82 db MOBILE_STUDIUM db -1 -MysteryMobileStudiumMenu: ; 0x49d89 +MysteryMobileStudiumMenu: db 6 db CONTINUE db NEW_GAME @@ -119,7 +114,7 @@ MysteryMobileStudiumMenu: ; 0x49d89 db MOBILE_STUDIUM db -1 -MysteryMenu: ; 0x49d91 +MysteryMenu: db 4 db CONTINUE db NEW_GAME @@ -127,7 +122,7 @@ MysteryMenu: ; 0x49d91 db MYSTERY_GIFT db -1 -MysteryStudiumMenu: ; 0x49d97 +MysteryStudiumMenu: db 5 db CONTINUE db NEW_GAME @@ -136,7 +131,7 @@ MysteryStudiumMenu: ; 0x49d97 db MOBILE_STUDIUM db -1 -StudiumMenu: ; 0x49d9e +StudiumMenu: db 4 db CONTINUE db NEW_GAME @@ -144,8 +139,7 @@ StudiumMenu: ; 0x49d9e db MOBILE_STUDIUM db -1 - -MainMenu_GetWhichMenu: ; 49da4 +MainMenu_GetWhichMenu: nop nop nop @@ -193,9 +187,8 @@ MainMenu_GetWhichMenu: ; 49da4 .ok4 ld a, $6 ; Mystery Gift ret -; 49de4 -MainMenuJoypadLoop: ; 49de4 +MainMenuJoypadLoop: call SetUpMenu .loop call MainMenu_PrintCurrentTimeAndDay @@ -218,9 +211,8 @@ MainMenuJoypadLoop: ; 49de4 .b_button scf ret -; 49e09 -MainMenu_PrintCurrentTimeAndDay: ; 49e09 +MainMenu_PrintCurrentTimeAndDay: ld a, [wSaveFileExists] and a ret z @@ -237,10 +229,8 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 ld a, $1 ld [hBGMapMode], a ret -; 49e27 - -.PlaceBox: ; 49e27 +.PlaceBox: call CheckRTCStatus and $80 jr nz, .TimeFail @@ -253,10 +243,8 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 .TimeFail: call SpeechTextBox ret -; 49e3d - -.PlaceTime: ; 49e3d +.PlaceTime: ld a, [wSaveFileExists] and a ret z @@ -282,26 +270,22 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 .min ; unused db "min.@" -; 49e75 -.PrintTimeNotSet: ; 49e75 +.PrintTimeNotSet: hlcoord 1, 14 ld de, .TimeNotSet call PlaceString ret -; 49e7f -.TimeNotSet: ; 49e7f +.TimeNotSet: db "TIME NOT SET@" -; 49e8c -.UnusedText: ; 49e8c +.UnusedText: ; Clock time unknown text_jump UnknownText_0x1c5182 db "@" -; 49e91 -.PlaceCurrentDay: ; 49e91 +.PlaceCurrentDay: push de ld hl, .Days ld a, b @@ -315,7 +299,6 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 ld de, .Day call PlaceString ret -; 49ea8 .Days: db "SUN@" @@ -327,9 +310,8 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 db "SATUR@" .Day: db "DAY@" -; 49ed0 -Function49ed0: ; 49ed0 +Function49ed0: xor a ld [hMapAnims], a call ClearTileMap @@ -337,25 +319,19 @@ Function49ed0: ; 49ed0 call LoadStandardFont call ClearWindowData ret -; 49ee0 - -MainMenu_NewGame: ; 49ee0 +MainMenu_NewGame: farcall NewGame ret -; 49ee7 -MainMenu_Options: ; 49ee7 +MainMenu_Options: farcall OptionsMenu ret -; 49eee -MainMenu_Continue: ; 49eee +MainMenu_Continue: farcall Continue ret -; 49ef5 -MainMenu_MysteryGift: ; 49ef5 +MainMenu_MysteryGift: farcall MysteryGift ret -; 49efc diff --git a/engine/menus/menu.asm b/engine/menus/menu.asm index 51de2e1a4..c9ce72b13 100644 --- a/engine/menus/menu.asm +++ b/engine/menus/menu.asm @@ -1,4 +1,4 @@ -_2DMenu_:: ; 2400e +_2DMenu_:: ld hl, CopyMenuData ld a, [wMenuData_2DMenuItemStringsBank] rst FarCall @@ -8,9 +8,8 @@ _2DMenu_:: ; 2400e call ApplyTilemap call Get2DMenuSelection ret -; 24022 -_InterpretBattleMenu:: ; 24022 +_InterpretBattleMenu:: ld hl, CopyMenuData ld a, [wMenuData_2DMenuItemStringsBank] rst FarCall @@ -21,9 +20,8 @@ _InterpretBattleMenu:: ; 24022 call ApplyTilemap call Get2DMenuSelection ret -; 2403c -_InterpretMobileMenu:: ; 2403c +_InterpretMobileMenu:: ld hl, CopyMenuData ld a, [wMenuData_2DMenuItemStringsBank] rst FarCall @@ -56,23 +54,19 @@ _InterpretMobileMenu:: ; 2403c ld [wMenuCursorBuffer], a and a ret -; 24085 - - -Draw2DMenu: ; 24085 +Draw2DMenu: xor a ld [hBGMapMode], a call MenuBox call Place2DMenuItemStrings ret -; 2408f -Get2DMenuSelection: ; 2408f +Get2DMenuSelection: call Init2DMenuCursorPosition call StaticMenuJoypad call MenuClickSound -Mobile_GetMenuSelection: ; 24098 +Mobile_GetMenuSelection: ld a, [wMenuDataFlags] bit 1, a jr z, .skip @@ -108,22 +102,19 @@ Mobile_GetMenuSelection: ; 24098 .quit2 scf ret -; 240cd -Get2DMenuNumberOfColumns: ; 240cd +Get2DMenuNumberOfColumns: ld a, [wMenuData_2DMenuDimensions] and $f ret -; 240d3 -Get2DMenuNumberOfRows: ; 240d3 +Get2DMenuNumberOfRows: ld a, [wMenuData_2DMenuDimensions] swap a and $f ret -; 240db -Place2DMenuItemStrings: ; 240db +Place2DMenuItemStrings: ld hl, wMenuData_2DMenuItemStringsAddr ld e, [hl] inc hl @@ -164,10 +155,8 @@ Place2DMenuItemStrings: ; 240db ld a, [wMenuData_2DMenuFunctionBank] rst FarCall ret -; 2411a - -Init2DMenuCursorPosition: ; 2411a (9:411a) +Init2DMenuCursorPosition: call GetMenuTextStartCoord ld a, b ld [w2DMenuCursorInitY], a @@ -222,9 +211,8 @@ Init2DMenuCursorPosition: ; 2411a (9:411a) ld [wCursorCurrentTile], a ld [wCursorCurrentTile + 1], a ret -; 24179 -.InitFlags_a: ; 24179 +.InitFlags_a: xor a ld hl, w2DMenuFlags1 ld [hli], a @@ -235,16 +223,14 @@ Init2DMenuCursorPosition: ; 2411a (9:411a) set 5, [hl] set 4, [hl] ret -; 2418a -.InitFlags_b: ; 2418a +.InitFlags_b: ld a, [wMenuData_2DMenuSpacing] or $20 ld [w2DMenuCursorOffsets], a ret -; 24193 -.InitFlags_c: ; 24193 +.InitFlags_c: ld hl, wMenuDataFlags ld a, A_BUTTON bit 0, [hl] @@ -257,12 +243,10 @@ Init2DMenuCursorPosition: ; 2411a (9:411a) .skip2 ld [wMenuJoypadFilter], a ret -; 241a8 - -_StaticMenuJoypad:: ; 241a8 +_StaticMenuJoypad:: call Place2DMenuCursor -_ScrollingMenuJoypad:: ; 241ab +_ScrollingMenuJoypad:: ld hl, w2DMenuFlags2 res 7, [hl] ld a, [hBGMapMode] @@ -271,9 +255,8 @@ _ScrollingMenuJoypad:: ; 241ab pop af ld [hBGMapMode], a ret -; 241ba -MobileMenuJoypad: ; 241ba +MobileMenuJoypad: ld hl, w2DMenuFlags2 res 7, [hl] ld a, [hBGMapMode] @@ -288,10 +271,8 @@ MobileMenuJoypad: ; 241ba call GetMenuJoypad ld c, a ret -; 241d5 - -Unreferenced_Function241d5: ; 241d5 +Unreferenced_Function241d5: call Place2DMenuCursor .loop call Move2DMenuCursor @@ -328,10 +309,8 @@ Unreferenced_Function241d5: ; 241d5 jr z, .loop2 and a ret -; 24216 - -MenuJoypadLoop: ; 24216 +MenuJoypadLoop: .loop call Move2DMenuCursor call .BGMap_OAM @@ -350,9 +329,8 @@ MenuJoypadLoop: ; 24216 .done ret -; 24238 -.BGMap_OAM: ; 24238 +.BGMap_OAM: ld a, [hOAMUpdate] push af ld a, $1 @@ -363,9 +341,8 @@ MenuJoypadLoop: ; 24216 xor a ld [hBGMapMode], a ret -; 24249 -Do2DMenuRTCJoypad: ; 24249 +Do2DMenuRTCJoypad: .loopRTC call RTC call Menu_WasButtonPressed @@ -375,9 +352,8 @@ Do2DMenuRTCJoypad: ; 24249 jr z, .loopRTC and a ret -; 24259 -Menu_WasButtonPressed: ; 24259 +Menu_WasButtonPressed: ld a, [w2DMenuFlags1] bit 6, a jr z, .skip_to_joypad @@ -390,9 +366,8 @@ Menu_WasButtonPressed: ; 24259 ret z scf ret -; 24270 -_2DMenuInterpretJoypad: ; 24270 +_2DMenuInterpretJoypad: call GetMenuJoypad bit A_BUTTON_F, a jp nz, .a_b_start_select @@ -413,7 +388,7 @@ _2DMenuInterpretJoypad: ; 24270 and a ret -.set_bit_7 ; 24299 +.set_bit_7 ld hl, w2DMenuFlags2 set 7, [hl] scf @@ -512,14 +487,12 @@ _2DMenuInterpretJoypad: ; 24270 ld [hl], $1 xor a ret -; 24318 -.a_b_start_select ; 24318 +.a_b_start_select xor a ret -; 2431a -Move2DMenuCursor: ; 2431a +Move2DMenuCursor: ld hl, wCursorCurrentTile ld a, [hli] ld h, [hl] @@ -529,7 +502,7 @@ Move2DMenuCursor: ; 2431a jr nz, Place2DMenuCursor ld a, [wCursorOffCharacter] ld [hl], a -Place2DMenuCursor: ; 24329 +Place2DMenuCursor: ld a, [w2DMenuCursorInitY] ld b, a ld a, [w2DMenuCursorInitX] @@ -580,9 +553,8 @@ Place2DMenuCursor: ; 24329 ld a, h ld [wCursorCurrentTile + 1], a ret -; 24374 -_PushWindow:: ; 24374 +_PushWindow:: ld a, [rSVBK] push af ld a, BANK(wWindowStack) @@ -651,9 +623,8 @@ _PushWindow:: ; 24374 ld hl, wWindowStackSize inc [hl] ret -; 243cd -.copy ; 243cd +.copy call GetMenuBoxDims inc b inc c @@ -678,13 +649,11 @@ _PushWindow:: ; 24374 jr nz, .row ret -; 243e7 -.ret ; 243e7 +.ret ret -; 243e8 -_ExitMenu:: ; 243e8 +_ExitMenu:: xor a ld [hBGMapMode], a @@ -722,9 +691,8 @@ _ExitMenu:: ; 243e8 ld hl, wWindowStackSize dec [hl] ret -; 24423 -Unreferenced_Function24423: ; 24423 +Unreferenced_Function24423: ld a, [wVramState] bit 0, a ret z @@ -755,22 +723,19 @@ Unreferenced_Function24423: ; 24423 jr nz, .loop call CloseSRAM ret -; 2445d -Error_Cant_ExitMenu: ; 2445d +Error_Cant_ExitMenu: ld hl, .Text_NoWindowsAvailableForPopping call PrintText call WaitBGMap .InfiniteLoop: jr .InfiniteLoop -; 24468 -.Text_NoWindowsAvailableForPopping: ; 24468 +.Text_NoWindowsAvailableForPopping: text_jump UnknownText_0x1c46b7 db "@" -; 2446d -_InitVerticalMenuCursor:: ; 2446d +_InitVerticalMenuCursor:: ld a, [wMenuDataFlags] ld b, a ld hl, w2DMenuCursorInitY @@ -838,4 +803,3 @@ _InitVerticalMenuCursor:: ; 2446d ld [hli], a ld [hli], a ret -; 244c3 diff --git a/engine/menus/menu_2.asm b/engine/menus/menu_2.asm index 16cce5348..b039b590f 100644 --- a/engine/menus/menu_2.asm +++ b/engine/menus/menu_2.asm @@ -1,4 +1,4 @@ -PlaceMenuItemName: ; 0x24ab4 +PlaceMenuItemName: push de ld a, [wMenuSelection] ld [wNamedObjectIndexBuffer], a @@ -7,7 +7,7 @@ PlaceMenuItemName: ; 0x24ab4 call PlaceString ret -PlaceMenuItemQuantity: ; 0x24ac3 +PlaceMenuItemQuantity: push de ld a, [wMenuSelection] ld [wCurItem], a @@ -27,22 +27,22 @@ PlaceMenuItemQuantity: ; 0x24ac3 .done ret -PlaceMoneyTopRight: ; 24ae8 +PlaceMoneyTopRight: ld hl, MenuHeader_0x24b15 call CopyMenuHeader jr PlaceMoneyTextBox -PlaceMoneyBottomLeft: ; 24af0 +PlaceMoneyBottomLeft: ld hl, MenuHeader_0x24b1d call CopyMenuHeader jr PlaceMoneyTextBox -PlaceMoneyAtTopLeftOfTextbox: ; 24af8 +PlaceMoneyAtTopLeftOfTextbox: ld hl, MenuHeader_0x24b15 lb de, 0, 11 call OffsetMenuHeader -PlaceMoneyTextBox: ; 24b01 +PlaceMoneyTextBox: call MenuBox call MenuBoxCoord2Tile ld de, SCREEN_WIDTH + 1 @@ -52,19 +52,19 @@ PlaceMoneyTextBox: ; 24b01 call PrintNum ret -MenuHeader_0x24b15: ; 0x24b15 +MenuHeader_0x24b15: db MENU_BACKUP_TILES ; flags menu_coords 11, 0, SCREEN_WIDTH - 1, 2 dw NULL db 1 ; default option -MenuHeader_0x24b1d: ; 0x24b1d +MenuHeader_0x24b1d: db MENU_BACKUP_TILES ; flags menu_coords 0, 11, 8, 13 dw NULL db 1 ; default option -DisplayCoinCaseBalance: ; 24b25 +DisplayCoinCaseBalance: ; Place a text box of size 1x7 at 11, 0. hlcoord 11, 0 ld b, 1 @@ -82,7 +82,7 @@ DisplayCoinCaseBalance: ; 24b25 call PrintNum ret -DisplayMoneyAndCoinBalance: ; 24b4e +DisplayMoneyAndCoinBalance: hlcoord 5, 0 ld b, 3 ld c, 13 @@ -103,14 +103,14 @@ DisplayMoneyAndCoinBalance: ; 24b4e call PrintNum ret -MoneyString: ; 24b83 +MoneyString: db "MONEY@" -CoinString: ; 24b89 +CoinString: db "COIN@" -ShowMoney_TerminatorString: ; 24b8e +ShowMoney_TerminatorString: db "@" -Unreferenced_Function24b8f: ; 24b8f +Unreferenced_Function24b8f: ; related to safari? ld hl, wOptions ld a, [hl] @@ -138,19 +138,19 @@ Unreferenced_Function24b8f: ; 24b8f ld [wOptions], a ret -.slash_500 ; 24bcf +.slash_500 db "/500@" -.booru_ko ; 24bd4 +.booru_ko db "ボール こ@" -StartMenu_DrawBugContestStatusBox: ; 24bdc +StartMenu_DrawBugContestStatusBox: hlcoord 0, 0 ld b, 5 ld c, 17 call TextBox ret -StartMenu_PrintBugContestStatus: ; 24be7 +StartMenu_PrintBugContestStatus: ld hl, wOptions ld a, [hl] push af @@ -194,18 +194,18 @@ StartMenu_PrintBugContestStatus: ; 24be7 ld [wOptions], a ret -.Balls_JP: ; 24c43 +.Balls_JP: db "ボール こ@" -.CAUGHT: ; 24c4b +.CAUGHT: db "CAUGHT@" -.Balls_EN: ; 24c52 +.Balls_EN: db "BALLS:@" -.None: ; 24c59 +.None: db "None@" -.LEVEL: ; 24c5e +.LEVEL: db "LEVEL@" -FindApricornsInBag: ; 24c64 +FindApricornsInBag: ; Checks the bag for Apricorns. ld hl, wBuffer1 xor a @@ -239,7 +239,7 @@ FindApricornsInBag: ; 24c64 scf ret -.addtobuffer ; 24c94 +.addtobuffer push hl ld hl, wBuffer1 inc [hl] diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index a958e10eb..8a8303067 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -4,15 +4,13 @@ NAMINGSCREEN_BORDER EQUS "\"■\"" ; $60 NAMINGSCREEN_MIDDLELINE EQUS "\"→\"" ; $eb NAMINGSCREEN_UNDERLINE EQUS "\"<DOT>\"" ; $f2 -_NamingScreen: ; 0x116b7 +_NamingScreen: call DisableSpriteUpdates call NamingScreen call ReturnToMapWithSpeechTextbox ret -; 0x116c1 - -NamingScreen: ; 116c1 +NamingScreen: ld hl, wNamingScreenDestinationPointer ld [hl], e inc hl @@ -45,9 +43,7 @@ NamingScreen: ; 116c1 call ClearJoypad ret -; 116f8 - -.SetUpNamingScreen: ; 116f8 +.SetUpNamingScreen: call ClearBGPalettes ld b, SCGB_DIPLOMA call GetSGBLayout @@ -63,9 +59,7 @@ NamingScreen: ; 116c1 call NamingScreen_InitNameEntry ret -; 1171d - -.GetNamingScreenSetup: ; 1171d +.GetNamingScreenSetup: ld a, [wNamingScreenType] and 7 ld e, a @@ -78,9 +72,7 @@ NamingScreen: ; 116c1 ld l, a jp hl -; 1172e - -.Jumptable: ; 1172e (4:572e) +.Jumptable: dw .Pokemon dw .Player dw .Rival @@ -90,7 +82,7 @@ NamingScreen: ; 116c1 dw .Pokemon dw .Pokemon -.Pokemon: ; 1173e (4:573e) +.Pokemon: ld a, [wCurPartySpecies] ld [wd265], a ld hl, LoadMenuMonIcon @@ -121,15 +113,11 @@ NamingScreen: ; 116c1 call .StoreMonIconParams ret -; 11780 (4:5780) - -.NicknameStrings: ; 11780 +.NicknameStrings: db "'S@" db "NICKNAME?@" -; 1178d - -.Player: ; 1178d (4:578d) +.Player: farcall GetPlayerIcon call .LoadSprite hlcoord 5, 2 @@ -138,14 +126,10 @@ NamingScreen: ; 116c1 call .StoreSpriteIconParams ret -; 117a3 (4:57a3) - -.PlayerNameString: ; 117a3 +.PlayerNameString: db "YOUR NAME?@" -; 117ae - -.Rival: ; 117ae (4:57ae) +.Rival: ld de, SilverSpriteGFX ld b, BANK(SilverSpriteGFX) call .LoadSprite @@ -155,14 +139,10 @@ NamingScreen: ; 116c1 call .StoreSpriteIconParams ret -; 117c3 (4:57c3) - -.RivalNameString: ; 117c3 +.RivalNameString: db "RIVAL'S NAME?@" -; 117d1 - -.Mom: ; 117d1 (4:57d1) +.Mom: ld de, MomSpriteGFX ld b, BANK(MomSpriteGFX) call .LoadSprite @@ -172,14 +152,10 @@ NamingScreen: ; 116c1 call .StoreSpriteIconParams ret -; 117e6 (4:57e6) - -.MomNameString: ; 117e6 +.MomNameString: db "MOTHER'S NAME?@" -; 117f5 - -.Box: ; 117f5 (4:57f5) +.Box: ld de, PokeBallSpriteGFX ld hl, vTiles0 tile $00 lb bc, BANK(PokeBallSpriteGFX), 4 @@ -200,28 +176,20 @@ NamingScreen: ; 116c1 call .StoreBoxIconParams ret -; 11822 (4:5822) - -.BoxNameString: ; 11822 +.BoxNameString: db "BOX NAME?@" -; 1182c - -.Tomodachi: ; 1182c (4:582c) +.Tomodachi: hlcoord 3, 2 ld de, .oTomodachi_no_namae_sutoringu call PlaceString call .StoreSpriteIconParams ret -; 11839 (4:5839) - -.oTomodachi_no_namae_sutoringu ; 11839 +.oTomodachi_no_namae_sutoringu db "おともだち の なまえは?@" -; 11847 - -.LoadSprite: ; 11847 (4:5847) +.LoadSprite: push de ld hl, vTiles0 tile $00 ld c, $4 @@ -253,22 +221,22 @@ NamingScreen: ; 116c1 call _InitSpriteAnimStruct ret -.StoreMonIconParams: ; 1187b (4:587b) +.StoreMonIconParams: ld a, MON_NAME_LENGTH - 1 hlcoord 5, 6 jr .StoreParams -.StoreSpriteIconParams: ; 11882 (4:5882) +.StoreSpriteIconParams: ld a, PLAYER_NAME_LENGTH - 1 hlcoord 5, 6 jr .StoreParams -.StoreBoxIconParams: ; 11889 (4:5889) +.StoreBoxIconParams: ld a, BOX_NAME_LENGTH - 1 hlcoord 5, 4 jr .StoreParams -.StoreParams: ; 11890 (4:5890) +.StoreParams: ld [wNamingScreenMaxNameLength], a ld a, l ld [wNamingScreenStringEntryCoord], a @@ -276,7 +244,7 @@ NamingScreen: ; 116c1 ld [wNamingScreenStringEntryCoord + 1], a ret -NamingScreen_IsTargetBox: ; 1189c +NamingScreen_IsTargetBox: push bc push af ld a, [wNamingScreenType] @@ -287,9 +255,7 @@ NamingScreen_IsTargetBox: ; 1189c pop bc ret -; 118a8 - -NamingScreen_InitText: ; 118a8 +NamingScreen_InitText: call WaitTop hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT @@ -304,7 +270,7 @@ NamingScreen_InitText: ; 118a8 .not_box call ClearBox ld de, NameInputUpper -NamingScreen_ApplyTextInputMode: ; 118ca +NamingScreen_ApplyTextInputMode: call NamingScreen_IsTargetBox jr nz, .not_box ld hl, BoxNameInputLower - NameInputLower @@ -350,9 +316,7 @@ NamingScreen_ApplyTextInputMode: ; 118ca jr nz, .row ret -; 11915 - -NamingScreenJoypadLoop: ; 11915 +NamingScreenJoypadLoop: call JoyTextDelay ld a, [wJumptableIndex] bit 7, a @@ -373,9 +337,7 @@ NamingScreenJoypadLoop: ; 11915 scf ret -; 11940 - -.UpdateStringEntry: ; 11940 +.UpdateStringEntry: xor a ld [hBGMapMode], a hlcoord 1, 5 @@ -399,9 +361,7 @@ NamingScreenJoypadLoop: ; 11915 ld [hBGMapMode], a ret -; 11968 - -.RunJumptable: ; 11968 +.RunJumptable: ld a, [wJumptableIndex] ld e, a ld d, $0 @@ -413,13 +373,11 @@ NamingScreenJoypadLoop: ; 11915 ld l, a jp hl -; 11977 - -.Jumptable: ; 11977 (4:5977) +.Jumptable: dw .InitCursor dw .ReadButtons -.InitCursor: ; 1197b (4:597b) +.InitCursor: depixel 10, 3 call NamingScreen_IsTargetBox jr nz, .got_cursor_position @@ -441,7 +399,7 @@ NamingScreenJoypadLoop: ; 11915 inc [hl] ret -.ReadButtons: ; 119a1 (4:59a1) +.ReadButtons: ld hl, hJoyPressed ; $ffa7 ld a, [hl] and A_BUTTON @@ -510,13 +468,13 @@ NamingScreenJoypadLoop: ; 11915 call NamingScreen_ApplyTextInputMode ret -.GetCursorPosition: ; 11a0b (4:5a0b) +.GetCursorPosition: ld hl, wNamingScreenCursorObjectPointer ld c, [hl] inc hl ld b, [hl] -NamingScreen_GetCursorPosition: ; 11a11 (4:5a11) +NamingScreen_GetCursorPosition: ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld a, [hl] @@ -551,7 +509,7 @@ NamingScreen_GetCursorPosition: ; 11a11 (4:5a11) xor a ret -NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) +NamingScreen_AnimateCursor: call .GetDPad ld hl, SPRITEANIMSTRUCT_0D add hl, bc @@ -590,17 +548,13 @@ NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) ld [hl], a ret -; 11a79 (4:5a79) - -.LetterEntries: ; 11a79 +.LetterEntries: db $00, $10, $20, $30, $40, $50, $60, $70, $80 -.CaseDelEnd: ; 11a82 +.CaseDelEnd: db $00, $00, $00, $30, $30, $30, $60, $60, $60 -; 11a8b - -.GetDPad: ; 11a8b (4:5a8b) +.GetDPad: ld hl, hJoyLast ld a, [hl] and D_UP @@ -713,9 +667,9 @@ NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) inc [hl] ret -NamingScreen_TryAddCharacter: ; 11b14 (4:5b14) +NamingScreen_TryAddCharacter: ld a, [wNamingScreenLastCharacter] ; lost -MailComposition_TryAddCharacter: ; 11b17 (4:5b17) +MailComposition_TryAddCharacter: ld a, [wNamingScreenMaxNameLength] ld c, a ld a, [wNamingScreenCurrNameLength] @@ -724,11 +678,11 @@ MailComposition_TryAddCharacter: ; 11b17 (4:5b17) ld a, [wNamingScreenLastCharacter] -NamingScreen_LoadNextCharacter: ; 11b23 +NamingScreen_LoadNextCharacter: call NamingScreen_GetTextCursorPosition ld [hl], a -NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 +NamingScreen_AdvanceCursor_CheckEndOfString: ld hl, wNamingScreenCurrNameLength inc [hl] call NamingScreen_GetTextCursorPosition @@ -743,8 +697,6 @@ NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 scf ret -; 11b39 (4:5b39) - ; unused ld a, [wNamingScreenCurrNameLength] and a @@ -769,13 +721,9 @@ NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 ld a, [hl] jr NamingScreen_LoadNextCharacter -; 11b56 - INCLUDE "data/text/unused_dakutens.asm" -; 11bbc - -NamingScreen_DeleteCharacter: ; 11bbc (4:5bbc) +NamingScreen_DeleteCharacter: ld hl, wNamingScreenCurrNameLength ld a, [hl] and a @@ -790,7 +738,7 @@ NamingScreen_DeleteCharacter: ; 11bbc (4:5bbc) ld [hl], NAMINGSCREEN_MIDDLELINE ret -NamingScreen_GetTextCursorPosition: ; 11bd0 (4:5bd0) +NamingScreen_GetTextCursorPosition: push af ld hl, wNamingScreenDestinationPointer ld a, [hli] @@ -803,9 +751,7 @@ NamingScreen_GetTextCursorPosition: ; 11bd0 (4:5bd0) pop af ret -; 11be0 - -NamingScreen_InitNameEntry: ; 11be0 +NamingScreen_InitNameEntry: ; load NAMINGSCREEN_UNDERLINE, (NAMINGSCREEN_MIDDLELINE * [wNamingScreenMaxNameLength]), "@" into the dw address at wNamingScreenDestinationPointer ld hl, wNamingScreenDestinationPointer ld a, [hli] @@ -824,9 +770,7 @@ NamingScreen_InitNameEntry: ; 11be0 ld [hl], "@" ret -; 11bf7 - -NamingScreen_StoreEntry: ; 11bf7 (4:5bf7) +NamingScreen_StoreEntry: ld hl, wNamingScreenDestinationPointer ld a, [hli] ld h, [hl] @@ -847,7 +791,7 @@ NamingScreen_StoreEntry: ; 11bf7 (4:5bf7) jr nz, .loop ret -NamingScreen_GetLastCharacter: ; 11c11 (4:5c11) +NamingScreen_GetLastCharacter: ld hl, wNamingScreenCursorObjectPointer ld c, [hl] inc hl @@ -890,7 +834,7 @@ NamingScreen_GetLastCharacter: ; 11c11 (4:5c11) ld [wNamingScreenLastCharacter], a ret -LoadNamingScreenGFX: ; 11c51 +LoadNamingScreenGFX: call ClearSprites callfar ClearSpriteAnims call LoadStandardFont @@ -935,32 +879,24 @@ LoadNamingScreenGFX: ; 11c51 ld [hWX], a ret -; 11cb7 - -NamingScreenGFX_Border: ; 11cb7 +NamingScreenGFX_Border: INCBIN "gfx/naming_screen/border.2bpp" -; 11cc7 -NamingScreenGFX_Cursor: ; 11cc7 +NamingScreenGFX_Cursor: INCBIN "gfx/naming_screen/cursor.2bpp" -; 11ce7 INCLUDE "data/text/name_input_chars.asm" -; 11e5d NamingScreenGFX_End: ; unused INCBIN "gfx/naming_screen/end.1bpp" -; 11e6d NamingScreenGFX_MiddleLine: INCBIN "gfx/naming_screen/middle_line.1bpp" -; 11e6d -NamingScreenGFX_UnderLine: ; 11e6d +NamingScreenGFX_UnderLine: INCBIN "gfx/naming_screen/underline.1bpp" -; 11e75 -_ComposeMailMessage: ; 11e75 (mail?) +_ComposeMailMessage: ld hl, wNamingScreenDestinationPointer ld [hl], e inc hl @@ -986,7 +922,7 @@ _ComposeMailMessage: ; 11e75 (mail?) ld [hMapAnims], a ret -.InitBlankMail: ; 11e9a (4:5e9a) +.InitBlankMail: call ClearBGPalettes call DisableLCD call LoadNamingScreenGFX @@ -1030,25 +966,18 @@ _ComposeMailMessage: ; 11e75 (mail?) ld [hl], "<NEXT>" ret -; 11ef4 (4:5ef4) - -.MailIcon: ; 11ef4 +.MailIcon: INCBIN "gfx/icons/mail_big.2bpp" -; 11f74 -.initwNamingScreenMaxNameLength ; 11f74 (4:5f74) +.initwNamingScreenMaxNameLength ld a, MAIL_MSG_LENGTH + 1 ld [wNamingScreenMaxNameLength], a ret -; 11f7a (4:5f7a) - .UnusedString11f7a: db "メールを かいてね@" -; 11f84 - -.InitCharset: ; 11f84 (4:5f84) +.InitCharset: call WaitTop hlcoord 0, 0 ld bc, 6 * SCREEN_WIDTH @@ -1063,7 +992,7 @@ INCBIN "gfx/icons/mail_big.2bpp" call ClearBox ld de, MailEntry_Uppercase -.PlaceMailCharset: ; 11fa9 (4:5fa9) +.PlaceMailCharset: hlcoord 1, 7 ld b, 6 .next @@ -1082,7 +1011,7 @@ INCBIN "gfx/icons/mail_big.2bpp" jr nz, .next ret -.DoMailEntry: ; 11fc0 (4:5fc0) +.DoMailEntry: call JoyTextDelay ld a, [wJumptableIndex] bit 7, a @@ -1103,7 +1032,7 @@ INCBIN "gfx/icons/mail_big.2bpp" scf ret -.Update: ; 11feb (4:5feb) +.Update: xor a ld [hBGMapMode], a hlcoord 1, 1 @@ -1119,7 +1048,7 @@ INCBIN "gfx/icons/mail_big.2bpp" ld [hBGMapMode], a ret -.DoJumptable: ; 12008 (4:6008) +.DoJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -1131,11 +1060,11 @@ INCBIN "gfx/icons/mail_big.2bpp" ld l, a jp hl -.Jumptable: ; 12017 (4:6017) +.Jumptable: dw .init_blinking_cursor dw .process_joypad -.init_blinking_cursor ; 1201b (4:601b) +.init_blinking_cursor depixel 9, 2 ld a, SPRITE_ANIM_INDEX_COMPOSE_MAIL_CURSOR call _InitSpriteAnimStruct @@ -1153,7 +1082,7 @@ INCBIN "gfx/icons/mail_big.2bpp" inc [hl] ret -.process_joypad ; 1203a (4:603a) +.process_joypad ld hl, hJoyPressed ; $ffa7 ld a, [hl] and A_BUTTON @@ -1240,7 +1169,7 @@ INCBIN "gfx/icons/mail_big.2bpp" ; called from engine/sprite_anims.asm -ComposeMail_AnimateCursor: ; 120c1 (4:60c1) +ComposeMail_AnimateCursor: call .GetDPad ld hl, SPRITEANIMSTRUCT_0D add hl, bc @@ -1274,17 +1203,13 @@ ComposeMail_AnimateCursor: ; 120c1 (4:60c1) ld [hl], a ret -; 120f8 (4:60f8) - -.LetterEntries: ; 120f8 +.LetterEntries: db $00, $10, $20, $30, $40, $50, $60, $70, $80, $90 -.CaseDelEnd: ; 12102 +.CaseDelEnd: db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60 -; 1210c - -.GetDPad: ; 1210c (4:610c) +.GetDPad: ld hl, hJoyLast ld a, [hl] and D_UP @@ -1386,13 +1311,13 @@ ComposeMail_AnimateCursor: ; 120c1 (4:60c1) ld [hl], $5 ret -NamingScreen_PressedA_GetCursorCommand: ; 12185 (4:6185) +NamingScreen_PressedA_GetCursorCommand: ld hl, wNamingScreenCursorObjectPointer ld c, [hl] inc hl ld b, [hl] -ComposeMail_GetCursorPosition: ; 1218b (4:618b) +ComposeMail_GetCursorPosition: ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld a, [hl] @@ -1420,12 +1345,10 @@ ComposeMail_GetCursorPosition: ; 1218b (4:618b) xor a ret -MailComposition_TryAddLastCharacter: ; 121ac (4:61ac) +MailComposition_TryAddLastCharacter: ld a, [wNamingScreenLastCharacter] jp MailComposition_TryAddCharacter -; 121b2 (4:61b2) - ; unused ld a, [wNamingScreenCurrNameLength] and a @@ -1460,8 +1383,4 @@ MailComposition_TryAddLastCharacter: ; 121ac (4:61ac) ld a, [hl] jp NamingScreen_LoadNextCharacter -; 121dd - INCLUDE "data/text/mail_input_chars.asm" - -; 122c1 diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index c0a255cb0..4dc6c0fe1 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -1,4 +1,4 @@ -_OptionsMenu: ; e41d0 +_OptionsMenu: ld hl, hInMenu ld a, [hl] push af @@ -59,28 +59,25 @@ _OptionsMenu: ; e41d0 pop af ld [hInMenu], a ret -; e4241 - -StringOptions: ; e4241 - db "TEXT SPEED<LNBRK>" - db " :<LNBRK>" - db "BATTLE SCENE<LNBRK>" - db " :<LNBRK>" - db "BATTLE STYLE<LNBRK>" - db " :<LNBRK>" - db "SOUND<LNBRK>" - db " :<LNBRK>" - db "PRINT<LNBRK>" - db " :<LNBRK>" - db "MENU ACCOUNT<LNBRK>" - db " :<LNBRK>" - db "FRAME<LNBRK>" - db " :TYPE<LNBRK>" - db "CANCEL@" -; e42d6 +StringOptions: + db "TEXT SPEED<LF>" + db " :<LF>" + db "BATTLE SCENE<LF>" + db " :<LF>" + db "BATTLE STYLE<LF>" + db " :<LF>" + db "SOUND<LF>" + db " :<LF>" + db "PRINT<LF>" + db " :<LF>" + db "MENU ACCOUNT<LF>" + db " :<LF>" + db "FRAME<LF>" + db " :TYPE<LF>" + db "CANCEL@" -GetOptionPointer: ; e42d6 +GetOptionPointer: ld a, [wJumptableIndex] ; load the cursor position to a ld e, a ; copy it to de ld d, 0 @@ -91,7 +88,6 @@ GetOptionPointer: ; e42d6 ld h, [hl] ld l, a jp hl ; jump to the code of the current highlighted item -; e42e5 .Pointers: dw Options_TextSpeed @@ -102,15 +98,13 @@ GetOptionPointer: ; e42d6 dw Options_MenuAccount dw Options_Frame dw Options_Cancel -; e42f5 - const_def const OPT_TEXT_SPEED_FAST ; 0 const OPT_TEXT_SPEED_MED ; 1 const OPT_TEXT_SPEED_SLOW ; 2 -Options_TextSpeed: ; e42f5 +Options_TextSpeed: call GetTextSpeed ld a, [hJoyPressed] bit D_LEFT_F, a @@ -156,7 +150,6 @@ Options_TextSpeed: ; e42f5 call PlaceString and a ret -; e4331 .Strings: ; entries correspond to OPT_TEXT_SPEED_* constants @@ -167,14 +160,12 @@ Options_TextSpeed: ; e42f5 .Fast: db "FAST@" .Mid: db "MID @" .Slow: db "SLOW@" -; e4346 - -GetTextSpeed: ; e4346 +GetTextSpeed: ; converts TEXT_DELAY_* value in a to OPT_TEXT_SPEED_* value in c, ; with previous/next TEXT_DELAY_* values in d/e ld a, [wOptions] - and $7 + and TEXT_DELAY_MASK cp TEXT_DELAY_SLOW jr z, .slow cp TEXT_DELAY_FAST @@ -193,10 +184,8 @@ GetTextSpeed: ; e4346 ld c, OPT_TEXT_SPEED_FAST lb de, TEXT_DELAY_SLOW, TEXT_DELAY_MED ret -; e4365 - -Options_BattleScene: ; e4365 +Options_BattleScene: ld hl, wOptions ld a, [hJoyPressed] bit D_LEFT_F, a @@ -231,14 +220,11 @@ Options_BattleScene: ; e4365 call PlaceString and a ret -; e4398 .On: db "ON @" .Off: db "OFF@" -; e43a0 - -Options_BattleStyle: ; e43a0 +Options_BattleStyle: ld hl, wOptions ld a, [hJoyPressed] bit D_LEFT_F, a @@ -272,14 +258,11 @@ Options_BattleStyle: ; e43a0 call PlaceString and a ret -; e43d1 .Shift: db "SHIFT@" .Set: db "SET @" -; e43dd - -Options_Sound: ; e43dd +Options_Sound: ld hl, wOptions ld a, [hJoyPressed] bit D_LEFT_F, a @@ -320,12 +303,9 @@ Options_Sound: ; e43dd call PlaceString and a ret -; e4416 .Mono: db "MONO @" .Stereo: db "STEREO@" -; e4424 - const_def const OPT_PRINT_LIGHTEST ; 0 @@ -334,7 +314,7 @@ Options_Sound: ; e43dd const OPT_PRINT_DARKER ; 3 const OPT_PRINT_DARKEST ; 4 -Options_Print: ; e4424 +Options_Print: call GetPrinterSetting ld a, [hJoyPressed] bit D_LEFT_F, a @@ -377,7 +357,6 @@ Options_Print: ; e4424 call PlaceString and a ret -; e445a .Strings: ; entries correspond to OPT_PRINT_* constants @@ -392,10 +371,8 @@ Options_Print: ; e4424 .Normal: db "NORMAL @" .Darker: db "DARKER @" .Darkest: db "DARKEST @" -; e4491 - -GetPrinterSetting: ; e4491 +GetPrinterSetting: ; converts GBPRINTER_* value in a to OPT_PRINT_* value in c, ; with previous/next GBPRINTER_* values in d/e ld a, [wGBPrinter] @@ -431,9 +408,8 @@ GetPrinterSetting: ; e4491 ld c, OPT_PRINT_DARKEST lb de, GBPRINTER_DARKER, GBPRINTER_LIGHTEST ret -; e44c1 -Options_MenuAccount: ; e44c1 +Options_MenuAccount: ld hl, wOptions2 ld a, [hJoyPressed] bit D_LEFT_F, a @@ -467,14 +443,11 @@ Options_MenuAccount: ; e44c1 call PlaceString and a ret -; e44f2 .Off: db "OFF@" .On: db "ON @" -; e44fa - -Options_Frame: ; e44fa +Options_Frame: ld hl, wTextBoxFrame ld a, [hJoyPressed] bit D_LEFT_F, a @@ -494,9 +467,9 @@ Options_Frame: ; e44fa dec a .Save: - and $7 + maskbits NUM_FRAMES ld [hl], a -UpdateFrame: ; e4512 +UpdateFrame: ld a, [wTextBoxFrame] hlcoord 16, 15 ; where on the screen the number is drawn add "1" @@ -504,9 +477,8 @@ UpdateFrame: ; e4512 call LoadFontsExtra and a ret -; e4520 -Options_Cancel: ; e4520 +Options_Cancel: ld a, [hJoyPressed] and A_BUTTON jr nz, .Exit @@ -516,9 +488,8 @@ Options_Cancel: ; e4520 .Exit: scf ret -; e452a -OptionsControl: ; e452a +OptionsControl: ld hl, wJumptableIndex ld a, [hJoyLast] cp D_DOWN @@ -563,9 +534,8 @@ OptionsControl: ; e452a dec [hl] scf ret -; e455c -Options_UpdateCursorPosition: ; e455c +Options_UpdateCursorPosition: hlcoord 1, 1 ld de, SCREEN_WIDTH ld c, $10 @@ -580,4 +550,3 @@ Options_UpdateCursorPosition: ; e455c call AddNTimes ld [hl], "▶" ret -; e4579 diff --git a/engine/menus/save.asm b/engine/menus/save.asm index efde37ffe..190f5f887 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -1,4 +1,4 @@ -SaveMenu: ; 14a1a +SaveMenu: call LoadStandardMenuHeader farcall DisplaySaveInfoOnSave call SpeechTextBox @@ -23,7 +23,7 @@ SaveMenu: ; 14a1a scf ret -SaveAfterLinkTrade: ; 14a58 +SaveAfterLinkTrade: call PauseGameLogic farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -35,10 +35,8 @@ SaveAfterLinkTrade: ; 14a58 farcall SaveRTC call ResumeGameLogic ret -; 14a83 - -ChangeBoxSaveGame: ; 14a83 (5:4a83) +ChangeBoxSaveGame: push de ld hl, Text_SaveOnBoxSwitch call MenuTextBox @@ -62,7 +60,7 @@ ChangeBoxSaveGame: ; 14a83 (5:4a83) pop de ret -Link_SaveGame: ; 14ab2 +Link_SaveGame: call AskOverwriteSaveFile jr c, .refused call PauseGameLogic @@ -72,9 +70,8 @@ Link_SaveGame: ; 14ab2 .refused ret -; 14ac2 -MoveMonWOMail_SaveGame: ; 14ac2 +MoveMonWOMail_SaveGame: call PauseGameLogic push de call SaveBox @@ -84,16 +81,15 @@ MoveMonWOMail_SaveGame: ; 14ac2 call LoadBox call ResumeGameLogic ret -; 14ad5 -MoveMonWOMail_InsertMon_SaveGame: ; 14ad5 +MoveMonWOMail_InsertMon_SaveGame: call PauseGameLogic push de call SaveBox pop de ld a, e ld [wCurBox], a - ld a, $1 + ld a, TRUE ld [wSaveFileExists], a farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -117,9 +113,8 @@ MoveMonWOMail_InsertMon_SaveGame: ; 14ad5 ld c, 24 call DelayFrames ret -; 14b34 -StartMoveMonWOMail_SaveGame: ; 14b34 +StartMoveMonWOMail_SaveGame: ld hl, Text_SaveOnMoveMonWOMail call MenuTextBox call YesNoBox @@ -136,22 +131,18 @@ StartMoveMonWOMail_SaveGame: ; 14b34 .refused scf ret -; 14b54 -PauseGameLogic: ; 14b54 +PauseGameLogic: ld a, $1 ld [wGameLogicPaused], a ret -; 14b5a -ResumeGameLogic: ; 14b5a +ResumeGameLogic: xor a ld [wGameLogicPaused], a ret -; 14b5f - -AddHallOfFameEntry: ; 14b5f +AddHallOfFameEntry: ld a, BANK(sHallOfFame) call GetSRAMBank ld hl, sHallOfFame + HOF_LENGTH * (NUM_HOF_TEAMS - 1) - 1 @@ -171,14 +162,12 @@ AddHallOfFameEntry: ; 14b5f call CopyBytes call CloseSRAM ret -; 14b85 -SaveGameData: ; 14b85 +SaveGameData: call SaveGameData_ ret -; 14b89 -AskOverwriteSaveFile: ; 14b89 +AskOverwriteSaveFile: ld a, [wSaveFileExists] and a jr z, .erase @@ -205,9 +194,8 @@ AskOverwriteSaveFile: ; 14b89 .refused scf ret -; 14baf -SaveTheGame_yesorno: ; 14baf +SaveTheGame_yesorno: ld b, BANK(Text_WouldYouLikeToSaveTheGame) call MapTextbox call LoadMenuTextBox @@ -221,9 +209,8 @@ SaveTheGame_yesorno: ; 14baf pop af and a ret -; 14bcb -CompareLoadedAndSavedPlayerID: ; 14bcb +CompareLoadedAndSavedPlayerID: ld a, BANK(sPlayerData) call GetSRAMBank ld hl, sPlayerData + (wPlayerID - wPlayerData) @@ -237,11 +224,10 @@ CompareLoadedAndSavedPlayerID: ; 14bcb ld a, [wPlayerID + 1] cp c ret -; 14be3 -_SavingDontTurnOffThePower: ; 14be3 +_SavingDontTurnOffThePower: call SavingDontTurnOffThePower -SavedTheGame: ; 14be6 +SavedTheGame: call SaveGameData_ ; wait 32 frames ld c, $20 @@ -265,11 +251,9 @@ SavedTheGame: ; 14be6 ld c, $1e call DelayFrames ret -; 14c10 - -SaveGameData_: ; 14c10 - ld a, 1 +SaveGameData_: + ld a, TRUE ld [wSaveFileExists], a farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -298,9 +282,8 @@ SaveGameData_: ; 14c10 .ok call CloseSRAM ret -; 14c6b -UpdateStackTop: ; 14c6b +UpdateStackTop: ; sStackTop appears to be unused. ; It could have been used to debug stack overflow during saving. call FindStackTop @@ -327,9 +310,8 @@ UpdateStackTop: ; 14c6b .done call CloseSRAM ret -; 14c90 -FindStackTop: ; 14c90 +FindStackTop: ; Find the furthest point that sp has traversed to. ; This is distinct from the current value of sp. ld hl, wStack - $ff @@ -339,9 +321,8 @@ FindStackTop: ; 14c90 ret nz inc hl jr .loop -; 14c99 -SavingDontTurnOffThePower: ; 14c99 +SavingDontTurnOffThePower: ; Prevent joypad interrupts xor a ld [hJoypadReleased], a @@ -364,10 +345,8 @@ SavingDontTurnOffThePower: ; 14c99 ld c, $10 call DelayFrames ret -; 14cbb - -ErasePreviousSave: ; 14cbb +ErasePreviousSave: call EraseBoxes call EraseHallOfFame call EraseLinkBattleStats @@ -383,9 +362,8 @@ ErasePreviousSave: ; 14cbb ld a, $1 ld [wSavedAtLeastOnce], a ret -; 14ce2 -EraseLinkBattleStats: ; 14ce2 +EraseLinkBattleStats: ld a, BANK(sLinkBattleStats) call GetSRAMBank ld hl, sLinkBattleStats @@ -393,9 +371,8 @@ EraseLinkBattleStats: ; 14ce2 xor a call ByteFill jp CloseSRAM -; 14cf4 -EraseMysteryGift: ; 14cf4 +EraseMysteryGift: ld a, BANK(sBackupMysteryGiftItem) call GetSRAMBank ld hl, sBackupMysteryGiftItem @@ -403,9 +380,8 @@ EraseMysteryGift: ; 14cf4 xor a call ByteFill jp CloseSRAM -; 14d06 -EraseHallOfFame: ; 14d06 +EraseHallOfFame: ld a, BANK(sHallOfFame) call GetSRAMBank ld hl, sHallOfFame @@ -413,9 +389,8 @@ EraseHallOfFame: ; 14d06 xor a call ByteFill jp CloseSRAM -; 14d18 -Unreferenced_Function14d18: ; 14d18 +Unreferenced_Function14d18: ; copy .Data to SRA4:a007 ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank @@ -424,9 +399,8 @@ Unreferenced_Function14d18: ; 14d18 ld bc, .DataEnd - .Data call CopyBytes jp CloseSRAM -; 14d2c -.Data: ; 14d2c +.Data: db $0d, $02, $00, $05, $00, $00 db $22, $02, $01, $05, $00, $00 db $03, $04, $05, $08, $03, $05 @@ -435,23 +409,20 @@ Unreferenced_Function14d18: ; 14d18 db $04, $07, $01, $05, $00, $00 db $0f, $05, $14, $07, $05, $05 db $11, $0c, $0c, $06, $06, $04 -; 14d5c .DataEnd -EraseBattleTowerStatus: ; 14d5c +EraseBattleTowerStatus: ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank xor a ld [sBattleTowerChallengeState], a jp CloseSRAM -; 14d68 -SaveData: ; 14d68 +SaveData: call _SaveData ret -; 14d6c -Unreferenced_Function14d6c: ; 14d6c +Unreferenced_Function14d6c: ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld a, [$a60b] ; address of MBC30 bank @@ -465,9 +436,8 @@ Unreferenced_Function14d6c: ; 14d6c ld [$a60b], a ; address of MBC30 bank call CloseSRAM ret -; 14d83 -Unreferenced_Function14d83: ; 14d83 +Unreferenced_Function14d83: ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank xor a @@ -475,27 +445,23 @@ Unreferenced_Function14d83: ; 14d83 ld [$a60d], a ; address of MBC30 bank call CloseSRAM ret -; 14d93 -Unreferenced_Function14d93: ; 14d93 +Unreferenced_Function14d93: ld a, 7 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank xor a ld [$a000], a ; address of MBC30 bank call CloseSRAM ret -; 14da0 - -HallOfFame_InitSaveIfNeeded: ; 14da0 +HallOfFame_InitSaveIfNeeded: ld a, [wSavedAtLeastOnce] and a ret nz call ErasePreviousSave ret -; 14da9 -ValidateSave: ; 14da9 +ValidateSave: ld a, BANK(sCheckValue1) ; BANK(sCheckValue2) call GetSRAMBank ld a, SAVE_CHECK_VALUE_1 @@ -503,9 +469,8 @@ ValidateSave: ; 14da9 ld a, SAVE_CHECK_VALUE_2 ld [sCheckValue2], a jp CloseSRAM -; 14dbb -SaveOptions: ; 14dbb +SaveOptions: ld a, BANK(sOptions) call GetSRAMBank ld hl, wOptions @@ -516,9 +481,8 @@ SaveOptions: ; 14dbb and $ff ^ (1 << NO_TEXT_SCROLL) ld [sOptions], a jp CloseSRAM -; 14dd7 -SavePlayerData: ; 14dd7 +SavePlayerData: ld a, BANK(sPlayerData) call GetSRAMBank ld hl, wPlayerData @@ -530,9 +494,8 @@ SavePlayerData: ; 14dd7 ld bc, wCurrMapDataEnd - wCurrMapData call CopyBytes jp CloseSRAM -; 14df7 -SavePokemonData: ; 14df7 +SavePokemonData: ld a, BANK(sPokemonData) call GetSRAMBank ld hl, wPokemonData @@ -541,15 +504,13 @@ SavePokemonData: ; 14df7 call CopyBytes call CloseSRAM ret -; 14e0c -SaveBox: ; 14e0c +SaveBox: call GetBoxAddress call SaveBoxAddress ret -; 14e13 -SaveChecksum: ; 14e13 +SaveChecksum: ld hl, sGameData ld bc, sGameDataEnd - sGameData ld a, BANK(sGameData) @@ -561,9 +522,8 @@ SaveChecksum: ; 14e13 ld [sChecksum + 1], a call CloseSRAM ret -; 14e2d -ValidateBackupSave: ; 14e2d +ValidateBackupSave: ld a, BANK(sBackupCheckValue1) ; BANK(sBackupCheckValue2) call GetSRAMBank ld a, SAVE_CHECK_VALUE_1 @@ -572,9 +532,8 @@ ValidateBackupSave: ; 14e2d ld [sBackupCheckValue2], a call CloseSRAM ret -; 14e40 -SaveBackupOptions: ; 14e40 +SaveBackupOptions: ld a, BANK(sBackupOptions) call GetSRAMBank ld hl, wOptions @@ -583,9 +542,8 @@ SaveBackupOptions: ; 14e40 call CopyBytes call CloseSRAM ret -; 14e55 -SaveBackupPlayerData: ; 14e55 +SaveBackupPlayerData: ld a, BANK(sBackupPlayerData) call GetSRAMBank ld hl, wPlayerData @@ -598,9 +556,8 @@ SaveBackupPlayerData: ; 14e55 call CopyBytes call CloseSRAM ret -; 14e76 -SaveBackupPokemonData: ; 14e76 +SaveBackupPokemonData: ld a, BANK(sBackupPokemonData) call GetSRAMBank ld hl, wPokemonData @@ -609,9 +566,8 @@ SaveBackupPokemonData: ; 14e76 call CopyBytes call CloseSRAM ret -; 14e8b -SaveBackupChecksum: ; 14e8b +SaveBackupChecksum: ld hl, sBackupGameData ld bc, sBackupGameDataEnd - sBackupGameData ld a, BANK(sBackupGameData) @@ -623,10 +579,8 @@ SaveBackupChecksum: ; 14e8b ld [sBackupChecksum + 1], a call CloseSRAM ret -; 14ea5 - -TryLoadSaveFile: ; 14ea5 (5:4ea5) +TryLoadSaveFile: call VerifyChecksum jr nz, .backup call LoadPlayerData @@ -672,9 +626,8 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5) scf ret - -TryLoadSaveData: ; 14f1c - xor a +TryLoadSaveData: + xor a ; FALSE ld [wSaveFileExists], a call CheckPrimarySaveFile ld a, [wSaveFileExists] @@ -720,13 +673,10 @@ TryLoadSaveData: ; 14f1c call CopyBytes call PanicResetClock ret -; 14f7c - INCLUDE "data/default_options.asm" - -CheckPrimarySaveFile: ; 14f84 +CheckPrimarySaveFile: ld a, BANK(sCheckValue1) ; BANK(sCheckValue2) call GetSRAMBank ld a, [sCheckValue1] @@ -740,15 +690,14 @@ CheckPrimarySaveFile: ; 14f84 ld bc, wOptionsEnd - wOptions call CopyBytes call CloseSRAM - ld a, $1 + ld a, TRUE ld [wSaveFileExists], a .nope call CloseSRAM ret -; 14faf -CheckBackupSaveFile: ; 14faf +CheckBackupSaveFile: ld a, BANK(sBackupCheckValue1) ; BANK(sBackupCheckValue2) call GetSRAMBank ld a, [sBackupCheckValue1] @@ -767,10 +716,8 @@ CheckBackupSaveFile: ; 14faf .nope call CloseSRAM ret -; 14fd7 - -LoadPlayerData: ; 14fd7 (5:4fd7) +LoadPlayerData: ld a, BANK(sPlayerData) call GetSRAMBank ld hl, sPlayerData @@ -793,7 +740,7 @@ LoadPlayerData: ; 14fd7 (5:4fd7) call CloseSRAM ret -LoadPokemonData: ; 1500c +LoadPokemonData: ld a, BANK(sPokemonData) call GetSRAMBank ld hl, sPokemonData @@ -802,14 +749,13 @@ LoadPokemonData: ; 1500c call CopyBytes call CloseSRAM ret -; 15021 -LoadBox: ; 15021 (5:5021) +LoadBox: call GetBoxAddress call LoadBoxAddress ret -VerifyChecksum: ; 15028 (5:5028) +VerifyChecksum: ld hl, sGameData ld bc, sGameDataEnd - sGameData ld a, BANK(sGameData) @@ -826,7 +772,7 @@ VerifyChecksum: ; 15028 (5:5028) pop af ret -LoadBackupPlayerData: ; 15046 (5:5046) +LoadBackupPlayerData: ld a, BANK(sBackupPlayerData) call GetSRAMBank ld hl, sBackupPlayerData @@ -840,7 +786,7 @@ LoadBackupPlayerData: ; 15046 (5:5046) call CloseSRAM ret -LoadBackupPokemonData: ; 15067 (5:5067) +LoadBackupPokemonData: ld a, BANK(sBackupPokemonData) call GetSRAMBank ld hl, sBackupPokemonData @@ -850,7 +796,7 @@ LoadBackupPokemonData: ; 15067 (5:5067) call CloseSRAM ret -VerifyBackupChecksum: ; 1507c (5:507c) +VerifyBackupChecksum: ld hl, sBackupGameData ld bc, sBackupGameDataEnd - sBackupGameData ld a, BANK(sBackupGameData) @@ -867,8 +813,7 @@ VerifyBackupChecksum: ; 1507c (5:507c) pop af ret - -_SaveData: ; 1509a +_SaveData: ; This is called within two scenarios: ; a) ErasePreviousSave (the process of erasing the save from a previous game file) ; b) unused mobile functionality @@ -894,8 +839,7 @@ _SaveData: ; 1509a jp CloseSRAM - -_LoadData: ; 150b9 +_LoadData: ld a, BANK(sCrystalData) call GetSRAMBank ld hl, sCrystalData @@ -914,8 +858,7 @@ _LoadData: ; 150b9 jp CloseSRAM - -GetBoxAddress: ; 150d8 +GetBoxAddress: ld a, [wCurBox] cp NUM_BOXES jr c, .ok @@ -940,9 +883,8 @@ endr ld l, a pop af ret -; 150f9 -SaveBoxAddress: ; 150f9 +SaveBoxAddress: ; Save box via wBoxPartialData. ; We do this in three steps because the size of wBoxPartialData is less than ; the size of sBox. @@ -1016,10 +958,8 @@ SaveBoxAddress: ; 150f9 pop hl ret -; 1517d - -LoadBoxAddress: ; 1517d (5:517d) +LoadBoxAddress: ; Load box via wBoxPartialData. ; We do this in three steps because the size of wBoxPartialData is less than ; the size of sBox. @@ -1082,8 +1022,7 @@ LoadBoxAddress: ; 1517d (5:517d) pop hl ret - -EraseBoxes: ; 151fb +EraseBoxes: ld hl, BoxAddresses ld c, NUM_BOXES .next @@ -1123,9 +1062,8 @@ EraseBoxes: ; 151fb dec c jr nz, .next ret -; 1522d -BoxAddresses: ; 1522d +BoxAddresses: ; dbww bank, address, address dbww BANK(sBox1), sBox1, sBox1End dbww BANK(sBox2), sBox2, sBox2End @@ -1141,10 +1079,8 @@ BoxAddresses: ; 1522d dbww BANK(sBox12), sBox12, sBox12End dbww BANK(sBox13), sBox13, sBox13End dbww BANK(sBox14), sBox14, sBox14End -; 15273 - -Checksum: ; 15273 +Checksum: ld de, 0 .loop ld a, [hli] @@ -1158,53 +1094,43 @@ Checksum: ; 15273 or c jr nz, .loop ret -; 15283 - -Text_WouldYouLikeToSaveTheGame: ; 0x15283 +Text_WouldYouLikeToSaveTheGame: ; Would you like to save the game? text_jump UnknownText_0x1c454b db "@" -; 0x15288 -Text_SavingDontTurnOffThePower: ; 0x15288 +Text_SavingDontTurnOffThePower: ; SAVING… DON'T TURN OFF THE POWER. text_jump UnknownText_0x1c456d db "@" -; 0x1528d -Text_PlayerSavedTheGame: ; 0x1528d +Text_PlayerSavedTheGame: ; saved the game. text_jump UnknownText_0x1c4590 db "@" -; 0x15292 -Text_AlreadyASaveFile: ; 0x15292 +Text_AlreadyASaveFile: ; There is already a save file. Is it OK to overwrite? text_jump UnknownText_0x1c45a3 db "@" -; 0x15297 -Text_AnotherSaveFile: ; 0x15297 +Text_AnotherSaveFile: ; There is another save file. Is it OK to overwrite? text_jump UnknownText_0x1c45d9 db "@" -; 0x1529c -Text_SaveFileCorrupted: ; 0x1529c +Text_SaveFileCorrupted: ; The save file is corrupted! text_jump UnknownText_0x1c460d db "@" -; 0x152a1 -Text_SaveOnBoxSwitch: ; 0x152a1 +Text_SaveOnBoxSwitch: ; When you change a #MON BOX, data will be saved. OK? text_jump UnknownText_0x1c462a db "@" -; 0x152a6 -Text_SaveOnMoveMonWOMail: ; 0x152a6 +Text_SaveOnMoveMonWOMail: ; Each time you move a #MON, data will be saved. OK? text_jump UnknownText_0x1c465f db "@" -; 0x152ab diff --git a/engine/menus/savemenu_copytilemapatonce.asm b/engine/menus/savemenu_copytilemapatonce.asm index 9b50494a4..8271603d9 100644 --- a/engine/menus/savemenu_copytilemapatonce.asm +++ b/engine/menus/savemenu_copytilemapatonce.asm @@ -1,4 +1,4 @@ -SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45) +SaveMenu_CopyTilemapAtOnce: ld a, [hCGB] and a jp z, WaitBGMap @@ -38,7 +38,7 @@ SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45) ld [hBGMapMode], a ret -.CopyTilemapAtOnce: ; 4cf80 (13:4f80) +.CopyTilemapAtOnce: ld [hSPBuffer], sp ; $ffd9 ld sp, hl ld a, [hBGMapAddress + 1] diff --git a/engine/menus/scrolling_menu.asm b/engine/menus/scrolling_menu.asm index 3be3d839c..a313c6646 100644 --- a/engine/menus/scrolling_menu.asm +++ b/engine/menus/scrolling_menu.asm @@ -1,4 +1,4 @@ -_InitScrollingMenu:: ; 245af +_InitScrollingMenu:: xor a ld [wMenuJoypad], a ld [hBGMapMode], a @@ -12,25 +12,22 @@ _InitScrollingMenu:: ; 245af xor a ld [hBGMapMode], a ret -; 245cb -_ScrollingMenu:: ; 245cb +_ScrollingMenu:: .loop call ScrollingMenuJoyAction jp c, .exit call z, .zero jr .loop -; 245d6 -.exit ; 245d6 +.exit call MenuClickSound ld [wMenuJoypad], a ld a, 0 ld [hInMenu], a ret -; 245e1 -.zero ; 245e1 +.zero call ScrollingMenu_InitDisplay ld a, 1 ld [hBGMapMode], a @@ -39,9 +36,8 @@ _ScrollingMenu:: ; 245cb xor a ld [hBGMapMode], a ret -; 245f1 -ScrollingMenu_InitDisplay: ; 245f1 +ScrollingMenu_InitDisplay: xor a ld [hBGMapMode], a ld hl, wOptions @@ -54,9 +50,8 @@ ScrollingMenu_InitDisplay: ; 245f1 pop af ld [wOptions], a ret -; 24609 -ScrollingMenuJoyAction: ; 24609 +ScrollingMenuJoyAction: .loop call ScrollingMenuJoypad ld a, [hJoyLast] @@ -82,15 +77,13 @@ ScrollingMenuJoyAction: ; 24609 bit D_DOWN_F, a jp nz, .d_down jr .loop -; 24640 .unreferenced ; unused ld a, -1 and a ret -; 24644 -.a_button ; 24644 +.a_button call PlaceHollowCursor ld a, [wMenuCursorY] dec a @@ -109,15 +102,13 @@ ScrollingMenuJoyAction: ; 24609 ld a, A_BUTTON scf ret -; 2466f -.b_button ; 2466f +.b_button ld a, B_BUTTON scf ret -; 24673 -.select ; 24673 +.select ld a, [wMenuDataFlags] bit 7, a jp z, xor_a_dec_a @@ -133,18 +124,16 @@ ScrollingMenuJoyAction: ; 24609 ld a, SELECT scf ret -; 24695 -.start ; 24695 +.start ld a, [wMenuDataFlags] bit 6, a jp z, xor_a_dec_a ld a, START scf ret -; 246a1 -.d_left ; 246a1 +.d_left ld hl, w2DMenuFlags2 bit 7, [hl] jp z, xor_a_dec_a @@ -154,9 +143,8 @@ ScrollingMenuJoyAction: ; 24609 ld a, D_LEFT scf ret -; 246b5 -.d_right ; 246b5 +.d_right ld hl, w2DMenuFlags2 bit 7, [hl] jp z, xor_a_dec_a @@ -166,9 +154,8 @@ ScrollingMenuJoyAction: ; 24609 ld a, D_RIGHT scf ret -; 246c9 -.d_up ; 246c9 +.d_up ld hl, w2DMenuFlags2 bit 7, [hl] jp z, xor_a @@ -181,9 +168,8 @@ ScrollingMenuJoyAction: ; 24609 .xor_dec_up jp xor_a_dec_a -; 246df -.d_down ; 246df +.d_down ld hl, w2DMenuFlags2 bit 7, [hl] jp z, xor_a @@ -199,18 +185,16 @@ ScrollingMenuJoyAction: ; 24609 .xor_dec_down jp xor_a_dec_a -; 246fc -ScrollingMenu_GetCursorPosition: ; 246fc +ScrollingMenu_GetCursorPosition: ld a, [wMenuScrollPosition] ld c, a ld a, [wMenuCursorY] add c ld c, a ret -; 24706 -ScrollingMenu_ClearLeftColumn: ; 24706 (9:4706) +ScrollingMenu_ClearLeftColumn: call MenuBoxCoord2Tile ld de, SCREEN_WIDTH add hl, de @@ -223,7 +207,7 @@ ScrollingMenu_ClearLeftColumn: ; 24706 (9:4706) jr nz, .loop ret -InitScrollingMenuCursor: ; 2471a +InitScrollingMenuCursor: ld hl, wMenuData_ItemsPointerAddr ld a, [hli] ld h, [hl] @@ -271,9 +255,8 @@ InitScrollingMenuCursor: ; 2471a .asm_24763 ret -; 24764 -ScrollingMenu_InitFlags: ; 24764 +ScrollingMenu_InitFlags: ld a, [wMenuDataFlags] ld c, a ld a, [wScrollingMenuListSize] @@ -343,9 +326,8 @@ ScrollingMenu_InitFlags: ; 24764 ld [wCursorCurrentTile + 1], a ld [wCursorOffCharacter], a ret -; 247dd -ScrollingMenu_ValidateSwitchItem: ; 247dd +ScrollingMenu_ValidateSwitchItem: ld a, [wScrollingMenuListSize] ld c, a ld a, [wSwitchItem] @@ -359,9 +341,8 @@ ScrollingMenu_ValidateSwitchItem: ; 247dd .done ret -; 247f0 -ScrollingMenu_UpdateDisplay: ; 247f0 +ScrollingMenu_UpdateDisplay: call ClearWholeMenuBox ld a, [wMenuDataFlags] bit 4, a ; place arrows @@ -432,9 +413,8 @@ ScrollingMenu_UpdateDisplay: ; 247f0 ld e, l ld hl, wMenuData_ScrollingMenuFunction1 jp CallPointerAt -; 2486e -ScrollingMenu_CallFunctions1and2: ; 2486e +ScrollingMenu_CallFunctions1and2: push hl ld d, h ld e, l @@ -454,9 +434,8 @@ ScrollingMenu_CallFunctions1and2: ; 2486e .done ret -; 2488b -ScrollingMenu_PlaceCursor: ; 2488b +ScrollingMenu_PlaceCursor: ld a, [wSwitchItem] and a jr z, .done @@ -486,9 +465,8 @@ ScrollingMenu_PlaceCursor: ; 2488b .done ret -; 248b8 -ScrollingMenu_CheckCallFunction3: ; 248b8 +ScrollingMenu_CheckCallFunction3: ld a, [wMenuDataFlags] bit 5, a ; call function 3 ret z @@ -505,9 +483,8 @@ ScrollingMenu_CheckCallFunction3: ; 248b8 ld hl, wMenuData_ScrollingMenuFunction3 call CallPointerAt ret -; 248d5 -ScrollingMenu_GetListItemCoordAndFunctionArgs: ; 248d5 +ScrollingMenu_GetListItemCoordAndFunctionArgs: push de push hl ld e, a @@ -540,4 +517,3 @@ ScrollingMenu_GetListItemCoordAndFunctionArgs: ; 248d5 pop hl pop de ret -; 2490c diff --git a/engine/menus/start_menu.asm b/engine/menus/start_menu.asm index 037efd947..108a4edf6 100644 --- a/engine/menus/start_menu.asm +++ b/engine/menus/start_menu.asm @@ -10,9 +10,7 @@ const STARTMENUITEM_POKEGEAR ; 7 const STARTMENUITEM_QUIT ; 8 - -StartMenu:: ; 125cd - +StartMenu:: call ClearWindowData ld de, SFX_MENU @@ -25,8 +23,8 @@ StartMenu:: ; 125cd ld hl, .MenuHeader jr z, .GotMenuData ld hl, .ContestMenuHeader -.GotMenuData: +.GotMenuData: call LoadMenuHeader call .SetUpMenuItems ld a, [wBattleMenuCursorBuffer] @@ -118,23 +116,20 @@ StartMenu:: ; 125cd .b scf ret -; 12691 -.ExitMenuRunScript: ; 12691 +.ExitMenuRunScript: call ExitMenu ld a, HMENURETURN_SCRIPT ld [hMenuReturn], a ret -; 12699 -.ExitMenuRunScriptCloseText: ; 12699 +.ExitMenuRunScriptCloseText: call ExitMenu ld a, HMENURETURN_SCRIPT ld [hMenuReturn], a jr .ReturnEnd2 -; 126a2 -.ExitMenuCallFuncCloseText: ; 126a2 +.ExitMenuCallFuncCloseText: call ExitMenu ld hl, wQueuedScriptAddr ld a, [hli] @@ -143,14 +138,12 @@ StartMenu:: ; 125cd ld a, [wQueuedScriptBank] rst FarCall jr .ReturnEnd2 -; 126b1 -.ReturnRedraw: ; 126b1 +.ReturnRedraw: call .Clear jp .Reopen -; 126b7 -.Clear: ; 126b7 +.Clear: call ClearBGPalettes call Call_ExitMenu call ReloadTilesetAndPalettes @@ -161,8 +154,6 @@ StartMenu:: ; 125cd call ret_d90 call FinishExitMenu ret -; 126d3 - .MenuHeader: db MENU_BACKUP_TILES ; flags @@ -241,17 +232,15 @@ StartMenu:: ; 125cd db "Quit and" next "be judged.@" - -.OpenMenu: ; 127e5 +.OpenMenu: ld a, [wMenuSelection] call .GetMenuAccountTextPointer ld a, [hli] ld h, [hl] ld l, a jp hl -; 127ef -.MenuString: ; 127ef +.MenuString: push de ld a, [wMenuSelection] call .GetMenuAccountTextPointer @@ -263,9 +252,8 @@ StartMenu:: ; 125cd pop hl call PlaceString ret -; 12800 -.MenuDesc: ; 12800 +.MenuDesc: push de ld a, [wMenuSelection] cp $ff @@ -283,10 +271,8 @@ endr .none pop de ret -; 12819 - -.GetMenuAccountTextPointer: ; 12819 +.GetMenuAccountTextPointer: ld e, a ld d, 0 ld hl, wMenuDataPointerTableAddr @@ -297,10 +283,8 @@ rept 6 add hl, de endr ret -; 12829 - -.SetUpMenuItems: ; 12829 +.SetUpMenuItems: xor a ld [wWhichIndexSet], a call .FillMenuList @@ -358,10 +342,8 @@ endr ld a, c ld [wMenuItemsList], a ret -; 1288d - -.FillMenuList: ; 1288d +.FillMenuList: xor a ld hl, wMenuItemsList ld [hli], a @@ -371,28 +353,24 @@ endr ld de, wMenuItemsList + 1 ld c, 0 ret -; 128a0 -.AppendMenuList: ; 128a0 +.AppendMenuList: ld [de], a inc de inc c ret -; 128a4 -.DrawMenuAccount_: ; 128a4 +.DrawMenuAccount_: jp .DrawMenuAccount -; 128a7 -.PrintMenuAccount: ; 128a7 +.PrintMenuAccount: call .IsMenuAccountOn ret z call .DrawMenuAccount decoord 0, 14 jp .MenuDesc -; 128b4 -.DrawMenuAccount: ; 128b4 +.DrawMenuAccount: call .IsMenuAccountOn ret z hlcoord 0, 13 @@ -402,23 +380,20 @@ endr ld b, 3 ld c, 8 jp TextBoxPalette -; 128cb -.IsMenuAccountOn: ; 128cb +.IsMenuAccountOn: ld a, [wOptions2] and 1 << MENU_ACCOUNT ret -; 128d1 -.DrawBugContestStatusBox: ; 128d1 +.DrawBugContestStatusBox: ld hl, wStatusFlags2 bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl] ret z farcall StartMenu_DrawBugContestStatusBox ret -; 128de -.DrawBugContestStatus: ; 128de +.DrawBugContestStatus: ld hl, wStatusFlags2 bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl] jr nz, .contest @@ -426,18 +401,14 @@ endr .contest farcall StartMenu_PrintBugContestStatus ret -; 128ed - -StartMenu_Exit: ; 128ed +StartMenu_Exit: ; Exit the menu. ld a, 1 ret -; 128f0 - -StartMenu_Quit: ; 128f0 +StartMenu_Quit: ; Retire from the bug catching contest. ld hl, .EndTheContestText @@ -456,10 +427,8 @@ StartMenu_Quit: ; 128f0 .EndTheContestText: text_jump UnknownText_0x1c1a6c db "@" -; 1290b - -StartMenu_Save: ; 1290b +StartMenu_Save: ; Save the game. call BufferScreen @@ -470,20 +439,16 @@ StartMenu_Save: ; 1290b .asm_12919 ld a, 1 ret -; 1291c - -StartMenu_Option: ; 1291c +StartMenu_Option: ; Game options. call FadeToMenu farcall OptionsMenu ld a, 6 ret -; 12928 - -StartMenu_Status: ; 12928 +StartMenu_Status: ; Player status. call FadeToMenu @@ -491,11 +456,8 @@ StartMenu_Status: ; 12928 call CloseSubmenu ld a, 0 ret -; 12937 - - -StartMenu_Pokedex: ; 12937 +StartMenu_Pokedex: ld a, [wPartyCount] and a jr z, .asm_12949 @@ -507,21 +469,15 @@ StartMenu_Pokedex: ; 12937 .asm_12949 ld a, 0 ret -; 1294c - - -StartMenu_Pokegear: ; 1294c +StartMenu_Pokegear: call FadeToMenu farcall PokeGear call CloseSubmenu ld a, 0 ret -; 1295b - - -StartMenu_Pack: ; 1295b +StartMenu_Pack: call FadeToMenu farcall Pack ld a, [wPackUsedItem] @@ -535,11 +491,8 @@ StartMenu_Pack: ; 1295b call ExitAllMenus ld a, 4 ret -; 12976 - - -StartMenu_Pokemon: ; 12976 +StartMenu_Pokemon: ld a, [wPartyCount] and a jr z, .return @@ -586,9 +539,8 @@ StartMenu_Pokemon: ; 12976 call ExitAllMenus pop af ret -; 129d5 -HasNoItems: ; 129d5 +HasNoItems: ld a, [wNumItems] and a ret nz @@ -612,7 +564,7 @@ HasNoItems: ; 129d5 and a ret -TossItemFromPC: ; 129f4 +TossItemFromPC: push de call PartyMonItemName farcall _CheckTossableItem @@ -675,38 +627,30 @@ TossItemFromPC: ; 129f4 ; That's too impor- tant to toss out! text_jump UnknownText_0x1c1adf db "@" -; 0x12a60 -CantUseItem: ; 12a60 +CantUseItem: ld hl, CantUseItemText call MenuTextBoxWaitButton ret -; 12a67 -CantUseItemText: ; 12a67 +CantUseItemText: text_jump UnknownText_0x1c1b03 db "@" -; 12a6c - -PartyMonItemName: ; 12a6c +PartyMonItemName: ld a, [wCurItem] ld [wd265], a call GetItemName call CopyName1 ret -; 12a79 - -CancelPokemonAction: ; 12a79 +CancelPokemonAction: farcall InitPartyMenuWithCancel farcall UnfreezeMonIcons ld a, 1 ret -; 12a88 - -PokemonActionSubmenu: ; 12a88 +PokemonActionSubmenu: hlcoord 1, 15 lb bc, 2, 18 call ClearBox @@ -749,11 +693,8 @@ PokemonActionSubmenu: ; 12a88 dbw MONMENUITEM_CANCEL, CancelPokemonAction dbw MONMENUITEM_MOVE, ManagePokemonMoves dbw MONMENUITEM_MAIL, MonMailAction -; 12aec - - -SwitchPartyMons: ; 12aec +SwitchPartyMons: ; Don't try if there's nothing to switch! ld a, [wPartyCount] cp 2 @@ -802,11 +743,8 @@ SwitchPartyMons: ; 12aec ld [wPartyMenuActionText], a call CancelPokemonAction ret -; 12b60 - - -GiveTakePartyMonItem: ; 12b60 +GiveTakePartyMonItem: ; Eggs can't hold items! ld a, [wCurPartySpecies] cp EGG @@ -844,11 +782,8 @@ GiveTakePartyMonItem: ; 12b60 .cancel ld a, 3 ret -; 12ba9 - .GiveItem: - farcall DepositSellInitPackBuffers .loop @@ -877,11 +812,8 @@ GiveTakePartyMonItem: ; 12b60 .quit ret -; 12bd9 - - -TryGiveItemToPartymon: ; 12bd9 +TryGiveItemToPartymon: call SpeechTextBox call PartyMonItemName call GetPartyItemLocation @@ -942,11 +874,8 @@ TryGiveItemToPartymon: ; 12bd9 .abort ret -; 12c4c - - -GivePartyItem: ; 12c4c +GivePartyItem: call GetPartyItemLocation ld a, [wCurItem] ld [hl], a @@ -957,11 +886,8 @@ GivePartyItem: ; 12c4c .done ret -; 12c60 - - -TakePartyItem: ; 12c60 +TakePartyItem: call SpeechTextBox call GetPartyItemLocation ld a, [hl] @@ -993,10 +919,8 @@ TakePartyItem: ; 12c60 .asm_12c9a ret -; 12c9b - -GiveTakeItemMenuData: ; 12c9b +GiveTakeItemMenuData: db MENU_SPRITE_ANIMS | MENU_BACKUP_TILES ; flags menu_coords 12, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .Items @@ -1007,81 +931,64 @@ GiveTakeItemMenuData: ; 12c9b db 2 ; # items db "GIVE@" db "TAKE@" -; 12caf - -TookAndMadeHoldText: ; 12caf +TookAndMadeHoldText: text_jump UnknownText_0x1c1b2c db "@" -; 12cb4 -MadeHoldText: ; 12cb4 +MadeHoldText: text_jump UnknownText_0x1c1b57 db "@" -; 12cb9 -PleaseRemoveMailText: ; 12cb9 +PleaseRemoveMailText: text_jump UnknownText_0x1c1b6f db "@" -; 12cbe -IsntHoldingAnythingText: ; 12cbe +IsntHoldingAnythingText: text_jump UnknownText_0x1c1b8e db "@" -; 12cc3 -ItemStorageIsFullText: ; 12cc3 +ItemStorageIsFullText: text_jump UnknownText_0x1c1baa db "@" -; 12cc8 -TookFromText: ; 12cc8 +TookFromText: text_jump UnknownText_0x1c1bc4 db "@" -; 12ccd -SwitchAlreadyHoldingText: ; 12ccd +SwitchAlreadyHoldingText: text_jump UnknownText_0x1c1bdc db "@" -; 12cd2 -CantBeHeldText: ; 12cd2 +CantBeHeldText: text_jump UnknownText_0x1c1c09 db "@" -; 12cd7 - -GetPartyItemLocation: ; 12cd7 +GetPartyItemLocation: push af ld a, MON_ITEM call GetPartyParamLocation pop af ret -; 12cdf - -ReceiveItemFromPokemon: ; 12cdf +ReceiveItemFromPokemon: ld a, 1 ld [wItemQuantityChangeBuffer], a ld hl, wNumItems jp ReceiveItem -; 12cea - -GiveItemToPokemon: ; 12cea (4:6cea) +GiveItemToPokemon: ld a, 1 ld [wItemQuantityChangeBuffer], a ld hl, wNumItems jp TossItem -StartMenuYesNo: ; 12cf5 +StartMenuYesNo: call MenuTextBox call YesNoBox jp ExitMenu -; 12cfe - -ComposeMailMessage: ; 12cfe (4:6cfe) +ComposeMailMessage: ld de, wTempMailMessage farcall _ComposeMailMessage ld hl, wPlayerName @@ -1110,7 +1017,7 @@ ComposeMailMessage: ; 12cfe (4:6cfe) call CloseSRAM ret -MonMailAction: ; 12d45 +MonMailAction: ; If in the time capsule or trade center, ; selecting the mail only allows you to ; read the mail. @@ -1181,15 +1088,12 @@ MonMailAction: ; 12d45 .done ld a, $3 ret -; 12dc9 - .MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 12, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData db 1 ; default option -; 0x12dd1 .MenuData: db STATICMENU_CURSOR ; flags @@ -1197,47 +1101,38 @@ MonMailAction: ; 12d45 db "READ@" db "TAKE@" db "QUIT@" -; 0x12de2 - .mailwilllosemessagetext ; The MAIL will lose its message. OK? text_jump UnknownText_0x1c1c22 db "@" -; 0x12de7 .tookmailfrommontext ; MAIL detached from <POKEMON>. text_jump UnknownText_0x1c1c47 db "@" -; 0x12dec .bagfulltext ; There's no space for removing MAIL. text_jump UnknownText_0x1c1c62 db "@" -; 0x12df1 .sendmailtopctext ; Send the removed MAIL to your PC? text_jump UnknownText_0x1c1c86 db "@" -; 0x12df6 .mailboxfulltext ; Your PC's MAILBOX is full. text_jump UnknownText_0x1c1ca9 db "@" -; 0x12dfb .sentmailtopctext ; The MAIL was sent to your PC. text_jump UnknownText_0x1c1cc4 db "@" -; 0x12e00 - -OpenPartyStats: ; 12e00 +OpenPartyStats: call LoadStandardMenuHeader call ClearSprites ; PartyMon @@ -1249,10 +1144,8 @@ OpenPartyStats: ; 12e00 call Call_ExitMenu ld a, 0 ret -; 12e1b - -MonMenu_Cut: ; 12e1b +MonMenu_Cut: farcall CutFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1264,10 +1157,8 @@ MonMenu_Cut: ; 12e1b .Fail: ld a, $3 ret -; 12e30 - -MonMenu_Fly: ; 12e30 +MonMenu_Fly: farcall FlyFunction ld a, [wFieldMoveSucceeded] cp $2 @@ -1290,9 +1181,8 @@ MonMenu_Fly: ; 12e30 .Unreferenced: ld a, $1 ret -; 12e55 -MonMenu_Flash: ; 12e55 +MonMenu_Flash: farcall OWFlash ld a, [wFieldMoveSucceeded] cp $1 @@ -1304,9 +1194,8 @@ MonMenu_Flash: ; 12e55 .Fail: ld a, $3 ret -; 12e6a -MonMenu_Strength: ; 12e6a +MonMenu_Strength: farcall StrengthFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1318,9 +1207,8 @@ MonMenu_Strength: ; 12e6a .Fail: ld a, $3 ret -; 12e7f -MonMenu_Whirlpool: ; 12e7f +MonMenu_Whirlpool: farcall WhirlpoolFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1332,9 +1220,8 @@ MonMenu_Whirlpool: ; 12e7f .Fail: ld a, $3 ret -; 12e94 -MonMenu_Waterfall: ; 12e94 +MonMenu_Waterfall: farcall WaterfallFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1346,9 +1233,8 @@ MonMenu_Waterfall: ; 12e94 .Fail: ld a, $3 ret -; 12ea9 -MonMenu_Teleport: ; 12ea9 +MonMenu_Teleport: farcall TeleportFunction ld a, [wFieldMoveSucceeded] and a @@ -1360,9 +1246,8 @@ MonMenu_Teleport: ; 12ea9 .Fail: ld a, $3 ret -; 12ebd -MonMenu_Surf: ; 12ebd +MonMenu_Surf: farcall SurfFunction ld a, [wFieldMoveSucceeded] and a @@ -1374,9 +1259,8 @@ MonMenu_Surf: ; 12ebd .Fail: ld a, $3 ret -; 12ed1 -MonMenu_Dig: ; 12ed1 +MonMenu_Dig: farcall DigFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1388,9 +1272,8 @@ MonMenu_Dig: ; 12ed1 .Fail: ld a, $3 ret -; 12ee6 -MonMenu_Softboiled_MilkDrink: ; 12ee6 +MonMenu_Softboiled_MilkDrink: call .CheckMonHasEnoughHP jr nc, .NotEnoughHP farcall Softboiled_MilkDrinkFunction @@ -1405,13 +1288,11 @@ MonMenu_Softboiled_MilkDrink: ; 12ee6 ld [wPartyMenuActionText], a ld a, $3 ret -; 12f00 .Text_NotEnoughHP: ; Not enough HP! text_jump UnknownText_0x1c1ce3 db "@" -; 0x12f05 .CheckMonHasEnoughHP: ; Need to have at least (MaxHP / 5) HP left. @@ -1433,9 +1314,8 @@ MonMenu_Softboiled_MilkDrink: ; 12ee6 ld a, [hQuotient + 1] sbc [hl] ret -; 12f26 -MonMenu_Headbutt: ; 12f26 +MonMenu_Headbutt: farcall HeadbuttFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1447,9 +1327,8 @@ MonMenu_Headbutt: ; 12f26 .Fail: ld a, $3 ret -; 12f3b -MonMenu_RockSmash: ; 12f3b +MonMenu_RockSmash: farcall RockSmashFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1461,16 +1340,14 @@ MonMenu_RockSmash: ; 12f3b .Fail: ld a, $3 ret -; 12f50 -MonMenu_SweetScent: ; 12f50 +MonMenu_SweetScent: farcall SweetScentFromMenu ld b, $4 ld a, $2 ret -; 12f5b -ChooseMoveToDelete: ; 12f5b +ChooseMoveToDelete: ld hl, wOptions ld a, [hl] push af @@ -1484,7 +1361,6 @@ ChooseMoveToDelete: ; 12f5b call ClearBGPalettes pop af ret -; 12f73 .ChooseMoveToDelete call SetUpMoveScreenBG @@ -1506,7 +1382,6 @@ ChooseMoveToDelete: ; 12f5b call PrepareToPlaceMoveData call PlaceMoveData jp .loop -; 12f9c .a_button and a @@ -1525,17 +1400,15 @@ ChooseMoveToDelete: ; 12f5b call ClearTileMap pop af ret -; 12fb2 -DeleteMoveScreenAttrs: ; 12fb2 +DeleteMoveScreenAttrs: db 3, 1 db 3, 1 db $40, $00 dn 2, 0 db D_UP | D_DOWN | A_BUTTON | B_BUTTON -; 12fba -ManagePokemonMoves: ; 12fba +ManagePokemonMoves: ld a, [wCurPartySpecies] cp EGG jr z, .egg @@ -1551,9 +1424,8 @@ ManagePokemonMoves: ; 12fba .egg ld a, $0 ret -; 12fd5 -MoveScreenLoop: ; 12fd5 +MoveScreenLoop: ld a, [wCurPartyMon] inc a ld [wPartyMenuCursor], a @@ -1613,7 +1485,6 @@ MoveScreenLoop: ; 12fd5 lb bc, 8, SCREEN_WIDTH - 2 call ClearBox jp .loop -; 1305b .d_right ld a, [wMoveSwapBuffer] @@ -1678,7 +1549,6 @@ MoveScreenLoop: ; 12fd5 and a jr z, .cycle_right jr .cycle_left_loop -; 130c6 .a_button call PlayClickSFX @@ -1729,7 +1599,6 @@ MoveScreenLoop: ; 12fd5 lb bc, 1, 9 call ClearBox jp .loop -; 1313a .copy_move push hl @@ -1752,7 +1621,6 @@ MoveScreenLoop: ; 12fd5 ld a, b ld [de], a ret -; 13154 .exit xor a @@ -1761,21 +1629,18 @@ MoveScreenLoop: ; 12fd5 res 6, [hl] call ClearSprites jp ClearTileMap -; 13163 -MoveScreenAttributes: ; 13163 +MoveScreenAttributes: db 3, 1 db 3, 1 db $40, $00 dn 2, 0 db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON -; 1316b -String_MoveWhere: ; 1316b +String_MoveWhere: db "Where?@" -; 13172 -SetUpMoveScreenBG: ; 13172 +SetUpMoveScreenBG: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -1821,9 +1686,8 @@ SetUpMoveScreenBG: ; 13172 hlcoord 16, 0 lb bc, 1, 3 jp ClearBox -; 131ef -SetUpMoveList: ; 131ef +SetUpMoveList: xor a ld [hBGMapMode], a ld [wMoveSwapBuffer], a @@ -1848,9 +1712,8 @@ SetUpMoveList: ; 131ef ld b, 5 ld c, 18 jp TextBox -; 13235 -PrepareToPlaceMoveData: ; 13235 +PrepareToPlaceMoveData: ld hl, wPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH ld a, [wCurPartyMon] @@ -1865,9 +1728,8 @@ PrepareToPlaceMoveData: ; 13235 hlcoord 1, 12 lb bc, 5, 18 jp ClearBox -; 13256 -PlaceMoveData: ; 13256 +PlaceMoveData: xor a ld [hBGMapMode], a hlcoord 0, 10 @@ -1909,28 +1771,22 @@ PlaceMoveData: ; 13256 ld a, $1 ld [hBGMapMode], a ret -; 132ba -String_MoveType_Top: ; 132ba +String_MoveType_Top: db "┌─────┐@" -; 132c2 -String_MoveType_Bottom: ; 132c2 +String_MoveType_Bottom: db "│TYPE/└@" -; 132ca -String_MoveAtk: ; 132ca +String_MoveAtk: db "ATK/@" -; 132cf -String_MoveNoPower: ; 132cf +String_MoveNoPower: db "---@" -; 132d3 -Function132d3: ; 132d3 +Function132d3: call Function132da call Function132fe ret -; 132da -Function132da: ; 132da +Function132da: ld a, [wCurPartyMon] and a ret z @@ -1958,9 +1814,8 @@ Function132da: ; 132da hlcoord 16, 0 ld [hl], "◀" ret -; 132fe -Function132fe: ; 132fe +Function132fe: ld a, [wCurPartyMon] inc a ld c, a @@ -1990,4 +1845,3 @@ Function132fe: ; 132fe hlcoord 18, 0 ld [hl], "▶" ret -; 13327 diff --git a/engine/menus/trainer_card.asm b/engine/menus/trainer_card.asm index e84c1c9f3..f48636f67 100644 --- a/engine/menus/trainer_card.asm +++ b/engine/menus/trainer_card.asm @@ -8,7 +8,7 @@ const TRAINERCARDSTATE_PAGE3_JOYPAD ; 5 const TRAINERCARDSTATE_QUIT ; 6 -TrainerCard: ; 25105 +TrainerCard: ld a, [wVramState] push af xor a @@ -38,7 +38,7 @@ TrainerCard: ; 25105 ld [wVramState], a ret -.InitRAM: ; 2513b (9:513b) +.InitRAM: call ClearBGPalettes call ClearSprites call ClearTileMap @@ -78,10 +78,10 @@ TrainerCard: ; 25105 ld [hl], a ; wTrainerCardBadgeAttributes ret -.RunJumptable: ; 2518e (9:518e) +.RunJumptable: jumptable .Jumptable, wJumptableIndex -.Jumptable: ; 2519d (9:519d) +.Jumptable: ; entries correspond to TRAINERCARDSTATE_* constants dw TrainerCard_Page1_LoadGFX dw TrainerCard_Page1_Joypad @@ -91,17 +91,17 @@ TrainerCard: ; 25105 dw TrainerCard_Page3_Joypad dw TrainerCard_Quit -TrainerCard_IncrementJumptable: ; 251ab (9:51ab) +TrainerCard_IncrementJumptable: ld hl, wJumptableIndex inc [hl] ret -TrainerCard_Quit: ; 251b0 (9:51b0) +TrainerCard_Quit: ld hl, wJumptableIndex set 7, [hl] ret -TrainerCard_Page1_LoadGFX: ; 251b6 (9:51b6) +TrainerCard_Page1_LoadGFX: call ClearSprites hlcoord 0, 8 ld d, 6 @@ -115,7 +115,7 @@ TrainerCard_Page1_LoadGFX: ; 251b6 (9:51b6) call TrainerCard_IncrementJumptable ret -TrainerCard_Page1_Joypad: ; 251d7 (9:51d7) +TrainerCard_Page1_Joypad: call TrainerCard_Page1_PrintGameTime ld hl, hJoyLast ld a, [hl] @@ -136,9 +136,7 @@ TrainerCard_Page1_Joypad: ; 251d7 (9:51d7) ld [wJumptableIndex], a ret -; 251f4 - -TrainerCard_Page2_LoadGFX: ; 251f4 (9:51f4) +TrainerCard_Page2_LoadGFX: call ClearSprites hlcoord 0, 8 ld d, 6 @@ -156,7 +154,7 @@ TrainerCard_Page2_LoadGFX: ; 251f4 (9:51f4) call TrainerCard_IncrementJumptable ret -TrainerCard_Page2_Joypad: ; 25221 (9:5221) +TrainerCard_Page2_Joypad: ld hl, TrainerCard_JohtoBadgesOAM call TrainerCard_Page2_3_AnimateBadges ld hl, hJoyLast @@ -186,7 +184,7 @@ TrainerCard_Page2_Joypad: ; 25221 (9:5221) ld [wJumptableIndex], a ret -TrainerCard_Page3_LoadGFX: ; 2524c (9:524c) +TrainerCard_Page3_LoadGFX: call ClearSprites hlcoord 0, 8 ld d, 6 @@ -204,7 +202,7 @@ TrainerCard_Page3_LoadGFX: ; 2524c (9:524c) call TrainerCard_IncrementJumptable ret -TrainerCard_Page3_Joypad: ; 25279 (9:5279) +TrainerCard_Page3_Joypad: ld hl, TrainerCard_JohtoBadgesOAM call TrainerCard_Page2_3_AnimateBadges ld hl, hJoyLast @@ -226,7 +224,7 @@ TrainerCard_Page3_Joypad: ; 25279 (9:5279) ld [wJumptableIndex], a ret -TrainerCard_PrintTopHalfOfCard: ; 25299 (9:5299) +TrainerCard_PrintTopHalfOfCard: hlcoord 0, 0 ld d, 5 call TrainerCard_InitBorder @@ -257,21 +255,18 @@ TrainerCard_PrintTopHalfOfCard: ; 25299 (9:5299) predef PlaceGraphic ret -; 252ec (9:52ec) - -.Name_Money: ; 252ec +.Name_Money: db "NAME/" next "" next "MONEY@" -.ID_No: ; 252f9 +.ID_No: db $27, $28, -1 ; ID NO -.HorizontalDivider: ; 252fc +.HorizontalDivider: db $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $26, -1 ; ____________> -; 2530a -TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a) +TrainerCard_Page1_PrintDexCaught_GameTime: hlcoord 2, 10 ld de, .Dex_PlayTime call PlaceString @@ -304,11 +299,10 @@ TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a) .Badges: db " BADGES▶@" -.StatusTilemap: ; 25366 +.StatusTilemap: db $29, $2a, $2b, $2c, $2d, -1 -; 2536c -TrainerCard_Page2_3_InitObjectsAndStrings: ; 2536c (9:536c) +TrainerCard_Page2_3_InitObjectsAndStrings: hlcoord 2, 8 ld de, .BadgesTilemap call TrainerCardSetup_PlaceTilemapString @@ -338,13 +332,10 @@ endr call TrainerCard_Page2_3_OAMUpdate ret -; 253a2 (9:53a2) - -.BadgesTilemap: ; 253a2 +.BadgesTilemap: db $79, $7a, $7b, $7c, $7d, -1 ; "BADGES" -; 253a8 -TrainerCardSetup_PlaceTilemapString: ; 253a8 (9:53a8) +TrainerCardSetup_PlaceTilemapString: .loop ld a, [de] cp -1 @@ -353,7 +344,7 @@ TrainerCardSetup_PlaceTilemapString: ; 253a8 (9:53a8) inc de jr .loop -TrainerCard_InitBorder: ; 253b0 (9:53b0) +TrainerCard_InitBorder: ld e, SCREEN_WIDTH .loop1 ld a, $23 @@ -411,7 +402,7 @@ TrainerCard_InitBorder: ; 253b0 (9:53b0) jr nz, .loop6 ret -TrainerCard_Page2_3_PlaceLeadersFaces: ; 253f4 (9:53f4) +TrainerCard_Page2_3_PlaceLeadersFaces: push de push hl ld [hli], a @@ -442,7 +433,7 @@ TrainerCard_Page2_3_PlaceLeadersFaces: ; 253f4 (9:53f4) pop de ret -TrainerCard_Page1_PrintGameTime: ; 25415 (9:5415) +TrainerCard_Page1_PrintGameTime: hlcoord 11, 12 ld de, wGameTimeHours lb bc, 2, 4 @@ -460,7 +451,7 @@ TrainerCard_Page1_PrintGameTime: ; 25415 (9:5415) ld [hl], a ret -TrainerCard_Page2_3_AnimateBadges: ; 25438 (9:5438) +TrainerCard_Page2_3_AnimateBadges: ld a, [hVBlankCounter] and %111 ret nz @@ -470,7 +461,7 @@ TrainerCard_Page2_3_AnimateBadges: ; 25438 (9:5438) ld [wTrainerCardBadgeFrameCounter], a jr TrainerCard_Page2_3_OAMUpdate -TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) +TrainerCard_Page2_3_OAMUpdate: ; copy flag array pointer ld a, [hli] ld e, a @@ -510,7 +501,7 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) jr nz, .loop ret -.PrepOAM: ; 2547b (9:547b) +.PrepOAM: ld a, [wTrainerCardBadgeTileID] and 1 << 7 jr nz, .xflip @@ -546,23 +537,21 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) inc de jr .loop2 -; 254a7 (9:54a7) - -.facing1 ; 254a7 +.facing1 dsprite 0, 0, 0, 0, $00, 0 dsprite 0, 0, 1, 0, $01, 0 dsprite 1, 0, 0, 0, $02, 0 dsprite 1, 0, 1, 0, $03, 0 db -1 -.facing2 ; 254b8 +.facing2 dsprite 0, 0, 0, 0, $01, 0 | X_FLIP dsprite 0, 0, 1, 0, $00, 0 | X_FLIP dsprite 1, 0, 0, 0, $03, 0 | X_FLIP dsprite 1, 0, 1, 0, $02, 0 | X_FLIP db -1 -TrainerCard_JohtoBadgesOAM: ; 254c9 +TrainerCard_JohtoBadgesOAM: ; Template OAM data for each badge on the trainer card. ; Format: ; y, x, palette @@ -611,7 +600,6 @@ TrainerCard_JohtoBadgesOAM: ; 254c9 db $80, $78, 0 db $1c, $20, $24, $20 | (1 << 7) db $1c | (1 << 7), $20, $24, $20 | (1 << 7) -; 25523 CardStatusGFX: INCBIN "gfx/trainer_card/card_status.2bpp" |