diff options
author | Fabio Battaglia | 2009-06-08 12:37:24 +0000 |
---|---|---|
committer | Fabio Battaglia | 2009-06-08 12:37:24 +0000 |
commit | 14c85028b12088e1b169a34488ece6522c4cf4ab (patch) | |
tree | b51db5cd8a16a7b537a2b6b3b76dc1a0262e9b57 | |
parent | f2fe13b064731a494275ae4858c02a321468544d (diff) | |
download | scummvm-rg350-14c85028b12088e1b169a34488ece6522c4cf4ab.tar.gz scummvm-rg350-14c85028b12088e1b169a34488ece6522c4cf4ab.tar.bz2 scummvm-rg350-14c85028b12088e1b169a34488ece6522c4cf4ab.zip |
sword1: add Broken Sword PSX demo support
svn-id: r41369
-rw-r--r-- | engines/sword1/detection.cpp | 22 | ||||
-rw-r--r-- | engines/sword1/logic.cpp | 4 | ||||
-rw-r--r-- | engines/sword1/music.cpp | 2 | ||||
-rw-r--r-- | engines/sword1/sound.cpp | 4 | ||||
-rw-r--r-- | engines/sword1/sword1.cpp | 37 | ||||
-rw-r--r-- | engines/sword1/sword1.h | 1 |
6 files changed, 48 insertions, 22 deletions
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 59d999bdc9..b0db320d86 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -47,17 +47,22 @@ static const PlainGameDescriptorGUIOpts sword1MacDemoSettings = {"sword1macdemo", "Broken Sword 1: The Shadow of the Templars (Mac demo)", Common::GUIO_NOMIDI}; static const PlainGameDescriptorGUIOpts sword1PSXSettings = {"sword1psx", "Broken Sword 1: The Shadow of the Templars (PlayStation)", Common::GUIO_NOMIDI}; +static const PlainGameDescriptorGUIOpts sword1PSXDemoSettings = + {"sword1psxdemo", "Broken Sword 1: The Shadow of the Templars (PlayStation demo)", Common::GUIO_NOMIDI}; + // check these subdirectories (if present) -static const char *g_dirNames[] = { "clusters", "speech" }; +static const char *g_dirNames[] = { "clusters", "speech", "english", "italian"}; #define NUM_COMMON_FILES_TO_CHECK 1 #define NUM_PC_FILES_TO_CHECK 3 #define NUM_MAC_FILES_TO_CHECK 4 -#define NUM_PSX_FILES_TO_CHECK 2 +#define NUM_PSX_FILES_TO_CHECK 1 +#define NUM_PSX_DEMO_FILES_TO_CHECK 2 #define NUM_DEMO_FILES_TO_CHECK 1 #define NUM_MAC_DEMO_FILES_TO_CHECK 1 -#define NUM_FILES_TO_CHECK NUM_COMMON_FILES_TO_CHECK + NUM_PC_FILES_TO_CHECK + NUM_MAC_FILES_TO_CHECK + NUM_PSX_FILES_TO_CHECK + NUM_DEMO_FILES_TO_CHECK + NUM_MAC_DEMO_FILES_TO_CHECK + +#define NUM_FILES_TO_CHECK NUM_COMMON_FILES_TO_CHECK + NUM_PC_FILES_TO_CHECK + NUM_MAC_FILES_TO_CHECK + NUM_PSX_FILES_TO_CHECK + NUM_DEMO_FILES_TO_CHECK + NUM_MAC_DEMO_FILES_TO_CHECK + NUM_PSX_DEMO_FILES_TO_CHECK static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to be found "swordres.rif", // Mac, PC and PSX version "general.clu", // PC and PSX version @@ -69,6 +74,7 @@ static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to "paris2.clm", // Mac version (full game only) "cows.mad", // this one should only exist in the demo version "scripts.clm", // Mac version both demo and full game + "train.plx", // PSX version only "speech.dat", // PSX version only "tunes.dat", // PSX version only // the engine needs several more files to work, but checking these should be sufficient @@ -119,6 +125,8 @@ GameList SwordMetaEngine::getSupportedGames() const { games.push_back(sword1DemoSettings); games.push_back(sword1MacFullSettings); games.push_back(sword1MacDemoSettings); + games.push_back(sword1PSXSettings); + games.push_back(sword1PSXDemoSettings); return games; } @@ -133,6 +141,8 @@ GameDescriptor SwordMetaEngine::findGame(const char *gameid) const { return sword1MacDemoSettings; if (0 == scumm_stricmp(gameid, sword1PSXSettings.gameid)) return sword1PSXSettings; + if (0 == scumm_stricmp(gameid, sword1PSXDemoSettings.gameid)) + return sword1PSXDemoSettings; return GameDescriptor(); } @@ -168,6 +178,7 @@ GameList SwordMetaEngine::detectGames(const Common::FSList &fslist) const { bool demoFilesFound = true; bool macDemoFilesFound = true; bool psxFilesFound = true; + bool psxDemoFilesFound = true; for (i = 0; i < NUM_COMMON_FILES_TO_CHECK; i++) if (!filesFound[i]) mainFilesFound = false; @@ -186,11 +197,16 @@ GameList SwordMetaEngine::detectGames(const Common::FSList &fslist) const { for (j = 0; j < NUM_PSX_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) psxFilesFound = false; + for (j = 0; j < NUM_PSX_DEMO_FILES_TO_CHECK; i++, j++) + if (!filesFound[i] || psxFilesFound) + psxDemoFilesFound = false; if (mainFilesFound && pcFilesFound && demoFilesFound) detectedGames.push_back(sword1DemoSettings); else if (mainFilesFound && pcFilesFound && psxFilesFound) detectedGames.push_back(sword1PSXSettings); + else if (mainFilesFound && pcFilesFound && psxDemoFilesFound) + detectedGames.push_back(sword1PSXDemoSettings); else if (mainFilesFound && pcFilesFound && !psxFilesFound) detectedGames.push_back(sword1FullSettings); else if (mainFilesFound && macFilesFound) diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp index 8b033d9e8d..7e911bd197 100644 --- a/engines/sword1/logic.cpp +++ b/engines/sword1/logic.cpp @@ -524,7 +524,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc case IT_PUSHVARIABLE: debug(9, "IT_PUSHVARIABLE: ScriptVar[%d] => %d", scriptCode[pc], _scriptVars[scriptCode[pc]]); varNum = scriptCode[pc++]; - if (SwordEngine::_systemVars.isDemo) { + if (SwordEngine::_systemVars.isDemo && SwordEngine::isPc()) { if (varNum >= 397) // BS1 Demo has different number of script variables varNum++; if (varNum >= 699) @@ -615,7 +615,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc case IT_POPVAR: // pop a variable debug(9, "IT_POPVAR: ScriptVars[%d] = %d", scriptCode[pc], stack[stackIdx-1]); varNum = scriptCode[pc++]; - if (SwordEngine::_systemVars.isDemo) { + if (SwordEngine::_systemVars.isDemo && SwordEngine::isPc()) { if (varNum >= 397) // BS1 Demo has different number of script variables varNum++; if (varNum >= 699) diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp index feb48b0750..9f602aca2c 100644 --- a/engines/sword1/music.cpp +++ b/engines/sword1/music.cpp @@ -272,7 +272,7 @@ bool MusicHandle::playPSX(uint16 id, bool loop) { tableFile.close(); - if (size != 0xffffffff) { + if (size != 0xffffffff && size) { _file.seek(offset, SEEK_SET); _audioSource = new Audio::VagStream(_file.readStream(size), loop); fadeUp(); diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index 1f2ad04f08..306d23db57 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -225,13 +225,15 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { warning ("Could not open speech.inf"); return false; } + + uint16 numRooms = file.readUint16LE(); // Number of rooms file.seek(locIndex * 4 + 2); // 4 bytes per room, skip first 2 bytes uint16 numLines = file.readUint16LE(); uint16 roomOffset = file.readUint16LE(); - file.seek(0x112 + roomOffset * 2); // The offset is in terms of uint16's, so multiply by 2. Skip the 0x112 byte header too. + file.seek(2 + numRooms * 4 + roomOffset * 2); // The offset is in terms of uint16's, so multiply by 2. Skip the 0x112 byte header too. locIndex = 0xFFFFFFFF; diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index 18a3f2a7c4..3796ceefd6 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -48,7 +48,9 @@ SystemVars SwordEngine::_systemVars; SwordEngine::SwordEngine(OSystem *syst) : Engine(syst) { - if (!scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1demo")) + if (!scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1demo") || + !scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psxdemo") || + !scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo")) _features = GF_DEMO; else _features = 0; @@ -59,11 +61,14 @@ SwordEngine::SwordEngine(OSystem *syst) Common::File::addDefaultDirectory(_gameDataDir.getChild("SPEECH")); Common::File::addDefaultDirectory(_gameDataDir.getChild("VIDEO")); Common::File::addDefaultDirectory(_gameDataDir.getChild("SMACKSHI")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("ENGLISH"));//PSX Demo + Common::File::addDefaultDirectory(_gameDataDir.getChild("ITALIAN"));//PSX Demo Common::File::addDefaultDirectory(_gameDataDir.getChild("clusters")); Common::File::addDefaultDirectory(_gameDataDir.getChild("music")); Common::File::addDefaultDirectory(_gameDataDir.getChild("speech")); Common::File::addDefaultDirectory(_gameDataDir.getChild("video")); Common::File::addDefaultDirectory(_gameDataDir.getChild("smackshi")); + } SwordEngine::~SwordEngine() { @@ -85,7 +90,8 @@ Common::Error SwordEngine::init() { if ( 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1mac") || 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo") ) _systemVars.platform = Common::kPlatformMacintosh; - else if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psx")) + else if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psx") || + 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psxdemo") ) _systemVars.platform = Common::kPlatformPSX; else _systemVars.platform = Common::kPlatformWindows; @@ -321,17 +327,17 @@ const CdFile SwordEngine::_psxCdFileList[] = { // PSX edition has only one cd { "syria.clu", FLAG_CD1 }, { "train.clu", FLAG_CD1 }, { "train.plx", FLAG_CD1 }, - { "compacts.clu", FLAG_CD1 | FLAG_IMMED }, - { "general.clu", FLAG_CD1 | FLAG_IMMED }, - { "maps.clu", FLAG_CD1 }, - { "paris1.clu", FLAG_CD1 }, - { "scripts.clu", FLAG_CD1 | FLAG_IMMED }, - { "swordres.rif", FLAG_CD1 | FLAG_IMMED }, - { "text.clu", FLAG_CD1 }, - { "speech.dat", FLAG_SPEECH1 }, - { "speech.tab", FLAG_SPEECH1 }, - { "speech.inf", FLAG_SPEECH1 }, - { "speech.lis", FLAG_SPEECH1 } + { "compacts.clu", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED }, + { "general.clu", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED }, + { "maps.clu", FLAG_CD1 | FLAG_DEMO }, + { "paris1.clu", FLAG_CD1 | FLAG_DEMO}, + { "scripts.clu", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED }, + { "swordres.rif", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED }, + { "text.clu", FLAG_CD1 | FLAG_DEMO }, + { "speech.dat", FLAG_SPEECH1 | FLAG_DEMO }, + { "speech.tab", FLAG_SPEECH1 | FLAG_DEMO }, + { "speech.inf", FLAG_SPEECH1 | FLAG_DEMO }, + { "speech.lis", FLAG_SPEECH1 | FLAG_DEMO } }; void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) { @@ -439,8 +445,9 @@ void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or if (Common::File::exists(_psxCdFileList[fcnt].name)) { fileExists[fcnt] = true; flagsToBool(foundTypes, _psxCdFileList[fcnt].flags); - isFullVersion = true; - cd2FilesFound = true; + if (!(_psxCdFileList[fcnt].flags & FLAG_DEMO)) + isFullVersion = true; + cd2FilesFound = true; } else { flagsToBool(missingTypes, _psxCdFileList[fcnt].flags); fileExists[fcnt] = false; diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h index 6c336a35ae..4877f99582 100644 --- a/engines/sword1/sword1.h +++ b/engines/sword1/sword1.h @@ -83,6 +83,7 @@ public: static bool isMac() { return _systemVars.platform == Common::kPlatformMacintosh; } static bool isPsx() { return _systemVars.platform == Common::kPlatformPSX; } + static bool isPc() { return _systemVars.platform == Common::kPlatformPC; } protected: // Engine APIs |