From 1fc7430a2baa2835f4dad4676a3e7ae513275a7d Mon Sep 17 00:00:00 2001 From: mid-kid Date: Tue, 17 Jul 2018 23:08:04 +0200 Subject: [PATCH] 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. --- charmap.asm | 5 ++- data/phone/non_trainer_names.asm | 2 +- engine/battle/core.asm | 2 +- engine/menus/options_menu.asm | 28 ++++++------- .../townmap_convertlinebreakcharacters.asm | 8 ++-- home/text.asm | 39 ++++++++++--------- mobile/mobile_22.asm | 2 +- mobile/mobile_5f.asm | 16 ++++---- 8 files changed, 53 insertions(+), 49 deletions(-) diff --git a/charmap.asm b/charmap.asm index e04091a88..d5bd2bcf1 100644 --- a/charmap.asm +++ b/charmap.asm @@ -2,9 +2,12 @@ ; Control characters (see home/text.asm) + charmap "", $00 charmap "", $14 ; "くん" or "ちゃん"; same as "" in English + charmap "", $15 + charmap "", $16 charmap "¯", $1f ; soft linebreak - charmap "", $22 + charmap "", $22 charmap "", $24 ; "" charmap "%", $25 ; soft linebreak in landmark names charmap "", $38 ; wRedsName diff --git a/data/phone/non_trainer_names.asm b/data/phone/non_trainer_names.asm index d7648fa7f..1792c506a 100644 --- a/data/phone/non_trainer_names.asm +++ b/data/phone/non_trainer_names.asm @@ -12,4 +12,4 @@ NonTrainerCallerNames: .bill: db "BILL:@" .elm: db "PROF.ELM:@" .bikeshop: db "BIKE SHOP:@" -.buena: db "BUENA: DISC JOCKEY@" +.buena: db "BUENA: DISC JOCKEY@" diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 57c0d7990..d1bd41b84 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8578,7 +8578,7 @@ ReadAndPrintLinkBattleRecord: db " 0 0 0@" .Format: - db " --- " + db " --- " db " - - -@" .Record: db "'s RECORD@" diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index 370eba3f6..4dc6c0fe1 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -61,20 +61,20 @@ _OptionsMenu: ret StringOptions: - db "TEXT SPEED" - db " :" - db "BATTLE SCENE" - db " :" - db "BATTLE STYLE" - db " :" - db "SOUND" - db " :" - db "PRINT" - db " :" - db "MENU ACCOUNT" - db " :" - db "FRAME" - db " :TYPE" + db "TEXT SPEED" + db " :" + db "BATTLE SCENE" + db " :" + db "BATTLE STYLE" + db " :" + db "SOUND" + db " :" + db "PRINT" + db " :" + db "MENU ACCOUNT" + db " :" + db "FRAME" + db " :TYPE" db "CANCEL@" GetOptionPointer: diff --git a/engine/pokegear/townmap_convertlinebreakcharacters.asm b/engine/pokegear/townmap_convertlinebreakcharacters.asm index e0ed55131..a881b9260 100644 --- a/engine/pokegear/townmap_convertlinebreakcharacters.asm +++ b/engine/pokegear/townmap_convertlinebreakcharacters.asm @@ -5,14 +5,14 @@ TownMap_ConvertLineBreakCharacters: cp "@" jr z, .end cp "%" - jr z, .line_break + jr z, .line_feed cp "¯" - jr z, .line_break + jr z, .line_feed inc hl jr .loop -.line_break - ld [hl], "" +.line_feed + ld [hl], "" .end ld de, wStringBuffer1 diff --git a/home/text.asm b/home/text.asm index d74af02af..b95a619dd 100644 --- a/home/text.asm +++ b/home/text.asm @@ -178,26 +178,30 @@ NextChar:: CheckDict:: dict: MACRO -if \1 == 0 +if \1 == "" and a else cp \1 endc - jp z, \2 -ENDM -dict2: MACRO - cp \1 +if STRSUB("\2", 1, 1) == "\"" +; Replace a character with another one jr nz, ._\@ ld a, \2 ._\@: +elif STRSUB("\2", 1, 1) == "." +; Locals can use a short jump + jr z, \2 +else + jp z, \2 +endc ENDM - dict TX_DAY, DayOfWeekChar + dict "", MobileScriptChar dict "", LineChar dict "", NextLineChar - dict TX_FAR, TextFar - dict TX_START, NullChar + dict "", CarriageReturnChar + dict "", NullChar dict "", _ContTextNoPause dict "<_CONT>", _ContText dict "", Paragraph @@ -215,7 +219,7 @@ ENDM dict "", TMChar dict "", TrainerChar dict "", PlaceKougeki - dict "", LineBreakChar + dict "", LineFeedChar dict "", ContText dict "<……>", SixDotsChar dict "", DoneText @@ -223,17 +227,14 @@ ENDM dict "", PlacePKMN dict "", PlacePOKE dict "%", NextChar - dict2 "¯", " " + dict "¯", " " dict "", PlaceDexEnd dict "", PlaceMoveTargetsName dict "", PlaceMoveUsersName dict "", PlaceEnemysName dict "", PlaceGenderedPlayerName - - cp "゚" - jr z, .place ; should be .diacritic - cp "゙" - jr z, .place ; should be .diacritic + dict "゚", .place ; should be .diacritic + dict "゙", .place ; should be .diacritic jr .not_diacritic .diacritic @@ -276,10 +277,10 @@ ENDM call PrintLetterDelay jp NextChar -DayOfWeekChar:: +MobileScriptChar:: ld c, l ld b, h - farcall Function17f036 + farcall RunMobileScript jp PlaceNextChar print_name: MACRO @@ -409,14 +410,14 @@ NextLineChar:: push hl jp NextChar -LineBreakChar:: +LineFeedChar:: pop hl ld bc, SCREEN_WIDTH add hl, bc push hl jp NextChar -TextFar:: +CarriageReturnChar:: pop hl push de ld bc, -wTileMap + $10000 diff --git a/mobile/mobile_22.asm b/mobile/mobile_22.asm index da8fee07c..5f0f3e86e 100644 --- a/mobile/mobile_22.asm +++ b/mobile/mobile_22.asm @@ -3894,7 +3894,7 @@ Function8aab6: ret String_8aaf0: - db "あたらしい めいしできまし@" + db "あたらしい めいしできまし@" Function8ab00: ld de, String_8911c diff --git a/mobile/mobile_5f.asm b/mobile/mobile_5f.asm index 505d6cdbd..6e47e4b6c 100644 --- a/mobile/mobile_5f.asm +++ b/mobile/mobile_5f.asm @@ -3570,25 +3570,25 @@ Palette_17eff6: RGB 24, 16, 3 RGB 0, 0, 0 -Function17f036:: +RunMobileScript:: ld a, $6 call GetSRAMBank inc de -.asm_17f03c - call Function17f047 - jr c, .asm_17f043 - jr .asm_17f03c +.loop + call _RunMobileScript + jr c, .finished + jr .loop -.asm_17f043 +.finished call CloseSRAM ret -Function17f047: +_RunMobileScript: ld a, [de] inc de cp $50 jr z, .finished - cp $10 + cp $10 ; jumptable size jr nc, .finished dec a push de