Skip to content

Commit

Permalink
SCI32: Adjust transition timings
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
csnover committed Dec 12, 2016
1 parent 8477e61 commit 4b4b8a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion engines/sci/engine/script_patches.cpp
Expand Up @@ -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
};

Expand Down
20 changes: 5 additions & 15 deletions engines/sci/graphics/transitions32.cpp
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
}

Expand Down
19 changes: 14 additions & 5 deletions engines/sci/graphics/transitions32.h
Expand Up @@ -239,11 +239,20 @@ class GfxTransitions32 {
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);
Expand Down

0 comments on commit 4b4b8a2

Please sign in to comment.