Skip to content

Commit

Permalink
Combine textfw macros
Browse files Browse the repository at this point in the history
  • Loading branch information
dannye committed Nov 5, 2023
1 parent 818d186 commit cf85e77
Show file tree
Hide file tree
Showing 10 changed files with 431 additions and 502 deletions.
602 changes: 301 additions & 301 deletions src/constants/charmaps.asm

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/engine/input_name.asm
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ PrintPlayerNameFromInput:
.char_underbar
db $56
REPT 10
textfw3 "_"
textfw "_"
ENDR
done

Expand Down Expand Up @@ -590,7 +590,7 @@ NamingScreen_ProcessInput:
ld a, [wd009]
cp $02
jr z, .read_char
ldfw3 bc, "゛"
lb bc, TX_FULLWIDTH3, "FW3_゛"
ld a, d
cp b
jr nz, .asm_6af4
Expand All @@ -604,7 +604,7 @@ NamingScreen_ProcessInput:
jr c, .nothing
jr .asm_6b09
.asm_6af4
ldfw3 bc, "゜"
lb bc, TX_FULLWIDTH3, "FW3_゜"
ld a, d
cp b
jr nz, .asm_6b1d
Expand Down
2 changes: 1 addition & 1 deletion src/engine/menus/card_album.asm
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ PrintCardSetListEntries:
ret

.EmptySlotText
textfw0 "-------------"
textfw "-------------"
done

; gets the index in the card list and adds it to wCurDeckName
Expand Down
2 changes: 1 addition & 1 deletion src/engine/menus/naming.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ DisplayPlayerNamingScreen:

.default_name
; "MARK": default player name.
textfw3 "MARK"
textfw "MARK"
db TX_END, TX_END, TX_END, TX_END

Unknown_128f7:
Expand Down
135 changes: 50 additions & 85 deletions src/macros/text.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,101 +4,66 @@ DEF done EQUS "db TX_END"

DEF half2full EQUS "db TX_HALF2FULL"

MACRO katakana
db TX_KATAKANA
FOR i, STRLEN(\1)
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
ENDR
ENDM

MACRO hiragana
db TX_HIRAGANA
FOR i, STRLEN(\1)
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
ENDR
ENDM

MACRO textfw0
REPT _NARG
IF STRCMP(STRSUB(\1, 1, 1), "<") == 0 && STRLEN(\1) > 1
db \1
ELSE
FOR i, STRLEN(\1)
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
ENDR
ENDC
SHIFT
ENDR
ENDM

MACRO textfw1
MACRO _textfw
PUSHO
OPT Wno-unmapped-char
REPT _NARG
IF STRCMP(STRSUB(\1, 1, 1), "<") == 0 && STRLEN(\1) > 1
db \1
ELSE
FOR i, STRLEN(\1)
IF STRCMP(STRSUB(\1, i + 1, 1), " ") == 0
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
ELSE
db TX_FULLWIDTH1, STRCAT("FW1_", STRSUB(\1, i + 1, 1))
ENDC
ENDR
IF STRLEN(\1) > 0
IF STRCMP(STRSUB(\1, 1, 1), "<") == 0 && STRLEN(\1) > 1
db \1
ELSE
FOR i, STRLEN(\1)
IF CHARLEN(STRCAT("FW{x:TX_KATAKANA}_", STRSUB(\1, i + 1, 1))) == 1
IF cur_set != TX_KATAKANA
DEF cur_set = TX_KATAKANA
db cur_set
ENDC
db STRCAT("FW{x:TX_KATAKANA}_", STRSUB(\1, i + 1, 1))
ELIF CHARLEN(STRCAT("FW{x:TX_HIRAGANA}_", STRSUB(\1, i + 1, 1))) == 1
IF cur_set != TX_HIRAGANA
DEF cur_set = TX_HIRAGANA
db cur_set
ENDC
db STRCAT("FW{x:TX_HIRAGANA}_", STRSUB(\1, i + 1, 1))
ELIF CHARLEN(STRCAT("FW0_", STRSUB(\1, i + 1, 1))) == 1
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
ELIF CHARLEN(STRCAT("FW1_", STRSUB(\1, i + 1, 1))) == 1
db TX_FULLWIDTH1, STRCAT("FW1_", STRSUB(\1, i + 1, 1))
ELIF CHARLEN(STRCAT("FW2_", STRSUB(\1, i + 1, 1))) == 1
db TX_FULLWIDTH2, STRCAT("FW2_", STRSUB(\1, i + 1, 1))
ELIF CHARLEN(STRCAT("FW3_", STRSUB(\1, i + 1, 1))) == 1
db TX_FULLWIDTH3, STRCAT("FW3_", STRSUB(\1, i + 1, 1))
ELIF CHARLEN(STRCAT("FW4_", STRSUB(\1, i + 1, 1))) == 1
db TX_FULLWIDTH4, STRCAT("FW4_", STRSUB(\1, i + 1, 1))
ELSE
FAIL STRCAT("Unmapped fullwidth character: ", STRSUB(\1, i + 1, 1))
ENDC
ENDR
ENDC
ENDC
SHIFT
ENDR
POPO
ENDM

MACRO textfw2
REPT _NARG
IF STRCMP(STRSUB(\1, 1, 1), "<") == 0 && STRLEN(\1) > 1
db \1
ELSE
FOR i, STRLEN(\1)
IF STRCMP(STRSUB(\1, i + 1, 1), " ") == 0
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
ELSE
db TX_FULLWIDTH2, STRCAT("FW2_", STRSUB(\1, i + 1, 1))
ENDC
ENDR
ENDC
SHIFT
ENDR
MACRO textfw
DEF cur_set = TX_KATAKANA
_textfw \#
ENDM

MACRO textfw3
REPT _NARG
IF STRCMP(STRSUB(\1, 1, 1), "<") == 0 && STRLEN(\1) > 1
db \1
ELSE
FOR i, STRLEN(\1)
IF STRCMP(STRSUB(\1, i + 1, 1), " ") == 0
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
ELSE
db TX_FULLWIDTH3, STRCAT("FW3_", STRSUB(\1, i + 1, 1))
ENDC
ENDR
ENDC
SHIFT
ENDR
MACRO linefw
db TX_LINE
_textfw \#
ENDM

MACRO textfw4
REPT _NARG
IF STRCMP(STRSUB(\1, 1, 1), "<") == 0 && STRLEN(\1) > 1
db \1
ELSE
FOR i, STRLEN(\1)
IF STRCMP(STRSUB(\1, i + 1, 1), " ") == 0
db STRCAT("FW0_", STRSUB(\1, i + 1, 1))
ELSE
db TX_FULLWIDTH4, STRCAT("FW4_", STRSUB(\1, i + 1, 1))
ENDC
ENDR
ENDC
SHIFT
ENDR
MACRO katakana
DEF cur_set = TX_KATAKANA
db TX_KATAKANA
_textfw \#
ENDM

MACRO ldfw3
ld \1, (TX_FULLWIDTH3 << 8) | STRCAT("FW3_", \2)
MACRO hiragana
DEF cur_set = TX_HIRAGANA
db TX_HIRAGANA
_textfw \#
ENDM
33 changes: 15 additions & 18 deletions src/text/text1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PKMNPWRText:
done

UnusedText000b: ; Unused (Pokemon Card)
textfw0 "ポケモンカ—ド"
textfw "ポケモンカ—ド"
done

LengthText:
Expand All @@ -55,27 +55,27 @@ PokemonText:
done

MetresText:
textfw3 "m"
textfw "m"
done

LbsText:
text "lbs."
done

PromostarRarityText:
textfw0 " "
textfw " "
done

CircleRarityText:
textfw3 "●"
textfw "●"
done

DiamondRarityText:
textfw3 "◆"
textfw "◆"
done

StarRarityText:
textfw3 "★"
textfw "★"
done

AllCardsOwnedText:
Expand Down Expand Up @@ -304,27 +304,27 @@ ColorListText:
done

GrassSymbolText:
textfw0 "<GRASS>"
textfw "<GRASS>"
done

FireSymbolText:
textfw0 "<FIRE>"
textfw "<FIRE>"
done

WaterSymbolText:
textfw0 "<WATER>"
textfw "<WATER>"
done

LightningSymbolText:
textfw0 "<LIGHTNING>"
textfw "<LIGHTNING>"
done

FightingSymbolText:
textfw0 "<FIGHTING>"
textfw "<FIGHTING>"
done

PsychicSymbolText:
textfw0 "<PSYCHIC>"
textfw "<PSYCHIC>"
done

BenchText:
Expand Down Expand Up @@ -602,18 +602,15 @@ SelectCheckText:
done

UnusedText0087: ; Unused
textfw3 "B"
textfw0 "<RAMNUM>"
textfw3 "S"
textfw0 "<RAMNUM>"
textfw "B", "<RAMNUM>", "S", "<RAMNUM>"
done

DuelistIsThinkingText:
text "<RAMNAME> is thinking."
done

ClearOpponentNameText:
textfw0 " "
textfw " "
done

SelectComputerOpponentText:
Expand Down Expand Up @@ -708,7 +705,7 @@ UnusedText0099: ; Unused
text "Load File"
line " "
half2full
textfw0 "0"
textfw "0"
text " Last Saved File"
done

Expand Down
Loading

0 comments on commit cf85e77

Please sign in to comment.