ref: 042fc4bfe5f55df87712d33b6f832a591b136f1a
parent: ba871547eda6e17e988f4e1dfa7b899050205d5e
author: PikalaxALT <PikalaxALT@gmail.com>
date: Mon Nov 16 16:46:36 EST 2015
Split up some more banks in main.asm
--- /dev/null
+++ b/engine/money.asm
@@ -1,0 +1,209 @@
+GiveMoney:: ; 15fd7
+ ld a, $3
+ call AddMoney
+ ld bc, MaxMoney
+ ld a, $3
+ call CompareMoney
+ jr z, .asm_15ff5
+ jr c, .asm_15ff5
+ ld hl, MaxMoney
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ scf
+ ret
+
+.asm_15ff5
+ and a
+ ret
+; 15ff7
+
+MaxMoney: ; 15ff7
+ dt 999999
+; 15ffa
+
+
+TakeMoney:: ; 15ffa
+ ld a, 3
+ call SubtractMoney
+ jr nc, .asm_16009
+ xor a
+ ld [de], a
+ inc de
+ ld [de], a
+ inc de
+ ld [de], a
+ scf
+ ret
+
+.asm_16009
+ and a
+ ret
+; 1600b
+
+CompareMoney:: ; 1600b
+ ld a, $3
+CompareFunds: ; 1600d
+ push hl
+ push de
+ push bc
+ ld h, b
+ ld l, c
+ ld c, $0
+ ld b, a
+.loop1
+ dec a
+ jr z, .done
+ inc de
+ inc hl
+ jr .loop1
+
+.done
+ and a
+.loop2
+ ld a, [de]
+ sbc [hl]
+ jr z, .okay
+ inc c
+
+.okay
+ dec de
+ dec hl
+ dec b
+ jr nz, .loop2
+ jr c, .set_carry
+ ld a, c
+ and a
+ jr .skip_carry
+
+.set_carry
+ ld a, $1
+ and a
+ scf
+
+.skip_carry
+ pop bc
+ pop de
+ pop hl
+ ret
+; 16035
+
+SubtractMoney: ; 16035
+ ld a, 3
+SubtractFunds: ; 16037
+ push hl
+ push de
+ push bc
+ ld h, b
+ ld l, c
+ ld b, a
+ ld c, 0
+.loop
+ dec a
+ jr z, .done
+ inc de
+ inc hl
+ jr .loop
+
+.done
+ and a
+.loop2
+ ld a, [de]
+ sbc [hl]
+ ld [de], a
+ dec de
+ dec hl
+ dec b
+ jr nz, .loop2
+ pop bc
+ pop de
+ pop hl
+ ret
+; 16053
+
+AddMoney: ; 16053
+ ld a, $3
+AddFunds: ; 16055
+ push hl
+ push de
+ push bc
+ ld h, b
+ ld l, c
+ ld b, a
+.loop1
+ dec a
+ jr z, .done
+ inc de
+ inc hl
+ jr .loop1
+
+.done
+ and a
+.loop2
+ ld a, [de]
+ adc [hl]
+ ld [de], a
+ dec de
+ dec hl
+ dec b
+ jr nz, .loop2
+ pop bc
+ pop de
+ pop hl
+ ret
+; 1606f
+
+GiveCoins:: ; 1606f
+ ld a, 2
+ ld de, Coins
+ call AddFunds
+ ld a, 2
+ ld bc, .maxcoins
+ call CompareFunds
+ jr c, .not_maxed
+ ld hl, .maxcoins
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ scf
+ ret
+
+.not_maxed
+ and a
+ ret
+; 1608d
+
+.maxcoins: ; 1608d
+ bigdw 9999
+; 1608f
+
+
+TakeCoins:: ; 1608f
+ ld a, 2
+ ld de, Coins
+ call SubtractFunds
+ jr nc, .asm_1609f
+ xor a
+ ld [de], a
+ inc de
+ ld [de], a
+ scf
+ ret
+
+.asm_1609f
+ and a
+ ret
+; 160a1
+
+CheckCoins:: ; 160a1
+ ld a, $2
+ ld de, Coins
+ jp CompareFunds
+; 160a9
--- /dev/null
+++ b/engine/pokecenter_pc.asm
@@ -1,0 +1,705 @@
+PokemonCenterPC: ; 1559a
+ call PC_CheckPartyForPokemon
+ ret c
+ call PC_PlayBootSound
+ ld hl, UnknownText_0x15a27
+ call PC_DisplayText
+ ld hl, UnknownText_0x15a2c
+ call PC_DisplayTextWaitMenu
+ ld hl, .TopMenu
+ call LoadMenuDataHeader
+.loop
+ xor a
+ ld [hBGMapMode], a
+ call .ChooseWhichPCListToUse
+ ld [wcf76], a
+ call DoNthMenu
+ jr c, .shutdown
+ ld a, [MenuSelection]
+ ld hl, .JumpTable
+ call MenuJumptable
+ jr nc, .loop
+
+.shutdown
+ call PC_PlayShutdownSound
+ call ExitMenu
+ call WriteBackup
+ ret
+; 155d6
+
+.TopMenu: ; 0x155d6
+ db $48 ; flags
+ db 00, 00 ; start coords
+ db 12, 15 ; end coords
+ dw .MenuData2
+ db 1 ; default option
+; 0x155de
+
+.MenuData2: ; 0x155de
+ db $a0 ; flags
+ db 0 ; items
+ dw .WhichPC
+ dw PlaceNthMenuStrings
+ dw .JumpTable
+; 0x155e6
+
+.JumpTable: ; 155e6
+ dw PlayersPC, .String_PlayersPC
+ dw BillsPC, .String_BillsPC
+ dw OaksPC, .String_OaksPC
+ dw HallOfFamePC, .String_HallOfFame
+ dw TurnOffPC, .String_TurnOff
+; 155fa
+
+.String_PlayersPC: db "<PLAYER>'s PC@"
+.String_BillsPC: db "BILL's PC@"
+.String_OaksPC: db "PROF.OAK's PC@"
+.String_HallOfFame: db "HALL OF FAME@"
+.String_TurnOff: db "TURN OFF@"
+; 1562c
+
+.WhichPC: ; 1562c
+ ; before pokedex
+ db 3 ; items
+ db 1, 0, 4 ; bill's, player's, turn off
+ db -1
+
+ ; before Hall Of Fame
+ db 4 ; items
+ db 1, 0, 2, 4 ; bill's, player's, oak's, turn off
+ db -1
+
+ ; postgame
+ db 5 ; items
+ db 1, 0, 2, 3, 4 ; bill's, player's, oak's, hall of fame, turn off
+ db -1
+; 1563e
+
+.ChooseWhichPCListToUse: ; 1563e
+ call CheckReceivedDex
+ jr nz, .got_dex
+ ld a, $0
+ ret
+
+.got_dex
+ ld a, [wHallOfFameCount]
+ and a
+ ld a, $1
+ ret z
+ ld a, $2
+ ret
+; 15650
+
+PC_CheckPartyForPokemon: ; 15650
+ ld a, [PartyCount]
+ and a
+ ret nz
+ ld de, SFX_CHOOSE_PC_OPTION
+ call PlaySFX
+ ld hl, UnknownText_0x15663
+ call PC_DisplayText
+ scf
+ ret
+; 15663
+
+UnknownText_0x15663: ; 0x15663
+ ; Bzzzzt! You must have a #MON to use this!
+ text_jump UnknownText_0x1c1328
+ db "@"
+; 0x15668
+
+BillsPC: ; 15668
+ call PC_PlayChoosePCSound
+ ld hl, UnknownText_0x15a31
+ call PC_DisplayText
+ callba _BillsPC
+ and a
+ ret
+; 15679 (5:5679)
+
+PlayersPC: ; 15679
+ call PC_PlayChoosePCSound
+ ld hl, UnknownText_0x15a36
+ call PC_DisplayText
+ ld b, $0
+ call _PlayersPC
+ and a
+ ret
+; 15689
+
+OaksPC: ; 15689
+ call PC_PlayChoosePCSound
+ ld hl, UnknownText_0x15a3b
+ call PC_DisplayText
+ callba ProfOaksPC
+ and a
+ ret
+; 1569a
+
+HallOfFamePC: ; 1569a
+ call PC_PlayChoosePCSound
+ call FadeToMenu
+ callba _HallOfFamePC
+ call Function2b3c
+ and a
+ ret
+; 156ab
+
+TurnOffPC: ; 156ab
+ ld hl, UnknownText_0x15a40
+ call PrintText
+ scf
+ ret
+; 156b3
+
+PC_PlayBootSound: ; 156b3
+ ld de, SFX_BOOT_PC
+ jr PC_WaitPlaySFX
+
+PC_PlayShutdownSound: ; 156b8
+ ld de, SFX_SHUT_DOWN_PC
+ call PC_WaitPlaySFX
+ call WaitSFX
+ ret
+
+PC_PlayChoosePCSound: ; 156c2
+ ld de, SFX_CHOOSE_PC_OPTION
+ jr PC_WaitPlaySFX
+
+Function156c7: ; 156c7
+ ld de, SFX_SWITCH_POKEMON
+ call PC_WaitPlaySFX
+ ld de, SFX_SWITCH_POKEMON
+
+PC_WaitPlaySFX: ; 156d0
+ push de
+ call WaitSFX
+ pop de
+ call PlaySFX
+ ret
+; 156d9
+
+Function156d9: ; 156d9
+ call PC_PlayBootSound
+ ld hl, UnknownText_0x156ff
+ call PC_DisplayText
+ ld b, $1
+ call _PlayersPC
+ and a
+ jr nz, .asm_156f9
+ call OverworldTextModeSwitch
+ call Function321c
+ call UpdateSprites
+ call PC_PlayShutdownSound
+ ld c, $0
+ ret
+
+.asm_156f9
+ call ClearBGPalettes
+ ld c, $1
+ ret
+; 156ff
+
+UnknownText_0x156ff: ; 0x156ff
+ ; turned on the PC.
+ text_jump UnknownText_0x1c1353
+ db "@"
+; 0x15704
+
+_PlayersPC: ; 15704
+ ld a, b
+ ld [wcf76], a
+ ld hl, UnknownText_0x157cc
+ call PC_DisplayTextWaitMenu
+ call Function15715
+ call ExitMenu
+ ret
+; 15715
+
+Function15715: ; 15715
+ xor a
+ ld [wd0d7], a
+ ld [wd0dd], a
+ ld hl, KrissPCMenuData
+ call LoadMenuDataHeader
+.asm_15722
+ call UpdateTimePals
+ call DoNthMenu
+ jr c, .asm_15731
+ call MenuJumptable
+ jr nc, .asm_15722
+ jr .asm_15732
+
+.asm_15731
+ xor a
+
+.asm_15732
+ call ExitMenu
+ ret
+; 15736
+
+KrissPCMenuData: ; 0x15736
+ db %01000000
+ db 0, 0 ; top left corner coords (y, x)
+ db 12, 15 ; bottom right corner coords (y, x)
+ dw .KrissPCMenuData2
+ db 1 ; default selected option
+
+.KrissPCMenuData2
+ db %10100000 ; bit7
+ db 0 ; # items?
+ dw .KrissPCMenuList1
+ dw PlaceNthMenuStrings
+ dw .KrissPCMenuPointers
+
+.KrissPCMenuPointers ; 0x15746
+ dw KrisWithdrawItemMenu, .WithdrawItem
+ dw KrisDepositItemMenu, .DepositItem
+ dw KrisTossItemMenu, .TossItem
+ dw KrisMailBoxMenu, .MailBox
+ dw KrisDecorationMenu, .Decoration
+ dw KrisLogOffMenu, .LogOff
+ dw KrisLogOffMenu, .TurnOff
+
+.WithdrawItem db "WITHDRAW ITEM@"
+.DepositItem db "DEPOSIT ITEM@"
+.TossItem db "TOSS ITEM@"
+.MailBox db "MAIL BOX@"
+.Decoration db "DECORATION@"
+.TurnOff db "TURN OFF@"
+.LogOff db "LOG OFF@"
+
+WITHDRAW_ITEM EQU 0
+DEPOSIT_ITEM EQU 1
+TOSS_ITEM EQU 2
+MAIL_BOX EQU 3
+DECORATION EQU 4
+TURN_OFF EQU 5
+LOG_OFF EQU 6
+
+.KrissPCMenuList1
+ db 5
+ db WITHDRAW_ITEM
+ db DEPOSIT_ITEM
+ db TOSS_ITEM
+ db MAIL_BOX
+ db TURN_OFF
+ db -1
+
+.KrissPCMenuList2
+ db 6
+ db WITHDRAW_ITEM
+ db DEPOSIT_ITEM
+ db TOSS_ITEM
+ db MAIL_BOX
+ db DECORATION
+ db LOG_OFF
+ db -1
+
+PC_DisplayTextWaitMenu: ; 157bb
+ ld a, [Options]
+ push af
+ set NO_TEXT_SCROLL, a
+ ld [Options], a
+ call MenuTextBox
+ pop af
+ ld [Options], a
+ ret
+; 157cc
+
+UnknownText_0x157cc: ; 0x157cc
+ ; What do you want to do?
+ text_jump UnknownText_0x1c1368
+ db "@"
+; 0x157d1
+
+KrisWithdrawItemMenu: ; 0x157d1
+ call LoadStandardMenuDataHeader
+ callba ClearPCItemScreen
+.asm_157da
+ call Function15985
+ jr c, .asm_157e4
+ call Function157e9
+ jr .asm_157da
+
+.asm_157e4
+ call Function2b3c
+ xor a
+ ret
+; 0x157e9
+
+Function157e9: ; 0x157e9
+ ; check if the item has a quantity
+ callba _CheckTossableItem
+ ld a, [wItemAttributeParamBuffer]
+ and a
+ jr z, .askquantity
+
+ ; items without quantity are always ×1
+ ld a, 1
+ ld [wItemQuantityChangeBuffer], a
+ jr .withdraw
+
+.askquantity
+ ld hl, .HowManyText
+ call MenuTextBox
+ callba Function24fbf
+ call ExitMenu
+ call ExitMenu
+ jr c, .done
+
+.withdraw
+ ld a, [wItemQuantityChangeBuffer]
+ ld [Buffer1], a ; quantity
+ ld a, [wd107]
+ ld [Buffer2], a
+ ld hl, NumItems
+ call ReceiveItem
+ jr nc, .PackFull
+ ld a, [Buffer1]
+ ld [wItemQuantityChangeBuffer], a
+ ld a, [Buffer2]
+ ld [wd107], a
+ ld hl, PCItems
+ call TossItem
+ predef PartyMonItemName
+ ld hl, .WithdrewText
+ call MenuTextBox
+ xor a
+ ld [hBGMapMode], a
+ call ExitMenu
+ ret
+
+.PackFull
+ ld hl, .NoRoomText
+ call MenuTextBoxBackup
+ ret
+
+.done
+ ret
+; 0x15850
+
+.HowManyText ; 0x15850
+ text_jump _KrissPCHowManyWithdrawText
+ db "@"
+
+.WithdrewText ; 0x15855
+ text_jump _KrissPCWithdrewItemsText
+ db "@"
+
+.NoRoomText ; 0x1585a
+ text_jump _KrissPCNoRoomWithdrawText
+ db "@"
+
+
+KrisTossItemMenu: ; 0x1585f
+ call LoadStandardMenuDataHeader
+ callba ClearPCItemScreen
+.asm_15868
+ call Function15985
+ jr c, .asm_15878
+ ld de, PCItems
+ callba Function129f4
+ jr .asm_15868
+
+.asm_15878
+ call Function2b3c
+ xor a
+ ret
+; 0x1587d
+
+
+KrisDecorationMenu: ; 0x1587d
+ callba _KrisDecorationMenu
+ ld a, c
+ and a
+ ret z
+ scf
+ ret
+; 0x15888
+
+
+KrisLogOffMenu: ; 0x15888
+ xor a
+ scf
+ ret
+; 0x1588b
+
+
+KrisDepositItemMenu: ; 0x1588b
+ call Function158b8
+ jr c, .asm_158b6
+ call DisableSpriteUpdates
+ call LoadStandardMenuDataHeader
+ callba Function106a5
+.asm_1589c
+ callba Function106be
+ ld a, [wcf66]
+ and a
+ jr z, .asm_158b3
+ call Function158cc
+ callba CheckRegisteredItem
+ jr .asm_1589c
+
+.asm_158b3
+ call Function2b3c
+
+.asm_158b6
+ xor a
+ ret
+; 0x158b8
+
+Function158b8: ; 0x158b8
+ callba Function129d5
+ ret nc
+ ld hl, UnknownText_0x158c7
+ call MenuTextBoxBackup
+ scf
+ ret
+; 0x158c7
+
+UnknownText_0x158c7: ; 0x158c7
+ ; No items here!
+ text_jump UnknownText_0x1c13df
+ db "@"
+; 0x158cc
+
+
+Function158cc: ; 0x158cc
+ ld a, [wc2ce]
+ push af
+ ld a, $0
+ ld [wc2ce], a
+ callba CheckItemMenu
+ ld a, [wItemAttributeParamBuffer]
+ ld hl, .jumptable
+ rst JumpTable
+ pop af
+ ld [wc2ce], a
+ ret
+; 0x158e7
+
+.jumptable: ; 0x158e7
+ dw .tossable
+ dw .no_toss
+ dw .no_toss
+ dw .no_toss
+ dw .tossable
+ dw .tossable
+ dw .tossable
+
+.no_toss:
+ ret
+
+.tossable:
+ ld a, [Buffer1]
+ push af
+ ld a, [Buffer2]
+ push af
+ call Function1590a
+ pop af
+ ld [Buffer2], a
+ pop af
+ ld [Buffer1], a
+ ret
+; 0x1590a
+
+Function1590a: ; 0x1590a
+ callba _CheckTossableItem
+ ld a, [wItemAttributeParamBuffer]
+ and a
+ jr z, .asm_1591d
+ ld a, $1
+ ld [wItemQuantityChangeBuffer], a
+ jr .asm_15933
+
+.asm_1591d
+ ld hl, .HowManyText
+ call MenuTextBox
+ callba Function24fbf
+ push af
+ call ExitMenu
+ call ExitMenu
+ pop af
+ jr c, .asm_1596c
+
+.asm_15933
+ ld a, [wItemQuantityChangeBuffer]
+ ld [Buffer1], a
+ ld a, [wd107]
+ ld [Buffer2], a
+ ld hl, PCItems
+ call ReceiveItem
+ jr nc, .asm_15965
+ ld a, [Buffer1]
+ ld [wItemQuantityChangeBuffer], a
+ ld a, [Buffer2]
+ ld [wd107], a
+ ld hl, NumItems
+ call TossItem
+ predef PartyMonItemName
+ ld hl, .DepositText
+ call PrintText
+ ret
+
+.asm_15965
+ ld hl, .NoRoomText
+ call PrintText
+ ret
+
+.asm_1596c
+ and a
+ ret
+; 0x1596e
+
+
+.HowManyText ; 0x1596e
+ text_jump _KrissPCHowManyDepositText
+ db "@"
+
+.DepositText ; 0x15973
+ text_jump _KrissPCDepositItemsText
+ db "@"
+
+.NoRoomText ; 0x15978
+ text_jump _KrissPCNoRoomDepositText
+ db "@"
+
+
+KrisMailBoxMenu: ; 0x1597d
+ callba _KrisMailBoxMenu
+ xor a
+ ret
+; 0x15985
+
+
+Function15985: ; 0x15985
+ xor a
+ ld [wd0e3], a
+.asm_15989
+ ld a, [wc2ce]
+ push af
+ ld a, $0
+ ld [wc2ce], a
+ ld hl, MenuData15a08
+ call CopyMenuDataHeader
+ hlcoord 0, 0
+ ld b, $a
+ ld c, $12
+ call TextBox
+ ld a, [wd0d7]
+ ld [wMenuCursorBuffer], a
+ ld a, [wd0dd]
+ ld [wd0e4], a
+ call HandleScrollingMenu
+ ld a, [wd0e4]
+ ld [wd0dd], a
+ ld a, [MenuSelection2]
+ ld [wd0d7], a
+ pop af
+ ld [wc2ce], a
+ ld a, [wd0e3]
+ and a
+ jr nz, .asm_159d8
+ ld a, [wcf73]
+ cp $2
+ jr z, .asm_15a06
+ cp $1
+ jr z, .asm_159fb
+ cp $4
+ jr z, .asm_159f2
+ jr .asm_159f8
+
+.asm_159d8
+ ld a, [wcf73]
+ cp $2
+ jr z, .asm_159e9
+ cp $1
+ jr z, .asm_159ef
+ cp $4
+ jr z, .asm_159ef
+ jr .asm_159f8
+
+.asm_159e9
+ xor a
+ ld [wd0e3], a
+ jr .asm_159f8
+
+.asm_159ef
+ call Function156c7
+
+.asm_159f2
+ callba Function2490c
+
+.asm_159f8
+ jp .asm_15989
+
+.asm_159fb
+ callba Function24706
+ call Function1bee
+ and a
+ ret
+
+.asm_15a06
+ scf
+ ret
+; 0x15a08
+
+MenuData15a08: ; 0x15a08
+ db %01000000
+ db 1, 4 ; start coords
+ db 10, 18 ; end coords
+ dw .MenuData2
+ db 1 ; default option
+
+.MenuData2
+ db %10110000
+ db 4, 8 ; rows/cols?
+ db 2 ; horizontal spacing?
+ dbw 0, PCItems
+ dba PlaceMenuItemName
+ dba PlaceMenuItemQuantity
+ dba Function244c3
+
+PC_DisplayText: ; 15a20
+ call MenuTextBox
+ call ExitMenu
+ ret
+; 15a27
+
+
+UnknownText_0x15a27: ; 0x15a27
+ ; turned on the PC.
+ text_jump UnknownText_0x1c144d
+ db "@"
+; 0x15a2c
+
+UnknownText_0x15a2c: ; 0x15a2c
+ ; Access whose PC?
+ text_jump UnknownText_0x1c1462
+ db "@"
+; 0x15a31
+
+UnknownText_0x15a31: ; 0x15a31
+ ; BILL's PC accessed. #MON Storage System opened.
+ text_jump UnknownText_0x1c1474
+ db "@"
+; 0x15a36
+
+UnknownText_0x15a36: ; 0x15a36
+ ; Accessed own PC. Item Storage System opened.
+ text_jump UnknownText_0x1c14a4
+ db "@"
+; 0x15a3b
+
+UnknownText_0x15a3b: ; 0x15a3b
+ ; PROF.OAK's PC accessed. #DEX Rating System opened.
+ text_jump UnknownText_0x1c14d2
+ db "@"
+; 0x15a40
+
+UnknownText_0x15a40: ; 0x15a40
+ ; … Link closed…
+ text_jump UnknownText_0x1c1505
+ db "@"
+; 0x15a45
--- /dev/null
+++ b/engine/timeset.asm
@@ -1,0 +1,771 @@
+InitClock: ; 90672 (24:4672)
+; Ask the player to set the time.
+ ld a, [hInMenu]
+ push af
+ ld a, $1
+ ld [hInMenu], a
+
+ ld a, $0
+ ld [wc2ce], a
+ ld a, $10
+ ld [MusicFade], a
+ ld a, MUSIC_NONE % $100
+ ld [MusicFadeIDLo], a
+ ld a, MUSIC_NONE / $100
+ ld [MusicFadeIDHi], a
+ ld c, 8
+ call DelayFrames
+ call Function4dd
+ call ClearTileMap
+ call ClearSprites
+ ld b, SCGB_08
+ call GetSGBLayout
+ xor a
+ ld [hBGMapMode], a
+ call LoadStandardFont
+ ld de, GFX_908fb
+ ld hl, VTiles2 tile $00
+ lb bc, BANK(GFX_908fb), 1
+ call Request1bpp
+ ld de, GFX_90903
+ ld hl, VTiles2 tile $01
+ lb bc, BANK(GFX_90903), 1
+ call Request1bpp
+ ld de, GFX_9090b
+ ld hl, VTiles2 tile $02
+ lb bc, BANK(GFX_9090b), 1
+ call Request1bpp
+ call .ClearScreen
+ call WaitBGMap
+ call Function4a3
+ ld hl, UnknownText_0x90874
+ call PrintText
+ ld hl, wc608
+ ld bc, 50
+ xor a
+ call ByteFill
+ ld a, $a
+ ld [wInitHourBuffer], a
+
+.loop
+ ld hl, UnknownText_0x90879
+ call PrintText
+ hlcoord 3, 7
+ ld b, 2
+ ld c, 15
+ call TextBox
+ hlcoord 11, 7
+ ld [hl], $1
+ hlcoord 11, 10
+ ld [hl], $2
+ hlcoord 4, 9
+ call DisplayHourOClock
+ ld c, 10
+ call DelayFrames
+
+.SetHourLoop
+ call JoyTextDelay
+ call SetHour
+ jr nc, .SetHourLoop
+
+ ld a, [wInitHourBuffer]
+ ld [StringBuffer2 + 1], a
+ call .ClearScreen
+ ld hl, UnknownText_0x90886
+ call PrintText
+ call YesNoBox
+ jr nc, .HourIsSet
+ call .ClearScreen
+ jr .loop
+
+.HourIsSet
+ ld hl, UnknownText_0x9089a
+ call PrintText
+ hlcoord 11, 7
+ lb bc, 2, 7
+ call TextBox
+ hlcoord 15, 7
+ ld [hl], $1
+ hlcoord 15, 10
+ ld [hl], $2
+ hlcoord 12, 9
+ call DisplayMinutesWithMinString
+ ld c, 10
+ call DelayFrames
+
+.SetMinutesLoop
+ call JoyTextDelay
+ call SetMinutes
+ jr nc, .SetMinutesLoop
+
+ ld a, [BattleMonNick + 5]
+ ld [StringBuffer2 + 2], a
+ call .ClearScreen
+ ld hl, UnknownText_0x908a4
+ call PrintText
+ call YesNoBox
+ jr nc, .MinutesAreSet
+ call .ClearScreen
+ jr .HourIsSet
+
+.MinutesAreSet
+ call Function658
+ ld hl, OakText_ResponseToSetTime
+ call PrintText
+ call WaitPressAorB_BlinkCursor
+ pop af
+ ld [hInMenu], a
+ ret
+
+.ClearScreen: ; 90783 (24:4783)
+ xor a
+ ld [hBGMapMode], a
+ hlcoord 0, 0
+ ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
+ xor a
+ call ByteFill
+ ld a, $1
+ ld [hBGMapMode], a
+ ret
+
+SetHour: ; 90795 (24:4795)
+ ld a, [hJoyPressed]
+ and A_BUTTON
+ jr nz, .Confirm
+
+ ld hl, hJoyLast
+ ld a, [hl]
+ and D_UP
+ jr nz, .up
+ ld a, [hl]
+ and D_DOWN
+ jr nz, .down
+ call DelayFrame
+ and a
+ ret
+
+.down
+ ld hl, wInitHourBuffer
+ ld a, [hl]
+ and a
+ jr nz, .DecreaseThroughMidnight
+ ld a, 23 + 1
+.DecreaseThroughMidnight
+ dec a
+ ld [hl], a
+ jr .okay
+
+.up
+ ld hl, wInitHourBuffer
+ ld a, [hl]
+ cp 23
+ jr c, .AdvanceThroughMidnight
+ ld a, -1
+.AdvanceThroughMidnight
+ inc a
+ ld [hl], a
+
+.okay
+ hlcoord 4, 9
+ ld a, " "
+ ld bc, 15
+ call ByteFill
+ hlcoord 4, 9
+ call DisplayHourOClock
+ call WaitBGMap
+ and a
+ ret
+
+.Confirm
+ scf
+ ret
+
+DisplayHourOClock: ; 907de (24:47de)
+ push hl
+ ld a, [wInitHourBuffer]
+ ld c, a
+ ld e, l
+ ld d, h
+ call PrintHour
+ inc hl
+ ld de, String_oclock
+ call PlaceString
+ pop hl
+ ret
+; 907f1 (24:47f1)
+
+Function907f1: ; 907f1
+ ld h, d
+ ld l, e
+ push hl
+ call DisplayHourOClock
+ pop de
+rept 2
+ inc de
+endr
+ ld a, $9c
+ ld [de], a
+ inc de
+ push de
+ ld hl, $3
+ add hl, de
+ ld a, [de]
+ inc de
+ ld [hli], a
+ ld a, [de]
+ ld [hl], a
+ pop hl
+ call DisplayMinutesWithMinString
+rept 3
+ inc hl
+endr
+ ret
+; 90810
+
+SetMinutes: ; 90810 (24:4810)
+ ld a, [hJoyPressed]
+ and A_BUTTON
+ jr nz, .asm_90857
+ ld hl, hJoyLast
+ ld a, [hl]
+ and D_UP
+ jr nz, .asm_90835
+ ld a, [hl]
+ and D_DOWN
+ jr nz, .asm_90828
+ call DelayFrame
+ and a
+ ret
+.asm_90828
+ ld hl, BattleMonNick + 5
+ ld a, [hl]
+ and a
+ jr nz, .asm_90831
+ ld a, 59 + 1
+.asm_90831
+ dec a
+ ld [hl], a
+ jr .asm_90841
+.asm_90835
+ ld hl, BattleMonNick + 5
+ ld a, [hl]
+ cp 59
+ jr c, .asm_9083f
+ ld a, -1
+.asm_9083f
+ inc a
+ ld [hl], a
+.asm_90841
+ hlcoord 12, 9
+ ld a, " "
+ ld bc, 7
+ call ByteFill
+ hlcoord 12, 9
+ call DisplayMinutesWithMinString
+ call WaitBGMap
+ and a
+ ret
+.asm_90857
+ scf
+ ret
+
+DisplayMinutesWithMinString: ; 90859 (24:4859)
+ ld de, BattleMonNick + 5
+ call PrintTwoDigitNumberRightAlign
+ inc hl
+ ld de, String_min
+ call PlaceString
+ ret
+
+PrintTwoDigitNumberRightAlign: ; 90867 (24:4867)
+ push hl
+ ld a, " "
+ ld [hli], a
+ ld [hl], a
+ pop hl
+ lb bc, PRINTNUM_RIGHTALIGN | 1, 2
+ call PrintNum
+ ret
+; 90874 (24:4874)
+
+UnknownText_0x90874: ; 0x90874
+ ; Zzz… Hm? Wha…? You woke me up! Will you check the clock for me?
+ text_jump UnknownText_0x1bc29c
+ db "@"
+; 0x90879
+
+UnknownText_0x90879: ; 0x90879
+ ; What time is it?
+ text_jump UnknownText_0x1bc2eb
+ db "@"
+; 0x9087e
+
+String_oclock:
+ db "o'clock@"
+; 90886
+
+UnknownText_0x90886: ; 0x90886
+ ; What?@ @
+ text_jump UnknownText_0x1bc2fd
+ start_asm
+ hlcoord 1, 16
+ call DisplayHourOClock
+ ld hl, UnknownText_0x90895
+ ret
+; 90895 (24:4895)
+
+UnknownText_0x90895: ; 0x90895
+ ; ?
+ text_jump UnknownText_0x1bc305
+ db "@"
+; 0x9089a
+
+UnknownText_0x9089a: ; 0x9089a
+ ; How many minutes?
+ text_jump UnknownText_0x1bc308
+ db "@"
+; 0x9089f
+
+String_min:
+ db "min.@"
+; 908a4
+
+UnknownText_0x908a4: ; 0x908a4
+ ; Whoa!@ @
+ text_jump UnknownText_0x1bc31b
+ start_asm
+; 0x908a9
+ hlcoord 7, 14
+ call DisplayMinutesWithMinString
+ ld hl, UnknownText_0x908b3
+ ret
+; 908b3 (24:48b3)
+
+UnknownText_0x908b3: ; 0x908b3
+ ; ?
+ text_jump UnknownText_0x1bc323
+ db "@"
+; 0x908b8
+
+OakText_ResponseToSetTime: ; 0x908b8
+ start_asm
+ decoord 1, 14
+ ld a, [wInitHourBuffer]
+ ld c, a
+ call PrintHour
+ ld [hl], ":"
+ inc hl
+ ld de, BattleMonNick + 5
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 2
+ call PrintNum
+ ld b, h
+ ld c, l
+ ld a, [wInitHourBuffer]
+ cp 4
+ jr c, .NITE
+ cp 11
+ jr c, .MORN
+ cp 18
+ jr c, .DAY
+.NITE
+ ld hl, .sodark
+ ret
+.MORN
+ ld hl, .overslept
+ ret
+.DAY
+ ld hl, .yikes
+ ret
+; 908ec (24:48ec)
+
+.overslept: ; 0x908ec
+ ; ! I overslept!
+ text_jump UnknownText_0x1bc326
+ db "@"
+; 0x908f1
+
+.yikes: ; 0x908f1
+ ; ! Yikes! I over- slept!
+ text_jump UnknownText_0x1bc336
+ db "@"
+; 0x908f6
+
+.sodark: ; 0x908f6
+ ; ! No wonder it's so dark!
+ text_jump UnknownText_0x1bc34f
+ db "@"
+; 0x908fb
+
+GFX_908fb: ; 908fb
+INCBIN "gfx/unknown/0908fb.2bpp"
+GFX_90903: ; 90903
+INCBIN "gfx/unknown/090903.2bpp"
+GFX_9090b: ; 9090b
+INCBIN "gfx/unknown/09090b.2bpp"
+; 90913
+
+Special_SetDayOfWeek: ; 90913
+ ld a, [hInMenu]
+ push af
+ ld a, $1
+ ld [hInMenu], a
+ ld de, GFX_90903
+ ld hl, VTiles1 tile $6f
+ lb bc, BANK(GFX_90903), 1
+ call Request1bpp
+ ld de, GFX_9090b
+ ld hl, VTiles1 tile $75
+ lb bc, BANK(GFX_9090b), 1
+ call Request1bpp
+ xor a
+ ld [wd002], a
+.asm_90936
+ hlcoord 0, 12
+ lb bc, 4, 18
+ call TextBox
+ call LoadStandardMenuDataHeader
+ ld hl, UnknownText_0x90a3f
+ call PrintText
+ hlcoord 9, 3
+ ld b, 2
+ ld c, 9
+ call TextBox
+ hlcoord 14, 3
+ ld [hl], $ef
+ hlcoord 14, 6
+ ld [hl], $f5
+ hlcoord 10, 5
+ call Function909de
+ call Function321c
+ ld c, 10
+ call DelayFrames
+.asm_9096a
+ call JoyTextDelay
+ call Function90993
+ jr nc, .asm_9096a
+ call ExitMenu
+ call UpdateSprites
+ ld hl, UnknownText_0x90a44
+ call PrintText
+ call YesNoBox
+ jr c, .asm_90936
+ ld a, [wd002]
+ ld [StringBuffer2], a
+ call Function663
+ call LoadStandardFont
+ pop af
+ ld [hInMenu], a
+ ret
+; 90993
+
+Function90993: ; 90993
+ ld a, [hJoyPressed]
+ and A_BUTTON
+ jr z, .asm_9099b
+ scf
+ ret
+
+.asm_9099b
+ ld hl, hJoyLast
+ ld a, [hl]
+ and D_UP
+ jr nz, .asm_909ba
+ ld a, [hl]
+ and D_DOWN
+ jr nz, .asm_909ad
+ call DelayFrame
+ and a
+ ret
+
+.asm_909ad
+ ld hl, wd002
+ ld a, [hl]
+ and a
+ jr nz, .asm_909b6
+ ld a, 6 + 1
+
+.asm_909b6
+ dec a
+ ld [hl], a
+ jr .asm_909c6
+
+.asm_909ba
+ ld hl, wd002
+ ld a, [hl]
+ cp 6
+ jr c, .asm_909c4
+ ld a, -1
+
+.asm_909c4
+ inc a
+ ld [hl], a
+
+.asm_909c6
+ xor a
+ ld [hBGMapMode], a
+ hlcoord 10, 4
+ ld b, $2
+ ld c, $9
+ call ClearBox
+ hlcoord 10, 5
+ call Function909de
+ call WaitBGMap
+ and a
+ ret
+; 909de
+
+Function909de: ; 909de
+ push hl
+ ld a, [wd002]
+ ld e, a
+ ld d, 0
+ ld hl, WeekdaysStrings
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld d, [hl]
+ ld e, a
+ pop hl
+ call PlaceString
+ ret
+; 909f2
+
+WeekdaysStrings: ; 909f2
+ dw Sunday
+ dw Monday
+ dw Tuesday
+ dw Wednesday
+ dw Thursday
+ dw Friday
+ dw Saturday
+ dw Sunday
+
+Sunday: db " SUNDAY@"
+Monday: db " MONDAY@"
+Tuesday: db " TUESDAY@"
+Wednesday: db "WEDNESDAY@"
+Thursday: db "THURSDAY@"
+Friday: db " FRIDAY@"
+Saturday: db "SATURDAY@"
+
+
+UnknownText_0x90a3f: ; 0x90a3f
+ ; What day is it?
+ text_jump UnknownText_0x1bc369
+ db "@"
+; 0x90a44
+
+UnknownText_0x90a44: ; 0x90a44
+ start_asm
+ hlcoord 1, 14
+ call Function909de
+ ld hl, UnknownText_0x90a4f
+ ret
+; 90a4f (24:4a4f)
+
+UnknownText_0x90a4f: ; 0x90a4f
+ ; , is it?
+ text_jump UnknownText_0x1bc37a
+ db "@"
+; 0x90a54
+
+Special_InitialSetDSTFlag: ; 90a54
+ ld a, [wDST]
+ set 7, a
+ ld [wDST], a
+ hlcoord 1, 14
+ lb bc, 3, 18
+ call ClearBox
+ ld hl, UnknownText_0x90a6c
+ call PlaceWholeStringInBoxAtOnce
+ ret
+; 90a6c
+
+UnknownText_0x90a6c: ; 90a6c
+ start_asm
+ call UpdateTime
+ ld a, [hHours]
+ ld b, a
+ ld a, [hMinutes]
+ ld c, a
+ decoord 1, 14
+ callba PrintHoursMins
+ ld hl, TextJump_DSTIsThatOK
+ ret
+; 90a83 (24:4a83)
+
+TextJump_DSTIsThatOK: ; 0x90a83
+ ; DST, is that OK?
+ text_jump Text_DSTIsThatOK
+ db "@"
+; 0x90a88
+
+Special_InitialClearDSTFlag: ; 90a88
+ ld a, [wDST]
+ res 7, a
+ ld [wDST], a
+ hlcoord 1, 14
+ lb bc, 3, 18
+ call ClearBox
+ ld hl, UnknownText_0x90aa0
+ call PlaceWholeStringInBoxAtOnce
+ ret
+; 90aa0
+
+UnknownText_0x90aa0: ; 90aa0
+ start_asm
+ call UpdateTime
+ ld a, [hHours]
+ ld b, a
+ ld a, [hMinutes]
+ ld c, a
+ decoord 1, 14
+ callba PrintHoursMins
+ ld hl, UnknownText_0x90ab7
+ ret
+; 90ab7
+
+UnknownText_0x90ab7: ; 0x90ab7
+ ; , is that OK?
+ text_jump UnknownText_0x1c5ff1
+ db "@"
+; 0x90abc
+
+Function90abc: ; 90abc
+ hlcoord 1, 14
+ lb bc, 3, SCREEN_WIDTH - 2
+ call ClearBox
+ ld hl, UnknownText_0x90acc
+ call PlaceWholeStringInBoxAtOnce
+ ret
+; 90acc
+
+UnknownText_0x90acc: ; 0x90acc
+ start_asm
+
+ call UpdateTime
+
+ hlcoord 1, 14
+ ld [hl], "R"
+ inc hl
+ ld [hl], "T"
+ inc hl
+ ld [hl], " "
+ inc hl
+
+ ld de, hRTCDayLo
+ call Function90b23
+
+ hlcoord 1, 16
+ ld [hl], "D"
+ inc hl
+ ld [hl], "F"
+ inc hl
+ ld [hl], " "
+ inc hl
+
+ ld de, StartDay
+ call Function90b23
+
+ ld [hl], " "
+ inc hl
+
+ ld a, [wDST]
+ bit 7, a
+ jr z, .off
+
+ ld [hl], "O"
+ inc hl
+ ld [hl], "N"
+ inc hl
+ jr .done
+
+.off
+ ld [hl], "O"
+ inc hl
+ ld [hl], "F"
+ inc hl
+ ld [hl], "F"
+ inc hl
+
+.done
+ ld hl, UnknownText_0x90b13
+ ret
+; 90b13
+
+UnknownText_0x90b13: ; 0x90b13
+ text "<PARA>Now on DEBUG…"
+ prompt
+; 0x90b23
+
+Function90b23: ; 90b23
+ lb bc, 1, 3
+ call PrintNum
+ ld [hl], "."
+ inc hl
+ inc de
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 2
+ call PrintNum
+ ld [hl], ":"
+ inc hl
+ inc de
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 2
+ call PrintNum
+ ret
+; 90b3e
+
+PrintHour: ; 90b3e (24:4b3e)
+ ld l, e
+ ld h, d
+ push bc
+ call GetTimeOfDayString
+ call PlaceString
+ ld l, c
+ ld h, b
+ inc hl
+ pop bc
+ call AdjustHourForAMorPM
+ ld [wd265], a
+ ld de, wd265
+ call PrintTwoDigitNumberRightAlign
+ ret
+
+GetTimeOfDayString: ; 90b58 (24:4b58)
+ ld a, c
+ cp 4
+ jr c, .nite
+ cp 10
+ jr c, .morn
+ cp 18
+ jr c, .day
+.nite
+ ld de, .NITE
+ ret
+.morn
+ ld de, .MORN
+ ret
+.day
+ ld de, .DAY
+ ret
+; 90b71 (24:4b71)
+
+.NITE: db "NITE@"
+.MORN: db "MORN@"
+.DAY: db "DAY@"
+; 90b7f
+
+AdjustHourForAMorPM:
+; Convert the hour stored in c (0-23) to a 1-12 value
+ ld a, c
+ or a
+ jr z, .midnight
+ cp 12
+ ret c
+ ret z
+ sub 12
+ ret
+
+.midnight
+ ld a, 12
+ ret
--- a/event/buena.asm
+++ b/event/buena.asm
@@ -11,7 +11,7 @@
add $2
ld [wMenuBorderRightCoord], a
call BackUpTiles
- call Function1e5d ; menu
+ call DoNthMenu ; menu
callba Function4ae5e
ld b, $0
ld a, [MenuSelection]
--- /dev/null
+++ b/event/daycare.asm
@@ -1,0 +1,768 @@
+Special_DayCareMan: ; 166d6
+ ld hl, wDaycareMan
+ bit 0, [hl]
+ jr nz, .asm_166fe
+ ld hl, wDaycareMan
+ ld a, $0
+ call Function1678f
+ jr c, .asm_16724
+ call Function16798
+ jr c, .asm_16721
+ callba Functionde2a
+ ld hl, wDaycareMan
+ set 0, [hl]
+ call Function167f6
+ call Function16a3b
+ ret
+
+.asm_166fe
+ callba Functione698
+ ld hl, wBreedMon1Nick
+ call Function1686d
+ call Function16807
+ jr c, .asm_16721
+ callba Functiondd21
+ call Function16850
+ ld hl, wDaycareMan
+ res 0, [hl]
+ res 5, [hl]
+ jr .asm_16724
+
+.asm_16721
+ call Function1689b
+
+.asm_16724
+ ld a, $13
+ call Function1689b
+ ret
+; 1672a
+
+Special_DayCareLady: ; 1672a
+ ld hl, wDaycareLady
+ bit 0, [hl]
+ jr nz, .asm_16752
+ ld hl, wDaycareLady
+ ld a, $2
+ call Function16781
+ jr c, .asm_1677b
+ call Function16798
+ jr c, .asm_16778
+ callba Functionde37
+ ld hl, wDaycareLady
+ set 0, [hl]
+ call Function167f6
+ call Function16a3b
+ ret
+
+.asm_16752
+ callba Functione6b3
+ ld hl, wBreedMon2Nick
+ call Function1686d
+ call Function16807
+ jr c, .asm_16778
+ callba Functiondd42
+ call Function16850
+ ld hl, wDaycareLady
+ res 0, [hl]
+ ld hl, wDaycareMan
+ res 5, [hl]
+ jr .asm_1677b
+
+.asm_16778
+ call Function1689b
+
+.asm_1677b
+ ld a, $13
+ call Function1689b
+ ret
+; 16781
+
+Function16781: ; 16781
+ bit 7, [hl]
+ jr nz, .asm_16788
+ set 7, [hl]
+ inc a
+
+.asm_16788
+ call Function1689b
+ call YesNoBox
+ ret
+; 1678f
+
+Function1678f: ; 1678f
+ set 7, [hl]
+ call Function1689b
+ call YesNoBox
+ ret
+; 16798
+
+Function16798: ; 16798
+ ld a, [PartyCount]
+ cp 2
+ jr c, .asm_167e5
+ ld a, 4
+ call Function1689b
+ ld b, 6
+ callba Function5001d
+ jr c, .asm_167dd
+ ld a, [CurPartySpecies]
+ cp EGG
+ jr z, .asm_167e1
+ callba CheckCurPartyMonFainted
+ jr c, .asm_167e9
+ ld hl, PartyMon1Item
+ ld bc, PARTYMON_STRUCT_LENGTH
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld d, [hl]
+ callba ItemIsMail
+ jr c, .asm_167ed
+ ld hl, PartyMonNicknames
+ ld a, [CurPartyMon]
+ call GetNick
+ and a
+ ret
+
+.asm_167dd
+ ld a, $12
+ scf
+ ret
+
+.asm_167e1
+ ld a, $6
+ scf
+ ret
+
+.asm_167e5
+ ld a, $7
+ scf
+ ret
+
+.asm_167e9
+ ld a, $8
+ scf
+ ret
+
+.asm_167ed
+ ld a, $a
+ scf
+ ret
+; 167f1
+
+UnknownText_0x167f1: ; 0x167f1
+ ;
+ text_jump UnknownText_0x1bdaa7
+ db "@"
+; 0x167f6
+
+Function167f6: ; 167f6
+ ld a, $5
+ call Function1689b
+ ld a, [CurPartySpecies]
+ call PlayCry
+ ld a, $9
+ call Function1689b
+ ret
+; 16807
+
+Function16807: ; 16807
+ ld a, [StringBuffer2 + 1]
+ and a
+ jr nz, .asm_16819
+ ld a, $f
+ call Function1689b
+ call YesNoBox
+ jr c, .asm_16844
+ jr .asm_1682d
+
+.asm_16819
+ ld a, $b
+ call Function1689b
+ call YesNoBox
+ jr c, .asm_16844
+ ld a, $c
+ call Function1689b
+ call YesNoBox
+ jr c, .asm_16844
+
+.asm_1682d
+ ld de, Money
+ ld bc, StringBuffer2 + 2
+ callba CompareMoney
+ jr c, .asm_16848
+ ld a, [PartyCount]
+ cp $6
+ jr nc, .asm_1684c
+ and a
+ ret
+
+.asm_16844
+ ld a, $12
+ scf
+ ret
+
+.asm_16848
+ ld a, $11
+ scf
+ ret
+
+.asm_1684c
+ ld a, $10
+ scf
+ ret
+; 16850
+
+Function16850: ; 16850
+ ld bc, StringBuffer2 + 2
+ ld de, Money
+ callba TakeMoney
+ ld a, $d
+ call Function1689b
+ ld a, [CurPartySpecies]
+ call PlayCry
+ ld a, $e
+ call Function1689b
+ ret
+; 1686d
+
+Function1686d: ; 1686d
+ ld a, b
+ ld [StringBuffer2], a
+ ld a, d
+ ld [StringBuffer2 + 1], a
+ ld de, StringBuffer1
+ ld bc, NAME_LENGTH
+ call CopyBytes
+ ld hl, 0
+ ld bc, $64
+ ld a, [StringBuffer2 + 1]
+ call AddNTimes
+ ld de, $64
+ add hl, de
+ xor a
+ ld [StringBuffer2 + 2], a
+ ld a, h
+ ld [StringBuffer2 + 3], a
+ ld a, l
+ ld [StringBuffer2 + 4], a
+ ret
+; 1689b
+
+Function1689b: ; 1689b
+ ld e, a
+ ld d, 0
+ ld hl, TextTable_168aa
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call PrintText
+ ret
+; 168aa
+
+TextTable_168aa: ; 168aa
+ dw UnknownText_0x168d2
+ dw UnknownText_0x168d7
+ dw UnknownText_0x168dc
+ dw UnknownText_0x168e1
+ dw UnknownText_0x168e6
+ dw UnknownText_0x168ff
+ dw UnknownText_0x168f0
+ dw UnknownText_0x168eb
+ dw UnknownText_0x168fa
+ dw UnknownText_0x16904
+ dw UnknownText_0x168f5
+ dw UnknownText_0x16909
+ dw UnknownText_0x1690e
+ dw UnknownText_0x16913
+ dw UnknownText_0x16918
+ dw UnknownText_0x1691d
+ dw UnknownText_0x16922
+ dw UnknownText_0x16927
+ dw UnknownText_0x1692c
+ dw UnknownText_0x16931
+; 168d2
+
+UnknownText_0x168d2: ; 0x168d2
+ ; I'm the DAY-CARE MAN. Want me to raise a #MON?
+ text_jump UnknownText_0x1bdaa9
+ db "@"
+; 0x168d7
+
+UnknownText_0x168d7: ; 0x168d7
+ ; I'm the DAY-CARE MAN. Do you know about EGGS? I was raising #MON with my wife, you see. We were shocked to find an EGG! How incredible is that? So, want me to raise a #MON?
+ text_jump UnknownText_0x1bdad8
+ db "@"
+; 0x168dc
+
+UnknownText_0x168dc: ; 0x168dc
+ ; I'm the DAY-CARE LADY. Should I raise a #MON for you?
+ text_jump UnknownText_0x1bdb85
+ db "@"
+; 0x168e1
+
+UnknownText_0x168e1: ; 0x168e1
+ ; I'm the DAY-CARE LADY. Do you know about EGGS? My husband and I were raising some #MON, you see. We were shocked to find an EGG! How incredible could that be? Should I raise a #MON for you?
+ text_jump UnknownText_0x1bdbbb
+ db "@"
+; 0x168e6
+
+UnknownText_0x168e6: ; 0x168e6
+ ; What should I raise for you?
+ text_jump UnknownText_0x1bdc79
+ db "@"
+; 0x168eb
+
+UnknownText_0x168eb: ; 0x168eb
+ ; Oh? But you have just one #MON.
+ text_jump UnknownText_0x1bdc97
+ db "@"
+; 0x168f0
+
+UnknownText_0x168f0: ; 0x168f0
+ ; Sorry, but I can't accept an EGG.
+ text_jump UnknownText_0x1bdcb8
+ db "@"
+; 0x168f5
+
+UnknownText_0x168f5: ; 0x168f5
+ ; Remove MAIL before you come see me.
+ text_jump UnknownText_0x1bdcda
+ db "@"
+; 0x168fa
+
+UnknownText_0x168fa: ; 0x168fa
+ ; If you give me that, what will you battle with?
+ text_jump UnknownText_0x1bdcff
+ db "@"
+; 0x168ff
+
+UnknownText_0x168ff: ; 0x168ff
+ ; OK. I'll raise your @ .
+ text_jump UnknownText_0x1bdd30
+ db "@"
+; 0x16904
+
+UnknownText_0x16904: ; 0x16904
+ ; Come back for it later.
+ text_jump UnknownText_0x1bdd4b
+ db "@"
+; 0x16909
+
+UnknownText_0x16909: ; 0x16909
+ ; Are we geniuses or what? Want to see your @ ?
+ text_jump UnknownText_0x1bdd64
+ db "@"
+; 0x1690e
+
+UnknownText_0x1690e: ; 0x1690e
+ ; Your @ has grown a lot. By level, it's grown by @ . If you want your #MON back, it will cost ¥@ .
+ text_jump UnknownText_0x1bdd96
+ db "@"
+; 0x16913
+
+UnknownText_0x16913: ; 0x16913
+ ; Perfect! Here's your #MON.
+ text_jump UnknownText_0x1bde04
+ db "@"
+; 0x16918
+
+UnknownText_0x16918: ; 0x16918
+ ; got back @ .
+ text_jump UnknownText_0x1bde1f
+ db "@"
+; 0x1691d
+
+UnknownText_0x1691d: ; 0x1691d
+ ; Huh? Back already? Your @ needs a little more time with us. If you want your #MON back, it will cost ¥100.
+ text_jump UnknownText_0x1bde32
+ db "@"
+; 0x16922
+
+UnknownText_0x16922: ; 0x16922
+ ; You have no room for it.
+ text_jump UnknownText_0x1bdea2
+ db "@"
+; 0x16927
+
+UnknownText_0x16927: ; 0x16927
+ ; You don't have enough money.
+ text_jump UnknownText_0x1bdebc
+ db "@"
+; 0x1692c
+
+UnknownText_0x1692c: ; 0x1692c
+ ; Oh, fine then.
+ text_jump UnknownText_0x1bded9
+ db "@"
+; 0x16931
+
+UnknownText_0x16931: ; 0x16931
+ ; Come again.
+ text_jump UnknownText_0x1bdee9
+ db "@"
+; 0x16936
+
+Special_DayCareManOutside: ; 16936
+ ld hl, wDaycareMan
+ bit 6, [hl]
+ jr nz, Function16949
+ ld hl, UnknownText_0x16944
+ call PrintText
+ ret
+
+UnknownText_0x16944: ; 0x16944
+ ; Not yet…
+ text_jump UnknownText_0x1bdef6
+ db "@"
+; 0x16949
+
+Function16949: ; 16949
+ ld hl, UnknownText_0x16993
+ call PrintText
+ call YesNoBox
+ jr c, .asm_1697c
+ ld a, [PartyCount]
+ cp PARTY_LENGTH
+ jr nc, .asm_16987
+ call Function169ac
+ ld hl, wDaycareMan
+ res 6, [hl]
+ call Function16a3b
+ ld hl, UnknownText_0x16998
+ call PrintText
+ ld de, SFX_GET_EGG_FROM_DAYCARE_LADY
+ call PlaySFX
+ ld c, 120
+ call DelayFrames
+ ld hl, UnknownText_0x1699d
+ jr .asm_1697f
+
+.asm_1697c
+ ld hl, UnknownText_0x169a2
+
+.asm_1697f
+ call PrintText
+ xor a
+ ld [ScriptVar], a
+ ret
+
+.asm_16987
+ ld hl, UnknownText_0x169a7
+ call PrintText
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+; 16993
+
+UnknownText_0x16993: ; 0x16993
+ ; Ah, it's you! We were raising your #MON, and my goodness, were we surprised! Your #MON had an EGG! We don't know how it got there, but your #MON had it. You want it?
+ text_jump UnknownText_0x1bdf00
+ db "@"
+; 0x16998
+
+UnknownText_0x16998: ; 0x16998
+ ; received the EGG!
+ text_jump UnknownText_0x1bdfa5
+ db "@"
+; 0x1699d
+
+UnknownText_0x1699d: ; 0x1699d
+ ; Take good care of it.
+ text_jump UnknownText_0x1bdfba
+ db "@"
+; 0x169a2
+
+UnknownText_0x169a2: ; 0x169a2
+ ; Well then, I'll keep it. Thanks!
+ text_jump UnknownText_0x1bdfd1
+ db "@"
+; 0x169a7
+
+UnknownText_0x169a7: ; 0x169a7
+ ; You have no room in your party. Come back later.
+ text_jump UnknownText_0x1bdff2
+ db "@"
+; 0x169ac
+
+Function169ac: ; 169ac
+ ld a, [wEggMonLevel]
+ ld [CurPartyLevel], a
+ ld hl, PartyCount
+ ld a, [hl]
+ cp PARTY_LENGTH
+ jr nc, .asm_16a2f
+ inc a
+ ld [hl], a
+ ld c, a
+ ld b, 0
+ add hl, bc
+ ld a, EGG
+ ld [hli], a
+ ld a, [wEggMonSpecies]
+ ld [CurSpecies], a
+ ld [CurPartySpecies], a
+ ld a, $ff
+ ld [hl], a
+ ld hl, PartyMonNicknames
+ ld bc, PKMN_NAME_LENGTH
+ call Function16a31
+ ld hl, wEggNick
+ call CopyBytes
+ ld hl, PartyMonOT
+ ld bc, NAME_LENGTH
+ call Function16a31
+ ld hl, wEggOT
+ call CopyBytes
+ ld hl, PartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call Function16a31
+ ld hl, wEggMon
+ ld bc, wEggMonEnd - wEggMon
+ call CopyBytes
+ call GetBaseData
+ ld a, [PartyCount]
+ dec a
+ ld hl, PartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld b, h
+ ld c, l
+ ld hl, MON_ID + 1
+ add hl, bc
+ push hl
+ ld hl, MON_MAXHP
+ add hl, bc
+ ld d, h
+ ld e, l
+ pop hl
+ push bc
+ ld b, $0
+ predef CalcPkmnStats
+ pop bc
+ ld hl, MON_HP
+ add hl, bc
+ xor a
+ ld [hli], a
+ ld [hl], a
+ and a
+ ret
+
+.asm_16a2f
+ scf
+ ret
+; 16a31
+
+Function16a31: ; 16a31
+ ld a, [PartyCount]
+ dec a
+ call AddNTimes
+ ld d, h
+ ld e, l
+ ret
+; 16a3b
+
+Function16a3b: ; 16a3b
+ ld a, [wDaycareLady]
+ bit 0, a
+ ret z
+ ld a, [wDaycareMan]
+ bit 0, a
+ ret z
+ callab Function16e1d
+ ld a, [wd265]
+ and a
+ ret z
+ inc a
+ ret z
+ ld hl, wDaycareMan
+ set 5, [hl]
+.asm_16a59
+ call Random
+ cp 150
+ jr c, .asm_16a59
+ ld [wStepsToEgg], a
+ jp Function16a66
+; 16a66
+
+Function16a66: ; 16a66
+ xor a
+ ld hl, wEggMon
+ ld bc, wEggMonEnd - wEggMon
+ call ByteFill
+ ld hl, wEggNick
+ ld bc, PKMN_NAME_LENGTH
+ call ByteFill
+ ld hl, wEggOT
+ ld bc, NAME_LENGTH
+ call ByteFill
+ ld a, [wBreedMon1DVs]
+ ld [TempMonDVs], a
+ ld a, [wBreedMon1DVs + 1]
+ ld [TempMonDVs + 1], a
+ ld a, [wBreedMon1Species]
+ ld [CurPartySpecies], a
+ ld a, $3
+ ld [MonType], a
+ ld a, [wBreedMon1Species]
+ cp DITTO
+ ld a, $1
+ jr z, .asm_16ab6
+ ld a, [wBreedMon2Species]
+ cp DITTO
+ ld a, $0
+ jr z, .asm_16ab6
+ callba GetGender
+ ld a, $0
+ jr z, .asm_16ab6
+ inc a
+
+.asm_16ab6
+ ld [wDittoInDaycare], a
+ and a
+ ld a, [wBreedMon1Species]
+ jr z, .asm_16ac2
+ ld a, [wBreedMon2Species]
+
+.asm_16ac2
+ ld [CurPartySpecies], a
+ callab GetPreEvolution
+ callab GetPreEvolution
+ ld a, EGG_LEVEL
+ ld [CurPartyLevel], a
+
+ ld a, [CurPartySpecies]
+ cp NIDORAN_F
+ jr nz, .asm_16ae8
+ call Random
+ cp $80
+ ld a, NIDORAN_F
+ jr c, .asm_16ae8
+ ld a, NIDORAN_M
+.asm_16ae8
+ ld [CurPartySpecies], a
+ ld [CurSpecies], a
+ ld [wEggMonSpecies], a
+
+ call GetBaseData
+ ld hl, wEggNick
+ ld de, String_16be0
+ call CopyName2
+ ld hl, PlayerName
+ ld de, wEggOT
+ ld bc, NAME_LENGTH
+ call CopyBytes
+ xor a
+ ld [wEggMonItem], a
+ ld de, wEggMonMoves
+ xor a
+ ld [Buffer1], a
+ predef FillMoves
+ callba Function170bf
+ ld hl, wEggMonID
+ ld a, [PlayerID]
+ ld [hli], a
+ ld a, [PlayerID + 1]
+ ld [hl], a
+ ld a, [CurPartyLevel]
+ ld d, a
+ callab CalcExpAtLevel
+ ld hl, wEggMonExp
+ ld a, [hMultiplicand]
+ ld [hli], a
+ ld a, [$ffb5]
+ ld [hli], a
+ ld a, [$ffb6]
+ ld [hl], a
+ xor a
+ ld b, $a
+ ld hl, wEggMonStatExp
+.asm_16b46
+ ld [hli], a
+ dec b
+ jr nz, .asm_16b46
+ ld hl, wEggMonDVs
+ call Random
+ ld [hli], a
+ ld [TempMonDVs], a
+ call Random
+ ld [hld], a
+ ld [TempMonDVs + 1], a
+ ld de, wBreedMon1DVs
+ ld a, [wBreedMon1Species]
+ cp DITTO
+ jr z, .asm_16b98
+ ld de, wBreedMon2DVs
+ ld a, [wBreedMon2Species]
+ cp DITTO
+ jr z, .asm_16b98
+ ld a, $3
+ ld [MonType], a
+ push hl
+ callba GetGender
+ pop hl
+ ld de, wBreedMon1DVs
+ ld bc, wBreedMon2DVs
+ jr c, .asm_16bab
+ jr z, .asm_16b90
+ ld a, [wDittoInDaycare]
+ and a
+ jr z, .asm_16b98
+ ld d, b
+ ld e, c
+ jr .asm_16b98
+
+.asm_16b90
+ ld a, [wDittoInDaycare]
+ and a
+ jr nz, .asm_16b98
+ ld d, b
+ ld e, c
+
+.asm_16b98
+ ld a, [de]
+ inc de
+ and $f
+ ld b, a
+ ld a, [hl]
+ and $f0
+ add b
+ ld [hli], a
+ ld a, [de]
+ and $7
+ ld b, a
+ ld a, [hl]
+ and $f8
+ add b
+ ld [hl], a
+
+.asm_16bab
+ ld hl, StringBuffer1
+ ld de, wd050
+ ld bc, NAME_LENGTH
+ call CopyBytes
+ ld hl, wEggMonMoves
+ ld de, wEggMonPP
+ predef FillPP
+ ld hl, wd050
+ ld de, StringBuffer1
+ ld bc, NAME_LENGTH
+ call CopyBytes
+ ld a, [BaseEggSteps]
+ ld hl, wEggMonHappiness
+ ld [hli], a
+ xor a
+rept 2
+ ld [hli], a
+endr
+ ld [hl], a
+ ld a, [CurPartyLevel]
+ ld [wEggMonLevel], a
+ ret
+; 16be0
+
+String_16be0: ; 16be0
+ db "EGG@"
+; 16be4
--- /dev/null
+++ b/event/field_moves.asm
@@ -1,0 +1,312 @@
+PlayWhirlpoolSound: ; 8c7d4
+ call WaitSFX
+ ld de, SFX_SURF
+ call PlaySFX
+ call WaitSFX
+ ret
+; 8c7e1
+
+BlindingFlash: ; 8c7e1
+ callba FadeOutPalettes
+ ld hl, StatusFlags
+ set 2, [hl]
+ callba Function8c0e5
+ callba Function8c001
+ ld b, SCGB_09
+ call GetSGBLayout
+ callba Function49409
+ callba FadeInPalettes
+ ret
+; 8c80a
+
+ShakeHeadbuttTree: ; 8c80a
+ callba Function8cf53
+ ld de, CutGrassGFX
+ ld hl, VTiles1
+ lb bc, BANK(CutGrassGFX), 4
+ call Request2bpp
+ ld de, HeadbuttTreeGFX
+ ld hl, VTiles1 tile $04
+ lb bc, BANK(HeadbuttTreeGFX), 8
+ call Request2bpp
+ call Function8cad3
+ ld a, SPRITE_ANIM_INDEX_1B
+ call _InitSpriteAnimStruct
+ ld hl, $3
+ add hl, bc
+ ld [hl], $84
+ ld a, $90
+ ld [wc3b5], a
+ callba Function8cf7a
+ call GetHeadbuttTreeRelativeLocation
+ ld a, $20
+ ld [wcf64], a
+ call WaitSFX
+ ld de, SFX_SANDSTORM
+ call PlaySFX
+.loop
+ ld hl, wcf64
+ ld a, [hl]
+ and a
+ jr z, .done
+ dec [hl]
+ ld a, $90
+ ld [wc3b5], a
+ callba Function8cf7a
+ call DelayFrame
+ jr .loop
+
+.done
+ call OverworldTextModeSwitch
+ call WaitBGMap
+ xor a
+ ld [hBGMapMode], a
+ callba Function8cf53
+ ld hl, Sprites + $90
+ ld bc, $10
+ xor a
+ call ByteFill
+ ld de, Font
+ ld hl, VTiles1
+ lb bc, BANK(Font), $c
+ call Get1bpp
+ call ReplaceKrisSprite
+ ret
+; 8c893
+
+HeadbuttTreeGFX: ; 8c893
+INCBIN "gfx/unknown/08c893.2bpp"
+; 8c913
+
+GetHeadbuttTreeRelativeLocation: ; 8c913
+ xor a
+ ld [hBGMapMode], a
+ ld a, [PlayerDirection]
+ and %00001100
+ srl a
+ ld e, a
+ ld d, 0
+ ld hl, TreeRelativeLocationTable
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+
+ ld a, $5
+ ld [hli], a
+ ld [hld], a
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hli], a
+ ld [hld], a
+ call WaitBGMap
+ xor a
+ ld [hBGMapMode], a
+ ret
+; 8c938
+
+TreeRelativeLocationTable: ; 8c938
+ dwcoord 8, 8 + 2 ; RIGHT
+ dwcoord 8, 8 - 2 ; LEFT
+ dwcoord 8 - 2, 8 ; DOWN
+ dwcoord 8 + 2, 8 ; UP
+; 8c940
+
+OWCutAnimation: ; 8c940
+ ld a, e
+ and $1
+ ld [wJumptableIndex], a
+ call .LoadCutGFX
+ call WaitSFX
+ ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
+ call PlaySFX
+.loop
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .finish
+ ld a, $90
+ ld [wc3b5], a
+ callab Function8cf7a
+ call OWCutJumptable
+ call DelayFrame
+ jr .loop
+
+.finish
+ ret
+; 8c96d
+
+.LoadCutGFX: ; 8c96d
+ callab Function8cf53 ; pointless to farcall
+ ld de, CutGrassGFX
+ ld hl, VTiles1
+ lb bc, BANK(CutGrassGFX), 4
+ call Request2bpp
+ ld de, CutTreeGFX
+ ld hl, VTiles1 tile $4
+ lb bc, BANK(CutTreeGFX), 4
+ call Request2bpp
+ ret
+; 8c98c
+
+CutTreeGFX: ; c898c
+INCBIN "gfx/misc/cut_tree.2bpp"
+; c89cc
+
+CutGrassGFX: ; 8c9cc
+INCBIN "gfx/misc/cut_grass.2bpp"
+; 8ca0c
+
+OWCutJumptable: ; 8ca0c
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, .jumptable
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 8ca1b
+
+
+.jumptable: ; 8ca1b (23:4a1b)
+ dw Function8ca23
+ dw Function8ca3c
+ dw Function8ca5c
+ dw Function8ca64
+
+
+Function8ca23: ; 8ca23 (23:4a23)
+ call Function8cad3
+ ld a, SPRITE_ANIM_INDEX_17 ; leaf
+ call _InitSpriteAnimStruct
+ ld hl, $3
+ add hl, bc
+ ld [hl], $84
+ ld a, $20
+ ld [wcf64], a
+ ld hl, wJumptableIndex
+rept 2
+ inc [hl]
+endr
+ ret
+
+Function8ca3c: ; 8ca3c (23:4a3c)
+ call Function8ca8e
+ xor a
+ call Function8ca73
+ ld a, $10
+ call Function8ca73
+ ld a, $20
+ call Function8ca73
+ ld a, $30
+ call Function8ca73
+ ld a, $20
+ ld [wcf64], a
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+
+Function8ca5c: ; 8ca5c (23:4a5c)
+ ld a, $1
+ ld [hBGMapMode], a
+ ld hl, wJumptableIndex
+ inc [hl]
+
+Function8ca64: ; 8ca64 (23:4a64)
+ ld hl, wcf64
+ ld a, [hl]
+ and a
+ jr z, .asm_8ca6d
+ dec [hl]
+ ret
+.asm_8ca6d
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+Function8ca73: ; 8ca73 (23:4a73)
+ push de
+ push af
+ ld a, SPRITE_ANIM_INDEX_16 ; fly takeoff
+ call _InitSpriteAnimStruct
+ ld hl, $3
+ add hl, bc
+ ld [hl], $80
+ ld hl, $e
+ add hl, bc
+ ld [hl], $4
+ pop af
+ ld hl, $c
+ add hl, bc
+ ld [hl], a
+ pop de
+ ret
+
+Function8ca8e: ; 8ca8e (23:4a8e)
+ ld de, 0
+ ld a, [wd197]
+ bit 0, a
+ jr z, .asm_8ca9a
+ set 0, e
+.asm_8ca9a
+ ld a, [wd196]
+ bit 0, a
+ jr z, .asm_8caa3
+ set 1, e
+.asm_8caa3
+ ld a, [PlayerDirection]
+ and $c
+ add e
+ ld e, a
+ ld hl, Unknown_8cab3
+rept 2
+ add hl, de
+endr
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ ret
+; 8cab3 (23:4ab3)
+
+Unknown_8cab3: ; 8cab3
+ db $58, $60
+ db $48, $60
+ db $58, $70
+ db $48, $70
+ db $58, $40
+ db $48, $40
+ db $58, $50
+ db $48, $50
+ db $38, $60
+ db $48, $60
+ db $38, $50
+ db $48, $50
+ db $58, $60
+ db $68, $60
+ db $58, $50
+ db $68, $50
+; 8cad3
+
+Function8cad3: ; 8cad3 (23:4ad3)
+ ld a, [PlayerDirection]
+ and $c
+ srl a
+ ld e, a
+ ld d, 0
+ ld hl, Unknown_8cae5
+ add hl, de
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ ret
+; 8cae5 (23:4ae5)
+
+Unknown_8cae5: ; 8cae5
+ db $50, $68
+ db $50, $48
+ db $40, $58
+ db $60, $58
+; 8caed
--- /dev/null
+++ b/event/magnet_train.asm
@@ -1,0 +1,485 @@
+Special_MagnetTrain: ; 8cc04
+ ld a, [ScriptVar]
+ and a
+ jr nz, .ToGoldenrod
+ ld a, 1 ; forwards
+ lb bc, $40, $60
+ ld de, $fca0
+ jr .continue
+
+.ToGoldenrod
+ ld a, -1 ; backwards
+ lb bc, $c0, $a0
+ ld de, $b460
+
+.continue
+ ld h, a
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+ ld a, h
+ ld [w5_d191], a
+ ld a, c
+ ld [w5_d192], a
+ ld a, b
+ ld [w5_d193], a
+ ld a, e
+ ld [w5_d194], a
+ ld a, d
+ ld [w5_d195], a
+ ld a, [hSCX]
+ push af
+ ld a, [hSCY]
+ push af
+ call Function8ccc9
+ ld hl, hVBlank
+ ld a, [hl]
+ push af
+ ld [hl], $1
+.loop
+ ld a, [wJumptableIndex]
+ and a
+ jr z, .initialize
+ bit 7, a
+ jr nz, .done
+ callab Function8cf69
+ call Function8cdf7
+ call Function8cc99
+ call Function3b0c
+ call DelayFrame
+ jr .loop
+
+.initialize
+ call Function8ceae
+ jr .loop
+
+.done
+ pop af
+ ld [hVBlank], a
+ call ClearBGPalettes
+ xor a
+ ld [hLCDStatCustom], a
+ ld [hLCDStatCustom + 1], a
+ ld [hLCDStatCustom + 2], a
+ ld [hSCX], a
+ ld [Requested2bppSource], a
+ ld [Requested2bppSource + 1], a
+ ld [Requested2bppDest], a
+ ld [Requested2bppDest + 1], a
+ ld [Requested2bpp], a
+ call ClearTileMap
+ pop af
+ ld [hSCY], a
+ pop af
+ ld [hSCX], a
+ xor a
+ ld [hBGMapMode], a
+ pop af
+ ld [rSVBK], a
+ ret
+; 8cc99
+
+Function8cc99: ; 8cc99
+ ld hl, LYOverridesBackup
+ ld c, $2f
+ ld a, [wcf64]
+ add a
+ ld [hSCX], a
+ call Function8ccc4
+ ld c, $30
+ ld a, [wcf65]
+ call Function8ccc4
+ ld c, $31
+ ld a, [wcf64]
+ add a
+ call Function8ccc4
+ ld a, [wd191]
+ ld d, a
+ ld hl, wcf64
+ ld a, [hl]
+rept 2
+ add d
+endr
+ ld [hl], a
+ ret
+; 8ccc4
+
+Function8ccc4: ; 8ccc4
+.asm_8ccc4
+ ld [hli], a
+ dec c
+ jr nz, .asm_8ccc4
+ ret
+; 8ccc9
+
+Function8ccc9: ; 8ccc9
+ call ClearBGPalettes
+ call ClearSprites
+ call DisableLCD
+ callab Function8cf53
+ call SetMagnetTrainPals
+ call DrawMagnetTrain
+ ld a, $90
+ ld [hWY], a
+ call EnableLCD
+ xor a
+ ld [hBGMapMode], a
+ ld [hSCX], a
+ ld [hSCY], a
+ ld a, [rSVBK]
+ push af
+ ld a, $1
+ ld [rSVBK], a
+ callba GetPlayerIcon
+ pop af
+ ld [rSVBK], a
+ ld hl, VTiles0
+ ld c, $4
+ call Request2bpp
+ ld hl, $c0
+ add hl, de
+ ld d, h
+ ld e, l
+ ld hl, VTiles0 tile $04
+ ld c, $4
+ call Request2bpp
+ call Function8cda6
+ ld hl, wJumptableIndex
+ xor a
+ ld [hli], a
+ ld a, [wd192]
+rept 3
+ ld [hli], a
+endr
+ ld de, MUSIC_MAGNET_TRAIN
+ call PlayMusic2
+ ret
+; 8cd27
+
+DrawMagnetTrain: ; 8cd27
+ ld hl, VBGMap0
+ xor a
+.asm_8cd2b
+ call GetMagnetTrainBGTiles
+ ld b, 32 / 2
+ call .FillAlt
+ inc a
+ cp $12
+ jr c, .asm_8cd2b
+ ld hl, VBGMap0 tile $0c
+ ld de, MagnetTrainTilemap1
+ ld c, 20
+ call .FillLine
+ ld hl, VBGMap0 tile $0e
+ ld de, MagnetTrainTilemap2
+ ld c, 20
+ call .FillLine
+ ld hl, VBGMap0 tile $10
+ ld de, MagnetTrainTilemap3
+ ld c, 20
+ call .FillLine
+ ld hl, VBGMap0 tile $12
+ ld de, MagnetTrainTilemap4
+ ld c, 20
+ call .FillLine
+ ret
+; 8cd65
+
+.FillLine ; 8cd65
+ ld a, [de]
+ inc de
+ ld [hli], a
+ dec c
+ jr nz, .FillLine
+ ret
+; 8cd6c
+
+.FillAlt ; 8cd6c
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ inc hl
+ dec b
+ jr nz, .FillAlt
+ ret
+; 8cd74
+
+GetMagnetTrainBGTiles: ; 8cd74
+ push hl
+ ld e, a
+ ld d, 0
+ ld hl, MagnetTrainBGTiles
+rept 2
+ add hl, de
+endr
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ pop hl
+ ret
+; 8cd82
+
+MagnetTrainBGTiles: ; 8cd82
+; Alternating tiles for each line
+; of the Magnet Train tilemap.
+ db $4c, $4d ; bush
+ db $5c, $5d ; bush
+ db $4c, $4d ; bush
+ db $5c, $5d ; bush
+ db $08, $08 ; fence
+ db $18, $18 ; fence
+ db $1f, $1f ; track
+ db $31, $31 ; track
+ db $11, $11 ; track
+ db $11, $11 ; track
+ db $0d, $0d ; track
+ db $31, $31 ; track
+ db $04, $04 ; fence
+ db $18, $18 ; fence
+ db $4c, $4d ; bush
+ db $5c, $5d ; bush
+ db $4c, $4d ; bush
+ db $5c, $5d ; bush
+; 8cda6
+
+Function8cda6: ; 8cda6
+ ld hl, LYOverrides
+ ld bc, $90
+ ld a, [wd192]
+ call ByteFill
+ ld hl, LYOverridesBackup
+ ld bc, $90
+ ld a, [wd192]
+ call ByteFill
+ ld a, $43
+ ld [hLCDStatCustom], a
+ ret
+; 8cdc3
+
+SetMagnetTrainPals: ; 8cdc3
+ ld a, $1
+ ld [rVBK], a
+
+ ; bushes
+ ld hl, VBGMap0
+ ld bc, 8 tiles
+ ld a, $2
+ call ByteFill
+
+ ; train
+ ld hl, VBGMap0 tile $08
+ ld bc, 20 tiles
+ xor a
+ call ByteFill
+
+ ; more bushes
+ ld hl, VBGMap0 tile $1c
+ ld bc, 8 tiles
+ ld a, $2
+ call ByteFill
+
+ ; train window
+ ld hl, VBGMap0 tile $10 + 7
+ ld bc, 6
+ ld a, $4
+ call ByteFill
+
+ ld a, $0
+ ld [rVBK], a
+ ret
+; 8cdf7
+
+Function8cdf7: ; 8cdf7
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_8ce06
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 8ce06
+
+Jumptable_8ce06: ; 8ce06
+ dw Function8ce19
+ dw Function8ce6d
+ dw Function8ce47
+ dw Function8ce6d
+ dw Function8ce7a
+ dw Function8ce6d
+ dw Function8cea2
+; 8ce14
+
+Function8ce14: ; 8ce14
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+; 8ce19
+
+Function8ce19: ; 8ce19
+ ld d, $55
+ ld a, [wd194 + 1]
+ ld e, a
+ ld b, SPRITE_ANIM_INDEX_15
+ ld a, [rSVBK]
+ push af
+ ld a, $1
+ ld [rSVBK], a
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .asm_8ce31
+ ld b, SPRITE_ANIM_INDEX_1F
+
+.asm_8ce31
+ pop af
+ ld [rSVBK], a
+ ld a, b
+ call _InitSpriteAnimStruct
+ ld hl, $3
+ add hl, bc
+ ld [hl], $0
+ call Function8ce14
+ ld a, $80
+ ld [wcf66], a
+ ret
+; 8ce47
+
+Function8ce47: ; 8ce47
+ ld hl, wd193
+ ld a, [wcf65]
+ cp [hl]
+ jr z, .asm_8ce64
+ ld e, a
+ ld a, [wd191]
+ xor $ff
+ inc a
+ add e
+ ld [wcf65], a
+ ld hl, wc3c0
+ ld a, [wd191]
+ add [hl]
+ ld [hl], a
+ ret
+
+.asm_8ce64
+ call Function8ce14
+ ld a, $80
+ ld [wcf66], a
+ ret
+; 8ce6d
+
+Function8ce6d: ; 8ce6d
+ ld hl, wcf66
+ ld a, [hl]
+ and a
+ jr z, .asm_8ce76
+ dec [hl]
+ ret
+
+.asm_8ce76
+ call Function8ce14
+ ret
+; 8ce7a
+
+Function8ce7a: ; 8ce7a
+ ld hl, wd194
+ ld a, [wcf65]
+ cp [hl]
+ jr z, .asm_8ce9e
+ ld e, a
+ ld a, [wd191]
+ xor $ff
+ inc a
+ ld d, a
+ ld a, e
+rept 2
+ add d
+endr
+ ld [wcf65], a
+ ld hl, wc3c0
+ ld a, [wd191]
+ ld d, a
+ ld a, [hl]
+rept 2
+ add d
+endr
+ ld [hl], a
+ ret
+
+ ret
+
+.asm_8ce9e
+ call Function8ce14
+ ret
+; 8cea2
+
+Function8cea2: ; 8cea2
+ ld a, $80
+ ld [wJumptableIndex], a
+ ld de, SFX_TRAIN_ARRIVED
+ call PlaySFX
+ ret
+; 8ceae
+
+Function8ceae: ; 8ceae
+ callba Function8cf69
+ call Function8cdf7
+ call Function8cc99
+ call Function3b0c
+ call DelayFrame
+ ld a, [rSVBK]
+ push af
+ ld a, $1
+ ld [rSVBK], a
+ ld a, [TimeOfDayPal]
+ push af
+ ld a, [wPermission]
+ push af
+ ld a, [TimeOfDay]
+ and $3
+ ld [TimeOfDayPal], a
+ ld a, $1
+ ld [wPermission], a
+ ld b, SCGB_09
+ call GetSGBLayout
+ call UpdateTimePals
+ ld a, [rBGP]
+ ld [wcfc7], a
+ ld a, [rOBP0]
+ ld [wcfc8], a
+ ld a, [rOBP1]
+ ld [wcfc9], a
+ pop af
+ ld [wPermission], a
+ pop af
+ ld [TimeOfDayPal], a
+ pop af
+ ld [rSVBK], a
+ ret
+; 8ceff
+
+MagnetTrainTilemap1:
+ db $1f, $05, $06, $0a, $0a
+ db $0a, $09, $0a, $0a, $0a
+ db $0a, $0a, $0a, $09, $0a
+ db $0a, $0a, $0b, $0c, $1f
+MagnetTrainTilemap2:
+ db $14, $15, $16, $1a, $1a
+ db $1a, $19, $1a, $1a, $1a
+ db $1a, $1a, $1a, $19, $1a
+ db $1a, $1a, $1b, $1c, $1d
+MagnetTrainTilemap3:
+ db $24, $25, $26, $27, $07
+ db $2f, $29, $28, $28, $28
+ db $28, $28, $28, $29, $07
+ db $2f, $2a, $2b, $2c, $2d
+MagnetTrainTilemap4:
+ db $20, $1f, $2e, $1f, $17
+ db $00, $2e, $1f, $1f, $1f
+ db $1f, $1f, $1f, $2e, $17
+ db $00, $1f, $2e, $1f, $0f
+; 8cf4f
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -227,7 +227,7 @@
ret
; 1e5d
-Function1e5d:: ; 1e5d
+DoNthMenu:: ; 1e5d
call MenuFunc_1e7f
call MenuWriteText
call Function1eff
@@ -438,7 +438,7 @@
ret
; 1f8d
-Function1f8d:: ; 1f8d
+PlaceNthMenuStrings:: ; 1f8d
push de
ld a, [MenuSelection]
call Function1fb1
@@ -464,7 +464,7 @@
ret
; 1fa7
-Function1fa7:: ; 1fa7
+MenuJumptable:: ; 1fa7
ld a, [MenuSelection]
call Function1fb1
ld a, [hli]
--- a/main.asm
+++ b/main.asm
@@ -9791,7 +9791,7 @@
ret
; e3fd
-Functione3fd: ; e3fd
+_BillsPC: ; e3fd
call Functione40a
ret c
call Functione41c
@@ -9851,7 +9851,7 @@
xor a
ld [wcf76], a
ld [hBGMapMode], a
- call Function1e5d
+ call DoNthMenu
jr c, .cancel
ld a, [wMenuCursorBuffer]
push af
@@ -11479,1699 +11479,18 @@
INCLUDE "engine/map_setup.asm"
-PokemonCenterPC: ; 1559a
- call PC_CheckPartyForPokemon
- ret c
- call PC_PlayBootSound
- ld hl, UnknownText_0x15a27
- call PC_DisplayText
- ld hl, UnknownText_0x15a2c
- call PC_DisplayTextWaitMenu
- ld hl, .TopMenu
- call LoadMenuDataHeader
-.loop
- xor a
- ld [hBGMapMode], a
- call Function1563e
- ld [wcf76], a
- call Function1e5d
- jr c, .shutdown
- ld a, [MenuSelection]
- ld hl, .JumpTable
- call Function1fa7
- jr nc, .loop
+INCLUDE "engine/pokecenter_pc.asm"
-.shutdown
- call Function156b8
- call ExitMenu
- call WriteBackup
- ret
-; 155d6
-
-.TopMenu: ; 0x155d6
- db $48 ; flags
- db 00, 00 ; start coords
- db 12, 15 ; end coords
- dw .MenuData2
- db 1 ; default option
-; 0x155de
-
-.MenuData2: ; 0x155de
- db $a0 ; flags
- db 0 ; items
- dw .WhichPC
- dw Function1f8d
- dw .JumpTable
-; 0x155e6
-
-.JumpTable: ; 155e6
- dw Function15679, .String_PlayersPC
- dw Function15668, .String_BillsPC
- dw Function15689, .String_OaksPC
- dw Function1569a, .String_HallOfFame
- dw Function156ab, .String_TurnOff
-; 155fa
-
-.String_PlayersPC: db "<PLAYER>'s PC@"
-.String_BillsPC: db "BILL's PC@"
-.String_OaksPC: db "PROF.OAK's PC@"
-.String_HallOfFame: db "HALL OF FAME@"
-.String_TurnOff: db "TURN OFF@"
-; 1562c
-
-.WhichPC: ; 1562c
- ; before pokedex
- db 3 ; items
- db 1, 0, 4 ; bill's, player's, turn off
- db -1
-
- ; before Hall Of Fame
- db 4 ; items
- db 1, 0, 2, 4 ; bill's, player's, oak's, turn off
- db -1
-
- ; postgame
- db 5 ; items
- db 1, 0, 2, 3, 4 ; bill's, player's, oak's, hall of fame, turn off
- db -1
-; 1563e
-
-Function1563e: ; 1563e
- call CheckReceivedDex
- jr nz, .asm_15646
- ld a, $0
- ret
-
-.asm_15646
- ld a, [wd95e]
- and a
- ld a, $1
- ret z
- ld a, $2
- ret
-; 15650
-
-PC_CheckPartyForPokemon: ; 15650
- ld a, [PartyCount]
- and a
- ret nz
- ld de, SFX_CHOOSE_PC_OPTION
- call PlaySFX
- ld hl, UnknownText_0x15663
- call PC_DisplayText
- scf
- ret
-; 15663
-
-UnknownText_0x15663: ; 0x15663
- ; Bzzzzt! You must have a #MON to use this!
- text_jump UnknownText_0x1c1328
- db "@"
-; 0x15668
-
-Function15668: ; 15668
- call Function156c2
- ld hl, UnknownText_0x15a31
- call PC_DisplayText
- callba Functione3fd
- and a
- ret
-; 15679 (5:5679)
-
-Function15679: ; 15679
- call Function156c2
- ld hl, UnknownText_0x15a36
- call PC_DisplayText
- ld b, $0
- call Function15704
- and a
- ret
-; 15689
-
-Function15689: ; 15689
- call Function156c2
- ld hl, UnknownText_0x15a3b
- call PC_DisplayText
- callba ProfOaksPC
- and a
- ret
-; 1569a
-
-Function1569a: ; 1569a
- call Function156c2
- call FadeToMenu
- callba Function86650
- call Function2b3c
- and a
- ret
-; 156ab
-
-Function156ab: ; 156ab
- ld hl, UnknownText_0x15a40
- call PrintText
- scf
- ret
-; 156b3
-
-PC_PlayBootSound: ; 156b3
- ld de, SFX_BOOT_PC
- jr Function156d0
-
-Function156b8: ; 156b8
- ld de, SFX_SHUT_DOWN_PC
- call Function156d0
- call WaitSFX
- ret
-
-Function156c2: ; 156c2
- ld de, SFX_CHOOSE_PC_OPTION
- jr Function156d0
-
-Function156c7: ; 156c7
- ld de, SFX_SWITCH_POKEMON
- call Function156d0
- ld de, SFX_SWITCH_POKEMON
-
-Function156d0: ; 156d0
- push de
- call WaitSFX
- pop de
- call PlaySFX
- ret
-; 156d9
-
-Function156d9: ; 156d9
- call PC_PlayBootSound
- ld hl, UnknownText_0x156ff
- call PC_DisplayText
- ld b, $1
- call Function15704
- and a
- jr nz, .asm_156f9
- call OverworldTextModeSwitch
- call Function321c
- call UpdateSprites
- call Function156b8
- ld c, $0
- ret
-
-.asm_156f9
- call ClearBGPalettes
- ld c, $1
- ret
-; 156ff
-
-UnknownText_0x156ff: ; 0x156ff
- ; turned on the PC.
- text_jump UnknownText_0x1c1353
- db "@"
-; 0x15704
-
-Function15704: ; 15704
- ld a, b
- ld [wcf76], a
- ld hl, UnknownText_0x157cc
- call PC_DisplayTextWaitMenu
- call Function15715
- call ExitMenu
- ret
-; 15715
-
-Function15715: ; 15715
- xor a
- ld [wd0d7], a
- ld [wd0dd], a
- ld hl, KrissPCMenuData
- call LoadMenuDataHeader
-.asm_15722
- call UpdateTimePals
- call Function1e5d
- jr c, .asm_15731
- call Function1fa7
- jr nc, .asm_15722
- jr .asm_15732
-
-.asm_15731
- xor a
-
-.asm_15732
- call ExitMenu
- ret
-; 15736
-
-KrissPCMenuData: ; 0x15736
- db %01000000
- db 0, 0 ; top left corner coords (y, x)
- db 12, 15 ; bottom right corner coords (y, x)
- dw .KrissPCMenuData2
- db 1 ; default selected option
-
-.KrissPCMenuData2
- db %10100000 ; bit7
- db 0 ; # items?
- dw .KrissPCMenuList1
- dw Function1f8d
- dw .KrissPCMenuPointers
-
-.KrissPCMenuPointers ; 0x15746
- dw KrisWithdrawItemMenu, .WithdrawItem
- dw KrisDepositItemMenu, .DepositItem
- dw KrisTossItemMenu, .TossItem
- dw KrisMailBoxMenu, .MailBox
- dw KrisDecorationMenu, .Decoration
- dw KrisLogOffMenu, .LogOff
- dw KrisLogOffMenu, .TurnOff
-
-.WithdrawItem db "WITHDRAW ITEM@"
-.DepositItem db "DEPOSIT ITEM@"
-.TossItem db "TOSS ITEM@"
-.MailBox db "MAIL BOX@"
-.Decoration db "DECORATION@"
-.TurnOff db "TURN OFF@"
-.LogOff db "LOG OFF@"
-
-WITHDRAW_ITEM EQU 0
-DEPOSIT_ITEM EQU 1
-TOSS_ITEM EQU 2
-MAIL_BOX EQU 3
-DECORATION EQU 4
-TURN_OFF EQU 5
-LOG_OFF EQU 6
-
-.KrissPCMenuList1
- db 5
- db WITHDRAW_ITEM
- db DEPOSIT_ITEM
- db TOSS_ITEM
- db MAIL_BOX
- db TURN_OFF
- db -1
-
-.KrissPCMenuList2
- db 6
- db WITHDRAW_ITEM
- db DEPOSIT_ITEM
- db TOSS_ITEM
- db MAIL_BOX
- db DECORATION
- db LOG_OFF
- db -1
-
-PC_DisplayTextWaitMenu: ; 157bb
- ld a, [Options]
- push af
- set NO_TEXT_SCROLL, a
- ld [Options], a
- call MenuTextBox
- pop af
- ld [Options], a
- ret
-; 157cc
-
-UnknownText_0x157cc: ; 0x157cc
- ; What do you want to do?
- text_jump UnknownText_0x1c1368
- db "@"
-; 0x157d1
-
-KrisWithdrawItemMenu: ; 0x157d1
- call LoadStandardMenuDataHeader
- callba ClearPCItemScreen
-.asm_157da
- call Function15985
- jr c, .asm_157e4
- call Function157e9
- jr .asm_157da
-
-.asm_157e4
- call Function2b3c
- xor a
- ret
-; 0x157e9
-
-Function157e9: ; 0x157e9
- ; check if the item has a quantity
- callba _CheckTossableItem
- ld a, [wItemAttributeParamBuffer]
- and a
- jr z, .askquantity
-
- ; items without quantity are always ×1
- ld a, 1
- ld [wItemQuantityChangeBuffer], a
- jr .withdraw
-
-.askquantity
- ld hl, .HowManyText
- call MenuTextBox
- callba Function24fbf
- call ExitMenu
- call ExitMenu
- jr c, .done
-
-.withdraw
- ld a, [wItemQuantityChangeBuffer]
- ld [Buffer1], a ; quantity
- ld a, [wd107]
- ld [Buffer2], a
- ld hl, NumItems
- call ReceiveItem
- jr nc, .PackFull
- ld a, [Buffer1]
- ld [wItemQuantityChangeBuffer], a
- ld a, [Buffer2]
- ld [wd107], a
- ld hl, PCItems
- call TossItem
- predef PartyMonItemName
- ld hl, .WithdrewText
- call MenuTextBox
- xor a
- ld [hBGMapMode], a
- call ExitMenu
- ret
-
-.PackFull
- ld hl, .NoRoomText
- call MenuTextBoxBackup
- ret
-
-.done
- ret
-; 0x15850
-
-.HowManyText ; 0x15850
- text_jump _KrissPCHowManyWithdrawText
- db "@"
-
-.WithdrewText ; 0x15855
- text_jump _KrissPCWithdrewItemsText
- db "@"
-
-.NoRoomText ; 0x1585a
- text_jump _KrissPCNoRoomWithdrawText
- db "@"
-
-
-KrisTossItemMenu: ; 0x1585f
- call LoadStandardMenuDataHeader
- callba ClearPCItemScreen
-.asm_15868
- call Function15985
- jr c, .asm_15878
- ld de, PCItems
- callba Function129f4
- jr .asm_15868
-
-.asm_15878
- call Function2b3c
- xor a
- ret
-; 0x1587d
-
-
-KrisDecorationMenu: ; 0x1587d
- callba _KrisDecorationMenu
- ld a, c
- and a
- ret z
- scf
- ret
-; 0x15888
-
-
-KrisLogOffMenu: ; 0x15888
- xor a
- scf
- ret
-; 0x1588b
-
-
-KrisDepositItemMenu: ; 0x1588b
- call Function158b8
- jr c, .asm_158b6
- call DisableSpriteUpdates
- call LoadStandardMenuDataHeader
- callba Function106a5
-.asm_1589c
- callba Function106be
- ld a, [wcf66]
- and a
- jr z, .asm_158b3
- call Function158cc
- callba CheckRegisteredItem
- jr .asm_1589c
-
-.asm_158b3
- call Function2b3c
-
-.asm_158b6
- xor a
- ret
-; 0x158b8
-
-Function158b8: ; 0x158b8
- callba Function129d5
- ret nc
- ld hl, UnknownText_0x158c7
- call MenuTextBoxBackup
- scf
- ret
-; 0x158c7
-
-UnknownText_0x158c7: ; 0x158c7
- ; No items here!
- text_jump UnknownText_0x1c13df
- db "@"
-; 0x158cc
-
-
-Function158cc: ; 0x158cc
- ld a, [wc2ce]
- push af
- ld a, $0
- ld [wc2ce], a
- callba CheckItemMenu
- ld a, [wItemAttributeParamBuffer]
- ld hl, .jumptable
- rst JumpTable
- pop af
- ld [wc2ce], a
- ret
-; 0x158e7
-
-.jumptable: ; 0x158e7
- dw .maybe_use
- dw .no_use
- dw .no_use
- dw .no_use
- dw .maybe_use
- dw .maybe_use
- dw .maybe_use
-
-.no_use:
- ret
-
-.maybe_use:
- ld a, [Buffer1]
- push af
- ld a, [Buffer2]
- push af
- call Function1590a
- pop af
- ld [Buffer2], a
- pop af
- ld [Buffer1], a
- ret
-; 0x1590a
-
-Function1590a: ; 0x1590a
- callba _CheckTossableItem
- ld a, [wItemAttributeParamBuffer]
- and a
- jr z, .asm_1591d
- ld a, $1
- ld [wItemQuantityChangeBuffer], a
- jr .asm_15933
-
-.asm_1591d
- ld hl, .HowManyText
- call MenuTextBox
- callba Function24fbf
- push af
- call ExitMenu
- call ExitMenu
- pop af
- jr c, .asm_1596c
-
-.asm_15933
- ld a, [wItemQuantityChangeBuffer]
- ld [Buffer1], a
- ld a, [wd107]
- ld [Buffer2], a
- ld hl, PCItems
- call ReceiveItem
- jr nc, .asm_15965
- ld a, [Buffer1]
- ld [wItemQuantityChangeBuffer], a
- ld a, [Buffer2]
- ld [wd107], a
- ld hl, NumItems
- call TossItem
- predef PartyMonItemName
- ld hl, .DepositText
- call PrintText
- ret
-
-.asm_15965
- ld hl, .NoRoomText
- call PrintText
- ret
-
-.asm_1596c
- and a
- ret
-; 0x1596e
-
-
-.HowManyText ; 0x1596e
- text_jump _KrissPCHowManyDepositText
- db "@"
-
-.DepositText ; 0x15973
- text_jump _KrissPCDepositItemsText
- db "@"
-
-.NoRoomText ; 0x15978
- text_jump _KrissPCNoRoomDepositText
- db "@"
-
-
-KrisMailBoxMenu: ; 0x1597d
- callba _KrisMailBoxMenu
- xor a
- ret
-; 0x15985
-
-
-Function15985: ; 0x15985
- xor a
- ld [wd0e3], a
-.asm_15989
- ld a, [wc2ce]
- push af
- ld a, $0
- ld [wc2ce], a
- ld hl, MenuData15a08
- call CopyMenuDataHeader
- hlcoord 0, 0
- ld b, $a
- ld c, $12
- call TextBox
- ld a, [wd0d7]
- ld [wMenuCursorBuffer], a
- ld a, [wd0dd]
- ld [wd0e4], a
- call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0dd], a
- ld a, [MenuSelection2]
- ld [wd0d7], a
- pop af
- ld [wc2ce], a
- ld a, [wd0e3]
- and a
- jr nz, .asm_159d8
- ld a, [wcf73]
- cp $2
- jr z, .asm_15a06
- cp $1
- jr z, .asm_159fb
- cp $4
- jr z, .asm_159f2
- jr .asm_159f8
-
-.asm_159d8
- ld a, [wcf73]
- cp $2
- jr z, .asm_159e9
- cp $1
- jr z, .asm_159ef
- cp $4
- jr z, .asm_159ef
- jr .asm_159f8
-
-.asm_159e9
- xor a
- ld [wd0e3], a
- jr .asm_159f8
-
-.asm_159ef
- call Function156c7
-
-.asm_159f2
- callba Function2490c
-
-.asm_159f8
- jp .asm_15989
-
-.asm_159fb
- callba Function24706
- call Function1bee
- and a
- ret
-
-.asm_15a06
- scf
- ret
-; 0x15a08
-
-MenuData15a08: ; 0x15a08
- db %01000000
- db 1, 4 ; start coords
- db 10, 18 ; end coords
- dw .MenuData2
- db 1 ; default option
-
-.MenuData2
- db %10110000
- db 4, 8 ; rows/cols?
- db 2 ; horizontal spacing?
- dbw 0, PCItems
- dba PlaceMenuItemName
- dba PlaceMenuItemQuantity
- dba Function244c3
-
-PC_DisplayText: ; 15a20
- call MenuTextBox
- call ExitMenu
- ret
-; 15a27
-
-
-UnknownText_0x15a27: ; 0x15a27
- ; turned on the PC.
- text_jump UnknownText_0x1c144d
- db "@"
-; 0x15a2c
-
-UnknownText_0x15a2c: ; 0x15a2c
- ; Access whose PC?
- text_jump UnknownText_0x1c1462
- db "@"
-; 0x15a31
-
-UnknownText_0x15a31: ; 0x15a31
- ; BILL's PC accessed. #MON Storage System opened.
- text_jump UnknownText_0x1c1474
- db "@"
-; 0x15a36
-
-UnknownText_0x15a36: ; 0x15a36
- ; Accessed own PC. Item Storage System opened.
- text_jump UnknownText_0x1c14a4
- db "@"
-; 0x15a3b
-
-UnknownText_0x15a3b: ; 0x15a3b
- ; PROF.OAK's PC accessed. #DEX Rating System opened.
- text_jump UnknownText_0x1c14d2
- db "@"
-; 0x15a40
-
-UnknownText_0x15a40: ; 0x15a40
- ; … Link closed…
- text_jump UnknownText_0x1c1505
- db "@"
-; 0x15a45
-
-
INCLUDE "engine/mart.asm"
-GiveMoney:: ; 15fd7
- ld a, $3
- call AddMoney
- ld bc, MaxMoney
- ld a, $3
- call CompareMoney
- jr z, .asm_15ff5
- jr c, .asm_15ff5
- ld hl, MaxMoney
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- scf
- ret
+INCLUDE "engine/money.asm"
-.asm_15ff5
- and a
- ret
-; 15ff7
-
-MaxMoney: ; 15ff7
- dt 999999
-; 15ffa
-
-
-TakeMoney:: ; 15ffa
- ld a, 3
- call SubtractMoney
- jr nc, .asm_16009
- xor a
- ld [de], a
- inc de
- ld [de], a
- inc de
- ld [de], a
- scf
- ret
-
-.asm_16009
- and a
- ret
-; 1600b
-
-CompareMoney:: ; 1600b
- ld a, $3
-CompareFunds: ; 1600d
- push hl
- push de
- push bc
- ld h, b
- ld l, c
- ld c, $0
- ld b, a
-.loop1
- dec a
- jr z, .done
- inc de
- inc hl
- jr .loop1
-
-.done
- and a
-.loop2
- ld a, [de]
- sbc [hl]
- jr z, .okay
- inc c
-
-.okay
- dec de
- dec hl
- dec b
- jr nz, .loop2
- jr c, .set_carry
- ld a, c
- and a
- jr .skip_carry
-
-.set_carry
- ld a, $1
- and a
- scf
-
-.skip_carry
- pop bc
- pop de
- pop hl
- ret
-; 16035
-
-SubtractMoney: ; 16035
- ld a, 3
-SubtractFunds: ; 16037
- push hl
- push de
- push bc
- ld h, b
- ld l, c
- ld b, a
- ld c, 0
-.loop
- dec a
- jr z, .done
- inc de
- inc hl
- jr .loop
-
-.done
- and a
-.loop2
- ld a, [de]
- sbc [hl]
- ld [de], a
- dec de
- dec hl
- dec b
- jr nz, .loop2
- pop bc
- pop de
- pop hl
- ret
-; 16053
-
-AddMoney: ; 16053
- ld a, $3
-AddFunds: ; 16055
- push hl
- push de
- push bc
- ld h, b
- ld l, c
- ld b, a
-.loop1
- dec a
- jr z, .done
- inc de
- inc hl
- jr .loop1
-
-.done
- and a
-.loop2
- ld a, [de]
- adc [hl]
- ld [de], a
- dec de
- dec hl
- dec b
- jr nz, .loop2
- pop bc
- pop de
- pop hl
- ret
-; 1606f
-
-GiveCoins:: ; 1606f
- ld a, 2
- ld de, Coins
- call AddFunds
- ld a, 2
- ld bc, .maxcoins
- call CompareFunds
- jr c, .not_maxed
- ld hl, .maxcoins
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- scf
- ret
-
-.not_maxed
- and a
- ret
-; 1608d
-
-.maxcoins: ; 1608d
- bigdw 9999
-; 1608f
-
-
-TakeCoins:: ; 1608f
- ld a, 2
- ld de, Coins
- call SubtractFunds
- jr nc, .asm_1609f
- xor a
- ld [de], a
- inc de
- ld [de], a
- scf
- ret
-
-.asm_1609f
- and a
- ret
-; 160a1
-
-CheckCoins:: ; 160a1
- ld a, $2
- ld de, Coins
- jp CompareFunds
-; 160a9
-
-
INCLUDE "items/marts.asm"
INCLUDE "event/mom.asm"
-Special_DayCareMan: ; 166d6
- ld hl, wDaycareMan
- bit 0, [hl]
- jr nz, .asm_166fe
- ld hl, wDaycareMan
- ld a, $0
- call Function1678f
- jr c, .asm_16724
- call Function16798
- jr c, .asm_16721
- callba Functionde2a
- ld hl, wDaycareMan
- set 0, [hl]
- call Function167f6
- call Function16a3b
- ret
-
-.asm_166fe
- callba Functione698
- ld hl, wBreedMon1Nick
- call Function1686d
- call Function16807
- jr c, .asm_16721
- callba Functiondd21
- call Function16850
- ld hl, wDaycareMan
- res 0, [hl]
- res 5, [hl]
- jr .asm_16724
-
-.asm_16721
- call Function1689b
-
-.asm_16724
- ld a, $13
- call Function1689b
- ret
-; 1672a
-
-Special_DayCareLady: ; 1672a
- ld hl, wDaycareLady
- bit 0, [hl]
- jr nz, .asm_16752
- ld hl, wDaycareLady
- ld a, $2
- call Function16781
- jr c, .asm_1677b
- call Function16798
- jr c, .asm_16778
- callba Functionde37
- ld hl, wDaycareLady
- set 0, [hl]
- call Function167f6
- call Function16a3b
- ret
-
-.asm_16752
- callba Functione6b3
- ld hl, wBreedMon2Nick
- call Function1686d
- call Function16807
- jr c, .asm_16778
- callba Functiondd42
- call Function16850
- ld hl, wDaycareLady
- res 0, [hl]
- ld hl, wDaycareMan
- res 5, [hl]
- jr .asm_1677b
-
-.asm_16778
- call Function1689b
-
-.asm_1677b
- ld a, $13
- call Function1689b
- ret
-; 16781
-
-Function16781: ; 16781
- bit 7, [hl]
- jr nz, .asm_16788
- set 7, [hl]
- inc a
-
-.asm_16788
- call Function1689b
- call YesNoBox
- ret
-; 1678f
-
-Function1678f: ; 1678f
- set 7, [hl]
- call Function1689b
- call YesNoBox
- ret
-; 16798
-
-Function16798: ; 16798
- ld a, [PartyCount]
- cp 2
- jr c, .asm_167e5
- ld a, 4
- call Function1689b
- ld b, 6
- callba Function5001d
- jr c, .asm_167dd
- ld a, [CurPartySpecies]
- cp EGG
- jr z, .asm_167e1
- callba CheckCurPartyMonFainted
- jr c, .asm_167e9
- ld hl, PartyMon1Item
- ld bc, PARTYMON_STRUCT_LENGTH
- ld a, [CurPartyMon]
- call AddNTimes
- ld d, [hl]
- callba ItemIsMail
- jr c, .asm_167ed
- ld hl, PartyMonNicknames
- ld a, [CurPartyMon]
- call GetNick
- and a
- ret
-
-.asm_167dd
- ld a, $12
- scf
- ret
-
-.asm_167e1
- ld a, $6
- scf
- ret
-
-.asm_167e5
- ld a, $7
- scf
- ret
-
-.asm_167e9
- ld a, $8
- scf
- ret
-
-.asm_167ed
- ld a, $a
- scf
- ret
-; 167f1
-
-UnknownText_0x167f1: ; 0x167f1
- ;
- text_jump UnknownText_0x1bdaa7
- db "@"
-; 0x167f6
-
-Function167f6: ; 167f6
- ld a, $5
- call Function1689b
- ld a, [CurPartySpecies]
- call PlayCry
- ld a, $9
- call Function1689b
- ret
-; 16807
-
-Function16807: ; 16807
- ld a, [StringBuffer2 + 1]
- and a
- jr nz, .asm_16819
- ld a, $f
- call Function1689b
- call YesNoBox
- jr c, .asm_16844
- jr .asm_1682d
-
-.asm_16819
- ld a, $b
- call Function1689b
- call YesNoBox
- jr c, .asm_16844
- ld a, $c
- call Function1689b
- call YesNoBox
- jr c, .asm_16844
-
-.asm_1682d
- ld de, Money
- ld bc, StringBuffer2 + 2
- callba CompareMoney
- jr c, .asm_16848
- ld a, [PartyCount]
- cp $6
- jr nc, .asm_1684c
- and a
- ret
-
-.asm_16844
- ld a, $12
- scf
- ret
-
-.asm_16848
- ld a, $11
- scf
- ret
-
-.asm_1684c
- ld a, $10
- scf
- ret
-; 16850
-
-Function16850: ; 16850
- ld bc, StringBuffer2 + 2
- ld de, Money
- callba TakeMoney
- ld a, $d
- call Function1689b
- ld a, [CurPartySpecies]
- call PlayCry
- ld a, $e
- call Function1689b
- ret
-; 1686d
-
-Function1686d: ; 1686d
- ld a, b
- ld [StringBuffer2], a
- ld a, d
- ld [StringBuffer2 + 1], a
- ld de, StringBuffer1
- ld bc, NAME_LENGTH
- call CopyBytes
- ld hl, 0
- ld bc, $64
- ld a, [StringBuffer2 + 1]
- call AddNTimes
- ld de, $64
- add hl, de
- xor a
- ld [StringBuffer2 + 2], a
- ld a, h
- ld [StringBuffer2 + 3], a
- ld a, l
- ld [StringBuffer2 + 4], a
- ret
-; 1689b
-
-Function1689b: ; 1689b
- ld e, a
- ld d, 0
- ld hl, TextTable_168aa
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- call PrintText
- ret
-; 168aa
-
-TextTable_168aa: ; 168aa
- dw UnknownText_0x168d2
- dw UnknownText_0x168d7
- dw UnknownText_0x168dc
- dw UnknownText_0x168e1
- dw UnknownText_0x168e6
- dw UnknownText_0x168ff
- dw UnknownText_0x168f0
- dw UnknownText_0x168eb
- dw UnknownText_0x168fa
- dw UnknownText_0x16904
- dw UnknownText_0x168f5
- dw UnknownText_0x16909
- dw UnknownText_0x1690e
- dw UnknownText_0x16913
- dw UnknownText_0x16918
- dw UnknownText_0x1691d
- dw UnknownText_0x16922
- dw UnknownText_0x16927
- dw UnknownText_0x1692c
- dw UnknownText_0x16931
-; 168d2
-
-UnknownText_0x168d2: ; 0x168d2
- ; I'm the DAY-CARE MAN. Want me to raise a #MON?
- text_jump UnknownText_0x1bdaa9
- db "@"
-; 0x168d7
-
-UnknownText_0x168d7: ; 0x168d7
- ; I'm the DAY-CARE MAN. Do you know about EGGS? I was raising #MON with my wife, you see. We were shocked to find an EGG! How incredible is that? So, want me to raise a #MON?
- text_jump UnknownText_0x1bdad8
- db "@"
-; 0x168dc
-
-UnknownText_0x168dc: ; 0x168dc
- ; I'm the DAY-CARE LADY. Should I raise a #MON for you?
- text_jump UnknownText_0x1bdb85
- db "@"
-; 0x168e1
-
-UnknownText_0x168e1: ; 0x168e1
- ; I'm the DAY-CARE LADY. Do you know about EGGS? My husband and I were raising some #MON, you see. We were shocked to find an EGG! How incredible could that be? Should I raise a #MON for you?
- text_jump UnknownText_0x1bdbbb
- db "@"
-; 0x168e6
-
-UnknownText_0x168e6: ; 0x168e6
- ; What should I raise for you?
- text_jump UnknownText_0x1bdc79
- db "@"
-; 0x168eb
-
-UnknownText_0x168eb: ; 0x168eb
- ; Oh? But you have just one #MON.
- text_jump UnknownText_0x1bdc97
- db "@"
-; 0x168f0
-
-UnknownText_0x168f0: ; 0x168f0
- ; Sorry, but I can't accept an EGG.
- text_jump UnknownText_0x1bdcb8
- db "@"
-; 0x168f5
-
-UnknownText_0x168f5: ; 0x168f5
- ; Remove MAIL before you come see me.
- text_jump UnknownText_0x1bdcda
- db "@"
-; 0x168fa
-
-UnknownText_0x168fa: ; 0x168fa
- ; If you give me that, what will you battle with?
- text_jump UnknownText_0x1bdcff
- db "@"
-; 0x168ff
-
-UnknownText_0x168ff: ; 0x168ff
- ; OK. I'll raise your @ .
- text_jump UnknownText_0x1bdd30
- db "@"
-; 0x16904
-
-UnknownText_0x16904: ; 0x16904
- ; Come back for it later.
- text_jump UnknownText_0x1bdd4b
- db "@"
-; 0x16909
-
-UnknownText_0x16909: ; 0x16909
- ; Are we geniuses or what? Want to see your @ ?
- text_jump UnknownText_0x1bdd64
- db "@"
-; 0x1690e
-
-UnknownText_0x1690e: ; 0x1690e
- ; Your @ has grown a lot. By level, it's grown by @ . If you want your #MON back, it will cost ¥@ .
- text_jump UnknownText_0x1bdd96
- db "@"
-; 0x16913
-
-UnknownText_0x16913: ; 0x16913
- ; Perfect! Here's your #MON.
- text_jump UnknownText_0x1bde04
- db "@"
-; 0x16918
-
-UnknownText_0x16918: ; 0x16918
- ; got back @ .
- text_jump UnknownText_0x1bde1f
- db "@"
-; 0x1691d
-
-UnknownText_0x1691d: ; 0x1691d
- ; Huh? Back already? Your @ needs a little more time with us. If you want your #MON back, it will cost ¥100.
- text_jump UnknownText_0x1bde32
- db "@"
-; 0x16922
+INCLUDE "event/daycare.asm"
-UnknownText_0x16922: ; 0x16922
- ; You have no room for it.
- text_jump UnknownText_0x1bdea2
- db "@"
-; 0x16927
-
-UnknownText_0x16927: ; 0x16927
- ; You don't have enough money.
- text_jump UnknownText_0x1bdebc
- db "@"
-; 0x1692c
-
-UnknownText_0x1692c: ; 0x1692c
- ; Oh, fine then.
- text_jump UnknownText_0x1bded9
- db "@"
-; 0x16931
-
-UnknownText_0x16931: ; 0x16931
- ; Come again.
- text_jump UnknownText_0x1bdee9
- db "@"
-; 0x16936
-
-Special_DayCareManOutside: ; 16936
- ld hl, wDaycareMan
- bit 6, [hl]
- jr nz, Function16949
- ld hl, UnknownText_0x16944
- call PrintText
- ret
-
-UnknownText_0x16944: ; 0x16944
- ; Not yet…
- text_jump UnknownText_0x1bdef6
- db "@"
-; 0x16949
-
-Function16949: ; 16949
- ld hl, UnknownText_0x16993
- call PrintText
- call YesNoBox
- jr c, .asm_1697c
- ld a, [PartyCount]
- cp PARTY_LENGTH
- jr nc, .asm_16987
- call Function169ac
- ld hl, wDaycareMan
- res 6, [hl]
- call Function16a3b
- ld hl, UnknownText_0x16998
- call PrintText
- ld de, SFX_GET_EGG_FROM_DAYCARE_LADY
- call PlaySFX
- ld c, 120
- call DelayFrames
- ld hl, UnknownText_0x1699d
- jr .asm_1697f
-
-.asm_1697c
- ld hl, UnknownText_0x169a2
-
-.asm_1697f
- call PrintText
- xor a
- ld [ScriptVar], a
- ret
-
-.asm_16987
- ld hl, UnknownText_0x169a7
- call PrintText
- ld a, $1
- ld [ScriptVar], a
- ret
-; 16993
-
-UnknownText_0x16993: ; 0x16993
- ; Ah, it's you! We were raising your #MON, and my goodness, were we surprised! Your #MON had an EGG! We don't know how it got there, but your #MON had it. You want it?
- text_jump UnknownText_0x1bdf00
- db "@"
-; 0x16998
-
-UnknownText_0x16998: ; 0x16998
- ; received the EGG!
- text_jump UnknownText_0x1bdfa5
- db "@"
-; 0x1699d
-
-UnknownText_0x1699d: ; 0x1699d
- ; Take good care of it.
- text_jump UnknownText_0x1bdfba
- db "@"
-; 0x169a2
-
-UnknownText_0x169a2: ; 0x169a2
- ; Well then, I'll keep it. Thanks!
- text_jump UnknownText_0x1bdfd1
- db "@"
-; 0x169a7
-
-UnknownText_0x169a7: ; 0x169a7
- ; You have no room in your party. Come back later.
- text_jump UnknownText_0x1bdff2
- db "@"
-; 0x169ac
-
-Function169ac: ; 169ac
- ld a, [wEggMonLevel]
- ld [CurPartyLevel], a
- ld hl, PartyCount
- ld a, [hl]
- cp PARTY_LENGTH
- jr nc, .asm_16a2f
- inc a
- ld [hl], a
- ld c, a
- ld b, 0
- add hl, bc
- ld a, EGG
- ld [hli], a
- ld a, [wEggMonSpecies]
- ld [CurSpecies], a
- ld [CurPartySpecies], a
- ld a, $ff
- ld [hl], a
- ld hl, PartyMonNicknames
- ld bc, PKMN_NAME_LENGTH
- call Function16a31
- ld hl, wEggNick
- call CopyBytes
- ld hl, PartyMonOT
- ld bc, NAME_LENGTH
- call Function16a31
- ld hl, wEggOT
- call CopyBytes
- ld hl, PartyMon1
- ld bc, PARTYMON_STRUCT_LENGTH
- call Function16a31
- ld hl, wEggMon
- ld bc, wEggMonEnd - wEggMon
- call CopyBytes
- call GetBaseData
- ld a, [PartyCount]
- dec a
- ld hl, PartyMon1
- ld bc, PARTYMON_STRUCT_LENGTH
- call AddNTimes
- ld b, h
- ld c, l
- ld hl, MON_ID + 1
- add hl, bc
- push hl
- ld hl, MON_MAXHP
- add hl, bc
- ld d, h
- ld e, l
- pop hl
- push bc
- ld b, $0
- predef CalcPkmnStats
- pop bc
- ld hl, MON_HP
- add hl, bc
- xor a
- ld [hli], a
- ld [hl], a
- and a
- ret
-
-.asm_16a2f
- scf
- ret
-; 16a31
-
-Function16a31: ; 16a31
- ld a, [PartyCount]
- dec a
- call AddNTimes
- ld d, h
- ld e, l
- ret
-; 16a3b
-
-Function16a3b: ; 16a3b
- ld a, [wDaycareLady]
- bit 0, a
- ret z
- ld a, [wDaycareMan]
- bit 0, a
- ret z
- callab Function16e1d
- ld a, [wd265]
- and a
- ret z
- inc a
- ret z
- ld hl, wDaycareMan
- set 5, [hl]
-.asm_16a59
- call Random
- cp 150
- jr c, .asm_16a59
- ld [wStepsToEgg], a
- jp Function16a66
-; 16a66
-
-Function16a66: ; 16a66
- xor a
- ld hl, wEggMon
- ld bc, wEggMonEnd - wEggMon
- call ByteFill
- ld hl, wEggNick
- ld bc, PKMN_NAME_LENGTH
- call ByteFill
- ld hl, wEggOT
- ld bc, NAME_LENGTH
- call ByteFill
- ld a, [wBreedMon1DVs]
- ld [TempMonDVs], a
- ld a, [wBreedMon1DVs + 1]
- ld [TempMonDVs + 1], a
- ld a, [wBreedMon1Species]
- ld [CurPartySpecies], a
- ld a, $3
- ld [MonType], a
- ld a, [wBreedMon1Species]
- cp DITTO
- ld a, $1
- jr z, .asm_16ab6
- ld a, [wBreedMon2Species]
- cp DITTO
- ld a, $0
- jr z, .asm_16ab6
- callba GetGender
- ld a, $0
- jr z, .asm_16ab6
- inc a
-
-.asm_16ab6
- ld [wDittoInDaycare], a
- and a
- ld a, [wBreedMon1Species]
- jr z, .asm_16ac2
- ld a, [wBreedMon2Species]
-
-.asm_16ac2
- ld [CurPartySpecies], a
- callab GetPreEvolution
- callab GetPreEvolution
- ld a, EGG_LEVEL
- ld [CurPartyLevel], a
-
- ld a, [CurPartySpecies]
- cp NIDORAN_F
- jr nz, .asm_16ae8
- call Random
- cp $80
- ld a, NIDORAN_F
- jr c, .asm_16ae8
- ld a, NIDORAN_M
-.asm_16ae8
- ld [CurPartySpecies], a
- ld [CurSpecies], a
- ld [wEggMonSpecies], a
-
- call GetBaseData
- ld hl, wEggNick
- ld de, String_16be0
- call CopyName2
- ld hl, PlayerName
- ld de, wEggOT
- ld bc, NAME_LENGTH
- call CopyBytes
- xor a
- ld [wEggMonItem], a
- ld de, wEggMonMoves
- xor a
- ld [Buffer1], a
- predef FillMoves
- callba Function170bf
- ld hl, wEggMonID
- ld a, [PlayerID]
- ld [hli], a
- ld a, [PlayerID + 1]
- ld [hl], a
- ld a, [CurPartyLevel]
- ld d, a
- callab CalcExpAtLevel
- ld hl, wEggMonExp
- ld a, [hMultiplicand]
- ld [hli], a
- ld a, [$ffb5]
- ld [hli], a
- ld a, [$ffb6]
- ld [hl], a
- xor a
- ld b, $a
- ld hl, wEggMonStatExp
-.asm_16b46
- ld [hli], a
- dec b
- jr nz, .asm_16b46
- ld hl, wEggMonDVs
- call Random
- ld [hli], a
- ld [TempMonDVs], a
- call Random
- ld [hld], a
- ld [TempMonDVs + 1], a
- ld de, wBreedMon1DVs
- ld a, [wBreedMon1Species]
- cp DITTO
- jr z, .asm_16b98
- ld de, wBreedMon2DVs
- ld a, [wBreedMon2Species]
- cp DITTO
- jr z, .asm_16b98
- ld a, $3
- ld [MonType], a
- push hl
- callba GetGender
- pop hl
- ld de, wBreedMon1DVs
- ld bc, wBreedMon2DVs
- jr c, .asm_16bab
- jr z, .asm_16b90
- ld a, [wDittoInDaycare]
- and a
- jr z, .asm_16b98
- ld d, b
- ld e, c
- jr .asm_16b98
-
-.asm_16b90
- ld a, [wDittoInDaycare]
- and a
- jr nz, .asm_16b98
- ld d, b
- ld e, c
-
-.asm_16b98
- ld a, [de]
- inc de
- and $f
- ld b, a
- ld a, [hl]
- and $f0
- add b
- ld [hli], a
- ld a, [de]
- and $7
- ld b, a
- ld a, [hl]
- and $f8
- add b
- ld [hl], a
-
-.asm_16bab
- ld hl, StringBuffer1
- ld de, wd050
- ld bc, NAME_LENGTH
- call CopyBytes
- ld hl, wEggMonMoves
- ld de, wEggMonPP
- predef FillPP
- ld hl, wd050
- ld de, StringBuffer1
- ld bc, NAME_LENGTH
- call CopyBytes
- ld a, [BaseEggSteps]
- ld hl, wEggMonHappiness
- ld [hli], a
- xor a
-rept 2
- ld [hli], a
-endr
- ld [hl], a
- ld a, [CurPartyLevel]
- ld [wEggMonLevel], a
- ret
-; 16be0
-
-String_16be0: ; 16be0
- db "EGG@"
-; 16be4
-
Function16be4: ; 16be4
ld a, [UnownDex]
and a
@@ -16627,13 +14946,13 @@
ld a, [wd1ef]
ld [wMenuCursorBuffer], a
call Function26806
- call Function1e5d
+ call DoNthMenu
ld a, [MenuSelection2]
ld [wd1ef], a
jr c, .asm_2678e
ld a, [MenuSelection]
ld hl, Unknown_267aa
- call Function1fa7
+ call MenuJumptable
jr nc, .asm_2676f
.asm_2678e
@@ -16657,7 +14976,7 @@
db $a0 ; flags
db 0 ; items
dw wd002
- dw Function1f8d
+ dw PlaceNthMenuStrings
dw Unknown_267aa
; 0x267aa
@@ -16942,7 +15261,7 @@
ld [wcf76], a
ld hl, MenuDataHeader_0x269b5
call LoadMenuDataHeader
- call Function1e5d
+ call DoNthMenu
jr c, .no_action_1
call DoDecorationAction2
@@ -37118,7 +35437,7 @@
callba Function14da0
- ld hl, wd95e
+ ld hl, wHallOfFameCount
ld a, [hl]
cp 200
jr nc, .ok
@@ -37249,7 +35568,7 @@
ld bc, HOF_LENGTH
xor a
call ByteFill
- ld a, [wd95e]
+ ld a, [wHallOfFameCount]
ld de, OverworldMap
ld [de], a
inc de
@@ -37387,7 +35706,7 @@
; 86635
Function86635: ; 86635
-.asm_86635
+.loop
ld a, [hSCX]
cp $70
ret z
@@ -37394,11 +35713,11 @@
add $4
ld [hSCX], a
call DelayFrame
- jr .asm_86635
+ jr .loop
; 86643
Function86643: ; 86643
-.asm_86643
+.loop
ld a, [hSCX]
and a
ret z
@@ -37407,14 +35726,14 @@
endr
ld [hSCX], a
call DelayFrame
- jr .asm_86643
+ jr .loop
; 86650
-Function86650: ; 86650
+_HallOfFamePC: ; 86650
call LoadFontsBattleExtra
xor a
ld [wJumptableIndex], a
-.asm_86657
+.loop
call Function8671c
ret c
call Function86665
@@ -37421,40 +35740,40 @@
ret c
ld hl, wJumptableIndex
inc [hl]
- jr .asm_86657
+ jr .loop
; 86665
Function86665: ; 86665
xor a
ld [wcf64], a
-.asm_86669
+.next
call Function86692
- jr c, .asm_86690
-.asm_8666e
+ jr c, .start_button
+.loop
call JoyTextDelay
ld hl, hJoyLast
ld a, [hl]
and B_BUTTON
- jr nz, .asm_8668e
+ jr nz, .b_button
ld a, [hl]
and A_BUTTON
- jr nz, .asm_86688
+ jr nz, .a_button
ld a, [hl]
and START
- jr nz, .asm_86690
+ jr nz, .start_button
call DelayFrame
- jr .asm_8666e
+ jr .loop
-.asm_86688
+.a_button
ld hl, wcf64
inc [hl]
- jr .asm_86669
+ jr .next
-.asm_8668e
+.b_button
scf
ret
-.asm_86690
+.start_button
and a
ret
; 86692
@@ -37464,19 +35783,19 @@
; If that number is above 200, print "HOF Master!" instead.
ld a, [wcf64]
cp $6
- jr nc, .asm_866a7
+ jr nc, .fail
ld hl, wc608 + 1
ld bc, $10
call AddNTimes
ld a, [hl]
cp $ff
- jr nz, .asm_866a9
+ jr nz, .okay
-.asm_866a7
+.fail
scf
ret
-.asm_866a9
+.okay
push hl
call ClearBGPalettes
pop hl
@@ -37483,14 +35802,14 @@
call Function86748
ld a, [wc608]
cp 200 + 1
- jr c, .asm_866c6
+ jr c, .print_num_hof
ld de, String_866fc
hlcoord 1, 2
call PlaceString
hlcoord 13, 2
- jr .asm_866de
+ jr .finish
-.asm_866c6
+.print_num_hof
ld de, String_8670c
hlcoord 1, 2
call PlaceString
@@ -37500,7 +35819,7 @@
call PrintNum
hlcoord 11, 2
-.asm_866de
+.finish
ld de, String_866fb
call PlaceString
call WaitBGMap
@@ -37530,7 +35849,7 @@
Function8671c: ; 8671c
ld a, [wJumptableIndex]
cp NUM_HOF_TEAMS
- jr nc, .asm_86746
+ jr nc, .full
ld hl, sHallOfFame
ld bc, HOF_LENGTH
call AddNTimes
@@ -37538,7 +35857,7 @@
call GetSRAMBank
ld a, [hl]
and a
- jr z, .asm_86743
+ jr z, .fail
ld de, wc608
ld bc, HOF_LENGTH
call CopyBytes
@@ -37546,10 +35865,10 @@
and a
ret
-.asm_86743
+.fail
call CloseSRAM
-.asm_86746
+.full
scf
ret
; 86748
@@ -37595,7 +35914,7 @@
call _PrepMonFrontpic
ld a, [CurPartySpecies]
cp EGG
- jr z, .asm_867f8
+ jr z, .print_id_no
hlcoord 1, 13
ld a, $74
ld [hli], a
@@ -37610,17 +35929,17 @@
ld a, $3
ld [MonType], a
callba GetGender
- ld a, $7f
- jr c, .asm_867e2
- ld a, $ef
- jr nz, .asm_867e2
- ld a, $f5
+ ld a, " "
+ jr c, .got_gender
+ ld a, "♂"
+ jr nz, .got_gender
+ ld a, "♀"
-.asm_867e2
+.got_gender
hlcoord 18, 13
ld [hli], a
hlcoord 8, 14
- ld a, $f3
+ ld a, "/"
ld [hli], a
ld de, StringBuffer2
call PlaceString
@@ -37627,13 +35946,13 @@
hlcoord 1, 16
call PrintLevel
-.asm_867f8
+.print_id_no
hlcoord 7, 16
- ld a, $73
+ ld a, "<ID>"
ld [hli], a
- ld a, $74
+ ld a, "№"
ld [hli], a
- ld [hl], $f3
+ ld [hl], "/"
hlcoord 10, 16
ld de, TempMonID
lb bc, PRINTNUM_LEADINGZEROS | 2, 5
@@ -38056,321 +36375,10 @@
ret
; 8c7d4
-PlayWhirlpoolSound: ; 8c7d4
- call WaitSFX
- ld de, SFX_SURF
- call PlaySFX
- call WaitSFX
- ret
-; 8c7e1
+INCLUDE "event/field_moves.asm"
-BlindingFlash: ; 8c7e1
- callba FadeOutPalettes
- ld hl, StatusFlags
- set 2, [hl]
- callba Function8c0e5
- callba Function8c001
- ld b, SCGB_09
- call GetSGBLayout
- callba Function49409
- callba FadeInPalettes
- ret
-; 8c80a
-
-ShakeHeadbuttTree: ; 8c80a
- callba Function8cf53
- ld de, CutGrassGFX
- ld hl, VTiles1
- lb bc, BANK(CutGrassGFX), 4
- call Request2bpp
- ld de, HeadbuttTreeGFX
- ld hl, VTiles1 tile $04
- lb bc, BANK(HeadbuttTreeGFX), 8
- call Request2bpp
- call Function8cad3
- ld a, SPRITE_ANIM_INDEX_1B
- call _InitSpriteAnimStruct
- ld hl, $3
- add hl, bc
- ld [hl], $84
- ld a, $90
- ld [wc3b5], a
- callba Function8cf7a
- call GetHeadbuttTreeRelativeLocation
- ld a, $20
- ld [wcf64], a
- call WaitSFX
- ld de, SFX_SANDSTORM
- call PlaySFX
-.loop
- ld hl, wcf64
- ld a, [hl]
- and a
- jr z, .done
- dec [hl]
- ld a, $90
- ld [wc3b5], a
- callba Function8cf7a
+Function8caed: ; 8caed
call DelayFrame
- jr .loop
-
-.done
- call OverworldTextModeSwitch
- call WaitBGMap
- xor a
- ld [hBGMapMode], a
- callba Function8cf53
- ld hl, Sprites + $90
- ld bc, $10
- xor a
- call ByteFill
- ld de, Font
- ld hl, VTiles1
- lb bc, BANK(Font), $c
- call Get1bpp
- call ReplaceKrisSprite
- ret
-; 8c893
-
-HeadbuttTreeGFX: ; 8c893
-INCBIN "gfx/unknown/08c893.2bpp"
-; 8c913
-
-GetHeadbuttTreeRelativeLocation: ; 8c913
- xor a
- ld [hBGMapMode], a
- ld a, [PlayerDirection]
- and %00001100
- srl a
- ld e, a
- ld d, 0
- ld hl, TreeRelativeLocationTable
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
-
- ld a, $5
- ld [hli], a
- ld [hld], a
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hli], a
- ld [hld], a
- call WaitBGMap
- xor a
- ld [hBGMapMode], a
- ret
-; 8c938
-
-TreeRelativeLocationTable: ; 8c938
- dwcoord 8, 8 + 2 ; RIGHT
- dwcoord 8, 8 - 2 ; LEFT
- dwcoord 8 - 2, 8 ; DOWN
- dwcoord 8 + 2, 8 ; UP
-; 8c940
-
-OWCutAnimation: ; 8c940
- ld a, e
- and $1
- ld [wJumptableIndex], a
- call .LoadCutGFX
- call WaitSFX
- ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
- call PlaySFX
-.loop
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .finish
- ld a, $90
- ld [wc3b5], a
- callab Function8cf7a
- call OWCutJumptable
- call DelayFrame
- jr .loop
-
-.finish
- ret
-; 8c96d
-
-.LoadCutGFX: ; 8c96d
- callab Function8cf53 ; pointless to farcall
- ld de, CutGrassGFX
- ld hl, VTiles1
- lb bc, BANK(CutGrassGFX), 4
- call Request2bpp
- ld de, CutTreeGFX
- ld hl, VTiles1 tile $4
- lb bc, BANK(CutTreeGFX), 4
- call Request2bpp
- ret
-; 8c98c
-
-CutTreeGFX: ; c898c
-INCBIN "gfx/misc/cut_tree.2bpp"
-; c89cc
-
-CutGrassGFX: ; 8c9cc
-INCBIN "gfx/misc/cut_grass.2bpp"
-; 8ca0c
-
-OWCutJumptable: ; 8ca0c
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 8ca1b
-
-
-.jumptable: ; 8ca1b (23:4a1b)
- dw Function8ca23
- dw Function8ca3c
- dw Function8ca5c
- dw Function8ca64
-
-
-Function8ca23: ; 8ca23 (23:4a23)
- call Function8cad3
- ld a, SPRITE_ANIM_INDEX_17 ; leaf
- call _InitSpriteAnimStruct
- ld hl, $3
- add hl, bc
- ld [hl], $84
- ld a, $20
- ld [wcf64], a
- ld hl, wJumptableIndex
-rept 2
- inc [hl]
-endr
- ret
-
-Function8ca3c: ; 8ca3c (23:4a3c)
- call Function8ca8e
- xor a
- call Function8ca73
- ld a, $10
- call Function8ca73
- ld a, $20
- call Function8ca73
- ld a, $30
- call Function8ca73
- ld a, $20
- ld [wcf64], a
- ld hl, wJumptableIndex
- inc [hl]
- ret
-
-Function8ca5c: ; 8ca5c (23:4a5c)
- ld a, $1
- ld [hBGMapMode], a
- ld hl, wJumptableIndex
- inc [hl]
-
-Function8ca64: ; 8ca64 (23:4a64)
- ld hl, wcf64
- ld a, [hl]
- and a
- jr z, .asm_8ca6d
- dec [hl]
- ret
-.asm_8ca6d
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-Function8ca73: ; 8ca73 (23:4a73)
- push de
- push af
- ld a, SPRITE_ANIM_INDEX_16 ; fly takeoff
- call _InitSpriteAnimStruct
- ld hl, $3
- add hl, bc
- ld [hl], $80
- ld hl, $e
- add hl, bc
- ld [hl], $4
- pop af
- ld hl, $c
- add hl, bc
- ld [hl], a
- pop de
- ret
-
-Function8ca8e: ; 8ca8e (23:4a8e)
- ld de, 0
- ld a, [wd197]
- bit 0, a
- jr z, .asm_8ca9a
- set 0, e
-.asm_8ca9a
- ld a, [wd196]
- bit 0, a
- jr z, .asm_8caa3
- set 1, e
-.asm_8caa3
- ld a, [PlayerDirection]
- and $c
- add e
- ld e, a
- ld hl, Unknown_8cab3
-rept 2
- add hl, de
-endr
- ld e, [hl]
- inc hl
- ld d, [hl]
- ret
-; 8cab3 (23:4ab3)
-
-Unknown_8cab3: ; 8cab3
- db $58, $60
- db $48, $60
- db $58, $70
- db $48, $70
- db $58, $40
- db $48, $40
- db $58, $50
- db $48, $50
- db $38, $60
- db $48, $60
- db $38, $50
- db $48, $50
- db $58, $60
- db $68, $60
- db $58, $50
- db $68, $50
-; 8cad3
-
-Function8cad3: ; 8cad3 (23:4ad3)
- ld a, [PlayerDirection]
- and $c
- srl a
- ld e, a
- ld d, 0
- ld hl, Unknown_8cae5
- add hl, de
- ld e, [hl]
- inc hl
- ld d, [hl]
- ret
-; 8cae5 (23:4ae5)
-
-Unknown_8cae5: ; 8cae5
- db $50, $68
- db $50, $48
- db $40, $58
- db $60, $58
-; 8caed
-
-Function8caed: ; 8caed
- call DelayFrame
ld a, [VramState]
push af
xor a
@@ -38515,492 +36523,8 @@
ld [hl], $80
ret
-Special_MagnetTrain: ; 8cc04
- ld a, [ScriptVar]
- and a
- jr nz, .ToGoldenrod
- ld a, 1 ; forwards
- lb bc, $40, $60
- ld de, $fca0
- jr .continue
+INCLUDE "event/magnet_train.asm"
-.ToGoldenrod
- ld a, -1 ; backwards
- lb bc, $c0, $a0
- ld de, $b460
-
-.continue
- ld h, a
- ld a, [rSVBK]
- push af
- ld a, $5
- ld [rSVBK], a
- ld a, h
- ld [w5_d191], a
- ld a, c
- ld [w5_d192], a
- ld a, b
- ld [w5_d193], a
- ld a, e
- ld [w5_d194], a
- ld a, d
- ld [w5_d195], a
- ld a, [hSCX]
- push af
- ld a, [hSCY]
- push af
- call Function8ccc9
- ld hl, hVBlank
- ld a, [hl]
- push af
- ld [hl], $1
-.loop
- ld a, [wJumptableIndex]
- and a
- jr z, .initialize
- bit 7, a
- jr nz, .done
- callab Function8cf69
- call Function8cdf7
- call Function8cc99
- call Function3b0c
- call DelayFrame
- jr .loop
-
-.initialize
- call Function8ceae
- jr .loop
-
-.done
- pop af
- ld [hVBlank], a
- call ClearBGPalettes
- xor a
- ld [hLCDStatCustom], a
- ld [hLCDStatCustom + 1], a
- ld [hLCDStatCustom + 2], a
- ld [hSCX], a
- ld [Requested2bppSource], a
- ld [Requested2bppSource + 1], a
- ld [Requested2bppDest], a
- ld [Requested2bppDest + 1], a
- ld [Requested2bpp], a
- call ClearTileMap
- pop af
- ld [hSCY], a
- pop af
- ld [hSCX], a
- xor a
- ld [hBGMapMode], a
- pop af
- ld [rSVBK], a
- ret
-; 8cc99
-
-Function8cc99: ; 8cc99
- ld hl, LYOverridesBackup
- ld c, $2f
- ld a, [wcf64]
- add a
- ld [hSCX], a
- call Function8ccc4
- ld c, $30
- ld a, [wcf65]
- call Function8ccc4
- ld c, $31
- ld a, [wcf64]
- add a
- call Function8ccc4
- ld a, [wd191]
- ld d, a
- ld hl, wcf64
- ld a, [hl]
-rept 2
- add d
-endr
- ld [hl], a
- ret
-; 8ccc4
-
-Function8ccc4: ; 8ccc4
-.asm_8ccc4
- ld [hli], a
- dec c
- jr nz, .asm_8ccc4
- ret
-; 8ccc9
-
-Function8ccc9: ; 8ccc9
- call ClearBGPalettes
- call ClearSprites
- call DisableLCD
- callab Function8cf53
- call SetMagnetTrainPals
- call DrawMagnetTrain
- ld a, $90
- ld [hWY], a
- call EnableLCD
- xor a
- ld [hBGMapMode], a
- ld [hSCX], a
- ld [hSCY], a
- ld a, [rSVBK]
- push af
- ld a, $1
- ld [rSVBK], a
- callba GetPlayerIcon
- pop af
- ld [rSVBK], a
- ld hl, VTiles0
- ld c, $4
- call Request2bpp
- ld hl, $c0
- add hl, de
- ld d, h
- ld e, l
- ld hl, VTiles0 tile $04
- ld c, $4
- call Request2bpp
- call Function8cda6
- ld hl, wJumptableIndex
- xor a
- ld [hli], a
- ld a, [wd192]
-rept 3
- ld [hli], a
-endr
- ld de, MUSIC_MAGNET_TRAIN
- call PlayMusic2
- ret
-; 8cd27
-
-DrawMagnetTrain: ; 8cd27
- ld hl, VBGMap0
- xor a
-.asm_8cd2b
- call GetMagnetTrainBGTiles
- ld b, 32 / 2
- call .FillAlt
- inc a
- cp $12
- jr c, .asm_8cd2b
- ld hl, VBGMap0 tile $0c
- ld de, MagnetTrainTilemap1
- ld c, 20
- call .FillLine
- ld hl, VBGMap0 tile $0e
- ld de, MagnetTrainTilemap2
- ld c, 20
- call .FillLine
- ld hl, VBGMap0 tile $10
- ld de, MagnetTrainTilemap3
- ld c, 20
- call .FillLine
- ld hl, VBGMap0 tile $12
- ld de, MagnetTrainTilemap4
- ld c, 20
- call .FillLine
- ret
-; 8cd65
-
-.FillLine ; 8cd65
- ld a, [de]
- inc de
- ld [hli], a
- dec c
- jr nz, .FillLine
- ret
-; 8cd6c
-
-.FillAlt ; 8cd6c
- ld [hl], e
- inc hl
- ld [hl], d
- inc hl
- dec b
- jr nz, .FillAlt
- ret
-; 8cd74
-
-GetMagnetTrainBGTiles: ; 8cd74
- push hl
- ld e, a
- ld d, 0
- ld hl, MagnetTrainBGTiles
-rept 2
- add hl, de
-endr
- ld e, [hl]
- inc hl
- ld d, [hl]
- pop hl
- ret
-; 8cd82
-
-MagnetTrainBGTiles: ; 8cd82
-; Alternating tiles for each line
-; of the Magnet Train tilemap.
- db $4c, $4d ; bush
- db $5c, $5d ; bush
- db $4c, $4d ; bush
- db $5c, $5d ; bush
- db $08, $08 ; fence
- db $18, $18 ; fence
- db $1f, $1f ; track
- db $31, $31 ; track
- db $11, $11 ; track
- db $11, $11 ; track
- db $0d, $0d ; track
- db $31, $31 ; track
- db $04, $04 ; fence
- db $18, $18 ; fence
- db $4c, $4d ; bush
- db $5c, $5d ; bush
- db $4c, $4d ; bush
- db $5c, $5d ; bush
-; 8cda6
-
-Function8cda6: ; 8cda6
- ld hl, LYOverrides
- ld bc, $90
- ld a, [wd192]
- call ByteFill
- ld hl, LYOverridesBackup
- ld bc, $90
- ld a, [wd192]
- call ByteFill
- ld a, $43
- ld [hLCDStatCustom], a
- ret
-; 8cdc3
-
-SetMagnetTrainPals: ; 8cdc3
- ld a, $1
- ld [rVBK], a
-
- ; bushes
- ld hl, VBGMap0
- ld bc, 8 tiles
- ld a, $2
- call ByteFill
-
- ; train
- ld hl, VBGMap0 tile $08
- ld bc, 20 tiles
- xor a
- call ByteFill
-
- ; more bushes
- ld hl, VBGMap0 tile $1c
- ld bc, 8 tiles
- ld a, $2
- call ByteFill
-
- ; train window
- ld hl, VBGMap0 tile $10 + 7
- ld bc, 6
- ld a, $4
- call ByteFill
-
- ld a, $0
- ld [rVBK], a
- ret
-; 8cdf7
-
-Function8cdf7: ; 8cdf7
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_8ce06
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 8ce06
-
-Jumptable_8ce06: ; 8ce06
- dw Function8ce19
- dw Function8ce6d
- dw Function8ce47
- dw Function8ce6d
- dw Function8ce7a
- dw Function8ce6d
- dw Function8cea2
-; 8ce14
-
-Function8ce14: ; 8ce14
- ld hl, wJumptableIndex
- inc [hl]
- ret
-; 8ce19
-
-Function8ce19: ; 8ce19
- ld d, $55
- ld a, [wd194 + 1]
- ld e, a
- ld b, SPRITE_ANIM_INDEX_15
- ld a, [rSVBK]
- push af
- ld a, $1
- ld [rSVBK], a
- ld a, [PlayerGender]
- bit 0, a
- jr z, .asm_8ce31
- ld b, SPRITE_ANIM_INDEX_1F
-
-.asm_8ce31
- pop af
- ld [rSVBK], a
- ld a, b
- call _InitSpriteAnimStruct
- ld hl, $3
- add hl, bc
- ld [hl], $0
- call Function8ce14
- ld a, $80
- ld [wcf66], a
- ret
-; 8ce47
-
-Function8ce47: ; 8ce47
- ld hl, wd193
- ld a, [wcf65]
- cp [hl]
- jr z, .asm_8ce64
- ld e, a
- ld a, [wd191]
- xor $ff
- inc a
- add e
- ld [wcf65], a
- ld hl, wc3c0
- ld a, [wd191]
- add [hl]
- ld [hl], a
- ret
-
-.asm_8ce64
- call Function8ce14
- ld a, $80
- ld [wcf66], a
- ret
-; 8ce6d
-
-Function8ce6d: ; 8ce6d
- ld hl, wcf66
- ld a, [hl]
- and a
- jr z, .asm_8ce76
- dec [hl]
- ret
-
-.asm_8ce76
- call Function8ce14
- ret
-; 8ce7a
-
-Function8ce7a: ; 8ce7a
- ld hl, wd194
- ld a, [wcf65]
- cp [hl]
- jr z, .asm_8ce9e
- ld e, a
- ld a, [wd191]
- xor $ff
- inc a
- ld d, a
- ld a, e
-rept 2
- add d
-endr
- ld [wcf65], a
- ld hl, wc3c0
- ld a, [wd191]
- ld d, a
- ld a, [hl]
-rept 2
- add d
-endr
- ld [hl], a
- ret
-
- ret
-
-.asm_8ce9e
- call Function8ce14
- ret
-; 8cea2
-
-Function8cea2: ; 8cea2
- ld a, $80
- ld [wJumptableIndex], a
- ld de, SFX_TRAIN_ARRIVED
- call PlaySFX
- ret
-; 8ceae
-
-Function8ceae: ; 8ceae
- callba Function8cf69
- call Function8cdf7
- call Function8cc99
- call Function3b0c
- call DelayFrame
- ld a, [rSVBK]
- push af
- ld a, $1
- ld [rSVBK], a
- ld a, [TimeOfDayPal]
- push af
- ld a, [wPermission]
- push af
- ld a, [TimeOfDay]
- and $3
- ld [TimeOfDayPal], a
- ld a, $1
- ld [wPermission], a
- ld b, SCGB_09
- call GetSGBLayout
- call UpdateTimePals
- ld a, [rBGP]
- ld [wcfc7], a
- ld a, [rOBP0]
- ld [wcfc8], a
- ld a, [rOBP1]
- ld [wcfc9], a
- pop af
- ld [wPermission], a
- pop af
- ld [TimeOfDayPal], a
- pop af
- ld [rSVBK], a
- ret
-; 8ceff
-
-MagnetTrainTilemap1:
- db $1f, $05, $06, $0a, $0a
- db $0a, $09, $0a, $0a, $0a
- db $0a, $0a, $0a, $09, $0a
- db $0a, $0a, $0b, $0c, $1f
-MagnetTrainTilemap2:
- db $14, $15, $16, $1a, $1a
- db $1a, $19, $1a, $1a, $1a
- db $1a, $1a, $1a, $19, $1a
- db $1a, $1a, $1b, $1c, $1d
-MagnetTrainTilemap3:
- db $24, $25, $26, $27, $07
- db $2f, $29, $28, $28, $28
- db $28, $28, $28, $29, $07
- db $2f, $2a, $2b, $2c, $2d
-MagnetTrainTilemap4:
- db $20, $1f, $2e, $1f, $17
- db $00, $2e, $1f, $1f, $1f
- db $1f, $1f, $1f, $2e, $17
- db $00, $1f, $2e, $1f, $0f
-; 8cf4f
-
Function8cf4f: ; 8cf4f
call Function3238
ret
@@ -39550,779 +37074,7 @@
SECTION "bank24", ROMX, BANK[$24]
INCLUDE "engine/phone.asm"
-
-InitClock: ; 90672 (24:4672)
-; Ask the player to set the time.
- ld a, [hInMenu]
- push af
- ld a, $1
- ld [hInMenu], a
-
- ld a, $0
- ld [wc2ce], a
- ld a, $10
- ld [MusicFade], a
- ld a, MUSIC_NONE % $100
- ld [MusicFadeIDLo], a
- ld a, MUSIC_NONE / $100
- ld [MusicFadeIDHi], a
- ld c, 8
- call DelayFrames
- call Function4dd
- call ClearTileMap
- call ClearSprites
- ld b, SCGB_08
- call GetSGBLayout
- xor a
- ld [hBGMapMode], a
- call LoadStandardFont
- ld de, GFX_908fb
- ld hl, VTiles2 tile $00
- lb bc, BANK(GFX_908fb), 1
- call Request1bpp
- ld de, GFX_90903
- ld hl, VTiles2 tile $01
- lb bc, BANK(GFX_90903), 1
- call Request1bpp
- ld de, GFX_9090b
- ld hl, VTiles2 tile $02
- lb bc, BANK(GFX_9090b), 1
- call Request1bpp
- call .ClearScreen
- call WaitBGMap
- call Function4a3
- ld hl, UnknownText_0x90874
- call PrintText
- ld hl, wc608
- ld bc, 50
- xor a
- call ByteFill
- ld a, $a
- ld [wInitHourBuffer], a
-
-.loop
- ld hl, UnknownText_0x90879
- call PrintText
- hlcoord 3, 7
- ld b, 2
- ld c, 15
- call TextBox
- hlcoord 11, 7
- ld [hl], $1
- hlcoord 11, 10
- ld [hl], $2
- hlcoord 4, 9
- call DisplayHourOClock
- ld c, 10
- call DelayFrames
-
-.SetHourLoop
- call JoyTextDelay
- call SetHour
- jr nc, .SetHourLoop
-
- ld a, [wInitHourBuffer]
- ld [StringBuffer2 + 1], a
- call .ClearScreen
- ld hl, UnknownText_0x90886
- call PrintText
- call YesNoBox
- jr nc, .HourIsSet
- call .ClearScreen
- jr .loop
-
-.HourIsSet
- ld hl, UnknownText_0x9089a
- call PrintText
- hlcoord 11, 7
- lb bc, 2, 7
- call TextBox
- hlcoord 15, 7
- ld [hl], $1
- hlcoord 15, 10
- ld [hl], $2
- hlcoord 12, 9
- call DisplayMinutesWithMinString
- ld c, 10
- call DelayFrames
-
-.SetMinutesLoop
- call JoyTextDelay
- call SetMinutes
- jr nc, .SetMinutesLoop
-
- ld a, [BattleMonNick + 5]
- ld [StringBuffer2 + 2], a
- call .ClearScreen
- ld hl, UnknownText_0x908a4
- call PrintText
- call YesNoBox
- jr nc, .MinutesAreSet
- call .ClearScreen
- jr .HourIsSet
-
-.MinutesAreSet
- call Function658
- ld hl, OakText_ResponseToSetTime
- call PrintText
- call WaitPressAorB_BlinkCursor
- pop af
- ld [hInMenu], a
- ret
-
-.ClearScreen: ; 90783 (24:4783)
- xor a
- ld [hBGMapMode], a
- hlcoord 0, 0
- ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
- xor a
- call ByteFill
- ld a, $1
- ld [hBGMapMode], a
- ret
-
-SetHour: ; 90795 (24:4795)
- ld a, [hJoyPressed]
- and A_BUTTON
- jr nz, .Confirm
-
- ld hl, hJoyLast
- ld a, [hl]
- and D_UP
- jr nz, .up
- ld a, [hl]
- and D_DOWN
- jr nz, .down
- call DelayFrame
- and a
- ret
-
-.down
- ld hl, wInitHourBuffer
- ld a, [hl]
- and a
- jr nz, .DecreaseThroughMidnight
- ld a, 23 + 1
-.DecreaseThroughMidnight
- dec a
- ld [hl], a
- jr .okay
-
-.up
- ld hl, wInitHourBuffer
- ld a, [hl]
- cp 23
- jr c, .AdvanceThroughMidnight
- ld a, -1
-.AdvanceThroughMidnight
- inc a
- ld [hl], a
-
-.okay
- hlcoord 4, 9
- ld a, " "
- ld bc, 15
- call ByteFill
- hlcoord 4, 9
- call DisplayHourOClock
- call WaitBGMap
- and a
- ret
-
-.Confirm
- scf
- ret
-
-DisplayHourOClock: ; 907de (24:47de)
- push hl
- ld a, [wInitHourBuffer]
- ld c, a
- ld e, l
- ld d, h
- call PrintHour
- inc hl
- ld de, String_oclock
- call PlaceString
- pop hl
- ret
-; 907f1 (24:47f1)
-
-Function907f1: ; 907f1
- ld h, d
- ld l, e
- push hl
- call DisplayHourOClock
- pop de
-rept 2
- inc de
-endr
- ld a, $9c
- ld [de], a
- inc de
- push de
- ld hl, $3
- add hl, de
- ld a, [de]
- inc de
- ld [hli], a
- ld a, [de]
- ld [hl], a
- pop hl
- call DisplayMinutesWithMinString
-rept 3
- inc hl
-endr
- ret
-; 90810
-
-SetMinutes: ; 90810 (24:4810)
- ld a, [hJoyPressed]
- and A_BUTTON
- jr nz, .asm_90857
- ld hl, hJoyLast
- ld a, [hl]
- and D_UP
- jr nz, .asm_90835
- ld a, [hl]
- and D_DOWN
- jr nz, .asm_90828
- call DelayFrame
- and a
- ret
-.asm_90828
- ld hl, BattleMonNick + 5
- ld a, [hl]
- and a
- jr nz, .asm_90831
- ld a, 59 + 1
-.asm_90831
- dec a
- ld [hl], a
- jr .asm_90841
-.asm_90835
- ld hl, BattleMonNick + 5
- ld a, [hl]
- cp 59
- jr c, .asm_9083f
- ld a, -1
-.asm_9083f
- inc a
- ld [hl], a
-.asm_90841
- hlcoord 12, 9
- ld a, " "
- ld bc, 7
- call ByteFill
- hlcoord 12, 9
- call DisplayMinutesWithMinString
- call WaitBGMap
- and a
- ret
-.asm_90857
- scf
- ret
-
-DisplayMinutesWithMinString: ; 90859 (24:4859)
- ld de, BattleMonNick + 5
- call PrintTwoDigitNumberRightAlign
- inc hl
- ld de, String_min
- call PlaceString
- ret
-
-PrintTwoDigitNumberRightAlign: ; 90867 (24:4867)
- push hl
- ld a, " "
- ld [hli], a
- ld [hl], a
- pop hl
- lb bc, PRINTNUM_RIGHTALIGN | 1, 2
- call PrintNum
- ret
-; 90874 (24:4874)
-
-UnknownText_0x90874: ; 0x90874
- ; Zzz… Hm? Wha…? You woke me up! Will you check the clock for me?
- text_jump UnknownText_0x1bc29c
- db "@"
-; 0x90879
-
-UnknownText_0x90879: ; 0x90879
- ; What time is it?
- text_jump UnknownText_0x1bc2eb
- db "@"
-; 0x9087e
-
-String_oclock:
- db "o'clock@"
-; 90886
-
-UnknownText_0x90886: ; 0x90886
- ; What?@ @
- text_jump UnknownText_0x1bc2fd
- start_asm
- hlcoord 1, 16
- call DisplayHourOClock
- ld hl, UnknownText_0x90895
- ret
-; 90895 (24:4895)
-
-UnknownText_0x90895: ; 0x90895
- ; ?
- text_jump UnknownText_0x1bc305
- db "@"
-; 0x9089a
-
-UnknownText_0x9089a: ; 0x9089a
- ; How many minutes?
- text_jump UnknownText_0x1bc308
- db "@"
-; 0x9089f
-
-String_min:
- db "min.@"
-; 908a4
-
-UnknownText_0x908a4: ; 0x908a4
- ; Whoa!@ @
- text_jump UnknownText_0x1bc31b
- start_asm
-; 0x908a9
- hlcoord 7, 14
- call DisplayMinutesWithMinString
- ld hl, UnknownText_0x908b3
- ret
-; 908b3 (24:48b3)
-
-UnknownText_0x908b3: ; 0x908b3
- ; ?
- text_jump UnknownText_0x1bc323
- db "@"
-; 0x908b8
-
-OakText_ResponseToSetTime: ; 0x908b8
- start_asm
- decoord 1, 14
- ld a, [wInitHourBuffer]
- ld c, a
- call PrintHour
- ld [hl], ":"
- inc hl
- ld de, BattleMonNick + 5
- lb bc, PRINTNUM_LEADINGZEROS | 1, 2
- call PrintNum
- ld b, h
- ld c, l
- ld a, [wInitHourBuffer]
- cp 4
- jr c, .NITE
- cp 11
- jr c, .MORN
- cp 18
- jr c, .DAY
-.NITE
- ld hl, .sodark
- ret
-.MORN
- ld hl, .overslept
- ret
-.DAY
- ld hl, .yikes
- ret
-; 908ec (24:48ec)
-
-.overslept: ; 0x908ec
- ; ! I overslept!
- text_jump UnknownText_0x1bc326
- db "@"
-; 0x908f1
-
-.yikes: ; 0x908f1
- ; ! Yikes! I over- slept!
- text_jump UnknownText_0x1bc336
- db "@"
-; 0x908f6
-
-.sodark: ; 0x908f6
- ; ! No wonder it's so dark!
- text_jump UnknownText_0x1bc34f
- db "@"
-; 0x908fb
-
-GFX_908fb: ; 908fb
-INCBIN "gfx/unknown/0908fb.2bpp"
-GFX_90903: ; 90903
-INCBIN "gfx/unknown/090903.2bpp"
-GFX_9090b: ; 9090b
-INCBIN "gfx/unknown/09090b.2bpp"
-; 90913
-
-Special_SetDayOfWeek: ; 90913
- ld a, [hInMenu]
- push af
- ld a, $1
- ld [hInMenu], a
- ld de, GFX_90903
- ld hl, VTiles1 tile $6f
- lb bc, BANK(GFX_90903), 1
- call Request1bpp
- ld de, GFX_9090b
- ld hl, VTiles1 tile $75
- lb bc, BANK(GFX_9090b), 1
- call Request1bpp
- xor a
- ld [wd002], a
-.asm_90936
- hlcoord 0, 12
- lb bc, 4, 18
- call TextBox
- call LoadStandardMenuDataHeader
- ld hl, UnknownText_0x90a3f
- call PrintText
- hlcoord 9, 3
- ld b, 2
- ld c, 9
- call TextBox
- hlcoord 14, 3
- ld [hl], $ef
- hlcoord 14, 6
- ld [hl], $f5
- hlcoord 10, 5
- call Function909de
- call Function321c
- ld c, 10
- call DelayFrames
-.asm_9096a
- call JoyTextDelay
- call Function90993
- jr nc, .asm_9096a
- call ExitMenu
- call UpdateSprites
- ld hl, UnknownText_0x90a44
- call PrintText
- call YesNoBox
- jr c, .asm_90936
- ld a, [wd002]
- ld [StringBuffer2], a
- call Function663
- call LoadStandardFont
- pop af
- ld [hInMenu], a
- ret
-; 90993
-
-Function90993: ; 90993
- ld a, [hJoyPressed]
- and A_BUTTON
- jr z, .asm_9099b
- scf
- ret
-
-.asm_9099b
- ld hl, hJoyLast
- ld a, [hl]
- and D_UP
- jr nz, .asm_909ba
- ld a, [hl]
- and D_DOWN
- jr nz, .asm_909ad
- call DelayFrame
- and a
- ret
-
-.asm_909ad
- ld hl, wd002
- ld a, [hl]
- and a
- jr nz, .asm_909b6
- ld a, 6 + 1
-
-.asm_909b6
- dec a
- ld [hl], a
- jr .asm_909c6
-
-.asm_909ba
- ld hl, wd002
- ld a, [hl]
- cp 6
- jr c, .asm_909c4
- ld a, -1
-
-.asm_909c4
- inc a
- ld [hl], a
-
-.asm_909c6
- xor a
- ld [hBGMapMode], a
- hlcoord 10, 4
- ld b, $2
- ld c, $9
- call ClearBox
- hlcoord 10, 5
- call Function909de
- call WaitBGMap
- and a
- ret
-; 909de
-
-Function909de: ; 909de
- push hl
- ld a, [wd002]
- ld e, a
- ld d, 0
- ld hl, WeekdaysStrings
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld d, [hl]
- ld e, a
- pop hl
- call PlaceString
- ret
-; 909f2
-
-WeekdaysStrings: ; 909f2
- dw Sunday
- dw Monday
- dw Tuesday
- dw Wednesday
- dw Thursday
- dw Friday
- dw Saturday
- dw Sunday
-
-Sunday: db " SUNDAY@"
-Monday: db " MONDAY@"
-Tuesday: db " TUESDAY@"
-Wednesday: db "WEDNESDAY@"
-Thursday: db "THURSDAY@"
-Friday: db " FRIDAY@"
-Saturday: db "SATURDAY@"
-
-
-UnknownText_0x90a3f: ; 0x90a3f
- ; What day is it?
- text_jump UnknownText_0x1bc369
- db "@"
-; 0x90a44
-
-UnknownText_0x90a44: ; 0x90a44
- start_asm
- hlcoord 1, 14
- call Function909de
- ld hl, UnknownText_0x90a4f
- ret
-; 90a4f (24:4a4f)
-
-UnknownText_0x90a4f: ; 0x90a4f
- ; , is it?
- text_jump UnknownText_0x1bc37a
- db "@"
-; 0x90a54
-
-Special_InitialSetDSTFlag: ; 90a54
- ld a, [wDST]
- set 7, a
- ld [wDST], a
- hlcoord 1, 14
- lb bc, 3, 18
- call ClearBox
- ld hl, UnknownText_0x90a6c
- call PlaceWholeStringInBoxAtOnce
- ret
-; 90a6c
-
-UnknownText_0x90a6c: ; 90a6c
- start_asm
- call UpdateTime
- ld a, [hHours]
- ld b, a
- ld a, [hMinutes]
- ld c, a
- decoord 1, 14
- callba PrintHoursMins
- ld hl, TextJump_DSTIsThatOK
- ret
-; 90a83 (24:4a83)
-
-TextJump_DSTIsThatOK: ; 0x90a83
- ; DST, is that OK?
- text_jump Text_DSTIsThatOK
- db "@"
-; 0x90a88
-
-Special_InitialClearDSTFlag: ; 90a88
- ld a, [wDST]
- res 7, a
- ld [wDST], a
- hlcoord 1, 14
- lb bc, 3, 18
- call ClearBox
- ld hl, UnknownText_0x90aa0
- call PlaceWholeStringInBoxAtOnce
- ret
-; 90aa0
-
-UnknownText_0x90aa0: ; 90aa0
- start_asm
- call UpdateTime
- ld a, [hHours]
- ld b, a
- ld a, [hMinutes]
- ld c, a
- decoord 1, 14
- callba PrintHoursMins
- ld hl, UnknownText_0x90ab7
- ret
-; 90ab7
-
-UnknownText_0x90ab7: ; 0x90ab7
- ; , is that OK?
- text_jump UnknownText_0x1c5ff1
- db "@"
-; 0x90abc
-
-Function90abc: ; 90abc
- hlcoord 1, 14
- lb bc, 3, SCREEN_WIDTH - 2
- call ClearBox
- ld hl, UnknownText_0x90acc
- call PlaceWholeStringInBoxAtOnce
- ret
-; 90acc
-
-UnknownText_0x90acc: ; 0x90acc
- start_asm
-
- call UpdateTime
-
- hlcoord 1, 14
- ld [hl], "R"
- inc hl
- ld [hl], "T"
- inc hl
- ld [hl], " "
- inc hl
-
- ld de, hRTCDayLo
- call Function90b23
-
- hlcoord 1, 16
- ld [hl], "D"
- inc hl
- ld [hl], "F"
- inc hl
- ld [hl], " "
- inc hl
-
- ld de, StartDay
- call Function90b23
-
- ld [hl], " "
- inc hl
-
- ld a, [wDST]
- bit 7, a
- jr z, .off
-
- ld [hl], "O"
- inc hl
- ld [hl], "N"
- inc hl
- jr .done
-
-.off
- ld [hl], "O"
- inc hl
- ld [hl], "F"
- inc hl
- ld [hl], "F"
- inc hl
-
-.done
- ld hl, UnknownText_0x90b13
- ret
-; 90b13
-
-UnknownText_0x90b13: ; 0x90b13
- text "<PARA>Now on DEBUG…"
- prompt
-; 0x90b23
-
-Function90b23: ; 90b23
- lb bc, 1, 3
- call PrintNum
- ld [hl], "."
- inc hl
- inc de
- lb bc, PRINTNUM_LEADINGZEROS | 1, 2
- call PrintNum
- ld [hl], ":"
- inc hl
- inc de
- lb bc, PRINTNUM_LEADINGZEROS | 1, 2
- call PrintNum
- ret
-; 90b3e
-
-PrintHour: ; 90b3e (24:4b3e)
- ld l, e
- ld h, d
- push bc
- call GetTimeOfDayString
- call PlaceString
- ld l, c
- ld h, b
- inc hl
- pop bc
- call AdjustHourForAMorPM
- ld [wd265], a
- ld de, wd265
- call PrintTwoDigitNumberRightAlign
- ret
-
-GetTimeOfDayString: ; 90b58 (24:4b58)
- ld a, c
- cp 4
- jr c, .nite
- cp 10
- jr c, .morn
- cp 18
- jr c, .day
-.nite
- ld de, .NITE
- ret
-.morn
- ld de, .MORN
- ret
-.day
- ld de, .DAY
- ret
-; 90b71 (24:4b71)
-
-.NITE: db "NITE@"
-.MORN: db "MORN@"
-.DAY: db "DAY@"
-; 90b7f
-
-AdjustHourForAMorPM:
-; Convert the hour stored in c (0-23) to a 1-12 value
- ld a, c
- or a
- jr z, .midnight
- cp 12
- ret c
- ret z
- sub 12
- ret
-
-.midnight
- ld a, 12
- ret
-
+INCLUDE "engine/timeset.asm"
INCLUDE "engine/pokegear.asm"
INCLUDE "data/wild/fish.asm"
--- a/wram.asm
+++ b/wram.asm
@@ -2402,7 +2402,7 @@
PlayerState:: ; d95d
ds 1
-wd95e:: ds 2
+wHallOfFameCount:: ds 2
wd960:: ds 2
MooMooBerries:: ; d962
ds 1 ; how many berries fed to MooMoo