support loading msg files from traditional Chinese version

This commit is contained in:
noword 2022-12-06 13:06:50 +08:00
parent 3a541d4b67
commit 10e06bb6d9
2 changed files with 9 additions and 0 deletions

View File

@ -88,6 +88,7 @@ namespace fallout {
#define GERMAN "german"
#define ITALIAN "italian"
#define SPANISH "spanish"
#define TCHINESE "cht"
typedef enum GameDifficulty {
GAME_DIFFICULTY_EASY,

View File

@ -476,6 +476,7 @@ static int _message_load_field(File* file, char* str)
int len;
len = 0;
bool ischt = compat_stricmp(settings.system.language.c_str(), TCHINESE) == 0;
while (1) {
ch = fileReadChar(file);
@ -510,6 +511,13 @@ static int _message_load_field(File* file, char* str)
*(str + len) = ch;
len++;
if (ischt && ch >= 0x81 && ch <= 0xfe) {
// language is "cht", and it's a big5 encoding char
ch = fileReadChar(file);
*(str + len) = ch;
len++;
}
if (len > 1024) {
debugPrint("\nError reading message file - text exceeds limit.\n");
return 4;