diff options
| author | dannye <33dannye@gmail.com> | 2025-07-02 21:15:13 -0500 |
|---|---|---|
| committer | dannye <33dannye@gmail.com> | 2025-07-02 21:15:13 -0500 |
| commit | ca019eac8fd96559f4d4e712f0b53e95492e5dcb (patch) | |
| tree | 209a500e3bda6c2109e5acec60448e9e52f8c2af /engine/battle/core.asm | |
| parent | Use more ldpikacry (diff) | |
| parent | Require RGBDS 0.9.3 for its DMG palette specs (#513) (diff) | |
| download | pokeyellow-ca019eac8fd96559f4d4e712f0b53e95492e5dcb.tar.gz pokeyellow-ca019eac8fd96559f4d4e712f0b53e95492e5dcb.tar.xz pokeyellow-ca019eac8fd96559f4d4e712f0b53e95492e5dcb.zip | |
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'engine/battle/core.asm')
| -rw-r--r-- | engine/battle/core.asm | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 2a1134de..8024fb9e 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -18,7 +18,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: call LoadFontTilePatterns call LoadHudAndHpBarAndStatusTilePatterns ld hl, vBGMap0 - ld bc, BG_MAP_WIDTH * BG_MAP_HEIGHT + ld bc, TILEMAP_AREA .clearBackgroundLoop ld a, " " ld [hli], a @@ -326,7 +326,7 @@ MainInBattleLoop: bit USING_TRAPPING_MOVE, a ; check if enemy is using a multi-turn attack like wrap jr z, .selectPlayerMove ; if not, jump ; enemy is using a multi-turn attack like wrap, so player is trapped and cannot execute a move - ld a, $ff + ld a, CANNOT_MOVE ld [wPlayerSelectedMove], a jr .selectEnemyMove .selectPlayerMove @@ -2172,9 +2172,9 @@ DisplayBattleMenu:: inc hl ld a, $1 ld [hli], a ; wMaxMenuItem - ld [hl], D_RIGHT | A_BUTTON ; wMenuWatchedKeys + ld [hl], PAD_RIGHT | PAD_A ; wMenuWatchedKeys call HandleMenuInput - bit BIT_D_RIGHT, a + bit B_PAD_RIGHT, a jr nz, .rightColumn jr .AButtonPressed ; the A button was pressed .rightColumn ; put cursor in right column of menu @@ -2205,10 +2205,10 @@ DisplayBattleMenu:: inc hl ld a, $1 ld [hli], a ; wMaxMenuItem - ld a, D_LEFT | A_BUTTON + ld a, PAD_LEFT | PAD_A ld [hli], a ; wMenuWatchedKeys call HandleMenuInput - bit BIT_D_LEFT, a + bit B_PAD_LEFT, a jr nz, .leftColumn ; if left was pressed, jump ld a, [wCurrentMenuItem] add $2 ; if we're in the right column, the actual id is +2 @@ -2450,12 +2450,12 @@ PartyMenuOrRockOrRun: inc hl ld a, $2 ld [hli], a ; wMaxMenuItem - ld a, B_BUTTON | A_BUTTON + ld a, PAD_B | PAD_A ld [hli], a ; wMenuWatchedKeys xor a ld [hl], a ; wLastMenuItem call HandleMenuInput - bit BIT_B_BUTTON, a + bit B_PAD_B, a jr nz, .partyMonDeselected ; if B was pressed, jump ; A was pressed call PlaceUnfilledArrowMenuCursor @@ -2481,10 +2481,10 @@ PartyMenuOrRockOrRun: jr nz, .doEnemyMonAnimation ; enemy mon doesn't have substitute ld a, [wEnemyMonMinimized] - and a ; has the enemy mon used Minimise? + and a ; has the enemy mon used Minimize? ld hl, AnimationMinimizeMon jr nz, .doEnemyMonAnimation -; enemy mon is not minimised +; enemy mon is not minimized ld a, [wEnemyMonSpecies] ld [wCurPartySpecies], a ld [wCurSpecies], a @@ -2651,10 +2651,10 @@ MoveSelectionMenu: ld [hli], a ; wMaxMenuItem ld a, [wMoveMenuType] dec a - ld b, D_UP | D_DOWN | A_BUTTON + ld b, PAD_UP | PAD_DOWN | PAD_A jr z, .matchedkeyspicked dec a - ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON + ld b, PAD_UP | PAD_DOWN | PAD_A | PAD_B jr z, .matchedkeyspicked ld a, [wLinkState] cp LINK_STATE_BATTLING @@ -2662,9 +2662,9 @@ MoveSelectionMenu: ; Disable left, right, and START buttons in regular battles. ld a, [wStatusFlags7] bit BIT_TEST_BATTLE, a - ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT + ld b, ~(PAD_LEFT | PAD_RIGHT | PAD_START) jr z, .matchedkeyspicked - ld b, D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON | SELECT | START + ld b, PAD_CTRL_PAD | PAD_BUTTONS .matchedkeyspicked ld a, b ld [hli], a ; wMenuWatchedKeys @@ -2710,21 +2710,21 @@ SelectMenuItem: call HandleMenuInput ld hl, hUILayoutFlags res BIT_DOUBLE_SPACED_MENU, [hl] - bit BIT_D_UP, a + bit B_PAD_UP, a jp nz, SelectMenuItem_CursorUp - bit BIT_D_DOWN, a + bit B_PAD_DOWN, a jp nz, SelectMenuItem_CursorDown - bit BIT_SELECT, a + bit B_PAD_SELECT, a jp nz, SwapMovesInMenu IF DEF(_DEBUG) - bit BIT_START, a + bit B_PAD_START, a jp nz, Func_3d4f5 - bit BIT_D_RIGHT, a + bit B_PAD_RIGHT, a jp nz, Func_3d529 - bit BIT_D_LEFT, a + bit B_PAD_LEFT, a jp nz, Func_3d523 ENDC - bit BIT_B_BUTTON, a + bit B_PAD_B, a push af xor a ld [wMenuItemToSwap], a @@ -2821,7 +2821,7 @@ SelectMenuItem_CursorDown: Func_3d4f5: IF DEF(_DEBUG) - ASSERT BIT_START == BIT_TRAINER_BATTLE + ASSERT B_PAD_START == BIT_TRAINER_BATTLE ENDC bit BIT_TRAINER_BATTLE, a ld a, $0 @@ -3165,7 +3165,7 @@ SelectEnemyMove: pop hl jr z, .chooseRandomMove ; move disabled, try again and a - jr z, .chooseRandomMove ; move non-existant, try again + jr z, .chooseRandomMove ; move non-existent, try again .done ld [wEnemySelectedMove], a ret @@ -3189,7 +3189,8 @@ LinkBattleExchangeData: ld b, LINKBATTLE_STRUGGLE jr z, .next dec b ; LINKBATTLE_NO_ACTION - inc a ; does move equal -1 (i.e. no action)? + ASSERT CANNOT_MOVE == $ff + inc a jr z, .next ld a, [wPlayerMoveListIndex] jr .doExchange @@ -3242,8 +3243,9 @@ ExecutePlayerMove: xor a ldh [hWhoseTurn], a ; set player's turn ld a, [wPlayerSelectedMove] + ASSERT CANNOT_MOVE == $ff inc a - jp z, ExecutePlayerMoveDone ; for selected move = FF, skip most of player's turn + jp z, ExecutePlayerMoveDone ; if the player cannot move, skip most of their turn xor a ld [wMoveMissed], a ld [wMonIsDisobedient], a @@ -5766,6 +5768,7 @@ RandomizeDamage: ; for more detailed commentary, see equivalent function for player side (ExecutePlayerMove) ExecuteEnemyMove: ld a, [wEnemySelectedMove] + ASSERT CANNOT_MOVE == $ff inc a jp z, ExecuteEnemyMoveDone call PrintGhostText |
