shithub: pokered

Download patch

ref: 63b7b8e783578afd8034e1bf56abe73f3e329ab4
parent: 35a33bf3d73e376f8d2c7f0871c56c4aac06fcca
author: IIMarckus <iimarckus@gmail.com>
date: Tue Dec 20 19:12:36 EST 2011

Add support for Unicode, and use it to put in ♀ and ♂.

hg-commit-id: a482b0ef7a01


--- a/pokered.asm
+++ b/pokered.asm
@@ -4352,7 +4352,7 @@
 MonsterNames: ; 421E
 	db "RHYDON@@@@"
 	db "KANGASKHAN"
-	db "NIDORAN",$EF,"@@"
+	db "NIDORAN♂@@"
 	db "CLEFAIRY@@"
 	db "SPEAROW@@@"
 	db "VOLTORB@@@"
@@ -4364,7 +4364,7 @@
 	db "EXEGGCUTE@"
 	db "GRIMER@@@@"
 	db "GENGAR@@@@"
-	db "NIDORAN",$F5,"@@"
+	db "NIDORAN♀@@"
 	db "NIDOQUEEN@"
 	db "CUBONE@@@@"
 	db "RHYHORN@@@"
@@ -4804,9 +4804,9 @@
 LassName:
 	db "LASS@"
 JrTrainerMName:
-	db "JR.TRAINER",$EF,$50
+	db "JR.TRAINER♂@"
 JrTrainerFName:
-	db "JR.TRAINER",$F5,$50
+	db "JR.TRAINER♀@"
 PokemaniacName:
 	db "POK",$BA,"MANIAC@"
 SuperNerdName:
@@ -4836,9 +4836,9 @@
 RocketName:
 	db "ROCKET@"
 CooltrainerMName:
-	db "COOLTRAINER",$EF,$50
+	db "COOLTRAINER♂@"
 CooltrainerFName:
-	db "COOLTRAINER",$F5,$50
+	db "COOLTRAINER♀@"
 
 INCBIN "baserom.gbc",$27f86,$27fb8-$27f86
 
--- a/textpre.awk
+++ b/textpre.awk
@@ -67,8 +67,10 @@
 char["?"] = "$E6"
 char["!"] = "$E7"
 char["."] = "$E8"
+char["♂"] = "$EF"
 char["/"] = "$F3"
 char[","] = "$F4"
+char["♀"] = "$F5"
 char["0"] = "$F6"
 char["1"] = "$F7"
 char["2"] = "$F8"
@@ -98,6 +100,16 @@
 	while (f != "") {
 		c = substr(f,1,1)
 		f = substr(f,2,length(f) - 1)
+		if (c > "𐀀") { # U+10000
+			c = c substr(f,1,3)
+			f = substr(f,4,length(f) - 3)
+		} else if (c > "ࠀ") { # U+0800
+			c = c substr(f,1,2)
+			f = substr(f,3,length(f) - 2)
+		} else if (c > "€") { # U+0080
+			c = c sustr(f,1,1)
+			f = substr(f,2,length(f) - 1)
+		}
 		print char[c]
 		if (length(f))
 			print ","