[Scummvm-git-logs] scummvm master -> d2d4765aaf42d7c23e502dd82f5bd908e0aa1227

athrxx noreply at scummvm.org
Wed Jun 8 22:49:11 UTC 2022


This automated email contains information about 10 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7c0659d859 KYRA: Extract Korean strings, preliminary work
8ec7fe9bae KYRA: Fix build, add credits filename
4670159f26 KYRA: (LoK/KOR) - inital font support
b874bfb016 KYRA: (LoL/KOR) - fix script handling
245cb1775f KYRA: (LoK/KOR) - fix end credits
6d83986bca KYRA: (LoK/KOR) - more font related fixes
a6fb73725a KYRA: (LoK/KOR) - fine tune ingame menus
c6a02db614 KYRA: (LoK/KOR) - fine tune dialogue text lines
ae4934bc8c KYRA: (LoK/KOR) - more accuracy fixes
d2d4765aaf KYRA: (LoK/KOR) - some preparations for Hangul input


Commit: 7c0659d85918898f8bce8efa86d266b9c7e9e650
    https://github.com/scummvm/scummvm/commit/7c0659d85918898f8bce8efa86d266b9c7e9e650
Author: eientei (einstein95 at users.noreply.github.com)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: Extract Korean strings, preliminary work

Changed paths:
  A devtools/create_kyradat/resources/lok_dos_korean.h
    devtools/create_kyradat/create_kyradat.cpp
    devtools/create_kyradat/games.cpp
    devtools/create_kyradat/resources.cpp
    engines/kyra/detection_tables.h
    engines/kyra/engine/kyra_lok.cpp
    engines/kyra/resource/staticres.cpp
    engines/kyra/script/script_lok.cpp
    engines/kyra/sequence/sequences_lok.cpp


diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp
index c6b55104b6e..59a47131e76 100644
--- a/devtools/create_kyradat/create_kyradat.cpp
+++ b/devtools/create_kyradat/create_kyradat.cpp
@@ -38,7 +38,7 @@
 
 
 enum {
-	kKyraDatVersion = 116
+	kKyraDatVersion = 117
 };
 
 const ExtractFilename extractFilenames[] = {
@@ -1203,6 +1203,7 @@ const TypeTable languageTable[] = {
 	{ HE_ISR,  8 },
 	{ ZH_CHN,  9 },
 	{ ZH_TWN, 10 },
+	{ KO_KOR, 11 },
 	{ -1, -1 }
 };
 
diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp
index 38d87c2cb62..2532c123e2b 100644
--- a/devtools/create_kyradat/games.cpp
+++ b/devtools/create_kyradat/games.cpp
@@ -43,6 +43,7 @@ const Game kyra1Games[] = {
 	{ kKyra1, kPlatformDOS, kNoSpecial, IT_ITA },
 	{ kKyra1, kPlatformDOS, kNoSpecial, ES_ESP },
 	{ kKyra1, kPlatformDOS, kOldFloppy, RU_RUS },
+	{ kKyra1, kPlatformDOS, kNoSpecial, KO_KOR },
 	{ kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN },
 
 	{ kKyra1, kPlatformDOS, kTalkieVersion, EN_ANY },
diff --git a/devtools/create_kyradat/resources.cpp b/devtools/create_kyradat/resources.cpp
index 020dc3716ff..a377dc35954 100644
--- a/devtools/create_kyradat/resources.cpp
+++ b/devtools/create_kyradat/resources.cpp
@@ -38,6 +38,7 @@
 #include "resources/lok_dos_oldfloppy.h"
 #include "resources/lok_dos_oldfloppy_russian.h"
 #include "resources/lok_dos_spanish.h"
+#include "resources/lok_dos_korean.h"
 #include "resources/lok_dos_chinese_trad.h"
 
 #include "resources/lok_dos_cd.h"
@@ -438,6 +439,30 @@ static const ResourceProvider resourceProviders[] = {
 	{ k1ConfigStrings, kKyra1, kPlatformDOS, kNoSpecial, ES_ESP, &k1ConfigStringsDOSSpanishProvider },
 	{ k1TwoByteFontLookupTable, kKyra1, kPlatformDOS, kNoSpecial, ES_ESP, &k1TwoByteFontLookupTableDOSProvider },
 	{ k1CreditsStrings, kKyra1, kPlatformDOS, kNoSpecial, ES_ESP, &k1k1CreditsStringsDummyDOSProvider },
+	{ k1IntroStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1IntroStringsDOSKoreanProvider },
+	{ k1ItemNames, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1ItemNamesDOSKoreanProvider },
+	{ k1TakenStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1TakenStringsDOSKoreanProvider },
+	{ k1PlacedStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1PlacedStringsDOSKoreanProvider },
+	{ k1DroppedStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1DroppedStringsDOSKoreanProvider },
+	{ k1NoDropStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1NoDropStringsDOSKoreanProvider },
+	{ k1PutDownString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1PutDownStringDOSKoreanProvider },
+	{ k1WaitAmuletString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1WaitAmuletStringDOSKoreanProvider },
+	{ k1BlackJewelString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1BlackJewelStringDOSKoreanProvider },
+	{ k1HealingTipString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1HealingTipStringDOSKoreanProvider },
+	{ k1PoisonGoneString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1PoisonGoneStringDOSKoreanProvider },
+	{ k1ThePoisonStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1ThePoisonStringsDOSKoreanProvider },
+	{ k1FluteStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1FluteStringsDOSKoreanProvider },
+	{ k1WispJewelStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1WispJewelStringsDOSKoreanProvider },
+	{ k1MagicJewelStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1MagicJewelStringsDOSKoreanProvider },
+	{ k1FlaskFullString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1FlaskFullStringDOSKoreanProvider },
+	{ k1FullFlaskString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1FullFlaskStringDOSKoreanProvider },
+	{ k1OutroHomeString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1OutroHomeStringDOSKoreanProvider },
+	{ k1VeryCleverString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1VeryCleverStringDOSKoreanProvider },
+	{ k1GUIStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1GUIStringsDOSKoreanProvider },
+	{ k1NewGameString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1NewGameStringDOSKoreanProvider },
+	{ k1ConfigStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1ConfigStringsDOSKoreanProvider },
+	{ k1TwoByteFontLookupTable, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1TwoByteFontLookupTableDOSProvider },
+	{ k1CreditsStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1k1CreditsStringsDummyDOSProvider },
 	{ k1IntroStrings, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1IntroStringsDOSChineseTradProvider },
 	{ k1ItemNames, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1ItemNamesDOSChineseTradProvider },
 	{ k1TakenStrings, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1TakenStringsDOSChineseTradProvider },
diff --git a/devtools/create_kyradat/resources/lok_dos_korean.h b/devtools/create_kyradat/resources/lok_dos_korean.h
new file mode 100644
index 00000000000..dcbd5980f5c
--- /dev/null
+++ b/devtools/create_kyradat/resources/lok_dos_korean.h
@@ -0,0 +1,335 @@
+static const char *const k1IntroStringsDOSKorean[51] = {
+	"This is a text test - 1",
+	"This is a text test - 2",
+	"\xb5\xa1\x9c\x85\xa0\x65\xb7\xa1\xb4\xa1! \xc4i\x9c\x62...",
+	"...\xc1\xa5\xaf\x61\x9c\xe5 \xb5\xb5\xc0\x61\x9f\xb1\xb7\x65 \xb5\x61\xb8\xe5\xd0\x61\x8a\x85!",
+	"\x90\x61 \xa1\xa9\x9c\x61?, \x90\x81 \xb7\xa1\x9fq \xb4i\xbb\xa1? \xc7\xa9\xc7\xa9\xc7\xa9...",
+	"\xa0i\xc5\xb1! \x99\xa1 \x90\xe1\x90\xa1?",
+	"\x91\x41\x88\x61 \xc8i\xb5\xa2\xd0\x65\x88\xe5 \xb7\xa1\xa3\xa1 \x97i\xb4\xf6\x94\x61.",
+	"\xb7\xa1\x9c\xfd\x89\x41 \x90\x61\xc8\x61\x90\x61\x9f\xa1\x9c\x61\x89\xa1 \xb5\x81\xacw\xb7\x65 \xd0\x96\xbb\xa1\xa0\x65...",
+	"\xc6\x81\xc6\x82...\xbb\xa5\xb8\xf7\xd0\x81 \xc4i\x9c\x62, \xc3\xb1\xc0\x62\xd0\x61\x9c\x61\x8a\x81.",
+	"\xb7\xa1\xb9\x41\xa6\x81\xc8\xe1 \xb7\xa1\x98w\xb5\x41\xac\xe5 \x90\x81\x88\x61 \xa4\xf3\xb7\xa1\xb4\xa1!",
+	"\x91\x41 \xa5\xa1\xb8i\x88\xf5 \xb4\xf4\x93\x65 \xa0\x61\xa4\xf3\x98\x61\xb6\xe5 \xaf\xa5\x89w\x95\xa1 \xb4\x65\xb3\x61\xbb\xa1.",
+	"\x8b\x61\x9c\xfd\x94\x61\xa1\x65 \x9bu\x94\x81\x9d\xa1 \xd0\x81\xa5\xa1\xaf\xa1\xbb\xa1!",
+	"\x90\xe1\xb5\x41\x89\x41 \xb3i \xa0\x61\xa4\xf3\xb7\x65 \x90q\xb4\x61\xb7\xb6\x94\x61.",
+	"\xd3w! \x8b\x61\x89\x41 \xad\xa1\xb6\xa5\xb7\xa1\x9c\x61\xa1\x65 \x97i\xb4\xe1\xba\x89\x8d\x41... \x90\x65 \xc0\x62\xd0\x61\x93\xa1\x8c\x61!",
+	"...\xb7\xa1\xb9\x41 \x90\xe1\x93\x65 \x95\xa9\xb7\xa1\xb4\xa1, \x95\xa9... \x95\xa9 \xb4i\xbb\xa1?!",
+	"\x90\x65 \xb7\xa1\xb9\x41 \x88\x61\x89V\xb4\xe1. \xb8i\xb7\xb6\x89\x41\x90\x61 \xc4i\x9c\x62...",
+	"\xb7\xa1 \x90\x61\x9c\x61\x93\x65 \x94\xe1\xb6\x82 \xb9\xbd\xb4\x61\xbb\xa9\x8c\xe1\xb4\xa1!",
+	"\xc7\xa1\x9c\x65\x97\xa1\xb4\x61\x93\x65 \x90\x81 \xad\xa5\xb4\x65\xb5\x41 \xb7\xb6\xb4\xe1! \xd0\x61\xd0\x61\xd0\x61~",
+	"\xb4\xe1\x9f\xb5\x89\xd7\x94\x81 \xa0i\xc5\xb1\xb7\xa1 \xc8i\xc2\x89\xd0\x96\x94\x61!",
+	"\x8b\x61\x93\x65 \xbb\xa1\x8bq \xc4\x61\xb7\xa1\x9c\x61\xb9Q\xb7i \xc9\xb7\xb9\x41\xd0\x61\x89\xa1 \xb7\xb6\x94\x61...",
+	"...\xc7\xa1\x9c\x65\x97\xa1\xb4\x61\xb7\x81 \xa1\xa1\x97\x65 \xa0\x61\xa4\xf3\xb7\x81 \x8b\x65\xb6\xa5!",
+	"",
+	"\x90\x81 \xa4i\xb7i \x88\xe9\x94\x61\x93\xa1, \xa2\x81\xb4\xf1\xd0\x61\x8a\x85!",
+	"\x8b\x61\x9c\xfd\xbb\xa1, \x91\x41\x89\x41 \xcb\x62\xa5i\xd3\xa1 \xb4i\x9d\x61 \xba\x89 \x88\xf5\xb7\xa1 \xb7\xb6\x94\x61...",
+	"\xa4\x61\x9d\xa1, \xb6\x95\x8b\xa1\x93\x65 \xa0\x61\xa4\xf3\xb7\xa1\xbb\xa1!",
+	"\x90\x65 \x90\xe1\xb5\x41\x89\x41 \xb8\xf7\xbb\xa2\xd0\x61\x89\x41 \x89w\x89\xa1\x9fi \xd0\x81\xba\x81\xa0\x61.",
+	"\x8b\x61 \x90\x61\xa2\x81\xb5\x45 \xb5\xa1\x9f\x61\xbb\xa1 \xa0i\xb4\x61\x9c\x61, \x8a\xe1\xb5\x61\xb6\x85 \x94\x61\x9cq\xba\xe1\xb4\xa1!",
+	"\x8b\x61 \x90\x61\xa2\x81\xb6\xe1\x9d\xa1 \xb5\xa1\x9f\x61\xbb\xa1 \xa0\x61\x9c\x61, \xb5\x81\xab\x65 \x94\x61\x9cq\xba\xe1\xb4\xa1!",
+	"\xb5\x41\xa7\xa1~!",
+	"\x8b\x61\x88\xf5\xb7\xa1 \xb8\xf7\x94s\xb7\xa1\x91\x41...",
+	"...\xb4\x65 \x8b\x61\x9c\xe5\x88\x61?",
+	"\xd0\x61 \xd0\x61 \xd0\x61...",
+	"\x90\x81 \xad\xa5\x88\x61\x9c\x62\xb7\xa1...",
+	"\x90\x81\x88\x61 \xaci\xb4\x61\xb7\xb6\x94\x61\x93\xa1...!",
+	"\xa7\x61\x9c\x85\x97\x65!",
+	"\xd0i\xb4\x61\xa4\xe1\xbb\xa1! \xb6\x81\x9f\xa1\x88\x61 \x97\x61\x97\xa1\xb4\xe1 \xd0\x81\x90\x96\xb4\xe1\xb6\x61!",
+	"\xb4\x61\x93\xa1\x94\x61! \x91\x41\x88\x61 \xd0\x81\x90\x85 \x88\xe1\xb4\xa1!",
+	"\xa7\x61\x9c\x85\x97\x65 \x94\x81\xb5\xd7 \xa0\x65\xad\x41!!!",
+	"\xc7\xa1\x9c\x65\x97\xa1\xb4\x61\xb7\x81 \xb5w\x89\xd7\xb7i \xb6\xe1\xd0\x61\xb5\x61!!",
+	"\xb7\xa1\xb9\x45 \xb5\x81\xb8\xe5\xb7\x81 \xc7\xa1\x9c\x65\x97\xa1\xb4\x61\x9fi \x94\x61\xaf\xa1 \x96\x41\xc0x\xb4\x61\xb4\xa1\x89V\x94\x61.",
+	"\xb9\xbd\xb7\x65 \xac\x97\x88\x62\xb7\xa1\xb5\x81\xb6\x61, \xd0i\xb4\x61\xa4\xe1\xbb\xa1.",
+	"\x90\x61\xb7\x81 \xc0\xf5\xa4\xe5\xbc\x81 \xb5\xd7\xa1w\xb7\x61\x9d\xa1\xb0\xe1...",
+	"\xb7\xa1 \xcb\x65\xcb\x65\xd0\x65 \xac\x85\x97i\xb7i \xc7\xa1\x9c\x65\x97\xa1\xb4\x61\xb7\x81 \x89\xb7\xaf\xa2 \xaf\xa5\xa4i\x9d\xa1 \xb8\xf7\xd0\x65\x94\x61!",
+	"\xa7\x61\x9c\x85\x97\x65, \xb8i \xd0\x61\xadv\xafs\x93\xa1\x94\x61.",
+	"\xb8\x61\xb5\x65\xb7\x65 \x94\xe1 \xb7\xa1\xacw \xafi\xcfq\xb5\x41 \xb8q\x89\x61\xb7\xb6\xbb\xa1 \xb4g\x89\xa1...",
+	"\x94w\xaf\xa5\xb7\x81 \xc3\xa5\x8a\x81\x97i\x95\xa1 \xb8\xf7\xacw\xb7\x61\x9d\xa1 \x95\xa9\xb4\x61\xb5\xd6\xafs\x93\xa1\x94\x61!",
+	"\xa7\x61\x9f\xa5...",
+	"\xa0i\xc5\xb1\xb7\xa1 \xc8i\xc2\x89\xd0\x96\xad\xa1!",
+	"\xb9\xa1\xa0\x65\x88\x65 \x90\x81\x89\x41\x9d\xa1 \xb5\xa9 \x88\xf5\xb7\xa1\xb5\xa1.",
+	"\xa7\x61\x9c\x85\x97\x65\xb7i \x95\xa1\xb5\xc1\xba\x81\xaf\xa1\xb5\xa1...",
+	""
+};
+
+static const StringListProvider k1IntroStringsDOSKoreanProvider = { ARRAYSIZE(k1IntroStringsDOSKorean), k1IntroStringsDOSKorean };
+
+static const char *const k1ItemNamesDOSKorean[107] = {
+	"\xac\xe2\x9f\x41\xac\xe2",
+	"\xb8\x61\xae\x81\xb8\xf7",
+	"\x90q\xb5\xa2",
+	"\x94\x61\xb7\xa1\xb4\x61\xa1\xa5\x97\x61",
+	"\xb5\x41\xa0\xe1\x9ci\x97\x61",
+	"\xbb\xa5\xba\x81",
+	"\x9e\x81\xa7\xa1",
+	"\x88q\x9cq\xac\xe2",
+	"\xac\x61\xcc\x61\xb7\xa1\xb4\xe1",
+	"\xb5\xa1\xcci",
+	"\xc9\xa1\xcc\x61\xbb\x61",
+	"\xb4\xe9\x9e\x82\xa0\x61\x91\xa1",
+	"\xc8\x65\xac\x97\xac\xe2",
+	"\xb6\xa9\xb8w\xac\xe2",
+	"\xa2\x81\xbb\xa1\x88\x81\xac\xe2",
+	"\xc0\xe5\xb5\x65\xb8\x61\xac\xe2",
+	"\xb8w\xa3\xa1",
+	"\xcbI\x9f\xb3",
+	"\x90\x65\xc1\xa1",
+	"\xb7\x65\xb8w\xa3\xa1",
+	"\xb8\x62\xb7\x65 \xb7\x65\xb9\xa1\x88\x62\xacw",
+	"\xb7\x65\xd1\xc1",
+	"\x8bq\xd1\xc1",
+	"\x8bq\xa4\x65\xbb\xa1",
+	"\xb5\xd7\xb7\x81 \xb8\x65",
+	"\xad\xa9\xa4w\xb6\x89",
+	"\x95\xa1\xc9\xa1\x9f\xa1",
+	"\xd1\xa1\x96\x81",
+	"\xd0w\xacw \xa7\xb9\x90\x61\x93\x65 \"\xa6\x89\x98i\x8b\xa1",
+	"\xa6\x89\x98i\x8b\xa1",
+	"\xa6\x89\x98i\x8b\xa1",
+	"\xa6\x89\x98i\x8b\xa1",
+	"\xa6\x89\x98i\x8b\xa1",
+	"\xa6\x89\x98i\x8b\xa1",
+	"\xa2\x89\x89\xa1\x8b\xa1",
+	"\xa2\x89\x89\xa1\x8b\xa1 \xa9\x61",
+	"\xb4\xb7\x89\xa1\x8b\xa1 \x94\x61\x9f\xa1",
+	"\xa9\x61",
+	"\xac\x61\x89\xc1",
+	"\xac\x61\x89\xc1\xa9\x61",
+	"\xa7i\x9e\x81\xa5\x41\x9f\xa1",
+	"\xa4\xe1\xac\xf5",
+	"\xa1\x41\xa1\xa1",
+	"\x94\x81\x9f\xa1\xac\xe2",
+	"\xc9\xb3",
+	"\xac\x97\xa1w\x89\xa1\x9f\xa1",
+	"\x8b\xb5\xc8\xe9",
+	"\x89\x81\x9c\x65",
+	"\xb7\xbc\xac\x61\x8a\xe1",
+	"\xc9\xa1\x8f\xa1\xce\x89",
+	"\xa5i\x99\xb7\xa5i",
+	"\xae\x81\xb8\xf7\x8a\x81\xafi",
+	"\x92\x85\xa2\x89",
+	"\x88\xe1\xb6\x89",
+	"\xb4\xe9\xb7q \xb9\xa1\x88\x62",
+	"\xcfi\x9e\x95",
+	"\xa1\xa1\x9c\x81\xaf\xa1\x89\x81",
+	"\xae\x41 \xb5i\xae\x41",
+	"\xb5\xa2 \xb5i\xae\x41",
+	"\xd3\x62\xb6\x61\xac\xe2 \xb5i\xae\x41",
+	"\xa8i\x88\x65\xac\x82 \xb4\xa2",
+	"\xa8i\x88\x65\xac\x82 \xb4\xa2",
+	"\xce\x81\x9f\x65\xac\x82 \xb4\xa2",
+	"\xce\x81\x9f\x65\xac\x82 \xb4\xa2",
+	"\x91\xa1\x9c\x65\xac\x82 \xb4\xa2",
+	"\x91\xa1\x9c\x65\xac\x82 \xb4\xa2",
+	"\xc1\xa1\x9d\xa2\xac\x82 \xb4\xa2",
+	"\xb5\xa1\x9d\x45\xbb\xa1\xac\x82 \xb4\xa2",
+	"\xa5\xa1\x9c\x61\xac\x82 \xb4\xa2",
+	"\xa2\x81\xbb\xa1\x88\x81\xac\x82 \xb4\xa2",
+	"\xa0j\xb7\x65\xa2\x89",
+	"\xa0j\xb7\x65\xa2\x89",
+	"\xad\xa1\x8bq\xa2\x89",
+	"\xad\xa1\x8bq\xa2\x89",
+	"\x89\xd7\xc0\xe5\xae\x81",
+	"\x89\xd7\xc0\xe5\xae\x81",
+	"\xa0\x61\xa4\xf3\xae\x81",
+	"\xa0\x61\xa4\xf3\xae\x81",
+	"\xa7\xa5 \xcfi\x9c\x61\xaf\x61\xc7\x61",
+	"\xa7\xa5 \xcfi\x9c\x61\xaf\x61\xc7\x61",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\x96\x81\x9e\x81\xa0\x61\x8b\xa1",
+	"\xb4\xb7\xcf\xa1\xbb\xa1 \xb9\xa1\x88\x62",
+	"\xb4\xb7\xcf\xa1\xbb\xa1 \xb9\xa1\x88\x62",
+	"\xb4\xb7\xcf\xa1\xbb\xa1 \xb9\xa1\x88\x62",
+	"\xb4\xb7\xcf\xa1\xbb\xa1 \xb9\xa1\x88\x62",
+	"\xb4\xb7\xcf\xa1\xbb\xa1 \xb9\xa1\x88\x62",
+	"\xa8i\x88\x65\xac\x82\xb7\x81 \xa0\x61\xa4\xf3\xb7\x81 \x95\xa9",
+	"\xb5\xa1\x9d\x45\xbb\xa1\xac\x82\xb7\x81 \xa0\x61\xa4\xf3\xb7\x81 \x95\xa9",
+	"\x91\xa1\x9c\x65\xac\x82\xb7\x81 \xa0\x61\xa4\xf3\xb7\x81 \x95\xa9",
+	"\xc1\xa1\x9d\xa2\xac\x82\xb7\x81 \xa0\x61\xa4\xf3\xb7\x81 \x95\xa9",
+	"\xc0\xf7\x9d\xa2\xac\x82\xb7\x81 \xa0\x61\xa4\xf3\xb7\x81 \x95\xa9",
+	"\xce\x81\x9f\x65\xac\x82\xb7\x81 \xa0\x61\xa4\xf3\xb7\x81 \x95\xa9",
+	"\xa5\xa1\x9c\x61\xac\x82\xb7\x81 \xa0\x61\xa4\xf3\xb7\x81 \x95\xa9",
+	"\xa2\x81\x88\xe1\xb6\x85 \x95\xa9",
+	"\xb5\xd7\x89\xc5",
+	"\xbb\xa1\xd2\xe1\xa5\xb7",
+	"\x8bq \xb5i\xae\x41",
+	"\xb4i\xae\x81\xb4\xf4\x93\x65 \xa2\x89\x88\xe5"
+};
+
+static const StringListProvider k1ItemNamesDOSKoreanProvider = { ARRAYSIZE(k1ItemNamesDOSKorean), k1ItemNamesDOSKorean };
+
+static const char *const k1TakenStringsDOSKorean[2] = {
+	" \xbb\xb3\xb4\xf6\xb7q",
+	" \xbb\xb3\xb4\xf6\xb7q"
+};
+
+static const StringListProvider k1TakenStringsDOSKoreanProvider = { ARRAYSIZE(k1TakenStringsDOSKorean), k1TakenStringsDOSKorean };
+
+static const char *const k1PlacedStringsDOSKorean[1] = {
+	" \x91\xbd\xb4v\xb7q"
+};
+
+static const StringListProvider k1PlacedStringsDOSKoreanProvider = { ARRAYSIZE(k1PlacedStringsDOSKorean), k1PlacedStringsDOSKorean };
+
+static const char *const k1DroppedStringsDOSKorean[1] = {
+	" \x91\xbd\xb4v\xb7q"
+};
+
+static const StringListProvider k1DroppedStringsDOSKoreanProvider = { ARRAYSIZE(k1DroppedStringsDOSKorean), k1DroppedStringsDOSKorean };
+
+static const char *const k1NoDropStringsDOSKorean[2] = {
+	"\xb5\x61\x8b\xa5 \x94\xe1\xb7\xa1\xacw\xb7\x81 \xa2\x89\x88\xe5\xb7i \x91\xbd\xbb\xa1 \xa1\xb5\xd0\x81.",
+	"\x8b\x61\x89\xb5\xb5\x45 \x91\xbd\xb7i \xae\x81 \xb4\xf4\xb4\xe1."
+};
+
+static const StringListProvider k1NoDropStringsDOSKoreanProvider = { ARRAYSIZE(k1NoDropStringsDOSKorean), k1NoDropStringsDOSKorean };
+
+static const char *const k1PutDownStringDOSKorean[1] = {
+	"\xb7\xa1\x88\xe9 \xa0\xe5\xb8\xe1 \x90\x81\x9d\x61 \x91\xbd\x93\x65\x89\x41 \xb9\xbd\x89V\xb4\xe1."
+};
+
+static const StringListProvider k1PutDownStringDOSKoreanProvider = { ARRAYSIZE(k1PutDownStringDOSKorean), k1PutDownStringDOSKorean };
+
+static const char *const k1WaitAmuletStringDOSKorean[1] = {
+	"\x90\x81 \xa6\x81\xb8\xe2\xb7\x81 \xd3\xb1\xb7\xa1 \xd2\x41\xa5\xa2\x96I \x98\x81 \x8c\x61\xbb\xa1 \x8b\xa1\x94\x61\x9d\x61\xb4\xa1 \xd0i \x88\xf5 \x88{\xb4\x61."
+};
+
+static const StringListProvider k1WaitAmuletStringDOSKoreanProvider = { ARRAYSIZE(k1WaitAmuletStringDOSKorean), k1WaitAmuletStringDOSKorean };
+
+static const char *const k1BlackJewelStringDOSKorean[1] = {
+	"\xb7\xa1\x88\xe5 \xa5\xa1\xac\xe2\xb7\xa1\xb8g\xb4\x61, \x8b\x61\x9c\xe5\x95\x41 \xb5\xe1 \x88\xf1\xb7\x65 \xac\x82\xb7\xa1\xbb\xa1?"
+};
+
+static const StringListProvider k1BlackJewelStringDOSKoreanProvider = { ARRAYSIZE(k1BlackJewelStringDOSKorean), k1BlackJewelStringDOSKorean };
+
+static const char *const k1HealingTipStringDOSKorean[1] = {
+	"\xd3\x61\xb7q, \xb7\xa1\x88\xe5 \x90\x81\x88\x61 \x94\x61\xc1v\xb7i \x98\x81 \xac\x61\xb6w\xd0\x61\xa1\x65 \xb9\xbd\x89V\x93\x65\x88\xe9."
+};
+
+static const StringListProvider k1HealingTipStringDOSKoreanProvider = { ARRAYSIZE(k1HealingTipStringDOSKorean), k1HealingTipStringDOSKorean };
+
+static const char *const k1PoisonGoneStringDOSKorean[2] = {
+	"\xb5\xc1!~, \x8f{\x90\x81\xba\x81\x93\x65\x95\x41!",
+	"\x95\xa2\x8b\xa1\xb6\x85\xb7\xa1 \xac\x61\x9c\x61\xb9v\xb4\xe1!"
+};
+
+static const StringListProvider k1PoisonGoneStringDOSKoreanProvider = { ARRAYSIZE(k1PoisonGoneStringDOSKorean), k1PoisonGoneStringDOSKorean };
+
+static const char *const k1ThePoisonStringsDOSKorean[4] = {
+	"\x95\xa2...",
+	"\xb7\x61\xb7\x61... \xae\x91\xb7\xa1 \xa0\x62\xd1\x61...",
+	"\x8b\xa1\xb6\x85\xb7\xa1 \xb4\xf4\xb4\xe1...",
+	"\x8b\x61 \xa4\x91\xb7\x65 \xa6\x85\xa1w\xd3\xa1\r...\x95\xa2\xa4\x91\xb7\xa1\xb4\xa1!"
+};
+
+static const StringListProvider k1ThePoisonStringsDOSKoreanProvider = { ARRAYSIZE(k1ThePoisonStringsDOSKorean), k1ThePoisonStringsDOSKorean };
+
+static const char *const k1FluteStringsDOSKorean[2] = {
+	"\xb6\x97\xb8w\xd0\x65 \xad\xa1\x9f\xa1\x93\x65 \xb4\x61\x93\xa1\x8a\x85.",
+	"\x89\x41\x94\x61\x88\x61 \xa0\x61\xbb\xa1\xa0\x62 \xb7q\xb7\xa1 \x90\xe1\xa2\x81 \x91\xbc\xb4\x61!"
+};
+
+static const StringListProvider k1FluteStringsDOSKoreanProvider = { ARRAYSIZE(k1FluteStringsDOSKorean), k1FluteStringsDOSKorean };
+
+static const char *const k1WispJewelStringsDOSKorean[3] = {
+	"\x8b\x61\x88\xe9 \xd0\x61\x89\xa1\xcf\x65 \x8b\xa1\xa6\x85\xb7\xa1 \xb4\x61\x90\xa1.",
+	"\xa0\xe5\xb8\xe1 \x90\x81",
+	", \x90\x81\x9d\x61\x91\xc1\xb4\xa1 \x89V\x93\x65\x88\xe9."
+};
+
+static const StringListProvider k1WispJewelStringsDOSKoreanProvider = { ARRAYSIZE(k1WispJewelStringsDOSKorean), k1WispJewelStringsDOSKorean };
+
+static const char *const k1MagicJewelStringsDOSKorean[1] = {
+	"\xb7\xa1\xacw\xd0\x65 \x93\x61\x8f\xb1\xb7\xa1 \xb5\xa1\x93\x65\x88\xe9"
+};
+
+static const StringListProvider k1MagicJewelStringsDOSKoreanProvider = { ARRAYSIZE(k1MagicJewelStringsDOSKorean), k1MagicJewelStringsDOSKorean };
+
+static const char *const k1FlaskFullStringDOSKorean[1] = {
+	"\xcfi\x9c\x61\xaf\x61\xc7\x61\x93\x65 \xb7\xa1\xa3\xa1 \x8d\xc2 \xc0\x61 \xb7\xb6\xafs\x93\xa1\x94\x61."
+};
+
+static const StringListProvider k1FlaskFullStringDOSKoreanProvider = { ARRAYSIZE(k1FlaskFullStringDOSKorean), k1FlaskFullStringDOSKorean };
+
+static const char *const k1FullFlaskStringDOSKorean[4] = {
+	"\xcfi\x9c\x61\xaf\x61\xc7\x61\x93\x65 \xbb\xa1\x8bq \xa0j\xb7\x65\r\xa2\x89\x9d\xa1 \xc0\x81\xb6\xa1\xb9v\xafs\x93\xa1\x94\x61.",
+	"\xcfi\x9c\x61\xaf\x61\xc7\x61\x93\x65 \xbb\xa1\x8bq \xad\xa1\x8bq\xa2\x89\x9d\xa1\r\xc0\x81\xb6\xa1\xb9v\xafs\x93\xa1\x94\x61.",
+	"\xcfi\x9c\x61\xaf\x61\xc7\x61\x93\x65 \xbb\xa1\x8bq \x89\xd7\xc0\xe5\xae\x81\x9d\xa1\r\xc0\x81\xb6\xa1\xb9v\xafs\x93\xa1\x94\x61.",
+	"\xa0\x61\xa4\xf3\xb7\x81 \xa2\x89."
+};
+
+static const StringListProvider k1FullFlaskStringDOSKoreanProvider = { ARRAYSIZE(k1FullFlaskStringDOSKorean), k1FullFlaskStringDOSKorean };
+
+static const char *const k1OutroHomeStringDOSKorean[1] = {
+	"\xbb\xb3"
+};
+
+static const StringListProvider k1OutroHomeStringDOSKoreanProvider = { ARRAYSIZE(k1OutroHomeStringDOSKorean), k1OutroHomeStringDOSKorean };
+
+static const char *const k1VeryCleverStringDOSKorean[1] = {
+	"\xb4\x61\xba\x81 \xb5w\x9f\xa1\xd0\x61\x8a\x85! \x8b\x61\x9c\xe1\x90\x61 \xb4\x61\xa2\x81\x9f\xa1 \xb4\x81\xb0\xe1\x95\xa1 \xad\xa1\xb6w\xb4\xf4\xb4\xe1!"
+};
+
+static const StringListProvider k1VeryCleverStringDOSKoreanProvider = { ARRAYSIZE(k1VeryCleverStringDOSKorean), k1VeryCleverStringDOSKorean };
+
+static const char *const k1GUIStringsDOSKorean[28] = {
+	"\xc7\xa1\x9c\x65\x97\xa1\xb4\x61\xb7\x81 \xb8\xe5\xac\xe9",
+	"\xb8\xe1\xb8w\x96\x45 \x89\x41\xb7\xb1\xb7i \xa6\x89\x9c\xe1\xb5\xb3\x93\xa1\x94\x61",
+	"\x89\x41\xb7\xb1\xb7i \xb8\xe1\xb8w\xd0s\x93\xa1\x94\x61",
+	"\xac\xe5\xc8\x82\xac\x61\xd0w",
+	"\xc7\xa1\x9c\x65\x97\xa1\xb4\x61\x9fi \x98\xe1\x90s\x93\xa1\x94\x61",
+	"\x89\x41\xb7\xb1\xb7i \x89\x81\xad\xa2\xd0s\x93\xa1\x94\x61",
+	"\xac\xe5\xc8\x82\xac\x61\xd0w",
+	"\xb4\xe1\x98\xe5 \xcc\x61\xb7\xa9\xb7i \xa6\x89\x9c\xe1\xb5\xa9\x8c\x61\xb6\x61?",
+	"\xb8\xe1\xb8w\xd0i \xb6\xe1\xc3\xa1\x9fi \xac\xe5\xc8\x82\xd0\x61\xad\x41\xb6\x61",
+	"[ \xa7\xa5 \x89\xb7\x88\x65 ]",
+	"\xc2\xe1\xad\xa1",
+	"\xb8\xe1\xb8w\xd0i \x89\x41\xb7\xb1\xb7\x81 \xac\xe9\xa1w\xb7i \xb7\xb3\x9d\x62\xd0\x61\xad\x41\xb6\x61",
+	"\xb8\xe1\xb8w",
+	"\xcd\x65\xd3\xa1 \xae\xe1\x88\xe1\x9c\x61, \xa7\x61\x9c\x85\x97\x65.",
+	"\xc7\xa1\x9c\x65\x97\xa1\xb4\x61\x9fi \x98\xe1\x90\x61\xaf\xa1\x89V\xafs\x93\xa1\x8c\x61?",
+	"XXX",
+	"XXX",
+	"XXXXXXX",
+	"XXXXXXXXX",
+	"\xba\x81 \xa1\x41\x93\x41",
+	"\xc5q",
+	"\x8fq",
+	"\xb5\x81",
+	"\xb4\x61\x93\xa1\xb5\xa1",
+	"R\xd1,\\\xd1,a\xd1,f\xd1,k\xd1,u\xd1,\xd1,\x84\xd1,\x89\xd1,\x88\xe8\x93\x65 \xad\xa2\x95\xa1 ",
+	"\xa2\x85\xb8w \xad\xa2\x95\xa1 ",
+	"\xb7q\xb4\x62",
+	"\xad\xa1\x9f\xa1"
+};
+
+static const StringListProvider k1GUIStringsDOSKoreanProvider = { ARRAYSIZE(k1GUIStringsDOSKorean), k1GUIStringsDOSKorean };
+
+static const char *const k1NewGameStringDOSKorean[1] = {
+	"[ \x89\x41\xb7\xb1\xb7i \xac\x81\x9d\xa1 \xaf\xa1\xb8\x62\xd0s\x93\xa1\x94\x61 ]"
+};
+
+static const StringListProvider k1NewGameStringDOSKoreanProvider = { ARRAYSIZE(k1NewGameStringDOSKorean), k1NewGameStringDOSKorean };
+
+static const char *const k1ConfigStringsDOSKorean[9] = {
+	"\x88\x61\xb8w \x93\x61\x9f\xb1",
+	"\x93\x61\x9f\xb1",
+	"\xa5\xa1\xc9\xb7",
+	"\xa8\x61\x9fq",
+	"\x88\x61\xb8w \xa8\x61\x9fq",
+	"\x88\x61\xb8w \x93\x61\x9f\xb1",
+	"\xa5\xa1\xc9\xb7",
+	"\xa8\x61\x9fq",
+	"\xae\x81\x95\xb7"
+};
+
+static const StringListProvider k1ConfigStringsDOSKoreanProvider = { ARRAYSIZE(k1ConfigStringsDOSKorean), k1ConfigStringsDOSKorean };
+
diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h
index 582b607dcff..118c35613d8 100644
--- a/engines/kyra/detection_tables.h
+++ b/engines/kyra/detection_tables.h
@@ -259,11 +259,11 @@ const KYRAGameDescription adGameDescs[] = {
 	{ // from trembyle
 		{
 			"kyra1",
-			msg_missingLangResources, // Reason for being unsupported
+			"Extracted",
 			AD_ENTRY1("GEMCUT.EMC", "57907d931675dbd16386c1d81d18fee4"),
 			Common::KO_KOR,
 			Common::kPlatformDOS,
-			ADGF_UNSUPPORTED,
+			ADGF_NO_FLAGS,
 			GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
 		},
 		KYRA1_FLOPPY_FLAGS
diff --git a/engines/kyra/engine/kyra_lok.cpp b/engines/kyra/engine/kyra_lok.cpp
index 9b0d6a9021c..ca166f569aa 100644
--- a/engines/kyra/engine/kyra_lok.cpp
+++ b/engines/kyra/engine/kyra_lok.cpp
@@ -95,7 +95,7 @@ KyraEngine_LoK::KyraEngine_LoK(OSystem *system, const GameFlags &flags)
 
 	_malcolmFrame = 0;
 	_malcolmTimer1 = _malcolmTimer2 = 0;
-	_defaultFont = (_flags.lang == Common::ZH_TWN) ? Screen::FID_CHINESE_FNT : ((_flags.lang == Common::JA_JPN) ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
+	_defaultFont = (_flags.lang == Common::ZH_TWN) ? Screen::FID_CHINESE_FNT : ((_flags.lang == Common::JA_JPN) ? Screen::FID_SJIS_FNT : ((_flags.lang == Common::KO_KOR) ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT));
 	_defaultLineSpacing = (_flags.lang == Common::ZH_TWN) ? 2 : 0;
 }
 
@@ -309,6 +309,9 @@ Common::Error KyraEngine_LoK::go() {
 		_screen->setTextMarginRight(312);
 	}
 
+	if (_flags.lang == Common::KO_KOR)
+		_screen->loadFont(Screen::FID_KOREAN_FNT, "MK15.BIT");
+
 	_screen->setFont(_defaultFont);
 	_screen->_lineSpacing = _defaultLineSpacing;
 
diff --git a/engines/kyra/resource/staticres.cpp b/engines/kyra/resource/staticres.cpp
index f6fa5ab555b..7834d3a3ff1 100644
--- a/engines/kyra/resource/staticres.cpp
+++ b/engines/kyra/resource/staticres.cpp
@@ -38,7 +38,7 @@
 
 namespace Kyra {
 
-#define RESFILE_VERSION 116
+#define RESFILE_VERSION 117
 
 namespace {
 bool checkKyraDat(Common::SeekableReadStream *file) {
@@ -96,6 +96,7 @@ const IndexTable iLanguageTable[] = {
 	{ Common::HE_ISR,  8 },
 	{ Common::ZH_CHN,  9 },
 	{ Common::ZH_TWN, 10 },
+	{ Common::KO_KOR, 11 },
 	{ -1, -1 }
 };
 
@@ -987,7 +988,7 @@ void KyraEngine_LoK::loadMainScreen(int page) {
 	_screen->clearPage(page);
 
 	bool success = false;
-	static const char *pattern[] = { "15", "_ENG", "_FRE", "_GER", "_SPA", "_ITA", "_HEB", "" };
+	static const char *pattern[] = { "15", "_ENG", "_FRE", "_GER", "_SPA", "_ITA", "_HEB", "_HAN", "" };
 	for (int i = 0; i < ARRAYSIZE(pattern) && !success; ++i) {
 		Common::String tryFile = Common::String::format("MAIN%s.CPS", pattern[i]);
 		if ((success = _res->exists(tryFile.c_str())))
diff --git a/engines/kyra/script/script_lok.cpp b/engines/kyra/script/script_lok.cpp
index 3c5b3aa73b5..f90f03f3719 100644
--- a/engines/kyra/script/script_lok.cpp
+++ b/engines/kyra/script/script_lok.cpp
@@ -1036,7 +1036,10 @@ int KyraEngine_LoK::o1_specialEventDisplayBrynnsNote(EMCState *script) {
 		else if (_flags.lang == Common::RU_RUS)
 			_screen->loadBitmap("NOTEENG.CPS", 3, 3, nullptr);
 	} else {
-		_screen->loadBitmap("NOTE.CPS", 3, 3, nullptr);
+		if (_flags.lang == Common::KO_KOR)
+			_screen->loadBitmap("HAN_NOTE.CPS", 3, 3, nullptr);
+		else
+			_screen->loadBitmap("NOTE.CPS", 3, 3, nullptr);
 	}
 	_screen->copyRegion(63, 8, 63, 8, 194, 128, 2, 0);
 	_screen->updateScreen();
diff --git a/engines/kyra/sequence/sequences_lok.cpp b/engines/kyra/sequence/sequences_lok.cpp
index c0994dae157..d0c6bd8acbf 100644
--- a/engines/kyra/sequence/sequences_lok.cpp
+++ b/engines/kyra/sequence/sequences_lok.cpp
@@ -252,7 +252,7 @@ bool KyraEngine_LoK::seq_introStory() {
 		return false;
 
 	bool success = false;
-	static const char *pattern[] = { "", "_ENG", "_FRE", "_GER", "_SPA", "_ITA", "_HEB" };
+	static const char *pattern[] = { "", "_ENG", "_FRE", "_GER", "_SPA", "_ITA", "_HEB", "_HAN" };
 	for (int i = 0; i < ARRAYSIZE(pattern) && !success; ++i) {
 		Common::String tryFile = Common::String::format("TEXT%s.CPS", pattern[i]);
 		if ((success = _res->exists(tryFile.c_str())))


Commit: 8ec7fe9baea686685061865c7d22f784cb4d3bc7
    https://github.com/scummvm/scummvm/commit/8ec7fe9baea686685061865c7d22f784cb4d3bc7
Author: eientei (einstein95 at users.noreply.github.com)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: Fix build, add credits filename

Changed paths:
    engines/kyra/graphics/screen.h
    engines/kyra/sequence/sequences_lok.cpp


diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index a34d14c1b20..83d052248dd 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -547,6 +547,7 @@ public:
 		FID_SJIS_LARGE_FNT,
 		FID_SJIS_SMALL_FNT,
 		FID_CHINESE_FNT,
+		FID_KOREAN_FNT,
 		FID_NUM
 	};
 
diff --git a/engines/kyra/sequence/sequences_lok.cpp b/engines/kyra/sequence/sequences_lok.cpp
index d0c6bd8acbf..d188501089f 100644
--- a/engines/kyra/sequence/sequences_lok.cpp
+++ b/engines/kyra/sequence/sequences_lok.cpp
@@ -1261,7 +1261,7 @@ void KyraEngine_LoK::seq_playCredits() {
 	uint8 *buffer = nullptr;
 	uint32 size = 0;
 
-	buffer = _res->fileData("CREDITS.TXT", &size);
+	buffer = _res->fileData(Common::String::format("CREDITS.%s", _flags.lang == Common::KO_KOR ? "HAN" : "TXT").c_str(), &size);
 	if (!buffer) {
 		int sizeTmp = 0;
 		const uint8 *bufferTmp = _staticres->loadRawData(k1CreditsStrings, sizeTmp);


Commit: 4670159f262fbe255cde6f5ec4744f3797557a14
    https://github.com/scummvm/scummvm/commit/4670159f262fbe255cde6f5ec4744f3797557a14
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: (LoK/KOR) - inital font support

This is still glitchy and will need some more polishing, but at least the intro runs...

Changed paths:
    devtools/create_kyradat/resources.cpp
    devtools/create_kyradat/resources/lok_dos_korean.h
    engines/kyra/engine/kyra_lok.cpp
    engines/kyra/graphics/screen.cpp
    engines/kyra/graphics/screen.h
    engines/kyra/graphics/screen_lok.cpp
    engines/kyra/gui/gui_lok.cpp
    engines/kyra/gui/gui_v1.cpp
    engines/kyra/gui/gui_v1.h
    engines/kyra/resource/staticres.cpp
    engines/kyra/sequence/seqplayer_lok.cpp
    engines/kyra/text/text.cpp


diff --git a/devtools/create_kyradat/resources.cpp b/devtools/create_kyradat/resources.cpp
index a377dc35954..dfb2fd09dda 100644
--- a/devtools/create_kyradat/resources.cpp
+++ b/devtools/create_kyradat/resources.cpp
@@ -461,7 +461,7 @@ static const ResourceProvider resourceProviders[] = {
 	{ k1GUIStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1GUIStringsDOSKoreanProvider },
 	{ k1NewGameString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1NewGameStringDOSKoreanProvider },
 	{ k1ConfigStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1ConfigStringsDOSKoreanProvider },
-	{ k1TwoByteFontLookupTable, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1TwoByteFontLookupTableDOSProvider },
+	{ k1TwoByteFontLookupTable, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1TwoByteFontLookupTableDOSKoreanProvider },
 	{ k1CreditsStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1k1CreditsStringsDummyDOSProvider },
 	{ k1IntroStrings, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1IntroStringsDOSChineseTradProvider },
 	{ k1ItemNames, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1ItemNamesDOSChineseTradProvider },
diff --git a/devtools/create_kyradat/resources/lok_dos_korean.h b/devtools/create_kyradat/resources/lok_dos_korean.h
index dcbd5980f5c..db2403389fe 100644
--- a/devtools/create_kyradat/resources/lok_dos_korean.h
+++ b/devtools/create_kyradat/resources/lok_dos_korean.h
@@ -333,3 +333,35 @@ static const char *const k1ConfigStringsDOSKorean[9] = {
 
 static const StringListProvider k1ConfigStringsDOSKoreanProvider = { ARRAYSIZE(k1ConfigStringsDOSKorean), k1ConfigStringsDOSKorean };
 
+static const uint16 k1TwoByteFontLookupTableDOSKorean[] = {
+	0xffff, 0x0000, 0x0020, 0x0160, 0x02a0, 0x03e0, 0x0520, 0x0660,
+	0x07a0, 0x08e0, 0x0a20, 0x0b60, 0x0ca0, 0x0de0, 0x0f20, 0x1060,
+	0x11a0, 0x12e0, 0x1420, 0x1560, 0x16a0, 0xffff, 0xffff, 0xffff,
+	0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+	0xffff, 0xffff, 0x0000, 0x0080, 0x0100, 0x0180, 0x0200, 0x0280,
+	0xffff, 0xffff, 0x0300, 0x0380, 0x0400, 0x0480, 0x0500, 0x0580,
+	0xffff, 0xffff, 0x0600, 0x0680, 0x0700, 0x0780, 0x0800, 0x0880,
+	0xffff, 0xffff, 0x0900, 0x0980, 0x0a00, 0x0a80, 0xffff, 0xffff,
+	0xffff, 0x0000, 0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300,
+	0x0380, 0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x0700,
+	0x0780, 0x0800, 0xffff, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80,
+	0x0b00, 0x0b80, 0x0c00, 0x0c80, 0x0d00, 0x0d80, 0xffff, 0xffff,
+	0xffff, 0x0000, 0x0000, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040,
+	0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040,
+	0x0040, 0x0000, 0x0040, 0x0040, 0x0040, 0xffff, 0xffff, 0xffff,
+	0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0040, 0x00c0, 0x00c0,
+	0x0000, 0x0000, 0x00c0, 0x0040, 0x0080, 0x0100, 0x0100, 0x0100,
+	0x0000, 0x0000, 0x0080, 0x0040, 0x00c0, 0x0000, 0x0000, 0x0000,
+	0x0000, 0x0000, 0x0000, 0x0000, 0x0040, 0x0000, 0x0040, 0x0020,
+	0x0000, 0x0000, 0x0040, 0x0020, 0x0040, 0x0060, 0x0000, 0x0040,
+	0x0000, 0x0000, 0x0020, 0x0060, 0x0060, 0x0020, 0x0040, 0x0020,
+	0x0000, 0x0000, 0x0060, 0x0060, 0x0020, 0x0020, 0x0000, 0x0000,
+	0xffff, 0x0000, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
+	0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
+	0x0020, 0x0020, 0xffff, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
+	0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0xffff, 0xffff
+};
+
+static const Uint16Provider k1TwoByteFontLookupTableDOSKoreanProvider = { ARRAYSIZE(k1TwoByteFontLookupTableDOSKorean), k1TwoByteFontLookupTableDOSKorean };
diff --git a/engines/kyra/engine/kyra_lok.cpp b/engines/kyra/engine/kyra_lok.cpp
index ca166f569aa..178cbf3ca56 100644
--- a/engines/kyra/engine/kyra_lok.cpp
+++ b/engines/kyra/engine/kyra_lok.cpp
@@ -95,8 +95,24 @@ KyraEngine_LoK::KyraEngine_LoK(OSystem *system, const GameFlags &flags)
 
 	_malcolmFrame = 0;
 	_malcolmTimer1 = _malcolmTimer2 = 0;
-	_defaultFont = (_flags.lang == Common::ZH_TWN) ? Screen::FID_CHINESE_FNT : ((_flags.lang == Common::JA_JPN) ? Screen::FID_SJIS_FNT : ((_flags.lang == Common::KO_KOR) ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT));
-	_defaultLineSpacing = (_flags.lang == Common::ZH_TWN) ? 2 : 0;
+	_defaultFont = Screen::FID_8_FNT;
+	_defaultLineSpacing = 0;
+
+	switch (_flags.lang) {
+	case Common::JA_JPN:
+		_defaultFont = Screen::FID_SJIS_FNT;
+		break;
+	case Common::ZH_TWN:
+		_defaultFont = Screen::FID_CHINESE_FNT;
+		_defaultLineSpacing = 2;
+		break;
+	case Common::KO_KOR:
+		_defaultFont = Screen::FID_KOREAN_FNT;
+		_defaultLineSpacing = 2;
+		break;
+	default:
+		break;
+	}
 }
 
 KyraEngine_LoK::~KyraEngine_LoK() {
@@ -307,10 +323,10 @@ Common::Error KyraEngine_LoK::go() {
 		_screen->loadFont(Screen::FID_CHINESE_FNT, "ASCII.FNT");
 		_screen->loadFont(Screen::FID_CHINESE_FNT, "KYRANDIA.FNT");
 		_screen->setTextMarginRight(312);
-	}
-
-	if (_flags.lang == Common::KO_KOR)
+	} else if (_flags.lang == Common::KO_KOR) {
 		_screen->loadFont(Screen::FID_KOREAN_FNT, "MK15.BIT");
+		_screen->setTextMarginRight(312);
+	}
 
 	_screen->setFont(_defaultFont);
 	_screen->_lineSpacing = _defaultLineSpacing;
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 0a106d3e252..8160f51cdb4 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -1395,6 +1395,10 @@ bool Screen::loadFont(FontId fontId, const char *filename) {
 				Common::MemoryReadStream str(oneByteData, temp);
 				fnt->load(str);
 			}
+		} else if (fontId == FID_KOREAN_FNT) {
+			const uint16 *lookupTable = _vm->staticres()->loadRawDataBe16(k1TwoByteFontLookupTable, temp);
+			// The FID_8_FNT must be loaded before this.
+			fnt = new KoreanFontLoK(_fonts[FID_8_FNT], lookupTable, temp);
 		} else {
 			fnt = new DOSFont();
 		}
@@ -1543,8 +1547,9 @@ uint16 Screen::fetchChar(const char *&s) const {
 
 	uint16 ch = (uint8)*s++;
 
-	if ((_fonts[_currentFont]->getType() == Font::kSJIS && (ch <= 0x7F || (ch >= 0xA1 && ch <= 0xDF))) || (_fonts[_currentFont]->getType() == Font::kBIG5 && ch < 0x7F))
-		return ch;
+	if ((_fonts[_currentFont]->getType() == Font::kSJIS && (ch <= 0x7F || (ch >= 0xA1 && ch <= 0xDF))) ||
+		(_fonts[_currentFont]->getType() == Font::kBIG5 && ch < 0x7F) || (_fonts[_currentFont]->getType() == Font::kKOR && ch < 0x80))
+			return ch;
 
 	ch |= (uint8)(*s++) << 8;
 	return ch;
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index 83d052248dd..3a2373177f8 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -67,7 +67,8 @@ public:
 	enum Type {
 		kASCII = 0,
 		kSJIS,
-		kBIG5
+		kBIG5,
+		kKOR
 	};
 
 public:
@@ -289,6 +290,35 @@ private:
 	const uint16 _pitch;
 };
 
+class KoreanFontLoK final : public Font {
+public:
+	KoreanFontLoK(Font *font8fnt, const uint16 *lookupTable, uint32 lookupTableSize);
+	~KoreanFontLoK() override;
+
+	bool load(Common::SeekableReadStream &data) override;
+	Type getType() const override { return kKOR; }
+	int getHeight() const override { return _height; }
+	int getWidth() const override { return _width; }
+	int getCharWidth(uint16 c) const override;
+	int getCharHeight(uint16 c) const override;
+	void setColorMap(const uint8 *src) override;
+	void drawChar(uint16 c, byte *dst, int pitch, int) const override;
+
+private:
+	const uint8 *createGlyph(uint16 chr) const;
+	void processColorMap();
+	void renderGlyph(byte *dst, const uint8 *glyph, uint8 col, int pitch) const;
+
+	int _width, _height;
+	const uint8 *_colorMap;
+
+	Font *_font8;
+	const uint8 *_fileData;
+	const uint8 *_glyphData[3];
+	const uint16 *_2byteTables[7];
+	uint8 *_glyphTemp;
+};
+
 class ChineseOneByteFontLoK final : public ChineseFont {
 public:
 	ChineseOneByteFontLoK(int pitch);
diff --git a/engines/kyra/graphics/screen_lok.cpp b/engines/kyra/graphics/screen_lok.cpp
index 594c724b65d..03373bdd151 100644
--- a/engines/kyra/graphics/screen_lok.cpp
+++ b/engines/kyra/graphics/screen_lok.cpp
@@ -533,4 +533,140 @@ void ChineseTwoByteFontLoK::processColorMap() {
 	_textColor[1] = _colorMap[0] | (_colorMap[0] << 8);
 }
 
+KoreanFontLoK::KoreanFontLoK(Font *font8fnt, const uint16 *lookupTable, uint32 lookupTableSize) : _font8(font8fnt), _height(16), _width(16), _fileData(0), _colorMap(0), _glyphTemp(0) {
+	assert(_font8);
+	assert(lookupTable);
+	assert(lookupTableSize == 224);
+	for (int i = 0; i < 7; ++i)
+		_2byteTables[i] = &lookupTable[i << 5];
+	memset(_glyphData, 0, sizeof(_glyphData));
+	_glyphTemp = new uint8[30];
+}
+
+KoreanFontLoK::~KoreanFontLoK() {
+	delete[] _fileData;
+	delete[] _glyphTemp;
+}
+
+bool KoreanFontLoK::load(Common::SeekableReadStream &data) {
+	if (_fileData)
+		return false;
+
+	if (!data.size())
+		return false;
+
+	uint32 fileSize = data.size();
+
+	if (fileSize != 5730 + 2550 + 3270) {
+		warning("KoreanFontLoK::load(): Invalid font file size '%d' (expected: '%d').", fileSize, 5730 + 2550 + 3270);
+		return false;
+	}
+
+	uint8 *dst = new uint8[fileSize];
+	if (!dst)
+		return false;
+
+	data.read(dst, fileSize);
+	_fileData = dst;
+
+	_glyphData[0] = _fileData;
+	_glyphData[1] = _glyphData[0] + 5730;
+	_glyphData[2] = _glyphData[1] + 2550;
+
+	return true;
+}
+
+int KoreanFontLoK::getCharWidth(uint16 c) const {
+	return (c >= 0x80) ? 16 : _font8->getCharWidth(c);
+}
+
+int KoreanFontLoK::getCharHeight(uint16 c) const {
+	return (_colorMap && _colorMap[3]) ? _height + 2 : _height;
+}
+
+void KoreanFontLoK::setColorMap(const uint8 *src) {
+	_colorMap = src;
+	_font8->setColorMap(src);
+}
+
+void KoreanFontLoK::drawChar(uint16 c, byte *dst, int pitch, int) const {
+	if (c < 0x80) {
+		_font8->drawChar(c, dst + (c == '\"' ? 0 : 5) * pitch, pitch, 0);
+		return;
+	}
+
+	const uint8 *glyph = createGlyph(c);
+	dst += (pitch + 1);
+
+	if (_colorMap[3]) {
+		renderGlyph(dst - 1, glyph, _colorMap[3], pitch);
+		renderGlyph(dst + 1, glyph, _colorMap[3], pitch);
+		renderGlyph(dst - pitch, glyph, _colorMap[3], pitch);
+		renderGlyph(dst + pitch, glyph, _colorMap[3], pitch);
+	}
+
+	renderGlyph(dst, glyph, _colorMap[1], pitch);
+};
+
+const uint8 *KoreanFontLoK::createGlyph(uint16 chr) const {
+	memset(_glyphTemp, 0, 30);
+
+	uint16 t[3];
+	memset(t, 0, sizeof(t));
+
+	chr = (chr << 8) | (chr >> 8);
+	uint8 i1 = chr & 0x1f;
+	uint8 i2 = (chr >> 5) & 0x1f;
+	uint8 i3 = (chr >> 10) & 0x1f;
+
+	uint16 r1 = _2byteTables[1][i2];
+	if ((int16)r1 > 0)
+		r1 += (_2byteTables[3][i3] + _2byteTables[6][i1] - 3);
+
+	uint16 r2 = _2byteTables[0][i3];
+	if ((int16)r2 > 0)
+		r2 += (_2byteTables[4][i2] + _2byteTables[6][i1]);
+
+	uint16 r3 = _2byteTables[2][i1];
+	if ((int16)r3 > 0)
+		r3 += (_2byteTables[5][i2] - 3);
+
+	t[0] = r2 >> 5;
+	t[1] = (r1 >> 5) - 2;
+	t[2] = (r3 >> 5) - 2;
+
+	static const uint8 lim[3] = { 0xBF, 0x55, 0x6D };
+
+	for (int l = 0; l < 3; ++l) {
+		if (t[l] <= lim[l]) {
+			const uint8 *src = &_glyphData[l][t[l] * 30];
+			for (int i = 0; i < 30; ++i)
+				_glyphTemp[i] |= *src++;
+		}
+	}
+
+	return _glyphTemp;
+}
+
+void KoreanFontLoK::renderGlyph(byte *dst, const uint8 *glyph, uint8 col, int pitch) const {
+	const uint8 *src = glyph;
+	pitch -= 15;
+
+	for (int y = 0; y < 15; ++y) {
+		uint8 m = 0;
+		uint8 in = 0;
+		for (int x = 0; x < 15; ++x) {
+			if (m == 0) {
+				in = *src++;
+				m = 0x80;
+			}
+			if (in & m)
+				*dst = col;
+			dst++;
+			m >>= 1;
+		}
+		dst += pitch;
+	}
+}
+
 } // End of namespace Kyra
diff --git a/engines/kyra/gui/gui_lok.cpp b/engines/kyra/gui/gui_lok.cpp
index abe5eea8897..c39edc15d7a 100644
--- a/engines/kyra/gui/gui_lok.cpp
+++ b/engines/kyra/gui/gui_lok.cpp
@@ -757,7 +757,7 @@ int GUI_LoK::saveGame(Button *button) {
 	_displaySubMenu = true;
 	_cancelSubMenu = false;
 
-	Screen::FontId cf = _screen->setFont(_vm->gameFlags().lang == Common::ZH_TWN ? Screen::FID_CHINESE_FNT : Screen::FID_8_FNT);
+	Screen::FontId cf = _screen->setFont(_vm->gameFlags().lang == Common::ZH_TWN ? Screen::FID_CHINESE_FNT : (_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT));
 
 	if (_savegameOffset == 0 && _vm->_gameToLoad == 0) {
 		_savegameName[0] = 0;
@@ -775,7 +775,7 @@ int GUI_LoK::saveGame(Button *button) {
 
 	while (_displaySubMenu && !_vm->shouldQuit()) {
 		checkTextfieldInput();
-		cf = _screen->setFont(_vm->gameFlags().lang == Common::ZH_TWN ? Screen::FID_CHINESE_FNT : Screen::FID_8_FNT);
+		cf = _screen->setFont(_vm->gameFlags().lang == Common::ZH_TWN ? Screen::FID_CHINESE_FNT : (_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT));
 		updateSavegameString();
 		_screen->setFont(cf);
 		processHighlights(_menu[3]);
diff --git a/engines/kyra/gui/gui_v1.cpp b/engines/kyra/gui/gui_v1.cpp
index cb581f2380c..991a91d18fe 100644
--- a/engines/kyra/gui/gui_v1.cpp
+++ b/engines/kyra/gui/gui_v1.cpp
@@ -31,6 +31,7 @@ namespace Kyra {
 
 GUI_v1::GUI_v1(KyraEngine_v1 *kyra) : GUI(kyra), _text(kyra->text()) {
 	_menuButtonList = nullptr;
+	_menuLabelYOffset = (kyra->game() == GI_LOL) ? 3 : 2;
 
 	_redrawButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawButtonCallback);
 	_redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawShadedButtonCallback);
@@ -128,9 +129,8 @@ void GUI_v1::initMenu(Menu &menu) {
 			else
 				textX = getMenuCenterStringX(getMenuItemTitle(menu.item[i]), x1, x2);
 
-			textY = y1 + 2;
+			textY = y1 + _menuLabelYOffset;
 			if (_vm->game() == GI_LOL) {
-				textY++;
 				if (i == menu.highlightedItem)
 					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 8);
 				else
@@ -138,7 +138,7 @@ void GUI_v1::initMenu(Menu &menu) {
 			} else {
 				Screen::FontId of = _screen->_currentFont;
 				if (menu.item[i].saveSlot > 0)
-					_screen->setFont((_vm->gameFlags().lang == Common::ZH_CHN || _vm->gameFlags().lang == Common::ZH_TWN) ? Screen::FID_CHINESE_FNT : Screen::FID_8_FNT);
+					_screen->setFont((_vm->gameFlags().lang == Common::ZH_CHN || _vm->gameFlags().lang == Common::ZH_TWN) ? Screen::FID_CHINESE_FNT : (_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT));
 
 				if (_vm->gameFlags().platform != Common::kPlatformAmiga)
 					printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
@@ -251,14 +251,13 @@ void GUI_v1::redrawText(const Menu &menu) {
 	else
 		textX = getMenuCenterStringX(getMenuItemTitle(menu.item[i]), x1, x2);
 
-	int textY = y1 + 2;
+	int textY = y1 + _menuLabelYOffset;
 	if (_vm->game() == GI_LOL) {
-		textY++;
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8);
 	} else {
 		Screen::FontId of = _screen->_currentFont;
 		if (menu.item[i].saveSlot > 0)
-			_screen->setFont((_vm->gameFlags().lang == Common::ZH_CHN || _vm->gameFlags().lang == Common::ZH_TWN) ? Screen::FID_CHINESE_FNT : Screen::FID_8_FNT);
+			_screen->setFont((_vm->gameFlags().lang == Common::ZH_CHN || _vm->gameFlags().lang == Common::ZH_TWN) ? Screen::FID_CHINESE_FNT : (_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT));
 		if (_vm->gameFlags().platform != Common::kPlatformAmiga)
 			printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0);
@@ -280,15 +279,14 @@ void GUI_v1::redrawHighlight(const Menu &menu) {
 	else
 		textX = getMenuCenterStringX(getMenuItemTitle(menu.item[i]), x1, x2);
 
-	int textY = y1 + 2;
+	int textY = y1 + _menuLabelYOffset;
 
 	if (_vm->game() == GI_LOL) {
-		textY++;
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 8);
 	} else {
 		Screen::FontId of = _screen->_currentFont;
 		if (menu.item[i].saveSlot > 0)
-			_screen->setFont((_vm->gameFlags().lang == Common::ZH_CHN || _vm->gameFlags().lang == Common::ZH_TWN) ? Screen::FID_CHINESE_FNT : Screen::FID_8_FNT);
+			_screen->setFont((_vm->gameFlags().lang == Common::ZH_CHN || _vm->gameFlags().lang == Common::ZH_TWN) ? Screen::FID_CHINESE_FNT : (_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT));
 		if (_vm->gameFlags().platform != Common::kPlatformAmiga)
 			printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0);
diff --git a/engines/kyra/gui/gui_v1.h b/engines/kyra/gui/gui_v1.h
index f9b7da8e681..3005eeb3c85 100644
--- a/engines/kyra/gui/gui_v1.h
+++ b/engines/kyra/gui/gui_v1.h
@@ -139,6 +139,8 @@ protected:
 
 	uint32 _lastScreenUpdate;
 	void checkTextfieldInput();
+
+	int _menuLabelYOffset;
 };
 
 class Movie;
diff --git a/engines/kyra/resource/staticres.cpp b/engines/kyra/resource/staticres.cpp
index 7834d3a3ff1..a73377383ce 100644
--- a/engines/kyra/resource/staticres.cpp
+++ b/engines/kyra/resource/staticres.cpp
@@ -1156,16 +1156,29 @@ void GUI_LoK::initStaticResource() {
 	Button::Callback loadGameMenuFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::loadGameMenu);
 	Button::Callback cancelSubMenuFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::cancelSubMenu);
 
-	int menuItemYStart = _vm->gameFlags().lang == Common::ZH_TWN ? 27 : 30;
-	int menuItemYInc = _vm->gameFlags().lang == Common::ZH_TWN ? 20 : 17;
-	int menuItemHeight = _vm->gameFlags().lang == Common::ZH_TWN ? 19 : 15;
+	int menuItemYStart = 30;
+	int menuItemYEnd = 110;
+	int menuItemYInc = 17;
+	int menuItemHeight = 15;
+	int menuHeight = 139;
+
+	if (_vm->gameFlags().lang == Common::ZH_TWN) {
+		menuItemYStart = 27;
+		menuItemYInc = 20;
+		menuItemHeight = 19;
+	} else if (_vm->gameFlags().lang == Common::KO_KOR) {
+		menuItemYInc = 23;
+		menuItemHeight = 21;
+		menuHeight = 160;
+		menuItemYEnd = menuItemYStart + menuItemYInc * 4;
+	}
 
-	GUI_V1_MENU(_menu[0], -1, -1, 0x100, 0x8B, 248, 249, 250, 0, 251, -1, 8, 0, 5, -1, -1, -1, -1);
+	GUI_V1_MENU(_menu[0], -1, -1, 0x100, menuHeight, 248, 249, 250, 0, 251, -1, 8, 0, 5, -1, -1, -1, -1);
 	GUI_V1_MENU_ITEM(_menu[0].item[0], 1, 0, 0, 0, -1, -1, menuItemYStart, 0xDC, menuItemHeight, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	GUI_V1_MENU_ITEM(_menu[0].item[1], 1, 0, 0, 0, -1, -1, menuItemYStart + menuItemYInc, 0xDC, menuItemHeight, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	GUI_V1_MENU_ITEM(_menu[0].item[2], 1, 0, 0, 0, -1, -1, menuItemYStart + menuItemYInc * 2, 0xDC, menuItemHeight, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	GUI_V1_MENU_ITEM(_menu[0].item[3], 1, 0, 0, 0, -1, -1, menuItemYStart + menuItemYInc * 3, 0xDC, menuItemHeight, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
-	GUI_V1_MENU_ITEM(_menu[0].item[4], 1, 0, 0, 0, -1,  0, 0x6E, 0xDC, menuItemHeight, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
+	GUI_V1_MENU_ITEM(_menu[0].item[4], 1, 0, 0, 0, -1,  0, menuItemYEnd, 0xDC, menuItemHeight, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	_menu[0].item[0].callback = loadGameMenuFunctor;
 	_menu[0].item[1].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::saveGameMenu);
 	_menu[0].item[2].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::gameControlsMenu);
@@ -1178,8 +1191,16 @@ void GUI_LoK::initStaticResource() {
 	_menu[1].item[0].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::quitConfirmYes);
 	_menu[1].item[1].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::quitConfirmNo);
 
-	menuItemYStart = _vm->gameFlags().lang == Common::ZH_TWN ? 40 : 39;
-	int labelYStart = _vm->gameFlags().lang == Common::ZH_TWN ? 5 : 8;
+	menuItemYStart = 39;
+	int labelYStart = 8;
+
+	if (_vm->gameFlags().lang == Common::ZH_TWN) {
+		menuItemYStart = 40;
+		labelYStart = 5;
+	} else if (_vm->gameFlags().lang == Common::KO_KOR) {
+		menuItemYStart = 40;
+		labelYStart = 5;
+	}
 
 	GUI_V1_MENU(_menu[2], -1, -1, 0x120, 0xA0, 248, 249, 250, 0, 251, -1, labelYStart, 0, 6, 132, 22, 132, 124);
 	GUI_V1_MENU_ITEM(_menu[2].item[0], 1, 0, 0, 0, -1, 255, menuItemYStart, 0x100, menuItemHeight, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
@@ -1190,11 +1211,19 @@ void GUI_LoK::initStaticResource() {
 	GUI_V1_MENU_ITEM(_menu[2].item[5], 1, 0, 0, 0, 0xB8, 0, 0x86, 0x58, menuItemHeight, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	_menu[2].item[5].callback = cancelSubMenuFunctor;
 
-	if (_vm->gameFlags().lang == Common::ZH_TWN)
+	if (_vm->gameFlags().lang == Common::ZH_TWN || _vm->gameFlags().lang == Common::KO_KOR)
 		_menu[2].item[4].enabled = false;
 
-	int menuHeight = _vm->gameFlags().lang == Common::ZH_TWN ? 80 : 67;
-	labelYStart = _vm->gameFlags().lang == Common::ZH_TWN ? 50 : 44;
+	menuHeight = 67;
+	labelYStart = 44;
+
+	if (_vm->gameFlags().lang == Common::ZH_TWN) {
+		menuHeight = 80;
+		labelYStart = 50;
+	} else if (_vm->gameFlags().lang == Common::KO_KOR) {
+		menuHeight = 80;
+		labelYStart = 50;
+	}
 
 	GUI_V1_MENU(_menu[3], -1, -1, 288, menuHeight, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1);
 	GUI_V1_MENU_ITEM(_menu[3].item[0], 1, 0, 0, 0, 22, 0, labelYStart, 88, menuItemHeight, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
@@ -1202,7 +1231,11 @@ void GUI_LoK::initStaticResource() {
 	_menu[3].item[0].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::savegameConfirm);
 	_menu[3].item[1].callback = cancelSubMenuFunctor;
 
-	menuItemYInc = _vm->gameFlags().lang == Common::ZH_TWN ? 21 : 17;
+	menuItemYInc = 17;
+	if (_vm->gameFlags().lang == Common::ZH_TWN)
+		menuItemYInc = 21;
+	else if (_vm->gameFlags().lang == Common::KO_KOR)
+		menuItemYInc = 21;
 
 	GUI_V1_MENU(_menu[4], -1, -1, 0xD0, 0x4C, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1);
 	GUI_V1_MENU_ITEM(_menu[4].item[0], 1, 0, 0, 0, -1, -1, 0x1E, 0xB4, menuItemHeight, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
@@ -1210,9 +1243,19 @@ void GUI_LoK::initStaticResource() {
 	_menu[4].item[0].callback = loadGameMenuFunctor;
 	_menu[4].item[1].callback = quitPlayingFunctor;
 
-	menuItemYStart = _vm->gameFlags().lang == Common::ZH_TWN ? 27 : 30;
-	menuItemYInc = _vm->gameFlags().lang == Common::ZH_TWN ? 20 : 17;
-	labelYStart = _vm->gameFlags().lang == Common::ZH_TWN ? 29 : 32;
+	menuItemYStart = 30;
+	menuItemYInc = 17;
+	labelYStart = 32;
+
+	if (_vm->gameFlags().lang == Common::ZH_TWN) {
+		menuItemYStart = 27;
+		menuItemYInc = 20;
+		labelYStart = 29;
+	} else if (_vm->gameFlags().lang == Common::KO_KOR) {
+		menuItemYStart = 27;
+		menuItemYInc = 20;
+		labelYStart = 29;
+	}
 
 	GUI_V1_MENU(_menu[5], -1, -1, 0x130, 0x99, 248, 249, 250, 0, 251, -1, 8, 0, 6, -1, -1, -1, -1);
 	GUI_V1_MENU_ITEM(_menu[5].item[0], 1, 0, 0, 0, 0xA5, 0, menuItemYStart, 0x80, menuItemHeight, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0x10, labelYStart, 0, 0);
diff --git a/engines/kyra/sequence/seqplayer_lok.cpp b/engines/kyra/sequence/seqplayer_lok.cpp
index 62baca11579..c6d1ec7d45d 100644
--- a/engines/kyra/sequence/seqplayer_lok.cpp
+++ b/engines/kyra/sequence/seqplayer_lok.cpp
@@ -642,7 +642,7 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
 					charIdx++;
 				}
 				charStr[1] = charStr[2] = '\0';
-				if (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().lang == Common::ZH_TWN) {
+				if (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().lang == Common::ZH_TWN || (_vm->gameFlags().lang == Common::KO_KOR && (charStr[0] & 0x80))) {
 					charStr[1] = _vm->seqTextsTable()[_seqDisplayedText][++_seqDisplayedChar];
 					_screen->printText(charStr, _seqDisplayedTextX, 180, 0xF, 0xC);
 					_seqDisplayedTextX += _screen->getTextWidth(charStr);
diff --git a/engines/kyra/text/text.cpp b/engines/kyra/text/text.cpp
index 58c72bdbf6d..2d086744f66 100644
--- a/engines/kyra/text/text.cpp
+++ b/engines/kyra/text/text.cpp
@@ -59,7 +59,7 @@ int TextDisplayer::getCharLength(const char *str, int len) {
 		while (i <= len && *str) {
 			uint c = *str++;
 			c &= 0xFF;
-			if (c >= 0x7F && _vm->gameFlags().lang == Common::JA_JPN) {
+			if (c >= 0x7F && (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().lang == Common::KO_KOR)) {
 				c = READ_LE_UINT16(str - 1);
 				++str;
 			}
@@ -103,12 +103,16 @@ char *TextDisplayer::preprocessString(const char *str) {
 	}
 	p = _talkBuffer;
 
-	Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT);
+	static const uint16 limDef[2] = { 176, 352 };
+	static const uint16 limKor[2] = { 240, 480 };
+	const uint16 *lim = (_vm->gameFlags().lang == Common::KO_KOR) ? limKor : limDef;
+
+	Screen::FontId curFont = _screen->setFont(_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT);
 	_screen->_charSpacing = -2;
 	int textWidth = _screen->getTextWidth(p);
 	_screen->_charSpacing = 0;
-	if (textWidth > 176) {
-		if (textWidth > 352) {
+	if (textWidth > lim[0]) {
+		if (textWidth > lim[1]) {
 			int count = getCharLength(p, textWidth / 3);
 			int offs = dropCRIntoString(p, count);
 			p += count + offs;


Commit: b874bfb016b3b87ca7417093cd722269419cd1fd
    https://github.com/scummvm/scummvm/commit/b874bfb016b3b87ca7417093cd722269419cd1fd
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: (LoL/KOR) - fix script handling

Changed paths:
    engines/kyra/script/script.cpp


diff --git a/engines/kyra/script/script.cpp b/engines/kyra/script/script.cpp
index 5ab05dcf24a..53e86394e74 100644
--- a/engines/kyra/script/script.cpp
+++ b/engines/kyra/script/script.cpp
@@ -165,7 +165,7 @@ bool EMCInterpreter::start(EMCState *script, int function) {
 		return false;
 
 	if (_vm->game() == GI_KYRA1) {
-		if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98)
+		if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98 || _vm->gameFlags().lang == Common::KO_KOR)
 			script->ip = &script->dataPtr->data[functionOffset+1];
 		else
 			script->ip = &script->dataPtr->data[functionOffset];


Commit: 245cb1775f2d2012121f707e8a40b7e85b727851
    https://github.com/scummvm/scummvm/commit/245cb1775f2d2012121f707e8a40b7e85b727851
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: (LoK/KOR) - fix end credits

Changed paths:
    devtools/create_kyradat/resources.cpp
    devtools/create_kyradat/resources/lok_dos_korean.h
    engines/kyra/sequence/sequences_lok.cpp


diff --git a/devtools/create_kyradat/resources.cpp b/devtools/create_kyradat/resources.cpp
index dfb2fd09dda..c18bf2f3bdc 100644
--- a/devtools/create_kyradat/resources.cpp
+++ b/devtools/create_kyradat/resources.cpp
@@ -462,7 +462,7 @@ static const ResourceProvider resourceProviders[] = {
 	{ k1NewGameString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1NewGameStringDOSKoreanProvider },
 	{ k1ConfigStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1ConfigStringsDOSKoreanProvider },
 	{ k1TwoByteFontLookupTable, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1TwoByteFontLookupTableDOSKoreanProvider },
-	{ k1CreditsStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1k1CreditsStringsDummyDOSProvider },
+	{ k1CreditsStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1k1CreditsStringsDOSKoreanProvider },
 	{ k1IntroStrings, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1IntroStringsDOSChineseTradProvider },
 	{ k1ItemNames, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1ItemNamesDOSChineseTradProvider },
 	{ k1TakenStrings, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1TakenStringsDOSChineseTradProvider },
diff --git a/devtools/create_kyradat/resources/lok_dos_korean.h b/devtools/create_kyradat/resources/lok_dos_korean.h
index db2403389fe..58b28d8db53 100644
--- a/devtools/create_kyradat/resources/lok_dos_korean.h
+++ b/devtools/create_kyradat/resources/lok_dos_korean.h
@@ -365,3 +365,167 @@ static const uint16 k1TwoByteFontLookupTableDOSKorean[] = {
 };
 
 static const Uint16Provider k1TwoByteFontLookupTableDOSKoreanProvider = { ARRAYSIZE(k1TwoByteFontLookupTableDOSKorean), k1TwoByteFontLookupTableDOSKorean };
+
+static const uint8 k1CreditsStringsDOSKorean[] = {
+	0x0d, 0x02, 0x88, 0x71, 0xac, 0x61, 0xd0, 0x73,
+	0x93, 0xa1, 0x94, 0x61, 0x0d, 0x0d, 0x0d, 0x0d,
+	0x95, 0xb7, 0xac, 0xe1, 0x89, 0x41, 0xb7, 0xb1,
+	0xc0, 0x81, 0x90, 0xe9, 0x0d, 0x0d, 0x0d, 0x0d,
+	0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+	0x0d, 0x02, 0x46, 0x61, 0x62, 0x6c, 0x65, 0x73,
+	0x20, 0x26, 0x20, 0x46, 0x69, 0x65, 0x6e, 0x64,
+	0x73, 0x0d, 0x02, 0x42, 0x6f, 0x6f, 0x6b, 0x20,
+	0x49, 0x0d, 0x02, 0x54, 0x48, 0x45, 0x20, 0x4c,
+	0x45, 0x47, 0x45, 0x4e, 0x44, 0x20, 0x4f, 0x46,
+	0x20, 0x4b, 0x59, 0x52, 0x41, 0x4e, 0x44, 0x49,
+	0x41, 0x0d, 0x0d, 0x50, 0x75, 0x62, 0x6c, 0x69,
+	0x73, 0x68, 0x65, 0x64, 0x20, 0x62, 0x79, 0x0d,
+	0x02, 0x57, 0x65, 0x73, 0x74, 0x77, 0x6f, 0x6f,
+	0x64, 0x20, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f,
+	0x73, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+	0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x03,
+	0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72,
+	0x3a, 0x05, 0x04, 0x42, 0x72, 0x65, 0x74, 0x74,
+	0x20, 0x57, 0x2e, 0x20, 0x53, 0x70, 0x65, 0x72,
+	0x72, 0x79, 0x0d, 0x0d, 0x03, 0x44, 0x65, 0x73,
+	0x69, 0x67, 0x6e, 0x3a, 0x05, 0x04, 0x4d, 0x69,
+	0x63, 0x68, 0x61, 0x65, 0x6c, 0x20, 0x4c, 0x65,
+	0x67, 0x67, 0x0d, 0x04, 0x52, 0x69, 0x63, 0x6b,
+	0x20, 0x50, 0x61, 0x72, 0x6b, 0x73, 0x0d, 0x04,
+	0x50, 0x61, 0x75, 0x6c, 0x20, 0x53, 0x2e, 0x20,
+	0x4d, 0x75, 0x64, 0x72, 0x61, 0x0d, 0x0d, 0x03,
+	0x4c, 0x65, 0x61, 0x64, 0x20, 0x50, 0x72, 0x6f,
+	0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x3a,
+	0x05, 0x04, 0x4d, 0x69, 0x63, 0x68, 0x61, 0x65,
+	0x6c, 0x20, 0x4c, 0x65, 0x67, 0x67, 0x0d, 0x0d,
+	0x03, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20,
+	0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d,
+	0x65, 0x72, 0x3a, 0x05, 0x04, 0x53, 0x63, 0x6f,
+	0x74, 0x74, 0x20, 0x42, 0x6f, 0x77, 0x65, 0x6e,
+	0x0d, 0x0d, 0x03, 0x41, 0x6d, 0x69, 0x67, 0x61,
+	0x20, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d,
+	0x6d, 0x65, 0x72, 0x3a, 0x05, 0x04, 0x42, 0x69,
+	0x6c, 0x6c, 0x20, 0x53, 0x74, 0x6f, 0x6b, 0x65,
+	0x73, 0x0d, 0x0d, 0x03, 0x49, 0x6e, 0x74, 0x72,
+	0x6f, 0x20, 0x26, 0x20, 0x46, 0x69, 0x6e, 0x61,
+	0x6c, 0x65, 0x3a, 0x05, 0x04, 0x43, 0x68, 0x72,
+	0x69, 0x73, 0x74, 0x6f, 0x70, 0x68, 0x65, 0x72,
+	0x20, 0x59, 0x61, 0x74, 0x65, 0x73, 0x0d, 0x0d,
+	0x03, 0x41, 0x72, 0x74, 0x20, 0x26, 0x20, 0x47,
+	0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x3a,
+	0x05, 0x04, 0x52, 0x69, 0x63, 0x6b, 0x20, 0x50,
+	0x61, 0x72, 0x6b, 0x73, 0x0d, 0x04, 0x52, 0x65,
+	0x6e, 0x20, 0x4f, 0x6c, 0x73, 0x65, 0x6e, 0x0d,
+	0x04, 0x4c, 0x6f, 0x75, 0x69, 0x73, 0x65, 0x20,
+	0x53, 0x61, 0x6e, 0x64, 0x6f, 0x76, 0x61, 0x6c,
+	0x0d, 0x04, 0x4a, 0x6f, 0x73, 0x65, 0x70, 0x68,
+	0x20, 0x48, 0x65, 0x77, 0x69, 0x74, 0x74, 0x20,
+	0x49, 0x56, 0x0d, 0x04, 0x4a, 0x75, 0x64, 0x69,
+	0x74, 0x68, 0x20, 0x50, 0x65, 0x74, 0x65, 0x72,
+	0x73, 0x6f, 0x6e, 0x0d, 0x04, 0x41, 0x61, 0x72,
+	0x6f, 0x6e, 0x20, 0x50, 0x6f, 0x77, 0x65, 0x6c,
+	0x6c, 0x0d, 0x04, 0x45, 0x6c, 0x69, 0x65, 0x20,
+	0x41, 0x72, 0x61, 0x62, 0x69, 0x61, 0x6e, 0x0d,
+	0x04, 0x45, 0x72, 0x69, 0x63, 0x20, 0x53, 0x68,
+	0x75, 0x6c, 0x74, 0x73, 0x0d, 0x0d, 0x03, 0x41,
+	0x75, 0x64, 0x69, 0x6f, 0x20, 0x44, 0x69, 0x72,
+	0x65, 0x63, 0x74, 0x6f, 0x72, 0x3a, 0x05, 0x04,
+	0x50, 0x61, 0x75, 0x6c, 0x20, 0x53, 0x2e, 0x20,
+	0x4d, 0x75, 0x64, 0x72, 0x61, 0x0d, 0x0d, 0x03,
+	0x4d, 0x75, 0x73, 0x69, 0x63, 0x3a, 0x05, 0x04,
+	0x46, 0x72, 0x61, 0x6e, 0x6b, 0x20, 0x4b, 0x6c,
+	0x65, 0x70, 0x61, 0x63, 0x6b, 0x69, 0x0d, 0x0d,
+	0x03, 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x45,
+	0x66, 0x66, 0x65, 0x63, 0x74, 0x73, 0x3a, 0x05,
+	0x04, 0x44, 0x77, 0x69, 0x67, 0x68, 0x74, 0x20,
+	0x4f, 0x6b, 0x61, 0x68, 0x61, 0x72, 0x61, 0x0d,
+	0x0d, 0x03, 0x57, 0x72, 0x69, 0x74, 0x65, 0x72,
+	0x3a, 0x05, 0x04, 0x22, 0x43, 0x6f, 0x63, 0x6f,
+	0x22, 0x0d, 0x0d, 0x03, 0x51, 0x75, 0x61, 0x6c,
+	0x69, 0x74, 0x79, 0x20, 0x41, 0x73, 0x73, 0x75,
+	0x72, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x05, 0x04,
+	0x47, 0x6c, 0x65, 0x6e, 0x6e, 0x20, 0x53, 0x70,
+	0x65, 0x72, 0x72, 0x79, 0x0d, 0x04, 0x4d, 0x61,
+	0x74, 0x74, 0x20, 0x43, 0x6f, 0x6c, 0x6c, 0x69,
+	0x6e, 0x73, 0x0d, 0x04, 0x42, 0x69, 0x6c, 0x6c,
+	0x20, 0x46, 0x6f, 0x73, 0x74, 0x65, 0x72, 0x0d,
+	0x04, 0x4d, 0x69, 0x63, 0x68, 0x61, 0x65, 0x6c,
+	0x20, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x65,
+	0x72, 0x0d, 0x04, 0x4d, 0x69, 0x63, 0x68, 0x61,
+	0x65, 0x6c, 0x20, 0x47, 0x61, 0x74, 0x65, 0x72,
+	0x0d, 0x04, 0x45, 0x75, 0x67, 0x65, 0x6e, 0x65,
+	0x20, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x0d,
+	0x04, 0x4d, 0x69, 0x63, 0x68, 0x61, 0x65, 0x6c,
+	0x20, 0x47, 0x6c, 0x6f, 0x73, 0x65, 0x63, 0x6b,
+	0x69, 0x0d, 0x04, 0x4a, 0x75, 0x73, 0x74, 0x69,
+	0x6e, 0x20, 0x4e, 0x6f, 0x72, 0x72, 0x0d, 0x04,
+	0x54, 0x6f, 0x70, 0x20, 0x53, 0x74, 0x61, 0x72,
+	0x20, 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67,
+	0x0d, 0x04, 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e,
+	0x67, 0x20, 0x31, 0x2c, 0x32, 0x2c, 0x33, 0x0d,
+	0x0d, 0x0d, 0x0d, 0x0d, 0x53, 0x70, 0x65, 0x63,
+	0x69, 0x61, 0x6c, 0x20, 0x54, 0x68, 0x61, 0x6e,
+	0x6b, 0x73, 0x20, 0x74, 0x6f, 0x0d, 0x4c, 0x79,
+	0x6c, 0x65, 0x20, 0x4a, 0x2e, 0x20, 0x48, 0x61,
+	0x6c, 0x6c, 0x0d, 0x44, 0x61, 0x76, 0x69, 0x64,
+	0x20, 0x42, 0x69, 0x73, 0x68, 0x6f, 0x70, 0x0d,
+	0x22, 0x54, 0x68, 0x65, 0x20, 0x44, 0x6f, 0x63,
+	0x22, 0x0d, 0x61, 0x6e, 0x64, 0x0d, 0x46, 0x69,
+	0x72, 0x65, 0x62, 0x65, 0x72, 0x72, 0x79, 0x20,
+	0x47, 0x72, 0x65, 0x65, 0x6e, 0x0d, 0x0d, 0x0d,
+	0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+	0x0d, 0x0d, 0x0d, 0x02, 0x43, 0x41, 0x53, 0x54,
+	0x20, 0x4f, 0x46, 0x20, 0x43, 0x48, 0x41, 0x52,
+	0x41, 0x43, 0x54, 0x45, 0x52, 0x53, 0x0d, 0x0d,
+	0x4d, 0x61, 0x6c, 0x63, 0x6f, 0x6c, 0x6d, 0x20,
+	0x74, 0x68, 0x65, 0x20, 0x4a, 0x65, 0x73, 0x74,
+	0x65, 0x72, 0x0d, 0x42, 0x72, 0x61, 0x6e, 0x64,
+	0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x42,
+	0x6f, 0x6c, 0x64, 0x0d, 0x42, 0x72, 0x61, 0x6e,
+	0x64, 0x79, 0x77, 0x69, 0x6e, 0x65, 0x20, 0x61,
+	0x6e, 0x64, 0x20, 0x44, 0x61, 0x72, 0x6d, 0x0d,
+	0x50, 0x72, 0x69, 0x65, 0x73, 0x74, 0x65, 0x73,
+	0x73, 0x20, 0x42, 0x72, 0x79, 0x6e, 0x6e, 0x0d,
+	0x5a, 0x61, 0x6e, 0x74, 0x68, 0x69, 0x61, 0x2c,
+	0x20, 0x4c, 0x61, 0x64, 0x79, 0x20, 0x6f, 0x66,
+	0x20, 0x41, 0x6c, 0x63, 0x68, 0x65, 0x6d, 0x79,
+	0x0d, 0x48, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x20,
+	0x74, 0x68, 0x65, 0x20, 0x48, 0x61, 0x6e, 0x64,
+	0x79, 0x6d, 0x61, 0x6e, 0x0d, 0x0d, 0x0d, 0x0d,
+	0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x01,
+	0x41, 0x6e, 0x79, 0x20, 0x63, 0x68, 0x61, 0x72,
+	0x61, 0x63, 0x74, 0x65, 0x72, 0x73, 0x20, 0x69,
+	0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x67,
+	0x61, 0x6d, 0x65, 0x20, 0x77, 0x68, 0x6f, 0x20,
+	0x62, 0x65, 0x61, 0x72, 0x0d, 0x01, 0x72, 0x65,
+	0x73, 0x65, 0x6d, 0x62, 0x6c, 0x61, 0x6e, 0x63,
+	0x65, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x65, 0x72,
+	0x73, 0x6f, 0x6e, 0x73, 0x20, 0x6c, 0x69, 0x76,
+	0x69, 0x6e, 0x67, 0x20, 0x6f, 0x72, 0x0d, 0x01,
+	0x64, 0x65, 0x61, 0x64, 0x20, 0x61, 0x72, 0x65,
+	0x20, 0x70, 0x75, 0x72, 0x65, 0x6c, 0x79, 0x20,
+	0x63, 0x6f, 0x69, 0x6e, 0x63, 0x69, 0x64, 0x65,
+	0x6e, 0x74, 0x61, 0x6c, 0x2e, 0x0d, 0x0d, 0x0d,
+	0x01, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67,
+	0x68, 0x74, 0x20, 0x28, 0x43, 0x29, 0x20, 0x31,
+	0x39, 0x39, 0x32, 0x2c, 0x20, 0x31, 0x39, 0x39,
+	0x33, 0x20, 0x57, 0x65, 0x73, 0x74, 0x77, 0x6f,
+	0x6f, 0x64, 0x20, 0x53, 0x74, 0x75, 0x64, 0x69,
+	0x6f, 0x73, 0x2c, 0x20, 0x49, 0x6e, 0x63, 0x2e,
+	0x0d, 0x01, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69,
+	0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73,
+	0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0d, 0x0d,
+	0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+	0x01, 0x48, 0x61, 0x6e, 0x67, 0x6c, 0x65, 0x20,
+	0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74,
+	0x69, 0x6f, 0x6e, 0x20, 0x62, 0x79, 0x20, 0x50,
+	0x61, 0x6e, 0x74, 0x68, 0x65, 0x6f, 0x6e, 0x20,
+	0x4c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f,
+	0x72, 0x79, 0x0d, 0x01, 0x6f, 0x66, 0x20, 0x44,
+	0x6f, 0x6e, 0x67, 0x20, 0x53, 0x65, 0x6f, 0x20,
+	0x47, 0x61, 0x6d, 0x65, 0x20, 0x43, 0x68, 0x61,
+	0x6e, 0x6e, 0x65, 0x6c, 0x0d, 0x0d, 0x0d, 0x0d,
+	0x0d, 0x0d, 0x0d, 0x0d, 0x00
+};
+
+static const ByteProvider k1CreditsStringsDOSKoreanProvider = { ARRAYSIZE(k1CreditsStringsDOSKorean), k1CreditsStringsDOSKorean };
diff --git a/engines/kyra/sequence/sequences_lok.cpp b/engines/kyra/sequence/sequences_lok.cpp
index d188501089f..c523aa6956a 100644
--- a/engines/kyra/sequence/sequences_lok.cpp
+++ b/engines/kyra/sequence/sequences_lok.cpp
@@ -1224,7 +1224,8 @@ void KyraEngine_LoK::seq_playCredits() {
 	_screen->disableDualPaletteMode();
 	_screen->hideMouse();
 
-	Screen::FontId font1, font2;
+	Common::String creditsFile = "CREDITS.TXT";
+	Screen::FontId font1, font2, font3;
 	int alignX3 = 157;
 	int alignX4 = 161;
 	int alignXOffs = 0;
@@ -1232,7 +1233,7 @@ void KyraEngine_LoK::seq_playCredits() {
 	int fin = 175;
 
 	if (_flags.lang == Common::ZH_TWN) {
-		font1 = font2 = Screen::FID_CHINESE_FNT;
+		font1 = font2 = font3 = Screen::FID_CHINESE_FNT;
 		alignX3 = alignX4 = 150;
 		alignXOffs = 10;
 		lineHeight = 16;
@@ -1241,12 +1242,17 @@ void KyraEngine_LoK::seq_playCredits() {
 		_screen->loadFont(Screen::FID_CRED6_FNT, "CREDIT6.FNT");
 		_screen->loadFont(Screen::FID_CRED8_FNT, "CREDIT8.FNT");
 		font1 = Screen::FID_CRED6_FNT;
-		font2 = Screen::FID_CRED8_FNT;
+		font2 = font3 = Screen::FID_CRED8_FNT;
+		if (_flags.lang == Common::KO_KOR) {
+			if (_res->exists("CREDITS.HAN"))
+				creditsFile = "CREDITS.HAN";
+			font3 = Screen::FID_KOREAN_FNT;
+		}
 	} else {
-		font1 = font2 = Screen::FID_8_FNT;
+		font1 = font2 = font3 = Screen::FID_8_FNT;
 	}
 
-	_screen->setFont(font2);
+	_screen->setFont(font3);
 	_screen->loadBitmap("CHALET.CPS", 4, 4, &_screen->getPalette(0));
 
 	_screen->setCurPage(0);
@@ -1261,7 +1267,7 @@ void KyraEngine_LoK::seq_playCredits() {
 	uint8 *buffer = nullptr;
 	uint32 size = 0;
 
-	buffer = _res->fileData(Common::String::format("CREDITS.%s", _flags.lang == Common::KO_KOR ? "HAN" : "TXT").c_str(), &size);
+	buffer = _res->fileData(creditsFile.c_str(), &size);
 	if (!buffer) {
 		int sizeTmp = 0;
 		const uint8 *bufferTmp = _staticres->loadRawData(k1CreditsStrings, sizeTmp);
@@ -1292,6 +1298,7 @@ void KyraEngine_LoK::seq_playCredits() {
 		if (lineEndCode != 0)
 			nextString++;
 
+		int lhAdjust = 0;
 		int alignment = 0;
 		if (*currentString == 3 || *currentString == 4) {
 			alignment = *currentString;
@@ -1306,8 +1313,19 @@ void KyraEngine_LoK::seq_playCredits() {
 			_screen->setFont(font2);
 		}
 
-		line.font = _screen->_currentFont;
+		if (font2 != font3 && _screen->_currentFont != font1) {
+			// Hack for proper display of the data from the CREDITS.HAN file
+			// which the original does not even support...
+			if ((currentString[0] == '\"' && (currentString[1] & 0x80)) || (*currentString & 0x80)) {
+				lhAdjust = 5;
+				_screen->setFont(font3);
+			} else {
+				_screen->setFont(font2);
+			}
+		}
 
+		line.font = _screen->_currentFont;
+		
 		if (alignment == 3)
 			line.x = alignX3 - _screen->getTextWidth((const char *)currentString);
 		else if (alignment == 4)
@@ -1317,7 +1335,7 @@ void KyraEngine_LoK::seq_playCredits() {
 
 		line.y = currentY;
 		if (lineEndCode != 5)
-			currentY += lineHeight;
+			currentY += (lineHeight + lhAdjust);
 
 		line.str = currentString;
 


Commit: 6d83986bca986b23dfe4c4f5f35c4dc0a4ca155d
    https://github.com/scummvm/scummvm/commit/6d83986bca986b23dfe4c4f5f35c4dc0a4ca155d
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: (LoK/KOR) - more font related fixes

e. g.
- font spacing
- scene message field
- ingame menus
- Brynn's note

Changed paths:
    devtools/create_kyradat/resources.cpp
    devtools/create_kyradat/resources/lok_dos_korean.h
    engines/kyra/engine/kyra_lok.cpp
    engines/kyra/engine/kyra_lok.h
    engines/kyra/graphics/screen.cpp
    engines/kyra/graphics/screen.h
    engines/kyra/graphics/screen_lok.cpp
    engines/kyra/gui/gui_lok.cpp
    engines/kyra/script/script_lok.cpp
    engines/kyra/text/text_lok.cpp


diff --git a/devtools/create_kyradat/resources.cpp b/devtools/create_kyradat/resources.cpp
index c18bf2f3bdc..0a654f75944 100644
--- a/devtools/create_kyradat/resources.cpp
+++ b/devtools/create_kyradat/resources.cpp
@@ -462,7 +462,7 @@ static const ResourceProvider resourceProviders[] = {
 	{ k1NewGameString, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1NewGameStringDOSKoreanProvider },
 	{ k1ConfigStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1ConfigStringsDOSKoreanProvider },
 	{ k1TwoByteFontLookupTable, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1TwoByteFontLookupTableDOSKoreanProvider },
-	{ k1CreditsStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1k1CreditsStringsDOSKoreanProvider },
+	{ k1CreditsStrings, kKyra1, kPlatformDOS, kNoSpecial, KO_KOR, &k1CreditsStringsDOSKoreanProvider },
 	{ k1IntroStrings, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1IntroStringsDOSChineseTradProvider },
 	{ k1ItemNames, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1ItemNamesDOSChineseTradProvider },
 	{ k1TakenStrings, kKyra1, kPlatformDOS, kNoSpecial, ZH_TWN, &k1TakenStringsDOSChineseTradProvider },
diff --git a/devtools/create_kyradat/resources/lok_dos_korean.h b/devtools/create_kyradat/resources/lok_dos_korean.h
index 58b28d8db53..6210cd83b14 100644
--- a/devtools/create_kyradat/resources/lok_dos_korean.h
+++ b/devtools/create_kyradat/resources/lok_dos_korean.h
@@ -305,7 +305,7 @@ static const char *const k1GUIStringsDOSKorean[28] = {
 	"\x8fq",
 	"\xb5\x81",
 	"\xb4\x61\x93\xa1\xb5\xa1",
-	"R\xd1,\\\xd1,a\xd1,f\xd1,k\xd1,u\xd1,\xd1,\x84\xd1,\x89\xd1,\x88\xe8\x93\x65 \xad\xa2\x95\xa1 ",
+	"123456789012345678901234567890123456""\x88\xe8\x93\x65 \xad\xa2\x95\xa1 ",
 	"\xa2\x85\xb8w \xad\xa2\x95\xa1 ",
 	"\xb7q\xb4\x62",
 	"\xad\xa1\x9f\xa1"
diff --git a/engines/kyra/engine/kyra_lok.cpp b/engines/kyra/engine/kyra_lok.cpp
index 178cbf3ca56..b4ece94d587 100644
--- a/engines/kyra/engine/kyra_lok.cpp
+++ b/engines/kyra/engine/kyra_lok.cpp
@@ -96,18 +96,19 @@ KyraEngine_LoK::KyraEngine_LoK(OSystem *system, const GameFlags &flags)
 	_malcolmFrame = 0;
 	_malcolmTimer1 = _malcolmTimer2 = 0;
 	_defaultFont = Screen::FID_8_FNT;
+	_noteFont = Screen::FID_6_FNT;
 	_defaultLineSpacing = 0;
 
 	switch (_flags.lang) {
 	case Common::JA_JPN:
-		_defaultFont = Screen::FID_SJIS_FNT;
+		_defaultFont = _noteFont = Screen::FID_SJIS_FNT;
 		break;
 	case Common::ZH_TWN:
-		_defaultFont = Screen::FID_CHINESE_FNT;
+		_defaultFont = _noteFont = Screen::FID_CHINESE_FNT;
 		_defaultLineSpacing = 2;
 		break;
 	case Common::KO_KOR:
-		_defaultFont = Screen::FID_KOREAN_FNT;
+		_defaultFont = _noteFont = Screen::FID_KOREAN_FNT;
 		_defaultLineSpacing = 2;
 		break;
 	default:
@@ -325,7 +326,6 @@ Common::Error KyraEngine_LoK::go() {
 		_screen->setTextMarginRight(312);
 	} else if (_flags.lang == Common::KO_KOR) {
 		_screen->loadFont(Screen::FID_KOREAN_FNT, "MK15.BIT");
-		_screen->setTextMarginRight(312);
 	}
 
 	_screen->setFont(_defaultFont);
diff --git a/engines/kyra/engine/kyra_lok.h b/engines/kyra/engine/kyra_lok.h
index b5f63b5f81c..52b2139343f 100644
--- a/engines/kyra/engine/kyra_lok.h
+++ b/engines/kyra/engine/kyra_lok.h
@@ -480,6 +480,7 @@ protected:
 	uint8 _configTextspeed;
 
 	Screen::FontId _defaultFont;
+	Screen::FontId _noteFont;
 	int _defaultLineSpacing;
 
 	Animator_LoK *_animator;
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 8160f51cdb4..2200060a66b 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -1397,8 +1397,7 @@ bool Screen::loadFont(FontId fontId, const char *filename) {
 			}
 		} else if (fontId == FID_KOREAN_FNT) {
 			const uint16 *lookupTable = _vm->staticres()->loadRawDataBe16(k1TwoByteFontLookupTable, temp);
-			// The FID_8_FNT must be loaded before this.
-			fnt = new KoreanFontLoK(_fonts[FID_8_FNT], lookupTable, temp);
+			fnt = new HangulFontLoK(_fonts[FID_8_FNT], lookupTable, temp);
 		} else {
 			fnt = new DOSFont();
 		}
@@ -1433,8 +1432,10 @@ int Screen::getFontWidth() const {
 }
 
 int Screen::getCharWidth(uint16 c) const {
-	const int width = _fonts[_currentFont]->getCharWidth(c);
-	return width + (_isSegaCD || _fonts[_currentFont]->getType() == Font::kASCII ? _charSpacing : 0);
+	int width = _fonts[_currentFont]->getCharWidth(c);
+	if (_isSegaCD || _fonts[_currentFont]->getType() == Font::kASCII || (_fonts[_currentFont]->getType() == Font::kHANGUL && c < 0x80))
+		width += _charSpacing;
+	return width;
 }
 
 int Screen::getCharHeight(uint16 c) const {
@@ -1548,8 +1549,11 @@ uint16 Screen::fetchChar(const char *&s) const {
 	uint16 ch = (uint8)*s++;
 
 	if ((_fonts[_currentFont]->getType() == Font::kSJIS && (ch <= 0x7F || (ch >= 0xA1 && ch <= 0xDF))) ||
-		(_fonts[_currentFont]->getType() == Font::kBIG5 && ch < 0x7F) || (_fonts[_currentFont]->getType() == Font::kKOR && ch < 0x80))
+		(_fonts[_currentFont]->getType() == Font::kBIG5 && ch < 0x7F) || (_fonts[_currentFont]->getType() == Font::kHANGUL && ch < 0x80)) {
+			//if (_fonts[_currentFont]->getType() == Font::kHANGUL && ch == ' ' && *s == ' ')
+			//	++s;
 			return ch;
+	}
 
 	ch |= (uint8)(*s++) << 8;
 	return ch;
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index 3a2373177f8..1f8101b80d4 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -68,7 +68,7 @@ public:
 		kASCII = 0,
 		kSJIS,
 		kBIG5,
-		kKOR
+		kHANGUL
 	};
 
 public:
@@ -290,13 +290,13 @@ private:
 	const uint16 _pitch;
 };
 
-class KoreanFontLoK final : public Font {
+class HangulFontLoK final : public Font {
 public:
-	KoreanFontLoK(Font *font8fnt, const uint16 *lookupTable, uint32 lookupTableSize);
-	~KoreanFontLoK() override;
+	HangulFontLoK(Font *&font8fat, const uint16 *lookupTable, uint32 lookupTableSize);
+	~HangulFontLoK() override;
 
 	bool load(Common::SeekableReadStream &data) override;
-	Type getType() const override { return kKOR; }
+	Type getType() const override { return kHANGUL; }
 	int getHeight() const override { return _height; }
 	int getWidth() const override { return _width; }
 	int getCharWidth(uint16 c) const override;
@@ -305,14 +305,14 @@ public:
 	void drawChar(uint16 c, byte *dst, int pitch, int) const override;
 
 private:
-	const uint8 *createGlyph(uint16 chr) const;
+	const uint8 *composeGlyph(uint16 chr) const;
 	void processColorMap();
 	void renderGlyph(byte *dst, const uint8 *glyph, uint8 col, int pitch) const;
 
 	int _width, _height;
 	const uint8 *_colorMap;
 
-	Font *_font8;
+	Font *&_font8fat;
 	const uint8 *_fileData;
 	const uint8 *_glyphData[3];
 	const uint16 *_2byteTables[7];
diff --git a/engines/kyra/graphics/screen_lok.cpp b/engines/kyra/graphics/screen_lok.cpp
index 03373bdd151..9e1372f29ab 100644
--- a/engines/kyra/graphics/screen_lok.cpp
+++ b/engines/kyra/graphics/screen_lok.cpp
@@ -533,8 +533,7 @@ void ChineseTwoByteFontLoK::processColorMap() {
 	_textColor[1] = _colorMap[0] | (_colorMap[0] << 8);
 }
 
-KoreanFontLoK::KoreanFontLoK(Font *font8fnt, const uint16 *lookupTable, uint32 lookupTableSize) : _font8(font8fnt), _height(16), _width(16), _fileData(0), _colorMap(0), _glyphTemp(0) {
-	assert(_font8);
+HangulFontLoK::HangulFontLoK(Font *&font8fat, const uint16 *lookupTable, uint32 lookupTableSize) : _font8fat(font8fat), _height(16), _width(16), _fileData(0), _colorMap(0), _glyphTemp(0) {
 	assert(lookupTable);
 	assert(lookupTableSize == 224);
 	for (int i = 0; i < 7; ++i)
@@ -543,12 +542,12 @@ KoreanFontLoK::KoreanFontLoK(Font *font8fnt, const uint16 *lookupTable, uint32 l
 	_glyphTemp = new uint8[30];
 }
 
-KoreanFontLoK::~KoreanFontLoK() {
+HangulFontLoK::~HangulFontLoK() {
 	delete[] _fileData;
 	delete[] _glyphTemp;
 }
 
-bool KoreanFontLoK::load(Common::SeekableReadStream &data) {
+bool HangulFontLoK::load(Common::SeekableReadStream &data) {
 	if (_fileData)
 		return false;
 
@@ -576,26 +575,29 @@ bool KoreanFontLoK::load(Common::SeekableReadStream &data) {
 	return true;
 }
 
-int KoreanFontLoK::getCharWidth(uint16 c) const {
-	return (c >= 0x80) ? 16 : _font8->getCharWidth(c);
+int HangulFontLoK::getCharWidth(uint16 c) const {
+	assert(_font8fat);
+	return (c >= 0x80) ? 16 : _font8fat->getCharWidth(c);
 }
 
-int KoreanFontLoK::getCharHeight(uint16 c) const {
-	return (_colorMap && _colorMap[3]) ? _height + 2 : _height;
+int HangulFontLoK::getCharHeight(uint16 c) const {
+	return /*(_colorMap && _colorMap[3]) ? _height + 2 :*/ _height;
 }
 
-void KoreanFontLoK::setColorMap(const uint8 *src) {
+void HangulFontLoK::setColorMap(const uint8 *src) {
 	_colorMap = src;
-	_font8->setColorMap(src);
+	assert(_font8fat);
+	_font8fat->setColorMap(src);
 }
 
-void KoreanFontLoK::drawChar(uint16 c, byte *dst, int pitch, int) const {
+void HangulFontLoK::drawChar(uint16 c, byte *dst, int pitch, int) const {
 	if (c < 0x80) {
-		_font8->drawChar(c, dst + (c == '\"' ? 0 : 5) * pitch, pitch, 0);
+		assert(_font8fat);
+		_font8fat->drawChar(c, dst + (c == '\"' ? 0 : 5) * pitch, pitch, 0);
 		return;
 	}
 
-	const uint8 *glyph = createGlyph(c);
+	const uint8 *glyph = composeGlyph(c);
 	dst += (pitch + 1);
 
 	if (_colorMap[3]) {
@@ -608,7 +610,7 @@ void KoreanFontLoK::drawChar(uint16 c, byte *dst, int pitch, int) const {
 	renderGlyph(dst, glyph, _colorMap[1], pitch);
 };
 
-const uint8 *KoreanFontLoK::createGlyph(uint16 chr) const {
+const uint8 *HangulFontLoK::composeGlyph(uint16 chr) const {
 	memset(_glyphTemp, 0, 30);
 
 	uint16 t[3];
@@ -648,7 +650,7 @@ const uint8 *KoreanFontLoK::createGlyph(uint16 chr) const {
 	return _glyphTemp;
 }
 
-void KoreanFontLoK::renderGlyph(byte *dst, const uint8 *glyph, uint8 col, int pitch) const {
+void HangulFontLoK::renderGlyph(byte *dst, const uint8 *glyph, uint8 col, int pitch) const {
 	const uint8 *src = glyph;
 	pitch -= 15;
 
diff --git a/engines/kyra/gui/gui_lok.cpp b/engines/kyra/gui/gui_lok.cpp
index c39edc15d7a..89accb8e24b 100644
--- a/engines/kyra/gui/gui_lok.cpp
+++ b/engines/kyra/gui/gui_lok.cpp
@@ -185,7 +185,7 @@ GUI_LoK::GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen) : GUI_v1(vm), _vm(vm),
 	initStaticResource();
 	_scrollUpFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::scrollUp);
 	_scrollDownFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::scrollDown);
-	_saveLoadNumSlots = (vm->gameFlags().lang == Common::ZH_TWN) ? 4 : 5;
+	_saveLoadNumSlots = (vm->gameFlags().lang == Common::ZH_TWN || vm->gameFlags().lang == Common::KO_KOR) ? 4 : 5;
 	_confMusicMenuMod = (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformMacintosh) ? 3 : 2;
 }
 
@@ -757,7 +757,7 @@ int GUI_LoK::saveGame(Button *button) {
 	_displaySubMenu = true;
 	_cancelSubMenu = false;
 
-	Screen::FontId cf = _screen->setFont(_vm->gameFlags().lang == Common::ZH_TWN ? Screen::FID_CHINESE_FNT : (_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT));
+	Screen::FontId cf = _screen->setFont(_vm->gameFlags().lang == Common::ZH_TWN ? Screen::FID_CHINESE_FNT : /*(_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : */Screen::FID_8_FNT);
 
 	if (_savegameOffset == 0 && _vm->_gameToLoad == 0) {
 		_savegameName[0] = 0;
diff --git a/engines/kyra/script/script_lok.cpp b/engines/kyra/script/script_lok.cpp
index f90f03f3719..7708f7e4e89 100644
--- a/engines/kyra/script/script_lok.cpp
+++ b/engines/kyra/script/script_lok.cpp
@@ -1041,12 +1041,17 @@ int KyraEngine_LoK::o1_specialEventDisplayBrynnsNote(EMCState *script) {
 		else
 			_screen->loadBitmap("NOTE.CPS", 3, 3, nullptr);
 	}
-	_screen->copyRegion(63, 8, 63, 8, 194, 128, 2, 0);
+
+	if (_flags.lang == Common::KO_KOR)
+		_screen->copyRegion(13, 1, 13, 1, 296, 156, 2, 0);
+	else
+		_screen->copyRegion(63, 8, 63, 8, 194, 128, 2, 0);
 	_screen->updateScreen();
 	_screen->showMouse();
 
-	if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie && _flags.lang != Common::JA_JPN && _flags.lang != Common::ZH_TWN)
-		_screen->setFont(Screen::FID_6_FNT);
+	// For Amiga and DOS CD this is actually an irrelevant call, since the note text is part of the
+	// bitmap and the script function for printing the text on it will not be called in these versions.
+	_screen->setFont(_noteFont);
 	return 0;
 }
 
@@ -1058,8 +1063,7 @@ int KyraEngine_LoK::o1_specialEventRemoveBrynnsNote(EMCState *script) {
 	_screen->updateScreen();
 	_screen->showMouse();
 
-	if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie && _flags.lang != Common::JA_JPN && _flags.lang != Common::ZH_TWN)
-		_screen->setFont(Screen::FID_8_FNT);
+	_screen->setFont(_defaultFont);
 	return 0;
 }
 
diff --git a/engines/kyra/text/text_lok.cpp b/engines/kyra/text/text_lok.cpp
index 719cd381de9..f29fe895bd5 100644
--- a/engines/kyra/text/text_lok.cpp
+++ b/engines/kyra/text/text_lok.cpp
@@ -329,9 +329,9 @@ void KyraEngine_LoK::drawSentenceCommand(const char *sentence, int color) {
 	int boxY2 = 152;
 	int col2 = _flags.platform == Common::kPlatformAmiga ? 19 : 12;
 
-	if (_flags.lang == Common::ZH_TWN) {
+	if (_flags.lang == Common::ZH_TWN || _flags.lang == Common::KO_KOR) {
 		boxY1 = 140;
-		boxY2 = 153;
+		boxY2 = _flags.lang == Common::KO_KOR ? 155 : 153;
 		col2 = 0;
 	}
 


Commit: a6fb73725aab28cf1c8e4635b8b74b130580c238
    https://github.com/scummvm/scummvm/commit/a6fb73725aab28cf1c8e4635b8b74b130580c238
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: (LoK/KOR) - fine tune ingame menus

Changed paths:
    engines/kyra/graphics/screen.cpp
    engines/kyra/graphics/screen_lok.cpp
    engines/kyra/gui/gui_lok.cpp
    engines/kyra/gui/gui_v1.cpp
    engines/kyra/resource/staticres.cpp


diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 2200060a66b..0d7c5e0baa9 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -1549,11 +1549,8 @@ uint16 Screen::fetchChar(const char *&s) const {
 	uint16 ch = (uint8)*s++;
 
 	if ((_fonts[_currentFont]->getType() == Font::kSJIS && (ch <= 0x7F || (ch >= 0xA1 && ch <= 0xDF))) ||
-		(_fonts[_currentFont]->getType() == Font::kBIG5 && ch < 0x7F) || (_fonts[_currentFont]->getType() == Font::kHANGUL && ch < 0x80)) {
-			//if (_fonts[_currentFont]->getType() == Font::kHANGUL && ch == ' ' && *s == ' ')
-			//	++s;
+		(_fonts[_currentFont]->getType() == Font::kBIG5 && ch < 0x7F) || (_fonts[_currentFont]->getType() == Font::kHANGUL && ch < 0x80))
 			return ch;
-	}
 
 	ch |= (uint8)(*s++) << 8;
 	return ch;
diff --git a/engines/kyra/graphics/screen_lok.cpp b/engines/kyra/graphics/screen_lok.cpp
index 9e1372f29ab..41e44c6632d 100644
--- a/engines/kyra/graphics/screen_lok.cpp
+++ b/engines/kyra/graphics/screen_lok.cpp
@@ -581,7 +581,7 @@ int HangulFontLoK::getCharWidth(uint16 c) const {
 }
 
 int HangulFontLoK::getCharHeight(uint16 c) const {
-	return /*(_colorMap && _colorMap[3]) ? _height + 2 :*/ _height;
+	return _height;
 }
 
 void HangulFontLoK::setColorMap(const uint8 *src) {
diff --git a/engines/kyra/gui/gui_lok.cpp b/engines/kyra/gui/gui_lok.cpp
index 89accb8e24b..e8bad35b38a 100644
--- a/engines/kyra/gui/gui_lok.cpp
+++ b/engines/kyra/gui/gui_lok.cpp
@@ -185,7 +185,7 @@ GUI_LoK::GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen) : GUI_v1(vm), _vm(vm),
 	initStaticResource();
 	_scrollUpFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::scrollUp);
 	_scrollDownFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::scrollDown);
-	_saveLoadNumSlots = (vm->gameFlags().lang == Common::ZH_TWN || vm->gameFlags().lang == Common::KO_KOR) ? 4 : 5;
+	_saveLoadNumSlots = (vm->gameFlags().lang == Common::ZH_TWN) ? 4 : 5;
 	_confMusicMenuMod = (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformMacintosh) ? 3 : 2;
 }
 
@@ -699,12 +699,22 @@ int GUI_LoK::loadGameMenu(Button *button) {
 }
 
 void GUI_LoK::redrawTextfield() {
-	_screen->fillRect(38, 91, 287, _vm->gameFlags().lang == Common::ZH_TWN ? 107 : 102, _vm->gameFlags().platform == Common::kPlatformAmiga ? 18 : 250);
-	_text->printText(_savegameName, 38, 92, 253, 0, 0);
+	Common::Rect textField(38, 91, 287, 102);
+	int yOffs = 1;
+
+	if (_vm->gameFlags().lang == Common::KO_KOR) {
+		textField = Common::Rect(23, 88, 295, 105);
+		yOffs = 0;
+	} else if (_vm->gameFlags().lang == Common::ZH_TWN) {
+		textField.bottom = 107;
+	}
+
+	_screen->fillRect(textField.left, textField.top, textField.right, textField.bottom, _vm->gameFlags().platform == Common::kPlatformAmiga ? 18 : 250);
+	_text->printText(_savegameName, textField.left, textField.top + yOffs, 253, 0, 0);
 
 	_screen->_charSpacing = -2;
 	int width = _screen->getTextWidth(_savegameName);
-	_screen->fillRect(39 + width, 93, 45 + width, _vm->gameFlags().lang == Common::ZH_TWN ? 105 : 100, _vm->gameFlags().platform == Common::kPlatformAmiga ? 31 : 254);
+	_screen->fillRect(textField.left + 1 + width, textField.top + 2, textField.left + 7 + width, textField.bottom - 2, _vm->gameFlags().platform == Common::kPlatformAmiga ? 31 : 254);
 	_screen->_charSpacing = 0;
 
 	_screen->updateScreen();
diff --git a/engines/kyra/gui/gui_v1.cpp b/engines/kyra/gui/gui_v1.cpp
index 991a91d18fe..906e8a54830 100644
--- a/engines/kyra/gui/gui_v1.cpp
+++ b/engines/kyra/gui/gui_v1.cpp
@@ -31,7 +31,7 @@ namespace Kyra {
 
 GUI_v1::GUI_v1(KyraEngine_v1 *kyra) : GUI(kyra), _text(kyra->text()) {
 	_menuButtonList = nullptr;
-	_menuLabelYOffset = (kyra->game() == GI_LOL) ? 3 : 2;
+	_menuLabelYOffset = (kyra->game() == GI_LOL || kyra->gameFlags().lang == Common::KO_KOR) ? 3 : 2;
 
 	_redrawButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawButtonCallback);
 	_redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawShadedButtonCallback);
diff --git a/engines/kyra/resource/staticres.cpp b/engines/kyra/resource/staticres.cpp
index a73377383ce..593f0415f23 100644
--- a/engines/kyra/resource/staticres.cpp
+++ b/engines/kyra/resource/staticres.cpp
@@ -1167,8 +1167,8 @@ void GUI_LoK::initStaticResource() {
 		menuItemYInc = 20;
 		menuItemHeight = 19;
 	} else if (_vm->gameFlags().lang == Common::KO_KOR) {
-		menuItemYInc = 23;
-		menuItemHeight = 21;
+		menuItemYInc = 24;
+		menuItemHeight = 22;
 		menuHeight = 160;
 		menuItemYEnd = menuItemYStart + menuItemYInc * 4;
 	}
@@ -1193,25 +1193,33 @@ void GUI_LoK::initStaticResource() {
 
 	menuItemYStart = 39;
 	int labelYStart = 8;
+	menuHeight = 160;
+	menuItemYEnd = 134;
+	int scrollUpY = 22;
+	int scrollDownY = 124;
 
 	if (_vm->gameFlags().lang == Common::ZH_TWN) {
 		menuItemYStart = 40;
 		labelYStart = 5;
 	} else if (_vm->gameFlags().lang == Common::KO_KOR) {
-		menuItemYStart = 40;
-		labelYStart = 5;
+		menuItemYStart = 44;
+		labelYStart = 4;
+		menuHeight = 190;
+		scrollUpY = 27;
+		scrollDownY = 164;
+		menuItemYEnd = menuItemYStart + menuItemYInc * 5;
 	}
 
-	GUI_V1_MENU(_menu[2], -1, -1, 0x120, 0xA0, 248, 249, 250, 0, 251, -1, labelYStart, 0, 6, 132, 22, 132, 124);
+	GUI_V1_MENU(_menu[2], -1, -1, 0x120, menuHeight, 248, 249, 250, 0, 251, -1, labelYStart, 0, 6, 132, scrollUpY, 132, scrollDownY);
 	GUI_V1_MENU_ITEM(_menu[2].item[0], 1, 0, 0, 0, -1, 255, menuItemYStart, 0x100, menuItemHeight, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	GUI_V1_MENU_ITEM(_menu[2].item[1], 1, 0, 0, 0, -1, 255, menuItemYStart + menuItemYInc, 0x100, menuItemHeight, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	GUI_V1_MENU_ITEM(_menu[2].item[2], 1, 0, 0, 0, -1, 255, menuItemYStart + menuItemYInc * 2, 0x100, menuItemHeight, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	GUI_V1_MENU_ITEM(_menu[2].item[3], 1, 0, 0, 0, -1, 255, menuItemYStart + menuItemYInc * 3, 0x100, menuItemHeight, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	GUI_V1_MENU_ITEM(_menu[2].item[4], 1, 0, 0, 0, -1, 255, menuItemYStart + menuItemYInc * 4, 0x100, menuItemHeight, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
-	GUI_V1_MENU_ITEM(_menu[2].item[5], 1, 0, 0, 0, 0xB8, 0, 0x86, 0x58, menuItemHeight, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
+	GUI_V1_MENU_ITEM(_menu[2].item[5], 1, 0, 0, 0, 0xB8, 0, menuItemYEnd, 0x58, menuItemHeight, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
 	_menu[2].item[5].callback = cancelSubMenuFunctor;
 
-	if (_vm->gameFlags().lang == Common::ZH_TWN || _vm->gameFlags().lang == Common::KO_KOR)
+	if (_vm->gameFlags().lang == Common::ZH_TWN)
 		_menu[2].item[4].enabled = false;
 
 	menuHeight = 67;
@@ -1235,7 +1243,7 @@ void GUI_LoK::initStaticResource() {
 	if (_vm->gameFlags().lang == Common::ZH_TWN)
 		menuItemYInc = 21;
 	else if (_vm->gameFlags().lang == Common::KO_KOR)
-		menuItemYInc = 21;
+		menuItemYInc = 24;
 
 	GUI_V1_MENU(_menu[4], -1, -1, 0xD0, 0x4C, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1);
 	GUI_V1_MENU_ITEM(_menu[4].item[0], 1, 0, 0, 0, -1, -1, 0x1E, 0xB4, menuItemHeight, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
@@ -1252,9 +1260,7 @@ void GUI_LoK::initStaticResource() {
 		menuItemYInc = 20;
 		labelYStart = 29;
 	} else if (_vm->gameFlags().lang == Common::KO_KOR) {
-		menuItemYStart = 27;
-		menuItemYInc = 20;
-		labelYStart = 29;
+		menuItemYInc = 24;
 	}
 
 	GUI_V1_MENU(_menu[5], -1, -1, 0x130, 0x99, 248, 249, 250, 0, 251, -1, 8, 0, 6, -1, -1, -1, -1);


Commit: c6a02db6148fe7f8a87cffed473a7e45b3666a80
    https://github.com/scummvm/scummvm/commit/c6a02db6148fe7f8a87cffed473a7e45b3666a80
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: (LoK/KOR) - fine tune dialogue text lines

Changed paths:
    engines/kyra/engine/kyra_lok.cpp
    engines/kyra/engine/kyra_lok.h
    engines/kyra/graphics/animator_lok.cpp
    engines/kyra/graphics/screen.cpp
    engines/kyra/graphics/screen.h
    engines/kyra/graphics/screen_lok.cpp
    engines/kyra/text/text.cpp
    engines/kyra/text/text_lok.cpp


diff --git a/engines/kyra/engine/kyra_lok.cpp b/engines/kyra/engine/kyra_lok.cpp
index b4ece94d587..4a43e44b145 100644
--- a/engines/kyra/engine/kyra_lok.cpp
+++ b/engines/kyra/engine/kyra_lok.cpp
@@ -108,8 +108,7 @@ KyraEngine_LoK::KyraEngine_LoK(OSystem *system, const GameFlags &flags)
 		_defaultLineSpacing = 2;
 		break;
 	case Common::KO_KOR:
-		_defaultFont = _noteFont = Screen::FID_KOREAN_FNT;
-		_defaultLineSpacing = 2;
+		_defaultFont = _noteFont = Screen::FID_KOREAN_FNT;;
 		break;
 	default:
 		break;
diff --git a/engines/kyra/engine/kyra_lok.h b/engines/kyra/engine/kyra_lok.h
index 52b2139343f..54f9fd389ed 100644
--- a/engines/kyra/engine/kyra_lok.h
+++ b/engines/kyra/engine/kyra_lok.h
@@ -308,8 +308,8 @@ protected:
 
 	// chat
 	// -> process
-	void characterSays(int vocFile, const char *chatStr, int8 charNum, int8 chatDuration);
-	void waitForChatToFinish(int vocFile, int16 chatDuration, const char *str, uint8 charNum, const bool printText);
+	void characterSays(int vocFile, const char *chatStr, int16 charNum, int16 chatDuration);
+	void waitForChatToFinish(int vocFile, int chatDuration, const char *str, uint8 charNum, const bool printText);
 
 	// -> initialization
 	int initCharacterChat(int8 charNum);
diff --git a/engines/kyra/graphics/animator_lok.cpp b/engines/kyra/graphics/animator_lok.cpp
index 4191703989e..499d3178875 100644
--- a/engines/kyra/graphics/animator_lok.cpp
+++ b/engines/kyra/graphics/animator_lok.cpp
@@ -591,6 +591,7 @@ void Animator_LoK::animRefreshNPC(int character) {
 			if (_vm->_brandonStatusBit0x02Flag) {
 				++_brandonDrawFrame;
 				// TODO: check this
+				// UPDATE: From DOS floppy disasm: _brandonDrawFrame > 122 --> Test where this actually occurs
 				if (_brandonDrawFrame >= 122) {
 					_brandonDrawFrame = 113;
 					_vm->_brandonStatusBit0x02Flag = 0;
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 0d7c5e0baa9..27efc0a2ed5 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -1543,13 +1543,14 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
 }
 
 uint16 Screen::fetchChar(const char *&s) const {
-	if (_fonts[_currentFont]->getType() == Font::kASCII)
+	const int fontType = _fonts[_currentFont]->getType();
+	if (fontType == Font::kASCII)
 		return (uint8)*s++;
 
 	uint16 ch = (uint8)*s++;
 
-	if ((_fonts[_currentFont]->getType() == Font::kSJIS && (ch <= 0x7F || (ch >= 0xA1 && ch <= 0xDF))) ||
-		(_fonts[_currentFont]->getType() == Font::kBIG5 && ch < 0x7F) || (_fonts[_currentFont]->getType() == Font::kHANGUL && ch < 0x80))
+	if ((fontType == Font::kSJIS && (ch <= 0x7F || (ch >= 0xA1 && ch <= 0xDF))) ||
+		((fontType == Font::kBIG5 || fontType == Font::kHANGUL) && ch < 0x80))
 			return ch;
 
 	ch |= (uint8)(*s++) << 8;
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index 1f8101b80d4..7a7c9297a85 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -295,6 +295,12 @@ public:
 	HangulFontLoK(Font *&font8fat, const uint16 *lookupTable, uint32 lookupTableSize);
 	~HangulFontLoK() override;
 
+	enum {
+		kNumJongseong = 191,
+		kNumJungseong = 85,
+		kNumChoseong = 109
+	};
+
 	bool load(Common::SeekableReadStream &data) override;
 	Type getType() const override { return kHANGUL; }
 	int getHeight() const override { return _height; }
@@ -305,7 +311,7 @@ public:
 	void drawChar(uint16 c, byte *dst, int pitch, int) const override;
 
 private:
-	const uint8 *composeGlyph(uint16 chr) const;
+	const uint8 *createGlyph(uint16 chr) const;
 	void processColorMap();
 	void renderGlyph(byte *dst, const uint8 *glyph, uint8 col, int pitch) const;
 
diff --git a/engines/kyra/graphics/screen_lok.cpp b/engines/kyra/graphics/screen_lok.cpp
index 41e44c6632d..ba210e48cbb 100644
--- a/engines/kyra/graphics/screen_lok.cpp
+++ b/engines/kyra/graphics/screen_lok.cpp
@@ -556,8 +556,8 @@ bool HangulFontLoK::load(Common::SeekableReadStream &data) {
 
 	uint32 fileSize = data.size();
 
-	if (fileSize != 5730 + 2550 + 3270) {
-		warning("KoreanFontLoK::load(): Invalid font file size '%d' (expected: '%d').", fileSize, 5730 + 2550 + 3270);
+	if (fileSize != (kNumJongseong + kNumJungseong + kNumChoseong) * 30) {
+		warning("KoreanFontLoK::load(): Invalid font file size '%d' (expected: '%d').", fileSize, (kNumJongseong + kNumJungseong + kNumChoseong) * 30);
 		return false;
 	}
 
@@ -569,8 +569,8 @@ bool HangulFontLoK::load(Common::SeekableReadStream &data) {
 	_fileData = dst;
 
 	_glyphData[0] = _fileData;
-	_glyphData[1] = _glyphData[0] + 5730;
-	_glyphData[2] = _glyphData[1] + 2550;
+	_glyphData[1] = _glyphData[0] + (kNumJongseong * 30);
+	_glyphData[2] = _glyphData[1] + (kNumJungseong * 30);
 
 	return true;
 }
@@ -597,7 +597,7 @@ void HangulFontLoK::drawChar(uint16 c, byte *dst, int pitch, int) const {
 		return;
 	}
 
-	const uint8 *glyph = composeGlyph(c);
+	const uint8 *glyph = createGlyph(c);
 	dst += (pitch + 1);
 
 	if (_colorMap[3]) {
@@ -610,7 +610,7 @@ void HangulFontLoK::drawChar(uint16 c, byte *dst, int pitch, int) const {
 	renderGlyph(dst, glyph, _colorMap[1], pitch);
 };
 
-const uint8 *HangulFontLoK::composeGlyph(uint16 chr) const {
+const uint8 *HangulFontLoK::createGlyph(uint16 chr) const {
 	memset(_glyphTemp, 0, 30);
 
 	uint16 t[3];
@@ -621,14 +621,17 @@ const uint8 *HangulFontLoK::composeGlyph(uint16 chr) const {
 	uint8 i2 = (chr >> 5) & 0x1f;
 	uint8 i3 = (chr >> 10) & 0x1f;
 
+	// determine jungseong glyph part
 	uint16 r1 = _2byteTables[1][i2];
 	if ((int16)r1 > 0)
 		r1 += (_2byteTables[3][i3] + _2byteTables[6][i1] - 3);
 
+	// determine jongseong glyph part
 	uint16 r2 = _2byteTables[0][i3];
 	if ((int16)r2 > 0)
 		r2 += (_2byteTables[4][i2] + _2byteTables[6][i1]);
 
+	// determine choseong glyph part
 	uint16 r3 = _2byteTables[2][i1];
 	if ((int16)r3 > 0)
 		r3 += (_2byteTables[5][i2] - 3);
@@ -637,7 +640,7 @@ const uint8 *HangulFontLoK::composeGlyph(uint16 chr) const {
 	t[1] = (r1 >> 5) - 2;
 	t[2] = (r3 >> 5) - 2;
 
-	static const uint8 lim[3] = { 0xBF, 0x55, 0x6D };
+	const uint8 lim[3] = { kNumJongseong, kNumJungseong, kNumChoseong };
 
 	for (int l = 0; l < 3; ++l) {
 		if (t[l] <= lim[l]) {
diff --git a/engines/kyra/text/text.cpp b/engines/kyra/text/text.cpp
index 2d086744f66..43e96eb874d 100644
--- a/engines/kyra/text/text.cpp
+++ b/engines/kyra/text/text.cpp
@@ -59,8 +59,9 @@ int TextDisplayer::getCharLength(const char *str, int len) {
 		while (i <= len && *str) {
 			uint c = *str++;
 			c &= 0xFF;
-			if (c >= 0x7F && (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().lang == Common::KO_KOR)) {
+			if (c > 0x7F && (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().lang == Common::KO_KOR)) {
 				c = READ_LE_UINT16(str - 1);
+				++charsCount;
 				++str;
 			}
 			i += _screen->getCharWidth(c);
diff --git a/engines/kyra/text/text_lok.cpp b/engines/kyra/text/text_lok.cpp
index f29fe895bd5..73f08ce3624 100644
--- a/engines/kyra/text/text_lok.cpp
+++ b/engines/kyra/text/text_lok.cpp
@@ -29,7 +29,7 @@
 
 namespace Kyra {
 
-void KyraEngine_LoK::waitForChatToFinish(int vocFile, int16 chatDuration, const char *chatStr, uint8 charNum, const bool printText) {
+void KyraEngine_LoK::waitForChatToFinish(int vocFile, int chatDuration, const char *chatStr, uint8 charNum, const bool printText) {
 	bool hasUpdatedNPCs = false;
 	bool runLoop = true;
 	uint8 currPage;
@@ -100,7 +100,7 @@ void KyraEngine_LoK::waitForChatToFinish(int vocFile, int16 chatDuration, const
 		_animator->copyChangedObjectsForward(0);
 		updateTextFade();
 
-		if (((chatDuration < (int16)(_system->getMillis() - timeAtStart)) && chatDuration != -1 && printText) || (!printText && !snd_voiceIsPlaying()))
+		if (((chatDuration < (int)(_system->getMillis() - timeAtStart)) && chatDuration != -1 && printText) || (!printText && !snd_voiceIsPlaying()))
 			break;
 
 		uint32 nextTime = loopStart + _tickLength;
@@ -249,7 +249,7 @@ int KyraEngine_LoK::initCharacterChat(int8 charNum) {
 	return returnValue;
 }
 
-void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int8 charNum, int8 chatDuration) {
+void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int16 charNum, int16 chatDuration) {
 	uint8 startAnimFrames[] =  { 0x10, 0x32, 0x56, 0x0, 0x0, 0x0 };
 
 	uint16 chatTicks;
@@ -284,7 +284,7 @@ void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int8 charNu
 	yPos -= 8;
 	yPos -= lineNum * (_screen->getFontHeight() + _screen->_lineSpacing);
 
-	_text->_talkMessageY = (_flags.lang == Common::ZH_TWN) ? CLIP<int>(yPos, 10, 80) : CLIP<int>(yPos, 11, 100);;
+	_text->_talkMessageY = (_flags.lang == Common::ZH_TWN) ? CLIP<int>(yPos, 10, 80) : CLIP<int>(yPos, 11, 100);
 	_text->_talkMessageH = lineNum * (_screen->getFontHeight() + _screen->_lineSpacing);
 
 	const bool printText = textEnabled();
@@ -297,10 +297,16 @@ void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int8 charNu
 		_text->printCharacterText(processedString, charNum, _characterList[charNum].x1);
 	}
 
+	// This happens right at the beginning, when talking to the treeand can be seen in DOSBox, too.
+	// It will make the sentence stay basically forever. We just set it to
+	// the value from the other versions (probably some typo from the translators).
+	if (_flags.lang == Common::KO_KOR && chatDuration == -20)
+		chatDuration = -2;
+
 	if (chatDuration == -2)
 		chatTicks = strlen(processedString) * 9;
 	else
-		chatTicks = chatDuration;
+		chatTicks = (uint16)chatDuration;
 
 	if (!speechEnabled())
 		vocFile = -1;


Commit: ae4934bc8cff39ecf86439dd09eec4f4c4769565
    https://github.com/scummvm/scummvm/commit/ae4934bc8cff39ecf86439dd09eec4f4c4769565
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: (LoK/KOR) - more accuracy fixes

Changed paths:
    engines/kyra/engine/kyra_lok.cpp
    engines/kyra/graphics/screen_lok.cpp
    engines/kyra/gui/gui_eob.cpp
    engines/kyra/gui/gui_lok.cpp
    engines/kyra/gui/gui_lol.cpp
    engines/kyra/text/text.cpp
    engines/kyra/text/text.h
    engines/kyra/text/text_lok.cpp


diff --git a/engines/kyra/engine/kyra_lok.cpp b/engines/kyra/engine/kyra_lok.cpp
index 4a43e44b145..834a836a62d 100644
--- a/engines/kyra/engine/kyra_lok.cpp
+++ b/engines/kyra/engine/kyra_lok.cpp
@@ -108,7 +108,8 @@ KyraEngine_LoK::KyraEngine_LoK(OSystem *system, const GameFlags &flags)
 		_defaultLineSpacing = 2;
 		break;
 	case Common::KO_KOR:
-		_defaultFont = _noteFont = Screen::FID_KOREAN_FNT;;
+		_defaultFont = _noteFont = Screen::FID_KOREAN_FNT;
+		_defaultLineSpacing = 1;
 		break;
 	default:
 		break;
diff --git a/engines/kyra/graphics/screen_lok.cpp b/engines/kyra/graphics/screen_lok.cpp
index ba210e48cbb..da767dfe6c1 100644
--- a/engines/kyra/graphics/screen_lok.cpp
+++ b/engines/kyra/graphics/screen_lok.cpp
@@ -533,7 +533,7 @@ void ChineseTwoByteFontLoK::processColorMap() {
 	_textColor[1] = _colorMap[0] | (_colorMap[0] << 8);
 }
 
-HangulFontLoK::HangulFontLoK(Font *&font8fat, const uint16 *lookupTable, uint32 lookupTableSize) : _font8fat(font8fat), _height(16), _width(16), _fileData(0), _colorMap(0), _glyphTemp(0) {
+HangulFontLoK::HangulFontLoK(Font *&font8fat, const uint16 *lookupTable, uint32 lookupTableSize) : _font8fat(font8fat), _height(15), _width(15), _fileData(0), _colorMap(0), _glyphTemp(0) {
 	assert(lookupTable);
 	assert(lookupTableSize == 224);
 	for (int i = 0; i < 7; ++i)
@@ -577,11 +577,11 @@ bool HangulFontLoK::load(Common::SeekableReadStream &data) {
 
 int HangulFontLoK::getCharWidth(uint16 c) const {
 	assert(_font8fat);
-	return (c >= 0x80) ? 16 : _font8fat->getCharWidth(c);
+	return (c >= 0x80) ? _width + 1 : _font8fat->getCharWidth(c);
 }
 
 int HangulFontLoK::getCharHeight(uint16 c) const {
-	return _height;
+	return _colorMap[3] ? _height + 2 : _height;
 }
 
 void HangulFontLoK::setColorMap(const uint8 *src) {
@@ -657,10 +657,10 @@ void HangulFontLoK::renderGlyph(byte *dst, const uint8 *glyph, uint8 col, int pi
 	const uint8 *src = glyph;
 	pitch -= 15;
 
-	for (int y = 0; y < 15; ++y) {
+	for (int y = 0; y < _height; ++y) {
 		uint8 m = 0;
 		uint8 in = 0;
-		for (int x = 0; x < 15; ++x) {
+		for (int x = 0; x < _width; ++x) {
 			if (m == 0) {
 				in = *src++;
 				m = 0x80;
diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index f624a1d3dff..c042b98762f 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -4597,7 +4597,7 @@ void GUI_EoB::setupSaveMenuSlots() {
 				Common::strlcpy(_saveSlotStringsTemp[i], _savegameList[i + _savegameOffset], 25);
 
 				if (!(_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().platform == Common::kPlatformSegaCD &&
-					Common::String(_saveSlotStringsTemp[i]).contains('\r')) && (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().platform == Common::kPlatformSegaCD)) {
+					Common::String(_saveSlotStringsTemp[i]).contains('\r')) && (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().lang == Common::ZH_TWN || _vm->gameFlags().platform == Common::kPlatformSegaCD)) {
 						// Strip special characters from GMM save dialog which might get misinterpreted as SJIS
 						// Special case for Japanese SegaCD: Only the save descriptions from GMM should be stripped. The auto-generated descriptions from the ingame save dialog
 						// have a special 1-byte encoding that must be kept. It is easy to distinguish between GMM descriptions and ingame descriptions due to the '\r' characters
diff --git a/engines/kyra/gui/gui_lok.cpp b/engines/kyra/gui/gui_lok.cpp
index e8bad35b38a..d9870debb00 100644
--- a/engines/kyra/gui/gui_lok.cpp
+++ b/engines/kyra/gui/gui_lok.cpp
@@ -592,7 +592,7 @@ void GUI_LoK::setupSavegames(Menu &menu, int num) {
 			_screen->_charSpacing = 0;
 
 			Util::convertUTF8ToDOS(_savegameNames[i], 35);
-			if (_vm->gameFlags().lang == Common::JA_JPN) {
+			if (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().lang == Common::ZH_TWN || _vm->gameFlags().lang == Common::KO_KOR) {
 				// Strip special characters from GMM save dialog which might get misinterpreted as SJIS
 				for (uint ii = 0; ii < strlen(_savegameNames[i]); ++ii) {
 					if (_savegameNames[i][ii] < 32) // due to the signed char type this will also clean up everything >= 0x80
@@ -721,18 +721,33 @@ void GUI_LoK::redrawTextfield() {
 }
 
 void GUI_LoK::updateSavegameString() {
-	int length;
+	int length = 0;
+	int inputType = Font::kASCII;
 
 	if (_keyPressed.keycode) {
 		length = strlen(_savegameName);
 		_screen->_charSpacing = -2;
 		int width = _screen->getTextWidth(_savegameName) + 7;
 		_screen->_charSpacing = 0;
+		char inputKey = 0;
 
-		char inputKey = _keyPressed.ascii;
-		Util::convertISOToDOS(inputKey);
+		if (inputType == Font::kHANGUL) {
+			if (_keyPressed.ascii < 128)
+				inputKey = (_keyPressed.ascii & 0x7f) | 0x80;
+		} else {
+			inputKey = _keyPressed.ascii;
+			Util::convertISOToDOS(inputKey);
+		}
 
-		if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 128 : 226)) {
+		/*if (inputType == Font::kHANGUL && (uint8)inputKey > 31) {
+			if ((length < ARRAYSIZE(_savegameName) - 2) && (width <= 240)) {
+				_savegameName[length] = inputKey - 101;
+				_savegameName[length + 1] = _savegameName[length + 2] = 0;
+				if (length & 1)
+					_savegameName[length - 1] |= 0x80;
+				redrawTextfield();
+			}
+		} else*/ if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 128 : 226)) {
 			if ((length < ARRAYSIZE(_savegameName) - 1) && (width <= 240)) {
 				_savegameName[length] = inputKey;
 				_savegameName[length + 1] = 0;
@@ -767,7 +782,7 @@ int GUI_LoK::saveGame(Button *button) {
 	_displaySubMenu = true;
 	_cancelSubMenu = false;
 
-	Screen::FontId cf = _screen->setFont(_vm->gameFlags().lang == Common::ZH_TWN ? Screen::FID_CHINESE_FNT : /*(_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : */Screen::FID_8_FNT);
+	Screen::FontId cf = _screen->setFont(_vm->gameFlags().lang == Common::ZH_TWN ? Screen::FID_CHINESE_FNT : (_vm->gameFlags().lang == Common::KO_KOR ? Screen::FID_KOREAN_FNT : Screen::FID_8_FNT));
 
 	if (_savegameOffset == 0 && _vm->_gameToLoad == 0) {
 		_savegameName[0] = 0;
diff --git a/engines/kyra/gui/gui_lol.cpp b/engines/kyra/gui/gui_lol.cpp
index 4e61970638d..1859bf97e35 100644
--- a/engines/kyra/gui/gui_lol.cpp
+++ b/engines/kyra/gui/gui_lol.cpp
@@ -2528,8 +2528,8 @@ void GUI_LoL::setupSaveMenuSlots(Menu &menu, int num) {
 				fC = _screen->getTextWidth(s);
 			}
 
-			if (_vm->gameFlags().lang == Common::JA_JPN) {
-				// Strip special characters from GMM save dialog which might get misinterpreted as SJIS
+			if (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().lang == Common::ZH_TWN) {
+				// Strip special characters from GMM save dialog which might get misinterpreted as 2-byte character
 				for (uint ii = 0; ii < strlen(s); ++ii) {
 					if (s[ii] < 32) // due to the signed char type this will also clean up everything >= 0x80
 						s[ii] = ' ';
diff --git a/engines/kyra/text/text.cpp b/engines/kyra/text/text.cpp
index 43e96eb874d..86cc253eee5 100644
--- a/engines/kyra/text/text.cpp
+++ b/engines/kyra/text/text.cpp
@@ -34,6 +34,7 @@ TextDisplayer::TextDisplayer(KyraEngine_v1 *vm, Screen *screen) {
 	_talkMessageY = 0xC;
 	_talkMessageH = 0;
 	_talkMessagePrinted = false;
+	_langExtraSpacing = (vm->gameFlags().lang == Common::KO_KOR) ? 1 : 0;
 	_lineBreakChar = (_vm->gameFlags().platform == Common::kPlatformMacintosh) ? '\n' : '\r';
 	memset(_talkSubstrings, 0, sizeof(_talkSubstrings));
 	memset(_talkBuffer, 0, sizeof(_talkBuffer));
@@ -195,18 +196,19 @@ void TextDisplayer::printTalkTextMessage(const char *text, int x, int y, uint8 c
 	// For Chinese we call this before recalculating the line count
 	int w = getWidestLineWidth(lineCount);
 	int marginTop = 0;
+
 	if (_vm->gameFlags().lang == Common::ZH_TWN) {
 		lineCount = (strlen(str) + 31) >> 5;
 		marginTop = 10;
 		w = MIN<int>(w, 302);
 	}
 
-	int top = y - lineCount * (_screen->getFontHeight() + _screen->_lineSpacing);
+	int top = y - lineCount * (_screen->getFontHeight() + _screen->_lineSpacing) - _langExtraSpacing;;
 	if (top < marginTop)
 		top = marginTop;
 
 	_talkMessageY = top;
-	_talkMessageH = lineCount * (_screen->getFontHeight() + _screen->_lineSpacing);
+	_talkMessageH = lineCount * (_screen->getFontHeight() + _screen->_lineSpacing) + _langExtraSpacing;;
 	
 	int x1 = 12;
 	int x2 = Screen::SCREEN_W - 12;
@@ -250,7 +252,7 @@ void TextDisplayer::printText(const Common::String &str, int x, int y, uint8 c0,
 	_screen->setTextColor(colorMap, 0, 3);
 	_screen->_charSpacing = -2;
 	int ls = _screen->_lineSpacing;
-	_screen->_lineSpacing = 0;
+	_screen->_lineSpacing = _langExtraSpacing;
 	_screen->printText(tmp, x, y, c0, c2);
 	_screen->_charSpacing = 0;
 	_screen->_lineSpacing = ls;
diff --git a/engines/kyra/text/text.h b/engines/kyra/text/text.h
index 35f493691c7..4fcbb4e0328 100644
--- a/engines/kyra/text/text.h
+++ b/engines/kyra/text/text.h
@@ -51,6 +51,7 @@ public:
 
 	uint16 _talkMessageY;
 	uint16 _talkMessageH;
+	int _langExtraSpacing;
 	bool printed() const { return _talkMessagePrinted; }
 
 protected:
diff --git a/engines/kyra/text/text_lok.cpp b/engines/kyra/text/text_lok.cpp
index 73f08ce3624..3cc9421aae0 100644
--- a/engines/kyra/text/text_lok.cpp
+++ b/engines/kyra/text/text_lok.cpp
@@ -285,7 +285,7 @@ void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int16 charN
 	yPos -= lineNum * (_screen->getFontHeight() + _screen->_lineSpacing);
 
 	_text->_talkMessageY = (_flags.lang == Common::ZH_TWN) ? CLIP<int>(yPos, 10, 80) : CLIP<int>(yPos, 11, 100);
-	_text->_talkMessageH = lineNum * (_screen->getFontHeight() + _screen->_lineSpacing);
+	_text->_talkMessageH = lineNum * (_screen->getFontHeight() + _screen->_lineSpacing) + _text->_langExtraSpacing;;
 
 	const bool printText = textEnabled();
 
@@ -297,7 +297,7 @@ void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int16 charN
 		_text->printCharacterText(processedString, charNum, _characterList[charNum].x1);
 	}
 
-	// This happens right at the beginning, when talking to the treeand can be seen in DOSBox, too.
+	// This happens right at the beginning, when talking to the tree and can be seen in DOSBox, too.
 	// It will make the sentence stay basically forever. We just set it to
 	// the value from the other versions (probably some typo from the translators).
 	if (_flags.lang == Common::KO_KOR && chatDuration == -20)
@@ -310,7 +310,7 @@ void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int16 charN
 
 	if (!speechEnabled())
 		vocFile = -1;
-	waitForChatToFinish(vocFile, chatTicks, chatStr, charNum, printText);
+	waitForChatToFinish(vocFile, (chatDuration == -1) ? -1 : chatTicks, chatStr, charNum, printText);
 
 	if (printText) {
 		_animator->restoreAllObjectBackgrounds();


Commit: d2d4765aaf42d7c23e502dd82f5bd908e0aa1227
    https://github.com/scummvm/scummvm/commit/d2d4765aaf42d7c23e502dd82f5bd908e0aa1227
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-09T00:49:05+02:00

Commit Message:
KYRA: (LoK/KOR) - some preparations for Hangul input

(not working yet)

Changed paths:
    engines/kyra/engine/util.cpp
    engines/kyra/engine/util.h
    engines/kyra/graphics/screen_lok.cpp
    engines/kyra/gui/gui_lok.cpp


diff --git a/engines/kyra/engine/util.cpp b/engines/kyra/engine/util.cpp
index d8a08620e8d..34096c3c774 100644
--- a/engines/kyra/engine/util.cpp
+++ b/engines/kyra/engine/util.cpp
@@ -104,6 +104,57 @@ void Util::convertISOToDOS(char &c) {
 		c = Common::U32String(Common::String::format("%c", c), Common::kISO8859_1).encode(Common::kDos850).firstChar();
 }
 
+uint8 Util::convertKeyDOSToHAN(char &c, uint16 &dest) {
+	struct DOS2HanEntry {
+		char key;
+		uint16 hanChar;
+		uint8 flags;
+	};
+
+	static const DOS2HanEntry hanConvTable[] = {
+		{ 'A', 0x2041, 0x11 }, { 'B', 0x0741, 0x04 }, { 'C', 0x4041, 0x11 }, { 'D', 0x3441, 0x11 },
+		{ 'E', 0x1841, 0x01 }, { 'F', 0x1c41, 0x11 }, { 'G', 0x5041, 0x11 }, { 'H', 0x05a1, 0x04 },
+		{ 'I', 0x04a1, 0x02 }, { 'J', 0x04e1, 0x02 }, { 'K', 0x0461, 0x02 }, { 'L', 0x07a1, 0x02 },
+		{ 'M', 0x0761, 0x04 }, { 'N', 0x0681, 0x04 }, { 'O', 0x04c1, 0x02 }, { 'P', 0x0581, 0x02 },
+		{ 'Q', 0x2841, 0x01 }, { 'R', 0x0c41, 0x11 }, { 'S', 0x1041, 0x11 }, { 'T', 0x3041, 0x11 },
+		{ 'U', 0x0561, 0x02 }, { 'V', 0x4c41, 0x01 }, { 'W', 0x3c41, 0x01 }, { 'X', 0x4841, 0x11 },
+		{ 'Y', 0x0661, 0x04 }, { 'Z', 0x4441, 0x11 }, { 'a', 0x2041, 0x11 }, { 'b', 0x0741, 0x04 },
+		{ 'c', 0x4041, 0x11 }, { 'd', 0x3441, 0x11 }, { 'e', 0x1441, 0x11 }, { 'f', 0x1c41, 0x11 },
+		{ 'g', 0x5041, 0x11 }, { 'h', 0x05a1, 0x04 }, { 'i', 0x04a1, 0x02 }, { 'j', 0x04e1, 0x02 },
+		{ 'k', 0x0461, 0x02 }, { 'l', 0x07a1, 0x02 }, { 'm', 0x0761, 0x04 }, { 'n', 0x0681, 0x04 },
+		{ 'o', 0x0481, 0x02 }, { 'p', 0x0541, 0x02 }, { 'q', 0x2441, 0x11 }, { 'r', 0x0841, 0x11 },
+		{ 's', 0x1041, 0x11 }, { 't', 0x2c41, 0x11 }, { 'u', 0x0561, 0x02 }, { 'v', 0x4c41, 0x11 },
+		{ 'w', 0x3841, 0x11 }, { 'x', 0x4841, 0x11 }, { 'y', 0x0661, 0x04 }, { 'z', 0x4441, 0x11 }
+	};
+
+	dest = 0;
+	if (!((c >= (uint8)'A' && c <= (uint8)'Z') || (c >= (uint8)'a' && c <= (uint8)'z')))
+		return 0;
+
+	uint16 res = 0;
+	for (uint16 lml = 0, lmu = 51;lml <= lmu; ) {
+		int16 a = (lml + lmu);
+		if (a < 0)
+			++a;
+		res = a >> 1;
+		if (hanConvTable[res].key > c)
+			lmu = res - 1;
+		else
+			lml = res + 1;
+		if (hanConvTable[res].key == c)
+			break;
+	}
+
+	uint8 flags = 0;
+	if (hanConvTable[res].key == c) {
+		dest = hanConvTable[res].hanChar;
+		flags = hanConvTable[res].flags;
+	}
+
+	return flags;
+}
+
+
 Common::String Util::decodeString1(const Common::String &src) {
 	char *tmp = new char[src.size() * 2 + 2];
 	Util::decodeString1(src.c_str(), tmp);
diff --git a/engines/kyra/engine/util.h b/engines/kyra/engine/util.h
index 68d83e4dc91..16f049954e1 100644
--- a/engines/kyra/engine/util.h
+++ b/engines/kyra/engine/util.h
@@ -40,6 +40,8 @@ public:
 	static Common::String convertISOToUTF8(Common::String &str);
 	static void convertISOToDOS(char &c);
 
+	static uint8 convertKeyDOSToHAN(char &c, uint16 &dest);
+
 	static Common::String findMacResourceFile(const char *baseName);
 };
 
diff --git a/engines/kyra/graphics/screen_lok.cpp b/engines/kyra/graphics/screen_lok.cpp
index da767dfe6c1..0bb8838db81 100644
--- a/engines/kyra/graphics/screen_lok.cpp
+++ b/engines/kyra/graphics/screen_lok.cpp
@@ -557,7 +557,7 @@ bool HangulFontLoK::load(Common::SeekableReadStream &data) {
 	uint32 fileSize = data.size();
 
 	if (fileSize != (kNumJongseong + kNumJungseong + kNumChoseong) * 30) {
-		warning("KoreanFontLoK::load(): Invalid font file size '%d' (expected: '%d').", fileSize, (kNumJongseong + kNumJungseong + kNumChoseong) * 30);
+		warning("HangulFontLoK::load(): Invalid font file size '%d' (expected: '%d').", fileSize, (kNumJongseong + kNumJungseong + kNumChoseong) * 30);
 		return false;
 	}
 
diff --git a/engines/kyra/gui/gui_lok.cpp b/engines/kyra/gui/gui_lok.cpp
index d9870debb00..e394fb61b51 100644
--- a/engines/kyra/gui/gui_lok.cpp
+++ b/engines/kyra/gui/gui_lok.cpp
@@ -729,33 +729,31 @@ void GUI_LoK::updateSavegameString() {
 		_screen->_charSpacing = -2;
 		int width = _screen->getTextWidth(_savegameName) + 7;
 		_screen->_charSpacing = 0;
-		char inputKey = 0;
+		char oneByteInput = _keyPressed.ascii;
+		Util::convertISOToDOS(oneByteInput);
+		uint16 twoByteInput = 0;
+		uint8 flags = 0;
 
-		if (inputType == Font::kHANGUL) {
-			if (_keyPressed.ascii < 128)
-				inputKey = (_keyPressed.ascii & 0x7f) | 0x80;
-		} else {
-			inputKey = _keyPressed.ascii;
-			Util::convertISOToDOS(inputKey);
-		}
+		if (inputType == Font::kHANGUL)
+			flags = Util::convertKeyDOSToHAN(oneByteInput, twoByteInput);
 
-		/*if (inputType == Font::kHANGUL && (uint8)inputKey > 31) {
+		if (twoByteInput) {
 			if ((length < ARRAYSIZE(_savegameName) - 2) && (width <= 240)) {
-				_savegameName[length] = inputKey - 101;
-				_savegameName[length + 1] = _savegameName[length + 2] = 0;
-				if (length & 1)
-					_savegameName[length - 1] |= 0x80;
+				WRITE_BE_UINT16(&_savegameName[length], twoByteInput | 0x8000);
+				_savegameName[length + 2] = 0;
 				redrawTextfield();
 			}
-		} else*/ if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 128 : 226)) {
+		} else if ((uint8)oneByteInput > 31 && (uint8)oneByteInput < (_vm->gameFlags().lang == Common::JA_JPN ? 128 : 226)) {
 			if ((length < ARRAYSIZE(_savegameName) - 1) && (width <= 240)) {
-				_savegameName[length] = inputKey;
+				_savegameName[length] = oneByteInput;
 				_savegameName[length + 1] = 0;
 				redrawTextfield();
 			}
-		} else if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE ||
-		           _keyPressed.keycode == Common::KEYCODE_DELETE) {
-			if (length > 0) {
+		} else if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE || _keyPressed.keycode == Common::KEYCODE_DELETE) {
+			if (inputType == Font::kHANGUL && length > 1 && (_savegameName[length - 2] & 0x80)) {
+				_savegameName[length - 2] = _savegameName[length - 1] = 0;
+				redrawTextfield();
+			} else if (length > 0) {
 				_savegameName[length - 1] = 0;
 				redrawTextfield();
 			}




More information about the Scummvm-git-logs mailing list