aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/journal.cpp27
-rw-r--r--engines/sherlock/objects.h1
-rw-r--r--engines/sherlock/resources.cpp12
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp10
-rw-r--r--engines/sherlock/scene.cpp10
-rw-r--r--engines/sherlock/scene.h4
-rw-r--r--engines/sherlock/screen.cpp23
-rw-r--r--engines/sherlock/screen.h1
-rw-r--r--engines/sherlock/sherlock.cpp14
-rw-r--r--engines/sherlock/sherlock.h5
-rw-r--r--engines/sherlock/sound.cpp18
-rw-r--r--engines/sherlock/talk.cpp2
-rw-r--r--engines/sherlock/user_interface.cpp10
13 files changed, 93 insertions, 44 deletions
diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index 966ed55b81..7e0120c67d 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();
+ }
}
/**
@@ -562,7 +564,7 @@ bool Journal::drawJournal(int direction, int howFar) {
int yp = 37;
int startPage = _page;
bool endJournal = false;
- bool firstOccurance = false;
+ bool firstOccurance = true;
bool searchSuccessful = false;
bool endFlag = false;
int lineNum = 0;
@@ -1030,10 +1032,14 @@ int Journal::getFindName(bool printError) {
SEARCH_POINTS[1][2] - screen.stringWidth("Backward") / 2, "Backward");
screen.makeButton(Common::Rect(SEARCH_POINTS[2][0], yp, SEARCH_POINTS[2][1], yp + 10),
SEARCH_POINTS[2][2] - screen.stringWidth("Forward") / 2, "Forward");
+ screen.gPrint(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth("Exit") / 2, yp),
+ COMMAND_FOREGROUND, "E");
+ screen.gPrint(Common::Point(SEARCH_POINTS[1][2] - screen.stringWidth("Backward") / 2, yp),
+ COMMAND_FOREGROUND, "B");
+ screen.gPrint(Common::Point(SEARCH_POINTS[2][2] - screen.stringWidth("Forward") / 2, yp),
+ COMMAND_FOREGROUND, "F");
- screen.gPrint(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth("Exit") / 2, yp), COMMAND_FOREGROUND, "E");
- screen.gPrint(Common::Point(SEARCH_POINTS[1][2] - screen.stringWidth("Backward") / 2, yp), COMMAND_FOREGROUND, "B");
- screen.gPrint(Common::Point(SEARCH_POINTS[2][2] - screen.stringWidth("Forward") / 2, yp), COMMAND_FOREGROUND, "F");
+ screen.makeField(Common::Rect(12, 185, 307, 196));
screen.fillRect(Common::Rect(12, 185, 307, 186), BUTTON_BOTTOM);
screen.vLine(12, 185, 195, BUTTON_BOTTOM);
@@ -1139,10 +1145,11 @@ int Journal::getFindName(bool printError) {
if (keyState.keycode >= Common::KEYCODE_SPACE && keyState.keycode <= Common::KEYCODE_z
&& keyState.keycode != Common::KEYCODE_AT && name.size() < 50
&& (xp + screen.charWidth(keyState.keycode)) < 296) {
+ char ch = toupper(keyState.keycode);
screen.vgaBar(Common::Rect(xp, yp, xp + 8, yp + 9), BUTTON_MIDDLE);
- screen.print(Common::Point(xp, yp), TALK_FOREGROUND, "%c", (char)keyState.keycode);
- xp += screen.charWidth((char)keyState.keycode);
- name += (char)keyState.keycode;
+ screen.print(Common::Point(xp, yp), TALK_FOREGROUND, "%c", ch);
+ xp += screen.charWidth(ch);
+ name += ch;
}
}
@@ -1158,7 +1165,7 @@ int Journal::getFindName(bool printError) {
break;
}
}
- } while (!done);
+ } while (!done && !_vm->shouldQuit());
if (done != -1) {
_find = name;
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index 4068973e58..7a1ef1aebe 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -164,6 +164,7 @@ struct UseType {
void load(Common::SeekableReadStream &s);
};
+enum { TURNON_OBJ = 0x20, TURNOFF_OBJ = 0x40 };
class Object {
private:
static SherlockEngine *_vm;
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/scene.cpp b/engines/sherlock/scene.cpp
index 41d9284024..a65c11b167 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -43,7 +43,7 @@ void BgFileHeader::load(Common::SeekableReadStream &s) {
/**
* Load the data for the object
*/
-void BgfileheaderInfo::load(Common::SeekableReadStream &s) {
+void BgFileHeaderInfo::load(Common::SeekableReadStream &s) {
_filesize = s.readUint32LE();
_maxFrames = s.readByte();
@@ -176,7 +176,7 @@ void Scene::selectScene() {
_restoreFlag = true;
events.clearEvents();
- // If there were any scripst waiting to be run, but were interrupt by a running
+ // If there were any scripts waiting to be run, but were interrupt by a running
// canimation (probably the last scene's exit canim), clear the _scriptMoreFlag
if (talk._scriptMoreFlag == 3)
talk._scriptMoreFlag = 0;
@@ -265,7 +265,7 @@ bool Scene::loadScene(const Common::String &filename) {
_invGraphicItems = bgHeader._numImages + 1;
// Read in the shapes header info
- Common::Array<BgfileheaderInfo> bgInfo;
+ Common::Array<BgFileHeaderInfo> bgInfo;
bgInfo.resize(bgHeader._numStructs);
for (uint idx = 0; idx < bgInfo.size(); ++idx)
@@ -461,13 +461,13 @@ bool Scene::loadScene(const Common::String &filename) {
// Check for TURNON objects
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
- if (_bgShapes[idx]._type == HIDDEN && (_bgShapes[idx]._flags & 0x20))
+ if (_bgShapes[idx]._type == HIDDEN && (_bgShapes[idx]._flags & TURNON_OBJ))
_bgShapes[idx].toggleHidden();
}
// Check for TURNOFF objects
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
- if (_bgShapes[idx]._type != HIDDEN && (_bgShapes[idx]._flags & 0x40) &&
+ if (_bgShapes[idx]._type != HIDDEN && (_bgShapes[idx]._flags & TURNOFF_OBJ) &&
_bgShapes[idx]._type != INVALID)
_bgShapes[idx].toggleHidden();
if (_bgShapes[idx]._type == HIDE_SHAPE)
diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h
index 665f5d28e4..78d41299e6 100644
--- a/engines/sherlock/scene.h
+++ b/engines/sherlock/scene.h
@@ -49,7 +49,7 @@ struct BgFileHeader {
void load(Common::SeekableReadStream &s);
};
-struct BgfileheaderInfo {
+struct BgFileHeaderInfo {
int _filesize; // How long images are
int _maxFrames; // How many unique frames in object
Common::String _filename; // Filename of object
@@ -83,7 +83,7 @@ struct SceneSound {
void load(Common::SeekableReadStream &s);
};
-class ObjectArray: public Common::Array<Object> {
+class ObjectArray : public Common::Array<Object> {
public:
int indexOf(const Object &obj) const;
};
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index cbf18f146f..d9ec1d745d 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);
@@ -112,8 +116,7 @@ int Screen::equalizePalette(const byte palette[PALETTE_SIZE]) {
// For any palette component that doesn't already match the given destination
// palette, change by 1 towards the reference palette component
for (int idx = 0; idx < PALETTE_SIZE; ++idx) {
- if (tempPalette[idx] > palette[idx])
- {
+ if (tempPalette[idx] > palette[idx]) {
tempPalette[idx] = MAX((int)palette[idx], (int)tempPalette[idx] - 4);
++total;
} else if (tempPalette[idx] < palette[idx]) {
@@ -212,7 +215,7 @@ void Screen::randomTransition() {
for (int idx = 0; idx <= 65535 && !_vm->shouldQuit(); ++idx) {
_transitionSeed = _transitionSeed * TRANSITION_MULTIPLIER + 1;
- int offset = _transitionSeed & 65535;
+ int offset = _transitionSeed & 0xFFFF;
if (offset < (SHERLOCK_SCREEN_WIDTH * SHERLOCK_SCREEN_HEIGHT))
*((byte *)getPixels() + offset) = *((const byte *)_backBuffer->getPixels() + offset);
@@ -467,7 +470,7 @@ void Screen::buttonPrint(const Common::Point &pt, byte color, bool slamIt,
}
/**
- * Draw a panel in th eback buffer with a raised area effect around the edges
+ * Draw a panel in the back buffer with a raised area effect around the edges
*/
void Screen::makePanel(const Common::Rect &r) {
_backBuffer->fillRect(r, BUTTON_MIDDLE);
@@ -483,6 +486,18 @@ void Screen::makePanel(const Common::Rect &r) {
}
/**
+ * Draw a field in the back buffer with a raised area effect around the edges,
+ * suitable for text input.
+ */
+void Screen::makeField(const Common::Rect &r) {
+ _backBuffer->fillRect(r, BUTTON_MIDDLE);
+ _backBuffer->hLine(r.left, r.top, r.right - 1, BUTTON_BOTTOM);
+ _backBuffer->hLine(r.left + 1, r.bottom - 1, r.right - 1, BUTTON_TOP);
+ _backBuffer->vLine(r.left, r.top + 1, r.bottom - 1, BUTTON_BOTTOM);
+ _backBuffer->vLine(r.right - 1, r.top + 1, r.bottom - 2, BUTTON_TOP);
+}
+
+/**
* Sets the active back buffer pointer to a restricted sub-area of the first back buffer
*/
void Screen::setDisplayBounds(const Common::Rect &r) {
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index 1f3c23748f..2103588fe0 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -123,6 +123,7 @@ public:
void buttonPrint(const Common::Point &pt, byte color, bool slamIt, const Common::String &str);
void makePanel(const Common::Rect &r);
+ void makeField(const Common::Rect &r);
void setDisplayBounds(const Common::Rect &r);
void resetDisplayBounds();
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index 09a8ef18ef..bdd2ec3588 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);
@@ -119,7 +129,9 @@ Common::Error SherlockEngine::run() {
_saves->loadGame(_loadGameSlot);
_loadGameSlot = -1;
} else {
- showOpening();
+ do
+ showOpening();
+ while (!shouldQuit() && !_interactiveFl);
}
while (!shouldQuit()) {
diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h
index 33e4a45b40..68c8e8daca 100644
--- a/engines/sherlock/sherlock.h
+++ b/engines/sherlock/sherlock.h
@@ -50,10 +50,6 @@
namespace Sherlock {
enum {
- kFileTypeHash
-};
-
-enum {
kDebugScript = 1 << 0
};
@@ -109,6 +105,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 40aa4fa81a..c79e179c1c 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -44,10 +44,17 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer): _vm(vm), _mixer(mixer) {
_musicOn = true;
_speechOn = true;
- _vm->_res->addToCache("MUSIC.LIB");
- _vm->_res->addToCache("TITLE.SND");
- _vm->_res->addToCache("EPILOGUE.SND");
- _vm->_res->addToCache("SND.SND");
+ if (!_vm->_interactiveFl)
+ _vm->_res->addToCache("TITLE.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");
+ }
+ }
}
/**
@@ -61,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] = {
@@ -81,7 +89,7 @@ static uint8 creativeADPCM_AdjustMap[64] = {
240, 0, 0, 0, 0, 0, 0, 0
};
-byte Sound::decodeSample(byte sample, byte& reference, int16& scale) {
+byte Sound::decodeSample(byte sample, byte &reference, int16 &scale) {
int16 samp = sample + scale;
int16 ref = 0;
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index b38b432e37..dfcf9b912d 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -672,7 +672,7 @@ void Talk::drawInterface() {
}
/**
- * Display a list of statements in a window at the bottom of the scren that the
+ * Display a list of statements in a window at the bottom of the screen that the
* player can select from.
*/
bool Talk::displayTalk(bool slamIt) {
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;