Skip to content

Commit

Permalink
SHERLOCK: Add code to make non-interactive demo completable
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed May 18, 2015
1 parent b1b7ee3 commit d82d476
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 19 deletions.
6 changes: 4 additions & 2 deletions engines/sherlock/journal.cpp
Expand Up @@ -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();
}
}

/**
Expand Down
12 changes: 7 additions & 5 deletions engines/sherlock/resources.cpp
Expand Up @@ -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");
}
}

/**
Expand Down
10 changes: 5 additions & 5 deletions engines/sherlock/scalpel/scalpel.cpp
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -279,7 +279,7 @@ void ScalpelEngine::initialize() {
* Show the opening sequence
*/
void ScalpelEngine::showOpening() {
if (getIsDemo())
if (getIsDemo() && _interactiveFl)
return;

if (!showCityCutscene())
Expand Down
4 changes: 4 additions & 0 deletions engines/sherlock/screen.cpp
Expand Up @@ -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);

Expand Down
10 changes: 10 additions & 0 deletions engines/sherlock/sherlock.cpp
Expand Up @@ -49,6 +49,7 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam
_loadGameSlot = -1;
_canLoadSave = false;
_showOriginalSavesDialog = false;
_interactiveFl = true;
}

SherlockEngine::~SherlockEngine() {
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions engines/sherlock/sherlock.h
Expand Up @@ -109,6 +109,7 @@ class SherlockEngine : public Engine {
int _loadGameSlot;
bool _canLoadSave;
bool _showOriginalSavesDialog;
bool _interactiveFl;
public:
SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
virtual ~SherlockEngine();
Expand Down
15 changes: 10 additions & 5 deletions engines/sherlock/sound.cpp
Expand Up @@ -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");
}
}
}

Expand All @@ -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] = {
Expand Down
10 changes: 8 additions & 2 deletions engines/sherlock/user_interface.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit d82d476

Please sign in to comment.