Parse a lot of text

still a few hundred kanji to go
This commit is contained in:
dannye
2021-11-01 10:17:52 -05:00
parent 5a01782555
commit a9e0010d3c
31 changed files with 59726 additions and 6444 deletions
+2
View File
@@ -6,4 +6,6 @@ INCLUDE "constants/hardware_constants.asm"
INCLUDE "constants/misc_constants.asm"
INCLUDE "constants/name_constants.asm"
INCLUDE "constants/sgb_constants.asm"
INCLUDE "constants/text_constants.asm"
INCLUDE "constants/attack_animation_constants.asm"
INCLUDE "constants/charmaps.asm"
File diff suppressed because it is too large Load Diff
+51
View File
@@ -0,0 +1,51 @@
TX_END EQU $00 ; terminates the text
; 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_START EQU $05
; usage: TX_SYMBOL, char1, TX_SYMBOL, char2, ...
; source: gfx/fonts/symbols.2bpp
; note: precede each symbol with TX_SYMBOL only when it's going to be processed as text.
; if copying directly to VRAM, don't precede symbols with TX_SYMBOL as they are just tile numbers.
TX_SYMBOL EQU $05
; usage: TX_HALFWIDTH, char1, char2, ...
; source: gfx/fonts/half_width.1bpp
TX_HALFWIDTH EQU $06 ; sets wFontWidth to HALF_WIDTH
; 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, ...
; 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).
; hJapaneseSyllabary is TX_KATAKANA by default.
TX_CTRL_END EQU $10
; wFontWidth constants
FULL_WIDTH EQU $0
HALF_WIDTH EQU $1 ; non-0
+14 -1
View File
@@ -1,7 +1,20 @@
INCLUDE "macros.asm"
INCLUDE "constants.asm"
SECTION "Card Gfx 1", ROMX[$4000], BANK[$1d]
SECTION "Gfx 1", ROMX
Fonts::
FullWidthFonts::
INCBIN "gfx/fonts/full_width/0_0_katakana.1bpp"
INCBIN "gfx/fonts/full_width/0_1_hiragana.1bpp"
INCBIN "gfx/fonts/full_width/0_2_digits_kanji1.1bpp"
INCBIN "gfx/fonts/full_width/1_kanji2.1bpp"
INCBIN "gfx/fonts/full_width/2_kanji3.1bpp"
INCBIN "gfx/fonts/full_width/3_kanji4.1bpp"
INCBIN "gfx/fonts/full_width/4.1bpp"
SECTION "Card Gfx 1", ROMX
CardGraphics:: ; c4000 (1d:4000)
Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+4
View File
@@ -29,6 +29,10 @@ ROM0
"romheader"
org $0150
"start"
ROMX $1b
"Gfx 1"
ROMX $1d
"Card Gfx 1"
ROMX $37
"Text Offsets"
ROMX $38
+1
View File
@@ -2,4 +2,5 @@ INCLUDE "macros/audio.asm"
INCLUDE "macros/constants.asm"
INCLUDE "macros/code.asm"
INCLUDE "macros/data.asm"
INCLUDE "macros/text.asm"
INCLUDE "macros/wram.asm"
+132
View File
@@ -0,0 +1,132 @@
text EQUS "db TX_HALFWIDTH, "
line EQUS "db TX_LINE, "
done EQUS "db TX_END"
half2full EQUS "db TX_HALF2FULL"
katakana: MACRO
db TX_KATAKANA
rept _NARG
if STRSUB(\1, 1, 4) == "FW0_"
db \1
elif STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1
db \1
else
for i, STRLEN(\1)
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
endr
endc
shift
endr
ENDM
hiragana: MACRO
db TX_HIRAGANA
rept _NARG
if STRSUB(\1, 1, 4) == "FW0_"
db \1
elif STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1
db \1
else
for i, STRLEN(\1)
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
endr
endc
shift
endr
ENDM
textfw0: MACRO
rept _NARG
if STRSUB(\1, 1, 4) == "FW0_"
db \1
elif STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1
db \1
else
for i, STRLEN(\1)
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
endr
endc
shift
endr
ENDM
textfw1: MACRO
rept _NARG
if STRSUB(\1, 1, 4) == "FW1_"
db TX_FULLWIDTH1, \1
elif STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1
db \1
else
for i, STRLEN(\1)
if (STRSUB(\1, i + 1, 1)) == " "
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
else
db TX_FULLWIDTH1, STRCAT("FW1_", STRSUB(\1, i + 1, 1))
endc
endr
endc
shift
endr
ENDM
textfw2: MACRO
rept _NARG
if STRSUB(\1, 1, 4) == "FW2_"
db TX_FULLWIDTH2, \1
elif STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1
db \1
else
for i, STRLEN(\1)
if (STRSUB(\1, i + 1, 1)) == " "
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
else
db TX_FULLWIDTH2, STRCAT("FW2_", STRSUB(\1, i + 1, 1))
endc
endr
endc
shift
endr
ENDM
textfw3: MACRO
rept _NARG
if STRSUB(\1, 1, 4) == "FW3_"
db TX_FULLWIDTH3, \1
elif STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1
db \1
else
for i, STRLEN(\1)
if (STRSUB(\1, i + 1, 1)) == " "
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
else
db TX_FULLWIDTH3, STRCAT("FW3_", STRSUB(\1, i + 1, 1))
endc
endr
endc
shift
endr
ENDM
textfw4: MACRO
rept _NARG
if STRSUB(\1, 1, 4) == "FW4_"
db TX_FULLWIDTH4, \1
elif STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1
db \1
else
for i, STRLEN(\1)
if (STRSUB(\1, i + 1, 1)) == " "
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
else
db TX_FULLWIDTH4, STRCAT("FW4_", STRSUB(\1, i + 1, 1))
endc
endr
endc
shift
endr
ENDM
ldfw3: MACRO
ld \1, (TX_FULLWIDTH3 << 8) | STRCAT("FW3_", \2)
ENDM
+1723 -317
View File
File diff suppressed because it is too large Load Diff
+3292 -213
View File
File diff suppressed because it is too large Load Diff
+3391 -303
View File
File diff suppressed because it is too large Load Diff
+3327 -288
View File
File diff suppressed because it is too large Load Diff
+3392 -192
View File
File diff suppressed because it is too large Load Diff
+4035 -421
View File
File diff suppressed because it is too large Load Diff
+4271 -512
View File
File diff suppressed because it is too large Load Diff
+4252 -486
View File
File diff suppressed because it is too large Load Diff
+2357 -238
View File
File diff suppressed because it is too large Load Diff
+3872 -671
View File
File diff suppressed because it is too large Load Diff
+3763 -435
View File
File diff suppressed because it is too large Load Diff
+3965 -640
View File
File diff suppressed because it is too large Load Diff
+3318 -303
View File
File diff suppressed because it is too large Load Diff
+3687 -567
View File
File diff suppressed because it is too large Load Diff
+3268 -287
View File
File diff suppressed because it is too large Load Diff
+3239 -307
View File
File diff suppressed because it is too large Load Diff
+3271 -263
View File
File diff suppressed because it is too large Load Diff