Skip to content

Commit

Permalink
CHEWY: Add methods for playing sound, speech and music to the debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Oct 2, 2016
1 parent 078cbf0 commit 676fa15
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
40 changes: 40 additions & 0 deletions engines/chewy/console.cpp
Expand Up @@ -26,12 +26,16 @@
#include "chewy/console.h"
#include "chewy/graphics.h"
#include "chewy/resource.h"
#include "chewy/sound.h"

namespace Chewy {

Console::Console(ChewyEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("dump", WRAP_METHOD(Console, Cmd_Dump));
registerCmd("draw", WRAP_METHOD(Console, Cmd_Draw));
registerCmd("play_sound", WRAP_METHOD(Console, Cmd_PlaySound));
registerCmd("play_speech", WRAP_METHOD(Console, Cmd_PlaySpeech));
registerCmd("play_music", WRAP_METHOD(Console, Cmd_PlayMusic));
}

Console::~Console() {
Expand Down Expand Up @@ -84,4 +88,40 @@ bool Console::Cmd_Draw(int argc, const char **argv) {
return false;
}

bool Console::Cmd_PlaySound(int argc, const char **argv) {
if (argc < 2) {
debugPrintf("Usage: play_sound <number>\n");
return true;
}

int resNum = atoi(argv[1]);
_vm->_sound->playSound(resNum);

return true;
}

bool Console::Cmd_PlaySpeech(int argc, const char **argv) {
if (argc < 2) {
debugPrintf("Usage: play_speech <number>\n");
return true;
}

int resNum = atoi(argv[1]);
_vm->_sound->playSpeech(resNum);

return true;
}

bool Console::Cmd_PlayMusic(int argc, const char **argv) {
if (argc < 2) {
debugPrintf("Usage: play_music <number>\n");
return true;
}

int resNum = atoi(argv[1]);
_vm->_sound->playMusic(resNum);

return true;
}

} // End of namespace Chewy
3 changes: 3 additions & 0 deletions engines/chewy/console.h
Expand Up @@ -39,6 +39,9 @@ class Console : public GUI::Debugger {

bool Cmd_Dump(int argc, const char **argv);
bool Cmd_Draw(int argc, const char **argv);
bool Cmd_PlaySound(int argc, const char **argv);
bool Cmd_PlaySpeech(int argc, const char **argv);
bool Cmd_PlayMusic(int argc, const char **argv);
};

} // End of namespace Chewy
Expand Down

0 comments on commit 676fa15

Please sign in to comment.