[Scummvm-git-logs] scummvm master -> 22e33f97b91457183fa53614714d341d7a95ef71
athrxx
noreply at scummvm.org
Mon Jun 27 22:39:06 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f1b085d867 KYRA: (MR/ZH) - fix ZH font issue when language is set to other than ZH (Step 1)
22e33f97b9 KYRA: (MR/ZH) - fix ZH font issue when language is set to other than ZH (Step 2)
Commit: f1b085d867e05c77f7239f1624eef61c34a16150
https://github.com/scummvm/scummvm/commit/f1b085d867e05c77f7239f1624eef61c34a16150
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-28T00:36:29+02:00
Commit Message:
KYRA: (MR/ZH) - fix ZH font issue when language is set to other than ZH (Step 1)
This is only one of two steps. It slightly changes the detection so that the game always "remembers" whether it is Simplified or Traditional Chinese, even when the language is set to English, German or French.
Changed paths:
engines/kyra/detection.h
engines/kyra/detection_tables.h
engines/kyra/engine/kyra_mr.cpp
engines/kyra/engine/kyra_v2.cpp
engines/kyra/graphics/screen_mr.cpp
engines/kyra/gui/gui_mr.cpp
diff --git a/engines/kyra/detection.h b/engines/kyra/detection.h
index fb3d6a4ca20..88b6d738365 100644
--- a/engines/kyra/detection.h
+++ b/engines/kyra/detection.h
@@ -38,6 +38,9 @@ enum {
struct GameFlags {
Common::Language lang;
+ // Only for MR versions which have 4 languages instead of 3 (Simplified Chinese/Traditional Chinese)
+ Common::Language extraLang;
+
// language overwrites of fan translations (only needed for multilingual games)
Common::Language fanLang;
Common::Language replacedLang;
@@ -53,7 +56,6 @@ struct GameFlags {
bool useHiColorMode : 1;
bool useDigSound : 1;
bool useInstallerPackage : 1;
- bool hasExtraLanguage : 1;
byte gameID;
};
diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h
index d84be7c6b54..b8df0f3957a 100644
--- a/engines/kyra/detection_tables.h
+++ b/engines/kyra/detection_tables.h
@@ -21,50 +21,51 @@
namespace {
-#define FLAGS(x, y, z, a, b, c, d, e, f, g, id) { Common::UNK_LANG, Common::UNK_LANG, Common::UNK_LANG, Common::kPlatformUnknown, x, y, z, a, b, c, d, e, f, g, id }
-#define FLAGS_FAN(fanLang, repLang, x, y, z, a, b, c, d, e, f, g, id) { Common::UNK_LANG, fanLang, repLang, Common::kPlatformUnknown, x, y, z, a, b, c, d, e, f, g, id }
-
-#define KYRA1_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
-#define KYRA1_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, false, false, false, true, false, Kyra::GI_KYRA1)
-#define KYRA1_OLDFLOPPY_FLAGS FLAGS(false, false, false, true, false, false, false, false, false, false, Kyra::GI_KYRA1)
-#define KYRA1_AMIGA_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
-#define KYRA1_TOWNS_FLAGS FLAGS(false, true, false, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
-#define KYRA1_TOWNS_SJIS_FLAGS FLAGS(false, true, false, false, true, false, false, false, false, false, Kyra::GI_KYRA1)
-#define KYRA1_CD_FLAGS FLAGS(false, true, true, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
-#define KYRA1_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, true, true, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
-#define KYRA1_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
-#define KYRA1_DEMO_CD_FLAGS FLAGS(true, true, true, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
-
-#define KYRA2_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
-#define KYRA2_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, false, false, false, true, false, Kyra::GI_KYRA2)
-#define KYRA2_FLOPPY_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
-#define KYRA2_CD_FLAGS FLAGS(false, false, true, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
-#define KYRA2_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
-#define KYRA2_CD_DEMO_FLAGS FLAGS(true, false, true, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
-#define KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
-#define KYRA2_TOWNS_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
-#define KYRA2_TOWNS_SJIS_FLAGS FLAGS(false, false, false, false, true, false, false, false, false, false, Kyra::GI_KYRA2)
-
-#define KYRA3_CD_FLAGS FLAGS(false, false, true, false, false, false, false, true, true, false, Kyra::GI_KYRA3)
-#define KYRA3_CD_4LANG_FLAGS FLAGS(false, false, true, false, false, false, false, true, true, true, Kyra::GI_KYRA3)
-#define KYRA3_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, false, false, false, true, false, false, Kyra::GI_KYRA3)
-
-#define LOL_CD_FLAGS FLAGS(false, false, true, false, false, false, false, false, false, false, Kyra::GI_LOL)
-#define LOL_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, false, false, false, false, false, false, Kyra::GI_LOL)
-#define LOL_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, false, Kyra::GI_LOL)
-#define LOL_FLOPPY_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, false, false, false, false, false, false, false, false, Kyra::GI_LOL)
-#define LOL_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, false, false, false, true, false, Kyra::GI_LOL)
-#define LOL_PC9801_FLAGS FLAGS(false, false, false, false, true, true, false, false, false, false, Kyra::GI_LOL)
-#define LOL_FMTOWNS_FLAGS FLAGS(false, false, false, false, true, false, false, false, false, false, Kyra::GI_LOL)
-#define LOL_DEMO_FLAGS FLAGS(true, true, false, false, false, false, false, false, false, false, Kyra::GI_LOL)
-#define LOL_CD_DEMO_FLAGS FLAGS(true, false, true, false, false, false, false, false, false, false, Kyra::GI_LOL)
-#define LOL_KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
-
-#define EOB_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, false, Kyra::GI_EOB1)
-#define EOB_SPANISH_FLAGS FLAGS(false, false, false, true, false, false, false, false, false, false, Kyra::GI_EOB1)
-#define EOB_PC98_FLAGS FLAGS(false, false, false, false, true, true, false, false, false, false, Kyra::GI_EOB1)
-#define EOB2_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, false, Kyra::GI_EOB2)
-#define EOB2_FMTOWNS_FLAGS FLAGS(false, false, false, false, true, false, true, false, false, false, Kyra::GI_EOB2)
+#define FLAGS(x, y, z, a, b, c, d, e, f, id) { Common::UNK_LANG, Common::UNK_LANG, Common::UNK_LANG, Common::UNK_LANG, Common::kPlatformUnknown, x, y, z, a, b, c, d, e, f, id }
+#define FLAGSXLANG(extraLang, x, y, z, a, b, c, d, e, f, id) { Common::UNK_LANG, extraLang, Common::UNK_LANG, Common::UNK_LANG, Common::kPlatformUnknown, x, y, z, a, b, c, d, e, f, id }
+#define FLAGS_FAN(fanLang, repLang, x, y, z, a, b, c, d, e, f, id) { Common::UNK_LANG, Common::UNK_LANG, fanLang, repLang, Common::kPlatformUnknown, x, y, z, a, b, c, d, e, f, id }
+
+#define KYRA1_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
+#define KYRA1_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, false, false, false, true, Kyra::GI_KYRA1)
+#define KYRA1_OLDFLOPPY_FLAGS FLAGS(false, false, false, true, false, false, false, false, false, Kyra::GI_KYRA1)
+#define KYRA1_AMIGA_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
+#define KYRA1_TOWNS_FLAGS FLAGS(false, true, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
+#define KYRA1_TOWNS_SJIS_FLAGS FLAGS(false, true, false, false, true, false, false, false, false, Kyra::GI_KYRA1)
+#define KYRA1_CD_FLAGS FLAGS(false, true, true, false, false, false, false, false, false, Kyra::GI_KYRA1)
+#define KYRA1_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, true, true, false, false, false, false, false, false, Kyra::GI_KYRA1)
+#define KYRA1_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, false, false, Kyra::GI_KYRA1)
+#define KYRA1_DEMO_CD_FLAGS FLAGS(true, true, true, false, false, false, false, false, false, Kyra::GI_KYRA1)
+
+#define KYRA2_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
+#define KYRA2_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, false, false, false, true, Kyra::GI_KYRA2)
+#define KYRA2_FLOPPY_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
+#define KYRA2_CD_FLAGS FLAGS(false, false, true, false, false, false, false, false, false, Kyra::GI_KYRA2)
+#define KYRA2_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, false, false, false, false, false, Kyra::GI_KYRA2)
+#define KYRA2_CD_DEMO_FLAGS FLAGS(true, false, true, false, false, false, false, false, false, Kyra::GI_KYRA2)
+#define KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
+#define KYRA2_TOWNS_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
+#define KYRA2_TOWNS_SJIS_FLAGS FLAGS(false, false, false, false, true, false, false, false, false, Kyra::GI_KYRA2)
+
+#define KYRA3_CD_FLAGS FLAGS(false, false, true, false, false, false, false, true, true, Kyra::GI_KYRA3)
+#define KYRA3_CD_4LANG_FLAGS(extraLang) FLAGSXLANG(extraLang, false, false, true, false, false, false, false, true, true, Kyra::GI_KYRA3)
+#define KYRA3_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, false, false, false, true, false, Kyra::GI_KYRA3)
+
+#define LOL_CD_FLAGS FLAGS(false, false, true, false, false, false, false, false, false, Kyra::GI_LOL)
+#define LOL_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, false, false, false, false, false, Kyra::GI_LOL)
+#define LOL_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, Kyra::GI_LOL)
+#define LOL_FLOPPY_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, false, false, false, false, false, false, false, Kyra::GI_LOL)
+#define LOL_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, false, false, false, true, Kyra::GI_LOL)
+#define LOL_PC9801_FLAGS FLAGS(false, false, false, false, true, true, false, false, false, Kyra::GI_LOL)
+#define LOL_FMTOWNS_FLAGS FLAGS(false, false, false, false, true, false, false, false, false, Kyra::GI_LOL)
+#define LOL_DEMO_FLAGS FLAGS(true, true, false, false, false, false, false, false, false, Kyra::GI_LOL)
+#define LOL_CD_DEMO_FLAGS FLAGS(true, false, true, false, false, false, false, false, false, Kyra::GI_LOL)
+#define LOL_KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
+
+#define EOB_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, Kyra::GI_EOB1)
+#define EOB_SPANISH_FLAGS FLAGS(false, false, false, true, false, false, false, false, false, Kyra::GI_EOB1)
+#define EOB_PC98_FLAGS FLAGS(false, false, false, false, true, true, false, false, false, Kyra::GI_EOB1)
+#define EOB2_FLAGS FLAGS(false, false, false, false, false, false, false, false, false, Kyra::GI_EOB2)
+#define EOB2_FMTOWNS_FLAGS FLAGS(false, false, false, false, true, false, true, false, false, Kyra::GI_EOB2)
#define GAMEOPTION_KYRA3_AUDIENCE GUIO_GAMEOPTIONS1
#define GAMEOPTION_KYRA3_SKIP GUIO_GAMEOPTIONS2
@@ -1163,7 +1164,7 @@ const KYRAGameDescription adGameDescs[] = {
KYRA3_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
- { // non installed version
+ {
{
"kyra3",
0,
@@ -1173,10 +1174,49 @@ const KYRAGameDescription adGameDescs[] = {
ADGF_DROPLANGUAGE,
GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
- KYRA3_CD_4LANG_FLAGS
+ KYRA3_CD_4LANG_FLAGS(Common::ZH_CHN)
+ },
+
+ {
+ {
+ "kyra3",
+ 0,
+ AD_ENTRY1s("ONETIME.PAK", "93b4ca2847ab7cfe52188cbde2ffe561", -1),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_DROPLANGUAGE,
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
+ },
+ KYRA3_CD_4LANG_FLAGS(Common::ZH_CHN)
+ },
+
+ {
+ {
+ "kyra3",
+ 0,
+ AD_ENTRY1s("ONETIME.PAK", "93b4ca2847ab7cfe52188cbde2ffe561", -1),
+ Common::FR_FRA,
+ Common::kPlatformDOS,
+ ADGF_DROPLANGUAGE,
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
+ },
+ KYRA3_CD_4LANG_FLAGS(Common::ZH_CHN)
+ },
+
+ {
+ {
+ "kyra3",
+ 0,
+ AD_ENTRY1s("ONETIME.PAK", "93b4ca2847ab7cfe52188cbde2ffe561", -1),
+ Common::DE_DEU,
+ Common::kPlatformDOS,
+ ADGF_DROPLANGUAGE,
+ GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
+ },
+ KYRA3_CD_4LANG_FLAGS(Common::ZH_CHN)
},
- { // non installed version
+ {
{
"kyra3",
0,
@@ -1186,46 +1226,46 @@ const KYRAGameDescription adGameDescs[] = {
ADGF_DROPLANGUAGE,
GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
- KYRA3_CD_4LANG_FLAGS
+ KYRA3_CD_4LANG_FLAGS(Common::ZH_TWN)
},
{
{
"kyra3",
0,
- AD_ENTRY1s("ONETIME.PAK", "93b4ca2847ab7cfe52188cbde2ffe561", -1),
+ AD_ENTRY1s("ONETIME.PAK", "4fe8ff05002f3a4d645f11cd326fcef2", -1),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_DROPLANGUAGE,
GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
- KYRA3_CD_4LANG_FLAGS
+ KYRA3_CD_4LANG_FLAGS(Common::ZH_TWN)
},
{
{
"kyra3",
0,
- AD_ENTRY1s("ONETIME.PAK", "93b4ca2847ab7cfe52188cbde2ffe561", -1),
+ AD_ENTRY1s("ONETIME.PAK", "4fe8ff05002f3a4d645f11cd326fcef2", -1),
Common::FR_FRA,
Common::kPlatformDOS,
ADGF_DROPLANGUAGE,
GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
- KYRA3_CD_4LANG_FLAGS
+ KYRA3_CD_4LANG_FLAGS(Common::ZH_TWN)
},
{
{
"kyra3",
0,
- AD_ENTRY1s("ONETIME.PAK", "93b4ca2847ab7cfe52188cbde2ffe561", -1),
+ AD_ENTRY1s("ONETIME.PAK", "4fe8ff05002f3a4d645f11cd326fcef2", -1),
Common::DE_DEU,
Common::kPlatformDOS,
ADGF_DROPLANGUAGE,
GUIO5(GUIO_NOMIDI, GUIO_RENDERVGA, GAMEOPTION_KYRA3_AUDIENCE, GAMEOPTION_KYRA3_SKIP, GAMEOPTION_KYRA3_HELIUM)
},
- KYRA3_CD_4LANG_FLAGS
+ KYRA3_CD_4LANG_FLAGS(Common::ZH_TWN)
},
// Lands of Lore CD
diff --git a/engines/kyra/engine/kyra_mr.cpp b/engines/kyra/engine/kyra_mr.cpp
index f4ada01b0d8..4d7633337a6 100644
--- a/engines/kyra/engine/kyra_mr.cpp
+++ b/engines/kyra/engine/kyra_mr.cpp
@@ -62,11 +62,11 @@ KyraEngine_MR::KyraEngine_MR(OSystem *system, const GameFlags &flags) : KyraEngi
_gamePlayBuffer = nullptr;
_interface = _interfaceCommandLine = nullptr;
// The slightly larger interface is used in the Chinese version regardless of the actual language setting.
- _interfaceCommandLineSize = flags.hasExtraLanguage ? 4800 : 3840;
+ _interfaceCommandLineSize = flags.extraLang != Common::UNK_LANG ? 4800 : 3840;
_interfaceCommandLineH = _interfaceCommandLineSize / Screen::SCREEN_W;
_interfaceCommandLineY1 = Screen::SCREEN_H - _interfaceCommandLineH;
_interfaceCommandLineY2 = 156 - _interfaceCommandLineH;
- _interfaceSize = flags.hasExtraLanguage ? 18880 : 17920;
+ _interfaceSize = flags.extraLang != Common::UNK_LANG ? 18880 : 17920;
_interfaceH = _interfaceSize / Screen::SCREEN_W;
_costPalBuffer = nullptr;
memset(_sceneShapes, 0, sizeof(_sceneShapes));
@@ -213,6 +213,13 @@ Common::Error KyraEngine_MR::init() {
setDebugger(new Debugger_v2(this));
+ // Unfortunately, if this is a Chinese version, but the language has been set to English, French or German
+ // we still don't know at this point if this is a Simplified or Traditional Chinese version. We just analyze
+ // some file...
+ if (_flags.extraLang != Common::UNK_LANG && _flags.extraLang != _flags.lang) {
+
+ }
+
KyraEngine_v1::init();
initStaticResource();
@@ -229,14 +236,12 @@ Common::Error KyraEngine_MR::init() {
_screen->loadFont(Screen::FID_BOOKFONT_FNT, "BOOKFONT.FNT");
_screen->setFont(Screen::FID_8_FNT);
- if (_flags.hasExtraLanguage) {
- // We don't check the language setting here, since we want to load the file even if the language is currently set to English, French or German.
- if (_res->exists("MALCOLM.PAK")) {
- _screen->loadFont(Screen::FID_CHINESE_FNT, "MALCOLM.PAK");
- if (_lang == 3) {
- _screen->setFont(Screen::FID_CHINESE_FNT);
- _screen->_lineSpacing = 2;
- }
+ // We don't check the language setting here, since we want to load the file even if the language is currently set to English, French or German.
+ if (_res->exists("MALCOLM.PAK")) {
+ _screen->loadFont(Screen::FID_CHINESE_FNT, "MALCOLM.PAK");
+ if (_lang == 3) {
+ _screen->setFont(Screen::FID_CHINESE_FNT);
+ _screen->_lineSpacing = 2;
}
}
diff --git a/engines/kyra/engine/kyra_v2.cpp b/engines/kyra/engine/kyra_v2.cpp
index c81f95ec2ff..1b0c1d3a81c 100644
--- a/engines/kyra/engine/kyra_v2.cpp
+++ b/engines/kyra/engine/kyra_v2.cpp
@@ -28,7 +28,7 @@
namespace Kyra {
-KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const EngineDesc &desc) : KyraEngine_v1(system, flags), _desc(desc), _langIntern(0), _numLang(flags.hasExtraLanguage ? 4 : 3) {
+KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const EngineDesc &desc) : KyraEngine_v1(system, flags), _desc(desc), _langIntern(0), _numLang(flags.extraLang != Common::UNK_LANG ? 4 : 3) {
memset(&_sceneAnims, 0, sizeof(_sceneAnims));
memset(&_sceneAnimMovie, 0, sizeof(_sceneAnimMovie));
@@ -81,6 +81,9 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const Engi
if (lang == _flags.fanLang && _flags.replacedLang != Common::UNK_LANG)
lang = _flags.replacedLang;
+ if (_flags.extraLang == Common::ZH_TWN)
+ _langIntern = 1;
+
switch (lang) {
case Common::EN_ANY:
case Common::EN_USA:
@@ -98,7 +101,7 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const Engi
case Common::ZH_TWN:
_langIntern = 1;
- if (!_flags.hasExtraLanguage) // HOF Floppy uses ENG extensions...
+ if (_flags.extraLang == Common::UNK_LANG) // HOF Floppy uses ENG extensions...
break;
// fall through
diff --git a/engines/kyra/graphics/screen_mr.cpp b/engines/kyra/graphics/screen_mr.cpp
index 0da7d7a0ed5..9426a3619ae 100644
--- a/engines/kyra/graphics/screen_mr.cpp
+++ b/engines/kyra/graphics/screen_mr.cpp
@@ -25,7 +25,7 @@
namespace Kyra {
Screen_MR::Screen_MR(KyraEngine_MR *vm, OSystem *system)
- : Screen_v2(vm, system, _screenDimTable, _screenDimTableCount), _interfaceCommandLineY1(vm->gameFlags().hasExtraLanguage ? 185 : 188) {
+ : Screen_v2(vm, system, _screenDimTable, _screenDimTableCount), _interfaceCommandLineY1(vm->gameFlags().extraLang != Common::UNK_LANG ? 185 : 188) {
}
Screen_MR::~Screen_MR() {
diff --git a/engines/kyra/gui/gui_mr.cpp b/engines/kyra/gui/gui_mr.cpp
index 2e022881330..dcb0c8407ec 100644
--- a/engines/kyra/gui/gui_mr.cpp
+++ b/engines/kyra/gui/gui_mr.cpp
@@ -359,7 +359,7 @@ void KyraEngine_MR::drawMalcolmsMoodText() {
_text->printText(string, x + 1, y, 0xFF, 0x00, 0x00);
_screen->setFontStyles(_screen->_currentFont, Font::kStyleBorder);
} else {
- _text->printText(string, x, y + (_flags.hasExtraLanguage ? 3 : 1), 0xFF, 0xF0, 0x00);
+ _text->printText(string, x, y + (_flags.extraLang != Common::UNK_LANG ? 3 : 1), 0xFF, 0xF0, 0x00);
}
_screen->_curPage = pageBackUp;
}
Commit: 22e33f97b91457183fa53614714d341d7a95ef71
https://github.com/scummvm/scummvm/commit/22e33f97b91457183fa53614714d341d7a95ef71
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-28T00:36:37+02:00
Commit Message:
KYRA: (MR/ZH) - fix ZH font issue when language is set to other than ZH (Step 2)
Allow reloading individual kyradat resources with a different language. Until now, our multi-language games did not require this, but for more or less random reasons (e. g. it just isn't possible to restart the intro or the main menu after changing the language ingame). However, the Chinese MR versions require this for the font loading.
Changed paths:
engines/kyra/graphics/screen.cpp
engines/kyra/resource/resource.h
engines/kyra/resource/staticres.cpp
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 54c23b63bd4..d72852b8bc6 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -1391,6 +1391,7 @@ bool Screen::loadFont(FontId fontId, const char *filename) {
fa->push_back(fn1);
fa->push_back(fn2);
fnt = new MultiSubsetFont(fa);
+ _vm->staticres()->renewPrefetchIdWithCustomLanguage(k2FontData, _vm->gameFlags().extraLang);
const uint8 *oneByteData = _vm->staticres()->loadRawData(k2FontData, temp);
Common::MemoryReadStream str(oneByteData, temp);
fnt->load(str);
diff --git a/engines/kyra/resource/resource.h b/engines/kyra/resource/resource.h
index 08fa13d080b..a7e8d23b1ee 100644
--- a/engines/kyra/resource/resource.h
+++ b/engines/kyra/resource/resource.h
@@ -1280,9 +1280,11 @@ public:
// can't be loaded and it breaks then the first res
// can't be loaded
bool prefetchId(int id);
+ bool renewPrefetchIdWithCustomLanguage(int id, Common::Language lang);
void unloadId(int id);
private:
bool tryKyraDatLoad();
+ Common::SeekableReadStream *loadIdMap(Common::Language lang);
KyraEngine_v1 *_vm;
diff --git a/engines/kyra/resource/staticres.cpp b/engines/kyra/resource/staticres.cpp
index 1df3deab3ea..acbeaed892b 100644
--- a/engines/kyra/resource/staticres.cpp
+++ b/engines/kyra/resource/staticres.cpp
@@ -100,8 +100,8 @@ const IndexTable iLanguageTable[] = {
{ -1, -1 }
};
-byte getLanguageID(const GameFlags &flags) {
- return Common::find(iLanguageTable, ARRAYEND(iLanguageTable) - 1, flags.lang)->value;
+byte getLanguageID(Common::Language lang) {
+ return Common::find(iLanguageTable, ARRAYEND(iLanguageTable) - 1, lang)->value;
}
const IndexTable iPlatformTable[] = {
@@ -174,31 +174,57 @@ bool StaticResource::loadStaticResourceFile() {
}
bool StaticResource::tryKyraDatLoad() {
+ Common::SeekableReadStream *idMap = loadIdMap(_vm->gameFlags().lang);
+ if (!idMap)
+ return false;
+
+ uint16 numIDs = idMap->readUint16BE();
+ while (numIDs--) {
+ uint16 id = idMap->readUint16BE();
+ uint8 type = idMap->readByte();
+ uint32 filename = idMap->readUint32BE();
+
+ _dataTable[id] = DataDescriptor(filename, type);
+ }
+
+ const bool fileError = idMap->err();
+ delete idMap;
+ if (fileError)
+ return false;
+
+ // load all tables for now
+ if (!prefetchId(-1))
+ return false;
+
+ return true;
+}
+
+Common::SeekableReadStream *StaticResource::loadIdMap(Common::Language lang) {
Common::SeekableReadStream *index = _vm->resource()->createReadStream("INDEX");
if (!index)
- return false;
+ return 0;
const uint32 version = index->readUint32BE();
if (version != RESFILE_VERSION) {
delete index;
- return false;
+ return 0;
}
const uint32 includedGames = index->readUint32BE();
if (includedGames * 2 + 8 != (uint32)index->size()) {
delete index;
- return false;
+ return 0;
}
const GameFlags &flags = _vm->gameFlags();
const byte game = getGameID(flags) & 0xF;
const byte platform = getPlatformID(flags) & 0xF;
const byte special = getSpecialID(flags) & 0xF;
- const byte lang = getLanguageID(flags) & 0xF;
+ const byte lng = getLanguageID(lang) & 0xF;
- const uint16 gameDef = (game << 12) | (platform << 8) | (special << 4) | (lang << 0);
+ const uint16 gameDef = (game << 12) | (platform << 8) | (special << 4) | (lng << 0);
bool found = false;
for (uint32 i = 0; i < includedGames; ++i) {
@@ -212,34 +238,12 @@ bool StaticResource::tryKyraDatLoad() {
index = nullptr;
if (!found)
- return false;
+ return 0;
// load the ID map for our game
- const Common::String filenamePattern = Common::String::format("0%01X%01X%01X000%01X", game, platform, special, lang);
- Common::SeekableReadStream *idMap = _vm->resource()->createReadStream(filenamePattern);
- if (!idMap)
- return false;
-
- uint16 numIDs = idMap->readUint16BE();
- while (numIDs--) {
- uint16 id = idMap->readUint16BE();
- uint8 type = idMap->readByte();
- uint32 filename = idMap->readUint32BE();
-
- _dataTable[id] = DataDescriptor(filename, type);
- }
-
- const bool fileError = idMap->err();
- delete idMap;
- if (fileError)
- return false;
-
- // load all tables for now
- if (!prefetchId(-1))
- return false;
-
- return true;
+ const Common::String filenamePattern = Common::String::format("0%01X%01X%01X000%01X", game, platform, special, lng);
+ return _vm->resource()->createReadStream(filenamePattern);
}
bool StaticResource::init() {
@@ -370,6 +374,35 @@ bool StaticResource::prefetchId(int id) {
return true;
}
+bool StaticResource::renewPrefetchIdWithCustomLanguage(int id, Common::Language lang) {
+ if (lang != Common::UNK_LANG) {
+ unloadId(id);
+
+ // load the ID map for our game
+ Common::SeekableReadStream *idMap = loadIdMap(lang);
+ if (!idMap)
+ return false;
+
+ uint16 numIDs = idMap->readUint16BE();
+ while (numIDs--) {
+ uint16 id2 = idMap->readUint16BE();
+ uint8 type = idMap->readByte();
+ uint32 filename = idMap->readUint32BE();
+ if (id2 != id)
+ continue;
+ _dataTable[id] = DataDescriptor(filename, type);
+ break;
+ }
+
+ const bool fileError = idMap->err();
+ delete idMap;
+ if (!numIDs || fileError)
+ return false;
+ }
+
+ return prefetchId(id);
+}
+
void StaticResource::unloadId(int id) {
Common::List<ResData>::iterator pos = _resList.begin();
for (; pos != _resList.end();) {
More information about the Scummvm-git-logs
mailing list