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 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