[Scummvm-cvs-logs] scummvm master -> 1b1643ad6f7f0c8cda743d92321dedf2c1373fda

dreammaster dreammaster at scummvm.org
Thu Jul 2 04:37:39 CEST 2015


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:
1b1643ad6f SHERLOCK: RT: Implement cmdPlaySong opcode


Commit: 1b1643ad6f7f0c8cda743d92321dedf2c1373fda
    https://github.com/scummvm/scummvm/commit/1b1643ad6f7f0c8cda743d92321dedf2c1373fda
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-01T22:36:38-04:00

Commit Message:
SHERLOCK: RT: Implement cmdPlaySong opcode

Changed paths:
    engines/sherlock/music.h
    engines/sherlock/sound.h
    engines/sherlock/tattoo/tattoo_scene.cpp
    engines/sherlock/tattoo/tattoo_talk.cpp



diff --git a/engines/sherlock/music.h b/engines/sherlock/music.h
index da1bca8..dc2ed02 100644
--- a/engines/sherlock/music.h
+++ b/engines/sherlock/music.h
@@ -72,6 +72,7 @@ public:
 	bool _musicOn;
 	int _musicVolume;
 	bool _midiOption;
+	Common::String _currentSongName, _nextSongName;
 public:
 	Music(SherlockEngine *vm, Audio::Mixer *mixer);
 	~Music();
diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h
index e82d94b..a2e7715 100644
--- a/engines/sherlock/sound.h
+++ b/engines/sherlock/sound.h
@@ -59,7 +59,6 @@ public:
 	bool _soundPlaying;
 	bool *_soundIsOn;
 	byte *_digiBuf;
-	Common::String _currentSongName, _nextSongName;
 public:
 	Sound(SherlockEngine *vm, Audio::Mixer *mixer);
 
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index f19eb73..5803a0a 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -85,11 +85,11 @@ bool TattooScene::loadScene(const Common::String &filename) {
 	// Handle loading music for the scene
 	if (music._musicOn) {
 		if (talk._scriptMoreFlag != 1 && talk._scriptMoreFlag != 3)
-			sound._nextSongName = Common::String::format("res%02d", _currentScene);
+			music._nextSongName = Common::String::format("res%02d", _currentScene);
 
 		// If it's a new song, then start it up
-		if (sound._currentSongName.compareToIgnoreCase(sound._nextSongName)) {
-			if (music.loadSong(sound._nextSongName)) {
+		if (music._currentSongName.compareToIgnoreCase(music._nextSongName)) {
+			if (music.loadSong(music._nextSongName)) {
 				music.setMIDIVolume(music._musicVolume);
 				if (music._musicOn)
 					music.startSong();
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index 84a7924..48f49a4 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -292,14 +292,14 @@ OpcodeReturn TattooTalk::cmdGotoScene(const byte *&str) {
 }
 
 OpcodeReturn TattooTalk::cmdNextSong(const byte *&str) {
-	Sound &sound = *_vm->_sound;
+	Music &music = *_vm->_music;
 
 	// Get the name of the next song to play
 	++str;
-	sound._nextSongName = "";
+	music._nextSongName = "";
 	for (int idx = 0; idx < 8; ++idx) {
 		if (str[idx] != '~')
-			sound._nextSongName += str[idx];
+			music._nextSongName += str[idx];
 		else
 			break;
 	}
@@ -368,7 +368,30 @@ OpcodeReturn TattooTalk::cmdNPCLabelSet(const byte *&str) {
 }
 
 OpcodeReturn TattooTalk::cmdPassword(const byte *&str) { error("TODO: script opcode (cmdPassword)"); }
-OpcodeReturn TattooTalk::cmdPlaySong(const byte *&str) { error("TODO: script opcode (cmdPlaySong)"); }
+
+OpcodeReturn TattooTalk::cmdPlaySong(const byte *&str) { 
+	Music &music = *_vm->_music;
+	Common::String currentSong = music._currentSongName;
+
+	// Get the name of the song to play
+	music._currentSongName = "";
+	str++;
+	for (int idx = 0; idx < 8; ++idx) {
+		if (str[idx] != '~')
+			music._currentSongName += str[idx];
+		else
+			break;
+	}
+	str += 7;
+
+	// Play the song
+	music.playMusic(music._currentSongName);
+
+	// Copy the old song name to _nextSongName so that when the new song is finished, the old song will restart
+	music._nextSongName = currentSong;
+
+	return RET_SUCCESS;
+}
 
 OpcodeReturn TattooTalk::cmdRestorePeopleSequence(const byte *&str) {
 	int npcNum = *++str - 1;






More information about the Scummvm-git-logs mailing list