aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sherlock/animation.cpp124
-rw-r--r--engines/sherlock/animation.h50
-rw-r--r--engines/sherlock/events.cpp20
-rw-r--r--engines/sherlock/events.h2
-rw-r--r--engines/sherlock/graphics.h2
-rw-r--r--engines/sherlock/module.mk2
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp34
-rw-r--r--engines/sherlock/scalpel/scalpel.h5
-rw-r--r--engines/sherlock/sherlock.cpp8
-rw-r--r--engines/sherlock/sherlock.h6
-rw-r--r--engines/sherlock/sound.cpp (renamed from engines/sherlock/vdaplayer.h)33
-rw-r--r--engines/sherlock/sound.h17
12 files changed, 294 insertions, 9 deletions
diff --git a/engines/sherlock/animation.cpp b/engines/sherlock/animation.cpp
new file mode 100644
index 0000000000..52859ce5e4
--- /dev/null
+++ b/engines/sherlock/animation.cpp
@@ -0,0 +1,124 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "sherlock/animation.h"
+#include "sherlock/sherlock.h"
+#include "common/algorithm.h"
+
+namespace Sherlock {
+
+// The following are a list of filenames played in the prologue that have
+// special effects associated with them at specific frames
+
+#define FRAMES_END 32000
+#define PROLOGUE_NAMES_COUNT 6
+#define TITLE_NAMES_COUNT 7
+static const char *const PROLOGUE_NAMES[6] = {
+ "subway1", "subway2", "finale2", "suicid", "coff3", "coff4"
+};
+static const int PROLOGUE_FRAMES[6][9] = {
+ { 4, 26, 54, 72, 92, 134, FRAMES_END },
+ { 2, 80, 95, 117, 166, FRAMES_END },
+ { 1, FRAMES_END },
+ { 42, FRAMES_END },
+ { FRAMES_END },
+ { FRAMES_END }
+};
+
+// Title animations file list
+static const char *const TITLE_NAMES[7] = {
+ "27pro1", "14note", "coff1", "coff2", "coff3", "coff4", "14kick"
+};
+
+static const int TITLE_FRAMES[7][9] = {
+ { 29, 131, FRAMES_END },
+ { 55, 80, 95, 117, 166, FRAMES_END },
+ { 15, FRAMES_END },
+ { 4, 37, 92, FRAMES_END },
+ { 2, 43, FRAMES_END },
+ { 2, FRAMES_END },
+ { 10, 50, FRAMES_END }
+};
+
+static const int NO_FRAMES = FRAMES_END;
+
+Animation::Animation(SherlockEngine *vm): _vm(vm) {
+ _useEpilogue2 = false;
+}
+
+void Animation::playPrologue(const Common::String &filename, int minDelay, int fade,
+ bool setPalette, int speed) {
+ // Check for any any sound frames for the given animation
+ const int *soundFrames = checkForSoundFrames(filename);
+
+ // Strip any extension off of the passed filename and add .vdx suffix
+ Common::String baseName = filename;
+ const char *p = strchr(baseName.c_str(), '.');
+ if (p)
+ baseName = Common::String(filename.c_str(), MIN(p - 1, baseName.c_str() + 7));
+
+ Common::String vdxName = baseName + ".vdx";
+
+ // Load the animation
+ Common::SeekableReadStream *stream;
+ if (!_titleOverride.empty())
+ stream = _vm->_res->load(vdxName, _titleOverride);
+ else if (_useEpilogue2)
+ stream = _vm->_res->load(vdxName, "epilog2.lib");
+ else
+ stream = _vm->_res->load(vdxName, "epilogoue.lib");
+ int resoucreIndex = _vm->_res->resouceIndex();
+
+ // Load initial image
+ //Common::String vdaName = baseName + ".vda";
+ // TODO
+
+
+ delete stream;
+}
+
+/**
+ * Checks for whether an animation is being played that has associated sound
+ */
+const int *Animation::checkForSoundFrames(const Common::String &filename) {
+ const int *frames = &NO_FRAMES;
+
+ if (!_soundOverride.empty()) {
+ for (int idx = 0; idx < PROLOGUE_NAMES_COUNT; ++idx) {
+ if (!scumm_stricmp(filename.c_str(), PROLOGUE_NAMES[idx])) {
+ frames = &PROLOGUE_FRAMES[idx][0];
+ break;
+ }
+ }
+ } else {
+ for (int idx = 0; idx < TITLE_NAMES_COUNT; ++idx) {
+ if (!scumm_stricmp(filename.c_str(), TITLE_NAMES[idx])) {
+ frames = &TITLE_FRAMES[idx][0];
+ break;
+ }
+ }
+ }
+
+ return frames;
+}
+
+} // End of namespace Sherlock
diff --git a/engines/sherlock/animation.h b/engines/sherlock/animation.h
new file mode 100644
index 0000000000..bf4429656e
--- /dev/null
+++ b/engines/sherlock/animation.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SHERLOCK_ANIMATION_H
+#define SHERLOCK_ANIMATION_H
+
+#include "common/scummsys.h"
+#include "common/str.h"
+
+namespace Sherlock {
+
+class SherlockEngine;
+
+class Animation {
+private:
+ SherlockEngine *_vm;
+
+ const int *checkForSoundFrames(const Common::String &filename);
+public:
+ Common::String _soundOverride;
+ Common::String _titleOverride;
+ bool _useEpilogue2;
+public:
+ Animation(SherlockEngine *vm);
+
+ void playPrologue(const Common::String &filename, int minDelay, int fade, bool setPalette, int speed);
+};
+
+} // End of namespace Sherlock
+
+#endif
diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp
index 7e62dc075b..fdcf61e46f 100644
--- a/engines/sherlock/events.cpp
+++ b/engines/sherlock/events.cpp
@@ -72,6 +72,9 @@ bool EventsManager::isCursorVisible() {
return CursorMan.isVisible();
}
+/**
+ * Check for any pending events
+ */
void EventsManager::pollEvents() {
checkForNextFrameCounter();
@@ -112,6 +115,9 @@ void EventsManager::pollEvents() {
}
}
+/**
+ * Check whether it's time to display the next screen frame
+ */
bool EventsManager::checkForNextFrameCounter() {
// Check for next game frame
uint32 milli = g_system->getMillis();
@@ -134,6 +140,17 @@ bool EventsManager::checkForNextFrameCounter() {
return false;
}
+/**
+ * Clear any current keypress or mouse click
+ */
+void EventsManager::clearEvents() {
+ _pendingKeys.clear();
+ _mouseClicked = false;
+}
+
+/**
+ * Delay for a given number of frames/cycles
+ */
void EventsManager::delay(int cycles) {
uint32 totalMilli = cycles * 1000 / GAME_FRAME_RATE;
uint32 delayEnd = g_system->getMillis() + totalMilli;
@@ -145,6 +162,9 @@ void EventsManager::delay(int cycles) {
}
}
+/**
+ * Wait for the next frame
+ */
void EventsManager::waitForNextFrame() {
_mouseClicked = false;
_mouseButtons = 0;
diff --git a/engines/sherlock/events.h b/engines/sherlock/events.h
index 4ba30e0bdf..26f4ddb2d5 100644
--- a/engines/sherlock/events.h
+++ b/engines/sherlock/events.h
@@ -71,6 +71,8 @@ public:
Common::KeyState getKey() { return _pendingKeys.pop(); }
+ void clearEvents();
+
void delay(int amount);
void waitForNextFrame();
diff --git a/engines/sherlock/graphics.h b/engines/sherlock/graphics.h
index 801b1747ee..97daaef6e3 100644
--- a/engines/sherlock/graphics.h
+++ b/engines/sherlock/graphics.h
@@ -30,6 +30,8 @@
namespace Sherlock {
+#define PALETTE_SIZE 768
+
class SherlockEngine;
class Surface : public Graphics::Surface {
diff --git a/engines/sherlock/module.mk b/engines/sherlock/module.mk
index 19ad039262..7009f49d3f 100644
--- a/engines/sherlock/module.mk
+++ b/engines/sherlock/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/sherlock
MODULE_OBJS = \
scalpel/scalpel.o \
tattoo/tattoo.o \
+ animation.o \
decompress.o \
debugger.o \
detection.o \
@@ -12,6 +13,7 @@ MODULE_OBJS = \
resources.o \
room.o \
sherlock.o \
+ sound.o \
sprite.o \
talk.o
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 1eaf7c91ee..72c5f1dcf3 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -21,6 +21,7 @@
*/
#include "sherlock/scalpel/scalpel.h"
+#include "sherlock/sherlock.h"
namespace Sherlock {
@@ -44,9 +45,42 @@ void ScalpelEngine::initialize() {
* Show the opening sequence
*/
void ScalpelEngine::showOpening() {
+ if (!_events->isKeyPressed())
+ showCityCutscene();
+ if (!_events->isKeyPressed())
+ showAlleyCutscene();
+ if (!_events->isKeyPressed())
+ showStreetCutscene();
+ if (!_events->isKeyPressed())
+ showOfficeCutscene();
+
+ _events->clearEvents();
+ _sound->stopMusic();
+}
+
+void ScalpelEngine::showCityCutscene() {
+ byte palette[PALETTE_SIZE];
+
+ _sound->playMusic("prolog1.mus");
+ _animation->_titleOverride = "title.lib";
+ _animation->_soundOverride = "title.snd";
+ _animation->playPrologue("26open1", 1, 255, true, 2);
+
// TODO
}
+void ScalpelEngine::showAlleyCutscene() {
+
+}
+
+void ScalpelEngine::showStreetCutscene() {
+
+}
+
+void ScalpelEngine::showOfficeCutscene() {
+
+}
+
} // End of namespace Scalpel
diff --git a/engines/sherlock/scalpel/scalpel.h b/engines/sherlock/scalpel/scalpel.h
index 6016984e45..5da33e1d52 100644
--- a/engines/sherlock/scalpel/scalpel.h
+++ b/engines/sherlock/scalpel/scalpel.h
@@ -30,6 +30,11 @@ namespace Sherlock {
namespace Scalpel {
class ScalpelEngine : public SherlockEngine {
+private:
+ void showCityCutscene();
+ void showAlleyCutscene();
+ void showStreetCutscene();
+ void showOfficeCutscene();
protected:
virtual void initialize();
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index cfbbacccf7..a750741ec9 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -30,21 +30,27 @@ namespace Sherlock {
SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc) :
Engine(syst), _gameDescription(gameDesc) {
+ _animation = nullptr;
_debugger = nullptr;
+ _events = nullptr;
_journal = nullptr;
_res = nullptr;
_rooms = nullptr;
_screen = nullptr;
+ _sound = nullptr;
_talk = nullptr;
}
SherlockEngine::~SherlockEngine() {
+ delete _animation;
delete _debugger;
+ delete _events;
delete _journal;
delete _res;
delete _rooms;
delete _screen;
+ delete _sound;
delete _talk;
}
@@ -66,7 +72,9 @@ void SherlockEngine::initialize() {
_midi->setNativeMT32(native_mt32);
*/
+ _animation = new Animation(this);
_debugger = new Debugger(this);
+ _events = new EventsManager(this);
_journal = new Journal();
_res = new Resources();
_rooms = new Rooms();
diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h
index 781851db71..88fbff74f9 100644
--- a/engines/sherlock/sherlock.h
+++ b/engines/sherlock/sherlock.h
@@ -30,11 +30,14 @@
#include "common/savefile.h"
#include "common/hash-str.h"
#include "engines/engine.h"
+#include "sherlock/animation.h"
#include "sherlock/debugger.h"
+#include "sherlock/events.h"
#include "sherlock/graphics.h"
#include "sherlock/journal.h"
#include "sherlock/resources.h"
#include "sherlock/room.h"
+#include "sherlock/sound.h"
#include "sherlock/talk.h"
namespace Sherlock {
@@ -67,11 +70,14 @@ protected:
virtual void showOpening() = 0;
public:
const SherlockGameDescription *_gameDescription;
+ Animation *_animation;
Debugger *_debugger;
+ EventsManager *_events;
Journal *_journal;
Resources *_res;
Rooms *_rooms;
Screen *_screen;
+ Sound *_sound;
Talk *_talk;
Common::Array<bool> _flags;
public:
diff --git a/engines/sherlock/vdaplayer.h b/engines/sherlock/sound.cpp
index 9b755606d5..f16dd5a80d 100644
--- a/engines/sherlock/vdaplayer.h
+++ b/engines/sherlock/sound.cpp
@@ -20,15 +20,36 @@
*
*/
-#ifndef SHERLOCK_VDAPLAYER_H
-#define SHERLOCK_VDAPLAYER_H
+#include "sherlock/sound.h"
namespace Sherlock {
-class VdaPlayer {
+Sound::Sound(SherlockEngine *vm): _vm(vm) {
+}
-};
+void Sound::playSound(const Common::String &name) {
+ // TODO
+}
-} // End of namespace Sherlock
+void Sound::cacheSound(const Common::String &name, int index) {
+ // TODO
+}
+
+void Sound::playCachedSound(int index) {
+ // TODO
+}
+
+void Sound::clearCache() {
+ // TODO
+}
+
+void Sound::playMusic(const Common::String &name) {
+ // TODO
+}
-#endif
+void Sound::stopMusic() {
+ // TODO
+}
+
+
+} // End of namespace Sherlock
diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h
index f3b34345ef..b1759a9c8e 100644
--- a/engines/sherlock/sound.h
+++ b/engines/sherlock/sound.h
@@ -23,15 +23,26 @@
#ifndef SHERLOCK_SOUND_H
#define SHERLOCK_SOUND_H
+#include "common/scummsys.h"
+#include "common/str.h"
+
namespace Sherlock {
+class SherlockEngine;
+
class Sound {
-public
- void playSound(const char *name);
- void cacheSound(const char *name, int index);
+private:
+ SherlockEngine *_vm;
+public:
+ Sound(SherlockEngine *vm);
+
+ void playSound(const Common::String &name);
+ void cacheSound(const Common::String &name, int index);
void playCachedSound(int index);
void clearCache();
+ void playMusic(const Common::String &name);
+ void stopMusic();
};
} // End of namespace Sherlock