aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorFilippos Karapetis2014-07-20 18:49:57 +0300
committerFilippos Karapetis2014-07-20 18:49:57 +0300
commitd8508a512818085640d4584f6c3daf271aba5307 (patch)
treea6474dadd0d707dabd298983aaf64f327bd5d0ca /engines/saga
parentd316b00b9e5d37af8060202ce5b5214f8101ef34 (diff)
downloadscummvm-rg350-d8508a512818085640d4584f6c3daf271aba5307.tar.gz
scummvm-rg350-d8508a512818085640d4584f6c3daf271aba5307.tar.bz2
scummvm-rg350-d8508a512818085640d4584f6c3daf271aba5307.zip
SAGA: Add debug commands for playing music, sounds and voices
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/console.cpp46
-rw-r--r--engines/saga/console.h4
-rw-r--r--engines/saga/saga.cpp1
-rw-r--r--engines/saga/sndres.h1
4 files changed, 51 insertions, 1 deletions
diff --git a/engines/saga/console.cpp b/engines/saga/console.cpp
index 0b801eef3e..8ad7fd5aaa 100644
--- a/engines/saga/console.cpp
+++ b/engines/saga/console.cpp
@@ -25,8 +25,10 @@
#include "saga/saga.h"
#include "saga/actor.h"
#include "saga/animation.h"
+#include "saga/music.h"
#include "saga/scene.h"
#include "saga/script.h"
+#include "saga/sndres.h"
#include "saga/console.h"
@@ -45,6 +47,11 @@ Console::Console(SagaEngine *vm) : GUI::Debugger() {
registerCmd("cutaway_info", WRAP_METHOD(Console, cmdCutawayInfo));
registerCmd("play_cutaway", WRAP_METHOD(Console, cmdPlayCutaway));
+ // Sound commands
+ registerCmd("play_music", WRAP_METHOD(Console, cmdPlayMusic));
+ registerCmd("play_sound", WRAP_METHOD(Console, cmdPlaySound));
+ registerCmd("play_voice", WRAP_METHOD(Console, cmdPlayVoice));
+
// Game stuff
#if 0
@@ -117,6 +124,45 @@ bool Console::cmdPlayCutaway(int argc, const char **argv) {
return true;
}
+bool Console::cmdPlayMusic(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("Usage: %s <Music number>\n", argv[0]);
+ } else {
+ if (_vm->getGameId() == GID_ITE)
+ _vm->_music->play(atoi(argv[1]) + 9);
+ else
+ _vm->_music->play(atoi(argv[1]));
+ }
+ return true;
+}
+
+bool Console::cmdPlaySound(int argc, const char **argv) {
+ if (argc != 2)
+ debugPrintf("Usage: %s <Sound number>\n", argv[0]);
+ else
+ _vm->_sndRes->playSound(atoi(argv[1]), 255, false);
+ return true;
+}
+
+bool Console::cmdPlayVoice(int argc, const char **argv) {
+ if (argc < 2) {
+ debugPrintf("Usage: %s <Voice number> <Voice bank>\n", argv[0]);
+ } else {
+ int voiceBank = 0;
+
+ if (argc == 3) {
+ voiceBank = _vm->_sndRes->getVoiceBank();
+ _vm->_sndRes->setVoiceBank(atoi(argv[2]));
+ }
+
+ _vm->_sndRes->playVoice(atoi(argv[1]));
+
+ if (argc == 3)
+ _vm->_sndRes->setVoiceBank(voiceBank);
+ }
+ return true;
+}
+
bool Console::cmdCurrentScene(int argc, const char **argv) {
debugPrintf("Current Scene is: %i, scene resource id: %i\n",
_vm->_scene->currentSceneNumber(), _vm->_scene->currentSceneResourceId());
diff --git a/engines/saga/console.h b/engines/saga/console.h
index 625e6f57ad..cec964301c 100644
--- a/engines/saga/console.h
+++ b/engines/saga/console.h
@@ -41,6 +41,10 @@ private:
bool cmdCutawayInfo(int argc, const char **argv);
bool cmdPlayCutaway(int argc, const char **argv);
+ bool cmdPlayMusic(int argc, const char **argv);
+ bool cmdPlaySound(int argc, const char **argv);
+ bool cmdPlayVoice(int argc, const char **argv);
+
bool cmdCurrentScene(int argc, const char **argv);
bool cmdCurrentChapter(int argc, const char **argv);
bool cmdSceneChange(int argc, const char **argv);
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index b15d161ba3..3d38b3ea52 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -341,7 +341,6 @@ Common::Error SagaEngine::run() {
syncSoundSettings();
} else {
_framesEsc = 0;
- //_sndRes->playVoice(0); // SAGA 2 sound test
_scene->startScene();
}
diff --git a/engines/saga/sndres.h b/engines/saga/sndres.h
index 554eed4a27..5115873d76 100644
--- a/engines/saga/sndres.h
+++ b/engines/saga/sndres.h
@@ -45,6 +45,7 @@ public:
void playVoice(uint32 resourceId);
int getVoiceLength(uint32 resourceId);
void setVoiceBank(int serial);
+ int getVoiceBank() { return _voiceSerial; }
Common::Array<FxTable> _fxTable;