diff options
author | lukaslw | 2014-05-27 21:19:24 +0200 |
---|---|---|
committer | lukaslw | 2014-06-22 20:08:16 +0200 |
commit | 905a95e0ce327d603e4b1778f62c8358217f2373 (patch) | |
tree | 45c31546e41e09ac4d06ff57cb4cc703acde4383 | |
parent | bc1553def6d7cc8a2cae014b35e0e963acc825b4 (diff) | |
download | scummvm-rg350-905a95e0ce327d603e4b1778f62c8358217f2373.tar.gz scummvm-rg350-905a95e0ce327d603e4b1778f62c8358217f2373.tar.bz2 scummvm-rg350-905a95e0ce327d603e4b1778f62c8358217f2373.zip |
PRINCE: showSprite fix
-rw-r--r-- | engines/prince/prince.cpp | 26 | ||||
-rw-r--r-- | engines/prince/prince.h | 4 |
2 files changed, 16 insertions, 14 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index be4fb1544e..6abc4bf6b4 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -711,15 +711,16 @@ void PrinceEngine::showSprite(Graphics::Surface *backAnimSurface, int destX, int int sprHeight = backAnimSurface->h; int sprModulo = 0; - if (destX - _picWindowX < 0) { // x1 on visible part of screen? + destX -= _picWindowX; + if (destX < 0) { // x1 on visible part of screen? // X1 signed, we add spriteWidth for x2 - if (sprWidth + destX - _picWindowX - 1 < 0) { + if (sprWidth + destX < 1) { //exit - x2 is negative - out of window return; // don't draw } else { - //esi += _picWindowX - destX; - sprWidth -= _picWindowX - destX; - sprModulo += _picWindowX - destX; + //esi += -1 * destX; + sprWidth -= -1 * destX; + sprModulo += -1 * destX; destX = 0; // x1 = 0; } } @@ -732,13 +733,14 @@ void PrinceEngine::showSprite(Graphics::Surface *backAnimSurface, int destX, int sprModulo += destX - kNormalWidth; } //right_x_check_ok - if (destY - _picWindowY < 0) { - if (sprHeight + destY - _picWindowY - 1 < 0) { + destY -= _picWindowY; + if (destY < 0) { + if (sprHeight + destY < 1) { //exit - y2 is negative - out of window return; // don't draw } else { - sprHeight -= _picWindowY - destY; - //esi += (sprWidth + sprModulo) * (_picWindowY - destY); + sprHeight -= -1 * destY; + //esi += (sprWidth + sprModulo) * (-1 * destY); destY = 0; } } @@ -751,7 +753,7 @@ void PrinceEngine::showSprite(Graphics::Surface *backAnimSurface, int destX, int } //lower_y_check_ok - _graph->drawTransparent(destX - _picWindowX, destY - _picWindowY, backAnimSurface); // TODO + _graph->drawTransparent(destX, destY, backAnimSurface); // TODO } void PrinceEngine::showBackAnims() { @@ -908,9 +910,9 @@ void PrinceEngine::showBackAnims() { int y = _backAnimList[i].backAnims[activeSubAnim]._y + _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseOffsetY(frame); //debug("x: %d", x); //debug("picWindowX: %d", _picWindowX); - if (x - _picWindowX >= 0) { // || x - _picWindowX + _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseOffsetX(frame) >= 0 ?? + //if (x >= _picWindowX) { // || x - _picWindowX + _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseOffsetX(frame) >= 0 ?? showSprite(backAnimSurface, x, y); - } + //} backAnimSurface->free(); delete backAnimSurface; diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 34e6c753eb..0ced4b6503 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -198,8 +198,8 @@ public: uint16 _cameraX; uint16 _newCameraX; uint16 _sceneWidth; - uint32 _picWindowX; - uint32 _picWindowY; + int32 _picWindowX; + int32 _picWindowY; Image::BitmapDecoder *_roomBmp; Common::Array<AnimListItem> _animList; |