aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-07-12 22:30:32 -0400
committerPaul Gilbert2015-07-12 22:30:32 -0400
commit6c036549806491012a1921bbe4aa3b5a3252702d (patch)
treee4f7d2be1b9f0228dac559f35d87b1a1ee1a6073
parent918f6c06a61e777ba200335a3595d90e21bdc6dd (diff)
downloadscummvm-rg350-6c036549806491012a1921bbe4aa3b5a3252702d.tar.gz
scummvm-rg350-6c036549806491012a1921bbe4aa3b5a3252702d.tar.bz2
scummvm-rg350-6c036549806491012a1921bbe4aa3b5a3252702d.zip
SHERLOCK: Split up Debugger class for both games
-rw-r--r--engines/sherlock/debugger.cpp64
-rw-r--r--engines/sherlock/debugger.h28
-rw-r--r--engines/sherlock/module.mk2
-rw-r--r--engines/sherlock/scalpel/scalpel_debugger.cpp91
-rw-r--r--engines/sherlock/scalpel/scalpel_debugger.h54
-rw-r--r--engines/sherlock/sherlock.cpp2
-rw-r--r--engines/sherlock/tattoo/tattoo_debugger.cpp35
-rw-r--r--engines/sherlock/tattoo/tattoo_debugger.h44
-rw-r--r--engines/sherlock/tattoo/tattoo_map.cpp3
9 files changed, 246 insertions, 77 deletions
diff --git a/engines/sherlock/debugger.cpp b/engines/sherlock/debugger.cpp
index 8b7bdaaa53..7806cc8c1f 100644
--- a/engines/sherlock/debugger.cpp
+++ b/engines/sherlock/debugger.cpp
@@ -23,21 +23,25 @@
#include "sherlock/debugger.h"
#include "sherlock/sherlock.h"
#include "sherlock/music.h"
-
#include "sherlock/scalpel/3do/movie_decoder.h"
-
+#include "sherlock/scalpel/scalpel_debugger.h"
+#include "sherlock/tattoo/tattoo_debugger.h"
#include "audio/mixer.h"
#include "audio/decoders/aiff.h"
#include "audio/decoders/wave.h"
-#include "audio/decoders/3do.h"
namespace Sherlock {
+Debugger *Debugger::init(SherlockEngine *vm) {
+ if (vm->getGameID() == GType_RoseTattoo)
+ return new Tattoo::TattooDebugger(vm);
+ else
+ return new Scalpel::ScalpelDebugger(vm);
+}
+
Debugger::Debugger(SherlockEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
registerCmd("scene", WRAP_METHOD(Debugger, cmdScene));
- registerCmd("3do_playmovie", WRAP_METHOD(Debugger, cmd3DO_PlayMovie));
- registerCmd("3do_playaudio", WRAP_METHOD(Debugger, cmd3DO_PlayAudio));
registerCmd("song", WRAP_METHOD(Debugger, cmdSong));
registerCmd("dumpfile", WRAP_METHOD(Debugger, cmdDumpFile));
}
@@ -78,56 +82,6 @@ bool Debugger::cmdScene(int argc, const char **argv) {
}
}
-bool Debugger::cmd3DO_PlayMovie(int argc, const char **argv) {
- if (argc != 2) {
- debugPrintf("Format: 3do_playmovie <3do-movie-file>\n");
- return true;
- }
-
- // play gets postboned until debugger is closed
- Common::String filename = argv[1];
- _3doPlayMovieFile = filename;
-
- return cmdExit(0, 0);
-}
-
-bool Debugger::cmd3DO_PlayAudio(int argc, const char **argv) {
- if (argc != 2) {
- debugPrintf("Format: 3do_playaudio <3do-audio-file>\n");
- return true;
- }
-
- Common::File *file = new Common::File();
- if (!file->open(argv[1])) {
- debugPrintf("can not open specified audio file\n");
- return true;
- }
-
- Audio::AudioStream *testStream;
- Audio::SoundHandle testHandle;
-
- // Try to load the given file as AIFF/AIFC
- testStream = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
-
- if (testStream) {
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &testHandle, testStream);
- _vm->_events->clearEvents();
-
- while ((!_vm->shouldQuit()) && g_system->getMixer()->isSoundHandleActive(testHandle)) {
- _vm->_events->pollEvents();
- g_system->delayMillis(10);
- if (_vm->_events->kbHit()) {
- break;
- }
- }
-
- debugPrintf("playing completed\n");
- g_system->getMixer()->stopHandle(testHandle);
- }
-
- return true;
-}
-
bool Debugger::cmdSong(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("Format: song <room>\n");
diff --git a/engines/sherlock/debugger.h b/engines/sherlock/debugger.h
index 2252f6d8ea..eec2579ca4 100644
--- a/engines/sherlock/debugger.h
+++ b/engines/sherlock/debugger.h
@@ -31,15 +31,7 @@ namespace Sherlock {
class SherlockEngine;
class Debugger : public GUI::Debugger {
-public:
- Debugger(SherlockEngine *vm);
- virtual ~Debugger() {}
-
- void postEnter();
-
private:
- SherlockEngine *_vm;
-
/**
* Converts a decimal or hexadecimal string into a number
*/
@@ -51,16 +43,6 @@ private:
bool cmdScene(int argc, const char **argv);
/**
- * Plays a 3DO movie
- */
- bool cmd3DO_PlayMovie(int argc, const char **argv);
-
- /**
- * Plays a 3DO audio
- */
- bool cmd3DO_PlayAudio(int argc, const char **argv);
-
- /**
* Plays a song
*/
bool cmdSong(int argc, const char **argv);
@@ -69,9 +51,15 @@ private:
* Dumps a file to disk
*/
bool cmdDumpFile(int argc, const char **argv);
-
-private:
+protected:
+ SherlockEngine *_vm;
Common::String _3doPlayMovieFile;
+public:
+ Debugger(SherlockEngine *vm);
+ virtual ~Debugger() {}
+ static Debugger *init(SherlockEngine *vm);
+
+ void postEnter();
};
} // End of namespace Sherlock
diff --git a/engines/sherlock/module.mk b/engines/sherlock/module.mk
index c1591b647c..73067fdc14 100644
--- a/engines/sherlock/module.mk
+++ b/engines/sherlock/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS = \
scalpel/drivers/mt32.o \
scalpel/tsage/logo.o \
scalpel/tsage/resources.o \
+ scalpel/scalpel_debugger.o \
scalpel/scalpel_fixed_text.o \
scalpel/scalpel_inventory.o \
scalpel/scalpel_journal.o \
@@ -21,6 +22,7 @@ MODULE_OBJS = \
scalpel/settings.o \
tattoo/tattoo.o \
tattoo/tattoo_darts.o \
+ tattoo/tattoo_debugger.o \
tattoo/tattoo_fixed_text.o \
tattoo/tattoo_inventory.o \
tattoo/tattoo_journal.o \
diff --git a/engines/sherlock/scalpel/scalpel_debugger.cpp b/engines/sherlock/scalpel/scalpel_debugger.cpp
new file mode 100644
index 0000000000..7f5e1efa69
--- /dev/null
+++ b/engines/sherlock/scalpel/scalpel_debugger.cpp
@@ -0,0 +1,91 @@
+/* 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/scalpel/scalpel_debugger.h"
+#include "sherlock/sherlock.h"
+#include "audio/mixer.h"
+#include "audio/decoders/3do.h"
+#include "audio/decoders/aiff.h"
+#include "audio/decoders/wave.h"
+
+namespace Sherlock {
+
+namespace Scalpel {
+
+ScalpelDebugger::ScalpelDebugger(SherlockEngine *vm) : Debugger(vm) {
+ registerCmd("3do_playmovie", WRAP_METHOD(ScalpelDebugger, cmd3DO_PlayMovie));
+ registerCmd("3do_playaudio", WRAP_METHOD(ScalpelDebugger, cmd3DO_PlayAudio));
+}
+
+bool ScalpelDebugger::cmd3DO_PlayMovie(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("Format: 3do_playmovie <3do-movie-file>\n");
+ return true;
+ }
+
+ // play gets postboned until debugger is closed
+ Common::String filename = argv[1];
+ _3doPlayMovieFile = filename;
+
+ return cmdExit(0, 0);
+}
+
+bool ScalpelDebugger::cmd3DO_PlayAudio(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("Format: 3do_playaudio <3do-audio-file>\n");
+ return true;
+ }
+
+ Common::File *file = new Common::File();
+ if (!file->open(argv[1])) {
+ debugPrintf("can not open specified audio file\n");
+ return true;
+ }
+
+ Audio::AudioStream *testStream;
+ Audio::SoundHandle testHandle;
+
+ // Try to load the given file as AIFF/AIFC
+ testStream = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
+
+ if (testStream) {
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &testHandle, testStream);
+ _vm->_events->clearEvents();
+
+ while ((!_vm->shouldQuit()) && g_system->getMixer()->isSoundHandleActive(testHandle)) {
+ _vm->_events->pollEvents();
+ g_system->delayMillis(10);
+ if (_vm->_events->kbHit()) {
+ break;
+ }
+ }
+
+ debugPrintf("playing completed\n");
+ g_system->getMixer()->stopHandle(testHandle);
+ }
+
+ return true;
+}
+
+} // End of namespace Scalpel
+
+} // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/scalpel_debugger.h b/engines/sherlock/scalpel/scalpel_debugger.h
new file mode 100644
index 0000000000..17a84779f0
--- /dev/null
+++ b/engines/sherlock/scalpel/scalpel_debugger.h
@@ -0,0 +1,54 @@
+/* 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_SCALPEL_DEBUGGER_H
+#define SHERLOCK_SCALPEL_DEBUGGER_H
+
+#include "sherlock/debugger.h"
+
+namespace Sherlock {
+
+class SherlockEngine;
+
+namespace Scalpel {
+
+class ScalpelDebugger : public Debugger {
+private:
+ /**
+ * Plays a 3DO movie
+ */
+ bool cmd3DO_PlayMovie(int argc, const char **argv);
+
+ /**
+ * Plays a 3DO audio
+ */
+ bool cmd3DO_PlayAudio(int argc, const char **argv);
+public:
+ ScalpelDebugger(SherlockEngine *vm);
+ virtual ~ScalpelDebugger() {}
+};
+
+} // End of namespace Scalpel
+
+} // End of namespace Sherlock
+
+#endif /* SHERLOCK_DEBUGGER_H */
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index 7653dc0083..d3a82d05fe 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -93,7 +93,7 @@ void SherlockEngine::initialize() {
_res = new Resources(this);
_animation = new Animation(this);
- _debugger = new Debugger(this);
+ _debugger = Debugger::init(this);
_events = new Events(this);
_fixedText = FixedText::init(this);
_inventory = Inventory::init(this);
diff --git a/engines/sherlock/tattoo/tattoo_debugger.cpp b/engines/sherlock/tattoo/tattoo_debugger.cpp
new file mode 100644
index 0000000000..8d59b4c592
--- /dev/null
+++ b/engines/sherlock/tattoo/tattoo_debugger.cpp
@@ -0,0 +1,35 @@
+/* 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/tattoo/tattoo_debugger.h"
+#include "sherlock/sherlock.h"
+
+namespace Sherlock {
+
+namespace Tattoo {
+
+TattooDebugger::TattooDebugger(SherlockEngine *vm) : Debugger(vm) {
+}
+
+} // End of namespace Tattoo
+
+} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_debugger.h b/engines/sherlock/tattoo/tattoo_debugger.h
new file mode 100644
index 0000000000..e729262b11
--- /dev/null
+++ b/engines/sherlock/tattoo/tattoo_debugger.h
@@ -0,0 +1,44 @@
+/* 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_TATTOO_DEBUGGER_H
+#define SHERLOCK_TATTOO_DEBUGGER_H
+
+#include "sherlock/debugger.h"
+
+namespace Sherlock {
+
+class SherlockEngine;
+
+namespace Tattoo {
+
+class TattooDebugger : public Debugger {
+public:
+ TattooDebugger(SherlockEngine *vm);
+ virtual ~TattooDebugger() {}
+};
+
+} // End of namespace Tattoo
+
+} // End of namespace Sherlock
+
+#endif /* SHERLOCK_TATTOO_DEBUGGER_H */
diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index 3bd22cd9aa..f7af0f47f3 100644
--- a/engines/sherlock/tattoo/tattoo_map.cpp
+++ b/engines/sherlock/tattoo/tattoo_map.cpp
@@ -293,7 +293,8 @@ void TattooMap::drawMapIcons() {
Screen &screen = *_vm->_screen;
for (uint idx = 0; idx < _data.size(); ++idx) {
- _vm->setFlagsDirect(idx + 1); //***DEBUG***
+ _vm->setFlagsDirect(idx + 1);
+
if (_data[idx]._iconNum != -1 && _vm->readFlags(idx + 1)) {
MapEntry &mapEntry = _data[idx];
ImageFrame &img = (*_iconImages)[mapEntry._iconNum];