aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDavid Fioramonti2018-08-26 17:39:01 -0700
committerdafioram2018-08-31 16:56:50 -0400
commit33131554c13fbd7d99cc83ccd97193a6c220cc85 (patch)
treec4aa706e18b8a4351e1ddacae93a5b8530cef2f7 /engines
parent59506d02874679f3233ac8329b9dc2950008f5d5 (diff)
downloadscummvm-rg350-33131554c13fbd7d99cc83ccd97193a6c220cc85.tar.gz
scummvm-rg350-33131554c13fbd7d99cc83ccd97193a6c220cc85.tar.bz2
scummvm-rg350-33131554c13fbd7d99cc83ccd97193a6c220cc85.zip
MOHAWK: RIVEN: Let credits roll longer
Fixes Trac#10675. Previously, the credits ended as soon as the last row was shown of the final credits image. Now some more black rows (empty rows) are shown and finally a few seconds of black. I set it to 8 seconds of wait beyond where the credits where previously stopping. In order to do this updateCredits was enhanced to work past the end of the last credits image (and just keep adding empty rows). The original game shows a black screen for a longer period than this. The credit image numbers are turned into enums.
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/riven_graphics.cpp20
-rw-r--r--engines/mohawk/riven_graphics.h7
-rw-r--r--engines/mohawk/riven_stack.cpp19
3 files changed, 34 insertions, 12 deletions
diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index ac42b1207a..bc6ebfc382 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -316,7 +316,7 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) :
_enableCardUpdateScript(true),
_scheduledTransition(kRivenTransitionNone),
_dirtyScreen(false),
- _creditsImage(302),
+ _creditsImage(kRivenCreditsZeroImage),
_creditsPos(0),
_transitionMode(kRivenTransitionModeFastest),
_transitionOffset(-1),
@@ -657,7 +657,7 @@ void RivenGraphics::beginCredits() {
clearCache();
// Now cache all the credits images
- for (uint16 i = 302; i <= 320; i++) {
+ for (uint16 i = kRivenCreditsZeroImage; i <= kRivenCreditsLastImage; i++) {
MohawkSurface *surface = _bitmapDecoder->decodeImage(_vm->getExtrasResource(ID_TBMP, i));
surface->convertToTrueColor();
addImageToCache(i, surface);
@@ -669,32 +669,32 @@ void RivenGraphics::beginCredits() {
}
void RivenGraphics::updateCredits() {
- if ((_creditsImage == 303 || _creditsImage == 304) && _creditsPos == 0)
+ if ((_creditsImage == kRivenCreditsFirstImage || _creditsImage == kRivenCreditsSecondImage) && _creditsPos == 0)
fadeToBlack();
- if (_creditsImage < 304) {
+ if (_creditsImage < kRivenCreditsSecondImage) {
// For the first two credit images, they are faded from black to the image and then out again
scheduleTransition(kRivenTransitionBlend);
Graphics::Surface *frame = findImage(_creditsImage++)->getSurface();
-
for (int y = 0; y < frame->h; y++)
memcpy(_mainScreen->getBasePtr(124, y), frame->getBasePtr(0, y), frame->pitch);
runScheduledTransition();
} else {
// Otheriwse, we're scrolling
+ // This is done by 1) moving the screen up one row and
+ // 2) adding a new row at the bottom that is the current row of the current image or
+ // not and it defaults to being empty (a black row).
+
// Move the screen up one row
memmove(_mainScreen->getPixels(), _mainScreen->getBasePtr(0, 1), _mainScreen->pitch * (_mainScreen->h - 1));
- // Only update as long as we're not before the last frame
- // Otherwise, we're just moving up a row (which we already did)
- if (_creditsImage <= 320) {
- // Copy the next row to the bottom of the screen
+ // Copy the next row to the bottom of the screen and keep incrementing the credit images and which row we are on until we reach the last.
+ if (_creditsImage <= kRivenCreditsLastImage) {
Graphics::Surface *frame = findImage(_creditsImage)->getSurface();
memcpy(_mainScreen->getBasePtr(124, _mainScreen->h - 1), frame->getBasePtr(0, _creditsPos), frame->pitch);
_creditsPos++;
-
if (_creditsPos == _mainScreen->h) {
_creditsImage++;
_creditsPos = 0;
diff --git a/engines/mohawk/riven_graphics.h b/engines/mohawk/riven_graphics.h
index 467dfb572c..845fbf25a1 100644
--- a/engines/mohawk/riven_graphics.h
+++ b/engines/mohawk/riven_graphics.h
@@ -58,6 +58,13 @@ enum RivenTransitionMode {
kRivenTransitionModeBest = 5003
};
+enum RivenCreditsImageNumber {
+ kRivenCreditsZeroImage = 302,
+ kRivenCreditsFirstImage = 303,
+ kRivenCreditsSecondImage = 304,
+ kRivenCreditsLastImage = 320
+};
+
class RivenGraphics : public GraphicsManager {
public:
explicit RivenGraphics(MohawkEngine_Riven *vm);
diff --git a/engines/mohawk/riven_stack.cpp b/engines/mohawk/riven_stack.cpp
index cecb557385..abe7e5a903 100644
--- a/engines/mohawk/riven_stack.cpp
+++ b/engines/mohawk/riven_stack.cpp
@@ -237,7 +237,7 @@ void RivenStack::runCredits(uint16 video, uint32 delay, uint32 videoFrameCountOv
frameCount = videoPtr->getFrameCount();
}
- while (!_vm->hasGameEnded() && _vm->_gfx->getCurCreditsImage() <= 320) {
+ while (!_vm->hasGameEnded() && _vm->_gfx->getCurCreditsImage() <= kRivenCreditsLastImage) {
if (videoPtr->getCurFrame() >= frameCount - 1) {
if (nextCreditsFrameStart == 0) {
videoPtr->disable();
@@ -246,7 +246,7 @@ void RivenStack::runCredits(uint16 video, uint32 delay, uint32 videoFrameCountOv
} else if (_vm->getTotalPlayTime() >= nextCreditsFrameStart) {
// the first two frames stay on for 4 seconds
// the rest of the scroll updates happen at 60Hz
- if (_vm->_gfx->getCurCreditsImage() < 304)
+ if (_vm->_gfx->getCurCreditsImage() < kRivenCreditsSecondImage)
nextCreditsFrameStart = _vm->getTotalPlayTime() + 4000;
else
nextCreditsFrameStart = _vm->getTotalPlayTime() + 1000 / 60;
@@ -258,6 +258,21 @@ void RivenStack::runCredits(uint16 video, uint32 delay, uint32 videoFrameCountOv
_vm->doFrame();
}
+ // Let the last frame of credits keep scrolling till black
+ uint currFrameTime = _vm->getTotalPlayTime();
+ nextCreditsFrameStart = currFrameTime + 1000 / 60;
+ uint endFrameTime = currFrameTime + 8000; // 8 seconds
+ uint sleepTime = 0;
+
+ while(currFrameTime < endFrameTime) {
+ if (sleepTime > 0)
+ _vm->delay(sleepTime);
+ nextCreditsFrameStart += 1000 / 60;
+ _vm->_gfx->updateCredits();
+ _vm->doFrame();
+ currFrameTime = _vm->getTotalPlayTime();
+ sleepTime = nextCreditsFrameStart - currFrameTime;
+ }
_vm->setGameEnded();
}