Port a xonotic feature with UTF-8 characters
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 14 Apr 2011 13:10:27 +0000 (16:10 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 14 Apr 2011 13:10:27 +0000 (16:10 +0300)
data/defaultVT.cfg
data/qcsrc/server/cl_client.qc
data/qcsrc/server/extensions.qh

index e595ba89cd81234675e345cf19bbef7dfd3c019a..86b45779220fa4da2fbb9a1eeda0cd770d990ce8 100644 (file)
@@ -1662,6 +1662,9 @@ r_fakelight 1
 // equalize looks better than fullbright\r
 r_equalize_entities_fullbright 1\r
 \r
+// UTF-8\r
+utf8_enable 1\r
+\r
 // safe font defaults\r
 r_font_hinting 1\r
 r_font_disable_freetype 0\r
index 845ad8be39b9168449b16a4a7bb8b66373046902..589f64909ed26e8450e757d02c0a8523f4b269e2 100644 (file)
@@ -2682,9 +2682,16 @@ float isInvisibleString(string s)
                switch(c)\r
                {\r
                        case 0:\r
-                       case 32:\r
-                       case 160:\r
+                       case 32: // space\r
                                break;\r
+                       case 192: // charmap space\r
+                               if (!cvar("utf8_enable"))\r
+                                       break;\r
+                               return FALSE;\r
+                       case 160: // space in unicode fonts\r
+                       case 0xE000 + 192: // utf8 charmap space\r
+                               if (cvar("utf8_enable"))\r
+                                       break;\r
                        default:\r
                                return FALSE;\r
                }\r
index ab96b8600a28809d450002f432f9858b41018e21..46d455eea715c732faa54daac775ea837c5130f7 100644 (file)
@@ -436,6 +436,16 @@ void(entity e, entity tagentity, string tagname) setattachment = #443; // attach
 //description:\r
 //global skybox for the map, can not be changed by QC\r
 \r
+//DP_UTF8\r
+//idea: Blub\0, divVerent\r
+//darkplaces implementation: Blub\0\r
+//cvar definitions:\r
+//   utf8_enable: enable utf8 encoding\r
+//description: utf8 characters are allowed inside cvars, protocol strings, files, progs strings, etc., \r
+//and count as 1 char for string functions like strlen, substring, etc.\r
+// note: utf8_enable is run-time cvar, could be changed during execution\r
+// note: beware that str2chr() could return value bigger than 255 once utf8 is enabled\r
+\r
 //DP_HALFLIFE_MAP\r
 //idea: LordHavoc\r
 //darkplaces implementation: LordHavoc\r