aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2018-04-01 14:41:23 +0200
committerEugene Sandulenko2018-04-01 14:41:23 +0200
commit506ed95cdcf11523efb06f8816c4f99a32a6a243 (patch)
treef3c9f3a1ae11ae4fa35efaf6d47adfdecf90e0c2
parentb277e795aa3157511a1a3d3804f25d233c77e7f8 (diff)
downloadscummvm-rg350-506ed95cdcf11523efb06f8816c4f99a32a6a243.tar.gz
scummvm-rg350-506ed95cdcf11523efb06f8816c4f99a32a6a243.tar.bz2
scummvm-rg350-506ed95cdcf11523efb06f8816c4f99a32a6a243.zip
BLADERUNNER: Fix chapter switching with CDFRAMES.DAT
-rw-r--r--engines/bladerunner/slice_animations.cpp12
-rw-r--r--engines/bladerunner/slice_animations.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/engines/bladerunner/slice_animations.cpp b/engines/bladerunner/slice_animations.cpp
index 411e6a07a1..f452947f2f 100644
--- a/engines/bladerunner/slice_animations.cpp
+++ b/engines/bladerunner/slice_animations.cpp
@@ -103,13 +103,15 @@ bool SliceAnimations::openFrames(int fileNumber) {
}
}
+ warning("opening: %d", fileNumber);
+
if (_framesPageFile._fileNumber == 0) // HDFRAMES.DAT
return true;
if (_framesPageFile._fileNumber == fileNumber)
return true;
- _framesPageFile._fileNumber = fileNumber;
+ _framesPageFile.close();
if (fileNumber == 1 && _framesPageFile.open("CDFRAMES.DAT")) // For Chapter1 we try both CDFRAMES.DAT and CDFRAMES1.DAT
return true;
@@ -139,11 +141,17 @@ bool SliceAnimations::PageFile::open(const Common::String &name) {
_pageOffsets[pageNumber] = dataOffset + i * _sliceAnimations->_pageSize;
}
- debug("PageFile::Open: page file \"%s\" opened with %d pages", name.c_str(), pageCount);
+ debug(5, "PageFile::Open: page file \"%s\" opened with %d pages", name.c_str(), pageCount);
return true;
}
+void SliceAnimations::PageFile::close() {
+ if (_file.isOpen()) {
+ _file.close();
+ }
+}
+
void *SliceAnimations::PageFile::loadPage(uint32 pageNumber) {
if (_pageOffsets[pageNumber] == -1)
return nullptr;
diff --git a/engines/bladerunner/slice_animations.h b/engines/bladerunner/slice_animations.h
index eafba1bb14..0732e596ea 100644
--- a/engines/bladerunner/slice_animations.h
+++ b/engines/bladerunner/slice_animations.h
@@ -72,6 +72,7 @@ class SliceAnimations {
PageFile(SliceAnimations *sliceAnimations) : _sliceAnimations(sliceAnimations), _fileNumber(-1) {}
bool open(const Common::String &name);
+ void close();
void *loadPage(uint32 page);
};