TWINE: Add Debugger commands for playing music

play_music and play_midi
This commit is contained in:
antoniou79 2021-12-12 16:42:02 +02:00 committed by Martin Gerhardy
parent 71f8e1227f
commit 7abe6c2d7b
2 changed files with 25 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include "twine/scene/scene.h"
#include "twine/text.h"
#include "twine/twine.h"
#include "twine/audio/music.h"
namespace TwinE {
@ -42,6 +43,8 @@ TwinEConsole::TwinEConsole(TwinEEngine *engine) : _engine(engine), GUI::Debugger
registerCmd("give_gas", WRAP_METHOD(TwinEConsole, doGiveGas));
registerCmd("give_kashes", WRAP_METHOD(TwinEConsole, doGiveKashes));
registerCmd("play_video", WRAP_METHOD(TwinEConsole, doPlayVideo));
registerCmd("play_midi", WRAP_METHOD(TwinEConsole, doPlayMidi));
registerCmd("play_music", WRAP_METHOD(TwinEConsole, doPlayMusic));
registerCmd("change_scene", WRAP_METHOD(TwinEConsole, doChangeScene));
registerCmd("toggle_scenery_view", WRAP_METHOD(TwinEConsole, doToggleSceneryView));
registerCmd("magic_points", WRAP_METHOD(TwinEConsole, doAddMagicPoints));
@ -350,6 +353,26 @@ bool TwinEConsole::doPlayVideo(int argc, const char **argv) {
return true;
}
bool TwinEConsole::doPlayMidi(int argc, const char **argv) {
if (argc <= 1) {
debugPrintf("Expected to get a midi id as first parameter\n");
return true;
}
int newMidiIndex = atoi(argv[1]);
_engine->_music->playMidiMusic(newMidiIndex);
return true;
}
bool TwinEConsole::doPlayMusic(int argc, const char **argv) {
if (argc <= 1) {
debugPrintf("Expected to get a music track id as first parameter\n");
return true;
}
int newMusicTrackIndex = atoi(argv[1]);
_engine->_music->playTrackMusic(newMusicTrackIndex);
return true;
}
bool TwinEConsole::doChangeScene(int argc, const char **argv) {
if (argc <= 1) {
debugPrintf("Expected to get a scene index as first parameter\n");

View File

@ -36,6 +36,8 @@ private:
bool doToggleSceneryView(int argc, const char **argv);
bool doPlayVideo(int argc, const char **argv);
bool doPlayMidi(int argc, const char **argv);
bool doPlayMusic(int argc, const char **argv);
bool doPrintGameFlag(int argc, const char **argv);
bool doPrintInventoryFlag(int argc, const char **argv);
bool doPrintHolomapFlag(int argc, const char **argv);