MOHAWK: RIVEN: Allow changing the game language at run-time
This commit is contained in:
parent
1f5d4d1fdd
commit
195d593405
10 changed files with 187 additions and 169 deletions
|
@ -208,6 +208,8 @@ public:
|
||||||
return "Myst and Riven (C) Cyan Worlds\nMohawk OS (C) Ubisoft";
|
return "Myst and Riven (C) Cyan Worlds\nMohawk OS (C) Ubisoft";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DetectedGames detectGames(const Common::FSList &fslist) const override;
|
||||||
|
|
||||||
bool hasFeature(MetaEngineFeature f) const override;
|
bool hasFeature(MetaEngineFeature f) const override;
|
||||||
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
|
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
|
||||||
SaveStateList listSaves(const char *target) const override;
|
SaveStateList listSaves(const char *target) const override;
|
||||||
|
@ -220,6 +222,29 @@ public:
|
||||||
GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DetectedGames MohawkMetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||||
|
DetectedGames detectedGames = AdvancedMetaEngine::detectGames(fslist);
|
||||||
|
|
||||||
|
// The AdvancedDetector model only allows specifying a single supported
|
||||||
|
// game language. The 25th anniversary edition Myst games are multilanguage.
|
||||||
|
// Here we amend the detected games to set the list of supported languages.
|
||||||
|
for (uint i = 0; i < detectedGames.size(); i++) {
|
||||||
|
DetectedGame &game = detectedGames[i];
|
||||||
|
#ifdef ENABLE_RIVEN
|
||||||
|
if (game.gameId == "riven"
|
||||||
|
&& Common::checkGameGUIOption(GAMEOPTION_25TH, game.getGUIOptions())) {
|
||||||
|
const Mohawk::RivenLanguage *languages = Mohawk::MohawkEngine_Riven::listLanguages();
|
||||||
|
while (languages->language != Common::UNK_LANG) {
|
||||||
|
game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(languages->language));
|
||||||
|
languages++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return detectedGames;
|
||||||
|
}
|
||||||
|
|
||||||
bool MohawkMetaEngine::hasFeature(MetaEngineFeature f) const {
|
bool MohawkMetaEngine::hasFeature(MetaEngineFeature f) const {
|
||||||
return
|
return
|
||||||
(f == kSupportsListSaves)
|
(f == kSupportsListSaves)
|
||||||
|
|
|
@ -676,174 +676,29 @@ static const MohawkGameDescription gameDescriptions[] = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Riven: The Sequel to Myst - 25th anniversary
|
// Riven: The Sequel to Myst - 25th anniversary
|
||||||
// English - Created by the ScummVM team
|
// Created by the ScummVM team
|
||||||
{
|
|
||||||
{
|
|
||||||
"riven",
|
|
||||||
"25th Anniversary",
|
|
||||||
{
|
|
||||||
// The french datafile is included in the list because
|
|
||||||
// in the 25th anniversary edition, all the files sit in the same
|
|
||||||
// package. All the detection entries need to have the same amount
|
|
||||||
// of files to show in the detection results.
|
|
||||||
{ "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
|
|
||||||
{ "a_data_french.mhk", 0, "ad7547ed7159a97be98a005f62862f85", 7088579 },
|
|
||||||
AD_LISTEND
|
|
||||||
},
|
|
||||||
Common::EN_ANY,
|
|
||||||
Common::kPlatformWindows,
|
|
||||||
ADGF_DROPPLATFORM,
|
|
||||||
GUI_OPTIONS_RIVEN_25TH
|
|
||||||
},
|
|
||||||
GType_RIVEN,
|
|
||||||
GF_DVD | GF_25TH,
|
|
||||||
0,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Riven: The Sequel to Myst - 25th anniversary
|
|
||||||
// French - Created by the ScummVM team
|
|
||||||
{
|
|
||||||
{
|
|
||||||
"riven",
|
|
||||||
"25th Anniversary",
|
|
||||||
{
|
|
||||||
{ "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
|
|
||||||
{ "a_data_french.mhk", 0, "ad7547ed7159a97be98a005f62862f85", 7088579 },
|
|
||||||
AD_LISTEND
|
|
||||||
},
|
|
||||||
Common::FR_FRA,
|
|
||||||
Common::kPlatformWindows,
|
|
||||||
ADGF_DROPPLATFORM,
|
|
||||||
GUI_OPTIONS_RIVEN_25TH
|
|
||||||
},
|
|
||||||
GType_RIVEN,
|
|
||||||
GF_DVD | GF_25TH | GF_LANGUAGE_FILES,
|
|
||||||
0,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Riven: The Sequel to Myst - 25th anniversary
|
|
||||||
// German - Created by the ScummVM team
|
|
||||||
{
|
|
||||||
{
|
|
||||||
"riven",
|
|
||||||
"25th Anniversary",
|
|
||||||
{
|
|
||||||
{ "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
|
|
||||||
{ "a_data_german.mhk", 0, "5ebd301bd4bf6fd7667c4a46eebf6532", 7098655 },
|
|
||||||
AD_LISTEND
|
|
||||||
},
|
|
||||||
Common::DE_DEU,
|
|
||||||
Common::kPlatformWindows,
|
|
||||||
ADGF_DROPPLATFORM,
|
|
||||||
GUI_OPTIONS_RIVEN_25TH
|
|
||||||
},
|
|
||||||
GType_RIVEN,
|
|
||||||
GF_DVD | GF_25TH | GF_LANGUAGE_FILES,
|
|
||||||
0,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Riven: The Sequel to Myst - 25th anniversary
|
|
||||||
// Italian - Created by the ScummVM team
|
|
||||||
{
|
|
||||||
{
|
|
||||||
"riven",
|
|
||||||
"25th Anniversary",
|
|
||||||
{
|
|
||||||
{ "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
|
|
||||||
{ "a_data_italian.mhk", 0, "9d53b178510ce90f10b32ad3ca967d38", 6677740 },
|
|
||||||
AD_LISTEND
|
|
||||||
},
|
|
||||||
Common::IT_ITA,
|
|
||||||
Common::kPlatformWindows,
|
|
||||||
ADGF_DROPPLATFORM,
|
|
||||||
GUI_OPTIONS_RIVEN_25TH
|
|
||||||
},
|
|
||||||
GType_RIVEN,
|
|
||||||
GF_DVD | GF_25TH | GF_LANGUAGE_FILES,
|
|
||||||
0,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Riven: The Sequel to Myst - 25th anniversary
|
|
||||||
// Japanese - Created by the ScummVM team
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"riven",
|
"riven",
|
||||||
"25th Anniversary",
|
"25th Anniversary",
|
||||||
{
|
{
|
||||||
{ "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
|
{ "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
|
||||||
{ "a_data_japanese.mhk", 0, "bf43cf8af21fefc5a02881f7cfb68f52", 7237370 },
|
{ "a_data_french.mhk", 0, "ad7547ed7159a97be98a005f62862f85", 7088579 },
|
||||||
|
{ "a_data_german.mhk", 0, "5ebd301bd4bf6fd7667c4a46eebf6532", 7098655 },
|
||||||
|
{ "a_data_italian.mhk", 0, "9d53b178510ce90f10b32ad3ca967d38", 6677740 },
|
||||||
|
{ "a_data_japanese.mhk", 0, "bf43cf8af21fefc5a02881f7cfb68f52", 7237370 },
|
||||||
|
{ "a_data_polish.mhk", 0, "5c7cd4b1a1a4c63cc670485816b0b5ec", 14588293 },
|
||||||
|
{ "a_data_russian.mhk", 0, "76e12906637f5274bb6af8ab42871c25", 14349136 },
|
||||||
|
{ "a_data_spanish.mhk", 0, "6226a3e1748e64962971b2f6536ef283", 8133297 },
|
||||||
AD_LISTEND
|
AD_LISTEND
|
||||||
},
|
},
|
||||||
Common::JA_JPN,
|
Common::UNK_LANG,
|
||||||
Common::kPlatformWindows,
|
Common::kPlatformWindows,
|
||||||
ADGF_DROPPLATFORM,
|
ADGF_DROPPLATFORM,
|
||||||
GUI_OPTIONS_RIVEN_25TH
|
GUI_OPTIONS_RIVEN_25TH
|
||||||
},
|
},
|
||||||
GType_RIVEN,
|
GType_RIVEN,
|
||||||
GF_DVD | GF_25TH | GF_LANGUAGE_FILES,
|
GF_DVD | GF_25TH,
|
||||||
0,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Riven: The Sequel to Myst - 25th anniversary
|
|
||||||
// Polish - Created by the ScummVM team
|
|
||||||
{
|
|
||||||
{
|
|
||||||
"riven",
|
|
||||||
"25th Anniversary",
|
|
||||||
{
|
|
||||||
{ "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
|
|
||||||
{ "a_data_polish.mhk", 0, "5c7cd4b1a1a4c63cc670485816b0b5ec", 14588293 },
|
|
||||||
AD_LISTEND
|
|
||||||
},
|
|
||||||
Common::PL_POL,
|
|
||||||
Common::kPlatformWindows,
|
|
||||||
ADGF_DROPPLATFORM,
|
|
||||||
GUI_OPTIONS_RIVEN_25TH
|
|
||||||
},
|
|
||||||
GType_RIVEN,
|
|
||||||
GF_DVD | GF_25TH | GF_LANGUAGE_FILES,
|
|
||||||
0,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Riven: The Sequel to Myst - 25th anniversary
|
|
||||||
// Russian - Created by the ScummVM team
|
|
||||||
{
|
|
||||||
{
|
|
||||||
"riven",
|
|
||||||
"25th Anniversary",
|
|
||||||
{
|
|
||||||
{ "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
|
|
||||||
{ "a_data_russian.mhk", 0, "76e12906637f5274bb6af8ab42871c25", 14349136 },
|
|
||||||
AD_LISTEND
|
|
||||||
},
|
|
||||||
Common::RU_RUS,
|
|
||||||
Common::kPlatformWindows,
|
|
||||||
ADGF_DROPPLATFORM,
|
|
||||||
GUI_OPTIONS_RIVEN_25TH
|
|
||||||
},
|
|
||||||
GType_RIVEN,
|
|
||||||
GF_DVD | GF_25TH | GF_LANGUAGE_FILES,
|
|
||||||
0,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Riven: The Sequel to Myst - 25th anniversary
|
|
||||||
// Spanish - Created by the ScummVM team
|
|
||||||
{
|
|
||||||
{
|
|
||||||
"riven",
|
|
||||||
"25th Anniversary",
|
|
||||||
{
|
|
||||||
{ "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
|
|
||||||
{ "a_data_spanish.mhk", 0, "6226a3e1748e64962971b2f6536ef283", 8133297 },
|
|
||||||
AD_LISTEND
|
|
||||||
},
|
|
||||||
Common::ES_ESP,
|
|
||||||
Common::kPlatformWindows,
|
|
||||||
ADGF_DROPPLATFORM,
|
|
||||||
GUI_OPTIONS_RIVEN_25TH
|
|
||||||
},
|
|
||||||
GType_RIVEN,
|
|
||||||
GF_DVD | GF_25TH | GF_LANGUAGE_FILES,
|
|
||||||
0,
|
0,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,10 @@ void MystMenuDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint3
|
||||||
#ifdef ENABLE_RIVEN
|
#ifdef ENABLE_RIVEN
|
||||||
|
|
||||||
RivenOptionsWidget::RivenOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
|
RivenOptionsWidget::RivenOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
|
||||||
OptionsContainerWidget(boss, name, "RivenOptionsDialog", false, domain) {
|
OptionsContainerWidget(boss, name, "RivenOptionsDialog", false, domain),
|
||||||
|
_languagePopUp(nullptr) {
|
||||||
|
Common::String guiOptions = ConfMan.get("guioptions", domain);
|
||||||
|
bool is25th = checkGameGUIOption(GAMEOPTION_25TH, guiOptions);
|
||||||
|
|
||||||
_zipModeCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "RivenOptionsDialog.ZipMode", _("~Z~ip Mode Activated"));
|
_zipModeCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "RivenOptionsDialog.ZipMode", _("~Z~ip Mode Activated"));
|
||||||
_waterEffectCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "RivenOptionsDialog.WaterEffect", _("~W~ater Effect Enabled"));
|
_waterEffectCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "RivenOptionsDialog.WaterEffect", _("~W~ater Effect Enabled"));
|
||||||
|
@ -269,6 +272,27 @@ RivenOptionsWidget::RivenOptionsWidget(GuiObject *boss, const Common::String &na
|
||||||
_transitionModePopUp->appendEntry(_("Fastest"), kRivenTransitionModeFastest);
|
_transitionModePopUp->appendEntry(_("Fastest"), kRivenTransitionModeFastest);
|
||||||
_transitionModePopUp->appendEntry(_("Normal"), kRivenTransitionModeNormal);
|
_transitionModePopUp->appendEntry(_("Normal"), kRivenTransitionModeNormal);
|
||||||
_transitionModePopUp->appendEntry(_("Best"), kRivenTransitionModeBest);
|
_transitionModePopUp->appendEntry(_("Best"), kRivenTransitionModeBest);
|
||||||
|
|
||||||
|
// Only the 25th anniversary edition is multi-language
|
||||||
|
// Only allow changing the language at run-time, so that there is only one
|
||||||
|
// language selection drop down in the edit game dialog.
|
||||||
|
if (is25th && g_engine) {
|
||||||
|
bool canChangeLanguage = true;
|
||||||
|
MohawkEngine_Riven *vm = static_cast<MohawkEngine_Riven *>(g_engine);
|
||||||
|
canChangeLanguage = vm->isInteractive();
|
||||||
|
|
||||||
|
GUI::StaticTextWidget *languageCaption = new GUI::StaticTextWidget(widgetsBoss(), "RivenOptionsDialog.LanguageDesc", _("Language:"));
|
||||||
|
languageCaption->setAlign(Graphics::kTextAlignRight);
|
||||||
|
|
||||||
|
_languagePopUp = new GUI::PopUpWidget(widgetsBoss(), "RivenOptionsDialog.Language");
|
||||||
|
_languagePopUp->setEnabled(canChangeLanguage);
|
||||||
|
|
||||||
|
const RivenLanguage *languages = MohawkEngine_Riven::listLanguages();
|
||||||
|
while (languages->language != Common::UNK_LANG) {
|
||||||
|
_languagePopUp->appendEntry(Common::getLanguageDescription(languages->language), languages->language);
|
||||||
|
languages++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RivenOptionsWidget::~RivenOptionsWidget() {
|
RivenOptionsWidget::~RivenOptionsWidget() {
|
||||||
|
@ -285,6 +309,11 @@ void RivenOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::Str
|
||||||
.addWidget("TransistionsDesc", "OptionsLabel")
|
.addWidget("TransistionsDesc", "OptionsLabel")
|
||||||
.addWidget("Transistions", "PopUp")
|
.addWidget("Transistions", "PopUp")
|
||||||
.closeLayout()
|
.closeLayout()
|
||||||
|
.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
|
||||||
|
.addPadding(0, 0, 0, 0)
|
||||||
|
.addWidget("LanguageDesc", "OptionsLabel")
|
||||||
|
.addWidget("Language", "PopUp")
|
||||||
|
.closeLayout()
|
||||||
.closeLayout()
|
.closeLayout()
|
||||||
.closeDialog();
|
.closeDialog();
|
||||||
}
|
}
|
||||||
|
@ -295,6 +324,14 @@ void RivenOptionsWidget::load() {
|
||||||
|
|
||||||
uint32 transitions = ConfMan.getInt("transition_mode", _domain);
|
uint32 transitions = ConfMan.getInt("transition_mode", _domain);
|
||||||
_transitionModePopUp->setSelectedTag(RivenGraphics::sanitizeTransitionMode(transitions));
|
_transitionModePopUp->setSelectedTag(RivenGraphics::sanitizeTransitionMode(transitions));
|
||||||
|
|
||||||
|
if (_languagePopUp) {
|
||||||
|
Common::Language language = Common::parseLanguage(ConfMan.get("language", _domain));
|
||||||
|
const RivenLanguage *languageDesc = MohawkEngine_Riven::getLanguageDesc(language);
|
||||||
|
if (languageDesc) {
|
||||||
|
_languagePopUp->setSelectedTag(languageDesc->language);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RivenOptionsWidget::save() {
|
bool RivenOptionsWidget::save() {
|
||||||
|
@ -302,6 +339,18 @@ bool RivenOptionsWidget::save() {
|
||||||
ConfMan.setBool("water_effects", _waterEffectCheckbox->getState(), _domain);
|
ConfMan.setBool("water_effects", _waterEffectCheckbox->getState(), _domain);
|
||||||
ConfMan.setInt("transition_mode", _transitionModePopUp->getSelectedTag(), _domain);
|
ConfMan.setInt("transition_mode", _transitionModePopUp->getSelectedTag(), _domain);
|
||||||
|
|
||||||
|
if (_languagePopUp) {
|
||||||
|
int32 selectedLanguage = _languagePopUp->getSelectedTag();
|
||||||
|
const RivenLanguage *languageDesc = nullptr;
|
||||||
|
if (selectedLanguage >= 0) {
|
||||||
|
languageDesc = MohawkEngine_Riven::getLanguageDesc(static_cast<Common::Language>(selectedLanguage));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (languageDesc != nullptr) {
|
||||||
|
ConfMan.set("language", Common::getLanguageCode(languageDesc->language));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,7 @@ private:
|
||||||
GUI::CheckboxWidget *_zipModeCheckbox;
|
GUI::CheckboxWidget *_zipModeCheckbox;
|
||||||
GUI::CheckboxWidget *_waterEffectCheckbox;
|
GUI::CheckboxWidget *_waterEffectCheckbox;
|
||||||
GUI::PopUpWidget *_transitionModePopUp;
|
GUI::PopUpWidget *_transitionModePopUp;
|
||||||
|
GUI::PopUpWidget *_languagePopUp;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,10 +45,7 @@ MohawkEngine::MohawkEngine(OSystem *syst, const MohawkGameDescription *gamedesc)
|
||||||
MohawkEngine::~MohawkEngine() {
|
MohawkEngine::~MohawkEngine() {
|
||||||
delete _pauseDialog;
|
delete _pauseDialog;
|
||||||
delete _cursor;
|
delete _cursor;
|
||||||
|
closeAllArchives();
|
||||||
for (uint32 i = 0; i < _mhk.size(); i++)
|
|
||||||
delete _mhk[i];
|
|
||||||
_mhk.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error MohawkEngine::run() {
|
Common::Error MohawkEngine::run() {
|
||||||
|
@ -110,4 +107,11 @@ Common::String MohawkEngine::getResourceName(uint32 tag, uint16 id) {
|
||||||
error("Could not find a \'%s\' resource with ID %04x", tag2str(tag), id);
|
error("Could not find a \'%s\' resource with ID %04x", tag2str(tag), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MohawkEngine::closeAllArchives() {
|
||||||
|
for (uint32 i = 0; i < _mhk.size(); i++)
|
||||||
|
delete _mhk[i];
|
||||||
|
|
||||||
|
_mhk.clear();
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Mohawk
|
} // End of namespace Mohawk
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
const char *getAppName() const;
|
const char *getAppName() const;
|
||||||
Common::Platform getPlatform() const;
|
Common::Platform getPlatform() const;
|
||||||
uint8 getGameType() const;
|
uint8 getGameType() const;
|
||||||
Common::Language getLanguage() const;
|
virtual Common::Language getLanguage() const;
|
||||||
Common::String getDatafileLanguageName(const char *prefix) const;
|
Common::String getDatafileLanguageName(const char *prefix) const;
|
||||||
|
|
||||||
bool hasFeature(EngineFeature f) const override;
|
bool hasFeature(EngineFeature f) const override;
|
||||||
|
@ -104,6 +104,7 @@ public:
|
||||||
uint32 getResourceOffset(uint32 tag, uint16 id);
|
uint32 getResourceOffset(uint32 tag, uint16 id);
|
||||||
uint16 findResourceID(uint32 type, const Common::String &resName);
|
uint16 findResourceID(uint32 type, const Common::String &resName);
|
||||||
Common::String getResourceName(uint32 tag, uint16 id);
|
Common::String getResourceName(uint32 tag, uint16 id);
|
||||||
|
void closeAllArchives();
|
||||||
|
|
||||||
void pauseGame();
|
void pauseGame();
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio
|
||||||
_card = nullptr;
|
_card = nullptr;
|
||||||
_inventory = nullptr;
|
_inventory = nullptr;
|
||||||
_lastSaveTime = 0;
|
_lastSaveTime = 0;
|
||||||
|
_currentLanguage = getLanguage();
|
||||||
|
|
||||||
_menuSavedCard = -1;
|
_menuSavedCard = -1;
|
||||||
_menuSavedStack = -1;
|
_menuSavedStack = -1;
|
||||||
|
@ -385,15 +386,13 @@ void MohawkEngine_Riven::changeToStack(uint16 stackId) {
|
||||||
_gfx->clearCache();
|
_gfx->clearCache();
|
||||||
|
|
||||||
// Clear the old stack files out
|
// Clear the old stack files out
|
||||||
for (uint32 i = 0; i < _mhk.size(); i++)
|
closeAllArchives();
|
||||||
delete _mhk[i];
|
|
||||||
_mhk.clear();
|
|
||||||
|
|
||||||
// Get the prefix character for the destination stack
|
// Get the prefix character for the destination stack
|
||||||
char prefix = RivenStacks::getName(stackId)[0];
|
char prefix = RivenStacks::getName(stackId)[0];
|
||||||
|
|
||||||
// Load the localization override file if any
|
// Load the localization override file if any
|
||||||
if (getFeatures() & GF_LANGUAGE_FILES) {
|
if (getFeatures() & GF_25TH) {
|
||||||
loadLanguageDatafile(prefix, stackId);
|
loadLanguageDatafile(prefix, stackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,6 +420,17 @@ void MohawkEngine_Riven::changeToStack(uint16 stackId) {
|
||||||
_stack->onMouseMove(getEventManager()->getMousePos());
|
_stack->onMouseMove(getEventManager()->getMousePos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MohawkEngine_Riven::reloadCurrentCard() {
|
||||||
|
assert(_stack && _card);
|
||||||
|
|
||||||
|
uint16 cardId = _card->getId();
|
||||||
|
|
||||||
|
closeAllArchives();
|
||||||
|
|
||||||
|
changeToStack(_stack->getId());
|
||||||
|
changeToCard(cardId);
|
||||||
|
}
|
||||||
|
|
||||||
const char **MohawkEngine_Riven::listExpectedDatafiles() const {
|
const char **MohawkEngine_Riven::listExpectedDatafiles() const {
|
||||||
// The files are in reverse order because of the way the 1.02 patch works.
|
// The files are in reverse order because of the way the 1.02 patch works.
|
||||||
// The only "Data3" file is j_Data3.mhk from that patch. Patch files have higher
|
// The only "Data3" file is j_Data3.mhk from that patch. Patch files have higher
|
||||||
|
@ -497,13 +507,43 @@ bool MohawkEngine_Riven::checkDatafiles() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const RivenLanguage *MohawkEngine_Riven::listLanguages() {
|
||||||
|
static const RivenLanguage languages[] = {
|
||||||
|
{ Common::EN_ANY, "english" },
|
||||||
|
{ Common::FR_FRA, "french" },
|
||||||
|
{ Common::DE_DEU, "german" },
|
||||||
|
{ Common::IT_ITA, "italian" },
|
||||||
|
{ Common::JA_JPN, "japanese" },
|
||||||
|
{ Common::PL_POL, "polish" },
|
||||||
|
{ Common::RU_RUS, "russian" },
|
||||||
|
{ Common::ES_ESP, "spanish" },
|
||||||
|
{ Common::UNK_LANG, nullptr }
|
||||||
|
};
|
||||||
|
return languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RivenLanguage *MohawkEngine_Riven::getLanguageDesc(Common::Language language) {
|
||||||
|
const RivenLanguage *languages = listLanguages();
|
||||||
|
|
||||||
|
while (languages->language != Common::UNK_LANG) {
|
||||||
|
if (languages->language == language) {
|
||||||
|
return languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
languages++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void MohawkEngine_Riven::loadLanguageDatafile(char prefix, uint16 stackId) {
|
void MohawkEngine_Riven::loadLanguageDatafile(char prefix, uint16 stackId) {
|
||||||
Common::String language = getDatafileLanguageName("a_data_");
|
Common::Language language = getLanguage();
|
||||||
if (language.empty()) {
|
const RivenLanguage *languageDesc = getLanguageDesc(language);
|
||||||
|
if (!languageDesc) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String languageDatafile = Common::String::format("%c_data_%s.mhk", prefix, language.c_str());
|
Common::String languageDatafile = Common::String::format("%c_data_%s.mhk", prefix, languageDesc->archiveSuffix);
|
||||||
|
|
||||||
MohawkArchive *mhk = new MohawkArchive();
|
MohawkArchive *mhk = new MohawkArchive();
|
||||||
if (mhk->openFile(languageDatafile)) {
|
if (mhk->openFile(languageDatafile)) {
|
||||||
|
@ -718,6 +758,21 @@ Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Common::Language MohawkEngine_Riven::getLanguage() const {
|
||||||
|
Common::Language language = MohawkEngine::getLanguage();
|
||||||
|
|
||||||
|
// The language can be changed at run time in the 25th anniversary edition
|
||||||
|
if (language == Common::UNK_LANG) {
|
||||||
|
language = Common::parseLanguage(ConfMan.get("language"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (language == Common::UNK_LANG) {
|
||||||
|
language = Common::EN_ANY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
void MohawkEngine_Riven::saveGameStateAndDisplayError(int slot, const Common::String &desc) {
|
void MohawkEngine_Riven::saveGameStateAndDisplayError(int slot, const Common::String &desc) {
|
||||||
assert(slot >= 0 && !desc.empty());
|
assert(slot >= 0 && !desc.empty());
|
||||||
|
|
||||||
|
@ -799,11 +854,22 @@ void MohawkEngine_Riven::applyGameSettings() {
|
||||||
|
|
||||||
_gfx->setTransitionMode(transitionsMode);
|
_gfx->setTransitionMode(transitionsMode);
|
||||||
|
|
||||||
|
Common::Language newLanguage = getLanguage();
|
||||||
|
if (_stack && newLanguage != _currentLanguage) {
|
||||||
|
_gfx->loadMenuFont();
|
||||||
|
reloadCurrentCard();
|
||||||
|
}
|
||||||
|
_currentLanguage = newLanguage;
|
||||||
|
|
||||||
if (_card) {
|
if (_card) {
|
||||||
_card->initializeZipMode();
|
_card->initializeZipMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MohawkEngine_Riven::isInteractive() const {
|
||||||
|
return !_scriptMan->hasQueuedScripts() && !hasGameEnded();
|
||||||
|
}
|
||||||
|
|
||||||
void MohawkEngine_Riven::registerDefaultSettings() {
|
void MohawkEngine_Riven::registerDefaultSettings() {
|
||||||
ConfMan.registerDefault("zip_mode", false);
|
ConfMan.registerDefault("zip_mode", false);
|
||||||
ConfMan.registerDefault("water_effects", true);
|
ConfMan.registerDefault("water_effects", true);
|
||||||
|
|
|
@ -48,6 +48,7 @@ struct MohawkGameDescription;
|
||||||
class MohawkArchive;
|
class MohawkArchive;
|
||||||
class RivenGraphics;
|
class RivenGraphics;
|
||||||
class RivenConsole;
|
class RivenConsole;
|
||||||
|
struct RivenLanguage;
|
||||||
class RivenSaveLoad;
|
class RivenSaveLoad;
|
||||||
class RivenOptionsWidget;
|
class RivenOptionsWidget;
|
||||||
class RivenStack;
|
class RivenStack;
|
||||||
|
@ -113,11 +114,17 @@ public:
|
||||||
Common::String getSaveStateName(int slot) const override {
|
Common::String getSaveStateName(int slot) const override {
|
||||||
return Common::String::format("riven-%03d.rvn", slot);
|
return Common::String::format("riven-%03d.rvn", slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const RivenLanguage *listLanguages();
|
||||||
|
static const RivenLanguage *getLanguageDesc(Common::Language language);
|
||||||
|
Common::Language getLanguage() const override;
|
||||||
|
|
||||||
bool hasFeature(EngineFeature f) const override;
|
bool hasFeature(EngineFeature f) const override;
|
||||||
static void registerDefaultSettings();
|
static void registerDefaultSettings();
|
||||||
void applyGameSettings() override;
|
void applyGameSettings() override;
|
||||||
static Common::Array<Common::Keymap *> initKeymaps(const char *target);
|
static Common::Array<Common::Keymap *> initKeymaps(const char *target);
|
||||||
|
|
||||||
|
bool isInteractive() const;
|
||||||
void doFrame();
|
void doFrame();
|
||||||
void processInput();
|
void processInput();
|
||||||
|
|
||||||
|
@ -141,6 +148,7 @@ private:
|
||||||
|
|
||||||
bool _gameEnded;
|
bool _gameEnded;
|
||||||
uint32 _lastSaveTime;
|
uint32 _lastSaveTime;
|
||||||
|
Common::Language _currentLanguage;
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
void initVars();
|
void initVars();
|
||||||
|
@ -152,6 +160,7 @@ public:
|
||||||
RivenStack *constructStackById(uint16 id);
|
RivenStack *constructStackById(uint16 id);
|
||||||
void changeToCard(uint16 dest);
|
void changeToCard(uint16 dest);
|
||||||
void changeToStack(uint16 stackId);
|
void changeToStack(uint16 stackId);
|
||||||
|
void reloadCurrentCard();
|
||||||
RivenCard *getCard() const { return _card; }
|
RivenCard *getCard() const { return _card; }
|
||||||
RivenStack *getStack() const { return _stack; }
|
RivenStack *getStack() const { return _stack; }
|
||||||
|
|
||||||
|
@ -197,6 +206,11 @@ public:
|
||||||
void startNewGame();
|
void startNewGame();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RivenLanguage {
|
||||||
|
Common::Language language;
|
||||||
|
const char *archiveSuffix;
|
||||||
|
};
|
||||||
|
|
||||||
} // End of namespace Mohawk
|
} // End of namespace Mohawk
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -802,6 +802,9 @@ void RivenGraphics::drawText(const Common::U32String &text, const Common::Rect &
|
||||||
}
|
}
|
||||||
|
|
||||||
void RivenGraphics::loadMenuFont() {
|
void RivenGraphics::loadMenuFont() {
|
||||||
|
delete _menuFont;
|
||||||
|
_menuFont = nullptr;
|
||||||
|
|
||||||
const char *fontName;
|
const char *fontName;
|
||||||
|
|
||||||
if (_vm->getLanguage() != Common::JA_JPN) {
|
if (_vm->getLanguage() != Common::JA_JPN) {
|
||||||
|
|
|
@ -106,6 +106,7 @@ public:
|
||||||
static RivenTransitionMode sanitizeTransitionMode(int mode);
|
static RivenTransitionMode sanitizeTransitionMode(int mode);
|
||||||
|
|
||||||
// Main menu
|
// Main menu
|
||||||
|
void loadMenuFont();
|
||||||
void drawText(const Common::U32String &text, const Common::Rect &dest, uint8 greyLevel);
|
void drawText(const Common::U32String &text, const Common::Rect &dest, uint8 greyLevel);
|
||||||
|
|
||||||
// Credits
|
// Credits
|
||||||
|
@ -147,7 +148,6 @@ private:
|
||||||
|
|
||||||
// Main menu
|
// Main menu
|
||||||
Graphics::Font *_menuFont;
|
Graphics::Font *_menuFont;
|
||||||
void loadMenuFont();
|
|
||||||
const Graphics::Font *getMenuFont() const;
|
const Graphics::Font *getMenuFont() const;
|
||||||
|
|
||||||
// Credits
|
// Credits
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue