[Scummvm-cvs-logs] SF.net SVN: scummvm:[41369] scummvm/trunk/engines/sword1
Hkz at users.sourceforge.net
Hkz at users.sourceforge.net
Mon Jun 8 14:37:25 CEST 2009
Revision: 41369
http://scummvm.svn.sourceforge.net/scummvm/?rev=41369&view=rev
Author: Hkz
Date: 2009-06-08 12:37:24 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
sword1: add Broken Sword PSX demo support
Modified Paths:
--------------
scummvm/trunk/engines/sword1/detection.cpp
scummvm/trunk/engines/sword1/logic.cpp
scummvm/trunk/engines/sword1/music.cpp
scummvm/trunk/engines/sword1/sound.cpp
scummvm/trunk/engines/sword1/sword1.cpp
scummvm/trunk/engines/sword1/sword1.h
Modified: scummvm/trunk/engines/sword1/detection.cpp
===================================================================
--- scummvm/trunk/engines/sword1/detection.cpp 2009-06-08 12:20:36 UTC (rev 41368)
+++ scummvm/trunk/engines/sword1/detection.cpp 2009-06-08 12:37:24 UTC (rev 41369)
@@ -47,17 +47,22 @@
{"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 @@
"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 @@
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 @@
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 @@
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 @@
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)
Modified: scummvm/trunk/engines/sword1/logic.cpp
===================================================================
--- scummvm/trunk/engines/sword1/logic.cpp 2009-06-08 12:20:36 UTC (rev 41368)
+++ scummvm/trunk/engines/sword1/logic.cpp 2009-06-08 12:37:24 UTC (rev 41369)
@@ -524,7 +524,7 @@
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 @@
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)
Modified: scummvm/trunk/engines/sword1/music.cpp
===================================================================
--- scummvm/trunk/engines/sword1/music.cpp 2009-06-08 12:20:36 UTC (rev 41368)
+++ scummvm/trunk/engines/sword1/music.cpp 2009-06-08 12:37:24 UTC (rev 41369)
@@ -272,7 +272,7 @@
tableFile.close();
- if (size != 0xffffffff) {
+ if (size != 0xffffffff && size) {
_file.seek(offset, SEEK_SET);
_audioSource = new Audio::VagStream(_file.readStream(size), loop);
fadeUp();
Modified: scummvm/trunk/engines/sword1/sound.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sound.cpp 2009-06-08 12:20:36 UTC (rev 41368)
+++ scummvm/trunk/engines/sword1/sound.cpp 2009-06-08 12:37:24 UTC (rev 41369)
@@ -225,13 +225,15 @@
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;
Modified: scummvm/trunk/engines/sword1/sword1.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sword1.cpp 2009-06-08 12:20:36 UTC (rev 41368)
+++ scummvm/trunk/engines/sword1/sword1.cpp 2009-06-08 12:37:24 UTC (rev 41369)
@@ -48,7 +48,9 @@
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 @@
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 @@
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 @@
{ "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 @@
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;
Modified: scummvm/trunk/engines/sword1/sword1.h
===================================================================
--- scummvm/trunk/engines/sword1/sword1.h 2009-06-08 12:20:36 UTC (rev 41368)
+++ scummvm/trunk/engines/sword1/sword1.h 2009-06-08 12:37:24 UTC (rev 41369)
@@ -83,6 +83,7 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list