Restore Dakuten and Hakuten Mechanic to Graphic Accentuation ( ´ , ^ , etc.) - pret/pokered GitHub Wiki

To do: Nickname Screen support.

Code edited from Japanese release (pokered-jp (luckytyphlosion)).

Method 1

This method is simpler to code and understand. However, unless you add some new control characters (in the same way that, say, $54 is set to print out POKé), you'll have to add the accentation mark before the letter you're trying to accentuate (like À = `a).

...
	dict "<TARGET>",  PlaceMoveTargetsName
	dict "<USER>",    PlaceMoveUsersName

+	cp "´"
+	jr z, .placeCombiningChar
+	cp "^"
+	jr z, .placeCombiningChar
+	cp "`"
+	jr z, .placeCombiningChar
+	cp "~"
+	jr z, .placeCombiningChar
+	cp "*1" ; ponto do "j"
+	jr z, .placeCombiningChar
+	cp "*2" ; ponto do "i" e "l"
+	jr z, .placeCombiningChar
+	cp "¨"
+	jr nz, .placeChar
+.placeCombiningChar
+	push hl
+	ld bc, -SCREEN_WIDTH
+	add hl, bc
+	ld [hl], a
+	pop hl
+	jr NextChar
+.placeChar

	ld [hli], a
	call PrintLetterDelay

NextChar::
	inc de
	jp PlaceNextChar
...
...
	charmap "'v",        $bf

+	charmap "´",         $c0
+	charmap "^",         $c1
+	charmap "`",         $c2
+	charmap "~",         $c3
+	charmap "¨",         $c4
+	charmap "*1",        $c5 ; "j"
+	charmap "*2",        $c6 ; "i" e "l"

+	charmap "ç",         $c7
+	charmap "Ç",         $c8

	charmap "'",         $e0
...

font

To add accents in letters, you need to put the accents before the letter:

...
_OakSpeechText1::
-	text "Hello there!"
-	line "Welcome to the"
-	cont "world of #MON!"

-	para "My name is OAK!"
-	line "People call me"
-	cont "the #MON PROF!"

+	text "O*2l´a `a todos!"
+	line "Se*1ja bem-v*2indo"
+	cont "ao MUNDO POK´EMON!"

+	para "Meu nome ´e JO~AO!"
+	line "Pessoas me chamam"
+	cont "de L*2ing¨u*2iça!"
	prompt
...
_DoYouWantToNicknameText::
	text "Do you want to"
-       line "give a nickname"
+	line "g*2ive a n*2ickname"
	cont "to @"
	text_ram wcd6d
	text "?"
	done
...
...
	assert_table_length NUM_TWO_OPTION_MENUS

.NoYesMenu:
	db   "NO"
	next "YES@"

.YesNoMenu:
-       db   "YES"
-       next "NO@"

+	db   "SIM"
+	next "N~AO@"

.NorthWestMenu:
	db   "NORTH"
	next "WEST@"
...

bgb00001

Preview in Video

Method 2

This is a method that the original Japanese developers have used to create the (han)dakuten accenting system in Pocket Monsters Red and Green. This system, for some reason, was scrubbed out of the other-region releases.

Editing the font

For starters, edit gfx/font/font.png. For example:

obraz

These can be in different locations, just make sure not to overwrite a tile you used. For best results, have a 1-pixel gap at the bottom of the tile.

Editing the character map

Now that that's done, we can move on to the character map. In constants/charmap.asm add your characters like so:

...
	charmap "<NULL>",        $00
+
+; add your characters from $01 to $48
+	charmap "Á",		 $10
+	charmap "É",             $14
+	charmap "Í",		 $18
+	charmap "Ó",		 $1d
+	charmap "Ú",		 $24
+	
+	charmap "À",		 $30
+	charmap "È",		 $34
+	charmap "Ì",		 $38
+	charmap "Ò",		 $3d
+	charmap "Ù",		 $44
+
	charmap "<PAGE>",        $49
...
	charmap "'v",        $bf
	
+	charmap "`",		 $c0 ; this'll make our life
+	charmap "~",	 	 $c1 ; easier in step num. 3

	charmap "'",         $e0

Make sure you position your accented tiles so that, when we add the correct value later, we get the accent-less versions of these characters. There might be an issue in adding the lowercase tiles, but they don't work with the accents anyway.

Now, if you build this without any extra code, it won't appear correctly. That's because we haven't actually told the game what to do with these new tiles. To do that, we need to add code.

Adding code

In home/text.asm:

...
        dict "<USER>",    PlaceMoveUsersName
	
+	cp "`"
+	jr z, .upper_line
+	cp "~"
+	jr nz, .determine_accented_character
+	
	ld [hli], a
	call PrintLetterDelay

+.upper_line:
+	push hl
+	ld bc, -SCREEN_WIDTH
+	add hl, bc
+	ld [hl], a
+	pop hl
+	jr NextChar
+
+.determine_accented_character:
+	cp "<PAGE>" ; anything above $49 (<PAGE>) treated as a normal character
+	jr nc, .normal_chr
+	cp "Ù" ; anything between $30 (À) and $44 (Ù) treated as reverse-accented
+	jr nc, .reverse_accent_chr
+	cp "Ú" ; anything between $10 (Á) and $24 (Ú) treated as accented
+	jr nc, .accent_chr
+.reverse_accent_chr:
+	add a, $50
+	push af
+	ld a, "`"
+       jr .cont1
+.accent_chr:
+       add a, $70
+       push af
+       ld a, "~"
+.cont1:
+	push hl
+	ld bc, -SCREEN_WIDTH
+	add hl, bc
+	ld [hl], a
+	pop hl
+	pop af
+	jr .normal_chr
+.normal_chr:
+	ld [hli], a
+	call PrintLetterDelay

(The code above is untested, please fix if needed)

And voila! You now should have the accented marks in your game.

⚠️ **GitHub.com Fallback** ⚠️