From 4b4b8a281b67bf5e739e376ec0a34d2bedbba4d7 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Mon, 12 Dec 2016 15:13:36 -0600 Subject: SCI32: Adjust transition timings Transition timings were originally chosen largely by feel in SQ6, as there was little other evidence to determine the correct speed. As additional games started being playable in ScummVM, it became apparent that these speeds were not quite right. Additional adjustments may be needed in the future, but these new timings seem to be somewhat closer to expectations than before. --- engines/sci/engine/script_patches.cpp | 2 +- engines/sci/graphics/transitions32.cpp | 20 +++++--------------- engines/sci/graphics/transitions32.h | 19 ++++++++++++++----- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index dbc351d8f2..dcefa219f7 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -4601,7 +4601,7 @@ static const uint16 sq6SlowTransitionSignature1[] = { }; static const uint16 sq6SlowTransitionPatch1[] = { - 0x38, SIG_UINT16(180), // pushi 180 + 0x38, SIG_UINT16(500), // pushi 500 PATCH_END }; diff --git a/engines/sci/graphics/transitions32.cpp b/engines/sci/graphics/transitions32.cpp index bad0185179..a1ae352b6c 100644 --- a/engines/sci/graphics/transitions32.cpp +++ b/engines/sci/graphics/transitions32.cpp @@ -41,8 +41,7 @@ static int16 divisionsDefaults[2][16] = { }; GfxTransitions32::GfxTransitions32(SegManager *segMan) : - _segMan(segMan), - _throttleState(0) { + _segMan(segMan) { for (int i = 0; i < 236; i += 2) { _styleRanges[i] = 0; _styleRanges[i + 1] = -1; @@ -67,17 +66,8 @@ GfxTransitions32::~GfxTransitions32() { _scrolls.clear(); } -void GfxTransitions32::throttle() { - uint8 throttleTime; - if (_throttleState == 2) { - throttleTime = 34; - _throttleState = 0; - } else { - throttleTime = 33; - ++_throttleState; - } - - g_sci->getEngineState()->speedThrottler(throttleTime); +void GfxTransitions32::throttle(const uint32 ms) { + g_sci->getEngineState()->speedThrottler(ms); g_sci->getEngineState()->_throttleTrigger = true; } @@ -936,7 +926,7 @@ void GfxTransitions32::processScrolls() { } } - throttle(); + throttle(33); } void GfxTransitions32::kernelSetScroll(const reg_t planeId, const int16 deltaX, const int16 deltaY, const GuiResourceId pictureId, const bool animate, const bool mirrorX) { @@ -1005,7 +995,7 @@ void GfxTransitions32::kernelSetScroll(const reg_t planeId, const int16 deltaX, while (!finished && !g_engine->shouldQuit()) { finished = processScroll(*scroll); g_sci->_gfxFrameout->frameOut(true); - throttle(); + throttle(33); } } diff --git a/engines/sci/graphics/transitions32.h b/engines/sci/graphics/transitions32.h index 12e0d64ec7..0c828a20f7 100644 --- a/engines/sci/graphics/transitions32.h +++ b/engines/sci/graphics/transitions32.h @@ -239,11 +239,20 @@ private: SegManager *_segMan; /** - * Throttles transition playback to prevent transitions from being instant - * on fast computers. - */ - void throttle(); - int8 _throttleState; + * Throttles transition playback to prevent transitions from being + * instantaneous on modern computers. + * + * kSetShowStyle transitions are throttled at 10ms intervals, under the + * assumption that the default fade transition of 101 divisions was designed + * to finish in one second. Empirically, this seems to roughly match the + * speed of DOSBox, and feels reasonable. + * + * Transitions using kSetScroll (used in the LSL6hires intro) need to be + * slower, so they get throttled at 33ms instead of 10ms. This value was + * chosen by gut feel, as these scrolling transitions are instantaneous in + * DOSBox. + */ + void throttle(const uint32 ms = 10); void clearShowRects(); void addShowRect(const Common::Rect &rect); -- cgit v1.2.3