From 0d10297969317118d27ecef5eeeb3721b02030fc Mon Sep 17 00:00:00 2001 From: Thanasis Antoniou Date: Thu, 21 Mar 2019 12:12:34 +0200 Subject: BLADERUNNER: Handle gracefully missing HDFRAMES or required CDFRAMESx file --- engines/bladerunner/bladerunner.cpp | 8 +++++++- engines/bladerunner/chapters.cpp | 3 ++- engines/bladerunner/slice_animations.cpp | 11 +++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index ef91fd8c19..5b858b53c0 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -83,6 +83,7 @@ #include "common/savefile.h" #include "common/system.h" #include "common/debug-channels.h" +#include "gui/message.h" #include "engines/util.h" #include "engines/advancedDetector.h" @@ -847,7 +848,12 @@ void BladeRunnerEngine::gameTick() { } if (!_kia->isOpen() && !_sceneScript->isInsideScript() && !_aiScripts->isInsideScript()) { - _settings->openNewScene(); + if (!_settings->openNewScene()) { + Common::Error runtimeError = Common::Error(Common::kUnknownError, "A required game resource was not found"); + GUI::MessageDialog dialog(runtimeError.getDesc()); + dialog.runModal(); + return; + } } if (_gameAutoSave >= 0) { diff --git a/engines/bladerunner/chapters.cpp b/engines/bladerunner/chapters.cpp index afe04139b6..64da4812cb 100644 --- a/engines/bladerunner/chapters.cpp +++ b/engines/bladerunner/chapters.cpp @@ -30,7 +30,8 @@ namespace BladeRunner { bool Chapters::enterChapter(int chapter) { int id = _resourceIds[chapter]; - _vm->_sliceAnimations->openFrames(id); + if (!_vm->_sliceAnimations->openFrames(id)) + return false; if (!_vm->openArchive("A.TLK")) return false; diff --git a/engines/bladerunner/slice_animations.cpp b/engines/bladerunner/slice_animations.cpp index 5db08063b8..11ec717b3e 100644 --- a/engines/bladerunner/slice_animations.cpp +++ b/engines/bladerunner/slice_animations.cpp @@ -95,12 +95,15 @@ bool SliceAnimations::openCoreAnim() { } 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; + } else { + warning("SliceAnimations::openFrames: HDFRAMES.DAT resource not found. Falling back to using CDFRAMESx.DAT files instead..."); } } @@ -114,10 +117,14 @@ bool SliceAnimations::openFrames(int fileNumber) { _framesPageFile._fileNumber = fileNumber; - if (fileNumber == 1 && _framesPageFile.open("CDFRAMES.DAT")) // For Chapter1 we try both CDFRAMES.DAT and CDFRAMES1.DAT + 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)); + if (_framesPageFile.open(Common::String::format("CDFRAMES%d.DAT", fileNumber))) { + return true; + } + return false; } bool SliceAnimations::PageFile::open(const Common::String &name) { -- cgit v1.2.3