SHERLOCK: intro timing + fixes

This commit is contained in:
Martin Kiewitz 2015-06-01 12:10:20 +02:00
parent 2143ade072
commit 049ca42bb2
3 changed files with 76 additions and 8 deletions

View file

@ -356,5 +356,39 @@ void Music::freeSong() {
void Music::waitTimerRoland(uint time) { void Music::waitTimerRoland(uint time) {
// TODO // TODO
warning("TODO: Sound::waitTimerRoland"); warning("TODO: Sound::waitTimerRoland");
}} // End of namespace Sherlock }
bool Music::waitUntilTick(uint32 tick, uint32 maxTick, uint32 additionalDelay, uint32 noMusicDelay) {
uint32 currentTick = 0;
if (!_midiParser.isPlaying()) {
return _vm->_events->delay(noMusicDelay, true);
}
while (1) {
if (!_midiParser.isPlaying()) { // Music has stopped playing -> we are done
if (additionalDelay > 0) {
if (!_vm->_events->delay(additionalDelay, true))
return false;
}
return true;
}
currentTick = _midiParser.getTick();
//warning("waitUntilTick: %lx", currentTick);
if (currentTick <= maxTick) {
if (currentTick >= tick) {
if (additionalDelay > 0) {
if (!_vm->_events->delay(additionalDelay, true))
return false;
}
return true;
}
}
if (!_vm->_events->delay(10, true))
return false;
}
}
} // End of namespace Sherlock

View file

@ -98,6 +98,8 @@ public:
void stopMusic(); void stopMusic();
void waitTimerRoland(uint time); void waitTimerRoland(uint time);
bool waitUntilTick(uint32 tick, uint32 maxTick, uint32 additionalDelay, uint32 noMusicDelay);
}; };
} // End of namespace Sherlock } // End of namespace Sherlock

View file

@ -307,7 +307,9 @@ bool ScalpelEngine::showCityCutscene() {
// In the alley... // In the alley...
_screen->transBlitFrom(titleImages[3], Common::Point(72, 51)); _screen->transBlitFrom(titleImages[3], Common::Point(72, 51));
_screen->fadeIn(palette, 3); _screen->fadeIn(palette, 3);
finished = _events->delay(2500, true);
// Wait until the track got looped and the first few notes were played
finished = _music->waitUntilTick(0x104, 0x500, 0, 2500);
} }
} }
@ -323,11 +325,16 @@ bool ScalpelEngine::showAlleyCutscene() {
_animation->_gfxLibraryFilename = "TITLE.LIB"; _animation->_gfxLibraryFilename = "TITLE.LIB";
_animation->_soundLibraryFilename = "TITLE.SND"; _animation->_soundLibraryFilename = "TITLE.SND";
// Fade "In The Alley..." text to black
_screen->fadeToBlack(2);
bool finished = _animation->play("27PRO1", 1, 3, true, 2); bool finished = _animation->play("27PRO1", 1, 3, true, 2);
if (finished) { if (finished) {
_screen->getPalette(palette); _screen->getPalette(palette);
_screen->fadeToBlack(2); _screen->fadeToBlack(2);
finished = _events->delay(500);
// wait until second lower main note
finished = _music->waitUntilTick(0x64a, 0xFFFF, 0, 1000); // 652
} }
if (finished) { if (finished) {
@ -337,7 +344,17 @@ bool ScalpelEngine::showAlleyCutscene() {
if (finished) { if (finished) {
showLBV("scream.lbv"); showLBV("scream.lbv");
finished = _events->delay(6000);
// wait until first "scream" in music happened
finished = _music->waitUntilTick(0xabe, 0xFFFF, 0, 6000);
}
if (finished) {
// quick fade out
_screen->fadeToBlack(1);
// wait until after third "scream" in music happened
finished = _music->waitUntilTick(0xb80, 0xFFFF, 0, 2000);
} }
if (finished) if (finished)
@ -351,9 +368,13 @@ bool ScalpelEngine::showAlleyCutscene() {
if (finished) { if (finished) {
ImageFile titleImages("title3.vgs", true); ImageFile titleImages("title3.vgs", true);
// "Early the following morning on Baker Street..." // "Early the following morning on Baker Street..."
_screen->_backBuffer1.transBlitFrom(titleImages[0], Common::Point(35, 51), false, 0); _screen->transBlitFrom(titleImages[0], Common::Point(35, 51));
_screen->fadeIn(palette, 3);
finished = _events->delay(1000); // fast fade-in
_screen->fadeIn(palette, 1);
// wait for music to end and wait an additional 2.5 seconds
finished = _music->waitUntilTick(0xFFFF, 0xFFFF, 2500, 3000);
} }
_animation->_gfxLibraryFilename = ""; _animation->_gfxLibraryFilename = "";
@ -367,7 +388,18 @@ bool ScalpelEngine::showStreetCutscene() {
_music->playMusic("PROLOG3.MUS"); _music->playMusic("PROLOG3.MUS");
bool finished = _animation->play("14KICK", 1, 3, true, 2); // wait a bit
bool finished = _events->delay(500);
if (finished) {
// fade out "Early the following morning..."
_screen->fadeToBlack(2);
// wait for music a bit
finished = _music->waitUntilTick(0xE4, 0xFFFF, 0, 1000);
}
finished = _animation->play("14KICK", 1, 3, true, 2);
if (finished) if (finished)
finished = _animation->play("14NOTE", 1, 0, false, 2); finished = _animation->play("14NOTE", 1, 0, false, 2);