shithub: pokecrystal

Download patch

ref: 6a41d4f63e8fb9f14e1c0a4a9ace062dac747432
parent: 512863989fb2cb17bcca2f27a61fe3fa8f567b9a
author: Remy Oukaour <[email protected]>
date: Sat Dec 9 07:24:50 EST 2017

Define more charmap characters and use them in place of hard-coded numbers

--- a/battle/trainer_huds.asm
+++ b/battle/trainer_huds.asm
@@ -256,9 +256,9 @@
 	ld de, OTPlayerName
 	call PlaceString
 	hlcoord 9, 8
-	ld a, $69 ; "V"
+	ld a, "<BOLD_V>"
 	ld [hli], a
-	ld [hl], $6a ; "S"
+	ld [hl], "<BOLD_S>"
 	callba LinkBattle_TrainerHuds ; no need to callba
 	ld b, SCGB_DIPLOMA
 	call GetSGBLayout
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -627,7 +627,7 @@
 	ld hl, OBJECT_MOVEMENTTYPE
 	add hl, de
 	ld a, [hl]
-	cp STEP_TYPE_SKYFALL_TOP
+	cp SPRITEMOVEDATA_STRENGTH_BOULDER
 	jr nz, .next
 
 	ld hl, OBJECT_NEXT_TILE
--- a/engine/phone.asm
+++ b/engine/phone.asm
@@ -518,7 +518,7 @@
 Phone_CallerTextboxWithName2: ; 902c9
 	call Phone_CallerTextbox
 	hlcoord 1, 2
-	ld [hl], $62
+	ld [hl], "<PHONE>"
 	inc hl
 	inc hl
 	ld a, [PhoneScriptBank]
@@ -618,7 +618,7 @@
 	push bc
 	call Phone_CallerTextbox
 	hlcoord 1, 1
-	ld [hl], $62
+	ld [hl], "<PHONE>"
 	inc hl
 	inc hl
 	ld d, h
--- a/engine/printnum.asm
+++ b/engine/printnum.asm
@@ -275,7 +275,7 @@
 	dec e
 	ret nz
 	inc hl
-	ld [hl], "·"
+	ld [hl], "<PERIOD>"
 	ret
 
 .PrintLeadingZero: ; c644
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -453,7 +453,7 @@
 	ld bc, SCREEN_WIDTH
 	ld d, SCREEN_HEIGHT
 .loop
-	ld a, $31
+	ld a, "|"
 	ld [hl], a
 	add hl, bc
 	dec d
@@ -583,7 +583,7 @@
 	hlcoord 9, 8
 	ld de, SCREEN_WIDTH
 	ld b, 10
-	ld a, $31
+	ld a, "|"
 .vertical_divider
 	ld [hl], a
 	add hl, de
@@ -743,7 +743,7 @@
 	hlcoord 10, 8
 	ld de, SCREEN_WIDTH
 	ld b, 10
-	ld a, $31
+	ld a, "|"
 .BluePageVerticalDivider:
 	ld [hl], a
 	add hl, de
--- a/engine/trainer_card.asm
+++ b/engine/trainer_card.asm
@@ -448,7 +448,7 @@
 	ret nz
 	hlcoord 15, 12
 	ld a, [hl]
-	xor %01010001 ; $7F <--> $2E
+	xor %01010001 ; $7F (space) <--> $2E (colon)
 	ld [hl], a
 	ret
 
--- a/engine/warp_connection.asm
+++ b/engine/warp_connection.asm
@@ -254,7 +254,7 @@
 	pop af
 	ld [rVBK], a
 
-	ld a, $60
+	ld a, "<BLACK>"
 	ld bc, VBGMap1 - VBGMap0
 	hlbgcoord 0, 0
 	call ByteFill
--- a/event/halloffame.asm
+++ b/event/halloffame.asm
@@ -1,3 +1,5 @@
+HALLOFFAME_COLON EQU $63
+
 HallOfFame:: ; 0x8640e
 	call HallOfFame_FadeOutMusic
 	ld a, [StatusFlags]
@@ -487,7 +489,7 @@
 	hlcoord 1, 13
 	ld a, "№"
 	ld [hli], a
-	ld [hl], "·"
+	ld [hl], "<PERIOD>"
 	hlcoord 3, 13
 	ld de, wd265
 	lb bc, PRINTNUM_LEADINGZEROS | 1, 3
@@ -531,8 +533,8 @@
 
 HOF_AnimatePlayerPic: ; 86810
 	call ClearBGPalettes
-	ld hl, VTiles2 tile $63
-	ld de, FontExtra + 13 tiles
+	ld hl, VTiles2 tile HALLOFFAME_COLON
+	ld de, FontExtra + 13 tiles ; "<COLON>"
 	lb bc, BANK(FontExtra), 1
 	call Request2bpp
 	hlcoord 0, 0
@@ -604,7 +606,7 @@
 	ld de, GameTimeHours
 	lb bc, 2, 3
 	call PrintNum
-	ld [hl], 99
+	ld [hl], HALLOFFAME_COLON
 	inc hl
 	ld de, GameTimeMinutes
 	lb bc, PRINTNUM_LEADINGZEROS | 1, 2
--- a/event/magikarp.asm
+++ b/event/magikarp.asm
@@ -79,7 +79,7 @@
 ; 0xfbbae
 
 Magikarp_LoadFeetInchesChars: ; fbbae
-	ld hl, VTiles2 tile "′"
+	ld hl, VTiles2 tile "′" ; $6e
 	ld de, .feetinchchars
 	lb bc, BANK(.feetinchchars), 2
 	call Request2bpp
--- a/gfx/font.asm
+++ b/gfx/font.asm
@@ -131,11 +131,11 @@
 
 _LoadFontsExtra1:: ; fb48a
 	ld de, MobilePhoneTilesGFX
-	ld hl, VTiles2 tile $60
+	ld hl, VTiles2 tile "<BLACK>" ; $60
 	lb bc, BANK(MobilePhoneTilesGFX), 1
 	call Get1bpp_2
 	ld de, OverworldPhoneIconGFX
-	ld hl, VTiles2 tile $62
+	ld hl, VTiles2 tile "<PHONE>" ; $62
 	lb bc, BANK(OverworldPhoneIconGFX), 1
 	call Get2bpp_2
 	ld de, FontExtra + 3 * LEN_2BPP_TILE
@@ -147,7 +147,7 @@
 
 _LoadFontsExtra2:: ; fb4b0
 	ld de, FontsExtra2_UpArrowGFX
-	ld hl, VTiles2 tile $61
+	ld hl, VTiles2 tile "▲" ; $61
 	ld b, BANK(FontsExtra2_UpArrowGFX)
 	ld c, 1
 	call Get2bpp_2
@@ -170,10 +170,10 @@
 	call AddNTimes
 	ld d, h
 	ld e, l
-	ld hl, VTiles2 tile $79
+	ld hl, VTiles2 tile "┌" ; $79
 	lb bc, BANK(Frames), TILES_PER_FRAME
 	call Get1bpp_2
-	ld hl, VTiles2 tile $7f
+	ld hl, VTiles2 tile " " ; $7f
 	ld de, TextBoxSpaceGFX
 	lb bc, BANK(TextBoxSpaceGFX), 1
 	call Get1bpp_2
@@ -186,7 +186,7 @@
 	lb bc, BANK(FontBattleExtra), $c
 	call Get2bpp_2
 	ld hl, VTiles2 tile $70
-	ld de, FontBattleExtra + $10 * LEN_2BPP_TILE
+	ld de, FontBattleExtra tile $10
 	lb bc, BANK(FontBattleExtra), 3
 	call Get2bpp_2
 	call LoadFrame
--- a/home/text.asm
+++ b/home/text.asm
@@ -230,41 +230,41 @@
 ._\@:
 endm
 
-	dict "<DAY>", Char15
-	dict "<LINE>", LineChar
-	dict "<NEXT>", NextLineChar
-	dict TX_FAR, TextFar
-	dict $00, NullChar
-	dict $4c, Char4C
-	dict $4b, Char4B
-	dict "<PARA>", Paragraph
-	dict "<MOM>", PrintMomsName
+	dict "<DAY>",    Char15
+	dict "<LINE>",   LineChar
+	dict "<NEXT>",   NextLineChar
+	dict TX_FAR,     TextFar
+	dict $00,        NullChar
+	dict $4c,        Char4C
+	dict $4b,        Char4B
+	dict "<PARA>",   Paragraph
+	dict "<MOM>",    PrintMomsName
 	dict "<PLAYER>", PrintPlayerName
-	dict "<RIVAL>", PrintRivalName
-	dict $35, Char35
-	dict $36, Char36
-	dict $37, Char37
-	dict "<RED>", PrintRedsName
-	dict "<GREEN>", PrintGreensName
-	dict "#", PlacePOKe
-	dict "<PC>", PCChar
+	dict "<RIVAL>",  PrintRivalName
+	dict $35,        Char35
+	dict $36,        Char36
+	dict $37,        Char37
+	dict "<RED>",    PrintRedsName
+	dict "<GREEN>",  PrintGreensName
+	dict "#",        PlacePOKe
+	dict "<PC>",     PCChar
 	dict "<ROCKET>", RocketChar
-	dict "<TM>", TMChar
-	dict "<TRNER>", TrainerChar
-	dict $23, PlaceKougeki
-	dict "<LNBRK>", Char22
-	dict "<CONT>", ContText
+	dict "<TM>",     TMChar
+	dict "<TRNER>",  TrainerChar
+	dict $23,        PlaceKougeki
+	dict "<LNBRK>",  Char22
+	dict "<CONT>",   ContText
 	dict "<......>", SixDotsChar
-	dict "<DONE>", DoneText
+	dict "<DONE>",   DoneText
 	dict "<PROMPT>", PromptText
-	dict "<PKMN>", PlacePKMN
-	dict "<POKE>", PlacePOKE
-	dict $25, NextChar
-	dict2 $1f, " "
+	dict "<PKMN>",   PlacePKMN
+	dict "<POKE>",   PlacePOKE
+	dict $25,        NextChar
+	dict2 $1f,       " "
 	dict "<DEXEND>", PlaceDexEnd
 	dict "<TARGET>", PlaceMoveTargetsName
-	dict "<USER>", PlaceMoveUsersName
-	dict "<ENEMY>", PlaceEnemysName
+	dict "<USER>",   PlaceMoveUsersName
+	dict "<ENEMY>",  PlaceEnemysName
 	dict "<PLAY_G>", PlaceGenderedPlayerName
 
 	cp "゚"
--- a/macros/charmap.asm
+++ b/macros/charmap.asm
@@ -1,53 +1,63 @@
 ; Control characters
 	charmap "<START>",  $00
-	charmap "<PLAY_G>", $14 ; <PLAYER> + gender
+	charmap "<PLAY_G>", $14 ; gendered PlayerName; same as "<PLAYER>" in English
 	charmap "<DAY>",    $15
-	charmap "¯",        $1f
+	charmap "¯",        $1f ; soft linebreak
 	charmap "<LNBRK>",  $22
-	charmap "<POKE>",   $24
+	charmap "<POKE>",   $24 ; "<PO><KE>"
 	charmap "%",        $25
-	charmap "<RED>",    $38
-	charmap "<GREEN>",  $39
+	charmap "<RED>",    $38 ; RedsName
+	charmap "<GREEN>",  $39 ; GreensName
 	charmap "<ENEMY>",  $3f
-	charmap "<SHINY>",  $3f
-	charmap "<MOM>",    $49
-	charmap "<PKMN>",   $4a
+	charmap "<MOM>",    $49 ; MomsName
+	charmap "<PKMN>",   $4a ; "<PK><MN>"
 	charmap "<NEXT>",   $4e
 	charmap "<LINE>",   $4f
 
 	charmap "@",        $50
 	charmap "<PARA>",   $51
-	charmap "<PLAYER>", $52
+	charmap "<PLAYER>", $52 ; PlayerName
 	charmap "<RIVAL>",  $53
 	charmap "#",        $54
 	charmap "<CONT>",   $55
-	charmap "<......>", $56
+	charmap "<......>", $56 ; "……"
 	charmap "<DONE>",   $57
 	charmap "<PROMPT>", $58
 	charmap "<TARGET>", $59
 	charmap "<USER>",   $5a
-	charmap "<PC>",     $5b
-	charmap "<TM>",     $5c
-	charmap "<TRNER>",  $5d
-	charmap "<ROCKET>", $5e
+	charmap "<PC>",     $5b ; "PC"
+	charmap "<TM>",     $5c ; "TM"
+	charmap "<TRNER>",  $5d ; "TRAINER"
+	charmap "<ROCKET>", $5e ; "ROCKET"
 	charmap "<DEXEND>", $5f
 
-; Actual characters
-	charmap "▲",        $61
-	charmap "_",        $62
-	charmap "<COLON>",  $6d ; necessary because ":" is already used
-	charmap "′",        $6e
-	charmap "<LV>",     $6e
-	charmap "″",        $6f
+; Actual characters (from gfx/misc/font_extra.png)
 
+	charmap "<BOLD_A>", $60 ; unused
+	charmap "<BOLD_B>", $61 ; unused
+	charmap "<BOLD_C>", $62 ; unused
+	charmap "<BOLD_D>", $63 ; unused
+	charmap "<BOLD_E>", $64 ; unused
+	charmap "<BOLD_F>", $65 ; unused
+	charmap "<BOLD_G>", $66 ; unused
+	charmap "<BOLD_H>", $67 ; unused
+	charmap "<BOLD_I>", $68 ; unused
+	charmap "<BOLD_V>", $69
+	charmap "<BOLD_S>", $6a
+	charmap "<BOLD_L>", $6b ; unused
+	charmap "<BOLD_M>", $6c ; unused
+	charmap "<COLON>",  $6d ; colon with tinier dots than ":"
+	charmap "ぃ",        $6e ; hiragana small i, unused
+	charmap "ぅ",        $6f ; hiragana small u, unused
 	charmap "<PO>",     $70
 	charmap "<KE>",     $71
-	charmap "◀",        $71
-	charmap "<``>",     $72
-	charmap "<''>",     $73
-	charmap "<ID>",     $73
-	charmap "№",        $74
-	charmap "…",        $75
+	charmap "<``>",     $72 ; opening quote
+	charmap "<''>",     $73 ; closing quote
+	charmap "·",        $74 ; middle dot, unused
+	charmap "…",        $75 ; ellipsis
+	charmap "ぁ",        $76 ; hiragana small a, unused
+	charmap "ぇ",        $77 ; hiragana small e, unused
+	charmap "ぉ",        $78 ; hiragana small o, unused
 
 	charmap "┌",        $79
 	charmap "─",        $7a
@@ -57,6 +67,32 @@
 	charmap "┘",        $7e
 	charmap " ",        $7f
 
+; Actual characters (from gfx/misc/font_battle_extra.png)
+
+	charmap "<LV>",     $6e
+
+	charmap "<ど>",      $70 ; hiragana small do, unused
+	charmap "◀",        $71
+	charmap "『",        $72 ; Japanese opening quote, unused
+	charmap "<ID>",     $73
+	charmap "№",        $74
+
+; Actual characters (from other graphics files)
+
+	charmap "|",        $31 ; StatsScreenPageTilesGFX
+
+	charmap "<SHINY>",  $3f ; ShinyIcon
+
+	charmap "<BLACK>",  $60 ; MobilePhoneTilesGFX
+	charmap "▲",        $61 ; FontsExtra2_UpArrowGFX
+	charmap "<PHONE>",  $62 ; OverworldPhoneIconGFX
+	charmap "_",        $62 ; HPExpBarBorderGFX
+
+	charmap "′",        $6e ; Magikarp_LoadFeetInchesChars.feetinchchars
+	charmap "″",        $6f ; Magikarp_LoadFeetInchesChars.feetinchchars
+
+; Actual characters (from gfx/misc/font.png)
+
 	charmap "A",        $80
 	charmap "B",        $81
 	charmap "C",        $82
@@ -152,7 +188,7 @@
 	charmap "♂",        $ef
 	charmap "¥",        $f0
 	charmap "×",        $f1
-	charmap "·",        $f2
+	charmap "<PERIOD>", $f2 ; same as "." in English
 	charmap "/",        $f3
 	charmap ",",        $f4
 	charmap "♀",        $f5
@@ -168,8 +204,7 @@
 	charmap "8",        $fe
 	charmap "9",        $ff
 
-; Japanese, for those bits of text that
-; were not translated to English.
+; Japanese kana, for those bits of text that were not translated to English
 
 	charmap "ガ", $5
 	charmap "ギ", $6
--- a/macros/text.asm
+++ b/macros/text.asm
@@ -1,15 +1,11 @@
 text   EQUS "db $00," ; Start writing text.
 next   EQUS "db $4e," ; Move a line down.
 line   EQUS "db $4f," ; Start writing at the bottom line.
+page   EQUS "db $50," ; Start a new Pokedex page.
 para   EQUS "db $51," ; Start a new paragraph.
 cont   EQUS "db $55," ; Scroll to the next line.
 done   EQUS "db $57"  ; End a text box.
 prompt EQUS "db $58"  ; Prompt the player to end a text box (initiating some other event).
-
-; Pokedex text commands are only used with pokered.
-; They are included for compatibility.
-page   EQUS "db $50,"     ; Start a new Pokedex page.
-dex    EQUS "db $e8, $50" ; End a Pokedex entry.
 
 ; TX_RAM EQU $01
 ; TX_FAR EQU $16
--- a/main.asm
+++ b/main.asm
@@ -92,7 +92,7 @@
 	xor a
 	ld [hBGMapMode], a
 	ld [hWY], a
-	callba HDMATransfer_FillBGMap0WithTile60 ; no need to farcall
+	callba HDMATransfer_FillBGMap0WithBlack ; no need to farcall
 	ld a, VBGMap0 / $100
 	call .LoadBGMapAddrIntoHRAM
 	xor a
@@ -131,13 +131,13 @@
 	call LoadStandardFont
 	ret
 
-HDMATransfer_FillBGMap0WithTile60: ; 64db
+HDMATransfer_FillBGMap0WithBlack: ; 64db
 	ld a, [rSVBK]
 	push af
 	ld a, $6
 	ld [rSVBK], a
 
-	ld a, $60
+	ld a, "<BLACK>" ; $60
 	ld hl, wDecompressScratch
 	ld bc, wScratchAttrMap - wDecompressScratch
 	call ByteFill
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -1313,7 +1313,7 @@
 .EggTemplate: ; 108a1d
 	db   "タマゴ"
 	next "おや/?????"
-	next "<ID>№·?????"
+	next "<ID>№<PERIOD>?????"
 	db   "@"
 ; 108a33
 
@@ -1353,10 +1353,10 @@
 ; 108a79
 
 .MonTemplate: ; 108a79
-	db   "─ №·"
+	db   "─ №<PERIOD>"
 	next ""
 	next "おや/"
-	next "<ID>№·"
+	next "<ID>№<PERIOD>"
 	db   "@"
 ; 108a87