From d82d476b277f80b69514fcb360ec47e9482e4a28 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 May 2015 20:57:27 +0200 Subject: SHERLOCK: Add code to make non-interactive demo completable --- engines/sherlock/journal.cpp | 6 ++++-- engines/sherlock/resources.cpp | 12 +++++++----- engines/sherlock/scalpel/scalpel.cpp | 10 +++++----- engines/sherlock/screen.cpp | 4 ++++ engines/sherlock/sherlock.cpp | 10 ++++++++++ engines/sherlock/sherlock.h | 1 + engines/sherlock/sound.cpp | 15 ++++++++++----- engines/sherlock/user_interface.cpp | 10 ++++++++-- 8 files changed, 49 insertions(+), 19 deletions(-) (limited to 'engines/sherlock') diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp index dc4ab9495f..3b63294b06 100644 --- a/engines/sherlock/journal.cpp +++ b/engines/sherlock/journal.cpp @@ -57,8 +57,10 @@ Journal::Journal(SherlockEngine *vm): _vm(vm) { _up = _down = false; _page = 1; - // Load the journal directory and location names - loadJournalLocations(); + if (_vm->_interactiveFl) { + // Load the journal directory and location names + loadJournalLocations(); + } } /** diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp index f6fbded9b1..456006a86a 100644 --- a/engines/sherlock/resources.cpp +++ b/engines/sherlock/resources.cpp @@ -102,11 +102,13 @@ Common::SeekableReadStream *Cache::get(const Common::String &filename) const { Resources::Resources(SherlockEngine *vm): _vm(vm), _cache(vm) { _resourceIndex = -1; - addToCache("vgs.lib"); - addToCache("talk.lib"); - addToCache("sequence.txt"); - addToCache("journal.txt"); - addToCache("portrait.lib"); + if (_vm->_interactiveFl) { + addToCache("vgs.lib"); + addToCache("talk.lib"); + addToCache("sequence.txt"); + addToCache("journal.txt"); + addToCache("portrait.lib"); + } } /** diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index 6959e435d2..078677be65 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -251,9 +251,9 @@ void ScalpelEngine::initialize() { _flags[39] = true; // Turn on Baker Street if (!getIsDemo()) { - // Load the map co-ordinates for each scene and sequence data - _map->loadPoints(NUM_PLACES, &MAP_X[0], &MAP_Y[0], &MAP_TRANSLATE[0]); - _map->loadSequences(3, &MAP_SEQUENCES[0][0]); + // Load the map co-ordinates for each scene and sequence data + _map->loadPoints(NUM_PLACES, &MAP_X[0], &MAP_Y[0], &MAP_TRANSLATE[0]); + _map->loadSequences(3, &MAP_SEQUENCES[0][0]); } // Load the inventory @@ -269,7 +269,7 @@ void ScalpelEngine::initialize() { _animation->setTitleFrames(&TITLE_FRAMES[0][0], 7, 9); // Starting scene - if (getIsDemo()) + if (getIsDemo() && _interactiveFl) _scene->_goToScene = 3; else _scene->_goToScene = 4; @@ -279,7 +279,7 @@ void ScalpelEngine::initialize() { * Show the opening sequence */ void ScalpelEngine::showOpening() { - if (getIsDemo()) + if (getIsDemo() && _interactiveFl) return; if (!showCityCutscene()) diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index c1c53fbe65..e98d9a51a9 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -53,6 +53,10 @@ Screen::~Screen() { * Set the font to use for writing text on the screen */ void Screen::setFont(int fontNumb) { + // Interactive demo doesn't use fonts + if (!_vm->_interactiveFl) + return; + _fontNumber = fontNumb; Common::String fname = Common::String::format("FONT%d.VGS", fontNumb + 1); diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index 09a8ef18ef..5c7354e5f3 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -49,6 +49,7 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam _loadGameSlot = -1; _canLoadSave = false; _showOriginalSavesDialog = false; + _interactiveFl = true; } SherlockEngine::~SherlockEngine() { @@ -79,6 +80,15 @@ void SherlockEngine::initialize() { ImageFile::setVm(this); Object::setVm(this); Sprite::setVm(this); + + if (getIsDemo()) { + Common::File f; + // The interactive demo doesn't have an intro thus doesn't include TITLE.SND + // At the opposite, the non-interactive demo is only the intro. + if (f.exists("TITLE.SND")) + _interactiveFl = false; + } + _res = new Resources(this); _animation = new Animation(this); _debugger = new Debugger(this); diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h index 33e4a45b40..bd6d4a4c8e 100644 --- a/engines/sherlock/sherlock.h +++ b/engines/sherlock/sherlock.h @@ -109,6 +109,7 @@ public: int _loadGameSlot; bool _canLoadSave; bool _showOriginalSavesDialog; + bool _interactiveFl; public: SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc); virtual ~SherlockEngine(); diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp index e0552a8b5e..5199fe7dc4 100644 --- a/engines/sherlock/sound.cpp +++ b/engines/sherlock/sound.cpp @@ -44,12 +44,16 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer): _vm(vm), _mixer(mixer) { _musicOn = true; _speechOn = true; - _vm->_res->addToCache("MUSIC.LIB"); - _vm->_res->addToCache("SND.SND"); - - if (!_vm->getIsDemo()) { + if (!_vm->_interactiveFl) _vm->_res->addToCache("TITLE.SND"); - _vm->_res->addToCache("EPILOGUE.SND"); + else { + _vm->_res->addToCache("MUSIC.LIB"); + _vm->_res->addToCache("SND.SND"); + + if (!_vm->getIsDemo()) { + _vm->_res->addToCache("TITLE.SND"); + _vm->_res->addToCache("EPILOGUE.SND"); + } } } @@ -64,6 +68,7 @@ void Sound::syncSoundSettings() { void Sound::loadSound(const Common::String &name, int priority) { // No implementation required in ScummVM + warning("loadSound"); } static int8 creativeADPCM_ScaleMap[64] = { diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp index d5ff828aee..e2ad307aa4 100644 --- a/engines/sherlock/user_interface.cpp +++ b/engines/sherlock/user_interface.cpp @@ -81,8 +81,14 @@ const char *const MUSE[] = { /*----------------------------------------------------------------*/ UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) { - _controls = new ImageFile("menu.all"); - _controlPanel = new ImageFile("controls.vgs"); + if (_vm->_interactiveFl) { + _controls = new ImageFile("menu.all"); + _controlPanel = new ImageFile("controls.vgs"); + } else { + _controls = nullptr; + _controlPanel = nullptr; + } + _bgFound = 0; _oldBgFound = -1; _keycode = Common::KEYCODE_INVALID; -- cgit v1.2.3