diff options
author | Scott Thomas | 2009-08-05 13:57:40 +0000 |
---|---|---|
committer | Scott Thomas | 2009-08-05 13:57:40 +0000 |
commit | 8820b6166ecc5f2c76e926aefdbf4d3ad6f2f062 (patch) | |
tree | 17ee69adb605a0618eb28b97c379273cd0d98690 /engines/groovie | |
parent | 26b372603bf84ad050d0c7b0db6896eb5279664e (diff) | |
download | scummvm-rg350-8820b6166ecc5f2c76e926aefdbf4d3ad6f2f062.tar.gz scummvm-rg350-8820b6166ecc5f2c76e926aefdbf4d3ad6f2f062.tar.bz2 scummvm-rg350-8820b6166ecc5f2c76e926aefdbf4d3ad6f2f062.zip |
T7G: Fix bug #2831041 by implementing opcode responsible for starting music partway through a video
svn-id: r43068
Diffstat (limited to 'engines/groovie')
-rw-r--r-- | engines/groovie/music.cpp | 14 | ||||
-rw-r--r-- | engines/groovie/music.h | 5 | ||||
-rw-r--r-- | engines/groovie/script.cpp | 11 | ||||
-rw-r--r-- | engines/groovie/script.h | 1 |
4 files changed, 29 insertions, 2 deletions
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index 1a1de92156..797290a6f3 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -35,7 +35,7 @@ namespace Groovie { MusicPlayer::MusicPlayer(GroovieEngine *vm) : _vm(vm), _isPlaying(false), _backgroundFileRef(0), _gameVolume(100), - _prevCDtrack(0) { + _prevCDtrack(0), _backgroundDelay(0) { } void MusicPlayer::playSong(uint32 fileref) { @@ -56,6 +56,18 @@ void MusicPlayer::setBackgroundSong(uint32 fileref) { _backgroundFileRef = fileref; } +void MusicPlayer::frameTick() { + if (_backgroundDelay > 0) { + _backgroundDelay--; + if (_backgroundDelay == 0) + playSong(_backgroundFileRef); + } +} + +void MusicPlayer::setBackgroundDelay(uint16 delay) { + _backgroundDelay = delay; +} + void MusicPlayer::playCD(uint8 track) { int startms = 0; diff --git a/engines/groovie/music.h b/engines/groovie/music.h index db50930c37..9909c8a185 100644 --- a/engines/groovie/music.h +++ b/engines/groovie/music.h @@ -44,6 +44,9 @@ public: void playCD(uint8 track); void startBackground(); + void frameTick(); + void setBackgroundDelay(uint16 delay); + // Volume void setUserVolume(uint16 volume); void setGameVolume(uint16 volume, uint16 time); @@ -55,6 +58,8 @@ private: uint32 _backgroundFileRef; uint8 _prevCDtrack; + uint16 _backgroundDelay; + // Volume fading uint32 _fadingStartTime; uint16 _fadingStartVolume; diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 10a63fc5d1..7fdfa6c780 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -564,6 +564,7 @@ bool Script::playvideofromref(uint32 fileref) { // Video available, play one frame if (_videoFile) { bool endVideo = _vm->_videoPlayer->playFrame(); + _vm->_musicPlayer->frameTick(); if (endVideo) { // Close the file @@ -1491,6 +1492,14 @@ void Script::o_playcd() { _vm->_musicPlayer->playCD(val); } +void Script::o_musicdelay() { + uint16 delay = readScript16bits(); + + debugScript(1, true, "MUSICDELAY %d", delay); + + _vm->_musicPlayer->setBackgroundDelay(delay); +} + void Script::o_hotspot_outrect() { uint16 left = readScript16bits(); uint16 top = readScript16bits(); @@ -1662,7 +1671,7 @@ Script::OpcodeFunc Script::_opcodesT7G[NUM_OPCODES] = { &Script::o_nop8, &Script::o_getcd, // 0x4C &Script::o_playcd, - &Script::o_nop16, + &Script::o_musicdelay, &Script::o_nop16, &Script::o_nop16, // 0x50 &Script::o_nop16, diff --git a/engines/groovie/script.h b/engines/groovie/script.h index 71c26835aa..e9e0be69ec 100644 --- a/engines/groovie/script.h +++ b/engines/groovie/script.h @@ -219,6 +219,7 @@ private: void o_sethotspotleft(); void o_getcd(); void o_playcd(); + void o_musicdelay(); void o_hotspot_outrect(); void o_stub56(); void o_stub59(); |