diff options
author | Eugene Sandulenko | 2018-04-01 14:41:23 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-04-01 14:41:23 +0200 |
commit | 506ed95cdcf11523efb06f8816c4f99a32a6a243 (patch) | |
tree | f3c9f3a1ae11ae4fa35efaf6d47adfdecf90e0c2 | |
parent | b277e795aa3157511a1a3d3804f25d233c77e7f8 (diff) | |
download | scummvm-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.cpp | 12 | ||||
-rw-r--r-- | engines/bladerunner/slice_animations.h | 1 |
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); }; |