Sync the credits so that the text scroll and music will last for about the
same amount of time. I don't think the original did this, but it turned out to be pretty easy. svn-id: r12334
This commit is contained in:
parent
e792b1c715
commit
c75f5efd2f
2 changed files with 35 additions and 23 deletions
|
@ -349,11 +349,6 @@ void Sound::saveMusicState(void) {
|
||||||
void Sound::restoreMusicState(void) {
|
void Sound::restoreMusicState(void) {
|
||||||
Common::StackLock lock(_mutex);
|
Common::StackLock lock(_mutex);
|
||||||
|
|
||||||
int restoreStream;
|
|
||||||
|
|
||||||
if (!_music[2]._streaming)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Fade out any music that happens to be playing
|
// Fade out any music that happens to be playing
|
||||||
|
|
||||||
for (int i = 0; i < MAXMUS; i++) {
|
for (int i = 0; i < MAXMUS; i++) {
|
||||||
|
@ -361,6 +356,11 @@ void Sound::restoreMusicState(void) {
|
||||||
_music[i].fadeDown();
|
_music[i].fadeDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_music[2]._streaming)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int restoreStream;
|
||||||
|
|
||||||
if (!_music[0]._streaming)
|
if (!_music[0]._streaming)
|
||||||
restoreStream = 0;
|
restoreStream = 0;
|
||||||
else
|
else
|
||||||
|
|
|
@ -585,8 +585,7 @@ int32 Logic::fnPlayCredits(int32 *params) {
|
||||||
// Start the music and roll the credits
|
// Start the music and roll the credits
|
||||||
|
|
||||||
// The credits music (which can also be heard briefly in the "carib"
|
// The credits music (which can also be heard briefly in the "carib"
|
||||||
// cutscene) is played once, and there is no attempt at synchronizing
|
// cutscene) is played once.
|
||||||
// it with the credits scroll.
|
|
||||||
|
|
||||||
int32 pars[2];
|
int32 pars[2];
|
||||||
|
|
||||||
|
@ -606,7 +605,18 @@ int32 Logic::fnPlayCredits(int32 *params) {
|
||||||
int startLine = 0;
|
int startLine = 0;
|
||||||
int scrollPos = 0;
|
int scrollPos = 0;
|
||||||
|
|
||||||
while (scrollPos < lineTop + CREDITS_FONT_HEIGHT && !_vm->_quit) {
|
bool abortCredits = false;
|
||||||
|
|
||||||
|
int scrollSteps = lineTop + CREDITS_FONT_HEIGHT;
|
||||||
|
uint32 musicStart = _vm->_system->get_msecs();
|
||||||
|
|
||||||
|
// Ideally the music should last just a tiny bit longer than the
|
||||||
|
// credits. Note that musicTimeRemaining() will return 0 if the music
|
||||||
|
// is muted, so we need a sensible fallback for that case.
|
||||||
|
|
||||||
|
uint32 musicLength = MAX(1000 * (_vm->_sound->musicTimeRemaining() - 3), 25 * scrollSteps);
|
||||||
|
|
||||||
|
while (scrollPos < scrollSteps && !_vm->_quit) {
|
||||||
bool foundStartLine = false;
|
bool foundStartLine = false;
|
||||||
|
|
||||||
_vm->_graphics->clearScene();
|
_vm->_graphics->clearScene();
|
||||||
|
@ -671,13 +681,16 @@ int32 Logic::fnPlayCredits(int32 *params) {
|
||||||
KeyboardEvent ke;
|
KeyboardEvent ke;
|
||||||
|
|
||||||
if (_vm->_input->readKey(&ke) == RD_OK && ke.keycode == 27) {
|
if (_vm->_input->readKey(&ke) == RD_OK && ke.keycode == 27) {
|
||||||
fnStopMusic(NULL);
|
if (!abortCredits) {
|
||||||
break;
|
abortCredits = true;
|
||||||
|
_vm->_graphics->fadeDown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (abortCredits && _vm->_graphics->getFadeStatus() == RDFADE_BLACK)
|
||||||
|
break;
|
||||||
|
|
||||||
_vm->_system->delay_msecs(30);
|
_vm->sleepUntil(musicStart + (musicLength * scrollPos) / scrollSteps);
|
||||||
|
|
||||||
scrollPos++;
|
scrollPos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,20 +707,19 @@ int32 Logic::fnPlayCredits(int32 *params) {
|
||||||
if (logoData)
|
if (logoData)
|
||||||
free(logoData);
|
free(logoData);
|
||||||
|
|
||||||
|
if (!abortCredits) {
|
||||||
|
// The music should either have stopped or be about to stop, so
|
||||||
|
// wait for it to really happen.
|
||||||
|
|
||||||
|
while (_vm->_sound->musicTimeRemaining() && !_vm->_quit) {
|
||||||
|
_vm->_graphics->updateDisplay(false);
|
||||||
|
_vm->_system->delay_msecs(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_vm->_quit)
|
if (_vm->_quit)
|
||||||
return IR_CONT;
|
return IR_CONT;
|
||||||
|
|
||||||
_vm->_graphics->fadeDown();
|
|
||||||
_vm->_graphics->waitForFade();
|
|
||||||
|
|
||||||
// The music should have stopped by now, but I suppose there is a
|
|
||||||
// slim chance it hasn't on a really, really fast computer.
|
|
||||||
|
|
||||||
while (_vm->_sound->musicTimeRemaining()) {
|
|
||||||
_vm->_graphics->updateDisplay(false);
|
|
||||||
_vm->_system->delay_msecs(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
_vm->_sound->restoreMusicState();
|
_vm->_sound->restoreMusicState();
|
||||||
_vm->_sound->muteFx(false);
|
_vm->_sound->muteFx(false);
|
||||||
_vm->_sound->muteSpeech(false);
|
_vm->_sound->muteSpeech(false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue