diff options
author | Travis Howell | 2006-03-22 23:38:16 +0000 |
---|---|---|
committer | Travis Howell | 2006-03-22 23:38:16 +0000 |
commit | a8c0079924053cc349c53f9c0e448daf2d1a2557 (patch) | |
tree | cf105038d6543da90093a76bb11f82eaee01ec4b | |
parent | 3110c11ea1295dd8d913193f5952b7a1034cfe69 (diff) | |
download | scummvm-rg350-a8c0079924053cc349c53f9c0e448daf2d1a2557.tar.gz scummvm-rg350-a8c0079924053cc349c53f9c0e448daf2d1a2557.tar.bz2 scummvm-rg350-a8c0079924053cc349c53f9c0e448daf2d1a2557.zip |
Code for inverted rect when scaling images of FF no longer required. Minor cleanup
svn-id: r21407
-rw-r--r-- | engines/simon/simon.cpp | 6 | ||||
-rw-r--r-- | engines/simon/simon.h | 6 | ||||
-rw-r--r-- | engines/simon/vga.cpp | 43 |
3 files changed, 16 insertions, 39 deletions
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index e017bb2602..5fb3ade72c 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -1640,12 +1640,12 @@ void SimonEngine::handle_mouse_moved() { _system->showMouse(true); pollMouseXY(); - if (_mouseX >= 32768) + if (_mouseX <= 0) _mouseX = 0; if (_mouseX >= _screenWidth - 1) _mouseX = _screenWidth - 1; - if (_mouseY >= 32768) + if (_mouseY <= 0) _mouseY = 0; if (_mouseY >= _screenHeight - 1) _mouseY = _screenHeight - 1; @@ -3266,7 +3266,7 @@ void SimonEngine::pause() { void SimonEngine::video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d) { byte *src, color; - uint w, h, i; + int w, h, i; _lockWord |= 0x8000; src = getFrontBuf() + ha->y * _dxSurfacePitch + ha->x; diff --git a/engines/simon/simon.h b/engines/simon/simon.h index 879f2ebc71..c5b444f1aa 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -295,8 +295,8 @@ protected: uint _base_time; - uint _mouseX, _mouseY; - uint _mouseXOld, _mouseYOld; + int _mouseX, _mouseY; + int _mouseXOld, _mouseYOld; Item *_dummyItem1; Item *_dummyItem2; @@ -309,7 +309,7 @@ protected: uint16 _videoVar7; volatile uint16 _paletteColorCount; - uint _screenWidth, _screenHeight; + int _screenWidth, _screenHeight; byte _videoVar4; bool _videoVar5; diff --git a/engines/simon/vga.cpp b/engines/simon/vga.cpp index d846bb52ba..50a3200eb4 100644 --- a/engines/simon/vga.cpp +++ b/engines/simon/vga.cpp @@ -872,8 +872,7 @@ void SimonEngine::drawImages_Feeble(VC10_state *state) { dst_org++; } while (++w != state->draw_width); - _vgaCurSpritePriority /= 10; - if (_vgaCurSpritePriority != 900) { + if (_vgaCurSpritePriority % 10 != 9) { _scaleX = state->x; _scaleY = state->y; _scaleWidth = state->width; @@ -911,8 +910,7 @@ void SimonEngine::drawImages_Feeble(VC10_state *state) { dst_org++; } while (++w != state->draw_width); - _vgaCurSpritePriority /= 10; - if (_vgaCurSpritePriority == 900) { + if (_vgaCurSpritePriority % 10 == 9) { scaleClip(_scaleHeight, _scaleWidth, _scaleY, _scaleX, _scaleY + _scrollY); } } else { @@ -1033,10 +1031,10 @@ void SimonEngine::scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY) { xscale = ((w * factor) / 2); dstRect.left = (int16)(x - xscale); - if (dstRect.left > 639) + if (dstRect.left > _screenWidth - 1) return; dstRect.top = (int16)(y - (h * factor)); - if (dstRect.top > 479) + if (dstRect.top > _screenHeight - 1) return; dstRect.right = (int16)(x + xscale); @@ -1049,49 +1047,28 @@ void SimonEngine::scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY) { _variableArray[22] = _feebleRect.bottom; _variableArray[23] = _feebleRect.right; - // Oddly enough, _feebleRect is sometimes (always?) "inverted". I do - // not know what effect, in any, this has in DirectDraw. For now, - // simply un-invert it. It does make the preliminary clipping above - // look rather strange, so it could be a bug in our code. - - int top, bottom, left, right; - - if (_feebleRect.top < _feebleRect.bottom) { - top = _feebleRect.top; - bottom = _feebleRect.bottom; - } else { - top = _feebleRect.bottom; - bottom = _feebleRect.top; - } - - if (_feebleRect.left < _feebleRect.right) { - left = _feebleRect.left; - right = _feebleRect.right; - } else { - left = _feebleRect.right; - right = _feebleRect.left; - } + debug(0, "Left %d Right %d Top %d Bottom %d", dstRect.left, dstRect.right, dstRect.top, dstRect.bottom); // Unlike normal rectangles in ScummVM, it seems that in the case of // the destination rectangle the bottom and right coordinates are // considered to be inside the rectangle. For the source rectangle, // I believe that they are not. - int scaledW = right - left + 1; - int scaledH = bottom - top + 1; + int scaledW = dstRect.width() + 1; + int scaledH = dstRect.height() + 1; byte *src = getScaleBuf(); byte *dst = getBackBuf(); - dst = dst + _dxSurfacePitch * top + left; + dst += _dxSurfacePitch * dstRect.top + dstRect.left; for (int dstY = 0; dstY < h; dstY++) { - if (top + dstY >= 0 && top + dstY < 480) { + if (dstRect.top + dstY >= 0 && dstRect.top + dstY < _screenHeight) { int srcY = (dstY * h) / scaledH; byte *srcPtr = src + _dxSurfacePitch * srcY; byte *dstPtr = dst + _dxSurfacePitch * dstY; for (int dstX = 0; dstX < w; dstX++) { - if (left + dstX >= 0 && left + dstX < 640) { + if (dstRect.left + dstX >= 0 && dstRect.left + dstX < _screenWidth) { int srcX = (dstX * w) / scaledW; if (srcPtr[srcX]) dstPtr[dstX] = srcPtr[srcX]; |