diff options
author | Filippos Karapetis | 2016-01-14 02:06:10 +0200 |
---|---|---|
committer | Filippos Karapetis | 2016-01-14 23:41:33 +0200 |
commit | b61ade788e75f7c610f46333aefd4559ad6f28e1 (patch) | |
tree | bc308f0e794c4061b60d46a534b461e755cbf96d /engines | |
parent | 374a76c89f525910eb27f23518086481bee9aa66 (diff) | |
download | scummvm-rg350-b61ade788e75f7c610f46333aefd4559ad6f28e1.tar.gz scummvm-rg350-b61ade788e75f7c610f46333aefd4559ad6f28e1.tar.bz2 scummvm-rg350-b61ade788e75f7c610f46333aefd4559ad6f28e1.zip |
LAB: Call checkRoomMusic() when changing a room
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/console.cpp | 2 | ||||
-rw-r--r-- | engines/lab/engine.cpp | 2 | ||||
-rw-r--r-- | engines/lab/music.cpp | 14 | ||||
-rw-r--r-- | engines/lab/music.h | 3 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 5 | ||||
-rw-r--r-- | engines/lab/savegame.cpp | 3 |
6 files changed, 12 insertions, 17 deletions
diff --git a/engines/lab/console.cpp b/engines/lab/console.cpp index 217dc28579..20b1f5645b 100644 --- a/engines/lab/console.cpp +++ b/engines/lab/console.cpp @@ -26,6 +26,7 @@ #include "lab/console.h" #include "lab/dispman.h" #include "lab/eventman.h" +#include "lab/music.h" #include "lab/processroom.h" #include "lab/resource.h" @@ -49,6 +50,7 @@ bool Console::Cmd_Scene(int argc, const char **argv) { } _vm->_roomNum = atoi(argv[1]); + _vm->_music->checkRoomMusic(1, _vm->_roomNum); _vm->_curFileName = " "; _vm->_closeDataPtr = nullptr; _vm->_mainDisplay = true; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 6c05a7fc47..3585134fde 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -399,7 +399,6 @@ void LabEngine::mainGameLoop() { // Since the intro hasn't been shown, init the background music here _music->resetMusic(false); - _music->checkRoomMusic(); } uint16 curInv = kItemMap; @@ -480,7 +479,6 @@ void LabEngine::mainGameLoop() { if (!curMsg) { // Does music load and next animation frame when you've run out of messages gotMessage = false; - _music->checkRoomMusic(); updateEvents(); _anim->diffNextFrame(); diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index afad7c56fd..b58d6dc923 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -44,7 +44,6 @@ namespace Lab { Music::Music(LabEngine *vm) : _vm(vm) { _musicFile = nullptr; - _curRoomMusic = 1; _storedPos = 0; } @@ -152,18 +151,13 @@ void Music::resetMusic(bool seektoStoredPos) { changeMusic("Music:BackGround", false, seektoStoredPos); } -void Music::checkRoomMusic() { - if ((_curRoomMusic == _vm->_roomNum) || !_musicFile) - return; - - if (_vm->_roomNum == CLOWNROOM) +void Music::checkRoomMusic(uint16 prevRoom, uint16 newRoom) { + if (newRoom == CLOWNROOM) changeMusic("Music:Laugh", true, false); - else if (_vm->_roomNum == DIMROOM) + else if (newRoom == DIMROOM) changeMusic("Music:Rm81", true, false); - else if (_curRoomMusic == CLOWNROOM || _curRoomMusic == DIMROOM) + else if (prevRoom == CLOWNROOM || prevRoom == DIMROOM) resetMusic(true); - - _curRoomMusic = _vm->_roomNum; } void Music::freeMusic() { diff --git a/engines/lab/music.h b/engines/lab/music.h index 86ebeef880..472fe4fef7 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -50,7 +50,6 @@ private: LabEngine *_vm; Common::File *_musicFile; - uint16 _curRoomMusic; uint32 _storedPos; Audio::SoundHandle _musicHandle; @@ -72,7 +71,7 @@ public: /** * Checks the music that should be playing in a particular room. */ - void checkRoomMusic(); + void checkRoomMusic(uint16 prevRoom, uint16 newRoom); /** * Frees up the music buffers and closes the file. diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index bc09bf5f3a..f0d17bbc24 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -143,8 +143,10 @@ void LabEngine::drawDirection(const CloseData *closePtr) { uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) { if (arrow == 1) { // Forward uint16 room = _rooms[_roomNum]._doors[curDirection]; - if (room != 0) + if (room != 0) { + _music->checkRoomMusic(_roomNum, room); _roomNum = room; + } return curDirection; } else if (arrow == 0) { // Left @@ -327,6 +329,7 @@ void LabEngine::doActions(const ActionList &actionList) { break; } + _music->checkRoomMusic(_roomNum, action->_param1); _roomNum = action->_param1; _direction = action->_param2 - 1; _closeDataPtr = nullptr; diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 1f11ba68f7..16c4044839 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -171,6 +171,7 @@ bool LabEngine::loadGame(int slot) { SaveGameHeader header; readSaveGameHeader(file, header); _roomNum = file->readUint16LE(); + _music->checkRoomMusic(1, _roomNum); _direction = file->readUint16LE(); setQuarters(file->readUint16LE()); @@ -233,8 +234,6 @@ bool LabEngine::saveRestoreGame() { int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { isOK = loadGame(slot); - if (isOK) - _music->checkRoomMusic(); } delete dialog; } |