SAGA: Add debug commands for playing music, sounds and voices

This commit is contained in:
Filippos Karapetis 2014-07-20 18:49:57 +03:00
parent d316b00b9e
commit d8508a5128
4 changed files with 51 additions and 1 deletions

View File

@ -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());

View File

@ -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);

View File

@ -341,7 +341,6 @@ Common::Error SagaEngine::run() {
syncSoundSettings();
} else {
_framesEsc = 0;
//_sndRes->playVoice(0); // SAGA 2 sound test
_scene->startScene();
}

View File

@ -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;