diff options
Diffstat (limited to 'engine/menu/start_sub_menus.asm')
-rwxr-xr-x | engine/menu/start_sub_menus.asm | 312 |
1 files changed, 144 insertions, 168 deletions
diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 60893d81..7c6fe4d6 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -1,6 +1,5 @@ StartMenu_Pokedex: ; 13095 (4:7095) - ld a,$29 - call Predef + predef ShowPokedexMenu call LoadScreenTilesFromBuffer2 ; restore saved screen call Delay3 call LoadGBPal @@ -8,19 +7,19 @@ StartMenu_Pokedex: ; 13095 (4:7095) jp RedisplayStartMenu StartMenu_Pokemon: ; 130a9 (4:70a9) - ld a,[W_NUMINPARTY] + ld a,[wPartyCount] and a jp z,RedisplayStartMenu xor a - ld [$cc35],a - ld [$d07d],a - ld [$cfcb],a + ld [wcc35],a + ld [wd07d],a + ld [wcfcb],a call DisplayPartyMenu jr .checkIfPokemonChosen .loop xor a - ld [$cc35],a - ld [$d07d],a + ld [wcc35],a + ld [wd07d],a call GoBackToPartyMenu .checkIfPokemonChosen jr nc,.chosePokemon @@ -32,9 +31,9 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) .chosePokemon call SaveScreenTilesToBuffer1 ; save screen ld a,$04 - ld [$d125],a + ld [wd125],a call DisplayTextBoxID ; display pokemon menu options - ld hl,$cd3d + ld hl,wWhichTrade ld bc,$020c ; max menu item ID, top menu item Y ld e,5 .adjustMenuVariablesLoop @@ -82,32 +81,30 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) jp z,.choseStats ld c,a ld b,0 - ld hl,$cd3d + ld hl,wWhichTrade add hl,bc jp .choseOutOfBattleMove .choseSwitch - ld a,[W_NUMINPARTY] + ld a,[wPartyCount] cp a,2 ; is there more than one pokemon in the party? jp c,StartMenu_Pokemon ; if not, no switching call SwitchPartyMon_Stats ld a,$04 ; swap pokemon positions menu - ld [$d07d],a + ld [wd07d],a call GoBackToPartyMenu jp .checkIfPokemonChosen .choseStats - call CleanLCD_OAM + call ClearSprites xor a - ld [$cc49],a - ld a,$36 - call Predef - ld a,$37 - call Predef + ld [wcc49],a + predef StatusScreen + predef StatusScreen2 call ReloadMapData jp StartMenu_Pokemon .choseOutOfBattleMove push hl ld a,[wWhichPokemon] - ld hl,W_PARTYMON1NAME + ld hl,wPartyMonNicks call GetPartyMonName pop hl ld a,[hl] @@ -138,26 +135,25 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) call CheckIfInOutsideMap jr z,.canFly ld a,[wWhichPokemon] - ld hl,W_PARTYMON1NAME + ld hl,wPartyMonNicks call GetPartyMonName ld hl,.cannotFlyHereText call PrintText jp .loop .canFly call ChooseFlyDestination - ld a,[$d732] + ld a,[wd732] bit 3,a ; did the player decide to fly? jp nz,.goBackToMap call LoadFontTilePatterns - ld hl,$d72e + ld hl,wd72e set 1,[hl] jp StartMenu_Pokemon .cut bit 1,a ; does the player have the Cascade Badge? jp z,.newBadgeRequired - ld a,$3c - call Predef - ld a,[$cd6a] + predef UsedCut + ld a,[wcd6a] and a jp z,.loop jp CloseTextDisplay @@ -165,15 +161,15 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) bit 4,a ; does the player have the Soul Badge? jp z,.newBadgeRequired callba CheckForForcedBikeSurf - ld hl,$d728 + ld hl,wd728 bit 1,[hl] res 1,[hl] jp z,.loop ld a,SURFBOARD - ld [$cf91],a - ld [$d152],a + ld [wcf91],a + ld [wd152],a call UseItem - ld a,[$cd6a] + ld a,[wcd6a] and a jp z,.loop call GBPalWhiteOutWithDelay3 @@ -181,15 +177,14 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) .strength bit 3,a ; does the player have the Rainbow Badge? jp z,.newBadgeRequired - ld a,$5b - call Predef + predef PrintStrengthTxt call GBPalWhiteOutWithDelay3 jp .goBackToMap .flash bit 0,a ; does the player have the Boulder Badge? jp z,.newBadgeRequired xor a - ld [$d35d],a + ld [wd35d],a ld hl,.flashLightsAreaText call PrintText call GBPalWhiteOutWithDelay3 @@ -199,10 +194,10 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) db "@" .dig ld a,ESCAPE_ROPE - ld [$cf91],a - ld [$d152],a + ld [wcf91],a + ld [wd152],a call UseItem - ld a,[$cd6a] + ld a,[wcd6a] and a jp z,.loop call GBPalWhiteOutWithDelay3 @@ -211,7 +206,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) call CheckIfInOutsideMap jr z,.canTeleport ld a,[wWhichPokemon] - ld hl,W_PARTYMON1NAME + ld hl,wPartyMonNicks call GetPartyMonName ld hl,.cannotUseTeleportNowText call PrintText @@ -219,10 +214,10 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) .canTeleport ld hl,.warpToLastPokemonCenterText call PrintText - ld hl,$d732 + ld hl,wd732 set 3,[hl] set 6,[hl] - ld hl,$d72e + ld hl,wd72e set 1,[hl] res 4,[hl] ld c,60 @@ -239,9 +234,9 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) TX_FAR _CannotFlyHereText db "@" .softboiled - ld hl,W_PARTYMON1_MAXHP + ld hl,wPartyMon1MaxHP ld a,[wWhichPokemon] - ld bc,44 + ld bc,wPartyMon2 - wPartyMon1 call AddNTimes ld a,[hli] ld [H_DIVIDEND],a @@ -251,7 +246,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) ld [H_DIVISOR],a ld b,2 ; number of bytes call Divide - ld bc,-33 + ld bc,wPartyMon1HP - wPartyMon1MaxHP add hl,bc ld a,[hld] ld b,a @@ -261,14 +256,14 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) ld a,[H_QUOTIENT + 2] sbc b jp nc,.notHealthyEnough - ld a,[$cc2b] + ld a,[wcc2b] push af ld a,POTION - ld [$cf91],a - ld [$d152],a + ld [wcf91],a + ld [wd152],a call UseItem pop af - ld [$cc2b],a + ld [wcc2b],a jp .loop .notHealthyEnough ; if current HP is less than 1/5 of max HP ld hl,.notHealthyEnoughText @@ -290,8 +285,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) ; writes a blank tile to all possible menu cursor positions on the party menu ErasePartyMenuCursors: ; 132ed (4:72ed) - FuncCoord 0,1 - ld hl,Coord + hlCoord 0, 1 ld bc,2 * 20 ; menu cursor positions are 2 rows apart ld a,6 ; 6 menu cursor positions .loop @@ -314,19 +308,19 @@ StartMenu_Item: ; 13302 (4:7302) jr .exitMenu .notInLinkBattle ld bc,wNumBagItems - ld hl,$cf8b + ld hl,wcf8b ld a,c ld [hli],a - ld [hl],b ; store item bag pointer at $cf8b (for DisplayListMenuID) + ld [hl],b ; store item bag pointer at wcf8b (for DisplayListMenuID) xor a - ld [$cf93],a + ld [wcf93],a ld a,ITEMLISTMENU ld [wListMenuID],a - ld a,[$cc2c] + ld a,[wcc2c] ld [wCurrentMenuItem],a call DisplayListMenuID ld a,[wCurrentMenuItem] - ld [$cc2c],a + ld [wcc2c],a jr nc,.choseItem .exitMenu call LoadScreenTilesFromBuffer2 ; restore saved screen @@ -336,23 +330,19 @@ StartMenu_Item: ; 13302 (4:7302) .choseItem ; erase menu cursor (blank each tile in front of an item name) ld a," " - FuncCoord 5,4 - ld [Coord],a - FuncCoord 5,6 - ld [Coord],a - FuncCoord 5,8 - ld [Coord],a - FuncCoord 5,10 - ld [Coord],a + Coorda 5, 4 + Coorda 5, 6 + Coorda 5, 8 + Coorda 5, 10 call PlaceUnfilledArrowMenuCursor xor a - ld [$cc35],a - ld a,[$cf91] + ld [wcc35],a + ld a,[wcf91] cp a,BICYCLE jp z,.useOrTossItem .notBicycle1 ld a,$06 ; use/toss menu - ld [$d125],a + ld [wd125],a call DisplayTextBoxID ld hl,wTopMenuItemY ld a,11 @@ -374,14 +364,14 @@ StartMenu_Item: ; 13302 (4:7302) jr z,.useOrTossItem jp ItemMenuLoop .useOrTossItem ; if the player made the choice to use or toss the item - ld a,[$cf91] - ld [$d11e],a + ld a,[wcf91] + ld [wd11e],a call GetItemName - call CopyStringToCF4B ; copy name to $cf4b - ld a,[$cf91] + call CopyStringToCF4B ; copy name to wcf4b + ld a,[wcf91] cp a,BICYCLE jr nz,.notBicycle2 - ld a,[$d732] + ld a,[wd732] bit 5,a jr z,.useItem_closeMenu ld hl,CannotGetOffHereText @@ -392,15 +382,15 @@ StartMenu_Item: ; 13302 (4:7302) and a jr nz,.tossItem .useItem - ld [$d152],a - ld a,[$cf91] + ld [wd152],a + ld a,[wcf91] cp a,HM_01 jr nc,.useItem_partyMenu ld hl,UsableItems_CloseMenu ld de,1 call IsInArray jr c,.useItem_closeMenu - ld a,[$cf91] + ld a,[wcf91] ld hl,UsableItems_PartyMenu ld de,1 call IsInArray @@ -409,34 +399,34 @@ StartMenu_Item: ; 13302 (4:7302) jp ItemMenuLoop .useItem_closeMenu xor a - ld [$d152],a + ld [wd152],a call UseItem - ld a,[$cd6a] + ld a,[wcd6a] and a jp z,ItemMenuLoop jp CloseStartMenu .useItem_partyMenu - ld a,[$cfcb] + ld a,[wcfcb] push af call UseItem - ld a,[$cd6a] + ld a,[wcd6a] cp a,$02 jp z,.partyMenuNotDisplayed call GBPalWhiteOutWithDelay3 call Func_3dbe pop af - ld [$cfcb],a + ld [wcfcb],a jp StartMenu_Item .partyMenuNotDisplayed pop af - ld [$cfcb],a + ld [wcfcb],a jp ItemMenuLoop .tossItem call IsKeyItem - ld a,[$d124] + ld a,[wd124] and a jr nz,.skipAskingQuantity - ld a,[$cf91] + ld a,[wcf91] call IsItemHM jr c,.skipAskingQuantity call DisplayChooseQuantityMenu @@ -515,8 +505,7 @@ StartMenu_TrainerInfo: ; 13460 (4:7460) xor a ld [$ffd7],a call DrawTrainerInfo - ld a,$2e - call Predef ; draw badges + predef DrawBadges ; draw badges ld b,$0d call GoPAL_SET call GBPalNormal @@ -535,101 +524,89 @@ StartMenu_TrainerInfo: ; 13460 (4:7460) DrawTrainerInfo: ; 1349a (4:749a) ld de,RedPicFront ld bc,(BANK(RedPicFront) << 8) | $01 - ld a,$3b - call Predef + predef Predef3B call DisableLCD - FuncCoord 0,2 - ld hl,Coord + hlCoord 0, 2 ld a," " call TrainerInfo_DrawVerticalLine - FuncCoord 1,2 - ld hl,Coord + hlCoord 1, 2 call TrainerInfo_DrawVerticalLine - ld hl,$9070 - ld de,$9000 - ld bc,$01c0 + ld hl,vChars2 + $70 + ld de,vChars2 + ld bc,$70 * 4 call CopyData ld hl,TrainerInfoTextBoxTileGraphics ; $7b98 ; trainer info text box tile patterns - ld de,$9770 + ld de,vChars2 + $770 ld bc,$0080 push bc call TrainerInfo_FarCopyData ld hl,BlankLeaderNames ; $7c28 - ld de,$9600 + ld de,vChars2 + $600 ld bc,$0170 call TrainerInfo_FarCopyData pop bc ld hl,BadgeNumbersTileGraphics ; $7d98 ; badge number tile patterns - ld de,$8d80 + ld de,vChars1 + $580 call TrainerInfo_FarCopyData ld hl,GymLeaderFaceAndBadgeTileGraphics ; $6a9e ; gym leader face and badge tile patterns - ld de,$9200 + ld de,vChars2 + $200 ld bc,$0400 ld a,$03 call FarCopyData2 ld hl,TextBoxGraphics ; $6288 ld de,$00d0 add hl,de ; hl = colon tile pattern - ld de,$8d60 + ld de,vChars1 + $560 ld bc,$0010 ld a,$04 push bc call FarCopyData2 pop bc ld hl,TrainerInfoTextBoxTileGraphics + $80 ; $7c18 ; background tile pattern - ld de,$8d70 + ld de,vChars1 + $570 call TrainerInfo_FarCopyData call EnableLCD - ld hl,$cd3d + ld hl,wWhichTrade ld a,18 + 1 ld [hli],a dec a ld [hli],a ld [hl],1 - FuncCoord 0,0 - ld hl,Coord + hlCoord 0, 0 call TrainerInfo_DrawTextBox - ld hl,$cd3d + ld hl,wWhichTrade ld a,16 + 1 ld [hli],a dec a ld [hli],a ld [hl],3 - FuncCoord 1,10 - ld hl,Coord + hlCoord 1, 10 call TrainerInfo_DrawTextBox - FuncCoord 0,10 - ld hl,Coord + hlCoord 0, 10 ld a,$d7 call TrainerInfo_DrawVerticalLine - FuncCoord 19,10 - ld hl,Coord + hlCoord 19, 10 call TrainerInfo_DrawVerticalLine - FuncCoord 6,9 - ld hl,Coord + hlCoord 6, 9 ld de,TrainerInfo_BadgesText call PlaceString - FuncCoord 2,2 - ld hl,Coord + hlCoord 2, 2 ld de,TrainerInfo_NameMoneyTimeText call PlaceString - FuncCoord 7,2 - ld hl,Coord - ld de,W_PLAYERNAME + hlCoord 7, 2 + ld de,wPlayerName call PlaceString - FuncCoord 8,4 - ld hl,Coord + hlCoord 8, 4 ld de,wPlayerMoney ld c,$e3 call PrintBCDNumber - FuncCoord 9,6 - ld hl,Coord - ld de,$da41 ; hours + hlCoord 9, 6 + ld de,W_PLAYTIMEHOURS + 1 ; hours ld bc,$4103 call PrintNumber ld [hl],$d6 ; colon tile ID inc hl - ld de,$da43 ; minutes + ld de,W_PLAYTIMEMINUTES + 1 ; minutes ld bc,$8102 jp PrintNumber @@ -650,15 +627,15 @@ TrainerInfo_BadgesText: ; 13597 (4:7597) ; height is always 6 ; INPUT: ; hl = destination address -; [$cd3d] = width + 1 -; [$cd3e] = width -; [$cd3f] = distance from the end of a text box row to the start of the next +; [wWhichTrade] = width + 1 +; [wTrainerEngageDistance] = width +; [wTrainerFacingDirection] = distance from the end of a text box row to the start of the next TrainerInfo_DrawTextBox: ; 135a0 (4:75a0) ld a,$79 ; upper left corner tile ID ld de,$7a7b ; top edge and upper right corner tile ID's call TrainerInfo_DrawHorizontalEdge ; draw top edge call TrainerInfo_NextTextBoxRow - ld a,[$cd3d] ; width of the text box plus one + ld a,[wWhichTrade] ; width of the text box plus one ld e,a ld d,0 ld c,6 ; height of the text box @@ -674,7 +651,7 @@ TrainerInfo_DrawTextBox: ; 135a0 (4:75a0) TrainerInfo_DrawHorizontalEdge: ; 135c3 (4:75c3) ld [hli],a ; place left corner tile - ld a,[$cd3e] ; width of the text box + ld a,[wTrainerEngageDistance] ; width of the text box ld c,a ld a,d .loop @@ -686,7 +663,7 @@ TrainerInfo_DrawHorizontalEdge: ; 135c3 (4:75c3) ret TrainerInfo_NextTextBoxRow: ; 135d0 (4:75d0) - ld a,[$cd3f] ; distance to the start of the next row + ld a,[wTrainerFacingDirection] ; distance to the start of the next row .loop inc hl dec a @@ -708,11 +685,10 @@ TrainerInfo_DrawVerticalLine: ; 135d8 (4:75d8) ret StartMenu_SaveReset: ; 135e3 (4:75e3) - ld a,[$d72e] + ld a,[wd72e] bit 6,a ; is the player using the link feature? - jp nz,InitGame - ld a,$3f - call Predef ; save the game + jp nz,Init + predef SaveSAV ; save the game call LoadScreenTilesFromBuffer2 ; restore saved screen jp HoldTextDisplayOpen @@ -729,9 +705,9 @@ StartMenu_Option: ; 135f6 (4:75f6) SwitchPartyMon: ; 13613 (4:7613) call SwitchPartyMon_Stats - ld a, [wWhichTrade] ; $cd3d + ld a, [wWhichTrade] ; wWhichTrade call SwitchPartyMon_OAM - ld a, [wCurrentMenuItem] ; $cc26 + ld a, [wCurrentMenuItem] ; wCurrentMenuItem call SwitchPartyMon_OAM jp RedrawPartyMenu_ @@ -762,42 +738,42 @@ SwitchPartyMon_OAM: ; 13625 (4:7625) jp PlaySound SwitchPartyMon_Stats: ; 13653 (4:7653) - ld a, [$cc35] + ld a, [wcc35] and a jr nz, .asm_13661 - ld a, [wWhichPokemon] ; $cf92 + ld a, [wWhichPokemon] ; wWhichPokemon inc a - ld [$cc35], a + ld [wcc35], a ret .asm_13661 xor a - ld [$d07d], a - ld a, [$cc35] + ld [wd07d], a + ld a, [wcc35] dec a ld b, a - ld a, [wCurrentMenuItem] ; $cc26 - ld [wWhichTrade], a ; $cd3d + ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld [wWhichTrade], a ; wWhichTrade cp b jr nz, .asm_1367b xor a - ld [$cc35], a - ld [$d07d], a + ld [wcc35], a + ld [wd07d], a ret .asm_1367b ld a, b - ld [$cc35], a + ld [wcc35], a push hl push de - ld hl, W_PARTYMON1 ; $d164 + ld hl, wPartySpecies ld d, h ld e, l - ld a, [wCurrentMenuItem] ; $cc26 + ld a, [wCurrentMenuItem] ; wCurrentMenuItem add l ld l, a jr nc, .asm_1368e inc h .asm_1368e - ld a, [$cc35] + ld a, [wcc35] add e ld e, a jr nc, .asm_13696 @@ -809,67 +785,67 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld [hl], a ld a, [H_DIVIDEND] ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) ld [de], a - ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA) - ld bc, $2c - ld a, [wCurrentMenuItem] ; $cc26 + ld hl, wPartyMons + ld bc, wPartyMon2 - wPartyMon1 + ld a, [wCurrentMenuItem] ; wCurrentMenuItem call AddNTimes push hl - ld de, $cc97 + ld de, wcc97 ld bc, $2c call CopyData - ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA) + ld hl, wPartyMons ld bc, $2c - ld a, [$cc35] + ld a, [wcc35] call AddNTimes pop de push hl ld bc, $2c call CopyData pop de - ld hl, $cc97 + ld hl, wcc97 ld bc, $2c call CopyData - ld hl, W_PARTYMON1OT ; $d273 - ld a, [wCurrentMenuItem] ; $cc26 + ld hl, wPartyMonOT ; wd273 + ld a, [wCurrentMenuItem] ; wCurrentMenuItem call SkipFixedLengthTextEntries push hl - ld de, $cc97 + ld de, wcc97 ld bc, $b call CopyData - ld hl, W_PARTYMON1OT ; $d273 - ld a, [$cc35] + ld hl, wPartyMonOT ; wd273 + ld a, [wcc35] call SkipFixedLengthTextEntries pop de push hl ld bc, $b call CopyData pop de - ld hl, $cc97 + ld hl, wcc97 ld bc, $b call CopyData - ld hl, W_PARTYMON1NAME ; $d2b5 - ld a, [wCurrentMenuItem] ; $cc26 + ld hl, wPartyMonNicks ; wPartyMonNicks + ld a, [wCurrentMenuItem] ; wCurrentMenuItem call SkipFixedLengthTextEntries push hl - ld de, $cc97 + ld de, wcc97 ld bc, $b call CopyData - ld hl, W_PARTYMON1NAME ; $d2b5 - ld a, [$cc35] + ld hl, wPartyMonNicks ; wPartyMonNicks + ld a, [wcc35] call SkipFixedLengthTextEntries pop de push hl ld bc, $b call CopyData pop de - ld hl, $cc97 + ld hl, wcc97 ld bc, $b call CopyData - ld a, [$cc35] - ld [wWhichTrade], a ; $cd3d + ld a, [wcc35] + ld [wWhichTrade], a ; wWhichTrade xor a - ld [$cc35], a - ld [$d07d], a + ld [wcc35], a + ld [wd07d], a pop de pop hl ret |