diff options
author | jidoc01 <jidoc01@naver.com> | 2019-06-30 13:34:51 +0900 |
---|---|---|
committer | jidoc01 <jidoc01@naver.com> | 2019-06-30 13:38:11 +0900 |
commit | fe2ed2123b186d3bb2868fd6be4ad2a877aca314 (patch) | |
tree | 24fe7f3b84af8ec7b9da2d0794147b853ac25b66 /src | |
parent | 404820c09c726d16b9ce5dd20981d5e3236bc635 (diff) |
[Bank 6] Add wNameBuffer
Diffstat (limited to 'src')
-rw-r--r-- | src/constants/name_constants.asm | 7 | ||||
-rw-r--r-- | src/engine/bank01.asm | 2 | ||||
-rw-r--r-- | src/engine/bank02.asm | 5 | ||||
-rw-r--r-- | src/engine/bank04.asm | 10 | ||||
-rw-r--r-- | src/engine/bank06.asm | 65 | ||||
-rw-r--r-- | src/engine/home.asm | 2 | ||||
-rw-r--r-- | src/sram.asm | 2 | ||||
-rw-r--r-- | src/wram.asm | 8 |
8 files changed, 56 insertions, 45 deletions
diff --git a/src/constants/name_constants.asm b/src/constants/name_constants.asm index b16df80..7d4370c 100644 --- a/src/constants/name_constants.asm +++ b/src/constants/name_constants.asm @@ -1,3 +1,6 @@ -PLAYER_NAME_LENGTH EQU $10 +NAME_BUFFER_LENGTH EQU 16 -NAMING_SCREEN_BUFFER_LENGTH EQU $18
\ No newline at end of file +MAX_PLAYER_NAME_LENGTH EQU 6 * 2 +MAX_DECK_NAME_LENGTH EQU 20 * 1 ; note that its unit is byte! + +NAMING_SCREEN_BUFFER_LENGTH EQU 24
\ No newline at end of file diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 46337fb..3e295c0 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -6112,7 +6112,7 @@ DuelDataToSave: ; 6729 (1:6729) ; dw address, number_of_bytes_to_copy dw wPlayerDuelVariables, wOpponentDuelVariables - wPlayerDuelVariables dw wOpponentDuelVariables, wPlayerDeck - wOpponentDuelVariables - dw wPlayerDeck, wc500 + $10 - wPlayerDeck + dw wPlayerDeck, wNameBuffer + $10 - wPlayerDeck dw wWhoseTurn, wDuelTheme + $1 - wWhoseTurn dw hWhoseTurn, $1 dw wRNG1, wRNGCounter + $1 - wRNG1 diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index c58895c..232fa98 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -254,6 +254,7 @@ Func_8f05: ; 8f05 (2:4f05) ld a, [wceb1] or a jr nz, .asm_8f10 + ; it refers to a data in the other bank without any bank desc. ld hl, Deck1Data jr .asm_8f23 .asm_8f10 @@ -269,8 +270,8 @@ Func_8f05: ; 8f05 (2:4f05) .asm_8f20 ld hl, Deck4Data .asm_8f23 - ld a, $14 - ld bc, $0401 + ld a, MAX_DECK_NAME_LENGTH + lb bc, 4, 1 ld de, wcfb9 farcall InputDeckName ld a, [wcfb9] diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index d9645a5..96a3c4b 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -1182,20 +1182,20 @@ Func_1288c: ; 1288c (4:688c) DisplayPlayerNamingScreen:: ; 128a9 (4:68a9) ; clear the name buffer. - ld hl, wc500 ; c500: name buffer. - ld bc, PLAYER_NAME_LENGTH + ld hl, wNameBuffer ; c500: name buffer. + ld bc, NAME_BUFFER_LENGTH ld a, TX_END call FillMemoryWithA ; get player's name ; from the user into hl. - ld hl, wc500 + ld hl, wNameBuffer farcall InputPlayerName farcall Func_c1a4 call DoFrameIfLCDEnabled call DisableLCD - ld hl, wc500 + ld hl, wNameBuffer ; get the first byte of the name buffer. ld a, [hl] or a @@ -1205,7 +1205,7 @@ DisplayPlayerNamingScreen:: ; 128a9 (4:68a9) .no_name ; set the default name. ld de, sPlayerName - ld bc, PLAYER_NAME_LENGTH + ld bc, NAME_BUFFER_LENGTH call EnableSRAM call CopyDataHLtoDE_SaveRegisters ; it seems for integrity checking. diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index c092d16..987958f 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -731,7 +731,7 @@ Func_006_4598: ; 18598 (6:4598) .asm_006_45f7 call DoFrame ldh a, [hKeysPressed] - and $02 + and B_BUTTON jr z, .asm_006_45f7 ld a, $ff farcall Func_90fb @@ -1532,9 +1532,9 @@ PlaySFXByA: ; (6:6794) InputPlayerName: ; (6:67a3) ld e, l ld d, h - ld a, $0c + ld a, MAX_PLAYER_NAME_LENGTH ld hl, WhatIsYourNameData - lb bc, $0c, $01 + lb bc, 12, 1 call InitializeInputName call Set_OBJ_8x8 xor a @@ -1573,9 +1573,9 @@ InputPlayerName: ; (6:67a3) ld a, $01 call PlaySFXByA call Func_006_6a07 - ld a, $06 + ld a, 6 ld [wNamingScreenCursorX], a - ld a, $05 + ld a, 5 ld [wNamingScreenCursorY], a call Func_006_6a23 jr .loop @@ -1597,12 +1597,12 @@ InputPlayerName: ; (6:67a3) jr z, .loop ; empty string? ; erase one character. ld e, a - ld d, $00 + ld d, 0 ld hl, wNamingScreenBuffer add hl, de dec hl dec hl - ld [hl], $00 + ld [hl], TX_END ld hl, wNamingScreenBufferLength ; note that its unit is byte, not word. dec [hl] dec [hl] @@ -1611,12 +1611,13 @@ InputPlayerName: ; (6:67a3) ; it's called when naming(either player's or deck's) starts. ; a: maximum length of name(depending on whether player's or deck's). +; bc: position of name. ; de: dest. pointer. ; hl: pointer to text item of the question. InitializeInputName: ld [wNamingScreenBufferMaxLength], a push hl - ld hl, wd007 + ld hl, wNamingScreenNamePosition ld [hl], b inc hl ld [hl], c @@ -1634,7 +1635,7 @@ InitializeInputName: inc hl ld [hl], d ; clear the name buffer. - ld a, $18 + ld a, NAMING_SCREEN_BUFFER_LENGTH ld hl, wNamingScreenBuffer call ClearMemory ld hl, wNamingScreenBuffer @@ -1699,13 +1700,13 @@ DrawNamingScreenBG: db $ff DrawTextboxForKeyboard: - ld de, $0003 ; x, y - ld bc, $140f ; w, h + lb de, 0, 3 ; x, y + lb bc, 20, 15 ; w, h call DrawRegularTextBox ret PrintPlayerNameFromInput: - ld hl, wd007 + ld hl, wNamingScreenNamePosition ld d, [hl] inc hl ld e, [hl] @@ -1965,7 +1966,7 @@ Func_006_6a28: jr nz, .asm_006_6a49 dec a .asm_006_6a49 - ld hl, wd007 + ld hl, wNamingScreenNamePosition add [hl] ld d, a ld h, $08 @@ -2329,20 +2330,24 @@ KeyboardData: ; (6:6baf) kbitem $54, $00, $50, $0e, $0055 kbitem $51, $0e, $56, $00, $0000 -; get deck name from the user -; into de. +; get deck name from the user into de. +; function description is similar to the player's. +; refer to 'InputPlayerName'. InputDeckName: ; 1ad89 (6:6d89) push af + ; check if the buffer is empty. ld a, [de] or a - jr nz, .asm_006_6d91 - ld a, $06 + jr nz, .not_empty + ; this buffer will contain half-width chars. + ld a, TX_HALFWIDTH ld [de], a -.asm_006_6d91 +.not_empty pop af inc a call InitializeInputName call Set_OBJ_8x8 + xor a ld [wTileMapFill], a call EmptyScreen @@ -2367,7 +2372,7 @@ InputDeckName: ; 1ad89 (6:6d89) ld [wceaa], a ld a, $00 ld [wceab], a -.asm_006_6dd6 +.loop ld a, $01 ld [wVBlankOAMCopyToggle], a call DoFrame @@ -2378,18 +2383,18 @@ InputDeckName: ; 1ad89 (6:6d89) ld a, $01 call PlaySFXByA call Func_006_6fa1 - ld a, $06 + ld a, 6 ld [wNamingScreenCursorX], a ld [wNamingScreenCursorY], a call Func_006_6fbd - jr .asm_006_6dd6 + jr .loop .on_start call Func_006_6efb - jr nc, .asm_006_6dd6 + jr nc, .loop cp $ff jr z, .asm_006_6e1c call Func_006_6ec3 - jr nc, .asm_006_6dd6 + jr nc, .loop call FinalizeInputName ld hl, wNamingScreenDestPointer ld a, [hli] @@ -2400,23 +2405,23 @@ InputDeckName: ; 1ad89 (6:6d89) or a jr nz, .asm_006_6e1b dec hl - ld [hl], $00 + ld [hl], TX_END .asm_006_6e1b ret .asm_006_6e1c ld a, [wNamingScreenBufferLength] cp $02 - jr c, .asm_006_6dd6 + jr c, .loop ld e, a - ld d, $00 + ld d, 0 ld hl, wNamingScreenBuffer add hl, de dec hl - ld [hl], $00 + ld [hl], TX_END ld hl, wNamingScreenBufferLength dec [hl] call ProcessTextWithUnderbar - jp .asm_006_6dd6 + jp .loop ; fill v0Tiles0 for 0x10 tiles ; with 0xF0. @@ -2439,7 +2444,7 @@ rept $10 endr ProcessTextWithUnderbar: - ld hl, wd007 + ld hl, wNamingScreenNamePosition ld d, [hl] inc hl ld e, [hl] @@ -2688,7 +2693,7 @@ Func_006_6fc2: .asm_006_6fdf dec a ld d, a - ld hl, wd007 + ld hl, wNamingScreenNamePosition ld a, [hl] sla a add d diff --git a/src/engine/home.asm b/src/engine/home.asm index 72aedcf..cab683d 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -5351,7 +5351,7 @@ CopyOpponentName: ; 1c8e (0:1c8e) ld h, a jp CopyText .special_name - ld hl, wc500 + ld hl, wNameBuffer ld a, [hl] or a jr z, .print_player2 diff --git a/src/sram.asm b/src/sram.asm index c69e4c0..272fbfd 100644 --- a/src/sram.asm +++ b/src/sram.asm @@ -25,7 +25,7 @@ s0a00c:: ; a00c ds $4 sPlayerName:: ; a010 - ds $10 + ds NAME_BUFFER_LENGTH ds $e0 diff --git a/src/wram.asm b/src/wram.asm index e34f4c3..3af5361 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -363,8 +363,9 @@ ENDU wOpponentDeck:: ; c480 ds $80 -wc500:: ; c500 - ds $10 +; this holds names like player's or opponent's. +wNameBuffer:: ; c500 + ds NAME_BUFFER_LENGTH ; this holds an $ff-terminated list of card deck indexes (e.g. cards in hand or in bench) ; or (less often) the attack list of a Pokemon card @@ -1499,7 +1500,8 @@ wd005:: ; d005 wNamingScreenCursorX:: ; d006 ds $1 -wd007:: ; d007 +; the position to display the input on. +wNamingScreenNamePosition:: ; d007 ds $2 wd009:: ; d009 |