diff options
Diffstat (limited to 'engine/pokemon')
27 files changed, 571 insertions, 922 deletions
diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 75cc3fe35..65621192d 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -1,4 +1,4 @@ -_DepositPKMN: ; e2391 (38:6391) +_DepositPKMN: ld hl, wOptions ld a, [hl] push af @@ -35,20 +35,20 @@ _DepositPKMN: ; e2391 (38:6391) ld [wOptions], a ret -.RunJumptable: ; e23d5 (38:63d5) +.RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call BillsPC_Jumptable jp hl -.Jumptable: ; e23df (38:63df) +.Jumptable: dw .Init dw .HandleJoypad dw .WhatsUp dw .Submenu dw BillsPC_EndJumptableLoop -.Init: ; e23e9 (38:63e9) +.Init: xor a ld [hBGMapMode], a call ClearSprites @@ -69,7 +69,7 @@ _DepositPKMN: ; e2391 (38:6391) call BillsPC_IncrementJumptableIndex ret -.HandleJoypad: ; e241a (38:641a) +.HandleJoypad: ld hl, hJoyPressed ; $ffa7 ld a, [hl] and B_BUTTON @@ -100,7 +100,6 @@ _DepositPKMN: ; e2391 (38:6391) ld a, $2 ld [wJumptableIndex], a ret -; e2452 (38:6452) .go_back ld hl, wJumptableIndex @@ -112,7 +111,7 @@ _DepositPKMN: ; e2391 (38:6391) ld [wJumptableIndex], a ret -.WhatsUp: ; e245d (38:645d) +.WhatsUp: xor a ld [hBGMapMode], a call ClearSprites @@ -127,7 +126,7 @@ _DepositPKMN: ; e2391 (38:6391) call BillsPC_IncrementJumptableIndex ret -.Submenu: ; e247d (38:647d) +.Submenu: ld hl, BillsPCDepositMenuHeader call CopyMenuHeader ld a, [wMenuCursorY] @@ -147,14 +146,13 @@ _DepositPKMN: ; e2391 (38:6391) ld l, a jp hl -BillsPCDepositJumptable: ; e24a1 (38:64a1) +BillsPCDepositJumptable: dw BillsPCDepositFuncDeposit ; Deposit Pokemon dw BillsPCDepositFuncStats ; Pokemon Stats dw BillsPCDepositFuncRelease ; Release Pokemon dw BillsPCDepositFuncCancel ; Cancel - -BillsPCDepositFuncDeposit: ; e24a9 (38:64a9) +BillsPCDepositFuncDeposit: call BillsPC_CheckMail_PreventBlackout jp c, BillsPCDepositFuncCancel call DepositPokemon @@ -171,7 +169,7 @@ BillsPCDepositFuncDeposit: ; e24a9 (38:64a9) call BillsPC_PlaceString ret -BillsPCDepositFuncStats: ; e24c8 (38:64c8) +BillsPCDepositFuncStats: call LoadStandardMenuHeader call BillsPC_StatsScreen call ExitMenu @@ -182,7 +180,7 @@ BillsPCDepositFuncStats: ; e24c8 (38:64c8) call BillsPC_ApplyPalettes ret -BillsPCDepositFuncRelease: ; e24e0 (38:64e0) +BillsPCDepositFuncRelease: call BillsPC_CheckMail_PreventBlackout jr c, BillsPCDepositFuncCancel call BillsPC_IsMonAnEgg @@ -222,29 +220,26 @@ BillsPCDepositFuncRelease: ; e24e0 (38:64e0) ld [wMenuCursorY], a ret -BillsPCDepositFuncCancel: ; e2537 (38:6537) +BillsPCDepositFuncCancel: ld a, $0 ld [wJumptableIndex], a ret -; e253d (38:653d) -BillsPCDepositMenuHeader: ; 0xe253d (38:653d) +BillsPCDepositMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 9, 4, SCREEN_WIDTH - 1, 13 dw .MenuData db 1 ; default option -; 0xe2545 -.MenuData: ; 0xe2545 (38:6545) +.MenuData: db STATICMENU_CURSOR ; flags db 4 ; items db "DEPOSIT@" db "STATS@" db "RELEASE@" db "CANCEL@" -; 0xe2564 (38:6564) -Unreferenced_BillsPCClearThreeBoxes: ; e2564 +Unreferenced_BillsPCClearThreeBoxes: hlcoord 0, 0 ld b, 4 ld c, 8 @@ -258,9 +253,8 @@ Unreferenced_BillsPCClearThreeBoxes: ; e2564 ld c, 8 call ClearBox ret -; e2583 -_WithdrawPKMN: ; e2583 (38:6583) +_WithdrawPKMN: ld hl, wOptions ld a, [hl] push af @@ -297,20 +291,20 @@ _WithdrawPKMN: ; e2583 (38:6583) ld [wOptions], a ret -.RunJumptable: ; e25c8 (38:65c8) +.RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call BillsPC_Jumptable jp hl -.Jumptable: ; e25d2 (38:65d2) +.Jumptable: dw .Init dw .Joypad dw .PrepSubmenu dw BillsPC_Withdraw dw BillsPC_EndJumptableLoop -.Init: ; e25dc (38:65dc) +.Init: ld a, NUM_BOXES + 1 ld [wBillsPC_LoadedBox], a xor a @@ -333,7 +327,7 @@ _WithdrawPKMN: ; e2583 (38:6583) call BillsPC_IncrementJumptableIndex ret -.Joypad: ; e2612 (38:6612) +.Joypad: ld hl, hJoyPressed ; $ffa7 ld a, [hl] and B_BUTTON @@ -362,7 +356,7 @@ _WithdrawPKMN: ; e2583 (38:6583) jr z, .b_button ld a, $2 ld [wJumptableIndex], a - ret ; e264a (38:664a) + ret .unused ld hl, wJumptableIndex @@ -373,9 +367,8 @@ _WithdrawPKMN: ; e2583 (38:6583) ld a, $4 ld [wJumptableIndex], a ret -; e2655 -.PrepSubmenu: ; e2655 (38:6655) +.PrepSubmenu: xor a ld [hBGMapMode], a call ClearSprites @@ -390,7 +383,7 @@ _WithdrawPKMN: ; e2583 (38:6583) call BillsPC_IncrementJumptableIndex ret -BillsPC_Withdraw: ; e2675 (38:6675) +BillsPC_Withdraw: ld hl, .MenuHeader call CopyMenuHeader ld a, [wMenuCursorY] @@ -410,14 +403,13 @@ BillsPC_Withdraw: ; e2675 (38:6675) ld l, a jp hl -.dw ; e2699 (38:6699) #mark +.dw dw .withdraw ; Withdraw dw .stats ; Stats dw .release ; Release dw .cancel ; Cancel - -.withdraw ; e26a1 (38:66a1) +.withdraw call BillsPC_CheckMail_PreventBlackout jp c, .cancel call TryWithdrawPokemon @@ -433,7 +425,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) call BillsPC_PlaceString ret -.stats ; e26c0 (38:66c0) +.stats call LoadStandardMenuHeader call BillsPC_StatsScreen call ExitMenu @@ -444,7 +436,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) call BillsPC_ApplyPalettes ret -.release ; e26d8 (38:66d8) +.release ld a, [wMenuCursorY] push af call BillsPC_IsMonAnEgg @@ -481,29 +473,26 @@ BillsPC_Withdraw: ; e2675 (38:6675) ld [wMenuCursorY], a ret -.cancel ; e272b (38:672b) +.cancel ld a, $0 ld [wJumptableIndex], a ret -; e2731 (38:6731) -.MenuHeader: ; 0xe2731 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 9, 4, SCREEN_WIDTH - 1, 13 dw .MenuData db 1 ; default option -; 0xe2739 -.MenuData: ; 0xe2739 +.MenuData: db STATICMENU_CURSOR ; flags db 4 ; items db "WITHDRAW@" db "STATS@" db "RELEASE@" db "CANCEL@" -; 0xe2759 -_MovePKMNWithoutMail: ; e2759 +_MovePKMNWithoutMail: ld hl, wOptions ld a, [hl] push af @@ -542,16 +531,14 @@ _MovePKMNWithoutMail: ; e2759 pop af ld [wOptions], a ret -; e27a2 -.RunJumptable: ; e27a2 +.RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call BillsPC_Jumptable jp hl -; e27ac -.Jumptable: ; e27ac +.Jumptable: dw .Init dw .Joypad dw .PrepSubmenu @@ -559,9 +546,8 @@ _MovePKMNWithoutMail: ; e2759 dw .PrepInsertCursor dw .Joypad2 dw BillsPC_EndJumptableLoop -; e27ba -.Init: ; e27ba +.Init: xor a ld [hBGMapMode], a call ClearSprites @@ -581,9 +567,8 @@ _MovePKMNWithoutMail: ; e2759 call BillsPC_UpdateSelectionCursor call BillsPC_IncrementJumptableIndex ret -; e27eb -.Joypad: ; e27eb +.Joypad: ld hl, hJoyPressed ld a, [hl] and B_BUTTON @@ -633,9 +618,8 @@ _MovePKMNWithoutMail: ; e2759 ld a, $6 ld [wJumptableIndex], a ret -; e283d -.PrepSubmenu: ; e283d +.PrepSubmenu: xor a ld [hBGMapMode], a call ClearSprites @@ -649,9 +633,8 @@ _MovePKMNWithoutMail: ; e2759 ld [wMenuCursorY], a call BillsPC_IncrementJumptableIndex ret -; e285d -.MoveMonWOMailSubmenu: ; e285d +.MoveMonWOMailSubmenu: ld hl, .MenuHeader call CopyMenuHeader ld a, [wMenuCursorY] @@ -670,15 +653,13 @@ _MovePKMNWithoutMail: ; e2759 ld h, [hl] ld l, a jp hl -; e2881 -.Jumptable2: ; e2881 +.Jumptable2: dw .Move dw .Stats dw .Cancel -; e2887 -.Move: ; e2887 +.Move: call BillsPC_CheckMail_PreventBlackout jp c, .Cancel ld a, [wBillsPC_ScrollPosition] @@ -690,9 +671,8 @@ _MovePKMNWithoutMail: ; e2759 ld a, $4 ld [wJumptableIndex], a ret -; e28a5 -.Stats: ; e28a5 +.Stats: call LoadStandardMenuHeader call BillsPC_StatsScreen call ExitMenu @@ -702,30 +682,26 @@ _MovePKMNWithoutMail: ; e2759 ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes ret -; e28bd -.Cancel: ; e28bd +.Cancel: ld a, $0 ld [wJumptableIndex], a ret -; e28c3 -.MenuHeader: ; 0xe28c3 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 9, 4, SCREEN_WIDTH - 1, 13 dw .MenuData db 1 ; default option -; 0xe28cb -.MenuData: ; 0xe28cb +.MenuData: db STATICMENU_CURSOR ; flags db 3 ; items db "MOVE@" db "STATS@" db "CANCEL@" -; 0xe28df -.PrepInsertCursor: ; e28df +.PrepInsertCursor: xor a ld [hBGMapMode], a call CopyBoxmonSpecies @@ -740,9 +716,8 @@ _MovePKMNWithoutMail: ; e2759 call WaitBGMap call BillsPC_IncrementJumptableIndex ret -; e2903 -.Joypad2: ; e2903 +.Joypad2: ld hl, hJoyPressed ld a, [hl] and B_BUTTON @@ -795,9 +770,8 @@ _MovePKMNWithoutMail: ; e2759 ld a, $0 ld [wJumptableIndex], a ret -; e2963 -BillsPC_InitRAM: ; e2963 (38:6963) +BillsPC_InitRAM: call ClearBGPalettes call ClearSprites call ClearTileMap @@ -815,17 +789,17 @@ BillsPC_InitRAM: ; e2963 (38:6963) ld [wBillsPC_ScrollPosition], a ret -BillsPC_IncrementJumptableIndex: ; e298d (38:698d) +BillsPC_IncrementJumptableIndex: ld hl, wJumptableIndex inc [hl] ret -BillsPC_EndJumptableLoop: ; e2992 (38:6992) +BillsPC_EndJumptableLoop: ld hl, wJumptableIndex set 7, [hl] ret -_StatsScreenDPad: ; e2998 (38:6998) +_StatsScreenDPad: ld a, [wBillsPC_NumMonsOnScreen] ld d, a ld a, [wBillsPC_NumMonsInBox] @@ -844,7 +818,7 @@ _StatsScreenDPad: ; e2998 (38:6998) .empty jp BillsPC_JoypadDidNothing -Withdraw_UpDown: ; e29b5 (38:69b5) +Withdraw_UpDown: ld hl, hJoyLast ld a, [wBillsPC_NumMonsOnScreen] ld d, a @@ -860,9 +834,8 @@ Withdraw_UpDown: ; e29b5 (38:69b5) jr nz, BillsPC_PressDown .empty jp BillsPC_JoypadDidNothing -; e29d0 (38:69d0) -MoveMonWithoutMail_DPad: ; e29d0 +MoveMonWithoutMail_DPad: ld hl, hJoyLast ld a, [wBillsPC_NumMonsOnScreen] ld d, a @@ -886,7 +859,7 @@ MoveMonWithoutMail_DPad: ; e29d0 jr nz, BillsPC_PressRight jr BillsPC_JoypadDidNothing -MoveMonWithoutMail_DPad_2: ; e29f4 +MoveMonWithoutMail_DPad_2: ld hl, hJoyLast ld a, [wBillsPC_NumMonsOnScreen] ld d, a @@ -911,7 +884,7 @@ MoveMonWithoutMail_DPad_2: ; e29f4 jr nz, BillsPC_PressRight jr BillsPC_JoypadDidNothing -BillsPC_PressUp: ; e2a18 (38:6a18) +BillsPC_PressUp: ld hl, wBillsPC_CursorPosition ld a, [hl] and a @@ -927,7 +900,7 @@ BillsPC_PressUp: ; e2a18 (38:6a18) dec [hl] jr BillsPC_UpDownDidSomething -BillsPC_PressDown: ; e2a2c (38:6a2c) +BillsPC_PressDown: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -947,9 +920,8 @@ BillsPC_PressDown: ; e2a2c (38:6a2c) ld hl, wBillsPC_ScrollPosition inc [hl] jr BillsPC_UpDownDidSomething -; e2a48 (38:6a48) -BillsPC_PressLeft: ; e2a48 +BillsPC_PressLeft: ld hl, wBillsPC_LoadedBox ld a, [hl] and a @@ -961,7 +933,7 @@ BillsPC_PressLeft: ; e2a48 ld [hl], NUM_BOXES jr BillsPC_LeftRightDidSomething -BillsPC_PressRight: ; e2a56 +BillsPC_PressRight: ld hl, wBillsPC_LoadedBox ld a, [hl] cp NUM_BOXES @@ -973,23 +945,21 @@ BillsPC_PressRight: ; e2a56 ld [hl], 0 jr BillsPC_LeftRightDidSomething -BillsPC_JoypadDidNothing: ; e2a65 (38:6a65) +BillsPC_JoypadDidNothing: xor a and a ret -BillsPC_UpDownDidSomething: ; e2a68 (38:6a68) +BillsPC_UpDownDidSomething: ld a, TRUE and a ret -; e2a6c (38:6a6c) -BillsPC_LeftRightDidSomething: ; e2a6c +BillsPC_LeftRightDidSomething: scf ret -; e2a6e -BillsPC_PlaceString: ; e2a6e (38:6a6e) +BillsPC_PlaceString: push de hlcoord 0, 15 lb bc, 1, 18 @@ -998,18 +968,16 @@ BillsPC_PlaceString: ; e2a6e (38:6a6e) hlcoord 1, 16 call PlaceString ret -; e2a80 (38:6a80) -BillsPC_MoveMonWOMail_BoxNameAndArrows: ; e2a80 +BillsPC_MoveMonWOMail_BoxNameAndArrows: call BillsPC_BoxName hlcoord 8, 1 ld [hl], $5f hlcoord 19, 1 ld [hl], $5e ret -; e2a8e -BillsPC_BoxName: ; e2a8e (38:6a8e) +BillsPC_BoxName: hlcoord 8, 0 lb bc, 1, 10 call TextBox @@ -1038,13 +1006,11 @@ BillsPC_BoxName: ; e2a8e (38:6a8e) hlcoord 10, 1 call PlaceString ret -; e2abd (38:6abd) .PartyPKMN: db "PARTY <PK><MN>@" -; e2ac6 -PCMonInfo: ; e2ac6 (38:6ac6) +PCMonInfo: ; Display a monster's pic and ; attributes when highlighting ; it in a PC menu. @@ -1143,7 +1109,7 @@ PCMonInfo: ; e2ac6 (38:6ac6) ld [hl], a ret -BillsPC_LoadMonStats: ; e2b6d (38:6b6d) +BillsPC_LoadMonStats: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1250,7 +1216,7 @@ BillsPC_LoadMonStats: ; e2b6d (38:6b6d) call CloseSRAM ret -BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) +BillsPC_RefreshTextboxes: hlcoord 8, 2 lb bc, 10, 10 call TextBox @@ -1287,13 +1253,11 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) dec a jr nz, .loop ret -; e2c67 (38:6c67) .CancelString: db "CANCEL@" -; e2c6e -.PlaceNickname: ; e2c6e (38:6c6e) +.PlaceNickname: ld a, [de] and a ret z @@ -1402,11 +1366,9 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) ld de, .Placeholder call PlaceString ret -; e2d2a (38:6d2a) .Placeholder: db "-----@" -; e2d30 copy_box_data: MACRO .loop\@ @@ -1442,7 +1404,7 @@ endc ld [wBillsPC_NumMonsInBox], a ENDM -CopyBoxmonSpecies: ; e2d30 (38:6d30) +CopyBoxmonSpecies: xor a ld hl, wBillsPCPokemonList ld bc, 3 * 30 @@ -1476,7 +1438,7 @@ CopyBoxmonSpecies: ; e2d30 (38:6d30) copy_box_data 1 ret -BillsPC_GetSelectedPokemonSpecies: ; e2def (38:6def) +BillsPC_GetSelectedPokemonSpecies: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1489,7 +1451,7 @@ BillsPC_GetSelectedPokemonSpecies: ; e2def (38:6def) ld a, [hl] ret -BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01) +BillsPC_UpdateSelectionCursor: ld a, [wBillsPC_NumMonsInBox] and a jr nz, .place_cursor @@ -1516,9 +1478,8 @@ rept SPRITEOAMSTRUCT_LENGTH + -1 inc de endr jr .loop -; e2e2b (38:6e2b) -.OAM: ; e2e2b +.OAM: dsprite 4, 6, 10, 0, $00, 0 dsprite 4, 6, 11, 0, $00, 0 dsprite 4, 6, 12, 0, $00, 0 @@ -1544,9 +1505,8 @@ endr dsprite 5, 6, 19, 1, $01, 0 | X_FLIP dsprite 6, 1, 19, 1, $01, 0 | X_FLIP | Y_FLIP db -1 -; e2e8c -BillsPC_UpdateInsertCursor: ; e2e8c +BillsPC_UpdateInsertCursor: ld hl, .OAM ld de, wVirtualOAMSprite00 .loop @@ -1566,9 +1526,8 @@ rept SPRITEOAMSTRUCT_LENGTH + -1 inc de endr jr .loop -; e2eac -.OAM: ; e2eac +.OAM: dsprite 4, 7, 10, 0, $06, 0 dsprite 5, 3, 11, 0, $00, 0 | Y_FLIP dsprite 5, 3, 12, 0, $00, 0 | Y_FLIP @@ -1580,9 +1539,8 @@ endr dsprite 5, 3, 18, 0, $00, 0 | Y_FLIP dsprite 4, 7, 19, 0, $07, 0 db -1 -; e2ed5 -Unreferenced_BillsPC_FillBox: ; e2ed5 +Unreferenced_BillsPC_FillBox: .row push bc push hl @@ -1597,9 +1555,8 @@ Unreferenced_BillsPC_FillBox: ; e2ed5 dec b jr nz, .row ret -; e2ee5 -BillsPC_CheckSpaceInDestination: ; e2ee5 +BillsPC_CheckSpaceInDestination: ; If moving within a box, no need to be here. ld hl, wBillsPC_LoadedBox ld a, [wBillsPC_BackupLoadedBox] @@ -1633,9 +1590,8 @@ BillsPC_CheckSpaceInDestination: ; e2ee5 call DelayFrames scf ret -; e2f18 -BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18) +BillsPC_CheckMail_PreventBlackout: ld a, [wBillsPC_LoadedBox] and a jr nz, .Okay @@ -1675,7 +1631,7 @@ BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18) scf ret -BillsPC_IsMonAnEgg: ; e2f5f (38:6f5f) +BillsPC_IsMonAnEgg: ld a, [wCurPartySpecies] cp EGG jr z, .egg @@ -1693,7 +1649,7 @@ BillsPC_IsMonAnEgg: ; e2f5f (38:6f5f) scf ret -BillsPC_StatsScreen: ; e2f7e (38:6f7e) +BillsPC_StatsScreen: call LowVolume call BillsPC_CopyMon ld a, $3 @@ -1703,7 +1659,7 @@ BillsPC_StatsScreen: ; e2f7e (38:6f7e) call MaxVolume ret -StatsScreenDPad: ; e2f95 (38:6f95) +StatsScreenDPad: ld hl, hJoyPressed ; $ffa7 ld a, [hl] and A_BUTTON | B_BUTTON | D_RIGHT | D_LEFT @@ -1737,7 +1693,7 @@ StatsScreenDPad: ; e2f95 (38:6f95) ld [wMenuJoypad], a ret -BillsPC_CopyMon: ; e2fd6 (38:6fd6) +BillsPC_CopyMon: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1809,7 +1765,7 @@ BillsPC_CopyMon: ; e2fd6 (38:6fd6) farcall CalcBufferMonStats ret -DepositPokemon: ; e307c (38:707c) +DepositPokemon: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1861,7 +1817,7 @@ DepositPokemon: ; e307c (38:707c) scf ret -TryWithdrawPokemon: ; e30fa (38:70fa) +TryWithdrawPokemon: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1916,8 +1872,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) scf ret - -ReleasePKMN_ByePKMN: ; e3180 (38:7180) +ReleasePKMN_ByePKMN: hlcoord 0, 0 lb bc, 15, 8 call ClearBox @@ -1962,9 +1917,8 @@ ReleasePKMN_ByePKMN: ; e3180 (38:7180) ld c, 50 call DelayFrames ret -; e31e7 (38:71e7) -MovePKMNWitoutMail_InsertMon: ; e31e7 +MovePKMNWitoutMail_InsertMon: push hl push de push bc @@ -2005,27 +1959,23 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld de, .dw_return push de jp hl -; e322a -.dw_return ; e322a +.dw_return pop af ld e, a farcall MoveMonWOMail_InsertMon_SaveGame ret -; e3233 .Saving_LeaveOn: db "Saving… Leave ON!@" -; e3245 -.Jumptable: ; e3245 +.Jumptable: dw .BoxToBox dw .PartyToBox dw .BoxToParty dw .PartyToParty -; e324d -.BoxToBox: ; e324d +.BoxToBox: ld hl, wBillsPC_BackupLoadedBox ld a, [wBillsPC_LoadedBox] cp [hl] @@ -2039,9 +1989,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 call .CheckTrivialMove call .CopyToBox ret -; e3267 -.PartyToBox: ; e3267 +.PartyToBox: call .CopyFromParty ld a, $1 ld [wGameLogicPaused], a @@ -2050,22 +1999,19 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld [wGameLogicPaused], a call .CopyToBox ret -; e327d -.BoxToParty: ; e327d +.BoxToParty: call .CopyFromBox call .CopyToParty ret -; e3284 -.PartyToParty: ; e3284 +.PartyToParty: call .CopyFromParty call .CheckTrivialMove call .CopyToParty ret -; e328e -.CheckTrivialMove: ; e328e +.CheckTrivialMove: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -2089,9 +2035,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ret z dec [hl] ret -; e32b0 -.CopyFromBox: ; e32b0 +.CopyFromBox: ld a, [wBillsPC_BackupLoadedBox] dec a ld e, a @@ -2117,9 +2062,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox ret -; e32fa -.CopyToBox: ; e32fa +.CopyToBox: ld a, [wBillsPC_LoadedBox] dec a ld e, a @@ -2130,9 +2074,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld [wCurPartyMon], a farcall InsertPokemonIntoBox ret -; e3316 -.CopyFromParty: ; e3316 +.CopyFromParty: ld a, [wBillsPC_BackupCursorPosition] ld hl, wBillsPC_BackupScrollPosition add [hl] @@ -2150,18 +2093,16 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox ret -; e3346 -.CopyToParty: ; e3346 +.CopyToParty: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] ld [wCurPartyMon], a farcall InsertPokemonIntoParty ret -; e3357 -CopySpeciesToTemp: ; e3357 (38:7357) +CopySpeciesToTemp: ld a, [wCurPartyMon] ld c, a ld b, $0 @@ -2170,7 +2111,7 @@ CopySpeciesToTemp: ; e3357 (38:7357) ld [wCurPartySpecies], a ret -CopyNicknameToTemp: ; e3363 (38:7363) +CopyNicknameToTemp: ld bc, MON_NAME_LENGTH ld a, [wCurPartyMon] call AddNTimes @@ -2179,7 +2120,7 @@ CopyNicknameToTemp: ; e3363 (38:7363) call CopyBytes ret -CopyOTNameToTemp: ; e3376 (38:7376) +CopyOTNameToTemp: ld bc, NAME_LENGTH ld a, [wCurPartyMon] call AddNTimes @@ -2188,14 +2129,14 @@ CopyOTNameToTemp: ; e3376 (38:7376) call CopyBytes ret -CopyMonToTemp: ; e3389 (38:7389) +CopyMonToTemp: ld a, [wCurPartyMon] call AddNTimes ld de, wBufferMon call CopyBytes ret -GetBoxPointer: ; e3396 (38:7396) +GetBoxPointer: dec b ld c, b ld b, 0 @@ -2209,9 +2150,8 @@ GetBoxPointer: ; e3396 (38:7396) ld h, [hl] ld l, a ret -; e33a6 (38:73a6) -.boxes ; e33a6 +.boxes ; bank, address dba sBox1 dba sBox2 @@ -2227,9 +2167,8 @@ GetBoxPointer: ; e3396 (38:7396) dba sBox12 dba sBox13 dba sBox14 -; e33d0 -BillsPC_ApplyPalettes: ; e33d0 (38:73d0) +BillsPC_ApplyPalettes: ld b, a call GetSGBLayout ld a, %11100100 @@ -2238,7 +2177,7 @@ BillsPC_ApplyPalettes: ; e33d0 (38:73d0) call DmgToCgbObjPal0 ret -BillsPC_Jumptable: ; e33df (38:73df) +BillsPC_Jumptable: ld e, a ld d, $0 add hl, de @@ -2248,7 +2187,7 @@ BillsPC_Jumptable: ; e33df (38:73df) ld l, a ret -BillsPC_InitGFX: ; e33e8 (38:73e8) +BillsPC_InitGFX: call DisableLCD ld hl, vTiles2 tile $00 ld bc, $31 tiles @@ -2267,11 +2206,9 @@ BillsPC_InitGFX: ; e33e8 (38:73e8) call SkipMusic call EnableLCD ret -; e3419 (38:7419) PCSelectLZ: INCBIN "gfx/pc/pc.2bpp.lz" PCMailGFX: INCBIN "gfx/pc/pc_mail.2bpp" -; e34dd PCString_ChooseaPKMN: db "Choose a <PK><MN>.@" PCString_WhatsUp: db "What's up?@" @@ -2289,10 +2226,8 @@ PCString_Non: db "Non.@" PCString_BoxFull: db "The BOX is full.@" PCString_PartyFull: db "The party's full!@" PCString_NoReleasingEGGS: db "No releasing EGGS!@" -; e35aa - -_ChangeBox: ; e35aa (38:75aa) +_ChangeBox: call LoadStandardMenuHeader call BillsPC_ClearTilemap .loop @@ -2318,7 +2253,7 @@ _ChangeBox: ; e35aa (38:75aa) call CloseWindow ret -BillsPC_ClearTilemap: ; e35e2 (38:75e2) +BillsPC_ClearTilemap: xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -2326,16 +2261,14 @@ BillsPC_ClearTilemap: ; e35e2 (38:75e2) ld a, " " call ByteFill ret -; e35f1 (38:75f1) -_ChangeBox_MenuHeader: ; 0xe35f1 +_ChangeBox_MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 1, 5, 9, 12 dw .MenuData db 1 ; default option -; 0xe35f9 -.MenuData ; 0xe35f9 +.MenuData db MENU_UNUSED_1 | MENU_UNUSED_3 ; flags db 4, 0 db 1 @@ -2343,9 +2276,8 @@ _ChangeBox_MenuHeader: ; 0xe35f1 dba .boxnames dba NULL dba BillsPC_PrintBoxCountAndCapacity -; e3609 -.boxes ; e3609 +.boxes db NUM_BOXES x = 1 rept NUM_BOXES @@ -2353,9 +2285,8 @@ rept NUM_BOXES x = x + 1 endr db -1 -; e3619 -.boxnames ; e3619 +.boxnames push de ld a, [wMenuSelection] dec a @@ -2363,18 +2294,16 @@ endr pop hl call PlaceString ret -; e3626 -GetBoxName: ; e3626 (38:7626) +GetBoxName: ld bc, BOX_NAME_LENGTH ld hl, wBoxNames call AddNTimes ld d, h ld e, l ret -; e3632 (38:7632) -BillsPC_PrintBoxCountAndCapacity: ; e3632 +BillsPC_PrintBoxCountAndCapacity: hlcoord 11, 7 lb bc, 5, 7 call TextBox @@ -2393,21 +2322,18 @@ BillsPC_PrintBoxCountAndCapacity: ; e3632 ld de, .out_of_20 call PlaceString ret -; e3663 -.Pokemon: ; e3663 +.Pokemon: db "#MON@" -; e3668 -.out_of_20 ; e3668 +.out_of_20 ; db "/20@" db "/" db "0" + MONS_PER_BOX / 10 ; "2" db "0" + MONS_PER_BOX % 10 ; "0" db "@" -; e366c -GetBoxCount: ; e366c (38:766c) +GetBoxCount: ld a, [wCurBox] ld c, a ld a, [wMenuSelection] @@ -2447,9 +2373,8 @@ GetBoxCount: ; e366c (38:766c) ld a, [hl] call CloseSRAM ret -; e36a5 (38:76a5) -.boxbanks ; e36a5 +.boxbanks dba sBox1 dba sBox2 dba sBox3 @@ -2464,9 +2389,8 @@ GetBoxCount: ; e366c (38:766c) dba sBox12 dba sBox13 dba sBox14 -; e36cf -BillsPC_PrintBoxName: ; e36cf (38:76cf) +BillsPC_PrintBoxName: hlcoord 0, 0 ld b, 2 ld c, 18 @@ -2480,13 +2404,11 @@ BillsPC_PrintBoxName: ; e36cf (38:76cf) hlcoord 11, 2 call PlaceString ret -; e36f1 (38:76f1) -.Current: ; e36f1 +.Current: db "CURRENT@" -; e36f9 -BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) +BillsPC_ChangeBoxSubmenu: ld hl, .MenuHeader call LoadMenuHeader call VerticalMenu @@ -2552,45 +2474,38 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) ld de, wd002 call CopyName2 ret -; e3778 (38:7778) hlcoord 11, 7 ; unused -.MenuHeader: ; 0xe377b +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 11, 4, SCREEN_WIDTH - 1, 13 dw .MenuData db 1 ; default option -; 0xe3783 -.MenuData: ; 0xe3783 +.MenuData: db STATICMENU_CURSOR ; flags db 4 ; items db "SWITCH@" db "NAME@" db "PRINT@" db "QUIT@" -; 0xe379c -BillsPC_PlaceChooseABoxString: ; e379c (38:779c) +BillsPC_PlaceChooseABoxString: ld de, .ChooseABox jr BillsPC_PlaceChangeBoxString -; e37a1 (38:77a1) -.ChooseABox: ; e37a1 +.ChooseABox: db "Choose a BOX.@" -; e37af -BillsPC_PlaceWhatsUpString: ; e37af (38:77af) +BillsPC_PlaceWhatsUpString: ld de, .WhatsUp jr BillsPC_PlaceChangeBoxString -; e37b4 (38:77b4) -.WhatsUp: ; e37b4 +.WhatsUp: db "What's up?@" -; e37be -BillsPC_PlaceEmptyBoxString_SFX: ; e37be (38:77be) +BillsPC_PlaceEmptyBoxString_SFX: ld de, .NoMonString call BillsPC_PlaceChangeBoxString ld de, SFX_WRONG @@ -2599,13 +2514,11 @@ BillsPC_PlaceEmptyBoxString_SFX: ; e37be (38:77be) ld c, 50 call DelayFrames ret -; e37d3 (38:77d3) -.NoMonString: ; e37d3 +.NoMonString: db "There's no #MON.@" -; e37e3 -BillsPC_PlaceChangeBoxString: ; e37e3 (38:77e3) +BillsPC_PlaceChangeBoxString: push de hlcoord 0, 14 lb bc, 2, 18 diff --git a/engine/pokemon/bills_pc_top.asm b/engine/pokemon/bills_pc_top.asm index 1e808c02c..550892f65 100644 --- a/engine/pokemon/bills_pc_top.asm +++ b/engine/pokemon/bills_pc_top.asm @@ -1,11 +1,11 @@ -_BillsPC: ; e3fd +_BillsPC: call .CheckCanUsePC ret c call .LogIn call .UseBillsPC jp .LogOut -.CheckCanUsePC: ; e40a (3:640a) +.CheckCanUsePC: ld a, [wPartyCount] and a ret nz @@ -14,12 +14,12 @@ _BillsPC: ; e3fd scf ret -.Text_GottaHavePokemon: ; 0xe417 +.Text_GottaHavePokemon: ; You gotta have #MON to call! text_jump UnknownText_0x1c1006 db "@" -.LogIn: ; e41c (3:641c) +.LogIn: xor a ld [hBGMapMode], a call LoadStandardMenuHeader @@ -35,16 +35,16 @@ _BillsPC: ; e3fd call LoadFontsBattleExtra ret -.Text_What: ; 0xe43a +.Text_What: ; What? text_jump UnknownText_0x1c1024 db "@" -.LogOut: ; e43f (3:643f) +.LogOut: call CloseSubmenu ret -.UseBillsPC: ; e443 (3:6443) +.UseBillsPC: ld hl, .MenuHeader call LoadMenuHeader ld a, $1 @@ -68,47 +68,47 @@ _BillsPC: ; e3fd call CloseWindow ret -.MenuHeader: ; 0xe46f +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData db 1 ; default option -.MenuData: ; 0xe477 +.MenuData: db STATICMENU_CURSOR ; flags db 0 ; items dw .items dw PlaceMenuStrings dw .strings -.strings ; e47f +.strings db "WITHDRAW <PK><MN>@" db "DEPOSIT <PK><MN>@" db "CHANGE BOX@" db "MOVE <PK><MN> W/O MAIL@" db "SEE YA!@" -.Jumptable: ; e4ba (3:64ba) +.Jumptable: dw BillsPC_WithdrawMenu dw BillsPC_DepositMenu dw BillsPC_ChangeBoxMenu dw BillsPC_MovePKMNMenu dw BillsPC_SeeYa -.items ; e4c4 - db 5 +.items + db 5 ; # items db 0 ; WITHDRAW - db 1; DEPOSIT + db 1 ; DEPOSIT db 2 ; CHANGE BOX db 3 ; MOVE PKMN db 4 ; SEE YA! db -1 -BillsPC_SeeYa: ; e4cb +BillsPC_SeeYa: scf ret -BillsPC_MovePKMNMenu: ; e4cd +BillsPC_MovePKMNMenu: call LoadStandardMenuHeader farcall IsAnyMonHoldingMail jr nc, .no_mail @@ -128,12 +128,12 @@ BillsPC_MovePKMNMenu: ; e4cd and a ret -.Text_MonHoldingMail: ; 0xe4f9 +.Text_MonHoldingMail: ; There is a #MON holding MAIL. Please remove the MAIL. text_jump UnknownText_0x1c102b db "@" -BillsPC_DepositMenu: ; e4fe (3:64fe) +BillsPC_DepositMenu: call LoadStandardMenuHeader farcall _DepositPKMN call ReturnToMapFromSubmenu @@ -163,17 +163,17 @@ Unreferenced_Functione512: scf ret -.Text_NoMon: ; 0xe52e +.Text_NoMon: ; You don't have a single #MON! text_jump UnknownText_0x1c1062 db "@" -.Text_ItsYourLastMon: ; 0xe533 +.Text_ItsYourLastMon: ; You can't deposit your last #MON! text_jump UnknownText_0x1c1080 db "@" -CheckCurPartyMonFainted: ; e538 +CheckCurPartyMonFainted: ld hl, wPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH ld b, $0 @@ -202,7 +202,7 @@ CheckCurPartyMonFainted: ; e538 and a ret -BillsPC_WithdrawMenu: ; e559 (3:6559) +BillsPC_WithdrawMenu: call LoadStandardMenuHeader farcall _WithdrawPKMN call ReturnToMapFromSubmenu @@ -224,17 +224,17 @@ Unreferenced_Functione56d: scf ret -UnknownText_0xe57e: ; 0xe57e +UnknownText_0xe57e: ; You can't take any more #MON. text_jump UnknownText_0x1c10a2 db "@" -BillsPC_ChangeBoxMenu: ; e583 (3:6583) +BillsPC_ChangeBoxMenu: farcall _ChangeBox and a ret -ClearPCItemScreen: ; e58b +ClearPCItemScreen: call DisableSpriteUpdates xor a ld [hBGMapMode], a @@ -254,7 +254,7 @@ ClearPCItemScreen: ; e58b call SetPalettes ; load regular palettes? ret -CopyBoxmonToTempMon: ; e5bb +CopyBoxmonToTempMon: ld a, [wCurPartyMon] ld hl, sBoxMon1Species ld bc, BOXMON_STRUCT_LENGTH @@ -370,7 +370,7 @@ Unreferenced_Functione5d9: call CloseSRAM ret -.BoxAddrs: ; e66e +.BoxAddrs: dba sBox1 dba sBox2 dba sBox3 diff --git a/engine/pokemon/breeding.asm b/engine/pokemon/breeding.asm index e32d1a3a6..7e7f0e097 100644 --- a/engine/pokemon/breeding.asm +++ b/engine/pokemon/breeding.asm @@ -1,4 +1,4 @@ -CheckBreedmonCompatibility: ; 16e1d +CheckBreedmonCompatibility: call .CheckBreedingGroupCompatibility ld c, $0 jp nc, .done @@ -83,10 +83,8 @@ CheckBreedmonCompatibility: ; 16e1d ld a, c ld [wd265], a ret -; 16ebc - -.CheckDVs: ; 16ebc (5:6ebc) +.CheckDVs: ; If Defense DVs match and the lower 3 bits of the Special DVs match, ; avoid breeding ld a, [wBreedMon1DVs] @@ -103,9 +101,8 @@ CheckBreedmonCompatibility: ; 16e1d and %111 cp b ret -; 16ed6 -.CheckBreedingGroupCompatibility: ; 16ed6 +.CheckBreedingGroupCompatibility: ; If either mon is in the No Eggs group, ; they are not compatible. ld a, [wBreedMon2Species] @@ -173,9 +170,8 @@ CheckBreedmonCompatibility: ; 16e1d .Compatible: scf ret -; 16f3e -DoEggStep:: ; 16f3e +DoEggStep:: ld de, wPartySpecies ld hl, wPartyMon1Happiness ld c, 0 @@ -198,24 +194,22 @@ DoEggStep:: ; 16f3e add hl, de pop de jr .loop -; 16f5e -OverworldHatchEgg:: ; 16f5e +OverworldHatchEgg:: call RefreshScreen call LoadStandardMenuHeader call HatchEggs call ExitAllMenus call RestartMapMusic jp CloseText -; 16f70 -HatchEggs: ; 16f70 (5:6f70) +HatchEggs: ld de, wPartySpecies ld hl, wPartyMon1Happiness xor a ld [wCurPartyMon], a -.loop ; 16f7a (5:6f7a) +.loop ld a, [de] inc de cp -1 @@ -348,7 +342,7 @@ HatchEggs: ; 16f70 (5:6f70) ld bc, MON_NAME_LENGTH call CopyBytes -.next ; 1707d (5:707d) +.next ld hl, wCurPartyMon inc [hl] pop hl @@ -357,11 +351,10 @@ HatchEggs: ; 16f70 (5:6f70) pop de jp .loop -.done ; 1708a (5:708a) +.done ret -; 1708b (5:708b) -.Text_HatchEgg: ; 0x1708b +.Text_HatchEgg: ; Huh? @ @ text_jump UnknownText_0x1c0db0 start_asm @@ -382,27 +375,23 @@ HatchEggs: ; 16f70 (5:6f70) pop hl ld hl, .CameOutOfItsEgg ret -; 170b0 (5:70b0) -.ClearTextbox: ; 0x170b0 +.ClearTextbox: ; text_jump UnknownText_0x1c0db8 db "@" -; 0x170b5 -.CameOutOfItsEgg: ; 0x170b5 +.CameOutOfItsEgg: ; came out of its EGG!@ @ text_jump UnknownText_0x1c0dba db "@" -; 0x170ba -.Text_NicknameHatchling: ; 0x170ba +.Text_NicknameHatchling: ; Give a nickname to @ ? text_jump UnknownText_0x1c0dd8 db "@" -; 0x170bf -InitEggMoves: ; 170bf +InitEggMoves: call GetHeritableMoves ld d, h ld e, l @@ -431,9 +420,8 @@ InitEggMoves: ; 170bf .done ret -; 170e4 -GetEggMove: ; 170e4 +GetEggMove: push bc ld a, [wEggMonSpecies] dec a @@ -445,7 +433,7 @@ GetEggMove: ; 170e4 ld a, BANK(EggMovePointers) call GetFarHalfword .loop - ld a, BANK(EggMoves) + ld a, BANK("Egg Moves") call GetFarByte cp -1 jr z, .reached_end @@ -479,18 +467,18 @@ GetEggMove: ; 170e4 ld a, BANK(EvosAttacksPointers) call GetFarHalfword .loop3 - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") call GetFarByte inc hl and a jr nz, .loop3 .loop4 - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") call GetFarByte and a jr z, .inherit_tmhm inc hl - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") call GetFarByte ld b, a ld a, [de] @@ -526,9 +514,8 @@ GetEggMove: ; 170e4 pop bc and a ret -; 17169 -LoadEggMove: ; 17169 +LoadEggMove: push de push bc ld a, [de] @@ -561,9 +548,8 @@ LoadEggMove: ; 17169 pop bc pop de ret -; 17197 -GetHeritableMoves: ; 17197 +GetHeritableMoves: ld hl, wBreedMon2Moves ld a, [wBreedMon1Species] cp DITTO @@ -619,9 +605,8 @@ GetHeritableMoves: ; 17197 pop af ld [wCurPartySpecies], a ret -; 1720b -GetBreedmonMovePointer: ; 1720b +GetBreedmonMovePointer: ld hl, wBreedMon1Moves ld a, [wBreedMon1Species] cp DITTO @@ -636,10 +621,8 @@ GetBreedmonMovePointer: ; 1720b .ditto ld hl, wBreedMon2Moves ret -; 17224 - -GetEggFrontpic: ; 17224 (5:7224) +GetEggFrontpic: push de ld [wCurPartySpecies], a ld [wCurSpecies], a @@ -649,7 +632,7 @@ GetEggFrontpic: ; 17224 (5:7224) pop de predef_jump GetMonFrontpic -GetHatchlingFrontpic: ; 1723c (5:723c) +GetHatchlingFrontpic: push de ld [wCurPartySpecies], a ld [wCurSpecies], a @@ -659,7 +642,7 @@ GetHatchlingFrontpic: ; 1723c (5:723c) pop de predef_jump GetAnimatedFrontpic -Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254) +Hatch_UpdateFrontpicBGMapCenter: push af call WaitTop push hl @@ -681,7 +664,7 @@ Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254) call SetPalettes jp WaitBGMap -EggHatch_DoAnimFrame: ; 1727f (5:727f) +EggHatch_DoAnimFrame: push hl push de push bc @@ -692,7 +675,7 @@ EggHatch_DoAnimFrame: ; 1727f (5:727f) pop hl ret -EggHatch_AnimationSequence: ; 1728f (5:728f) +EggHatch_AnimationSequence: ld a, [wd265] ld [wJumptableIndex], a ld a, [wCurSpecies] @@ -782,13 +765,13 @@ EggHatch_AnimationSequence: ; 1728f (5:728f) ld [wCurSpecies], a ret -Hatch_LoadFrontpicPal: ; 17363 (5:7363) +Hatch_LoadFrontpicPal: ld [wPlayerHPPal], a ld b, SCGB_EVOLUTION ld c, $0 jp GetSGBLayout -EggHatch_CrackShell: ; 1736d (5:736d) +EggHatch_CrackShell: ld a, [wFrameCounter] dec a and $7 @@ -808,13 +791,11 @@ EggHatch_CrackShell: ; 1736d (5:736d) ld [hl], $0 ld de, SFX_EGG_CRACK jp PlaySFX -; 17393 (5:7393) -EggHatchGFX: ; 17393 +EggHatchGFX: INCBIN "gfx/evo/egg_hatch.2bpp" -; 173b3 -Hatch_InitShellFragments: ; 173b3 (5:73b3) +Hatch_InitShellFragments: farcall ClearSpriteAnims ld hl, .SpriteData .loop @@ -856,14 +837,13 @@ Hatch_InitShellFragments: ; 173b3 (5:73b3) call PlaySFX call EggHatch_DoAnimFrame ret -; 173ef (5:73ef) shell_fragment: MACRO ; y tile, y pxl, x tile, x pxl, frameset offset, ??? db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5 - SPRITE_ANIM_FRAMESET_EGG_HATCH_1, \6 ENDM -.SpriteData: ; 173ef +.SpriteData: shell_fragment 10, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $3c shell_fragment 11, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_2, $04 shell_fragment 10, 4, 10, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $30 @@ -875,9 +855,8 @@ ENDM shell_fragment 10, 0, 10, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_3, $2a shell_fragment 12, 0, 10, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_4, $16 db -1 -; 17418 -Hatch_ShellFragmentLoop: ; 17418 (5:7418) +Hatch_ShellFragmentLoop: ld c, 129 .loop call EggHatch_DoAnimFrame @@ -885,7 +864,7 @@ Hatch_ShellFragmentLoop: ; 17418 (5:7418) jr nz, .loop ret -DayCareMon1: ; 17421 +DayCareMon1: ld hl, DayCareMon1Text call PrintText ld a, [wBreedMon1Species] @@ -898,7 +877,7 @@ DayCareMon1: ; 17421 call DayCareMonCompatibilityText jp PrintText -DayCareMon2: ; 17440 +DayCareMon2: ld hl, DayCareMon2Text call PrintText ld a, [wBreedMon2Species] @@ -911,23 +890,20 @@ DayCareMon2: ; 17440 call DayCareMonCompatibilityText jp PrintText -DayCareMonCursor: ; 1745f +DayCareMonCursor: jp WaitPressAorB_BlinkCursor -; 17462 -DayCareMon2Text: ; 0x17462 +DayCareMon2Text: ; It's @ that was left with the DAY-CARE LADY. text_jump UnknownText_0x1c0df3 db "@" -; 0x17467 -DayCareMon1Text: ; 0x17467 +DayCareMon1Text: ; It's @ that was left with the DAY-CARE MAN. text_jump UnknownText_0x1c0e24 db "@" -; 0x1746c -DayCareMonCompatibilityText: ; 1746c +DayCareMonCompatibilityText: push bc ld de, wStringBuffer1 ld bc, NAME_LENGTH @@ -951,44 +927,35 @@ DayCareMonCompatibilityText: ; 1746c .done ret -; 1749c -.AllAlone: ; 0x1749c +.AllAlone: ; It's brimming with energy. text_jump UnknownText_0x1c0e54 db "@" -; 0x174a1 -.Incompatible: ; 0x174a1 +.Incompatible: ; It has no interest in @ . text_jump UnknownText_0x1c0e6f db "@" -; 0x174a6 -.HighCompatibility: ; 0x174a6 +.HighCompatibility: ; It appears to care for @ . text_jump UnknownText_0x1c0e8d db "@" -; 0x174ab -.ModerateCompatibility: ; 0x174ab +.ModerateCompatibility: ; It's friendly with @ . text_jump UnknownText_0x1c0eac db "@" -; 0x174b0 -.SlightCompatibility: ; 0x174b0 +.SlightCompatibility: ; It shows interest in @ . text_jump UnknownText_0x1c0ec6 db "@" -; 0x174b5 -Unreferenced_DayCareMonPrintEmptyString: ; 174b5 +Unreferenced_DayCareMonPrintEmptyString: ld hl, .string ret -; 174b9 -.string ; 174b9 +.string db "@" -; 174ba - diff --git a/engine/pokemon/breedmon_level_growth.asm b/engine/pokemon/breedmon_level_growth.asm index dc22db798..c6356dd6e 100644 --- a/engine/pokemon/breedmon_level_growth.asm +++ b/engine/pokemon/breedmon_level_growth.asm @@ -1,4 +1,4 @@ -GetBreedMon1LevelGrowth: ; e698 +GetBreedMon1LevelGrowth: ld hl, wBreedMon1Stats ld de, wTempMon ld bc, BOXMON_STRUCT_LENGTH @@ -12,7 +12,7 @@ GetBreedMon1LevelGrowth: ; e698 ld d, a ret -GetBreedMon2LevelGrowth: ; e6b3 +GetBreedMon2LevelGrowth: ld hl, wBreedMon2Stats ld de, wTempMon ld bc, BOXMON_STRUCT_LENGTH diff --git a/engine/pokemon/caught_data.asm b/engine/pokemon/caught_data.asm index 3bfacf539..89d22fdf6 100644 --- a/engine/pokemon/caught_data.asm +++ b/engine/pokemon/caught_data.asm @@ -1,4 +1,4 @@ -CheckPartyFullAfterContest: ; 4d9e5 +CheckPartyFullAfterContest: ld a, [wContestMon] and a jp z, .DidntCatchAnything @@ -85,7 +85,7 @@ CheckPartyFullAfterContest: ; 4d9e5 ld [wScriptVar], a ret -.TryAddToBox: ; 4daa3 +.TryAddToBox: ld a, BANK(sBoxCount) call GetSRAMBank ld hl, sBoxCount @@ -146,27 +146,27 @@ CheckPartyFullAfterContest: ; 4d9e5 ld [wScriptVar], a ret -.DidntCatchAnything: ; 4db35 +.DidntCatchAnything: ld a, BUGCONTEST_NO_CATCH ld [wScriptVar], a ret -GiveANickname_YesNo: ; 4db3b +GiveANickname_YesNo: ld hl, TextJump_GiveANickname call PrintText jp YesNoBox -TextJump_GiveANickname: ; 0x4db44 +TextJump_GiveANickname: ; Give a nickname to the @ you received? text_jump UnknownText_0x1c12fc db "@" -SetCaughtData: ; 4db49 +SetCaughtData: ld a, [wPartyCount] dec a ld hl, wPartyMon1CaughtLevel call GetPartyLocation -SetBoxmonOrEggmonCaughtData: ; 4db53 +SetBoxmonOrEggmonCaughtData: ld a, [wTimeOfDay] inc a rrca @@ -199,7 +199,7 @@ SetBoxmonOrEggmonCaughtData: ; 4db53 ld [hl], a ret -SetBoxMonCaughtData: ; 4db83 +SetBoxMonCaughtData: ld a, BANK(sBoxMon1CaughtLevel) call GetSRAMBank ld hl, sBoxMon1CaughtLevel @@ -207,7 +207,7 @@ SetBoxMonCaughtData: ; 4db83 call CloseSRAM ret -SetGiftBoxMonCaughtData: ; 4db92 +SetGiftBoxMonCaughtData: push bc ld a, BANK(sBoxMon1CaughtLevel) call GetSRAMBank @@ -217,14 +217,14 @@ SetGiftBoxMonCaughtData: ; 4db92 call CloseSRAM ret -SetGiftPartyMonCaughtData: ; 4dba3 +SetGiftPartyMonCaughtData: ld a, [wPartyCount] dec a ld hl, wPartyMon1CaughtLevel push bc call GetPartyLocation pop bc -SetGiftMonCaughtData: ; 4dbaf +SetGiftMonCaughtData: xor a ld [hli], a ld a, GIFT_LOCATION @@ -233,7 +233,7 @@ SetGiftMonCaughtData: ; 4dbaf ld [hl], a ret -SetEggMonCaughtData: ; 4dbb8 (13:5bb8) +SetEggMonCaughtData: ld a, [wCurPartyMon] ld hl, wPartyMon1CaughtLevel call GetPartyLocation diff --git a/engine/pokemon/correct_nick_errors.asm b/engine/pokemon/correct_nick_errors.asm index 5d44846bf..335540cfe 100644 --- a/engine/pokemon/correct_nick_errors.asm +++ b/engine/pokemon/correct_nick_errors.asm @@ -1,4 +1,4 @@ -CorrectNickErrors:: ; 669f +CorrectNickErrors:: ; error-check monster nick before use ; must be a peace offering to gamesharkers @@ -60,7 +60,7 @@ CorrectNickErrors:: ; 669f pop bc ret -.textcommands ; 66cf +.textcommands ; table defining which characters are actually text commands ; format: ; ≥ < diff --git a/engine/pokemon/correct_party_errors.asm b/engine/pokemon/correct_party_errors.asm index cf60115ee..50a9f3562 100644 --- a/engine/pokemon/correct_party_errors.asm +++ b/engine/pokemon/correct_party_errors.asm @@ -201,13 +201,11 @@ Unreferenced_CorrectPartyErrors: dec b jr nz, .loop5 ret -; 13b6b -.TAMAGO: ; 13b6b +.TAMAGO: db "タマゴ@@@" -; 13b71 -.GetLengthOfStringWith6CharCap: ; 13b71 +.GetLengthOfStringWith6CharCap: push de ld c, 1 ld b, NAME_LENGTH_JAPANESE @@ -226,4 +224,3 @@ Unreferenced_CorrectPartyErrors: .done pop de ret -; 13b87 diff --git a/engine/pokemon/european_mail.asm b/engine/pokemon/european_mail.asm index 8f037cc43..38c542d35 100644 --- a/engine/pokemon/european_mail.asm +++ b/engine/pokemon/european_mail.asm @@ -1,4 +1,4 @@ -IsMailEuropean: ; 1de5c8 +IsMailEuropean: ; return 1 if French ; return 2 if German ; return 3 if Italian @@ -27,18 +27,18 @@ IsMailEuropean: ; 1de5c8 ret ; The regular font. -StandardEnglishFont: ; 1de5e6 +StandardEnglishFont: INCBIN "gfx/font/english.1bpp" ; An extended font. -FrenchGermanFont: ; 1de9e6 +FrenchGermanFont: INCBIN "gfx/font/french_german.1bpp" ; An even more extended font. -SpanishItalianFont: ; 1dede6 +SpanishItalianFont: INCBIN "gfx/font/spanish_italian.1bpp" -HandleFrenchGermanMail: ; 1df1e6 +HandleFrenchGermanMail: ; called if mail is french or german ; fix 's 't 'v ld b, sPartyMon1MailAuthor - sPartyMon1Mail @@ -68,7 +68,7 @@ HandleFrenchGermanMail: ; 1df1e6 ret LireLeCourrierAnglais: -DeutenEnglischenPost: ; 1df203 +DeutenEnglischenPost: ; Cette fonction convertit certains des caractères anglais pour ; leur équivalent dans le jeu de caractères français. ; Diese Funktion wandelt bestimmte englische Zeichen, um ihre @@ -99,7 +99,7 @@ DeutenEnglischenPost: ; 1df203 jr nz, .loop ret -HandleSpanishItalianMail: ; 1df220 +HandleSpanishItalianMail: LeerCorreosIngleses: LeggiPostaInglese: ; This function converts certain characters between diff --git a/engine/pokemon/evolve.asm b/engine/pokemon/evolve.asm index 291bd79b0..571cff0b8 100644 --- a/engine/pokemon/evolve.asm +++ b/engine/pokemon/evolve.asm @@ -1,4 +1,4 @@ -EvolvePokemon: ; 421d8 +EvolvePokemon: ld hl, wEvolvableFlags xor a ld [hl], a @@ -6,7 +6,7 @@ EvolvePokemon: ; 421d8 ld c, a ld b, SET_FLAG call EvoFlagAction -EvolveAfterBattle: ; 421e6 +EvolveAfterBattle: xor a ld [wMonTriedToEvolve], a dec a @@ -87,7 +87,6 @@ EvolveAfterBattle_MasterLoop: cp EVOLVE_HAPPINESS jr z, .happiness - ; EVOLVE_STAT ld a, [wTempMonLevel] cp [hl] @@ -116,7 +115,6 @@ EvolveAfterBattle_MasterLoop: inc hl jr .proceed - .happiness ld a, [wTempMonHappiness] cp HAPPINESS_TO_EVOLVE @@ -143,7 +141,6 @@ EvolveAfterBattle_MasterLoop: jp z, .dont_evolve_3 jr .proceed - .trade ld a, [wLinkMode] and a @@ -169,7 +166,6 @@ EvolveAfterBattle_MasterLoop: ld [wTempMonItem], a jr .proceed - .item ld a, [hli] ld b, a @@ -185,7 +181,6 @@ EvolveAfterBattle_MasterLoop: jp nz, .dont_evolve_3 jr .proceed - .level ld a, [hli] ld b, a @@ -323,7 +318,6 @@ EvolveAfterBattle_MasterLoop: ld l, e ld h, d jp EvolveAfterBattle_MasterLoop -; 423f8 .dont_evolve_1 inc hl @@ -349,9 +343,8 @@ EvolveAfterBattle_MasterLoop: and a call nz, RestartMapMusic ret -; 42414 -UpdateSpeciesNameIfNotNicknamed: ; 42414 +UpdateSpeciesNameIfNotNicknamed: ld a, [wCurSpecies] push af ld a, [wBaseDexNo] @@ -382,17 +375,15 @@ UpdateSpeciesNameIfNotNicknamed: ; 42414 pop de ld bc, MON_NAME_LENGTH jp CopyBytes -; 42454 -CancelEvolution: ; 42454 +CancelEvolution: ld hl, Text_StoppedEvolving call PrintText call ClearTileMap pop hl jp EvolveAfterBattle_MasterLoop -; 42461 -IsMonHoldingEverstone: ; 42461 +IsMonHoldingEverstone: push hl ld a, [wCurPartyMon] ld hl, wPartyMon1Item @@ -402,34 +393,28 @@ IsMonHoldingEverstone: ; 42461 cp EVERSTONE pop hl ret -; 42473 -Text_CongratulationsYourPokemon: ; 0x42473 +Text_CongratulationsYourPokemon: ; Congratulations! Your @ @ text_jump UnknownText_0x1c4b92 db "@" -; 0x42478 -Text_EvolvedIntoPKMN: ; 0x42478 +Text_EvolvedIntoPKMN: ; evolved into @ ! text_jump UnknownText_0x1c4baf db "@" -; 0x4247d -Text_StoppedEvolving: ; 0x4247d +Text_StoppedEvolving: ; Huh? @ stopped evolving! text_jump UnknownText_0x1c4bc5 db "@" -; 0x42482 -Text_WhatEvolving: ; 0x42482 +Text_WhatEvolving: ; What? @ is evolving! text_jump UnknownText_0x1c4be3 db "@" -; 0x42487 - -LearnLevelMoves: ; 42487 +LearnLevelMoves: ld a, [wd265] ld [wCurPartySpecies], a dec a @@ -492,10 +477,8 @@ LearnLevelMoves: ; 42487 ld a, [wCurPartySpecies] ld [wd265], a ret -; 424e1 - -FillMoves: ; 424e1 +FillMoves: ; Fill in moves at de for wCurPartySpecies at wCurPartyLevel push hl @@ -604,9 +587,8 @@ FillMoves: ; 424e1 pop de pop hl ret -; 4256e -ShiftMoves: ; 4256e +ShiftMoves: ld c, NUM_MOVES - 1 .loop inc de @@ -615,18 +597,15 @@ ShiftMoves: ; 4256e dec c jr nz, .loop ret -; 42577 - -EvoFlagAction: ; 42577 +EvoFlagAction: push de ld d, $0 predef SmallFarFlagAction pop de ret -; 42581 -GetPreEvolution: ; 42581 +GetPreEvolution: ; Find the first mon to evolve into wCurPartySpecies. ; Return carry and the new species in wCurPartySpecies @@ -673,4 +652,3 @@ GetPreEvolution: ; 42581 ld [wCurPartySpecies], a scf ret -; 425b1 diff --git a/engine/pokemon/experience.asm b/engine/pokemon/experience.asm index 6b94ed357..3c3b10439 100644 --- a/engine/pokemon/experience.asm +++ b/engine/pokemon/experience.asm @@ -1,4 +1,4 @@ -CalcLevel: ; 50e1b +CalcLevel: ld a, [wTempMonSpecies] ld [wCurSpecies], a call GetBaseData @@ -30,7 +30,7 @@ CalcLevel: ; 50e1b dec d ret -CalcExpAtLevel: ; 50e47 +CalcExpAtLevel: ; (a/b)*n**3 + c*n**2 + d*n - e ld a, [wBaseGrowthRate] add a @@ -150,7 +150,7 @@ CalcExpAtLevel: ; 50e47 ld [hMultiplicand], a ret -.LevelSquared: ; 50eed +.LevelSquared: xor a ld [hMultiplicand + 0], a ld [hMultiplicand + 1], a diff --git a/engine/pokemon/health.asm b/engine/pokemon/health.asm index cc47e8252..229da1e19 100644 --- a/engine/pokemon/health.asm +++ b/engine/pokemon/health.asm @@ -1,4 +1,4 @@ -HealParty: ; c658 +HealParty: xor a ld [wCurPartyMon], a ld hl, wPartySpecies @@ -22,7 +22,7 @@ HealParty: ; c658 .done ret -HealPartyMon: ; c677 +HealPartyMon: ld a, MON_SPECIES call GetPartyParamLocation ld d, h @@ -52,7 +52,7 @@ HealPartyMon: ; c677 farcall RestoreAllPP ret -ComputeHPBarPixels: ; c699 +ComputeHPBarPixels: ; e = bc * (6 * 8) / de ld a, b or c @@ -103,7 +103,7 @@ ComputeHPBarPixels: ; c699 ld e, 0 ret -AnimateHPBar: ; c6e0 +AnimateHPBar: call WaitBGMap call _AnimateHPBar call WaitBGMap diff --git a/engine/pokemon/knows_move.asm b/engine/pokemon/knows_move.asm index 4ec3da347..d84a0d424 100644 --- a/engine/pokemon/knows_move.asm +++ b/engine/pokemon/knows_move.asm @@ -1,4 +1,4 @@ -KnowsMove: ; f9ea +KnowsMove: ld a, MON_MOVES call GetPartyParamLocation ld a, [wPutativeTMHMMove] @@ -19,7 +19,7 @@ KnowsMove: ; f9ea scf ret -.Text_knows: ; 0xfa06 +.Text_knows: ; knows @ . text_jump UnknownText_0x1c5ea8 db "@" diff --git a/engine/pokemon/learn.asm b/engine/pokemon/learn.asm index fb62289a7..20294c878 100644 --- a/engine/pokemon/learn.asm +++ b/engine/pokemon/learn.asm @@ -1,4 +1,4 @@ -LearnMove: ; 6508 +LearnMove: call LoadTileMapToTempTileMap ld a, [wCurPartyMon] ld hl, wPartyMonNicknames @@ -117,9 +117,8 @@ LearnMove: ; 6508 call PrintText ld b, 1 ret -; 65d3 -ForgetMove: ; 65d3 +ForgetMove: push hl ld hl, Text_TryingToLearn call PrintText @@ -200,40 +199,34 @@ ForgetMove: ; 65d3 .cancel scf ret -; 666b -Text_LearnedMove: ; 666b +Text_LearnedMove: ; <MON> learned <MOVE>! text_jump UnknownText_0x1c5660 db "@" -; 6670 -Text_ForgetWhich: ; 6670 +Text_ForgetWhich: ; Which move should be forgotten? text_jump UnknownText_0x1c5678 db "@" -; 6675 -Text_StopLearning: ; 6675 +Text_StopLearning: ; Stop learning <MOVE>? text_jump UnknownText_0x1c5699 db "@" -; 667a -Text_DidNotLearn: ; 667a +Text_DidNotLearn: ; <MON> did not learn <MOVE>. text_jump UnknownText_0x1c56af db "@" -; 667f -Text_TryingToLearn: ; 667f +Text_TryingToLearn: ; <MON> is trying to learn <MOVE>. But <MON> can't learn more than ; four moves. Delete an older move to make room for <MOVE>? text_jump UnknownText_0x1c56c9 db "@" -; 6684 -Text_1_2_and_Poof: ; 6684 +Text_1_2_and_Poof: text_jump UnknownText_0x1c5740 ; 1, 2 and… start_asm push de @@ -247,10 +240,8 @@ Text_1_2_and_Poof: ; 6684 ; Poof! <MON> forgot <MOVE>. And… text_jump UnknownText_0x1c574e db "@" -; 669a -Text_CantForgetHM: ; 669a +Text_CantForgetHM: ; HM moves can't be forgotten now. text_jump UnknownText_0x1c5772 db "@" -; 669f diff --git a/engine/pokemon/level_up_happiness.asm b/engine/pokemon/level_up_happiness.asm index 8c6dd92fe..533399d9f 100644 --- a/engine/pokemon/level_up_happiness.asm +++ b/engine/pokemon/level_up_happiness.asm @@ -1,4 +1,4 @@ -LevelUpHappinessMod: ; 2709e +LevelUpHappinessMod: ld a, [wCurPartyMon] ld hl, wPartyMon1CaughtLocation call GetPartyLocation diff --git a/engine/pokemon/mail.asm b/engine/pokemon/mail.asm index 33bce604d..359d2ac8e 100644 --- a/engine/pokemon/mail.asm +++ b/engine/pokemon/mail.asm @@ -1,4 +1,4 @@ -SendMailToPC: ; 4456e +SendMailToPC: ld a, MON_ITEM call GetPartyParamLocation ld d, [hl] @@ -37,9 +37,8 @@ SendMailToPC: ; 4456e .full scf ret -; 445c0 -DeleteMailFromPC: ; 445c0 (11:45c0) +DeleteMailFromPC: ; Shift all mail messages in the mailbox ld a, BANK(sMailboxCount) call GetSRAMBank @@ -71,9 +70,8 @@ DeleteMailFromPC: ; 445c0 (11:45c0) ld hl, sMailboxCount dec [hl] jp CloseSRAM -; 445f4 (11:45f4) -ReadMailMessage: ; 445f4 +ReadMailMessage: ld a, b ld hl, sMailbox ld bc, MAIL_STRUCT_LENGTH @@ -83,7 +81,7 @@ ReadMailMessage: ; 445f4 farcall ReadAnyMail ret -MoveMailFromPCToParty: ; 44607 +MoveMailFromPCToParty: ld a, BANK(sMailboxCount) call GetSRAMBank push bc @@ -114,17 +112,15 @@ MoveMailFromPCToParty: ; 44607 call CloseSRAM pop bc jp DeleteMailFromPC -; 44648 (11:4648) -GetMailboxCount: ; 44648 +GetMailboxCount: ld a, BANK(sMailboxCount) call GetSRAMBank ld a, [sMailboxCount] ld c, a jp CloseSRAM -; 44654 -CheckPokeMail:: ; 44654 +CheckPokeMail:: push bc push de farcall SelectMonFromParty @@ -191,10 +187,8 @@ CheckPokeMail:: ; 44654 .return ld [wScriptVar], a ret -; 446cc - -GivePokeMail:: ; 446cc +GivePokeMail:: ld a, [wPartyCount] dec a push af @@ -241,10 +235,8 @@ GivePokeMail:: ; 446cc ld a, b ld [de], a jp CloseSRAM -; 44725 - -BackupPartyMonMail: ; 44725 +BackupPartyMonMail: ld a, BANK(sPartyMail) call GetSRAMBank ld hl, sPartyMail @@ -256,9 +248,8 @@ BackupPartyMonMail: ; 44725 ld bc, 1 + 10 * MAIL_STRUCT_LENGTH call CopyBytes jp CloseSRAM -; 44745 -RestorePartyMonMail: ; 44745 (11:4745) +RestorePartyMonMail: ld a, BANK(sPartyMail) call GetSRAMBank ld hl, sPartyMailBackup @@ -271,7 +262,7 @@ RestorePartyMonMail: ; 44745 (11:4745) call CopyBytes jp CloseSRAM -DeletePartyMonMail: ; 44765 (11:4765) +DeletePartyMonMail: ld a, BANK(sPartyMail) call GetSRAMBank xor a @@ -283,10 +274,8 @@ DeletePartyMonMail: ; 44765 (11:4765) ld bc, 1 + 10 * MAIL_STRUCT_LENGTH call ByteFill jp CloseSRAM -; 44781 (11:4781) - -IsAnyMonHoldingMail: ; 44781 +IsAnyMonHoldingMail: ld a, [wPartyCount] and a jr z, .no_mons @@ -308,9 +297,8 @@ IsAnyMonHoldingMail: ; 44781 .no_mons and a ret -; 447a0 -_PlayerMailBoxMenu: ; 0x447a0 +_PlayerMailBoxMenu: call InitMail jr z, .nomail call LoadStandardMenuHeader @@ -320,13 +308,12 @@ _PlayerMailBoxMenu: ; 0x447a0 .nomail ld hl, .EmptyMailboxText jp MenuTextBoxBackup -; 0x447b4 -.EmptyMailboxText: ; 0x447b4 +.EmptyMailboxText: text_jump _EmptyMailboxText db "@" -InitMail: ; 0x447b9 +InitMail: ; initialize wMailboxCount and beyond with incrementing values, one per mail ; set z if no mail ld a, BANK(sMailboxCount) @@ -353,9 +340,8 @@ InitMail: ; 0x447b9 ld a, [wMailboxCount] and a ret -; 0x447da -MailboxPC_GetMailAuthor: ; 0x447da +MailboxPC_GetMailAuthor: dec a ld hl, sMailbox1Author ld bc, MAIL_STRUCT_LENGTH @@ -371,17 +357,15 @@ MailboxPC_GetMailAuthor: ; 0x447da call CloseSRAM pop de ret -; 0x447fb -MailboxPC_PrintMailAuthor: ; 0x447fb +MailboxPC_PrintMailAuthor: push de ld a, [wMenuSelection] call MailboxPC_GetMailAuthor pop hl jp PlaceString -; 0x44806 -MailboxPC: ; 0x44806 +MailboxPC: xor a ld [wCurMessageScrollPosition], a ld a, 1 @@ -414,9 +398,8 @@ MailboxPC: ; 0x44806 .exit xor a ret -; 0x4484a -.Submenu: ; 0x4484a +.Submenu: ld hl, .SubMenuHeader call LoadMenuHeader call VerticalMenu @@ -429,7 +412,6 @@ MailboxPC: ; 0x44806 .subexit ret -; 0x44861 .JumpTable: dw .ReadMail @@ -437,16 +419,15 @@ MailboxPC: ; 0x44806 dw .AttachMail dw .Cancel -.ReadMail: ; 0x44869 +.ReadMail: call FadeToMenu ld a, [wMenuSelection] dec a ld b, a call ReadMailMessage jp CloseSubmenu -; 0x44877 -.PutInPack: ; 0x44877 +.PutInPack: ld hl, .MessageLostText call MenuTextBox call YesNoBox @@ -470,21 +451,20 @@ MailboxPC: ; 0x44806 call DeleteMailFromPC ld hl, .PutAwayText jp MenuTextBoxBackup -; 0x448ac -.PutAwayText: ; 0x448ac +.PutAwayText: text_jump ClearedMailPutAwayText db "@" -.PackFullText: ; 0x448b1 +.PackFullText: text_jump MailPackFullText db "@" -.MessageLostText: ; 0x448b6 +.MessageLostText: text_jump MailMessageLostText db "@" -.GetMailType: ; 0x448bb +.GetMailType: push af ld a, BANK(sMailboxCount) call GetSRAMBank @@ -495,9 +475,8 @@ MailboxPC: ; 0x44806 ld a, [hl] ld [wCurItem], a jp CloseSRAM -; 0x448d2 -.AttachMail: ; 0x448d2 +.AttachMail: call FadeToMenu xor a ld [wPartyMenuActionText], a @@ -540,24 +519,23 @@ MailboxPC: ; 0x44806 .exit2 jp CloseSubmenu -; 0x4493c -.HoldingMailText: ; 0x4493c +.HoldingMailText: text_jump MailAlreadyHoldingItemText db "@" -.EggText: ; 0x44941 +.EggText: text_jump MailEggText db "@" -.MailMovedText: ; 0x44946 +.MailMovedText: text_jump MailMovedFromBoxText db "@" .Cancel: ret -.TopMenuHeader: ; 0x4494c +.TopMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 8, 1, SCREEN_WIDTH - 2, 10 dw .TopMenuData @@ -572,7 +550,7 @@ MailboxPC: ; 0x44806 dba NULL dba NULL -.SubMenuHeader: ; 0x44964 +.SubMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 13, 9 dw .SubMenuData diff --git a/engine/pokemon/mail_2.asm b/engine/pokemon/mail_2.asm index 6e326641b..1cc776706 100644 --- a/engine/pokemon/mail_2.asm +++ b/engine/pokemon/mail_2.asm @@ -1,11 +1,11 @@ -ReadPartyMonMail: ; b9229 +ReadPartyMonMail: ld a, [wCurPartyMon] ld hl, sPartyMail ld bc, MAIL_STRUCT_LENGTH call AddNTimes ld d, h ld e, l -ReadAnyMail: ; b9237 +ReadAnyMail: push de call ClearBGPalettes call ClearSprites @@ -63,9 +63,8 @@ ReadAnyMail: ; b9237 pop af ld [wJumptableIndex], a jr .loop -; b92b8 -.LoadGFX: ; b92b8 +.LoadGFX: ld h, d ld l, e push hl @@ -110,9 +109,8 @@ ReadAnyMail: ; b9237 jp hl .done ret -; b92f8 -MailGFXPointers: ; b92f8 +MailGFXPointers: dbw FLOWER_MAIL, LoadFlowerMailGFX dbw SURF_MAIL, LoadSurfMailGFX dbw LITEBLUEMAIL, LoadLiteBlueMailGFX @@ -124,9 +122,8 @@ MailGFXPointers: ; b92f8 dbw MUSIC_MAIL, LoadMusicMailGFX dbw MIRAGE_MAIL, LoadMirageMailGFX db -1 -; b9317 -LoadSurfMailGFX: ; b9317 +LoadSurfMailGFX: push bc ld hl, vTiles2 tile $31 ld de, SurfMailBorderGFX @@ -140,7 +137,7 @@ LoadSurfMailGFX: ; b9317 call LoadMailGFX_Color2 jr FinishLoadingSurfLiteBlueMailGFX -LoadLiteBlueMailGFX: ; b9335 +LoadLiteBlueMailGFX: push bc ld hl, vTiles2 tile $31 ld de, LiteBlueMailBorderGFX @@ -153,7 +150,7 @@ LoadLiteBlueMailGFX: ; b9335 ld c, 1 * 8 call LoadMailGFX_Color2 -FinishLoadingSurfLiteBlueMailGFX: ; b9351 +FinishLoadingSurfLiteBlueMailGFX: ld de, SurfLiteBlueMailSmallShapesGFX ld c, 2 * 8 call LoadMailGFX_Color2 @@ -209,9 +206,8 @@ FinishLoadingSurfLiteBlueMailGFX: ; b9351 ld [hli], a pop hl jp MailGFX_PlaceMessage -; b93d2 -LoadEonMailGFX: ; b93d2 +LoadEonMailGFX: push bc ld hl, vTiles2 tile $31 ld de, EonMailBorder1GFX @@ -259,9 +255,8 @@ LoadEonMailGFX: ; b93d2 call LovelyEonMail_PlaceIcons pop hl jp MailGFX_PlaceMessage -; b944b -LoadLovelyMailGFX: ; b944b +LoadLovelyMailGFX: push bc ld hl, vTiles2 tile $31 ld de, LovelyMailBorderGFX @@ -290,9 +285,8 @@ LoadLovelyMailGFX: ; b944b call LovelyEonMail_PlaceIcons pop hl jp MailGFX_PlaceMessage -; b9491 -LovelyEonMail_PlaceIcons: ; b9491 +LovelyEonMail_PlaceIcons: ld a, $3d hlcoord 2, 2 call Mail_Draw2x2Graphic @@ -322,9 +316,8 @@ LovelyEonMail_PlaceIcons: ; b9491 hlcoord 16, 12 ld [hl], a ret -; b94d6 -LoadMorphMailGFX: ; b94d6 +LoadMorphMailGFX: push bc ld hl, vTiles2 tile $31 ld bc, 5 * 8 @@ -398,9 +391,8 @@ LoadMorphMailGFX: ; b94d6 call Mail_Draw3x2Graphic pop hl jp MailGFX_PlaceMessage -; b9582 -LoadBlueSkyMailGFX: ; b9582 +LoadBlueSkyMailGFX: push bc ld hl, vTiles2 tile $31 ld de, EonMailBorder1GFX @@ -476,9 +468,8 @@ LoadBlueSkyMailGFX: ; b9582 call Mail_Draw2x2Graphic pop hl jp MailGFX_PlaceMessage -; b9636 -Mail_Place6TileRow: ; b9636 +Mail_Place6TileRow: ld b, $6 .loop ld [hli], a @@ -486,9 +477,8 @@ Mail_Place6TileRow: ; b9636 dec b jr nz, .loop ret -; b963e -LoadFlowerMailGFX: ; b963e +LoadFlowerMailGFX: push bc ld hl, vTiles2 tile $31 ld de, FlowerMailBorderGFX @@ -541,9 +531,8 @@ LoadFlowerMailGFX: ; b963e call Mail_Draw2x2Graphic pop hl jp MailGFX_PlaceMessage -; b96ca -LoadPortraitMailGFX: ; b96ca +LoadPortraitMailGFX: push bc ld hl, vTiles2 tile $31 ld de, PortraitMailBorderGFX @@ -572,9 +561,8 @@ LoadPortraitMailGFX: ; b96ca call PrepMonFrontpic pop hl jp MailGFX_PlaceMessage -; b9710 -LoadMusicMailGFX: ; b9710 +LoadMusicMailGFX: push bc ld hl, vTiles2 tile $31 ld de, MusicMailBorderGFX @@ -615,9 +603,8 @@ LoadMusicMailGFX: ; b9710 call LovelyEonMail_PlaceIcons pop hl jp MailGFX_PlaceMessage -; b9776 -LoadMirageMailGFX: ; b9776 +LoadMirageMailGFX: push bc ld hl, vTiles2 tile $31 ld bc, 5 * 8 @@ -676,9 +663,8 @@ LoadMirageMailGFX: ; b9776 call Mail_Draw16TileRow pop hl jp MailGFX_PlaceMessage -; b97f8 -MailGFX_GenerateMonochromeTilesColor2: ; b97f8 +MailGFX_GenerateMonochromeTilesColor2: .loop xor a ld [hli], a @@ -689,9 +675,8 @@ MailGFX_GenerateMonochromeTilesColor2: ; b97f8 or c jr nz, .loop ret -; b9803 -MailGFX_PlaceMessage: ; b9803 +MailGFX_PlaceMessage: ld bc, MAIL_STRUCT_LENGTH ld de, wTempMail ld a, BANK(sPartyMail) @@ -723,9 +708,8 @@ MailGFX_PlaceMessage: ; b9803 .place_author jp PlaceString -; b984e -Unreferenced_Functionb984e: ; b984e +Unreferenced_Functionb984e: .loop ld a, [hl] xor $ff @@ -735,9 +719,8 @@ Unreferenced_Functionb984e: ; b984e or c jr nz, .loop ret -; b9858 -DrawMailBorder: ; b9858 +DrawMailBorder: hlcoord 0, 0 ld a, $31 ld [hli], a @@ -757,9 +740,8 @@ DrawMailBorder: ; b9858 ld a, $38 ld [hl], a ret -; b987b -DrawMailBorder2: ; b987b +DrawMailBorder2: hlcoord 0, 0 ld a, $31 ld [hli], a @@ -778,23 +760,22 @@ DrawMailBorder2: ; b987b call Mail_DrawLeftRightBorder ld [hl], $31 ret -; b989e -Mail_Place14TileAlternatingRow: ; b989e +Mail_Place14TileAlternatingRow: push af ld b, 14 / 2 jr Mail_PlaceAlternatingRow -Mail_Place16TileAlternatingRow: ; b98a3 +Mail_Place16TileAlternatingRow: push af ld b, 16 / 2 jr Mail_PlaceAlternatingRow -Mail_Place18TileAlternatingRow: ; b98a8 +Mail_Place18TileAlternatingRow: push af ld b, 18 / 2 -Mail_PlaceAlternatingRow: ; b98ab +Mail_PlaceAlternatingRow: .loop ld [hli], a inc a @@ -805,18 +786,17 @@ Mail_PlaceAlternatingRow: ; b98ab ld [hl], a pop af ret -; b98b5 -Mail_Place14TileAlternatingColumn: ; b98b5 +Mail_Place14TileAlternatingColumn: push af ld b, 14 / 2 jr Mail_PlaceAlternatingColumn -Mail_Place16TileAlternatingColumn: ; b98ba +Mail_Place16TileAlternatingColumn: push af ld b, 16 / 2 -Mail_PlaceAlternatingColumn: ; b98bd +Mail_PlaceAlternatingColumn: .loop ld [hl], a ld de, SCREEN_WIDTH @@ -830,36 +810,34 @@ Mail_PlaceAlternatingColumn: ; b98bd ld [hl], a pop af ret -; b98cc -Mail_Draw7TileRow: ; b98cc +Mail_Draw7TileRow: ld b, $7 jr Mail_DrawRowLoop -Mail_Draw13TileRow: ; b98d0 +Mail_Draw13TileRow: ld b, $d jr Mail_DrawRowLoop -Mail_Draw16TileRow: ; b98d4 +Mail_Draw16TileRow: ld b, $10 jr Mail_DrawRowLoop -Mail_DrawTopBottomBorder: ; b98d8 +Mail_DrawTopBottomBorder: ld b, SCREEN_WIDTH - 2 jr Mail_DrawRowLoop -Mail_DrawFullWidthBorder: ; b98dc +Mail_DrawFullWidthBorder: ld b, SCREEN_WIDTH -Mail_DrawRowLoop: ; b98de +Mail_DrawRowLoop: .loop ld [hli], a dec b jr nz, .loop ret -; b98e3 -Mail_DrawLeftRightBorder: ; b98e3 +Mail_DrawLeftRightBorder: ld b, SCREEN_HEIGHT - 2 ld de, SCREEN_WIDTH .loop @@ -868,9 +846,8 @@ Mail_DrawLeftRightBorder: ; b98e3 dec b jr nz, .loop ret -; b98ee -Mail_Draw2x2Graphic: ; b98ee +Mail_Draw2x2Graphic: push af ld [hli], a inc a @@ -883,9 +860,8 @@ Mail_Draw2x2Graphic: ; b98ee ld [hl], a pop af ret -; b98fc -Mail_Draw3x2Graphic: ; b98fc +Mail_Draw3x2Graphic: ld [hli], a inc a ld [hli], a @@ -900,9 +876,8 @@ Mail_Draw3x2Graphic: ; b98fc inc a ld [hl], a ret -; b990c -LoadMailGFX_Color1: ; b990c +LoadMailGFX_Color1: .loop ld a, [de] inc de @@ -912,9 +887,8 @@ LoadMailGFX_Color1: ; b990c dec c jr nz, .loop ret -; b9915 -LoadMailGFX_Color2: ; b9915 +LoadMailGFX_Color2: .loop xor a ld [hli], a @@ -924,9 +898,8 @@ LoadMailGFX_Color2: ; b9915 dec c jr nz, .loop ret -; b991e -LoadMailGFX_Color3: ; b991e +LoadMailGFX_Color3: .loop ld a, [de] inc de @@ -935,15 +908,13 @@ LoadMailGFX_Color3: ; b991e dec c jr nz, .loop ret -; b9926 INCLUDE "gfx/mail.asm" -ItemIsMail: ; b9e76 +ItemIsMail: ld a, d ld hl, MailItems ld de, 1 jp IsInArray -; b9e80 INCLUDE "data/items/mail_items.asm" diff --git a/engine/pokemon/mon_menu.asm b/engine/pokemon/mon_menu.asm index 088b1b1a3..2d14bd603 100644 --- a/engine/pokemon/mon_menu.asm +++ b/engine/pokemon/mon_menu.asm @@ -1,6 +1,6 @@ INCLUDE "data/mon_menu.asm" -MonSubmenu: ; 24d19 +MonSubmenu: xor a ld [hBGMapMode], a call GetMonSubmenuItems @@ -17,16 +17,14 @@ MonSubmenu: ; 24d19 call ExitMenu ret -; 24d3f -.MenuHeader: ; 24d3f +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw 0 db 1 ; default option -; 24d47 -.GetTopCoord: ; 24d47 +.GetTopCoord: ; TopCoord = 1 + BottomCoord - 2 * (NumSubmenuItems + 1) ld a, [wBuffer1] inc a @@ -38,9 +36,8 @@ MonSubmenu: ; 24d19 ld [wMenuBorderTopCoord], a call MenuBox ret -; 24d59 -MonMenuLoop: ; 24d59 +MonMenuLoop: .loop ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags ld [wMenuDataFlags], a @@ -72,9 +69,8 @@ MonMenuLoop: ; 24d59 add hl, bc ld a, [hl] ret -; 24d91 -PopulateMonMenu: ; 24d91 +PopulateMonMenu: call MenuBoxCoord2Tile ld bc, 2 * SCREEN_WIDTH + 2 add hl, bc @@ -93,9 +89,8 @@ PopulateMonMenu: ; 24d91 add hl, bc pop de jr .loop -; 24db0 -GetMonMenuString: ; 24db0 +GetMonMenuString: ld hl, MonMenuOptions + 1 ld de, 3 call IsInArray @@ -118,9 +113,8 @@ GetMonMenuString: ; 24db0 ld d, h ld e, l ret -; 24dd4 -GetMonSubmenuItems: ; 24dd4 +GetMonSubmenuItems: call ResetMonSubmenu ld a, [wCurPartySpecies] cp EGG @@ -195,9 +189,8 @@ GetMonSubmenuItems: ; 24dd4 call AddMonMenuItem call TerminateMonSubmenu ret -; 24e52 -IsFieldMove: ; 24e52 +IsFieldMove: ld b, a ld hl, MonMenuOptions .next @@ -216,18 +209,16 @@ IsFieldMove: ; 24e52 .nope ret -; 24e68 -ResetMonSubmenu: ; 24e68 +ResetMonSubmenu: xor a ld [wBuffer1], a ld hl, wBuffer2 ld bc, NUM_MONMENU_ITEMS + 1 call ByteFill ret -; 24e76 -TerminateMonSubmenu: ; 24e76 +TerminateMonSubmenu: ld a, [wBuffer1] ld e, a ld d, 0 @@ -235,9 +226,8 @@ TerminateMonSubmenu: ; 24e76 add hl, de ld [hl], -1 ret -; 24e83 -AddMonMenuItem: ; 24e83 +AddMonMenuItem: push hl push de push af @@ -253,9 +243,8 @@ AddMonMenuItem: ; 24e83 pop de pop hl ret -; 24e99 -BattleMonMenu: ; 24e99 +BattleMonMenu: ld hl, MenuHeader_0x24ed4 call CopyMenuHeader xor a @@ -286,19 +275,16 @@ BattleMonMenu: ; 24e99 .clear_carry and a ret -; 24ed4 -MenuHeader_0x24ed4: ; 24ed4 +MenuHeader_0x24ed4: db 0 ; flags menu_coords 11, 11, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24edc db 1 ; default option -; 24edc -MenuData_0x24edc: ; 24edc +MenuData_0x24edc: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 3 ; items db "SWITCH@" db "STATS@" db "CANCEL@" -; 24ef2 diff --git a/engine/pokemon/mon_stats.asm b/engine/pokemon/mon_stats.asm index 5468d76fe..76f09b461 100644 --- a/engine/pokemon/mon_stats.asm +++ b/engine/pokemon/mon_stats.asm @@ -1,11 +1,11 @@ -DrawPlayerHP: ; 50b0a +DrawPlayerHP: ld a, $1 jr DrawHP -DrawEnemyHP: ; 50b0e +DrawEnemyHP: ld a, $2 -DrawHP: ; 50b10 +DrawHP: ld [wWhichHPBar], a push hl push bc @@ -82,7 +82,7 @@ DrawHP: ; 50b10 pop de ret -PrintTempMonStats: ; 50b7b +PrintTempMonStats: ; Print wTempMon's stats at hl, with spacing bc. push bc push hl @@ -105,7 +105,7 @@ PrintTempMonStats: ; 50b7b ld de, wTempMonSpeed jp PrintNum -.PrintStat: ; 50bab +.PrintStat: push hl call PrintNum pop hl @@ -113,7 +113,7 @@ PrintTempMonStats: ; 50b7b add hl, de ret -.StatNames: ; 50bb5 +.StatNames: db "ATTACK" next "DEFENSE" next "SPCL.ATK" @@ -121,7 +121,7 @@ PrintTempMonStats: ; 50b7b next "SPEED" next "@" -GetGender: ; 50bdd +GetGender: ; Return the gender of a given monster (wCurPartyMon/wCurOTMon/wCurWildMon). ; When calling this function, a should be set to an appropriate wMonType value. @@ -170,7 +170,6 @@ GetGender: ; 50bdd call AddNTimes .DVs: - ; sBoxMon data is read directly from SRAM. ld a, [wMonType] cp BOXMON @@ -235,7 +234,7 @@ GetGender: ; 50bdd scf ret -ListMovePP: ; 50c50 +ListMovePP: ld a, [wNumMoves] inc a ld c, a @@ -316,7 +315,7 @@ ListMovePP: ; 50c50 .done ret -.load_loop ; 50cc9 +.load_loop ld [hli], a ld [hld], a add hl, de @@ -324,7 +323,7 @@ ListMovePP: ; 50c50 jr nz, .load_loop ret -Unreferenced_Function50cd0: ; 50cd0 +Unreferenced_Function50cd0: .loop ld [hl], $32 inc hl @@ -363,7 +362,7 @@ Unused_PlaceEnemyHPLevel: .egg ret -PlaceStatusString: ; 50d0a +PlaceStatusString: push de inc de inc de @@ -382,10 +381,10 @@ PlaceStatusString: ; 50d0a and a ret -FntString: ; 50d22 +FntString: db "FNT@" -CopyStatusString: ; 50d25 +CopyStatusString: ld a, [de] inc de ld [hli], a @@ -396,7 +395,7 @@ CopyStatusString: ; 50d25 ld [hl], a ret -PlaceNonFaintStatus: ; 50d2e +PlaceNonFaintStatus: push de ld a, [de] ld de, PsnString @@ -430,7 +429,7 @@ BrnString: db "BRN@" FrzString: db "FRZ@" ParString: db "PAR@" -ListMoves: ; 50d6f +ListMoves: ; List moves at hl, spaced every [wBuffer1] tiles. ld de, wListMoves_MoveIndicesBuffer ld b, $0 diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 630479797..128bbf200 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -1,4 +1,4 @@ -TryAddMonToParty: ; d88c +TryAddMonToParty: ; Check if to copy wild mon or generate a new one ; Whose is it? ld de, wPartyCount @@ -76,7 +76,7 @@ TryAddMonToParty: ; d88c dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes -GeneratePartyMonStats: ; d906 +GeneratePartyMonStats: ; wBattleMode specifies whether it's a wild mon or not. ; wMonType specifies whether it's an opposing mon or not. ; wCurPartySpecies/wCurPartyLevel specify the species and level. @@ -360,9 +360,8 @@ endr .done scf ; When this function returns, the carry flag indicates success vs failure. ret -; da6d -FillPP: ; da6d +FillPP: push bc ld b, NUM_MOVES .loop @@ -391,9 +390,8 @@ FillPP: ; da6d jr nz, .loop pop bc ret -; da96 -AddTempmonToParty: ; da96 +AddTempmonToParty: ld hl, wPartyCount ld a, [hl] cp PARTY_LENGTH @@ -477,7 +475,7 @@ AddTempmonToParty: ; da96 and a ret -SendGetMonIntoFromBox: ; db3f +SendGetMonIntoFromBox: ; Sents/Gets mon into/from Box depending on Parameter ; wPokemonWithdrawDepositParameter == 0: get mon into Party ; wPokemonWithdrawDepositParameter == 1: sent mon into Box @@ -702,15 +700,13 @@ SendGetMonIntoFromBox: ; db3f call CloseSRAM and a ret -; dcb1 -CloseSRAM_And_SetCarryFlag: ; dcb1 +CloseSRAM_And_SetCarryFlag: call CloseSRAM scf ret -; dcb6 -RestorePPofDepositedPokemon: ; dcb6 +RestorePPofDepositedPokemon: ld a, b ld hl, sBoxMons ld bc, BOXMON_STRUCT_LENGTH @@ -773,9 +769,8 @@ RestorePPofDepositedPokemon: ; dcb6 pop af ld [wMenuCursorY], a ret -; dd21 -RetrieveMonFromDayCareMan: ; dd21 +RetrieveMonFromDayCareMan: ld a, [wBreedMon1Species] ld [wCurPartySpecies], a ld de, SFX_TRANSACTION @@ -789,9 +784,8 @@ RetrieveMonFromDayCareMan: ; dd21 xor a ld [wPokemonWithdrawDepositParameter], a jp RetrieveBreedmon -; dd42 -RetrieveMonFromDayCareLady: ; dd42 +RetrieveMonFromDayCareLady: ld a, [wBreedMon2Species] ld [wCurPartySpecies], a ld de, SFX_TRANSACTION @@ -805,9 +799,8 @@ RetrieveMonFromDayCareLady: ; dd42 ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a jp RetrieveBreedmon -; dd64 -RetrieveBreedmon: ; dd64 +RetrieveBreedmon: ld hl, wPartyCount ld a, [hl] cp PARTY_LENGTH @@ -902,9 +895,8 @@ RetrieveBreedmon: ; dd64 ld [hl], a and a ret -; de1a -GetLastPartyMon: ; de1a +GetLastPartyMon: ld a, [wPartyCount] dec a ld hl, wPartyMon1Species @@ -913,25 +905,22 @@ GetLastPartyMon: ; de1a ld d, h ld e, l ret -; de2a -DepositMonWithDayCareMan: ; de2a +DepositMonWithDayCareMan: ld de, wBreedMon1Nick call DepositBreedmon xor a ; REMOVE_PARTY ld [wPokemonWithdrawDepositParameter], a jp RemoveMonFromPartyOrBox -; de37 -DepositMonWithDayCareLady: ; de37 +DepositMonWithDayCareLady: ld de, wBreedMon2Nick call DepositBreedmon xor a ; REMOVE_PARTY ld [wPokemonWithdrawDepositParameter], a jp RemoveMonFromPartyOrBox -; de44 -DepositBreedmon: ; de44 +DepositBreedmon: ld a, [wCurPartyMon] ld hl, wPartyMonNicknames call SkipNames @@ -947,7 +936,7 @@ DepositBreedmon: ; de44 ld bc, BOXMON_STRUCT_LENGTH jp CopyBytes -SendMonIntoBox: ; de6e +SendMonIntoBox: ; Sends the mon into one of Bills Boxes ; the data comes mainly from 'wEnemyMon:' ld a, BANK(sBoxCount) @@ -1073,15 +1062,13 @@ SendMonIntoBox: ; de6e call CloseSRAM scf ret -; df42 -.full ; df42 +.full call CloseSRAM and a ret -; df47 -ShiftBoxMon: ; df47 +ShiftBoxMon: ld hl, sBoxMonOT ld bc, NAME_LENGTH call .shift @@ -1127,9 +1114,8 @@ ShiftBoxMon: ; df47 or b jr nz, .loop ret -; df8c -GiveEgg:: ; df8c +GiveEgg:: ld a, [wCurPartySpecies] push af callfar GetPreEvolution @@ -1226,13 +1212,11 @@ GiveEgg:: ; df8c ld [hl], a and a ret -; e035 -String_Egg: ; e035 +String_Egg: db "EGG@" -; e039 -RemoveMonFromPartyOrBox: ; e039 +RemoveMonFromPartyOrBox: ld hl, wPartyCount ld a, [wPokemonWithdrawDepositParameter] @@ -1382,10 +1366,8 @@ RemoveMonFromPartyOrBox: ; e039 jr nz, .loop2 .close_sram jp CloseSRAM -; e134 - -ComputeNPCTrademonStats: ; e134 +ComputeNPCTrademonStats: ld a, MON_LEVEL call GetPartyParamLocation ld a, [hl] @@ -1413,16 +1395,15 @@ ComputeNPCTrademonStats: ; e134 ld a, [de] ld [hl], a ret -; e167 -CalcMonStats: ; e167 +CalcMonStats: ; Calculates all 6 Stats of a mon ; b: Take into account stat EXP if TRUE ; 'c' counts from 1-6 and points with 'wBaseStats' to the base value ; hl is the path to the Stat EXP ; de points to where the final stats will be saved - ld c, $0 + ld c, STAT_HP - 1 ; first stat .loop inc c call CalcMonStatC @@ -1433,12 +1414,11 @@ CalcMonStats: ; e167 ld [de], a inc de ld a, c - cp STAT_SDEF + cp STAT_SDEF ; last stat jr nz, .loop ret -; e17b -CalcMonStatC: ; e17b +CalcMonStatC: ; 'c' is 1-6 and points to the BaseStat ; 1: HP ; 2: Attack @@ -1454,14 +1434,14 @@ CalcMonStatC: ; e17b push hl ld hl, wBaseStats dec hl ; has to be decreased, because 'c' begins with 1 - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] ld e, a pop hl push hl ld a, c - cp STAT_SDEF + cp STAT_SDEF ; last stat jr nz, .not_spdef dec hl dec hl @@ -1497,29 +1477,29 @@ CalcMonStatC: ; e17b jr z, .Special cp STAT_SDEF jr z, .Special -; DV_HP = (DV_ATK & 1) << 3 + (DV_DEF & 1) << 2 + (DV_SPD & 1) << 1 + (DV_SPC & 1) +; DV_HP = (DV_ATK & 1) << 3 | (DV_DEF & 1) << 2 | (DV_SPD & 1) << 1 | (DV_SPC & 1) push bc ld a, [hl] swap a - and $1 + and 1 add a add a add a ld b, a ld a, [hli] - and $1 + and 1 add a add a add b ld b, a ld a, [hl] swap a - and $1 + and 1 add a add b ld b, a ld a, [hl] - and $1 + and 1 add b pop bc jr .GotDV @@ -1632,9 +1612,8 @@ CalcMonStatC: ; e17b pop de pop hl ret -; e277 -GivePoke:: ; e277 +GivePoke:: push de push bc xor a ; PARTYMON @@ -1812,22 +1791,19 @@ GivePoke:: ; e277 call CloseSRAM ld b, $1 ret -; e3d4 -.FailedToGiveMon: ; e3d4 +.FailedToGiveMon: pop bc pop de ld b, $2 ret -; e3d9 -TextJump_WasSentToBillsPC: ; 0xe3d9 +TextJump_WasSentToBillsPC: ; was sent to BILL's PC. text_jump Text_WasSentToBillsPC db "@" -; 0xe3de -InitNickname: ; e3de +InitNickname: push de call LoadStandardMenuHeader call DisableSpriteUpdates @@ -1842,4 +1818,3 @@ InitNickname: ; e3de ld hl, ExitAllMenus rst FarCall ret -; e3fd diff --git a/engine/pokemon/move_mon_wo_mail.asm b/engine/pokemon/move_mon_wo_mail.asm index 5d81da8a0..1dab879c7 100644 --- a/engine/pokemon/move_mon_wo_mail.asm +++ b/engine/pokemon/move_mon_wo_mail.asm @@ -1,4 +1,4 @@ -InsertPokemonIntoBox: ; 51322 +InsertPokemonIntoBox: ld a, BANK(sBoxCount) call GetSRAMBank ld hl, sBoxCount @@ -37,7 +37,7 @@ InsertPokemonIntoBox: ; 51322 farcall RestorePPofDepositedPokemon jp CloseSRAM -InsertPokemonIntoParty: ; 5138b +InsertPokemonIntoParty: ld hl, wPartyCount call InsertSpeciesIntoBoxOrParty ld a, [wPartyCount] @@ -63,7 +63,7 @@ InsertPokemonIntoParty: ; 5138b call InsertDataIntoBoxOrParty ret -InsertSpeciesIntoBoxOrParty: ; 513cb +InsertSpeciesIntoBoxOrParty: inc [hl] inc hl ld a, [wCurPartyMon] @@ -81,7 +81,7 @@ InsertSpeciesIntoBoxOrParty: ; 513cb jr nz, .loop ret -InsertDataIntoBoxOrParty: ; 513e0 +InsertDataIntoBoxOrParty: push de push hl push bc diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index 11edc0412..c3a70dbdc 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -1,4 +1,4 @@ -SelectMonFromParty: ; 50000 +SelectMonFromParty: call DisableSpriteUpdates xor a ld [wPartyMenuActionText], a @@ -10,10 +10,8 @@ SelectMonFromParty: ; 50000 call PartyMenuSelect call ReturnToMapWithSpeechTextbox ret -; 5001d - -SelectTradeOrDayCareMon: ; 5001d +SelectTradeOrDayCareMon: ld a, b ld [wPartyMenuActionText], a call DisableSpriteUpdates @@ -27,26 +25,22 @@ SelectTradeOrDayCareMon: ; 5001d call PartyMenuSelect call ReturnToMapWithSpeechTextbox ret -; 5003f -InitPartyMenuLayout: ; 5003f +InitPartyMenuLayout: call LoadPartyMenuGFX call InitPartyMenuWithCancel call InitPartyMenuGFX call WritePartyMenuTilemap call PrintPartyMenuText ret -; 5004f -LoadPartyMenuGFX: ; 5004f +LoadPartyMenuGFX: call LoadFontsBattleExtra callfar InitPartyMenuPalettes ; engine/color.asm callfar ClearSpriteAnims2 ret -; 5005f - -WritePartyMenuTilemap: ; 0x5005f +WritePartyMenuTilemap: ld hl, wOptions ld a, [hl] push af @@ -71,9 +65,8 @@ WritePartyMenuTilemap: ; 0x5005f pop af ld [wOptions], a ret -; 0x50089 -.Jumptable: ; 50089 +.Jumptable: ; entries correspond to PARTYMENUQUALITY_* constants dw PlacePartyNicknames dw PlacePartyHPBar @@ -84,9 +77,8 @@ WritePartyMenuTilemap: ; 0x5005f dw PlacePartyMonEvoStoneCompatibility dw PlacePartyMonGender dw PlacePartyMonMobileBattleSelection -; 5009b -PlacePartyNicknames: ; 5009b +PlacePartyNicknames: hlcoord 3, 1 ld a, [wPartyCount] and a @@ -116,14 +108,11 @@ PlacePartyNicknames: ; 5009b ld de, .CANCEL call PlaceString ret -; 500c8 -.CANCEL: ; 500c8 +.CANCEL: db "CANCEL@" -; 500cf - -PlacePartyHPBar: ; 500cf +PlacePartyHPBar: xor a ld [wSGBPals], a ld a, [wPartyCount] @@ -164,9 +153,8 @@ PlacePartyHPBar: ; 500cf ld b, SCGB_PARTY_MENU call GetSGBLayout ret -; 50117 -PlacePartymonHPBar: ; 50117 +PlacePartymonHPBar: ld a, b ld bc, PARTYMON_STRUCT_LENGTH ld hl, wPartyMon1HP @@ -191,9 +179,8 @@ PlacePartymonHPBar: ; 50117 ld e, a predef ComputeHPBarPixels ret -; 50138 -PlacePartyMenuHPDigits: ; 50138 +PlacePartyMenuHPDigits: ld a, [wPartyCount] and a ret z @@ -233,9 +220,8 @@ PlacePartyMenuHPDigits: ; 50138 dec c jr nz, .loop ret -; 50176 -PlacePartyMonLevel: ; 50176 +PlacePartyMonLevel: ld a, [wPartyCount] and a ret z @@ -276,9 +262,8 @@ PlacePartyMonLevel: ; 50176 dec c jr nz, .loop ret -; 501b2 -PlacePartyMonStatus: ; 501b2 +PlacePartyMonStatus: ld a, [wPartyCount] and a ret z @@ -309,9 +294,8 @@ PlacePartyMonStatus: ; 501b2 dec c jr nz, .loop ret -; 501e0 -PlacePartyMonTMHMCompatibility: ; 501e0 +PlacePartyMonTMHMCompatibility: ld a, [wPartyCount] and a ret z @@ -344,9 +328,8 @@ PlacePartyMonTMHMCompatibility: ; 501e0 dec c jr nz, .loop ret -; 50215 -.PlaceAbleNotAble: ; 50215 +.PlaceAbleNotAble: ld a, c and a jr nz, .able @@ -356,18 +339,14 @@ PlacePartyMonTMHMCompatibility: ; 501e0 .able ld de, .string_able ret -; 50221 -.string_able ; 50221 +.string_able db "ABLE@" -; 50226 -.string_not_able ; 50226 +.string_not_able db "NOT ABLE@" -; 5022f - -PlacePartyMonEvoStoneCompatibility: ; 5022f +PlacePartyMonEvoStoneCompatibility: ld a, [wPartyCount] and a ret z @@ -404,9 +383,8 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f dec c jr nz, .loop ret -; 50268 -.DetermineCompatibility: ; 50268 +.DetermineCompatibility: ld de, wStringBuffer1 ld a, BANK(EvosAttacksPointers) ld bc, 2 @@ -416,7 +394,7 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f ld h, [hl] ld l, a ld de, wStringBuffer1 - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") ld bc, 10 call FarCopyBytes ld hl, wStringBuffer1 @@ -441,17 +419,13 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f .nope ld de, .string_not_able ret -; 502a3 -.string_able ; 502a3 +.string_able db "ABLE@" -; 502a8 -.string_not_able ; 502a8 +.string_not_able db "NOT ABLE@" -; 502b1 - -PlacePartyMonGender: ; 502b1 +PlacePartyMonGender: ld a, [wPartyCount] and a ret z @@ -489,22 +463,17 @@ PlacePartyMonGender: ; 502b1 dec c jr nz, .loop ret -; 502ee -.male ; 502ee +.male db "♂…MALE@" -; 502f5 -.female ; 502f5 +.female db "♀…FEMALE@" -; 502fe -.unknown ; 502fe +.unknown db "…UNKNOWN@" -; 50307 - -PlacePartyMonMobileBattleSelection: ; 50307 +PlacePartyMonMobileBattleSelection: ld a, [wPartyCount] and a ret z @@ -571,23 +540,17 @@ PlacePartyMonMobileBattleSelection: ; 50307 dec b ret z jr .loop2 -; 5036b -.String_Banme: ; 5036b +.String_Banme: db " ばんめ @" ; Place -; 50372 -.String_Sanka_Shinai: ; 50372 +.String_Sanka_Shinai: db "さんかしない@" ; Cancel -; 50379 -.String_Kettei_Yameru: ; 50379 +.String_Kettei_Yameru: db "けってい やめる@" ; Quit -; 50383 -.Strings_1_2_3: ; 50383 +.Strings_1_2_3: db "1@", "2@", "3@" ; 1st, 2nd, 3rd -; 50389 - -PartyMenuCheckEgg: ; 50389 +PartyMenuCheckEgg: ld a, LOW(wPartySpecies) add b ld e, a @@ -597,9 +560,8 @@ PartyMenuCheckEgg: ; 50389 ld a, [de] cp EGG ret -; 50396 -GetPartyMenuQualityIndexes: ; 50396 +GetPartyMenuQualityIndexes: ld a, [wPartyMenuActionText] and $f0 jr nz, .skip @@ -618,12 +580,10 @@ GetPartyMenuQualityIndexes: ; 50396 .skip ld hl, PartyMenuQualityPointers.Default ret -; 503b2 INCLUDE "data/party_menu_qualities.asm" - -InitPartyMenuGFX: ; 503e0 +InitPartyMenuGFX: ld hl, wPartyCount ld a, [hli] and a @@ -647,9 +607,8 @@ InitPartyMenuGFX: ; 503e0 jr nz, .loop callfar PlaySpriteAnimations ret -; 50405 -InitPartyMenuWithCancel: ; 50405 +InitPartyMenuWithCancel: ; with cancel xor a ld [wSwitchMon], a @@ -675,9 +634,8 @@ InitPartyMenuWithCancel: ; 50405 ld a, A_BUTTON | B_BUTTON ld [wMenuJoypadFilter], a ret -; 5042d -InitPartyMenuNoCancel: ; 0x5042d +InitPartyMenuNoCancel: ; no cancel ld de, PartyMenuAttributes call SetMenuAttributes @@ -697,9 +655,8 @@ InitPartyMenuNoCancel: ; 0x5042d ld a, A_BUTTON | B_BUTTON ld [wMenuJoypadFilter], a ret -; 5044f (14:444f) -PartyMenuAttributes: ; 5044f +PartyMenuAttributes: ; cursor y ; cursor x ; num rows @@ -713,9 +670,8 @@ PartyMenuAttributes: ; 5044f db $60, $00 dn 2, 0 db 0 -; 50457 -PartyMenuSelect: ; 0x50457 +PartyMenuSelect: ; sets carry if exitted menu. call StaticMenuJoypad call PlaceHollowCursor @@ -752,10 +708,8 @@ PartyMenuSelect: ; 0x50457 call WaitSFX scf ret -; 0x5049a - -PrintPartyMenuText: ; 5049a +PrintPartyMenuText: hlcoord 0, 14 lb bc, 2, 18 call TextBox @@ -764,7 +718,7 @@ PrintPartyMenuText: ; 5049a jr nz, .haspokemon ld de, YouHaveNoPKMNString jr .gotstring -.haspokemon ; 504ae +.haspokemon ld a, [wPartyMenuActionText] and $f ; drop high nibble ld hl, PartyMenuStrings @@ -775,7 +729,7 @@ PrintPartyMenuText: ; 5049a ld a, [hli] ld d, [hl] ld e, a -.gotstring ; 504be +.gotstring ld a, [wOptions] push af set NO_TEXT_SCROLL, a @@ -785,9 +739,8 @@ PrintPartyMenuText: ; 5049a pop af ld [wOptions], a ret -; 0x504d2 -PartyMenuStrings: ; 0x504d2 +PartyMenuStrings: dw ChooseAMonString dw UseOnWhichPKMNString dw WhichPKMNString @@ -798,36 +751,36 @@ PartyMenuStrings: ; 0x504d2 dw ChooseAMonString ; Probably used to be ChooseAMalePKMNString dw ToWhichPKMNString -ChooseAMonString: ; 0x504e4 +ChooseAMonString: db "Choose a #MON.@" -UseOnWhichPKMNString: ; 0x504f3 +UseOnWhichPKMNString: db "Use on which <PK><MN>?@" -WhichPKMNString: ; 0x50504 +WhichPKMNString: db "Which <PK><MN>?@" -TeachWhichPKMNString: ; 0x5050e +TeachWhichPKMNString: db "Teach which <PK><MN>?@" -MoveToWhereString: ; 0x5051e +MoveToWhereString: db "Move to where?@" -ChooseAFemalePKMNString: ; 0x5052d +ChooseAFemalePKMNString: ; unused db "Choose a ♀<PK><MN>.@" -ChooseAMalePKMNString: ; 0x5053b +ChooseAMalePKMNString: ; unused db "Choose a ♂<PK><MN>.@" -ToWhichPKMNString: ; 0x50549 +ToWhichPKMNString: db "To which <PK><MN>?@" -YouHaveNoPKMNString: ; 0x50556 +YouHaveNoPKMNString: db "You have no <PK><MN>!@" -PrintPartyMenuActionText: ; 50566 +PrintPartyMenuActionText: ld a, [wCurPartyMon] ld hl, wPartyMonNicknames call GetNick @@ -836,9 +789,8 @@ PrintPartyMenuActionText: ; 50566 ld hl, .MenuActionTexts call .PrintText ret -; 5057b -.MenuActionTexts: ; 5057b +.MenuActionTexts: ; entries correspond to PARTYMENUTEXT_* constants dw .Text_CuredOfPoison dw .Text_BurnWasHealed @@ -850,70 +802,58 @@ PrintPartyMenuActionText: ; 50566 dw .Text_Revitalized dw .Text_GrewToLevel dw .Text_CameToItsSenses -; 5058f -.Text_RecoveredSomeHP: ; 0x5058f +.Text_RecoveredSomeHP: ; recovered @ HP! text_jump UnknownText_0x1bc0a2 db "@" -; 0x50594 -.Text_CuredOfPoison: ; 0x50594 +.Text_CuredOfPoison: ; 's cured of poison. text_jump UnknownText_0x1bc0bb db "@" -; 0x50599 -.Text_RidOfParalysis: ; 0x50599 +.Text_RidOfParalysis: ; 's rid of paralysis. text_jump UnknownText_0x1bc0d2 db "@" -; 0x5059e -.Text_BurnWasHealed: ; 0x5059e +.Text_BurnWasHealed: ; 's burn was healed. text_jump UnknownText_0x1bc0ea db "@" -; 0x505a3 -.Text_Defrosted: ; 0x505a3 +.Text_Defrosted: ; was defrosted. text_jump UnknownText_0x1bc101 db "@" -; 0x505a8 -.Text_WokeUp: ; 0x505a8 +.Text_WokeUp: ; woke up. text_jump UnknownText_0x1bc115 db "@" -; 0x505ad -.Text_HealthReturned: ; 0x505ad +.Text_HealthReturned: ; 's health returned. text_jump UnknownText_0x1bc123 db "@" -; 0x505b2 -.Text_Revitalized: ; 0x505b2 +.Text_Revitalized: ; is revitalized. text_jump UnknownText_0x1bc13a db "@" -; 0x505b7 -.Text_GrewToLevel: ; 0x505b7 +.Text_GrewToLevel: ; grew to level @ !@ @ text_jump UnknownText_0x1bc14f db "@" -; 0x505bc -.Text_CameToItsSenses: ; 0x505bc +.Text_CameToItsSenses: ; came to its senses. text_jump UnknownText_0x1bc16e db "@" -; 0x505c1 - -.PrintText: ; 505c1 +.PrintText: ld e, a ld d, 0 add hl, de @@ -929,4 +869,3 @@ PrintPartyMenuActionText: ; 50566 pop af ld [wOptions], a ret -; 505da diff --git a/engine/pokemon/search.asm b/engine/pokemon/search.asm index 57b489a37..c8d4439df 100644 --- a/engine/pokemon/search.asm +++ b/engine/pokemon/search.asm @@ -1,4 +1,4 @@ -BeastsCheck: ; 0x4a6e8 +BeastsCheck: ; Check if the player owns all three legendary beasts. ; They must exist in either party or PC, and have the player's OT and ID. ; Return the result in wScriptVar. @@ -28,8 +28,7 @@ BeastsCheck: ; 0x4a6e8 ld [wScriptVar], a ret - -MonCheck: ; 0x4a711 +MonCheck: ; Check if the player owns any Pokémon of the species in wScriptVar. ; Return the result in wScriptVar. @@ -46,8 +45,7 @@ MonCheck: ; 0x4a711 ld [wScriptVar], a ret - -CheckOwnMonAnywhere: ; 0x4a721 +CheckOwnMonAnywhere: ; Check if the player owns any monsters of the species in wScriptVar. ; It must exist in either party or PC, and have the player's OT and ID. @@ -178,8 +176,7 @@ CheckOwnMonAnywhere: ; 0x4a721 and a ret - -CheckOwnMon: ; 0x4a7ba +CheckOwnMon: ; Check if a Pokémon belongs to the player and is of a specific species. ; inputs: @@ -246,9 +243,8 @@ endr pop bc scf ret -; 0x4a810 -BoxAddressTable1: ; 4a810 +BoxAddressTable1: dba sBox1 dba sBox2 dba sBox3 @@ -263,9 +259,8 @@ BoxAddressTable1: ; 4a810 dba sBox12 dba sBox13 dba sBox14 -; 4a83a -UpdateOTPointer: ; 0x4a83a +UpdateOTPointer: push hl ld hl, NAME_LENGTH add hl, bc @@ -273,4 +268,3 @@ UpdateOTPointer: ; 0x4a83a ld c, l pop hl ret -; 0x4a843 diff --git a/engine/pokemon/search2.asm b/engine/pokemon/search2.asm index b7112f1f8..7af93282e 100644 --- a/engine/pokemon/search2.asm +++ b/engine/pokemon/search2.asm @@ -1,18 +1,18 @@ -_FindPartyMonAboveLevel: ; 4dbd2 +_FindPartyMonAboveLevel: ld hl, wPartyMon1Level call FindAboveLevel ret -_FindPartyMonAtLeastThatHappy: ; 4dbd9 +_FindPartyMonAtLeastThatHappy: ld hl, wPartyMon1Happiness call FindAtLeastThatHappy ret -_FindPartyMonThatSpecies: ; 4dbe0 +_FindPartyMonThatSpecies: ld hl, wPartyMon1Species jp FindThatSpecies -_FindPartyMonThatSpeciesYourTrainerID: ; 4dbe6 +_FindPartyMonThatSpeciesYourTrainerID: ld hl, wPartyMon1Species call FindThatSpecies ret z @@ -35,7 +35,7 @@ _FindPartyMonThatSpeciesYourTrainerID: ; 4dbe6 xor a ret -FindAtLeastThatHappy: ; 4dc0a +FindAtLeastThatHappy: ; Sets the bits for the Pokemon that have a happiness greater than or equal to b. ; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy. ld c, $0 @@ -69,7 +69,7 @@ FindAtLeastThatHappy: ; 4dc0a and a ret -FindAboveLevel: ; 4dc31 +FindAboveLevel: ld c, $0 ld a, [wPartyCount] ld d, a @@ -98,7 +98,7 @@ FindAboveLevel: ; 4dc31 and a ret -FindThatSpecies: ; 4dc56 +FindThatSpecies: ; Find species b in your party. ; If you have no Pokemon, returns c = -1 and z. ; If that species is in your party, returns its location in c, and nz. @@ -116,7 +116,7 @@ FindThatSpecies: ; 4dc56 and a ret -RetroactivelyIgnoreEggs: ; 4dc67 +RetroactivelyIgnoreEggs: ld e, -2 ld hl, wPartySpecies .loop diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index 7e44cb96e..dfc704f1a 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -4,7 +4,7 @@ const BLUE_PAGE ; 3 NUM_STAT_PAGES EQU const_value + -1 -BattleStatsScreenInit: ; 4dc7b (13:5c7b) +BattleStatsScreenInit: ld a, [wLinkMode] cp LINK_MOBILE jr nz, StatsScreenInit @@ -14,15 +14,15 @@ BattleStatsScreenInit: ; 4dc7b (13:5c7b) jr z, StatsScreenInit jr _MobileStatsScreenInit -StatsScreenInit: ; 4dc8a +StatsScreenInit: ld hl, StatsScreenMain jr StatsScreenInit_gotaddress -_MobileStatsScreenInit: ; 4dc8f +_MobileStatsScreenInit: ld hl, StatsScreenMobile jr StatsScreenInit_gotaddress -StatsScreenInit_gotaddress: ; 4dc94 +StatsScreenInit_gotaddress: ld a, [hMapAnims] push af xor a @@ -56,9 +56,8 @@ StatsScreenInit_gotaddress: ; 4dc94 pop af ld [hMapAnims], a ret -; 0x4dcd2 -StatsScreenMain: ; 0x4dcd2 +StatsScreenMain: xor a ld [wJumptableIndex], a ; stupid interns @@ -67,7 +66,7 @@ StatsScreenMain: ; 0x4dcd2 and %11111100 or 1 ld [wcf64], a -.loop ; 4dce3 +.loop ld a, [wJumptableIndex] and $ff ^ (1 << 7) ld hl, StatsScreenPointerTable @@ -77,9 +76,8 @@ StatsScreenMain: ; 0x4dcd2 bit 7, a jr z, .loop ret -; 0x4dcf7 -StatsScreenMobile: ; 4dcf7 +StatsScreenMobile: xor a ld [wJumptableIndex], a ; stupid interns @@ -103,9 +101,8 @@ StatsScreenMobile: ; 4dcf7 .exit ret -; 4dd2a -StatsScreenPointerTable: ; 4dd2a +StatsScreenPointerTable: dw MonStatsInit ; regular pokémon dw EggStatsInit ; egg dw StatsScreenWaitCry @@ -114,10 +111,8 @@ StatsScreenPointerTable: ; 4dd2a dw StatsScreenWaitCry dw MonStatsJoypad dw StatsScreen_Exit -; 4dd3a - -StatsScreen_WaitAnim: ; 4dd3a (13:5d3a) +StatsScreen_WaitAnim: ld hl, wcf64 bit 6, [hl] jr nz, .try_anim @@ -137,19 +132,19 @@ StatsScreen_WaitAnim: ; 4dd3a (13:5d3a) farcall HDMATransferTileMapToWRAMBank3 ret -StatsScreen_SetJumptableIndex: ; 4dd62 (13:5d62) +StatsScreen_SetJumptableIndex: ld a, [wJumptableIndex] and $80 or h ld [wJumptableIndex], a ret -StatsScreen_Exit: ; 4dd6c (13:5d6c) +StatsScreen_Exit: ld hl, wJumptableIndex set 7, [hl] ret -MonStatsInit: ; 4dd72 (13:5d72) +MonStatsInit: ld hl, wcf64 res 6, [hl] call ClearBGPalettes @@ -171,16 +166,14 @@ MonStatsInit: ; 4dd72 (13:5d72) call StatsScreen_SetJumptableIndex ret -EggStatsInit: ; 4dda1 +EggStatsInit: call EggStatsScreen ld a, [wJumptableIndex] inc a ld [wJumptableIndex], a ret -; 0x4ddac - -EggStatsJoypad: ; 4ddac (13:5dac) +EggStatsJoypad: call StatsScreen_GetJoypad jr nc, .check ld h, 0 @@ -198,7 +191,7 @@ EggStatsJoypad: ; 4ddac (13:5dac) call StatsScreen_SetJumptableIndex ret -StatsScreen_LoadPage: ; 4ddc6 (13:5dc6) +StatsScreen_LoadPage: call StatsScreen_LoadGFX ld hl, wcf64 res 4, [hl] @@ -207,7 +200,7 @@ StatsScreen_LoadPage: ; 4ddc6 (13:5dc6) ld [wJumptableIndex], a ret -MonStatsJoypad: ; 4ddd6 (13:5dd6) +MonStatsJoypad: call StatsScreen_GetJoypad jr nc, .next ld h, 0 @@ -218,7 +211,7 @@ MonStatsJoypad: ; 4ddd6 (13:5dd6) and D_DOWN | D_UP | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON jp StatsScreen_JoypadAction -StatsScreenWaitCry: ; 4dde6 (13:5de6) +StatsScreenWaitCry: call IsSFXPlaying ret nc ld a, [wJumptableIndex] @@ -226,7 +219,7 @@ StatsScreenWaitCry: ; 4dde6 (13:5de6) ld [wJumptableIndex], a ret -StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2) +StatsScreen_CopyToTempMon: ld a, [wMonType] cp TEMPMON jr nz, .breedmon @@ -252,7 +245,7 @@ StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2) and a ret -StatsScreen_GetJoypad: ; 4de2c (13:5e2c) +StatsScreen_GetJoypad: call GetJoypad ld a, [wMonType] cp TEMPMON @@ -280,7 +273,7 @@ StatsScreen_GetJoypad: ; 4de2c (13:5e2c) scf ret -StatsScreen_JoypadAction: ; 4de54 (13:5e54) +StatsScreen_JoypadAction: push af ld a, [wcf64] maskbits NUM_STAT_PAGES @@ -374,12 +367,12 @@ StatsScreen_JoypadAction: ; 4de54 (13:5e54) call StatsScreen_SetJumptableIndex ret -.b_button ; 4dee4 (13:5ee4) +.b_button ld h, 7 call StatsScreen_SetJumptableIndex ret -StatsScreen_InitUpperHalf: ; 4deea (13:5eea) +StatsScreen_InitUpperHalf: call .PlaceHPBar xor a ld [hBGMapMode], a @@ -416,7 +409,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) call StatsScreen_PlaceShinyIcon ret -.PlaceHPBar: ; 4df45 (13:5f45) +.PlaceHPBar: ld hl, wTempMonHP ld a, [hli] ld b, a @@ -433,7 +426,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) call DelayFrame ret -.PlaceGenderChar: ; 4df66 (13:5f66) +.PlaceGenderChar: push hl farcall GetGender pop hl @@ -444,16 +437,14 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) .got_gender ld [hl], a ret -; 4df77 (13:5f77) -.NicknamePointers: ; 4df77 +.NicknamePointers: dw wPartyMonNicknames dw wOTPartyMonNicknames dw sBoxMonNicknames dw wBufferMonNick -; 4df7f -Unreferenced_Function4df7f: ; 4df7f +Unreferenced_Function4df7f: hlcoord 7, 0 ld bc, SCREEN_WIDTH ld d, SCREEN_HEIGHT @@ -464,9 +455,8 @@ Unreferenced_Function4df7f: ; 4df7f dec d jr nz, .loop ret -; 4df8f -StatsScreen_PlaceHorizontalDivider: ; 4df8f (13:5f8f) +StatsScreen_PlaceHorizontalDivider: hlcoord 0, 7 ld b, SCREEN_WIDTH ld a, $62 ; horizontal divider (empty HP/exp bar) @@ -476,14 +466,14 @@ StatsScreen_PlaceHorizontalDivider: ; 4df8f (13:5f8f) jr nz, .loop ret -StatsScreen_PlacePageSwitchArrows: ; 4df9b (13:5f9b) +StatsScreen_PlacePageSwitchArrows: hlcoord 12, 6 ld [hl], "◀" hlcoord 19, 6 ld [hl], "▶" ret -StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6) +StatsScreen_PlaceShinyIcon: ld bc, wTempMonDVs farcall CheckShininess ret nc @@ -491,7 +481,7 @@ StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6) ld [hl], "⁂" ret -StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) +StatsScreen_LoadGFX: ld a, [wBaseDexNo] ld [wd265], a ld [wCurSpecies], a @@ -510,7 +500,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) call StatsScreen_PlaceFrontpic ret -.ClearBox: ; 4dfda (13:5fda) +.ClearBox: ld a, [wcf64] maskbits NUM_STAT_PAGES ld c, a @@ -520,7 +510,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) call ClearBox ret -.LoadPals: ; 4dfed (13:5fed) +.LoadPals: ld a, [wcf64] maskbits NUM_STAT_PAGES ld c, a @@ -530,7 +520,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) set 5, [hl] ret -.PageTilemap: ; 4e002 (13:6002) +.PageTilemap: ld a, [wcf64] maskbits NUM_STAT_PAGES dec a @@ -538,13 +528,13 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) rst JumpTable ret -.Jumptable: ; 4e00d (13:600d) +.Jumptable: ; entries correspond to *_PAGE constants dw .PinkPage dw .GreenPage dw .BluePage -.PinkPage: ; 4e013 (13:6013) +.PinkPage: hlcoord 0, 9 ld b, $0 predef DrawPlayerHP @@ -624,7 +614,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [hl], $41 ; right exp bar end cap ret -.PrintNextLevel: ; 4e0d3 (13:60d3) +.PrintNextLevel: ld a, [wTempMonLevel] push af cp MAX_LEVEL @@ -637,7 +627,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [wTempMonLevel], a ret -.CalcExpToNextLevel: ; 4e0e7 (13:60e7) +.CalcExpToNextLevel: ld a, [wTempMonLevel] cp MAX_LEVEL jr z, .AlreadyAtMaxLevel @@ -666,34 +656,27 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [hli], a ld [hl], a ret -; 4e119 (13:6119) -.Status_Type: ; 4e119 +.Status_Type: db "STATUS/" next "TYPE/@" -; 4e127 -.OK_str: ; 4e127 +.OK_str: db "OK @" -; 4e12b -.ExpPointStr: ; 4e12b +.ExpPointStr: db "EXP POINTS@" -; 4e136 -.LevelUpStr: ; 4e136 +.LevelUpStr: db "LEVEL UP@" -; 4e13f -.ToStr: ; 4e13f +.ToStr: db "TO@" -; 4e142 -.PkrsStr: ; 4e142 +.PkrsStr: db "#RUS@" -; 4e147 -.GreenPage: ; 4e147 (13:6147) +.GreenPage: ld de, .Item hlcoord 0, 8 call PlaceString @@ -717,7 +700,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) predef ListMovePP ret -.GetItemName: ; 4e189 (13:6189) +.GetItemName: ld de, .ThreeDashes ld a, [wTempMonItem] and a @@ -728,21 +711,17 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [wd265], a call GetItemName ret -; 4e1a0 (13:61a0) -.Item: ; 4e1a0 +.Item: db "ITEM@" -; 4e1a5 -.ThreeDashes: ; 4e1a5 +.ThreeDashes: db "---@" -; 4e1a9 -.Move: ; 4e1a9 +.Move: db "MOVE@" -; 4e1ae -.BluePage: ; 4e1ae (13:61ae) +.BluePage: call .PlaceOTInfo hlcoord 10, 8 ld de, SCREEN_WIDTH @@ -758,7 +737,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) predef PrintTempMonStats ret -.PlaceOTInfo: ; 4e1cc (13:61cc) +.PlaceOTInfo: ld de, IDNoString hlcoord 0, 9 call PlaceString @@ -789,24 +768,20 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [hl], a .done ret -; 4e216 (13:6216) -.OTNamePointers: ; 4e216 +.OTNamePointers: dw wPartyMonOT dw wOTPartyMonOT dw sBoxMonOT dw wBufferMonOT -; 4e21e -IDNoString: ; 4e21e +IDNoString: db "<ID>№.@" -OTString: ; 4e222 +OTString: db "OT/@" -; 4e226 - -StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) +StatsScreen_PlaceFrontpic: ld hl, wTempMonDVs predef GetUnownLetter call StatsScreen_GetAnimationParam @@ -832,7 +807,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) call PlayMonCry2 ret -.AnimateMon: ; 4e253 (13:6253) +.AnimateMon: ld hl, wcf64 set 5, [hl] ld a, [wCurPartySpecies] @@ -849,7 +824,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) call _PrepMonFrontpic ret -.AnimateEgg: ; 4e271 (13:6271) +.AnimateEgg: ld a, [wCurPartySpecies] cp UNOWN jr z, .unownegg @@ -864,7 +839,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) call .get_animation ret -.get_animation ; 4e289 (13:6289) +.get_animation ld a, [wCurPartySpecies] call IsAPokemon ret c @@ -879,20 +854,20 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) set 6, [hl] ret -StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) +StatsScreen_GetAnimationParam: ld a, [wMonType] ld hl, .Jumptable rst JumpTable ret -.Jumptable: ; 4e2b5 (13:62b5) +.Jumptable: dw .PartyMon dw .OTPartyMon dw .BoxMon dw .Tempmon dw .Wildmon -.PartyMon: ; 4e2bf (13:62bf) +.PartyMon: ld a, [wCurPartyMon] ld hl, wPartyMon1 ld bc, PARTYMON_STRUCT_LENGTH @@ -901,11 +876,11 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) ld c, l jr .CheckEggFaintedFrzSlp -.OTPartyMon: ; 4e2cf (13:62cf) +.OTPartyMon: xor a ret -.BoxMon: ; 4e2d1 (13:62d1) +.BoxMon: ld hl, sBoxMons ld bc, PARTYMON_STRUCT_LENGTH ld a, [wCurPartyMon] @@ -920,11 +895,11 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) pop af ret -.Tempmon: ; 4e2ed (13:62ed) +.Tempmon: ld bc, wTempMonSpecies jr .CheckEggFaintedFrzSlp ; utterly pointless -.CheckEggFaintedFrzSlp: ; 4e2f2 (13:62f2) +.CheckEggFaintedFrzSlp: ld a, [wCurPartySpecies] cp EGG jr z, .egg @@ -935,16 +910,16 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) scf ret -.Wildmon: ; 4e301 (13:6301) +.Wildmon: ld a, $1 and a ret -.FaintedFrzSlp: ; 4e305 (13:6305) +.FaintedFrzSlp: xor a ret -StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307) +StatsScreen_LoadTextBoxSpaceGFX: nop push hl push de @@ -966,14 +941,12 @@ StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307) pop de pop hl ret -; 4e32a (13:632a) -Unreferenced_4e32a: ; 4e32a +Unreferenced_4e32a: ; A blank space tile? ds 16 -; 4e33a -EggStatsScreen: ; 4e33a +EggStatsScreen: xor a ld [hBGMapMode], a ld hl, wCurHPPal @@ -1025,38 +998,35 @@ EggStatsScreen: ; 4e33a ld de, SFX_2_BOOPS call PlaySFX ret -; 0x4e3c0 -EggString: ; 4e3c0 +EggString: db "EGG@" -FiveQMarkString: ; 4e3c4 +FiveQMarkString: db "?????@" -EggSoonString: ; 0x4e3ca +EggSoonString: db "It's making sounds" next "inside. It's going" next "to hatch soon!@" -EggCloseString: ; 0x4e3fd +EggCloseString: db "It moves around" next "inside sometimes." next "It must be close" next "to hatching.@" -EggMoreTimeString: ; 0x4e43d +EggMoreTimeString: db "Wonder what's" next "inside? It needs" next "more time, though.@" -EggALotMoreTimeString: ; 0x4e46e +EggALotMoreTimeString: db "This EGG needs a" next "lot more time to" next "hatch.@" -; 0x4e497 - -StatsScreen_AnimateEgg: ; 4e497 (13:6497) +StatsScreen_AnimateEgg: call StatsScreen_GetAnimationParam ret nc ld a, [wTempMonHappiness] @@ -1083,7 +1053,7 @@ StatsScreen_AnimateEgg: ; 4e497 (13:6497) set 6, [hl] ret -StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) +StatsScreen_LoadPageIndicators: hlcoord 13, 5 ld a, $36 ; first of 4 small square tiles call .load_square @@ -1101,7 +1071,7 @@ StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) hlcoord 15, 5 ; GREEN_PAGE (= GREEN_PAGE) jr z, .load_square hlcoord 17, 5 ; BLUE_PAGE (> GREEN_PAGE) -.load_square ; 4e4f7 (13:64f7) +.load_square push bc ld [hli], a inc a @@ -1115,7 +1085,7 @@ StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) pop bc ret -CopyNickname: ; 4e505 (13:6505) +CopyNickname: ld de, wStringBuffer1 ld bc, MON_NAME_LENGTH jr .okay ; utterly pointless @@ -1137,7 +1107,7 @@ CopyNickname: ; 4e505 (13:6505) pop de ret -GetNicknamePointer: ; 4e528 (13:6528) +GetNicknamePointer: ld a, [wMonType] add a ld c, a @@ -1152,8 +1122,7 @@ GetNicknamePointer: ; 4e528 (13:6528) ld a, [wCurPartyMon] jp SkipNames - -CheckFaintedFrzSlp: ; 4e53f +CheckFaintedFrzSlp: ld hl, MON_HP add hl, bc ld a, [hli] @@ -1170,4 +1139,3 @@ CheckFaintedFrzSlp: ; 4e53f .fainted_frz_slp scf ret -; 4e554 diff --git a/engine/pokemon/switchpartymons.asm b/engine/pokemon/switchpartymons.asm index b01178417..d612a3472 100644 --- a/engine/pokemon/switchpartymons.asm +++ b/engine/pokemon/switchpartymons.asm @@ -16,7 +16,7 @@ _SwitchPartyMons: .skip ret -.ClearSprite: ; 50f34 (14:4f34) +.ClearSprite: push af hlcoord 0, 1 ld bc, 2 * SCREEN_WIDTH @@ -39,7 +39,7 @@ _SwitchPartyMons: call WaitPlaySFX ret -.SwapMonAndMail: ; 50f62 (14:4f62) +.SwapMonAndMail: push hl push de push bc @@ -136,10 +136,10 @@ _SwitchPartyMons: pop hl ret -.CopyNameTowd002: ; 51036 (14:5036) +.CopyNameTowd002: ld de, wd002 -.CopyName: ; 51039 (14:5039) +.CopyName: ld bc, NAME_LENGTH call CopyBytes ret diff --git a/engine/pokemon/tempmon.asm b/engine/pokemon/tempmon.asm index 723bfb1dd..4547a02b9 100644 --- a/engine/pokemon/tempmon.asm +++ b/engine/pokemon/tempmon.asm @@ -1,4 +1,4 @@ -CopyMonToTempMon: ; 5084a +CopyMonToTempMon: ; gets the BaseData of a mon ; and copies the party_struct to wTempMon @@ -32,13 +32,13 @@ CopyMonToTempMon: ; 5084a .done ret -CalcBufferMonStats: ; 5088b +CalcBufferMonStats: ld bc, wBufferMon jr _TempMonStatsCalculation -CalcTempmonStats: ; 50890 +CalcTempmonStats: ld bc, wTempMon -_TempMonStatsCalculation: ; 50893 +_TempMonStatsCalculation: ld hl, MON_LEVEL add hl, bc ld a, [hl] @@ -82,7 +82,7 @@ _TempMonStatsCalculation: ; 50893 ld [hl], a ret -GetMonSpecies: ; 508d5 +GetMonSpecies: ; [wMonType] has the type of the mon ; e = Nr. of mon (i.e. [wCurPartyMon]) diff --git a/engine/pokemon/types.asm b/engine/pokemon/types.asm index dc0df61ae..4e2ca3e45 100644 --- a/engine/pokemon/types.asm +++ b/engine/pokemon/types.asm @@ -1,4 +1,4 @@ -PrintMonTypes: ; 5090d +PrintMonTypes: ; Print one or both types of [wCurSpecies] ; on the stats screen at hl. @@ -37,10 +37,8 @@ PrintMonTypes: ; 5090d add hl, bc ld bc, NAME_LENGTH_JAPANESE - 1 jp ByteFill -; 5093a - -PrintMoveType: ; 5093a +PrintMoveType: ; Print the type of move b at hl. push hl @@ -57,8 +55,7 @@ PrintMoveType: ; 5093a ld b, a - -PrintType: ; 50953 +PrintType: ; Print type b at hl. ld a, b @@ -75,10 +72,8 @@ PrintType: ; 50953 pop hl jp PlaceString -; 50964 - -GetTypeName: ; 50964 +GetTypeName: ; Copy the name of type [wd265] to wStringBuffer1. ld a, [wd265] @@ -93,7 +88,5 @@ GetTypeName: ; 50964 ld de, wStringBuffer1 ld bc, MOVE_NAME_LENGTH jp CopyBytes -; 5097b - INCLUDE "data/types/names.asm" |