diff options
| author | dannye <33dannye@gmail.com> | 2020-11-04 00:06:44 -0600 |
|---|---|---|
| committer | dannye <33dannye@gmail.com> | 2020-11-04 00:06:44 -0600 |
| commit | 5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch) | |
| tree | dde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /engine/menu | |
| parent | Merge pull request #55 from Deokishisu/patch-1 (diff) | |
| download | pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.gz pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.xz pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.zip | |
Sync with pokered
Diffstat (limited to '')
| -rw-r--r-- | engine/events/diploma.asm (renamed from engine/menu/diploma.asm) | 4 | ||||
| -rwxr-xr-x | engine/events/prize_menu.asm (renamed from engine/menu/prize_menu.asm) | 90 | ||||
| -rwxr-xr-x | engine/events/vending_machine.asm (renamed from engine/menu/vending_machine.asm) | 52 | ||||
| -rw-r--r-- | engine/menu/link_menu.asm | 910 | ||||
| -rwxr-xr-x | engine/menu/oaks_pc.asm | 28 | ||||
| -rwxr-xr-x | engine/menu/party_menu.asm | 333 | ||||
| -rw-r--r-- | engine/menu/text_box.asm | 739 | ||||
| -rw-r--r-- | engine/menus/display_text_id_init.asm | 76 | ||||
| -rw-r--r-- | engine/menus/draw_badges.asm (renamed from engine/menu/draw_badges.asm) | 14 | ||||
| -rw-r--r-- | engine/menus/draw_start_menu.asm (renamed from engine/menu/draw_start_menu.asm) | 10 | ||||
| -rwxr-xr-x | engine/menus/league_pc.asm (renamed from engine/menu/league_pc.asm) | 24 | ||||
| -rw-r--r-- | engine/menus/link_menu.asm | 910 | ||||
| -rwxr-xr-x | engine/menus/main_menu.asm (renamed from engine/menu/main_menu.asm) | 67 | ||||
| -rwxr-xr-x | engine/menus/naming_screen.asm (renamed from engine/menu/naming_screen.asm) | 76 | ||||
| -rwxr-xr-x | engine/menus/oaks_pc.asm | 28 | ||||
| -rw-r--r-- | engine/menus/options.asm (renamed from engine/menu/options.asm) | 40 | ||||
| -rwxr-xr-x | engine/menus/party_menu.asm | 314 | ||||
| -rwxr-xr-x | engine/menus/pc.asm (renamed from engine/menu/pc.asm) | 40 | ||||
| -rwxr-xr-x | engine/menus/players_pc.asm (renamed from engine/menu/players_pc.asm) | 62 | ||||
| -rwxr-xr-x | engine/menus/pokedex.asm (renamed from engine/menu/pokedex.asm) | 160 | ||||
| -rwxr-xr-x | engine/menus/save.asm (renamed from engine/save.asm) | 76 | ||||
| -rwxr-xr-x | engine/menus/start_sub_menus.asm (renamed from engine/menu/start_sub_menus.asm) | 210 | ||||
| -rw-r--r-- | engine/menus/swap_items.asm (renamed from engine/menu/swap_items.asm) | 10 | ||||
| -rw-r--r-- | engine/menus/text_box.asm | 533 | ||||
| -rw-r--r-- | engine/pokemon/bills_pc.asm (renamed from engine/menu/bills_pc.asm) | 157 | ||||
| -rwxr-xr-x | engine/pokemon/status_screen.asm (renamed from engine/menu/status_screen.asm) | 151 | ||||
| -rwxr-xr-x | home/start_menu.asm (renamed from engine/menu/start_menu.asm) | 8 |
27 files changed, 2449 insertions, 2673 deletions
diff --git a/engine/menu/diploma.asm b/engine/events/diploma.asm index 3f309bd2..a5a007fa 100644 --- a/engine/menu/diploma.asm +++ b/engine/events/diploma.asm @@ -1,4 +1,4 @@ -DisplayDiploma: +DisplayDiploma:: call SaveScreenTilesToBuffer2 call GBPalWhiteOutWithDelay3 call ClearScreen @@ -6,7 +6,7 @@ DisplayDiploma: ld [wUpdateSpritesEnabled], a ld hl, wd730 set 6, [hl] - callab _DisplayDiploma + callfar _DisplayDiploma call WaitForTextScrollButtonPress ld hl, wd730 res 6, [hl] diff --git a/engine/menu/prize_menu.asm b/engine/events/prize_menu.asm index 405441c8..87244119 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -1,4 +1,4 @@ -CeladonPrizeMenu: +CeladonPrizeMenu:: ld b, COIN_CASE call IsItemInBag jr nz, .havingCoinCase @@ -22,7 +22,7 @@ CeladonPrizeMenu: ld a, $01 ld [wTopMenuItemX], a call PrintPrizePrice - coord hl, 0, 2 + hlcoord 0, 2 lb bc, 8, 16 call TextBoxBorder call GetPrizeMenuId @@ -42,17 +42,17 @@ CeladonPrizeMenu: ret RequireCoinCaseTextPtr: - TX_FAR _RequireCoinCaseText - TX_WAIT - db "@" + text_far _RequireCoinCaseText + text_waitbutton + text_end ExchangeCoinsForPrizesTextPtr: - TX_FAR _ExchangeCoinsForPrizesText - db "@" + text_far _ExchangeCoinsForPrizesText + text_end WhichPrizeTextPtr: - TX_FAR _WhichPrizeText - db "@" + text_far _WhichPrizeText + text_end GetPrizeMenuId: ; determine which one among the three @@ -63,7 +63,7 @@ GetPrizeMenuId: ; display the three prizes' names ; (distinguishing between Pokemon names ; and Items (specifically TMs) names) - ld a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndexOrTextID] sub 3 ; prize-texts' id are 3, 4 and 5 ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2) add a @@ -92,75 +92,73 @@ GetPrizeMenuId: ld a, [wPrize1] ld [wd11e], a call GetItemName - coord hl, 2, 4 + hlcoord 2, 4 call PlaceString ld a, [wPrize2] ld [wd11e], a call GetItemName - coord hl, 2, 6 + hlcoord 2, 6 call PlaceString ld a, [wPrize3] ld [wd11e], a call GetItemName - coord hl, 2, 8 + hlcoord 2, 8 call PlaceString jr .putNoThanksText .putMonName ld a, [wPrize1] ld [wd11e], a call GetMonName - coord hl, 2, 4 + hlcoord 2, 4 call PlaceString ld a, [wPrize2] ld [wd11e], a call GetMonName - coord hl, 2, 6 + hlcoord 2, 6 call PlaceString ld a, [wPrize3] ld [wd11e], a call GetMonName - coord hl, 2, 8 + hlcoord 2, 8 call PlaceString .putNoThanksText - coord hl, 2, 10 + hlcoord 2, 10 ld de, NoThanksText call PlaceString ; put prices on the right side of the textbox ld de, wPrize1Price - coord hl, 13, 5 + hlcoord 13, 5 ; reg. c: ; [low nybble] number of bytes -; [bit 765 = %100] space-padding (not zero-padding) +; [bits 765 = %100] space-padding (not zero-padding) ld c, (1 << 7 | 2) -; Function $15CD displays BCD value (same routine -; used by text-command $02) call PrintBCDNumber ld de, wPrize2Price - coord hl, 13, 7 + hlcoord 13, 7 ld c, (1 << 7 | 2) call PrintBCDNumber ld de, wPrize3Price - coord hl, 13, 9 + hlcoord 13, 9 ld c, (1 << 7 | 2) jp PrintBCDNumber NoThanksText: db "NO THANKS@" -INCLUDE "data/prizes.asm" +INCLUDE "data/events/prizes.asm" PrintPrizePrice: - coord hl, 11, 0 + hlcoord 11, 0 lb bc, 1, 7 call TextBoxBorder call UpdateSprites - coord hl, 12, 0 + hlcoord 12, 0 ld de, .CoinString call PlaceString - coord hl, 13, 1 + hlcoord 13, 1 ld de, .SixSpacesString call PlaceString - coord hl, 13, 1 + hlcoord 13, 1 ld de, wPlayerCoins ld c, %10000010 call PrintBCDNumber @@ -180,11 +178,11 @@ LoadCoinsToSubtract: ld hl, wPrize1Price add hl, de ; get selected prize's price xor a - ld [hUnusedCoinsByte], a + ldh [hUnusedCoinsByte], a ld a, [hli] - ld [hCoins], a + ldh [hCoins], a ld a, [hl] - ld [hCoins + 1], a + ldh [hCoins + 1], a ret HandlePrizeChoice: @@ -266,28 +264,28 @@ UnknownPrizeData: db $00,$01,$00,$01,$00,$01,$00,$00,$01 HereYouGoTextPtr: - TX_FAR _HereYouGoText - TX_WAIT - db "@" + text_far _HereYouGoText + text_waitbutton + text_end SoYouWantPrizeTextPtr: - TX_FAR _SoYouWantPrizeText - db "@" + text_far _SoYouWantPrizeText + text_end SorryNeedMoreCoinsText: - TX_FAR _SorryNeedMoreCoinsText - TX_WAIT - db "@" + text_far _SorryNeedMoreCoinsText + text_waitbutton + text_end PrizeRoomBagIsFullTextPtr: - TX_FAR _OopsYouDontHaveEnoughRoomText - TX_WAIT - db "@" + text_far _OopsYouDontHaveEnoughRoomText + text_waitbutton + text_end OhFineThenTextPtr: - TX_FAR _OhFineThenText - TX_WAIT - db "@" + text_far _OhFineThenText + text_waitbutton + text_end GetPrizeMonLevel: ld a, [wcf91] @@ -304,4 +302,4 @@ GetPrizeMonLevel: ld [wCurEnemyLVL], a ret -INCLUDE "data/prize_mon_levels.asm" +INCLUDE "data/events/prize_mon_levels.asm" diff --git a/engine/menu/vending_machine.asm b/engine/events/vending_machine.asm index 37d9b9e7..6ff6a5e4 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/events/vending_machine.asm @@ -1,4 +1,4 @@ -VendingMachineMenu: +VendingMachineMenu:: ld hl, VendingMachineText1 call PrintText ld a, MONEY_BOX @@ -17,14 +17,14 @@ VendingMachineMenu: ld [wTopMenuItemX], a ld hl, wd730 set 6, [hl] - coord hl, 0, 3 + hlcoord 0, 3 lb bc, 8, 12 call TextBoxBorder call UpdateSprites - coord hl, 2, 5 + hlcoord 2, 5 ld de, DrinkText call PlaceString - coord hl, 9, 6 + hlcoord 9, 6 ld de, DrinkPriceText call PlaceString ld hl, wd730 @@ -36,17 +36,17 @@ VendingMachineMenu: cp 3 ; chose Cancel? jr z, .notThirsty xor a - ld [hMoney], a - ld [hMoney + 2], a + ldh [hMoney], a + ldh [hMoney + 2], a ld a, $2 - ld [hMoney + 1], a + ldh [hMoney + 1], a call HasEnoughMoney jr nc, .enoughMoney ld hl, VendingMachineText4 jp PrintText .enoughMoney call LoadVendingMachineItem - ld a, [hVendingMachineItem] + ldh a, [hVendingMachineItem] ld b, a ld c, 1 call GiveItem @@ -80,8 +80,8 @@ VendingMachineMenu: jp PrintText VendingMachineText1: - TX_FAR _VendingMachineText1 - db "@" + text_far _VendingMachineText1 + text_end DrinkText: db "FRESH WATER" @@ -96,20 +96,20 @@ DrinkPriceText: next "@" VendingMachineText4: - TX_FAR _VendingMachineText4 - db "@" + text_far _VendingMachineText4 + text_end VendingMachineText5: - TX_FAR _VendingMachineText5 - db "@" + text_far _VendingMachineText5 + text_end VendingMachineText6: - TX_FAR _VendingMachineText6 - db "@" + text_far _VendingMachineText6 + text_end VendingMachineText7: - TX_FAR _VendingMachineText7 - db "@" + text_far _VendingMachineText7 + text_end LoadVendingMachineItem: ld hl, VendingPrices @@ -120,19 +120,13 @@ LoadVendingMachineItem: ld e, a add hl, de ld a, [hli] - ld [hVendingMachineItem], a + ldh [hVendingMachineItem], a ld a, [hli] - ld [hVendingMachinePrice], a + ldh [hVendingMachinePrice], a ld a, [hli] - ld [hVendingMachinePrice + 1], a + ldh [hVendingMachinePrice + 1], a ld a, [hl] - ld [hVendingMachinePrice + 2], a + ldh [hVendingMachinePrice + 2], a ret -VendingPrices: - db FRESH_WATER - money 200 - db SODA_POP - money 300 - db LEMONADE - money 350 +INCLUDE "data/items/vending_prices.asm" diff --git a/engine/menu/link_menu.asm b/engine/menu/link_menu.asm deleted file mode 100644 index 9bc28b31..00000000 --- a/engine/menu/link_menu.asm +++ /dev/null @@ -1,910 +0,0 @@ -Func_f531b:: - ld c,$14 - call DelayFrames - ld a,$1 - ld [wBuffer],a - xor a - ld [wUnknownSerialFlag_d499],a - coord hl, 0,0 - lb bc, 4, 5 - call TextBoxBorder - ld de,Text_f5791 - coord hl, 1,2 - call PlaceString - coord hl, 8,0 - lb bc, 8, 10 - call TextBoxBorder - coord hl, 10,2 - ld de,Text_f579c - call PlaceString - coord hl, 0,10 - lb bc, 6, 18 - call TextBoxBorder - call UpdateSprites - xor a - ld [wUnusedCD37],a - ld [wd72d],a - ld [wd11e],a - ld hl,wTopMenuItemY - ld a,$2 - ld [hli],a - ld a,$9 - ld [hli],a - xor a - ld [hli],a - inc hl - ld a,$3 - ld [hli],a - ld a,$3 - ld [hli],a - xor a - ld [hl],a -.asm_f5377 - call Func_f56bd - call HandleMenuInput - and $3 - add a - add a - ld b,a - ld a,[wCurrentMenuItem] - cp $3 - jr nz,.asm_f5390 - bit 2,b - jr z,.asm_f5390 - dec a - ld b,$8 -.asm_f5390 - add b - add $c0 - ld [wLinkMenuSelectionSendBuffer],a - ld [wLinkMenuSelectionSendBuffer+1],a -.asm_f5399 - ld hl,wLinkMenuSelectionSendBuffer - ld a,[hl] - ld [hSerialSendData],a - call Serial_ExchangeByte - push af - ld hl,wLinkMenuSelectionSendBuffer - ld a,[hl] - ld [hSerialSendData],a - call Serial_ExchangeByte - pop bc - cp b - jr nz,.asm_f5399 - and $f0 - cp $c0 - jr nz,.asm_f5399 - ld a,b - and $c - jr nz,.asm_f53c4 - ld a,[wLinkMenuSelectionSendBuffer] - and $c - jr z,.asm_f5377 - jr .asm_f53df -.asm_f53c4 - ld a,[wLinkMenuSelectionSendBuffer] - and $c - jr z,.asm_f53d1 - ld a,[hSerialConnectionStatus] - cp $2 - jr z,.asm_f53df -.asm_f53d1 - ld a,$1 - ld [wd11e],a - ld a,b - ld [wLinkMenuSelectionSendBuffer],a - and $3 - ld [wCurrentMenuItem],a -.asm_f53df - call DelayFrame - call DelayFrame - ld hl,wLinkMenuSelectionSendBuffer - ld a,[hl] - ld [hSerialSendData],a - call Serial_ExchangeByte - call Serial_ExchangeByte - ld b,$14 -.loop - call DelayFrame - call Serial_SendZeroByte - dec b - jr nz,.loop - ld b,$7f - ld c,$7f - ld d,$7f - ld e,$ec - ld a,[wLinkMenuSelectionSendBuffer] - bit 3,a - jr nz,.asm_f541a - ld b,e - ld e,c - ld a,[wCurrentMenuItem] - and a - jr z,.asm_f541a - ld c,b - ld b,d - dec a - jr z,.asm_f541a - ld d,c - ld c,b -.asm_f541a - ld a,b - Coorda 9,2 - ld a,c - Coorda 9,4 - ld a,d - Coorda 9,6 - ld a,e - Coorda 9,8 - ld c,40 - call DelayFrames - ld a,[wLinkMenuSelectionSendBuffer] - bit 3,a - jr nz,asm_f547f - ld a,[wCurrentMenuItem] - cp $3 - jr z,asm_f547f - inc a - ld [wUnknownSerialFlag_d499],a - ld a,[wCurrentMenuItem] - ld hl,PointerTable_f5488 - ld c,a - ld b,$0 - add hl,bc - add hl,bc - ld a,[hli] - ld h,[hl] - ld l,a - ld de,.returnaddress - push de - jp hl -.returnaddress - ld [wLinkMenuSelectionSendBuffer],a - xor a - ld [wUnknownSerialCounter],a - ld [wUnknownSerialCounter+1],a - call Serial_SyncAndExchangeNybble - ld a,[wLinkMenuSelectionSendBuffer] - and a - jr nz,asm_f547c - ld a, [wLinkMenuSelectionReceiveBuffer] - and a - jr nz, Func_f5476 - xor a - ld [wUnknownSerialCounter],a - ld [wUnknownSerialCounter+1],a - and a - ret - -Func_f5476:: - ld hl,ColosseumIneligibleText - call PrintText -asm_f547c:: - jp Func_f531b - -asm_f547f:: - xor a - ld [wUnknownSerialCounter],a - ld [wUnknownSerialCounter+1],a - scf - ret - -PointerTable_f5488:: - dw PokeCup - dw PikaCup - dw PetitCup - -PokeCup:: - ld hl,wPartyCount - ld a,[hli] - cp $3 - jp nz,NotThreeMonsInParty - ld b,$3 -.loop - ld a,[hli] - cp MEW - jp z,MewInParty - dec b - jr nz,.loop - dec hl - dec hl - cp [hl] ; is third mon second mon? - jp z,DuplicateSpecies - dec hl ; wPartySpecies - cp [hl] ; is third mon first mon? - jp z,DuplicateSpecies - ld a,[hli] - cp [hl] ; is first mon second mon? - jp z,DuplicateSpecies - ld a,[wPartyMon1Level] - cp 56 - jp nc,LevelAbove55 - cp 50 - jp c,LevelUnder50 - ld b,a - ld a,[wPartyMon2Level] - cp 56 - jp nc,LevelAbove55 - cp 50 - jp c,LevelUnder50 - ld c,a - ld a,[wPartyMon3Level] - cp 56 - jp nc,LevelAbove55 - cp 50 - jp c,LevelUnder50 - add b - add c - cp 156 - jp nc,CombinedLevelsGreaterThan155 - xor a - ret - -PikaCup:: - ld hl,wPartyCount - ld a,[hli] - cp $3 - jp nz,NotThreeMonsInParty - ld b,$3 -.loop - ld a,[hli] ; wPartySpecies - cp MEW - jp z,MewInParty - dec b - jr nz,.loop - dec hl - dec hl - cp [hl] ; is third mon second mon? - jp z,DuplicateSpecies - dec hl ; wPartySpecies - cp [hl] ; is third mon first mon? - jp z,DuplicateSpecies - ld a,[hli] - cp [hl] ; is first mon second mon? - jp z,DuplicateSpecies - ld a,[wPartyMon1Level] - cp 21 - jp nc,LevelAbove20 - cp 15 - jp c,LevelUnder15 - ld b,a - ld a,[wPartyMon2Level] - cp 21 - jp nc,LevelAbove20 - cp 15 - jp c,LevelUnder15 - ld c,a - ld a,[wPartyMon3Level] - cp 21 - jp nc,LevelAbove20 - cp 15 - jp c,LevelUnder15 - add b - add c - cp 51 - jp nc,CombinedLevelsAbove50 - xor a - ret - -PetitCup:: - ld hl,wPartyCount - ld a,[hli] - cp $3 - jp nz,NotThreeMonsInParty - ld b,$3 -.loop - ld a,[hli] - cp MEW - jp z,MewInParty - dec b - jr nz,.loop - dec hl - dec hl - cp [hl] ; is third mon second mon? - jp z,DuplicateSpecies - dec hl ; wPartySpecies - cp [hl] ; is third mon first mon? - jp z,DuplicateSpecies - ld a,[hli] - cp [hl] ; is first mon second mon? - jp z,DuplicateSpecies - dec hl - ld a,[hl] - ld [wcf91],a - push hl - callab Func_3b10f - pop hl - jp c,asm_f56ad - inc hl - ld a,[hl] - ld [wcf91],a - push hl - callab Func_3b10f - pop hl - jp c,asm_f56ad - inc hl - ld a,[hl] - ld [wcf91],a - push hl - callab Func_3b10f - pop hl - jp c,asm_f56ad - dec hl - dec hl - ld b,$3 -.bigloop - ld a,[hli] - push hl - push bc - push af - dec a - ld c,a - ld b,$0 - ld hl,PokedexEntryPointers - add hl,bc - add hl,bc - ld de,wcd6d - ld bc,$2 - ld a,BANK(PokedexEntryPointers) - call FarCopyData - ld hl,wcd6d - ld a,[hli] - ld h,[hl] - ld l,a - ld de,wcd6d - ld bc,$14 - ld a,BANK(PokedexEntryPointers) - call FarCopyData - ld hl,wcd6d -.loop2 - ld a,[hli] - cp "@" - jr nz,.loop2 - ld a,[hli] - cp $7 - jp nc,asm_f5689 - add a - add a - ld b,a - add a - add b - ld b,a - ld a,[hli] - add b - cp $51 - jp nc,asm_f5689 - ld a,[hli] - sub $b9 - ld a,[hl] - sbc $1 - jp nc,asm_f569b - pop af - pop bc - pop hl - dec b - jr nz,.bigloop - ld a,[wPartyMon1Level] - cp 31 - jp nc,LevelAbove30 - cp 25 - jp c,LevelUnder25 - ld b,a - ld a,[wPartyMon2Level] - cp 31 - jp nc,LevelAbove30 - cp 25 - jp c,LevelUnder25 - ld c,a - ld a,[wPartyMon3Level] - cp 31 - jp nc,LevelAbove30 - cp 25 - jp c,LevelUnder25 - add b - add c - cp 81 - jp nc,CombinedLevelsAbove80 - xor a - ret - -NotThreeMonsInParty:: - ld hl,Colosseum3MonsText - call PrintText - ld a,$1 - ret - -MewInParty:: - ld hl,ColosseumMewText - call PrintText - ld a,$2 - ret - -DuplicateSpecies:: - ld hl,ColosseumDifferentMonsText - call PrintText - ld a,$3 - ret - -LevelAbove55:: - ld hl,ColosseumMaxL55Text - call PrintText - ld a,$4 - ret - -LevelUnder50:: - ld hl,ColosseumMinL50Text - call PrintText - ld a,$5 - ret - -CombinedLevelsGreaterThan155:: - ld hl,ColosseumTotalL155Text - call PrintText - ld a,$6 - ret - -LevelAbove30:: - ld hl,ColosseumMaxL30Text - call PrintText - ld a,$7 - ret - -LevelUnder25:: - ld hl,ColosseumMinL25Text - call PrintText - ld a,$8 - ret - -CombinedLevelsAbove80:: - ld hl,ColosseumTotalL80Text - call PrintText - ld a,$9 - ret - -LevelAbove20:: - ld hl,ColosseumMaxL20Text - call PrintText - ld a,$a - ret - -LevelUnder15:: - ld hl,ColosseumMinL15Text - call PrintText - ld a,$b - ret - -CombinedLevelsAbove50:: - ld hl,ColosseumTotalL50Text - call PrintText - ld a,$c - ret - -asm_f5689:: - pop af - pop bc - pop hl - ld [wd11e],a - call GetMonName - ld hl,ColosseumHeightText - call PrintText - ld a,$d - ret - -asm_f569b:: - pop af - pop bc - pop hl - ld [wd11e],a - call GetMonName - ld hl,ColosseumWeightText - call PrintText - ld a,$e - ret - -asm_f56ad:: - ld a,[hl] - ld [wd11e],a - call GetMonName - ld hl,ColosseumEvolvedText - call PrintText - ld a,$f - ret - -Func_f56bd:: - xor a - ld [H_AUTOBGTRANSFERENABLED],a - coord hl, 1,11 - lb bc, 6, 18 - call ClearScreenArea - ld a,[wCurrentMenuItem] - cp $3 - jr nc,.asm_f56e6 - ld hl,PointerTable_f56ee - ld a,[wCurrentMenuItem] - ld c,a - ld b,$0 - add hl,bc - add hl,bc - ld a,[hli] - ld h,[hl] - ld l,a - ld d,h - ld e,l - coord hl, 1,12 - call PlaceString -.asm_f56e6 - call Delay3 - ld a,$1 - ld [H_AUTOBGTRANSFERENABLED],a - ret - -PointerTable_f56ee:: - dw Text_f56f4 - dw Text_f5728 - dw Text_f575b - -Text_f56f4:: - db "LVs of 3<pkmn>:50-55" - next "Sum of LVs:155 MAX" - next "MEW can't attend.@" - -Text_f5728:: - db "LVs of 3<pkmn>:15-20" - next "Sum of LVs:50 MAX" - next "MEW can't attend.@" - -Text_f575b:: - db "3 Basic <pkmn>.LV25-30" - next "Sum of LVs:80 MAX" - next "6′8″ and 44lb MAX@" - -Text_f5791:: - db "View" - next "Rules@" - -Text_f579c:: - db "# Cup" - next "Pika Cup" - next "Petit Cup" - next "CANCEL@" - -Colosseum3MonsText:: - TX_FAR _Colosseum3MonsText - db "@" - -ColosseumMewText:: - TX_FAR _ColosseumMewText - db "@" - -ColosseumDifferentMonsText:: - TX_FAR _ColosseumDifferentMonsText - db "@" - -ColosseumMaxL55Text:: - TX_FAR _ColosseumMaxL55Text - db "@" - -ColosseumMinL50Text:: - TX_FAR _ColosseumMinL50Text - db "@" - -ColosseumTotalL155Text:: - TX_FAR _ColosseumTotalL155Text - db "@" - -ColosseumMaxL30Text:: - TX_FAR _ColosseumMaxL30Text - db "@" - -ColosseumMinL25Text:: - TX_FAR _ColosseumMinL25Text - db "@" - -ColosseumTotalL80Text:: - TX_FAR _ColosseumTotalL80Text - db "@" - -ColosseumMaxL20Text:: - TX_FAR _ColosseumMaxL20Text - db "@" - -ColosseumMinL15Text:: - TX_FAR _ColosseumMinL15Text - db "@" - -ColosseumTotalL50Text:: - TX_FAR _ColosseumTotalL50Text - db "@" - -ColosseumHeightText:: - TX_FAR _ColosseumHeightText - db "@" - -ColosseumWeightText:: - TX_FAR _ColosseumWeightText - db "@" - -ColosseumEvolvedText:: - TX_FAR _ColosseumEvolvedText - db "@" - -ColosseumIneligibleText:: - TX_FAR _ColosseumIneligibleText - db "@" - -LinkMenu: - xor a - ld [wLetterPrintingDelayFlags], a - ld hl, wd72e - set 6, [hl] - ld hl, TextTerminator_f5a16 - call PrintText - call SaveScreenTilesToBuffer1 - ld hl, ColosseumWhereToText - call PrintText - coord hl, 5, 3 - lb bc, 8, 13 - call TextBoxBorder - call UpdateSprites - coord hl, 7, 5 - ld de, TradeCenterText - call PlaceString - xor a - ld [wUnusedCD37], a - ld [wd72d], a - ld [wd11e], a - ld hl, wTopMenuItemY - ld a, $5 - ld [hli], a - ld a, $6 - ld [hli], a - xor a - ld [hli], a - inc hl - ld a, $3 - ld [hli], a - ld [hli], a - xor a - ld [hl], a -.waitForInputLoop - call HandleMenuInput - and A_BUTTON | B_BUTTON - add a - add a - ld b, a - ld a, [wCurrentMenuItem] - cp $3 - jr nz,.asm_f586b - bit 2,b - jr z,.asm_f586b - dec a - ld b,$8 -.asm_f586b - add b - add $d0 - ld [wLinkMenuSelectionSendBuffer], a - ld [wLinkMenuSelectionSendBuffer + 1], a -.exchangeMenuSelectionLoop - call Serial_ExchangeLinkMenuSelection - ld a, [wLinkMenuSelectionReceiveBuffer] - ld b, a - and $f0 - cp $d0 - jr z, .asm_f5c7d - ld a, [wLinkMenuSelectionReceiveBuffer + 1] - ld b, a - and $f0 - cp $d0 - jr nz, .exchangeMenuSelectionLoop -.asm_f5c7d - ld a, b - and $c ; did the enemy press A or B? - jr nz, .enemyPressedAOrB -; the enemy didn't press A or B - ld a, [wLinkMenuSelectionSendBuffer] - and $c ; did the player press A or B? - jr z, .waitForInputLoop ; if neither the player nor the enemy pressed A or B, try again - jr .doneChoosingMenuSelection ; if the player pressed A or B but the enemy didn't, use the player's selection -.enemyPressedAOrB - ld a, [wLinkMenuSelectionSendBuffer] - and $c ; did the player press A or B? - jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection -; the enemy and the player both pressed A or B -; The gameboy that is clocking the connection wins. - ld a, [hSerialConnectionStatus] - cp USING_INTERNAL_CLOCK - jr z, .doneChoosingMenuSelection -.useEnemyMenuSelection - ld a, $1 - ld [wd11e], a - ld a, b - ld [wLinkMenuSelectionSendBuffer], a - and $3 - ld [wCurrentMenuItem], a ; wCurrentMenuItem -.doneChoosingMenuSelection - ld a, [hSerialConnectionStatus] - cp USING_INTERNAL_CLOCK - jr nz, .skipStartingTransfer - call DelayFrame - call DelayFrame - ld a, START_TRANSFER_INTERNAL_CLOCK - ld [rSC], a -.skipStartingTransfer - ld b, " " - ld c, " " - ld d, " " - ld e, "▷" - ld a, [wLinkMenuSelectionSendBuffer] - and (B_BUTTON << 2) ; was B button pressed? - jr nz, .updateCursorPosition -; A button was pressed - ld a, [wCurrentMenuItem] - cp $2 - jp z, .asm_f5963 - ld b, e - ld e, c - ld a, [wCurrentMenuItem] - and a - jr z, .updateCursorPosition - ld c, b - ld b, d - dec a - jr z, .updateCursorPosition - ld d, c - ld c, b -.updateCursorPosition - call Func_f59ec - call LoadScreenTilesFromBuffer1 - ld a, [wLinkMenuSelectionSendBuffer] - and (B_BUTTON << 2) ; was B button pressed? - jr nz, .choseCancel ; cancel if B pressed - ld a, [wCurrentMenuItem] - cp $2 - jr z, .choseCancel - xor a - ld [wWalkBikeSurfState], a ; start walking - ld a, [wCurrentMenuItem] - and a - ld a, COLOSSEUM - jr nz, .next - ld a, TRADE_CENTER -.next - ld [wd72d], a - ld hl, ColosseumPleaseWaitText - call PrintText - ld c, 50 - call DelayFrames - ld hl, wd732 - res 1, [hl] - ld a, [wDefaultMap] - ld [wDestinationMap], a - callab SpecialWarpIn - ld c, 20 - call DelayFrames - xor a - ld [wMenuJoypadPollCount], a - ld [wSerialExchangeNybbleSendData], a - inc a ; LINK_STATE_IN_CABLE_CLUB - ld [wLinkState], a - ld [wEnteringCableClub], a - jpab SpecialEnterMap -.choseCancel - xor a - ld [wMenuJoypadPollCount], a - call Delay3 - callab CloseLinkConnection - ld hl, ColosseumCanceledText - call PrintText - ld hl, wd72e - res 6, [hl] - ret - -.asm_f5963 - ld a,[wd11e] - and a - jr nz,.asm_f5974 - ld b," " - ld c," " - ld d,"▷" - ld e," " - call Func_f59ec -.asm_f5974 - xor a - ld [wBuffer], a - ld a,$ff - ld [wSerialExchangeNybbleReceiveData],a - ld a, $b - ld [wLinkMenuSelectionSendBuffer], a - ld b,$78 -.loop - ld a,[hSerialConnectionStatus] - cp $2 - call z,DelayFrame - dec b - jr z,.asm_f59b2 - call Serial_ExchangeNybble - call DelayFrame - ld a,[wSerialExchangeNybbleReceiveData] - inc a - jr z,.loop - ld b,$f -.loop2 - call DelayFrame - call Serial_ExchangeNybble - dec b - jr nz,.loop2 - ld b,$f -.loop3 - call DelayFrame - call Serial_SendZeroByte - dec b - jr nz,.loop3 - jr .asm_f59d6 - -.asm_f59b2 - xor a - ld [wUnknownSerialCounter],a - ld [wUnknownSerialCounter+1],a - ld a,[wd11e] - and a - jr z,.asm_f59cd - ld b," " - ld c," " - ld d," " - ld e,"▷" - call Func_f59ec - jp .choseCancel - -.asm_f59cd - ld hl,ColosseumVersionText - call PrintText - jp .choseCancel - -.asm_f59d6 - ld b," " - ld c," " - ld d,"▷" - ld e," " - call Func_f59ec - call Func_f531b - jp c,.choseCancel - ld a,$f0 - jp .next - -Func_f59ec:: - ld a, b - Coorda 6, 5 - ld a, c - Coorda 6, 7 - ld a, d - Coorda 6, 9 - ld a, e - Coorda 6, 11 - ld c, 40 - call DelayFrames - ret - -ColosseumWhereToText: - TX_FAR _ColosseumWhereToText - db "@" - -ColosseumPleaseWaitText: - TX_FAR _ColosseumPleaseWaitText - db "@" - -ColosseumCanceledText: - TX_FAR _ColosseumCanceledText - db "@" - -ColosseumVersionText: - TX_FAR _ColosseumVersionText - db "@" - -TextTerminator_f5a16: - db "@" - -TradeCenterText: - db "TRADE CENTER" - next "COLOSSEUM" - next "COLOSSEUM2" - next "CANCEL@" diff --git a/engine/menu/oaks_pc.asm b/engine/menu/oaks_pc.asm deleted file mode 100755 index 03c9b8f1..00000000 --- a/engine/menu/oaks_pc.asm +++ /dev/null @@ -1,28 +0,0 @@ -OpenOaksPC: - call SaveScreenTilesToBuffer2 - ld hl, AccessedOaksPCText - call PrintText - ld hl, GetDexRatedText - call PrintText - call YesNoChoice - ld a, [wCurrentMenuItem] - and a - jr nz, .closePC - predef DisplayDexRating -.closePC - ld hl, ClosedOaksPCText - call PrintText - jp LoadScreenTilesFromBuffer2 - -GetDexRatedText: - TX_FAR _GetDexRatedText - db "@" - -ClosedOaksPCText: - TX_FAR _ClosedOaksPCText - TX_WAIT - db "@" - -AccessedOaksPCText: - TX_FAR _AccessedOaksPCText - db "@" diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm deleted file mode 100755 index 00c757be..00000000 --- a/engine/menu/party_menu.asm +++ /dev/null @@ -1,333 +0,0 @@ -; [wPartyMenuTypeOrMessageID] = menu type / message ID -; if less than $F0, it is a menu type -; menu types: -; 00: normal pokemon menu (e.g. Start menu) -; 01: use healing item on pokemon menu -; 02: in-battle switch pokemon menu -; 03: learn TM/HM menu -; 04: swap pokemon positions menu -; 05: use evolution stone on pokemon menu -; otherwise, it is a message ID -; f0: poison healed -; f1: burn healed -; f2: freeze healed -; f3: sleep healed -; f4: paralysis healed -; f5: HP healed -; f6: health returned -; f7: revitalized -; f8: leveled up -DrawPartyMenu_: - xor a - ld [H_AUTOBGTRANSFERENABLED], a - call ClearScreen - call UpdateSprites - callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics - -RedrawPartyMenu_: - ld a, [wPartyMenuTypeOrMessageID] - cp SWAP_MONS_PARTY_MENU - jp z, .printMessage - call ErasePartyMenuCursors - callba InitPartyMenuBlkPacket - coord hl, 3, 0 - ld de, wPartySpecies - xor a - ld c, a - ld [hPartyMonIndex], a - ld [wWhichPartyMenuHPBar], a -.loop - ld a, [de] - cp $FF ; reached the terminator? - jp z, .afterDrawingMonEntries - push bc - push de - push hl - ld a, c - push hl - ld hl, wPartyMonNicks - call GetPartyMonName - pop hl - call PlaceString ; print the pokemon's name - ld a, [hPartyMonIndex] - ld [wWhichPokemon], a - callab IsThisPartymonStarterPikachu_Party - jr nc, .regularMon - call CheckPikachuFollowingPlayer - jr z, .regularMon - ld a, $ff - ld [hPartyMonIndex], a -.regularMon - callba WriteMonPartySpriteOAMByPartyIndex ; place the appropriate pokemon icon - ld a, [wWhichPokemon] - inc a - ld [hPartyMonIndex], a - call LoadMonData - pop hl - push hl - ld a, [wMenuItemToSwap] - and a ; is the player swapping pokemon positions? - jr z, .skipUnfilledRightArrow -; if the player is swapping pokemon positions - dec a - ld b, a - ld a, [wWhichPokemon] - cp b ; is the player swapping the current pokemon in the list? - jr nz, .skipUnfilledRightArrow -; the player is swapping the current pokemon in the list - dec hl - dec hl - dec hl - ld a, "▷" ; unfilled right arrow menu cursor - ld [hli], a ; place the cursor - inc hl - inc hl -.skipUnfilledRightArrow - ld a, [wPartyMenuTypeOrMessageID] ; menu type - cp TMHM_PARTY_MENU - jr z, .teachMoveMenu - cp EVO_STONE_PARTY_MENU - jr z, .evolutionStoneMenu - push hl - ld bc, 14 ; 14 columns to the right - add hl, bc - ld de, wLoadedMonStatus - call PrintStatusCondition - pop hl - push hl - ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column - ld a, [hFlags_0xFFFA] - set 0, a - ld [hFlags_0xFFFA], a - add hl, bc - predef DrawHP2 ; draw HP bar and prints current / max HP - ld a, [hFlags_0xFFFA] - res 0, a - ld [hFlags_0xFFFA], a - call SetPartyMenuHPBarColor ; color the HP bar (on SGB) - pop hl - jr .printLevel -.teachMoveMenu - push hl - predef CanLearnTM ; check if the pokemon can learn the move - pop hl - ld de, .ableToLearnMoveText - ld a, c - and a - jr nz, .placeMoveLearnabilityString - ld de, .notAbleToLearnMoveText -.placeMoveLearnabilityString - push hl - ld bc, 20 + 9 ; down 1 row and right 9 columns - add hl, bc - call PlaceString - pop hl -.printLevel - ld bc, 10 ; move 10 columns to the right - add hl, bc - call PrintLevel - pop hl - pop de - inc de - ld bc, 2 * 20 - add hl, bc - pop bc - inc c - jp .loop -.ableToLearnMoveText - db "ABLE@" -.notAbleToLearnMoveText - db "NOT ABLE@" -.evolutionStoneMenu - push hl - ld hl, EvosMovesPointerTable - ld b, 0 - ld a, [wLoadedMonSpecies] - dec a - add a - rl b - ld c, a - add hl, bc - ld de, wEvosMoves - ld a, BANK(EvosMovesPointerTable) - ld bc, 2 - call FarCopyData - ld hl, wEvosMoves - ld a, [hli] - ld h, [hl] - ld l, a - ld de, wEvosMoves - ld a, BANK(EvosMovesPointerTable) - ld bc, wEvosMoves.end - wEvosMoves - call FarCopyData - ld hl, wEvosMoves - ld de, .notAbleToEvolveText -; loop through the pokemon's evolution entries -.checkEvolutionsLoop - ld a, [hli] - and a ; reached terminator? - jr z, .placeEvolutionStoneString ; if so, place the "NOT ABLE" string - inc hl - inc hl - cp EV_ITEM - jr nz, .checkEvolutionsLoop -; if it's a stone evolution entry - dec hl - dec hl - ld b, [hl] - ld a, [wEvoStoneItemID] ; the stone the player used - inc hl - inc hl - inc hl - cp b ; does the player's stone match this evolution entry's stone? - jr nz, .checkEvolutionsLoop -; if it does match - ld de, .ableToEvolveText -.placeEvolutionStoneString - pop hl - push hl - ld bc, 20 + 9 ; down 1 row and right 9 columns - add hl, bc - call PlaceString - pop hl - jr .printLevel -.ableToEvolveText - db "ABLE@" -.notAbleToEvolveText - db "NOT ABLE@" -.afterDrawingMonEntries - ld b, SET_PAL_PARTY_MENU - call RunPaletteCommand -.printMessage - ld hl, wd730 - ld a, [hl] - push af - push hl - set 6, [hl] ; turn off letter printing delay - ld a, [wPartyMenuTypeOrMessageID] ; message ID - cp $F0 - jr nc, .printItemUseMessage - add a - ld hl, PartyMenuMessagePointers - ld b, 0 - ld c, a - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - call PrintText -.done - pop hl - pop af - ld [hl], a - ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a - call Delay3 - jp GBPalNormal -.printItemUseMessage - and $0F - ld hl, PartyMenuItemUseMessagePointers - add a - ld c, a - ld b, 0 - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - push hl - ld a, [wUsedItemOnWhichPokemon] - ld hl, wPartyMonNicks - call GetPartyMonName - pop hl - call PrintText - jr .done - -PartyMenuItemUseMessagePointers: - dw AntidoteText - dw BurnHealText - dw IceHealText - dw AwakeningText - dw ParlyzHealText - dw PotionText - dw FullHealText - dw ReviveText - dw RareCandyText - -PartyMenuMessagePointers: - dw PartyMenuNormalText - dw PartyMenuItemUseText - dw PartyMenuBattleText - dw PartyMenuUseTMText - dw PartyMenuSwapMonText - dw PartyMenuItemUseText - -PartyMenuNormalText: - TX_FAR _PartyMenuNormalText - db "@" - -PartyMenuItemUseText: - TX_FAR _PartyMenuItemUseText - db "@" - -PartyMenuBattleText: - TX_FAR _PartyMenuBattleText - db "@" - -PartyMenuUseTMText: - TX_FAR _PartyMenuUseTMText - db "@" - -PartyMenuSwapMonText: - TX_FAR _PartyMenuSwapMonText - db "@" - -PotionText: - TX_FAR _PotionText - db "@" - -AntidoteText: - TX_FAR _AntidoteText - db "@" - -ParlyzHealText: - TX_FAR _ParlyzHealText - db "@" - -BurnHealText: - TX_FAR _BurnHealText - db "@" - -IceHealText: - TX_FAR _IceHealText - db "@" - -AwakeningText: - TX_FAR _AwakeningText - db "@" - -FullHealText: - TX_FAR _FullHealText - db "@" - -ReviveText: - TX_FAR _ReviveText - db "@" - -RareCandyText: - TX_FAR _RareCandyText - TX_SFX_ITEM_1 ; probably supposed to play SFX_LEVEL_UP but the wrong music bank is loaded - TX_BLINK - db "@" - -SetPartyMenuHPBarColor: - ld hl, wPartyMenuHPBarColors - ld a, [wWhichPartyMenuHPBar] - ld c, a - ld b, 0 - add hl, bc - call GetHealthBarColor - ld b, UPDATE_PARTY_MENU_BLK_PACKET - call RunPaletteCommand - ld hl, wWhichPartyMenuHPBar - inc [hl] - ret diff --git a/engine/menu/text_box.asm b/engine/menu/text_box.asm deleted file mode 100644 index a109bff2..00000000 --- a/engine/menu/text_box.asm +++ /dev/null @@ -1,739 +0,0 @@ -; function to draw various text boxes -DisplayTextBoxID_: - ld a, [wTextBoxID] - cp TWO_OPTION_MENU - jp z, DisplayTwoOptionMenu - ld c, a - ld hl, TextBoxFunctionTable - ld de, 3 - call SearchTextBoxTable - jr c, .functionTableMatch - ld hl, TextBoxCoordTable - ld de, 5 - call SearchTextBoxTable - jr c, .coordTableMatch - ld hl, TextBoxTextAndCoordTable - ld de, 9 - call SearchTextBoxTable - jr c, .textAndCoordTableMatch -.done - ret -.functionTableMatch - ld a, [hli] - ld h, [hl] - ld l, a ; hl = address of function - ld de, .done - push de - jp hl ; jump to the function -.coordTableMatch - call GetTextBoxIDCoords - call GetAddressOfScreenCoords - call TextBoxBorder - ret -.textAndCoordTableMatch - call GetTextBoxIDCoords - push hl - call GetAddressOfScreenCoords - call TextBoxBorder - pop hl - call GetTextBoxIDText - ld a, [wd730] - push af - ld a, [wd730] - set 6, a ; no pauses between printing each letter - ld [wd730], a - call PlaceString - pop af - ld [wd730], a - call UpdateSprites - ret - -; function to search a table terminated with $ff for a byte matching c in increments of de -; sets carry flag if a match is found and clears carry flag if not -SearchTextBoxTable: - dec de -.loop - ld a, [hli] - cp $ff - jr z, .notFound - cp c - jr z, .found - add hl, de - jr .loop -.found - scf -.notFound - ret - -; function to load coordinates from the TextBoxCoordTable or the TextBoxTextAndCoordTable -; INPUT: -; hl = address of coordinates -; OUTPUT: -; b = height -; c = width -; d = row of upper left corner -; e = column of upper left corner -GetTextBoxIDCoords: - ld a, [hli] ; column of upper left corner - ld e, a - ld a, [hli] ; row of upper left corner - ld d, a - ld a, [hli] ; column of lower right corner - sub e - dec a - ld c, a ; c = width - ld a, [hli] ; row of lower right corner - sub d - dec a - ld b, a ; b = height - ret - -; function to load a text address and text coordinates from the TextBoxTextAndCoordTable -GetTextBoxIDText: - ld a, [hli] - ld e, a - ld a, [hli] - ld d, a ; de = address of text - push de ; save text address - ld a, [hli] - ld e, a ; column of upper left corner of text - ld a, [hl] - ld d, a ; row of upper left corner of text - call GetAddressOfScreenCoords - pop de ; restore text address - ret - -; function to point hl to the screen coordinates -; INPUT: -; d = row -; e = column -; OUTPUT: -; hl = address of upper left corner of text box -GetAddressOfScreenCoords: - push bc - coord hl, 0, 0 - ld bc, 20 -.loop ; loop to add d rows to the base address - ld a, d - and a - jr z, .addedRows - add hl, bc - dec d - jr .loop -.addedRows - pop bc - add hl, de - ret - -; Format: -; 00: text box ID -; 01-02: function address -TextBoxFunctionTable: - dbw MONEY_BOX, DisplayMoneyBox - dbw BUY_SELL_QUIT_MENU, DoBuySellQuitMenu - dbw FIELD_MOVE_MON_MENU, DisplayFieldMoveMonMenu - db $ff ; terminator - -; Format: -; 00: text box ID -; 01: column of upper left corner -; 02: row of upper left corner -; 03: column of lower right corner -; 04: row of lower right corner -TextBoxCoordTable: - db MESSAGE_BOX, 0, 12, 19, 17 - db $03, 0, 0, 19, 14 - db $07, 0, 0, 11, 6 - db LIST_MENU_BOX, 4, 2, 19, 12 - db $10, 7, 0, 19, 17 - db MON_SPRITE_POPUP, 6, 4, 14, 13 - db $ff ; terminator - -; Format: -; 00: text box ID -; 01: column of upper left corner -; 02: row of upper left corner -; 03: column of lower right corner -; 04: row of lower right corner -; 05-06: address of text -; 07: column of beginning of text -; 08: row of beginning of text -; table of window positions and corresponding text [key, start column, start row, end column, end row, text pointer [2 bytes], text column, text row] -TextBoxTextAndCoordTable: - db JP_MOCHIMONO_MENU_TEMPLATE - db 0,0,14,17 ; text box coordinates - dw JapaneseMochimonoText - db 3,0 ; text coordinates - - db USE_TOSS_MENU_TEMPLATE - db 13,10,19,14 ; text box coordinates - dw UseTossText - db 15,11 ; text coordinates - - db JP_SAVE_MESSAGE_MENU_TEMPLATE - db 0,0,7,5 ; text box coordinates - dw JapaneseSaveMessageText - db 2,2 ; text coordinates - - db JP_SPEED_OPTIONS_MENU_TEMPLATE - db 0,6,5,10 ; text box coordinates - dw JapaneseSpeedOptionsText - db 2,7 ; text coordinates - - db BATTLE_MENU_TEMPLATE - db 8,12,19,17 ; text box coordinates - dw BattleMenuText - db 10,14 ; text coordinates - - db SAFARI_BATTLE_MENU_TEMPLATE - db 0,12,19,17 ; text box coordinates - dw SafariZoneBattleMenuText - db 2,14 ; text coordinates - - db SWITCH_STATS_CANCEL_MENU_TEMPLATE - db 11,11,19,17 ; text box coordinates - dw SwitchStatsCancelText - db 13,12 ; text coordinates - - db BUY_SELL_QUIT_MENU_TEMPLATE - db 0,0,10,6 ; text box coordinates - dw BuySellQuitText - db 2,1 ; text coordinates - - db MONEY_BOX_TEMPLATE - db 11,0,19,2 ; text box coordinates - dw MoneyText - db 13,0 ; text coordinates - - db JP_AH_MENU_TEMPLATE - db 7,6,11,10 ; text box coordinates - dw JapaneseAhText - db 8,8 ; text coordinates - - db JP_POKEDEX_MENU_TEMPLATE - db 11,8,19,17 ; text box coordinates - dw JapanesePokedexMenu - db 12,10 ; text coordinates - -; note that there is no terminator - -BuySellQuitText: - db "BUY" - next "SELL" - next "QUIT@@" - -UseTossText: - db "USE" - next "TOSS@" - -JapaneseSaveMessageText: - db "きろく" - next "メッセージ@" - -JapaneseSpeedOptionsText: - db "はやい" - next "おそい@" - -MoneyText: - db "MONEY@" - -JapaneseMochimonoText: - db "もちもの@" - -JapaneseMainMenuText: - db "つづきから" - next "さいしょから@" - -BattleMenuText: - db "FIGHT ",$E1,$E2 - next "ITEM RUN@" - -SafariZoneBattleMenuText: - db "BALL× BAIT" - next "THROW ROCK RUN@" - -SwitchStatsCancelText: - db "SWITCH" - next "STATS" - next "CANCEL@" - -JapaneseAhText: - db "アッ!@" - -JapanesePokedexMenu: - db "データをみる" - next "なきごえ" - next "ぶんぷをみる" - next "キャンセル@" - -DisplayMoneyBox: - ld hl, wd730 - set 6, [hl] - ld a, MONEY_BOX_TEMPLATE - ld [wTextBoxID], a - call DisplayTextBoxID - coord hl, 13, 1 - lb bc, 1, 6 - call ClearScreenArea - coord hl, 12, 1 - ld de, wPlayerMoney - ld c, $a3 - call PrintBCDNumber - ld hl, wd730 - res 6, [hl] - ret - -CurrencyString: - db " ¥@" - -DoBuySellQuitMenu: - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a - xor a - ld [wChosenMenuItem], a - ld a, BUY_SELL_QUIT_MENU_TEMPLATE - ld [wTextBoxID], a - call DisplayTextBoxID - ld a, A_BUTTON | B_BUTTON - ld [wMenuWatchedKeys], a - ld a, $2 - ld [wMaxMenuItem], a - ld a, $1 - ld [wTopMenuItemY], a - ld a, $1 - ld [wTopMenuItemX], a - xor a - ld [wCurrentMenuItem], a - ld [wLastMenuItem], a - ld [wMenuWatchMovingOutOfBounds], a - ld a, [wd730] - res 6, a ; turn on the printing delay - ld [wd730], a - call HandleMenuInput - call PlaceUnfilledArrowMenuCursor - bit 0, a ; was A pressed? - jr nz, .pressedA - bit 1, a ; was B pressed? (always true since only A/B are watched) - jr z, .pressedA - ld a, CANCELLED_MENU - ld [wMenuExitMethod], a - jr .quit -.pressedA - ld a, CHOSE_MENU_ITEM - ld [wMenuExitMethod], a - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - ld b, a - ld a, [wMaxMenuItem] - cp b - jr z, .quit - ret -.quit - ld a, CANCELLED_MENU - ld [wMenuExitMethod], a - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - scf - ret - -; displays a menu with two options to choose from -; b = Y of upper left corner of text region -; c = X of upper left corner of text region -; hl = address where the text box border should be drawn -DisplayTwoOptionMenu: - push hl - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a - -; pointless because both values are overwritten before they are read - xor a - ld [wChosenMenuItem], a - ld [wMenuExitMethod], a - - ld a, A_BUTTON | B_BUTTON - ld [wMenuWatchedKeys], a - ld a, $1 - ld [wMaxMenuItem], a - ld a, b - ld [wTopMenuItemY], a - ld a, c - ld [wTopMenuItemX], a - xor a - ld [wLastMenuItem], a - ld [wMenuWatchMovingOutOfBounds], a - push hl - ld hl, wTwoOptionMenuID - bit 7, [hl] ; select second menu item by default? - res 7, [hl] - jr z, .storeCurrentMenuItem - inc a -.storeCurrentMenuItem - ld [wCurrentMenuItem], a - pop hl - push hl - push hl - call TwoOptionMenu_SaveScreenTiles - ld a, [wTwoOptionMenuID] - ld hl, TwoOptionMenuStrings - ld e, a - ld d, $0 - ld a, $5 -.menuStringLoop - add hl, de - dec a - jr nz, .menuStringLoop - ld a, [hli] - ld c, a - ld a, [hli] - ld b, a - ld e, l - ld d, h - pop hl - push de - ld a, [wTwoOptionMenuID] - cp TRADE_CANCEL_MENU - jr nz, .notTradeCancelMenu - call CableClub_TextBoxBorder - jr .afterTextBoxBorder -.notTradeCancelMenu - call TextBoxBorder -.afterTextBoxBorder - call UpdateSprites - pop hl - ld a, [hli] - and a ; put blank line before first menu item? - ld bc, 20 + 2 - jr z, .noBlankLine - ld bc, 2 * 20 + 2 -.noBlankLine - ld a, [hli] - ld e, a - ld a, [hli] - ld d, a - pop hl - add hl, bc - call PlaceString - xor a - ld [wTwoOptionMenuID], a - ld hl, wd730 - res 6, [hl] ; turn on the printing delay - call HandleMenuInput - pop hl - bit 1, a ; A button pressed? - jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed -.pressedAButton - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - and a - jr nz, .choseSecondMenuItem -; chose first menu item - ld a, CHOSE_FIRST_ITEM - ld [wMenuExitMethod], a - ld c, 15 - call DelayFrames - call TwoOptionMenu_RestoreScreenTiles - and a - ret -.choseSecondMenuItem - ld a, 1 - ld [wCurrentMenuItem], a - ld [wChosenMenuItem], a - ld a, CHOSE_SECOND_ITEM - ld [wMenuExitMethod], a - ld c, 15 - call DelayFrames - call TwoOptionMenu_RestoreScreenTiles - scf - ret - -; Some of the wider/taller two option menus will not have the screen areas -; they cover be fully saved/restored by the two functions below. -; The bottom and right edges of the menu may remain after the function returns. - -TwoOptionMenu_SaveScreenTiles: - ld de, wBuffer - lb bc, 5, 6 -.loop - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .loop - push bc - ld bc, SCREEN_WIDTH - 6 - add hl, bc - pop bc - ld c, $6 - dec b - jr nz, .loop - ret - -TwoOptionMenu_RestoreScreenTiles: - ld de, wBuffer - lb bc, 5, 6 -.loop - ld a, [de] - inc de - ld [hli], a - dec c - jr nz, .loop - push bc - ld bc, SCREEN_WIDTH - 6 - add hl, bc - pop bc - ld c, 6 - dec b - jr nz, .loop - call UpdateSprites - ret - -; Format: -; 00: byte width -; 01: byte height -; 02: byte put blank line before first menu item -; 03: word text pointer -TwoOptionMenuStrings: - db 4,3,0 - dw .YesNoMenu - db 6,3,0 - dw .NorthWestMenu - db 6,3,0 - dw .SouthEastMenu - db 6,3,0 - dw .YesNoMenu - db 6,3,0 - dw .NorthEastMenu - db 7,3,0 - dw .TradeCancelMenu - db 7,4,1 - dw .HealCancelMenu - db 4,3,0 - dw .NoYesMenu - -.NoYesMenu - db "NO" - next "YES@" -.YesNoMenu - db "YES" - next "NO@" -.NorthWestMenu - db "NORTH" - next "WEST@" -.SouthEastMenu - db "SOUTH" - next "EAST@" -.NorthEastMenu - db "NORTH" - next "EAST@" -.TradeCancelMenu - db "TRADE" - next "CANCEL@" -.HealCancelMenu - db "HEAL" - next "CANCEL@" - -DisplayFieldMoveMonMenu: - xor a - ld hl, wFieldMoves - ld [hli], a ; wFieldMoves - ld [hli], a ; wFieldMoves + 1 - ld [hli], a ; wFieldMoves + 2 - ld [hli], a ; wFieldMoves + 3 - ld [hli], a ; wNumFieldMoves - ld [hl], 12 ; wFieldMovesLeftmostXCoord - call GetMonFieldMoves - ld a, [wNumFieldMoves] - and a - jr nz, .fieldMovesExist - -; no field moves - coord hl, 11, 11 - lb bc, 5, 7 - call TextBoxBorder - call UpdateSprites - ld a, 12 - ld [hFieldMoveMonMenuTopMenuItemX], a - coord hl, 13, 12 - ld de, PokemonMenuEntries - jp PlaceString - -.fieldMovesExist - push af - -; Calculate the text box position and dimensions based on the leftmost X coord -; of the field move names before adjusting for the number of field moves. - coord hl, 0, 11 - ld a, [wFieldMovesLeftmostXCoord] - dec a - ld e, a - ld d, 0 - add hl, de - ld b, 5 - ld a, 18 - sub e - ld c, a - pop af - -; For each field move, move the top of the text box up 2 rows while the leaving -; the bottom of the text box at the bottom of the screen. - ld de, -SCREEN_WIDTH * 2 -.textBoxHeightLoop - add hl, de - inc b - inc b - dec a - jr nz, .textBoxHeightLoop - -; Make space for an extra blank row above the top field move. - ld de, -SCREEN_WIDTH - add hl, de - inc b - - call TextBoxBorder - call UpdateSprites - -; Calculate the position of the first field move name to print. - coord hl, 0, 12 - ld a, [wFieldMovesLeftmostXCoord] - inc a - ld e, a - ld d, 0 - add hl, de - ld de, -SCREEN_WIDTH * 2 - ld a, [wNumFieldMoves] -.calcFirstFieldMoveYLoop - add hl, de - dec a - jr nz, .calcFirstFieldMoveYLoop - - xor a - ld [wNumFieldMoves], a - ld de, wFieldMoves -.printNamesLoop - push hl - ld hl, FieldMoveNames - ld a, [de] - and a - jr z, .donePrintingNames - inc de - ld b, a ; index of name -.skipNamesLoop ; skip past names before the name we want - dec b - jr z, .reachedName -.skipNameLoop ; skip past current name - ld a, [hli] - cp "@" - jr nz, .skipNameLoop - jr .skipNamesLoop -.reachedName - ld b, h - ld c, l - pop hl - push de - ld d, b - ld e, c - call PlaceString - ld bc, SCREEN_WIDTH * 2 - add hl, bc - pop de - jr .printNamesLoop - -.donePrintingNames - pop hl - ld a, [wFieldMovesLeftmostXCoord] - ld [hFieldMoveMonMenuTopMenuItemX], a - coord hl, 0, 12 - ld a, [wFieldMovesLeftmostXCoord] - inc a - ld e, a - ld d, 0 - add hl, de - ld de, PokemonMenuEntries - jp PlaceString - -FieldMoveNames: - db "CUT@" - db "FLY@" - db "@" - db "SURF@" - db "STRENGTH@" - db "FLASH@" - db "DIG@" - db "TELEPORT@" - db "SOFTBOILED@" - -PokemonMenuEntries: - db "STATS" - next "SWITCH" - next "CANCEL@" - -GetMonFieldMoves: - ld a, [wWhichPokemon] - ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 - call AddNTimes - ld d, h - ld e, l - ld c, NUM_MOVES + 1 - ld hl, wFieldMoves -.loop - push hl -.nextMove - dec c - jr z, .done - ld a, [de] ; move ID - and a - jr z, .done - ld b, a - inc de - ld hl, FieldMoveDisplayData -.fieldMoveLoop - ld a, [hli] - cp $ff - jr z, .nextMove ; if the move is not a field move - cp b - jr z, .foundFieldMove - inc hl - inc hl - jr .fieldMoveLoop -.foundFieldMove - ld a, b - ld [wLastFieldMoveID], a - ld a, [hli] ; field move name index - ld b, [hl] ; field move leftmost X coordinate - pop hl - ld [hli], a ; store name index in wFieldMoves - ld a, [wNumFieldMoves] - inc a - ld [wNumFieldMoves], a - ld a, [wFieldMovesLeftmostXCoord] - cp b - jr c, .skipUpdatingLeftmostXCoord - ld a, b - ld [wFieldMovesLeftmostXCoord], a -.skipUpdatingLeftmostXCoord - ld a, [wLastFieldMoveID] - ld b, a - jr .loop -.done - pop hl - ret - -; Format: [Move id], [name index], [leftmost tile] -; Move id = id of move -; Name index = index of name in FieldMoveNames -; Leftmost tile = -1 + tile column in which the first letter of the move's name should be displayed -; "SOFTBOILED" is $08 because it has 4 more letters than "SURF", for example, whose value is $0C -FieldMoveDisplayData: - db CUT, $01, $0C - db FLY, $02, $0C - db $B4, $03, $0C ; unused field move - db SURF, $04, $0C - db STRENGTH, $05, $0A - db FLASH, $06, $0C - db DIG, $07, $0C - db TELEPORT, $08, $0A - db SOFTBOILED, $09, $08 - db $ff ; list terminator diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm new file mode 100644 index 00000000..17f290b4 --- /dev/null +++ b/engine/menus/display_text_id_init.asm @@ -0,0 +1,76 @@ +; function that performs initialization for DisplayTextID +DisplayTextIDInit:: + xor a + ld [wListMenuID], a + ld a, [wAutoTextBoxDrawingControl] + bit 0, a + jr nz, .skipDrawingTextBoxBorder + ldh a, [hSpriteIndexOrTextID] ; text ID (or sprite ID) + and a + jr nz, .notStartMenu +; if text ID is 0 (i.e. the start menu) +; Note that the start menu text border is also drawn in the function directly +; below this, so this seems unnecessary. + CheckEvent EVENT_GOT_POKEDEX +; start menu with pokedex + hlcoord 10, 0 + lb bc, 14, 8 + jr nz, .drawTextBoxBorder +; start menu without pokedex + hlcoord 10, 0 + lb bc, 12, 8 + jr .drawTextBoxBorder +; if text ID is not 0 (i.e. not the start menu) then do a standard dialogue text box +.notStartMenu + hlcoord 0, 12 + lb bc, 4, 18 +.drawTextBoxBorder + call TextBoxBorder +.skipDrawingTextBoxBorder + ld hl, wFontLoaded + set 0, [hl] + ld hl, wFlags_0xcd60 + bit 4, [hl] + res 4, [hl] + jr nz, .skipMovingSprites + call UpdateSprites +.skipMovingSprites +; loop to copy [x#SPRITESTATEDATA1_FACINGDIRECTION] to +; [x#SPRITESTATEDATA2_ORIGFACINGDIRECTION] for each non-player sprite +; this is done because when you talk to an NPC, they turn to look your way +; the original direction they were facing must be restored after the dialogue is over + ld hl, wSprite01StateData1FacingDirection + ld c, $0f + ld de, $10 +.spriteFacingDirectionCopyLoop + ld a, [hl] ; x#SPRITESTATEDATA1_FACINGDIRECTION + inc h + ld [hl], a ; [x#SPRITESTATEDATA2_ORIGFACINGDIRECTION] + dec h + add hl, de + dec c + jr nz, .spriteFacingDirectionCopyLoop +; loop to force all the sprites in the middle of animation to stand still +; (so that they don't like they're frozen mid-step during the dialogue) + ld hl, wSpritePlayerStateData1ImageIndex + ld de, $10 + ld c, e +.spriteStandStillLoop + ld a, [hl] + cp $ff ; is the sprite visible? + jr z, .nextSprite +; if it is visible + and $fc + ld [hl], a +.nextSprite + add hl, de + dec c + jr nz, .spriteStandStillLoop + ld b, $9c ; window background address + call CopyScreenTileBufferToVRAM ; transfer background in WRAM to VRAM + xor a + ldh [hWY], a ; put the window on the screen + call LoadFontTilePatterns + ld a, $01 + ldh [hAutoBGTransferEnabled], a ; enable continuous WRAM to VRAM transfer each V-blank + ret diff --git a/engine/menu/draw_badges.asm b/engine/menus/draw_badges.asm index 9e6262a0..0bb433cc 100644 --- a/engine/menu/draw_badges.asm +++ b/engine/menus/draw_badges.asm @@ -8,12 +8,12 @@ DrawBadges: ; Tile ids for face/badge graphics. ld de, wBadgeOrFaceTiles ld hl, .FaceBadgeTiles - ld bc, 8 + ld bc, NUM_BADGES call CopyData ; Booleans for each badge. ld hl, wTempObtainedBadgesBooleans - ld bc, 8 + ld bc, NUM_BADGES xor a call FillMemory @@ -22,7 +22,7 @@ DrawBadges: ld hl, wBadgeOrFaceTiles ld a, [wObtainedBadges] ld b, a - ld c, 8 + ld c, NUM_BADGES .CheckBadge srl b jr nc, .NextBadge @@ -43,11 +43,11 @@ DrawBadges: ld [hli], a ld [hl], $60 ; First name - coord hl, 2, 11 + hlcoord 2, 11 ld de, wTempObtainedBadgesBooleans call .DrawBadgeRow - coord hl, 2, 14 + hlcoord 2, 14 ld de, wTempObtainedBadgesBooleans + 4 ; call .DrawBadgeRow ; ret @@ -92,7 +92,7 @@ DrawBadges: push bc ld hl, wBadgeOrFaceTiles + 1 ld de, wBadgeOrFaceTiles - ld bc, 8 + ld bc, NUM_BADGES call CopyData pop bc @@ -117,4 +117,4 @@ DrawBadges: db $20, $28, $30, $38, $40, $48, $50, $58 GymLeaderFaceAndBadgeTileGraphics: - INCBIN "gfx/badges.2bpp" + INCBIN "gfx/trainer_card/badges.2bpp" diff --git a/engine/menu/draw_start_menu.asm b/engine/menus/draw_start_menu.asm index 632b8c3a..7ca75ecb 100644 --- a/engine/menu/draw_start_menu.asm +++ b/engine/menus/draw_start_menu.asm @@ -1,12 +1,12 @@ ; function that displays the start menu -DrawStartMenu: +DrawStartMenu:: CheckEvent EVENT_GOT_POKEDEX ; menu with pokedex - coord hl, 10, 0 + hlcoord 10, 0 lb bc, 14, 8 - jr nz,.drawTextBoxBorder + jr nz, .drawTextBoxBorder ; shorter menu if the player doesn't have the pokedex - coord hl, 10, 0 + hlcoord 10, 0 lb bc, 12, 8 .drawTextBoxBorder call TextBoxBorder @@ -23,7 +23,7 @@ DrawStartMenu: ld [wMenuWatchMovingOutOfBounds], a ld hl, wd730 set 6, [hl] ; no pauses between printing each letter - coord hl, 12, 2 + hlcoord 12, 2 CheckEvent EVENT_GOT_POKEDEX ; case for not having pokedex ld a, $06 diff --git a/engine/menu/league_pc.asm b/engine/menus/league_pc.asm index 9946b90d..5551fd0b 100755 --- a/engine/menu/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -6,10 +6,10 @@ PKMNLeaguePC: push hl ld a, [wUpdateSpritesEnabled] push af - ld a, [hTilesetType] + ldh a, [hTilesetType] push af xor a - ld [hTilesetType], a + ldh [hTilesetType], a ld [wSpriteFlipped], a ld [wUpdateSpritesEnabled], a ld [wHoFTeamIndex2], a @@ -29,7 +29,7 @@ PKMNLeaguePC: push bc ld a, [wHoFTeamIndex2] ld [wHoFTeamIndex], a - callba LoadHallOfFameTeams + farcall LoadHallOfFameTeams call LeaguePCShowTeam pop bc jr c, .doneShowingTeams @@ -40,7 +40,7 @@ PKMNLeaguePC: jr nz, .loop .doneShowingTeams pop af - ld [hTilesetType], a + ldh [hTilesetType], a pop af ld [wUpdateSpritesEnabled], a pop hl @@ -56,7 +56,7 @@ LeaguePCShowTeam: push bc call LeaguePCShowMon call WaitForTextScrollButtonPress - ld a, [hJoyHeld] + ldh a, [hJoyHeld] bit 1, a jr nz, .exit ld hl, wHallOfFame + HOF_MON @@ -95,25 +95,25 @@ LeaguePCShowMon: ld b, SET_PAL_POKEMON_WHOLE_SCREEN ld c, 0 call RunPaletteCommand - coord hl, 12, 5 + hlcoord 12, 5 call GetMonHeader call LoadFrontSpriteByMonIndex call GBPalNormal - coord hl, 0, 13 + hlcoord 0, 13 lb bc, 2, 18 call TextBoxBorder - coord hl, 1, 15 + hlcoord 1, 15 ld de, HallOfFameNoText call PlaceString - coord hl, 16, 15 + hlcoord 16, 15 ld de, wHoFTeamNo lb bc, 1, 3 call PrintNumber - jpba Func_7033f + farjp Func_7033f HallOfFameNoText: db "HALL OF FAME No @" AccessedHoFPCText: - TX_FAR _AccessedHoFPCText - db "@" + text_far _AccessedHoFPCText + text_end diff --git a/engine/menus/link_menu.asm b/engine/menus/link_menu.asm new file mode 100644 index 00000000..2f2db573 --- /dev/null +++ b/engine/menus/link_menu.asm @@ -0,0 +1,910 @@ +Func_f531b:: + ld c, $14 + call DelayFrames + ld a, $1 + ld [wBuffer], a + xor a + ld [wUnknownSerialFlag_d499], a + coord hl, 0, 0 + lb bc, 4, 5 + call TextBoxBorder + ld de, Text_f5791 + coord hl, 1, 2 + call PlaceString + coord hl, 8, 0 + lb bc, 8, 10 + call TextBoxBorder + coord hl, 10, 2 + ld de, Text_f579c + call PlaceString + coord hl, 0, 10 + lb bc, 6, 18 + call TextBoxBorder + call UpdateSprites + xor a + ld [wUnusedCD37], a + ld [wd72d], a + ld [wd11e], a + ld hl, wTopMenuItemY + ld a, $2 + ld [hli], a + ld a, $9 + ld [hli], a + xor a + ld [hli], a + inc hl + ld a, $3 + ld [hli], a + ld a, $3 + ld [hli], a + xor a + ld [hl], a +.asm_f5377 + call Func_f56bd + call HandleMenuInput + and $3 + add a + add a + ld b, a + ld a, [wCurrentMenuItem] + cp $3 + jr nz, .asm_f5390 + bit 2, b + jr z, .asm_f5390 + dec a + ld b, $8 +.asm_f5390 + add b + add $c0 + ld [wLinkMenuSelectionSendBuffer], a + ld [wLinkMenuSelectionSendBuffer+1], a +.asm_f5399 + ld hl, wLinkMenuSelectionSendBuffer + ld a, [hl] + ldh [hSerialSendData], a + call Serial_ExchangeByte + push af + ld hl, wLinkMenuSelectionSendBuffer + ld a, [hl] + ldh [hSerialSendData], a + call Serial_ExchangeByte + pop bc + cp b + jr nz, .asm_f5399 + and $f0 + cp $c0 + jr nz, .asm_f5399 + ld a, b + and $c + jr nz, .asm_f53c4 + ld a, [wLinkMenuSelectionSendBuffer] + and $c + jr z, .asm_f5377 + jr .asm_f53df +.asm_f53c4 + ld a, [wLinkMenuSelectionSendBuffer] + and $c + jr z, .asm_f53d1 + ldh a, [hSerialConnectionStatus] + cp $2 + jr z, .asm_f53df +.asm_f53d1 + ld a, $1 + ld [wd11e], a + ld a, b + ld [wLinkMenuSelectionSendBuffer], a + and $3 + ld [wCurrentMenuItem], a +.asm_f53df + call DelayFrame + call DelayFrame + ld hl, wLinkMenuSelectionSendBuffer + ld a, [hl] + ldh [hSerialSendData], a + call Serial_ExchangeByte + call Serial_ExchangeByte + ld b, $14 +.loop + call DelayFrame + call Serial_SendZeroByte + dec b + jr nz, .loop + ld b, " " + ld c, " " + ld d, " " + ld e, "▷" + ld a, [wLinkMenuSelectionSendBuffer] + bit 3, a + jr nz, .asm_f541a + ld b, e + ld e, c + ld a, [wCurrentMenuItem] + and a + jr z, .asm_f541a + ld c, b + ld b, d + dec a + jr z, .asm_f541a + ld d, c + ld c, b +.asm_f541a + ld a, b + ldcoord_a 9, 2 + ld a, c + ldcoord_a 9, 4 + ld a, d + ldcoord_a 9, 6 + ld a, e + ldcoord_a 9, 8 + ld c, 40 + call DelayFrames + ld a, [wLinkMenuSelectionSendBuffer] + bit 3, a + jr nz, asm_f547f + ld a, [wCurrentMenuItem] + cp $3 + jr z, asm_f547f + inc a + ld [wUnknownSerialFlag_d499], a + ld a, [wCurrentMenuItem] + ld hl, PointerTable_f5488 + ld c, a + ld b, $0 + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld de, .returnaddress + push de + jp hl +.returnaddress + ld [wLinkMenuSelectionSendBuffer], a + xor a + ld [wUnknownSerialCounter], a + ld [wUnknownSerialCounter+1], a + call Serial_SyncAndExchangeNybble + ld a, [wLinkMenuSelectionSendBuffer] + and a + jr nz, asm_f547c + ld a, [wLinkMenuSelectionReceiveBuffer] + and a + jr nz, Func_f5476 + xor a + ld [wUnknownSerialCounter], a + ld [wUnknownSerialCounter+1], a + and a + ret + +Func_f5476:: + ld hl, ColosseumIneligibleText + call PrintText +asm_f547c:: + jp Func_f531b + +asm_f547f:: + xor a + ld [wUnknownSerialCounter], a + ld [wUnknownSerialCounter+1], a + scf + ret + +PointerTable_f5488:: + dw PokeCup + dw PikaCup + dw PetitCup + +PokeCup:: + ld hl, wPartyCount + ld a, [hli] + cp $3 + jp nz, NotThreeMonsInParty + ld b, $3 +.loop + ld a, [hli] + cp MEW + jp z, MewInParty + dec b + jr nz, .loop + dec hl + dec hl + cp [hl] ; is third mon second mon? + jp z, DuplicateSpecies + dec hl ; wPartySpecies + cp [hl] ; is third mon first mon? + jp z, DuplicateSpecies + ld a, [hli] + cp [hl] ; is first mon second mon? + jp z, DuplicateSpecies + ld a, [wPartyMon1Level] + cp 56 + jp nc, LevelAbove55 + cp 50 + jp c, LevelUnder50 + ld b, a + ld a, [wPartyMon2Level] + cp 56 + jp nc, LevelAbove55 + cp 50 + jp c, LevelUnder50 + ld c, a + ld a, [wPartyMon3Level] + cp 56 + jp nc, LevelAbove55 + cp 50 + jp c, LevelUnder50 + add b + add c + cp 156 + jp nc, CombinedLevelsGreaterThan155 + xor a + ret + +PikaCup:: + ld hl, wPartyCount + ld a, [hli] + cp $3 + jp nz, NotThreeMonsInParty + ld b, $3 +.loop + ld a, [hli] ; wPartySpecies + cp MEW + jp z, MewInParty + dec b + jr nz, .loop + dec hl + dec hl + cp [hl] ; is third mon second mon? + jp z, DuplicateSpecies + dec hl ; wPartySpecies + cp [hl] ; is third mon first mon? + jp z, DuplicateSpecies + ld a, [hli] + cp [hl] ; is first mon second mon? + jp z, DuplicateSpecies + ld a, [wPartyMon1Level] + cp 21 + jp nc, LevelAbove20 + cp 15 + jp c, LevelUnder15 + ld b, a + ld a, [wPartyMon2Level] + cp 21 + jp nc, LevelAbove20 + cp 15 + jp c, LevelUnder15 + ld c, a + ld a, [wPartyMon3Level] + cp 21 + jp nc, LevelAbove20 + cp 15 + jp c, LevelUnder15 + add b + add c + cp 51 + jp nc, CombinedLevelsAbove50 + xor a + ret + +PetitCup:: + ld hl, wPartyCount + ld a, [hli] + cp $3 + jp nz, NotThreeMonsInParty + ld b, $3 +.loop + ld a, [hli] + cp MEW + jp z, MewInParty + dec b + jr nz, .loop + dec hl + dec hl + cp [hl] ; is third mon second mon? + jp z, DuplicateSpecies + dec hl ; wPartySpecies + cp [hl] ; is third mon first mon? + jp z, DuplicateSpecies + ld a, [hli] + cp [hl] ; is first mon second mon? + jp z, DuplicateSpecies + dec hl + ld a, [hl] + ld [wcf91], a + push hl + callfar Func_3b10f + pop hl + jp c, asm_f56ad + inc hl + ld a, [hl] + ld [wcf91], a + push hl + callfar Func_3b10f + pop hl + jp c, asm_f56ad + inc hl + ld a, [hl] + ld [wcf91], a + push hl + callfar Func_3b10f + pop hl + jp c, asm_f56ad + dec hl + dec hl + ld b, $3 +.bigloop + ld a, [hli] + push hl + push bc + push af + dec a + ld c, a + ld b, $0 + ld hl, PokedexEntryPointers + add hl, bc + add hl, bc + ld de, wcd6d + ld bc, $2 + ld a, BANK(PokedexEntryPointers) + call FarCopyData + ld hl, wcd6d + ld a, [hli] + ld h, [hl] + ld l, a + ld de, wcd6d + ld bc, $14 + ld a, BANK(PokedexEntryPointers) + call FarCopyData + ld hl, wcd6d +.loop2 + ld a, [hli] + cp "@" + jr nz, .loop2 + ld a, [hli] + cp $7 + jp nc, asm_f5689 + add a + add a + ld b, a + add a + add b + ld b, a + ld a, [hli] + add b + cp $51 + jp nc, asm_f5689 + ld a, [hli] + sub $b9 + ld a, [hl] + sbc $1 + jp nc, asm_f569b + pop af + pop bc + pop hl + dec b + jr nz, .bigloop + ld a, [wPartyMon1Level] + cp 31 + jp nc, LevelAbove30 + cp 25 + jp c, LevelUnder25 + ld b, a + ld a, [wPartyMon2Level] + cp 31 + jp nc, LevelAbove30 + cp 25 + jp c, LevelUnder25 + ld c, a + ld a, [wPartyMon3Level] + cp 31 + jp nc, LevelAbove30 + cp 25 + jp c, LevelUnder25 + add b + add c + cp 81 + jp nc, CombinedLevelsAbove80 + xor a + ret + +NotThreeMonsInParty:: + ld hl, Colosseum3MonsText + call PrintText + ld a, $1 + ret + +MewInParty:: + ld hl, ColosseumMewText + call PrintText + ld a, $2 + ret + +DuplicateSpecies:: + ld hl, ColosseumDifferentMonsText + call PrintText + ld a, $3 + ret + +LevelAbove55:: + ld hl, ColosseumMaxL55Text + call PrintText + ld a, $4 + ret + +LevelUnder50:: + ld hl, ColosseumMinL50Text + call PrintText + ld a, $5 + ret + +CombinedLevelsGreaterThan155:: + ld hl, ColosseumTotalL155Text + call PrintText + ld a, $6 + ret + +LevelAbove30:: + ld hl, ColosseumMaxL30Text + call PrintText + ld a, $7 + ret + +LevelUnder25:: + ld hl, ColosseumMinL25Text + call PrintText + ld a, $8 + ret + +CombinedLevelsAbove80:: + ld hl, ColosseumTotalL80Text + call PrintText + ld a, $9 + ret + +LevelAbove20:: + ld hl, ColosseumMaxL20Text + call PrintText + ld a, $a + ret + +LevelUnder15:: + ld hl, ColosseumMinL15Text + call PrintText + ld a, $b + ret + +CombinedLevelsAbove50:: + ld hl, ColosseumTotalL50Text + call PrintText + ld a, $c + ret + +asm_f5689:: + pop af + pop bc + pop hl + ld [wd11e], a + call GetMonName + ld hl, ColosseumHeightText + call PrintText + ld a, $d + ret + +asm_f569b:: + pop af + pop bc + pop hl + ld [wd11e], a + call GetMonName + ld hl, ColosseumWeightText + call PrintText + ld a, $e + ret + +asm_f56ad:: + ld a, [hl] + ld [wd11e], a + call GetMonName + ld hl, ColosseumEvolvedText + call PrintText + ld a, $f + ret + +Func_f56bd:: + xor a + ldh [hAutoBGTransferEnabled], a + coord hl, 1, 11 + lb bc, 6, 18 + call ClearScreenArea + ld a, [wCurrentMenuItem] + cp $3 + jr nc, .asm_f56e6 + ld hl, PointerTable_f56ee + ld a, [wCurrentMenuItem] + ld c, a + ld b, $0 + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld d, h + ld e, l + coord hl, 1, 12 + call PlaceString +.asm_f56e6 + call Delay3 + ld a, $1 + ldh [hAutoBGTransferEnabled], a + ret + +PointerTable_f56ee:: + dw Text_f56f4 + dw Text_f5728 + dw Text_f575b + +Text_f56f4:: + db "LVs of 3<PKMN>:50-55" + next "Sum of LVs:155 MAX" + next "MEW can't attend.@" + +Text_f5728:: + db "LVs of 3<PKMN>:15-20" + next "Sum of LVs:50 MAX" + next "MEW can't attend.@" + +Text_f575b:: + db "3 Basic <PKMN>.LV25-30" + next "Sum of LVs:80 MAX" + next "6’8” and 44lb MAX@" + +Text_f5791:: + db "View" + next "Rules@" + +Text_f579c:: + db "# Cup" + next "Pika Cup" + next "Petit Cup" + next "CANCEL@" + +Colosseum3MonsText:: + text_far _Colosseum3MonsText + text_end + +ColosseumMewText:: + text_far _ColosseumMewText + text_end + +ColosseumDifferentMonsText:: + text_far _ColosseumDifferentMonsText + text_end + +ColosseumMaxL55Text:: + text_far _ColosseumMaxL55Text + text_end + +ColosseumMinL50Text:: + text_far _ColosseumMinL50Text + text_end + +ColosseumTotalL155Text:: + text_far _ColosseumTotalL155Text + text_end + +ColosseumMaxL30Text:: + text_far _ColosseumMaxL30Text + text_end + +ColosseumMinL25Text:: + text_far _ColosseumMinL25Text + text_end + +ColosseumTotalL80Text:: + text_far _ColosseumTotalL80Text + text_end + +ColosseumMaxL20Text:: + text_far _ColosseumMaxL20Text + text_end + +ColosseumMinL15Text:: + text_far _ColosseumMinL15Text + text_end + +ColosseumTotalL50Text:: + text_far _ColosseumTotalL50Text + text_end + +ColosseumHeightText:: + text_far _ColosseumHeightText + text_end + +ColosseumWeightText:: + text_far _ColosseumWeightText + text_end + +ColosseumEvolvedText:: + text_far _ColosseumEvolvedText + text_end + +ColosseumIneligibleText:: + text_far _ColosseumIneligibleText + text_end + +LinkMenu: + xor a + ld [wLetterPrintingDelayFlags], a + ld hl, wd72e + set 6, [hl] + ld hl, TextTerminator_f5a16 + call PrintText + call SaveScreenTilesToBuffer1 + ld hl, ColosseumWhereToText + call PrintText + hlcoord 5, 3 + lb bc, 8, 13 + call TextBoxBorder + call UpdateSprites + hlcoord 7, 5 + ld de, TradeCenterText + call PlaceString + xor a + ld [wUnusedCD37], a + ld [wd72d], a + ld [wd11e], a + ld hl, wTopMenuItemY + ld a, $5 + ld [hli], a + ld a, $6 + ld [hli], a + xor a + ld [hli], a + inc hl + ld a, $3 + ld [hli], a + ld [hli], a + xor a + ld [hl], a +.waitForInputLoop + call HandleMenuInput + and A_BUTTON | B_BUTTON + add a + add a + ld b, a + ld a, [wCurrentMenuItem] + cp $3 + jr nz, .asm_f586b + bit 2, b + jr z, .asm_f586b + dec a + ld b, $8 +.asm_f586b + add b + add $d0 + ld [wLinkMenuSelectionSendBuffer], a + ld [wLinkMenuSelectionSendBuffer + 1], a +.exchangeMenuSelectionLoop + call Serial_ExchangeLinkMenuSelection + ld a, [wLinkMenuSelectionReceiveBuffer] + ld b, a + and $f0 + cp $d0 + jr z, .asm_f5c7d + ld a, [wLinkMenuSelectionReceiveBuffer + 1] + ld b, a + and $f0 + cp $d0 + jr nz, .exchangeMenuSelectionLoop +.asm_f5c7d + ld a, b + and $c ; did the enemy press A or B? + jr nz, .enemyPressedAOrB +; the enemy didn't press A or B + ld a, [wLinkMenuSelectionSendBuffer] + and $c ; did the player press A or B? + jr z, .waitForInputLoop ; if neither the player nor the enemy pressed A or B, try again + jr .doneChoosingMenuSelection ; if the player pressed A or B but the enemy didn't, use the player's selection +.enemyPressedAOrB + ld a, [wLinkMenuSelectionSendBuffer] + and $c ; did the player press A or B? + jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection +; the enemy and the player both pressed A or B +; The gameboy that is clocking the connection wins. + ldh a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK + jr z, .doneChoosingMenuSelection +.useEnemyMenuSelection + ld a, $1 + ld [wd11e], a + ld a, b + ld [wLinkMenuSelectionSendBuffer], a + and $3 + ld [wCurrentMenuItem], a ; wCurrentMenuItem +.doneChoosingMenuSelection + ldh a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK + jr nz, .skipStartingTransfer + call DelayFrame + call DelayFrame + ld a, START_TRANSFER_INTERNAL_CLOCK + ldh [rSC], a +.skipStartingTransfer + ld b, " " + ld c, " " + ld d, " " + ld e, "▷" + ld a, [wLinkMenuSelectionSendBuffer] + and (B_BUTTON << 2) ; was B button pressed? + jr nz, .updateCursorPosition +; A button was pressed + ld a, [wCurrentMenuItem] + cp $2 + jp z, .asm_f5963 + ld b, e + ld e, c + ld a, [wCurrentMenuItem] + and a + jr z, .updateCursorPosition + ld c, b + ld b, d + dec a + jr z, .updateCursorPosition + ld d, c + ld c, b +.updateCursorPosition + call Func_f59ec + call LoadScreenTilesFromBuffer1 + ld a, [wLinkMenuSelectionSendBuffer] + and (B_BUTTON << 2) ; was B button pressed? + jr nz, .choseCancel ; cancel if B pressed + ld a, [wCurrentMenuItem] + cp $2 + jr z, .choseCancel + xor a + ld [wWalkBikeSurfState], a ; start walking + ld a, [wCurrentMenuItem] + and a + ld a, COLOSSEUM + jr nz, .next + ld a, TRADE_CENTER +.next + ld [wd72d], a + ld hl, ColosseumPleaseWaitText + call PrintText + ld c, 50 + call DelayFrames + ld hl, wd732 + res 1, [hl] + ld a, [wDefaultMap] + ld [wDestinationMap], a + callfar SpecialWarpIn + ld c, 20 + call DelayFrames + xor a + ld [wMenuJoypadPollCount], a + ld [wSerialExchangeNybbleSendData], a + inc a ; LINK_STATE_IN_CABLE_CLUB + ld [wLinkState], a + ld [wEnteringCableClub], a + jpfar SpecialEnterMap +.choseCancel + xor a + ld [wMenuJoypadPollCount], a + call Delay3 + callfar CloseLinkConnection + ld hl, ColosseumCanceledText + call PrintText + ld hl, wd72e + res 6, [hl] + ret + +.asm_f5963 + ld a, [wd11e] + and a + jr nz, .asm_f5974 + ld b, " " + ld c, " " + ld d, "▷" + ld e, " " + call Func_f59ec +.asm_f5974 + xor a + ld [wBuffer], a + ld a, $ff + ld [wSerialExchangeNybbleReceiveData], a + ld a, $b + ld [wLinkMenuSelectionSendBuffer], a + ld b, $78 +.loop + ldh a, [hSerialConnectionStatus] + cp $2 + call z, DelayFrame + dec b + jr z, .asm_f59b2 + call Serial_ExchangeNybble + call DelayFrame + ld a, [wSerialExchangeNybbleReceiveData] + inc a + jr z, .loop + ld b, $f +.loop2 + call DelayFrame + call Serial_ExchangeNybble + dec b + jr nz, .loop2 + ld b, $f +.loop3 + call DelayFrame + call Serial_SendZeroByte + dec b + jr nz, .loop3 + jr .asm_f59d6 + +.asm_f59b2 + xor a + ld [wUnknownSerialCounter], a + ld [wUnknownSerialCounter+1], a + ld a, [wd11e] + and a + jr z, .asm_f59cd + ld b, " " + ld c, " " + ld d, " " + ld e, "▷" + call Func_f59ec + jp .choseCancel + +.asm_f59cd + ld hl, ColosseumVersionText + call PrintText + jp .choseCancel + +.asm_f59d6 + ld b, " " + ld c, " " + ld d, "▷" + ld e, " " + call Func_f59ec + call Func_f531b + jp c, .choseCancel + ld a, $f0 + jp .next + +Func_f59ec:: + ld a, b + ldcoord_a 6, 5 + ld a, c + ldcoord_a 6, 7 + ld a, d + ldcoord_a 6, 9 + ld a, e + ldcoord_a 6, 11 + ld c, 40 + call DelayFrames + ret + +ColosseumWhereToText: + text_far _ColosseumWhereToText + text_end + +ColosseumPleaseWaitText: + text_far _ColosseumPleaseWaitText + text_end + +ColosseumCanceledText: + text_far _ColosseumCanceledText + text_end + +ColosseumVersionText: + text_far _ColosseumVersionText + text_end + +TextTerminator_f5a16: + text_end + +TradeCenterText: + db "TRADE CENTER" + next "COLOSSEUM" + next "COLOSSEUM2" + next "CANCEL@" diff --git a/engine/menu/main_menu.asm b/engine/menus/main_menu.asm index ce27ebba..7d81d2f6 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -33,18 +33,18 @@ MainMenu: cp 1 jr z, .noSaveFile ; there's a save file - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 6, 13 call TextBoxBorder - coord hl, 2, 2 + hlcoord 2, 2 ld de, ContinueText call PlaceString jr .next2 .noSaveFile - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 4, 13 call TextBoxBorder - coord hl, 2, 2 + hlcoord 2, 2 ld de, NewGameText call PlaceString .next2 @@ -92,11 +92,11 @@ MainMenu: set 5, [hl] .inputLoop xor a - ld [hJoyPressed], a - ld [hJoyReleased], a - ld [hJoyHeld], a + ldh [hJoyPressed], a + ldh [hJoyReleased], a + ldh [hJoyHeld], a call Joypad - ld a, [hJoyHeld] + ldh a, [hJoyHeld] bit 0, a jr nz, .pressedA bit 1, a @@ -141,12 +141,13 @@ Func_5cc1: ret NotEnoughMemoryText: - TX_FAR _NotEnoughMemoryText - db "@" + text_far _NotEnoughMemoryText + text_end StartNewGame: ld hl, wd732 res 1, [hl] +StartNewGameDebug: call OakSpeech ld a, $8 ld [wPlayerMovingDirection], a @@ -154,11 +155,11 @@ StartNewGame: call DelayFrames ; enter map after using a special warp or loading the game from the main menu -SpecialEnterMap: +SpecialEnterMap:: xor a - ld [hJoyPressed], a - ld [hJoyHeld], a - ld [hJoy5], a + ldh [hJoyPressed], a + ldh [hJoyHeld], a + ldh [hJoy5], a ld [wd72d], a ld hl, wd732 set 0, [hl] ; count play time @@ -172,7 +173,9 @@ SpecialEnterMap: jp EnterMap ContinueText: - db "CONTINUE", $4e + db "CONTINUE" + next "" + ; fallthrough NewGameText: db "NEW GAME" @@ -180,49 +183,49 @@ NewGameText: DisplayContinueGameInfo: xor a - ld [H_AUTOBGTRANSFERENABLED], a - coord hl, 4, 7 + ldh [hAutoBGTransferEnabled], a + hlcoord 4, 7 lb bc, 8, 14 call TextBoxBorder - coord hl, 5, 9 + hlcoord 5, 9 ld de, SaveScreenInfoText call PlaceString - coord hl, 12, 9 + hlcoord 12, 9 ld de, wPlayerName call PlaceString - coord hl, 17, 11 + hlcoord 17, 11 call PrintNumBadges - coord hl, 16, 13 + hlcoord 16, 13 call PrintNumOwnedMons - coord hl, 13, 15 + hlcoord 13, 15 call PrintPlayTime ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a ld c, 30 jp DelayFrames PrintSaveScreenText: xor a - ld [H_AUTOBGTRANSFERENABLED], a - coord hl, 4, 0 + ldh [hAutoBGTransferEnabled], a + hlcoord 4, 0 lb bc, 8, 14 call TextBoxBorder call LoadTextBoxTilePatterns call UpdateSprites - coord hl, 5, 2 + hlcoord 5, 2 ld de, SaveScreenInfoText call PlaceString - coord hl, 12, 2 + hlcoord 12, 2 ld de, wPlayerName call PlaceString - coord hl, 17, 4 + hlcoord 17, 4 call PrintNumBadges - coord hl, 16, 6 + hlcoord 16, 6 call PrintNumOwnedMons - coord hl, 13, 8 + hlcoord 13, 8 call PrintPlayTime ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a ld c, 30 jp DelayFrames @@ -263,7 +266,7 @@ SaveScreenInfoText: next "TIME@" DisplayOptionMenu: - callab DisplayOptionMenu_ + callfar DisplayOptionMenu_ ret CheckForPlayerNameInSRAM: diff --git a/engine/menu/naming_screen.asm b/engine/menus/naming_screen.asm index 2560677a..553c47d0 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -4,7 +4,7 @@ AskName: push hl ld a, [wIsInBattle] dec a - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 4, 11 call z, ClearScreenArea ; only if in wild battle ld a, [wcf91] @@ -12,7 +12,7 @@ AskName: call GetMonName ld hl, DoYouWantToNicknameText call PrintText - coord hl, 14, 7 + hlcoord 14, 7 lb bc, 8, 15 ld a, TWO_OPTION_MENU ld [wTextBoxID], a @@ -49,10 +49,10 @@ AskName: jp CopyData DoYouWantToNicknameText: - TX_FAR _DoYouWantToNicknameText - db "@" + text_far _DoYouWantToNicknameText + text_end -DisplayNameRaterScreen: +DisplayNameRaterScreen:: ld hl, wBuffer xor a ld [wUpdateSpritesEnabled], a @@ -91,8 +91,8 @@ DisplayNamingScreen: call RunPaletteCommand call LoadHpBarAndStatusTilePatterns call LoadEDTile - callba LoadMonPartySpriteGfx - coord hl, 0, 4 + farcall LoadMonPartySpriteGfx + hlcoord 0, 4 lb bc, 9, 18 call TextBoxBorder call PrintNamingText @@ -126,11 +126,11 @@ DisplayNamingScreen: .inputLoop ld a, [wCurrentMenuItem] push af - callba AnimatePartyMon_ForceSpeed1 + farcall AnimatePartyMon_ForceSpeed1 pop af ld [wCurrentMenuItem], a call JoypadLowSensitivity - ld a, [hJoyPressed] + ldh a, [hJoyPressed] and a jr z, .inputLoop ld hl, .namingScreenButtonFunctions @@ -170,7 +170,7 @@ DisplayNamingScreen: ld a, [wIsInBattle] and a jp z, LoadTextBoxTilePatterns - jpab LoadHudTilePatterns + jpfar LoadHudTilePatterns .namingScreenButtonFunctions dw .dPadReturnPoint @@ -229,10 +229,10 @@ DisplayNamingScreen: ld [wNamingScreenLetter], a call CalcStringLength ld a, [wNamingScreenLetter] - cp $e5 + cp "゙" ld de, Dakutens jr z, .dakutensAndHandakutens - cp $e4 + cp "゚" ld de, Handakutens jr z, .dakutensAndHandakutens ld a, [wNamingScreenType] @@ -327,10 +327,10 @@ LoadEDTile: ; Because Yellow uses the MBC5, loading $0 into $2000 - $2fff range will load bank0 instead of bank1 and thus incorrectly load the tile ; Instead of defining the correct bank, GameFreak decided to simply copy the ED_Tile in the function during HBlank ld de, ED_Tile - ld hl, vFont + $700 + ld hl, vFont tile $70 ld c, $4 ; number of copies needed .waitForHBlankLoop - ld a, [rSTAT] + ldh a, [rSTAT] and %10 ; in HBlank? jr nz, .waitForHBlankLoop ld a, [de] @@ -346,19 +346,19 @@ LoadEDTile: ret ED_Tile: - INCBIN "gfx/ED_tile.1bpp" + INCBIN "gfx/font/ED.1bpp" ED_TileEnd: PrintAlphabet: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a ld a, [wAlphabetCase] and a ld de, LowerCaseAlphabet jr nz, .lowercase ld de, UpperCaseAlphabet .lowercase - coord hl, 2, 5 + hlcoord 2, 5 lb bc, 5, 9 ; 5 rows, 9 columns .outerLoop push bc @@ -376,26 +376,22 @@ PrintAlphabet: jr nz, .outerLoop call PlaceString ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a jp Delay3 -LowerCaseAlphabet: - db "abcdefghijklmnopqrstuvwxyz ×():;[]",$e1,$e2,"-?!♂♀/⠄,¥UPPER CASE@" - -UpperCaseAlphabet: - db "ABCDEFGHIJKLMNOPQRSTUVWXYZ ×():;[]",$e1,$e2,"-?!♂♀/⠄,¥lower case@" +INCLUDE "data/text/alphabets.asm" PrintNicknameAndUnderscores: call CalcStringLength ld a, c ld [wNamingScreenNameLength], a - coord hl, 10, 2 + hlcoord 10, 2 lb bc, 1, 10 call ClearScreenArea - coord hl, 10, 2 + hlcoord 10, 2 ld de, wcf4b call PlaceString - coord hl, 10, 3 + hlcoord 10, 3 ld a, [wNamingScreenType] cp NAME_MON_SCREEN jr nc, .pokemon1 @@ -434,7 +430,7 @@ PrintNicknameAndUnderscores: .emptySpacesRemaining ld c, a ld b, $0 - coord hl, 10, 3 + hlcoord 10, 3 add hl, bc ld [hl], $77 ; raised underscore tile id ret @@ -453,21 +449,7 @@ DakutensAndHandakutens: ld [wNamingScreenLetter], a ret -Dakutens: - db "かが", "きぎ", "くぐ", "けげ", "こご" - db "さざ", "しじ", "すず", "せぜ", "そぞ" - db "ただ", "ちぢ", "つづ", "てで", "とど" - db "はば", "ひび", "ふぶ", "へべ", "ほぼ" - db "カガ", "キギ", "クグ", "ケゲ", "コゴ" - db "サザ", "シジ", "スズ", "セゼ", "ソゾ" - db "タダ", "チヂ", "ツヅ", "テデ", "トド" - db "ハバ", "ヒビ", "フブ", "へべ", "ホボ" - db $ff - -Handakutens: - db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ" - db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ" - db $ff +INCLUDE "data/text/dakutens.asm" ; calculates the length of the string at wcf4b and stores it in c CalcStringLength: @@ -482,7 +464,7 @@ CalcStringLength: jr .loop PrintNamingText: - coord hl, 0, 1 + hlcoord 0, 1 ld a, [wNamingScreenType] ld de, YourTextString and a @@ -493,16 +475,16 @@ PrintNamingText: ld a, [wcf91] ld [wMonPartySpriteSpecies], a push af - callba WriteMonPartySpriteOAMBySpecies + farcall WriteMonPartySpriteOAMBySpecies pop af ld [wd11e], a call GetMonName - coord hl, 4, 1 + hlcoord 4, 1 call PlaceString ld hl, $1 add hl, bc - ld [hl], $c9 - coord hl, 1, 3 + ld [hl], "の" ; leftover from Japanese version; blank tile $c9 in English + hlcoord 1, 3 ld de, NicknameTextString jr .placeString .notNickname diff --git a/engine/menus/oaks_pc.asm b/engine/menus/oaks_pc.asm new file mode 100755 index 00000000..7743e5df --- /dev/null +++ b/engine/menus/oaks_pc.asm @@ -0,0 +1,28 @@ +OpenOaksPC: + call SaveScreenTilesToBuffer2 + ld hl, AccessedOaksPCText + call PrintText + ld hl, GetDexRatedText + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .closePC + predef DisplayDexRating +.closePC + ld hl, ClosedOaksPCText + call PrintText + jp LoadScreenTilesFromBuffer2 + +GetDexRatedText: + text_far _GetDexRatedText + text_end + +ClosedOaksPCText: + text_far _ClosedOaksPCText + text_waitbutton + text_end + +AccessedOaksPCText: + text_far _AccessedOaksPCText + text_end diff --git a/engine/menu/options.asm b/engine/menus/options.asm index da89ad82..110bef2a 100644 --- a/engine/menu/options.asm +++ b/engine/menus/options.asm @@ -2,7 +2,7 @@ DisplayOptionMenu_: call InitOptionsMenu .optionMenuLoop call JoypadLowSensitivity - ld a, [hJoy5] + ldh a, [hJoy5] and START | B_BUTTON jr nz, .exitOptionMenu call OptionsControl @@ -42,7 +42,7 @@ OptionMenuJumpTable: OptionsMenu_TextSpeed: call GetTextSpeed - ld a, [hJoy5] + ldh a, [hJoy5] bit 4, a ; right jr nz, .pressedRight bit 5, a @@ -79,7 +79,7 @@ OptionsMenu_TextSpeed: ld e, [hl] inc hl ld d, [hl] - coord hl, 14, 2 + hlcoord 14, 2 call PlaceString and a ret @@ -117,7 +117,7 @@ GetTextSpeed: ret OptionsMenu_BattleAnimations: - ld a, [hJoy5] + ldh a, [hJoy5] and D_RIGHT | D_LEFT jr nz, .asm_41d33 ld a, [wOptions] @@ -137,7 +137,7 @@ OptionsMenu_BattleAnimations: ld e, [hl] inc hl ld d, [hl] - coord hl, 14, 4 + hlcoord 14, 4 call PlaceString and a ret @@ -152,7 +152,7 @@ AnimationOffText: db "OFF@" OptionsMenu_BattleStyle: - ld a, [hJoy5] + ldh a, [hJoy5] and D_LEFT | D_RIGHT jr nz, .asm_41d6b ld a, [wOptions] @@ -173,7 +173,7 @@ OptionsMenu_BattleStyle: ld e, [hl] inc hl ld d, [hl] - coord hl, 14, 6 + hlcoord 14, 6 call PlaceString and a ret @@ -192,7 +192,7 @@ OptionsMenu_SpeakerSettings: and $30 swap a ld c, a - ld a, [hJoy5] + ldh a, [hJoy5] bit 4, a jr nz, .pressedRight bit 5, a @@ -212,7 +212,7 @@ OptionsMenu_SpeakerSettings: swap a ld b, a xor a - ld [rNR51], a + ldh [rNR51], a ld a, [wOptions] and $cf or b @@ -225,7 +225,7 @@ OptionsMenu_SpeakerSettings: ld e, [hl] inc hl ld d, [hl] - coord hl, 8, 8 + hlcoord 8, 8 call PlaceString and a ret @@ -247,7 +247,7 @@ Earphone3SoundText: OptionsMenu_GBPrinterBrightness: call Func_41e7b - ld a, [hJoy5] + ldh a, [hJoy5] bit 4, a jr nz, .pressedRight bit 5, a @@ -281,7 +281,7 @@ OptionsMenu_GBPrinterBrightness: ld e, [hl] inc hl ld d, [hl] - coord hl, 8, 10 + hlcoord 8, 10 call PlaceString and a ret @@ -339,7 +339,7 @@ OptionsMenu_Dummy: ret OptionsMenu_Cancel: - ld a, [hJoy5] + ldh a, [hJoy5] and A_BUTTON jr nz, .pressedCancel and a @@ -350,7 +350,7 @@ OptionsMenu_Cancel: OptionsControl: ld hl, wOptionsCursorLocation - ld a, [hJoy5] + ldh a, [hJoy5] cp D_DOWN jr z, .pressedDown cp D_UP @@ -389,7 +389,7 @@ OptionsControl: ret OptionsMenu_UpdateCursorPosition: - coord hl, 1, 1 + hlcoord 1, 1 ld de, SCREEN_WIDTH ld c, 16 .loop @@ -397,7 +397,7 @@ OptionsMenu_UpdateCursorPosition: add hl, de dec c jr nz, .loop - coord hl, 1, 2 + hlcoord 1, 2 ld bc, SCREEN_WIDTH * 2 ld a, [wOptionsCursorLocation] call AddNTimes @@ -405,13 +405,13 @@ OptionsMenu_UpdateCursorPosition: ret InitOptionsMenu: - coord hl, 0, 0 + hlcoord 0, 0 lb bc, SCREEN_HEIGHT - 2, SCREEN_WIDTH - 2 call TextBoxBorder - coord hl, 2, 2 + hlcoord 2, 2 ld de, AllOptionsText call PlaceString - coord hl, 2, 16 + hlcoord 2, 16 ld de, OptionMenuCancelText call PlaceString xor a @@ -428,7 +428,7 @@ InitOptionsMenu: xor a ld [wOptionsCursorLocation], a inc a - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a call Delay3 ret diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm new file mode 100755 index 00000000..32f47f6a --- /dev/null +++ b/engine/menus/party_menu.asm @@ -0,0 +1,314 @@ +DrawPartyMenu_:: + xor a + ldh [hAutoBGTransferEnabled], a + call ClearScreen + call UpdateSprites + farcall LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics + +RedrawPartyMenu_:: + ld a, [wPartyMenuTypeOrMessageID] + cp SWAP_MONS_PARTY_MENU + jp z, .printMessage + call ErasePartyMenuCursors + farcall InitPartyMenuBlkPacket + hlcoord 3, 0 + ld de, wPartySpecies + xor a + ld c, a + ldh [hPartyMonIndex], a + ld [wWhichPartyMenuHPBar], a +.loop + ld a, [de] + cp $FF ; reached the terminator? + jp z, .afterDrawingMonEntries + push bc + push de + push hl + ld a, c + push hl + ld hl, wPartyMonNicks + call GetPartyMonName + pop hl + call PlaceString ; print the pokemon's name + ldh a, [hPartyMonIndex] + ld [wWhichPokemon], a + callfar IsThisPartymonStarterPikachu_Party + jr nc, .regularMon + call CheckPikachuFollowingPlayer + jr z, .regularMon + ld a, $ff + ldh [hPartyMonIndex], a +.regularMon + farcall WriteMonPartySpriteOAMByPartyIndex ; place the appropriate pokemon icon + ld a, [wWhichPokemon] + inc a + ldh [hPartyMonIndex], a + call LoadMonData + pop hl + push hl + ld a, [wMenuItemToSwap] + and a ; is the player swapping pokemon positions? + jr z, .skipUnfilledRightArrow +; if the player is swapping pokemon positions + dec a + ld b, a + ld a, [wWhichPokemon] + cp b ; is the player swapping the current pokemon in the list? + jr nz, .skipUnfilledRightArrow +; the player is swapping the current pokemon in the list + dec hl + dec hl + dec hl + ld a, "▷" ; unfilled right arrow menu cursor + ld [hli], a ; place the cursor + inc hl + inc hl +.skipUnfilledRightArrow + ld a, [wPartyMenuTypeOrMessageID] ; menu type + cp TMHM_PARTY_MENU + jr z, .teachMoveMenu + cp EVO_STONE_PARTY_MENU + jr z, .evolutionStoneMenu + push hl + ld bc, 14 ; 14 columns to the right + add hl, bc + ld de, wLoadedMonStatus + call PrintStatusCondition + pop hl + push hl + ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column + ldh a, [hFlagsFFFA] + set 0, a + ldh [hFlagsFFFA], a + add hl, bc + predef DrawHP2 ; draw HP bar and prints current / max HP + ldh a, [hFlagsFFFA] + res 0, a + ldh [hFlagsFFFA], a + call SetPartyMenuHPBarColor ; color the HP bar (on SGB) + pop hl + jr .printLevel +.teachMoveMenu + push hl + predef CanLearnTM ; check if the pokemon can learn the move + pop hl + ld de, .ableToLearnMoveText + ld a, c + and a + jr nz, .placeMoveLearnabilityString + ld de, .notAbleToLearnMoveText +.placeMoveLearnabilityString + push hl + ld bc, 20 + 9 ; down 1 row and right 9 columns + add hl, bc + call PlaceString + pop hl +.printLevel + ld bc, 10 ; move 10 columns to the right + add hl, bc + call PrintLevel + pop hl + pop de + inc de + ld bc, 2 * 20 + add hl, bc + pop bc + inc c + jp .loop +.ableToLearnMoveText + db "ABLE@" +.notAbleToLearnMoveText + db "NOT ABLE@" +.evolutionStoneMenu + push hl + ld hl, EvosMovesPointerTable + ld b, 0 + ld a, [wLoadedMonSpecies] + dec a + add a + rl b + ld c, a + add hl, bc + ld de, wEvosMoves + ld a, BANK(EvosMovesPointerTable) + ld bc, 2 + call FarCopyData + ld hl, wEvosMoves + ld a, [hli] + ld h, [hl] + ld l, a + ld de, wEvosMoves + ld a, BANK(EvosMovesPointerTable) + ld bc, wEvosMoves.end - wEvosMoves + call FarCopyData + ld hl, wEvosMoves + ld de, .notAbleToEvolveText +; loop through the pokemon's evolution entries +.checkEvolutionsLoop + ld a, [hli] + and a ; reached terminator? + jr z, .placeEvolutionStoneString ; if so, place the "NOT ABLE" string + inc hl + inc hl + cp EV_ITEM + jr nz, .checkEvolutionsLoop +; if it's a stone evolution entry + dec hl + dec hl + ld b, [hl] + ld a, [wEvoStoneItemID] ; the stone the player used + inc hl + inc hl + inc hl + cp b ; does the player's stone match this evolution entry's stone? + jr nz, .checkEvolutionsLoop +; if it does match + ld de, .ableToEvolveText +.placeEvolutionStoneString + pop hl + push hl + ld bc, 20 + 9 ; down 1 row and right 9 columns + add hl, bc + call PlaceString + pop hl + jr .printLevel +.ableToEvolveText + db "ABLE@" +.notAbleToEvolveText + db "NOT ABLE@" +.afterDrawingMonEntries + ld b, SET_PAL_PARTY_MENU + call RunPaletteCommand +.printMessage + ld hl, wd730 + ld a, [hl] + push af + push hl + set 6, [hl] ; turn off letter printing delay + ld a, [wPartyMenuTypeOrMessageID] ; message ID + cp FIRST_PARTY_MENU_TEXT_ID + jr nc, .printItemUseMessage + add a + ld hl, PartyMenuMessagePointers + ld b, 0 + ld c, a + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + call PrintText +.done + pop hl + pop af + ld [hl], a + ld a, 1 + ldh [hAutoBGTransferEnabled], a + call Delay3 + jp GBPalNormal +.printItemUseMessage + and $0F + ld hl, PartyMenuItemUseMessagePointers + add a + ld c, a + ld b, 0 + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + push hl + ld a, [wUsedItemOnWhichPokemon] + ld hl, wPartyMonNicks + call GetPartyMonName + pop hl + call PrintText + jr .done + +PartyMenuItemUseMessagePointers: + dw AntidoteText + dw BurnHealText + dw IceHealText + dw AwakeningText + dw ParlyzHealText + dw PotionText + dw FullHealText + dw ReviveText + dw RareCandyText + +PartyMenuMessagePointers: + dw PartyMenuNormalText + dw PartyMenuItemUseText + dw PartyMenuBattleText + dw PartyMenuUseTMText + dw PartyMenuSwapMonText + dw PartyMenuItemUseText + +PartyMenuNormalText: + text_far _PartyMenuNormalText + text_end + +PartyMenuItemUseText: + text_far _PartyMenuItemUseText + text_end + +PartyMenuBattleText: + text_far _PartyMenuBattleText + text_end + +PartyMenuUseTMText: + text_far _PartyMenuUseTMText + text_end + +PartyMenuSwapMonText: + text_far _PartyMenuSwapMonText + text_end + +PotionText: + text_far _PotionText + text_end + +AntidoteText: + text_far _AntidoteText + text_end + +ParlyzHealText: + text_far _ParlyzHealText + text_end + +BurnHealText: + text_far _BurnHealText + text_end + +IceHealText: + text_far _IceHealText + text_end + +AwakeningText: + text_far _AwakeningText + text_end + +FullHealText: + text_far _FullHealText + text_end + +ReviveText: + text_far _ReviveText + text_end + +RareCandyText: + text_far _RareCandyText + sound_get_item_1 ; probably supposed to play SFX_LEVEL_UP but the wrong music bank is loaded + text_promptbutton + text_end + +SetPartyMenuHPBarColor: + ld hl, wPartyMenuHPBarColors + ld a, [wWhichPartyMenuHPBar] + ld c, a + ld b, 0 + add hl, bc + call GetHealthBarColor + ld b, SET_PAL_PARTY_MENU_HP_BARS + call RunPaletteCommand + ld hl, wWhichPartyMenuHPBar + inc [hl] + ret diff --git a/engine/menu/pc.asm b/engine/menus/pc.asm index 5639bd99..4c340e7b 100755 --- a/engine/menu/pc.asm +++ b/engine/menus/pc.asm @@ -1,4 +1,4 @@ -ActivatePC: +ActivatePC:: call SaveScreenTilesToBuffer2 ld a, SFX_TURN_ON_PC call PlaySound @@ -10,7 +10,7 @@ ActivatePC: call LoadScreenTilesFromBuffer2 call Delay3 PCMainMenu: - callba DisplayPCMainMenu + farcall DisplayPCMainMenu ld hl, wFlags_0xcd60 set 5, [hl] call HandleMenuInput @@ -56,19 +56,19 @@ PCMainMenu: call WaitForSoundToFinish ld hl, AccessedMyPCText call PrintText - callba PlayerPC + farcall PlayerPC jr ReloadMainMenu OaksPC: ld a, SFX_ENTER_PC call PlaySound call WaitForSoundToFinish - callba OpenOaksPC + farcall OpenOaksPC jr ReloadMainMenu PKMNLeague: ld a, SFX_ENTER_PC call PlaySound call WaitForSoundToFinish - callba PKMNLeaguePC + farcall PKMNLeaguePC jr ReloadMainMenu BillsPC: ld a, SFX_ENTER_PC @@ -82,7 +82,7 @@ BillsPC: ld hl, AccessedBillsPCText .printText call PrintText - callba BillsPC_ + farcall BillsPC_ ReloadMainMenu: xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a @@ -99,28 +99,28 @@ LogOff: ret TurnedOnPC1Text: - TX_FAR _TurnedOnPC1Text - db "@" + text_far _TurnedOnPC1Text + text_end AccessedBillsPCText: - TX_FAR _AccessedBillsPCText - db "@" + text_far _AccessedBillsPCText + text_end AccessedSomeonesPCText: - TX_FAR _AccessedSomeonesPCText - db "@" + text_far _AccessedSomeonesPCText + text_end AccessedMyPCText: - TX_FAR _AccessedMyPCText - db "@" + text_far _AccessedMyPCText + text_end ; removes one of the specified item ID [hItemToRemoveID] from bag (if existent) -RemoveItemByID: +RemoveItemByID:: ld hl, wBagItems - ld a, [hItemToRemoveID] + ldh a, [hItemToRemoveID] ld b, a xor a - ld [hItemToRemoveIndex], a + ldh [hItemToRemoveIndex], a .loop ld a, [hli] cp -1 ; reached terminator? @@ -128,14 +128,14 @@ RemoveItemByID: cp b jr z, .foundItem inc hl - ld a, [hItemToRemoveIndex] + ldh a, [hItemToRemoveIndex] inc a - ld [hItemToRemoveIndex], a + ldh [hItemToRemoveIndex], a jr .loop .foundItem ld a, $1 ld [wItemQuantity], a - ld a, [hItemToRemoveIndex] + ldh a, [hItemToRemoveIndex] ld [wWhichPokemon], a ld hl, wNumBagItems jp RemoveItemFromInventory diff --git a/engine/menu/players_pc.asm b/engine/menus/players_pc.asm index 1cc02cbf..1fac030b 100755 --- a/engine/menu/players_pc.asm +++ b/engine/menus/players_pc.asm @@ -1,4 +1,4 @@ -PlayerPC: +PlayerPC:: ld a, ITEM_NAME ld [wNameListType], a call SaveScreenTilesToBuffer1 @@ -22,11 +22,11 @@ PlayerPCMenu: ld hl, wFlags_0xcd60 set 5, [hl] call LoadScreenTilesFromBuffer2 - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 8, 14 call TextBoxBorder call UpdateSprites - coord hl, 2, 2 + hlcoord 2, 2 ld de, PlayersPCMenuEntries call PlaceString ld hl, wTopMenuItemY @@ -246,57 +246,57 @@ PlayersPCMenuEntries: next "LOG OFF@" TurnedOnPC2Text: - TX_FAR _TurnedOnPC2Text - db "@" + text_far _TurnedOnPC2Text + text_end WhatDoYouWantText: - TX_FAR _WhatDoYouWantText - db "@" + text_far _WhatDoYouWantText + text_end WhatToDepositText: - TX_FAR _WhatToDepositText - db "@" + text_far _WhatToDepositText + text_end DepositHowManyText: - TX_FAR _DepositHowManyText - db "@" + text_far _DepositHowManyText + text_end ItemWasStoredText: - TX_FAR _ItemWasStoredText - db "@" + text_far _ItemWasStoredText + text_end NothingToDepositText: - TX_FAR _NothingToDepositText - db "@" + text_far _NothingToDepositText + text_end NoRoomToStoreText: - TX_FAR _NoRoomToStoreText - db "@" + text_far _NoRoomToStoreText + text_end WhatToWithdrawText: - TX_FAR _WhatToWithdrawText - db "@" + text_far _WhatToWithdrawText + text_end WithdrawHowManyText: - TX_FAR _WithdrawHowManyText - db "@" + text_far _WithdrawHowManyText + text_end WithdrewItemText: - TX_FAR _WithdrewItemText - db "@" + text_far _WithdrewItemText + text_end NothingStoredText: - TX_FAR _NothingStoredText - db "@" + text_far _NothingStoredText + text_end CantCarryMoreText: - TX_FAR _CantCarryMoreText - db "@" + text_far _CantCarryMoreText + text_end WhatToTossText: - TX_FAR _WhatToTossText - db "@" + text_far _WhatToTossText + text_end TossHowManyText: - TX_FAR _TossHowManyText - db "@" + text_far _TossHowManyText + text_end diff --git a/engine/menu/pokedex.asm b/engine/menus/pokedex.asm index bc2a7e9b..874fe50f 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -10,9 +10,9 @@ ShowPokedexMenu: ld [wLastMenuItem], a inc a ld [wd11e], a - ld [hJoy7], a + ldh [hJoy7], a .setUpGraphics - callab LoadPokedexTilePatterns + callfar LoadPokedexTilePatterns .loop ld b, SET_PAL_GENERIC call RunPaletteCommand @@ -36,7 +36,7 @@ ShowPokedexMenu: ld [wMenuWatchMovingOutOfBounds], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld [hJoy7], a + ldh [hJoy7], a ld [wWastedByteCD3A], a ld [wOverrideSimulatedJoypadStatesMask], a pop af @@ -97,7 +97,7 @@ HandlePokedexSideMenu: xor a ld [hli], a ; old menu item ID ld [wMenuWatchMovingOutOfBounds], a - ld [hJoy7], a + ldh [hJoy7], a .handleMenuInput call HandleMenuInput bit 1, a ; was the B button pressed? @@ -126,9 +126,9 @@ HandlePokedexSideMenu: pop af ld [wCurrentMenuItem], a ld a, $1 - ld [hJoy7], a + ldh [hJoy7], a push bc - coord hl, 0, 3 + hlcoord 0, 3 ld de, 20 lb bc, " ", 13 call DrawTileLine ; cover up the menu cursor in the pokemon list @@ -137,7 +137,7 @@ HandlePokedexSideMenu: .buttonBPressed push bc - coord hl, 15, 8 + hlcoord 15, 8 ld de, 20 lb bc, " ", 9 call DrawTileLine ; cover up the menu cursor in the side menu @@ -162,18 +162,18 @@ HandlePokedexSideMenu: jr .exitSideMenu .chosePrint - ld a, [hTilesetType] + ldh a, [hTilesetType] push af xor a - ld [hTilesetType], a + ldh [hTilesetType], a ld a, [wd11e] ld [wcf91], a - callab PrintPokedexEntry + callfar PrintPokedexEntry xor a - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a call ClearScreen pop af - ld [hTilesetType], a + ldh [hTilesetType], a ld b, $3 jr .exitSideMenu @@ -257,45 +257,45 @@ HandlePokedexListMenu: Pokedex_DrawInterface: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a ; draw the horizontal line separating the seen and owned amounts from the menu - coord hl, 15, 6 + hlcoord 15, 6 ld a, "─" ld [hli], a ld [hli], a ld [hli], a ld [hli], a ld [hli], a - coord hl, 14, 0 + hlcoord 14, 0 ld [hl], $71 ; vertical line tile - coord hl, 14, 1 + hlcoord 14, 1 call DrawPokedexVerticalLine - coord hl, 14, 9 + hlcoord 14, 9 call DrawPokedexVerticalLine ld hl, wPokedexSeen ld b, wPokedexSeenEnd - wPokedexSeen call CountSetBits ld de, wNumSetBits - coord hl, 16, 2 + hlcoord 16, 2 lb bc, 1, 3 call PrintNumber ; print number of seen pokemon ld hl, wPokedexOwned ld b, wPokedexOwnedEnd - wPokedexOwned call CountSetBits ld de, wNumSetBits - coord hl, 16, 5 + hlcoord 16, 5 lb bc, 1, 3 call PrintNumber ; print number of owned pokemon - coord hl, 16, 1 + hlcoord 16, 1 ld de, PokedexSeenText call PlaceString - coord hl, 16, 4 + hlcoord 16, 4 ld de, PokedexOwnText call PlaceString - coord hl, 1, 1 + hlcoord 1, 1 ld de, PokedexContentsText call PlaceString - coord hl, 16, 8 + hlcoord 16, 8 ld de, PokedexMenuItemsText call PlaceString ; find the highest pokedex number among the pokemon the player has seen @@ -347,11 +347,11 @@ PokedexMenuItemsText: Pokedex_PlacePokemonList: xor a - ld [H_AUTOBGTRANSFERENABLED], a - coord hl, 4, 2 + ldh [hAutoBGTransferEnabled], a + hlcoord 4, 2 lb bc, 14, 10 call ClearScreenArea - coord hl, 1, 3 + hlcoord 1, 3 ld a, [wListScrollOffset] ld [wd11e], a ld d, 7 @@ -411,7 +411,7 @@ Pokedex_PlacePokemonList: dec d jr nz, .printPokemonLoop ld a, 01 - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a call Delay3 ret @@ -434,18 +434,18 @@ ShowPokedexData: call GBPalWhiteOutWithDelay3 call ClearScreen call UpdateSprites - callab LoadPokedexTilePatterns ; load pokedex tiles + callfar LoadPokedexTilePatterns ; load pokedex tiles ; function to display pokedex data from inside the pokedex ShowPokedexDataInternal: ld hl, wd72c set 1, [hl] ld a, $33 ; 3/7 volume - ld [rNR50], a - ld a, [hTilesetType] + ldh [rNR50], a + ldh a, [hTilesetType] push af xor a - ld [hTilesetType], a + ldh [hTilesetType], a call GBPalWhiteOut ; zero all palettes ld a, [wd11e] ; pokemon ID ld [wcf91], a @@ -458,11 +458,11 @@ ShowPokedexDataInternal: call c, Pokedex_PrintFlavorTextAtRow11 .waitForButtonPress call JoypadLowSensitivity - ld a, [hJoy5] + ldh a, [hJoy5] and a, A_BUTTON | B_BUTTON jr z, .waitForButtonPress pop af - ld [hTilesetType], a + ldh [hTilesetType], a call GBPalWhiteOut call ClearScreen call RunDefaultPaletteCommand @@ -471,11 +471,11 @@ ShowPokedexDataInternal: ld hl, wd72c res 1, [hl] ld a, $77 ; max volume - ld [rNR50], a + ldh [rNR50], a ret HeightWeightText: - db "HT ?", $60, "??", $61 + db "HT ?′??″" next "WT ???lb@" ; XXX does anything point to this? @@ -484,52 +484,50 @@ PokeText: ; horizontal line that divides the pokedex text description from the rest of the data PokedexDataDividerLine: - db $68, $69, $6B, $69, $6B - db $69, $6B, $69, $6B, $6B - db $6B, $6B, $69, $6B, $69 - db $6B, $69, $6B, $69, $6A + db $68, $69, $6B, $69, $6B, $69, $6B, $69, $6B, $6B + db $6B, $6B, $69, $6B, $69, $6B, $69, $6B, $69, $6A db "@" DrawDexEntryOnScreen: call ClearScreen - coord hl, 0, 0 + hlcoord 0, 0 ld de, 1 lb bc, $64, SCREEN_WIDTH call DrawTileLine ; draw top border - coord hl, 0, 17 + hlcoord 0, 17 ld b, $6f call DrawTileLine ; draw bottom border - coord hl, 0, 1 + hlcoord 0, 1 ld de, 20 lb bc, $66, $10 call DrawTileLine ; draw left border - coord hl, 19, 1 + hlcoord 19, 1 ld b, $67 call DrawTileLine ; draw right border ld a, $63 ; upper left corner tile - Coorda 0, 0 + ldcoord_a 0, 0 ld a, $65 ; upper right corner tile - Coorda 19, 0 + ldcoord_a 19, 0 ld a, $6c ; lower left corner tile - Coorda 0, 17 + ldcoord_a 0, 17 ld a, $6e ; lower right corner tile - Coorda 19, 17 + ldcoord_a 19, 17 - coord hl, 0, 9 + hlcoord 0, 9 ld de, PokedexDataDividerLine call PlaceString ; draw horizontal divider line - coord hl, 9, 6 + hlcoord 9, 6 ld de, HeightWeightText call PlaceString call GetMonName - coord hl, 9, 2 + hlcoord 9, 2 call PlaceString ld hl, PokedexEntryPointers @@ -543,7 +541,7 @@ DrawDexEntryOnScreen: ld e, a ld d, [hl] ; de = address of pokedex entry - coord hl, 9, 4 + hlcoord 9, 4 call PlaceString ; print species name ld h, b @@ -553,10 +551,10 @@ DrawDexEntryOnScreen: push af call IndexToPokedex - coord hl, 2, 8 + hlcoord 2, 8 ld a, "№" ld [hli], a - ld a, "⠄" + ld a, "<DOT>" ld [hli], a ld de, wd11e lb bc, LEADING_ZEROES | 1, 3 @@ -578,7 +576,7 @@ DrawDexEntryOnScreen: call Delay3 call GBPalNormal call GetMonHeader ; load pokemon picture location - coord hl, 1, 1 + hlcoord 1, 1 call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture ld a, [wcf91] call PlayCry ; play pokemon cry @@ -594,17 +592,17 @@ DrawDexEntryOnScreen: inc de ; de = address of feet (height) ld a, [de] ; reads feet, but a is overwritten without being used - coord hl, 12, 6 + hlcoord 12, 6 lb bc, 1, 2 call PrintNumber ; print feet (height) - ld a, $60 ; feet symbol tile (one tick) + ld a, "′" ld [hl], a inc de inc de ; de = address of inches (height) - coord hl, 15, 6 + hlcoord 15, 6 lb bc, LEADING_ZEROES | 1, 2 call PrintNumber ; print inches (height) - ld a, $61 ; inches symbol tile (two ticks) + ld a, "″" ld [hl], a ; now print the weight (note that weight is stored in tenths of pounds internally) inc de @@ -623,13 +621,13 @@ DrawDexEntryOnScreen: ld a, [de] ; a = lower byte of weight ld [hl], a ; store lower byte of weight in [hDexWeight + 1] ld de, hDexWeight - coord hl, 11, 8 + hlcoord 11, 8 lb bc, 2, 5 ; 2 bytes, 5 digits call PrintNumber ; print weight - coord hl, 14, 8 - ld a, [hDexWeight + 1] + hlcoord 14, 8 + ldh a, [hDexWeight + 1] sub 10 - ld a, [hDexWeight] + ldh a, [hDexWeight] sbc 0 jr nc, .next ld [hl], "0" ; if the weight is less than 10, put a 0 before the decimal point @@ -637,54 +635,54 @@ DrawDexEntryOnScreen: inc hl ld a, [hli] ld [hld], a ; make space for the decimal point by moving the last digit forward one tile - ld [hl], "⠄" ; decimal point tile + ld [hl], "<DOT>" ; decimal point tile pop af - ld [hDexWeight + 1], a ; restore original value of [hDexWeight + 1] + ldh [hDexWeight + 1], a ; restore original value of [hDexWeight + 1] pop af - ld [hDexWeight], a ; restore original value of [hDexWeight] + ldh [hDexWeight], a ; restore original value of [hDexWeight] pop hl inc hl ; hl = address of pokedex description text scf ret Pokedex_PrintFlavorTextAtRow11: - coord bc, 1, 11 + bccoord 1, 11 Pokedex_PrintFlavorTextAtBC: - ld a, 2 - ld [$fff9], a + ld a, %10 + ldh [hClearLetterPrintingDelayFlags], a call TextCommandProcessor ; print pokedex description text xor a - ld [$fff9], a + ldh [hClearLetterPrintingDelayFlags], a ret Pokedex_PrepareDexEntryForPrinting: - coord hl, 0, 0 + hlcoord 0, 0 ld de, SCREEN_WIDTH lb bc, $66, $d call DrawTileLine - coord hl, 19, 0 + hlcoord 19, 0 ld b, $67 call DrawTileLine - coord hl, 0, 13 + hlcoord 0, 13 ld de, $1 lb bc, $6f, SCREEN_WIDTH call DrawTileLine ld a, $6c - Coorda 0, 13 + ldcoord_a 0, 13 ld a, $6e - Coorda 19, 13 + ldcoord_a 19, 13 ld a, [wPrinterPokedexEntryTextPointer] ld l, a ld a, [wPrinterPokedexEntryTextPointer + 1] ld h, a - coord bc, 1, 1 - ld a, [hFlags_0xFFFA] + bccoord 1, 1 + ldh a, [hFlagsFFFA] set 3, a - ld [hFlags_0xFFFA], a + ldh [hFlagsFFFA], a call Pokedex_PrintFlavorTextAtBC - ld a, [hFlags_0xFFFA] + ldh a, [hFlagsFFFA] res 3, a - ld [hFlags_0xFFFA], a + ldh [hFlagsFFFA], a ret ; draws a line of tiles @@ -705,7 +703,7 @@ DrawTileLine: pop bc ret -INCLUDE "data/pokedex_entries.asm" +INCLUDE "data/pokemon/dex_entries.asm" PokedexToIndex: ; converts the Pokédex number at wd11e to an index @@ -744,4 +742,4 @@ IndexToPokedex: pop bc ret -INCLUDE "data/pokedex_order.asm" +INCLUDE "data/pokemon/dex_order.asm" diff --git a/engine/save.asm b/engine/menus/save.asm index 7f453bf0..bcb27ddf 100755 --- a/engine/save.asm +++ b/engine/menus/save.asm @@ -28,8 +28,8 @@ LoadSAV: ret FileDataDestroyedText: - TX_FAR _FileDataDestroyedText - db "@" + text_far _FileDataDestroyedText + text_end LoadSAV0: call EnableSRAMAndLatchClockData @@ -68,7 +68,7 @@ LoadSAV0: ld bc, wSpriteDataEnd - wSpriteDataStart call CopyData ld a, [sTilesetType] - ld [hTilesetType], a + ldh [hTilesetType], a ld hl, sCurBoxData ld de, wBoxDataStart ld bc, wBoxDataEnd - wBoxDataStart @@ -130,7 +130,7 @@ LoadSAVIgnoreBadCheckSum: jp LoadSAV2 SaveSAV: - callba PrintSaveScreenText + farcall PrintSaveScreenText ld c, 10 call DelayFrames ld hl, WouldYouLikeToSaveText @@ -156,7 +156,7 @@ SaveSAV: call DelayFrames ld hl, GameSavedText call PrintText - ld c,10 + ld c, 10 call DelayFrames ld a, SFX_SAVE call PlaySoundWaitForCurrent @@ -167,7 +167,7 @@ SaveSAV: SaveSAVConfirm: call PrintText - coord hl, 0, 7 + hlcoord 0, 7 lb bc, 8, 1 ld a, TWO_OPTION_MENU ld [wTextBoxID], a @@ -176,20 +176,20 @@ SaveSAVConfirm: ret WouldYouLikeToSaveText: - TX_FAR _WouldYouLikeToSaveText - db "@" + text_far _WouldYouLikeToSaveText + text_end SavingText: - TX_FAR _SavingText - db "@" + text_far _SavingText + text_end GameSavedText: - TX_FAR _GameSavedText - db "@" + text_far _GameSavedText + text_end OlderFileWillBeErasedText: - TX_FAR _OlderFileWillBeErasedText - db "@" + text_far _OlderFileWillBeErasedText + text_end SaveSAVtoSRAM0: call EnableSRAMAndLatchClockData @@ -211,7 +211,7 @@ SaveSAVtoSRAM0: ld de, sCurBoxData ld bc, wBoxDataEnd - wBoxDataStart call CopyData - ld a, [hTilesetType] + ldh a, [hTilesetType] ld [sTilesetType], a ld hl, sPlayerName ld bc, sMainDataCheckSum - sPlayerName @@ -262,7 +262,7 @@ SaveSAVtoSRAM2: call DisableSRAMAndPrepareClockData ret -SaveSAVtoSRAM: +SaveSAVtoSRAM:: ld a, $2 ld [wSaveFileStatus], a call SaveSAVtoSRAM0 @@ -342,10 +342,10 @@ ChangeBox:: call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM call DisplayChangeBoxMenu call UpdateSprites - ld hl, hFlags_0xFFFA + ld hl, hFlagsFFFA set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFFA + ld hl, hFlagsFFFA res 1, [hl] bit 1, a ; pressed b ret nz @@ -377,8 +377,8 @@ ChangeBox:: ret WhenYouChangeBoxText: - TX_FAR _WhenYouChangeBoxText - db "@" + text_far _WhenYouChangeBoxText + text_end CopyBoxToOrFromSRAM: ; copy an entire box from hl to de with b as the SRAM bank @@ -406,7 +406,7 @@ CopyBoxToOrFromSRAM: DisplayChangeBoxMenu: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a ld a, 11 @@ -421,39 +421,39 @@ DisplayChangeBoxMenu: and $7f ld [wCurrentMenuItem], a ld [wLastMenuItem], a - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 2, 9 call TextBoxBorder ld hl, ChooseABoxText call PrintText - coord hl, 11, 0 + hlcoord 11, 0 lb bc, 12, 7 call TextBoxBorder - ld hl, hFlags_0xFFFA + ld hl, hFlagsFFFA set 2, [hl] ld de, BoxNames - coord hl, 13, 1 + hlcoord 13, 1 call PlaceString - ld hl, hFlags_0xFFFA + ld hl, hFlagsFFFA res 2, [hl] ld a, [wCurrentBoxNum] and $7f cp 9 jr c, .singleDigitBoxNum sub 9 - coord hl, 8, 2 + hlcoord 8, 2 ld [hl], "1" add "0" jr .next .singleDigitBoxNum add "1" .next - Coorda 9, 2 - coord hl, 1, 2 + ldcoord_a 9, 2 + hlcoord 1, 2 ld de, BoxNoText call PlaceString call GetMonCountsForAllBoxes - coord hl, 18, 1 + hlcoord 18, 1 ld de, wBoxMonCounts ld bc, SCREEN_WIDTH ld a, $c @@ -470,12 +470,12 @@ DisplayChangeBoxMenu: dec a jr nz, .loop ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a ret ChooseABoxText: - TX_FAR _ChooseABoxText - db "@" + text_far _ChooseABoxText + text_end BoxNames: db "BOX 1" @@ -575,11 +575,11 @@ GetMonCountsForBoxesInBank: ret SAVCheckRandomID: -;checks if Sav file is the same by checking player's name 1st letter ($a598) +; checks if Sav file is the same by checking player's name 1st letter ; and the two random numbers generated at game beginning -;(which are stored at wPlayerID)s +; (which are stored at wPlayerID)s call EnableSRAMAndLatchClockData - ld a, $1 + ld a, $01 ld [MBC1SRamBank], a ld a, [sPlayerName] and a @@ -663,8 +663,8 @@ ClearSAV: PadSRAM_FF: ld [MBC1SRamBank], a - ld hl, $a000 - ld bc, $2000 + ld hl, SRAM_Begin + ld bc, SRAM_End - SRAM_Begin ld a, $ff jp FillMemory diff --git a/engine/menu/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index abc8f000..84583a69 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -1,4 +1,4 @@ -StartMenu_Pokedex: +StartMenu_Pokedex:: predef ShowPokedexMenu call LoadScreenTilesFromBuffer2 ; restore saved screen call Delay3 @@ -6,7 +6,7 @@ StartMenu_Pokedex: call UpdateSprites jp RedisplayStartMenu -StartMenu_Pokemon: +StartMenu_Pokemon:: ld a, [wPartyCount] and a jp z, RedisplayStartMenu @@ -50,7 +50,7 @@ StartMenu_Pokemon: ld hl, wTopMenuItemY ld a, c ld [hli], a ; top menu item Y - ld a, [hFieldMoveMonMenuTopMenuItemX] + ldh a, [hFieldMoveMonMenuTopMenuItemX] ld [hli], a ; top menu item X xor a ld [hli], a ; current menu item ID @@ -130,7 +130,7 @@ StartMenu_Pokemon: dw .teleport dw .softboiled .fly - bit 2, a ; does the player have the Thunder Badge? + bit BIT_THUNDERBADGE, a jp z, .newBadgeRequired call CheckIfInOutsideMap jr z, .canFly @@ -153,7 +153,7 @@ StartMenu_Pokemon: call Func_1510 jp .goBackToMap .cut - bit 1, a ; does the player have the Cascade Badge? + bit BIT_CASCADEBADGE, a jp z, .newBadgeRequired predef UsedCut ld a, [wActionResultOrTookBattleTurn] @@ -161,9 +161,9 @@ StartMenu_Pokemon: jp z, .loop jp CloseTextDisplay .surf - bit 4, a ; does the player have the Soul Badge? + bit BIT_SOULBADGE, a jp z, .newBadgeRequired - callba IsSurfingAllowed + farcall IsSurfingAllowed ld hl, wd728 bit 1, [hl] res 1, [hl] @@ -177,7 +177,7 @@ StartMenu_Pokemon: ld a, $2 .continue ld [wd473], a - ld a,SURFBOARD + ld a, SURFBOARD ld [wcf91], a ld [wPseudoItemID], a call UseItem @@ -191,13 +191,13 @@ StartMenu_Pokemon: ld [wd473], a jp .loop .strength - bit 3, a ; does the player have the Rainbow Badge? + bit BIT_RAINBOWBADGE, a jp z, .newBadgeRequired predef PrintStrengthTxt call GBPalWhiteOutWithDelay3 jp .goBackToMap .flash - bit 0, a ; does the player have the Boulder Badge? + bit BIT_BOULDERBADGE, a jp z, .newBadgeRequired xor a ld [wMapPalOffset], a @@ -206,8 +206,8 @@ StartMenu_Pokemon: call GBPalWhiteOutWithDelay3 jp .goBackToMap .flashLightsAreaText - TX_FAR _FlashLightsAreaText - db "@" + text_far _FlashLightsAreaText + text_end .dig ld a, ESCAPE_ROPE ld [wcf91], a @@ -242,35 +242,35 @@ StartMenu_Pokemon: call GBPalWhiteOutWithDelay3 jp .goBackToMap .warpToLastPokemonCenterText - TX_FAR _WarpToLastPokemonCenterText - db "@" + text_far _WarpToLastPokemonCenterText + text_end .cannotUseTeleportNowText - TX_FAR _CannotUseTeleportNowText - db "@" + text_far _CannotUseTeleportNowText + text_end .cannotFlyHereText - TX_FAR _CannotFlyHereText - db "@" + text_far _CannotFlyHereText + text_end .softboiled ld hl, wPartyMon1MaxHP ld a, [wWhichPokemon] ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld a, [hli] - ld [H_DIVIDEND], a + ldh [hDividend], a ld a, [hl] - ld [H_DIVIDEND + 1], a + ldh [hDividend + 1], a ld a, 5 - ld [H_DIVISOR], a + ldh [hDivisor], a ld b, 2 ; number of bytes call Divide ld bc, wPartyMon1HP - wPartyMon1MaxHP add hl, bc ld a, [hld] ld b, a - ld a, [H_QUOTIENT + 3] + ldh a, [hQuotient + 3] sub b ld b, [hl] - ld a, [H_QUOTIENT + 2] + ldh a, [hQuotient + 2] sbc b jp nc, .notHealthyEnough ld a, [wPartyAndBillsPCSavedMenuItem] @@ -287,8 +287,8 @@ StartMenu_Pokemon: call PrintText jp .loop .notHealthyEnoughText - TX_FAR _NotHealthyEnoughText - db "@" + text_far _NotHealthyEnoughText + text_end .goBackToMap call RestoreScreenTilesAndReloadTilePatterns jp CloseTextDisplay @@ -297,12 +297,12 @@ StartMenu_Pokemon: call PrintText jp .loop .newBadgeRequiredText - TX_FAR _NewBadgeRequiredText - db "@" + text_far _NewBadgeRequiredText + text_end ; writes a blank tile to all possible menu cursor positions on the party menu -ErasePartyMenuCursors: - coord hl, 0, 1 +ErasePartyMenuCursors:: + hlcoord 0, 1 ld bc, 2 * 20 ; menu cursor positions are 2 rows apart ld a, 6 ; 6 menu cursor positions .loop @@ -316,7 +316,7 @@ ItemMenuLoop: call LoadScreenTilesFromBuffer2DisableBGTransfer ; restore saved screen call RunDefaultPaletteCommand -StartMenu_Item: +StartMenu_Item:: ld a, [wLinkState] dec a ; is the player in the Colosseum or Trade Centre? jr nz, .notInCableClubRoom @@ -346,10 +346,10 @@ StartMenu_Item: .choseItem ; erase menu cursor (blank each tile in front of an item name) ld a, " " - Coorda 5, 4 - Coorda 5, 6 - Coorda 5, 8 - Coorda 5, 10 + ldcoord_a 5, 4 + ldcoord_a 5, 6 + ldcoord_a 5, 8 + ldcoord_a 5, 10 call PlaceUnfilledArrowMenuCursor xor a ld [wMenuItemToSwap], a @@ -400,7 +400,7 @@ StartMenu_Item: ; use item ld [wPseudoItemID], a ; a must be 0 due to above conditional jump ld a, [wcf91] - cp HM_01 + cp HM01 jr nc, .useItem_partyMenu ld hl, UsableItems_CloseMenu ld de, 1 @@ -455,71 +455,25 @@ StartMenu_Item: jp ItemMenuLoop CannotUseItemsHereText: - TX_FAR _CannotUseItemsHereText - db "@" + text_far _CannotUseItemsHereText + text_end CannotGetOffHereText: - TX_FAR _CannotGetOffHereText - db "@" + text_far _CannotGetOffHereText + text_end -; items which bring up the party menu when used -UsableItems_PartyMenu: - db MOON_STONE - db ANTIDOTE - db BURN_HEAL - db ICE_HEAL - db AWAKENING - db PARLYZ_HEAL - db FULL_RESTORE - db MAX_POTION - db HYPER_POTION - db SUPER_POTION - db POTION - db FIRE_STONE - db THUNDER_STONE - db WATER_STONE - db HP_UP - db PROTEIN - db IRON - db CARBOS - db CALCIUM - db RARE_CANDY - db LEAF_STONE - db FULL_HEAL - db REVIVE - db MAX_REVIVE - db FRESH_WATER - db SODA_POP - db LEMONADE - db X_ATTACK - db X_DEFEND - db X_SPEED - db X_SPECIAL - db PP_UP - db ETHER - db MAX_ETHER - db ELIXER - db MAX_ELIXER - db $ff +INCLUDE "data/items/use_party.asm" -; items which close the item menu when used -UsableItems_CloseMenu: - db ESCAPE_ROPE - db ITEMFINDER - db POKE_FLUTE - db OLD_ROD - db GOOD_ROD - db SUPER_ROD - db $ff +INCLUDE "data/items/use_overworld.asm" -StartMenu_TrainerInfo: +StartMenu_TrainerInfo:: call GBPalWhiteOut call ClearScreen call UpdateSprites - ld a, [hTilesetType] + ldh a, [hTilesetType] push af xor a - ld [hTilesetType], a + ldh [hTilesetType], a call DrawTrainerInfo predef DrawBadges ; draw badges ld b, SET_PAL_TRAINER_CARD @@ -531,10 +485,10 @@ StartMenu_TrainerInfo: call LoadScreenTilesFromBuffer2 ; restore saved screen call RunDefaultPaletteCommand call ReloadMapData - callba DrawStartMenu ; XXX what difference does this make? + farcall DrawStartMenu ; XXX what difference does this make? call LoadGBPal pop af - ld [hTilesetType], a + ldh [hTilesetType], a jp RedisplayStartMenu_DoNotDrawStartMenu ; loads tile patterns and draws everything except for gym leader faces / badges @@ -543,44 +497,44 @@ DrawTrainerInfo: lb bc, BANK(RedPicFront), $01 predef DisplayPicCenteredOrUpperRight call DisableLCD - coord hl, 0, 2 + hlcoord 0, 2 ld a, " " call TrainerInfo_DrawVerticalLine - coord hl, 1, 2 + hlcoord 1, 2 call TrainerInfo_DrawVerticalLine - ld hl, vChars2 + $70 - ld de, vChars2 - ld bc, $70 * 4 + ld hl, vChars2 tile $07 + ld de, vChars2 tile $00 + ld bc, $1c tiles call CopyData ld hl, TrainerInfoTextBoxTileGraphics ; trainer info text box tile patterns - ld de, vChars2 + $770 - ld bc, $0080 + ld de, vChars2 tile $77 + ld bc, 8 tiles push bc call TrainerInfo_FarCopyData ld hl, BlankLeaderNames - ld de, vChars2 + $600 - ld bc, $0170 + ld de, vChars2 tile $60 + ld bc, $17 tiles call TrainerInfo_FarCopyData pop bc ld hl, BadgeNumbersTileGraphics ; badge number tile patterns - ld de, vChars1 + $580 + ld de, vChars1 tile $58 call TrainerInfo_FarCopyData ld hl, GymLeaderFaceAndBadgeTileGraphics ; gym leader face and badge tile patterns - ld de, vChars2 + $200 - ld bc, $0400 - ld a, $03 + ld de, vChars2 tile $20 + ld bc, 8 * 8 tiles + ld a, BANK(GymLeaderFaceAndBadgeTileGraphics) call FarCopyData ld hl, TextBoxGraphics - ld de, $00d0 + ld de, 13 tiles add hl, de ; hl = colon tile pattern - ld de, vChars1 + $560 - ld bc, $0010 - ld a, $04 + ld de, vChars1 tile $56 + ld bc, 1 tiles + ld a, BANK(TextBoxGraphics) push bc call FarCopyData pop bc - ld hl, TrainerInfoTextBoxTileGraphics + $80 ; background tile pattern - ld de, vChars1 + $570 + ld hl, TrainerInfoTextBoxTileGraphics tile 8 ; background tile pattern + ld de, vChars1 tile $57 call TrainerInfo_FarCopyData call EnableLCD ld hl, wTrainerInfoTextBoxWidthPlus1 @@ -589,7 +543,7 @@ DrawTrainerInfo: dec a ld [hli], a ld [hl], 1 - coord hl, 0, 0 + hlcoord 0, 0 call TrainerInfo_DrawTextBox ld hl, wTrainerInfoTextBoxWidthPlus1 ld a, 16 + 1 @@ -597,27 +551,27 @@ DrawTrainerInfo: dec a ld [hli], a ld [hl], 3 - coord hl, 1, 10 + hlcoord 1, 10 call TrainerInfo_DrawTextBox - coord hl, 0, 10 + hlcoord 0, 10 ld a, $d7 call TrainerInfo_DrawVerticalLine - coord hl, 19, 10 + hlcoord 19, 10 call TrainerInfo_DrawVerticalLine - coord hl, 6, 9 + hlcoord 6, 9 ld de, TrainerInfo_BadgesText call PlaceString - coord hl, 2, 2 + hlcoord 2, 2 ld de, TrainerInfo_NameMoneyTimeText call PlaceString - coord hl, 7, 2 + hlcoord 7, 2 ld de, wPlayerName call PlaceString - coord hl, 8, 4 + hlcoord 8, 4 ld de, wPlayerMoney ld c, $e3 call PrintBCDNumber - coord hl, 9, 6 + hlcoord 9, 6 ld de, wPlayTimeHours ; hours lb bc, LEFT_ALIGN | 1, 3 call PrintNumber @@ -701,7 +655,7 @@ TrainerInfo_DrawVerticalLine: jr nz, .loop ret -StartMenu_SaveReset: +StartMenu_SaveReset:: ld a, [wd72e] bit 6, a ; is the player using the link feature? jp nz, Init @@ -709,18 +663,18 @@ StartMenu_SaveReset: call LoadScreenTilesFromBuffer2 ; restore saved screen jp HoldTextDisplayOpen -StartMenu_Option: +StartMenu_Option:: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a call ClearScreen call UpdateSprites - callab DisplayOptionMenu + callfar DisplayOptionMenu call LoadScreenTilesFromBuffer2 ; restore saved screen call LoadTextBoxTilePatterns call UpdateSprites jp RedisplayStartMenu -SwitchPartyMon: +SwitchPartyMon:: call SwitchPartyMon_InitVarOrSwapData ; swap data ld a, [wSwappedMenuItem] call SwitchPartyMon_ClearGfx @@ -730,7 +684,7 @@ SwitchPartyMon: SwitchPartyMon_ClearGfx: push af - coord hl, 0, 0 + hlcoord 0, 0 ld bc, SCREEN_WIDTH * 2 call AddNTimes ld c, SCREEN_WIDTH * 2 @@ -800,10 +754,10 @@ SwitchPartyMon_InitVarOrSwapData: inc d .noCarry2 ld a, [hl] - ld [hSwapTemp], a + ldh [hSwapTemp], a ld a, [de] ld [hl], a - ld a, [hSwapTemp] + ldh a, [hSwapTemp] ld [de], a ld hl, wPartyMons ld bc, wPartyMon2 - wPartyMon1 diff --git a/engine/menu/swap_items.asm b/engine/menus/swap_items.asm index 563fc7d5..2d506ce2 100644 --- a/engine/menu/swap_items.asm +++ b/engine/menus/swap_items.asm @@ -1,4 +1,4 @@ -HandleItemListSwapping: +HandleItemListSwapping:: ld a, [wListMenuID] cp ITEMLISTMENU jp nz, DisplayListMenuIDLoop ; only rearrange item list menus @@ -77,18 +77,18 @@ HandleItemListSwapping: cp b jr z, .swapSameItemType .swapDifferentItems - ld [$ff95], a ; [$ff95] = second item ID + ldh [hSwapItemID], a ; save second item ID ld a, [hld] - ld [$ff96], a ; [$ff96] = second item quantity + ldh [hSwapItemQuantity], a ; save second item quantity ld a, [de] ld [hli], a ; put first item ID in second item slot inc de ld a, [de] ld [hl], a ; put first item quantity in second item slot - ld a, [$ff96] + ldh a, [hSwapItemQuantity] ld [de], a ; put second item quantity in first item slot dec de - ld a, [$ff95] + ldh a, [hSwapItemID] ld [de], a ; put second item ID in first item slot xor a ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm new file mode 100644 index 00000000..7a315af2 --- /dev/null +++ b/engine/menus/text_box.asm @@ -0,0 +1,533 @@ +; function to draw various text boxes +DisplayTextBoxID_:: + ld a, [wTextBoxID] + cp TWO_OPTION_MENU + jp z, DisplayTwoOptionMenu + ld c, a + ld hl, TextBoxFunctionTable + ld de, 3 + call SearchTextBoxTable + jr c, .functionTableMatch + ld hl, TextBoxCoordTable + ld de, 5 + call SearchTextBoxTable + jr c, .coordTableMatch + ld hl, TextBoxTextAndCoordTable + ld de, 9 + call SearchTextBoxTable + jr c, .textAndCoordTableMatch +.done + ret +.functionTableMatch + ld a, [hli] + ld h, [hl] + ld l, a ; hl = address of function + ld de, .done + push de + jp hl ; jump to the function +.coordTableMatch + call GetTextBoxIDCoords + call GetAddressOfScreenCoords + call TextBoxBorder + ret +.textAndCoordTableMatch + call GetTextBoxIDCoords + push hl + call GetAddressOfScreenCoords + call TextBoxBorder + pop hl + call GetTextBoxIDText + ld a, [wd730] + push af + ld a, [wd730] + set 6, a ; no pauses between printing each letter + ld [wd730], a + call PlaceString + pop af + ld [wd730], a + call UpdateSprites + ret + +; function to search a table terminated with $ff for a byte matching c in increments of de +; sets carry flag if a match is found and clears carry flag if not +SearchTextBoxTable: + dec de +.loop + ld a, [hli] + cp $ff + jr z, .notFound + cp c + jr z, .found + add hl, de + jr .loop +.found + scf +.notFound + ret + +; function to load coordinates from the TextBoxCoordTable or the TextBoxTextAndCoordTable +; INPUT: +; hl = address of coordinates +; OUTPUT: +; b = height +; c = width +; d = row of upper left corner +; e = column of upper left corner +GetTextBoxIDCoords: + ld a, [hli] ; column of upper left corner + ld e, a + ld a, [hli] ; row of upper left corner + ld d, a + ld a, [hli] ; column of lower right corner + sub e + dec a + ld c, a ; c = width + ld a, [hli] ; row of lower right corner + sub d + dec a + ld b, a ; b = height + ret + +; function to load a text address and text coordinates from the TextBoxTextAndCoordTable +GetTextBoxIDText: + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a ; de = address of text + push de ; save text address + ld a, [hli] + ld e, a ; column of upper left corner of text + ld a, [hl] + ld d, a ; row of upper left corner of text + call GetAddressOfScreenCoords + pop de ; restore text address + ret + +; function to point hl to the screen coordinates +; INPUT: +; d = row +; e = column +; OUTPUT: +; hl = address of upper left corner of text box +GetAddressOfScreenCoords: + push bc + hlcoord 0, 0 + ld bc, 20 +.loop ; loop to add d rows to the base address + ld a, d + and a + jr z, .addedRows + add hl, bc + dec d + jr .loop +.addedRows + pop bc + add hl, de + ret + +INCLUDE "data/text_boxes.asm" + +DisplayMoneyBox: + ld hl, wd730 + set 6, [hl] + ld a, MONEY_BOX_TEMPLATE + ld [wTextBoxID], a + call DisplayTextBoxID + hlcoord 13, 1 + lb bc, 1, 6 + call ClearScreenArea + hlcoord 12, 1 + ld de, wPlayerMoney + ld c, $a3 + call PrintBCDNumber + ld hl, wd730 + res 6, [hl] + ret + +CurrencyString: + db " ¥@" + +DoBuySellQuitMenu: + ld a, [wd730] + set 6, a ; no printing delay + ld [wd730], a + xor a + ld [wChosenMenuItem], a + ld a, BUY_SELL_QUIT_MENU_TEMPLATE + ld [wTextBoxID], a + call DisplayTextBoxID + ld a, A_BUTTON | B_BUTTON + ld [wMenuWatchedKeys], a + ld a, $2 + ld [wMaxMenuItem], a + ld a, $1 + ld [wTopMenuItemY], a + ld a, $1 + ld [wTopMenuItemX], a + xor a + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a + ld [wMenuWatchMovingOutOfBounds], a + ld a, [wd730] + res 6, a ; turn on the printing delay + ld [wd730], a + call HandleMenuInput + call PlaceUnfilledArrowMenuCursor + bit 0, a ; was A pressed? + jr nz, .pressedA + bit 1, a ; was B pressed? (always true since only A/B are watched) + jr z, .pressedA + ld a, CANCELLED_MENU + ld [wMenuExitMethod], a + jr .quit +.pressedA + ld a, CHOSE_MENU_ITEM + ld [wMenuExitMethod], a + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + ld b, a + ld a, [wMaxMenuItem] + cp b + jr z, .quit + ret +.quit + ld a, CANCELLED_MENU + ld [wMenuExitMethod], a + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + scf + ret + +; displays a menu with two options to choose from +; b = Y of upper left corner of text region +; c = X of upper left corner of text region +; hl = address where the text box border should be drawn +DisplayTwoOptionMenu: + push hl + ld a, [wd730] + set 6, a ; no printing delay + ld [wd730], a + +; pointless because both values are overwritten before they are read + xor a + ld [wChosenMenuItem], a + ld [wMenuExitMethod], a + + ld a, A_BUTTON | B_BUTTON + ld [wMenuWatchedKeys], a + ld a, $1 + ld [wMaxMenuItem], a + ld a, b + ld [wTopMenuItemY], a + ld a, c + ld [wTopMenuItemX], a + xor a + ld [wLastMenuItem], a + ld [wMenuWatchMovingOutOfBounds], a + push hl + ld hl, wTwoOptionMenuID + bit 7, [hl] ; select second menu item by default? + res 7, [hl] + jr z, .storeCurrentMenuItem + inc a +.storeCurrentMenuItem + ld [wCurrentMenuItem], a + pop hl + push hl + push hl + call TwoOptionMenu_SaveScreenTiles + ld a, [wTwoOptionMenuID] + ld hl, TwoOptionMenuStrings + ld e, a + ld d, $0 + ld a, $5 +.menuStringLoop + add hl, de + dec a + jr nz, .menuStringLoop + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a + ld e, l + ld d, h + pop hl + push de + ld a, [wTwoOptionMenuID] + cp TRADE_CANCEL_MENU + jr nz, .notTradeCancelMenu + call CableClub_TextBoxBorder + jr .afterTextBoxBorder +.notTradeCancelMenu + call TextBoxBorder +.afterTextBoxBorder + call UpdateSprites + pop hl + ld a, [hli] + and a ; put blank line before first menu item? + ld bc, 20 + 2 + jr z, .noBlankLine + ld bc, 2 * 20 + 2 +.noBlankLine + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + pop hl + add hl, bc + call PlaceString + xor a + ld [wTwoOptionMenuID], a + ld hl, wd730 + res 6, [hl] ; turn on the printing delay + call HandleMenuInput + pop hl + bit 1, a ; A button pressed? + jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed +.pressedAButton + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + and a + jr nz, .choseSecondMenuItem +; chose first menu item + ld a, CHOSE_FIRST_ITEM + ld [wMenuExitMethod], a + ld c, 15 + call DelayFrames + call TwoOptionMenu_RestoreScreenTiles + and a + ret +.choseSecondMenuItem + ld a, 1 + ld [wCurrentMenuItem], a + ld [wChosenMenuItem], a + ld a, CHOSE_SECOND_ITEM + ld [wMenuExitMethod], a + ld c, 15 + call DelayFrames + call TwoOptionMenu_RestoreScreenTiles + scf + ret + +; Some of the wider/taller two option menus will not have the screen areas +; they cover be fully saved/restored by the two functions below. +; The bottom and right edges of the menu may remain after the function returns. + +TwoOptionMenu_SaveScreenTiles: + ld de, wBuffer + lb bc, 5, 6 +.loop + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .loop + push bc + ld bc, SCREEN_WIDTH - 6 + add hl, bc + pop bc + ld c, $6 + dec b + jr nz, .loop + ret + +TwoOptionMenu_RestoreScreenTiles: + ld de, wBuffer + lb bc, 5, 6 +.loop + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .loop + push bc + ld bc, SCREEN_WIDTH - 6 + add hl, bc + pop bc + ld c, 6 + dec b + jr nz, .loop + call UpdateSprites + ret + +INCLUDE "data/yes_no_menu_strings.asm" + +DisplayFieldMoveMonMenu: + xor a + ld hl, wFieldMoves + ld [hli], a ; wFieldMoves + ld [hli], a ; wFieldMoves + 1 + ld [hli], a ; wFieldMoves + 2 + ld [hli], a ; wFieldMoves + 3 + ld [hli], a ; wNumFieldMoves + ld [hl], 12 ; wFieldMovesLeftmostXCoord + call GetMonFieldMoves + ld a, [wNumFieldMoves] + and a + jr nz, .fieldMovesExist + +; no field moves + hlcoord 11, 11 + lb bc, 5, 7 + call TextBoxBorder + call UpdateSprites + ld a, 12 + ldh [hFieldMoveMonMenuTopMenuItemX], a + hlcoord 13, 12 + ld de, PokemonMenuEntries + jp PlaceString + +.fieldMovesExist + push af + +; Calculate the text box position and dimensions based on the leftmost X coord +; of the field move names before adjusting for the number of field moves. + hlcoord 0, 11 + ld a, [wFieldMovesLeftmostXCoord] + dec a + ld e, a + ld d, 0 + add hl, de + ld b, 5 + ld a, 18 + sub e + ld c, a + pop af + +; For each field move, move the top of the text box up 2 rows while the leaving +; the bottom of the text box at the bottom of the screen. + ld de, -SCREEN_WIDTH * 2 +.textBoxHeightLoop + add hl, de + inc b + inc b + dec a + jr nz, .textBoxHeightLoop + +; Make space for an extra blank row above the top field move. + ld de, -SCREEN_WIDTH + add hl, de + inc b + + call TextBoxBorder + call UpdateSprites + +; Calculate the position of the first field move name to print. + hlcoord 0, 12 + ld a, [wFieldMovesLeftmostXCoord] + inc a + ld e, a + ld d, 0 + add hl, de + ld de, -SCREEN_WIDTH * 2 + ld a, [wNumFieldMoves] +.calcFirstFieldMoveYLoop + add hl, de + dec a + jr nz, .calcFirstFieldMoveYLoop + + xor a + ld [wNumFieldMoves], a + ld de, wFieldMoves +.printNamesLoop + push hl + ld hl, FieldMoveNames + ld a, [de] + and a + jr z, .donePrintingNames + inc de + ld b, a ; index of name +.skipNamesLoop ; skip past names before the name we want + dec b + jr z, .reachedName +.skipNameLoop ; skip past current name + ld a, [hli] + cp "@" + jr nz, .skipNameLoop + jr .skipNamesLoop +.reachedName + ld b, h + ld c, l + pop hl + push de + ld d, b + ld e, c + call PlaceString + ld bc, SCREEN_WIDTH * 2 + add hl, bc + pop de + jr .printNamesLoop + +.donePrintingNames + pop hl + ld a, [wFieldMovesLeftmostXCoord] + ldh [hFieldMoveMonMenuTopMenuItemX], a + hlcoord 0, 12 + ld a, [wFieldMovesLeftmostXCoord] + inc a + ld e, a + ld d, 0 + add hl, de + ld de, PokemonMenuEntries + jp PlaceString + +INCLUDE "data/moves/field_move_names.asm" + +PokemonMenuEntries: + db "STATS" + next "SWITCH" + next "CANCEL@" + +GetMonFieldMoves: + ld a, [wWhichPokemon] + ld hl, wPartyMon1Moves + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ld d, h + ld e, l + ld c, NUM_MOVES + 1 + ld hl, wFieldMoves +.loop + push hl +.nextMove + dec c + jr z, .done + ld a, [de] ; move ID + and a + jr z, .done + ld b, a + inc de + ld hl, FieldMoveDisplayData +.fieldMoveLoop + ld a, [hli] + cp $ff + jr z, .nextMove ; if the move is not a field move + cp b + jr z, .foundFieldMove + inc hl + inc hl + jr .fieldMoveLoop +.foundFieldMove + ld a, b + ld [wLastFieldMoveID], a + ld a, [hli] ; field move name index + ld b, [hl] ; field move leftmost X coordinate + pop hl + ld [hli], a ; store name index in wFieldMoves + ld a, [wNumFieldMoves] + inc a + ld [wNumFieldMoves], a + ld a, [wFieldMovesLeftmostXCoord] + cp b + jr c, .skipUpdatingLeftmostXCoord + ld a, b + ld [wFieldMovesLeftmostXCoord], a +.skipUpdatingLeftmostXCoord + ld a, [wLastFieldMoveID] + ld b, a + jr .loop +.done + pop hl + ret + +INCLUDE "data/moves/field_moves.asm" diff --git a/engine/menu/bills_pc.asm b/engine/pokemon/bills_pc.asm index 41626310..cc7864f2 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -1,6 +1,6 @@ DisplayPCMainMenu:: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a call SaveScreenTilesToBuffer2 ld a, [wNumHoFTeams] and a @@ -10,15 +10,15 @@ DisplayPCMainMenu:: ld a, [wNumHoFTeams] and a jr nz, .leaguePCAvailable - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 8, 14 jr .next .noOaksPC - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 6, 14 jr .next .leaguePCAvailable - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 10, 14 .next call TextBoxBorder @@ -27,15 +27,15 @@ DisplayPCMainMenu:: ld [wMaxMenuItem], a CheckEvent EVENT_MET_BILL jr nz, .metBill - coord hl, 2, 2 + hlcoord 2, 2 ld de, SomeonesPCText jr .next2 .metBill - coord hl, 2, 2 + hlcoord 2, 2 ld de, BillsPCText .next2 call PlaceString - coord hl, 2, 4 + hlcoord 2, 4 ld de, wPlayerName call PlaceString ld l, c @@ -44,7 +44,7 @@ DisplayPCMainMenu:: call PlaceString CheckEvent EVENT_GOT_POKEDEX jr z, .noOaksPC2 - coord hl, 2, 6 + hlcoord 2, 6 ld de, OaksPCText call PlaceString ld a, [wNumHoFTeams] @@ -52,20 +52,20 @@ DisplayPCMainMenu:: jr z, .noLeaguePC ld a, 4 ld [wMaxMenuItem], a - coord hl, 2, 8 + hlcoord 2, 8 ld de, PKMNLeaguePCText call PlaceString - coord hl, 2, 10 + hlcoord 2, 10 ld de, LogOffPCText jr .next3 .noLeaguePC - coord hl, 2, 8 + hlcoord 2, 8 ld de, LogOffPCText jr .next3 .noOaksPC2 ld a, $2 ld [wMaxMenuItem], a - coord hl, 2, 6 + hlcoord 2, 6 ld de, LogOffPCText .next3 call PlaceString @@ -79,14 +79,14 @@ DisplayPCMainMenu:: ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a ret SomeonesPCText: db "SOMEONE's PC@" BillsPCText: db "BILL's PC@" PlayersPCText: db "'s PC@" OaksPCText: db "PROF.OAK's PC@" -PKMNLeaguePCText: db $4a, "LEAGUE@" +PKMNLeaguePCText: db "<PKMN>LEAGUE@" LogOffPCText: db "LOG OFF@" BillsPC_:: @@ -111,19 +111,19 @@ BillsPC_:: BillsPCMenu: ld a, [wParentMenuItem] ld [wCurrentMenuItem], a - ld hl, vChars2 + $780 + ld hl, vChars2 tile $78 ld de, PokeballTileGraphics - lb bc, BANK(PokeballTileGraphics), $01 + lb bc, BANK(PokeballTileGraphics), 1 call CopyVideoData call LoadScreenTilesFromBuffer2DisableBGTransfer - coord hl, 0, 12 + hlcoord 0, 12 lb bc, 4, 18 call TextBoxBorder - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 12, 12 call TextBoxBorder call UpdateSprites - coord hl, 2, 2 + hlcoord 2, 2 ld de, BillsPCMenuText call PlaceString ld hl, wTopMenuItemY @@ -144,7 +144,7 @@ BillsPCMenu: ld [hli], a ; wListScrollOffset ld [hl], a ; wMenuWatchMovingOutOfBounds ld [wPlayerMonNumber], a - coord hl, 9, 14 + hlcoord 9, 14 lb bc, 2, 9 call TextBoxBorder ld a, [wCurrentBoxNum] @@ -153,19 +153,19 @@ BillsPCMenu: jr c, .singleDigitBoxNum ; two digit box num sub 9 - coord hl, 17, 16 + hlcoord 17, 16 ld [hl], "1" add "0" jr .next .singleDigitBoxNum add "1" .next - Coorda 18, 16 - coord hl, 10, 16 + ldcoord_a 18, 16 + hlcoord 10, 16 ld de, BoxNoPCText call PlaceString ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a call Delay3 call HandleMenuInput bit 1, a @@ -204,7 +204,7 @@ ExitBillsPC: ret BillsPCPrintBox: - callab PrintPCBox + callfar PrintPCBox jp BillsPCMenu BillsPCDeposit: @@ -225,7 +225,7 @@ BillsPCDeposit: ld hl, wPartyCount call DisplayMonListMenu jp c, BillsPCMenu - callab IsThisPartymonStarterPikachu_Party + callfar IsThisPartymonStarterPikachu_Party jr nc, .asm_215ad call CheckPikachuFollowingPlayer jr z, .asm_215ad @@ -235,10 +235,10 @@ BillsPCDeposit: .asm_215ad call DisplayDepositWithdrawMenu jp nc, BillsPCMenu - callab IsThisPartymonStarterPikachu_Party + callfar IsThisPartymonStarterPikachu_Party jr nc, .asm_215c9 ld e, $1b - callab PlayPikachuSoundClip + callfar PlayPikachuSoundClip jr .asm_215cf .asm_215c9 ld a, [wcf91] @@ -272,8 +272,8 @@ BillsPCDeposit: jp BillsPCMenu SleepingPikachuText2: - TX_FAR _SleepingPikachuText2 - db "@" + text_far _SleepingPikachuText2 + text_end BillsPCWithdraw: ld a, [wNumInBox] @@ -298,10 +298,10 @@ BillsPCWithdraw: ld a, [wWhichPokemon] ld hl, wBoxMonNicks call GetPartyMonName - callab IsThisPartymonStarterPikachu_Box + callfar IsThisPartymonStarterPikachu_Box jr nc, .asm_21660 ld e, $22 - callab PlayPikachuSoundClip + callfar PlayPikachuSoundClip jr .asm_21666 .asm_21660 ld a, [wcf91] @@ -329,7 +329,7 @@ BillsPCRelease: ld hl, wNumInBox call DisplayMonListMenu jp c, BillsPCMenu - callab IsThisPartymonStarterPikachu_Box + callfar IsThisPartymonStarterPikachu_Box jr c, .asm_216cb ld hl, OnceReleasedText call PrintText @@ -352,13 +352,13 @@ BillsPCRelease: ld hl, wBoxMonNicks call GetPartyMonName ld e, $27 - callab PlayPikachuSoundClip + callfar PlayPikachuSoundClip ld hl, PikachuUnhappyText call PrintText jp BillsPCMenu BillsPCChangeBox: - callba ChangeBox + farcall ChangeBox jp BillsPCMenu DisplayMonListMenu: @@ -379,9 +379,9 @@ DisplayMonListMenu: ret BillsPCMenuText: - db "WITHDRAW ", $4a - next "DEPOSIT ", $4a - next "RELEASE ", $4a + db "WITHDRAW <PKMN>" + next "DEPOSIT <PKMN>" + next "RELEASE <PKMN>" next "CHANGE BOX" next "PRINT BOX" next "SEE YA!" @@ -418,15 +418,10 @@ KnowsHMMove:: ret HMMoveArray: - db CUT - db FLY - db SURF - db STRENGTH - db FLASH - db -1 +INCLUDE "data/moves/hm_moves.asm" DisplayDepositWithdrawMenu: - coord hl, 9, 10 + hlcoord 9, 10 lb bc, 6, 9 call TextBoxBorder ld a, [wParentMenuItem] @@ -435,9 +430,9 @@ DisplayDepositWithdrawMenu: jr nz, .next ld de, WithdrawPCText .next - coord hl, 11, 12 + hlcoord 11, 12 call PlaceString - coord hl, 11, 14 + hlcoord 11, 14 ld de, StatsCancelPCText call PlaceString ld hl, wTopMenuItemY @@ -498,62 +493,62 @@ StatsCancelPCText: next "CANCEL@" SwitchOnText: - TX_FAR _SwitchOnText - db "@" + text_far _SwitchOnText + text_end WhatText: - TX_FAR _WhatText - db "@" + text_far _WhatText + text_end DepositWhichMonText: - TX_FAR _DepositWhichMonText - db "@" + text_far _DepositWhichMonText + text_end MonWasStoredText: - TX_FAR _MonWasStoredText - db "@" + text_far _MonWasStoredText + text_end CantDepositLastMonText: - TX_FAR _CantDepositLastMonText - db "@" + text_far _CantDepositLastMonText + text_end BoxFullText: - TX_FAR _BoxFullText - db "@" + text_far _BoxFullText + text_end MonIsTakenOutText: - TX_FAR _MonIsTakenOutText - db "@" + text_far _MonIsTakenOutText + text_end NoMonText: - TX_FAR _NoMonText - db "@" + text_far _NoMonText + text_end CantTakeMonText: - TX_FAR _CantTakeMonText - db "@" + text_far _CantTakeMonText + text_end PikachuUnhappyText: - TX_FAR _PikachuUnhappyText - db "@" + text_far _PikachuUnhappyText + text_end ReleaseWhichMonText: - TX_FAR _ReleaseWhichMonText - db "@" + text_far _ReleaseWhichMonText + text_end OnceReleasedText: - TX_FAR _OnceReleasedText - db "@" + text_far _OnceReleasedText + text_end MonWasReleasedText: - TX_FAR _MonWasReleasedText - db "@" + text_far _MonWasReleasedText + text_end CableClubLeftGameboy:: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK ret z - ld a, [wSpritePlayerStateData1FacingDirection] ; player's sprite facing direction + ld a, [wSpritePlayerStateData1FacingDirection] cp SPRITE_FACING_RIGHT ret nz ld a, [wCurMap] @@ -567,10 +562,10 @@ CableClubLeftGameboy:: tx_pre_jump JustAMomentText CableClubRightGameboy:: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK ret z - ld a, [wSpritePlayerStateData1FacingDirection] ; player's sprite facing direction + ld a, [wSpritePlayerStateData1FacingDirection] cp SPRITE_FACING_LEFT ret nz ld a, [wCurMap] @@ -584,15 +579,15 @@ CableClubRightGameboy:: tx_pre_jump JustAMomentText JustAMomentText:: - TX_FAR _JustAMomentText - db "@" + text_far _JustAMomentText + text_end - ld a, [wSpritePlayerStateData1FacingDirection] ; player's sprite facing direction + ld a, [wSpritePlayerStateData1FacingDirection] cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing tx_pre_jump OpenBillsPCText OpenBillsPCText:: - TX_BILLS_PC + script_bills_pc diff --git a/engine/menu/status_screen.asm b/engine/pokemon/status_screen.asm index 1e2ba889..a2cfb595 100755 --- a/engine/menu/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -40,7 +40,7 @@ DrawHP_: push hl call DrawHPBar pop hl - ld a, [hFlags_0xFFFA] + ldh a, [hFlagsFFFA] bit 0, a jr z, .printFractionBelowBar ld bc, $9 ; right of bar @@ -80,87 +80,87 @@ StatusScreen: ld hl, wd72c set 1, [hl] ld a, $33 - ld [rNR50], a ; Reduce the volume + ldh [rNR50], a ; Reduce the volume call GBPalWhiteOutWithDelay3 call ClearScreen call UpdateSprites call LoadHpBarAndStatusTilePatterns ld de, BattleHudTiles1 ; source - ld hl, vChars2 + $6d0 ; dest - lb bc, BANK(BattleHudTiles1), $03 + ld hl, vChars2 tile $6d ; dest + lb bc, BANK(BattleHudTiles1), 3 call CopyVideoDataDouble ; ·│ :L and halfarrow line end ld de, BattleHudTiles2 - ld hl, vChars2 + $780 - lb bc, BANK(BattleHudTiles2), $01 + ld hl, vChars2 tile $78 + lb bc, BANK(BattleHudTiles2), 1 call CopyVideoDataDouble ; │ ld de, BattleHudTiles3 - ld hl, vChars2 + $760 - lb bc, BANK(BattleHudTiles3), $02 - call CopyVideoDataDouble ; ─┘ + ld hl, vChars2 tile $76 + lb bc, BANK(BattleHudTiles3), 2 + call CopyVideoDataDouble ; ─ ┘ ld de, PTile - ld hl, vChars2 + $720 - lb bc, BANK(PTile), (PTileEnd - PTile) / $8 - call CopyVideoDataDouble ; P (for PP), inline - ld a, [hTilesetType] + ld hl, vChars2 tile $72 + lb bc, BANK(PTile), 1 + call CopyVideoDataDouble ; bold P (for PP) + ldh a, [hTilesetType] push af xor a - ld [hTilesetType], a - coord hl, 19, 1 + ldh [hTilesetType], a + hlcoord 19, 1 lb bc, 6, 10 call DrawLineBox ; Draws the box around name, HP and status ld de, -6 add hl, de - ld [hl], "⠄" ; . after No ("." is a different one) + ld [hl], "<DOT>" dec hl ld [hl], "№" - coord hl, 19, 9 + hlcoord 19, 9 lb bc, 8, 6 call DrawLineBox ; Draws the box around types, ID No. and OT - coord hl, 10, 9 + hlcoord 10, 9 ld de, Type1Text call PlaceString ; "TYPE1/" - coord hl, 11, 3 + hlcoord 11, 3 predef DrawHP ld hl, wStatusScreenHPBarColor call GetHealthBarColor ld b, SET_PAL_STATUS_SCREEN call RunPaletteCommand - coord hl, 16, 6 + hlcoord 16, 6 ld de, wLoadedMonStatus call PrintStatusCondition jr nz, .StatusWritten - coord hl, 16, 6 + hlcoord 16, 6 ld de, OKText call PlaceString ; "OK" .StatusWritten - coord hl, 9, 6 + hlcoord 9, 6 ld de, StatusText call PlaceString ; "STATUS/" - coord hl, 14, 2 + hlcoord 14, 2 call PrintLevel ; Pokémon level ld a, [wMonHIndex] ld [wd11e], a ld [wd0b5], a predef IndexToPokedex - coord hl, 3, 7 + hlcoord 3, 7 ld de, wd11e lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; Pokémon no. - coord hl, 11, 10 + hlcoord 11, 10 predef PrintMonType ld hl, NamePointers2 call .GetStringPointer ld d, h ld e, l - coord hl, 9, 1 + hlcoord 9, 1 call PlaceString ; Pokémon name ld hl, OTPointers call .GetStringPointer ld d, h ld e, l - coord hl, 12, 16 + hlcoord 12, 16 call PlaceString ; OT - coord hl, 12, 14 + hlcoord 12, 14 ld de, wLoadedMonOTID lb bc, LEADING_ZEROES | 2, 5 call PrintNumber ; ID Number @@ -168,22 +168,22 @@ StatusScreen: call PrintStatsBox call Delay3 call GBPalNormal - coord hl, 1, 0 + hlcoord 1, 0 call LoadFlippedFrontSpriteByMonIndex ; draw Pokémon picture ld a, [wMonDataLocation] cp ENEMY_PARTY_DATA jr z, .playRegularCry cp BOX_DATA jr z, .checkBoxData - callab IsThisPartymonStarterPikachu_Party + callfar IsThisPartymonStarterPikachu_Party jr nc, .playRegularCry jr .playPikachuSoundClip .checkBoxData - callab IsThisPartymonStarterPikachu_Box + callfar IsThisPartymonStarterPikachu_Box jr nc, .playRegularCry .playPikachuSoundClip ld e, 16 - callab PlayPikachuSoundClip + callfar PlayPikachuSoundClip jr .continue .playRegularCry ld a, [wcf91] @@ -191,7 +191,7 @@ StatusScreen: .continue call WaitForTextScrollButtonPress ; wait for button pop af - ld [hTilesetType], a + ldh [hTilesetType], a ret .GetStringPointer @@ -222,14 +222,17 @@ NamePointers2: dw wDayCareMonName Type1Text: - db "TYPE1/", $4e - + db "TYPE1/" + next "" + ; fallthrough Type2Text: - db "TYPE2/", $4e - + db "TYPE2/" + next "" + ; fallthrough IDNoText: - db $73, "№/", $4e - + db "<ID>№/" + next "" + ; fallthrough OTText: db "OT/" next "@" @@ -258,26 +261,24 @@ DrawLineBox: ld [hl], $6f ; ← (halfarrow ending) ret -PTile: ; This is a single 1bpp "P" tile - INCBIN "gfx/p_tile.1bpp" -PTileEnd: +PTile: INCBIN "gfx/font/P.1bpp" PrintStatsBox: ld a, d and a ; a is 0 from the status screen jr nz, .DifferentBox - coord hl, 0, 8 + hlcoord 0, 8 lb bc, 8, 8 call TextBoxBorder ; Draws the box - coord hl, 1, 9 ; Start printing stats from here - ld bc, $0019 ; Number offset + hlcoord 1, 9 ; Start printing stats from here + ld bc, $19 ; Number offset jr .PrintStats .DifferentBox - coord hl, 9, 2 + hlcoord 9, 2 lb bc, 8, 9 call TextBoxBorder - coord hl, 11, 3 - ld bc, $0018 + hlcoord 11, 3 + ld bc, $18 .PrintStats push bc push hl @@ -310,11 +311,11 @@ StatsText: next "SPECIAL@" StatusScreen2: - ld a, [hTilesetType] + ldh a, [hTilesetType] push af xor a - ld [hTilesetType], a - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hTilesetType], a + ldh [hAutoBGTransferEnabled], a ld bc, NUM_MOVES + 1 ld hl, wMoves call FillMemory @@ -322,16 +323,16 @@ StatusScreen2: ld de, wMoves ld bc, NUM_MOVES call CopyData - callab FormatMovesString - coord hl, 9, 2 + callfar FormatMovesString + hlcoord 9, 2 lb bc, 5, 10 call ClearScreenArea ; Clear under name - coord hl, 19, 3 + hlcoord 19, 3 ld [hl], $78 - coord hl, 0, 8 + hlcoord 0, 8 lb bc, 8, 18 call TextBoxBorder ; Draw move container - coord hl, 2, 9 + hlcoord 2, 9 ld de, wMovesString call PlaceString ; Print moves ld a, [wNumMovesMinusOne] @@ -340,9 +341,9 @@ StatusScreen2: ld a, $4 sub c ld b, a ; Number of moves ? - coord hl, 11, 10 + hlcoord 11, 10 ld de, SCREEN_WIDTH * 2 - ld a, $72 ; special P tile id + ld a, "<BOLD_P>" call StatusScreen_PrintPP ; Print "PP" ld a, b and a @@ -352,7 +353,7 @@ StatusScreen2: call StatusScreen_PrintPP ; Fill the rest with -- .InitPP ld hl, wLoadedMonMoves - coord de, 14, 10 + decoord 14, 10 ld b, 0 .PrintPP ld a, [hli] @@ -367,7 +368,7 @@ StatusScreen2: ld a, b ld [hl], a push hl - callab GetMaxPP + callfar GetMaxPP pop hl pop af ld [hl], a @@ -402,7 +403,7 @@ StatusScreen2: cp $4 jr nz, .PrintPP .PPDone - coord hl, 9, 3 + hlcoord 9, 3 ld de, StatusScreenExpText call PlaceString ld a, [wLoadedMonLevel] @@ -412,41 +413,41 @@ StatusScreen2: inc a ld [wLoadedMonLevel], a ; Increase temporarily if not 100 .Level100 - coord hl, 14, 6 - ld [hl], $70 ; 1-tile "to" + hlcoord 14, 6 + ld [hl], "<to>" inc hl inc hl call PrintLevel pop af ld [wLoadedMonLevel], a ld de, wLoadedMonExp - coord hl, 12, 4 + hlcoord 12, 4 lb bc, 3, 7 call PrintNumber ; exp call CalcExpToLevelUp ld de, wLoadedMonExp - coord hl, 7, 6 + hlcoord 7, 6 lb bc, 3, 7 call PrintNumber ; exp needed to level up - coord hl, 9, 0 + hlcoord 9, 0 call StatusScreen_ClearName - coord hl, 9, 1 + hlcoord 9, 1 call StatusScreen_ClearName ld a, [wMonHIndex] ld [wd11e], a call GetMonName - coord hl, 9, 1 + hlcoord 9, 1 call PlaceString ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ldh [hAutoBGTransferEnabled], a call Delay3 call WaitForTextScrollButtonPress ; wait for button pop af - ld [hTilesetType], a + ldh [hTilesetType], a ld hl, wd72c res 1, [hl] ld a, $77 - ld [rNR50], a + ldh [rNR50], a call GBPalWhiteOut jp ClearScreen @@ -456,15 +457,15 @@ CalcExpToLevelUp: jr z, .atMaxLevel inc a ld d, a - callab CalcExperience + callfar CalcExperience ld hl, wLoadedMonExp + 2 - ld a, [hExperience + 2] + ldh a, [hExperience + 2] sub [hl] ld [hld], a - ld a, [hExperience + 1] + ldh a, [hExperience + 1] sbc [hl] ld [hld], a - ld a, [hExperience] + ldh a, [hExperience] sbc [hl] ld [hld], a ret diff --git a/engine/menu/start_menu.asm b/home/start_menu.asm index 498d1467..bd1b24bf 100755 --- a/engine/menu/start_menu.asm +++ b/home/start_menu.asm @@ -6,9 +6,9 @@ DisplayStartMenu:: call PlaySound RedisplayStartMenu:: - callba DrawStartMenu -RedisplayStartMenu_DoNotDrawStartMenu: - callba PrintSafariZoneSteps ; print Safari Zone info, if in Safari Zone + farcall DrawStartMenu +RedisplayStartMenu_DoNotDrawStartMenu:: + farcall PrintSafariZoneSteps ; print Safari Zone info, if in Safari Zone call UpdateSprites .loop call HandleMenuInput @@ -77,7 +77,7 @@ RedisplayStartMenu_DoNotDrawStartMenu: ; EXIT falls through to here CloseStartMenu:: call Joypad - ld a, [hJoyPressed] + ldh a, [hJoyPressed] bit 0, a ; was A button newly pressed? jr nz, CloseStartMenu call LoadTextBoxTilePatterns |
