TITANIC: Added sound command to debugger

This commit is contained in:
Paul Gilbert 2017-07-06 11:07:55 -04:00
parent 0b18b0b1b5
commit 6044ba16ce
2 changed files with 25 additions and 0 deletions

View File

@ -36,6 +36,7 @@ Debugger::Debugger(TitanicEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("pet", WRAP_METHOD(Debugger, cmdPET));
registerCmd("item", WRAP_METHOD(Debugger, cmdItem));
registerCmd("movie", WRAP_METHOD(Debugger, cmdMovie));
registerCmd("sound", WRAP_METHOD(Debugger, cmdSound));
}
int Debugger::strToInt(const char *s) {
@ -294,4 +295,23 @@ bool Debugger::cmdMovie(int argc, const char **argv) {
return false;
}
bool Debugger::cmdSound(int argc, const char **argv) {
if (argc == 2) {
Common::String name = argv[1];
const char *ch = strchr(argv[1], '!');
if (ch)
name.setChar('#', ch - argv[1]);
if (!name.contains("#"))
name = "z#" + name;
CGameManager *gameManager = g_vm->_window->_gameManager;
CProximity prox;
gameManager->_sound.playSound(name, prox);
return false;
} else {
debugPrintf("sound <name>\n");
return true;
}
}
} // End of namespace Titanic

View File

@ -94,6 +94,11 @@ private:
* Shows a movie
*/
bool cmdMovie(int argc, const char **argv);
/**
* Play a sound
*/
bool cmdSound(int argc, const char **argv);
protected:
TitanicEngine *_vm;
public: