summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2018-07-10 23:14:39 +0200
committerxCrystal <rgr.crystal@gmail.com>2018-07-10 23:14:39 +0200
commit1cb35e7d97933f146ad9ab7966bb496536aa3d93 (patch)
treedb984b49773cc45106335a47e3344bb07c78afcf /src
parent1ef94a8af1a7232bf6e54911b16e0dd63c4f602f (diff)
More text engine
TODO: update charmaps and text/
Diffstat (limited to 'src')
-rw-r--r--src/constants/gfx_constants.asm3
-rw-r--r--src/constants/text_constants.asm42
-rw-r--r--src/engine/bank06.asm2
-rw-r--r--src/engine/home.asm240
-rw-r--r--src/hram.asm7
-rw-r--r--src/macros/wram.asm8
-rw-r--r--src/text/text4.asm6
-rw-r--r--src/text/text6.asm16
-rw-r--r--src/text/text9.asm2
-rw-r--r--src/wram.asm2
10 files changed, 187 insertions, 141 deletions
diff --git a/src/constants/gfx_constants.asm b/src/constants/gfx_constants.asm
index f5915d3..4ab84d2 100644
--- a/src/constants/gfx_constants.asm
+++ b/src/constants/gfx_constants.asm
@@ -14,6 +14,9 @@ palettes EQUS "* CGB_PAL_SIZE"
TILE_SIZE EQU 16 ; bytes
tiles EQUS "* TILE_SIZE"
+TILE_SIZE_1BPP EQU 8 ; bytes
+tiles_1bpp EQUS "* TILE_SIZE_1BPP"
+
; wFlushPaletteFlags constants
FLUSH_ONE EQU %10000000
FLUSH_ALL EQU %11000000
diff --git a/src/constants/text_constants.asm b/src/constants/text_constants.asm
index 70e0ab7..ed0938b 100644
--- a/src/constants/text_constants.asm
+++ b/src/constants/text_constants.asm
@@ -1,14 +1,36 @@
-TX_END EQU $00
-TX_SYMBOL EQU $05
-TX_START EQU $06
-TX_RAM1 EQU $09
-TX_LINE EQU "\n" ; $0a
-TX_RAM2 EQU $0B
-TX_RAM3 EQU $0C
+TX_END EQU $00
-text EQUS "db TX_START, "
-line EQUS "db TX_LINE, "
-done EQUS "db TX_END"
+; TX_FULLWIDTH*, char1, TX_FULLWIDTH*, char2, ...
+TX_FULLWIDTH1 EQU $01
+TX_FULLWIDTH2 EQU $02
+TX_FULLWIDTH3 EQU $03
+TX_FULLWIDTH4 EQU $04
+
+TX_CTRL_BEGIN EQU $05
+
+; TX_SYMBOL, char1, TX_SYMBOL, char2, ...
+TX_SYMBOL EQU $05
+
+; TX_HALFWIDTH, char1, char2, ...
+TX_HALFWIDTH EQU $06 ; sets wFontWidth to HALF_WIDTH
+
+TX_HALF2FULL EQU $07 ; sets wFontWidth to FULL_WIDTH, and hDefaultFont to TX_FULLWIDTH6
+TX_RAM1 EQU $09
+TX_LINE EQU "\n" ; $0a
+TX_RAM2 EQU $0b
+TX_RAM3 EQU $0c
+
+; usage: TX_FULLWIDTH*, char1, char2, ...
+; db char1, char2, ... defaults to the value at hDefaultFont, unless
+; wFontWidth was set to HALF_WIDTH by TX_HALFWIDTH (it is FULL_WIDTH by default)
+TX_FULLWIDTH5 EQU $0e ; sets hDefaultFont to TX_FULLWIDTH5
+TX_FULLWIDTH6 EQU $0f ; sets hDefaultFont to TX_FULLWIDTH6
+
+TX_CTRL_END EQU $10
+
+text EQUS "db TX_HALFWIDTH, "
+line EQUS "db TX_LINE, "
+done EQUS "db TX_END"
charmap "é", "`"
charmap "♂", "$"
diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm
index 7c19b74..f952585 100644
--- a/src/engine/bank06.asm
+++ b/src/engine/bank06.asm
@@ -11,7 +11,7 @@ _CopyCardNameAndLevel: ; 18000 (6:4000)
call CopyText ; copy card name to wDefaultText
pop hl
ld a, [hli]
- cp TX_START
+ cp TX_HALFWIDTH
jp z, Func_18086
ld a, [wcd9b]
ld c, a
diff --git a/src/engine/home.asm b/src/engine/home.asm
index cc00b7d..add74b6 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -842,12 +842,12 @@ CallHL: ; 05c1 (0:05c1)
; 0x5c2
; converts two one-digit numbers provided in a to text (ascii) format,
-; writes them to [wcaa0] and [wcaa0 + 1], and to the BGMap0 address at bc
+; writes them to [wTextBuf] and [wTextBuf + 1], and to the BGMap0 address at bc
WriteTwoOneDigitNumbers: ; 05c2 (0:05c2)
push hl
push bc
push de
- ld hl, wcaa0
+ ld hl, wTextBuf
push hl
push bc
call WriteNumbersInTextFormat
@@ -863,12 +863,12 @@ WriteTwoOneDigitNumbers: ; 05c2 (0:05c2)
; 0x5db
; converts a one-digit number provided in the lower nybble of a to text
-; (ascii) format, and writes it to [wcaa0] and to the BGMap0 address at bc
+; (ascii) format, and writes it to [wTextBuf] and to the BGMap0 address at bc
WriteOneDigitNumber: ; 05db (0:05db)
push hl
push bc
push de
- ld hl, wcaa0
+ ld hl, wTextBuf
push hl
push bc
call WriteNumberInTextFormat
@@ -884,14 +884,14 @@ WriteOneDigitNumber: ; 05db (0:05db)
; 0x5f4
; converts four one-digit numbers provided in h and l to text (ascii) format,
-; writes them to [wcaa0] through [wcaa0 + 3], and to the BGMap0 address at bc
+; writes them to [wTextBuf] through [wTextBuf + 3], and to the BGMap0 address at bc
WriteFourOneDigitNumbers: ; 05f4 (0:05f4)
push hl
push bc
push de
ld e, l
ld d, h
- ld hl, wcaa0
+ ld hl, wTextBuf
push hl
push bc
ld a, d
@@ -934,13 +934,13 @@ WriteNumberInTextFormat:
; 0x627
; converts the one-byte number at a to text (ascii) format,
-; and writes it to [wcaa0] and the BGMap0 address at bc
+; and writes it to [wTextBuf] and the BGMap0 address at bc
WriteOneByteNumber: ; 0627 (0:0627)
push bc
push hl
ld l, a
ld h, $00
- ld de, wcaa0
+ ld de, wTextBuf
push de
push bc
ld bc, -100
@@ -960,10 +960,10 @@ WriteOneByteNumber: ; 0627 (0:0627)
; 0x650
; converts the two-byte number at hl to text (ascii) format,
-; and writes it to [wcaa0] and the BGMap0 address at bc
+; and writes it to [wTextBuf] and the BGMap0 address at bc
WriteTwoByteNumber: ; 0650 (0:0650)
push bc
- ld de, wcaa0
+ ld de, wTextBuf
push de
call TwoByteNumberToText
call BCCoordToBGMap0Address
@@ -5991,7 +5991,7 @@ Func_212f: ; 212f (0:212f)
DrawDuelBoxMessage: ; 2167 (0:2167)
ld l, a
- ld h, (40 tiles) / 4 ; boxes are 10x4 tiles
+ ld h, 40 tiles / 4 ; boxes are 10x4 tiles
call HtimesL
add hl, hl
add hl, hl
@@ -6016,16 +6016,16 @@ Func_21c5: ; 21c5 (0:21c5)
call Func_2298
jr .asm_21e8
.asm_21cc
- cp $5
+ cp TX_CTRL_BEGIN
jr c, .asm_21d9
- cp $10
+ cp TX_CTRL_END
jr nc, .asm_21d9
call Func_21f2
jr .asm_21e8
.asm_21d9
ld e, a
ld d, [hl]
- call Func_2546
+ call ProcessFullWidthFontCharacterPair
jr nc, .asm_21e1
inc hl
.asm_21e1
@@ -6042,38 +6042,38 @@ Func_21c5: ; 21c5 (0:21c5)
ret
Func_21f2: ; 21f2 (0:21f2)
- or a
- jr z, .asm_2241
- cp $e
+ or a ; TX_END
+ jr z, .tx_end
+ cp TX_FULLWIDTH5
jr z, .asm_2221
- cp $f
+ cp TX_FULLWIDTH6
jr z, .asm_2221
- cp $a
- jr z, .reached_line_length
+ cp "\n"
+ jr z, .end_of_line
cp TX_SYMBOL
- jr z, .asm_2225
- cp TX_START
- jr z, .asm_220f
- cp $7
- jr z, .asm_2215
+ jr z, .tx_symbol
+ cp TX_HALFWIDTH
+ jr z, .tx_halfwidth
+ cp TX_HALF2FULL
+ jr z, .tx_half2full
scf
ret
-.asm_220f
+.tx_halfwidth
ld a, HALF_WIDTH
ld [wFontWidth], a
ret
-.asm_2215
+.tx_half2full
call Func_230f
xor a ; FULL_WIDTH
ld [wFontWidth], a
- ld a, $f
- ldh [hffaf], a
+ ld a, TX_FULLWIDTH6
+ ldh [hDefaultFont], a
ret
.asm_2221
- ldh [hffaf], a
+ ldh [hDefaultFont], a
xor a
ret
-.asm_2225
+.tx_symbol
ld a, [wFontWidth]
push af
ld a, HALF_WIDTH
@@ -6090,17 +6090,17 @@ Func_21f2: ; 21f2 (0:21f2)
pop hl
.asm_2240
inc hl
-.asm_2241
+.tx_end
ldh a, [hTextLineLength]
or a
ret z
ld b, a
ldh a, [hTextLineCurPos]
cp b
- jr z, .reached_line_length
+ jr z, .end_of_line
xor a
ret
-.reached_line_length
+.end_of_line
call Func_230f
ld a, [wLineSeparation]
or a
@@ -6151,14 +6151,14 @@ Func_2275: ; 2275 (0:2275)
; wFontWidth <- FULL_WIDTH
; hTextLineCurPos <- 0
; wcd0b <- 0
-; hffaf <- $f
+; hDefaultFont <- TX_FULLWIDTH6
Func_2298: ; 2298 (0:2298)
xor a ; FULL_WIDTH
ld [wFontWidth], a
ldh [hTextLineCurPos], a
ld [wcd0b], a
- ld a, $f
- ldh [hffaf], a
+ ld a, TX_FULLWIDTH6
+ ldh [hDefaultFont], a
ret
; Func_22ae
@@ -6387,7 +6387,7 @@ CaseHalfWidthLetter: ; 23b1 (0:23b1)
Func_23c1: ; 23c1 (0:23c1)
ld a, [hl]
- cp TX_START
+ cp TX_HALFWIDTH
jr nz, .asm_23cf
call Func_23d3
inc b
@@ -6407,9 +6407,9 @@ Func_23d3: ; 23d3 (0:23d3)
or a
jr z, .asm_23f8
inc c
- cp $5
+ cp TX_CTRL_BEGIN
jr c, .asm_23ec
- cp $10
+ cp TX_CTRL_END
jr nc, .asm_23ec
cp TX_SYMBOL
jr nz, .asm_23d8
@@ -6419,7 +6419,7 @@ Func_23d3: ; 23d3 (0:23d3)
ld e, a
ld d, [hl]
inc b
- call Func_2546
+ call ProcessFullWidthFontCharacterPair
jr nc, .asm_23d8
.asm_23f4
inc c
@@ -6435,12 +6435,12 @@ Func_23d3: ; 23d3 (0:23d3)
INCROM $23fd, $245d
-; convert the number at hl to TX_SYMBOL text format and write it to wcaa0
+; convert the number at hl to TX_SYMBOL text format and write it to wTextBuf
; replace leading zeros with SYM_SPACE
TwoByteNumberToTxSymbol_TrimLeadingZeros: ; 245d (0:245d)
push de
push bc
- ld de, wcaa0
+ ld de, wTextBuf
push de
ld bc, -10000
call .get_digit
@@ -6538,9 +6538,9 @@ CreateHalfWidthFontTile: ; 24ca (0:24ca)
ld a, d
ld de, wTextTileBuffer + 1
call CopyHalfWidthCharacterToDE
- ; construct the resulting half-width font tile
+ ; construct the 2bpp-converted half-width font tile
ld hl, wTextTileBuffer
- ld b, TILE_SIZE / 2
+ ld b, TILE_SIZE_1BPP
.loop
ld a, [hli]
swap a
@@ -6555,7 +6555,7 @@ CreateHalfWidthFontTile: ; 24ca (0:24ca)
ld de, wTextTileBuffer
ret
-; copies a half-tile corresponding to a half-width font character to de.
+; copies a 1bpp tile corresponding to a half-width font character to de.
; the ascii value of the character to copy is provided in a.
; assumes BANK(HalfWidthFont) is already loaded.
CopyHalfWidthCharacterToDE: ; 24fa (0:24fa)
@@ -6567,12 +6567,12 @@ CopyHalfWidthCharacterToDE: ; 24fa (0:24fa)
add hl, hl
ld bc, HalfWidthFont
add hl, bc
- ld b, TILE_SIZE / 2
+ ld b, TILE_SIZE_1BPP
.loop
ld a, [hli]
ld [de], a
inc de
- inc de ; skip the other half of the tile
+ inc de
dec b
jr nz, .loop
ret
@@ -6615,7 +6615,7 @@ CreateFullWidthFontTile: ; 252e (0:252e)
call BankpushHome
ld de, wTextTileBuffer
push de
- ld c, TILE_SIZE / 2
+ ld c, TILE_SIZE_1BPP
.loop
ld a, [hli]
ld [de], a
@@ -6628,32 +6628,37 @@ CreateFullWidthFontTile: ; 252e (0:252e)
call BankpopHome
ret
-Func_2546: ; 2546 (0:2546)
+; given two text characters at de, use the char at d to determine
+; which type of TX_FULLWIDTH this pair of characters belongs to.
+; return carry if TX_FULLWIDTH1 to TX_FULLWIDTH4.
+ProcessFullWidthFontCharacterPair: ; 2546 (0:2546)
ld a, [wFontWidth]
or a ; FULL_WIDTH
- jr nz, .asm_255f
+ jr nz, .half_width
ld a, e
- cp $10
- jr c, .asm_2561
+ cp TX_CTRL_END
+ jr c, .continue_check
cp $60
- jr nc, .asm_2565
- ldh a, [hffaf]
- cp $f
- jr nz, .asm_2565
- ld d, $f
+ jr nc, .first_font
+ ldh a, [hDefaultFont]
+ cp TX_FULLWIDTH6
+ jr nz, .first_font
+ ld d, TX_FULLWIDTH6
or a
ret
-.asm_255f
+.half_width
or a
ret
-.asm_2561
- cp $5
- jr c, .asm_2569
-.asm_2565
+.continue_check
+ cp TX_CTRL_BEGIN
+ jr c, .ath_font
+.first_font
+; TX_FULLWIDTH5
ld d, $0
or a
ret
-.asm_2569
+.ath_font
+; TX_FULLWIDTH1 to TX_FULLWIDTH4
ld e, d
ld d, a
scf
@@ -6661,19 +6666,21 @@ Func_2546: ; 2546 (0:2546)
; convert the full-width font tile number at de to the
; equivalent offset within the full-width font tile graphics.
-; d = $e and d = $f are treated differently
+; if d == TX_FULLWIDTH6: get tile from the 80-tile font at the top of the graphics.
+; if d == TX_FULLWIDTH5 or d == $0: get tile from first 256-tile font of the graphics.
+; if d >= TX_FULLWIDTH1 and d <= TX_FULLWIDTH4: get tile from N+1th 256-tile font of the graphics.
GetFullWidthFontTileOffset: ; 256d (0:256d)
- ld bc, 40 tiles
+ ld bc, $50 tiles_1bpp
ld a, d
- cp $e
- jr z, .asm_2580
- cp $f
+ cp TX_FULLWIDTH5
+ jr z, .first_font
+ cp TX_FULLWIDTH6
jr nz, .get_address
- ld bc, $0000
+ ld bc, $0 tiles
ld a, e
- sub $10
+ sub $10 ; the first $10 are control characters, but this font's graphics start at $0
ld e, a
-.asm_2580
+.first_font
ld d, $0
.get_address
ld l, e
@@ -7805,9 +7812,9 @@ Func_2c37: ; 2c37 (0:2c37)
ld a, [hli]
or a ; TX_END
jr z, .end
- cp $10
+ cp TX_CTRL_END
jr nc, .char_loop
- cp TX_START
+ cp TX_HALFWIDTH
jr c, .skip
cp "\n"
jr nz, .char_loop
@@ -7838,11 +7845,11 @@ Func_2c62: ; 2c62 (0:2c62)
ld [hl], d
pop hl
ld a, $01
- jr Func_2c84
+ jr PrintScrollableText
Func_2c73: ; 2c73 (0:2c73)
xor a
- call Func_2c84
+ call PrintScrollableText
; when a text box is full, prompt the player to press A or B
; in order to clear the text and print the next lines.
@@ -7853,7 +7860,11 @@ WaitForPlayerToAdvanceText: ; 2c77 (0:2c77)
call WaitForButtonAorB
ret
-Func_2c84: ; 2c84 (0:2c84)
+; prints text with id at hl, with letter delay, in a textbox area.
+; unlike PrintText, PrintScrollableText supports scrollable text, and prompts
+; the user to press A or B to advance the page or close the text.
+; used mostly for overworld NPC text.
+PrintScrollableText: ; 2c84 (0:2c84)
ld [wIsTextBoxLabeled], a
ldh a, [hBankROM]
push af
@@ -7864,7 +7875,7 @@ Func_2c84: ; 2c84 (0:2c84)
ld a, [wTextSpeed]
ld c, a
inc c
- jr .asm_2cac
+ jr .go
.nonzero_text_speed
ld a, [wTextSpeed]
cp 2
@@ -7877,7 +7888,7 @@ Func_2c84: ; 2c84 (0:2c84)
push bc
call DoFrame
pop bc
-.asm_2cac
+.go
dec c
jr nz, .nonzero_text_speed
.skip_delay
@@ -7895,24 +7906,24 @@ Func_2c84: ; 2c84 (0:2c84)
call BankswitchHome
ret
-; zero wWhichTextStruct, wWhichTxRam2 and wWhichTxRam3, and set hffaf to $f
-; fill wTextStruct1 with $f, wFontWidth, hBankROM, and register bc for the text's pointer.
+; zero wWhichTextStruct, wWhichTxRam2 and wWhichTxRam3, and set hDefaultFont to TX_FULLWIDTH6
+; fill wTextStruct1 with TX_FULLWIDTH6, wFontWidth, hBankROM, and register bc for the text's pointer.
InitRegistersForPrintingText: ; 2cc8 (0:2cc8)
xor a
ld [wWhichTextStruct], a
ld [wWhichTxRam2], a
ld [wWhichTxRam3], a
- ld a, $f
- ld [hffaf], a
+ ld a, TX_FULLWIDTH6
+ ld [hDefaultFont], a
; fallthrough
-; fill the wTextStruct specified in wWhichTextStruct (0-3) with hffaf,
+; fill the wTextStruct specified in wWhichTextStruct (0-3) with hDefaultFont,
; wFontWidth, hBankROM, and register bc for the text's pointer.
WriteToTextStruct: ; 2cd7 (0:2cd7)
push hl
call GetPointerToTextStruct
pop bc
- ld a, [hffaf]
+ ld a, [hDefaultFont]
ld [hli], a
ld a, [wFontWidth]
ld [hli], a
@@ -7938,7 +7949,7 @@ WriteToTextStruct_MoveToNext: ; 2ceb (0:2ceb)
ReadTextStruct: ; 2cf3 (0:2cf3)
call GetPointerToTextStruct
ld a, [hli]
- ld [hffaf], a
+ ld [hDefaultFont], a
ld a, [hli]
ld [wFontWidth], a
ld a, [hli]
@@ -7990,11 +8001,12 @@ Func_2d43: ; 2d43 (0:2d43)
call ReadTextStruct
ld a, [hli]
or a ; TX_END
- jr z, .asm_2d79
- cp $5
- jr c, .asm_2d65
- cp $10
- jr nc, .asm_2d65
+ jr z, .tx_end
+ cp TX_CTRL_BEGIN
+ jr c, .full_width_font
+ cp TX_CTRL_END
+ jr nc, .full_width_font
+ ; special character
call Func_21f2
jr nc, .asm_2d74
cp TX_RAM1
@@ -8004,10 +8016,10 @@ Func_2d43: ; 2d43 (0:2d43)
cp TX_RAM3
jr z, .tx_ram3
jr .asm_2d74
-.asm_2d65
- ld e, a
- ld d, [hl]
- call Func_2546
+.full_width_font
+ ld e, a ; first char
+ ld d, [hl] ; second char
+ call ProcessFullWidthFontCharacterPair
jr nc, .asm_2d6d
inc hl
.asm_2d6d
@@ -8018,21 +8030,22 @@ Func_2d43: ; 2d43 (0:2d43)
call WriteToTextStruct
or a
ret
-.asm_2d79
+.tx_end
ld a, [wWhichTextStruct]
or a
- jr z, .asm_2d85
+ jr z, .no_more_text
+ ; handle text struct in the above level
dec a
ld [wWhichTextStruct], a
jr Func_2d43
-.asm_2d85
+.no_more_text
call Func_230f
scf
ret
.tx_ram2
call WriteToTextStruct_MoveToNext
- ld a, $f
- ld [hffaf], a
+ ld a, TX_FULLWIDTH6
+ ld [hDefaultFont], a
xor a ; FULL_WIDTH
ld [wFontWidth], a
ld de, wTxRam2
@@ -8058,11 +8071,11 @@ Func_2d43: ; 2d43 (0:2d43)
jp Func_2d43
.tx_ram1
call WriteToTextStruct_MoveToNext
- call CopyTurnDuelistName
- ld a, [wcaa0]
- cp $6
+ call CopyPlayerNameOrTurnDuelistName
+ ld a, [wTextBuf]
+ cp TX_HALFWIDTH
jr z, .asm_2dda
- ld a, $7
+ ld a, TX_HALF2FULL
call Func_21f2
.asm_2dda
call WriteToTextStruct
@@ -8118,16 +8131,16 @@ GetTextOffsetFromTextID: ; 2ded (0:2ded)
ret
; if [wFontWidth] == HALF_WIDTH:
-; convert the number at hl to text (ascii) format and write it to wcaa0
+; convert the number at hl to text (ascii) format and write it to wTextBuf
; return c = 4 - leading_zeros
; if [wFontWidth] == FULL_WIDTH:
-; convert the number at hl to TX_SYMBOL text format and write it to wcaa0
+; convert the number at hl to TX_SYMBOL text format and write it to wTextBuf
; replace leading zeros with SYM_SPACE
TwoByteNumberToText_CountLeadingZeros: ; 2e12 (0:2e12)
ld a, [wFontWidth]
or a ; FULL_WIDTH
jp z, TwoByteNumberToTxSymbol_TrimLeadingZeros
- ld de, wcaa0
+ ld de, wTextBuf
push de
call TwoByteNumberToText
pop hl
@@ -8141,9 +8154,10 @@ TwoByteNumberToText_CountLeadingZeros: ; 2e12 (0:2e12)
jr nz, .digit_loop
ret
-; copy the name of the duelist whose turn it is to de
-CopyTurnDuelistName: ; 2e2c (0:2e2c)
- ld de, wcaa0
+; in the overworld: copy the player's name to wTextBuf
+; in a duel: copy the name of the duelist whose turn it is to wTextBuf
+CopyPlayerNameOrTurnDuelistName: ; 2e2c (0:2e2c)
+ ld de, wTextBuf
push de
ldh a, [hWhoseTurn]
cp OPPONENT_TURN
@@ -8156,7 +8170,8 @@ CopyTurnDuelistName: ; 2e2c (0:2e2c)
pop hl
ret
-; prints text with id at hl, with letter delay, in a textbox area
+; prints text with id at hl, with letter delay, in a textbox area.
+; the text must fit in the textbox; PrintScrollableText should be used instead.
PrintText: ; 2e41 (0:2e41)
ld a, l
or h
@@ -8194,7 +8209,8 @@ PrintText: ; 2e41 (0:2e41)
jr nc, .next_tile_loop
ret
-; prints text with id at hl, without letter delay, in a textbox area
+; prints text with id at hl, without letter delay, in a textbox area.
+; the text must fit in the textbox; PrintScrollableText should be used instead.
PrintTextNoDelay: ; 2e76 (0:2e76)
ldh a, [hBankROM]
push af
diff --git a/src/hram.asm b/src/hram.asm
index 2bf432f..aac2753 100644
--- a/src/hram.asm
+++ b/src/hram.asm
@@ -108,7 +108,12 @@ hTextHorizontalAlign:: ; ffad
hTextLineLength:: ; ffae
ds $1
-hffaf:: ; ffaf
+; when printing text and no leading control character is specified, whether characters $10 to $60
+; map to the first 50 tiles of the full width font graphics as characters $0 to $50
+; (TX_FULLWIDTH6 mode), or map to the first 256-tile font located right after (TX_FULLWIDTH5 mode).
+; the TX_FULLWIDTH5 and TX_FULLWIDTH6 control characters are used to set this address to said value.
+; only these two values are admitted, as any other is interpreted as TX_FULLWIDTH5.
+hDefaultFont:: ; ffaf
ds $1
hffb0:: ; ffb0
diff --git a/src/macros/wram.asm b/src/macros/wram.asm
index a904d87..fc32615 100644
--- a/src/macros/wram.asm
+++ b/src/macros/wram.asm
@@ -40,10 +40,10 @@ move_data_struct: MACRO
ENDM
text_struct: MACRO
-\1Unknown:: ds 1
-\1FontWidth:: ds 1
-\1Address:: ds 2
-\1RomBank:: ds 1
+\1DefaultFont:: ds 1
+\1FontWidth:: ds 1
+\1Address:: ds 2
+\1RomBank:: ds 1
ENDM
; TODO: Figure out what the rest are for
diff --git a/src/text/text4.asm b/src/text/text4.asm
index dd9f326..f2a432e 100644
--- a/src/text/text4.asm
+++ b/src/text/text4.asm
@@ -120,7 +120,7 @@ Text040d: ; 40819 (10:4819)
done
Text040e: ; 409c6 (10:49c6)
- text "Fight to the end, ", TX_START, TX_RAM1, ","
+ text "Fight to the end, ", TX_HALFWIDTH, TX_RAM1, ","
line "and don't give up!"
line "Mason Laboratory"
line " Dr. Mason ;)"
@@ -815,7 +815,7 @@ Text0467: ; 43221 (10:7221)
line "I am the super musical star,"
line "Imakuni?!"
line "I'll sing the Pok`Rap - You dance!"
- line $07,$03,$63, TX_START, "La di da la di da"
+ line $07,$03,$63, TX_HALFWIDTH, "La di da la di da"
line " La di da la di da..."
line "Hey!"
line "Move those feet!"
@@ -878,7 +878,7 @@ Text0471: ; 435a7 (10:75a7)
line "You weren't too bad, but since "
line "I won...Let's see you shake it!"
line "Come on, shake it!!!"
- line $07,$03,$63, TX_START, "La di da la di da"
+ line $07,$03,$63, TX_HALFWIDTH, "La di da la di da"
line " La di da la di da..."
line "... You dance weird!"
done
diff --git a/src/text/text6.asm b/src/text/text6.asm
index a99de27..b60447c 100644
--- a/src/text/text6.asm
+++ b/src/text/text6.asm
@@ -263,7 +263,7 @@ Text054f: ; 48b5b (12:4b5b)
Text0550: ; 48b73 (12:4b73)
text "The Winner of this Challenge Cup "
- line "is ", TX_START, TX_RAM1, "!!!"
+ line "is ", TX_HALFWIDTH, TX_RAM1, "!!!"
done
Text0551: ; 48b9f (12:4b9f)
@@ -272,7 +272,7 @@ Text0551: ; 48b9f (12:4b9f)
done
Text0552: ; 48bb4 (12:4bb4)
- text "Congratulations, ", TX_START, TX_RAM1, "!!!"
+ text "Congratulations, ", TX_HALFWIDTH, TX_RAM1, "!!!"
done
Text0553: ; 48bcc (12:4bcc)
@@ -352,7 +352,7 @@ Text055e: ; 48fcb (12:4fcb)
Text055f: ; 48ff9 (12:4ff9)
text "You've really improved your "
- line "game, ", TX_START, TX_RAM1, "."
+ line "game, ", TX_HALFWIDTH, TX_RAM1, "."
line "Use my card to make it better!"
done
@@ -374,7 +374,7 @@ Text0561: ; 490c6 (12:50c6)
Text0562: ; 4911e (12:511e)
text TX_RAM1, ", That is not the way"
line "to the Hall of Honor."
- line "Hurry, ", TX_START, TX_RAM1, "! Go through to"
+ line "Hurry, ", TX_HALFWIDTH, TX_RAM1, "! Go through to"
line "the Hall of Honor!"
done
@@ -543,7 +543,7 @@ Text057e: ; 49980 (12:5980)
done
Text057f: ; 4999c (12:599c)
- text "Is your Deck ready, ", TX_START, TX_RAM1, "?"
+ text "Is your Deck ready, ", TX_HALFWIDTH, TX_RAM1, "?"
done
Text0580: ; 499b5 (12:59b5)
@@ -682,7 +682,7 @@ Text0597: ; 49f7e (12:5f7e)
done
Text0598: ; 49fb5 (12:5fb5)
- text "Is your Deck ready, ", TX_START, TX_RAM1, "?"
+ text "Is your Deck ready, ", TX_HALFWIDTH, TX_RAM1, "?"
done
Text0599: ; 49fce (12:5fce)
@@ -786,7 +786,7 @@ Text05a8: ; 4a452 (12:6452)
done
Text05a9: ; 4a49a (12:649a)
- text "Is your Deck ready, ", TX_START, TX_RAM1, "?"
+ text "Is your Deck ready, ", TX_HALFWIDTH, TX_RAM1, "?"
done
Text05aa: ; 4a4b3 (12:64b3)
@@ -802,7 +802,7 @@ Text05ac: ; 4a4f5 (12:64f5)
text "I was here first! The Legendary"
line "Pokémon Cards belong to me!"
line "I'll make it all too clear to"
- line "you, ", TX_START, TX_RAM1, "!"
+ line "you, ", TX_HALFWIDTH, TX_RAM1, "!"
done
Text05ad: ; 4a559 (12:6559)
diff --git a/src/text/text9.asm b/src/text/text9.asm
index b329238..6569d18 100644
--- a/src/text/text9.asm
+++ b/src/text/text9.asm
@@ -1092,7 +1092,7 @@ DefeatedFiveOpponentsText: ; 5728e (15:728e)
Text07e7: ; 572ba (15:72ba)
text TX_RAM1, " successfully defeated "
- line "5 opponents ", TX_START, TX_RAM3, " time(s)!!!"
+ line "5 opponents ", TX_HALFWIDTH, TX_RAM3, " time(s)!!!"
done
ConsecutiveWinRecordIncreasedText: ; 572ee (15:72ee)
diff --git a/src/wram.asm b/src/wram.asm
index 0691a19..51ff973 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -373,7 +373,7 @@ SECTION "WRAM Engine 1", WRAM0
wOAM:: ; ca00
ds $a0
-wcaa0:: ; caa0
+wTextBuf:: ; caa0
ds $10
wcab0:: ; cab0