aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2016-02-26 07:18:44 +0100
committerBastien Bouclet2016-02-26 07:22:30 +0100
commit5aeda50f5811d185e336813d7c7904b771e453ae (patch)
tree9817936aecc6df339e5cc8a6bd176ffc317b799d
parentfaff49d001bfaa4a6cce45509b4f80fe3ea0ea6f (diff)
downloadscummvm-rg350-5aeda50f5811d185e336813d7c7904b771e453ae.tar.gz
scummvm-rg350-5aeda50f5811d185e336813d7c7904b771e453ae.tar.bz2
scummvm-rg350-5aeda50f5811d185e336813d7c7904b771e453ae.zip
MOHAWK: Fix the drawing time simulation
Was broken when adding transition support. Fixes scripted card changes not displaying for a long enough time.
-rw-r--r--engines/mohawk/myst.cpp10
-rw-r--r--engines/mohawk/myst_graphics.cpp16
2 files changed, 16 insertions, 10 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index e0e8380cba..3bc2b2dccb 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -599,10 +599,12 @@ void MohawkEngine_Myst::changeToCard(uint16 card, TransitionType transition) {
// Make sure the screen is updated
if (transition != kNoTransition) {
- if (!_gameState->_globals.transitions)
- transition = kTransitionCopy;
-
- _gfx->runTransition(transition, Common::Rect(544, 333), 10, 0);
+ if (_gameState->_globals.transitions) {
+ _gfx->runTransition(transition, Common::Rect(544, 333), 10, 0);
+ } else {
+ _gfx->copyBackBufferToScreen(Common::Rect(544, 333));
+ _needsUpdate = true;
+ }
}
// Make sure we have the right cursor showing
diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp
index 6c93f980ac..5db9697a78 100644
--- a/engines/mohawk/myst_graphics.cpp
+++ b/engines/mohawk/myst_graphics.cpp
@@ -227,9 +227,8 @@ void MystGraphics::copyBackBufferToScreen(Common::Rect r) {
void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16 steps, uint16 delay) {
- // Do not artificially delay during transitions
- int oldEnableDrawingTimeSimulation = _enableDrawingTimeSimulation;
- _enableDrawingTimeSimulation = 0;
+ // Transitions are barely visible without adding delays between the draw calls
+ enableDrawingTimeSimulation(true);
switch (type) {
case kTransitionLeftToRight: {
@@ -290,7 +289,10 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
debugC(kDebugView, "Dissolve");
for (int16 step = 0; step < 8; step++) {
- simulatePreviousDrawDelay(rect);
+ // Only one eighth of the rect pixels are updated by a draw step,
+ // delay by one eighth of the regular time
+ simulatePreviousDrawDelay(Common::Rect(rect.width() / 8, rect.height()));
+
transitionDissolve(rect, step);
}
}
@@ -369,7 +371,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
error("Unknown transition %d", type);
}
- _enableDrawingTimeSimulation = oldEnableDrawingTimeSimulation;
+ enableDrawingTimeSimulation(false);
}
void MystGraphics::transitionDissolve(Common::Rect rect, uint step) {
@@ -641,8 +643,10 @@ void MystGraphics::simulatePreviousDrawDelay(const Common::Rect &dest) {
// Do not draw anything new too quickly after the previous draw call
// so that images stay at least a little while on screen
// This is enabled only for scripted draw calls
- if (time < _nextAllowedDrawTime)
+ if (time < _nextAllowedDrawTime) {
+ debugC(kDebugView, "Delaying draw call by %d ms", _nextAllowedDrawTime - time);
_vm->_system->delayMillis(_nextAllowedDrawTime - time);
+ }
}
// Next draw call allowed at DELAY + AERA * COEFF milliseconds from now