diff options
author | Willem Jan Palenstijn | 2015-12-26 14:20:15 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-26 14:20:15 +0100 |
commit | ae519716a207b134e3c287dc53cadb4ef55a389a (patch) | |
tree | 4c37f8c3310d53bb6cc3791939dbf963cc147ecd /engines/lab | |
parent | 01d99d213dae8731c3c9a19cbd98f5fbfb9ee1fc (diff) | |
parent | 07b554b847d9675d5d97b7ea36ac87ce17e6a1f3 (diff) | |
download | scummvm-rg350-ae519716a207b134e3c287dc53cadb4ef55a389a.tar.gz scummvm-rg350-ae519716a207b134e3c287dc53cadb4ef55a389a.tar.bz2 scummvm-rg350-ae519716a207b134e3c287dc53cadb4ef55a389a.zip |
Merge branch 'master' of github.com:scummvm/scummvm
Diffstat (limited to 'engines/lab')
-rw-r--r-- | engines/lab/anim.cpp | 9 | ||||
-rw-r--r-- | engines/lab/anim.h | 4 | ||||
-rw-r--r-- | engines/lab/detection.cpp | 4 | ||||
-rw-r--r-- | engines/lab/dispman.cpp | 21 | ||||
-rw-r--r-- | engines/lab/eventman.cpp | 3 | ||||
-rw-r--r-- | engines/lab/lab.cpp | 7 | ||||
-rw-r--r-- | engines/lab/map.cpp | 5 | ||||
-rw-r--r-- | engines/lab/music.cpp | 16 | ||||
-rw-r--r-- | engines/lab/music.h | 9 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 29 |
10 files changed, 42 insertions, 65 deletions
diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index eb825fb4c0..ea7f568de3 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -80,6 +80,9 @@ void Anim::setOutputBuffer(byte *memoryBuffer) { _outputBuffer = memoryBuffer; } +uint16 Anim::getDIFFHeight() { + return _headerdata._height; +} void Anim::diffNextFrame(bool onlyDiffData) { if (_lastBlockHeader == 65535) @@ -90,7 +93,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { byte *startOfBuf = _outputBuffer; int bufPitch = _vm->_graphics->_screenWidth; - if (!_outputBuffer) { + if (!startOfBuf) { startOfBuf = _vm->_graphics->getCurrentDrawingBuffer(); drawOnScreen = true; } @@ -217,7 +220,9 @@ void Anim::diffNextFrame(bool onlyDiffData) { _sampleSpeed = _diffFile->readUint16LE(); _diffFile->skip(2); - _vm->_music->playSoundEffect(_sampleSpeed, _size, _diffFile); + // Sound effects embedded in animations are started here. These are + // usually animation-specific, like door opening sounds, and are not looped + _vm->_music->playSoundEffect(_sampleSpeed, _size, false, _diffFile); break; case 65535: diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 1979aa5979..e9bc8589c0 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -66,12 +66,12 @@ private: uint32 _diffHeight; byte *_outputBuffer; + DIFFHeader _headerdata; public: Anim(LabEngine *vm); virtual ~Anim(); - DIFFHeader _headerdata; char _diffPalette[256 * 3]; bool _waitForEffect; // Wait for each sound effect to finish before continuing. bool _doBlack; // Black the screen before new picture @@ -94,6 +94,8 @@ public: * Stops an animation from running. */ void stopDiffEnd(); + + uint16 getDIFFHeight(); }; } // End of namespace Lab diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 0810c4cb44..805594bf6a 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -43,7 +43,6 @@ static const ADGameDescription labDescriptions[] = { "", { { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, // game/doors - { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, // fonts/notes11 { "noteold.fon", 0, "6c1d90ad55149556e79d3f7bfddb4bd7", 9252 }, // game/spict/noteold.fon { NULL, 0, NULL, 0 } }, @@ -57,7 +56,6 @@ static const ADGameDescription labDescriptions[] = { "Lowres", { { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, // game/doors - { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, // fonts/notes11 { "64b", 0, "3a84d41bcc6a782f22e8e954bce09721", 39916 }, // game/pict/h2/64b { NULL, 0, NULL, 0 } }, @@ -71,7 +69,6 @@ static const ADGameDescription labDescriptions[] = { "Rerelease", { { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, // game/doors - { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, // fonts/notes11 { "noteold.fon", 0, "6c1d90ad55149556e79d3f7bfddb4bd7", 9252 }, // game/spict/noteold.fon { "wyrmkeep",0, "97c7064c54c28b952d37c4ebff6efa50", 52286 }, // game/spict/intro { NULL, 0, NULL, 0 } @@ -94,7 +91,6 @@ static const ADGameDescription labDescriptions[] = { }; static const char *const directoryGlobs[] = { - "fonts", "game", "pict", "spict", diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 65bb7c4398..a2c83f834b 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -88,10 +88,6 @@ void DisplayMan::readPict(const Common::String filename, bool playOnce, bool onl _vm->_anim->stopDiff(); loadPict(filename); _vm->updateMusicAndEvents(); - - if (!_vm->_music->_loopSoundEffect) - _vm->_music->stopSoundEffect(); - _vm->_anim->setOutputBuffer(memoryBuffer); _vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData); } @@ -677,20 +673,19 @@ void DisplayMan::doScrollWipe(const Common::String filename) { uint16 nheight = height; uint16 startLine = 0, onRow = 0; - while (onRow < _vm->_anim->_headerdata._height) { + while (onRow < _vm->_anim->getDIFFHeight()) { _vm->updateMusicAndEvents(); if ((by > nheight) && nheight) by = nheight; - if ((startLine + by) > (_vm->_anim->_headerdata._height - height - 1)) + if ((startLine + by) > (_vm->_anim->getDIFFHeight() - height - 1)) break; if (nheight) nheight -= by; copyPage(width, height, nheight, startLine, mem); - screenUpdate(); if (!nheight) @@ -719,7 +714,7 @@ void DisplayMan::doScrollBounce() { byte *mem = _vm->_anim->_scrollScreenBuffer; _vm->updateMusicAndEvents(); - int startLine = _vm->_anim->_headerdata._height - height - 1; + int startLine = _vm->_anim->getDIFFHeight() - height - 1; for (int i = 0; i < 5; i++) { _vm->updateMusicAndEvents(); @@ -832,19 +827,19 @@ void DisplayMan::doTransition(TransitionType transitionType, const Common::Strin case kTransitionTransporter: doTransWipe(filename); break; - case kTransitionScrollWipe: + case kTransitionScrollWipe: // only used in scene 7 (street, when teleporting to the surreal maze) doScrollWipe(filename); break; - case kTransitionScrollBlack: + case kTransitionScrollBlack: // only used in scene 7 (street, when teleporting to the surreal maze) doScrollBlack(); break; - case kTransitionScrollBounce: + case kTransitionScrollBounce: // only used in scene 7 (street, when teleporting to the surreal maze) doScrollBounce(); break; - case kTransitionReadFirstFrame: + case kTransitionReadFirstFrame: // only used in scene 7 (street, when teleporting to the surreal maze) readPict(filename, false); break; - case kTransitionReadNextFrame: + case kTransitionReadNextFrame: // only used in scene 7 (street, when teleporting to the surreal maze) _vm->_anim->diffNextFrame(); break; case kTransitionNone: diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 83c50b9771..823b6b45e9 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -191,9 +191,6 @@ void EventManager::processInput() { case Common::KEYCODE_RIGHTBRACKET: _vm->changeVolume(1); break; - case Common::KEYCODE_z: - //saveSettings(); - break; case Common::KEYCODE_d: if (event.kbd.hasFlags(Common::KBD_CTRL)) { // Open debugger console diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index e942617a26..815053e71e 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -221,7 +221,12 @@ void LabEngine::drawStaticMessage(byte index) { } void LabEngine::changeVolume(int delta) { - warning("STUB: changeVolume()"); + int sfxPrev = _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType); + int musicPrev = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType); + int sfxNew = (delta > 0) ? MIN<int>(sfxPrev + 10, Audio::Mixer::kMaxMixerVolume) : MAX<int>(sfxPrev - 10, 0); + int musicNew = (delta > 0) ? MIN<int>(musicPrev + 10, Audio::Mixer::kMaxMixerVolume) : MAX<int>(musicPrev - 10, 0); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, sfxNew); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, musicNew); } void LabEngine::waitTOF() { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 21a0830913..d96631f330 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -83,8 +83,6 @@ void LabEngine::loadMapData() { Common::File *mapFile = _resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); updateMusicAndEvents(); - if (!_music->_loopSoundEffect) - _music->stopSoundEffect(); _maxRooms = mapFile->readUint16LE(); _maps = new MapData[_maxRooms + 1]; // will be freed when the user exits the map @@ -339,10 +337,11 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad for (int i = 1; i <= _maxRooms; i++) { if ((_maps[i]._pageNumber == floorNum) && _roomsFound->in(i) && _maps[i]._x) { drawRoomMap(i, (bool)(i == curRoom)); - updateMusicAndEvents(); } } + updateMusicAndEvents(); + // Makes sure the X is drawn in corridors // NOTE: this here on purpose just in case there's some weird // condition, like the surreal maze where there are no rooms diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 95581aec5c..c46e3a10ec 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -56,7 +56,6 @@ Music::Music(LabEngine *vm) : _vm(vm) { _leftInFile = 0; _musicOn = false; - _loopSoundEffect = false; _queuingAudioStream = nullptr; _lastMusicRoom = 1; _doReset = true; @@ -95,7 +94,7 @@ uint16 Music::getPlayingBufferCount() { return (_queuingAudioStream) ? _queuingAudioStream->numQueuedStreams() : 0; } -void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, Common::File *dataFile) { +void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile) { pauseBackMusic(); stopSoundEffect(); @@ -114,7 +113,7 @@ void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, Common::File *dat dataFile->read(soundData, length); Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)soundData, length, sampleSpeed, soundFlags); - uint loops = (_loopSoundEffect) ? 0 : 1; + uint loops = (loop) ? 0 : 1; Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); } @@ -274,22 +273,21 @@ void Music::resetMusic() { _tFile = 0; } -bool Music::readMusic(const Common::String filename, bool waitTillFinished) { +bool Music::readMusic(const Common::String filename, bool loop, bool waitTillFinished) { Common::File *file = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); _vm->updateMusicAndEvents(); - if (!_loopSoundEffect) - stopSoundEffect(); + stopSoundEffect(); if (!file) return false; _vm->_anim->_doBlack = false; - readSound(waitTillFinished, file); + readSound(waitTillFinished, loop, file); return true; } -void Music::readSound(bool waitTillFinished, Common::File *file) { +void Music::readSound(bool waitTillFinished, bool loop, Common::File *file) { uint32 magicBytes = file->readUint32LE(); if (magicBytes != 1219009121) { warning("readSound: Bad signature, skipping"); @@ -320,7 +318,7 @@ void Music::readSound(bool waitTillFinished, Common::File *file) { uint16 sampleRate = file->readUint16LE(); file->skip(2); - playSoundEffect(sampleRate, soundSize, file); + playSoundEffect(sampleRate, soundSize, loop, file); } else if (soundTag == 65535) { if (waitTillFinished) { while (isSoundEffectActive()) { diff --git a/engines/lab/music.h b/engines/lab/music.h index 42fdf41d67..1a3fd24e72 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -74,7 +74,7 @@ private: * Pauses the background music. */ void pauseBackMusic(); - void readSound(bool waitTillFinished, Common::File *file); + void readSound(bool waitTillFinished, bool loop, Common::File *file); /** * Starts up the music initially. @@ -82,9 +82,6 @@ private: void startMusic(bool restartFl); public: - bool _loopSoundEffect; - -public: Music(LabEngine *vm); /** @@ -107,12 +104,12 @@ public: */ bool initMusic(const Common::String filename); bool isSoundEffectActive() const; - void playSoundEffect(uint16 sampleSpeed, uint32 length, Common::File *dataFile); + void playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile); /** * Reads in a music file. Ignores any graphics. */ - bool readMusic(const Common::String filename, bool waitTillFinished); + bool readMusic(const Common::String filename, bool loop, bool waitTillFinished); /** * Changes the background music to the original piece playing. diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index d54a7fc2fc..813642e193 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -239,18 +239,15 @@ void LabEngine::doActions(const ActionList &actionList) { switch (action->_actionType) { case kActionPlaySound: - _music->_loopSoundEffect = false; - _music->readMusic(action->_messages[0], true); + _music->readMusic(action->_messages[0], false, true); break; - case kActionPlaySoundNoWait: - _music->_loopSoundEffect = false; - _music->readMusic(action->_messages[0], false); + case kActionPlaySoundNoWait: // only used in scene 7 (street, when teleporting to the surreal maze) + _music->readMusic(action->_messages[0], false, false); break; case kActionPlaySoundLooping: - _music->_loopSoundEffect = true; - _music->readMusic(action->_messages[0], false); + _music->readMusic(action->_messages[0], true, false); break; case kActionShowDiff: @@ -411,12 +408,7 @@ void LabEngine::doActions(const ActionList &actionList) { break; case kActionClearSound: - if (_music->_loopSoundEffect) { - _music->_loopSoundEffect = false; - _music->stopSoundEffect(); - } else if (_music->isSoundEffectActive()) - _music->stopSoundEffect(); - + _music->stopSoundEffect(); break; case kActionWinMusic: @@ -474,16 +466,7 @@ void LabEngine::doActions(const ActionList &actionList) { } } - if (_music->_loopSoundEffect) { - _music->_loopSoundEffect = false; - _music->stopSoundEffect(); - } else { - while (_music->isSoundEffectActive()) { - updateMusicAndEvents(); - _anim->diffNextFrame(); - waitTOF(); - } - } + _music->stopSoundEffect(); } bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults) { |