mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-14 16:07:39 +00:00
MYST3: Change Database not to depend on Myst3Engine
This commit is contained in:
parent
264b5a3c88
commit
ca5030a6a0
@ -21,7 +21,6 @@
|
||||
*/
|
||||
|
||||
#include "engines/myst3/database.h"
|
||||
#include "engines/myst3/myst3.h"
|
||||
|
||||
#include "common/archive.h"
|
||||
#include "common/debug.h"
|
||||
@ -110,8 +109,10 @@ const AgeData Database::_ages[] = {
|
||||
{ 11, 0, 1, roomsLOGO, 0 }
|
||||
};
|
||||
|
||||
Database::Database(Myst3Engine *vm) :
|
||||
_vm(vm),
|
||||
Database::Database(const Common::Platform platform, const Common::Language language, const uint32 localizationType) :
|
||||
_platform(platform),
|
||||
_language(language),
|
||||
_localizationType(localizationType),
|
||||
_currentRoomID(0),
|
||||
_currentRoomData(0) {
|
||||
|
||||
@ -130,18 +131,18 @@ Database::Database(Myst3Engine *vm) :
|
||||
error("Incorrect 'myst3.dat' version. Expected '%d', found '%d'", kDatVersion, version);
|
||||
}
|
||||
|
||||
bool isWindowMacVersion = _vm->getPlatform() == Common::kPlatformWindows || _vm->getPlatform() == Common::kPlatformMacintosh;
|
||||
bool isXboxVersion = _vm->getPlatform() == Common::kPlatformXbox;
|
||||
bool isWindowMacVersion = _platform == Common::kPlatformWindows || _platform == Common::kPlatformMacintosh;
|
||||
bool isXboxVersion = _platform == Common::kPlatformXbox;
|
||||
|
||||
readScriptIndex(_datFile, isWindowMacVersion); // Main scripts
|
||||
readScriptIndex(_datFile, isWindowMacVersion && _vm->isMulti6Version()); // Menu scripts 6 languages version
|
||||
readScriptIndex(_datFile, isWindowMacVersion && !_vm->isMulti6Version() && !_vm->isMonolingual()); // Menu scripts 2 languages CD version
|
||||
readScriptIndex(_datFile, isWindowMacVersion && !_vm->isMulti6Version() && _vm->isMonolingual()); // Menu scripts english CD version
|
||||
readScriptIndex(_datFile, isXboxVersion); // Main scripts Xbox version
|
||||
readScriptIndex(_datFile, isXboxVersion && !_vm->isMonolingual()); // Menu scripts PAL Xbox version
|
||||
readScriptIndex(_datFile, isXboxVersion && _vm->isMonolingual()); // Menu scripts NTSC Xbox version
|
||||
readSoundNames(_datFile, isWindowMacVersion); // Sound names
|
||||
readSoundNames(_datFile, isXboxVersion); // Sound names Xbox
|
||||
readScriptIndex(_datFile, isWindowMacVersion); // Main scripts
|
||||
readScriptIndex(_datFile, isWindowMacVersion && _localizationType == kLocMulti6); // Menu scripts 6 languages version
|
||||
readScriptIndex(_datFile, isWindowMacVersion && _localizationType == kLocMulti2); // Menu scripts 2 languages CD version
|
||||
readScriptIndex(_datFile, isWindowMacVersion && _localizationType == kLocMonolingual); // Menu scripts english CD version
|
||||
readScriptIndex(_datFile, isXboxVersion); // Main scripts Xbox version
|
||||
readScriptIndex(_datFile, isXboxVersion && _localizationType != kLocMonolingual); // Menu scripts PAL Xbox version
|
||||
readScriptIndex(_datFile, isXboxVersion && _localizationType == kLocMonolingual); // Menu scripts NTSC Xbox version
|
||||
readSoundNames(_datFile, isWindowMacVersion); // Sound names
|
||||
readSoundNames(_datFile, isXboxVersion); // Sound names Xbox
|
||||
|
||||
_roomScriptsStartOffset = _datFile->pos();
|
||||
|
||||
@ -156,7 +157,7 @@ Database::Database(Myst3Engine *vm) :
|
||||
preloadCommonRooms();
|
||||
initializeZipBitIndexTable();
|
||||
|
||||
if (isWindowMacVersion && !_vm->isMulti6Version() && !_vm->isMonolingual()) {
|
||||
if (isWindowMacVersion && _localizationType == kLocMulti2) {
|
||||
patchLanguageMenu();
|
||||
}
|
||||
}
|
||||
@ -698,6 +699,28 @@ Common::SeekableReadStream *Database::getRoomScriptStream(const char *room, Scri
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int16 Database::getGameLanguageCode() const {
|
||||
// The monolingual versions of the game always use 0 as the language code
|
||||
if (_localizationType == kLocMonolingual) {
|
||||
return kEnglish;
|
||||
}
|
||||
|
||||
switch (_language) {
|
||||
case Common::FR_FRA:
|
||||
return kFrench;
|
||||
case Common::DE_DEU:
|
||||
return kGerman;
|
||||
case Common::IT_ITA:
|
||||
return kItalian;
|
||||
case Common::ES_ESP:
|
||||
return kSpanish;
|
||||
case Common::EN_ANY:
|
||||
return kEnglish;
|
||||
default:
|
||||
return kOther;
|
||||
}
|
||||
}
|
||||
|
||||
void Database::patchLanguageMenu() {
|
||||
// The menu scripts in 'myst3.dat" for the non English CD versions come from the French version
|
||||
// The scripts for the other languages only differ by the value set for AudioLanguage variable
|
||||
@ -714,7 +737,7 @@ void Database::patchLanguageMenu() {
|
||||
// op 194, runPuzzle1 ( 19 )
|
||||
|
||||
NodePtr languageMenu = getNodeData(530, 901, 9);
|
||||
languageMenu->hotspots[5].script[1].args[1] = _vm->getGameLanguageCode();
|
||||
languageMenu->hotspots[5].script[1].args[1] = getGameLanguageCode();
|
||||
}
|
||||
|
||||
} // End of namespace Myst3
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "common/scummsys.h"
|
||||
#include "engines/myst3/hotspot.h"
|
||||
#include "common/str.h"
|
||||
#include "common/language.h"
|
||||
#include "common/platform.h"
|
||||
#include "common/ptr.h"
|
||||
#include "common/array.h"
|
||||
#include "common/hashmap.h"
|
||||
@ -33,6 +35,22 @@
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
enum GameLocalizationType {
|
||||
kLocMonolingual,
|
||||
kLocMulti2,
|
||||
kLocMulti6,
|
||||
};
|
||||
|
||||
enum MystLanguage {
|
||||
kEnglish = 0,
|
||||
kOther = 1, // Dutch, Japanese or Polish
|
||||
kDutch = 1,
|
||||
kFrench = 2,
|
||||
kGerman = 3,
|
||||
kItalian = 4,
|
||||
kSpanish = 5
|
||||
};
|
||||
|
||||
struct NodeData {
|
||||
int16 id;
|
||||
int16 zipBitIndex;
|
||||
@ -91,7 +109,7 @@ class Myst3Engine;
|
||||
|
||||
class Database {
|
||||
public:
|
||||
Database(Myst3Engine *vm);
|
||||
Database(const Common::Platform platform, const Common::Language language, const uint32 localizationType);
|
||||
~Database();
|
||||
|
||||
/**
|
||||
@ -143,8 +161,12 @@ public:
|
||||
* Retrieve an ambient cue from its id
|
||||
*/
|
||||
const AmbientCue &getAmbientCue(uint16 id);
|
||||
|
||||
int16 getGameLanguageCode() const;
|
||||
private:
|
||||
Myst3Engine *_vm;
|
||||
const Common::Platform _platform;
|
||||
const Common::Language _language;
|
||||
const uint32 _localizationType;
|
||||
|
||||
static const AgeData _ages[];
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
#include "engines/myst3/database.h"
|
||||
#include "engines/myst3/state.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
@ -34,7 +35,7 @@ namespace Myst3 {
|
||||
|
||||
struct Myst3GameDescription {
|
||||
ADGameDescription desc;
|
||||
uint32 flags;
|
||||
uint32 localizationType;
|
||||
};
|
||||
|
||||
static const PlainGameDescriptor myst3Games[] = {
|
||||
@ -81,43 +82,43 @@ static const char *directoryGlobs[] = {
|
||||
ADGF_UNSTABLE, \
|
||||
GUIO_NONE \
|
||||
}, \
|
||||
kFlagMulti6 \
|
||||
kLocMulti6 \
|
||||
},
|
||||
|
||||
|
||||
static const Myst3GameDescription gameDescriptions[] = {
|
||||
// Initial US release (English only)
|
||||
MYST3ENTRY(Common::EN_ANY, "ENGLISH.m3t", "3ca92b097c4319a2ace7fd6e911d6b0f", 0, kFlagMonolingual)
|
||||
MYST3ENTRY(Common::EN_ANY, "ENGLISH.m3t", "3ca92b097c4319a2ace7fd6e911d6b0f", 0, kLocMonolingual)
|
||||
|
||||
// European releases (Country language + English) (1.2)
|
||||
MYST3ENTRY(Common::NL_NLD, "DUTCH.m3u", "0e8019cfaeb58c2de00ac114cf122220", 0, kFlagNone)
|
||||
MYST3ENTRY(Common::FR_FRA, "FRENCH.m3u", "3a7e270c686806dfc31c2091e09c03ec", 0, kFlagNone)
|
||||
MYST3ENTRY(Common::DE_DEU, "GERMAN.m3u", "00000000000000000000000000000000", 0, kFlagNone)
|
||||
MYST3ENTRY(Common::ES_ESP, "SPANISH.m3u", "00000000000000000000000000000000", 0, kFlagNone)
|
||||
MYST3ENTRY(Common::PL_POL, "POLISH.m3u", "00000000000000000000000000000000", 0, kFlagNone)
|
||||
MYST3ENTRY(Common::NL_NLD, "DUTCH.m3u", "0e8019cfaeb58c2de00ac114cf122220", 0, kLocMulti2)
|
||||
MYST3ENTRY(Common::FR_FRA, "FRENCH.m3u", "3a7e270c686806dfc31c2091e09c03ec", 0, kLocMulti2)
|
||||
MYST3ENTRY(Common::DE_DEU, "GERMAN.m3u", "00000000000000000000000000000000", 0, kLocMulti2)
|
||||
MYST3ENTRY(Common::ES_ESP, "SPANISH.m3u", "00000000000000000000000000000000", 0, kLocMulti2)
|
||||
MYST3ENTRY(Common::PL_POL, "POLISH.m3u", "00000000000000000000000000000000", 0, kLocMulti2)
|
||||
|
||||
// Russian release (Russian only) (1.2)
|
||||
MYST3ENTRY(Common::RU_RUS, "ENGLISH.m3t", "57d36d8610043fda554a0708d71d2681", 0, kFlagMonolingual)
|
||||
MYST3ENTRY(Common::RU_RUS, "ENGLISH.m3t", "57d36d8610043fda554a0708d71d2681", 0, kLocMonolingual)
|
||||
|
||||
// Japanese release (1.2)
|
||||
MYST3ENTRY(Common::JA_JPN, "JAPANESE.m3u", "21bbd040bcfadd13b9dc84360c3de01d", 0, kFlagNone)
|
||||
MYST3ENTRY(Common::JA_JPN, "JAPANESE.m3u", "1e7c3156417978a1187fa6bc0e2cfafc", "Subtitles only", kFlagNone)
|
||||
MYST3ENTRY(Common::JA_JPN, "JAPANESE.m3u", "21bbd040bcfadd13b9dc84360c3de01d", 0, kLocMulti2)
|
||||
MYST3ENTRY(Common::JA_JPN, "JAPANESE.m3u", "1e7c3156417978a1187fa6bc0e2cfafc", "Subtitles only", kLocMulti2)
|
||||
|
||||
// Multilingual CD release (1.21)
|
||||
MYST3ENTRY(Common::EN_ANY, "ENGLISH.m3u", "b62ca55aa17724cddbbcc78cba988337", 0, kFlagMulti6)
|
||||
MYST3ENTRY(Common::FR_FRA, "FRENCH.m3u", "73519070cba1c7bea599adbddeae304f", 0, kFlagMulti6)
|
||||
MYST3ENTRY(Common::NL_NLD, "DUTCH.m3u", "c4a8d8fb0eb3fecb9c435a8517bc1f9a", 0, kFlagMulti6)
|
||||
MYST3ENTRY(Common::DE_DEU, "GERMAN.m3u", "5b3be343dd20f03ebdf16381b873f035", 0, kFlagMulti6)
|
||||
MYST3ENTRY(Common::IT_ITA, "ITALIAN.m3u", "73db43aac3fe8671e2c4e227977fbb61", 0, kFlagMulti6)
|
||||
MYST3ENTRY(Common::ES_ESP, "SPANISH.m3u", "55ceb165dad02211ef2d25946c3aac8e", 0, kFlagMulti6)
|
||||
MYST3ENTRY(Common::EN_ANY, "ENGLISH.m3u", "b62ca55aa17724cddbbcc78cba988337", 0, kLocMulti6)
|
||||
MYST3ENTRY(Common::FR_FRA, "FRENCH.m3u", "73519070cba1c7bea599adbddeae304f", 0, kLocMulti6)
|
||||
MYST3ENTRY(Common::NL_NLD, "DUTCH.m3u", "c4a8d8fb0eb3fecb9c435a8517bc1f9a", 0, kLocMulti6)
|
||||
MYST3ENTRY(Common::DE_DEU, "GERMAN.m3u", "5b3be343dd20f03ebdf16381b873f035", 0, kLocMulti6)
|
||||
MYST3ENTRY(Common::IT_ITA, "ITALIAN.m3u", "73db43aac3fe8671e2c4e227977fbb61", 0, kLocMulti6)
|
||||
MYST3ENTRY(Common::ES_ESP, "SPANISH.m3u", "55ceb165dad02211ef2d25946c3aac8e", 0, kLocMulti6)
|
||||
|
||||
// DVD releases (1.27)
|
||||
MYST3ENTRY(Common::EN_ANY, "ENGLISH.m3u", "e200b416f43e70fee76148a80d195d5c", "DVD", kFlagMulti6)
|
||||
MYST3ENTRY(Common::FR_FRA, "FRENCH.m3u", "5679ce65c5e9af8899835ef9af398f1a", "DVD", kFlagMulti6)
|
||||
MYST3ENTRY(Common::NL_NLD, "DUTCH.m3u", "2997afdb4306c573153fdbb391ed2fff", "DVD", kFlagMulti6)
|
||||
MYST3ENTRY(Common::DE_DEU, "GERMAN.m3u", "09f32e6ceb414463e8fc22ca1a9564d3", "DVD", kFlagMulti6)
|
||||
MYST3ENTRY(Common::IT_ITA, "ITALIAN.m3u", "51fb02f6bf37dde811d7cde648365260", "DVD", kFlagMulti6)
|
||||
MYST3ENTRY(Common::ES_ESP, "SPANISH.m3u", "e27e610fe8ce35223a3239ff170a85ec", "DVD", kFlagMulti6)
|
||||
MYST3ENTRY(Common::EN_ANY, "ENGLISH.m3u", "e200b416f43e70fee76148a80d195d5c", "DVD", kLocMulti6)
|
||||
MYST3ENTRY(Common::FR_FRA, "FRENCH.m3u", "5679ce65c5e9af8899835ef9af398f1a", "DVD", kLocMulti6)
|
||||
MYST3ENTRY(Common::NL_NLD, "DUTCH.m3u", "2997afdb4306c573153fdbb391ed2fff", "DVD", kLocMulti6)
|
||||
MYST3ENTRY(Common::DE_DEU, "GERMAN.m3u", "09f32e6ceb414463e8fc22ca1a9564d3", "DVD", kLocMulti6)
|
||||
MYST3ENTRY(Common::IT_ITA, "ITALIAN.m3u", "51fb02f6bf37dde811d7cde648365260", "DVD", kLocMulti6)
|
||||
MYST3ENTRY(Common::ES_ESP, "SPANISH.m3u", "e27e610fe8ce35223a3239ff170a85ec", "DVD", kLocMulti6)
|
||||
|
||||
// Myst 3 Xbox (PAL)
|
||||
MYST3ENTRY_XBOX(Common::EN_ANY, "ENGLISHX.m3t", "c4d012ab02b8ca7d0c7e79f4dbd4e676")
|
||||
@ -308,12 +309,8 @@ Common::Language Myst3Engine::getGameLanguage() const {
|
||||
return _gameDescription->desc.language;
|
||||
}
|
||||
|
||||
bool Myst3Engine::isMulti6Version() const {
|
||||
return (_gameDescription->flags & kFlagMulti6) != 0;
|
||||
}
|
||||
|
||||
bool Myst3Engine::isMonolingual() const {
|
||||
return (_gameDescription->flags & kFlagMonolingual) != 0;
|
||||
uint32 Myst3Engine::getGameLocalizationType() const {
|
||||
return _gameDescription->localizationType;
|
||||
}
|
||||
|
||||
} // End of namespace Myst3
|
||||
|
@ -62,16 +62,6 @@
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
enum MystLanguage {
|
||||
kEnglish = 0,
|
||||
kOther = 1, // Dutch, Japanese or Polish
|
||||
kDutch = 1,
|
||||
kFrench = 2,
|
||||
kGerman = 3,
|
||||
kItalian = 4,
|
||||
kSpanish = 5
|
||||
};
|
||||
|
||||
Myst3Engine::Myst3Engine(OSystem *syst, const Myst3GameDescription *version) :
|
||||
Engine(syst), _system(syst), _gameDescription(version),
|
||||
_db(0), _console(0), _scriptEngine(0),
|
||||
@ -115,9 +105,6 @@ Myst3Engine::Myst3Engine(OSystem *syst, const Myst3GameDescription *version) :
|
||||
SearchMan.addSubDirectoryMatching(gameDataDir, "MYST3BIN/M3DATA/TEXT");
|
||||
SearchMan.addSubDirectoryMatching(gameDataDir, "MYST3BIN/M3DATA/TEXT/NTSC");
|
||||
SearchMan.addSubDirectoryMatching(gameDataDir, "MYST3BIN/M3DATA/TEXT/PAL");
|
||||
|
||||
settingsInitDefaults();
|
||||
syncSoundSettings();
|
||||
}
|
||||
|
||||
Myst3Engine::~Myst3Engine() {
|
||||
@ -168,7 +155,7 @@ Common::Error Myst3Engine::run() {
|
||||
_console = new Console(this);
|
||||
_scriptEngine = new Script(this);
|
||||
_state = new GameState(this);
|
||||
_db = new Database(this);
|
||||
_db = new Database(getPlatform(), getGameLanguage(), getGameLocalizationType());
|
||||
_scene = new Scene(this);
|
||||
if (getPlatform() == Common::kPlatformXbox) {
|
||||
_menu = new AlbumMenu(this);
|
||||
@ -186,6 +173,9 @@ Common::Error Myst3Engine::run() {
|
||||
_cursor = new Cursor(this);
|
||||
_inventory = new Inventory(this);
|
||||
|
||||
settingsInitDefaults();
|
||||
syncSoundSettings();
|
||||
|
||||
// Init the font
|
||||
Graphics::Surface *font = loadTexture(1206);
|
||||
_gfx->initFont(font);
|
||||
@ -282,7 +272,7 @@ void Myst3Engine::openArchives() {
|
||||
break;
|
||||
}
|
||||
|
||||
if (isMulti6Version()) {
|
||||
if (getGameLocalizationType() == kLocMulti6) {
|
||||
switch (ConfMan.getInt("text_language")) {
|
||||
case kDutch:
|
||||
textLanguage = "DUTCH";
|
||||
@ -305,14 +295,14 @@ void Myst3Engine::openArchives() {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (isMonolingual() || ConfMan.getInt("text_language")) {
|
||||
if (getGameLocalizationType() == kLocMonolingual || ConfMan.getInt("text_language")) {
|
||||
textLanguage = menuLanguage;
|
||||
} else {
|
||||
textLanguage = "ENGLISH";
|
||||
}
|
||||
}
|
||||
|
||||
if (!isMonolingual() && getPlatform() != Common::kPlatformXbox && textLanguage == "ENGLISH") {
|
||||
if (getGameLocalizationType() != kLocMonolingual && getPlatform() != Common::kPlatformXbox && textLanguage == "ENGLISH") {
|
||||
textLanguage = "ENGLISHjp";
|
||||
}
|
||||
|
||||
@ -330,7 +320,7 @@ void Myst3Engine::openArchives() {
|
||||
|
||||
addArchive(textLanguage + ".m3t", true);
|
||||
|
||||
if (!isMonolingual() || getPlatform() == Common::kPlatformXbox) {
|
||||
if (getGameLocalizationType() != kLocMonolingual || getPlatform() == Common::kPlatformXbox) {
|
||||
addArchive(menuLanguage + ".m3u", true);
|
||||
}
|
||||
|
||||
@ -1654,10 +1644,10 @@ SunSpot Myst3Engine::computeSunspotsIntensity(float pitch, float heading) {
|
||||
}
|
||||
|
||||
void Myst3Engine::settingsInitDefaults() {
|
||||
int defaultLanguage = getGameLanguageCode();
|
||||
int defaultLanguage = _db->getGameLanguageCode();
|
||||
|
||||
int defaultTextLanguage;
|
||||
if (isMulti6Version())
|
||||
if (getGameLocalizationType() == kLocMulti6)
|
||||
defaultTextLanguage = defaultLanguage;
|
||||
else
|
||||
defaultTextLanguage = getGameLanguage() != Common::EN_ANY;
|
||||
@ -1675,28 +1665,6 @@ void Myst3Engine::settingsInitDefaults() {
|
||||
ConfMan.registerDefault("vibrations", true); // Xbox specific
|
||||
}
|
||||
|
||||
int16 Myst3Engine::getGameLanguageCode() const {
|
||||
// The monolingual versions of the game always use 0 as the language code
|
||||
if (isMonolingual()) {
|
||||
return kEnglish;
|
||||
}
|
||||
|
||||
switch (getGameLanguage()) {
|
||||
case Common::FR_FRA:
|
||||
return kFrench;
|
||||
case Common::DE_DEU:
|
||||
return kGerman;
|
||||
case Common::IT_ITA:
|
||||
return kItalian;
|
||||
case Common::ES_ESP:
|
||||
return kSpanish;
|
||||
case Common::EN_ANY:
|
||||
return kEnglish;
|
||||
default:
|
||||
return kOther;
|
||||
}
|
||||
}
|
||||
|
||||
void Myst3Engine::settingsLoadToVars() {
|
||||
_state->setWaterEffects(ConfMan.getBool("water_effects"));
|
||||
_state->setTransitionSpeed(ConfMan.getInt("transition_speed"));
|
||||
|
@ -42,12 +42,6 @@ struct Event;
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
enum GameVersionFlags {
|
||||
kFlagNone = 0,
|
||||
kFlagMulti6 = (1 << 1), // 6 languages version
|
||||
kFlagMonolingual = (1 << 2) // Monolingual version
|
||||
};
|
||||
|
||||
// Engine Debug Flags
|
||||
enum {
|
||||
kDebugVariable = (1 << 0),
|
||||
@ -122,9 +116,7 @@ public:
|
||||
bool hasFeature(EngineFeature f) const override;
|
||||
Common::Platform getPlatform() const;
|
||||
Common::Language getGameLanguage() const;
|
||||
int16 getGameLanguageCode() const;
|
||||
bool isMonolingual() const;
|
||||
bool isMulti6Version() const;
|
||||
uint32 getGameLocalizationType() const;
|
||||
bool isWideScreenModEnabled() const;
|
||||
|
||||
bool canLoadGameStateCurrently() override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user