diff options
author | Paul Gilbert | 2019-06-26 21:16:23 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-07-06 15:27:08 -0700 |
commit | 9c197d71ab40143a40daa8b7599db18ed98a1215 (patch) | |
tree | 2a248cf467323905b04d74e43e7b00aa4dca7215 /engines/glk | |
parent | 86f9985951203ed39e1a6c08e32730b478b10517 (diff) | |
download | scummvm-rg350-9c197d71ab40143a40daa8b7599db18ed98a1215.tar.gz scummvm-rg350-9c197d71ab40143a40daa8b7599db18ed98a1215.tar.bz2 scummvm-rg350-9c197d71ab40143a40daa8b7599db18ed98a1215.zip |
GLK: ALAN3: Add support for loading a3r Blorb files
Diffstat (limited to 'engines/glk')
-rw-r--r-- | engines/glk/blorb.cpp | 34 | ||||
-rw-r--r-- | engines/glk/blorb.h | 6 | ||||
-rw-r--r-- | engines/glk/glk.cpp | 19 |
3 files changed, 48 insertions, 11 deletions
diff --git a/engines/glk/blorb.cpp b/engines/glk/blorb.cpp index 03c3dd3051..3c60fd36fc 100644 --- a/engines/glk/blorb.cpp +++ b/engines/glk/blorb.cpp @@ -215,7 +215,39 @@ bool Blorb::isBlorb(const Common::String &filename, uint32 type) { bool Blorb::hasBlorbExt(const Common::String &filename) { return filename.hasSuffixIgnoreCase(".blorb") || filename.hasSuffixIgnoreCase(".zblorb") - || filename.hasSuffixIgnoreCase(".gblorb") || filename.hasSuffixIgnoreCase(".blb"); + || filename.hasSuffixIgnoreCase(".gblorb") || filename.hasSuffixIgnoreCase(".blb") + || filename.hasSuffixIgnoreCase(".a3r"); +} + +void Blorb::getBlorbFilenames(const Common::String &srcFilename, Common::StringArray &filenames, + InterpreterType interpType) { + // Strip off the source filename extension + Common::String filename = srcFilename; + if (!filename.contains('.')) { + filename += '.'; + } else { + while (filename[filename.size() - 1] != '.') + filename.deleteLastChar(); + } + + // Add in the different possible filenames + filenames.clear(); + filenames.push_back(filename + "blorb"); + filenames.push_back(filename + "blb"); + + switch (interpType) { + case INTERPRETER_ALAN3: + filenames.push_back(filename + "a3r"); + break; + case INTERPRETER_FROTZ: + filenames.push_back(filename + "zblorb"); + break; + case INTERPRETER_GLULXE: + filenames.push_back(filename + "gblorb"); + break; + default: + break; + } } } // End of namespace Glk diff --git a/engines/glk/blorb.h b/engines/glk/blorb.h index 92a5f3f190..887690c251 100644 --- a/engines/glk/blorb.h +++ b/engines/glk/blorb.h @@ -146,6 +146,12 @@ public: * Returns true if a given filename has a Blorb file extension */ static bool hasBlorbExt(const Common::String &filename); + + /** + * Return a list of possible filenames for blorb files + */ + static void getBlorbFilenames(const Common::String &srcFilename, Common::StringArray &filenames, + InterpreterType interpType); }; } // End of namespace Glk diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp index ffb5015633..b17304d957 100644 --- a/engines/glk/glk.cpp +++ b/engines/glk/glk.cpp @@ -126,16 +126,15 @@ Common::Error GlkEngine::run() { return Common::kNoGameDataFoundError; } else { // Check for a secondary blorb file with the same filename - Common::String baseName = filename; - while (baseName.contains('.')) - baseName.deleteLastChar(); - - if (Common::File::exists(baseName + ".blorb")) { - _blorb = new Blorb(baseName + ".blorb", getInterpreterType()); - SearchMan.add("blorb", _blorb, 99, false); - } else if (Common::File::exists(baseName + ".blb")) { - _blorb = new Blorb(baseName + ".blb", getInterpreterType()); - SearchMan.add("blorb", _blorb, 99, false); + Common::StringArray blorbFilenames; + Blorb::getBlorbFilenames(filename, blorbFilenames, getInterpreterType()); + + for (uint idx = 0; idx < blorbFilenames.size(); ++idx) { + if (Common::File::exists(blorbFilenames[idx])) { + _blorb = new Blorb(blorbFilenames[idx], getInterpreterType()); + SearchMan.add("blorb", _blorb, 99, false); + break; + } } // Open up the game file |