summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/constants.asm1
-rw-r--r--src/constants/charmaps.asm65
-rw-r--r--src/constants/text_constants.asm106
-rw-r--r--src/engine/home.asm74
-rw-r--r--src/hram.asm12
-rw-r--r--src/macros.asm3
-rw-r--r--src/macros/text.asm4
-rw-r--r--src/text/text1.asm16
8 files changed, 151 insertions, 130 deletions
diff --git a/src/constants.asm b/src/constants.asm
index 7755766..c3af333 100644
--- a/src/constants.asm
+++ b/src/constants.asm
@@ -12,3 +12,4 @@ INCLUDE "constants/music_constants.asm"
INCLUDE "constants/npc_constants.asm"
INCLUDE "constants/sgb_constants.asm"
INCLUDE "constants/text_constants.asm"
+INCLUDE "constants/charmaps.asm"
diff --git a/src/constants/charmaps.asm b/src/constants/charmaps.asm
new file mode 100644
index 0000000..4731f7d
--- /dev/null
+++ b/src/constants/charmaps.asm
@@ -0,0 +1,65 @@
+; control characters
+ charmap "<RAMNAME>", TX_RAM1
+ charmap "<RAMTEXT>", TX_RAM2
+ charmap "<RAMNUM>", TX_RAM3
+
+; ascii half-width font
+ charmap "é", "`"
+ charmap "♂", "$"
+ charmap "♀", "%"
+ charmap "”", "\""
+
+; TX_SYMBOL (full-tile icons/symbols loaded at the beginning of v0Tiles2)
+; TODO: If user-defined functions ever become a thing a symbol(*) syntax
+; would probably be preferred over SYM_*
+ charmap "<", TX_SYMBOL
+ const_def
+ txsymbol SPACE ; $00
+ txsymbol FIRE ; $01
+ txsymbol GRASS ; $02
+ txsymbol LIGHTNING ; $03
+ txsymbol WATER ; $04
+ txsymbol FIGHTING ; $05
+ txsymbol PSYCHIC ; $06
+ txsymbol COLORLESS ; $07
+ txsymbol POISONED ; $08
+ txsymbol ASLEEP ; $09
+ txsymbol CONFUSED ; $0a
+ txsymbol PARALYZED ; $0b
+ txsymbol CURSOR_U ; $0c
+ txsymbol POKEMON ; $0d
+ txsymbol UNKNOWN_0E ; $0e
+ txsymbol CURSOR_R ; $0f
+ txsymbol HP ; $10
+ txsymbol Lv ; $11
+ txsymbol E ; $12
+ txsymbol No ; $13
+ txsymbol PLUSPOWER ; $14
+ txsymbol DEFENDER ; $15
+ txsymbol HP_OK ; $16
+ txsymbol HP_NOK ; $17
+ txsymbol BOX_TOP_L ; $18
+ txsymbol BOX_TOP_R ; $19
+ txsymbol BOX_BTM_L ; $1a
+ txsymbol BOX_BTM_R ; $1b
+ txsymbol BOX_TOP ; $1c
+ txsymbol BOX_BOTTOM ; $1d
+ txsymbol BOX_LEFT ; $1e
+ txsymbol BOX_RIGHT ; $1f
+ txsymbol 0 ; $20
+ txsymbol 1 ; $21
+ txsymbol 2 ; $22
+ txsymbol 3 ; $23
+ txsymbol 4 ; $24
+ txsymbol 5 ; $25
+ txsymbol 6 ; $26
+ txsymbol 7 ; $27
+ txsymbol 8 ; $28
+ txsymbol 9 ; $29
+ txsymbol DOT ; $2a
+ txsymbol PLUS ; $2b
+ txsymbol MINUS ; $2c
+ txsymbol x ; $2d
+ txsymbol SLASH ; $2e
+ txsymbol CURSOR_D ; $2f
+ txsymbol PRIZE ; $30
diff --git a/src/constants/text_constants.asm b/src/constants/text_constants.asm
index 434a93a..fbef11a 100644
--- a/src/constants/text_constants.asm
+++ b/src/constants/text_constants.asm
@@ -1,99 +1,49 @@
-TX_END EQU $00
+TX_END EQU $00 ; terminates the text
-; TX_FULLWIDTH*, char1, TX_FULLWIDTH*, char2, ...
+; usage: TX_FULLWIDTH*, char1, TX_FULLWIDTH*, char2, ...
+; source: gfx/fonts/full_width/1_kanji2.1bpp
TX_FULLWIDTH1 EQU $01
+; source: gfx/fonts/full_width/2_kanji3.1bpp
TX_FULLWIDTH2 EQU $02
+; source: gfx/fonts/full_width/3.1bpp (contains latin letters and symbols)
TX_FULLWIDTH3 EQU $03
+; source: gfx/fonts/full_width/4.1bpp
TX_FULLWIDTH4 EQU $04
TX_CTRL_BEGIN EQU $05
-; TX_SYMBOL, char1, TX_SYMBOL, char2, ...
+; usage: TX_SYMBOL, char1, TX_SYMBOL, char2, ...
+; source: gfx/fonts/symbols.2bpp
TX_SYMBOL EQU $05
-; TX_HALFWIDTH, char1, char2, ...
+; usage: TX_HALFWIDTH, char1, char2, ...
+; source: gfx/fonts/half_width.1bpp
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: <half width text>, TX_HALF2FULL, <full width text>
+TX_HALF2FULL EQU $07 ; sets wFontWidth to FULL_WIDTH, and hJapaneseSyllabary to TX_KATAKANA
+
+TX_RAM1 EQU $09 ; prints the player's name or, in a duel, the turn duelist's name
+TX_LINE EQU "\n" ; advances to a new line
+TX_RAM2 EQU $0b ; prints text from wTxRam2 or wTxRam2_b
+TX_RAM3 EQU $0c ; prints a number from wTxRam3 or wTxRam3_b
; usage: TX_FULLWIDTH*, char1, char2, ...
-; db char1, char2, ... defaults to the value at hDefaultFont, unless
+; sources:
+ ; gfx/fonts/full_width/0_1_hiragana.1bpp (characters below $60)
+ ; gfx/fonts/full_width/0_2_digits_kanji1.1bpp (characters above or equal to $60)
+TX_HIRAGANA EQU $0e ; sets hJapaneseSyllabary to TX_HIRAGANA
+; sources:
+ ; gfx/fonts/full_width/0_0_katakana.1bpp (characters below $60)
+ ; gfx/fonts/full_width/0_2_digits_kanji1.1bpp (characters above or equal to $60)
+TX_KATAKANA EQU $0f ; sets hJapaneseSyllabary to TX_KATAKANA
+
+; db char1, char2, ... defaults to the value at hJapaneseSyllabary, unless
; wFontWidth was set to HALF_WIDTH by TX_HALFWIDTH (it is FULL_WIDTH by default).
-; hDefaultFont is TX_FULLWIDTH6 by default.
-TX_FULLWIDTH5 EQU $0e ; sets hDefaultFont to TX_FULLWIDTH5
-TX_FULLWIDTH6 EQU $0f ; sets hDefaultFont to TX_FULLWIDTH6
+; hJapaneseSyllabary is TX_KATAKANA by default.
TX_CTRL_END EQU $10
-text EQUS "db TX_HALFWIDTH, "
-line EQUS "db TX_LINE, "
-done EQUS "db TX_END"
-
- charmap "é", "`"
- charmap "♂", "$"
- charmap "♀", "%"
- charmap "”", "\""
-
; wFontWidth constants
FULL_WIDTH EQU $0
HALF_WIDTH EQU $1 ; non-0
-
-; TX_SYMBOL (full-tile icons/symbols loaded at the beginning of v0Tiles2)
-; TODO: Use symbols in menus (cursor tile number, tile behind cursor), draw text boxes, WriteByteToBGMap0, etc
-; If user-defined functions ever become a thing a symbol(*) syntax would probably be preferred over SYM_*
-
- charmap "<", TX_SYMBOL
- const_def
- txsymbol SPACE ; $00
- txsymbol FIRE ; $01
- txsymbol GRASS ; $02
- txsymbol LIGHTNING ; $03
- txsymbol WATER ; $04
- txsymbol FIGHTING ; $05
- txsymbol PSYCHIC ; $06
- txsymbol COLORLESS ; $07
- txsymbol POISONED ; $08
- txsymbol ASLEEP ; $09
- txsymbol CONFUSED ; $0a
- txsymbol PARALYZED ; $0b
- txsymbol CURSOR_U ; $0c
- txsymbol POKEMON ; $0d
- txsymbol UNKNOWN_0E ; $0e
- txsymbol CURSOR_R ; $0f
- txsymbol HP ; $10
- txsymbol Lv ; $11
- txsymbol E ; $12
- txsymbol No ; $13
- txsymbol PLUSPOWER ; $14
- txsymbol DEFENDER ; $15
- txsymbol HP_OK ; $16
- txsymbol HP_NOK ; $17
- txsymbol BOX_TOP_L ; $18
- txsymbol BOX_TOP_R ; $19
- txsymbol BOX_BTM_L ; $1a
- txsymbol BOX_BTM_R ; $1b
- txsymbol BOX_TOP ; $1c
- txsymbol BOX_BOTTOM ; $1d
- txsymbol BOX_LEFT ; $1e
- txsymbol BOX_RIGHT ; $1f
- txsymbol 0 ; $20
- txsymbol 1 ; $21
- txsymbol 2 ; $22
- txsymbol 3 ; $23
- txsymbol 4 ; $24
- txsymbol 5 ; $25
- txsymbol 6 ; $26
- txsymbol 7 ; $27
- txsymbol 8 ; $28
- txsymbol 9 ; $29
- txsymbol DOT ; $2a
- txsymbol PLUS ; $2b
- txsymbol MINUS ; $2c
- txsymbol x ; $2d
- txsymbol SLASH ; $2e
- txsymbol CURSOR_D ; $2f
- txsymbol PRIZE ; $30
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 3935919..d68951b 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -6044,9 +6044,9 @@ Func_21c5: ; 21c5 (0:21c5)
Func_21f2: ; 21f2 (0:21f2)
or a ; TX_END
jr z, .tx_end
- cp TX_FULLWIDTH5
+ cp TX_HIRAGANA
jr z, .asm_2221
- cp TX_FULLWIDTH6
+ cp TX_KATAKANA
jr z, .asm_2221
cp "\n"
jr z, .end_of_line
@@ -6066,11 +6066,11 @@ Func_21f2: ; 21f2 (0:21f2)
call Func_230f
xor a ; FULL_WIDTH
ld [wFontWidth], a
- ld a, TX_FULLWIDTH6
- ldh [hDefaultFont], a
+ ld a, TX_KATAKANA
+ ldh [hJapaneseSyllabary], a
ret
.asm_2221
- ldh [hDefaultFont], a
+ ldh [hJapaneseSyllabary], a
xor a
ret
.tx_symbol
@@ -6151,14 +6151,14 @@ Func_2275: ; 2275 (0:2275)
; wFontWidth <- FULL_WIDTH
; hTextLineCurPos <- 0
; wcd0b <- 0
-; hDefaultFont <- TX_FULLWIDTH6
+; hJapaneseSyllabary <- TX_KATAKANA
Func_2298: ; 2298 (0:2298)
xor a ; FULL_WIDTH
ld [wFontWidth], a
ldh [hTextLineCurPos], a
ld [wcd0b], a
- ld a, TX_FULLWIDTH6
- ldh [hDefaultFont], a
+ ld a, TX_KATAKANA
+ ldh [hJapaneseSyllabary], a
ret
; Func_22ae
@@ -6494,7 +6494,7 @@ TwoByteNumberToTxSymbol_TrimLeadingZeros: ; 245d (0:245d)
; generates a text tile and copies it to VRAM
; if wFontWidth == FULL_WIDTH
- ; de = full-width font tile number (d = $e and d = $f are treated differently)
+ ; de = full-width font tile number
; if wFontWidth == HALF_WIDTH
; d = half-width character 1 (left)
; e = half-width character 2 (right)
@@ -6577,8 +6577,8 @@ CopyHalfWidthCharacterToDE: ; 24fa (0:24fa)
jr nz, .loop
ret
-; create, at wTextTileBuffer, a full-width font tile
-; given its tile number within the full-width font graphics in de.
+; create, at wTextTileBuffer, a full-width font tile given its tile
+; number within the full-width font graphics (FullWidthFonts) in de.
; return its v*Tiles address in hl, and return c = TILE_SIZE.
CreateFullWidthFontTile_ConvertToTileDataAddress: ; 2510 (0:2510)
push bc
@@ -6608,8 +6608,8 @@ ConvertTileNumberToTileDataAddress: ; 2518 (0:2518)
ld c, TILE_SIZE
ret
-; create, at wTextTileBuffer, a full-width font tile
-; given its offset within the full-width font graphics in hl
+; create, at wTextTileBuffer, a full-width font tile given its
+; within the full-width font graphics (FullWidthFonts) in hl
CreateFullWidthFontTile: ; 252e (0:252e)
ld a, BANK(FullWidthFonts); BANK(DuelGraphics); BANK(HalfWidthFont)
call BankpushHome
@@ -6629,7 +6629,7 @@ CreateFullWidthFontTile: ; 252e (0:252e)
ret
; given two text characters at de, use the char at d to determine
-; which type of TX_FULLWIDTH this pair of characters belongs to.
+; which type of full width text this pair of characters belongs to.
; return carry if TX_FULLWIDTH1 to TX_FULLWIDTH4.
ProcessFullWidthFontCharacterPair: ; 2546 (0:2546)
ld a, [wFontWidth]
@@ -6639,11 +6639,11 @@ ProcessFullWidthFontCharacterPair: ; 2546 (0:2546)
cp TX_CTRL_END
jr c, .continue_check
cp $60
- jr nc, .first_font
- ldh a, [hDefaultFont]
- cp TX_FULLWIDTH6
- jr nz, .first_font
- ld d, TX_FULLWIDTH6
+ jr nc, .not_katakana
+ ldh a, [hJapaneseSyllabary]
+ cp TX_KATAKANA
+ jr nz, .not_katakana
+ ld d, TX_KATAKANA
or a
ret
.half_width
@@ -6652,8 +6652,8 @@ ProcessFullWidthFontCharacterPair: ; 2546 (0:2546)
.continue_check
cp TX_CTRL_BEGIN
jr c, .ath_font
-.first_font
-; TX_FULLWIDTH5
+.not_katakana
+; 0_1_hiragana.1bpp (e < $60) or 0_2_digits_kanji1.1bpp (e >= $60)
ld d, $0
or a
ret
@@ -6666,21 +6666,21 @@ ProcessFullWidthFontCharacterPair: ; 2546 (0:2546)
; convert the full-width font tile number at de to the
; equivalent offset within the full-width font tile graphics.
-; 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.
+; if d == TX_KATAKANA: get tile from the 0_0_katakana.1bpp font.
+; if d == TX_HIRAGANA or d == $0: get tile from the 0_1_hiragana.1bpp or 0_2_digits_kanji1.1bpp font.
+; if d >= TX_FULLWIDTH1 and d <= TX_FULLWIDTH4: get tile from one of the other full-width fonts.
GetFullWidthFontTileOffset: ; 256d (0:256d)
ld bc, $50 tiles_1bpp
ld a, d
- cp TX_FULLWIDTH5
- jr z, .first_font
- cp TX_FULLWIDTH6
+ cp TX_HIRAGANA
+ jr z, .hiragana
+ cp TX_KATAKANA
jr nz, .get_address
ld bc, $0 tiles
ld a, e
sub $10 ; the first $10 are control characters, but this font's graphics start at $0
ld e, a
-.first_font
+.hiragana
ld d, $0
.get_address
ld l, e
@@ -7906,24 +7906,24 @@ PrintScrollableText: ; 2c84 (0:2c84)
call BankswitchHome
ret
-; 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.
+; zero wWhichTextStruct, wWhichTxRam2 and wWhichTxRam3, and set hJapaneseSyllabary to TX_KATAKANA
+; fill wTextStruct1 with TX_KATAKANA, 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, TX_FULLWIDTH6
- ld [hDefaultFont], a
+ ld a, TX_KATAKANA
+ ld [hJapaneseSyllabary], a
; fallthrough
-; fill the wTextStruct specified in wWhichTextStruct (0-3) with hDefaultFont,
+; fill the wTextStruct specified in wWhichTextStruct (0-3) with hJapaneseSyllabary,
; wFontWidth, hBankROM, and register bc for the text's pointer.
WriteToTextStruct: ; 2cd7 (0:2cd7)
push hl
call GetPointerToTextStruct
pop bc
- ld a, [hDefaultFont]
+ ld a, [hJapaneseSyllabary]
ld [hli], a
ld a, [wFontWidth]
ld [hli], a
@@ -7949,7 +7949,7 @@ WriteToTextStruct_MoveToNext: ; 2ceb (0:2ceb)
ReadTextStruct: ; 2cf3 (0:2cf3)
call GetPointerToTextStruct
ld a, [hli]
- ld [hDefaultFont], a
+ ld [hJapaneseSyllabary], a
ld a, [hli]
ld [wFontWidth], a
ld a, [hli]
@@ -8044,8 +8044,8 @@ Func_2d43: ; 2d43 (0:2d43)
ret
.tx_ram2
call WriteToTextStruct_MoveToNext
- ld a, TX_FULLWIDTH6
- ld [hDefaultFont], a
+ ld a, TX_KATAKANA
+ ld [hJapaneseSyllabary], a
xor a ; FULL_WIDTH
ld [wFontWidth], a
ld de, wTxRam2
diff --git a/src/hram.asm b/src/hram.asm
index aac2753..13c4756 100644
--- a/src/hram.asm
+++ b/src/hram.asm
@@ -108,12 +108,12 @@ hTextHorizontalAlign:: ; ffad
hTextLineLength:: ; ffae
ds $1
-; 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
+; when printing text and no leading control character is specified, whether characters
+; $10 to $60 map to the katakana.1bpp font graphics as characters $0 to $50
+; (TX_KATAKANA mode), or map to the hiragana.1bpp font graphics (TX_HIRAGANA mode).
+; the TX_HIRAGANA and TX_KATAKANA control characters are used to set this address to said
+; value. only these two values are admitted, as any other is interpreted as TX_HIRAGANA.
+hJapaneseSyllabary:: ; ffaf
ds $1
hffb0:: ; ffb0
diff --git a/src/macros.asm b/src/macros.asm
index 7425977..d592c8d 100644
--- a/src/macros.asm
+++ b/src/macros.asm
@@ -1,6 +1,7 @@
INCLUDE "macros/audio.asm"
-INCLUDE "macros/code.asm"
INCLUDE "macros/constants.asm"
+INCLUDE "macros/code.asm"
INCLUDE "macros/data.asm"
INCLUDE "macros/scripts.asm"
+INCLUDE "macros/text.asm"
INCLUDE "macros/wram.asm"
diff --git a/src/macros/text.asm b/src/macros/text.asm
new file mode 100644
index 0000000..24c5987
--- /dev/null
+++ b/src/macros/text.asm
@@ -0,0 +1,4 @@
+text EQUS "db TX_HALFWIDTH, "
+textfw EQUS "db TX_FULLWIDTH3, "
+line EQUS "db TX_LINE, "
+done EQUS "db TX_END"
diff --git a/src/text/text1.asm b/src/text/text1.asm
index 4274caf..50210fb 100644
--- a/src/text/text1.asm
+++ b/src/text/text1.asm
@@ -55,7 +55,7 @@ PokemonText: ; 36378 (d:6378)
done
Text000f: ; 36382 (d:6382)
- db $03,$4c
+ textfw $4c
done
LbsText: ; 36385 (d:6385)
@@ -67,15 +67,15 @@ Text0011: ; 3638b (d:638b)
done
Text0012: ; 3638d (d:638d)
- db $03,$52
+ textfw $52
done
Text0013: ; 36390 (d:6390)
- db $03,$53
+ textfw $53
done
Text0014: ; 36393 (d:6393)
- db $03,$54
+ textfw $54
done
Text0015: ; 36396 (d:6396)
@@ -278,16 +278,16 @@ DiscardDescription: ; 36757 (d:6757)
done
Text0042: ; 367cc (d:67cc)
- text TX_RAM1, " will draw ", TX_RAM3, " Prize(s)."
+ text "<RAMNAME> will draw <RAMNUM> Prize(s)."
done
Text0043: ; 367e5 (d:67e5)
- text TX_RAM1, " drew ", TX_RAM3, " Prize(s)."
+ text "<RAMNAME> drew <RAMNUM> Prize(s)."
done
Text0044: ; 367f9 (d:67f9)
- text TX_RAM1, " placed"
- line "a ", TX_RAM2, "."
+ text "<RAMNAME> placed"
+ line "a <RAMTEXT>."
done
Text0045: ; 36808 (d:6808)