aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2011-10-05 02:40:15 -0700
committerFilippos Karapetis2011-10-05 02:40:15 -0700
commit7cfd7f3a666cfcfeb22613ba42a24f1d342b12ce (patch)
tree4aa1e552d1e95d6208887490be6b532ac3827a98
parent22db5dda42c98ef14aa527a8e54838453509487c (diff)
parentfb180cba85ae5739f49d4ffe9b008b8df2f3ef99 (diff)
downloadscummvm-rg350-7cfd7f3a666cfcfeb22613ba42a24f1d342b12ce.tar.gz
scummvm-rg350-7cfd7f3a666cfcfeb22613ba42a24f1d342b12ce.tar.bz2
scummvm-rg350-7cfd7f3a666cfcfeb22613ba42a24f1d342b12ce.zip
Merge pull request #99 from tsoliman/scumm-speech-detection-rebased-2
SCUMM: Enable speech gui options when speech file found
-rw-r--r--engines/scumm/detection.cpp45
-rw-r--r--engines/scumm/script_v5.cpp24
2 files changed, 63 insertions, 6 deletions
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 3ed9218776..47b461f1bc 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -308,6 +308,47 @@ static void closeDiskImage(ScummDiskImage *img) {
SearchMan.remove("tmpDiskImgDir");
}
+/*
+ * This function tries to detect if a speech file exists.
+ * False doesn't necessarily mean there are no speech files.
+ */
+static bool detectSpeech(const Common::FSList &fslist, const GameSettings *gs) {
+ if (gs->id == GID_MONKEY || gs->id == GID_MONKEY2) {
+
+ // FMTOWNS monkey and monkey2 games don't have speech but may have .sou files
+ if (gs->platform == Common::kPlatformFMTowns)
+ return false;
+
+ const char *basenames[] = { gs->gameid, "monster", 0 };
+ const char *extensions[] = { "sou",
+#ifdef USE_FLAC
+ "sof",
+#endif
+#ifdef USE_VORBIS
+ "sog",
+#endif
+#ifdef USE_MAD
+ "so3",
+#endif
+ 0 };
+
+ for (Common::FSList::const_iterator file = fslist.begin();
+ file != fslist.end(); ++file) {
+ if (!file->isDirectory()) {
+ for (int i = 0; basenames[i]; ++i) {
+ for (int j = 0; extensions[j]; ++j) {
+ Common::String filename = Common::String(basenames[i])
+ + "." + Common::String(extensions[j]);
+ if (filename.equalsIgnoreCase(file->getName()))
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+}
+
// The following function tries to detect the language for COMI and DIG
static Common::Language detectLanguage(const Common::FSList &fslist, byte id) {
// First try to detect Chinese translation
@@ -608,6 +649,10 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
// HACK: Perhaps it is some modified translation?
dr.language = detectLanguage(fslist, g->id);
+ // Detect if there are speech files in this unknown game
+ if(detectSpeech(fslist, g))
+ dr.game.guioptions &= ~GUIO_NOSPEECH;
+
// Add the game/variant to the candidates list if it is consistent
// with the file(s) we are seeing.
if (testGame(g, fileMD5Map, file))
diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index 02c8d977a5..6426b75e1e 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -1799,12 +1799,20 @@ void ScummEngine_v5::o5_roomOps() {
case 13: // SO_SAVE_STRING
{
- // This subopcode is used in Indy 4 to save the IQ points data.
- // No other game uses it. We use this to replace the given filename by
- // one based on the targetname ("TARGET.iq").
- // This way, the iq data of each Indy 4 variant a user might have stays
- // separate. Moreover, the filename now clearly reflects to which target
- // it belongs (as it should).
+ // This subopcode is used in Indy 4 to save the IQ points
+ // data. No other LucasArts game uses it. We use this fact
+ // to substitute a filename based on the targetname
+ // ("TARGET.iq").
+ //
+ // This way, the iq data of each Indy 4 variant stays
+ // separate. Moreover, the filename now clearly reflects to
+ // which target it belongs (as it should).
+ //
+ // In addition, the Monkey Island fan patch (which adds
+ // speech support and more things to MI 1 and 2) uses
+ // this opcode to generate a "monkey.cfg" file containing.
+ // some user controllable settings.
+ // Once more we use a custom filename ("TARGET.cfg").
Common::String filename;
char chr;
@@ -1814,6 +1822,8 @@ void ScummEngine_v5::o5_roomOps() {
if (_game.id == GID_INDY4) {
filename = _targetName + ".iq";
+ } else if (_game.id == GID_MONKEY || _game.id == GID_MONKEY2) {
+ filename = _targetName + ".cfg";
} else {
error("SO_SAVE_STRING: Unsupported filename %s", filename.c_str());
}
@@ -1841,6 +1851,8 @@ void ScummEngine_v5::o5_roomOps() {
if (_game.id == GID_INDY4) {
filename = _targetName + ".iq";
+ } else if (_game.id == GID_MONKEY || _game.id == GID_MONKEY2) {
+ filename = _targetName + ".cfg";
} else {
error("SO_LOAD_STRING: Unsupported filename %s", filename.c_str());
}