summaryrefslogtreecommitdiffstats
path: root/src/text/Messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/text/Messages.cpp')
-rw-r--r--src/text/Messages.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/text/Messages.cpp b/src/text/Messages.cpp
index 5abaa7ae..59341b84 100644
--- a/src/text/Messages.cpp
+++ b/src/text/Messages.cpp
@@ -9,6 +9,8 @@
#include "ControllerConfig.h"
+#include "Font.h"
+
tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES];
tPreviousBrief CMessages::PreviousBriefs[NUMPREVIOUSBRIEFS];
tBigMessage CMessages::BIGMessages[NUMBIGMESSAGES];
@@ -50,6 +52,15 @@ CMessages::WideStringCopy(wchar *dst, wchar *src, uint16 size)
dst[i] = '\0';
}
+wchar FixupChar(wchar c)
+{
+#ifdef MORE_LANGUAGES
+ if (CFont::IsJapanese())
+ return c & 0x7fff;
+#endif
+ return c;
+}
+
bool
CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
{
@@ -59,10 +70,10 @@ CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
return false;
for (int32 i = 0; i < size; i++) {
- if (!str1[i])
+ if (FixupChar(str1[i]) == '\0')
break;
- if (str1[i] != str2[i])
+ if (FixupChar(str1[i]) != FixupChar(str2[i]))
return false;
}
return true;
@@ -368,7 +379,12 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
int32 i = 0;
for (int32 c = 0; c < size;) {
+#ifdef MORE_LANGUAGES
+ if ((CFont::IsJapanese() && str[c] == (0x8000 | '~') && str[c + 1] == (0x8000 | '1') && str[c + 2] == (0x8000 | '~')) ||
+ (!CFont::IsJapanese() && str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~')) {
+#else
if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') {
+#endif
switch (i) {
case 0: sprintf(numStr, "%d", n1); break;
case 1: sprintf(numStr, "%d", n2); break;
@@ -406,7 +422,13 @@ CMessages::InsertStringInString(wchar *str1, wchar *str2)
wchar *_str1 = str1;
uint16 i;
for (i = 0; i < total_size; ) {
- if (*_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~') {
+#ifdef MORE_LANGUAGES
+ if ((CFont::IsJapanese() && *_str1 == (0x8000 | '~') && *(_str1 + 1) == (0x8000 | 'a') && *(_str1 + 2) == (0x8000 | '~'))
+ || (CFont::IsJapanese() && *_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~'))
+ {
+#else
+ if (*_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~') {
+#endif
_str1 += 3;
for (int j = 0; j < str2_size; j++) {
tempstr[i++] = str2[j];
@@ -437,7 +459,12 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
wchar *_outstr = outstr;
for (i = 0; i < strSize;) {
+#ifdef MORE_LANGUAGES
+ if ((CFont::IsJapanese() && str[i] == (0x8000 | '~') && str[i + 1] == (0x8000 | 'k') && str[i + 2] == (0x8000 | '~')) ||
+ (!CFont::IsJapanese() && str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~')) {
+#else
if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') {
+#endif
i += 4;
for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS; cont++) {
uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]);