aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/scene_eob.cpp
diff options
context:
space:
mode:
authorathrxx2012-01-15 01:13:03 +0100
committerathrxx2012-01-15 13:36:50 +0100
commitd355c536c4d3dea4ff61288d8ac85ab071451825 (patch)
treeb9abfc0c50583fd395d0712513f52e9f47b7c8a5 /engines/kyra/scene_eob.cpp
parente73984631083a29c072c3bc2191eefbc0d36b9cd (diff)
downloadscummvm-rg350-d355c536c4d3dea4ff61288d8ac85ab071451825.tar.gz
scummvm-rg350-d355c536c4d3dea4ff61288d8ac85ab071451825.tar.bz2
scummvm-rg350-d355c536c4d3dea4ff61288d8ac85ab071451825.zip
KYRA: (EOB) - add support for original save game files
The engine will try to import original save game files once per target (especially the "Quick Start Party"). Afterwards the user can manually import save files with the debug console.
Diffstat (limited to 'engines/kyra/scene_eob.cpp')
-rw-r--r--engines/kyra/scene_eob.cpp76
1 files changed, 50 insertions, 26 deletions
diff --git a/engines/kyra/scene_eob.cpp b/engines/kyra/scene_eob.cpp
index 982191b359..3d615e966a 100644
--- a/engines/kyra/scene_eob.cpp
+++ b/engines/kyra/scene_eob.cpp
@@ -38,31 +38,7 @@ void EoBCoreEngine::loadLevel(int level, int sub) {
_currentSub = sub;
uint32 end = _system->getMillis() + 500;
- Common::String file;
- Common::SeekableReadStream *s = 0;
- static const char *suffix[] = { "INF", "DRO", "ELO", 0 };
-
- for (const char *const *sf = suffix; *sf && !s; sf++) {
- file = Common::String::format("LEVEL%d.%s", level, *sf);
- s = _res->createReadStream(file);
- }
-
- if (!s)
- error("Failed to load level file LEVEL%d.INF/DRO/ELO", level);
-
- if (s->readUint16LE() + 2 == s->size()) {
- if (s->readUint16LE() == 4) {
- delete s;
- s = 0;
- _screen->loadBitmap(file.c_str(), 5, 5, 0);
- }
- }
-
- if (s) {
- s->seek(0);
- _screen->loadFileDataToPage(s, 5, 15000);
- delete s;
- }
+ readLevelFileData(level);
Common::String gfxFile;
// Work around for issue with corrupt (incomplete) monster property data
@@ -121,6 +97,34 @@ void EoBCoreEngine::loadLevel(int level, int sub) {
_screen->setCurPage(0);
}
+void EoBCoreEngine::readLevelFileData(int level) {
+ Common::String file;
+ Common::SeekableReadStream *s = 0;
+ static const char *suffix[] = { "INF", "DRO", "ELO", 0 };
+
+ for (const char *const *sf = suffix; *sf && !s; sf++) {
+ file = Common::String::format("LEVEL%d.%s", level, *sf);
+ s = _res->createReadStream(file);
+ }
+
+ if (!s)
+ error("Failed to load level file LEVEL%d.INF/DRO/ELO", level);
+
+ if (s->readUint16LE() + 2 == s->size()) {
+ if (s->readUint16LE() == 4) {
+ delete s;
+ s = 0;
+ _screen->loadBitmap(file.c_str(), 5, 5, 0);
+ }
+ }
+
+ if (s) {
+ s->seek(0);
+ _screen->loadFileDataToPage(s, 5, 15000);
+ delete s;
+ }
+}
+
Common::String EoBCoreEngine::initLevelData(int sub) {
const uint8 *data = _screen->getCPagePtr(5) + 2;
const uint8 *pos = data;
@@ -300,9 +304,29 @@ const uint8 *EoBCoreEngine::getBlockFileData(int) {
return _screen->getCPagePtr(14);
}
+Common::String EoBCoreEngine::getBlockFileName(int levelIndex, int sub) {
+ readLevelFileData(levelIndex);
+ const uint8 *data = _screen->getCPagePtr(5) + 2;
+ const uint8 *pos = data;
+
+ for (int i = 0; i < sub; i++)
+ pos = data + READ_LE_UINT16(pos);
+
+ pos += 2;
+
+ if (*pos++ == 0xEC || _flags.gameID == GI_EOB1) {
+ if (_flags.gameID == GI_EOB1)
+ pos -= 3;
+
+ return Common::String((const char *)pos);
+ }
+
+ return Common::String();
+}
+
const uint8 *EoBCoreEngine::getBlockFileData(const char *mazFile) {
_curBlockFile = mazFile;
- return getBlockFileData(0);
+ return getBlockFileData();
}
void EoBCoreEngine::loadDecorations(const char *cpsFile, const char *decFile) {