LAB: Refactor the music code

This commit is contained in:
Filippos Karapetis 2015-12-27 21:12:41 +02:00
parent 29342b1331
commit c5f5fbc208
13 changed files with 115 additions and 267 deletions

View file

@ -72,7 +72,7 @@ void Intro::doPictText(const Common::String filename, bool isScreen) {
Common::String path = Common::String("Lab:rooms/Intro/") + filename;
uint timeDelay = (isScreen) ? 35 : 7;
_vm->updateMusicAndEvents();
_vm->updateEvents();
if (_quitIntro)
return;
@ -126,7 +126,7 @@ void Intro::doPictText(const Common::String filename, bool isScreen) {
}
if (!msg) {
_vm->updateMusicAndEvents();
_vm->updateEvents();
_vm->_anim->diffNextFrame();
uint32 elapsedSeconds = (_vm->_system->getMillis() - lastMillis) / 1000;
@ -192,13 +192,13 @@ void Intro::doPictText(const Common::String filename, bool isScreen) {
}
void Intro::musicDelay() {
_vm->updateMusicAndEvents();
_vm->updateEvents();
if (_quitIntro)
return;
for (int i = 0; i < 20; i++) {
_vm->updateMusicAndEvents();
_vm->updateEvents();
_vm->waitTOF();
_vm->waitTOF();
_vm->waitTOF();
@ -208,7 +208,7 @@ void Intro::musicDelay() {
void Intro::nReadPict(const Common::String filename, bool playOnce) {
Common::String finalFileName = Common::String("P:Intro/") + filename;
_vm->updateMusicAndEvents();
_vm->updateEvents();
introEatMessages();
if (_quitIntro)
@ -247,10 +247,10 @@ void Intro::play() {
_vm->_graphics->blackAllScreen();
if (_vm->getPlatform() == Common::kPlatformAmiga)
_vm->_music->initMusic("Music:BackGround");
if (_vm->getPlatform() != Common::kPlatformAmiga)
_vm->_music->changeMusic("Music:BackGrou", false, false);
else
_vm->_music->initMusic("Music:BackGrou");
_vm->_music->changeMusic("Music:BackGround", false, false);
_vm->_anim->_noPalChange = true;
if (_vm->getPlatform() == Common::kPlatformDOS)
@ -266,7 +266,7 @@ void Intro::play() {
((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) +
(_vm->_anim->_diffPalette[i * 3 + 2] >> 2);
}
_vm->updateMusicAndEvents();
_vm->updateEvents();
if (!_quitIntro)
_vm->_graphics->fade(true);
@ -275,7 +275,7 @@ void Intro::play() {
if (_quitIntro)
break;
_vm->updateMusicAndEvents();
_vm->updateEvents();
uint16 temp = palette[2];
for (int i = 2; i < 15; i++)
@ -290,7 +290,7 @@ void Intro::play() {
if (!_quitIntro) {
_vm->_graphics->fade(false);
_vm->_graphics->blackAllScreen();
_vm->updateMusicAndEvents();
_vm->updateEvents();
}
nReadPict("Title.A");
@ -313,9 +313,9 @@ void Intro::play() {
nReadPict("DA");
musicDelay();
_vm->updateMusicAndEvents();
_vm->updateEvents();
_vm->_graphics->blackAllScreen();
_vm->updateMusicAndEvents();
_vm->updateEvents();
_vm->_anim->_noPalChange = true;
nReadPict("Intro.1");
@ -334,7 +334,7 @@ void Intro::play() {
}
_vm->_graphics->blackAllScreen();
_vm->updateMusicAndEvents();
_vm->updateEvents();
_introDoBlack = true;
nReadPict("Station1");
@ -369,7 +369,7 @@ void Intro::play() {
for (int idx = (8 * 3); idx < (255 * 3); idx++)
_vm->_anim->_diffPalette[idx] = 255 - _vm->_anim->_diffPalette[idx];
_vm->updateMusicAndEvents();
_vm->updateEvents();
_vm->waitTOF();
_vm->_graphics->setPalette(_vm->_anim->_diffPalette, 256);
_vm->waitTOF();