From d8508a512818085640d4584f6c3daf271aba5307 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 20 Jul 2014 18:49:57 +0300 Subject: SAGA: Add debug commands for playing music, sounds and voices --- engines/saga/console.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ engines/saga/console.h | 4 ++++ engines/saga/saga.cpp | 1 - engines/saga/sndres.h | 1 + 4 files changed, 51 insertions(+), 1 deletion(-) (limited to 'engines/saga') 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 \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 \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 \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; -- cgit v1.2.3