diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/bank02.asm | 160 | ||||
-rw-r--r-- | src/engine/bank05.asm | 134 | ||||
-rw-r--r-- | src/engine/bank06.asm | 109 | ||||
-rw-r--r-- | src/engine/bank08.asm | 4 | ||||
-rw-r--r-- | src/macros/data.asm | 11 | ||||
-rw-r--r-- | src/wram.asm | 4 |
6 files changed, 300 insertions, 122 deletions
diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index be38fad..51127a2 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -41,7 +41,7 @@ DuelCheckMenu_InPlayArea: ; 8039 (2:4039) ; opens the Glossary submenu DuelCheckMenu_Glossary: ; 8042 (2:4042) - farcall Func_184c8 + farcall OpenGlossaryScreen ret ; opens the Your Play Area submenu @@ -1442,7 +1442,7 @@ Func_8764: ; 8764 (2:4764) xor a ld [wPrizeCardCursorPosition], a - ld de, Func_88c2 + ld de, Func_8764_TransitionTable ld hl, wce53 ld [hl], e inc hl @@ -1458,7 +1458,7 @@ Func_8764: ; 8764 (2:4764) .asm_87e7 cp $ff jr nz, .asm_87f0 - call Func_8aa1 + call ZeroObjectPositionsWithCopyToggleOn jr .swap .asm_87f0 ld hl, .asm_87f8 @@ -1590,7 +1590,7 @@ Func_8883: ; 8883 (2:4883) xor a ld [wPrizeCardCursorPosition], a - ld de, $48fa + ld de, Func_8883_TransitionTable ld hl, wce53 ld [hl], e inc hl @@ -1601,8 +1601,25 @@ Func_8883: ; 8883 (2:4883) ld [$ce56], a jp Func_8764.loop_2 -Func_88c2: ; 88c2 (2:48c2) - INCROM $88c2, $8932 +Func_8764_TransitionTable: ; 88c2 (2:48c2) + cursor_transition $08, $28, $00, $04, $02, $01, $07 + cursor_transition $30, $28, $20, $05, $03, $07, $00 + cursor_transition $08, $38, $00, $00, $04, $03, $07 + cursor_transition $30, $38, $20, $01, $05, $07, $02 + cursor_transition $08, $48, $00, $02, $00, $05, $07 + cursor_transition $30, $48, $20, $03, $01, $07, $04 + cursor_transition $78, $50, $00, $07, $07, $00, $01 + cursor_transition $78, $28, $00, $07, $07, $00, $01 + +Func_8883_TransitionTable: + cursor_transition $a0, $60, $20, $02, $04, $07, $01 + cursor_transition $78, $60, $00, $03, $05, $00, $07 + cursor_transition $a0, $50, $20, $04, $00, $06, $03 + cursor_transition $78, $50, $00, $05, $01, $02, $06 + cursor_transition $a0, $40, $20, $00, $02, $06, $05 + cursor_transition $78, $40, $00, $01, $03, $04, $06 + cursor_transition $08, $38, $00, $07, $07, $05, $04 + cursor_transition $08, $60, $00, $06, $06, $01, $00 Func_8932: ; 8932 (2:4932) INCROM $8932, $8992 @@ -1618,6 +1635,7 @@ LoadCursorTile: ; 8992 (2:4992) db $e0, $c0, $98, $b0, $84, $8c, $83, $82 db $86, $8f, $9d, $be, $f4, $f8, $50, $60 +; similar to OpenInPlayAreaScreen_HandleInput Func_89ae: ; 89ae (2:49ae) xor a ld [wcfe3], a @@ -1628,7 +1646,7 @@ Func_89ae: ; 89ae (2:49ae) ld d, [hl] ld a, [wPrizeCardCursorPosition] - ld [wce61], a + ld [wPrizeCardCursorTemporaryPosition], a ld l, a ld h, 7 call HtimesL @@ -1637,66 +1655,90 @@ Func_89ae: ; 89ae (2:49ae) ldh a, [hDPadHeld] or a - jp z, .asm_8a4f - + jp z, .check_button inc hl inc hl inc hl + bit D_UP_F, a - jr z, .asm_89d5 + jr z, .else_if_down + + ; up ld a, [hl] - jr .asm_89eb + jr .process_dpad -.asm_89d5 +.else_if_down inc hl bit D_DOWN_F, a - jr z, .asm_89dd + jr z, .else_if_right + + ; down ld a, [hl] - jr .asm_89eb -.asm_89dd + jr .process_dpad + +.else_if_right inc hl bit D_RIGHT_F, a - jr z, .asm_89e5 + jr z, .else_if_left + + ; right ld a, [hl] - jr .asm_89eb -.asm_89e5 + jr .process_dpad + +.else_if_left inc hl bit D_LEFT_F, a - jr z, .asm_8a4f + jr z, .check_button + + ; left ld a, [hl] -.asm_89eb +.process_dpad ld [wPrizeCardCursorPosition], a - cp $08 - jr nc, .asm_8a46 + cp $08 ; if a >= 0x8 + jr nc, .next ld b, $01 -.asm_89f4 + +; this loop equals to +; b = (1 << a) +.make_bitmask_loop or a - jr z, .asm_89fc + jr z, .make_bitmask_done sla b dec a - jr .asm_89f4 -.asm_89fc + jr .make_bitmask_loop + +.make_bitmask_done +; check if the moved cursor refers to an existing item. +; it's always true when this function was called from the glossary procedure. ld a, [wDuelInitialPrizesUpperBitsSet] and b - jr nz, .asm_8a46 - ld a, [wce61] + jr nz, .next + +; when no cards exist at the cursor, + ld a, [wPrizeCardCursorTemporaryPosition] cp $06 jr nz, Func_89ae + ; move once more in the direction (recursively) until it reaches an existing item. + +; check if one of the dpad, left or right, is pressed. +; if not, just go back to the start. ldh a, [hDPadHeld] - bit 4, a - jr nz, .asm_8a13 - bit 5, a + bit D_RIGHT_F, a + jr nz, .left_or_right + bit D_LEFT_F, a jr z, Func_89ae -.asm_8a13 + +.left_or_right ld a, [wDuelInitialPrizes] cp $05 - jr nc, .asm_8a46 + jr nc, .next ld a, [wPrizeCardCursorPosition] cp $05 jr nz, .asm_8a28 ld a, $03 ld [wPrizeCardCursorPosition], a jr .asm_8a2d + .asm_8a28 ld a, $02 ld [wPrizeCardCursorPosition], a @@ -1709,50 +1751,53 @@ Func_89ae: ; 89ae (2:49ae) ld [wPrizeCardCursorPosition], a .asm_8a3c ld a, [wPrizeCardCursorPosition] - ld [wce61], a + ld [wPrizeCardCursorTemporaryPosition], a ld b, $01 - jr .asm_89f4 -.asm_8a46 + jr .make_bitmask_loop + +.next ld a, $01 ld [wcfe3], a ; reset cursor blink xor a ld [wCheckMenuCursorBlinkCounter], a - -.asm_8a4f +.check_button ldh a, [hKeysPressed] and A_BUTTON | B_BUTTON - jr z, .asm_8a6d + jr z, .return + and A_BUTTON - jr nz, .asm_8a60 - ld a, $ff ; cancel + jr nz, .a_button + + ld a, -1 ; cancel call PlaySFXConfirmOrCancel scf ret -.asm_8a60 - call Func_8a82 +.a_button + call .draw_cursor ld a, $01 call PlaySFXConfirmOrCancel ld a, [wPrizeCardCursorPosition] scf ret -.asm_8a6d + +.return ld a, [wcfe3] or a - jr z, .asm_8a76 + jr z, .skip_sfx call PlaySFX -.asm_8a76 +.skip_sfx ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] - and $0f + and (1 << 4) - 1 ret nz bit 4, [hl] - jr nz, Func_8aa1 + jr nz, ZeroObjectPositionsWithCopyToggleOn -Func_8a82 ; 8a82 (2:4a82) +.draw_cursor call ZeroObjectPositions ld hl, wce53 ld e, [hl] @@ -1775,8 +1820,9 @@ Func_8a82 ; 8a82 (2:4a82) or a ret -Func_8aa1: ; 8aa1 (2:4aa1) +ZeroObjectPositionsWithCopyToggleOn: ; 8aa1 (2:4aa1) call ZeroObjectPositions + ld a, $01 ld [wVBlankOAMCopyToggle], a ret @@ -1786,7 +1832,19 @@ Func_8aaa: ; 8aaa (2:4aaa) INCROM $8aaa, $8b85 Func_8b85: ; 8b85 (2:4b85) - INCROM $8b85, $8cd4 + INCROM $8b85, $8c8e + +OpenGlossaryScreen_TransitionTable: + cursor_transition $08, $28, $00, $04, $01, $05, $05 + cursor_transition $08, $38, $00, $00, $02, $06, $06 + cursor_transition $08, $48, $00, $01, $03, $07, $07 + cursor_transition $08, $58, $00, $02, $04, $08, $08 + cursor_transition $08, $68, $00, $03, $00, $09, $09 + cursor_transition $58, $28, $00, $09, $06, $00, $00 + cursor_transition $58, $38, $00, $05, $07, $01, $01 + cursor_transition $58, $48, $00, $06, $08, $02, $02 + cursor_transition $58, $58, $00, $07, $09, $03, $03 + cursor_transition $58, $68, $00, $08, $05, $04, $04 Func_8cd4: ; 8cd4 (2:4cd4) push bc diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm index a8f2672..1e734d1 100644 --- a/src/engine/bank05.asm +++ b/src/engine/bank05.asm @@ -358,17 +358,17 @@ CheckEnergyNeededForAttack: ; 14279 (5:4279) ld hl, wLoadedMoveName ld a, [hli] or [hl] - jr z, .no_move + jr z, .no_attack ld a, [wLoadedMoveCategory] cp POKEMON_POWER - jr nz, .is_move -.no_move + jr nz, .is_attack +.no_attack lb bc, 0, 0 ld e, c scf ret -.is_move +.is_attack ldh a, [hTempPlayAreaLocation_ff9d] ld e, a call GetPlayAreaCardAttachedEnergies @@ -673,7 +673,7 @@ EstimateDamage_VersusDefendingCard: ; 143e5 (5:43e5) call CopyMoveDataAndDamage_FromDeckIndex ld a, [wLoadedMoveCategory] cp POKEMON_POWER - jr nz, .is_move + jr nz, .is_attack ; is a Pokémon Power ; set wDamage, wAIMinDamage and wAIMaxDamage to zero @@ -687,7 +687,7 @@ EstimateDamage_VersusDefendingCard: ; 143e5 (5:43e5) ld d, a ret -.is_move +.is_attack ; set wAIMinDamage and wAIMaxDamage to damage of move ; these values take into account the range of damage ; that the move can span (e.g. min and max number of hits) @@ -890,7 +890,7 @@ EstimateDamage_FromDefendingPokemon: ; 1450b (5:450b) call SwapTurn ld a, [wLoadedMoveCategory] cp POKEMON_POWER - jr nz, .is_move + jr nz, .is_attack ; is a Pokémon Power ; set wDamage, wAIMinDamage and wAIMaxDamage to zero @@ -904,7 +904,7 @@ EstimateDamage_FromDefendingPokemon: ; 1450b (5:450b) ld d, a ret -.is_move +.is_attack ; set wAIMinDamage and wAIMaxDamage to damage of move ; these values take into account the range of damage ; that the move can span (e.g. min and max number of hits) @@ -1502,8 +1502,122 @@ Func_15649: ; 15649 (5:5649) ret ; 0x156c3 -Func_156c3: ; 156c3 (5:56c3) - INCROM $156c3, $1575e +; load selected move from Pokémon in hTempPlayAreaLocation_ff9d, +; gets an energy card to discard and subsequently +; check if there is enough energy to execute the selected move +; after removing that attached energy card. +; input: +; [hTempPlayAreaLocation_ff9d] = location of Pokémon card +; [wSelectedMoveIndex] = selected move to examine +; output: +; b = basic energy still needed +; c = colorless energy still needed +; e = output of ConvertColorToEnergyCardID, or $0 if not a move +; carry set if no move +; OR if it's a Pokémon Power +; OR if not enough energy for move +CheckEnergyNeededForAttackAfterDiscard: ; 156c3 (5:56c3) + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ld d, a + ld a, [wSelectedMoveIndex] + ld e, a + call CopyMoveDataAndDamage_FromDeckIndex + ld hl, wLoadedMoveName + ld a, [hli] + or [hl] + jr z, .no_attack + ld a, [wLoadedMoveCategory] + cp POKEMON_POWER + jr nz, .is_attack +.no_attack + lb bc, 0, 0 + ld e, c + scf + ret + +.is_attack + ldh a, [hTempPlayAreaLocation_ff9d] + farcall GetEnergyCardToDiscard + call LoadCardDataToBuffer1_FromDeckIndex + cp DOUBLE_COLORLESS_ENERGY + jr z, .colorless + +; color energy +; decrease respective attached energy by 1. + ld hl, wAttachedEnergies + dec a + ld c, a + ld b, $00 + add hl, bc + dec [hl] + ld hl, wTotalAttachedEnergies + dec [hl] + jr .asm_1570c +; decrease attached colorless by 2. +.colorless + ld hl, wAttachedEnergies + COLORLESS + dec [hl] + dec [hl] + ld hl, wTotalAttachedEnergies + dec [hl] + dec [hl] + +.asm_1570c + bank1call HandleEnergyBurn + xor a + ld [wTempLoadedMoveEnergyCost], a + ld [wTempLoadedMoveEnergyNeededAmount], a + ld [wTempLoadedMoveEnergyNeededType], a + ld hl, wAttachedEnergies + ld de, wLoadedMoveEnergyCost + ld b, 0 + ld c, (NUM_TYPES / 2) - 1 +.loop + ; check all basic energy cards except colorless + ld a, [de] + swap a + call CheckIfEnoughParticularAttachedEnergy + ld a, [de] + call CheckIfEnoughParticularAttachedEnergy + inc de + dec c + jr nz, .loop + + ld a, [de] + swap a + and $0f + ld b, a ; colorless energy still needed + ld a, [wTempLoadedMoveEnergyCost] + ld hl, wTempLoadedMoveEnergyNeededAmount + sub [hl] + ld c, a ; basic energy still needed + ld a, [wTotalAttachedEnergies] + sub c + sub b + jr c, .not_enough_energy + + ld a, [wTempLoadedMoveEnergyNeededAmount] + or a + ret z + +; being here means the energy cost isn't satisfied, +; including with colorless energy + xor a +.not_enough_energy + cpl + inc a + ld c, a ; colorless energy still needed + ld a, [wTempLoadedMoveEnergyNeededAmount] + ld b, a ; basic energy still needed + ld a, [wTempLoadedMoveEnergyNeededType] + call ConvertColorToEnergyCardID + ld e, a + ld d, 0 + scf + ret +; 0x1575e ; zeroes a bytes starting at hl ZeroData: ; 1575e (5:575e) diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index bb9d872..e3ee426 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -478,55 +478,48 @@ OpenInPlayAreaScreen_TextTable: tx PKMNPowerText ; INPLAYAREA_OPP_BENCH_4 tx DoneText ; INPLAYAREA_OPP_BENCH_5 -; cursor x / cursor y / attribute / idx-up / idx-down / idx-right / idx-left -in_play_area_transition: MACRO - db \1, \2, \3 - rept 4 - db INPLAYAREA_\4 - shift - endr +in_play_area_cursor_transition: MACRO + cursor_transition \1, \2, \3, INPLAYAREA_\4, INPLAYAREA_\5, INPLAYAREA_\6, INPLAYAREA_\7 ENDM ; it's related to wInPlayAreaInputTablePointer. ; with this table, the cursor moves into the proper location by the input. ; note that the unit of the position is not a 8x8 tile. -; idx-[direction] means the index to get when the input is in the direction. -; its attribute is used for drawing a flipped cursor. OpenInPlayAreaScreen_TransitionTable1: - in_play_area_transition $18, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_2, PLAYER_BENCH_5 - in_play_area_transition $30, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_3, PLAYER_BENCH_1 - in_play_area_transition $48, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_4, PLAYER_BENCH_2 - in_play_area_transition $60, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_5, PLAYER_BENCH_3 - in_play_area_transition $78, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_1, PLAYER_BENCH_4 - in_play_area_transition $30, $6c, $00, OPP_ACTIVE, PLAYER_BENCH_1, PLAYER_DISCARD_PILE, PLAYER_DISCARD_PILE - in_play_area_transition $78, $80, $00, PLAYER_DISCARD_PILE, PLAYER_BENCH_1, PLAYER_ACTIVE, PLAYER_ACTIVE - in_play_area_transition $78, $70, $00, OPP_ACTIVE, PLAYER_HAND, PLAYER_ACTIVE, PLAYER_ACTIVE - in_play_area_transition $78, $34, 1 << OAM_X_FLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_DISCARD_PILE, OPP_DISCARD_PILE - in_play_area_transition $30, $20, 1 << OAM_X_FLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE - in_play_area_transition $30, $38, 1 << OAM_X_FLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE - in_play_area_transition $90, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2 - in_play_area_transition $78, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3 - in_play_area_transition $60, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4 - in_play_area_transition $48, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5 - in_play_area_transition $30, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1 + in_play_area_cursor_transition $18, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_2, PLAYER_BENCH_5 + in_play_area_cursor_transition $30, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_3, PLAYER_BENCH_1 + in_play_area_cursor_transition $48, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_4, PLAYER_BENCH_2 + in_play_area_cursor_transition $60, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_5, PLAYER_BENCH_3 + in_play_area_cursor_transition $78, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_1, PLAYER_BENCH_4 + in_play_area_cursor_transition $30, $6c, $00, OPP_ACTIVE, PLAYER_BENCH_1, PLAYER_DISCARD_PILE, PLAYER_DISCARD_PILE + in_play_area_cursor_transition $78, $80, $00, PLAYER_DISCARD_PILE, PLAYER_BENCH_1, PLAYER_ACTIVE, PLAYER_ACTIVE + in_play_area_cursor_transition $78, $70, $00, OPP_ACTIVE, PLAYER_HAND, PLAYER_ACTIVE, PLAYER_ACTIVE + in_play_area_cursor_transition $78, $34, 1 << OAM_X_FLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_DISCARD_PILE, OPP_DISCARD_PILE + in_play_area_cursor_transition $30, $20, 1 << OAM_X_FLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE + in_play_area_cursor_transition $30, $38, 1 << OAM_X_FLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE + in_play_area_cursor_transition $90, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2 + in_play_area_cursor_transition $78, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3 + in_play_area_cursor_transition $60, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4 + in_play_area_cursor_transition $48, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5 + in_play_area_cursor_transition $30, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1 OpenInPlayAreaScreen_TransitionTable2: - in_play_area_transition $18, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_2, PLAYER_BENCH_5 - in_play_area_transition $30, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_3, PLAYER_BENCH_1 - in_play_area_transition $48, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_4, PLAYER_BENCH_2 - in_play_area_transition $60, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_5, PLAYER_BENCH_3 - in_play_area_transition $78, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_1, PLAYER_BENCH_4 - in_play_area_transition $30, $6c, $00, OPP_ACTIVE, PLAYER_BENCH_1, PLAYER_DISCARD_PILE, PLAYER_DISCARD_PILE - in_play_area_transition $78, $80, $00, PLAYER_DISCARD_PILE, PLAYER_BENCH_1, PLAYER_ACTIVE, PLAYER_ACTIVE - in_play_area_transition $78, $70, $00, OPP_ACTIVE, PLAYER_HAND, PLAYER_ACTIVE, PLAYER_ACTIVE - in_play_area_transition $78, $34, 1 << OAM_X_FLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_DISCARD_PILE, OPP_DISCARD_PILE - in_play_area_transition $30, $20, 1 << OAM_X_FLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE - in_play_area_transition $30, $38, 1 << OAM_X_FLIP, OPP_HAND, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE - in_play_area_transition $90, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2 - in_play_area_transition $78, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3 - in_play_area_transition $60, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4 - in_play_area_transition $48, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5 - in_play_area_transition $30, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1 + in_play_area_cursor_transition $18, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_2, PLAYER_BENCH_5 + in_play_area_cursor_transition $30, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_3, PLAYER_BENCH_1 + in_play_area_cursor_transition $48, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_4, PLAYER_BENCH_2 + in_play_area_cursor_transition $60, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_5, PLAYER_BENCH_3 + in_play_area_cursor_transition $78, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_1, PLAYER_BENCH_4 + in_play_area_cursor_transition $30, $6c, $00, OPP_ACTIVE, PLAYER_BENCH_1, PLAYER_DISCARD_PILE, PLAYER_DISCARD_PILE + in_play_area_cursor_transition $78, $80, $00, PLAYER_DISCARD_PILE, PLAYER_BENCH_1, PLAYER_ACTIVE, PLAYER_ACTIVE + in_play_area_cursor_transition $78, $70, $00, OPP_ACTIVE, PLAYER_HAND, PLAYER_ACTIVE, PLAYER_ACTIVE + in_play_area_cursor_transition $78, $34, 1 << OAM_X_FLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_DISCARD_PILE, OPP_DISCARD_PILE + in_play_area_cursor_transition $30, $20, 1 << OAM_X_FLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE + in_play_area_cursor_transition $30, $38, 1 << OAM_X_FLIP, OPP_HAND, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE + in_play_area_cursor_transition $90, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2 + in_play_area_cursor_transition $78, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3 + in_play_area_cursor_transition $60, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4 + in_play_area_cursor_transition $48, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5 + in_play_area_cursor_transition $30, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1 OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) xor a @@ -730,14 +723,14 @@ ZeroObjectPositionsAndToggleOAMCopy_Bank6 ; 184bf (6:44bf) ld [wVBlankOAMCopyToggle], a ret -Func_184c8: ; 184c8 (6:44c8) +OpenGlossaryScreen: ; 184c8 (6:44c8) xor a ld [wGlossaryPageNo], a - call Func_1852b + call .display_menu xor a ld [wInPlayAreaCurPosition], a - ld de, $4c8e ; this data is stored in bank 2. + ld de, OpenGlossaryScreen_TransitionTable ; this data is stored in bank 2. ld hl, wInPlayAreaInputTablePointer ld [hl], e inc hl @@ -760,19 +753,19 @@ Func_184c8: ; 184c8 (6:44c8) cp -1 ; b button jr nz, .check_button - farcall $2, $4aa1 + farcall ZeroObjectPositionsWithCopyToggleOn ret .check_button push af - farcall Func_8aa1 + farcall ZeroObjectPositionsWithCopyToggleOn pop af cp $09 ; $09: next page or prev page jr z, .change_page - call Func_18598 - call Func_1852b + call .print_description + call .display_menu xor a ld [wCheckMenuCursorBlinkCounter], a jr .next @@ -784,11 +777,11 @@ Func_184c8: ; 184c8 (6:44c8) ld a, [wGlossaryPageNo] xor $01 ; swap page ld [wGlossaryPageNo], a - call Func_1855a + call .print_menu jr .next ; display glossary menu. -Func_1852b: ; 1852b (6:452b) +.display_menu ; 1852b (6:452b) xor a ld [wTileMapFill], a call ZeroObjectPositions @@ -797,19 +790,19 @@ Func_1852b: ; 1852b (6:452b) call DoFrame call EmptyScreen call Set_OBJ_8x8 - farcall $2, $4992 + farcall LoadCursorTile lb de, 5, 0 call InitTextPrinting ldtx hl, PokemonCardGlossaryText call ProcessTextFromID - call Func_1855a + call .print_menu ldtx hl, ChooseWordAndPressAButtonText call DrawWideTextBox_PrintText ret ; print texts in glossary menu. -Func_1855a: ; 1855a (6:455a) +.print_menu ; 1855a (6:455a) ld hl, wDefaultText ld a, TX_SYMBOL @@ -854,7 +847,7 @@ Func_1855a: ; 1855a (6:455a) ret ; display glossary description. -Func_18598: ; 18598 (6:4598) +.print_description ; 18598 (6:4598) push af xor a ld [wTileMapFill], a @@ -871,11 +864,11 @@ Func_18598: ; 18598 (6:4598) or a jr nz, .back_page - ld hl, GlossaryData_1 + ld hl, GlossaryData1 jr .front_page .back_page - ld hl, GlossaryData_2 + ld hl, GlossaryData2 .front_page pop af ; hl += (a + (a << 2)). @@ -930,7 +923,7 @@ glossary_entry: MACRO tx \3 ENDM -GlossaryData_1: +GlossaryData1: glossary_entry 7, Text02fa, Text030c glossary_entry 5, Text02fb, Text030d glossary_entry 7, Text02fc, Text030e @@ -941,7 +934,7 @@ GlossaryData_1: glossary_entry 7, Text0301, Text0313 glossary_entry 5, Text0302, Text0314 -GlossaryData_2: +GlossaryData2: glossary_entry 5, Text0303, Text0315 glossary_entry 5, Text0304, Text0316 glossary_entry 5, Text0305, Text0317 diff --git a/src/engine/bank08.asm b/src/engine/bank08.asm index 98e7cf9..d736f0e 100644 --- a/src/engine/bank08.asm +++ b/src/engine/bank08.asm @@ -593,7 +593,7 @@ FindTargetCardForSuperPotion: ; 2030f (8:430f) ldh [hTempPlayAreaLocation_ff9d], a farcall CheckEnergyNeededForAttack jr c, .second_attack_2 - farcall Func_156c3 + farcall CheckEnergyNeededForAttackAfterDiscard jr c, .asm_203f5 .second_attack_2 pop de @@ -604,7 +604,7 @@ FindTargetCardForSuperPotion: ; 2030f (8:430f) ldh [hTempPlayAreaLocation_ff9d], a farcall CheckEnergyNeededForAttack jr c, .asm_203f2 - farcall Func_156c3 + farcall CheckEnergyNeededForAttackAfterDiscard jr c, .asm_203f5 .asm_203f2 pop de diff --git a/src/macros/data.asm b/src/macros/data.asm index a7ac93d..f2a2210 100644 --- a/src/macros/data.asm +++ b/src/macros/data.asm @@ -88,4 +88,15 @@ ENDM textitem: MACRO db \1, \2 tx \3 +ENDM + +; cursor x / cursor y / attribute / idx-up / idx-down / idx-right / idx-left +; idx-[direction] means the index to get when the input is in the direction. +; its attribute is used for drawing a flipped cursor. +cursor_transition: MACRO + db \1, \2, \3 + rept 4 + db \4 + shift + endr ENDM
\ No newline at end of file diff --git a/src/wram.asm b/src/wram.asm index 42e008d..be77e77 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1506,7 +1506,9 @@ wYourOrOppPlayAreaLastCursorPosition:: ; ce5f wInPlayAreaFromSelectButton:: ; ce60 ds $1 -wce61:: ; ce61 +; it's used only in one function, +; which means that it's a kind of local variable, but defined in wram. +wPrizeCardCursorTemporaryPosition:: ; ce61 ds $1 wGlossaryPageNo:: ; ce62 |