From 2a876e11b52cdf80b697b9d4bf973ec02fb284c9 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 11 Oct 2006 12:03:47 +0000 Subject: Add support for clearWindow and cleanup svn-id: r24272 --- engines/agos/agos.cpp | 6 ++-- engines/agos/agos.h | 2 ++ engines/agos/vga.cpp | 87 ++++++++++++++++++++++++++++++--------------------- engines/agos/vga.h | 2 +- 4 files changed, 58 insertions(+), 39 deletions(-) (limited to 'engines/agos') diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 7e8b561a31..bd4f6ebebb 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -559,7 +559,7 @@ int AGOSEngine::init() { return 0; } -const static uint16 initialVideoWindows_Simon[20] = { +static const uint16 initialVideoWindows_Simon[20] = { 0, 0, 20, 200, 0, 0, 3, 136, 17, 0, 3, 136, @@ -567,7 +567,7 @@ const static uint16 initialVideoWindows_Simon[20] = { 0, 0, 20, 134 }; -const static uint16 initialVideoWindows_Common[20] = { +static const uint16 initialVideoWindows_Common[20] = { 3, 0, 14, 136, 0, 0, 3, 136, 17, 0, 3, 136, @@ -1765,6 +1765,8 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) { } } + clearWindow(_windowNum, READ_BE_UINT16(&((ImageHeader_WW *) b)->color)); + vc_ptr_org = _vcPtr; if (getGameType() == GType_FF || getGameType() == GType_PP) { diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 4f15f51c92..3eebb3af50 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -1217,6 +1217,8 @@ protected: void checkScrollY(int16 y, int16 ypos); void centreScroll(); + void clearWindow(uint windowNum, uint color); + void startOverlayAnims(); void startAnOverlayAnim(); diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index ed4a970d28..2b97663a9c 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -737,7 +737,7 @@ void vc10_skip_cols(VC10_state *vs) { byte *AGOSEngine::vc10_uncompressFlip(const byte *src, uint w, uint h) { w *= 8; - byte *src_org, *dstPtr; + byte *dst, *dstPtr, *srcPtr; byte color; int8 cur = -0x80; uint i, w_cur = w; @@ -745,7 +745,7 @@ byte *AGOSEngine::vc10_uncompressFlip(const byte *src, uint w, uint h) { dstPtr = _videoBuf1 + w; do { - byte *dst = dstPtr; + dst = dstPtr; uint h_cur = h; if (cur == -0x80) @@ -784,18 +784,17 @@ byte *AGOSEngine::vc10_uncompressFlip(const byte *src, uint w, uint h) { dstPtr++; } while (--w_cur); - - src_org = dstPtr = _videoBuf1 + w; + srcPtr = dstPtr = _videoBuf1 + w; do { - byte *dst = dstPtr; + dst = dstPtr; for (i = 0; i != w; ++i) { - byte b = src_org[i]; + byte b = srcPtr[i]; b = (b >> 4) | (b << 4); *--dst = b; } - src_org += w; + srcPtr += w; dstPtr += w; } while (--h); @@ -1252,48 +1251,43 @@ void AGOSEngine::drawImages(VC10_state *state) { if (drawImages_clip(state) == 0) return; - uint offs, offs2; + uint xoffs, yoffs; if (getGameType() == GType_ELVIRA1) { - //if (_windowNum != 2 && _windowNum != 3) { - // offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; - // offs2 = (vlut[1] - _videoWindows[17] + state->y); + //if (_windowNum != 2 && _windowNum != 3 && _windowNum != 6) { + // xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; + // yoffs = (vlut[1] - _videoWindows[17] + state->y); //} else { - offs = (vlut[0] * 2 + state->x) * 8; - offs2 = vlut[1] + state->y; + xoffs = (vlut[0] * 2 + state->x) * 8; + yoffs = vlut[1] + state->y; //} } else if (getGameType() == GType_ELVIRA2) { //if (_windowNum == 4 || _windowNum >= 10) { - // offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; - // offs2 = (vlut[1] - _videoWindows[17] + state->y); + // xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; + // yoffs = (vlut[1] - _videoWindows[17] + state->y); //} else { - offs = (vlut[0] * 2 + state->x) * 8; - offs2 = vlut[1] + state->y; + xoffs = (vlut[0] * 2 + state->x) * 8; + yoffs = vlut[1] + state->y; //} } else if (getGameType() == GType_WW) { - //if (_windowNum == 4 || (_windowNum >= 10 && _windowsNum < 28)) { - // offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; - // offs2 = (vlut[1] - _videoWindows[17] + state->y); + //if (_windowNum == 4 || (_windowNum >= 10 && _windowNum < 28)) { + // xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; + // yoffs = (vlut[1] - _videoWindows[17] + state->y); //} else { - offs = (vlut[0] * 2 + state->x) * 8; - offs2 = vlut[1] + state->y; + xoffs = (vlut[0] * 2 + state->x) * 8; + yoffs = vlut[1] + state->y; //} - } else if (getGameType() == GType_SIMON1) { + } else if (getGameType() == GType_SIMON1 && (_subroutine == 2923 || _subroutine == 2926)) { // Allow one section of Simon the Sorcerer 1 introduction to be displayed // in lower half of screen - if ((getGameType() == GType_SIMON1) && (_subroutine == 2923 || _subroutine == 2926)) { - offs = state->x * 8; - offs2 = state->y; - } else { - offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; - offs2 = (vlut[1] - _videoWindows[17] + state->y); - } + xoffs = state->x * 8; + yoffs = state->y; } else { - offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; - offs2 = (vlut[1] - _videoWindows[17] + state->y); + xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; + yoffs = (vlut[1] - _videoWindows[17] + state->y); } - state->surf2_addr += offs + offs2 * state->surf2_pitch; - state->surf_addr += offs + offs2 * state->surf_pitch; + state->surf2_addr += xoffs + yoffs * state->surf_pitch; + state->surf_addr += xoffs + yoffs * state->surf2_pitch; if (state->flags & kDFMasked) { byte *mask, *src, *dst; @@ -1988,11 +1982,32 @@ void AGOSEngine::vc34_setMouseOff() { _leftButtonDown = 0; } +void AGOSEngine::clearWindow(uint num, uint color) { + if (getGameType() == GType_ELVIRA1) { + if (num == 2 || num == 6) + return; + } else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) { + if (num != 4 && num < 10) + return; + } + + if (num == 3) { + memset(getBackBuf(), 0, _screenWidth * _screenHeight); + } else { + const uint16 *vlut = &_videoWindows[num * 4]; + byte *dst = getBackBuf() + vlut[0] * 16 + vlut[1] * _dxSurfacePitch; + + for (uint h = 0; h < vlut[3]; h++) { + memset(dst, 0, vlut[2] * 16); + dst += _screenWidth; + } + } +} + void AGOSEngine::vc35_clearWindow() { uint16 num = vcReadNextWord(); uint16 color = vcReadNextWord(); - - debug(0, "vc35_clearWindow: window %d color %d", num, color); + clearWindow(num, color); } void AGOSEngine::vc36_setWindowImage() { diff --git a/engines/agos/vga.h b/engines/agos/vga.h index e6d3741707..fb577e0601 100644 --- a/engines/agos/vga.h +++ b/engines/agos/vga.h @@ -71,7 +71,7 @@ struct AnimationHeader_Simon { // Elvira 1/2 and Waxworks struct ImageHeader_WW { uint16 id; - uint16 x_1; + uint16 color; uint16 x_2; uint16 scriptOffs; }; -- cgit v1.2.3