From 77f07d4987be35fc2d5be27fce906d7f9b2398e4 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Mon, 1 Jul 2019 13:24:04 +0900 Subject: [Bank 6] Analyze keyboard data for deck --- src/engine/bank06.asm | 81 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 5c61c8d..adf1ef0 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -1715,7 +1715,7 @@ PrintPlayerNameFromInput: sub e inc a ld e, a - ld d, $00 + ld d, 0 ; print the underbars ; before print the input. ld hl, .char_underbar @@ -2792,10 +2792,83 @@ GetCharInfoFromPos_Deck: jr nz, .loop ret -; a bunch of data KeyboardData_Deck: ; (6:7019) - INCROM $1b019, $1b8e8 - INCROM $1b8e8, $1ba12 + db $04, $02, "A" + db $06, $02, "J" + db $08, $02, "S" + db $0a, $02, "?" + db $0c, $02, "4" + db $0e, $02, $02 + db $10, $0f, $01 + + db $04, $04, "B" + db $06, $04, "K" + db $08, $04, "T" + db $0a, $04, "&" + db $0c, $04, "5" + db $0e, $04, $02 + db $10, $0f, $01 + + db $04, $06, "C" + db $06, $06, "L" + db $08, $06, "U" + db $0a, $06, "+" + db $0c, $06, "6" + db $0e, $06, $02 + db $10, $0f, $01 + + db $04, $08, "D" + db $06, $08, "M" + db $08, $08, "V" + db $0a, $08, "-" + db $0c, $08, "7" + db $0e, $08, $02 + db $10, $0f, $01 + + db $04, $0a, "E" + db $06, $0a, "N" + db $08, $0a, "W" + db $0a, $0a, "'" + db $0c, $0a, "8" + db $0e, $0a, $02 + db $10, $0f, $01 + + db $04, $0c, "F" + db $06, $0c, "O" + db $08, $0c, "X" + db $0a, $0c, "0" + db $0c, $0c, "9" + db $0e, $0c, $02 + db $10, $0f, $01 + + db $04, $0e, "G" + db $06, $0e, "P" + db $08, $0e, "Y" + db $0a, $0e, "1" + db $0c, $0e, " " + db $0e, $0e, $02 + db $10, $0f, $01 + + db $04, $10, "H" + db $06, $10, "Q" + db $08, $10, "Z" + db $0a, $10, "2" + db $0c, $10, " " + db $0e, $10, $02 + db $10, $0f, $01 + + db $04, $12, "I" + db $06, $12, "R" + db $08, $12, "!" + db $0a, $12, "3" + db $0c, $12, " " + db $0e, $12, $02 + db $10, $0f, $01 + +; unknown data. +; needs analyze. +; (6:70d6) + INCROM $1b0d6, $1ba12 Func_006_7a12: ; (6:7a12) push af -- cgit v1.2.3 From b80e335255a13bb01ebdb8d85c45ba4fc449cd49 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Thu, 4 Jul 2019 16:24:08 +0900 Subject: Add some macros for text --- src/engine/bank06.asm | 114 ++++++++++++++++++++++++++++---------------------- src/macros/text.asm | 4 ++ 2 files changed, 68 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index f711215..ef473ba 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -1175,7 +1175,7 @@ Func_006_5168: ; 19168 (6:5168) ret INCROM $191a3, $1996e - + Func_1996e: ; 1996e (6:596e) call EnableSRAM ld a, PLAYER_TURN @@ -1371,8 +1371,8 @@ Func_006_668d: lb de, $38, $9f call SetupText bank1call InitAndDrawCardListScreenLayout - ld hl, $0056 - ld de, $0196 + ldtx hl, ChooseTheCardYouWishToExamineText + ldtx de, Text0196 bank1call SetCardListHeaderText ld a, A_BUTTON | START ld [wNoItemSelectionMenuKeys], a @@ -2060,7 +2060,7 @@ NamingScreen_ProcessInput: ld a, [wd009] cp $02 jr z, .read_char - ld bc, $0359 ; “ + ldfw3 bc, "“" ld a, d cp b jr nz, .asm_006_6af4 @@ -2074,7 +2074,7 @@ NamingScreen_ProcessInput: jr c, .nothing jr .asm_006_6b09 .asm_006_6af4 - ld bc, $035b ; º + ldfw3 bc, "º(2)" ld a, d cp b jr nz, .asm_006_6b1d @@ -2254,62 +2254,76 @@ GetCharInfoFromPos_Player: ; - unused data contains its character code as zero. kbitem: MACRO db \1, \2, \3, \4 +if (_NARG == 5) dw \5 +elif (\5 == TX_FULLWIDTH3) + dw (\5 << 8) | STRCAT("FW3_", \6) +else + dw (\5 << 8) | \6 +endc ENDM KeyboardData_Player: ; (6:6baf) - kbitem $04, $02, $11, $00, $0330 - kbitem $06, $02, $12, $00, $0339 - kbitem $08, $02, $13, $00, $0342 - kbitem $0a, $02, $14, $00, $006f - kbitem $0c, $02, $15, $00, $0064 + kbitem $04, $02, $11, $00, TX_FULLWIDTH3, "A" + kbitem $06, $02, $12, $00, TX_FULLWIDTH3, "J" + kbitem $08, $02, $13, $00, TX_FULLWIDTH3, "S" + kbitem $0a, $02, $14, $00, "o" + kbitem $0c, $02, $15, $00, "d" kbitem $10, $0f, $01, $09, $0000 - kbitem $04, $04, $16, $00, $0331 - kbitem $06, $04, $17, $00, $033a - kbitem $08, $04, $18, $00, $0343 - kbitem $0a, $04, $19, $00, $035d - kbitem $0c, $04, $1a, $00, $0065 + + kbitem $04, $04, $16, $00, TX_FULLWIDTH3, "B" + kbitem $06, $04, $17, $00, TX_FULLWIDTH3, "K" + kbitem $08, $04, $18, $00, TX_FULLWIDTH3, "T" + kbitem $0a, $04, $19, $00, TX_FULLWIDTH3, "&" + kbitem $0c, $04, $1a, $00, "e" kbitem $10, $0f, $01, $09, $0000 - kbitem $04, $06, $1b, $00, $0332 - kbitem $06, $06, $1c, $00, $033b - kbitem $08, $06, $1d, $00, $0344 - kbitem $0a, $06, $1e, $00, $006a - kbitem $0c, $06, $1f, $00, $0066 + + kbitem $04, $06, $1b, $00, TX_FULLWIDTH3, "C" + kbitem $06, $06, $1c, $00, TX_FULLWIDTH3, "L" + kbitem $08, $06, $1d, $00, TX_FULLWIDTH3, "U" + kbitem $0a, $06, $1e, $00, "j" + kbitem $0c, $06, $1f, $00, "f" kbitem $10, $0f, $01, $09, $0000 - kbitem $04, $08, $20, $00, $0333 - kbitem $06, $08, $21, $00, $033c - kbitem $08, $08, $22, $00, $0345 - kbitem $0a, $08, $23, $00, $006b - kbitem $0c, $08, $24, $00, $0067 + + kbitem $04, $08, $20, $00, TX_FULLWIDTH3, "D" + kbitem $06, $08, $21, $00, TX_FULLWIDTH3, "M" + kbitem $08, $08, $22, $00, TX_FULLWIDTH3, "V" + kbitem $0a, $08, $23, $00, "k" + kbitem $0c, $08, $24, $00, "g" kbitem $10, $0f, $01, $09, $0000 - kbitem $04, $0a, $25, $00, $0334 - kbitem $06, $0a, $26, $00, $033d - kbitem $08, $0a, $27, $00, $0346 - kbitem $0a, $0a, $28, $00, $0077 - kbitem $0c, $0a, $29, $00, $0068 + + kbitem $04, $0a, $25, $00, TX_FULLWIDTH3, "E" + kbitem $06, $0a, $26, $00, TX_FULLWIDTH3, "N" + kbitem $08, $0a, $27, $00, TX_FULLWIDTH3, "W" + kbitem $0a, $0a, $28, $00, "w" + kbitem $0c, $0a, $29, $00, "h" kbitem $10, $0f, $01, $09, $0000 - kbitem $04, $0c, $2a, $00, $0335 - kbitem $06, $0c, $2b, $00, $033e - kbitem $08, $0c, $2c, $00, $0347 - kbitem $0a, $0c, $2d, $00, $0060 - kbitem $0c, $0c, $2e, $00, $0069 + + kbitem $04, $0c, $2a, $00, TX_FULLWIDTH3, "F" + kbitem $06, $0c, $2b, $00, TX_FULLWIDTH3, "O" + kbitem $08, $0c, $2c, $00, TX_FULLWIDTH3, "X" + kbitem $0a, $0c, $2d, $00, "`" + kbitem $0c, $0c, $2e, $00, "i" kbitem $10, $0f, $01, $09, $0000 - kbitem $04, $0e, $2f, $00, $0336 - kbitem $06, $0e, $30, $00, $033f - kbitem $08, $0e, $31, $00, $0348 - kbitem $0a, $0e, $32, $00, $0061 - kbitem $0c, $0e, $33, $00, $0513 + + kbitem $04, $0e, $2f, $00, TX_FULLWIDTH3, "G" + kbitem $06, $0e, $30, $00, TX_FULLWIDTH3, "P" + kbitem $08, $0e, $31, $00, TX_FULLWIDTH3, "Y" + kbitem $0a, $0e, $32, $00, "a" + kbitem $0c, $0e, $33, $00, TX_SYMBOL, SYM_No kbitem $10, $0f, $01, $09, $0000 - kbitem $04, $10, $34, $00, $0337 - kbitem $06, $10, $35, $00, $0340 - kbitem $08, $10, $36, $00, $0349 - kbitem $0a, $10, $3c, $00, $0062 - kbitem $0c, $10, $3d, $00, $0511 + + kbitem $04, $10, $34, $00, TX_FULLWIDTH3, "H" + kbitem $06, $10, $35, $00, TX_FULLWIDTH3, "Q" + kbitem $08, $10, $36, $00, TX_FULLWIDTH3, "Z" + kbitem $0a, $10, $3c, $00, "b" + kbitem $0c, $10, $3d, $00, TX_SYMBOL, SYM_Lv kbitem $10, $0f, $01, $09, $0000 - kbitem $04, $12, $37, $00, $0338 - kbitem $06, $12, $38, $00, $0341 - kbitem $08, $12, $39, $00, $006e - kbitem $0a, $12, $3a, $00, $0063 - kbitem $0c, $12, $3b, $00, $0070 + + kbitem $04, $12, $37, $00, TX_FULLWIDTH3, "I" + kbitem $06, $12, $38, $00, TX_FULLWIDTH3, "R" + kbitem $08, $12, $39, $00, "n" + kbitem $0a, $12, $3a, $00, "c" + kbitem $0c, $12, $3b, $00, "p" kbitem $10, $0f, $01, $09, $0000 kbitem $00, $00, $00, $00, $0000 ; a set of transition datum. diff --git a/src/macros/text.asm b/src/macros/text.asm index dd47c02..8ad94e8 100644 --- a/src/macros/text.asm +++ b/src/macros/text.asm @@ -82,3 +82,7 @@ endc shift endr ENDM + +ldfw3: MACRO + ld \1, (TX_FULLWIDTH3 << 8) | STRCAT("FW3_", \2) +ENDM \ No newline at end of file -- cgit v1.2.3 From 2cae76bd6ad60040e5a442c129a0e8aee67e2e2d Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Fri, 5 Jul 2019 20:11:53 +0900 Subject: Disassemble 6:591f --- src/engine/bank01.asm | 4 ++-- src/engine/bank06.asm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index fff7239..79035fc 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -7682,7 +7682,7 @@ Func_741a: ; 741a (1:741a) xor a ld [wd4b0], a push hl - farcall $6, $4f9c + farcall Func_006_4f9c pop hl jr .loop .done @@ -7770,7 +7770,7 @@ Func_7571: ; 7571 (1:7571) INCROM $7571, $7576 Func_7576: ; 7576 (1:7576) - farcall $6, $591f + farcall Func_006_591f ret ; 0x757b diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index ef473ba..c7de261 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -681,8 +681,8 @@ Func_006_4598: ; 18598 (6:4598) call InitTextPrinting ldtx hl, Text02f6 call ProcessTextFromID - ld de, $0004 - ld bc, $140e + lb de, 0, 4 + lb bc, 20, 14 call DrawRegularTextBox ld a, [wGlossaryPageNo] or a @@ -1174,7 +1174,55 @@ Func_006_5168: ; 19168 (6:5168) bank1call DrawDuelHUDs ret - INCROM $191a3, $1996e + INCROM $191a3, $1991f + +Func_006_591f: + add a + ld e, a + ld d, 0 + ld hl, .data + add hl, de + ld a, PLAYER_TURN + ldh [hWhoseTurn], a + ld a, [hli] + add $02 + push hl + ld hl, sDeck1Name + call Func_199e0 + pop hl + call SwapTurn + ld a, [hli] + add $02 + call LoadDeck + call SwapTurn + call EnableSRAM + ld h, $a1 + ld de, wPlayerDeck + ld c, $3c +.asm_006_594c + ld a, [de] + inc de + ld l, a + res 7, [hl] + dec c + jr nz, .asm_006_594c + + ld h, $a1 + ld de, wOpponentDeck + ld c, $1e +.asm_006_595b + ld a, [de] + inc de + ld l, a + res 7, [hl] + inc [hl] + dec c + jr nz, .asm_006_595b + + call DisableSRAM + ret +.data + db $03, $04, $05, $06, $07, $08 Func_1996e: ; 1996e (6:596e) call EnableSRAM -- cgit v1.2.3 From acf08c866fb78af3dfb82466646b78b149ea2485 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Fri, 5 Jul 2019 22:35:40 +0900 Subject: Analyze 6:40d5 --- src/engine/bank06.asm | 232 ++++++++++++++++++++++++++++------------------ src/engine/home.asm | 2 +- src/text/text2.asm | 2 +- src/text/text_offsets.asm | 2 +- src/wram.asm | 16 +++- 5 files changed, 159 insertions(+), 95 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index c7de261..caa95c1 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -147,80 +147,103 @@ Func_18086: ; 18086 (6:4086) ret ; 0x180d5 +; this function is called when the player +; is shown the appearance of the play area. +; it can be called in the command window +; from either pressing select button +; or selecting check command. Func_180d5: ; 180d5 (6:40d5) ld a, $05 - ld [$ce52], a -.asm_006_40da + ld [wPlayAreaCursorPosition], a +.start xor a ld [wcea3], a farcall $2, $42ce call EnableLCD call IsClairvoyanceActive - jr c, .asm_006_40ef + jr c, .clairvoyance_on + ld de, $42db - jr .asm_006_40f2 -.asm_006_40ef + jr .clairvoyance_off + +.clairvoyance_on ld de, $434b -.asm_006_40f2 - ld hl, $ce53 +.clairvoyance_off + ld hl, wPlayAreaInputTablePointer ld [hl], e inc hl ld [hl], d - ld a, [$ce52] - call .asm_006_4171 -.asm_006_40fe + ld a, [wPlayAreaCursorPosition] + call Func_006_4171 +.on_frame ld a, $01 ld [wVBlankOAMCopyToggle], a call DoFrame + ldh a, [hDPadHeld] - and $08 - jr nz, .asm_006_4153 - ld a, [wce60] + and START + jr nz, .selection + + ; if this function's been called from 'select' button, + ; wIsFromSelectButton is on. + ld a, [wIsFromSelectButton] or a - jr z, .asm_006_4118 + jr z, .from_check_command + ldh a, [hDPadHeld] - and $04 - jr nz, .asm_006_4148 -.asm_006_4118 - ld a, [$ce52] + and SELECT + jr nz, .toggle_view + +.from_check_command + ld a, [wPlayAreaCursorPosition] ld [$ce58], a - call Func_006_43bb - jr c, .asm_006_4139 - ld a, [$ce52] + call HandleInput_PlayArea + jr c, .pressed + + ld a, [wPlayAreaCursorPosition] cp $10 - jp z, .asm_006_41f8 + jp z, Func_006_4171.asm_006_41f8 cp $11 - jp z, .asm_006_4210 + jp z, Func_006_4171.asm_006_4210 + ld hl, $ce58 cp [hl] - call nz, .asm_006_4171 - jr .asm_006_40fe -.asm_006_4139 - cp $ff - jr nz, .asm_006_4153 + call nz, Func_006_4171 + + jr .on_frame + +.pressed + cp -1 + jr nz, .selection + + ; pressed b button. call Func_006_44bf lb de, $38, $9f call SetupText scf ret -.asm_006_4148 + +.toggle_view call Func_006_44bf lb de, $38, $9f call SetupText or a ret -.asm_006_4153 + +.selection ; pressed a button or start button. call Func_006_44bf lb de, $38, $9f call SetupText - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] ld [$ce57], a - ld hl, .jump_table + ld hl, Func_006_4171.jump_table call JumpToFunctionInTable ld a, [$ce57] - ld [$ce52], a - jp .asm_006_40da -.asm_006_4171 ; 18171 (6:4171) + ld [wPlayAreaCursorPosition], a + + jp .start + +Func_006_4171 ; 18171 (6:4171) push af lb de, 1, 17 call InitTextPrinting @@ -228,7 +251,7 @@ Func_180d5: ; 180d5 (6:40d5) call ProcessTextFromID ld hl, hffb0 ld [hl], $01 - ldtx hl, Text024e + ldtx hl, HandText_2 call ProcessTextFromID ld hl, hffb0 ld [hl], $00 @@ -249,7 +272,7 @@ Func_180d5: ; 180d5 (6:40d5) ld a, l cp $06 jr nc, .asm_006_41e3 - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] cp $06 jr nc, .asm_006_41c2 ld a, l @@ -277,7 +300,7 @@ Func_180d5: ; 180d5 (6:40d5) call ProcessText ret .asm_006_41e3 - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] cp $08 jr nc, .asm_006_41ee call PrintTextNoDelay @@ -296,8 +319,8 @@ Func_180d5: ; 180d5 (6:40d5) pop af ldh [hWhoseTurn], a ld a, [$ce57] - ld [$ce52], a - jp .asm_006_40da + ld [wPlayAreaCursorPosition], a + jp Func_180d5.start .asm_006_4210 lb de, $38, $9f call SetupText @@ -307,8 +330,9 @@ Func_180d5: ; 180d5 (6:40d5) pop af ldh [hWhoseTurn], a ld a, [$ce57] - ld [$ce52], a - jp .asm_006_40da + ld [wPlayAreaCursorPosition], a + jp Func_180d5.start + .jump_table ; (6:4228) dw Func_006_4248 dw Func_006_4248 @@ -328,7 +352,7 @@ Func_180d5: ; 180d5 (6:40d5) dw Func_006_426a Func_006_4248: - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] inc a cp PLAY_AREA_BENCH_5 + $01 jr nz, .asm_006_4251 @@ -347,7 +371,7 @@ Func_006_4248: ret Func_006_426a: - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] sub $08 or a jr z, .asm_006_4274 @@ -402,137 +426,165 @@ Func_006_42b1: Data_006_42bb: INCROM $182bb, $183bb -Func_006_43bb: ; 183bb (6:43bb) +HandleInput_PlayArea: ; 183bb (6:43bb) xor a ld [wcfe3], a - ld hl, $ce53 -.asm_006_43c2 + ld hl, wPlayAreaInputTablePointer ld e, [hl] inc hl ld d, [hl] - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] ld l, a -.asm_006_43c9 ld h, $07 call HtimesL add hl, de + ldh a, [hDPadHeld] or a - jp z, .asm_006_446b + jp z, .check_button + inc hl inc hl inc hl + + ; check d-pad bit D_UP_F, a - jr z, .asm_006_43df -.asm_006_43dc + jr z, .else_if_down + + ; up ld a, [hl] - jr .asm_006_43f5 -.asm_006_43df + jr .process_dpad + +.else_if_down inc hl bit D_DOWN_F, a - jr z, .asm_006_43e7 + jr z, .else_if_right + + ; down ld a, [hl] - jr .asm_006_43f5 -.asm_006_43e7 + jr .process_dpad + +.else_if_right inc hl bit D_RIGHT_F, a - jr z, .asm_006_43ef + jr z, .else_if_left + + ; right ld a, [hl] - jr .asm_006_43f5 -.asm_006_43ef + jr .process_dpad + +.else_if_left inc hl bit D_LEFT_F, a - jr z, .asm_006_446b + jr z, .check_button + + ; left ld a, [hl] -.asm_006_43f5 +.process_dpad push af - ld a, [$ce52] - ld [$ce57], a + ld a, [wPlayAreaCursorPosition] + ld [$ce57], a ; saved state pop af - ld [$ce52], a + ld [wPlayAreaCursorPosition], a ; current state + cp $05 jr c, .asm_006_440e cp $0b jr c, .asm_006_4462 cp $10 jr c, .asm_006_4437 + jr .asm_006_4462 .asm_006_440e ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetTurnDuelistVariable dec a jr nz, .asm_006_441d + ld a, $10 - ld [$ce52], a + ld [wPlayAreaCursorPosition], a jr .asm_006_4462 .asm_006_441d ld b, a - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] cp b jr c, .asm_006_4462 + ldh a, [hDPadHeld] bit D_RIGHT_F, a jr z, .asm_006_4430 + xor a - ld [$ce52], a + ld [wPlayAreaCursorPosition], a jr .asm_006_4462 -.asm_006_4430: + +.asm_006_4430 ld a, b dec a - ld [$ce52], a + ld [wPlayAreaCursorPosition], a jr .asm_006_4462 -.asm_006_4437: + +.asm_006_4437 ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetNonTurnDuelistVariable dec a jr nz, .asm_006_4446 + ld a, $11 - ld [$ce52], a + ld [wPlayAreaCursorPosition], a jr .asm_006_4462 + .asm_006_4446 ld b, a - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] sub $0b cp b jr c, .asm_006_4462 + ldh a, [hDPadHeld] bit D_LEFT_F, a jr z, .asm_006_445c + ld a, $0b - ld [$ce52], a + ld [wPlayAreaCursorPosition], a jr .asm_006_4462 + .asm_006_445c ld a, b add $0a - ld [$ce52], a + ld [wPlayAreaCursorPosition], a .asm_006_4462 ld a, $01 ld [wcfe3], a xor a ld [wcea3], a -.asm_006_446b +.check_button ldh a, [hKeysPressed] - and $03 - jr z, .asm_006_448b - and $01 - jr nz, .asm_006_447d - ld a, $ff + and A_BUTTON | B_BUTTON + jr z, .return + + and A_BUTTON + jr nz, .a_button + + ; pressed b button + ld a, -1 farcall Func_90fb scf ret -.asm_006_447d +.a_button call Func_006_44a0 ld a, $01 farcall Func_90fb - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] scf ret -.asm_006_448b + +.return ld a, [wcfe3] or a - jr z, .asm_006_4494 + jr z, .skip_sfx call PlaySFX -.asm_006_4494 +.skip_sfx ld hl, wcea3 ld a, [hl] inc [hl] @@ -543,11 +595,11 @@ Func_006_43bb: ; 183bb (6:43bb) Func_006_44a0: ; 184a0 (6:44a0) call ZeroObjectPositions - ld hl, $ce53 + ld hl, wPlayAreaInputTablePointer ld e, [hl] inc hl ld d, [hl] - ld a, [$ce52] + ld a, [wPlayAreaCursorPosition] ld l, a ld h, $07 call HtimesL @@ -572,9 +624,9 @@ Func_006_44bf: ; 184bf (6:44bf) ld [wGlossaryPageNo], a call Func_006_452b xor a - ld [$ce52], a + ld [wPlayAreaCursorPosition], a ld de, $4c8e - ld hl, $ce53 + ld hl, wPlayAreaInputTablePointer ld [hl], e inc hl ld [hl], d diff --git a/src/engine/home.asm b/src/engine/home.asm index 0101028..d58fd80 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -9292,7 +9292,7 @@ Func_30a6: ; 30a6 (0:30a6) ld a, BANK(Func_180d5) call BankswitchROM ld a, $1 - ld [wce60], a + ld [wIsFromSelectButton], a call Func_180d5 pop bc ld a, b diff --git a/src/text/text2.asm b/src/text/text2.asm index 27ccff9..4cb3784 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -1775,7 +1775,7 @@ Text024d: ; 3bd08 (e:7d08) text "Please choose a Prize." done -Text024e: ; 3bd20 (e:7d20) +HandText_2: ; 3bd20 (e:7d20) text "Hand" done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 65dab94..a61fa03 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -591,7 +591,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text024b ; 0x024b textpointer Text024c ; 0x024c textpointer Text024d ; 0x024d - textpointer Text024e ; 0x024e + textpointer HandText_2 ; 0x024e textpointer Text024f ; 0x024f textpointer Text0250 ; 0x0250 textpointer Text0251 ; 0x0251 diff --git a/src/wram.asm b/src/wram.asm index 3af5361..ff57b49 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1289,7 +1289,19 @@ wce50:: ; ce50 wce51:: ; ce51 ds $1 - ds $7 +; the position of cursor +; in the display of play area. +; note that it's used in neither +; player's nor opponent's alone. +wPlayAreaCursorPosition:: ; ce52 + ds $1 + +; pointer to the table which contains +; information for each key-press. +wPlayAreaInputTablePointer:: ; ce53 + ds $2 + + ds $4 wce59:: ; ce59 ds $1 @@ -1301,7 +1313,7 @@ wce5e:: ; ce5e ds $1 -wce60:: ; ce60 +wIsFromSelectButton:: ; ce60 ds $1 wce61:: ; ce61 -- cgit v1.2.3 From b2e73cc90ac92a7d08d39bbf6d320f990bd7e031 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Sat, 6 Jul 2019 23:56:02 +0900 Subject: Add wram constants related to play-area-view --- src/wram.asm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/wram.asm b/src/wram.asm index ff57b49..7a7f0ad 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1301,7 +1301,18 @@ wPlayAreaCursorPosition:: ; ce52 wPlayAreaInputTablePointer:: ; ce53 ds $2 - ds $4 + ds $2 + +; it's used for restore the position of cursor +; when going into another view, and returning to +; the previous view. +wPlayAreaPreservedPosition:: ; ce57 + ds $1 + +; it's used for checking if the player changed +; the cursor in the play area view. +wPlayAreaPreservedPosition_2:: ; ce58 + ds $1 wce59:: ; ce59 ds $1 -- cgit v1.2.3 From e04c9323dc63d9cae6e6cad34db9f767efbe78be Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Sat, 6 Jul 2019 23:57:35 +0900 Subject: Analyze the part of play-area-view more I've changed functions names, and added some data-structure.` --- src/engine/bank06.asm | 216 ++++++++++++++++++++++++++++++++++++++++++-------- src/engine/home.asm | 4 +- 2 files changed, 185 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index caa95c1..922af38 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -152,7 +152,7 @@ Func_18086: ; 18086 (6:4086) ; it can be called in the command window ; from either pressing select button ; or selecting check command. -Func_180d5: ; 180d5 (6:40d5) +HandlePlayAreaView: ; 180d5 (6:40d5) ld a, $05 ld [wPlayAreaCursorPosition], a .start @@ -174,7 +174,7 @@ Func_180d5: ; 180d5 (6:40d5) inc hl ld [hl], d ld a, [wPlayAreaCursorPosition] - call Func_006_4171 + call PrintCardName_HandlePlayAreaView .on_frame ld a, $01 ld [wVBlankOAMCopyToggle], a @@ -188,27 +188,28 @@ Func_180d5: ; 180d5 (6:40d5) ; wIsFromSelectButton is on. ld a, [wIsFromSelectButton] or a - jr z, .from_check_command + jr z, .handle_input ; if it's from the check command, jump. ldh a, [hDPadHeld] and SELECT jr nz, .toggle_view -.from_check_command +.handle_input ld a, [wPlayAreaCursorPosition] - ld [$ce58], a + ld [wPlayAreaPreservedPosition_2], a call HandleInput_PlayArea jr c, .pressed ld a, [wPlayAreaCursorPosition] - cp $10 - jp z, Func_006_4171.asm_006_41f8 - cp $11 - jp z, Func_006_4171.asm_006_4210 + cp $10 ; player's hand + jp z, ShowPlayerHand_HandlePlayAreaView + cp $11 ; opponent's hand + jp z, ShowOpponentHand_HandlePlayAreaView - ld hl, $ce58 + ; check if the cursor moved. + ld hl, wPlayAreaPreservedPosition_2 cp [hl] - call nz, Func_006_4171 + call nz, PrintCardName_HandlePlayAreaView jr .on_frame @@ -235,60 +236,70 @@ Func_180d5: ; 180d5 (6:40d5) lb de, $38, $9f call SetupText ld a, [wPlayAreaCursorPosition] - ld [$ce57], a - ld hl, Func_006_4171.jump_table + ld [wPlayAreaPreservedPosition], a + ld hl, JumpTable_HandlePlayAreaView call JumpToFunctionInTable - ld a, [$ce57] + ld a, [wPlayAreaPreservedPosition] ld [wPlayAreaCursorPosition], a jp .start -Func_006_4171 ; 18171 (6:4171) +PrintCardName_HandlePlayAreaView: ; 18171 (6:4171) push af lb de, 1, 17 call InitTextPrinting ldtx hl, Text0251 call ProcessTextFromID + ld hl, hffb0 ld [hl], $01 ldtx hl, HandText_2 call ProcessTextFromID + ld hl, hffb0 ld [hl], $00 lb de, 1, 17 call InitTextPrinting pop af + ld hl, Data_006_42bb ld b, 0 sla a ld c, a - add hl, bc + add hl, bc ; hl = 0x42bb + 2 * (wPlayAreaCursorPostion) + ld a, [hli] ld h, [hl] ld l, a ld a, h or a jr nz, .asm_006_41e3 + ld a, l cp $06 jr nc, .asm_006_41e3 + ld a, [wPlayAreaCursorPosition] cp $06 jr nc, .asm_006_41c2 + ld a, l add DUELVARS_ARENA_CARD call GetTurnDuelistVariable cp -1 ret z + call GetCardIDFromDeckIndex call LoadCardDataToBuffer1_FromCardID jr .asm_006_41d7 + .asm_006_41c2 ld a, l add DUELVARS_ARENA_CARD call GetNonTurnDuelistVariable cp -1 ret z + call SwapTurn call GetCardIDFromDeckIndex call LoadCardDataToBuffer1_FromCardID @@ -299,18 +310,21 @@ Func_006_4171 ; 18171 (6:4171) ld hl, wDefaultText call ProcessText ret + .asm_006_41e3 ld a, [wPlayAreaCursorPosition] cp $08 jr nc, .asm_006_41ee call PrintTextNoDelay ret + .asm_006_41ee call SwapTurn call PrintTextNoDelay call SwapTurn ret -.asm_006_41f8 + +ShowPlayerHand_HandlePlayAreaView: lb de, $38, $9f call SetupText ldh a, [hWhoseTurn] @@ -318,10 +332,11 @@ Func_006_4171 ; 18171 (6:4171) bank1call OpenTurnHolderPlayAreaScreen pop af ldh [hWhoseTurn], a - ld a, [$ce57] + ld a, [wPlayAreaPreservedPosition] ld [wPlayAreaCursorPosition], a - jp Func_180d5.start -.asm_006_4210 + jp HandlePlayAreaView.start + +ShowOpponentHand_HandlePlayAreaView: lb de, $38, $9f call SetupText ldh a, [hWhoseTurn] @@ -329,11 +344,11 @@ Func_006_4171 ; 18171 (6:4171) bank1call OpenNonTurnHolderPlayAreaScreen pop af ldh [hWhoseTurn], a - ld a, [$ce57] + ld a, [wPlayAreaPreservedPosition] ld [wPlayAreaCursorPosition], a - jp Func_180d5.start + jp HandlePlayAreaView.start -.jump_table ; (6:4228) +JumpTable_HandlePlayAreaView ; (6:4228) dw Func_006_4248 dw Func_006_4248 dw Func_006_4248 @@ -424,7 +439,134 @@ Func_006_42b1: ret Data_006_42bb: - INCROM $182bb, $183bb + db $01, $00 + db $02, $00 + db $03, $00 + db $04, $00 + db $05, $00 + db $00, $00 + db $4f, $02 + db $50, $02 + db $00, $00 + db $4f, $02 + db $50, $02 + db $01, $00 + db $02, $00 + db $03, $00 + db $04, $00 + db $05, $00 + db $18, $8c + db $00, $05 + db $10, $01 + db $04, $30 + db $8c, $00 + db $05, $10 + db $02, $00 + db $48, $8c + db $00, $05 + db $10, $03 + db $01, $60 + db $8c, $00 + db $05, $10 + db $04, $02 + db $78, $8c + db $00, $05 + db $10, $00 + db $03, $30 + db $6c, $00 + db $08, $00 + db $07, $07 + db $78, $80 + db $00, $07 + db $00, $05 + db $05, $78 + db $70, $00 + db $08, $06 + db $05, $05 + db $78, $34 + db $20, $0b + db $05, $0a + db $0a, $30 + db $20, $20 + db $0b, $0a + db $08, $08 + db $30, $38 + db $20, $0b + db $05, $08 + db $08, $90 + db $14, $20 + db $11, $08 + db $0f, $0c + db $78, $14 + db $20, $11 + db $08, $0b + db $0d, $60 + db $14, $20 + db $11, $08 + db $0c, $0e + db $48, $14 + db $20, $11 + db $08, $0d + db $0f, $30 + db $14, $20 + db $11, $08 + db $0e, $0b + db $18, $8c + db $00, $05 + db $10, $01 + db $04, $30 + db $8c, $00 + db $05, $10 + db $02, $00 + db $48, $8c + db $00, $05 + db $10, $03 + db $01, $60 + db $8c, $00 + db $05, $10 + db $04, $02 + db $78, $8c + db $00, $05 + db $10, $00 + db $03, $30 + db $6c, $00 + db $08, $00 + db $07, $07 + db $78, $80 + db $00, $07 + db $00, $05 + db $05, $78 + db $70, $00 + db $08, $06 + db $05, $05 + db $78, $34 + db $20, $0b + db $05, $0a + db $0a, $30 + db $20, $20 + db $0b, $0a + db $08, $08 + db $30, $38 + db $20, $09 + db $05, $08 + db $08, $90 + db $14, $20 + db $11, $08 + db $0f, $0c + db $78, $14 + db $20, $11 + db $08, $0b + db $0d, $60 + db $14, $20 + db $11, $08 + db $0c, $0e + db $48, $14 + db $20, $11 + db $08, $0d + db $0f, $30 + db $14, $20 + db $11, $08 + db $0e, $0b HandleInput_PlayArea: ; 183bb (6:43bb) xor a @@ -483,9 +625,9 @@ HandleInput_PlayArea: ; 183bb (6:43bb) .process_dpad push af ld a, [wPlayAreaCursorPosition] - ld [$ce57], a ; saved state + ld [wPlayAreaPreservedPosition], a pop af - ld [wPlayAreaCursorPosition], a ; current state + ld [wPlayAreaCursorPosition], a cp $05 jr c, .asm_006_440e @@ -495,6 +637,7 @@ HandleInput_PlayArea: ; 183bb (6:43bb) jr c, .asm_006_4437 jr .asm_006_4462 + .asm_006_440e ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetTurnDuelistVariable @@ -504,6 +647,7 @@ HandleInput_PlayArea: ; 183bb (6:43bb) ld a, $10 ld [wPlayAreaCursorPosition], a jr .asm_006_4462 + .asm_006_441d ld b, a ld a, [wPlayAreaCursorPosition] @@ -571,6 +715,7 @@ HandleInput_PlayArea: ; 183bb (6:43bb) farcall Func_90fb scf ret + .a_button call Func_006_44a0 ld a, $01 @@ -590,6 +735,7 @@ HandleInput_PlayArea: ; 183bb (6:43bb) inc [hl] and $0f ret nz + bit D_RIGHT_F, [hl] jr nz, Func_006_44bf @@ -623,6 +769,7 @@ Func_006_44bf: ; 184bf (6:44bf) xor a ld [wGlossaryPageNo], a call Func_006_452b + xor a ld [wPlayAreaCursorPosition], a ld de, $4c8e @@ -639,26 +786,29 @@ Func_006_44bf: ; 184bf (6:44bf) ld [wVBlankOAMCopyToggle], a call DoFrame ldh a, [hKeysPressed] - and $04 - jr nz, .asm_006_4518 + and SELECT + jr nz, .on_select farcall $2, $49ae jr nc, .asm_006_44e5 - cp $ff + cp -1 jr nz, .asm_006_4502 farcall $2, $4aa1 ret + .asm_006_4502 push af farcall $2, $4aa1 pop af cp $09 jr z, .asm_006_451e + call Func_006_4598 call Func_006_452b xor a ld [wcea3], a jr .asm_006_44e5 -.asm_006_4518 + +.on_select ld a, $01 farcall Func_90fb .asm_006_451e @@ -680,10 +830,10 @@ Func_006_452b: ; 1852b (6:452b) farcall $2, $4992 lb de, 5, 0 call InitTextPrinting - ldtx hl, Text02f6 + ldtx hl, GlossaryText call ProcessTextFromID call Func_006_455a - ldtx hl, Text02f9 + ldtx hl, ChooseWordInGlossaryText call DrawWideTextBox_PrintText ret @@ -731,7 +881,7 @@ Func_006_4598: ; 18598 (6:4598) call EmptyScreen lb de, 5, 0 call InitTextPrinting - ldtx hl, Text02f6 + ldtx hl, GlossaryText call ProcessTextFromID lb de, 0, 4 lb bc, 20, 14 diff --git a/src/engine/home.asm b/src/engine/home.asm index d58fd80..23095e1 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -9289,11 +9289,11 @@ Func_3096: ; 3096 (0:3096) Func_30a6: ; 30a6 (0:30a6) ldh a, [hBankROM] push af - ld a, BANK(Func_180d5) + ld a, BANK(HandlePlayAreaView) call BankswitchROM ld a, $1 ld [wIsFromSelectButton], a - call Func_180d5 + call HandlePlayAreaView pop bc ld a, b call BankswitchROM -- cgit v1.2.3 From 674f1e573c193ab780936a7b6e7d556b535ab7c1 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Sun, 7 Jul 2019 00:00:33 +0900 Subject: Label Text --- src/text/text3.asm | 4 ++-- src/text/text_offsets.asm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/text/text3.asm b/src/text/text3.asm index 04d0b05..5d72609 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -619,7 +619,7 @@ Text02f5: ; 3d2e6 (f:52e6) line "very rare Pokémon cards!" done -Text02f6: ; 3d31c (f:531c) +GlossaryText: ; 3d31c (f:531c) text "Pokémon Card Glossary" done @@ -639,7 +639,7 @@ Text02f8: ; 3d3e0 (f:53e0) line "Attack To previous page" done -Text02f9: ; 3d48f (f:548f) +ChooseWordInGlossaryText: ; 3d48f (f:548f) text "Choose a word and press the" line "A button." done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index a61fa03..36611ca 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -759,10 +759,10 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text02f3 ; 0x02f3 textpointer Text02f4 ; 0x02f4 textpointer Text02f5 ; 0x02f5 - textpointer Text02f6 ; 0x02f6 + textpointer GlossaryText ; 0x02f6 textpointer Text02f7 ; 0x02f7 textpointer Text02f8 ; 0x02f8 - textpointer Text02f9 ; 0x02f9 + textpointer ChooseWordInGlossaryText ; 0x02f9 textpointer Text02fa ; 0x02fa textpointer Text02fb ; 0x02fb textpointer Text02fc ; 0x02fc -- cgit v1.2.3 From a1dcd04fc19fd14776c94a7b41d993a270aae8f6 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Sun, 7 Jul 2019 00:22:46 +0900 Subject: Analyze data 6:42bb and 6:42db --- src/engine/bank06.asm | 157 ++++++++++++++------------------------------------ 1 file changed, 42 insertions(+), 115 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 922af38..de83a1e 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -163,11 +163,11 @@ HandlePlayAreaView: ; 180d5 (6:40d5) call IsClairvoyanceActive jr c, .clairvoyance_on - ld de, $42db + ld de, Data_006_42db jr .clairvoyance_off .clairvoyance_on - ld de, $434b + ld de, Data_006_434b .clairvoyance_off ld hl, wPlayAreaInputTablePointer ld [hl], e @@ -439,6 +439,7 @@ Func_006_42b1: ret Data_006_42bb: +; db $01, $00 db $02, $00 db $03, $00 @@ -455,118 +456,44 @@ Data_006_42bb: db $03, $00 db $04, $00 db $05, $00 - db $18, $8c - db $00, $05 - db $10, $01 - db $04, $30 - db $8c, $00 - db $05, $10 - db $02, $00 - db $48, $8c - db $00, $05 - db $10, $03 - db $01, $60 - db $8c, $00 - db $05, $10 - db $04, $02 - db $78, $8c - db $00, $05 - db $10, $00 - db $03, $30 - db $6c, $00 - db $08, $00 - db $07, $07 - db $78, $80 - db $00, $07 - db $00, $05 - db $05, $78 - db $70, $00 - db $08, $06 - db $05, $05 - db $78, $34 - db $20, $0b - db $05, $0a - db $0a, $30 - db $20, $20 - db $0b, $0a - db $08, $08 - db $30, $38 - db $20, $0b - db $05, $08 - db $08, $90 - db $14, $20 - db $11, $08 - db $0f, $0c - db $78, $14 - db $20, $11 - db $08, $0b - db $0d, $60 - db $14, $20 - db $11, $08 - db $0c, $0e - db $48, $14 - db $20, $11 - db $08, $0d - db $0f, $30 - db $14, $20 - db $11, $08 - db $0e, $0b - db $18, $8c - db $00, $05 - db $10, $01 - db $04, $30 - db $8c, $00 - db $05, $10 - db $02, $00 - db $48, $8c - db $00, $05 - db $10, $03 - db $01, $60 - db $8c, $00 - db $05, $10 - db $04, $02 - db $78, $8c - db $00, $05 - db $10, $00 - db $03, $30 - db $6c, $00 - db $08, $00 - db $07, $07 - db $78, $80 - db $00, $07 - db $00, $05 - db $05, $78 - db $70, $00 - db $08, $06 - db $05, $05 - db $78, $34 - db $20, $0b - db $05, $0a - db $0a, $30 - db $20, $20 - db $0b, $0a - db $08, $08 - db $30, $38 - db $20, $09 - db $05, $08 - db $08, $90 - db $14, $20 - db $11, $08 - db $0f, $0c - db $78, $14 - db $20, $11 - db $08, $0b - db $0d, $60 - db $14, $20 - db $11, $08 - db $0c, $0e - db $48, $14 - db $20, $11 - db $08, $0d - db $0f, $30 - db $14, $20 - db $11, $08 - db $0e, $0b + +Data_006_42db: +; transitions[] + db $18, $8c, $00, $05, $10, $01, $04 + db $30, $8c, $00, $05, $10, $02, $00 + db $48, $8c, $00, $05, $10, $03, $01 + db $60, $8c, $00, $05, $10, $04, $02 + db $78, $8c, $00, $05, $10, $00, $03 + db $30, $6c, $00, $08, $00, $07, $07 + db $78, $80, $00, $07, $00, $05, $05 + db $78, $70, $00, $08, $06, $05, $05 + db $78, $34, $20, $0b, $05, $0a, $0a + db $30, $20, $20, $0b, $0a, $08, $08 + db $30, $38, $20, $0b, $05, $08, $08 + db $90, $14, $20, $11, $08, $0f, $0c + db $78, $14, $20, $11, $08, $0b, $0d + db $60, $14, $20, $11, $08, $0c, $0e + db $48, $14, $20, $11, $08, $0d, $0f + db $30, $14, $20, $11, $08, $0e, $0b + +Data_006_434b: +; transitions[] + db $18, $8c, $00, $05, $10, $01, $04 + db $30, $8c, $00, $05, $10, $02, $00 + db $48, $8c, $00, $05, $10, $03, $01 + db $60, $8c, $00, $05, $10, $04, $02 + db $78, $8c, $00, $05, $10, $00, $03 + db $30, $6c, $00, $08, $00, $07, $07 + db $78, $80, $00, $07, $00, $05, $05 + db $78, $70, $00, $08, $06, $05, $05 + db $78, $34, $20, $0b, $05, $0a, $0a + db $30, $20, $20, $0b, $0a, $08, $08 + db $30, $38, $20, $09, $05, $08, $08 + db $90, $14, $20, $11, $08, $0f, $0c + db $78, $14, $20, $11, $08, $0b, $0d + db $60, $14, $20, $11, $08, $0c, $0e + db $48, $14, $20, $11, $08, $0d, $0f + db $30, $14, $20, $11, $08, $0e, $0b HandleInput_PlayArea: ; 183bb (6:43bb) xor a @@ -769,7 +696,7 @@ Func_006_44bf: ; 184bf (6:44bf) xor a ld [wGlossaryPageNo], a call Func_006_452b - + xor a ld [wPlayAreaCursorPosition], a ld de, $4c8e -- cgit v1.2.3 From 45195f6c65300f712fef37e5e97eb0605b6476bf Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Sun, 7 Jul 2019 22:59:21 +0900 Subject: Rename some text and comment --- src/engine/bank06.asm | 24 ++++++++++++------------ src/text/text3.asm | 4 ++-- src/text/text_offsets.asm | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index e6793d5..44ae872 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -152,10 +152,8 @@ _CopyCardNameAndLevel_HalfwidthText: ret ; 0x180d5 -; this function is called when the player -; is shown the appearance of the play area. -; it can be called in the command window -; from either pressing select button +; this function is called when the player is shown the appearance of the play area. +; it can be called in the command window from either pressing select button ; or selecting check command. HandlePlayAreaView: ; 180d5 (6:40d5) ld a, $05 @@ -760,10 +758,10 @@ Func_006_452b: ; 1852b (6:452b) farcall $2, $4992 lb de, 5, 0 call InitTextPrinting - ldtx hl, GlossaryText + ldtx hl, PokemonCardGlossaryText call ProcessTextFromID call Func_006_455a - ldtx hl, ChooseWordInGlossaryText + ldtx hl, ChooseWordAndPressAButtonText call DrawWideTextBox_PrintText ret @@ -811,7 +809,7 @@ Func_006_4598: ; 18598 (6:4598) call EmptyScreen lb de, 5, 0 call InitTextPrinting - ldtx hl, GlossaryText + ldtx hl, PokemonCardGlossaryText call ProcessTextFromID lb de, 0, 4 lb bc, 20, 14 @@ -819,10 +817,10 @@ Func_006_4598: ; 18598 (6:4598) ld a, [wGlossaryPageNo] or a jr nz, .back_page - ld hl, GlossaryData1 + ld hl, GlossaryData_1 jr .front_page .back_page - ld hl, GlossaryData2 + ld hl, GlossaryData_2 .front_page pop af ; hl += (a + (a << 2)). @@ -875,7 +873,7 @@ glossary_entry: MACRO tx \2 tx \3 ENDM -GlossaryData1: +GlossaryData_1: glossary_entry 7, Text02fa, Text030c glossary_entry 5, Text02fb, Text030d glossary_entry 7, Text02fc, Text030e @@ -885,7 +883,7 @@ GlossaryData1: glossary_entry 5, Text0300, Text0312 glossary_entry 7, Text0301, Text0313 glossary_entry 5, Text0302, Text0314 -GlossaryData2: +GlossaryData_2: glossary_entry 5, Text0303, Text0315 glossary_entry 5, Text0304, Text0316 glossary_entry 5, Text0305, Text0317 @@ -2431,7 +2429,7 @@ GetCharInfoFromPos_Player: ; unit: 6 bytes. ; structure: ; abs. y pos. (1) / abs. x pos. (1) / type 1 (1) / type 2 (1) / char. code (2) -; - unused data contains its character code as zero. +; unused data contains its character code as zero. kbitem: MACRO db \1, \2, \3, \4 if (_NARG == 5) @@ -2506,6 +2504,7 @@ KeyboardData_Player: ; (6:6baf) kbitem $0c, $12, $3b, $00, "p" kbitem $10, $0f, $01, $09, $0000 kbitem $00, $00, $00, $00, $0000 + ; a set of transition datum. ; unit: 4 bytes. ; structure: @@ -2539,6 +2538,7 @@ TransitionTable1: dw $0e55, $0050 dw $0e56, $0051 dw $0000 + TransitionTable2: dw $0e2a, $0052 dw $0e2b, $0053 diff --git a/src/text/text3.asm b/src/text/text3.asm index 5d72609..0b67212 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -619,7 +619,7 @@ Text02f5: ; 3d2e6 (f:52e6) line "very rare Pokémon cards!" done -GlossaryText: ; 3d31c (f:531c) +PokemonCardGlossaryText: ; 3d31c (f:531c) text "Pokémon Card Glossary" done @@ -639,7 +639,7 @@ Text02f8: ; 3d3e0 (f:53e0) line "Attack To previous page" done -ChooseWordInGlossaryText: ; 3d48f (f:548f) +ChooseWordAndPressAButtonText: ; 3d48f (f:548f) text "Choose a word and press the" line "A button." done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 8421f29..aeb29e2 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -759,10 +759,10 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text02f3 ; 0x02f3 textpointer Text02f4 ; 0x02f4 textpointer Text02f5 ; 0x02f5 - textpointer GlossaryText ; 0x02f6 + textpointer PokemonCardGlossaryText ; 0x02f6 textpointer Text02f7 ; 0x02f7 textpointer Text02f8 ; 0x02f8 - textpointer ChooseWordInGlossaryText ; 0x02f9 + textpointer ChooseWordAndPressAButtonText ; 0x02f9 textpointer Text02fa ; 0x02fa textpointer Text02fb ; 0x02fb textpointer Text02fc ; 0x02fc -- cgit v1.2.3 From 3001cecb682d8ebdc39a100ded32bdf8f2d480d2 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Sun, 7 Jul 2019 23:55:07 +0900 Subject: Analyze HandlePlayAreaView more --- src/engine/bank02.asm | 6 ++--- src/engine/bank06.asm | 69 ++++++++++++++++++++++++++++----------------------- src/wram.asm | 6 ++++- 3 files changed, 46 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index f22d584..acfd216 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -430,7 +430,7 @@ Func_905a: ; 905a (2:505a) xor a ld [wceaf], a ld [wceb0], a - ld [wcea3], a + ld [wCheckCommandCounter], a ret Func_9065: ; 9065 (2:5065) @@ -472,7 +472,7 @@ Func_9065: ; 9065 (2:5065) ld a, e ld [wceb0], a xor a - ld [wcea3], a + ld [wCheckCommandCounter], a .asm_90a6 ldh a, [hKeysPressed] and A_BUTTON | B_BUTTON @@ -495,7 +495,7 @@ Func_9065: ; 9065 (2:5065) jr z, .asm_90ca call PlaySFX .asm_90ca - ld hl, wcea3 + ld hl, wCheckCommandCounter ld a, [hl] inc [hl] and $f diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 44ae872..04c3605 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -160,17 +160,17 @@ HandlePlayAreaView: ; 180d5 (6:40d5) ld [wPlayAreaCursorPosition], a .start xor a - ld [wcea3], a + ld [wCheckCommandCounter], a farcall $2, $42ce call EnableLCD call IsClairvoyanceActive jr c, .clairvoyance_on - ld de, Data_006_42db + ld de, PlayAreaViewTransitionTable1 jr .clairvoyance_off .clairvoyance_on - ld de, Data_006_434b + ld de, PlayAreaViewTransitionTable2 .clairvoyance_off ld hl, wPlayAreaInputTablePointer ld [hl], e @@ -213,7 +213,7 @@ HandlePlayAreaView: ; 180d5 (6:40d5) ld hl, wPlayAreaPreservedPosition_2 cp [hl] call nz, PrintCardName_HandlePlayAreaView - + jr .on_frame .pressed @@ -221,21 +221,21 @@ HandlePlayAreaView: ; 180d5 (6:40d5) jr nz, .selection ; pressed b button. - call Func_006_44bf + call HandleInput_PlayArea.non_draw_cursor lb de, $38, $9f call SetupText scf ret .toggle_view - call Func_006_44bf + call HandleInput_PlayArea.non_draw_cursor lb de, $38, $9f call SetupText or a ret .selection ; pressed a button or start button. - call Func_006_44bf + call HandleInput_PlayArea.non_draw_cursor lb de, $38, $9f call SetupText ld a, [wPlayAreaCursorPosition] @@ -268,7 +268,7 @@ PrintCardName_HandlePlayAreaView: ; 18171 (6:4171) ld b, 0 sla a ld c, a - add hl, bc ; hl = 0x42bb + 2 * (wPlayAreaCursorPostion) + add hl, bc ; hl = TextIDTable_182bb + 2 * (wPlayAreaCursorPostion) ld a, [hli] ld h, [hl] @@ -458,8 +458,13 @@ TextIDTable_182bb: tx PKMNPowerText tx DoneText -Data_006_42db: -; transitions[] +; it's related to wPlayAreaInputTablePointer. +; 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. +PlayAreaViewTransitionTable1: +; cursor x pos. / cursor y pos. / attribute / idx-up / idx-down / idx-right / idx-left db $18, $8c, $00, $05, $10, $01, $04 db $30, $8c, $00, $05, $10, $02, $00 db $48, $8c, $00, $05, $10, $03, $01 @@ -477,8 +482,8 @@ Data_006_42db: db $48, $14, $20, $11, $08, $0d, $0f db $30, $14, $20, $11, $08, $0e, $0b -Data_006_434b: -; transitions[] +PlayAreaViewTransitionTable2: +; same as 1. db $18, $8c, $00, $05, $10, $01, $04 db $30, $8c, $00, $05, $10, $02, $00 db $48, $8c, $00, $05, $10, $03, $01 @@ -629,7 +634,7 @@ HandleInput_PlayArea: ; 183bb (6:43bb) ld a, $01 ld [wcfe3], a xor a - ld [wcea3], a + ld [wCheckCommandCounter], a .check_button ldh a, [hKeysPressed] and A_BUTTON | B_BUTTON @@ -645,7 +650,7 @@ HandleInput_PlayArea: ; 183bb (6:43bb) ret .a_button - call Func_006_44a0 + call .draw_cursor ld a, $01 farcall Func_90fb ld a, [wPlayAreaCursorPosition] @@ -658,16 +663,16 @@ HandleInput_PlayArea: ; 183bb (6:43bb) jr z, .skip_sfx call PlaySFX .skip_sfx - ld hl, wcea3 + ld hl, wCheckCommandCounter ld a, [hl] inc [hl] and $0f ret nz - bit D_RIGHT_F, [hl] - jr nz, Func_006_44bf + bit 4, [hl] ; and $10 + jr nz, .non_draw_cursor -Func_006_44a0: ; 184a0 (6:44a0) +.draw_cursor ; 184a0 (6:44a0) call ZeroObjectPositions ld hl, wPlayAreaInputTablePointer ld e, [hl] @@ -678,22 +683,24 @@ Func_006_44a0: ; 184a0 (6:44a0) ld h, $07 call HtimesL add hl, de - ld d, [hl] + + ld d, [hl] ; x position. inc hl - ld e, [hl] + ld e, [hl] ; y position. inc hl - ld b, [hl] + ld b, [hl] ; attribute. ld c, $00 call SetOneObjectAttributes or a ret -Func_006_44bf: ; 184bf (6:44bf) +.non_draw_cursor ; 184bf (6:44bf) call ZeroObjectPositions ld a, $01 ld [wVBlankOAMCopyToggle], a ret +Func_006_44c8: ; (6:44c8) xor a ld [wGlossaryPageNo], a call Func_006_452b @@ -708,7 +715,7 @@ Func_006_44bf: ; 184bf (6:44bf) ld a, $ff ld [$ce55], a xor a - ld [wcea3], a + ld [wCheckCommandCounter], a .asm_006_44e5 ld a, $01 ld [wVBlankOAMCopyToggle], a @@ -733,7 +740,7 @@ Func_006_44bf: ; 184bf (6:44bf) call Func_006_4598 call Func_006_452b xor a - ld [wcea3], a + ld [wCheckCommandCounter], a jr .asm_006_44e5 .on_select @@ -933,7 +940,7 @@ GlossaryData_2: ld a, e ld [wceb0], a xor a - ld [wcea3], a + ld [wCheckCommandCounter], a .asm_006_46a2 ldh a, [hKeysPressed] and $03 @@ -956,7 +963,7 @@ GlossaryData_2: jr z, .asm_006_46c6 call PlaySFX .asm_006_46c6 - ld hl, wcea3 + ld hl, wCheckCommandCounter ld a, [hl] inc [hl] and $0f @@ -2060,7 +2067,7 @@ NamingScreen_CheckButtonState: ld a, h ld [wNamingScreenCursorX], a xor a - ld [wcea3], a + ld [wCheckCommandCounter], a ld a, $06 cp d jp z, NamingScreen_CheckButtonState @@ -2086,7 +2093,7 @@ NamingScreen_CheckButtonState: jr z, .asm_006_69f8 call PlaySFX .asm_006_69f8 - ld hl, wcea3 + ld hl, wCheckCommandCounter ld a, [hl] inc [hl] and $0f @@ -2538,7 +2545,7 @@ TransitionTable1: dw $0e55, $0050 dw $0e56, $0051 dw $0000 - + TransitionTable2: dw $0e2a, $0052 dw $0e2b, $0053 @@ -2857,7 +2864,7 @@ Func_006_6efb: ld a, h ld [wNamingScreenCursorX], a xor a - ld [wcea3], a + ld [wCheckCommandCounter], a ld a, $02 cp d jp z, Func_006_6efb @@ -2883,7 +2890,7 @@ Func_006_6efb: jr z, .asm_006_6f92 call PlaySFX .asm_006_6f92 - ld hl, wcea3 + ld hl, wCheckCommandCounter ld a, [hl] inc [hl] and $0f diff --git a/src/wram.asm b/src/wram.asm index 7a7f0ad..306fe70 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1411,7 +1411,11 @@ wcea1:: ; cea1 ds $1 -wcea3:: ; cea3 +; it's used when the player enters check command menu, and its sub-menus. +; it increases from 0x00 to 0xff. +; the game makes its blinking cursor by this. +; note that the check command contains the pokemon glossary. +wCheckCommandCounter:: ; cea3 ds $1 wNamingScreenCursorY:: ; cea4 -- cgit v1.2.3 From 03ce0249d46ff5f55b890bafc45ff1c757177eed Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Tue, 9 Jul 2019 00:30:12 +0900 Subject: Label in PrintCardName_HandlePlayAreaView --- src/engine/bank06.asm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 04c3605..0becce8 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -274,16 +274,17 @@ PrintCardName_HandlePlayAreaView: ; 18171 (6:4171) ld h, [hl] ld l, a ld a, h + or a - jr nz, .asm_006_41e3 + jr nz, .raw_string ld a, l cp $06 - jr nc, .asm_006_41e3 + jr nc, .raw_string ld a, [wPlayAreaCursorPosition] cp $06 - jr nc, .asm_006_41c2 + jr nc, .opponent_side ld a, l add DUELVARS_ARENA_CARD @@ -293,9 +294,9 @@ PrintCardName_HandlePlayAreaView: ; 18171 (6:4171) call GetCardIDFromDeckIndex call LoadCardDataToBuffer1_FromCardID - jr .asm_006_41d7 + jr .display_card_info -.asm_006_41c2 +.opponent_side ld a, l add DUELVARS_ARENA_CARD call GetNonTurnDuelistVariable @@ -306,21 +307,21 @@ PrintCardName_HandlePlayAreaView: ; 18171 (6:4171) call GetCardIDFromDeckIndex call LoadCardDataToBuffer1_FromCardID call SwapTurn -.asm_006_41d7 +.display_card_info ld a, 18 call CopyCardNameAndLevel ld hl, wDefaultText call ProcessText ret -.asm_006_41e3 +.raw_string ld a, [wPlayAreaCursorPosition] cp $08 - jr nc, .asm_006_41ee + jr nc, .opponent_side_raw_string call PrintTextNoDelay ret -.asm_006_41ee +.opponent_side_raw_string call SwapTurn call PrintTextNoDelay call SwapTurn -- cgit v1.2.3 From c03e3a124eeeb5ca4bedd53a0dc5f6506e54000b Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Tue, 9 Jul 2019 23:29:27 +0900 Subject: Finish HandlePlayAreaView I also finished related callbacks. --- src/engine/bank06.asm | 57 ++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 0becce8..4def888 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -352,30 +352,31 @@ ShowOpponentHand_HandlePlayAreaView: jp HandlePlayAreaView.start JumpTable_HandlePlayAreaView ; (6:4228) - dw Func_006_4248 - dw Func_006_4248 - dw Func_006_4248 - dw Func_006_4248 - dw Func_006_4248 - dw Func_006_4248 - dw Func_006_4293 - dw Func_006_42a7 - dw Func_006_426a - dw Func_006_429d - dw Func_006_42b1 - dw Func_006_426a - dw Func_006_426a - dw Func_006_426a - dw Func_006_426a - dw Func_006_426a - -Func_006_4248: + dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x00: my bench pokemon 1 + dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x01: my bench pokemon 2 + dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x02: my bench pokemon 3 + dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x03: my bench pokemon 4 + dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x04: my bench pokemon 5 + dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x05: my active pokemon + dw ShowPlayerHand_HandlePlayAreaView_2 ; 0x06: my hand + dw ShowPlayerDiscardPile_HandlePlayAreaView ; 0x07: my discard pile + + dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x08: opp. active pokemon + dw ShowOpponentHand_HandlePlayAreaView_2 ; 0x09: opp. hand + dw ShowOpponentDiscardPile_HandlePlayAreaView ; 0x0a: opp. discard pile + dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0b: opp. bench pokemon 1 + dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0c: opp. bench pokemon 2 + dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0d: opp. bench pokemon 3 + dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0e: opp. bench pokemon 4 + dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0f: opp. bench pokemon 5 + +ShowPlayerAreaPokemon_HandlePlayAreaView: ld a, [wPlayAreaCursorPosition] inc a - cp PLAY_AREA_BENCH_5 + $01 - jr nz, .asm_006_4251 + cp $05 + 1 ; $05: my active pokemon + jr nz, .on_bench xor a ; PLAY_AREA_ARENA -.asm_006_4251 +.on_bench ld [wCurPlayAreaSlot], a add DUELVARS_ARENA_CARD call GetTurnDuelistVariable @@ -388,13 +389,13 @@ Func_006_4248: bank1call OpenCardPage_FromCheckPlayArea ret -Func_006_426a: +ShowOpponentAreaPokemon_HandlePlayAreaView: ld a, [wPlayAreaCursorPosition] sub $08 or a - jr z, .asm_006_4274 + jr z, .on_bench sub $02 -.asm_006_4274 +.on_bench ld [wCurPlayAreaSlot], a add DUELVARS_ARENA_CARD call GetNonTurnDuelistVariable @@ -409,7 +410,7 @@ Func_006_426a: call SwapTurn ret -Func_006_4293: +ShowPlayerHand_HandlePlayAreaView_2: ldh a, [hWhoseTurn] push af bank1call OpenTurnHolderHandScreen_Simple @@ -417,7 +418,7 @@ Func_006_4293: ldh [hWhoseTurn], a ret -Func_006_429d: +ShowOpponentHand_HandlePlayAreaView_2: ldh a, [hWhoseTurn] push af bank1call OpenNonTurnHolderHandScreen_Simple @@ -425,7 +426,7 @@ Func_006_429d: ldh [hWhoseTurn], a ret -Func_006_42a7: +ShowPlayerDiscardPile_HandlePlayAreaView: ldh a, [hWhoseTurn] push af bank1call OpenTurnHolderDiscardPileScreen @@ -433,7 +434,7 @@ Func_006_42a7: ldh [hWhoseTurn], a ret -Func_006_42b1: +ShowOpponentDiscardPile_HandlePlayAreaView: ldh a, [hWhoseTurn] push af bank1call OpenNonTurnHolderDiscardPileScreen -- cgit v1.2.3 From 41d7ac06ac4acf16648d7a769ce98f07c8f10c2a Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Fri, 12 Jul 2019 00:39:47 +0900 Subject: Work on glossary menu --- src/engine/bank06.asm | 113 ++++++++++++++++++++++++++++------------------ src/text/text3.asm | 4 +- src/text/text_offsets.asm | 4 +- src/wram.asm | 8 +++- 4 files changed, 79 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 4def888..53821b6 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -562,77 +562,81 @@ HandleInput_PlayArea: ; 183bb (6:43bb) ld a, [wPlayAreaCursorPosition] ld [wPlayAreaPreservedPosition], a pop af + ld [wPlayAreaCursorPosition], a cp $05 - jr c, .asm_006_440e + jr c, .player_area cp $0b - jr c, .asm_006_4462 + jr c, .next cp $10 - jr c, .asm_006_4437 + jr c, .opponent_area - jr .asm_006_4462 + jr .next -.asm_006_440e +.player_area ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetTurnDuelistVariable dec a - jr nz, .asm_006_441d + jr nz, .bench_pokemon_exists + ; no pokemon in player's bench. + ; then move to player's hand. ld a, $10 ld [wPlayAreaCursorPosition], a - jr .asm_006_4462 + jr .next -.asm_006_441d +.bench_pokemon_exists ld b, a ld a, [wPlayAreaCursorPosition] cp b - jr c, .asm_006_4462 + jr c, .next + ; handle index overflow ldh a, [hDPadHeld] bit D_RIGHT_F, a - jr z, .asm_006_4430 + jr z, .on_left xor a ld [wPlayAreaCursorPosition], a - jr .asm_006_4462 + jr .next -.asm_006_4430 +.on_left ld a, b dec a ld [wPlayAreaCursorPosition], a - jr .asm_006_4462 + jr .next -.asm_006_4437 +.opponent_area ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetNonTurnDuelistVariable dec a - jr nz, .asm_006_4446 + jr nz, .bench_pokemon_exists_2 ld a, $11 ld [wPlayAreaCursorPosition], a - jr .asm_006_4462 + jr .next -.asm_006_4446 +.bench_pokemon_exists_2 ld b, a ld a, [wPlayAreaCursorPosition] sub $0b cp b - jr c, .asm_006_4462 + jr c, .next ldh a, [hDPadHeld] bit D_LEFT_F, a - jr z, .asm_006_445c + jr z, .on_right ld a, $0b ld [wPlayAreaCursorPosition], a - jr .asm_006_4462 + jr .next -.asm_006_445c +.on_right ld a, b add $0a ld [wPlayAreaCursorPosition], a -.asm_006_4462 +.next ld a, $01 ld [wcfe3], a xor a @@ -668,10 +672,10 @@ HandleInput_PlayArea: ; 183bb (6:43bb) ld hl, wCheckCommandCounter ld a, [hl] inc [hl] - and $0f + and $10 - 1 ret nz - bit 4, [hl] ; and $10 + bit 4, [hl] ; = and $10 jr nz, .non_draw_cursor .draw_cursor ; 184a0 (6:44a0) @@ -709,52 +713,57 @@ Func_006_44c8: ; (6:44c8) xor a ld [wPlayAreaCursorPosition], a - ld de, $4c8e + ld de, $4c8e ; this data is stored in bank 2. ld hl, wPlayAreaInputTablePointer ld [hl], e inc hl ld [hl], d ld a, $ff - ld [$ce55], a + ld [wce55], a xor a ld [wCheckCommandCounter], a -.asm_006_44e5 +.next ld a, $01 ld [wVBlankOAMCopyToggle], a call DoFrame ldh a, [hKeysPressed] and SELECT jr nz, .on_select + farcall $2, $49ae - jr nc, .asm_006_44e5 - cp -1 - jr nz, .asm_006_4502 + jr nc, .next + + cp -1 ; b button + jr nz, .check_button + farcall $2, $4aa1 ret -.asm_006_4502 +.check_button push af farcall $2, $4aa1 pop af - cp $09 - jr z, .asm_006_451e + + cp $09 ; $09: next page or prev page + jr z, .change_page call Func_006_4598 call Func_006_452b xor a ld [wCheckCommandCounter], a - jr .asm_006_44e5 + jr .next .on_select ld a, $01 farcall Func_90fb -.asm_006_451e +.change_page ld a, [wGlossaryPageNo] - xor $01 + xor $01 ; swap page ld [wGlossaryPageNo], a call Func_006_455a - jr .asm_006_44e5 + jr .next +; display glossary menu. Func_006_452b: ; 1852b (6:452b) xor a ld [wTileMapFill], a @@ -765,6 +774,7 @@ Func_006_452b: ; 1852b (6:452b) call EmptyScreen call Set_OBJ_8x8 farcall $2, $4992 + lb de, 5, 0 call InitTextPrinting ldtx hl, PokemonCardGlossaryText @@ -774,22 +784,29 @@ Func_006_452b: ; 1852b (6:452b) call DrawWideTextBox_PrintText ret -; print glossary +; print texts in glossary menu. Func_006_455a: ; 1855a (6:455a) ld hl, wDefaultText + ld a, TX_SYMBOL ld [hli], a + ld a, [wGlossaryPageNo] add SYM_1 ld [hli], a + ld a, TX_SYMBOL ld [hli], a + ld a, SYM_SLASH ld [hli], a + ld a, TX_SYMBOL ld [hli], a + ld a, SYM_2 ld [hli], a + ld [hl], TX_END lb de, 16, 1 @@ -801,16 +818,18 @@ Func_006_455a: ; 1855a (6:455a) call InitTextPrinting ld a, [wGlossaryPageNo] or a - jr nz, .page_two - ldtx hl, Text02f7 + + ldtx hl, GlossaryMenuPage1Text jr .page_one + .page_two - ldtx hl, Text02f8 + ldtx hl, GlossaryMenuPage2Text .page_one call ProcessTextFromID ret +; display glossary description. Func_006_4598: ; 18598 (6:4598) push af xor a @@ -823,11 +842,14 @@ Func_006_4598: ; 18598 (6:4598) lb de, 0, 4 lb bc, 20, 14 call DrawRegularTextBox + ld a, [wGlossaryPageNo] or a jr nz, .back_page + ld hl, GlossaryData_1 jr .front_page + .back_page ld hl, GlossaryData_2 .front_page @@ -865,18 +887,19 @@ Func_006_4598: ; 18598 (6:4598) xor a ld [wLineSeparation], a call EnableLCD -.asm_006_45f7 +.loop call DoFrame ldh a, [hKeysPressed] and B_BUTTON - jr z, .asm_006_45f7 - ld a, $ff + jr z, .loop + + ld a, -1 farcall Func_90fb ret ; unit: 5 bytes. ; [structure] -; horizonal align (1) / text id 1 (2) / text id 2 (2) +; horizonal align (1) / title text id (2) / desc. text id (2) glossary_entry: MACRO db \1 tx \2 diff --git a/src/text/text3.asm b/src/text/text3.asm index 0b67212..60b3c25 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -623,7 +623,7 @@ PokemonCardGlossaryText: ; 3d31c (f:531c) text "Pokémon Card Glossary" done -Text02f7: ; 3d333 (f:5333) +GlossaryMenuPage1Text: ; 3d333 (f:5333) text "Deck Active Pokémon" line "Discard Pile Bench Pokémon" line "Hand Prizes " @@ -631,7 +631,7 @@ Text02f7: ; 3d333 (f:5333) line "Bench To next page " done -Text02f8: ; 3d3e0 (f:53e0) +GlossaryMenuPage2Text: ; 3d3e0 (f:53e0) text "Energy Card Pokémon Power " line "Trainer Card Weakness " line "Basic Pokémon Resistance" diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index aeb29e2..24091f1 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -760,8 +760,8 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text02f4 ; 0x02f4 textpointer Text02f5 ; 0x02f5 textpointer PokemonCardGlossaryText ; 0x02f6 - textpointer Text02f7 ; 0x02f7 - textpointer Text02f8 ; 0x02f8 + textpointer GlossaryMenuPage1Text ; 0x02f7 + textpointer GlossaryMenuPage2Text ; 0x02f8 textpointer ChooseWordAndPressAButtonText ; 0x02f9 textpointer Text02fa ; 0x02fa textpointer Text02fb ; 0x02fb diff --git a/src/wram.asm b/src/wram.asm index 306fe70..5807f90 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1301,6 +1301,7 @@ wPlayAreaCursorPosition:: ; ce52 wPlayAreaInputTablePointer:: ; ce53 ds $2 +wce55:: ; ce55 ds $2 ; it's used for restore the position of cursor @@ -1498,8 +1499,13 @@ wcfda:: ; cfda ds $7 +; it's a flag variable being used in play-area view. +; need analysis. wcfe3:: ; cfe3 - ds $4 + ds $1 + +wcfe4:: ; cfe4 + ds $3 ; a name buffer in the naming screen. wNamingScreenBuffer:: ; cfe7 -- cgit v1.2.3 From b0d87604071b972b1667b3d2a4697c12a4a79160 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Mon, 15 Jul 2019 12:32:53 +0900 Subject: Analyze data from 6:51a4 --- src/engine/bank06.asm | 153 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 151 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 53821b6..4e0a662 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -1030,7 +1030,7 @@ Func_006_4f9c: ; 18f9c (6:4f9c) ld l, a ld h, 0 add hl, hl - ld de, $51a4 + ld de, Data_006_51a4 .asm_006_4fa8 add hl, de ld e, [hl] @@ -1336,7 +1336,156 @@ Func_006_5168: ; 19168 (6:5168) bank1call DrawDuelHUDs ret - INCROM $191a3, $1991f + ret + +Data_006_51a4: + dw $0000 + dw $52c6 + dw $52cf + dw $52c6 + dw $52c6 + dw $52c6 + dw $52d8 + dw $52d8 + dw $52e3 + dw $52d8 + dw $52f0 + dw $52f0 + dw $52f0 + dw $52f0 + dw $52fd + dw $5308 + dw $5313 + dw $531e + dw $5329 + dw $5334 + dw $533f + dw $534a + dw $5357 + dw $5362 + dw $5362 + dw $536d + dw $536d + dw $536d + dw $5378 + dw $5383 + dw $538e + dw $5383 + dw $5399 + dw $53a4 + dw $53af + dw $53ba + dw $53c5 + dw $53d0 + dw $53d5 + dw $53e0 + dw $53eb + dw $53f6 + dw $53f6 + dw $53f6 + dw $5401 + dw $540c + dw $5417 + dw $5422 + dw $542d + dw $542d + dw $5438 + dw $5438 + dw $5438 + dw $5438 + dw $5438 + dw $5443 + dw $5443 + dw $544e + dw $5443 + dw $5443 + dw $5443 + dw $5453 + dw $5453 + dw $5460 + dw $5453 + dw $5467 + dw $5467 + dw $5472 + dw $5472 + dw $547d + dw $5488 + dw $548f + dw $549c + dw $549c + dw $54a9 + dw $54a9 + dw $54ae + dw $54ae + dw $54b3 + dw $54be + dw $54c3 + dw $54c8 + dw $54d3 + dw $54e0 + dw $54eb + dw $54f2 + dw $54f9 + dw $5504 + dw $5513 + dw $5516 + dw $5521 + dw $552e + dw $5533 + dw $553a + dw $5543 + dw $554a + dw $5555 + dw $555e + dw $556d + dw $5574 + dw $557b + dw $557e + dw $5583 + dw $5583 + dw $5583 + dw $558c + dw $5597 + dw $559c + dw $55a1 + dw $55a4 + dw $55a9 + dw $55b4 + dw $55b4 + dw $55bf + dw $55c4 + dw $55c9 + dw $55ce + dw $55d5 + dw $55e0 + dw $55e5 + dw $55e6 + dw $55ed + dw $55f2 + dw $55fb + dw $55fe + dw $5601 + dw $5604 + dw $5607 + dw $560a + dw $560f + dw $5612 + dw $561d + dw $5628 + dw $562d + dw $5632 + dw $5637 + dw $5644 + dw $564f + dw $5654 + dw $5659 + dw $565e + dw $5665 + dw $5668 + dw $5673 + dw $5673 + + INCROM $192c6, $1991f Func_006_591f: add a -- cgit v1.2.3 From a0bb31e3ad38896ae69ff1500346e3f732284773 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Mon, 22 Jul 2019 22:46:14 +0200 Subject: More duel related disassembly and documentation --- src/constants/duel_constants.asm | 10 ++- src/engine/bank01.asm | 152 +++++++++++++++++++++++++++++++++------ src/engine/bank07.asm | 2 +- src/engine/effect_functions.asm | 77 +++++++++++++++++++- src/engine/home.asm | 63 ++++++++-------- src/wram.asm | 13 ++-- 6 files changed, 254 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index dd448aa..0f80a73 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -13,9 +13,10 @@ DUELTYPE_PRACTICE EQU $80 ; for normal duels (vs AI), wDuelType is $80 + [wOpponentDeckID] ; wDuelFinished constants -TURN_PLAYER_WON EQU $1 -TURN_PLAYER_LOST EQU $2 -TURN_PLAYER_TIED EQU $3 +DUEL_NOT_FINISHED EQU $0 +TURN_PLAYER_WON EQU $1 +TURN_PLAYER_LOST EQU $2 +TURN_PLAYER_TIED EQU $3 ; wDuelResult constants DUEL_WIN EQU $0 @@ -244,3 +245,6 @@ SELECT_CHECK EQU $02 const PRACTICEDUEL_REPEAT_INSTRUCTIONS const PRACTICEDUEL_PLAY_STARYU_FROM_BENCH const PRACTICEDUEL_REPLACE_KNOCKED_OUT_POKEMON + +; wAnimationQueue length +ANIMATION_QUEUE_LENGTH EQU 7 diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index f0ac3ae..a0d736c 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -1545,7 +1545,7 @@ Func_49a8: ; 49a8 (1:49a8) call DoFrame call CheckSkipDelayAllowed jr c, .asm_49c6 - call Func_3b52 + call CheckAnyAnimationPlaying jr c, .asm_49b9 .asm_49c6 call Func_3b31 @@ -2258,7 +2258,7 @@ Func_4e98: ; 4e98 (1:4e98) call DoFrame call CheckSkipDelayAllowed jr c, .asm_4edd - call Func_3b52 + call CheckAnyAnimationPlaying jr c, .asm_4ed0 .asm_4edd call Func_3b31 @@ -2277,7 +2277,7 @@ Func_4e98: ; 4e98 (1:4e98) call DoFrame call CheckSkipDelayAllowed jr c, .asm_4f28 - call Func_3b52 + call CheckAnyAnimationPlaying jr c, .asm_4ef4 ld hl, wNumCardsBeingDrawn inc [hl] @@ -2342,7 +2342,7 @@ Func_4f2d: ; 4f2d (1:4f2d) call DoFrame call CheckSkipDelayAllowed jr c, .asm_4f7d - call Func_3b52 + call CheckAnyAnimationPlaying jr c, .asm_4f70 .asm_4f7d call Func_3b31 @@ -6496,7 +6496,7 @@ OppActionTable: ; 695e (1:695e) dw OppAction_ExecuteTrainerCardEffectCommands dw OppAction_BeginUseAttack dw OppAction_UseAttack - dw OppAction_DealAttackDamage + dw OppAction_PlayAttackAnimation_DealAttackDamage dw OppAction_DrawCard dw OppAction_UsePokemonPower dw OppAction_ExecutePokemonPowerEffect @@ -6679,15 +6679,15 @@ OppAction_UseAttack: ; 6a8c (1:6a8c) ld [wSkipDuelistIsThinkingDelay], a ret .confusion_damage - call DealConfusionDamageToSelf + call HandleConfusionDamageToSelf ; end the turn if dealing damage to self due to confusion ld a, 1 ld [wOpponentTurnEnded], a ret ; 0x6ab1 -OppAction_DealAttackDamage: ; 6ab1 (1:6ab1) - call DealAttackDamage +OppAction_PlayAttackAnimation_DealAttackDamage: ; 6ab1 (1:6ab1) + call PlayAttackAnimation_DealAttackDamage ld a, 1 ld [wOpponentTurnEnded], a ret @@ -7016,7 +7016,7 @@ Func_6cab: ; 6cab (1:6cab) call Func_3b6a .asm_6cd8 call DoFrame - call Func_3b52 + call CheckAnyAnimationPlaying jr c, .asm_6cd8 call Func_6c7e.asm_6c98 ret @@ -7211,7 +7211,102 @@ ApplyStatusConditionToArenaPokemon: ; 6e38 (1:6e38) ; 0x6e49 Func_6e49: ; 6e49 (1:6e49) - INCROM $6e49, $700a + call HandleDestinyBondSubstatus + call ClearDamageReductionSubstatus2OfKnockedOutPokemon + xor a + ld [wcce8], a + call SwapTurn + call Func_6ef6 + call SwapTurn + ld a, [wcce8] + or a + jr z, .asm_6e86 + call $6ff7 + jr c, .asm_6e86 + call $6fc7 + ld c, a + call SwapTurn + call CountPrizes + call SwapTurn + dec a + cp c + jr c, .asm_6e86 + ld a, c + call SwapTurn + call DrawPrizes + call SwapTurn + ld a, $01 + jr .asm_6ecc +.asm_6e86 + call Func_6ef6 + ld a, [wcce8] + cp $01 + jr nz, .asm_6e9f + call SwapTurn + call $6ff7 + call SwapTurn + jr c, .asm_6e9f + ld a, $02 + jr .asm_6ecc +.asm_6e9f + call SwapTurn + call $6eff + call SwapTurn + call $6eff + ld a, [wcce8] + or a + jr nz, .asm_6ec4 + xor a +.asm_6eb2 + push af + call $6f08 + call SwapTurn + call $6f08 + call SwapTurn + call ShiftAllPokemonToFirstPlayAreaSlots + pop af + ret +.asm_6ec4 + ld e, a + ld d, $00 + ld hl, Data_6ed2 + add hl, de + ld a, [hl] +.asm_6ecc + ld [wDuelFinished], a + scf + jr .asm_6eb2 +; 0x6ed2 + +Data_6ed2: ; 6ed2 (1:6ed2) + db DUEL_NOT_FINISHED, TURN_PLAYER_LOST, TURN_PLAYER_WON, TURN_PLAYER_TIED + db TURN_PLAYER_LOST, TURN_PLAYER_LOST, TURN_PLAYER_TIED, TURN_PLAYER_LOST + db TURN_PLAYER_WON, TURN_PLAYER_TIED, TURN_PLAYER_WON, TURN_PLAYER_WON + db TURN_PLAYER_TIED, TURN_PLAYER_LOST, TURN_PLAYER_WON, TURN_PLAYER_TIED + +; clears SUBSTATUS2_REDUCE_BY_20, SUBSTATUS2_POUNCE, SUBSTATUS2_GROWL, +; SUBSTATUS2_TAIL_WAG, and SUBSTATUS2_LEER for each arena Pokemon with 0 HP +ClearDamageReductionSubstatus2OfKnockedOutPokemon: ; 6ee2 (1:6ee2) + call SwapTurn + call .clear + call SwapTurn +.clear + ld a, DUELVARS_ARENA_CARD_HP + call GetNonTurnDuelistVariable + or a + ret nz + call ClearDamageReductionSubstatus2 + ret +; 0x6ef6 + +Func_6ef6: ; 6ef6 (1:6ef6) + call $6fa5 + ld hl, wcce8 + rl [hl] + ret +; 0x6eff + + INCROM $6eff, $700a ; print one of the "There was no effect from" texts depending ; on the value at wNoEffectFromStatus (NO_STATUS or a status condition constant) @@ -7391,15 +7486,17 @@ PrizeBitmasks: ; 715a (1:715a) db %0, %1, %11, %111, %1111, %11111, %111111 ; 0x7161 -Func_7161: ; 7161 (1:7161) +; update the turn holder's DUELVARS_PRIZES following that duelist +; drawing a number of prizes equal to register a +DrawPrizes: ; 7161 (1:7161) or a ret z ld c, a call CountPrizes sub c - jr nc, .asm_716b + jr nc, .no_underflow xor a -.asm_716b +.no_underflow ld c, a ld b, $00 ld hl, PrizeBitmasks @@ -7555,7 +7652,7 @@ _TossCoin: ; 71ad (1:71ad) .asm_725e push de call DoFrame - call Func_3b52 + call CheckAnyAnimationPlaying pop de jr c, .asm_725e ld a, e @@ -7709,18 +7806,21 @@ Func_741a: ; 741a (1:741a) xor a ld [wd4b0], a push hl - farcall $6, $4f9c + farcall Func_006_4f9c pop hl jr .loop .done ret ; 0x7469 -Func_7469: ; 7469 (1:7469) +; this is a simple version of PlayAttackAnimation_DealAttackDamage that doesn't +; take into account status conditions, damage modifiers, etc, for damage calculation. +; used for confusion damage to self and for damage to benched Pokemon, for example +PlayAttackAnimation_DealAttackDamageSimple: ; 7469 (1:7469) push hl push de - call Func_7494 - call Func_7484 + call PlayMoveAnimation + call WaitMoveAnimation pop de pop hl call SubstractHP @@ -7735,20 +7835,26 @@ Func_7469: ; 7469 (1:7469) ret ; 0x7484 -Func_7484: ; 7484 (1:7484) +; if [wLoadedMoveAnimation] != 0, wait until the animation is over +WaitMoveAnimation: ; 7484 (1:7484) ld a, [wLoadedMoveAnimation] or a ret z push de -.asm_748a +.anim_loop call DoFrame - call Func_3b52 - jr c, .asm_748a + call CheckAnyAnimationPlaying + jr c, .anim_loop pop de ret ; 0x7494 -Func_7494: ; 7494 (1:7494) +; play move animation +; input: +; - [wLoadedMoveAnimation]: animation to play +; - de: damage dealt by the move (to display the animation with the number) +; - c: a wDamageEffectiveness constant (to print WEAK or RESIST if necessary) +PlayMoveAnimation: ; 7494 (1:7494) ldh a, [hWhoseTurn] push af push hl diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm index a79f27a..7c53b96 100644 --- a/src/engine/bank07.asm +++ b/src/engine/bank07.asm @@ -384,7 +384,7 @@ Func_1cb18: ; 1cb18 (7:4b18) ld a, [wd42a] cp $ff call nz, $4cd4 - ld hl, wd423 + ld hl, wAnimationQueue ld c, $07 .asm_1cb3b push bc diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index ab7bd38..116d545 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -109,7 +109,7 @@ Func_2c08a: ; 2c08a (b:408a) Func_2c08c: push de push af - ld a, $11 + ld a, OPPACTION_TOSS_COIN_A_TIMES call SetOppAction_SerialSendDuelData pop af pop de @@ -130,7 +130,39 @@ SetWasUnsuccessful: ; 2c0a2 (b:40a2) ret ; 0x2c0a8 - INCROM $2c0a8, $2c0d4 +Func_2c0a8: ; 2c0a8 (b:40a8) + ldh a, [hTemp_ffa0] + push af + ldh a, [hWhoseTurn] + ldh [hTemp_ffa0], a + ld a, OPPACTION_6B30 + call SetOppAction_SerialSendDuelData + bank1call Func_4f2d + ld c, a + pop af + ldh [hTemp_ffa0], a + ld a, c + ret +; 0x2c0bd + +Func_2c0bd: ; 2c0bd (b:40bd) + call ExchangeRNG + bank1call Func_4f2d + call ShuffleDeck + ret +; 0x2c0c7 + +Func_2c0c7: ; 2c0c7 (b:40c7) + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_PLAYER + jr z, .player + or a + ret +.player + scf + ret +; 0x2c0d4 ; Sets some flags for AI use ; if target poisoned @@ -184,7 +216,46 @@ Func_2c0fb: ; 2c0fb (b:40fb) ret ; 0x2c10b - INCROM $2c10b, $2c140 +Func_2c10b: ; 2c10b (b:410b) + ldh [hTempPlayAreaLocation_ff9d], a + bank1call Func_61a1 + bank1call PrintPlayAreaCardList_EnableLCD + bank1call Func_6194 + ret +; 0x2c117 + +; deal damage to all the turn holder's benched Pokemon +; input: a = amount of damage to deal to each Pokemon +DealDamageToAllBenchedPokemon: ; 2c117 (b:4117) + ld e, a + ld d, $00 + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + ld b, PLAY_AREA_ARENA + jr .skip_to_bench +.loop + push bc + call DealDamageToPlayAreaPokemon + pop bc +.skip_to_bench + inc b + dec c + jr nz, .loop + ret +; 0x2c12e + +Func_2c12e: ; 2c12e (b:412e) + ld [wLoadedMoveAnimation], a + ldh a, [hTempPlayAreaLocation_ff9d] + ld b, a + ld c, $0 ; neither WEAKNESS nor RESISTANCE + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call WaitMoveAnimation + ret +; 0x2c140 ; apply a status condition of type 1 identified by register a to the target ApplySubstatus1ToDefendingCard: ; 2c140 (b:4140) diff --git a/src/engine/home.asm b/src/engine/home.asm index 5271270..e6247c9 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -3290,8 +3290,8 @@ MoveDiscardPileCardToHand: ; 1182 (0:1182) ret ; 0x11a5 -; return in the z flag whether turn holder's prize a (0-7) has been taken or not -; z: taken, nz: not taken +; return in the z flag whether turn holder's prize a (0-7) has been drawn or not +; z: drawn, nz: not drawn CheckPrizeTaken: ; 11a5 (0:11a5) ld e, a ld d, 0 @@ -4293,9 +4293,9 @@ GetNonTurnDuelistVariable: ; 1611 (0:1611) ldh a, [hWhoseTurn] ld h, OPPONENT_TURN cp PLAYER_TURN - jr z, .asm_161c + jr z, .ok ld h, PLAYER_TURN -.asm_161c +.ok ld a, [hl] ret ; 0x161e @@ -4498,7 +4498,7 @@ UseAttackOrPokemonPower: ; 1730 (0:1730) ld a, EFFECTCMDTYPE_DISCARD_ENERGY call TryExecuteEffectCommandFunction call CheckSelfConfusionDamage - jp c, DealConfusionDamageToSelf + jp c, HandleConfusionDamageToSelf call DrawDuelMainScene_PrintPokemonsAttackText call WaitForWideTextBoxInput call ExchangeRNG @@ -4508,7 +4508,7 @@ UseAttackOrPokemonPower: ; 1730 (0:1730) call SetOppAction_SerialSendDuelData ; fallthrough -DealAttackDamage: ; 179a (0:179a) +PlayAttackAnimation_DealAttackDamage: ; 179a (0:179a) call Func_7415 ld a, [wLoadedMoveCategory] and RESIDUAL @@ -4534,9 +4534,9 @@ DealAttackDamage: ; 179a (0:179a) call GetNonTurnDuelistVariable push de push hl - call Func_7494 + call PlayMoveAnimation call Func_741a - call Func_7484 + call WaitMoveAnimation pop hl pop de call SubstractHP @@ -4579,9 +4579,11 @@ DisplayUsePokemonPowerScreen_WaitForInput: ; 1819 (0:1819) push hl call DisplayUsePokemonPowerScreen pop hl +; fallthrough DrawWideTextBox_WaitForInput_ReturnCarry: ; 181e (0:181e) call DrawWideTextBox_WaitForInput +; fallthrough ReturnCarry: ; 1821 (0:1821) scf @@ -4592,7 +4594,9 @@ ClearNonTurnTemporaryDuelvars_ResetCarry: ; 1823 (0:1823) or a ret -DealConfusionDamageToSelf: ; 1828 (0:1828) +; called when attacker deals damage to itself due to confusion +; display the corresponding animation and deal damage to self +HandleConfusionDamageToSelf: ; 1828 (0:1828) bank1call DrawDuelMainScene ld a, 1 ld [wIsDamageToSelf], a @@ -4601,7 +4605,7 @@ DealConfusionDamageToSelf: ; 1828 (0:1828) ld a, $75 ld [wLoadedMoveAnimation], a ld a, 20 ; damage - call Func_195c + call DealConfusionDamageToSelf call Func_1bb4 call Func_6e49 bank1call ClearNonTurnTemporaryDuelvars @@ -4775,8 +4779,7 @@ Func_1955: ; 1955 (0:1955) pop af ; fallthrough -; this function appears to handle dealing damage to self due to confusion -Func_195c: ; 195c (0:195c) +DealConfusionDamageToSelf: ; 195c (0:195c) ld hl, wDamage ld [hli], a ld [hl], 0 @@ -4789,13 +4792,13 @@ Func_195c: ; 195c (0:195c) push af ld a, [wTempTurnDuelistCardID] ld [wTempNonTurnDuelistCardID], a - bank1call ApplyDamageModifiers_DamageToSelf ; switch to bank 1, but call a home func + bank1call ApplyDamageModifiers_DamageToSelf ; this is at bank 0 ld a, [wDamageEffectiveness] ld c, a ld b, $0 ld a, DUELVARS_ARENA_CARD_HP call GetTurnDuelistVariable - bank1call Func_7469 + bank1call PlayAttackAnimation_DealAttackDamageSimple call PrintKnockedOutIfHLZero pop af ld [wTempNonTurnDuelistCardID], a @@ -5042,11 +5045,11 @@ PrintKnockedOut: ; 1ad3 (0:1ad3) ret ; 0x1af3 -; seems to be a function to deal damage to a card, but can be used -; to deal damage to a benched Pokemon. +; deal damage to turn holder's Pokemon card at play area location at b (PLAY_AREA_*). +; damage to deal is given in de. ; shows the defending player's play area screen when dealing the damage -; instead of the main duel interface, and has a fixed move animation -Func_1af3: ; 1af3 (0:1af3) +; instead of the main duel interface, and has a fixed move animation. +DealDamageToPlayAreaPokemon: ; 1af3 (0:1af3) ld a, $78 ld [wLoadedMoveAnimation], a ld a, b @@ -5110,7 +5113,7 @@ Func_1af3: ; 1af3 (0:1af3) ld b, a or a ; cp PLAY_AREA_ARENA jr nz, .benched - ; add damage at de to [wDealtDamage] + ; if arena Pokemon, add damage at de to [wDealtDamage] ld hl, wDealtDamage ld a, e add [hl] @@ -5123,7 +5126,7 @@ Func_1af3: ; 1af3 (0:1af3) add DUELVARS_ARENA_CARD_HP call GetTurnDuelistVariable push af - bank1call Func_7469 + bank1call PlayAttackAnimation_DealAttackDamageSimple pop af or a jr z, .skip_knocked_out @@ -10211,8 +10214,10 @@ IsPrehistoricPowerActive: ; 35b7 (0:35b7) ret ; 0x35c7 -; clears some SUBSTATUS2 conditions from the turn holder's active Pokemon -Func_35c7: ; 35c7 (0:35c7) +; clears some SUBSTATUS2 conditions from the turn holder's active Pokemon. +; more specifically, those conditions that reduce the damage from an attack +; or prevent the opposing Pokemon from attacking the substatus condition inducer. +ClearDamageReductionSubstatus2: ; 35c7 (0:35c7) ld a, DUELVARS_ARENA_CARD_SUBSTATUS2 call GetTurnDuelistVariable or a @@ -11215,19 +11220,21 @@ Func_3b31: ; 3b31 (0:3b31) call BankswitchROM ret -Func_3b52: ; 3b52 (0:3b52) +; return nc if wd42a, wd4c0, and wAnimationQueue[] are all equal to $ff +; nc means no animation is playing (or animation(s) has/have ended) +CheckAnyAnimationPlaying: ; 3b52 (0:3b52) push hl push bc ld a, [wd42a] ld hl, wd4c0 and [hl] - ld hl, wd423 - ld c, $7 -.asm_3b60 + ld hl, wAnimationQueue + ld c, ANIMATION_QUEUE_LENGTH +.loop and [hl] inc hl dec c - jr nz, .asm_3b60 + jr nz, .loop cp $ff pop bc pop hl @@ -11250,7 +11257,7 @@ Func_3b6a: ; 3b6a (0:3b6a) ld a, [wd4ac] cp [hl] jr nz, .asm_3b90 - call Func_3b52 + call CheckAnyAnimationPlaying jr nc, .asm_3b95 .asm_3b90 call $4a31 diff --git a/src/wram.asm b/src/wram.asm index 4210cf7..38ebd4a 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -161,7 +161,7 @@ wPlayerArenaCardChangedResistance:: ; c2ea wPlayerArenaCardSubstatus3:: ; c2eb ds $1 -; Each bit represents a prize (1 = not taken ; 0 = taken) +; each bit represents a prize that this duelist can draw (1 = not drawn ; 0 = drawn) wPlayerPrizes:: ; c2ec ds $1 @@ -982,6 +982,7 @@ wIsDamageToSelf:: ; cce6 wcce7:: ; cce7 ds $1 +wcce8:: ; cce8 ds $1 ; used in CopyDeckData @@ -1299,8 +1300,7 @@ wPrizeCardCursorPosition:: wce53:: ; ce53 ds $2 -; same as wDuelInitialPrizes but -; with upper 2 bits set +; same as wDuelInitialPrizes but with upper 2 bits set wDuelInitialPrizesUpperBitsSet:: ; ce55 ds $1 @@ -1990,8 +1990,11 @@ wd421:: ; d421 wd422:: ; d422 ds $1 -wd423:: ; d423 - ds $7 +; holds a list of animations to play +; as long as any of the slot isn't $ff, there's something to play +; it may actually not be a queue +wAnimationQueue:: ; d423 + ds ANIMATION_QUEUE_LENGTH wd42a:: ; d42a ds $1 -- cgit v1.2.3 From 0d2dce27ff7ad77a12f5182bbb8618d871446aa4 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Mon, 22 Jul 2019 22:51:01 +0200 Subject: Fix accidentailly renamed label --- src/constants/duel_constants.asm | 2 +- src/engine/bank01.asm | 4 ++-- src/engine/home.asm | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index 0f80a73..dd61a44 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -180,7 +180,7 @@ EFFECTCMDTYPE_UNKNOWN_08 EQU $08 const OPPACTION_EXECUTE_TRAINER_EFFECTS ; $07 const OPPACTION_BEGIN_ATTACK ; $08 const OPPACTION_USE_ATTACK ; $09 - const OPPACTION_DEAL_ATTACK_DAMAGE ; $0a + const OPPACTION_ATTACK_ANIM_AND_DAMAGE ; $0a const OPPACTION_DRAW_CARD ; $0b const OPPACTION_USE_PKMN_POWER ; $0c const OPPACTION_EXECUTE_PKMN_POWER_EFFECT ; $0d diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index a0d736c..6058fcd 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -6496,7 +6496,7 @@ OppActionTable: ; 695e (1:695e) dw OppAction_ExecuteTrainerCardEffectCommands dw OppAction_BeginUseAttack dw OppAction_UseAttack - dw OppAction_PlayAttackAnimation_DealAttackDamage + dw OppAction_PlayAttackAnimationDealAttackDamage dw OppAction_DrawCard dw OppAction_UsePokemonPower dw OppAction_ExecutePokemonPowerEffect @@ -6686,7 +6686,7 @@ OppAction_UseAttack: ; 6a8c (1:6a8c) ret ; 0x6ab1 -OppAction_PlayAttackAnimation_DealAttackDamage: ; 6ab1 (1:6ab1) +OppAction_PlayAttackAnimationDealAttackDamage: ; 6ab1 (1:6ab1) call PlayAttackAnimation_DealAttackDamage ld a, 1 ld [wOpponentTurnEnded], a diff --git a/src/engine/home.asm b/src/engine/home.asm index e6247c9..b46bc44 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -4504,7 +4504,7 @@ UseAttackOrPokemonPower: ; 1730 (0:1730) call ExchangeRNG ld a, EFFECTCMDTYPE_REQUIRE_SELECTION call TryExecuteEffectCommandFunction - ld a, OPPACTION_DEAL_ATTACK_DAMAGE + ld a, OPPACTION_ATTACK_ANIM_AND_DAMAGE call SetOppAction_SerialSendDuelData ; fallthrough -- cgit v1.2.3 From b7ee18f262b1d88582fdc55879f1abaad17cc5ce Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 23 Jul 2019 21:03:39 +0200 Subject: Disassemble and document code related to knocking out Pokemon and taking prizes --- src/engine/bank01.asm | 310 +++++++++++++++++++++++++++++++++++++++++++--- src/engine/home.asm | 4 +- src/text/text1.asm | 10 +- src/text/text2.asm | 4 +- src/text/text_offsets.asm | 14 +-- src/wram.asm | 9 +- 6 files changed, 316 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 6058fcd..433b120 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -852,7 +852,7 @@ CheckAbleToRetreat: ; 45bb (1:45bb) ret c call CheckIfActiveCardParalyzedOrAsleep ret c - call HasAlivePokemonOnBench + call HasAlivePokemonInBench jr c, .unable_to_retreat ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable @@ -2794,7 +2794,7 @@ PracticeDuel_ReplaceKnockedOutPokemon: ; 52b0 (1:52b0) cp PLAY_AREA_BENCH_1 ret z ; if player selected Drowzee instead (which is at PLAY_AREA_BENCH_2) - call HasAlivePokemonOnBench + call HasAlivePokemonInBench ldtx hl, SelectStaryuPracticeDuelText scf ; fallthrough @@ -3700,8 +3700,100 @@ DisplayCardPageOnLeftOrRightPressed: ; 57cd (1:57cd) ret ; 0x57df -Func_57df: - INCROM $57df, $5892 +Func_57df: ; 57df (1:57df) + push hl + call EmptyScreen + lb de, 0, 0 + lb bc, 20, 18 + call DrawRegularTextBox + ld a, 19 + lb de, 1, 1 + call InitTextPrintingInTextbox + call SetNoLineSeparation + pop hl + call ProcessTextFromID + call EnableLCD + call SetOneLineSeparation + call WaitForWideTextBoxInput + ret +; 0x5805 + +Func_5805: ; 5805 (1:5805) + call Func_3b31 + ld a, [wccc8] + ld l, a + ld h, $00 + call LoadTxRam3 + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_PLAYER + jr nz, .opponent + + ldtx hl, WillDrawNPrizesText + call DrawWideTextBox_WaitForInput + ld a, [wccc8] + call Func_310a + ld hl, hTemp_ffa0 + ld d, [hl] + inc hl + ld e, [hl] + call SerialSend8Bytes +.asm_582f + call ExchangeRNG + ld a, DUELVARS_PRIZES + call GetTurnDuelistVariable + or a + ret nz + scf + ret + +.opponent + call Func_588a + ldtx hl, WillDrawNPrizesText + call DrawWideTextBox_PrintText + call CountPrizes + ld [wcbfc], a + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_LINK_OPP + jr z, .link_opponent + call Func_2bd7 + ld c, DECK_SIZE +.asm_5858 + call DoFrame + dec c + jr nz, .asm_5858 + jr .asm_586f + +.link_opponent + call SerialRecv8Bytes + ld a, DUELVARS_PRIZES + call GetTurnDuelistVariable + ld [hl], d + ld a, e + cp $ff + call nz, AddCardToHand +.asm_586f + ld a, [wcbfc] + ld hl, wccc8 + cp [hl] + jr nc, .asm_587e + ld l, a + ld h, $00 + call LoadTxRam3 +.asm_587e + farcall Func_82b6 + ldtx hl, DrewNPrizesText + call DrawWideTextBox_WaitForInput + jr .asm_582f +; 0x588a + +Func_588a: ; 588a (1:588a) + ld l, PLAYER_TURN + ldh a, [hWhoseTurn] + ld h, a + jp DrawYourOrOppPlayAreaScreen_Bank0 +; 0x5892 ; display the previous valid card page DisplayPreviousCardPage: ; 5892 (1:5892) @@ -4985,7 +5077,7 @@ PrintPokemonCardLength: ; 5f9a (1:5f9a) ; return carry if the turn holder has any Pokemon with non-zero HP on the bench. ; return how many Pokemon with non-zero HP in b. ; does this by calculating how many Pokemon in play area minus one -HasAlivePokemonOnBench: ; 5fd9 (1:5fd9) +HasAlivePokemonInBench: ; 5fd9 (1:5fd9) ld a, $01 jr _HasAlivePokemonInPlayArea @@ -5186,7 +5278,7 @@ Func_60dd: ; 60dd (1:60dd) and SELECT jr z, .asm_60f2 .asm_6119 - call HasAlivePokemonOnBench + call HasAlivePokemonInBench ld a, $01 ld [wcbd4], a .asm_6121 @@ -6698,7 +6790,7 @@ OppAction_ForceSwitchActive: ; 6aba (1:6aba) ldtx hl, SelectPkmnOnBenchToSwitchWithActiveText call DrawWideTextBox_WaitForInput call SwapTurn - call HasAlivePokemonOnBench + call HasAlivePokemonInBench ld a, $01 ld [wcbd4], a .force_selection @@ -7221,9 +7313,9 @@ Func_6e49: ; 6e49 (1:6e49) ld a, [wcce8] or a jr z, .asm_6e86 - call $6ff7 + call Func_6ff7 jr c, .asm_6e86 - call $6fc7 + call CountKnockedOutPokemon ld c, a call SwapTurn call CountPrizes @@ -7233,7 +7325,7 @@ Func_6e49: ; 6e49 (1:6e49) jr c, .asm_6e86 ld a, c call SwapTurn - call DrawPrizes + call TakeAPrizes call SwapTurn ld a, $01 jr .asm_6ecc @@ -7243,25 +7335,25 @@ Func_6e49: ; 6e49 (1:6e49) cp $01 jr nz, .asm_6e9f call SwapTurn - call $6ff7 + call Func_6ff7 call SwapTurn jr c, .asm_6e9f ld a, $02 jr .asm_6ecc .asm_6e9f call SwapTurn - call $6eff + call Func_6eff call SwapTurn - call $6eff + call Func_6eff ld a, [wcce8] or a jr nz, .asm_6ec4 xor a .asm_6eb2 push af - call $6f08 + call MoveAllTurnHolderKnockedOutPokemonToDiscardPile call SwapTurn - call $6f08 + call MoveAllTurnHolderKnockedOutPokemonToDiscardPile call SwapTurn call ShiftAllPokemonToFirstPlayAreaSlots pop af @@ -7300,13 +7392,195 @@ ClearDamageReductionSubstatus2OfKnockedOutPokemon: ; 6ee2 (1:6ee2) ; 0x6ef6 Func_6ef6: ; 6ef6 (1:6ef6) - call $6fa5 + call Func_6fa5 ld hl, wcce8 rl [hl] ret ; 0x6eff - INCROM $6eff, $700a +Func_6eff: ; 6eff (1:6eff) + call ReplaceKnockedOutPokemon + ld hl, wcce8 + rl [hl] + ret +; 0x6f08 + +; for each Pokemon in the turn holder's play area (arena and bench), +; move that card to the discard pile if its HP is 0 +MoveAllTurnHolderKnockedOutPokemonToDiscardPile: ; 6f08 (1:6f08) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld d, a + ld l, DUELVARS_ARENA_CARD_HP + ld e, PLAY_AREA_ARENA +.loop + ld a, [hl] + or a + jr nz, .next + push hl + push de + call MovePlayAreaCardToDiscardPile + pop de + pop hl +.next + inc hl + inc e + dec d + jr nz, .loop + ret +; 0x6f23 + +; have the turn holder replace the arena Pokemon card when it's been knocked out. +; if there are no Pokemon cards in the turn holder's bench, return carry. +ReplaceKnockedOutPokemon: ; 6f23 (1:6f23) + ld a, DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + or a + ret nz + call ClearAllStatusConditions + call HasAlivePokemonInBench + jr nc, .can_replace_pokemon + +; if we made it here, the duelist can't replace the knocked out Pokemon + bank1call DrawDuelMainScene + ldtx hl, ThereAreNoPokemonInPlayAreaText + call DrawWideTextBox_WaitForInput + call ExchangeRNG + scf + ret + +.can_replace_pokemon + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_PLAYER + jr nz, .opponent + +; prompt the player to replace the knocked out Pokemon with one from bench + bank1call DrawDuelMainScene + ldtx hl, SelectPokemonToPlaceInTheArenaText + call DrawWideTextBox_WaitForInput + ld a, $01 + ld [wcbd4], a + ld a, PRACTICEDUEL_PLAY_STARYU_FROM_BENCH + call DoPracticeDuelAction +.select_pokemon + call OpenPlayAreaScreenForSelection + jr c, .select_pokemon + ldh a, [hTempPlayAreaLocation_ff9d] + call SerialSend8Bytes + +; replace the arena Pokemon with the one at location [hTempPlayAreaLocation_ff9d] +.replace_pokemon + call Func_3b31 + ld a, PRACTICEDUEL_REPLACE_KNOCKED_OUT_POKEMON + call DoPracticeDuelAction + jr c, .select_pokemon + ldh a, [hTempPlayAreaLocation_ff9d] + ld d, a + ld e, PLAY_AREA_ARENA + call SwapPlayAreaPokemon + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ldtx hl, DuelistPlacedACardText + bank1call DisplayCardDetailScreen + call ExchangeRNG + or a + ret + +; the AI opponent replaces the knocked out Pokemon with one from bench +.opponent + cp DUELIST_TYPE_LINK_OPP + jr z, .link_opponent + call Func_2bcf + ldh a, [hTemp_ffa0] + ldh [hTempPlayAreaLocation_ff9d], a + jr .replace_pokemon + +; wait for link opponent to replace the knocked out Pokemon with one from bench +.link_opponent + bank1call DrawDuelMainScene + ldtx hl, DuelistIsSelectingPokemonToPlaceInArenaText + call DrawWideTextBox_PrintText + call SerialRecv8Bytes + ldh [hTempPlayAreaLocation_ff9d], a + jr .replace_pokemon +; 0x6fa5 + +Func_6fa5: ; 6fa5 (1:6fa5) + call CountKnockedOutPokemon + ret nc + ; at least one Pokemon knocked out + call SwapTurn + bank1call Func_5805 + call SwapTurn + ret nc + call SwapTurn + bank1call DrawDuelMainScene + ldtx hl, TookAllThePrizesText + call DrawWideTextBox_WaitForInput + call ExchangeRNG + call SwapTurn + scf + ret +; 0x6fc7 + +; return in wccc8 the amount of Pokemon in the turn holder's +; play area that are still there despite having 0 HP. +; that is, the number of Pokemon that have just been knocked out. +; Clefairy Doll and Mysterious Fossil don't count. +CountKnockedOutPokemon: ; 6fc7 (1:6fc7) + ld a, DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + ld d, h + ld e, DUELVARS_ARENA_CARD + ld b, PLAY_AREA_ARENA + ld c, MAX_PLAY_AREA_POKEMON +.loop + ld a, [de] + cp -1 + jr z, .next ; jump if no Pokemon in this location + ld a, [hl] + or a + jr nz, .next ; jump if this Pokemon's HP isn't 0 + ; this Pokemon's HP has just become 0 + ld a, [de] + push de + call GetCardIDFromDeckIndex + call GetCardType + pop de + cp TYPE_TRAINER + jr z, .next ; jump if this is a trainer card (Clefairy Doll or Mysterious Fossil) + inc b +.next + inc hl + inc de + dec c + jr nz, .loop + ld a, b + ld [wccc8], a + or a + ret z + scf + ret +; 0x6ff7 + +Func_6ff7: ; 6ff7 (1:6ff7) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + ld l, DUELVARS_ARENA_CARD_HP +.loop + ld a, [hli] + or a + jr nz, .non_zero_hp + dec c + jr nz, .loop + scf + ret +.non_zero_hp + or a + ret +; 0x700a ; print one of the "There was no effect from" texts depending ; on the value at wNoEffectFromStatus (NO_STATUS or a status condition constant) @@ -7488,7 +7762,7 @@ PrizeBitmasks: ; 715a (1:715a) ; update the turn holder's DUELVARS_PRIZES following that duelist ; drawing a number of prizes equal to register a -DrawPrizes: ; 7161 (1:7161) +TakeAPrizes: ; 7161 (1:7161) or a ret z ld c, a diff --git a/src/engine/home.asm b/src/engine/home.asm index b46bc44..6ff4cbb 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -4023,8 +4023,8 @@ PutHandCardInPlayArea: ; 14d2 (0:14d2) ret ; 0x14dd -; move the play area Pokemon card of the turn holder at CARD_LOCATION_PLAY_AREA + a -; to the discard pile +; move the Pokemon card of the turn holder in the +; PLAY_AREA_* location given in e to the discard pile MovePlayAreaCardToDiscardPile: ; 14dd (0:14dd) call EmptyPlayAreaSlot ld l, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA diff --git a/src/text/text1.asm b/src/text/text1.asm index 8789758..075a9ef 100644 --- a/src/text/text1.asm +++ b/src/text/text1.asm @@ -277,15 +277,15 @@ DiscardDescription: ; 36757 (d:6757) line "a Pokémon Power)" done -Text0042: ; 367cc (d:67cc) +WillDrawNPrizesText: ; 367cc (d:67cc) text " will draw Prize(s)." done -Text0043: ; 367e5 (d:67e5) +DrewNPrizesText: ; 367e5 (d:67e5) text " drew Prize(s)." done -Text0044: ; 367f9 (d:67f9) +DuelistPlacedACardText: ; 367f9 (d:67f9) text " placed" line "a ." done @@ -561,12 +561,12 @@ CardsText: ; 36e63 (d:6e63) text "Cards" done -Text007f: ; 36e6a (d:6e6a) +TookAllThePrizesText: ; 36e6a (d:6e6a) text " took" line "all the Prizes!" done -Text0080: ; 36e82 (d:6e82) +ThereAreNoPokemonInPlayAreaText: ; 36e82 (d:6e82) text "There are no Pokémon" line "in 's Play Area!" done diff --git a/src/text/text2.asm b/src/text/text2.asm index 8dac791..97ecf45 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -126,12 +126,12 @@ SelectPkmnOnBenchToSwitchWithActiveText: ; 38533 (e:4533) line "to switch with the Active Pokémon." done -Text010f: ; 38575 (e:4575) +SelectPokemonToPlaceInTheArenaText: ; 38575 (e:4575) text "Select a Pokémon to place" line "in the Arena." done -Text0110: ; 3859e (e:459e) +DuelistIsSelectingPokemonToPlaceInArenaText: ; 3859e (e:459e) text " is selecting a Pokémon" line "to place in the Arena." done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 6e03ba2..cf89644 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -67,9 +67,9 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text003f ; 0x003f textpointer Text0040 ; 0x0040 textpointer DiscardDescription ; 0x0041 - textpointer Text0042 ; 0x0042 - textpointer Text0043 ; 0x0043 - textpointer Text0044 ; 0x0044 + textpointer WillDrawNPrizesText ; 0x0042 + textpointer DrewNPrizesText ; 0x0043 + textpointer DuelistPlacedACardText ; 0x0044 textpointer Text0045 ; 0x0045 textpointer Text0046 ; 0x0046 textpointer Text0047 ; 0x0047 @@ -128,8 +128,8 @@ TextOffsets:: ; 34000 (d:4000) textpointer NoneText ; 0x007c textpointer YesText ; 0x007d textpointer CardsText ; 0x007e - textpointer Text007f ; 0x007f - textpointer Text0080 ; 0x0080 + textpointer TookAllThePrizesText ; 0x007f + textpointer ThereAreNoPokemonInPlayAreaText ; 0x0080 textpointer WasKnockedOutText ; 0x0081 textpointer HavePokemonPowerText ; 0x0082 textpointer UnableToUsePkmnPowerDueToToxicGasText ; 0x0083 @@ -272,8 +272,8 @@ TextOffsets:: ; 34000 (d:4000) textpointer NoDamageOrEffectDueToTransparencyText ; 0x010c textpointer Text010d ; 0x010d textpointer SelectPkmnOnBenchToSwitchWithActiveText ; 0x010e - textpointer Text010f ; 0x010f - textpointer Text0110 ; 0x0110 + textpointer SelectPokemonToPlaceInTheArenaText ; 0x010f + textpointer DuelistIsSelectingPokemonToPlaceInArenaText ; 0x0110 textpointer Text0111 ; 0x0111 textpointer Text0112 ; 0x0112 textpointer Text0113 ; 0x0113 diff --git a/src/wram.asm b/src/wram.asm index 38ebd4a..7399551 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -780,6 +780,8 @@ wcbfa:: ; cbfa wcbfb:: ; cbfb ds $1 +; used by Func_5805 to store the remaining Prizes, so that if more than that +; amount would be taken, only the remaining amount is taken wcbfc:: ; cbfc ds $1 @@ -959,7 +961,12 @@ wSelectedMoveIndex:: ; ccc6 ; if affected by a no damage or effect substatus, this flag indicates what the cause was wNoDamageOrEffect:: ; ccc7 - ds $2 + ds $1 + +; used by CountKnockedOutPokemon and Func_5805 to store the amount +; of prizes to take (equal to the number of Pokemon knocked out) +wccc8:: ; ccc8 + ds $1 ; set to 1 if the coin toss in the confusion check is heads (CheckSelfConfusionDamage) wGotHeadsFromConfusionCheck:: ; ccc9 -- cgit v1.2.3 From 63631c6c7950b63a94e4cf5c5e414ed0019c0e72 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Wed, 24 Jul 2019 23:55:40 +0900 Subject: Changed namings related to InPlayArea --- src/engine/bank01.asm | 4 +- src/engine/bank02.asm | 6 +- src/engine/bank06.asm | 170 +++++++++++++++++++++++++------------------------- src/engine/home.asm | 6 +- src/wram.asm | 10 +-- 5 files changed, 98 insertions(+), 98 deletions(-) (limited to 'src') diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index e81f95d..ed02786 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -823,7 +823,7 @@ DuelMenuShortcut_BothActivePokemon: ; 458e (1:458e) ; 0x4597 Func_4597: ; 4597 (1:4597) - call Func_30a6 + call OpenInPlayAreaScreen_FromSelectButton ret c call Func_45a9 ret c @@ -6369,7 +6369,7 @@ Func_6862: ; 6862 (1:6862) ld a, [wcbff] or a jr nz, .asm_68ad - call Func_30a6 + call OpenInPlayAreaScreen_FromSelectButton jr .return_carry .asm_68ad call Func_4597 diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index acfd216..60d9826 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -430,7 +430,7 @@ Func_905a: ; 905a (2:505a) xor a ld [wceaf], a ld [wceb0], a - ld [wCheckCommandCounter], a + ld [wCheckMenuCursorBlinkCounter], a ret Func_9065: ; 9065 (2:5065) @@ -472,7 +472,7 @@ Func_9065: ; 9065 (2:5065) ld a, e ld [wceb0], a xor a - ld [wCheckCommandCounter], a + ld [wCheckMenuCursorBlinkCounter], a .asm_90a6 ldh a, [hKeysPressed] and A_BUTTON | B_BUTTON @@ -495,7 +495,7 @@ Func_9065: ; 9065 (2:5065) jr z, .asm_90ca call PlaySFX .asm_90ca - ld hl, wCheckCommandCounter + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] and $f diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 4e0a662..047418c 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -155,12 +155,12 @@ _CopyCardNameAndLevel_HalfwidthText: ; this function is called when the player is shown the appearance of the play area. ; it can be called in the command window from either pressing select button ; or selecting check command. -HandlePlayAreaView: ; 180d5 (6:40d5) +OpenInPlayAreaScreen: ; 180d5 (6:40d5) ld a, $05 - ld [wPlayAreaCursorPosition], a + ld [wInPlayAreaCursorPosition], a .start xor a - ld [wCheckCommandCounter], a + ld [wCheckMenuCursorBlinkCounter], a farcall $2, $42ce call EnableLCD call IsClairvoyanceActive @@ -172,12 +172,12 @@ HandlePlayAreaView: ; 180d5 (6:40d5) .clairvoyance_on ld de, PlayAreaViewTransitionTable2 .clairvoyance_off - ld hl, wPlayAreaInputTablePointer + ld hl, wInPlayAreaInputTablePointer ld [hl], e inc hl ld [hl], d - ld a, [wPlayAreaCursorPosition] - call PrintCardName_HandlePlayAreaView + ld a, [wInPlayAreaCursorPosition] + call PrintCardName_OpenInPlayAreaScreen .on_frame ld a, $01 ld [wVBlankOAMCopyToggle], a @@ -198,21 +198,21 @@ HandlePlayAreaView: ; 180d5 (6:40d5) jr nz, .toggle_view .handle_input - ld a, [wPlayAreaCursorPosition] - ld [wPlayAreaPreservedPosition_2], a + ld a, [wInPlayAreaCursorPosition] + ld [wInPlayAreaTemporaryCursorPosition], a call HandleInput_PlayArea jr c, .pressed - ld a, [wPlayAreaCursorPosition] + ld a, [wInPlayAreaCursorPosition] cp $10 ; player's hand - jp z, ShowPlayerHand_HandlePlayAreaView + jp z, ShowPlayerHand_OpenInPlayAreaScreen cp $11 ; opponent's hand - jp z, ShowOpponentHand_HandlePlayAreaView + jp z, ShowOpponentHand_OpenInPlayAreaScreen ; check if the cursor moved. - ld hl, wPlayAreaPreservedPosition_2 + ld hl, wInPlayAreaTemporaryCursorPosition cp [hl] - call nz, PrintCardName_HandlePlayAreaView + call nz, PrintCardName_OpenInPlayAreaScreen jr .on_frame @@ -238,16 +238,16 @@ HandlePlayAreaView: ; 180d5 (6:40d5) call HandleInput_PlayArea.non_draw_cursor lb de, $38, $9f call SetupText - ld a, [wPlayAreaCursorPosition] - ld [wPlayAreaPreservedPosition], a - ld hl, JumpTable_HandlePlayAreaView + ld a, [wInPlayAreaCursorPosition] + ld [wInPlayAreaPreservedPosition], a + ld hl, JumpTable_OpenInPlayAreaScreen call JumpToFunctionInTable - ld a, [wPlayAreaPreservedPosition] - ld [wPlayAreaCursorPosition], a + ld a, [wInPlayAreaPreservedPosition] + ld [wInPlayAreaCursorPosition], a jp .start -PrintCardName_HandlePlayAreaView: ; 18171 (6:4171) +PrintCardName_OpenInPlayAreaScreen: ; 18171 (6:4171) push af lb de, 1, 17 call InitTextPrinting @@ -282,7 +282,7 @@ PrintCardName_HandlePlayAreaView: ; 18171 (6:4171) cp $06 jr nc, .raw_string - ld a, [wPlayAreaCursorPosition] + ld a, [wInPlayAreaCursorPosition] cp $06 jr nc, .opponent_side @@ -315,7 +315,7 @@ PrintCardName_HandlePlayAreaView: ; 18171 (6:4171) ret .raw_string - ld a, [wPlayAreaCursorPosition] + ld a, [wInPlayAreaCursorPosition] cp $08 jr nc, .opponent_side_raw_string call PrintTextNoDelay @@ -327,7 +327,7 @@ PrintCardName_HandlePlayAreaView: ; 18171 (6:4171) call SwapTurn ret -ShowPlayerHand_HandlePlayAreaView: +ShowPlayerHand_OpenInPlayAreaScreen: lb de, $38, $9f call SetupText ldh a, [hWhoseTurn] @@ -335,11 +335,11 @@ ShowPlayerHand_HandlePlayAreaView: bank1call OpenTurnHolderPlayAreaScreen pop af ldh [hWhoseTurn], a - ld a, [wPlayAreaPreservedPosition] - ld [wPlayAreaCursorPosition], a - jp HandlePlayAreaView.start + ld a, [wInPlayAreaPreservedPosition] + ld [wInPlayAreaCursorPosition], a + jp OpenInPlayAreaScreen.start -ShowOpponentHand_HandlePlayAreaView: +ShowOpponentHand_OpenInPlayAreaScreen: lb de, $38, $9f call SetupText ldh a, [hWhoseTurn] @@ -347,31 +347,31 @@ ShowOpponentHand_HandlePlayAreaView: bank1call OpenNonTurnHolderPlayAreaScreen pop af ldh [hWhoseTurn], a - ld a, [wPlayAreaPreservedPosition] - ld [wPlayAreaCursorPosition], a - jp HandlePlayAreaView.start - -JumpTable_HandlePlayAreaView ; (6:4228) - dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x00: my bench pokemon 1 - dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x01: my bench pokemon 2 - dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x02: my bench pokemon 3 - dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x03: my bench pokemon 4 - dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x04: my bench pokemon 5 - dw ShowPlayerAreaPokemon_HandlePlayAreaView ; 0x05: my active pokemon - dw ShowPlayerHand_HandlePlayAreaView_2 ; 0x06: my hand - dw ShowPlayerDiscardPile_HandlePlayAreaView ; 0x07: my discard pile + ld a, [wInPlayAreaPreservedPosition] + ld [wInPlayAreaCursorPosition], a + jp OpenInPlayAreaScreen.start + +JumpTable_OpenInPlayAreaScreen ; (6:4228) + dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x00: my bench pokemon 1 + dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x01: my bench pokemon 2 + dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x02: my bench pokemon 3 + dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x03: my bench pokemon 4 + dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x04: my bench pokemon 5 + dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x05: my active pokemon + dw ShowPlayerHand_OpenInPlayAreaScreen_2 ; 0x06: my hand + dw ShowPlayerDiscardPile_OpenInPlayAreaScreen ; 0x07: my discard pile - dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x08: opp. active pokemon - dw ShowOpponentHand_HandlePlayAreaView_2 ; 0x09: opp. hand - dw ShowOpponentDiscardPile_HandlePlayAreaView ; 0x0a: opp. discard pile - dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0b: opp. bench pokemon 1 - dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0c: opp. bench pokemon 2 - dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0d: opp. bench pokemon 3 - dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0e: opp. bench pokemon 4 - dw ShowOpponentAreaPokemon_HandlePlayAreaView ; 0x0f: opp. bench pokemon 5 - -ShowPlayerAreaPokemon_HandlePlayAreaView: - ld a, [wPlayAreaCursorPosition] + dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x08: opp. active pokemon + dw ShowOpponentHand_OpenInPlayAreaScreen_2 ; 0x09: opp. hand + dw ShowOpponentDiscardPile_OpenInPlayAreaScreen ; 0x0a: opp. discard pile + dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0b: opp. bench pokemon 1 + dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0c: opp. bench pokemon 2 + dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0d: opp. bench pokemon 3 + dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0e: opp. bench pokemon 4 + dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0f: opp. bench pokemon 5 + +ShowPlayerAreaPokemon_OpenInPlayAreaScreen: + ld a, [wInPlayAreaCursorPosition] inc a cp $05 + 1 ; $05: my active pokemon jr nz, .on_bench @@ -389,8 +389,8 @@ ShowPlayerAreaPokemon_HandlePlayAreaView: bank1call OpenCardPage_FromCheckPlayArea ret -ShowOpponentAreaPokemon_HandlePlayAreaView: - ld a, [wPlayAreaCursorPosition] +ShowOpponentAreaPokemon_OpenInPlayAreaScreen: + ld a, [wInPlayAreaCursorPosition] sub $08 or a jr z, .on_bench @@ -410,7 +410,7 @@ ShowOpponentAreaPokemon_HandlePlayAreaView: call SwapTurn ret -ShowPlayerHand_HandlePlayAreaView_2: +ShowPlayerHand_OpenInPlayAreaScreen_2: ldh a, [hWhoseTurn] push af bank1call OpenTurnHolderHandScreen_Simple @@ -418,7 +418,7 @@ ShowPlayerHand_HandlePlayAreaView_2: ldh [hWhoseTurn], a ret -ShowOpponentHand_HandlePlayAreaView_2: +ShowOpponentHand_OpenInPlayAreaScreen_2: ldh a, [hWhoseTurn] push af bank1call OpenNonTurnHolderHandScreen_Simple @@ -426,7 +426,7 @@ ShowOpponentHand_HandlePlayAreaView_2: ldh [hWhoseTurn], a ret -ShowPlayerDiscardPile_HandlePlayAreaView: +ShowPlayerDiscardPile_OpenInPlayAreaScreen: ldh a, [hWhoseTurn] push af bank1call OpenTurnHolderDiscardPileScreen @@ -434,7 +434,7 @@ ShowPlayerDiscardPile_HandlePlayAreaView: ldh [hWhoseTurn], a ret -ShowOpponentDiscardPile_HandlePlayAreaView: +ShowOpponentDiscardPile_OpenInPlayAreaScreen: ldh a, [hWhoseTurn] push af bank1call OpenNonTurnHolderDiscardPileScreen @@ -460,7 +460,7 @@ TextIDTable_182bb: tx PKMNPowerText tx DoneText -; it's related to wPlayAreaInputTablePointer. +; 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. @@ -506,11 +506,11 @@ PlayAreaViewTransitionTable2: HandleInput_PlayArea: ; 183bb (6:43bb) xor a ld [wcfe3], a - ld hl, wPlayAreaInputTablePointer + ld hl, wInPlayAreaInputTablePointer ld e, [hl] inc hl ld d, [hl] - ld a, [wPlayAreaCursorPosition] + ld a, [wInPlayAreaCursorPosition] ld l, a ld h, $07 call HtimesL @@ -559,11 +559,11 @@ HandleInput_PlayArea: ; 183bb (6:43bb) ld a, [hl] .process_dpad push af - ld a, [wPlayAreaCursorPosition] - ld [wPlayAreaPreservedPosition], a + ld a, [wInPlayAreaCursorPosition] + ld [wInPlayAreaPreservedPosition], a pop af - ld [wPlayAreaCursorPosition], a + ld [wInPlayAreaCursorPosition], a cp $05 jr c, .player_area @@ -583,12 +583,12 @@ HandleInput_PlayArea: ; 183bb (6:43bb) ; no pokemon in player's bench. ; then move to player's hand. ld a, $10 - ld [wPlayAreaCursorPosition], a + ld [wInPlayAreaCursorPosition], a jr .next .bench_pokemon_exists ld b, a - ld a, [wPlayAreaCursorPosition] + ld a, [wInPlayAreaCursorPosition] cp b jr c, .next @@ -598,13 +598,13 @@ HandleInput_PlayArea: ; 183bb (6:43bb) jr z, .on_left xor a - ld [wPlayAreaCursorPosition], a + ld [wInPlayAreaCursorPosition], a jr .next .on_left ld a, b dec a - ld [wPlayAreaCursorPosition], a + ld [wInPlayAreaCursorPosition], a jr .next .opponent_area @@ -614,12 +614,12 @@ HandleInput_PlayArea: ; 183bb (6:43bb) jr nz, .bench_pokemon_exists_2 ld a, $11 - ld [wPlayAreaCursorPosition], a + ld [wInPlayAreaCursorPosition], a jr .next .bench_pokemon_exists_2 ld b, a - ld a, [wPlayAreaCursorPosition] + ld a, [wInPlayAreaCursorPosition] sub $0b cp b jr c, .next @@ -629,18 +629,18 @@ HandleInput_PlayArea: ; 183bb (6:43bb) jr z, .on_right ld a, $0b - ld [wPlayAreaCursorPosition], a + ld [wInPlayAreaCursorPosition], a jr .next .on_right ld a, b add $0a - ld [wPlayAreaCursorPosition], a + ld [wInPlayAreaCursorPosition], a .next ld a, $01 ld [wcfe3], a xor a - ld [wCheckCommandCounter], a + ld [wCheckMenuCursorBlinkCounter], a .check_button ldh a, [hKeysPressed] and A_BUTTON | B_BUTTON @@ -659,7 +659,7 @@ HandleInput_PlayArea: ; 183bb (6:43bb) call .draw_cursor ld a, $01 farcall Func_90fb - ld a, [wPlayAreaCursorPosition] + ld a, [wInPlayAreaCursorPosition] scf ret @@ -669,7 +669,7 @@ HandleInput_PlayArea: ; 183bb (6:43bb) jr z, .skip_sfx call PlaySFX .skip_sfx - ld hl, wCheckCommandCounter + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] and $10 - 1 @@ -680,11 +680,11 @@ HandleInput_PlayArea: ; 183bb (6:43bb) .draw_cursor ; 184a0 (6:44a0) call ZeroObjectPositions - ld hl, wPlayAreaInputTablePointer + ld hl, wInPlayAreaInputTablePointer ld e, [hl] inc hl ld d, [hl] - ld a, [wPlayAreaCursorPosition] + ld a, [wInPlayAreaCursorPosition] ld l, a ld h, $07 call HtimesL @@ -712,16 +712,16 @@ Func_006_44c8: ; (6:44c8) call Func_006_452b xor a - ld [wPlayAreaCursorPosition], a + ld [wInPlayAreaCursorPosition], a ld de, $4c8e ; this data is stored in bank 2. - ld hl, wPlayAreaInputTablePointer + ld hl, wInPlayAreaInputTablePointer ld [hl], e inc hl ld [hl], d ld a, $ff ld [wce55], a xor a - ld [wCheckCommandCounter], a + ld [wCheckMenuCursorBlinkCounter], a .next ld a, $01 ld [wVBlankOAMCopyToggle], a @@ -750,7 +750,7 @@ Func_006_44c8: ; (6:44c8) call Func_006_4598 call Func_006_452b xor a - ld [wCheckCommandCounter], a + ld [wCheckMenuCursorBlinkCounter], a jr .next .on_select @@ -965,7 +965,7 @@ GlossaryData_2: ld a, e ld [wceb0], a xor a - ld [wCheckCommandCounter], a + ld [wCheckMenuCursorBlinkCounter], a .asm_006_46a2 ldh a, [hKeysPressed] and $03 @@ -988,7 +988,7 @@ GlossaryData_2: jr z, .asm_006_46c6 call PlaySFX .asm_006_46c6 - ld hl, wCheckCommandCounter + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] and $0f @@ -2241,7 +2241,7 @@ NamingScreen_CheckButtonState: ld a, h ld [wNamingScreenCursorX], a xor a - ld [wCheckCommandCounter], a + ld [wCheckMenuCursorBlinkCounter], a ld a, $06 cp d jp z, NamingScreen_CheckButtonState @@ -2267,7 +2267,7 @@ NamingScreen_CheckButtonState: jr z, .asm_006_69f8 call PlaySFX .asm_006_69f8 - ld hl, wCheckCommandCounter + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] and $0f @@ -3038,7 +3038,7 @@ Func_006_6efb: ld a, h ld [wNamingScreenCursorX], a xor a - ld [wCheckCommandCounter], a + ld [wCheckMenuCursorBlinkCounter], a ld a, $02 cp d jp z, Func_006_6efb @@ -3064,7 +3064,7 @@ Func_006_6efb: jr z, .asm_006_6f92 call PlaySFX .asm_006_6f92 - ld hl, wCheckCommandCounter + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] and $0f diff --git a/src/engine/home.asm b/src/engine/home.asm index 7739545..69cb3b5 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -9286,14 +9286,14 @@ Func_3096: ; 3096 (0:3096) call BankswitchROM ret -Func_30a6: ; 30a6 (0:30a6) +OpenInPlayAreaScreen_FromSelectButton: ; 30a6 (0:30a6) ldh a, [hBankROM] push af - ld a, BANK(HandlePlayAreaView) + ld a, BANK(OpenInPlayAreaScreen) call BankswitchROM ld a, $1 ld [wIsFromSelectButton], a - call HandlePlayAreaView + call OpenInPlayAreaScreen pop bc ld a, b call BankswitchROM diff --git a/src/wram.asm b/src/wram.asm index 5807f90..a3fcff1 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1293,12 +1293,12 @@ wce51:: ; ce51 ; in the display of play area. ; note that it's used in neither ; player's nor opponent's alone. -wPlayAreaCursorPosition:: ; ce52 +wInPlayAreaCursorPosition:: ; ce52 ds $1 ; pointer to the table which contains ; information for each key-press. -wPlayAreaInputTablePointer:: ; ce53 +wInPlayAreaInputTablePointer:: ; ce53 ds $2 wce55:: ; ce55 @@ -1307,12 +1307,12 @@ wce55:: ; ce55 ; it's used for restore the position of cursor ; when going into another view, and returning to ; the previous view. -wPlayAreaPreservedPosition:: ; ce57 +wInPlayAreaPreservedPosition:: ; ce57 ds $1 ; it's used for checking if the player changed ; the cursor in the play area view. -wPlayAreaPreservedPosition_2:: ; ce58 +wInPlayAreaTemporaryCursorPosition:: ; ce58 ds $1 wce59:: ; ce59 @@ -1416,7 +1416,7 @@ wcea1:: ; cea1 ; it increases from 0x00 to 0xff. ; the game makes its blinking cursor by this. ; note that the check command contains the pokemon glossary. -wCheckCommandCounter:: ; cea3 +wCheckMenuCursorBlinkCounter:: ; cea3 ds $1 wNamingScreenCursorY:: ; cea4 -- cgit v1.2.3 From 618a904a49ebe85e4c66c0081c71b7626baff7e6 Mon Sep 17 00:00:00 2001 From: jidoc01 Date: Thu, 25 Jul 2019 00:29:40 +0900 Subject: Changed namings related to OpenInPlayAreaScreen --- src/engine/bank06.asm | 92 +++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 047418c..c3a26c4 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -166,18 +166,18 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) call IsClairvoyanceActive jr c, .clairvoyance_on - ld de, PlayAreaViewTransitionTable1 + ld de, OpenInPlayAreaScreen_TransitionTable1 jr .clairvoyance_off .clairvoyance_on - ld de, PlayAreaViewTransitionTable2 + ld de, OpenInPlayAreaScreen_TransitionTable2 .clairvoyance_off ld hl, wInPlayAreaInputTablePointer ld [hl], e inc hl ld [hl], d ld a, [wInPlayAreaCursorPosition] - call PrintCardName_OpenInPlayAreaScreen + call .print_card_name .on_frame ld a, $01 ld [wVBlankOAMCopyToggle], a @@ -200,19 +200,19 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) .handle_input ld a, [wInPlayAreaCursorPosition] ld [wInPlayAreaTemporaryCursorPosition], a - call HandleInput_PlayArea + call OpenInPlayAreaScreen_HandleInput jr c, .pressed ld a, [wInPlayAreaCursorPosition] cp $10 ; player's hand - jp z, ShowPlayerHand_OpenInPlayAreaScreen + jp z, .show_turn_holder_hand cp $11 ; opponent's hand - jp z, ShowOpponentHand_OpenInPlayAreaScreen + jp z, .show_non_turn_holder_hand ; check if the cursor moved. ld hl, wInPlayAreaTemporaryCursorPosition cp [hl] - call nz, PrintCardName_OpenInPlayAreaScreen + call nz, .print_card_name jr .on_frame @@ -221,33 +221,33 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) jr nz, .selection ; pressed b button. - call HandleInput_PlayArea.non_draw_cursor + call OpenInPlayAreaScreen_HandleInput.non_draw_cursor lb de, $38, $9f call SetupText scf ret .toggle_view - call HandleInput_PlayArea.non_draw_cursor + call OpenInPlayAreaScreen_HandleInput.non_draw_cursor lb de, $38, $9f call SetupText or a ret .selection ; pressed a button or start button. - call HandleInput_PlayArea.non_draw_cursor + call OpenInPlayAreaScreen_HandleInput.non_draw_cursor lb de, $38, $9f call SetupText ld a, [wInPlayAreaCursorPosition] ld [wInPlayAreaPreservedPosition], a - ld hl, JumpTable_OpenInPlayAreaScreen + ld hl, .jump_table call JumpToFunctionInTable ld a, [wInPlayAreaPreservedPosition] ld [wInPlayAreaCursorPosition], a jp .start -PrintCardName_OpenInPlayAreaScreen: ; 18171 (6:4171) +.print_card_name ; 18171 (6:4171) push af lb de, 1, 17 call InitTextPrinting @@ -264,7 +264,7 @@ PrintCardName_OpenInPlayAreaScreen: ; 18171 (6:4171) lb de, 1, 17 call InitTextPrinting pop af - ld hl, TextIDTable_182bb + ld hl, OpenInPlayAreaScreen_TextTable ld b, 0 sla a ld c, a @@ -327,7 +327,7 @@ PrintCardName_OpenInPlayAreaScreen: ; 18171 (6:4171) call SwapTurn ret -ShowPlayerHand_OpenInPlayAreaScreen: +.show_turn_holder_hand lb de, $38, $9f call SetupText ldh a, [hWhoseTurn] @@ -337,9 +337,9 @@ ShowPlayerHand_OpenInPlayAreaScreen: ldh [hWhoseTurn], a ld a, [wInPlayAreaPreservedPosition] ld [wInPlayAreaCursorPosition], a - jp OpenInPlayAreaScreen.start + jp .start -ShowOpponentHand_OpenInPlayAreaScreen: +.show_non_turn_holder_hand lb de, $38, $9f call SetupText ldh a, [hWhoseTurn] @@ -349,28 +349,28 @@ ShowOpponentHand_OpenInPlayAreaScreen: ldh [hWhoseTurn], a ld a, [wInPlayAreaPreservedPosition] ld [wInPlayAreaCursorPosition], a - jp OpenInPlayAreaScreen.start - -JumpTable_OpenInPlayAreaScreen ; (6:4228) - dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x00: my bench pokemon 1 - dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x01: my bench pokemon 2 - dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x02: my bench pokemon 3 - dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x03: my bench pokemon 4 - dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x04: my bench pokemon 5 - dw ShowPlayerAreaPokemon_OpenInPlayAreaScreen ; 0x05: my active pokemon - dw ShowPlayerHand_OpenInPlayAreaScreen_2 ; 0x06: my hand - dw ShowPlayerDiscardPile_OpenInPlayAreaScreen ; 0x07: my discard pile + jp .start + +.jump_table ; (6:4228) + dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x00: my bench pokemon 1 + dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x01: my bench pokemon 2 + dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x02: my bench pokemon 3 + dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x03: my bench pokemon 4 + dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x04: my bench pokemon 5 + dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x05: my active pokemon + dw OpenInPlayAreaScreen_ShowTurnHolderHand ; 0x06: my hand + dw OpenInPlayAreaScreen_ShowPlayerDiscardPile ; 0x07: my discard pile - dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x08: opp. active pokemon - dw ShowOpponentHand_OpenInPlayAreaScreen_2 ; 0x09: opp. hand - dw ShowOpponentDiscardPile_OpenInPlayAreaScreen ; 0x0a: opp. discard pile - dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0b: opp. bench pokemon 1 - dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0c: opp. bench pokemon 2 - dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0d: opp. bench pokemon 3 - dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0e: opp. bench pokemon 4 - dw ShowOpponentAreaPokemon_OpenInPlayAreaScreen ; 0x0f: opp. bench pokemon 5 - -ShowPlayerAreaPokemon_OpenInPlayAreaScreen: + dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x08: opp. active pokemon + dw OpenInPlayAreaScreen_ShowNonTurnHolderHand ; 0x09: opp. hand + dw OpenInPlayAreaScreen_ShowOpponentDiscardPile ; 0x0a: opp. discard pile + dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0b: opp. bench pokemon 1 + dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0c: opp. bench pokemon 2 + dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0d: opp. bench pokemon 3 + dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0e: opp. bench pokemon 4 + dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0f: opp. bench pokemon 5 + +OpenInPlayAreaScreen_ShowPlayerAreaPokemon: ld a, [wInPlayAreaCursorPosition] inc a cp $05 + 1 ; $05: my active pokemon @@ -389,7 +389,7 @@ ShowPlayerAreaPokemon_OpenInPlayAreaScreen: bank1call OpenCardPage_FromCheckPlayArea ret -ShowOpponentAreaPokemon_OpenInPlayAreaScreen: +OpenInPlayAreaScreen_ShowOpponentAreaPokemon: ld a, [wInPlayAreaCursorPosition] sub $08 or a @@ -410,7 +410,7 @@ ShowOpponentAreaPokemon_OpenInPlayAreaScreen: call SwapTurn ret -ShowPlayerHand_OpenInPlayAreaScreen_2: +OpenInPlayAreaScreen_ShowTurnHolderHand: ldh a, [hWhoseTurn] push af bank1call OpenTurnHolderHandScreen_Simple @@ -418,7 +418,7 @@ ShowPlayerHand_OpenInPlayAreaScreen_2: ldh [hWhoseTurn], a ret -ShowOpponentHand_OpenInPlayAreaScreen_2: +OpenInPlayAreaScreen_ShowNonTurnHolderHand: ldh a, [hWhoseTurn] push af bank1call OpenNonTurnHolderHandScreen_Simple @@ -426,7 +426,7 @@ ShowOpponentHand_OpenInPlayAreaScreen_2: ldh [hWhoseTurn], a ret -ShowPlayerDiscardPile_OpenInPlayAreaScreen: +OpenInPlayAreaScreen_ShowPlayerDiscardPile: ldh a, [hWhoseTurn] push af bank1call OpenTurnHolderDiscardPileScreen @@ -434,7 +434,7 @@ ShowPlayerDiscardPile_OpenInPlayAreaScreen: ldh [hWhoseTurn], a ret -ShowOpponentDiscardPile_OpenInPlayAreaScreen: +OpenInPlayAreaScreen_ShowOpponentDiscardPile: ldh a, [hWhoseTurn] push af bank1call OpenNonTurnHolderDiscardPileScreen @@ -442,7 +442,7 @@ ShowOpponentDiscardPile_OpenInPlayAreaScreen: ldh [hWhoseTurn], a ret -TextIDTable_182bb: +OpenInPlayAreaScreen_TextTable: tx HandText tx CheckText tx AttackText @@ -465,7 +465,7 @@ TextIDTable_182bb: ; 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. -PlayAreaViewTransitionTable1: +OpenInPlayAreaScreen_TransitionTable1: ; cursor x pos. / cursor y pos. / attribute / idx-up / idx-down / idx-right / idx-left db $18, $8c, $00, $05, $10, $01, $04 db $30, $8c, $00, $05, $10, $02, $00 @@ -484,7 +484,7 @@ PlayAreaViewTransitionTable1: db $48, $14, $20, $11, $08, $0d, $0f db $30, $14, $20, $11, $08, $0e, $0b -PlayAreaViewTransitionTable2: +OpenInPlayAreaScreen_TransitionTable2: ; same as 1. db $18, $8c, $00, $05, $10, $01, $04 db $30, $8c, $00, $05, $10, $02, $00 @@ -503,7 +503,7 @@ PlayAreaViewTransitionTable2: db $48, $14, $20, $11, $08, $0d, $0f db $30, $14, $20, $11, $08, $0e, $0b -HandleInput_PlayArea: ; 183bb (6:43bb) +OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) xor a ld [wcfe3], a ld hl, wInPlayAreaInputTablePointer -- cgit v1.2.3 From d79d138ffe16800e99e564b4c7729e437e36d41e Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 25 Jul 2019 15:40:03 +0200 Subject: Fix #52 post-merge build issues --- src/engine/bank02.asm | 4 ++-- src/wram.asm | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index a4a0f62..c969add 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -35,8 +35,8 @@ _OpenDuelCheckMenu: ; 8000 (2:4000) ; opens the In Play Area submenu DuelCheckMenu_InPlayArea: ; 8039 (2:4039) xor a - ld [wce60], a - farcall Func_180d5 + ld [wIsFromSelectButton], a + farcall OpenInPlayAreaScreen ret ; opens the Glossary submenu diff --git a/src/wram.asm b/src/wram.asm index 97ce581..18b0a04 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1308,12 +1308,14 @@ wPrizeCardCursorPosition:: ; ce52 ; pointer to the table which contains information for each key-press. wInPlayAreaInputTablePointer:: ; ce53 + +wce53:: ; ce53 ds $2 ; same as wDuelInitialPrizes but with upper 2 bits set wDuelInitialPrizesUpperBitsSet:: ; ce55 ds $1 - + ds $1 ; it's used for restore the position of cursor -- cgit v1.2.3 From b5ea62817b418bbd87b372236cd0619d10f9ba3b Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 25 Jul 2019 16:02:33 +0200 Subject: Minor bank6 clean up --- src/engine/bank02.asm | 2 +- src/engine/bank06.asm | 106 +++++++++++++++++++++++++------------------------- src/engine/home.asm | 2 +- src/wram.asm | 6 ++- 4 files changed, 60 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index c969add..79d8996 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -35,7 +35,7 @@ _OpenDuelCheckMenu: ; 8000 (2:4000) ; opens the In Play Area submenu DuelCheckMenu_InPlayArea: ; 8039 (2:4039) xor a - ld [wIsFromSelectButton], a + ld [wInPlayAreaFromSelectButton], a farcall OpenInPlayAreaScreen ret diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index d08e6e7..4517d03 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -152,9 +152,9 @@ _CopyCardNameAndLevel_HalfwidthText: ret ; 0x180d5 -; this function is called when the player is shown the appearance of the play area. -; it can be called in the command window from either pressing select button -; or selecting check command. +; this function is called when the player is shown the "In Play Area" screen. +; it can be called with either the select button (DuelMenuShortcut_BothActivePokemon), +; or via the "In Play Area" item of the Check menu (DuelCheckMenu_InPlayArea) OpenInPlayAreaScreen: ; 180d5 (6:40d5) ld a, $05 ld [wInPlayAreaCursorPosition], a @@ -188,10 +188,10 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) jr nz, .selection ; if this function's been called from 'select' button, - ; wIsFromSelectButton is on. - ld a, [wIsFromSelectButton] + ; wInPlayAreaFromSelectButton is on. + ld a, [wInPlayAreaFromSelectButton] or a - jr z, .handle_input ; if it's from the check command, jump. + jr z, .handle_input ; if it's from the Check menu, jump. ldh a, [hDPadHeld] and SELECT @@ -213,7 +213,7 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) ld hl, wInPlayAreaTemporaryCursorPosition cp [hl] call nz, .print_card_name - + jr .on_frame .pressed @@ -221,21 +221,21 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) jr nz, .selection ; pressed b button. - call OpenInPlayAreaScreen_HandleInput.non_draw_cursor + call ZeroObjectPositionsAndToggleOAMCopy_Bank6 lb de, $38, $9f call SetupText scf ret .toggle_view - call OpenInPlayAreaScreen_HandleInput.non_draw_cursor + call ZeroObjectPositionsAndToggleOAMCopy_Bank6 lb de, $38, $9f call SetupText or a ret .selection ; pressed a button or start button. - call OpenInPlayAreaScreen_HandleInput.non_draw_cursor + call ZeroObjectPositionsAndToggleOAMCopy_Bank6 lb de, $38, $9f call SetupText ld a, [wInPlayAreaCursorPosition] @@ -268,18 +268,18 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) ld b, 0 sla a ld c, a - add hl, bc ; hl = TextIDTable_182bb + 2 * (wPlayAreaCursorPostion) + add hl, bc ; hl = OpenInPlayAreaScreen_TextTable + 2 * (wInPlayAreaCursorPosition) ld a, [hli] ld h, [hl] ld l, a ld a, h - + or a jr nz, .raw_string ld a, l - cp $06 + cp TX_HALFWIDTH jr nc, .raw_string ld a, [wInPlayAreaCursorPosition] @@ -352,25 +352,26 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) jp .start .jump_table ; (6:4228) - dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x00: my bench pokemon 1 - dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x01: my bench pokemon 2 - dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x02: my bench pokemon 3 - dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x03: my bench pokemon 4 - dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x04: my bench pokemon 5 - dw OpenInPlayAreaScreen_ShowPlayerAreaPokemon ; 0x05: my active pokemon - dw OpenInPlayAreaScreen_ShowTurnHolderHand ; 0x06: my hand - dw OpenInPlayAreaScreen_ShowPlayerDiscardPile ; 0x07: my discard pile - - dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x08: opp. active pokemon - dw OpenInPlayAreaScreen_ShowNonTurnHolderHand ; 0x09: opp. hand - dw OpenInPlayAreaScreen_ShowOpponentDiscardPile ; 0x0a: opp. discard pile - dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0b: opp. bench pokemon 1 - dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0c: opp. bench pokemon 2 - dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0d: opp. bench pokemon 3 - dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0e: opp. bench pokemon 4 - dw OpenInPlayAreaScreen_ShowOpponentAreaPokemon ; 0x0f: opp. bench pokemon 5 - -OpenInPlayAreaScreen_ShowPlayerAreaPokemon: + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x00: my bench pokemon 1 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x01: my bench pokemon 2 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x02: my bench pokemon 3 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x03: my bench pokemon 4 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x04: my bench pokemon 5 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x05: my active pokemon + dw OpenInPlayAreaScreen_TurnHolderHand ; 0x06: my hand + dw OpenInPlayAreaScreen_TurnHolderDiscardPile ; 0x07: my discard pile + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x08: opp. active pokemon + dw OpenInPlayAreaScreen_NonTurnHolderHand ; 0x09: opp. hand + dw OpenInPlayAreaScreen_NonTurnHolderDiscardPile ; 0x0a: opp. discard pile + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0b: opp. bench pokemon 1 + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0c: opp. bench pokemon 2 + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0d: opp. bench pokemon 3 + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0e: opp. bench pokemon 4 + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0f: opp. bench pokemon 5 + +OpenInPlayAreaScreen_TurnHolderPlayArea: + ; wInPlayAreaCursorPosition constants conveniently map to (PLAY_AREA_* constants - 1) + ; for bench locations. this mapping is taken for granted in the following code. ld a, [wInPlayAreaCursorPosition] inc a cp $05 + 1 ; $05: my active pokemon @@ -389,7 +390,7 @@ OpenInPlayAreaScreen_ShowPlayerAreaPokemon: bank1call OpenCardPage_FromCheckPlayArea ret -OpenInPlayAreaScreen_ShowOpponentAreaPokemon: +OpenInPlayAreaScreen_NonTurnHolderPlayArea: ld a, [wInPlayAreaCursorPosition] sub $08 or a @@ -410,7 +411,7 @@ OpenInPlayAreaScreen_ShowOpponentAreaPokemon: call SwapTurn ret -OpenInPlayAreaScreen_ShowTurnHolderHand: +OpenInPlayAreaScreen_TurnHolderHand: ldh a, [hWhoseTurn] push af bank1call OpenTurnHolderHandScreen_Simple @@ -418,7 +419,7 @@ OpenInPlayAreaScreen_ShowTurnHolderHand: ldh [hWhoseTurn], a ret -OpenInPlayAreaScreen_ShowNonTurnHolderHand: +OpenInPlayAreaScreen_NonTurnHolderHand: ldh a, [hWhoseTurn] push af bank1call OpenNonTurnHolderHandScreen_Simple @@ -426,7 +427,7 @@ OpenInPlayAreaScreen_ShowNonTurnHolderHand: ldh [hWhoseTurn], a ret -OpenInPlayAreaScreen_ShowPlayerDiscardPile: +OpenInPlayAreaScreen_TurnHolderDiscardPile: ldh a, [hWhoseTurn] push af bank1call OpenTurnHolderDiscardPileScreen @@ -434,7 +435,7 @@ OpenInPlayAreaScreen_ShowPlayerDiscardPile: ldh [hWhoseTurn], a ret -OpenInPlayAreaScreen_ShowOpponentDiscardPile: +OpenInPlayAreaScreen_NonTurnHolderDiscardPile: ldh a, [hWhoseTurn] push af bank1call OpenNonTurnHolderDiscardPileScreen @@ -527,7 +528,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) ; check d-pad bit D_UP_F, a jr z, .else_if_down - + ; up ld a, [hl] jr .process_dpad @@ -536,7 +537,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) inc hl bit D_DOWN_F, a jr z, .else_if_right - + ; down ld a, [hl] jr .process_dpad @@ -545,7 +546,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) inc hl bit D_RIGHT_F, a jr z, .else_if_left - + ; right ld a, [hl] jr .process_dpad @@ -584,7 +585,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) ld a, $10 ld [wInPlayAreaCursorPosition], a jr .next - + .bench_pokemon_exists ld b, a ld a, [wInPlayAreaCursorPosition] @@ -675,7 +676,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) ret nz bit 4, [hl] ; = and $10 - jr nz, .non_draw_cursor + jr nz, ZeroObjectPositionsAndToggleOAMCopy_Bank6 .draw_cursor ; 184a0 (6:44a0) call ZeroObjectPositions @@ -688,7 +689,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) ld h, $07 call HtimesL add hl, de - + ld d, [hl] ; x position. inc hl ld e, [hl] ; y position. @@ -699,7 +700,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) or a ret -.non_draw_cursor ; 184bf (6:44bf) +ZeroObjectPositionsAndToggleOAMCopy_Bank6 ; 184bf (6:44bf) call ZeroObjectPositions ld a, $01 ld [wVBlankOAMCopyToggle], a @@ -729,18 +730,18 @@ Func_006_44c8: ; 184c8 (6:44c8) and SELECT jr nz, .on_select - farcall $2, $49ae + farcall Func_89ae jr nc, .next - + cp -1 ; b button jr nz, .check_button farcall $2, $4aa1 ret - + .check_button push af - farcall $2, $4aa1 + farcall Func_8aa1 pop af cp $09 ; $09: next page or prev page @@ -915,7 +916,7 @@ GlossaryData_1: glossary_entry 5, Text0300, Text0312 glossary_entry 7, Text0301, Text0313 glossary_entry 5, Text0302, Text0314 - + GlossaryData_2: glossary_entry 5, Text0303, Text0315 glossary_entry 5, Text0304, Text0316 @@ -969,9 +970,9 @@ Func_006_4661: ; 18661 (6:4661) ld [wCheckMenuCursorBlinkCounter], a .asm_006_46a2 ldh a, [hKeysPressed] - and $03 + and A_BUTTON | B_BUTTON jr z, .asm_006_46bd - and $01 + and A_BUTTON jr nz, .asm_006_46b3 ld a, $ff call Func_006_50fb @@ -1535,7 +1536,7 @@ Func_006_591f: ret .data db $03, $04, $05, $06, $07, $08 - + Func_1996e: ; 1996e (6:596e) call EnableSRAM ld a, PLAYER_TURN @@ -2622,6 +2623,7 @@ else dw (\5 << 8) | \6 endc ENDM + KeyboardData_Player: ; (6:6baf) kbitem $04, $02, $11, $00, TX_FULLWIDTH3, "A" kbitem $06, $02, $12, $00, TX_FULLWIDTH3, "J" diff --git a/src/engine/home.asm b/src/engine/home.asm index cdb96c9..d8a9a01 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -9303,7 +9303,7 @@ OpenInPlayAreaScreen_FromSelectButton: ; 30a6 (0:30a6) ld a, BANK(OpenInPlayAreaScreen) call BankswitchROM ld a, $1 - ld [wIsFromSelectButton], a + ld [wInPlayAreaFromSelectButton], a call OpenInPlayAreaScreen pop bc ld a, b diff --git a/src/wram.asm b/src/wram.asm index 18b0a04..71278bb 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1316,7 +1316,7 @@ wce53:: ; ce53 wDuelInitialPrizesUpperBitsSet:: ; ce55 ds $1 - ds $1 + ds $1 ; it's used for restore the position of cursor ; when going into another view, and returning to @@ -1348,7 +1348,9 @@ wce5e:: ; ce5e wYourOrOppPlayAreaLastCursorPosition:: ; ce5f ds $1 -wIsFromSelectButton:: ; ce60 +; $00 when the "In Play Area" screen has been opened from the Check menu +; $01 when the "In Play Area" screen has been opened by pressing the select button +wInPlayAreaFromSelectButton:: ; ce60 ds $1 wce61:: ; ce61 -- cgit v1.2.3 From 20affd92b5d23b21a8c09ac689119cb9d188ec21 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 25 Jul 2019 16:15:19 +0200 Subject: Consolidate label format in bank6 --- src/engine/bank01.asm | 8 +- src/engine/bank02.asm | 2 +- src/engine/bank06.asm | 668 +++++++++++++++++++++++++------------------------- 3 files changed, 339 insertions(+), 339 deletions(-) (limited to 'src') diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 222ccf4..f9f8781 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -8080,7 +8080,7 @@ Func_741a: ; 741a (1:741a) xor a ld [wd4b0], a push hl - farcall Func_006_4f9c + farcall Func_18f9c pop hl jr .loop .done @@ -8162,7 +8162,7 @@ PlayMoveAnimation: ; 7494 (1:7494) ld a, $02 ld [wLoadedMoveAnimation], a .asm_74d1 - farcall Func_006_4f9c + farcall Func_18f9c pop bc pop de pop hl @@ -8177,7 +8177,7 @@ Func_7571: ; 7571 (1:7571) INCROM $7571, $7576 Func_7576: ; 7576 (1:7576) - farcall Func_006_591f + farcall Func_1991f ret ; 0x757b @@ -8192,7 +8192,7 @@ Func_7594: ; 7594 (1:7594) ; 0x7599 Func_7599: ; 7599 (1:7599) - farcall Func_006_668d + farcall Func_1a68d ret ; 0x759e diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index 79d8996..e6671a8 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_006_44c8 + farcall Func_184c8 ret ; opens the Your Play Area submenu diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 4517d03..0e1534d 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -706,10 +706,10 @@ ZeroObjectPositionsAndToggleOAMCopy_Bank6 ; 184bf (6:44bf) ld [wVBlankOAMCopyToggle], a ret -Func_006_44c8: ; 184c8 (6:44c8) +Func_184c8: ; 184c8 (6:44c8) xor a ld [wGlossaryPageNo], a - call Func_006_452b + call Func_1852b xor a ld [wInPlayAreaCursorPosition], a @@ -747,8 +747,8 @@ Func_006_44c8: ; 184c8 (6:44c8) cp $09 ; $09: next page or prev page jr z, .change_page - call Func_006_4598 - call Func_006_452b + call Func_18598 + call Func_1852b xor a ld [wCheckMenuCursorBlinkCounter], a jr .next @@ -760,11 +760,11 @@ Func_006_44c8: ; 184c8 (6:44c8) ld a, [wGlossaryPageNo] xor $01 ; swap page ld [wGlossaryPageNo], a - call Func_006_455a + call Func_1855a jr .next ; display glossary menu. -Func_006_452b: ; 1852b (6:452b) +Func_1852b: ; 1852b (6:452b) xor a ld [wTileMapFill], a call ZeroObjectPositions @@ -779,13 +779,13 @@ Func_006_452b: ; 1852b (6:452b) call InitTextPrinting ldtx hl, PokemonCardGlossaryText call ProcessTextFromID - call Func_006_455a + call Func_1855a ldtx hl, ChooseWordAndPressAButtonText call DrawWideTextBox_PrintText ret ; print texts in glossary menu. -Func_006_455a: ; 1855a (6:455a) +Func_1855a: ; 1855a (6:455a) ld hl, wDefaultText ld a, TX_SYMBOL @@ -830,7 +830,7 @@ Func_006_455a: ; 1855a (6:455a) ret ; display glossary description. -Func_006_4598: ; 18598 (6:4598) +Func_18598: ; 18598 (6:4598) push af xor a ld [wTileMapFill], a @@ -928,7 +928,7 @@ GlossaryData_2: glossary_entry 6, Text030a, Text031c glossary_entry 6, Text030b, Text031d -Func_006_4661: ; 18661 (6:4661) +Func_18661: ; 18661 (6:4661) xor a ld [wcfe3], a ld a, [wCheckMenuCursorXPosition] @@ -937,30 +937,30 @@ Func_006_4661: ; 18661 (6:4661) ld e, a ldh a, [hDPadHeld] or a - jr z, .asm_006_46a2 + jr z, .asm_46a2 bit D_LEFT_F, a - jr nz, .asm_006_467a + jr nz, .asm_467a bit D_RIGHT_F, a - jr z, .asm_006_4680 -.asm_006_467a + jr z, .asm_4680 +.asm_467a ld a, d xor $01 ld d, a - jr .asm_006_468c -.asm_006_4680 + jr .asm_468c +.asm_4680 bit D_UP_F, a - jr nz, .asm_006_4688 + jr nz, .asm_4688 bit D_DOWN_F, a - jr z, .asm_006_46a2 -.asm_006_4688 + jr z, .asm_46a2 +.asm_4688 ld a, e xor $01 ld e, a -.asm_006_468c +.asm_468c ld a, $01 ld [wcfe3], a push de - call .asm_006_46d4 + call .asm_46d4 pop de ld a, d ld [wCheckMenuCursorXPosition], a @@ -968,28 +968,28 @@ Func_006_4661: ; 18661 (6:4661) ld [wCheckMenuCursorYPosition], a xor a ld [wCheckMenuCursorBlinkCounter], a -.asm_006_46a2 +.asm_46a2 ldh a, [hKeysPressed] and A_BUTTON | B_BUTTON - jr z, .asm_006_46bd + jr z, .asm_46bd and A_BUTTON - jr nz, .asm_006_46b3 + jr nz, .asm_46b3 ld a, $ff - call Func_006_50fb + call Func_190fb scf ret -.asm_006_46b3 - call .asm_006_46f3 +.asm_46b3 + call .asm_46f3 ld a, $01 - call Func_006_50fb + call Func_190fb scf ret -.asm_006_46bd +.asm_46bd ld a, [wcfe3] or a - jr z, .asm_006_46c6 + jr z, .asm_46c6 call PlaySFX -.asm_006_46c6 +.asm_46c6 ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] @@ -997,10 +997,10 @@ Func_006_4661: ; 18661 (6:4661) ret nz ld a, $0f bit D_RIGHT_F, [hl] - jr z, .asm_006_46d6 -.asm_006_46d4 ; 186d4 (6:46d4) + jr z, .asm_46d6 +.asm_46d4 ; 186d4 (6:46d4) ld a, $00 -.asm_006_46d6 +.asm_46d6 ld e, a ld a, $0a ld l, a @@ -1018,14 +1018,14 @@ Func_006_4661: ; 18661 (6:4661) call WriteByteToBGMap0 or a ret -.asm_006_46f3: ; 186f3 (6:46f3) +.asm_46f3: ; 186f3 (6:46f3) ld a, $0f - jr .asm_006_46d6 + jr .asm_46d6 ; (6:46f7) INCLUDE "data/effect_commands.asm" -Func_006_4f9c: ; 18f9c (6:4f9c) +Func_18f9c: ; 18f9c (6:4f9c) ld a, [wLoadedMoveAnimation] or a ret z @@ -1033,7 +1033,7 @@ Func_006_4f9c: ; 18f9c (6:4f9c) ld h, 0 add hl, hl ld de, Data_006_51a4 -.asm_006_4fa8 +.asm_4fa8 add hl, de ld e, [hl] inc hl @@ -1042,7 +1042,7 @@ Func_006_4f9c: ; 18f9c (6:4f9c) ld hl, wce7e ld a, [hl] or a - jr nz, .asm_006_4fd3 + jr nz, .asm_4fd3 ld [hl], $01 call Func_3b21 pop de @@ -1055,66 +1055,66 @@ Func_006_4f9c: ; 18f9c (6:4f9c) ld [wd4b0], a ld a, [de] cp $04 - jr z, .asm_006_4fd3 + jr z, .asm_4fd3 ld a, $96 call Func_3b6a -.asm_006_4fd3 +.asm_4fd3 pop de -.asm_006_4fd4 +.asm_4fd4 ld a, [de] inc de ld hl, PointerTable_006_508f jp JumpToFunctionInTable -Func_006_4fdc: +Func_18fdc: ; 18fdc (6:4fdc) ret -Func_006_4fdd: +Func_18fdd: ; 18fdd (6:4fdd) ldh a, [hWhoseTurn] ld [wd4af], a ld a, [wDuelType] cp $00 - jr nz, Func_006_5014 + jr nz, Func_19014 ld a, $c2 ld [wd4af], a - jr Func_006_5014 + jr Func_19014 -Func_006_4ff0: +Func_18ff0: ; 18ff0 (6:4ff0) call SwapTurn ldh a, [hWhoseTurn] ld [wd4af], a call SwapTurn ld a, [wDuelType] cp $00 - jr nz, Func_006_5014 + jr nz, Func_19014 ld a, $c3 ld [wd4af], a - jr Func_006_5014 + jr Func_19014 -Func_006_5009: +Func_19009: ; 19009 (6:5009) ld a, [wce82] and $7f ld [wd4b0], a - jr Func_006_5014 + jr Func_19014 -Func_006_5013: +Func_19013: ; 19013 (6:5013) ret -Func_006_5014: +Func_19014: ; 19014 (6:5014) ld a, [de] inc de cp $09 - jr z, .asm_006_502b + jr z, .asm_502b cp $fa - jr z, .asm_006_5057 + jr z, .asm_5057 cp $fb - jr z, .asm_006_505d + jr z, .asm_505d cp $fc - jr z, .asm_006_5063 -.asm_006_5026 + jr z, .asm_5063 +.asm_5026 call Func_3b6a - jr Func_006_4f9c.asm_006_4fd4 -.asm_006_502b + jr Func_18f9c.asm_4fd4 +.asm_502b ld a, $97 call Func_3b6a ld a, [wce81] @@ -1132,104 +1132,104 @@ Func_006_5014: call Func_3b6a ld a, [wDuelDisplayedScreen] cp $01 - jr nz, .asm_006_5054 + jr nz, .asm_5054 ld a, $98 call Func_3b6a -.asm_006_5054 - jp Func_006_4f9c.asm_006_4fd4 -.asm_006_5057 +.asm_5054 + jp Func_18f9c.asm_4fd4 +.asm_5057 ld c, $61 ld b, $63 - jr .asm_006_5067 -.asm_006_505d + jr .asm_5067 +.asm_505d ld c, $62 ld b, $64 - jr .asm_006_5067 -.asm_006_5063 + jr .asm_5067 +.asm_5063 ld c, $63 ld b, $61 -.asm_006_5067 +.asm_5067 ldh a, [hWhoseTurn] cp $c2 ld a, c - jr z, .asm_006_5026 + jr z, .asm_5026 ld a, [wDuelType] cp $00 ld a, c - jr z, .asm_006_5026 + jr z, .asm_5026 ld a, b - jr .asm_006_5026 + jr .asm_5026 -Func_006_5079: +Func_19079: ; 19079 (6:5079) ld a, [de] inc de ld [$d4b3], a ld a, [wce82] ld [wd4b0], a - call Func_006_509d + call Func_1909d ld a, $96 call Func_3b6a - jp Func_006_4f9c.asm_006_4fd4 + jp Func_18f9c.asm_4fd4 PointerTable_006_508f: ; (6:508f) - dw Func_006_4fdc - dw Func_006_5014 - dw Func_006_4fdd - dw Func_006_4ff0 - dw Func_006_5079 - dw Func_006_5009 - dw Func_006_5013 - -Func_006_509d: ; 1909d (6:509d) + dw Func_18fdc + dw Func_19014 + dw Func_18fdd + dw Func_18ff0 + dw Func_19079 + dw Func_19009 + dw Func_19013 + +Func_1909d: ; 1909d (6:509d) ld a, [$d4b3] cp $04 - jr z, .asm_006_50ad + jr z, .asm_50ad cp $01 ret nz ld a, $00 ld [wd4ae], a ret -.asm_006_50ad +.asm_50ad ld a, [wd4b0] ld l, a ld a, [wWhoseTurn] ld h, a cp $c2 - jr z, .asm_006_50cc + jr z, .asm_50cc ld a, [wDuelType] cp $00 - jr z, .asm_006_50c6 + jr z, .asm_50c6 bit 7, l - jr z, .asm_006_50e2 - jr .asm_006_50d2 -.asm_006_50c6 + jr z, .asm_50e2 + jr .asm_50d2 +.asm_50c6 bit 7, l - jr z, .asm_006_50da - jr .asm_006_50ea -.asm_006_50cc + jr z, .asm_50da + jr .asm_50ea +.asm_50cc bit 7, l - jr z, .asm_006_50d2 - jr .asm_006_50e2 -.asm_006_50d2 + jr z, .asm_50d2 + jr .asm_50e2 +.asm_50d2 ld l, $04 ld h, $c2 ld a, $01 - jr .asm_006_50f0 -.asm_006_50da + jr .asm_50f0 +.asm_50da ld l, $04 ld h, $c3 ld a, $01 - jr .asm_006_50f0 -.asm_006_50e2 + jr .asm_50f0 +.asm_50e2 ld l, $05 ld h, $c3 ld a, $02 - jr .asm_006_50f0 -.asm_006_50ea + jr .asm_50f0 +.asm_50ea ld l, $05 ld h, $c2 ld a, $02 -.asm_006_50f0: +.asm_50f0: ld [wd4ae], a ret @@ -1237,36 +1237,36 @@ Func_006_509d: ; 1909d (6:509d) ; needs some fix. ld a, [$d4b3] cp $04 - jr z, Func_006_50fb.asm_006_510f -Func_006_50fb: ; 190fb (6:50fb) + jr z, Func_190fb.asm_510f +Func_190fb: ; 190fb (6:50fb) cp $01 - jr nz, .asm_006_510e + jr nz, .asm_510e ld a, $00 ld [wd4ae], a ld a, [wDuelDisplayedScreen] cp $01 - jr z, .asm_006_510e + jr z, .asm_510e bank1call DrawDuelMainScene -.asm_006_510e +.asm_510e ret -.asm_006_510f - call Func_006_509d +.asm_510f + call Func_1909d ld a, [wDuelDisplayedScreen] cp l - jr z, .asm_006_512e + jr z, .asm_512e ld a, l push af ld l, $c2 ld a, [wDuelType] cp $00 - jr nz, .asm_006_5127 + jr nz, .asm_5127 ld a, [wWhoseTurn] ld l, a -.asm_006_5127 +.asm_5127 call DrawYourOrOppPlayAreaScreen_Bank0 pop af ld [wDuelDisplayedScreen], a -.asm_006_512e +.asm_512e call DrawWideTextBox ret @@ -1276,9 +1276,9 @@ Func_006_50fb: ; 190fb (6:50fb) push de ld a, [wLoadedMoveAnimation] cp $79 - jr z, .asm_006_5164 + jr z, .asm_5164 cp $86 - jr z, .asm_006_5164 + jr z, .asm_5164 ld a, [wTempNonTurnDuelistCardID] ld e, a ld d, $00 @@ -1294,20 +1294,20 @@ Func_006_50fb: ; 190fb (6:50fb) ld a, [hli] ld h, [hl] ld l, a - call Func_006_5168 + call Func_19168 ld a, l or h call nz, DrawWideTextBox_PrintText -.asm_006_5164 +.asm_5164 pop de pop bc pop hl ret -Func_006_5168: ; 19168 (6:5168) +Func_19168: ; 19168 (6:5168) ld a, l or h - jr z, .asm_006_5188 + jr z, .asm_5188 call LoadTxRam3 ld a, [wce81] ld hl, $003a @@ -1321,7 +1321,7 @@ Func_006_5168: ; 19168 (6:5168) ret nz ld hl, $0036 ret -.asm_006_5188 +.asm_5188 call CheckNoDamageOrEffect ret c ld hl, $003b @@ -1489,7 +1489,7 @@ Data_006_51a4: INCROM $192c6, $1991f -Func_006_591f: +Func_1991f: ; 1991f (6:591f) add a ld e, a ld d, 0 @@ -1512,25 +1512,25 @@ Func_006_591f: ld h, $a1 ld de, wPlayerDeck ld c, $3c -.asm_006_594c +.asm_594c ld a, [de] inc de ld l, a res 7, [hl] dec c - jr nz, .asm_006_594c + jr nz, .asm_594c ld h, $a1 ld de, wOpponentDeck ld c, $1e -.asm_006_595b +.asm_595b ld a, [de] inc de ld l, a res 7, [hl] inc [hl] dec c - jr nz, .asm_006_595b + jr nz, .asm_595b call DisableSRAM ret @@ -1702,31 +1702,31 @@ Func_1a61f: ; 1a61f (6:661f) ret ; 0x1a68d -Func_006_668d: +Func_1a68d: ; 1a68d (6:668d) ld a, $c2 ; player's turn ldh [hWhoseTurn], a ld h, a ld l, $00 -.asm_006_6694 +.asm_6694 xor a ld [hli], a ld a, l cp $3c - jr c, .asm_006_6694 + jr c, .asm_6694 xor a ld hl, wBoosterCardsDrawn ld de, wDuelTempList ld c, $00 -.asm_006_66a4 +.asm_66a4 ld a, [hli] or a - jr z, .asm_006_66ae + jr z, .asm_66ae ld a, c ld [de], a inc de inc c - jr .asm_006_66a4 -.asm_006_66ae + jr .asm_66a4 +.asm_66ae ld a, $ff ld [de], a lb de, $38, $9f @@ -1743,7 +1743,7 @@ Func_006_668d: CommentedOut_1a6cc: ; 1a6cc (6:66cc) ret -Func_006_66cd: ; (6:66cd) +Func_1a6cd: ; 1a6cd (6:66cd) ldh a, [hBankSRAM] or a ret nz @@ -1754,14 +1754,14 @@ Func_006_66cd: ; (6:66cd) ld bc, $0250 ld a, [s0a000 + $b] ld e, a -.asm_006_66de +.asm_66de ld a, [hli] xor e ld e, a dec bc ld a, c or b - jr nz, .asm_006_66de + jr nz, .asm_66de ld a, e pop bc pop de @@ -1781,13 +1781,13 @@ Func_006_66cd: ; (6:66cd) bank1call SetDefaultPalettes ld a, [wConsole] cp $01 - jr nz, .asm_006_6719 + jr nz, .asm_6719 ld a, $e4 ld [wOBP0], a ld [wBGP], a ld a, $01 ld [wFlushPaletteFlags], a -.asm_006_6719 +.asm_6719 lb de, $38, $9f call SetupText ld hl, $00a3 @@ -1802,7 +1802,7 @@ Func_006_66cd: ; (6:66cd) jp Reset ret -Func_006_673a: ; (6:673a) +Func_1a73a: ; 1a73a (6:673a) ldh a, [hBankSRAM] or a ret nz @@ -1812,14 +1812,14 @@ Func_006_673a: ; (6:673a) ld hl, sCardCollection ld bc, $0250 ld e, $00 -.asm_006_6749 +.asm_6749 ld a, [hli] xor e ld e, a dec bc ld a, c or b - jr nz, .asm_006_6749 + jr nz, .asm_6749 ld a, $0a ld [$0000], a ld a, e @@ -1930,12 +1930,12 @@ InputPlayerName: ; (6:67a3) ; if pressed start button. ld a, $01 call PlayAcceptOrDeclineSFX - call Func_006_6a07 + call Func_1aa07 ld a, 6 ld [wNamingScreenCursorX], a ld a, 5 ld [wNamingScreenCursorY], a - call Func_006_6a23 + call Func_1aa23 jr .loop .else call NamingScreen_CheckButtonState @@ -2112,35 +2112,35 @@ NamingScreen_CheckButtonState: ld a, [wNamingScreenCursorY] ld l, a bit D_UP_F, b - jr z, .asm_006_692c + jr z, .asm_692c ; up dec a bit D_DOWN_F, a - jr z, .asm_006_69a7 + jr z, .asm_69a7 ld a, c dec a - jr .asm_006_69a7 -.asm_006_692c + jr .asm_69a7 +.asm_692c bit D_DOWN_F, b - jr z, .asm_006_6937 + jr z, .asm_6937 ; down inc a cp c - jr c, .asm_006_69a7 + jr c, .asm_69a7 xor a - jr .asm_006_69a7 -.asm_006_6937 + jr .asm_69a7 +.asm_6937 ld a, [wd005] ld c, a ld a, h bit D_LEFT_F, b - jr z, .asm_006_6974 + jr z, .asm_6974 ; left ld d, a ld a, $06 cp l ld a, d - jr nz, .asm_006_696b + jr nz, .asm_696b push hl push bc push af @@ -2158,31 +2158,31 @@ NamingScreen_CheckButtonState: pop hl sub d cp $ff - jr nz, .asm_006_6962 + jr nz, .asm_6962 ld a, c sub $02 - jr .asm_006_69aa -.asm_006_6962 + jr .asm_69aa +.asm_6962 cp $fe - jr nz, .asm_006_696b + jr nz, .asm_696b ld a, c sub $03 - jr .asm_006_69aa -.asm_006_696b + jr .asm_69aa +.asm_696b dec a bit D_DOWN_F, a - jr z, .asm_006_69aa + jr z, .asm_69aa ld a, c dec a - jr .asm_006_69aa -.asm_006_6974 + jr .asm_69aa +.asm_6974 bit D_RIGHT_F, b jr z, .no_press ld d, a ld a, $06 cp l ld a, d - jr nz, .asm_006_6990 + jr nz, .asm_6990 push hl push bc push af @@ -2198,30 +2198,30 @@ NamingScreen_CheckButtonState: pop bc pop hl add d -.asm_006_6990 +.asm_6990 inc a cp c - jr c, .asm_006_69aa + jr c, .asm_69aa inc c cp c - jr c, .asm_006_69a4 + jr c, .asm_69a4 inc c cp c - jr c, .asm_006_69a0 + jr c, .asm_69a0 ld a, $02 - jr .asm_006_69aa -.asm_006_69a0 + jr .asm_69aa +.asm_69a0 ld a, $01 - jr .asm_006_69aa -.asm_006_69a4 + jr .asm_69aa +.asm_69a4 xor a - jr .asm_006_69aa -.asm_006_69a7 + jr .asm_69aa +.asm_69a7 ld l, a - jr .asm_006_69ab -.asm_006_69aa + jr .asm_69ab +.asm_69aa ld h, a -.asm_006_69ab +.asm_69ab push hl call GetCharInfoFromPos_Player inc hl @@ -2229,13 +2229,13 @@ NamingScreen_CheckButtonState: inc hl ld a, [wd009] cp $02 - jr nz, .asm_006_69bb + jr nz, .asm_69bb inc hl inc hl -.asm_006_69bb +.asm_69bb ld d, [hl] push de - call Func_006_6a07 + call Func_1aa07 pop de pop hl ld a, l @@ -2252,23 +2252,23 @@ NamingScreen_CheckButtonState: .no_press ldh a, [hKeysPressed] and A_BUTTON | B_BUTTON - jr z, .asm_006_69ef + jr z, .asm_69ef and A_BUTTON - jr nz, .asm_006_69e5 + jr nz, .asm_69e5 ld a, $ff -.asm_006_69e5 +.asm_69e5 call PlayAcceptOrDeclineSFX push af - call Func_006_6a23 + call Func_1aa23 pop af scf ret -.asm_006_69ef +.asm_69ef ld a, [wcfe3] or a - jr z, .asm_006_69f8 + jr z, .asm_69f8 call PlaySFX -.asm_006_69f8 +.asm_69f8 ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] @@ -2276,11 +2276,11 @@ NamingScreen_CheckButtonState: ret nz ld a, [wceaa] bit 4, [hl] - jr z, Func_006_6a07.asm_006_6a0a + jr z, Func_1aa07.asm_6a0a -Func_006_6a07: +Func_1aa07: ; 1aa07 (6:6a07) ld a, [wceab] -.asm_006_6a0a +.asm_6a0a ld e, a ld a, [wNamingScreenCursorX] ld h, a @@ -2292,16 +2292,16 @@ Func_006_6a07: ld b, [hl] dec b ld a, e - call Func_006_6a28 + call Func_1aa28 call WriteByteToBGMap0 or a ret -Func_006_6a23: +Func_1aa23: ; 1aa23 (6:6a23) ld a, [wceaa] - jr Func_006_6a07.asm_006_6a0a + jr Func_1aa07.asm_6a0a -Func_006_6a28: +Func_1aa28: ; 1aa28 (6:6a28) push af push bc push de @@ -2312,7 +2312,7 @@ Func_006_6a28: ld b, a ld a, [wceab] cp b - jr z, .asm_006_6a60 + jr z, .asm_6a60 ld a, [wNamingScreenBufferLength] srl a ld d, a @@ -2321,9 +2321,9 @@ Func_006_6a28: ld e, a ld a, d cp e - jr nz, .asm_006_6a49 + jr nz, .asm_6a49 dec a -.asm_006_6a49 +.asm_6a49 ld hl, wNamingScreenNamePosition add [hl] ld d, a @@ -2336,7 +2336,7 @@ Func_006_6a28: ld e, $18 ld bc, $0000 call SetOneObjectAttributes -.asm_006_6a60 +.asm_6a60 pop hl pop de pop bc @@ -2383,71 +2383,71 @@ NamingScreen_ProcessInput: cp $09 jp z, .on_end cp $07 - jr nz, .asm_006_6ab8 + jr nz, .asm_6ab8 ld a, [wd009] or a - jr nz, .asm_006_6aac + jr nz, .asm_6aac ld a, $01 - jp .asm_006_6ace -.asm_006_6aac + jp .asm_6ace +.asm_6aac dec a - jr nz, .asm_006_6ab4 + jr nz, .asm_6ab4 ld a, $02 - jp .asm_006_6ace -.asm_006_6ab4 + jp .asm_6ace +.asm_6ab4 xor a - jp .asm_006_6ace -.asm_006_6ab8 + jp .asm_6ace +.asm_6ab8 cp $08 - jr nz, .asm_006_6ad6 + jr nz, .asm_6ad6 ld a, [wd009] or a - jr nz, .asm_006_6ac6 + jr nz, .asm_6ac6 ld a, $02 - jr .asm_006_6ace -.asm_006_6ac6 + jr .asm_6ace +.asm_6ac6 dec a - jr nz, .asm_006_6acc + jr nz, .asm_6acc xor a - jr .asm_006_6ace -.asm_006_6acc + jr .asm_6ace +.asm_6acc ld a, $01 -.asm_006_6ace +.asm_6ace ld [wd009], a call DrawNamingScreenBG or a ret -.asm_006_6ad6 +.asm_6ad6 ld a, [wd009] cp $02 jr z, .read_char ldfw3 bc, "“" ld a, d cp b - jr nz, .asm_006_6af4 + jr nz, .asm_6af4 ld a, e cp c - jr nz, .asm_006_6af4 + jr nz, .asm_6af4 push hl ld hl, TransitionTable1 ; from 55th. call TransformCharacter pop hl jr c, .nothing - jr .asm_006_6b09 -.asm_006_6af4 + jr .asm_6b09 +.asm_6af4 ldfw3 bc, "º(2)" ld a, d cp b - jr nz, .asm_006_6b1d + jr nz, .asm_6b1d ld a, e cp c - jr nz, .asm_006_6b1d + jr nz, .asm_6b1d push hl ld hl, TransitionTable2 ; from 72th. call TransformCharacter pop hl jr c, .nothing -.asm_006_6b09 +.asm_6b09 ld a, [wNamingScreenBufferLength] dec a dec a @@ -2459,19 +2459,19 @@ NamingScreen_ProcessInput: add hl, de pop de ld a, [hl] - jr .asm_006_6b37 -.asm_006_6b1d + jr .asm_6b37 +.asm_6b1d ld a, d or a - jr nz, .asm_006_6b37 + jr nz, .asm_6b37 ld a, [wd009] or a - jr nz, .asm_006_6b2b + jr nz, .asm_6b2b ld a, TX_HIRAGANA - jr .asm_006_6b37 -.asm_006_6b2b + jr .asm_6b37 +.asm_6b2b ld a, TX_KATAKANA - jr .asm_006_6b37 + jr .asm_6b37 ; read character code from info. to register. ; hl: pointer. .read_char @@ -2480,12 +2480,12 @@ NamingScreen_ProcessInput: ld a, [hl] ; a: first byte of the code. or a ; if 2 bytes code, jump. - jr nz, .asm_006_6b37 + jr nz, .asm_6b37 ; if 1 byte code(ascii), ; set first byte to $0e. ld a, $0e ; on 2 bytes code. -.asm_006_6b37 +.asm_6b37 ld d, a ; de: character code. ld hl, wNamingScreenBufferLength ld a, [hl] @@ -2494,22 +2494,22 @@ NamingScreen_ProcessInput: ld hl, wNamingScreenBufferMaxLength cp [hl] pop hl - jr nz, .asm_006_6b4c + jr nz, .asm_6b4c ; if the buffer is full ; just change the last character of it. ld hl, wNamingScreenBuffer dec hl dec hl - jr .asm_006_6b51 + jr .asm_6b51 ; increase name length before add the character. -.asm_006_6b4c +.asm_6b4c inc [hl] inc [hl] ld hl, wNamingScreenBuffer ; write 2 bytes character codes to the name buffer. ; de: 2 bytes character codes. ; hl: dest. -.asm_006_6b51 +.asm_6b51 ld b, 0 add hl, bc ld [hl], d @@ -2769,7 +2769,7 @@ InputDeckName: ; 1ad89 (6:6d89) xor a ld [wd009], a - call Func_006_6e99 + call Func_1ae99 xor a ld [wNamingScreenCursorX], a @@ -2796,22 +2796,22 @@ InputDeckName: ; 1ad89 (6:6d89) ld a, $01 call PlayAcceptOrDeclineSFX - call Func_006_6fa1 + call Func_1afa1 ld a, 6 ld [wNamingScreenCursorX], a ld [wNamingScreenCursorY], a - call Func_006_6fbd + call Func_1afbd jr .loop .on_start - call Func_006_6efb + call Func_1aefb jr nc, .loop cp $ff - jr z, .asm_006_6e1c + jr z, .asm_6e1c - call Func_006_6ec3 + call Func_1aec3 jr nc, .loop call FinalizeInputName @@ -2830,7 +2830,7 @@ InputDeckName: ; 1ad89 (6:6d89) ld [hl], TX_END .return ret -.asm_006_6e1c +.asm_6e1c ld a, [wNamingScreenBufferLength] cp $02 jr c, .loop @@ -2906,7 +2906,7 @@ rept MAX_DECK_NAME_LENGTH endr db TX_END -Func_006_6e99: +Func_1ae99: ; 1ae99 (6:6e99) call DrawTextboxForKeyboard call ProcessTextWithUnderbar ld hl, wNamingScreenQuestionPointer @@ -2931,7 +2931,7 @@ Func_006_6e99: call EnableLCD ret -Func_006_6ec3: +Func_1aec3: ; 1aec3 (6:6ec3) ld a, [wNamingScreenCursorX] ld h, a ld a, [wNamingScreenCursorY] @@ -2941,10 +2941,10 @@ Func_006_6ec3: inc hl ld a, [hl] cp $01 - jr nz, .asm_006_6ed7 + jr nz, .asm_6ed7 scf ret -.asm_006_6ed7 +.asm_6ed7 ld d, a ld hl, wNamingScreenBufferLength ld a, [hl] @@ -2953,14 +2953,14 @@ Func_006_6ec3: ld hl, wNamingScreenBufferMaxLength cp [hl] pop hl - jr nz, .asm_006_6eeb + jr nz, .asm_6eeb ld hl, wNamingScreenBuffer dec hl - jr .asm_006_6eef -.asm_006_6eeb + jr .asm_6eef +.asm_6eeb inc [hl] ld hl, wNamingScreenBuffer -.asm_006_6eef +.asm_6eef ld b, 0 add hl, bc ld [hl], d @@ -2970,12 +2970,12 @@ Func_006_6ec3: or a ret -Func_006_6efb: +Func_1aefb: ; 1aefb (6:6efb) xor a ld [wcfe3], a ldh a, [hDPadHeld] or a - jp z, .asm_006_6f73 + jp z, .asm_6f73 ld b, a ld a, [wNamingScreenKeyboardHeight] ld c, a @@ -2984,56 +2984,56 @@ Func_006_6efb: ld a, [wNamingScreenCursorY] ld l, a bit 6, b - jr z, .asm_006_6f1f + jr z, .asm_6f1f dec a bit 7, a - jr z, .asm_006_6f4b + jr z, .asm_6f4b ld a, c dec a - jr .asm_006_6f4b -.asm_006_6f1f + jr .asm_6f4b +.asm_6f1f bit 7, b - jr z, .asm_006_6f2a + jr z, .asm_6f2a inc a cp c - jr c, .asm_006_6f4b + jr c, .asm_6f4b xor a - jr .asm_006_6f4b -.asm_006_6f2a + jr .asm_6f4b +.asm_6f2a cp $06 - jr z, .asm_006_6f73 + jr z, .asm_6f73 ld a, [wd005] ld c, a ld a, h bit 5, b - jr z, .asm_006_6f40 + jr z, .asm_6f40 dec a bit 7, a - jr z, .asm_006_6f4e + jr z, .asm_6f4e ld a, c dec a - jr .asm_006_6f4e -.asm_006_6f40 + jr .asm_6f4e +.asm_6f40 bit 4, b - jr z, .asm_006_6f73 + jr z, .asm_6f73 inc a cp c - jr c, .asm_006_6f4e + jr c, .asm_6f4e xor a - jr .asm_006_6f4e -.asm_006_6f4b + jr .asm_6f4e +.asm_6f4b ld l, a - jr .asm_006_6f4f -.asm_006_6f4e + jr .asm_6f4f +.asm_6f4e ld h, a -.asm_006_6f4f +.asm_6f4f push hl call GetCharInfoFromPos_Deck inc hl inc hl ld d, [hl] push de - call Func_006_6fa1 + call Func_1afa1 pop de pop hl ld a, l @@ -3044,29 +3044,29 @@ Func_006_6efb: ld [wCheckMenuCursorBlinkCounter], a ld a, $02 cp d - jp z, Func_006_6efb + jp z, Func_1aefb ld a, $01 ld [wcfe3], a -.asm_006_6f73 +.asm_6f73 ldh a, [hKeysPressed] and $03 - jr z, .asm_006_6f89 + jr z, .asm_6f89 and $01 - jr nz, .asm_006_6f7f + jr nz, .asm_6f7f ld a, $ff -.asm_006_6f7f +.asm_6f7f call PlayAcceptOrDeclineSFX push af - call Func_006_6fbd + call Func_1afbd pop af scf ret -.asm_006_6f89 +.asm_6f89 ld a, [wcfe3] or a - jr z, .asm_006_6f92 + jr z, .asm_6f92 call PlaySFX -.asm_006_6f92 +.asm_6f92 ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] @@ -3074,11 +3074,11 @@ Func_006_6efb: ret nz ld a, [wceaa] bit 4, [hl] - jr z, Func_006_6fa1.asm_006_6fa4 + jr z, Func_1afa1.asm_6fa4 -Func_006_6fa1: +Func_1afa1: ; 1afa1 (6:6fa1) ld a, [wceab] -.asm_006_6fa4 +.asm_6fa4 ld e, a ld a, [wNamingScreenCursorX] ld h, a @@ -3090,16 +3090,16 @@ Func_006_6fa1: ld b, [hl] dec b ld a, e - call Func_006_6fc2 + call Func_1afc2 call WriteByteToBGMap0 or a ret -Func_006_6fbd: +Func_1afbd: ; 1afbd (6:6fbd) ld a, [wceaa] - jr Func_006_6fa1.asm_006_6fa4 + jr Func_1afa1.asm_6fa4 -Func_006_6fc2: +Func_1afc2: ; 1afc2 (6:6fc2) push af push bc push de @@ -3110,16 +3110,16 @@ Func_006_6fc2: ld b, a ld a, [wceab] cp b - jr z, .asm_006_6ffb + jr z, .asm_6ffb ld a, [wNamingScreenBufferLength] ld d, a ld a, [wNamingScreenBufferMaxLength] ld e, a ld a, d cp e - jr nz, .asm_006_6fdf + jr nz, .asm_6fdf dec a -.asm_006_6fdf +.asm_6fdf dec a ld d, a ld hl, wNamingScreenNamePosition @@ -3136,7 +3136,7 @@ Func_006_6fc2: ld e, $18 ld bc, $0000 call SetOneObjectAttributes -.asm_006_6ffb +.asm_6ffb pop hl pop de pop bc @@ -3250,7 +3250,7 @@ KeyboardData_Deck: ; (6:7019) ; (6:70d6) INCROM $1b0d6, $1ba12 -Func_006_7a12: ; (6:7a12) +Func_1ba12: ; 1ba12 (6:7a12) push af ld [bc], a call EnableSRAM @@ -3261,10 +3261,10 @@ Func_006_7a12: ; (6:7a12) ld bc, $78e8 add hl, bc ld b, $00 -.asm_006_7a26 - call Func_006_7a4c - call Func_006_7a5b - call Func_006_7a7d +.asm_7a26 + call Func_1ba4c + call Func_1ba5b + call Func_1ba7d push hl ld de, wd0aa ld h, b @@ -3282,11 +3282,11 @@ Func_006_7a12: ; (6:7a12) inc b ld a, b cp $05 - jr nz, .asm_006_7a26 + jr nz, .asm_7a26 call DisableSRAM ret -Func_006_7a4c: +Func_1ba4c: ; 1ba4c (6:7a4c) push hl ld l, b ld h, $54 @@ -3298,7 +3298,7 @@ Func_006_7a4c: pop hl ret -Func_006_7a5b: +Func_1ba5b: ; 1ba5b (6:7a5b) push hl push bc push de @@ -3309,22 +3309,22 @@ Func_006_7a5b: pop hl ld bc, $0018 add hl, bc -.asm_006_7a67 +.asm_7a67 ld a, [de] inc de ld b, a or a - jr z, .asm_006_7a77 + jr z, .asm_7a77 ld a, [de] inc de ld c, a -.asm_006_7a70 +.asm_7a70 ld [hl], c inc hl dec b - jr nz, .asm_006_7a70 - jr .asm_006_7a67 -.asm_006_7a77 + jr nz, .asm_7a70 + jr .asm_7a67 +.asm_7a77 pop de pop bc pop hl @@ -3332,7 +3332,7 @@ Func_006_7a5b: inc hl ret -Func_006_7a7d: +Func_1ba7d: ; 1ba7d (6:7a7d) push hl push bc push de @@ -3343,14 +3343,14 @@ Func_006_7a7d: call CopyText pop hl ld de, wd089 -.asm_006_7a8d +.asm_7a8d ld a, [de] ld [hli], a or a - jr z, .asm_006_7a95 + jr z, .asm_7a95 inc de - jr .asm_006_7a8d -.asm_006_7a95 + jr .asm_7a8d +.asm_7a95 pop bc pop hl inc hl @@ -3358,61 +3358,61 @@ Func_006_7a7d: ret ; farcall from 0xb87e(2:787d): [EF|06|9A|7A] -Func_006_7a9a: ; (6:7a9a) +Func_1ba9a: ; 1ba9a (6:7a9a) xor a ld [wd0a6], a ld a, $01 -.asm_006_7aa0 - call Func_006_7ae4 +.asm_7aa0 + call Func_1bae4 ret nc sla a cp $10 - jr z, .asm_006_7aac - jr .asm_006_7aa0 -.asm_006_7aac + jr z, .asm_7aac + jr .asm_7aa0 +.asm_7aac ld a, $03 - call Func_006_7ae4 + call Func_1bae4 ret nc ld a, $05 - call Func_006_7ae4 + call Func_1bae4 ret nc ld a, $09 - call Func_006_7ae4 + call Func_1bae4 ret nc ld a, $06 - call Func_006_7ae4 + call Func_1bae4 ret nc ld a, $0a - call Func_006_7ae4 + call Func_1bae4 ret nc ld a, $0c - call Func_006_7ae4 + call Func_1bae4 ret nc ld a, $f7 -.asm_006_7ad2 - call Func_006_7ae4 +.asm_7ad2 + call Func_1bae4 ret nc sra a cp $ff - jr z, .asm_006_7ade - jr .asm_006_7ad2 -.asm_006_7ade - call Func_006_7ae4 + jr z, .asm_7ade + jr .asm_7ad2 +.asm_7ade + call Func_1bae4 ret nc scf ret -Func_006_7ae4: +Func_1bae4: ; 1bae4 (6:7ae4) push af ld hl, wd088 ld b, [hl] farcall $2, $7625 - jr c, .asm_006_7af5 + jr c, .asm_7af5 pop af ld [wd0a6], a or a ret -.asm_006_7af5 +.asm_7af5 pop af scf ret -- cgit v1.2.3 From 4d1b0a49a8c7dc1b4a9d77c54874db16e75b9264 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 25 Jul 2019 19:14:48 +0200 Subject: Constants for InPlayArea positions and some useful clarifications --- src/constants/duel_constants.asm | 65 ++++++--- src/engine/bank02.asm | 12 +- src/engine/bank06.asm | 290 +++++++++++++++++++++------------------ src/wram.asm | 4 +- 4 files changed, 208 insertions(+), 163 deletions(-) (limited to 'src') diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index dd61a44..e64fe38 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -168,6 +168,17 @@ EFFECTCMDTYPE_PKMN_POWER_TRIGGER EQU $07 EFFECTCMDTYPE_AI EQU $09 EFFECTCMDTYPE_UNKNOWN_08 EQU $08 +; wDamageEffectiveness constants +WEAKNESS EQU 1 +RESISTANCE EQU 2 + +; wNoDamageOrEffect constants +NO_DAMAGE_OR_EFFECT_AGILITY EQU $01 +NO_DAMAGE_OR_EFFECT_BARRIER EQU $02 +NO_DAMAGE_OR_EFFECT_FLY EQU $03 +NO_DAMAGE_OR_EFFECT_TRANSPARENCY EQU $04 +NO_DAMAGE_OR_EFFECT_NSHIELD EQU $05 + ; OppAction_* constants (OppActionTable) const_def const OPPACTION_ERROR ; $00 @@ -194,16 +205,18 @@ EFFECTCMDTYPE_UNKNOWN_08 EQU $08 const OPPACTION_6B15 ; $15 const OPPACTION_DUEL_MAIN_SCENE ; $16 -; wNoDamageOrEffect constants -NO_DAMAGE_OR_EFFECT_AGILITY EQU $01 -NO_DAMAGE_OR_EFFECT_BARRIER EQU $02 -NO_DAMAGE_OR_EFFECT_FLY EQU $03 -NO_DAMAGE_OR_EFFECT_TRANSPARENCY EQU $04 -NO_DAMAGE_OR_EFFECT_NSHIELD EQU $05 - -; wDamageEffectiveness constants -WEAKNESS EQU 1 -RESISTANCE EQU 2 +; constants for PracticeDuelActionTable entries + const_def 1 + const PRACTICEDUEL_DRAW_SEVEN_CARDS + const PRACTICEDUEL_PLAY_GOLDEEN + const PRACTICEDUEL_PUT_STARYU_IN_BENCH + const PRACTICEDUEL_VERIFY_INITIAL_PLAY + const PRACTICEDUEL_DONE_PUTTING_ON_BENCH + const PRACTICEDUEL_PRINT_TURN_INSTRUCTIONS + const PRACTICEDUEL_VERIFY_PLAYER_TURN_ACTIONS + const PRACTICEDUEL_REPEAT_INSTRUCTIONS + const PRACTICEDUEL_PLAY_STARYU_FROM_BENCH + const PRACTICEDUEL_REPLACE_KNOCKED_OUT_POKEMON ; wEffectFailed constants EFFECT_FAILED_NO_EFFECT EQU $01 @@ -233,18 +246,26 @@ CHECK_PLAY_AREA EQU $0a PLAY_CHECK EQU $01 SELECT_CHECK EQU $02 -; constants for PracticeDuelActionTable entries - const_def 1 - const PRACTICEDUEL_DRAW_SEVEN_CARDS - const PRACTICEDUEL_PLAY_GOLDEEN - const PRACTICEDUEL_PUT_STARYU_IN_BENCH - const PRACTICEDUEL_VERIFY_INITIAL_PLAY - const PRACTICEDUEL_DONE_PUTTING_ON_BENCH - const PRACTICEDUEL_PRINT_TURN_INSTRUCTIONS - const PRACTICEDUEL_VERIFY_PLAYER_TURN_ACTIONS - const PRACTICEDUEL_REPEAT_INSTRUCTIONS - const PRACTICEDUEL_PLAY_STARYU_FROM_BENCH - const PRACTICEDUEL_REPLACE_KNOCKED_OUT_POKEMON +; wInPlayAreaCurPosition constants + const_def + const INPLAYAREA_PLAYER_BENCH_1 ; $00 + const INPLAYAREA_PLAYER_BENCH_2 ; $01 + const INPLAYAREA_PLAYER_BENCH_3 ; $02 + const INPLAYAREA_PLAYER_BENCH_4 ; $03 + const INPLAYAREA_PLAYER_BENCH_5 ; $04 + const INPLAYAREA_PLAYER_ACTIVE ; $05 + const INPLAYAREA_PLAYER_HAND ; $06 + const INPLAYAREA_PLAYER_DISCARD_PILE ; $07 + const INPLAYAREA_OPP_ACTIVE ; $08 + const INPLAYAREA_OPP_HAND ; $09 + const INPLAYAREA_OPP_DISCARD_PILE ; $0a + const INPLAYAREA_OPP_BENCH_1 ; $0b + const INPLAYAREA_OPP_BENCH_2 ; $0c + const INPLAYAREA_OPP_BENCH_3 ; $0d + const INPLAYAREA_OPP_BENCH_4 ; $0e + const INPLAYAREA_OPP_BENCH_5 ; $0f + const INPLAYAREA_PLAYER_PLAY_AREA ; $10 + const INPLAYAREA_OPP_PLAY_AREA ; $11 ; wAnimationQueue length ANIMATION_QUEUE_LENGTH EQU 7 diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index e6671a8..be38fad 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -22,11 +22,11 @@ _OpenDuelCheckMenu: ; 8000 (2:4000) ld b, a ld a, [wCheckMenuCursorXPosition] add b - ld hl, .table + ld hl, .jump_table call JumpToFunctionInTable jr _OpenDuelCheckMenu -.table: ; 8031 (2:4031) +.jump_table: ; 8031 (2:4031) dw DuelCheckMenu_InPlayArea dw DuelCheckMenu_Glossary dw DuelCheckMenu_YourPlayArea @@ -88,11 +88,11 @@ DuelCheckMenu_YourPlayArea: ; 8047 (2:4047) ld b, a ld a, [wCheckMenuCursorXPosition] add b - ld hl, .table + ld hl, .jump_table call JumpToFunctionInTable jr .draw -.table ; 8098 (2:4098) +.jump_table ; 8098 (2:4098) dw OpenYourOrOppPlayAreaScreen_TurnHolderPlayArea dw OpenYourOrOppPlayAreaScreen_TurnHolderHand dw OpenYourOrOppPlayAreaScreen_TurnHolderDiscardPile @@ -225,11 +225,11 @@ DuelCheckMenu_OppPlayArea: ; 80da (2:40da) ld b, a ld a, [wCheckMenuCursorXPosition] add b - ld hl, .table + ld hl, .jump_table call JumpToFunctionInTable jr .turns -.table +.jump_table dw OpenYourOrOppPlayAreaScreen_NonTurnHolderPlayArea dw OpenYourOrOppPlayAreaScreen_NonTurnHolderHand dw OpenYourOrOppPlayAreaScreen_NonTurnHolderDiscardPile diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 0e1534d..bb9d872 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -156,8 +156,8 @@ _CopyCardNameAndLevel_HalfwidthText: ; it can be called with either the select button (DuelMenuShortcut_BothActivePokemon), ; or via the "In Play Area" item of the Check menu (DuelCheckMenu_InPlayArea) OpenInPlayAreaScreen: ; 180d5 (6:40d5) - ld a, $05 - ld [wInPlayAreaCursorPosition], a + ld a, INPLAYAREA_PLAYER_ACTIVE + ld [wInPlayAreaCurPosition], a .start xor a ld [wCheckMenuCursorBlinkCounter], a @@ -176,8 +176,8 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) ld [hl], e inc hl ld [hl], d - ld a, [wInPlayAreaCursorPosition] - call .print_card_name + ld a, [wInPlayAreaCurPosition] + call .print_associated_text .on_frame ld a, $01 ld [wVBlankOAMCopyToggle], a @@ -195,24 +195,24 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) ldh a, [hDPadHeld] and SELECT - jr nz, .toggle_view + jr nz, .skip_input .handle_input - ld a, [wInPlayAreaCursorPosition] - ld [wInPlayAreaTemporaryCursorPosition], a + ld a, [wInPlayAreaCurPosition] + ld [wInPlayAreaTemporaryPosition], a call OpenInPlayAreaScreen_HandleInput jr c, .pressed - ld a, [wInPlayAreaCursorPosition] - cp $10 ; player's hand - jp z, .show_turn_holder_hand - cp $11 ; opponent's hand - jp z, .show_non_turn_holder_hand + ld a, [wInPlayAreaCurPosition] + cp INPLAYAREA_PLAYER_PLAY_AREA + jp z, .show_turn_holder_play_area + cp INPLAYAREA_OPP_PLAY_AREA + jp z, .show_non_turn_holder_play_area ; check if the cursor moved. - ld hl, wInPlayAreaTemporaryCursorPosition + ld hl, wInPlayAreaTemporaryPosition cp [hl] - call nz, .print_card_name + call nz, .print_associated_text jr .on_frame @@ -227,7 +227,7 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) scf ret -.toggle_view +.skip_input call ZeroObjectPositionsAndToggleOAMCopy_Bank6 lb de, $38, $9f call SetupText @@ -238,16 +238,18 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) call ZeroObjectPositionsAndToggleOAMCopy_Bank6 lb de, $38, $9f call SetupText - ld a, [wInPlayAreaCursorPosition] + ld a, [wInPlayAreaCurPosition] ld [wInPlayAreaPreservedPosition], a ld hl, .jump_table call JumpToFunctionInTable ld a, [wInPlayAreaPreservedPosition] - ld [wInPlayAreaCursorPosition], a + ld [wInPlayAreaCurPosition], a jp .start -.print_card_name ; 18171 (6:4171) +.print_associated_text ; 18171 (6:4171) +; each position has a text associated to it, +; which is printed at the bottom of the screen push af lb de, 1, 17 call InitTextPrinting @@ -268,22 +270,30 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) ld b, 0 sla a ld c, a - add hl, bc ; hl = OpenInPlayAreaScreen_TextTable + 2 * (wInPlayAreaCursorPosition) + add hl, bc + ; hl = OpenInPlayAreaScreen_TextTable + 2 * (wInPlayAreaCurPosition) ld a, [hli] ld h, [hl] ld l, a ld a, h + ; jump ahead if entry does not contain null text (it's not active pokemon) or a - jr nz, .raw_string + jr nz, .print_hand_or_discard_pile ld a, l - cp TX_HALFWIDTH - jr nc, .raw_string - - ld a, [wInPlayAreaCursorPosition] - cp $06 + ; bench slots have dummy text IDs assigned to them, which are never used. + ; these are secretly not text id's, but rather, 2-byte PLAY_AREA_BENCH_* constants + ; check if the value at register l is one of those, and jump ahead if not + cp PLAY_AREA_BENCH_5 + $01 + jr nc, .print_hand_or_discard_pile + +; if we make it here, we need to print a Pokemon card name. +; wInPlayAreaCurPosition determines which duelist +; and l contains the PLAY_AREA_* location of the card. + ld a, [wInPlayAreaCurPosition] + cp INPLAYAREA_PLAYER_HAND jr nc, .opponent_side ld a, l @@ -294,7 +304,7 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) call GetCardIDFromDeckIndex call LoadCardDataToBuffer1_FromCardID - jr .display_card_info + jr .display_card_name .opponent_side ld a, l @@ -307,27 +317,31 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) call GetCardIDFromDeckIndex call LoadCardDataToBuffer1_FromCardID call SwapTurn -.display_card_info + +.display_card_name ld a, 18 call CopyCardNameAndLevel ld hl, wDefaultText call ProcessText ret -.raw_string - ld a, [wInPlayAreaCursorPosition] - cp $08 - jr nc, .opponent_side_raw_string +.print_hand_or_discard_pile +; if we make it here, cursor position is to Hand or Discard Pile +; so DuelistHandText_2 or DuelistDiscardPileText will be printed + + ld a, [wInPlayAreaCurPosition] + cp INPLAYAREA_OPP_ACTIVE + jr nc, .opp_side_print_hand_or_discard_pile call PrintTextNoDelay ret -.opponent_side_raw_string +.opp_side_print_hand_or_discard_pile call SwapTurn call PrintTextNoDelay call SwapTurn ret -.show_turn_holder_hand +.show_turn_holder_play_area lb de, $38, $9f call SetupText ldh a, [hWhoseTurn] @@ -336,10 +350,10 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) pop af ldh [hWhoseTurn], a ld a, [wInPlayAreaPreservedPosition] - ld [wInPlayAreaCursorPosition], a + ld [wInPlayAreaCurPosition], a jp .start -.show_non_turn_holder_hand +.show_non_turn_holder_play_area lb de, $38, $9f call SetupText ldh a, [hWhoseTurn] @@ -348,33 +362,33 @@ OpenInPlayAreaScreen: ; 180d5 (6:40d5) pop af ldh [hWhoseTurn], a ld a, [wInPlayAreaPreservedPosition] - ld [wInPlayAreaCursorPosition], a + ld [wInPlayAreaCurPosition], a jp .start .jump_table ; (6:4228) - dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x00: my bench pokemon 1 - dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x01: my bench pokemon 2 - dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x02: my bench pokemon 3 - dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x03: my bench pokemon 4 - dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x04: my bench pokemon 5 - dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x05: my active pokemon - dw OpenInPlayAreaScreen_TurnHolderHand ; 0x06: my hand - dw OpenInPlayAreaScreen_TurnHolderDiscardPile ; 0x07: my discard pile - dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x08: opp. active pokemon - dw OpenInPlayAreaScreen_NonTurnHolderHand ; 0x09: opp. hand - dw OpenInPlayAreaScreen_NonTurnHolderDiscardPile ; 0x0a: opp. discard pile - dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0b: opp. bench pokemon 1 - dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0c: opp. bench pokemon 2 - dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0d: opp. bench pokemon 3 - dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0e: opp. bench pokemon 4 - dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0f: opp. bench pokemon 5 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x00: INPLAYAREA_PLAYER_BENCH_1 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x01: INPLAYAREA_PLAYER_BENCH_2 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x02: INPLAYAREA_PLAYER_BENCH_3 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x03: INPLAYAREA_PLAYER_BENCH_4 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x04: INPLAYAREA_PLAYER_BENCH_5 + dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x05: INPLAYAREA_PLAYER_ACTIVE + dw OpenInPlayAreaScreen_TurnHolderHand ; 0x06: INPLAYAREA_PLAYER_HAND + dw OpenInPlayAreaScreen_TurnHolderDiscardPile ; 0x07: INPLAYAREA_PLAYER_DISCARD_PILE + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x08: INPLAYAREA_OPP_ACTIVE + dw OpenInPlayAreaScreen_NonTurnHolderHand ; 0x09: INPLAYAREA_OPP_HAND + dw OpenInPlayAreaScreen_NonTurnHolderDiscardPile ; 0x0a: INPLAYAREA_OPP_DISCARD_PILE + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0b: INPLAYAREA_OPP_BENCH_1 + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0c: INPLAYAREA_OPP_BENCH_2 + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0d: INPLAYAREA_OPP_BENCH_3 + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0e: INPLAYAREA_OPP_BENCH_4 + dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0f: INPLAYAREA_OPP_BENCH_5 OpenInPlayAreaScreen_TurnHolderPlayArea: - ; wInPlayAreaCursorPosition constants conveniently map to (PLAY_AREA_* constants - 1) + ; wInPlayAreaCurPosition constants conveniently map to (PLAY_AREA_* constants - 1) ; for bench locations. this mapping is taken for granted in the following code. - ld a, [wInPlayAreaCursorPosition] + ld a, [wInPlayAreaCurPosition] inc a - cp $05 + 1 ; $05: my active pokemon + cp INPLAYAREA_PLAYER_ACTIVE + $01 jr nz, .on_bench xor a ; PLAY_AREA_ARENA .on_bench @@ -391,12 +405,13 @@ OpenInPlayAreaScreen_TurnHolderPlayArea: ret OpenInPlayAreaScreen_NonTurnHolderPlayArea: - ld a, [wInPlayAreaCursorPosition] - sub $08 + ld a, [wInPlayAreaCurPosition] + sub INPLAYAREA_OPP_ACTIVE or a - jr z, .on_bench - sub $02 -.on_bench + jr z, .active + ; convert INPLAYAREA_OPP_BENCH_* constant to PLAY_AREA_BENCH_* constant + sub INPLAYAREA_OPP_BENCH_1 - INPLAYAREA_OPP_ACTIVE - PLAY_AREA_BENCH_1 +.active ld [wCurPlayAreaSlot], a add DUELVARS_ARENA_CARD call GetNonTurnDuelistVariable @@ -444,22 +459,33 @@ OpenInPlayAreaScreen_NonTurnHolderDiscardPile: ret OpenInPlayAreaScreen_TextTable: - tx HandText - tx CheckText - tx AttackText - tx PKMNPowerText - tx DoneText - dw NONE - tx DuelistHandText_2 - tx DuelistDiscardPileText - dw NONE - tx DuelistHandText_2 - tx DuelistDiscardPileText - tx HandText - tx CheckText - tx AttackText - tx PKMNPowerText - tx DoneText +; note that for bench slots, the entries are +; PLAY_AREA_BENCH_* constants in practice + tx HandText ; INPLAYAREA_PLAYER_BENCH_1 + tx CheckText ; INPLAYAREA_PLAYER_BENCH_2 + tx AttackText ; INPLAYAREA_PLAYER_BENCH_3 + tx PKMNPowerText ; INPLAYAREA_PLAYER_BENCH_4 + tx DoneText ; INPLAYAREA_PLAYER_BENCH_5 + dw NONE ; INPLAYAREA_PLAYER_ACTIVE + tx DuelistHandText_2 ; INPLAYAREA_PLAYER_HAND + tx DuelistDiscardPileText ; INPLAYAREA_PLAYER_DISCARD_PILE + dw NONE ; INPLAYAREA_OPP_ACTIVE + tx DuelistHandText_2 ; INPLAYAREA_OPP_HAND + tx DuelistDiscardPileText ; INPLAYAREA_OPP_DISCARD_PILE + tx HandText ; INPLAYAREA_OPP_BENCH_1 + tx CheckText ; INPLAYAREA_OPP_BENCH_2 + tx AttackText ; INPLAYAREA_OPP_BENCH_3 + 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 +ENDM ; it's related to wInPlayAreaInputTablePointer. ; with this table, the cursor moves into the proper location by the input. @@ -467,42 +493,40 @@ OpenInPlayAreaScreen_TextTable: ; 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: -; cursor x pos. / cursor y pos. / attribute / idx-up / idx-down / idx-right / idx-left - db $18, $8c, $00, $05, $10, $01, $04 - db $30, $8c, $00, $05, $10, $02, $00 - db $48, $8c, $00, $05, $10, $03, $01 - db $60, $8c, $00, $05, $10, $04, $02 - db $78, $8c, $00, $05, $10, $00, $03 - db $30, $6c, $00, $08, $00, $07, $07 - db $78, $80, $00, $07, $00, $05, $05 - db $78, $70, $00, $08, $06, $05, $05 - db $78, $34, $20, $0b, $05, $0a, $0a - db $30, $20, $20, $0b, $0a, $08, $08 - db $30, $38, $20, $0b, $05, $08, $08 - db $90, $14, $20, $11, $08, $0f, $0c - db $78, $14, $20, $11, $08, $0b, $0d - db $60, $14, $20, $11, $08, $0c, $0e - db $48, $14, $20, $11, $08, $0d, $0f - db $30, $14, $20, $11, $08, $0e, $0b + 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 OpenInPlayAreaScreen_TransitionTable2: -; same as 1. - db $18, $8c, $00, $05, $10, $01, $04 - db $30, $8c, $00, $05, $10, $02, $00 - db $48, $8c, $00, $05, $10, $03, $01 - db $60, $8c, $00, $05, $10, $04, $02 - db $78, $8c, $00, $05, $10, $00, $03 - db $30, $6c, $00, $08, $00, $07, $07 - db $78, $80, $00, $07, $00, $05, $05 - db $78, $70, $00, $08, $06, $05, $05 - db $78, $34, $20, $0b, $05, $0a, $0a - db $30, $20, $20, $0b, $0a, $08, $08 - db $30, $38, $20, $09, $05, $08, $08 - db $90, $14, $20, $11, $08, $0f, $0c - db $78, $14, $20, $11, $08, $0b, $0d - db $60, $14, $20, $11, $08, $0c, $0e - db $48, $14, $20, $11, $08, $0d, $0f - db $30, $14, $20, $11, $08, $0e, $0b + 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 OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) xor a @@ -511,7 +535,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) ld e, [hl] inc hl ld d, [hl] - ld a, [wInPlayAreaCursorPosition] + ld a, [wInPlayAreaCurPosition] ld l, a ld h, $07 call HtimesL @@ -560,16 +584,16 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) ld a, [hl] .process_dpad push af - ld a, [wInPlayAreaCursorPosition] + ld a, [wInPlayAreaCurPosition] ld [wInPlayAreaPreservedPosition], a pop af - ld [wInPlayAreaCursorPosition], a - cp $05 + ld [wInPlayAreaCurPosition], a + cp INPLAYAREA_PLAYER_ACTIVE jr c, .player_area - cp $0b + cp INPLAYAREA_OPP_BENCH_1 jr c, .next - cp $10 + cp INPLAYAREA_PLAYER_PLAY_AREA jr c, .opponent_area jr .next @@ -581,14 +605,14 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) jr nz, .bench_pokemon_exists ; no pokemon in player's bench. - ; then move to player's hand. - ld a, $10 - ld [wInPlayAreaCursorPosition], a + ; then move to player's play area. + ld a, INPLAYAREA_PLAYER_PLAY_AREA + ld [wInPlayAreaCurPosition], a jr .next .bench_pokemon_exists ld b, a - ld a, [wInPlayAreaCursorPosition] + ld a, [wInPlayAreaCurPosition] cp b jr c, .next @@ -598,13 +622,13 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) jr z, .on_left xor a - ld [wInPlayAreaCursorPosition], a + ld [wInPlayAreaCurPosition], a jr .next .on_left ld a, b dec a - ld [wInPlayAreaCursorPosition], a + ld [wInPlayAreaCurPosition], a jr .next .opponent_area @@ -613,14 +637,14 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) dec a jr nz, .bench_pokemon_exists_2 - ld a, $11 - ld [wInPlayAreaCursorPosition], a + ld a, INPLAYAREA_OPP_PLAY_AREA + ld [wInPlayAreaCurPosition], a jr .next .bench_pokemon_exists_2 ld b, a - ld a, [wInPlayAreaCursorPosition] - sub $0b + ld a, [wInPlayAreaCurPosition] + sub INPLAYAREA_OPP_BENCH_1 cp b jr c, .next @@ -628,14 +652,14 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) bit D_LEFT_F, a jr z, .on_right - ld a, $0b - ld [wInPlayAreaCursorPosition], a + ld a, INPLAYAREA_OPP_BENCH_1 + ld [wInPlayAreaCurPosition], a jr .next .on_right ld a, b - add $0a - ld [wInPlayAreaCursorPosition], a + add INPLAYAREA_OPP_DISCARD_PILE + ld [wInPlayAreaCurPosition], a .next ld a, $01 ld [wcfe3], a @@ -659,7 +683,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) call .draw_cursor ld a, $01 farcall PlaySFXConfirmOrCancel - ld a, [wInPlayAreaCursorPosition] + ld a, [wInPlayAreaCurPosition] scf ret @@ -684,7 +708,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb) ld e, [hl] inc hl ld d, [hl] - ld a, [wInPlayAreaCursorPosition] + ld a, [wInPlayAreaCurPosition] ld l, a ld h, $07 call HtimesL @@ -712,7 +736,7 @@ Func_184c8: ; 184c8 (6:44c8) call Func_1852b xor a - ld [wInPlayAreaCursorPosition], a + ld [wInPlayAreaCurPosition], a ld de, $4c8e ; this data is stored in bank 2. ld hl, wInPlayAreaInputTablePointer ld [hl], e diff --git a/src/wram.asm b/src/wram.asm index 71278bb..a2e01a2 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1300,7 +1300,7 @@ wCheckMenuPlayAreaWhichLayout:: ; ce51 ds $1 ; the position of cursor in the "In Play Area" screen -wInPlayAreaCursorPosition:: ; ce52 +wInPlayAreaCurPosition:: ; ce52 ; holds the position of the cursor when selecting a prize card wPrizeCardCursorPosition:: ; ce52 @@ -1326,7 +1326,7 @@ wInPlayAreaPreservedPosition:: ; ce57 ; it's used for checking if the player changed ; the cursor in the play area view. -wInPlayAreaTemporaryCursorPosition:: ; ce58 +wInPlayAreaTemporaryPosition:: ; ce58 ds $1 wce59:: ; ce59 -- cgit v1.2.3 From b5e5b355cdc355630d777fe73e0ed19e609d5461 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 25 Jul 2019 19:18:05 +0200 Subject: Reorganize duel constants --- src/constants.asm | 1 + src/constants/card_data_constants.asm | 26 ----------- src/constants/duel_constants.asm | 45 ------------------- src/constants/duel_interface_constants.asm | 70 ++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 src/constants/duel_interface_constants.asm (limited to 'src') diff --git a/src/constants.asm b/src/constants.asm index aec75af..76b206c 100644 --- a/src/constants.asm +++ b/src/constants.asm @@ -3,6 +3,7 @@ INCLUDE "constants/card_constants.asm" INCLUDE "constants/card_data_constants.asm" INCLUDE "constants/deck_constants.asm" INCLUDE "constants/duel_constants.asm" +INCLUDE "constants/duel_interface_constants.asm" INCLUDE "constants/event_constants.asm" INCLUDE "constants/gfx_constants.asm" INCLUDE "constants/hardware_constants.asm" diff --git a/src/constants/card_data_constants.asm b/src/constants/card_data_constants.asm index 4840171..03b26ff 100644 --- a/src/constants/card_data_constants.asm +++ b/src/constants/card_data_constants.asm @@ -184,29 +184,3 @@ FLAG_3_BIT_1 EQU %00000010 ; special CARD_DATA_RETREAT_COST values UNABLE_RETREAT EQU $64 - -; wCardPageNumber constants -CARDPAGE_POKEMON_OVERVIEW EQU $01 -CARDPAGE_POKEMON_MOVE1_1 EQU $02 -CARDPAGE_POKEMON_MOVE1_2 EQU $03 -CARDPAGE_POKEMON_MOVE2_1 EQU $04 -CARDPAGE_POKEMON_MOVE2_2 EQU $05 -CARDPAGE_POKEMON_DESCRIPTION EQU $06 -CARDPAGE_ENERGY EQU $09 -CARDPAGE_TRAINER_1 EQU $0d -CARDPAGE_TRAINER_2 EQU $0e - -; wMovePageNumber constants -MOVEPAGE_MOVE1_1 EQU $00 -MOVEPAGE_MOVE1_2 EQU $01 -MOVEPAGE_MOVE2_1 EQU $02 -MOVEPAGE_MOVE2_2 EQU $03 - -; wCardPageType constants -CARDPAGETYPE_NOT_PLAY_AREA EQU $00 -CARDPAGETYPE_PLAY_AREA EQU $01 - -; card type header constants ($10-tile headers in DuelCardHeaderGraphics) -HEADER_TRAINER EQU $00 -HEADER_ENERGY EQU $01 -HEADER_POKEMON EQU $02 diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index e64fe38..f3e2912 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -222,50 +222,5 @@ NO_DAMAGE_OR_EFFECT_NSHIELD EQU $05 EFFECT_FAILED_NO_EFFECT EQU $01 EFFECT_FAILED_UNSUCCESSFUL EQU $02 -; Box message id's - const_def - const BOXMSG_PLAYERS_TURN - const BOXMSG_OPPONENTS_TURN - const BOXMSG_BETWEEN_TURNS - const BOXMSG_DECISION - const BOXMSG_BENCH_POKEMON - const BOXMSG_ARENA_POKEMON - const BOXMSG_COIN_TOSS - -; wDuelDisplayedScreen constants -DUEL_MAIN_SCENE EQU $01 -PLAY_AREA_CARD_LIST EQU $02 -COIN_TOSS EQU $06 -DRAW_CARDS EQU $07 -LARGE_CARD_PICTURE EQU $08 -SHUFFLE_DECK EQU $09 -CHECK_PLAY_AREA EQU $0a - -; wCardListItemSelectionMenuType constants -;NONE EQU $00 -PLAY_CHECK EQU $01 -SELECT_CHECK EQU $02 - -; wInPlayAreaCurPosition constants - const_def - const INPLAYAREA_PLAYER_BENCH_1 ; $00 - const INPLAYAREA_PLAYER_BENCH_2 ; $01 - const INPLAYAREA_PLAYER_BENCH_3 ; $02 - const INPLAYAREA_PLAYER_BENCH_4 ; $03 - const INPLAYAREA_PLAYER_BENCH_5 ; $04 - const INPLAYAREA_PLAYER_ACTIVE ; $05 - const INPLAYAREA_PLAYER_HAND ; $06 - const INPLAYAREA_PLAYER_DISCARD_PILE ; $07 - const INPLAYAREA_OPP_ACTIVE ; $08 - const INPLAYAREA_OPP_HAND ; $09 - const INPLAYAREA_OPP_DISCARD_PILE ; $0a - const INPLAYAREA_OPP_BENCH_1 ; $0b - const INPLAYAREA_OPP_BENCH_2 ; $0c - const INPLAYAREA_OPP_BENCH_3 ; $0d - const INPLAYAREA_OPP_BENCH_4 ; $0e - const INPLAYAREA_OPP_BENCH_5 ; $0f - const INPLAYAREA_PLAYER_PLAY_AREA ; $10 - const INPLAYAREA_OPP_PLAY_AREA ; $11 - ; wAnimationQueue length ANIMATION_QUEUE_LENGTH EQU 7 diff --git a/src/constants/duel_interface_constants.asm b/src/constants/duel_interface_constants.asm new file mode 100644 index 0000000..baf0a4c --- /dev/null +++ b/src/constants/duel_interface_constants.asm @@ -0,0 +1,70 @@ +; wCardPageNumber constants +CARDPAGE_POKEMON_OVERVIEW EQU $01 +CARDPAGE_POKEMON_MOVE1_1 EQU $02 +CARDPAGE_POKEMON_MOVE1_2 EQU $03 +CARDPAGE_POKEMON_MOVE2_1 EQU $04 +CARDPAGE_POKEMON_MOVE2_2 EQU $05 +CARDPAGE_POKEMON_DESCRIPTION EQU $06 +CARDPAGE_ENERGY EQU $09 +CARDPAGE_TRAINER_1 EQU $0d +CARDPAGE_TRAINER_2 EQU $0e + +; wMovePageNumber constants +MOVEPAGE_MOVE1_1 EQU $00 +MOVEPAGE_MOVE1_2 EQU $01 +MOVEPAGE_MOVE2_1 EQU $02 +MOVEPAGE_MOVE2_2 EQU $03 + +; wCardPageType constants +CARDPAGETYPE_NOT_PLAY_AREA EQU $00 +CARDPAGETYPE_PLAY_AREA EQU $01 + +; card type header constants ($10-tile headers in DuelCardHeaderGraphics) +HEADER_TRAINER EQU $00 +HEADER_ENERGY EQU $01 +HEADER_POKEMON EQU $02 + +; Box message id's + const_def + const BOXMSG_PLAYERS_TURN + const BOXMSG_OPPONENTS_TURN + const BOXMSG_BETWEEN_TURNS + const BOXMSG_DECISION + const BOXMSG_BENCH_POKEMON + const BOXMSG_ARENA_POKEMON + const BOXMSG_COIN_TOSS + +; wDuelDisplayedScreen constants +DUEL_MAIN_SCENE EQU $01 +PLAY_AREA_CARD_LIST EQU $02 +COIN_TOSS EQU $06 +DRAW_CARDS EQU $07 +LARGE_CARD_PICTURE EQU $08 +SHUFFLE_DECK EQU $09 +CHECK_PLAY_AREA EQU $0a + +; wCardListItemSelectionMenuType constants +;NONE EQU $00 +PLAY_CHECK EQU $01 +SELECT_CHECK EQU $02 + +; wInPlayAreaCurPosition constants + const_def + const INPLAYAREA_PLAYER_BENCH_1 ; $00 + const INPLAYAREA_PLAYER_BENCH_2 ; $01 + const INPLAYAREA_PLAYER_BENCH_3 ; $02 + const INPLAYAREA_PLAYER_BENCH_4 ; $03 + const INPLAYAREA_PLAYER_BENCH_5 ; $04 + const INPLAYAREA_PLAYER_ACTIVE ; $05 + const INPLAYAREA_PLAYER_HAND ; $06 + const INPLAYAREA_PLAYER_DISCARD_PILE ; $07 + const INPLAYAREA_OPP_ACTIVE ; $08 + const INPLAYAREA_OPP_HAND ; $09 + const INPLAYAREA_OPP_DISCARD_PILE ; $0a + const INPLAYAREA_OPP_BENCH_1 ; $0b + const INPLAYAREA_OPP_BENCH_2 ; $0c + const INPLAYAREA_OPP_BENCH_3 ; $0d + const INPLAYAREA_OPP_BENCH_4 ; $0e + const INPLAYAREA_OPP_BENCH_5 ; $0f + const INPLAYAREA_PLAYER_PLAY_AREA ; $10 + const INPLAYAREA_OPP_PLAY_AREA ; $11 -- cgit v1.2.3