diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 7 | ||||
-rw-r--r-- | engines/bladerunner/chapters.cpp | 3 | ||||
-rw-r--r-- | engines/bladerunner/slice_animations.cpp | 26 | ||||
-rw-r--r-- | engines/bladerunner/slice_animations.h | 5 |
4 files changed, 29 insertions, 12 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 0b1ad83abd..ab8ad36979 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -436,13 +436,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { if (!r) return false; - // TODO: Support cdframes - - r = _sliceAnimations->openHDFrames(); - if (!r) { - return false; - } - r = _sliceAnimations->openCoreAnim(); if (!r) { return false; diff --git a/engines/bladerunner/chapters.cpp b/engines/bladerunner/chapters.cpp index e7404c3c97..16d084b970 100644 --- a/engines/bladerunner/chapters.cpp +++ b/engines/bladerunner/chapters.cpp @@ -23,12 +23,15 @@ #include "bladerunner/chapters.h" #include "bladerunner/bladerunner.h" +#include "bladerunner/slice_animations.h" namespace BladeRunner { bool Chapters::enterChapter(int chapter) { int id = _resourceIds[chapter]; + _vm->_sliceAnimations->openFrames(id); + if (!_vm->openArchive("A.TLK")) return false; diff --git a/engines/bladerunner/slice_animations.cpp b/engines/bladerunner/slice_animations.cpp index 181b11d9f1..411e6a07a1 100644 --- a/engines/bladerunner/slice_animations.cpp +++ b/engines/bladerunner/slice_animations.cpp @@ -93,8 +93,28 @@ bool SliceAnimations::openCoreAnim() { return _coreAnimPageFile.open("COREANIM.DAT"); } -bool SliceAnimations::openHDFrames() { - return _framesPageFile.open("HDFRAMES.DAT"); +bool SliceAnimations::openFrames(int fileNumber) { + if (_framesPageFile._fileNumber == -1) { // Running for the first time, need to probe + // First, try HDFRAMES.DAT + if (_framesPageFile.open("HDFRAMES.DAT")) { + _framesPageFile._fileNumber = 0; + + return true; + } + } + + if (_framesPageFile._fileNumber == 0) // HDFRAMES.DAT + return true; + + if (_framesPageFile._fileNumber == fileNumber) + return true; + + _framesPageFile._fileNumber = fileNumber; + + if (fileNumber == 1 && _framesPageFile.open("CDFRAMES.DAT")) // For Chapter1 we try both CDFRAMES.DAT and CDFRAMES1.DAT + return true; + + return _framesPageFile.open(Common::String::format("CDFRAMES%d.DAT", fileNumber)); } bool SliceAnimations::PageFile::open(const Common::String &name) { @@ -119,7 +139,7 @@ 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("PageFile::Open: page file \"%s\" opened with %d pages", name.c_str(), pageCount); return true; } diff --git a/engines/bladerunner/slice_animations.h b/engines/bladerunner/slice_animations.h index edc0684140..eafba1bb14 100644 --- a/engines/bladerunner/slice_animations.h +++ b/engines/bladerunner/slice_animations.h @@ -64,11 +64,12 @@ class SliceAnimations { }; struct PageFile { + int _fileNumber; SliceAnimations *_sliceAnimations; Common::File _file; Common::Array<int32> _pageOffsets; - PageFile(SliceAnimations *sliceAnimations) : _sliceAnimations(sliceAnimations) {} + PageFile(SliceAnimations *sliceAnimations) : _sliceAnimations(sliceAnimations), _fileNumber(-1) {} bool open(const Common::String &name); void *loadPage(uint32 page); @@ -102,7 +103,7 @@ public: bool open(const Common::String &name); bool openCoreAnim(); - bool openHDFrames(); + bool openFrames(int fileNumber); Palette &getPalette(int i) { return _palettes[i]; }; void *getFramePtr(uint32 animation, uint32 frame); |