Fix misnamed character codes

Some character codes were erroneously named after their text command
counterparts. This has caused a lot of confusion with naming their
functions and with other things.

I've also removed the `dict2` macro and expanded the `dict` macro. This
really isn't something we should be doing for macros but I can't deny it
looks a lot neater than repeated code.
This commit is contained in:
mid-kid 2018-07-17 23:08:04 +02:00
parent 778d57ba21
commit 1fc7430a2b
8 changed files with 53 additions and 49 deletions

View File

@ -2,9 +2,12 @@
; Control characters (see home/text.asm) ; Control characters (see home/text.asm)
charmap "<NULL>", $00
charmap "<PLAY_G>", $14 ; "<PLAYER>くん" or "<PLAYER>ちゃん"; same as "<PLAYER>" in English charmap "<PLAY_G>", $14 ; "<PLAYER>くん" or "<PLAYER>ちゃん"; same as "<PLAYER>" in English
charmap "<MOBILE>", $15
charmap "<CR>", $16
charmap "¯", $1f ; soft linebreak charmap "¯", $1f ; soft linebreak
charmap "<LNBRK>", $22 charmap "<LF>", $22
charmap "<POKE>", $24 ; "<PO><KE>" charmap "<POKE>", $24 ; "<PO><KE>"
charmap "%", $25 ; soft linebreak in landmark names charmap "%", $25 ; soft linebreak in landmark names
charmap "<RED>", $38 ; wRedsName charmap "<RED>", $38 ; wRedsName

View File

@ -12,4 +12,4 @@ NonTrainerCallerNames:
.bill: db "BILL:@" .bill: db "BILL:@"
.elm: db "PROF.ELM:@" .elm: db "PROF.ELM:@"
.bikeshop: db "BIKE SHOP:@" .bikeshop: db "BIKE SHOP:@"
.buena: db "BUENA:<LNBRK> DISC JOCKEY@" .buena: db "BUENA:<LF> DISC JOCKEY@"

View File

@ -8578,7 +8578,7 @@ ReadAndPrintLinkBattleRecord:
db " 0 0 0@" db " 0 0 0@"
.Format: .Format:
db " --- <LNBRK>" db " --- <LF>"
db " - - -@" db " - - -@"
.Record: .Record:
db "<PLAYER>'s RECORD@" db "<PLAYER>'s RECORD@"

View File

@ -61,20 +61,20 @@ _OptionsMenu:
ret ret
StringOptions: StringOptions:
db "TEXT SPEED<LNBRK>" db "TEXT SPEED<LF>"
db " :<LNBRK>" db " :<LF>"
db "BATTLE SCENE<LNBRK>" db "BATTLE SCENE<LF>"
db " :<LNBRK>" db " :<LF>"
db "BATTLE STYLE<LNBRK>" db "BATTLE STYLE<LF>"
db " :<LNBRK>" db " :<LF>"
db "SOUND<LNBRK>" db "SOUND<LF>"
db " :<LNBRK>" db " :<LF>"
db "PRINT<LNBRK>" db "PRINT<LF>"
db " :<LNBRK>" db " :<LF>"
db "MENU ACCOUNT<LNBRK>" db "MENU ACCOUNT<LF>"
db " :<LNBRK>" db " :<LF>"
db "FRAME<LNBRK>" db "FRAME<LF>"
db " :TYPE<LNBRK>" db " :TYPE<LF>"
db "CANCEL@" db "CANCEL@"
GetOptionPointer: GetOptionPointer:

View File

@ -5,14 +5,14 @@ TownMap_ConvertLineBreakCharacters:
cp "@" cp "@"
jr z, .end jr z, .end
cp "%" cp "%"
jr z, .line_break jr z, .line_feed
cp "¯" cp "¯"
jr z, .line_break jr z, .line_feed
inc hl inc hl
jr .loop jr .loop
.line_break .line_feed
ld [hl], "<LNBRK>" ld [hl], "<LF>"
.end .end
ld de, wStringBuffer1 ld de, wStringBuffer1

View File

@ -178,26 +178,30 @@ NextChar::
CheckDict:: CheckDict::
dict: MACRO dict: MACRO
if \1 == 0 if \1 == "<NULL>"
and a and a
else else
cp \1 cp \1
endc endc
jp z, \2
ENDM
dict2: MACRO if STRSUB("\2", 1, 1) == "\""
cp \1 ; Replace a character with another one
jr nz, ._\@ jr nz, ._\@
ld a, \2 ld a, \2
._\@: ._\@:
elif STRSUB("\2", 1, 1) == "."
; Locals can use a short jump
jr z, \2
else
jp z, \2
endc
ENDM ENDM
dict TX_DAY, DayOfWeekChar dict "<MOBILE>", MobileScriptChar
dict "<LINE>", LineChar dict "<LINE>", LineChar
dict "<NEXT>", NextLineChar dict "<NEXT>", NextLineChar
dict TX_FAR, TextFar dict "<CR>", CarriageReturnChar
dict TX_START, NullChar dict "<NULL>", NullChar
dict "<SCROLL>", _ContTextNoPause dict "<SCROLL>", _ContTextNoPause
dict "<_CONT>", _ContText dict "<_CONT>", _ContText
dict "<PARA>", Paragraph dict "<PARA>", Paragraph
@ -215,7 +219,7 @@ ENDM
dict "<TM>", TMChar dict "<TM>", TMChar
dict "<TRAINER>", TrainerChar dict "<TRAINER>", TrainerChar
dict "<KOUGEKI>", PlaceKougeki dict "<KOUGEKI>", PlaceKougeki
dict "<LNBRK>", LineBreakChar dict "<LF>", LineFeedChar
dict "<CONT>", ContText dict "<CONT>", ContText
dict "<……>", SixDotsChar dict "<……>", SixDotsChar
dict "<DONE>", DoneText dict "<DONE>", DoneText
@ -223,17 +227,14 @@ ENDM
dict "<PKMN>", PlacePKMN dict "<PKMN>", PlacePKMN
dict "<POKE>", PlacePOKE dict "<POKE>", PlacePOKE
dict "%", NextChar dict "%", NextChar
dict2 "¯", " " dict "¯", " "
dict "<DEXEND>", PlaceDexEnd dict "<DEXEND>", PlaceDexEnd
dict "<TARGET>", PlaceMoveTargetsName dict "<TARGET>", PlaceMoveTargetsName
dict "<USER>", PlaceMoveUsersName dict "<USER>", PlaceMoveUsersName
dict "<ENEMY>", PlaceEnemysName dict "<ENEMY>", PlaceEnemysName
dict "<PLAY_G>", PlaceGenderedPlayerName dict "<PLAY_G>", PlaceGenderedPlayerName
dict "゚", .place ; should be .diacritic
cp "゚" dict "゙", .place ; should be .diacritic
jr z, .place ; should be .diacritic
cp "゙"
jr z, .place ; should be .diacritic
jr .not_diacritic jr .not_diacritic
.diacritic .diacritic
@ -276,10 +277,10 @@ ENDM
call PrintLetterDelay call PrintLetterDelay
jp NextChar jp NextChar
DayOfWeekChar:: MobileScriptChar::
ld c, l ld c, l
ld b, h ld b, h
farcall Function17f036 farcall RunMobileScript
jp PlaceNextChar jp PlaceNextChar
print_name: MACRO print_name: MACRO
@ -409,14 +410,14 @@ NextLineChar::
push hl push hl
jp NextChar jp NextChar
LineBreakChar:: LineFeedChar::
pop hl pop hl
ld bc, SCREEN_WIDTH ld bc, SCREEN_WIDTH
add hl, bc add hl, bc
push hl push hl
jp NextChar jp NextChar
TextFar:: CarriageReturnChar::
pop hl pop hl
push de push de
ld bc, -wTileMap + $10000 ld bc, -wTileMap + $10000

View File

@ -3894,7 +3894,7 @@ Function8aab6:
ret ret
String_8aaf0: String_8aaf0:
db "あたらしい めいし<PKMN>できまし<LNBRK>@" db "あたらしい めいし<PKMN>できまし<LF>@"
Function8ab00: Function8ab00:
ld de, String_8911c ld de, String_8911c

View File

@ -3570,25 +3570,25 @@ Palette_17eff6:
RGB 24, 16, 3 RGB 24, 16, 3
RGB 0, 0, 0 RGB 0, 0, 0
Function17f036:: RunMobileScript::
ld a, $6 ld a, $6
call GetSRAMBank call GetSRAMBank
inc de inc de
.asm_17f03c .loop
call Function17f047 call _RunMobileScript
jr c, .asm_17f043 jr c, .finished
jr .asm_17f03c jr .loop
.asm_17f043 .finished
call CloseSRAM call CloseSRAM
ret ret
Function17f047: _RunMobileScript:
ld a, [de] ld a, [de]
inc de inc de
cp $50 cp $50
jr z, .finished jr z, .finished
cp $10 cp $10 ; jumptable size
jr nc, .finished jr nc, .finished
dec a dec a
push de push de