aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-07-01 22:36:38 -0400
committerPaul Gilbert2015-07-01 22:36:38 -0400
commit1b1643ad6f7f0c8cda743d92321dedf2c1373fda (patch)
treef61b8873b42d719e1d3c145d1c547b8214eee8a6
parent76419173b556a094828160dfe37b944bb10bf9c0 (diff)
downloadscummvm-rg350-1b1643ad6f7f0c8cda743d92321dedf2c1373fda.tar.gz
scummvm-rg350-1b1643ad6f7f0c8cda743d92321dedf2c1373fda.tar.bz2
scummvm-rg350-1b1643ad6f7f0c8cda743d92321dedf2c1373fda.zip
SHERLOCK: RT: Implement cmdPlaySong opcode
-rw-r--r--engines/sherlock/music.h1
-rw-r--r--engines/sherlock/sound.h1
-rw-r--r--engines/sherlock/tattoo/tattoo_scene.cpp6
-rw-r--r--engines/sherlock/tattoo/tattoo_talk.cpp31
4 files changed, 31 insertions, 8 deletions
diff --git a/engines/sherlock/music.h b/engines/sherlock/music.h
index da1bca83e1..dc2ed0244f 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 e82d94bbe0..a2e7715b21 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 f19eb73a54..5803a0ace0 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 84a7924c69..48f49a4ed8 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;