aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sci.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2010-08-29 00:17:56 +0000
committerFilippos Karapetis2010-08-29 00:17:56 +0000
commit3f1f894e8eeb091153963b8b936b533f78f17e4a (patch)
treefa1f2d094b642e44ba21183da5fd9b83cb16e950 /engines/sci/sci.cpp
parenta2a30735626f8b4440f2a3128e0568c55b840b30 (diff)
downloadscummvm-rg350-3f1f894e8eeb091153963b8b936b533f78f17e4a.tar.gz
scummvm-rg350-3f1f894e8eeb091153963b8b936b533f78f17e4a.tar.bz2
scummvm-rg350-3f1f894e8eeb091153963b8b936b533f78f17e4a.zip
SCI: Added proper handling of QFG exported character files.
Now, QFG2, 3 and 4 may read exported characters from all other QFG games, like the originals did. Fixes bug #3054692 - "QFG2/QFG3 Import issues". svn-id: r52430
Diffstat (limited to 'engines/sci/sci.cpp')
-rw-r--r--engines/sci/sci.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index c7309a8415..cb36ebd0f5 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -637,36 +637,40 @@ Common::String SciEngine::getSavegamePattern() const {
}
Common::String SciEngine::getFilePrefix() const {
- if (_gameId == GID_QFG2) {
- // Quest for Glory 2 wants to read files from Quest for Glory 1 (EGA/VGA) to import character data
- if (_gamestate->currentRoomNumber() == 805) {
- // Check if there are any QFG1VGA games - bug #3054613
- Common::StringArray saveNames = g_engine->getSaveFileManager()->listSavefiles("qfg1vga-*.sav");
- return (saveNames.size() > 0) ? "qfg1vga" : "qfg1";
- }
- } else if (_gameId == GID_QFG3) {
- // Quest for Glory 3 wants to read files from Quest for Glory 2 to import character data
- if (_gamestate->currentRoomNumber() == 54)
- return "qfg2";
- } else if (_gameId == GID_QFG4) {
- // Quest for Glory 4 wants to read files from Quest for Glory 3 to import character data
- if (_gamestate->currentRoomNumber() == 54)
- return "qfg3";
- }
return _targetName;
}
Common::String SciEngine::wrapFilename(const Common::String &name) const {
- return getFilePrefix() + "-" + name;
+ // Do not wrap the game prefix when reading files in QFG import screens.
+ // That way, we can read exported characters from all QFG games, as
+ // intended.
+ return !isQFGImportScreen() ? getFilePrefix() + "-" + name : name;
}
Common::String SciEngine::unwrapFilename(const Common::String &name) const {
Common::String prefix = getFilePrefix() + "-";
- if (name.hasPrefix(prefix.c_str()))
+ // Do not unwrap the file name when reading files in QFG import screens.
+ // We don't wrap the game ID prefix in these screens in order to read
+ // save states from all QFG games.
+ if (name.hasPrefix(prefix.c_str()) && !isQFGImportScreen())
return Common::String(name.c_str() + prefix.size());
return name;
}
+bool SciEngine::isQFGImportScreen() const {
+ if (_gameId == GID_QFG2 && _gamestate->currentRoomNumber() == 805) {
+ // QFG2 character import screen
+ return true;
+ } else if (_gameId == GID_QFG3 && _gamestate->currentRoomNumber() == 54) {
+ // QFG3 character import screen
+ return true;
+ } else if (_gameId == GID_QFG4 && _gamestate->currentRoomNumber() == 54) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
void SciEngine::pauseEngineIntern(bool pause) {
_mixer->pauseAll(pause);
}