diff options
author | Travis Howell | 2006-04-08 00:12:16 +0000 |
---|---|---|
committer | Travis Howell | 2006-04-08 00:12:16 +0000 |
commit | 9a7b16e4d3eeb60ce2ed58159adb40486210ec07 (patch) | |
tree | d12a733f7935f263fdd881b1fdd424e09ddab9f9 | |
parent | 9e5950e7042d818508a3b91571d076a3bc35c258 (diff) | |
download | scummvm-rg350-9a7b16e4d3eeb60ce2ed58159adb40486210ec07.tar.gz scummvm-rg350-9a7b16e4d3eeb60ce2ed58159adb40486210ec07.tar.bz2 scummvm-rg350-9a7b16e4d3eeb60ce2ed58159adb40486210ec07.zip |
Add initial support for vertical scrolling in FF
svn-id: r21675
-rw-r--r-- | engines/simon/simon.cpp | 62 | ||||
-rw-r--r-- | engines/simon/simon.h | 3 | ||||
-rw-r--r-- | engines/simon/vga.cpp | 57 |
3 files changed, 94 insertions, 28 deletions
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index 5583c4a15a..6334db9ba8 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -2689,34 +2689,54 @@ void SimonEngine::timer_vga_sprites() { void SimonEngine::scrollEvent() { byte *dst = getFrontBuf(); const byte *src; - uint x; + uint x, y;; - if (_scrollFlag < 0) { - memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8); - } else { - memmove(dst, dst + 8, _screenWidth * _scrollHeight - 8); - } + if (_scrollXMax == 0) { + if (_scrollFlag < 0) { + memmove(dst + 8 * _screenWidth, dst, (_scrollHeight - 8) * _screenWidth); + } else { + memmove(dst, dst + 8 * _screenWidth, (_scrollHeight - 8) * _screenWidth); + } - x = _scrollX; - x -= (getGameType() == GType_FF) ? 8 : 1; + y = _scrollY - 8; - if (_scrollFlag > 0) { - dst += _screenWidth - 8; - x += (getGameType() == GType_FF) ? 648 : 41; - } + if (_scrollFlag > 0) { + dst += (_scrollHeight - 8) * _screenWidth; + y += 488; + } - if (getGameType() == GType_FF) - src = _scrollImage + x / 2; - else - src = _scrollImage + x * 4; - decodeStripA(dst, src + readUint32Wrapper(src), _scrollHeight); + src = _scrollImage + y / 2; + decodeRow(dst, src + readUint32Wrapper(src), _scrollWidth); - memcpy(_sdl_buf_attached, _sdl_buf, _screenWidth * _screenHeight); - dx_copy_from_attached_to_3(_scrollHeight); + _scrollY += _scrollFlag; + vcWriteVar(250, _scrollY); + } else { + if (_scrollFlag < 0) { + memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8); + } else { + memmove(dst, dst + 8, _screenWidth * _scrollHeight - 8); + } + + x = _scrollX; + x -= (getGameType() == GType_FF) ? 8 : 1; + + if (_scrollFlag > 0) { + dst += _screenWidth - 8; + x += (getGameType() == GType_FF) ? 648 : 41; + } - _scrollX += _scrollFlag; + if (getGameType() == GType_FF) + src = _scrollImage + x / 2; + else + src = _scrollImage + x * 4; + decodeColumn(dst, src + readUint32Wrapper(src), _scrollHeight); - vcWriteVar(251, _scrollX); + _scrollX += _scrollFlag; + vcWriteVar(251, _scrollX); + } + + memcpy(_sdl_buf_attached, _sdl_buf, _screenWidth * _screenHeight); + memcpy(_sdl_buf_3, _sdl_buf_attached, _scrollHeight * _screenWidth); _scrollFlag = 0; } diff --git a/engines/simon/simon.h b/engines/simon/simon.h index 5e73412cd8..c494bc390a 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -1101,7 +1101,8 @@ protected: void o_waitForMark(uint i); void scrollEvent(); - void decodeStripA(byte *dst, const byte *src, int height); + void decodeColumn(byte *dst, const byte *src, int height); + void decodeRow(byte *dst, const byte *src, int width); void scroll_timeout(); void hitarea_stuff_helper_2(); void fastFadeIn(); diff --git a/engines/simon/vga.cpp b/engines/simon/vga.cpp index 27dbd3b4d4..02a9c8ea89 100644 --- a/engines/simon/vga.cpp +++ b/engines/simon/vga.cpp @@ -608,7 +608,7 @@ static uint16 _video_windows[128] = { }; /* simon2 specific */ -void SimonEngine::decodeStripA(byte *dst, const byte *src, int height) { +void SimonEngine::decodeColumn(byte *dst, const byte *src, int height) { const uint pitch = _dxSurfacePitch; int8 reps = (int8)0x80; byte color; @@ -652,6 +652,50 @@ void SimonEngine::decodeStripA(byte *dst, const byte *src, int height) { } } +void SimonEngine::decodeRow(byte *dst, const byte *src, int width) { + const uint pitch = _dxSurfacePitch; + int8 reps = (int8)0x80; + byte color; + byte *dst_org = dst; + uint w = width, h = 8; + + for (;;) { + reps = *src++; + if (reps >= 0) { + color = *src++; + + do { + *dst++ = color; + + /* reached right edge? */ + if (--w == 0) { + /* reached bottom? */ + if (--h == 0) + return; + dst_org += pitch; + dst = dst_org; + w = width; + } + } while (--reps >= 0); + } else { + + do { + *dst++ = *src++; + + /* reached right edge? */ + if (--w == 0) { + /* reached bottom? */ + if (--h == 0) + return; + dst_org += pitch; + dst = dst_org; + w = width; + } + } while (++reps != 0); + } + } +} + void SimonEngine::vc10_draw() { byte *p2; uint width, height; @@ -1281,7 +1325,7 @@ void SimonEngine::horizontalScroll(VC10_state *state) { src = state->depack_src + _scrollX * 4; for (w = 0; w < _screenWidth; w += 8) { - decodeStripA(dst, src + readUint32Wrapper(src), state->height); + decodeColumn(dst, src + readUint32Wrapper(src), state->height); dst += 8; src += 4; } @@ -1309,8 +1353,8 @@ void SimonEngine::verticalScroll(VC10_state *state) { src = state->depack_src + _scrollY / 2; for (h = 0; h < _screenHeight; h += 8) { - //decodeRow(dst, src + READ_LE_UINT32(src), state->width); - dst += 8; + decodeRow(dst, src + READ_LE_UINT32(src), state->width); + dst += 8 * state->width; src += 4; } } @@ -1862,7 +1906,7 @@ void SimonEngine::vc48_setPathFinder() { y = vsp->y; vsp->y = y1; - checkScrollY(y, y1); + checkScrollY(y1 - y, y1); _variableArray[11] = readUint16Wrapper(p); _variableArray[13] = pos; @@ -2356,7 +2400,8 @@ void SimonEngine::vc77_setScaleYOffs() { vsp->y += getScale(vsp->y, y); _variableArray[var] = vsp->y; - checkScrollY(y, vsp->y); + if (y != 0) + checkScrollY(y, vsp->y); vsp->flags = kDFScaled; } |