diff options
Diffstat (limited to 'engine/menu')
-rw-r--r-- | engine/menu/draw_start_menu.asm | 72 | ||||
-rwxr-xr-x | engine/menu/main_menu.asm | 406 | ||||
-rwxr-xr-x | engine/menu/party_menu.asm | 204 | ||||
-rwxr-xr-x | engine/menu/pc.asm | 16 | ||||
-rwxr-xr-x | engine/menu/pokedex.asm | 518 | ||||
-rwxr-xr-x | engine/menu/prize_menu.asm | 208 | ||||
-rwxr-xr-x | engine/menu/start_menu.asm | 88 | ||||
-rwxr-xr-x | engine/menu/start_sub_menus.asm | 568 | ||||
-rw-r--r-- | engine/menu/swap_items.asm | 180 | ||||
-rw-r--r-- | engine/menu/text_box.asm | 96 |
10 files changed, 1178 insertions, 1178 deletions
diff --git a/engine/menu/draw_start_menu.asm b/engine/menu/draw_start_menu.asm index 83a81aac..11777dc6 100644 --- a/engine/menu/draw_start_menu.asm +++ b/engine/menu/draw_start_menu.asm @@ -3,60 +3,60 @@ DrawStartMenu: CheckEvent EVENT_GOT_POKEDEX ; menu with pokedex coord hl, 10, 0 - ld b,$0e - ld c,$08 - jr nz,.drawTextBoxBorder + ld b, $0e + ld c, $08 + jr nz, .drawTextBoxBorder ; shorter menu if the player doesn't have the pokedex coord hl, 10, 0 - ld b,$0c - ld c,$08 + ld b, $0c + ld c, $08 .drawTextBoxBorder call TextBoxBorder - ld a,D_DOWN | D_UP | START | B_BUTTON | A_BUTTON - ld [wMenuWatchedKeys],a - ld a,$02 - ld [wTopMenuItemY],a ; Y position of first menu choice - ld a,$0b - ld [wTopMenuItemX],a ; X position of first menu choice - ld a,[wBattleAndStartSavedMenuItem] ; remembered menu selection from last time - ld [wCurrentMenuItem],a - ld [wLastMenuItem],a + ld a, D_DOWN | D_UP | START | B_BUTTON | A_BUTTON + ld [wMenuWatchedKeys], a + ld a, $02 + ld [wTopMenuItemY], a ; Y position of first menu choice + ld a, $0b + ld [wTopMenuItemX], a ; X position of first menu choice + ld a, [wBattleAndStartSavedMenuItem] ; remembered menu selection from last time + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a xor a - ld [wMenuWatchMovingOutOfBounds],a - ld hl,wd730 - set 6,[hl] ; no pauses between printing each letter + ld [wMenuWatchMovingOutOfBounds], a + ld hl, wd730 + set 6, [hl] ; no pauses between printing each letter coord hl, 12, 2 CheckEvent EVENT_GOT_POKEDEX ; case for not having pokedex - ld a,$06 - jr z,.storeMenuItemCount + ld a, $06 + jr z, .storeMenuItemCount ; case for having pokedex - ld de,StartMenuPokedexText + ld de, StartMenuPokedexText call PrintStartMenuItem - ld a,$07 + ld a, $07 .storeMenuItemCount - ld [wMaxMenuItem],a ; number of menu items - ld de,StartMenuPokemonText + ld [wMaxMenuItem], a ; number of menu items + ld de, StartMenuPokemonText call PrintStartMenuItem - ld de,StartMenuItemText + ld de, StartMenuItemText call PrintStartMenuItem - ld de,wPlayerName ; player's name + ld de, wPlayerName ; player's name call PrintStartMenuItem - ld a,[wd72e] - bit 6,a ; is the player using the link feature? + ld a, [wd72e] + bit 6, a ; is the player using the link feature? ; case for not using link feature - ld de,StartMenuSaveText - jr z,.printSaveOrResetText + ld de, StartMenuSaveText + jr z, .printSaveOrResetText ; case for using link feature - ld de,StartMenuResetText + ld de, StartMenuResetText .printSaveOrResetText call PrintStartMenuItem - ld de,StartMenuOptionText + ld de, StartMenuOptionText call PrintStartMenuItem - ld de,StartMenuExitText + ld de, StartMenuExitText call PlaceString - ld hl,wd730 - res 6,[hl] ; turn pauses between printing letters back on + ld hl, wd730 + res 6, [hl] ; turn pauses between printing letters back on ret StartMenuPokedexText: @@ -84,6 +84,6 @@ PrintStartMenuItem: push hl call PlaceString pop hl - ld de,SCREEN_WIDTH * 2 - add hl,de + ld de, SCREEN_WIDTH * 2 + add hl, de ret diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index cd4198b6..da2e98e4 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -2,133 +2,133 @@ MainMenu: ; Check save file call InitOptions xor a - ld [wOptionsInitialized],a + ld [wOptionsInitialized], a inc a - ld [wSaveFileStatus],a + ld [wSaveFileStatus], a call CheckForPlayerNameInSRAM - jr nc,.mainMenuLoop + jr nc, .mainMenuLoop predef LoadSAV .mainMenuLoop - ld c,20 + ld c, 20 call DelayFrames xor a ; LINK_STATE_NONE - ld [wLinkState],a - ld hl,wPartyAndBillsPCSavedMenuItem - ld [hli],a - ld [hli],a - ld [hli],a - ld [hl],a - ld [wDefaultMap],a - ld hl,wd72e - res 6,[hl] + ld [wLinkState], a + ld hl, wPartyAndBillsPCSavedMenuItem + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ld [wDefaultMap], a + ld hl, wd72e + res 6, [hl] call ClearScreen call RunDefaultPaletteCommand call LoadTextBoxTilePatterns call LoadFontTilePatterns - ld hl,wd730 - set 6,[hl] - ld a,[wSaveFileStatus] - cp a,1 - jr z,.noSaveFile + ld hl, wd730 + set 6, [hl] + ld a, [wSaveFileStatus] + cp 1 + jr z, .noSaveFile ; there's a save file coord hl, 0, 0 - ld b,6 - ld c,13 + ld b, 6 + ld c, 13 call TextBoxBorder coord hl, 2, 2 - ld de,ContinueText + ld de, ContinueText call PlaceString jr .next2 .noSaveFile coord hl, 0, 0 - ld b,4 - ld c,13 + ld b, 4 + ld c, 13 call TextBoxBorder coord hl, 2, 2 - ld de,NewGameText + ld de, NewGameText call PlaceString .next2 - ld hl,wd730 - res 6,[hl] + ld hl, wd730 + res 6, [hl] call UpdateSprites xor a - ld [wCurrentMenuItem],a - ld [wLastMenuItem],a - ld [wMenuJoypadPollCount],a + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a + ld [wMenuJoypadPollCount], a inc a - ld [wTopMenuItemX],a + ld [wTopMenuItemX], a inc a - ld [wTopMenuItemY],a - ld a,A_BUTTON | B_BUTTON | START - ld [wMenuWatchedKeys],a - ld a,[wSaveFileStatus] - ld [wMaxMenuItem],a + ld [wTopMenuItemY], a + ld a, A_BUTTON | B_BUTTON | START + ld [wMenuWatchedKeys], a + ld a, [wSaveFileStatus] + ld [wMaxMenuItem], a call HandleMenuInput - bit 1,a ; pressed B? - jp nz,DisplayTitleScreen ; if so, go back to the title screen - ld c,20 + bit 1, a ; pressed B? + jp nz, DisplayTitleScreen ; if so, go back to the title screen + ld c, 20 call DelayFrames - ld a,[wCurrentMenuItem] - ld b,a - ld a,[wSaveFileStatus] - cp a,2 - jp z,.skipInc + ld a, [wCurrentMenuItem] + ld b, a + ld a, [wSaveFileStatus] + cp 2 + jp z, .skipInc ; If there's no save file, increment the current menu item so that the numbers ; are the same whether or not there's a save file. inc b .skipInc - ld a,b + ld a, b and a - jr z,.choseContinue - cp a,1 - jp z,StartNewGame + jr z, .choseContinue + cp 1 + jp z, StartNewGame call DisplayOptionMenu - ld a,1 - ld [wOptionsInitialized],a + ld a, 1 + ld [wOptionsInitialized], a jp .mainMenuLoop .choseContinue call DisplayContinueGameInfo - ld hl,wCurrentMapScriptFlags - set 5,[hl] + ld hl, wCurrentMapScriptFlags + set 5, [hl] .inputLoop xor a - ld [hJoyPressed],a - ld [hJoyReleased],a - ld [hJoyHeld],a + ld [hJoyPressed], a + ld [hJoyReleased], a + ld [hJoyHeld], a call Joypad - ld a,[hJoyHeld] - bit 0,a - jr nz,.pressedA - bit 1,a - jp nz,.mainMenuLoop ; pressed B + ld a, [hJoyHeld] + bit 0, a + jr nz, .pressedA + bit 1, a + jp nz, .mainMenuLoop ; pressed B jr .inputLoop .pressedA call GBPalWhiteOutWithDelay3 call ClearScreen - ld a,PLAYER_DIR_DOWN - ld [wPlayerDirection],a - ld c,10 + ld a, PLAYER_DIR_DOWN + ld [wPlayerDirection], a + ld c, 10 call DelayFrames - ld a,[wNumHoFTeams] + ld a, [wNumHoFTeams] and a - jp z,SpecialEnterMap - ld a,[wCurMap] ; map ID - cp a,HALL_OF_FAME - jp nz,SpecialEnterMap + jp z, SpecialEnterMap + ld a, [wCurMap] ; map ID + cp HALL_OF_FAME + jp nz, SpecialEnterMap xor a - ld [wDestinationMap],a - ld hl,wd732 - set 2,[hl] ; fly warp or dungeon warp + ld [wDestinationMap], a + ld hl, wd732 + set 2, [hl] ; fly warp or dungeon warp call SpecialWarpIn jp SpecialEnterMap InitOptions: - ld a,1 ; no delay - ld [wLetterPrintingDelayFlags],a - ld a,3 ; medium speed - ld [wOptions],a + ld a, 1 ; no delay + ld [wLetterPrintingDelayFlags], a + ld a, 3 ; medium speed + ld [wOptions], a ret LinkMenu: @@ -428,154 +428,154 @@ SaveScreenInfoText: DisplayOptionMenu: coord hl, 0, 0 - ld b,3 - ld c,18 + ld b, 3 + ld c, 18 call TextBoxBorder coord hl, 0, 5 - ld b,3 - ld c,18 + ld b, 3 + ld c, 18 call TextBoxBorder coord hl, 0, 10 - ld b,3 - ld c,18 + ld b, 3 + ld c, 18 call TextBoxBorder coord hl, 1, 1 - ld de,TextSpeedOptionText + ld de, TextSpeedOptionText call PlaceString coord hl, 1, 6 - ld de,BattleAnimationOptionText + ld de, BattleAnimationOptionText call PlaceString coord hl, 1, 11 - ld de,BattleStyleOptionText + ld de, BattleStyleOptionText call PlaceString coord hl, 2, 16 - ld de,OptionMenuCancelText + ld de, OptionMenuCancelText call PlaceString xor a - ld [wCurrentMenuItem],a - ld [wLastMenuItem],a + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a inc a - ld [wLetterPrintingDelayFlags],a - ld [wUnusedCD40],a - ld a,3 ; text speed cursor Y coordinate - ld [wTopMenuItemY],a + ld [wLetterPrintingDelayFlags], a + ld [wUnusedCD40], a + ld a, 3 ; text speed cursor Y coordinate + ld [wTopMenuItemY], a call SetCursorPositionsFromOptions - ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate - ld [wTopMenuItemX],a - ld a,$01 - ld [H_AUTOBGTRANSFERENABLED],a ; enable auto background transfer + ld a, [wOptionsTextSpeedCursorX] ; text speed cursor X coordinate + ld [wTopMenuItemX], a + ld a, $01 + ld [H_AUTOBGTRANSFERENABLED], a ; enable auto background transfer call Delay3 .loop call PlaceMenuCursor call SetOptionsFromCursorPositions .getJoypadStateLoop call JoypadLowSensitivity - ld a,[hJoy5] - ld b,a - and a,A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed? - jr z,.getJoypadStateLoop - bit 1,b ; B button pressed? - jr nz,.exitMenu - bit 3,b ; Start button pressed? - jr nz,.exitMenu - bit 0,b ; A button pressed? - jr z,.checkDirectionKeys - ld a,[wTopMenuItemY] - cp a,16 ; is the cursor on Cancel? - jr nz,.loop + ld a, [hJoy5] + ld b, a + and A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed? + jr z, .getJoypadStateLoop + bit 1, b ; B button pressed? + jr nz, .exitMenu + bit 3, b ; Start button pressed? + jr nz, .exitMenu + bit 0, b ; A button pressed? + jr z, .checkDirectionKeys + ld a, [wTopMenuItemY] + cp 16 ; is the cursor on Cancel? + jr nz, .loop .exitMenu - ld a,SFX_PRESS_AB + ld a, SFX_PRESS_AB call PlaySound ret .eraseOldMenuCursor - ld [wTopMenuItemX],a + ld [wTopMenuItemX], a call EraseMenuCursor jp .loop .checkDirectionKeys - ld a,[wTopMenuItemY] - bit 7,b ; Down pressed? - jr nz,.downPressed - bit 6,b ; Up pressed? - jr nz,.upPressed - cp a,8 ; cursor in Battle Animation section? - jr z,.cursorInBattleAnimation - cp a,13 ; cursor in Battle Style section? - jr z,.cursorInBattleStyle - cp a,16 ; cursor on Cancel? - jr z,.loop + ld a, [wTopMenuItemY] + bit 7, b ; Down pressed? + jr nz, .downPressed + bit 6, b ; Up pressed? + jr nz, .upPressed + cp 8 ; cursor in Battle Animation section? + jr z, .cursorInBattleAnimation + cp 13 ; cursor in Battle Style section? + jr z, .cursorInBattleStyle + cp 16 ; cursor on Cancel? + jr z, .loop .cursorInTextSpeed - bit 5,b ; Left pressed? - jp nz,.pressedLeftInTextSpeed + bit 5, b ; Left pressed? + jp nz, .pressedLeftInTextSpeed jp .pressedRightInTextSpeed .downPressed - cp a,16 - ld b,-13 - ld hl,wOptionsTextSpeedCursorX - jr z,.updateMenuVariables - ld b,5 - cp a,3 + cp 16 + ld b, -13 + ld hl, wOptionsTextSpeedCursorX + jr z, .updateMenuVariables + ld b, 5 + cp 3 inc hl - jr z,.updateMenuVariables - cp a,8 + jr z, .updateMenuVariables + cp 8 inc hl - jr z,.updateMenuVariables - ld b,3 + jr z, .updateMenuVariables + ld b, 3 inc hl jr .updateMenuVariables .upPressed - cp a,8 - ld b,-5 - ld hl,wOptionsTextSpeedCursorX - jr z,.updateMenuVariables - cp a,13 + cp 8 + ld b, -5 + ld hl, wOptionsTextSpeedCursorX + jr z, .updateMenuVariables + cp 13 inc hl - jr z,.updateMenuVariables - cp a,16 - ld b,-3 + jr z, .updateMenuVariables + cp 16 + ld b, -3 inc hl - jr z,.updateMenuVariables - ld b,13 + jr z, .updateMenuVariables + ld b, 13 inc hl .updateMenuVariables add b - ld [wTopMenuItemY],a - ld a,[hl] - ld [wTopMenuItemX],a + ld [wTopMenuItemY], a + ld a, [hl] + ld [wTopMenuItemX], a call PlaceUnfilledArrowMenuCursor jp .loop .cursorInBattleAnimation - ld a,[wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate - xor a,$0b ; toggle between 1 and 10 - ld [wOptionsBattleAnimCursorX],a + ld a, [wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate + xor $0b ; toggle between 1 and 10 + ld [wOptionsBattleAnimCursorX], a jp .eraseOldMenuCursor .cursorInBattleStyle - ld a,[wOptionsBattleStyleCursorX] ; battle style cursor X coordinate - xor a,$0b ; toggle between 1 and 10 - ld [wOptionsBattleStyleCursorX],a + ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate + xor $0b ; toggle between 1 and 10 + ld [wOptionsBattleStyleCursorX], a jp .eraseOldMenuCursor .pressedLeftInTextSpeed - ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate - cp a,1 - jr z,.updateTextSpeedXCoord - cp a,7 - jr nz,.fromSlowToMedium - sub a,6 + ld a, [wOptionsTextSpeedCursorX] ; text speed cursor X coordinate + cp 1 + jr z, .updateTextSpeedXCoord + cp 7 + jr nz, .fromSlowToMedium + sub 6 jr .updateTextSpeedXCoord .fromSlowToMedium - sub a,7 + sub 7 jr .updateTextSpeedXCoord .pressedRightInTextSpeed - ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate - cp a,14 - jr z,.updateTextSpeedXCoord - cp a,7 - jr nz,.fromFastToMedium - add a,7 + ld a, [wOptionsTextSpeedCursorX] ; text speed cursor X coordinate + cp 14 + jr z, .updateTextSpeedXCoord + cp 7 + jr nz, .fromFastToMedium + add 7 jr .updateTextSpeedXCoord .fromFastToMedium - add a,6 + add 6 .updateTextSpeedXCoord - ld [wOptionsTextSpeedCursorX],a ; text speed cursor X coordinate + ld [wOptionsTextSpeedCursorX], a ; text speed cursor X coordinate jp .eraseOldMenuCursor TextSpeedOptionText: @@ -595,79 +595,79 @@ OptionMenuCancelText: ; sets the options variable according to the current placement of the menu cursors in the options menu SetOptionsFromCursorPositions: - ld hl,TextSpeedOptionData - ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate - ld c,a + ld hl, TextSpeedOptionData + ld a, [wOptionsTextSpeedCursorX] ; text speed cursor X coordinate + ld c, a .loop - ld a,[hli] + ld a, [hli] cp c - jr z,.textSpeedMatchFound + jr z, .textSpeedMatchFound inc hl jr .loop .textSpeedMatchFound - ld a,[hl] - ld d,a - ld a,[wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate + ld a, [hl] + ld d, a + ld a, [wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate dec a - jr z,.battleAnimationOn + jr z, .battleAnimationOn .battleAnimationOff - set 7,d + set 7, d jr .checkBattleStyle .battleAnimationOn - res 7,d + res 7, d .checkBattleStyle - ld a,[wOptionsBattleStyleCursorX] ; battle style cursor X coordinate + ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate dec a - jr z,.battleStyleShift + jr z, .battleStyleShift .battleStyleSet - set 6,d + set 6, d jr .storeOptions .battleStyleShift - res 6,d + res 6, d .storeOptions - ld a,d - ld [wOptions],a + ld a, d + ld [wOptions], a ret ; reads the options variable and places menu cursors in the correct positions within the options menu SetCursorPositionsFromOptions: - ld hl,TextSpeedOptionData + 1 - ld a,[wOptions] - ld c,a - and a,$3f + ld hl, TextSpeedOptionData + 1 + ld a, [wOptions] + ld c, a + and $3f push bc - ld de,2 + ld de, 2 call IsInArray pop bc dec hl - ld a,[hl] - ld [wOptionsTextSpeedCursorX],a ; text speed cursor X coordinate + ld a, [hl] + ld [wOptionsTextSpeedCursorX], a ; text speed cursor X coordinate coord hl, 0, 3 call .placeUnfilledRightArrow sla c - ld a,1 ; On - jr nc,.storeBattleAnimationCursorX - ld a,10 ; Off + ld a, 1 ; On + jr nc, .storeBattleAnimationCursorX + ld a, 10 ; Off .storeBattleAnimationCursorX - ld [wOptionsBattleAnimCursorX],a ; battle animation cursor X coordinate + ld [wOptionsBattleAnimCursorX], a ; battle animation cursor X coordinate coord hl, 0, 8 call .placeUnfilledRightArrow sla c - ld a,1 - jr nc,.storeBattleStyleCursorX - ld a,10 + ld a, 1 + jr nc, .storeBattleStyleCursorX + ld a, 10 .storeBattleStyleCursorX - ld [wOptionsBattleStyleCursorX],a ; battle style cursor X coordinate + ld [wOptionsBattleStyleCursorX], a ; battle style cursor X coordinate coord hl, 0, 13 call .placeUnfilledRightArrow ; cursor in front of Cancel coord hl, 0, 16 - ld a,1 + ld a, 1 .placeUnfilledRightArrow - ld e,a - ld d,0 - add hl,de - ld [hl],$ec ; unfilled right arrow menu cursor + ld e, a + ld d, 0 + add hl, de + ld [hl], $ec ; unfilled right arrow menu cursor ret ; table that indicates how the 3 text speed options affect frame delays diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm index a35524ed..5149e5ab 100755 --- a/engine/menu/party_menu.asm +++ b/engine/menu/party_menu.asm @@ -19,83 +19,83 @@ ; f8: leveled up DrawPartyMenu_: xor a - ld [H_AUTOBGTRANSFERENABLED],a + ld [H_AUTOBGTRANSFERENABLED], a call ClearScreen call UpdateSprites callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics RedrawPartyMenu_: - ld a,[wPartyMenuTypeOrMessageID] - cp a,SWAP_MONS_PARTY_MENU - jp z,.printMessage + ld a, [wPartyMenuTypeOrMessageID] + cp SWAP_MONS_PARTY_MENU + jp z, .printMessage call ErasePartyMenuCursors callba InitPartyMenuBlkPacket coord hl, 3, 0 - ld de,wPartySpecies + ld de, wPartySpecies xor a - ld c,a - ld [hPartyMonIndex],a - ld [wWhichPartyMenuHPBar],a + ld c, a + ld [hPartyMonIndex], a + ld [wWhichPartyMenuHPBar], a .loop - ld a,[de] - cp a,$FF ; reached the terminator? - jp z,.afterDrawingMonEntries + ld a, [de] + cp $FF ; reached the terminator? + jp z, .afterDrawingMonEntries push bc push de push hl - ld a,c + ld a, c push hl - ld hl,wPartyMonNicks + ld hl, wPartyMonNicks call GetPartyMonName pop hl call PlaceString ; print the pokemon's name callba WriteMonPartySpriteOAMByPartyIndex ; place the appropriate pokemon icon - ld a,[hPartyMonIndex] - ld [wWhichPokemon],a + ld a, [hPartyMonIndex] + ld [wWhichPokemon], a inc a - ld [hPartyMonIndex],a + ld [hPartyMonIndex], a call LoadMonData pop hl push hl - ld a,[wMenuItemToSwap] + ld a, [wMenuItemToSwap] and a ; is the player swapping pokemon positions? - jr z,.skipUnfilledRightArrow + jr z, .skipUnfilledRightArrow ; if the player is swapping pokemon positions dec a - ld b,a - ld a,[wWhichPokemon] + ld b, a + ld a, [wWhichPokemon] cp b ; is the player swapping the current pokemon in the list? - jr nz,.skipUnfilledRightArrow + 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 + ld a, "▷" ; unfilled right arrow menu cursor + ld [hli], a ; place the cursor inc hl inc hl .skipUnfilledRightArrow - ld a,[wPartyMenuTypeOrMessageID] ; menu type - cp a,TMHM_PARTY_MENU - jr z,.teachMoveMenu - cp a,EVO_STONE_PARTY_MENU - jr z,.evolutionStoneMenu + 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 + 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_0xFFF6] - set 0,a - ld [hFlags_0xFFF6],a - add hl,bc + ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column + ld a, [hFlags_0xFFF6] + set 0, a + ld [hFlags_0xFFF6], a + add hl, bc predef DrawHP2 ; draw HP bar and prints current / max HP - ld a,[hFlags_0xFFF6] - res 0,a - ld [hFlags_0xFFF6],a + ld a, [hFlags_0xFFF6] + res 0, a + ld [hFlags_0xFFF6], a call SetPartyMenuHPBarColor ; color the HP bar (on SGB) pop hl jr .printLevel @@ -103,26 +103,26 @@ RedrawPartyMenu_: push hl predef CanLearnTM ; check if the pokemon can learn the move pop hl - ld de,.ableToLearnMoveText - ld a,c + ld de, .ableToLearnMoveText + ld a, c and a - jr nz,.placeMoveLearnabilityString - ld de,.notAbleToLearnMoveText + jr nz, .placeMoveLearnabilityString + ld de, .notAbleToLearnMoveText .placeMoveLearnabilityString - ld bc,20 + 9 ; down 1 row and right 9 columns + ld bc, 20 + 9 ; down 1 row and right 9 columns push hl - add hl,bc + add hl, bc call PlaceString pop hl .printLevel - ld bc,10 ; move 10 columns to the right - add hl,bc + 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 + ld bc, 2 * 20 + add hl, bc pop bc inc c jp .loop @@ -132,54 +132,54 @@ RedrawPartyMenu_: db "NOT ABLE@" .evolutionStoneMenu push hl - ld hl,EvosMovesPointerTable - ld b,0 - ld a,[wLoadedMonSpecies] + ld hl, EvosMovesPointerTable + ld b, 0 + ld a, [wLoadedMonSpecies] dec a add a rl b - ld c,a - add hl,bc - ld de,wcd6d - ld a,BANK(EvosMovesPointerTable) - ld bc,2 + ld c, a + add hl, bc + ld de, wcd6d + ld a, BANK(EvosMovesPointerTable) + ld bc, 2 call FarCopyData - ld hl,wcd6d - ld a,[hli] - ld h,[hl] - ld l,a - ld de,wcd6d - ld a,BANK(EvosMovesPointerTable) - ld bc,Mon133_EvosEnd - Mon133_EvosMoves + ld hl, wcd6d + ld a, [hli] + ld h, [hl] + ld l, a + ld de, wcd6d + ld a, BANK(EvosMovesPointerTable) + ld bc, Mon133_EvosEnd - Mon133_EvosMoves call FarCopyData - ld hl,wcd6d - ld de,.notAbleToEvolveText + ld hl, wcd6d + ld de, .notAbleToEvolveText ; loop through the pokemon's evolution entries .checkEvolutionsLoop - ld a,[hli] + ld a, [hli] and a ; reached terminator? - jr z,.placeEvolutionStoneString ; if so, place the "NOT ABLE" string + jr z, .placeEvolutionStoneString ; if so, place the "NOT ABLE" string inc hl inc hl - cp a,EV_ITEM - jr nz,.checkEvolutionsLoop + 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 + 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 + jr nz, .checkEvolutionsLoop ; if it does match - ld de,.ableToEvolveText + ld de, .ableToEvolveText .placeEvolutionStoneString - ld bc,20 + 9 ; down 1 row and right 9 columns + ld bc, 20 + 9 ; down 1 row and right 9 columns pop hl push hl - add hl,bc + add hl, bc call PlaceString pop hl jr .printLevel @@ -191,44 +191,44 @@ RedrawPartyMenu_: ld b, SET_PAL_PARTY_MENU call RunPaletteCommand .printMessage - ld hl,wd730 - ld a,[hl] + ld hl, wd730 + ld a, [hl] push af push hl - set 6,[hl] ; turn off letter printing delay - ld a,[wPartyMenuTypeOrMessageID] ; message ID - cp a,$F0 - jr nc,.printItemUseMessage + 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 + 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 + ld [hl], a + ld a, 1 + ld [H_AUTOBGTRANSFERENABLED], a call Delay3 jp GBPalNormal .printItemUseMessage - and a,$0F - ld hl,PartyMenuItemUseMessagePointers + 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 + 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 + ld a, [wUsedItemOnWhichPokemon] + ld hl, wPartyMonNicks call GetPartyMonName pop hl call PrintText diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm index c9e2cf08..5639bd99 100755 --- a/engine/menu/pc.asm +++ b/engine/menu/pc.asm @@ -17,34 +17,34 @@ PCMainMenu: bit 1, a ;if player pressed B jp nz, LogOff ld a, [wMaxMenuItem] - cp a, 2 + cp 2 jr nz, .next ;if not 2 menu items (not counting log off) (2 occurs before you get the pokedex) ld a, [wCurrentMenuItem] and a jp z, BillsPC ;if current menu item id is 0, it's bills pc - cp a, 1 + cp 1 jr z, .playersPC ;if current menu item id is 1, it's players pc jp LogOff ;otherwise, it's 2, and you're logging off .next - cp a, 3 + cp 3 jr nz, .next2 ;if not 3 menu items (not counting log off) (3 occurs after you get the pokedex, before you beat the pokemon league) ld a, [wCurrentMenuItem] and a jp z, BillsPC ;if current menu item id is 0, it's bills pc - cp a, 1 + cp 1 jr z, .playersPC ;if current menu item id is 1, it's players pc - cp a, 2 + cp 2 jp z, OaksPC ;if current menu item id is 2, it's oaks pc jp LogOff ;otherwise, it's 3, and you're logging off .next2 ld a, [wCurrentMenuItem] and a jp z, BillsPC ;if current menu item id is 0, it's bills pc - cp a, 1 + cp 1 jr z, .playersPC ;if current menu item id is 1, it's players pc - cp a, 2 + cp 2 jp z, OaksPC ;if current menu item id is 2, it's oaks pc - cp a, 3 + cp 3 jp z, PKMNLeague ;if current menu item id is 3, it's pkmnleague jp LogOff ;otherwise, it's 4, and you're logging off .playersPC diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index bf8afaa9..8e1fd480 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -2,53 +2,53 @@ ShowPokedexMenu: call GBPalWhiteOut call ClearScreen call UpdateSprites - ld a,[wListScrollOffset] + ld a, [wListScrollOffset] push af xor a - ld [wCurrentMenuItem],a - ld [wListScrollOffset],a - ld [wLastMenuItem],a + ld [wCurrentMenuItem], a + ld [wListScrollOffset], a + ld [wLastMenuItem], a inc a - ld [wd11e],a - ld [hJoy7],a + ld [wd11e], a + ld [hJoy7], a .setUpGraphics ld b, SET_PAL_GENERIC call RunPaletteCommand callab LoadPokedexTilePatterns .doPokemonListMenu - ld hl,wTopMenuItemY - ld a,3 - ld [hli],a ; top menu item Y + ld hl, wTopMenuItemY + ld a, 3 + ld [hli], a ; top menu item Y xor a - ld [hli],a ; top menu item X + ld [hli], a ; top menu item X inc a - ld [wMenuWatchMovingOutOfBounds],a + ld [wMenuWatchMovingOutOfBounds], a inc hl inc hl - ld a,6 - ld [hli],a ; max menu item ID - ld [hl],D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON + ld a, 6 + ld [hli], a ; max menu item ID + ld [hl], D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON call HandlePokedexListMenu - jr c,.goToSideMenu ; if the player chose a pokemon from the list + jr c, .goToSideMenu ; if the player chose a pokemon from the list .exitPokedex xor a - ld [wMenuWatchMovingOutOfBounds],a - ld [wCurrentMenuItem],a - ld [wLastMenuItem],a - ld [hJoy7],a - ld [wWastedByteCD3A],a - ld [wOverrideSimulatedJoypadStatesMask],a + ld [wMenuWatchMovingOutOfBounds], a + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a + ld [hJoy7], a + ld [wWastedByteCD3A], a + ld [wOverrideSimulatedJoypadStatesMask], a pop af - ld [wListScrollOffset],a + ld [wListScrollOffset], a call GBPalWhiteOutWithDelay3 call RunDefaultPaletteCommand jp ReloadMapData .goToSideMenu call HandlePokedexSideMenu dec b - jr z,.exitPokedex ; if the player chose Quit + jr z, .exitPokedex ; if the player chose Quit dec b - jr z,.doPokemonListMenu ; if pokemon not seen or player pressed B button + jr z, .doPokemonListMenu ; if pokemon not seen or player pressed B button jp .setUpGraphics ; if pokemon data or area was shown ; handles the menu on the lower right in the pokedex screen @@ -59,68 +59,68 @@ ShowPokedexMenu: ; 02: the pokemon has not been seen yet or the player pressed the B button HandlePokedexSideMenu: call PlaceUnfilledArrowMenuCursor - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] push af - ld b,a - ld a,[wLastMenuItem] + ld b, a + ld a, [wLastMenuItem] push af - ld a,[wListScrollOffset] + ld a, [wListScrollOffset] push af add b inc a - ld [wd11e],a - ld a,[wd11e] + ld [wd11e], a + ld a, [wd11e] push af - ld a,[wDexMaxSeenMon] + ld a, [wDexMaxSeenMon] push af ; this doesn't need to be preserved - ld hl,wPokedexSeen + ld hl, wPokedexSeen call IsPokemonBitSet - ld b,2 - jr z,.exitSideMenu + ld b, 2 + jr z, .exitSideMenu call PokedexToIndex - ld hl,wTopMenuItemY - ld a,10 - ld [hli],a ; top menu item Y - ld a,15 - ld [hli],a ; top menu item X + ld hl, wTopMenuItemY + ld a, 10 + ld [hli], a ; top menu item Y + ld a, 15 + ld [hli], a ; top menu item X xor a - ld [hli],a ; current menu item ID + ld [hli], a ; current menu item ID inc hl - ld a,3 - ld [hli],a ; max menu item ID + ld a, 3 + ld [hli], a ; max menu item ID ;ld a, A_BUTTON | B_BUTTON - ld [hli],a ; menu watched keys (A button and B button) + ld [hli], a ; menu watched keys (A button and B button) xor a - ld [hli],a ; old menu item ID - ld [wMenuWatchMovingOutOfBounds],a + ld [hli], a ; old menu item ID + ld [wMenuWatchMovingOutOfBounds], a .handleMenuInput call HandleMenuInput - bit 1,a ; was the B button pressed? - ld b,2 - jr nz,.buttonBPressed - ld a,[wCurrentMenuItem] + bit 1, a ; was the B button pressed? + ld b, 2 + jr nz, .buttonBPressed + ld a, [wCurrentMenuItem] and a - jr z,.choseData + jr z, .choseData dec a - jr z,.choseCry + jr z, .choseCry dec a - jr z,.choseArea + jr z, .choseArea .choseQuit - ld b,1 + ld b, 1 .exitSideMenu pop af - ld [wDexMaxSeenMon],a + ld [wDexMaxSeenMon], a pop af - ld [wd11e],a + ld [wd11e], a pop af - ld [wListScrollOffset],a + ld [wListScrollOffset], a pop af - ld [wLastMenuItem],a + ld [wLastMenuItem], a pop af - ld [wCurrentMenuItem],a + ld [wCurrentMenuItem], a push bc coord hl, 0, 3 - ld de,20 + ld de, 20 lb bc, " ", 13 call DrawTileLine ; cover up the menu cursor in the pokemon list pop bc @@ -129,7 +129,7 @@ HandlePokedexSideMenu: .buttonBPressed push bc coord hl, 15, 10 - ld de,20 + ld de, 20 lb bc, " ", 7 call DrawTileLine ; cover up the menu cursor in the side menu pop bc @@ -137,130 +137,130 @@ HandlePokedexSideMenu: .choseData call ShowPokedexDataInternal - ld b,0 + ld b, 0 jr .exitSideMenu ; play pokemon cry .choseCry - ld a,[wd11e] + ld a, [wd11e] call GetCryData call PlaySound jr .handleMenuInput .choseArea predef LoadTownMap_Nest ; display pokemon areas - ld b,0 + ld b, 0 jr .exitSideMenu ; handles the list of pokemon on the left of the pokedex screen ; sets carry flag if player presses A, unsets carry flag if player presses B HandlePokedexListMenu: xor a - ld [H_AUTOBGTRANSFERENABLED],a + ld [H_AUTOBGTRANSFERENABLED], a ; draw the horizontal line separating the seen and owned amounts from the menu coord hl, 15, 8 - ld a,"─" - ld [hli],a - ld [hli],a - ld [hli],a - ld [hli],a - ld [hli],a + ld a, "─" + ld [hli], a + ld [hli], a + ld [hli], a + ld [hli], a + ld [hli], a coord hl, 14, 0 - ld [hl],$71 ; vertical line tile + ld [hl], $71 ; vertical line tile coord hl, 14, 1 call DrawPokedexVerticalLine coord hl, 14, 9 call DrawPokedexVerticalLine - ld hl,wPokedexSeen - ld b,wPokedexSeenEnd - wPokedexSeen + ld hl, wPokedexSeen + ld b, wPokedexSeenEnd - wPokedexSeen call CountSetBits ld de, wNumSetBits coord hl, 16, 3 lb bc, 1, 3 call PrintNumber ; print number of seen pokemon - ld hl,wPokedexOwned - ld b,wPokedexOwnedEnd - wPokedexOwned + ld hl, wPokedexOwned + ld b, wPokedexOwnedEnd - wPokedexOwned call CountSetBits ld de, wNumSetBits coord hl, 16, 6 lb bc, 1, 3 call PrintNumber ; print number of owned pokemon coord hl, 16, 2 - ld de,PokedexSeenText + ld de, PokedexSeenText call PlaceString coord hl, 16, 5 - ld de,PokedexOwnText + ld de, PokedexOwnText call PlaceString coord hl, 1, 1 - ld de,PokedexContentsText + ld de, PokedexContentsText call PlaceString coord hl, 16, 10 - ld de,PokedexMenuItemsText + ld de, PokedexMenuItemsText call PlaceString ; find the highest pokedex number among the pokemon the player has seen - ld hl,wPokedexSeenEnd - 1 - ld b,(wPokedexSeenEnd - wPokedexSeen) * 8 + 1 + ld hl, wPokedexSeenEnd - 1 + ld b, (wPokedexSeenEnd - wPokedexSeen) * 8 + 1 .maxSeenPokemonLoop - ld a,[hld] - ld c,8 + ld a, [hld] + ld c, 8 .maxSeenPokemonInnerLoop dec b sla a - jr c,.storeMaxSeenPokemon + jr c, .storeMaxSeenPokemon dec c - jr nz,.maxSeenPokemonInnerLoop + jr nz, .maxSeenPokemonInnerLoop jr .maxSeenPokemonLoop .storeMaxSeenPokemon - ld a,b - ld [wDexMaxSeenMon],a + ld a, b + ld [wDexMaxSeenMon], a .loop xor a - ld [H_AUTOBGTRANSFERENABLED],a + ld [H_AUTOBGTRANSFERENABLED], a coord hl, 4, 2 lb bc, 14, 10 call ClearScreenArea coord hl, 1, 3 - ld a,[wListScrollOffset] - ld [wd11e],a - ld d,7 - ld a,[wDexMaxSeenMon] - cp a,7 - jr nc,.printPokemonLoop - ld d,a + ld a, [wListScrollOffset] + ld [wd11e], a + ld d, 7 + ld a, [wDexMaxSeenMon] + cp 7 + jr nc, .printPokemonLoop + ld d, a dec a - ld [wMaxMenuItem],a + ld [wMaxMenuItem], a ; loop to print pokemon pokedex numbers and names ; if the player has owned the pokemon, it puts a pokeball beside the name .printPokemonLoop - ld a,[wd11e] + ld a, [wd11e] inc a - ld [wd11e],a + ld [wd11e], a push af push de push hl - ld de,-SCREEN_WIDTH - add hl,de - ld de,wd11e + ld de, -SCREEN_WIDTH + add hl, de + ld de, wd11e lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; print the pokedex number - ld de,SCREEN_WIDTH - add hl,de + ld de, SCREEN_WIDTH + add hl, de dec hl push hl - ld hl,wPokedexOwned + ld hl, wPokedexOwned call IsPokemonBitSet pop hl - ld a," " - jr z,.writeTile - ld a,$72 ; pokeball tile + ld a, " " + jr z, .writeTile + ld a, $72 ; pokeball tile .writeTile - ld [hl],a ; put a pokeball next to pokemon that the player has owned + ld [hl], a ; put a pokeball next to pokemon that the player has owned push hl - ld hl,wPokedexSeen + ld hl, wPokedexSeen call IsPokemonBitSet - jr nz,.getPokemonName ; if the player has seen the pokemon - ld de,.dashedLine ; print a dashed line in place of the name if the player hasn't seen the pokemon + jr nz, .getPokemonName ; if the player has seen the pokemon + ld de, .dashedLine ; print a dashed line in place of the name if the player hasn't seen the pokemon jr .skipGettingName .dashedLine ; for unseen pokemon in the list db "----------@" @@ -272,73 +272,73 @@ HandlePokedexListMenu: inc hl call PlaceString pop hl - ld bc,2 * SCREEN_WIDTH - add hl,bc + ld bc, 2 * SCREEN_WIDTH + add hl, bc pop de pop af - ld [wd11e],a + ld [wd11e], a dec d - jr nz,.printPokemonLoop - ld a,01 - ld [H_AUTOBGTRANSFERENABLED],a + jr nz, .printPokemonLoop + ld a, 01 + ld [H_AUTOBGTRANSFERENABLED], a call Delay3 call GBPalNormal call HandleMenuInput - bit 1,a ; was the B button pressed? - jp nz,.buttonBPressed + bit 1, a ; was the B button pressed? + jp nz, .buttonBPressed .checkIfUpPressed - bit 6,a ; was Up pressed? - jr z,.checkIfDownPressed + bit 6, a ; was Up pressed? + jr z, .checkIfDownPressed .upPressed ; scroll up one row - ld a,[wListScrollOffset] + ld a, [wListScrollOffset] and a - jp z,.loop + jp z, .loop dec a - ld [wListScrollOffset],a + ld [wListScrollOffset], a jp .loop .checkIfDownPressed - bit 7,a ; was Down pressed? - jr z,.checkIfRightPressed + bit 7, a ; was Down pressed? + jr z, .checkIfRightPressed .downPressed ; scroll down one row - ld a,[wDexMaxSeenMon] - cp a,7 - jp c,.loop ; can't if the list is shorter than 7 - sub a,7 - ld b,a - ld a,[wListScrollOffset] + ld a, [wDexMaxSeenMon] + cp 7 + jp c, .loop ; can't if the list is shorter than 7 + sub 7 + ld b, a + ld a, [wListScrollOffset] cp b - jp z,.loop + jp z, .loop inc a - ld [wListScrollOffset],a + ld [wListScrollOffset], a jp .loop .checkIfRightPressed - bit 4,a ; was Right pressed? - jr z,.checkIfLeftPressed + bit 4, a ; was Right pressed? + jr z, .checkIfLeftPressed .rightPressed ; scroll down 7 rows - ld a,[wDexMaxSeenMon] - cp a,7 - jp c,.loop ; can't if the list is shorter than 7 - sub a,6 - ld b,a - ld a,[wListScrollOffset] - add a,7 - ld [wListScrollOffset],a + ld a, [wDexMaxSeenMon] + cp 7 + jp c, .loop ; can't if the list is shorter than 7 + sub 6 + ld b, a + ld a, [wListScrollOffset] + add 7 + ld [wListScrollOffset], a cp b - jp c,.loop + jp c, .loop dec b - ld a,b - ld [wListScrollOffset],a + ld a, b + ld [wListScrollOffset], a jp .loop .checkIfLeftPressed ; scroll up 7 rows - bit 5,a ; was Left pressed? - jr z,.buttonAPressed + bit 5, a ; was Left pressed? + jr z, .buttonAPressed .leftPressed - ld a,[wListScrollOffset] - sub a,7 - ld [wListScrollOffset],a - jp nc,.loop + ld a, [wListScrollOffset] + sub 7 + ld [wListScrollOffset], a + jp nc, .loop xor a - ld [wListScrollOffset],a + ld [wListScrollOffset], a jp .loop .buttonAPressed scf @@ -348,15 +348,15 @@ HandlePokedexListMenu: ret DrawPokedexVerticalLine: - ld c,9 ; height of line - ld de,SCREEN_WIDTH - ld a,$71 ; vertical line tile + ld c, 9 ; height of line + ld de, SCREEN_WIDTH + ld a, $71 ; vertical line tile .loop - ld [hl],a - add hl,de - xor a,1 ; toggle between vertical line tile and box tile + ld [hl], a + add hl, de + xor 1 ; toggle between vertical line tile and box tile dec c - jr nz,.loop + jr nz, .loop ret PokedexSeenText: @@ -379,12 +379,12 @@ PokedexMenuItemsText: ; [wd11e] = pokedex number ; hl = address of bit field IsPokemonBitSet: - ld a,[wd11e] + ld a, [wd11e] dec a - ld c,a - ld b,FLAG_TEST + ld c, a + ld b, FLAG_TEST predef FlagActionPredef - ld a,c + ld a, c and a ret @@ -397,26 +397,26 @@ ShowPokedexData: ; 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 hl, wd72c + set 1, [hl] + ld a, $33 ; 3/7 volume + ld [rNR50], a call GBPalWhiteOut ; zero all palettes call ClearScreen - ld a,[wd11e] ; pokemon ID - ld [wcf91],a + ld a, [wd11e] ; pokemon ID + ld [wcf91], a push af ld b, SET_PAL_POKEDEX call RunPaletteCommand pop af - ld [wd11e],a - ld a,[hTilesetType] + ld [wd11e], a + ld a, [hTilesetType] push af xor a - ld [hTilesetType],a + ld [hTilesetType], a coord hl, 0, 0 - ld de,1 + ld de, 1 lb bc, $64, SCREEN_WIDTH call DrawTileLine ; draw top border @@ -425,71 +425,71 @@ ShowPokedexDataInternal: call DrawTileLine ; draw bottom border coord hl, 0, 1 - ld de,20 + ld de, 20 lb bc, $66, $10 call DrawTileLine ; draw left border coord hl, 19, 1 - ld b,$67 + ld b, $67 call DrawTileLine ; draw right border - ld a,$63 ; upper left corner tile + ld a, $63 ; upper left corner tile Coorda 0, 0 - ld a,$65 ; upper right corner tile + ld a, $65 ; upper right corner tile Coorda 19, 0 - ld a,$6c ; lower left corner tile + ld a, $6c ; lower left corner tile Coorda 0, 17 - ld a,$6e ; lower right corner tile + ld a, $6e ; lower right corner tile Coorda 19, 17 coord hl, 0, 9 - ld de,PokedexDataDividerLine + ld de, PokedexDataDividerLine call PlaceString ; draw horizontal divider line coord hl, 9, 6 - ld de,HeightWeightText + ld de, HeightWeightText call PlaceString call GetMonName coord hl, 9, 2 call PlaceString - ld hl,PokedexEntryPointers - ld a,[wd11e] + ld hl, PokedexEntryPointers + ld a, [wd11e] dec a - ld e,a - ld d,0 - add hl,de - add hl,de - ld a,[hli] - ld e,a - ld d,[hl] ; de = address of pokedex entry + ld e, a + ld d, 0 + add hl, de + add hl, de + ld a, [hli] + ld e, a + ld d, [hl] ; de = address of pokedex entry coord hl, 9, 4 call PlaceString ; print species name - ld h,b - ld l,c + ld h, b + ld l, c push de - ld a,[wd11e] + ld a, [wd11e] push af call IndexToPokedex coord hl, 2, 8 ld a, "№" - ld [hli],a - ld a,"⠄" - ld [hli],a - ld de,wd11e + ld [hli], a + ld a, "⠄" + ld [hli], a + ld de, wd11e lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; print pokedex number - ld hl,wPokedexOwned + ld hl, wPokedexOwned call IsPokemonBitSet pop af - ld [wd11e],a - ld a,[wcf91] - ld [wd0b5],a + ld [wd11e], a + ld a, [wcf91] + ld [wd0b5], a pop de push af @@ -502,7 +502,7 @@ ShowPokedexDataInternal: call GetMonHeader ; load pokemon picture location coord hl, 1, 1 call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture - ld a,[wcf91] + ld a, [wcf91] call PlayCry ; play pokemon cry pop hl @@ -510,83 +510,83 @@ ShowPokedexDataInternal: pop bc pop af - ld a,c + ld a, c and a - jp z,.waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description + jp z, .waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description inc de ; de = address of feet (height) - ld a,[de] ; reads feet, but a is overwritten without being used + ld a, [de] ; reads feet, but a is overwritten without being used coord hl, 12, 6 lb bc, 1, 2 call PrintNumber ; print feet (height) - ld a,$60 ; feet symbol tile (one tick) - ld [hl],a + ld a, $60 ; feet symbol tile (one tick) + ld [hl], a inc de inc de ; de = address of inches (height) coord hl, 15, 6 lb bc, LEADING_ZEROES | 1, 2 call PrintNumber ; print inches (height) - ld a,$61 ; inches symbol tile (two ticks) - ld [hl],a + ld a, $61 ; inches symbol tile (two ticks) + ld [hl], a ; now print the weight (note that weight is stored in tenths of pounds internally) inc de inc de inc de ; de = address of upper byte of weight push de ; put weight in big-endian order at hDexWeight - ld hl,hDexWeight - ld a,[hl] ; save existing value of [hDexWeight] + ld hl, hDexWeight + ld a, [hl] ; save existing value of [hDexWeight] push af - ld a,[de] ; a = upper byte of weight - ld [hli],a ; store upper byte of weight in [hDexWeight] - ld a,[hl] ; save existing value of [hDexWeight + 1] + ld a, [de] ; a = upper byte of weight + ld [hli], a ; store upper byte of weight in [hDexWeight] + ld a, [hl] ; save existing value of [hDexWeight + 1] push af dec de - ld a,[de] ; a = lower byte of weight - ld [hl],a ; store lower byte of weight in [hDexWeight + 1] - ld de,hDexWeight + 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 lb bc, 2, 5 ; 2 bytes, 5 digits call PrintNumber ; print weight coord hl, 14, 8 - ld a,[hDexWeight + 1] - sub a,10 - ld a,[hDexWeight] - sbc a,0 - jr nc,.next - ld [hl],"0" ; if the weight is less than 10, put a 0 before the decimal point + ld a, [hDexWeight + 1] + sub 10 + ld a, [hDexWeight] + sbc 0 + jr nc, .next + ld [hl], "0" ; if the weight is less than 10, put a 0 before the decimal point .next 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 a, [hli] + ld [hld], a ; make space for the decimal point by moving the last digit forward one tile + ld [hl], "⠄" ; decimal point tile pop af - ld [hDexWeight + 1],a ; restore original value of [hDexWeight + 1] + ld [hDexWeight + 1], a ; restore original value of [hDexWeight + 1] pop af - ld [hDexWeight],a ; restore original value of [hDexWeight] + ld [hDexWeight], a ; restore original value of [hDexWeight] pop hl inc hl ; hl = address of pokedex description text coord bc, 1, 11 - ld a,2 - ld [$fff4],a + ld a, 2 + ld [$fff4], a call TextCommandProcessor ; print pokedex description text xor a - ld [$fff4],a + ld [$fff4], a .waitForButtonPress call JoypadLowSensitivity - ld a,[hJoy5] - and a,A_BUTTON | B_BUTTON - jr z,.waitForButtonPress + ld a, [hJoy5] + and A_BUTTON | B_BUTTON + jr z, .waitForButtonPress pop af - ld [hTilesetType],a + ld [hTilesetType], a call GBPalWhiteOut call ClearScreen call RunDefaultPaletteCommand call LoadTextBoxTilePatterns call GBPalNormal - ld hl,wd72c - res 1,[hl] - ld a,$77 ; max volume - ld [rNR50],a + ld hl, wd72c + res 1, [hl] + ld a, $77 ; max volume + ld [rNR50], a ret HeightWeightText: @@ -615,10 +615,10 @@ DrawTileLine: push bc push de .loop - ld [hl],b - add hl,de + ld [hl], b + add hl, de dec c - jr nz,.loop + jr nz, .loop pop de pop bc ret @@ -629,19 +629,19 @@ PokedexToIndex: ; converts the Pokédex number at wd11e to an index push bc push hl - ld a,[wd11e] - ld b,a - ld c,0 - ld hl,PokedexOrder + ld a, [wd11e] + ld b, a + ld c, 0 + ld hl, PokedexOrder .loop ; go through the list until we find an entry with a matching dex number inc c - ld a,[hli] + ld a, [hli] cp b - jr nz,.loop + jr nz, .loop - ld a,c - ld [wd11e],a + ld a, c + ld [wd11e], a pop hl pop bc ret @@ -650,14 +650,14 @@ IndexToPokedex: ; converts the index number at wd11e to a Pokédex number push bc push hl - ld a,[wd11e] + ld a, [wd11e] dec a - ld hl,PokedexOrder - ld b,0 - ld c,a - add hl,bc - ld a,[hl] - ld [wd11e],a + ld hl, PokedexOrder + ld b, 0 + ld c, a + add hl, bc + ld a, [hl] + ld [wd11e], a pop hl pop bc ret diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index f6ca013b..bcd0d4ea 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -1,26 +1,26 @@ CeladonPrizeMenu: - ld b,COIN_CASE + ld b, COIN_CASE call IsItemInBag - jr nz,.havingCoinCase - ld hl,RequireCoinCaseTextPtr + jr nz, .havingCoinCase + ld hl, RequireCoinCaseTextPtr jp PrintText .havingCoinCase - ld hl,wd730 - set 6,[hl] ; disable letter-printing delay - ld hl,ExchangeCoinsForPrizesTextPtr + ld hl, wd730 + set 6, [hl] ; disable letter-printing delay + ld hl, ExchangeCoinsForPrizesTextPtr call PrintText ; the following are the menu settings xor a - ld [wCurrentMenuItem],a - ld [wLastMenuItem],a - ld a,A_BUTTON | B_BUTTON - ld [wMenuWatchedKeys],a - ld a,$03 - ld [wMaxMenuItem],a - ld a,$04 - ld [wTopMenuItemY],a - ld a,$01 - ld [wTopMenuItemX],a + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a + ld a, A_BUTTON | B_BUTTON + ld [wMenuWatchedKeys], a + ld a, $03 + ld [wMaxMenuItem], a + ld a, $04 + ld [wTopMenuItemY], a + ld a, $01 + ld [wTopMenuItemX], a call PrintPrizePrice coord hl, 0, 2 ld b, 8 @@ -28,18 +28,18 @@ CeladonPrizeMenu: call TextBoxBorder call GetPrizeMenuId call UpdateSprites - ld hl,WhichPrizeTextPtr + ld hl, WhichPrizeTextPtr call PrintText call HandleMenuInput ; menu choice handler - bit 1,a ; keypress = B (Cancel) + bit 1, a ; keypress = B (Cancel) jr nz, .noChoice - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] cp 3 ; "NO,THANKS" choice jr z, .noChoice call HandlePrizeChoice .noChoice - ld hl,wd730 - res 6,[hl] + ld hl, wd730 + res 6, [hl] ret RequireCoinCaseTextPtr: @@ -64,85 +64,85 @@ GetPrizeMenuId: ; display the three prizes' names ; (distinguishing between Pokemon names ; and Items (specifically TMs) names) - ld a,[hSpriteIndexOrTextID] + ld 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) + ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2) add a add a - ld d,0 - ld e,a - ld hl,PrizeDifferentMenuPtrs - add hl,de - ld a,[hli] - ld d,[hl] - ld e,a + ld d, 0 + ld e, a + ld hl, PrizeDifferentMenuPtrs + add hl, de + ld a, [hli] + ld d, [hl] + ld e, a inc hl push hl - ld hl,wPrize1 + ld hl, wPrize1 call CopyString pop hl - ld a,[hli] - ld h,[hl] - ld l,a - ld de,wPrize1Price - ld bc,6 + ld a, [hli] + ld h, [hl] + ld l, a + ld de, wPrize1Price + ld bc, 6 call CopyData - ld a,[wWhichPrizeWindow] + ld a, [wWhichPrizeWindow] cp 2 ;is TM_menu? - jr nz,.putMonName - ld a,[wPrize1] - ld [wd11e],a + jr nz, .putMonName + ld a, [wPrize1] + ld [wd11e], a call GetItemName coord hl, 2, 4 call PlaceString - ld a,[wPrize2] - ld [wd11e],a + ld a, [wPrize2] + ld [wd11e], a call GetItemName coord hl, 2, 6 call PlaceString - ld a,[wPrize3] - ld [wd11e],a + ld a, [wPrize3] + ld [wd11e], a call GetItemName coord hl, 2, 8 call PlaceString jr .putNoThanksText .putMonName - ld a,[wPrize1] - ld [wd11e],a + ld a, [wPrize1] + ld [wd11e], a call GetMonName coord hl, 2, 4 call PlaceString - ld a,[wPrize2] - ld [wd11e],a + ld a, [wPrize2] + ld [wd11e], a call GetMonName coord hl, 2, 6 call PlaceString - ld a,[wPrize3] - ld [wd11e],a + ld a, [wPrize3] + ld [wd11e], a call GetMonName coord hl, 2, 8 call PlaceString .putNoThanksText coord hl, 2, 10 - ld de,NoThanksText + ld de, NoThanksText call PlaceString ; put prices on the right side of the textbox - ld de,wPrize1Price + ld de, wPrize1Price coord hl, 13, 5 ; reg. c: ; [low nybble] number of bytes ; [bit 765 = %100] space-padding (not zero-padding) - ld c,(1 << 7 | 2) + ld c, (1 << 7 | 2) ; Function $15CD displays BCD value (same routine ; used by text-command $02) call PrintBCDNumber - ld de,wPrize2Price + ld de, wPrize2Price coord hl, 13, 7 - ld c,(1 << 7 | 2) + ld c, (1 << 7 | 2) call PrintBCDNumber - ld de,wPrize3Price + ld de, wPrize3Price coord hl, 13, 9 - ld c,(1 << 7 | 2) + ld c, (1 << 7 | 2) jp PrintBCDNumber INCLUDE "data/prizes.asm" @@ -160,8 +160,8 @@ PrintPrizePrice: ld de, .SixSpacesString call PlaceString coord hl, 13, 1 - ld de,wPlayerCoins - ld c,%10000010 + ld de, wPlayerCoins + ld c, %10000010 call PrintBCDNumber ret @@ -172,30 +172,30 @@ PrintPrizePrice: db " @" LoadCoinsToSubtract: - ld a,[wWhichPrize] + ld a, [wWhichPrize] add a - ld d,0 - ld e,a - ld hl,wPrize1Price - add hl,de ; get selected prize's price + ld d, 0 + ld e, a + ld hl, wPrize1Price + add hl, de ; get selected prize's price xor a - ld [hUnusedCoinsByte],a - ld a,[hli] - ld [hCoins],a - ld a,[hl] - ld [hCoins + 1],a + ld [hUnusedCoinsByte], a + ld a, [hli] + ld [hCoins], a + ld a, [hl] + ld [hCoins + 1], a ret HandlePrizeChoice: - ld a,[wCurrentMenuItem] - ld [wWhichPrize],a - ld d,0 - ld e,a - ld hl,wPrize1 - add hl,de - ld a,[hl] - ld [wd11e],a - ld a,[wWhichPrizeWindow] + ld a, [wCurrentMenuItem] + ld [wWhichPrize], a + ld d, 0 + ld e, a + ld hl, wPrize1 + add hl, de + ld a, [hl] + ld [wd11e], a + ld a, [wWhichPrizeWindow] cp 2 ; is prize a TM? jr nz, .getMonName call GetItemName @@ -203,40 +203,40 @@ HandlePrizeChoice: .getMonName call GetMonName .givePrize - ld hl,SoYouWantPrizeTextPtr + ld hl, SoYouWantPrizeTextPtr call PrintText call YesNoChoice - ld a,[wCurrentMenuItem] ; yes/no answer (Y=0, N=1) + ld a, [wCurrentMenuItem] ; yes/no answer (Y=0, N=1) and a jr nz, .printOhFineThen call LoadCoinsToSubtract call HasEnoughCoins jr c, .notEnoughCoins - ld a,[wWhichPrizeWindow] + ld a, [wWhichPrizeWindow] cp $02 jr nz, .giveMon - ld a,[wd11e] - ld b,a - ld a,1 - ld c,a + ld a, [wd11e] + ld b, a + ld a, 1 + ld c, a call GiveItem jr nc, .bagFull jr .subtractCoins .giveMon - ld a,[wd11e] - ld [wcf91],a + ld a, [wd11e] + ld [wcf91], a push af call GetPrizeMonLevel - ld c,a + ld c, a pop af - ld b,a + ld b, a call GivePokemon ; If either the party or box was full, wait after displaying message. push af - ld a,[wAddedToParty] + ld a, [wAddedToParty] and a - call z,WaitForTextScrollButtonPress + call z, WaitForTextScrollButtonPress pop af ; If the mon couldn't be given to the player (because both the party and box @@ -245,19 +245,19 @@ HandlePrizeChoice: .subtractCoins call LoadCoinsToSubtract - ld hl,hCoins + 1 - ld de,wPlayerCoins + 1 - ld c,$02 ; how many bytes + ld hl, hCoins + 1 + ld de, wPlayerCoins + 1 + ld c, $02 ; how many bytes predef SubBCDPredef jp PrintPrizePrice .bagFull - ld hl,PrizeRoomBagIsFullTextPtr + ld hl, PrizeRoomBagIsFullTextPtr jp PrintText .notEnoughCoins - ld hl,SorryNeedMoreCoinsText + ld hl, SorryNeedMoreCoinsText jp PrintText .printOhFineThen - ld hl,OhFineThenTextPtr + ld hl, OhFineThenTextPtr jp PrintText UnknownPrizeData: @@ -289,18 +289,18 @@ OhFineThenTextPtr: db "@" GetPrizeMonLevel: - ld a,[wcf91] - ld b,a - ld hl,PrizeMonLevelDictionary + ld a, [wcf91] + ld b, a + ld hl, PrizeMonLevelDictionary .loop - ld a,[hli] + ld a, [hli] cp b - jr z,.matchFound + jr z, .matchFound inc hl jr .loop .matchFound - ld a,[hl] - ld [wCurEnemyLVL],a + ld a, [hl] + ld [wCurEnemyLVL], a ret INCLUDE "data/prize_mon_levels.asm" diff --git a/engine/menu/start_menu.asm b/engine/menu/start_menu.asm index 029d8c01..eb4b4f2d 100755 --- a/engine/menu/start_menu.asm +++ b/engine/menu/start_menu.asm @@ -1,9 +1,9 @@ DisplayStartMenu:: - ld a,BANK(StartMenu_Pokedex) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ld a,[wWalkBikeSurfState] ; walking/biking/surfing - ld [wWalkBikeSurfStateCopy],a + ld a, BANK(StartMenu_Pokedex) + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + ld a, [wWalkBikeSurfState] ; walking/biking/surfing + ld [wWalkBikeSurfStateCopy], a ld a, SFX_START_MENU call PlaySound @@ -13,73 +13,73 @@ RedisplayStartMenu:: call UpdateSprites .loop call HandleMenuInput - ld b,a + ld b, a .checkIfUpPressed - bit 6,a ; was Up pressed? - jr z,.checkIfDownPressed - ld a,[wCurrentMenuItem] ; menu selection + bit 6, a ; was Up pressed? + jr z, .checkIfDownPressed + ld a, [wCurrentMenuItem] ; menu selection and a - jr nz,.loop - ld a,[wLastMenuItem] + jr nz, .loop + ld a, [wLastMenuItem] and a - jr nz,.loop + jr nz, .loop ; if the player pressed tried to go past the top item, wrap around to the bottom CheckEvent EVENT_GOT_POKEDEX - ld a,6 ; there are 7 menu items with the pokedex, so the max index is 6 - jr nz,.wrapMenuItemId + ld a, 6 ; there are 7 menu items with the pokedex, so the max index is 6 + jr nz, .wrapMenuItemId dec a ; there are only 6 menu items without the pokedex .wrapMenuItemId - ld [wCurrentMenuItem],a + ld [wCurrentMenuItem], a call EraseMenuCursor jr .loop .checkIfDownPressed - bit 7,a - jr z,.buttonPressed + bit 7, a + jr z, .buttonPressed ; if the player pressed tried to go past the bottom item, wrap around to the top CheckEvent EVENT_GOT_POKEDEX - ld a,[wCurrentMenuItem] - ld c,7 ; there are 7 menu items with the pokedex - jr nz,.checkIfPastBottom + ld a, [wCurrentMenuItem] + ld c, 7 ; there are 7 menu items with the pokedex + jr nz, .checkIfPastBottom dec c ; there are only 6 menu items without the pokedex .checkIfPastBottom cp c - jr nz,.loop + jr nz, .loop ; the player went past the bottom, so wrap to the top xor a - ld [wCurrentMenuItem],a + ld [wCurrentMenuItem], a call EraseMenuCursor jr .loop .buttonPressed ; A, B, or Start button pressed call PlaceUnfilledArrowMenuCursor - ld a,[wCurrentMenuItem] - ld [wBattleAndStartSavedMenuItem],a ; save current menu selection - ld a,b - and a,%00001010 ; was the Start button or B button pressed? - jp nz,CloseStartMenu + ld a, [wCurrentMenuItem] + ld [wBattleAndStartSavedMenuItem], a ; save current menu selection + ld a, b + and %00001010 ; was the Start button or B button pressed? + jp nz, CloseStartMenu call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2 CheckEvent EVENT_GOT_POKEDEX - ld a,[wCurrentMenuItem] - jr nz,.displayMenuItem + ld a, [wCurrentMenuItem] + jr nz, .displayMenuItem inc a ; adjust position to account for missing pokedex menu item .displayMenuItem - cp a,0 - jp z,StartMenu_Pokedex - cp a,1 - jp z,StartMenu_Pokemon - cp a,2 - jp z,StartMenu_Item - cp a,3 - jp z,StartMenu_TrainerInfo - cp a,4 - jp z,StartMenu_SaveReset - cp a,5 - jp z,StartMenu_Option + cp 0 + jp z, StartMenu_Pokedex + cp 1 + jp z, StartMenu_Pokemon + cp 2 + jp z, StartMenu_Item + cp 3 + jp z, StartMenu_TrainerInfo + cp 4 + jp z, StartMenu_SaveReset + cp 5 + jp z, StartMenu_Option ; EXIT falls through to here CloseStartMenu:: call Joypad - ld a,[hJoyPressed] - bit 0,a ; was A button newly pressed? - jr nz,CloseStartMenu + ld a, [hJoyPressed] + bit 0, a ; was A button newly pressed? + jr nz, CloseStartMenu call LoadTextBoxTilePatterns jp CloseTextDisplay diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 8c10266b..947837e3 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -7,22 +7,22 @@ StartMenu_Pokedex: jp RedisplayStartMenu StartMenu_Pokemon: - ld a,[wPartyCount] + ld a, [wPartyCount] and a - jp z,RedisplayStartMenu + jp z, RedisplayStartMenu xor a - ld [wMenuItemToSwap],a - ld [wPartyMenuTypeOrMessageID],a - ld [wUpdateSpritesEnabled],a + ld [wMenuItemToSwap], a + ld [wPartyMenuTypeOrMessageID], a + ld [wUpdateSpritesEnabled], a call DisplayPartyMenu jr .checkIfPokemonChosen .loop xor a - ld [wMenuItemToSwap],a - ld [wPartyMenuTypeOrMessageID],a + ld [wMenuItemToSwap], a + ld [wPartyMenuTypeOrMessageID], a call GoBackToPartyMenu .checkIfPokemonChosen - jr nc,.chosePokemon + jr nc, .chosePokemon .exitMenu call GBPalWhiteOutWithDelay3 call RestoreScreenTilesAndReloadTilePatterns @@ -30,94 +30,94 @@ StartMenu_Pokemon: jp RedisplayStartMenu .chosePokemon call SaveScreenTilesToBuffer1 - ld a,FIELD_MOVE_MON_MENU - ld [wTextBoxID],a + ld a, FIELD_MOVE_MON_MENU + ld [wTextBoxID], a call DisplayTextBoxID ; display pokemon menu options - ld hl,wFieldMoves + ld hl, wFieldMoves lb bc, 2, 12 ; max menu item ID, top menu item Y - ld e,5 + ld e, 5 .adjustMenuVariablesLoop dec e - jr z,.storeMenuVariables - ld a,[hli] + jr z, .storeMenuVariables + ld a, [hli] and a ; end of field moves? - jr z,.storeMenuVariables + jr z, .storeMenuVariables inc b dec c dec c jr .adjustMenuVariablesLoop .storeMenuVariables - ld hl,wTopMenuItemY - ld a,c - ld [hli],a ; top menu item Y - ld a,[hFieldMoveMonMenuTopMenuItemX] - ld [hli],a ; top menu item X + ld hl, wTopMenuItemY + ld a, c + ld [hli], a ; top menu item Y + ld a, [hFieldMoveMonMenuTopMenuItemX] + ld [hli], a ; top menu item X xor a - ld [hli],a ; current menu item ID + ld [hli], a ; current menu item ID inc hl - ld a,b - ld [hli],a ; max menu item ID - ld a,A_BUTTON | B_BUTTON - ld [hli],a ; menu watched keys + ld a, b + ld [hli], a ; max menu item ID + ld a, A_BUTTON | B_BUTTON + ld [hli], a ; menu watched keys xor a - ld [hl],a + ld [hl], a call HandleMenuInput push af call LoadScreenTilesFromBuffer1 ; restore saved screen pop af - bit 1,a ; was the B button pressed? - jp nz,.loop + bit 1, a ; was the B button pressed? + jp nz, .loop ; if the B button wasn't pressed - ld a,[wMaxMenuItem] - ld b,a - ld a,[wCurrentMenuItem] ; menu selection + ld a, [wMaxMenuItem] + ld b, a + ld a, [wCurrentMenuItem] ; menu selection cp b - jp z,.exitMenu ; if the player chose Cancel + jp z, .exitMenu ; if the player chose Cancel dec b cp b - jr z,.choseSwitch + jr z, .choseSwitch dec b cp b - jp z,.choseStats - ld c,a - ld b,0 - ld hl,wFieldMoves - add hl,bc + jp z, .choseStats + ld c, a + ld b, 0 + ld hl, wFieldMoves + add hl, bc jp .choseOutOfBattleMove .choseSwitch - ld a,[wPartyCount] - cp a,2 ; is there more than one pokemon in the party? - jp c,StartMenu_Pokemon ; if not, no switching + ld a, [wPartyCount] + cp 2 ; is there more than one pokemon in the party? + jp c, StartMenu_Pokemon ; if not, no switching call SwitchPartyMon_InitVarOrSwapData ; init [wMenuItemToSwap] - ld a,SWAP_MONS_PARTY_MENU - ld [wPartyMenuTypeOrMessageID],a + ld a, SWAP_MONS_PARTY_MENU + ld [wPartyMenuTypeOrMessageID], a call GoBackToPartyMenu jp .checkIfPokemonChosen .choseStats call ClearSprites xor a ; PLAYER_PARTY_DATA - ld [wMonDataLocation],a + ld [wMonDataLocation], a predef StatusScreen predef StatusScreen2 call ReloadMapData jp StartMenu_Pokemon .choseOutOfBattleMove push hl - ld a,[wWhichPokemon] - ld hl,wPartyMonNicks + ld a, [wWhichPokemon] + ld hl, wPartyMonNicks call GetPartyMonName pop hl - ld a,[hl] + ld a, [hl] dec a add a - ld b,0 - ld c,a - ld hl,.outOfBattleMovePointers - add hl,bc - ld a,[hli] - ld h,[hl] - ld l,a - ld a,[wObtainedBadges] ; badges obtained + ld b, 0 + ld c, a + ld hl, .outOfBattleMovePointers + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wObtainedBadges] ; badges obtained jp hl .outOfBattleMovePointers dw .cut @@ -130,62 +130,62 @@ StartMenu_Pokemon: dw .teleport dw .softboiled .fly - bit 2,a ; does the player have the Thunder Badge? - jp z,.newBadgeRequired + bit 2, a ; does the player have the Thunder Badge? + jp z, .newBadgeRequired call CheckIfInOutsideMap - jr z,.canFly - ld a,[wWhichPokemon] - ld hl,wPartyMonNicks + jr z, .canFly + ld a, [wWhichPokemon] + ld hl, wPartyMonNicks call GetPartyMonName - ld hl,.cannotFlyHereText + ld hl, .cannotFlyHereText call PrintText jp .loop .canFly call ChooseFlyDestination - ld a,[wd732] - bit 3,a ; did the player decide to fly? - jp nz,.goBackToMap + ld a, [wd732] + bit 3, a ; did the player decide to fly? + jp nz, .goBackToMap call LoadFontTilePatterns - ld hl,wd72e - set 1,[hl] + ld hl, wd72e + set 1, [hl] jp StartMenu_Pokemon .cut - bit 1,a ; does the player have the Cascade Badge? - jp z,.newBadgeRequired + bit 1, a ; does the player have the Cascade Badge? + jp z, .newBadgeRequired predef UsedCut - ld a,[wActionResultOrTookBattleTurn] + ld a, [wActionResultOrTookBattleTurn] and a - jp z,.loop + jp z, .loop jp CloseTextDisplay .surf - bit 4,a ; does the player have the Soul Badge? - jp z,.newBadgeRequired + bit 4, a ; does the player have the Soul Badge? + jp z, .newBadgeRequired callba IsSurfingAllowed - ld hl,wd728 - bit 1,[hl] - res 1,[hl] - jp z,.loop - ld a,SURFBOARD - ld [wcf91],a - ld [wPseudoItemID],a + ld hl, wd728 + bit 1, [hl] + res 1, [hl] + jp z, .loop + ld a, SURFBOARD + ld [wcf91], a + ld [wPseudoItemID], a call UseItem - ld a,[wActionResultOrTookBattleTurn] + ld a, [wActionResultOrTookBattleTurn] and a - jp z,.loop + jp z, .loop call GBPalWhiteOutWithDelay3 jp .goBackToMap .strength - bit 3,a ; does the player have the Rainbow Badge? - jp z,.newBadgeRequired + bit 3, a ; does the player have the Rainbow Badge? + jp z, .newBadgeRequired predef PrintStrengthTxt call GBPalWhiteOutWithDelay3 jp .goBackToMap .flash - bit 0,a ; does the player have the Boulder Badge? - jp z,.newBadgeRequired + bit 0, a ; does the player have the Boulder Badge? + jp z, .newBadgeRequired xor a - ld [wMapPalOffset],a - ld hl,.flashLightsAreaText + ld [wMapPalOffset], a + ld hl, .flashLightsAreaText call PrintText call GBPalWhiteOutWithDelay3 jp .goBackToMap @@ -193,34 +193,34 @@ StartMenu_Pokemon: TX_FAR _FlashLightsAreaText db "@" .dig - ld a,ESCAPE_ROPE - ld [wcf91],a - ld [wPseudoItemID],a + ld a, ESCAPE_ROPE + ld [wcf91], a + ld [wPseudoItemID], a call UseItem - ld a,[wActionResultOrTookBattleTurn] + ld a, [wActionResultOrTookBattleTurn] and a - jp z,.loop + jp z, .loop call GBPalWhiteOutWithDelay3 jp .goBackToMap .teleport call CheckIfInOutsideMap - jr z,.canTeleport - ld a,[wWhichPokemon] - ld hl,wPartyMonNicks + jr z, .canTeleport + ld a, [wWhichPokemon] + ld hl, wPartyMonNicks call GetPartyMonName - ld hl,.cannotUseTeleportNowText + ld hl, .cannotUseTeleportNowText call PrintText jp .loop .canTeleport - ld hl,.warpToLastPokemonCenterText + ld hl, .warpToLastPokemonCenterText call PrintText - ld hl,wd732 - set 3,[hl] - set 6,[hl] - ld hl,wd72e - set 1,[hl] - res 4,[hl] - ld c,60 + ld hl, wd732 + set 3, [hl] + set 6, [hl] + ld hl, wd72e + set 1, [hl] + res 4, [hl] + ld c, 60 call DelayFrames call GBPalWhiteOutWithDelay3 jp .goBackToMap @@ -234,39 +234,39 @@ StartMenu_Pokemon: TX_FAR _CannotFlyHereText db "@" .softboiled - ld hl,wPartyMon1MaxHP - ld a,[wWhichPokemon] - ld bc,wPartyMon2 - wPartyMon1 + ld hl, wPartyMon1MaxHP + ld a, [wWhichPokemon] + ld bc, wPartyMon2 - wPartyMon1 call AddNTimes - ld a,[hli] - ld [H_DIVIDEND],a - ld a,[hl] - ld [H_DIVIDEND + 1],a - ld a,5 - ld [H_DIVISOR],a - ld b,2 ; number of bytes + ld a, [hli] + ld [H_DIVIDEND], a + ld a, [hl] + ld [H_DIVIDEND + 1], a + ld a, 5 + ld [H_DIVISOR], 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] + ld bc, wPartyMon1HP - wPartyMon1MaxHP + add hl, bc + ld a, [hld] + ld b, a + ld a, [H_QUOTIENT + 3] sub b - ld b,[hl] - ld a,[H_QUOTIENT + 2] + ld b, [hl] + ld a, [H_QUOTIENT + 2] sbc b - jp nc,.notHealthyEnough - ld a,[wPartyAndBillsPCSavedMenuItem] + jp nc, .notHealthyEnough + ld a, [wPartyAndBillsPCSavedMenuItem] push af - ld a,POTION - ld [wcf91],a - ld [wPseudoItemID],a + ld a, POTION + ld [wcf91], a + ld [wPseudoItemID], a call UseItem pop af - ld [wPartyAndBillsPCSavedMenuItem],a + ld [wPartyAndBillsPCSavedMenuItem], a jp .loop .notHealthyEnough ; if current HP is less than 1/5 of max HP - ld hl,.notHealthyEnoughText + ld hl, .notHealthyEnoughText call PrintText jp .loop .notHealthyEnoughText @@ -276,7 +276,7 @@ StartMenu_Pokemon: call RestoreScreenTilesAndReloadTilePatterns jp CloseTextDisplay .newBadgeRequired - ld hl,.newBadgeRequiredText + ld hl, .newBadgeRequiredText call PrintText jp .loop .newBadgeRequiredText @@ -286,13 +286,13 @@ StartMenu_Pokemon: ; writes a blank tile to all possible menu cursor positions on the party menu ErasePartyMenuCursors: coord hl, 0, 1 - ld bc,2 * 20 ; menu cursor positions are 2 rows apart - ld a,6 ; 6 menu cursor positions + ld bc, 2 * 20 ; menu cursor positions are 2 rows apart + ld a, 6 ; 6 menu cursor positions .loop - ld [hl]," " - add hl,bc + ld [hl], " " + add hl, bc dec a - jr nz,.loop + jr nz, .loop ret ItemMenuLoop: @@ -300,28 +300,28 @@ ItemMenuLoop: call RunDefaultPaletteCommand StartMenu_Item: - ld a,[wLinkState] + ld a, [wLinkState] dec a ; is the player in the Colosseum or Trade Centre? - jr nz,.notInCableClubRoom - ld hl,CannotUseItemsHereText + jr nz, .notInCableClubRoom + ld hl, CannotUseItemsHereText call PrintText jr .exitMenu .notInCableClubRoom - ld bc,wNumBagItems - ld hl,wListPointer - ld a,c - ld [hli],a - ld [hl],b ; store item bag pointer in wListPointer (for DisplayListMenuID) + ld bc, wNumBagItems + ld hl, wListPointer + ld a, c + ld [hli], a + ld [hl], b ; store item bag pointer in wListPointer (for DisplayListMenuID) xor a - ld [wPrintItemPrices],a - ld a,ITEMLISTMENU - ld [wListMenuID],a - ld a,[wBagSavedMenuItem] - ld [wCurrentMenuItem],a + ld [wPrintItemPrices], a + ld a, ITEMLISTMENU + ld [wListMenuID], a + ld a, [wBagSavedMenuItem] + ld [wCurrentMenuItem], a call DisplayListMenuID - ld a,[wCurrentMenuItem] - ld [wBagSavedMenuItem],a - jr nc,.choseItem + ld a, [wCurrentMenuItem] + ld [wBagSavedMenuItem], a + jr nc, .choseItem .exitMenu call LoadScreenTilesFromBuffer2 ; restore saved screen call LoadTextBoxTilePatterns @@ -329,111 +329,111 @@ StartMenu_Item: jp RedisplayStartMenu .choseItem ; erase menu cursor (blank each tile in front of an item name) - ld a," " + ld a, " " Coorda 5, 4 Coorda 5, 6 Coorda 5, 8 Coorda 5, 10 call PlaceUnfilledArrowMenuCursor xor a - ld [wMenuItemToSwap],a - ld a,[wcf91] - cp a,BICYCLE - jp z,.useOrTossItem + ld [wMenuItemToSwap], a + ld a, [wcf91] + cp BICYCLE + jp z, .useOrTossItem .notBicycle1 - ld a,USE_TOSS_MENU_TEMPLATE - ld [wTextBoxID],a + ld a, USE_TOSS_MENU_TEMPLATE + ld [wTextBoxID], a call DisplayTextBoxID - ld hl,wTopMenuItemY - ld a,11 - ld [hli],a ; top menu item Y - ld a,14 - ld [hli],a ; top menu item X + ld hl, wTopMenuItemY + ld a, 11 + ld [hli], a ; top menu item Y + ld a, 14 + ld [hli], a ; top menu item X xor a - ld [hli],a ; current menu item ID + ld [hli], a ; current menu item ID inc hl inc a ; a = 1 - ld [hli],a ; max menu item ID - ld a,A_BUTTON | B_BUTTON - ld [hli],a ; menu watched keys + ld [hli], a ; max menu item ID + ld a, A_BUTTON | B_BUTTON + ld [hli], a ; menu watched keys xor a - ld [hl],a ; old menu item id + ld [hl], a ; old menu item id call HandleMenuInput call PlaceUnfilledArrowMenuCursor - bit 1,a ; was the B button pressed? - jr z,.useOrTossItem + bit 1, a ; was the B button pressed? + jr z, .useOrTossItem jp ItemMenuLoop .useOrTossItem ; if the player made the choice to use or toss the item - ld a,[wcf91] - ld [wd11e],a + ld a, [wcf91] + ld [wd11e], a call GetItemName call CopyStringToCF4B ; copy name to wcf4b - ld a,[wcf91] - cp a,BICYCLE - jr nz,.notBicycle2 - ld a,[wd732] - bit 5,a - jr z,.useItem_closeMenu - ld hl,CannotGetOffHereText + ld a, [wcf91] + cp BICYCLE + jr nz, .notBicycle2 + ld a, [wd732] + bit 5, a + jr z, .useItem_closeMenu + ld hl, CannotGetOffHereText call PrintText jp ItemMenuLoop .notBicycle2 - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] and a - jr nz,.tossItem + jr nz, .tossItem ; use item - ld [wPseudoItemID],a ; a must be 0 due to above conditional jump - ld a,[wcf91] - cp a,HM_01 - jr nc,.useItem_partyMenu - ld hl,UsableItems_CloseMenu - ld de,1 + ld [wPseudoItemID], a ; a must be 0 due to above conditional jump + ld a, [wcf91] + cp HM_01 + jr nc, .useItem_partyMenu + ld hl, UsableItems_CloseMenu + ld de, 1 call IsInArray - jr c,.useItem_closeMenu - ld a,[wcf91] - ld hl,UsableItems_PartyMenu - ld de,1 + jr c, .useItem_closeMenu + ld a, [wcf91] + ld hl, UsableItems_PartyMenu + ld de, 1 call IsInArray - jr c,.useItem_partyMenu + jr c, .useItem_partyMenu call UseItem jp ItemMenuLoop .useItem_closeMenu xor a - ld [wPseudoItemID],a + ld [wPseudoItemID], a call UseItem - ld a,[wActionResultOrTookBattleTurn] + ld a, [wActionResultOrTookBattleTurn] and a - jp z,ItemMenuLoop + jp z, ItemMenuLoop jp CloseStartMenu .useItem_partyMenu - ld a,[wUpdateSpritesEnabled] + ld a, [wUpdateSpritesEnabled] push af call UseItem - ld a,[wActionResultOrTookBattleTurn] - cp a,$02 - jp z,.partyMenuNotDisplayed + ld a, [wActionResultOrTookBattleTurn] + cp $02 + jp z, .partyMenuNotDisplayed call GBPalWhiteOutWithDelay3 call RestoreScreenTilesAndReloadTilePatterns pop af - ld [wUpdateSpritesEnabled],a + ld [wUpdateSpritesEnabled], a jp StartMenu_Item .partyMenuNotDisplayed pop af - ld [wUpdateSpritesEnabled],a + ld [wUpdateSpritesEnabled], a jp ItemMenuLoop .tossItem call IsKeyItem - ld a,[wIsKeyItem] + ld a, [wIsKeyItem] and a - jr nz,.skipAskingQuantity - ld a,[wcf91] + jr nz, .skipAskingQuantity + ld a, [wcf91] call IsItemHM - jr c,.skipAskingQuantity + jr c, .skipAskingQuantity call DisplayChooseQuantityMenu inc a - jr z,.tossZeroItems + jr z, .tossZeroItems .skipAskingQuantity - ld hl,wNumBagItems + ld hl, wNumBagItems call TossItem .tossZeroItems jp ItemMenuLoop @@ -500,10 +500,10 @@ StartMenu_TrainerInfo: call GBPalWhiteOut call ClearScreen call UpdateSprites - ld a,[hTilesetType] + ld a, [hTilesetType] push af xor a - ld [hTilesetType],a + ld [hTilesetType], a call DrawTrainerInfo predef DrawBadges ; draw badges ld b, SET_PAL_TRAINER_CARD @@ -517,101 +517,101 @@ StartMenu_TrainerInfo: call ReloadMapData call LoadGBPal pop af - ld [hTilesetType],a + ld [hTilesetType], a jp RedisplayStartMenu ; loads tile patterns and draws everything except for gym leader faces / badges DrawTrainerInfo: - ld de,RedPicFront + ld de, RedPicFront lb bc, BANK(RedPicFront), $01 predef DisplayPicCenteredOrUpperRight call DisableLCD coord hl, 0, 2 - ld a," " + ld a, " " call TrainerInfo_DrawVerticalLine coord hl, 1, 2 call TrainerInfo_DrawVerticalLine - ld hl,vChars2 + $70 - ld de,vChars2 - ld bc,$70 * 4 + ld hl, vChars2 + $70 + ld de, vChars2 + ld bc, $70 * 4 call CopyData - ld hl,TrainerInfoTextBoxTileGraphics ; trainer info text box tile patterns - ld de,vChars2 + $770 - ld bc,$0080 + ld hl, TrainerInfoTextBoxTileGraphics ; trainer info text box tile patterns + ld de, vChars2 + $770 + ld bc, $0080 push bc call TrainerInfo_FarCopyData - ld hl,BlankLeaderNames - ld de,vChars2 + $600 - ld bc,$0170 + ld hl, BlankLeaderNames + ld de, vChars2 + $600 + ld bc, $0170 call TrainerInfo_FarCopyData pop bc - ld hl,BadgeNumbersTileGraphics ; badge number tile patterns - ld de,vChars1 + $580 + ld hl, BadgeNumbersTileGraphics ; badge number tile patterns + ld de, vChars1 + $580 call TrainerInfo_FarCopyData - ld hl,GymLeaderFaceAndBadgeTileGraphics ; gym leader face and badge tile patterns - ld de,vChars2 + $200 - ld bc,$0400 - ld a,$03 + ld hl, GymLeaderFaceAndBadgeTileGraphics ; gym leader face and badge tile patterns + ld de, vChars2 + $200 + ld bc, $0400 + ld a, $03 call FarCopyData2 - ld hl,TextBoxGraphics - ld de,$00d0 - add hl,de ; hl = colon tile pattern - ld de,vChars1 + $560 - ld bc,$0010 - ld a,$04 + ld hl, TextBoxGraphics + ld de, $00d0 + add hl, de ; hl = colon tile pattern + ld de, vChars1 + $560 + ld bc, $0010 + ld a, $04 push bc call FarCopyData2 pop bc - ld hl,TrainerInfoTextBoxTileGraphics + $80 ; background tile pattern - ld de,vChars1 + $570 + ld hl, TrainerInfoTextBoxTileGraphics + $80 ; background tile pattern + ld de, vChars1 + $570 call TrainerInfo_FarCopyData call EnableLCD - ld hl,wTrainerInfoTextBoxWidthPlus1 - ld a,18 + 1 - ld [hli],a + ld hl, wTrainerInfoTextBoxWidthPlus1 + ld a, 18 + 1 + ld [hli], a dec a - ld [hli],a - ld [hl],1 + ld [hli], a + ld [hl], 1 coord hl, 0, 0 call TrainerInfo_DrawTextBox - ld hl,wTrainerInfoTextBoxWidthPlus1 - ld a,16 + 1 - ld [hli],a + ld hl, wTrainerInfoTextBoxWidthPlus1 + ld a, 16 + 1 + ld [hli], a dec a - ld [hli],a - ld [hl],3 + ld [hli], a + ld [hl], 3 coord hl, 1, 10 call TrainerInfo_DrawTextBox coord hl, 0, 10 - ld a,$d7 + ld a, $d7 call TrainerInfo_DrawVerticalLine coord hl, 19, 10 call TrainerInfo_DrawVerticalLine coord hl, 6, 9 - ld de,TrainerInfo_BadgesText + ld de, TrainerInfo_BadgesText call PlaceString coord hl, 2, 2 - ld de,TrainerInfo_NameMoneyTimeText + ld de, TrainerInfo_NameMoneyTimeText call PlaceString coord hl, 7, 2 - ld de,wPlayerName + ld de, wPlayerName call PlaceString coord hl, 8, 4 - ld de,wPlayerMoney - ld c,$e3 + ld de, wPlayerMoney + ld c, $e3 call PrintBCDNumber coord hl, 9, 6 - ld de,wPlayTimeHours ; hours + ld de, wPlayTimeHours ; hours lb bc, LEFT_ALIGN | 1, 3 call PrintNumber - ld [hl],$d6 ; colon tile ID + ld [hl], $d6 ; colon tile ID inc hl - ld de,wPlayTimeMinutes ; minutes + ld de, wPlayTimeMinutes ; minutes lb bc, LEADING_ZEROES | 1, 2 jp PrintNumber TrainerInfo_FarCopyData: - ld a,BANK(TrainerInfoTextBoxTileGraphics) + ld a, BANK(TrainerInfoTextBoxTileGraphics) jp FarCopyData2 TrainerInfo_NameMoneyTimeText: @@ -631,43 +631,43 @@ TrainerInfo_BadgesText: ; [wTrainerInfoTextBoxWidth] = width - 1 ; [wTrainerInfoTextBoxNextRowOffset] = distance from the end of a text box row to the start of the next TrainerInfo_DrawTextBox: - ld a,$79 ; upper left corner tile ID + ld a, $79 ; upper left corner tile ID lb de, $7a, $7b ; top edge and upper right corner tile ID's call TrainerInfo_DrawHorizontalEdge ; draw top edge call TrainerInfo_NextTextBoxRow - ld a,[wTrainerInfoTextBoxWidthPlus1] - ld e,a - ld d,0 - ld c,6 ; height of the text box + ld a, [wTrainerInfoTextBoxWidthPlus1] + ld e, a + ld d, 0 + ld c, 6 ; height of the text box .loop - ld [hl],$7c ; left edge tile ID - add hl,de - ld [hl],$78 ; right edge tile ID + ld [hl], $7c ; left edge tile ID + add hl, de + ld [hl], $78 ; right edge tile ID call TrainerInfo_NextTextBoxRow dec c - jr nz,.loop - ld a,$7d ; lower left corner tile ID - lb de,$77, $7e ; bottom edge and lower right corner tile ID's + jr nz, .loop + ld a, $7d ; lower left corner tile ID + lb de, $77, $7e ; bottom edge and lower right corner tile ID's TrainerInfo_DrawHorizontalEdge: - ld [hli],a ; place left corner tile - ld a,[wTrainerInfoTextBoxWidth] - ld c,a - ld a,d + ld [hli], a ; place left corner tile + ld a, [wTrainerInfoTextBoxWidth] + ld c, a + ld a, d .loop - ld [hli],a ; place edge tile + ld [hli], a ; place edge tile dec c - jr nz,.loop - ld a,e - ld [hl],a ; place right corner tile + jr nz, .loop + ld a, e + ld [hl], a ; place right corner tile ret TrainerInfo_NextTextBoxRow: - ld a,[wTrainerInfoTextBoxNextRowOffset] ; distance to the start of the next row + ld a, [wTrainerInfoTextBoxNextRowOffset] ; distance to the start of the next row .loop inc hl dec a - jr nz,.loop + jr nz, .loop ret ; draws a vertical line @@ -675,26 +675,26 @@ TrainerInfo_NextTextBoxRow: ; hl = address of top tile in the line ; a = tile ID TrainerInfo_DrawVerticalLine: - ld de,SCREEN_WIDTH - ld c,8 + ld de, SCREEN_WIDTH + ld c, 8 .loop - ld [hl],a - add hl,de + ld [hl], a + add hl, de dec c - jr nz,.loop + jr nz, .loop ret StartMenu_SaveReset: - ld a,[wd72e] - bit 6,a ; is the player using the link feature? - jp nz,Init + ld a, [wd72e] + bit 6, a ; is the player using the link feature? + jp nz, Init predef SaveSAV ; save the game call LoadScreenTilesFromBuffer2 ; restore saved screen jp HoldTextDisplayOpen StartMenu_Option: xor a - ld [H_AUTOBGTRANSFERENABLED],a + ld [H_AUTOBGTRANSFERENABLED], a call ClearScreen call UpdateSprites callab DisplayOptionMenu diff --git a/engine/menu/swap_items.asm b/engine/menu/swap_items.asm index b1fa78be..563fc7d5 100644 --- a/engine/menu/swap_items.asm +++ b/engine/menu/swap_items.asm @@ -1,149 +1,149 @@ HandleItemListSwapping: - ld a,[wListMenuID] - cp a,ITEMLISTMENU - jp nz,DisplayListMenuIDLoop ; only rearrange item list menus + ld a, [wListMenuID] + cp ITEMLISTMENU + jp nz, DisplayListMenuIDLoop ; only rearrange item list menus push hl - ld hl,wListPointer - ld a,[hli] - ld h,[hl] - ld l,a + ld hl, wListPointer + ld a, [hli] + ld h, [hl] + ld l, a inc hl ; hl = beginning of list entries - ld a,[wCurrentMenuItem] - ld b,a - ld a,[wListScrollOffset] + ld a, [wCurrentMenuItem] + ld b, a + ld a, [wListScrollOffset] add b add a - ld c,a - ld b,0 - add hl,bc ; hl = address of currently selected item entry - ld a,[hl] + ld c, a + ld b, 0 + add hl, bc ; hl = address of currently selected item entry + ld a, [hl] pop hl inc a - jp z,DisplayListMenuIDLoop ; ignore attempts to swap the Cancel menu item - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) + jp z, DisplayListMenuIDLoop ; ignore attempts to swap the Cancel menu item + ld a, [wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) and a ; has the first item to swap already been chosen? - jr nz,.swapItems + jr nz, .swapItems ; if not, set the currently selected item as the first item - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] inc a - ld b,a - ld a,[wListScrollOffset] ; index of top (visible) menu item within the list + ld b, a + ld a, [wListScrollOffset] ; index of top (visible) menu item within the list add b - ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1) - ld c,20 + ld [wMenuItemToSwap], a ; ID of item chosen for swapping (counts from 1) + ld c, 20 call DelayFrames jp DisplayListMenuIDLoop .swapItems - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] inc a - ld b,a - ld a,[wListScrollOffset] + ld b, a + ld a, [wListScrollOffset] add b - ld b,a - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) + ld b, a + ld a, [wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) cp b ; is the currently selected item the same as the first item to swap? - jp z,DisplayListMenuIDLoop ; ignore attempts to swap an item with itself + jp z, DisplayListMenuIDLoop ; ignore attempts to swap an item with itself dec a - ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1) - ld c,20 + ld [wMenuItemToSwap], a ; ID of item chosen for swapping (counts from 1) + ld c, 20 call DelayFrames push hl push de - ld hl,wListPointer - ld a,[hli] - ld h,[hl] - ld l,a + ld hl, wListPointer + ld a, [hli] + ld h, [hl] + ld l, a inc hl ; hl = beginning of list entries - ld d,h - ld e,l ; de = beginning of list entries - ld a,[wCurrentMenuItem] - ld b,a - ld a,[wListScrollOffset] + ld d, h + ld e, l ; de = beginning of list entries + ld a, [wCurrentMenuItem] + ld b, a + ld a, [wListScrollOffset] add b add a - ld c,a - ld b,0 - add hl,bc ; hl = address of currently selected item entry - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) + ld c, a + ld b, 0 + add hl, bc ; hl = address of currently selected item entry + ld a, [wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) add a add e - ld e,a - jr nc,.noCarry + ld e, a + jr nc, .noCarry inc d .noCarry ; de = address of first item to swap - ld a,[de] - ld b,a - ld a,[hli] + ld a, [de] + ld b, a + ld a, [hli] cp b - jr z,.swapSameItemType + jr z, .swapSameItemType .swapDifferentItems - ld [$ff95],a ; [$ff95] = second item ID - ld a,[hld] - ld [$ff96],a ; [$ff96] = second item quantity - ld a,[de] - ld [hli],a ; put first item ID in second item slot + ld [$ff95], a ; [$ff95] = second item ID + ld a, [hld] + ld [$ff96], a ; [$ff96] = 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] - ld [de],a ; put second item quantity in first item slot + ld a, [de] + ld [hl], a ; put first item quantity in second item slot + ld a, [$ff96] + ld [de], a ; put second item quantity in first item slot dec de - ld a,[$ff95] - ld [de],a ; put second item ID in first item slot + ld a, [$ff95] + ld [de], a ; put second item ID in first item slot xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped pop de pop hl jp DisplayListMenuIDLoop .swapSameItemType inc de - ld a,[hl] - ld b,a - ld a,[de] + ld a, [hl] + ld b, a + ld a, [de] add b ; a = sum of both item quantities - cp a,100 ; is the sum too big for one item slot? - jr c,.combineItemSlots + cp 100 ; is the sum too big for one item slot? + jr c, .combineItemSlots ; swap enough items from the first slot to max out the second slot if they can't be combined - sub a,99 - ld [de],a - ld a,99 - ld [hl],a + sub 99 + ld [de], a + ld a, 99 + ld [hl], a jr .done .combineItemSlots - ld [hl],a ; put the sum in the second item slot - ld hl,wListPointer - ld a,[hli] - ld h,[hl] - ld l,a + ld [hl], a ; put the sum in the second item slot + ld hl, wListPointer + ld a, [hli] + ld h, [hl] + ld l, a dec [hl] ; decrease the number of items - ld a,[hl] - ld [wListCount],a ; update number of items variable - cp a,1 - jr nz,.skipSettingMaxMenuItemID - ld [wMaxMenuItem],a ; if the number of items is only one now, update the max menu item ID + ld a, [hl] + ld [wListCount], a ; update number of items variable + cp 1 + jr nz, .skipSettingMaxMenuItemID + ld [wMaxMenuItem], a ; if the number of items is only one now, update the max menu item ID .skipSettingMaxMenuItemID dec de - ld h,d - ld l,e + ld h, d + ld l, e inc hl inc hl ; hl = address of item after first item to swap .moveItemsUpLoop ; erase the first item slot and move up all the following item slots to fill the gap - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de inc a ; reached the $ff terminator? - jr z,.afterMovingItemsUp - ld a,[hli] - ld [de],a + jr z, .afterMovingItemsUp + ld a, [hli] + ld [de], a inc de jr .moveItemsUpLoop .afterMovingItemsUp xor a - ld [wListScrollOffset],a - ld [wCurrentMenuItem],a + ld [wListScrollOffset], a + ld [wCurrentMenuItem], a .done xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped pop de pop hl jp DisplayListMenuIDLoop diff --git a/engine/menu/text_box.asm b/engine/menu/text_box.asm index 90c35d25..b9a36652 100644 --- a/engine/menu/text_box.asm +++ b/engine/menu/text_box.asm @@ -1,28 +1,28 @@ ; function to draw various text boxes DisplayTextBoxID_: - ld a,[wTextBoxID] - cp a,TWO_OPTION_MENU - jp z,DisplayTwoOptionMenu - ld c,a - ld hl,TextBoxFunctionTable - ld de,3 + 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 + jr c, .functionTableMatch + ld hl, TextBoxCoordTable + ld de, 5 call SearchTextBoxTable - jr c,.coordTableMatch - ld hl,TextBoxTextAndCoordTable - ld de,9 + jr c, .coordTableMatch + ld hl, TextBoxTextAndCoordTable + ld de, 9 call SearchTextBoxTable - jr c,.textAndCoordTableMatch + jr c, .textAndCoordTableMatch .done ret .functionTableMatch - ld a,[hli] - ld h,[hl] - ld l,a ; hl = address of function - ld de,.done + 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 @@ -37,14 +37,14 @@ DisplayTextBoxID_: call TextBoxBorder pop hl call GetTextBoxIDText - ld a,[wd730] + ld a, [wd730] push af - ld a,[wd730] - set 6,a ; no pauses between printing each letter - ld [wd730],a + ld a, [wd730] + set 6, a ; no pauses between printing each letter + ld [wd730], a call PlaceString pop af - ld [wd730],a + ld [wd730], a call UpdateSprites ret @@ -53,12 +53,12 @@ DisplayTextBoxID_: SearchTextBoxTable: dec de .loop - ld a,[hli] - cp a,$ff - jr z,.notFound + ld a, [hli] + cp $ff + jr z, .notFound cp c - jr z,.found - add hl,de + jr z, .found + add hl, de jr .loop .found scf @@ -74,31 +74,31 @@ SearchTextBoxTable: ; 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 + 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 + ld c, a ; c = width + ld a, [hli] ; row of lower right corner sub d dec a - ld b,a ; b = height + 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 + 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 + 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 @@ -112,17 +112,17 @@ GetTextBoxIDText: GetAddressOfScreenCoords: push bc coord hl, 0, 0 - ld bc,20 + ld bc, 20 .loop ; loop to add d rows to the base address - ld a,d + ld a, d and a - jr z,.addedRows - add hl,bc + jr z, .addedRows + add hl, bc dec d jr .loop .addedRows pop bc - add hl,de + add hl, de ret ; Format: |