[Scummvm-cvs-logs] scummvm master -> d8508a512818085640d4584f6c3daf271aba5307

bluegr bluegr at gmail.com
Sun Jul 20 17:50:33 CEST 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d8508a5128 SAGA: Add debug commands for playing music, sounds and voices


Commit: d8508a512818085640d4584f6c3daf271aba5307
    https://github.com/scummvm/scummvm/commit/d8508a512818085640d4584f6c3daf271aba5307
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-07-20T18:49:57+03:00

Commit Message:
SAGA: Add debug commands for playing music, sounds and voices

Changed paths:
    engines/saga/console.cpp
    engines/saga/console.h
    engines/saga/saga.cpp
    engines/saga/sndres.h



diff --git a/engines/saga/console.cpp b/engines/saga/console.cpp
index 0b801ee..8ad7fd5 100644
--- a/engines/saga/console.cpp
+++ b/engines/saga/console.cpp
@@ -25,8 +25,10 @@
 #include "saga/saga.h"
 #include "saga/actor.h"
 #include "saga/animation.h"
+#include "saga/music.h"
 #include "saga/scene.h"
 #include "saga/script.h"
+#include "saga/sndres.h"
 
 #include "saga/console.h"
 
@@ -45,6 +47,11 @@ Console::Console(SagaEngine *vm) : GUI::Debugger() {
 	registerCmd("cutaway_info",		WRAP_METHOD(Console, cmdCutawayInfo));
 	registerCmd("play_cutaway",		WRAP_METHOD(Console, cmdPlayCutaway));
 
+	// Sound commands
+	registerCmd("play_music",	WRAP_METHOD(Console, cmdPlayMusic));
+	registerCmd("play_sound",	WRAP_METHOD(Console, cmdPlaySound));
+	registerCmd("play_voice",	WRAP_METHOD(Console, cmdPlayVoice));
+
 	// Game stuff
 
 #if 0
@@ -117,6 +124,45 @@ bool Console::cmdPlayCutaway(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdPlayMusic(int argc, const char **argv) {
+	if (argc != 2) {
+		debugPrintf("Usage: %s <Music number>\n", argv[0]);
+	} else {
+		if (_vm->getGameId() == GID_ITE)
+			_vm->_music->play(atoi(argv[1]) + 9);
+		else
+			_vm->_music->play(atoi(argv[1]));
+	}
+	return true;
+}
+
+bool Console::cmdPlaySound(int argc, const char **argv) {
+	if (argc != 2)
+		debugPrintf("Usage: %s <Sound number>\n", argv[0]);
+	else
+		_vm->_sndRes->playSound(atoi(argv[1]), 255, false);
+	return true;
+}
+
+bool Console::cmdPlayVoice(int argc, const char **argv) {
+	if (argc < 2) {
+		debugPrintf("Usage: %s <Voice number> <Voice bank>\n", argv[0]);
+	} else {
+		int voiceBank = 0;
+
+		if (argc == 3) {
+			voiceBank = _vm->_sndRes->getVoiceBank();
+			_vm->_sndRes->setVoiceBank(atoi(argv[2]));
+		}
+
+		_vm->_sndRes->playVoice(atoi(argv[1]));
+
+		if (argc == 3)
+			_vm->_sndRes->setVoiceBank(voiceBank);
+	}
+	return true;
+}
+
 bool Console::cmdCurrentScene(int argc, const char **argv) {
 	debugPrintf("Current Scene is: %i, scene resource id: %i\n",
 		_vm->_scene->currentSceneNumber(), _vm->_scene->currentSceneResourceId());
diff --git a/engines/saga/console.h b/engines/saga/console.h
index 625e6f5..cec9643 100644
--- a/engines/saga/console.h
+++ b/engines/saga/console.h
@@ -41,6 +41,10 @@ private:
 	bool cmdCutawayInfo(int argc, const char **argv);
 	bool cmdPlayCutaway(int argc, const char **argv);
 
+	bool cmdPlayMusic(int argc, const char **argv);
+	bool cmdPlaySound(int argc, const char **argv);
+	bool cmdPlayVoice(int argc, const char **argv);
+
 	bool cmdCurrentScene(int argc, const char **argv);
 	bool cmdCurrentChapter(int argc, const char **argv);
 	bool cmdSceneChange(int argc, const char **argv);
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index b15d161..3d38b3e 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -341,7 +341,6 @@ Common::Error SagaEngine::run() {
 		syncSoundSettings();
 	} else {
 		_framesEsc = 0;
-		//_sndRes->playVoice(0);    // SAGA 2 sound test
 		_scene->startScene();
 	}
 
diff --git a/engines/saga/sndres.h b/engines/saga/sndres.h
index 554eed4..5115873 100644
--- a/engines/saga/sndres.h
+++ b/engines/saga/sndres.h
@@ -45,6 +45,7 @@ public:
 	void playVoice(uint32 resourceId);
 	int getVoiceLength(uint32 resourceId);
 	void setVoiceBank(int serial);
+	int getVoiceBank() { return _voiceSerial; }
 
 	Common::Array<FxTable> _fxTable;
 






More information about the Scummvm-git-logs mailing list