aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2012-04-09 19:38:25 +0100
committerThierry Crozat2012-04-15 11:45:14 +0100
commita3406aab131142418b442e74bdd0f5a5ab196028 (patch)
tree6bbe0ad72e884cb6ca01676360c8439e902d8e4e
parent586d9bf32fed9bc2009dcf890a0b714e1e618c2c (diff)
downloadscummvm-rg350-a3406aab131142418b442e74bdd0f5a5ab196028.tar.gz
scummvm-rg350-a3406aab131142418b442e74bdd0f5a5ab196028.tar.bz2
scummvm-rg350-a3406aab131142418b442e74bdd0f5a5ab196028.zip
DREAMWEB: Support opening data files from ES and FR CD version
-rw-r--r--engines/dreamweb/dreamweb.cpp41
-rw-r--r--engines/dreamweb/dreamweb.h1
-rw-r--r--engines/dreamweb/stubs.cpp8
3 files changed, 46 insertions, 4 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index a846579e46..52aa6ff487 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -63,6 +63,20 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_channel1 = 0;
_datafilePrefix = "DREAMWEB.";
+ // ES and FR CD release use a different data file prefix
+ if (isCD()) {
+ switch(getLanguage()) {
+ case Common::ES_ESP:
+ _datafilePrefix = "DREAMWSP.";
+ break;
+ case Common::FR_FRA:
+ _datafilePrefix = "DREAMWFR.";
+ break;
+ default:
+ // Nothing to do
+ break;
+ }
+ }
_openChangeSize = kInventx+(4*kItempicsize);
_quitRequested = false;
@@ -530,6 +544,33 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const {
return c;
}
}
+
+Common::String DreamWebEngine::modifyFileName(const char* name) {
+ Common::String fileName(name);
+
+ // Sanity check
+ if (!fileName.hasPrefix("DREAMWEB"))
+ return fileName;
+
+ // CD ES and FR release use a different file name
+ if (isCD()) {
+ switch(getLanguage()) {
+ case Common::ES_ESP:
+ fileName.setChar('S', 6);
+ fileName.setChar('P', 7);
+ break;
+ case Common::FR_FRA:
+ fileName.setChar('F', 6);
+ fileName.setChar('R', 7);
+ break;
+ default:
+ // Nothing to do
+ break;
+ }
+ }
+
+ return fileName;
+}
bool DreamWebEngine::hasSpeech() {
return isCD() && _hasSpeech;
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 13a27449dc..a23b79c773 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -149,6 +149,7 @@ public:
Common::Language getLanguage() const;
uint8 modifyChar(uint8 c) const;
+ Common::String modifyFileName(const char*);
void stopSound(uint8 channel);
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 8226982db7..5a53b82510 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -2090,8 +2090,8 @@ void DreamWebEngine::getRidOfAll() {
void DreamWebEngine::loadRoomData(const Room &room, bool skipDat) {
processEvents();
Common::File file;
- if (!file.open(room.name))
- error("cannot open file %s", room.name);
+ if (!file.open(modifyFileName(room.name)))
+ error("cannot open file %s", modifyFileName(room.name).c_str());
FileHeader header;
file.read((uint8 *)&header, sizeof(FileHeader));
@@ -2176,8 +2176,8 @@ void DreamWebEngine::restoreReels() {
processEvents();
Common::File file;
- if (!file.open(room.name))
- error("cannot open file %s", room.name);
+ if (!file.open(modifyFileName(room.name)))
+ error("cannot open file %s", modifyFileName(room.name).c_str());
FileHeader header;
file.read((uint8 *)&header, sizeof(FileHeader));