[Scummvm-git-logs] scummvm master -> 33131554c13fbd7d99cc83ccd97193a6c220cc85

dafioram dafioram at gmail.com
Fri Aug 31 22:56:54 CEST 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
33131554c1 MOHAWK: RIVEN: Let credits roll longer


Commit: 33131554c13fbd7d99cc83ccd97193a6c220cc85
    https://github.com/scummvm/scummvm/commit/33131554c13fbd7d99cc83ccd97193a6c220cc85
Author: David Fioramonti (dafioram at gmail.com)
Date: 2018-08-31T16:56:50-04:00

Commit Message:
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.

Changed paths:
    engines/mohawk/riven_graphics.cpp
    engines/mohawk/riven_graphics.h
    engines/mohawk/riven_stack.cpp


diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index ac42b12..bc6ebfc 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 467dfb5..845fbf2 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 cecb557..abe7e5a 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();
 }
 





More information about the Scummvm-git-logs mailing list