SHERLOCK: intro: msec sync instead of ticks

This commit is contained in:
Martin Kiewitz 2015-06-16 22:56:58 +02:00
parent 071de331c0
commit 3aef3c396d
3 changed files with 6 additions and 43 deletions

View File

@ -504,41 +504,6 @@ uint32 Music::getCurrentPosition() {
}
}
// This is used to wait for the music in certain situations like especially the intro
// Note: the original game didn't do this, instead it just waited for certain amounts of time
// We do this, so that the intro graphics + music work together even on faster/slower hardware.
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;
}
}
// This is used to wait for the music in certain situations like especially the intro
// Note: the original game didn't do this, instead it just waited for certain amounts of time
// We do this, so that the intro graphics + music work together even on faster/slower hardware.

View File

@ -113,8 +113,6 @@ public:
bool isPlaying();
uint32 getCurrentPosition();
bool waitUntilTick(uint32 tick, uint32 maxTick, uint32 additionalDelay, uint32 noMusicDelay);
bool waitUntilMSec(uint32 msecTarget, uint32 maxMSec, uint32 additionalDelay, uint32 noMusicDelay);
/**

View File

@ -340,7 +340,7 @@ bool ScalpelEngine::showCityCutscene() {
_screen->fadeIn(palette, 3);
// Wait until the track got looped and the first few notes were played
finished = _music->waitUntilTick(0x104, 0x500, 0, 2500);
finished = _music->waitUntilMSec(4300, 21300, 0, 2500); // ticks 0x104 / ticks 0x500
}
}
@ -365,7 +365,7 @@ bool ScalpelEngine::showAlleyCutscene() {
_screen->fadeToBlack(2);
// wait until second lower main note
finished = _music->waitUntilTick(0x64a, 0xFFFF, 0, 1000); // 652
finished = _music->waitUntilMSec(26800, 0xFFFFFFFF, 0, 1000); // ticks 0x64A
}
if (finished) {
@ -377,7 +377,7 @@ bool ScalpelEngine::showAlleyCutscene() {
showLBV("scream.lbv");
// wait until first "scream" in music happened
finished = _music->waitUntilTick(0xabe, 0xFFFF, 0, 6000);
finished = _music->waitUntilMSec(45800, 0xFFFFFFFF, 0, 6000); // ticks 0xABE
}
if (finished) {
@ -385,7 +385,7 @@ bool ScalpelEngine::showAlleyCutscene() {
_screen->fadeToBlack(1);
// wait until after third "scream" in music happened
finished = _music->waitUntilTick(0xb80, 0xFFFF, 0, 2000);
finished = _music->waitUntilMSec(49000, 0xFFFFFFFF, 0, 2000); // ticks 0xB80
}
if (finished)
@ -405,7 +405,7 @@ bool ScalpelEngine::showAlleyCutscene() {
_screen->fadeIn(palette, 1);
// wait for music to end and wait an additional 2.5 seconds
finished = _music->waitUntilTick(0xFFFF, 0xFFFF, 2500, 3000);
finished = _music->waitUntilMSec(0xFFFFFFFF, 0xFFFFFFFF, 2500, 3000);
}
_animation->_gfxLibraryFilename = "";
@ -427,7 +427,7 @@ bool ScalpelEngine::showStreetCutscene() {
_screen->fadeToBlack(2);
// wait for music a bit
finished = _music->waitUntilTick(0xE4, 0xFFFF, 0, 1000);
finished = _music->waitUntilMSec(3800, 0xFFFFFFFF, 0, 1000); // ticks 0xE4
}
if (finished)