NEVERHOOD: Add a new console command, "playsound"

This commit is contained in:
Filippos Karapetis
2013-07-03 05:49:25 +03:00
parent 0146b00148
commit e457fc2a26
2 changed files with 20 additions and 0 deletions
+19
View File
@@ -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
+1
View File
@@ -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