summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2021-05-20 13:34:25 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2021-05-20 13:34:25 +0100
commit6a7f5a9ebe6e91607c92a4a98ec6562914c12ab8 (patch)
tree34a145890b65109d411ed5e8e212ecf07f645569
parent511209843c1f851c24d07069193c8bedfd3c5579 (diff)
Start Menu disasm
-rw-r--r--src/constants/gfx_constants.asm2
-rw-r--r--src/constants/menu_constants.asm7
-rw-r--r--src/engine/bank01.asm2
-rw-r--r--src/engine/bank03.asm10
-rw-r--r--src/engine/bank04.asm551
-rw-r--r--src/engine/bank06.asm6
-rw-r--r--src/engine/bank07.asm633
-rw-r--r--src/engine/bank20.asm2
-rw-r--r--src/engine/home.asm16
-rw-r--r--src/hram.asm3
-rw-r--r--src/text/text3.asm26
-rw-r--r--src/text/text_offsets.asm26
-rw-r--r--src/wram.asm45
13 files changed, 1178 insertions, 151 deletions
diff --git a/src/constants/gfx_constants.asm b/src/constants/gfx_constants.asm
index 6ec2e0b..a32e255 100644
--- a/src/constants/gfx_constants.asm
+++ b/src/constants/gfx_constants.asm
@@ -13,6 +13,8 @@ palettes EQUS "* CGB_PAL_SIZE"
NUM_BACKGROUND_PALETTES EQU 8
NUM_OBJECT_PALETTES EQU 8
+PALRGB_WHITE EQU (31 << 10 | 31 << 5 | 31)
+
; tile size
TILE_SIZE EQU 16 ; bytes
tiles EQUS "* TILE_SIZE"
diff --git a/src/constants/menu_constants.asm b/src/constants/menu_constants.asm
index 86df8bf..007a354 100644
--- a/src/constants/menu_constants.asm
+++ b/src/constants/menu_constants.asm
@@ -46,3 +46,10 @@ NUM_CARDS_PROMOTIONAL EQU 20
const_def
const VENUSAUR_OWNED_PHANTOM_F ; $0
const MEW_OWNED_PHANTOM_F ; $1
+
+; wStartMenuChoice enums
+ const_def
+ const START_MENU_CARD_POP ; 0
+ const START_MENU_CONTINUE_FROM_DIARY ; 1
+ const START_MENU_NEW_GAME ; 2
+ const START_MENU_CONTINUE_DUEL ; 3
diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm
index 1bc9665..358aabf 100644
--- a/src/engine/bank01.asm
+++ b/src/engine/bank01.asm
@@ -1643,7 +1643,7 @@ DrawDuelistPortraitsAndNames: ; 4a97 (1:4a97)
call ProcessText
; player's portrait
lb bc, 0, 5
- call Func_3e10
+ call DrawPlayerPortrait
; opponent's name (aligned to the right)
ld de, wDefaultText
push de
diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm
index 8d47a3a..8d9442c 100644
--- a/src/engine/bank03.asm
+++ b/src/engine/bank03.asm
@@ -698,7 +698,7 @@ Func_c4b9: ; c4b9 (3:44b9)
xor a
ld [wVRAMTileOffset], a
ld [wd4cb], a
- ld a, $1d
+ ld a, PALETTE_29
farcall LoadPaletteData
ld b, $0
ld a, [wConsole]
@@ -1148,7 +1148,7 @@ StartMenu: ; c75a (3:475a)
Func_c797: ; c797 (3:4797)
ld a, [wd0b8]
ld hl, Unknown_10d98
- farcall Func_111e9
+ farcall InitAndPrintStartMenu
ret
PointerTable_c7a2: ; c7a2 (3:47a2)
@@ -1245,7 +1245,7 @@ PointerTable_c846: ; c846 (3:4846)
Func_c84e: ; c84e (3:484e)
ld a, [wd0b9]
ld hl, Unknown_10da9
- farcall Func_111e9
+ farcall InitAndPrintStartMenu
ret
Func_c859: ; c859 (3:4859)
@@ -2376,7 +2376,7 @@ ScriptCommand_ShowCardReceivedScreen: ; cee2 (3:4ee2)
.show_card
push af
farcall Func_10000
- farcall Func_10031
+ farcall FlashWhiteScreen
pop af
bank1call Func_7594
call WhiteOutDMGPals
@@ -3025,7 +3025,7 @@ ShowMultichoiceTextbox: ; d28c (3:528c)
ld h, [hl]
ld l, a
ld a, [wd416]
- farcall Func_111e9
+ farcall InitAndPrintStartMenu
pop hl
inc hl
ld a, [hli]
diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm
index 2f369f6..92d6d57 100644
--- a/src/engine/bank04.asm
+++ b/src/engine/bank04.asm
@@ -23,20 +23,24 @@ Func_10000: ; 10000 (4:4000)
ld [wVBlankOAMCopyToggle], a
ret
-Func_10031: ; 10031 (4:4031)
+; saves all pals to SRAM, then fills them with white.
+; after flushing, it loads back the saved pals from SRAM.
+FlashWhiteScreen: ; 10031 (4:4031)
ldh a, [hBankSRAM]
+
push af
- ld a, $1
+ ld a, BANK("SRAM1")
call BankswitchSRAM
- call Func_10cbb
+ call CopyPalsToSRAMBuffer
call DisableSRAM
call Func_10b28
call FlushAllPalettes
call EnableLCD
call DoFrameIfLCDEnabled
- call Func_10cea
+ call LoadPalsFromSRAMBuffer
call FlushAllPalettes
pop af
+
call BankswitchSRAM
call DisableSRAM
ret
@@ -51,7 +55,13 @@ Func_1010c: ; 1010c (4:410c)
INCROM $1010c, $10197
Func_10197: ; 10197 (4:4197)
- INCROM $10197, $1029e
+ INCROM $10197, $101df
+
+Func_101df: ; 101df (4:41df)
+ INCROM $101df, $1024f
+
+Func_1024f: ; 1024f (4:424f)
+ INCROM $1024f, $1029e
Medal_1029e: ; 1029e (4:429e)
sub $8
@@ -80,7 +90,7 @@ Medal_1029e: ; 1029e (4:429e)
ld [wTxRam2], a
ld a, [hl]
ld [wTxRam2 + 1], a
- call Func_10031
+ call FlashWhiteScreen
ld a, MUSIC_MEDAL
call PlaySong
ld a, $ff
@@ -148,7 +158,7 @@ GiveBoosterPack: ; 1031b (4:431b)
ld [wTxRam2], a
ld a, [hl]
ld [wTxRam2 + 1], a
- call Func_10031
+ call FlashWhiteScreen
call PauseSong
ld a, MUSIC_BOOSTER_PACK
call PlaySong
@@ -272,7 +282,7 @@ Duel_Init: ; 103d3 (4:43d3)
call Func_3e2a ; LoadDuelistPortrait
ld a, [wMatchStartTheme]
call PlaySong
- call Func_10031
+ call FlashWhiteScreen
call DoFrameIfLCDEnabled
lb bc, $2f, $1d ; cursor tile, tile behind cursor
lb de, 18, 17 ; x, y
@@ -285,10 +295,14 @@ Duel_Init: ; 103d3 (4:43d3)
ret
Unknown_10451: ; 10451 (4:4451)
- INCROM $10451, $10456
+ db 1, 14
+ tx Text0395
+ db $ff
Unknown_10456: ; 10456 (4:4456)
- INCROM $10456, $1045b
+ db 1, 16
+ tx Text0396
+ db $ff
Unknown_1045b: ; 1045b (4:445b)
INCROM $1045b, $1052f
@@ -343,8 +357,28 @@ TryGivePCPack: ; 10a70 (4:4a70)
pop hl
ret
+; writes wd293 with byte depending on console
+; every entry in the list is $00
Func_10a9b: ; 10a9b (4:4a9b)
- INCROM $10a9b, $10ab4
+ push hl
+ ld a, [wConsole]
+ add LOW(.data_10ab1)
+ ld l, a
+ ld a, HIGH(.data_10ab1)
+ adc $00
+ ld h, a
+ ld a, [hl]
+ ld [wd293], a
+ xor a
+ ld [wd317], a
+ pop hl
+ ret
+
+.data_10ab1
+ db $00 ; CONSOLE_DMG
+ db $00 ; CONSOLE_SGB
+ db $00 ; CONSOLE_CGB
+; 0x10ab4
Func_10ab4: ; 10ab4 (4:4ab4)
INCROM $10ab4, $10af9
@@ -352,8 +386,269 @@ Func_10ab4: ; 10ab4 (4:4ab4)
Func_10af9: ; 10af9 (4:4af9)
INCROM $10af9, $10b28
+; fills wBackgroundPalettesCGB with white pal
Func_10b28: ; 10b28 (4:4b28)
- INCROM $10b28, $10c96
+ ld a, [wd293]
+ ld [wBGP], a
+ ld [wOBP0], a
+ ld [wOBP1], a
+ ld de, PALRGB_WHITE
+ ld hl, wBackgroundPalettesCGB
+ ld bc, NUM_BACKGROUND_PALETTES palettes
+ call FillMemoryWithDE
+ ret
+; 0x10b41
+
+ INCROM $10b41, $10b85
+
+; does something with wBGP given wd294
+; mixes them into a single value?
+Func_10b85: ; 10b85 (4:4b85)
+ push bc
+ ld c, $03
+ ld hl, wBGP
+ ld de, wd294
+.asm_10b8e
+ push bc
+ ld b, [hl]
+ ld a, [de]
+ ld c, a
+ call .Func_10b9e
+ ld [hl], a
+ pop bc
+ inc de
+ inc hl
+ dec c
+ jr nz, .asm_10b8e
+ pop bc
+ ret
+
+.Func_10b9e
+ push bc
+ push de
+ ld e, 4
+ ld d, $00
+.loop
+ call .Func_10bba
+ or d
+ rlca
+ rlca
+ ld d, a
+ rlc b
+ rlc b
+ rlc c
+ rlc c
+ dec e
+ jr nz, .loop
+ ld a, d
+ pop de
+ pop bc
+ ret
+
+; calculates ((b & %11) << 2) | (c & %11)
+; that is, %0000xxyy, where x and y are
+; the 2 lower bits of b and c respectively
+; and outputs the entry from a table given that value
+.Func_10bba
+ push hl
+ push bc
+ ld a, %11
+ and b
+ add a
+ add a
+ ld b, a
+ ld a, %11
+ and c
+ or b
+ ld c, a
+ ld b, $00
+ ld hl, .data_10bd1
+ add hl, bc
+ ld a, [hl]
+ pop bc
+ pop hl
+ ret
+
+.data_10bd1
+ db %00 ; b = %00 | c = %00
+ db %01 ; b = %00 | c = %01
+ db %01 ; b = %00 | c = %10
+ db %01 ; b = %00 | c = %11
+ db %00 ; b = %01 | c = %00
+ db %01 ; b = %01 | c = %01
+ db %10 ; b = %01 | c = %10
+ db %10 ; b = %01 | c = %11
+ db %01 ; b = %10 | c = %00
+ db %01 ; b = %10 | c = %01
+ db %10 ; b = %10 | c = %10
+ db %11 ; b = %10 | c = %11
+ db %10 ; b = %11 | c = %00
+ db %10 ; b = %11 | c = %01
+ db %10 ; b = %11 | c = %10
+ db %11 ; b = %11 | c = %11
+; 0x10be1
+
+ INCROM $10be1, $10bec
+
+FadeBGPalIntoTemp1: ; 10bec (4:4bec)
+ push bc
+ ld c, 2 palettes
+ ld hl, wBackgroundPalettesCGB
+ ld de, wTempBackgroundPalettesCGB
+ jr FadePalIntoAnother
+
+FadeBGPalIntoTemp2: ; 10bf7 (4:4bf7)
+ push bc
+ ld c, 2 palettes
+ ld hl, wBackgroundPalettesCGB + 4 palettes
+ ld de, wTempBackgroundPalettesCGB + 4 palettes
+ jr FadePalIntoAnother
+
+ push bc
+ ld c, 4 palettes
+ ld hl, wBackgroundPalettesCGB
+ ld de, wTempBackgroundPalettesCGB
+; fallthrough
+
+; hl = input pal to modify
+; de = pal to fade into
+; c = number of colors to fade
+FadePalIntoAnother: ; 10c0b (4:4c0b)
+ push bc
+ ld a, [de]
+ inc de
+ ld c, a
+ ld a, [de]
+ inc de
+ ld b, a
+ push de
+ push bc
+ ld c, [hl]
+ inc hl
+ ld b, [hl]
+ pop de
+ call .GetFadedColor
+ ; overwrite with new color
+ ld [hld], a
+ ld [hl], c
+ inc hl
+ inc hl
+ pop de
+ pop bc
+ dec c
+ jr nz, FadePalIntoAnother
+ pop bc
+ ret
+
+; fade pal bc to de
+; output resulting pal in a and c
+.GetFadedColor
+ push hl
+ ld a, c
+ cp e
+ jr nz, .unequal
+ ld a, b
+ cp d
+ jr z, .skip
+
+.unequal
+ ; red
+ ld a, e
+ and %11111
+ ld l, a
+ ld a, c
+ and %11111
+ call .FadeColor
+ ldh [hffb6], a
+
+ ; green
+ ld a, e
+ and %11100000
+ ld l, a
+ ld a, d
+ and %11
+ or l
+ swap a
+ rrca
+ ld l, a
+ ld a, c
+ and %11100000
+ ld h, a
+ ld a, b
+ and %11
+ or h
+ swap a
+ rrca
+ call .FadeColor
+ rlca
+ swap a
+ ld h, a
+ and %11
+ ldh [hffb7], a
+ ld a, %11100000
+ and h
+ ld h, a
+ ldh a, [hffb6]
+ or h
+ ld h, a
+
+ ; blue
+ ld a, d
+ and %1111100
+ rrca
+ rrca
+ ld l, a
+ ld a, b
+ and %1111100
+ rrca
+ rrca
+ call .FadeColor
+ rlca
+ rlca
+ ld b, a
+ ldh a, [hffb7]
+ or b
+ ld c, h
+.skip
+ pop hl
+ ret
+
+; compares color in a and in l
+; if a is smaller/greater than l, then
+; increase/decrease its value up to l
+; up to a maximum of 4
+; a = pal color (red, green or blue)
+; l = pal color (red, green or blue)
+.FadeColor
+ cp l
+ ret z ; same value
+ jr c, .incr_a
+; decr a
+ dec a
+ cp l
+ ret z
+ dec a
+ cp l
+ ret z
+ dec a
+ cp l
+ ret z
+ dec a
+ ret
+
+.incr_a
+ inc a
+ cp l
+ ret z
+ inc a
+ cp l
+ ret z
+ inc a
+ cp l
+ ret z
+ inc a
+ ret
+; 0x10c96
Func_10c96: ; 10c96 (4:4c96)
ldh a, [hBankSRAM]
@@ -361,13 +656,13 @@ Func_10c96: ; 10c96 (4:4c96)
push bc
ld a, $1
call BankswitchSRAM
- call Func_10cbb
+ call CopyPalsToSRAMBuffer
call Func_10ab4
pop bc
ld a, c
or a
jr nz, .asm_10cb0
- call Func_10cea
+ call LoadPalsFromSRAMBuffer
call Func_10af9
.asm_10cb0
@@ -377,11 +672,123 @@ Func_10c96: ; 10c96 (4:4c96)
call DisableSRAM
ret
-Func_10cbb: ; 10cbb (4:4cbb)
- INCROM $10cbb, $10cea
+; copies current BG and OP pals,
+; wBackgroundPalettesCGB and wObjectPalettesCGB
+; to sGfxBuffer2
+CopyPalsToSRAMBuffer: ; 10cbb (4:4cbb)
+ ldh a, [hBankSRAM]
-Func_10cea: ; 10cea (4:4cea)
- INCROM $10cea, $10d98
+ push af
+ cp BANK("SRAM1")
+ jr z, .ok
+ debug_nop
+.ok
+ ld a, BANK("SRAM1")
+ call BankswitchSRAM
+ ld hl, sGfxBuffer2
+ ld a, [wBGP]
+ ld [hli], a
+ ld a, [wOBP0]
+ ld [hli], a
+ ld a, [wOBP1]
+ ld [hli], a
+ ld e, l
+ ld d, h
+ ld hl, wBackgroundPalettesCGB
+ ld bc, NUM_BACKGROUND_PALETTES palettes + NUM_OBJECT_PALETTES palettes
+ call CopyDataHLtoDE_SaveRegisters
+ pop af
+
+ call BankswitchSRAM
+ call DisableSRAM
+ ret
+; 0x10cea
+
+; loads BG and OP pals,
+; wBackgroundPalettesCGB and wObjectPalettesCGB
+; from sGfxBuffer2
+LoadPalsFromSRAMBuffer: ; 10cea (4:4cea)
+ ldh a, [hBankSRAM]
+
+ push af
+ cp BANK("SRAM1")
+ jr z, .ok
+ debug_nop
+.ok
+ ld a, BANK("SRAM1")
+ call BankswitchSRAM
+ ld hl, sGfxBuffer2
+ ld a, [hli]
+ ld [wBGP], a
+ ld a, [hli]
+ ld [wOBP0], a
+ ld a, [hli]
+ ld [wOBP1], a
+ ld de, wBackgroundPalettesCGB
+ ld bc, NUM_BACKGROUND_PALETTES palettes + NUM_OBJECT_PALETTES palettes
+ call CopyDataHLtoDE_SaveRegisters
+ pop af
+
+ call BankswitchSRAM
+ call DisableSRAM
+ ret
+; 0x10d17
+
+; backs up all palettes
+; and writes 4 BG pals with white pal
+Func_10d17: ; 10d17 (4:4d17)
+ ld a, [wBGP]
+ ld [wd294], a
+ ld a, [wOBP0]
+ ld [wd295], a
+ ld a, [wOBP1]
+ ld [wd296], a
+ ld hl, wBackgroundPalettesCGB
+ ld de, wTempBackgroundPalettesCGB
+ ld bc, NUM_BACKGROUND_PALETTES palettes + NUM_OBJECT_PALETTES palettes
+ call CopyDataHLtoDE_SaveRegisters
+
+ ld a, [wd293]
+ ld [wBGP], a
+ ld de, PALRGB_WHITE
+ ld hl, wBackgroundPalettesCGB
+ ld bc, 4 palettes
+ call FillMemoryWithDE
+ call FlushAllPalettes
+
+ ld a, $10
+ ld [wd317], a
+ ret
+; 0x10d50
+
+ INCROM $10d50, $10d74
+
+; does stuff according to bottom 2 bits from wd317:
+; - if equal to %01, modify wBGP
+; - if bottom bit not set, fade BG pals 0 and 1
+; - if bottom bit is set, fade BG pals 4 and 5
+; and Flush Palettes
+; then decrements wd317
+; does nothing if wd317 is 0
+Func_10d74: ; 10d74 (4:4d74)
+ ld a, [wd317]
+ or a
+ ret z
+ and %11
+ ld c, a
+ cp $1
+ call z, Func_10b85
+ bit 0, c
+ call z, FadeBGPalIntoTemp1
+ bit 0, c
+ call nz, FadeBGPalIntoTemp2
+ bit 0, c
+ call nz, FlushAllPalettes
+ ld a, [wd317]
+ dec a
+ ld [wd317], a
+ ret
+; 0x10d98
Unknown_10d98: ; 10d98 (4:4d98)
INCROM $10d98, $10da9
@@ -394,7 +801,7 @@ Func_10dba: ; 10dba (4:4dba)
farcall Func_c29b
ld a, [wd0ba]
ld hl, Unknown_10e17
- farcall Func_111e9
+ farcall InitAndPrintStartMenu
.asm_10dca
call DoFrameIfLCDEnabled
call HandleMenuInput
@@ -1079,11 +1486,107 @@ OverworldMap_ContinuePlayerWalkingAnimation: ; 11184 (4:5184)
dec [hl]
ret
+; prints $ff-terminated list of text to text box
+; given 2 bytes for text alignment and 2 bytes for text ID
Func_111b3: ; 111b3 (4:51b3)
- INCROM $111b3, $111e9
+ ldh a, [hffb0]
+ push af
+ ld a, $02
+ ldh [hffb0], a
+
+ push hl
+.loop_text_print_1
+ ld d, [hl]
+ inc hl
+ bit 7, d
+ jr nz, .next
+ inc hl
+ ld a, [hli]
+ push hl
+ ld h, [hl]
+ ld l, a
+ call PrintTextNoDelay
+ pop hl
+ inc hl
+ jr .loop_text_print_1
-Func_111e9: ; 111e9 (4:51e9)
- INCROM $111e9, $11238
+.next
+ pop hl
+ pop af
+ ldh [hffb0], a
+.loop_text_print_2
+ ld d, [hl]
+ inc hl
+ bit 7, d
+ ret nz
+ ld e, [hl]
+ inc hl
+ call AdjustCoordinatesForBGScroll
+ call InitTextPrinting
+ ld a, [hli]
+ push hl
+ ld h, [hl]
+ ld l, a
+ call PrintTextNoDelay
+ pop hl
+ inc hl
+ jr .loop_text_print_2
+; 0x111e9
+
+InitAndPrintStartMenu: ; 111e9 (4:51e9)
+ push hl
+ push bc
+ push de
+ push af
+ ld d, [hl]
+ inc hl
+ ld e, [hl]
+ inc hl
+ ld b, [hl]
+ inc hl
+ ld c, [hl]
+ inc hl
+ push hl
+ call AdjustCoordinatesForBGScroll
+ farcall Func_c3ca
+ call DrawRegularTextBox
+ call DoFrameIfLCDEnabled
+ pop hl
+ call Func_111b3
+ pop af
+ call InitializeMenuParameters
+ pop de
+ pop bc
+ pop hl
+ ret
+; 0x1120f
+
+; xors sb800
+; this has the effect of invalidating the save data checksum
+; which the game interprets as being having no save data
+InvalidateSaveData: ; 1120f (4:520f)
+ push hl
+ ldh a, [hBankSRAM]
+
+ push af
+ ld a, $02
+ call BankswitchSRAM
+ ld a, $08
+ xor $ff
+ ld [sb800 + 0], a
+ ld a, $00
+ xor $ff
+ ld [sb800 + 1], a
+ pop af
+
+ call BankswitchSRAM
+ call DisableSRAM
+ call EnableSRAM
+ bank1call DiscardSavedDuelData
+ call DisableSRAM
+ pop hl
+ ret
+; 0x11238
; saves all data to SRAM, including
; General save data and Album/Deck data
@@ -3217,7 +3720,7 @@ _GameLoop: ; 126d1 (4:66d1)
ldh [hWhoseTurn], a
farcall Func_c1f8
farcall Func_1d078
- ld a, [wd628]
+ ld a, [wStartMenuChoice]
ld hl, MainMenuFunctionTable
call JumpToFunctionInTable
jr c, .main_menu_loop ; return to main menu
@@ -3497,7 +4000,7 @@ GetSpriteAnimCounter: ; 12a13 (4:6a13)
ret
; 0x12a21
-HandleAllSpriteAnimations: ; 12a21 (4:6a21)
+_HandleAllSpriteAnimations: ; 12a21 (4:6a21)
push af
ld a, [wd5d7] ; skip animating this frame if enabled
or a
diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm
index c0c663c..d0c928c 100644
--- a/src/engine/bank06.asm
+++ b/src/engine/bank06.asm
@@ -1955,7 +1955,7 @@ LoadRegistersFromIRDataBuffer: ; 198d0 (6:58d0)
; 0x198e7
; empties screen and replaces
-; wVBlankFunctionTrampoline with Func_3cb4
+; wVBlankFunctionTrampoline with HandleAllSpriteAnimations
Func_198e7: ; 198e7 (6:58e7)
call EmptyScreen
call Set_OBJ_8x8
@@ -1966,9 +1966,9 @@ Func_198e7: ; 198e7 (6:58e7)
ld de, wVBlankFunctionTrampolineBackup
call BackupVBlankFunctionTrampoline
di
- ld [hl], LOW(Func_3cb4)
+ ld [hl], LOW(HandleAllSpriteAnimations)
inc hl
- ld [hl], HIGH(Func_3cb4)
+ ld [hl], HIGH(HandleAllSpriteAnimations)
ei
ret
; 0x19907
diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm
index c0d7a9f..757a254 100644
--- a/src/engine/bank07.asm
+++ b/src/engine/bank07.asm
@@ -1411,7 +1411,7 @@ Func_1cb5e: ; 1cb5e (7:4b5e)
ld [wVRAMTileOffset], a
ld [wd4cb], a
- ld a, $25
+ ld a, PALETTE_37
farcall LoadPaletteData
call Func_1cba6
@@ -1780,7 +1780,7 @@ WhiteFlashScreen: ; 1cd76 (7:4d76)
ld de, wTempBackgroundPalettesCGB
ld bc, 8 palettes
call CopyDataHLtoDE_SaveRegisters
- ld de, $7fff ; rgb 31, 31, 31
+ ld de, PALRGB_WHITE
ld hl, wBackgroundPalettesCGB
ld bc, (8 palettes) / 2
call FillMemoryWithDE
@@ -1876,13 +1876,14 @@ INCLUDE "data/duel_animations.asm"
Func_1d078: ; 1d078 (7:5078)
ld a, [wd627]
or a
- jr z, .asm_1d0c7
+ jr z, .start_menu
+
.asm_1d07e
ld a, MUSIC_STOP
call PlaySong
call Func_3ca0
call Func_1d335
- call Func_1d3ce
+ call LoadTitleScreenSprites
xor a
ld [wd635], a
ld a, $3c
@@ -1913,52 +1914,59 @@ Func_1d078: ; 1d078 (7:5078)
call PlaySFX
farcall Func_10ab4
-.asm_1d0c7
- call Func_1d0fa
- call Func_1d11c
- ld a, [wd628]
- cp $2
- jr nz, .asm_1d0db
- call Func_1d289
+.start_menu
+ call CheckIfHasSaveData
+ call HandleStartMenu
+
+; new game
+ ld a, [wStartMenuChoice]
+ cp START_MENU_NEW_GAME
+ jr nz, .continue_from_diary
+ call DeleteSaveDataForNewGame
jr c, Func_1d078
- jr .asm_1d0e7
-.asm_1d0db
- ld a, [wd628]
- cp $1
- jr nz, .asm_1d0e7
- call Func_1d2b8
+ jr .card_pop
+.continue_from_diary
+ ld a, [wStartMenuChoice]
+ cp START_MENU_CONTINUE_FROM_DIARY
+ jr nz, .card_pop
+ call AskToContinueFromDiaryWithDuelData
jr c, Func_1d078
-.asm_1d0e7
- ld a, [wd628]
- cp $0
- jr nz, .asm_1d0f3
- call Func_1d2dd
+.card_pop
+ ld a, [wStartMenuChoice]
+ cp START_MENU_CARD_POP
+ jr nz, .continue_duel
+ call ShowCardPopCGBDisclaimer
jr c, Func_1d078
-.asm_1d0f3
+.continue_duel
call ResetDoFrameFunction
call Func_3ca0
ret
+; 0x1d0fa
-Func_1d0fa: ; 1d0fa (7:50fa)
+; updates wHasSaveData and wHasDuelSaveData
+; depending on whether the save data is valid or not
+CheckIfHasSaveData: ; 1d0fa (7:50fa)
farcall ValidateBackupGeneralSaveData
- ld a, $01
+ ld a, TRUE
jr c, .no_error
- ld a, $00
+ ld a, FALSE
.no_error
- ld [wd624], a
+ ld [wHasSaveData], a
cp $00 ; or a
- jr z, .asm_1d114
+ jr z, .write_has_duel_data
bank1call ValidateSavedNonLinkDuelData
- ld a, $01
- jr nc, .asm_1d114
- ld a, $00
-.asm_1d114
- ld [wd625], a
+ ld a, TRUE
+ jr nc, .write_has_duel_data
+ ld a, FALSE
+.write_has_duel_data
+ ld [wHasDuelSaveData], a
farcall ValidateBackupGeneralSaveData
ret
; 0x1d11c
-Func_1d11c: ; 1d11c (7:511c)
+; handles printing the Start Menu
+; and getting player input and choice
+HandleStartMenu: ; 1d11c (7:511c)
ld a, MUSIC_PC_MAIN_MENU
call PlaySong
call DisableLCD
@@ -1968,68 +1976,339 @@ Func_1d11c: ; 1d11c (7:511c)
call Func_3ca0
xor a
ld [wLineSeparation], a
- call Func_1d1e1
- call Func_1d17f
+ call .DrawPlayerPortrait
+ call .SetStartMenuParams
+
ld a, $ff
ld [wd626], a
ld a, [wd627]
cp $4
- jr c, .asm_1d14f
- ld a, [wd624]
+ jr c, .init_menu
+ ld a, [wHasSaveData]
or a
- jr z, .asm_1d14f
- ld a, $1
-.asm_1d14f
- ld hl, wd636
- farcall Func_111e9
- farcall Func_10031
-.asm_1d15a
+ jr z, .init_menu
+ ld a, 1 ; start at second menu option
+.init_menu
+ ld hl, wStartMenuParams
+ farcall InitAndPrintStartMenu
+ farcall FlashWhiteScreen
+
+.wait_input
call DoFrameIfLCDEnabled
call UpdateRNGSources
call HandleMenuInput
push af
- call Func_1d1e9
+ call PrintStartMenuDescriptionText
pop af
- jr nc, .asm_1d15a
+ jr nc, .wait_input
ldh a, [hCurMenuItem]
cp e
- jr nz, .asm_1d15a
+ jr nz, .wait_input
+
ld [wd627], a
- ld a, [wd624]
+ ld a, [wHasSaveData]
or a
- jr nz, .asm_1d17a
+ jr nz, .no_adjustment
+ ; New Game is 3rd option
+ ; but when there's no save data,
+ ; it's the 1st in menu list, so adjust it
inc e
inc e
-.asm_1d17a
+.no_adjustment
ld a, e
- ld [wd628], a
+ ld [wStartMenuChoice], a
+ ret
+
+.SetStartMenuParams
+ ld hl, .StartMenuParams
+ ld de, wStartMenuParams
+ ld bc, .StartMenuParamsEnd - .StartMenuParams
+ call CopyDataHLtoDE
+
+ ld e, 0
+ ld a, [wHasSaveData]
+ or a
+ jr z, .get_text_id ; New Game
+ inc e
+ ld a, 2
+ call .AddItems
+ ld a, [wHasDuelSaveData]
+ or a
+ jr z, .get_text_id ; Continue From Diary
+ inc e
+ ld a, 1
+ call .AddItems
+ ; Continue Duel
+
+.get_text_id
+ sla e
+ ld d, $00
+ ld hl, .StartMenuTextIDs
+ add hl, de
+ ; set text ID as Start Menu param
+ ld a, [hli]
+ ld [wStartMenuParams + 6], a
+ ld a, [hl]
+ ld [wStartMenuParams + 7], a
+ ret
+
+; adds c items to start menu list
+; this means adding 2 units per item to the text box height
+; and adding to the number of items
+.AddItems
+ push bc
+ ld c, a
+ ; number of items in menu
+ ld a, [wStartMenuParams + 12]
+ add c
+ ld [wStartMenuParams + 12], a
+ ; height of text box
+ sla c
+ ld a, [wStartMenuParams + 3]
+ add c
+ ld [wStartMenuParams + 3], a
+ pop bc
ret
-Func_1d17f: ; 1d17f (7:517f)
- INCROM $1d17f, $1d1e1
+.StartMenuParams
+ db 0, 0 ; start menu coords
+ db 14, 4 ; start menu text box dimensions
-Func_1d1e1: ; 1d1e1 (7:51e1)
- INCROM $1d1e1, $1d1e9
+ db 2, 2 ; text alignment for InitTextPrinting
+ tx NewGameText
+ db $ff
-Func_1d1e9: ; 1d1e9 (7:51e9)
- INCROM $1d1e9, $1d289
+ db 1, 2 ; cursor x, cursor y
+ db 2 ; y displacement between items
+ db 1 ; number of items
+ db SYM_CURSOR_R ; cursor tile number
+ db SYM_SPACE ; tile behind cursor
+ dw NULL ; function pointer if non-0
+.StartMenuParamsEnd
-Func_1d289: ; 1d289 (7:5289)
- INCROM $1d289, $1d2b8
+.StartMenuTextIDs
+ tx NewGameText
+ tx CardPopContinueDiaryNewGameText
+ tx CardPopContinueDiaryNewGameContinueDuelText
-Func_1d2b8: ; 1d2b8 (7:52b8)
- INCROM $1d2b8, $1d2dd
+.DrawPlayerPortrait
+ lb bc, 14, 1
+ farcall $4, DrawPlayerPortrait
+ ret
+; 0x1d1e9
-Func_1d2dd: ; 1d2dd (7:52dd)
- INCROM $1d2dd, $1d306
+; prints the description for the current selected item
+; in the Start Menu in the text box
+PrintStartMenuDescriptionText: ; 1d1e9 (7:51e9)
+ push hl
+ push bc
+ push de
+ ld a, [wCurMenuItem]
+ ld e, a
+ ld a, [wd626]
+ cp e
+ jr z, .skip
+ ld a, [wHasSaveData]
+ or a
+ jr nz, .has_data
+ ; New Game option is 3rd element
+ ; in function table, so add 2
+ inc e
+ inc e
+.has_data
+
+ ld a, e
+ push af
+ lb de, 0, 10
+ lb bc, 20, 8
+ call DrawRegularTextBox
+ pop af
+ ld hl, .StartMenuDescriptionFunctionTable
+ call JumpToFunctionInTable
+.skip
+ ld a, [wCurMenuItem]
+ ld [wd626], a
+ pop de
+ pop bc
+ pop hl
+ ret
+
+.StartMenuDescriptionFunctionTable
+ dw .CardPop
+ dw .ContinueFromDiary
+ dw .NewGame
+ dw .ContinueDuel
+
+.CardPop
+ lb de, 1, 12
+ call InitTextPrinting
+ ldtx hl, WhenYouCardPopWithFriendText
+ call PrintTextNoDelay
+ ret
+
+.ContinueDuel
+ lb de, 1, 12
+ call InitTextPrinting
+ ldtx hl, TheGameWillContinueFromThePointInTheDuelText
+ call PrintTextNoDelay
+ ret
+
+.NewGame
+ lb de, 1, 12
+ call InitTextPrinting
+ ldtx hl, StartANewGameText
+ call PrintTextNoDelay
+ ret
+
+.ContinueFromDiary
+ ; get OW map name
+ ld a, [wCurOverworldMap]
+ add a
+ ld c, a
+ ld b, $00
+ ld hl, OverworldMapNames
+ add hl, bc
+ ld a, [hli]
+ ld [wTxRam2 + 0], a
+ ld a, [hl]
+ ld [wTxRam2 + 1], a
+
+ ; get medal count
+ ld a, [wMedalCount]
+ ld [wTxRam3 + 0], a
+ xor a
+ ld [wTxRam3 + 1], a
+
+ ; print text
+ lb de, 1, 10
+ call InitTextPrinting
+ ldtx hl, ContinueFromDiarySummaryText
+ call PrintTextNoDelay
+
+ ld a, [wTotalNumCardsCollected]
+ ld d, a
+ ld a, [wTotalNumCardsToCollect]
+ ld e, a
+ ld bc, $90e
+ farcall Func_1024f
+ ld bc, $a10
+ farcall Func_101df
+ ret
+; 0x1d289
+
+; asks the player whether it's okay to delete
+; the save data in order to create a new one
+; if player answers "yes", delete it
+DeleteSaveDataForNewGame: ; 1d289 (7:5289)
+; exit if there no save data
+ ld a, [wHasSaveData]
+ or a
+ ret z
+
+ call DisableLCD
+ farcall Func_10000
+ call Func_3ca0
+ farcall FlashWhiteScreen
+ call DoFrameIfLCDEnabled
+ ldtx hl, SavedDataAlreadyExistsText
+ call PrintScrollableText_NoTextBoxLabel
+ ldtx hl, OKToDeleteTheDataText
+ call YesOrNoMenuWithText
+ ret c ; quit if chose "no"
+ farcall InvalidateSaveData
+ ldtx hl, AllDataWasDeletedText
+ call PrintScrollableText_NoTextBoxLabel
+ or a
+ ret
+; 0x1d2b8
+
+; asks the player if the game should resume
+; from diary even though there is Duel save data
+; returns carry if "no" was selected
+AskToContinueFromDiaryWithDuelData: ; 1d2b8 (7:52b8)
+; return if there's no duel save data
+ ld a, [wHasDuelSaveData]
+ or a
+ ret z
+
+ call DisableLCD
+ farcall Func_10000
+ call Func_3ca0
+ farcall FlashWhiteScreen
+ call DoFrameIfLCDEnabled
+ ldtx hl, DataExistsWhenPowerWasTurnedOFFDuringDuelText
+ call PrintScrollableText_NoTextBoxLabel
+ ldtx hl, ContinueFromDiaryText
+ call YesOrNoMenuWithText
+ ret c
+ or a
+ ret
+; 0x1d2dd
+
+; shows disclaimer for Card Pop!
+; in case player is not playing in CGB
+; return carry if disclaimer was shown
+ShowCardPopCGBDisclaimer: ; 1d2dd (7:52dd)
+; return if playing in CGB
+ ld a, [wConsole]
+ cp CONSOLE_CGB
+ ret z
+
+ lb de, 0, 10
+ lb bc, 20, 8
+ call DrawRegularTextBox
+ lb de, 1,12
+ call InitTextPrinting
+ ldtx hl, YouCanAccessCardPopOnlyWithGameBoyColorsText
+ call PrintTextNoDelay
+ lb bc, SYM_CURSOR_D, SYM_BOX_BOTTOM
+ lb de, 18, 17
+ call SetCursorParametersForTextBox
+ call WaitForButtonAorB
+ scf
+ ret
+; 0x1d306
Func_1d306: ; 1d306 (7:5306)
INCROM $1d306, $1d335
Func_1d335: ; 1d335 (7:5335)
- INCROM $1d335, $1d386
+ call DisableLCD
+ farcall Func_10a9b
+ farcall Func_10000
+ call Func_3ca0
+ ld hl, HandleAllSpriteAnimations
+ call SetDoFrameFunction
+ call LoadTitleScreenSprites
+ ld a, LOW(Data_1d59d)
+ ld [wd631 + 0], a
+ ld a, HIGH(Data_1d59d)
+ ld [wd631 + 1], a
+
+ xor a
+ ld [wd317], a
+ ld [wd634], a
+ ld [wd633], a
+ farcall FlashWhiteScreen
-Titlescreen_1d386: ; 1d386 (7:5386)
+.asm_1d364
+ call DoFrameIfLCDEnabled
+ call UpdateRNGSources
+ ldh a, [hKeysPressed]
+ and A_BUTTON | START
+ jr nz, .TitleScreen
+ ld a, [wd634]
+ or a
+ jr z, .asm_1d37a
+ farcall Func_10d74
+.asm_1d37a
+ call Func_1d408
+ ld a, [wd633]
+ cp $ff
+ jr nz, .asm_1d364
+ jr .asm_1d39f
+
+.TitleScreen
call AssertSongFinished
or a
jr nz, .asm_1d39f
@@ -2045,15 +2324,107 @@ Titlescreen_1d386: ; 1d386 (7:5386)
call Func_1d3a9
call EnableLCD
ret
+; 0x1d3a9
Func_1d3a9: ; 1d3a9 (7:53a9)
INCROM $1d3a9, $1d3ce
-Func_1d3ce: ; 1d3ce (7:53ce)
- INCROM $1d3ce, $1d42e
+LoadTitleScreenSprites: ; 1d3ce (7:53ce)
+ xor a
+ ld [wd4ca], a
+ ld [wd4cb], a
+ ld a, PALETTE_30
+ farcall LoadPaletteData
+
+ ld bc, 0
+ ld de, wTitleScreenSprite
+.loop_load_sprites
+ push bc
+ push de
+ ld hl, .TitleScreenSpriteList
+ add hl, bc
+ ld a, [hl]
+ farcall CreateSpriteAndAnimBufferEntry
+ ld a, [wWhichSprite]
+ ld [de], a
+ call GetFirstSpriteAnimBufferProperty
+ inc hl
+ ld a, [hl] ; SPRITE_ANIM_ATTRIBUTES
+ or c
+ ld [hl], a
+ pop de
+ pop bc
+ inc de
+ inc c
+ ld a, c
+ cp $7
+ jr c, .loop_load_sprites
+ ret
+
+.TitleScreenSpriteList
+ db SPRITE_GRASS
+ db SPRITE_FIRE
+ db SPRITE_WATER
+ db SPRITE_COLORLESS
+ db SPRITE_LIGHTNING
+ db SPRITE_PSYCHIC
+ db SPRITE_FIGHTING
+; 0x1d408
+
+Func_1d408: ; 1d408 (7:5408)
+ ld a, [wd633]
+ or a
+ jr z, .call_function
+ cp $ff
+ ret z
+ dec a
+ ld [wd633], a
+ ret
+
+.call_function
+ ld a, [wd631 + 0]
+ ld l, a
+ ld a, [wd631 + 1]
+ ld h, a
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+ ld a, [hli]
+ ld c, a
+ ld a, [hli]
+ ld b, a
+ ld l, e
+ ld h, d
+ call CallHL2
+ jr c, Func_1d408
+ ret
+; 0x1d42e
Func_1d42e: ; 1d42e (7:542e)
- INCROM $1d42e, $1d519
+ ld a, $02
+ jr Func_1d438
+
+Func_1d432: ; 1d432 (7:5432)
+ ld a, $03
+ jr Func_1d438
+
+ ld a, $04
+; fallthrough
+
+Func_1d438: ; 1d438 (7:5438)
+ push hl
+ ld hl, wd631
+ add [hl]
+ ld [hli], a
+ ld a, [hl]
+ adc 0
+ ld [hl], a
+ pop hl
+ ret
+; 0x1d444
+
+ INCROM $1d444, $1d519
Titlescreen_1d519: ; 1d519 (7:5519)
ld a, MUSIC_TITLESCREEN
@@ -2063,10 +2434,73 @@ Titlescreen_1d519: ; 1d519 (7:5519)
ret
; 0x1d523
- INCROM $1d523, $1d59c
+ INCROM $1d523, $1d530
+
+Func_1d530: ; 1d530 (7:5530)
+ ld a, c
+ call PlaySFX
+ call Func_1d432
+ scf
+ ret
+; 0x1d539
+
+ INCROM $1d539, $1d551
+
+ShowCharizardIntro: ; 1d551 (7:5551)
+ lb bc, 6, 3
+ ld a, SCENE_CHARIZARD_INTRO
+ jr LoadIntroSceneAndUpdateSGBBorder
+
+ lb bc, 6, 3
+ ld a, SCENE_SCYTHER_INTRO
+ jr LoadIntroSceneAndUpdateSGBBorder
+
+ lb bc, 6, 3
+ ld a, SCENE_AERODACTYL_INTRO
+; fallthrough
+
+LoadIntroSceneAndUpdateSGBBorder: ; 1d564 (7:5564)
+ call LoadIntroScene
+ ld l, %001010
+ lb bc, 0, 0
+ lb de, 20, 18
+ farcall Func_70498
+ scf
+ ret
+; 0x1d575
+
+ INCROM $1d575, $1d582
+
+; a = scene ID
+; bc = coordinates for scene
+LoadIntroScene: ; 1d582 (7:5582)
+ push af
+ push bc
+ call DisableLCD
+ pop bc
+ pop af
+
+ farcall _LoadScene ; TODO change func name?
+ farcall Func_10d17
+
+ xor a
+ ld [wd634], a
+ call Func_1d42e
+ call EnableLCD
+ ret
+; 0x1d59c
Func_1d59c: ; 1d59c (7:559c)
- INCROM $1d59c, $1d614
+ ret
+; 0x1d59d
+
+Data_1d59d: ; 1d59d (7:559d)
+ dw ShowCharizardIntro
+ dwb Func_1d530, SFX_58
+ dw $5486
+; 0x1d5a4
+
+ INCROM $1d5a4, $1d614
Func_1d614: ; 1d614 (7:5614)
INCROM $1d614, $1d6ad
@@ -2080,7 +2514,7 @@ Credits_1d6ad: ; 1d6ad (7:56ad)
ld [wOWMapEvents + 1], a
ld a, MUSIC_CREDITS
call PlaySong
- farcall Func_10031
+ farcall FlashWhiteScreen
call Func_1d7fc
.asm_1d6c8
call DoFrameIfLCDEnabled
@@ -2116,7 +2550,58 @@ Func_1d765: ; 1d765 (7:5765)
INCROM $1d765, $1d7fc
Func_1d7fc: ; 1d7fc (7:57fc)
- INCROM $1d7fc, $1d80b
+ ld a, LOW(Data_1daef)
+ ld [wd631 + 0], a
+ ld a, HIGH(Data_1daef)
+ ld [wd631 + 1], a
+ xor a
+ ld [wd633], a
+ ret
+; 0x1d80b
Func_1d80b: ; 1d80b (7:580b)
- INCROM $1d80b, $1e1c4
+ INCROM $1d80b, $1d835
+
+Func_1d835: ; 1d835 (7:5835)
+ ld a, $02
+ jr Func_1d847
+
+ ld a, $03
+ jr Func_1d847
+
+ ld a, $05
+ jr Func_1d847
+
+ ld a, $06
+ jr Func_1d847
+
+ ld a, $04
+; fallthrough
+
+Func_1d847: ; 1d847 (7:5847)
+ push hl
+ ld hl, wd631
+ add [hl]
+ ld [hli], a
+ ld a, [hl]
+ adc 0
+ ld [hl], a
+ pop hl
+ ret
+; 0x1d853
+
+ INCROM $1d853, $1d9db
+
+Func_1d9db: ; 1d9db (7:59db)
+ call DisableLCD
+ jp Func_1d835
+; 0x1d9e1
+
+ INCROM $1d9e1, $1daef
+
+Data_1daef: ; 1daef (7:5aef)
+ dw Func_1d9db
+ dw $59d5
+; 0x1daf3
+
+ INCROM $1daf3, $1e1c4
diff --git a/src/engine/bank20.asm b/src/engine/bank20.asm
index daf4004..6d84675 100644
--- a/src/engine/bank20.asm
+++ b/src/engine/bank20.asm
@@ -1416,7 +1416,7 @@ Func_80cd7: ; 80cd7 (20:4cd7)
.loop
call DoFrameIfLCDEnabled
call .HandleInput
- call Func_3cb4
+ call HandleAllSpriteAnimations
ldh a, [hKeysPressed]
and SELECT ; if select is pressed, exit
jr z, .loop
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 5aba9be..6935e0b 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -10603,7 +10603,7 @@ OverworldDoFrameFunction: ; 380e (0:380e)
ld a, BANK(HandleAllNPCMovement)
call BankswitchROM
call HandleAllNPCMovement
- call Func_3cb4
+ call HandleAllSpriteAnimations
ld a, BANK(DoLoadedFramesetSubgroupsFrame)
call BankswitchROM
call DoLoadedFramesetSubgroupsFrame
@@ -11238,7 +11238,7 @@ Func_3ba2: ; 3ba2 (0:3ba2)
ld a, BANK(Func_1cac5)
call BankswitchROM
call Func_1cac5
- call Func_3cb4
+ call HandleAllSpriteAnimations
pop af
call BankswitchROM
ret
@@ -11250,7 +11250,7 @@ Func_3bb5: ; 3bb5 (0:3bb5)
push af
ld a, [wDuelAnimReturnBank]
call BankswitchROM
- call Func_3cb4
+ call HandleAllSpriteAnimations
call CallHL2
pop af
call BankswitchROM
@@ -11450,12 +11450,12 @@ Func_3ca4: ; 3ca4 (0:3ca4)
call BankswitchROM
ret
-Func_3cb4: ; 3cb4 (0:3cb4)
+HandleAllSpriteAnimations: ; 3cb4 (0:3cb4)
ldh a, [hBankROM]
push af
- ld a, BANK(HandleAllSpriteAnimations)
+ ld a, BANK(_HandleAllSpriteAnimations)
call BankswitchROM
- call HandleAllSpriteAnimations
+ call _HandleAllSpriteAnimations
pop af
call BankswitchROM
ret
@@ -11702,7 +11702,7 @@ LoadScene: ; 3df3 (0:3df3)
ret
; draws player's portrait at b,c
-Func_3e10: ; 3e10 (0:3e10)
+DrawPlayerPortrait: ; 3e10 (0:3e10)
ld a, $1
ld [wd61e], a
ld a, TILEMAP_PLAYER
@@ -11728,7 +11728,7 @@ Func_3e2a: ; 3e2a (0:3e2a)
Func_3e31: ; 3e31 (0:3e31)
ldh a, [hBankROM]
push af
- call Func_3cb4
+ call HandleAllSpriteAnimations
ld a, BANK(DoLoadedFramesetSubgroupsFrame)
call BankswitchROM
call DoLoadedFramesetSubgroupsFrame
diff --git a/src/hram.asm b/src/hram.asm
index 6877f9c..bee2cbc 100644
--- a/src/hram.asm
+++ b/src/hram.asm
@@ -180,3 +180,6 @@ hffb5:: ; ffb5
; used in DivideBCbyDE
hffb6:: ; ffb6
ds $1
+
+hffb7:: ; ffb7
+ ds $1
diff --git a/src/text/text3.asm b/src/text/text3.asm
index ffe0f59..ff1565c 100644
--- a/src/text/text3.asm
+++ b/src/text/text3.asm
@@ -1269,29 +1269,29 @@ Text036b: ; 3ec03 (f:6c03)
text "Mail 15"
done
-Text036c: ; 3ec0c (f:6c0c)
+NewGameText: ; 3ec0c (f:6c0c)
text "NEW GAME"
done
-Text036d: ; 3ec16 (f:6c16)
+CardPopContinueDiaryNewGameText: ; 3ec16 (f:6c16)
text "CARD POP!"
line "CONTINUE FROM DIARY"
line "NEW GAME"
done
-Text036e: ; 3ec3e (f:6c3e)
+CardPopContinueDiaryNewGameContinueDuelText: ; 3ec3e (f:6c3e)
text "CARD POP!"
line "CONTINUE FROM DIARY"
line "New Game"
line "CONTINUE DUEL"
done
-Text036f: ; 3ec74 (f:6c74)
+WhenYouCardPopWithFriendText: ; 3ec74 (f:6c74)
text "When you CARD POP! with a friend,"
line "you will each receive a new card!"
done
-Text0370: ; 3ecb9 (f:6cb9)
+ContinueFromDiarySummaryText: ; 3ecb9 (f:6cb9)
text " <RAMNAME> <RAMTEXT>"
line " Master Medals Won "
half2full
@@ -1307,32 +1307,32 @@ Text0370: ; 3ecb9 (f:6cb9)
text ""
done
-Text0371: ; 3ed14 (f:6d14)
+StartANewGameText: ; 3ed14 (f:6d14)
text "Start a New Game."
line ""
done
-Text0372: ; 3ed28 (f:6d28)
+TheGameWillContinueFromThePointInTheDuelText: ; 3ed28 (f:6d28)
text "The Game will continue from "
line "the point in the duel at"
line "which the power was turned OFF."
done
-Text0373: ; 3ed7f (f:6d7f)
+SavedDataAlreadyExistsText: ; 3ed7f (f:6d7f)
text "Saved data already exists."
line "If you continue, you will lose"
line "all the cards you have collected."
done
-Text0374: ; 3eddc (f:6ddc)
+OKToDeleteTheDataText: ; 3eddc (f:6ddc)
text "OK to delete the data?"
done
-Text0375: ; 3edf4 (f:6df4)
+AllDataWasDeletedText: ; 3edf4 (f:6df4)
text "All data was deleted."
done
-Text0376: ; 3ee0b (f:6e0b)
+DataExistsWhenPowerWasTurnedOFFDuringDuelText: ; 3ee0b (f:6e0b)
text "Data exists from when the power "
line "was turned OFF during a duel."
line "Choose CONTINUE DUEL on the"
@@ -1347,11 +1347,11 @@ Text0376: ; 3ee0b (f:6e0b)
line "from the point saved in"
done
-Text0377: ; 3ef50 (f:6f50)
+ContinueFromDiaryText: ; 3ef50 (f:6f50)
text "CONTINUE FROM DIARY?"
done
-Text0378: ; 3ef66 (f:6f66)
+YouCanAccessCardPopOnlyWithGameBoyColorsText: ; 3ef66 (f:6f66)
text "You can access Card Pop! only"
line "with two Game Boy Colors."
line "Please play using a Game Boy Color."
diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm
index b9d2561..10a58e8 100644
--- a/src/text/text_offsets.asm
+++ b/src/text/text_offsets.asm
@@ -877,19 +877,19 @@ TextOffsets:: ; 34000 (d:4000)
textpointer Text0369 ; 0x0369
textpointer Text036a ; 0x036a
textpointer Text036b ; 0x036b
- textpointer Text036c ; 0x036c
- textpointer Text036d ; 0x036d
- textpointer Text036e ; 0x036e
- textpointer Text036f ; 0x036f
- textpointer Text0370 ; 0x0370
- textpointer Text0371 ; 0x0371
- textpointer Text0372 ; 0x0372
- textpointer Text0373 ; 0x0373
- textpointer Text0374 ; 0x0374
- textpointer Text0375 ; 0x0375
- textpointer Text0376 ; 0x0376
- textpointer Text0377 ; 0x0377
- textpointer Text0378 ; 0x0378
+ textpointer NewGameText ; 0x036c
+ textpointer CardPopContinueDiaryNewGameText ; 0x036d
+ textpointer CardPopContinueDiaryNewGameContinueDuelText ; 0x036e
+ textpointer WhenYouCardPopWithFriendText ; 0x036f
+ textpointer ContinueFromDiarySummaryText ; 0x0370
+ textpointer StartANewGameText ; 0x0371
+ textpointer TheGameWillContinueFromThePointInTheDuelText ; 0x0372
+ textpointer SavedDataAlreadyExistsText ; 0x0373
+ textpointer OKToDeleteTheDataText ; 0x0374
+ textpointer AllDataWasDeletedText ; 0x0375
+ textpointer DataExistsWhenPowerWasTurnedOFFDuringDuelText ; 0x0376
+ textpointer ContinueFromDiaryText ; 0x0377
+ textpointer YouCanAccessCardPopOnlyWithGameBoyColorsText ; 0x0378
textpointer Text0379 ; 0x0379
textpointer Text037a ; 0x037a
textpointer Text037b ; 0x037b
diff --git a/src/wram.asm b/src/wram.asm
index ff74424..f625a2a 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -2497,14 +2497,27 @@ wd291:: ; d291
wWriteBGMapToSRAM:: ; d292
ds $1
- ds $4
+wd293:: ; d293
+ ds $1
+
+wd294:: ; d294
+ ds $1
+
+wd295:: ; d295
+ ds $1
+
+wd296:: ; d296
+ ds $1
; temporarily holds the palettes from
; wBackgroundPalettesCGB
wTempBackgroundPalettesCGB:: ; d297
ds 8 palettes
- ds $41
+ ds $40
+
+wd317:: ; d317
+ ds $1
; pointer to the data of current map OW frameset
wCurMapOWFrameset:: ; d318
@@ -2997,10 +3010,12 @@ wSceneSGBPacketPtr:: ; d620
wSceneSGBRoutinePtr:: ; d622
ds $2
-wd624:: ; d624
+; whether there exists valid save data
+wHasSaveData:: ; d624
ds $1
-wd625:: ; d625
+; whether has valid duel save data
+wHasDuelSaveData:: ; d625
ds $1
wd626:: ; d626
@@ -3009,23 +3024,35 @@ wd626:: ; d626
wd627:: ; d627
ds $1
-wd628:: ; d628
+; START_MENU_* constant chosen
+; by the player in the Start Menu
+wStartMenuChoice:: ; d628
ds $1
- ds $a
+; list of sprites used in the Title Screen
+wTitleScreenSprite:: ; d629
+ ds $7
+
+ ds $1
+
+wd631:: ; d631
+ ds $2
wd633:: ; d633
ds $1
+wd634:: ; d634
ds $1
wd635:: ; d635
ds $1
-wd636:: ; d635
- ds $1
+; has parameters used for the Start Menu
+; check SetStartMenuParams for what parameters are set
+wStartMenuParams:: ; d636
+ ds $11
- ds $14
+ ds $4
; wd64b to wd665 used by Func_3e44
wd64b:: ; d64b