LAB: Move music reset code into a separate function

This commit is contained in:
Filippos Karapetis 2016-01-14 00:31:37 +02:00
parent 49a45a21ce
commit 7aafcaca1a
5 changed files with 16 additions and 21 deletions

View File

@ -396,10 +396,7 @@ void LabEngine::mainGameLoop() {
loadGame(ConfMan.getInt("save_slot"));
// Since the intro hasn't been shown, init the background music here
if (getPlatform() != Common::kPlatformAmiga)
_music->changeMusic("Music:BackGrou", false, false);
else
_music->changeMusic("Music:BackGround", false, false);
_music->resetMusic(false);
_music->checkRoomMusic();
}

View File

@ -238,11 +238,7 @@ void Intro::play() {
}
_vm->_graphics->blackAllScreen();
if (_vm->getPlatform() != Common::kPlatformAmiga)
_vm->_music->changeMusic("Music:BackGrou", false, false);
else
_vm->_music->changeMusic("Music:BackGround", false, false);
_vm->_music->resetMusic(false);
if (_vm->getPlatform() == Common::kPlatformDOS)
nReadPict("TNDcycle.pic", true, true);

View File

@ -104,16 +104,12 @@ void Music::checkRoomMusic() {
if ((_curRoomMusic == _vm->_roomNum) || !_musicFile)
return;
if (_vm->_roomNum == CLOWNROOM) {
if (_vm->_roomNum == CLOWNROOM)
changeMusic("Music:Laugh", true, false);
} else if (_vm->_roomNum == DIMROOM) {
else if (_vm->_roomNum == DIMROOM)
changeMusic("Music:Rm81", true, false);
} else if (_curRoomMusic == CLOWNROOM || _curRoomMusic == DIMROOM) {
if (_vm->getPlatform() != Common::kPlatformAmiga)
changeMusic("Music:Backgrou", false, true);
else
changeMusic("Music:Background", false, true);
}
else if (_curRoomMusic == CLOWNROOM || _curRoomMusic == DIMROOM)
resetMusic(true);
_curRoomMusic = _vm->_roomNum;
}
@ -175,4 +171,11 @@ void Music::readSound(bool waitTillFinished, bool loop, Common::File *file) {
}
}
void Music::resetMusic(bool seektoStoredPos) {
if (_vm->getPlatform() != Common::kPlatformAmiga)
changeMusic("Music:BackGrou", false, seektoStoredPos);
else
changeMusic("Music:BackGround", false, seektoStoredPos);
}
} // End of namespace Lab

View File

@ -68,6 +68,8 @@ public:
*/
void changeMusic(const Common::String filename, bool storeCurPos, bool seektoStoredPos);
void resetMusic(bool seekToStoredPos);
/**
* Checks the music that should be playing in a particular room.
*/

View File

@ -389,10 +389,7 @@ void LabEngine::doActions(const ActionList &actionList) {
break;
case kActionResetMusic: // used in scene 45 (sheriff's office, after museum)
if (getPlatform() != Common::kPlatformAmiga)
_music->changeMusic("Music:BackGrou", false, true);
else
_music->changeMusic("Music:BackGround", false, true);
_music->resetMusic(true);
break;
case kActionFillMusic: