aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2013-07-03 05:49:25 +0300
committerFilippos Karapetis2013-07-03 05:49:25 +0300
commite457fc2a268be4ef5e32a51ec58f15aeb476ec8a (patch)
treeb9dcf578d3363fe4db364befd9b2e3074d8ae2a7
parent0146b00148631a36cfe9b89a7edaf88a571946eb (diff)
downloadscummvm-rg350-e457fc2a268be4ef5e32a51ec58f15aeb476ec8a.tar.gz
scummvm-rg350-e457fc2a268be4ef5e32a51ec58f15aeb476ec8a.tar.bz2
scummvm-rg350-e457fc2a268be4ef5e32a51ec58f15aeb476ec8a.zip
NEVERHOOD: Add a new console command, "playsound"
-rw-r--r--engines/neverhood/console.cpp19
-rw-r--r--engines/neverhood/console.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp
index a4dd50ce4b..e676da3727 100644
--- a/engines/neverhood/console.cpp
+++ b/engines/neverhood/console.cpp
@@ -25,6 +25,7 @@
#include "neverhood/neverhood.h"
#include "neverhood/gamemodule.h"
#include "neverhood/scene.h"
+#include "neverhood/sound.h"
#include "neverhood/modules/module1600.h"
namespace Neverhood {
@@ -34,6 +35,7 @@ Console::Console(NeverhoodEngine *vm) : GUI::Debugger(), _vm(vm) {
DCmd_Register("dumpvars", WRAP_METHOD(Console, Cmd_Dumpvars));
DCmd_Register("room", WRAP_METHOD(Console, Cmd_Room));
DCmd_Register("surfaces", WRAP_METHOD(Console, Cmd_Surfaces));
+ DCmd_Register("playsound", WRAP_METHOD(Console, Cmd_PlaySound));
}
Console::~Console() {
@@ -169,4 +171,21 @@ bool Console::Cmd_Dumpvars(int argc, const char **argv) {
return true;
}
+bool Console::Cmd_PlaySound(int argc, const char **argv) {
+ if (argc < 2) {
+ DebugPrintf("Usage: %s <sound hash>\n", argv[0]);
+ } else {
+ uint32 soundHash = strtol(argv[1], NULL, 0);
+ AudioResourceManSoundItem *soundItem = new AudioResourceManSoundItem(_vm, soundHash);
+ soundItem->setVolume(100);
+ soundItem->playSound(false);
+ while (soundItem->isPlaying()) {
+ _vm->_system->delayMillis(10);
+ }
+ delete soundItem;
+ }
+
+ return true;
+}
+
} // End of namespace Neverhood
diff --git a/engines/neverhood/console.h b/engines/neverhood/console.h
index 40c11b50e3..62d65bd693 100644
--- a/engines/neverhood/console.h
+++ b/engines/neverhood/console.h
@@ -41,6 +41,7 @@ private:
bool Cmd_Surfaces(int argc, const char **argv);
bool Cmd_Cheat(int argc, const char **argv);
bool Cmd_Dumpvars(int argc, const char **argv);
+ bool Cmd_PlaySound(int argc, const char **argv);
};
} // End of namespace Neverhood