[Scummvm-cvs-logs] scummvm master -> 0d271324db406bcdfe51ae4b8ebf30eebef32860
clone2727
clone2727 at gmail.com
Wed Mar 9 20:12:57 CET 2011
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8743838f47 MOHAWK: Add initial support for the Riven credits sequence
8de370e847 MOHAWK: Correct start times for Riven credits
0d271324db MOHAWK: Remove outdated TODO
Commit: 8743838f47efb8b80955e64aca027c954dbf8b51
https://github.com/scummvm/scummvm/commit/8743838f47efb8b80955e64aca027c954dbf8b51
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-09T10:59:30-08:00
Commit Message:
MOHAWK: Add initial support for the Riven credits sequence
The credits start too early for a few of the end game sequences, but otherwise works well (minus missing fade support, but that is throughout the game anyway).
Changed paths:
engines/mohawk/graphics.cpp
engines/mohawk/graphics.h
engines/mohawk/riven_external.cpp
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index 897ca79..19882c4 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -246,6 +246,13 @@ void GraphicsManager::copyAnimImageSectionToScreen(MohawkSurface *image, Common:
getVM()->_system->unlockScreen();
}
+void GraphicsManager::addImageToCache(uint16 id, MohawkSurface *surface) {
+ if (_cache.contains(id))
+ error("Image %d already in cache", id);
+
+ _cache[id] = surface;
+}
+
MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) {
_bmpDecoder = new MystBitmap();
@@ -630,6 +637,9 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) : GraphicsManager(), _vm(vm
_scheduledTransition = -1; // no transition
_dirtyScreen = false;
_inventoryDrawn = false;
+
+ _creditsImage = 302;
+ _creditsPos = 0;
}
RivenGraphics::~RivenGraphics() {
@@ -840,6 +850,17 @@ void RivenGraphics::runScheduledTransition() {
_scheduledTransition = -1; // Clear scheduled transition
}
+void RivenGraphics::clearMainScreen() {
+ _mainScreen->fillRect(Common::Rect(0, 0, 608, 392), _pixelFormat.RGBToColor(0, 0, 0));
+}
+
+void RivenGraphics::fadeToBlack() {
+ // Self-explanatory
+ scheduleTransition(16);
+ clearMainScreen();
+ runScheduledTransition();
+}
+
void RivenGraphics::showInventory() {
// Don't redraw the inventory
if (_inventoryDrawn)
@@ -955,6 +976,60 @@ void RivenGraphics::drawExtrasImage(uint16 id, Common::Rect dstRect) {
_dirtyScreen = true;
}
+void RivenGraphics::beginCredits() {
+ // Clear the old cache
+ clearCache();
+
+ // Now cache all the credits images
+ for (uint16 i = 302; i <= 320; i++) {
+ MohawkSurface *surface = _bitmapDecoder->decodeImage(_vm->getExtrasResource(ID_TBMP, i));
+ surface->convertToTrueColor();
+ addImageToCache(i, surface);
+ }
+
+ // And clear our screen too
+ clearMainScreen();
+}
+
+void RivenGraphics::updateCredits() {
+ if ((_creditsImage == 303 || _creditsImage == 304) && _creditsPos == 0)
+ fadeToBlack();
+
+ if (_creditsImage < 304) {
+ // For the first two credit images, they are faded from black to the image and then out again
+ scheduleTransition(16);
+
+ 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
+ // Move the screen up one row
+ memmove(_mainScreen->pixels, _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
+ 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;
+ }
+ }
+
+ // Now flush the new screen
+ _vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
+ _vm->_system->updateScreen();
+ }
+}
+
LBGraphics::LBGraphics(MohawkEngine_LivingBooks *vm, uint16 width, uint16 height) : GraphicsManager(), _vm(vm) {
_bmpDecoder = _vm->isPreMohawk() ? new OldMohawkBitmap() : new MohawkBitmap();
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h
index 89189d4..fbac2f2 100644
--- a/engines/mohawk/graphics.h
+++ b/engines/mohawk/graphics.h
@@ -110,6 +110,7 @@ protected:
virtual Common::Array<MohawkSurface *> decodeImages(uint16 id);
virtual MohawkEngine *getVM() = 0;
+ void addImageToCache(uint16 id, MohawkSurface *surface);
private:
// An image cache that stores images until clearCache() is called
@@ -195,11 +196,17 @@ public:
// Transitions
void scheduleTransition(uint16 id, Common::Rect rect = Common::Rect(0, 0, 608, 392));
void runScheduledTransition();
+ void fadeToBlack();
// Inventory
void showInventory();
void hideInventory();
+ // Credits
+ void beginCredits();
+ void updateCredits();
+ uint getCurCreditsImage() { return _creditsImage; }
+
protected:
MohawkSurface *decodeImage(uint16 id);
MohawkEngine *getVM() { return (MohawkEngine *)_vm; }
@@ -224,6 +231,10 @@ private:
Graphics::Surface *_mainScreen;
bool _dirtyScreen;
Graphics::PixelFormat _pixelFormat;
+ void clearMainScreen();
+
+ // Credits
+ uint _creditsImage, _creditsPos;
};
class LBGraphics : public GraphicsManager {
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index e6ea25c..dbc1bd9 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -223,13 +223,27 @@ void RivenExternal::runEndGame(uint16 video) {
}
void RivenExternal::runCredits(uint16 video) {
- // TODO: Play until the last frame and then run the credits
+ // Initialize our credits state
+ _vm->_cursor->hideCursor();
+ _vm->_gfx->beginCredits();
+ uint nextCreditsFrameStart = 0;
VideoHandle videoHandle = _vm->_video->findVideoHandleRiven(video);
- while (!_vm->_video->endOfVideo(videoHandle) && !_vm->shouldQuit()) {
- if (_vm->_video->updateMovies())
- _vm->_system->updateScreen();
+ while (!_vm->shouldQuit() && _vm->_gfx->getCurCreditsImage() <= 320) {
+ if (_vm->_video->getCurFrame(videoHandle) >= (int32)_vm->_video->getFrameCount(videoHandle) - 1) {
+ if (_vm->_system->getMillis() >= nextCreditsFrameStart) {
+ // the first two frames stay on for 5 seconds
+ // the rest of the scroll updates happen at 30Hz
+ if (_vm->_gfx->getCurCreditsImage() < 304)
+ nextCreditsFrameStart = _vm->_system->getMillis() + 5000;
+ else
+ nextCreditsFrameStart = _vm->_system->getMillis() + 1000 / 30;
+
+ _vm->_gfx->updateCredits();
+ }
+ } else if (_vm->_video->updateMovies())
+ _vm->_system->updateScreen();
Common::Event event;
while (_vm->_system->getEventManager()->pollEvent(event))
Commit: 8de370e847e967e736036ccb6620f02dd1054181
https://github.com/scummvm/scummvm/commit/8de370e847e967e736036ccb6620f02dd1054181
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-09T11:10:47-08:00
Commit Message:
MOHAWK: Correct start times for Riven credits
Changed paths:
engines/mohawk/riven_external.cpp
engines/mohawk/riven_external.h
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index dbc1bd9..03c667f 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -216,13 +216,13 @@ void RivenExternal::runDemoBoundaryDialog() {
dialog.runModal();
}
-void RivenExternal::runEndGame(uint16 video) {
+void RivenExternal::runEndGame(uint16 video, uint32 delay) {
_vm->_sound->stopAllSLST();
_vm->_video->playMovieRiven(video);
- runCredits(video);
+ runCredits(video, delay);
}
-void RivenExternal::runCredits(uint16 video) {
+void RivenExternal::runCredits(uint16 video, uint32 delay) {
// Initialize our credits state
_vm->_cursor->hideCursor();
_vm->_gfx->beginCredits();
@@ -232,7 +232,10 @@ void RivenExternal::runCredits(uint16 video) {
while (!_vm->shouldQuit() && _vm->_gfx->getCurCreditsImage() <= 320) {
if (_vm->_video->getCurFrame(videoHandle) >= (int32)_vm->_video->getFrameCount(videoHandle) - 1) {
- if (_vm->_system->getMillis() >= nextCreditsFrameStart) {
+ if (nextCreditsFrameStart == 0) {
+ // Set us up to start after delay ms
+ nextCreditsFrameStart = _vm->_system->getMillis() + delay;
+ } else if (_vm->_system->getMillis() >= nextCreditsFrameStart) {
// the first two frames stay on for 5 seconds
// the rest of the scroll updates happen at 30Hz
if (_vm->_gfx->getCurCreditsImage() < 304)
@@ -1852,11 +1855,11 @@ void RivenExternal::xorollcredittime(uint16 argc, uint16 *argv) {
uint32 *gehnState = _vm->getVar("agehn");
if (*gehnState == 0) // Gehn who?
- runEndGame(1);
+ runEndGame(1, 9500);
else if (*gehnState == 4) // You freed him? Are you kidding me?
- runEndGame(2);
+ runEndGame(2, 12000);
else // You already spoke with Gehn. What were you thinking?
- runEndGame(3);
+ runEndGame(3, 8000);
}
void RivenExternal::xbookclick(uint16 argc, uint16 *argv) {
@@ -1965,7 +1968,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) {
// Run the credits from here.
if (*_vm->getVar("agehn") == 3) {
_vm->_scriptMan->stopAllScripts();
- runCredits(argv[0]);
+ runCredits(argv[0], 5000);
return;
}
@@ -2140,7 +2143,7 @@ void RivenExternal::xrcredittime(uint16 argc, uint16 *argv) {
// For the record, when agehn == 4, Gehn will thank you for
// showing him the rebel age and then leave you to die.
// Otherwise, the rebels burn the book. Epic fail either way.
- runEndGame(1);
+ runEndGame(1, 1500);
}
void RivenExternal::xrshowinventory(uint16 argc, uint16 *argv) {
@@ -2180,30 +2183,26 @@ void RivenExternal::xtexterior300_telescopedown(uint16 argc, uint16 *argv) {
if (*_vm->getVar("pcage") == 2) {
// The best ending: Catherine is free, Gehn is trapped, Atrus comes to rescue you.
// And now we fall back to Earth... all the way...
- warning("xtexterior300_telescopedown: Good ending");
_vm->_video->activateMLST(8, _vm->getCurCard());
- runEndGame(8);
+ runEndGame(8, 5000);
} else if (*_vm->getVar("agehn") == 4) {
// The ok ending: Catherine is still trapped, Gehn is trapped, Atrus comes to rescue you.
// Nice going! Catherine and the islanders are all dead now! Just go back to your home...
- warning("xtexterior300_telescopedown: OK ending");
_vm->_video->activateMLST(9, _vm->getCurCard());
- runEndGame(9);
+ runEndGame(9, 5000);
} else if (*_vm->getVar("atrapbook") == 1) {
// The bad ending: Catherine is trapped, Gehn is free, Atrus gets shot by Gehn,
// And then you get shot by Cho. Nice going! Catherine and the islanders are dead
// and you have just set Gehn free from Riven, not to mention you're dead.
- warning("xtexterior300_telescopedown: Bad ending");
_vm->_video->activateMLST(10, _vm->getCurCard());
- runEndGame(10);
+ runEndGame(10, 5000);
} else {
// The impossible ending: You don't have Catherine's journal and yet you were somehow
// able to open the hatch on the telescope. The game provides an ending for those who
// cheat, load a saved game with the combo, or just guess the telescope combo. Atrus
// doesn't come and you just fall into the fissure.
- warning("xtexterior300_telescopedown: Wtf ending");
_vm->_video->activateMLST(11, _vm->getCurCard());
- runEndGame(11);
+ runEndGame(11, 5000);
}
} else {
// ...the telescope can't move down anymore.
diff --git a/engines/mohawk/riven_external.h b/engines/mohawk/riven_external.h
index 818bc06..90fdc66 100644
--- a/engines/mohawk/riven_external.h
+++ b/engines/mohawk/riven_external.h
@@ -61,8 +61,8 @@ private:
// Supplementary Functions
int jspitElevatorLoop();
void runDemoBoundaryDialog();
- void runEndGame(uint16 video);
- void runCredits(uint16 video);
+ void runEndGame(uint16 video, uint32 delay);
+ void runCredits(uint16 video, uint32 delay);
void runDomeCheck();
void runDomeButtonMovie();
void resetDomeSliders(uint16 soundId, uint16 startHotspot);
Commit: 0d271324db406bcdfe51ae4b8ebf30eebef32860
https://github.com/scummvm/scummvm/commit/0d271324db406bcdfe51ae4b8ebf30eebef32860
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-09T11:11:28-08:00
Commit Message:
MOHAWK: Remove outdated TODO
Changed paths:
engines/mohawk/riven_external.cpp
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index 03c667f..5424a07 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -1940,7 +1940,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) {
*_vm->getVar("agehn") = 4; // Set Gehn to the trapped state
*_vm->getVar("atrapbook") = 1; // We've got the trap book again
_vm->_sound->playSound(0); // Play the link sound again
- _vm->changeToCard(_vm->matchRMAPToCard(0x2885)); // Link out! (TODO: Shouldn't this card change?)
+ _vm->changeToCard(_vm->matchRMAPToCard(0x2885)); // Link out!
return;
}
break;
More information about the Scummvm-git-logs
mailing list