aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2008-12-12 14:23:02 +0000
committerFilippos Karapetis2008-12-12 14:23:02 +0000
commitcfa939d1510d0630a81cec41fc94a61b9908693e (patch)
tree6ecc219bb5c951820f78d6724a52749b7c23571a
parent2efe7bede0d5c659abd8e48b5de011d8c5266fc8 (diff)
downloadscummvm-rg350-cfa939d1510d0630a81cec41fc94a61b9908693e.tar.gz
scummvm-rg350-cfa939d1510d0630a81cec41fc94a61b9908693e.tar.bz2
scummvm-rg350-cfa939d1510d0630a81cec41fc94a61b9908693e.zip
- Stop passing the scene clip rectangle around for no reason
- More changes for dirty rectangle handling - Stop adding dirty rectangles that cover the whole screen for no reason - Dirty rectangle handling is still very buggy, so it's still disabled svn-id: r35314
-rw-r--r--engines/saga/actor.cpp2
-rw-r--r--engines/saga/animation.cpp2
-rw-r--r--engines/saga/events.cpp8
-rw-r--r--engines/saga/gfx.cpp6
-rw-r--r--engines/saga/gfx.h3
-rw-r--r--engines/saga/interface.cpp29
-rw-r--r--engines/saga/isomap.cpp3
-rw-r--r--engines/saga/puzzle.cpp4
-rw-r--r--engines/saga/render.cpp24
-rw-r--r--engines/saga/scene.cpp5
-rw-r--r--engines/saga/sfuncs.cpp1
-rw-r--r--engines/saga/sprite.cpp28
-rw-r--r--engines/saga/sprite.h8
13 files changed, 77 insertions, 46 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp
index 0365412aae..067511d3be 100644
--- a/engines/saga/actor.cpp
+++ b/engines/saga/actor.cpp
@@ -1059,7 +1059,7 @@ void Actor::drawActors() {
if (_vm->_scene->getFlags() & kSceneFlagISO) {
_vm->_isoMap->drawSprite(*spriteList, frameNumber, drawObject->_location, drawObject->_screenPosition, drawObject->_screenScale);
} else {
- _vm->_sprite->drawOccluded(_vm->_scene->getSceneClip(),*spriteList, frameNumber, drawObject->_screenPosition, drawObject->_screenScale, drawObject->_screenDepth);
+ _vm->_sprite->drawOccluded(*spriteList, frameNumber, drawObject->_screenPosition, drawObject->_screenScale, drawObject->_screenDepth);
}
}
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp
index e28d43fdcd..90d3837ce1 100644
--- a/engines/saga/animation.cpp
+++ b/engines/saga/animation.cpp
@@ -350,6 +350,7 @@ void Anim::showCutawayBg(int bg) {
memcpy(pal, palPointer, sizeof(pal));
const Rect rect(width, height);
_vm->_render->getBackGroundSurface()->blit(rect, buf);
+ _vm->_render->setFullRefresh(true);
_vm->_frameCount++;
if (_cutAwayFade) {
@@ -540,6 +541,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) {
// FIXME: if start > 0, then this works incorrectly
decodeFrame(anim, anim->frameOffsets[frame], displayBuffer, _vm->getDisplayWidth() * _vm->getDisplayHeight());
+ _vm->_render->addDirtyRect(Common::Rect(0, 0, _vm->getDisplayWidth(), _vm->getDisplayHeight()));
_vm->_frameCount++;
anim->currentFrame++;
if (anim->completed != 65535) {
diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp
index 0f99790b47..a95a73c293 100644
--- a/engines/saga/events.cpp
+++ b/engines/saga/events.cpp
@@ -170,6 +170,7 @@ int Events::handleContinuous(Event *event) {
rect.right = bgInfo.bounds.width();
rect.bottom = bgInfo.bounds.height();
_vm->_render->getBackGroundSurface()->transitionDissolve(bgInfo.buffer, rect, 0, event_pc);
+ _vm->_render->setFullRefresh(true);
break;
case kEventDissolveBGMask:
// we dissolve it centered.
@@ -185,6 +186,7 @@ int Events::handleContinuous(Event *event) {
rect.setHeight(h);
_vm->_render->getBackGroundSurface()->transitionDissolve( maskBuffer, rect, 1, event_pc);
+ _vm->_render->setFullRefresh(true);
break;
default:
break;
@@ -351,8 +353,6 @@ int Events::handleOneShot(Event *event) {
}
}
_vm->_render->clearFlag(RF_DISABLE_ACTORS);
-
- _vm->_render->setFullRefresh(true);
}
break;
case kPsychicProfileBgEvent:
@@ -376,6 +376,7 @@ int Events::handleOneShot(Event *event) {
const Rect profileRect(width, height);
_vm->_render->getBackGroundSurface()->blit(profileRect, buf);
+ _vm->_render->addDirtyRect(profileRect);
_vm->_frameCount++;
_vm->_gfx->setPalette(palette);
@@ -390,14 +391,12 @@ int Events::handleOneShot(Event *event) {
case kAnimEvent:
switch (event->op) {
case kEventPlay:
- _vm->_render->setFullRefresh(true);
_vm->_anim->play(event->param, event->time, true);
break;
case kEventStop:
_vm->_anim->stop(event->param);
break;
case kEventFrame:
- _vm->_render->setFullRefresh(true);
_vm->_anim->play(event->param, event->time, false);
break;
case kEventSetFlag:
@@ -420,6 +419,7 @@ int Events::handleOneShot(Event *event) {
BGInfo bgInfo;
_vm->_scene->getBGInfo(bgInfo);
_vm->_render->getBackGroundSurface()->blit(bgInfo.bounds, bgInfo.buffer);
+ _vm->_render->addDirtyRect(bgInfo.bounds);
_vm->_scene->draw();
}
break;
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp
index 30b36e08ef..621351915f 100644
--- a/engines/saga/gfx.cpp
+++ b/engines/saga/gfx.cpp
@@ -586,4 +586,10 @@ void Gfx::drawRegion(const Common::Rect &destRect, const byte *sourceBuffer) {
_vm->_render->addDirtyRect(destRect);
}
+// This method does not add a dirty rectangle automatically
+void Gfx::drawBgRegion(const Common::Rect &destRect, const byte *sourceBuffer) {
+ _backBuffer.blit(destRect, sourceBuffer);
+}
+
+
} // End of namespace Saga
diff --git a/engines/saga/gfx.h b/engines/saga/gfx.h
index 6cd5d2469b..f3ccad469f 100644
--- a/engines/saga/gfx.h
+++ b/engines/saga/gfx.h
@@ -166,6 +166,9 @@ public:
// This method adds a dirty rectangle automatically
void drawRegion(const Common::Rect &destRect, const byte *sourceBuffer);
+ // This method does not add a dirty rectangle automatically
+ void drawBgRegion(const Common::Rect &destRect, const byte *sourceBuffer);
+
// Used for testing
void drawPalette() {
_backBuffer.drawPalette();
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index dcf8705513..43c4115cb0 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -503,6 +503,7 @@ void Interface::setMode(int mode) {
}
draw();
+ _vm->_render->setFullRefresh(true);
}
bool Interface::processAscii(Common::KeyState keystate) {
@@ -782,7 +783,7 @@ void Interface::drawVerbPanel(PanelButton* panelButton) {
point.x = _mainPanel.x + panelButton->xOffset;
point.y = _mainPanel.y + panelButton->yOffset;
- _vm->_sprite->draw(_vm->getDisplayClip(), _mainPanel.sprites, spriteNumber, point, 256);
+ _vm->_sprite->draw(_mainPanel.sprites, spriteNumber, point, 256);
drawVerbPanelText(panelButton, textColor, kKnownColorVerbTextShadow);
}
@@ -818,7 +819,7 @@ void Interface::draw() {
(_panelMode == kPanelNull && _vm->getGameId() == GID_IHNM_DEMO)) {
leftPortraitPoint.x = _mainPanel.x + _vm->getDisplayInfo().leftPortraitXOffset;
leftPortraitPoint.y = _mainPanel.y + _vm->getDisplayInfo().leftPortraitYOffset;
- _vm->_sprite->draw(_vm->getDisplayClip(), _defPortraits, _leftPortrait, leftPortraitPoint, 256);
+ _vm->_sprite->draw(_defPortraits, _leftPortrait, leftPortraitPoint, 256);
}
if (!_inMainMode && _vm->getDisplayInfo().rightPortraitXOffset >= 0) { //FIXME: should we change !_inMainMode to _panelMode == kPanelConverse ?
@@ -833,7 +834,7 @@ void Interface::draw() {
if (_rightPortrait >= _scenePortraits.spriteCount)
_rightPortrait = 0;
- _vm->_sprite->draw(_vm->getDisplayClip(), _scenePortraits, _rightPortrait, rightPortraitPoint, 256);
+ _vm->_sprite->draw(_scenePortraits, _rightPortrait, rightPortraitPoint, 256);
}
drawInventory();
@@ -973,7 +974,7 @@ void Interface::drawOption() {
panelButton = &_optionPanel.buttons[0];
sliderPoint.x = _optionPanel.x + panelButton->xOffset;
sliderPoint.y = _optionSaveRectSlider.top;
- _vm->_sprite->draw(_vm->getDisplayClip(), _optionPanel.sprites, 0 + _optionSaveFileSlider->state, sliderPoint, 256);
+ _vm->_sprite->draw(_optionPanel.sprites, 0 + _optionSaveFileSlider->state, sliderPoint, 256);
}
@@ -1903,7 +1904,7 @@ void Interface::drawStatusBar() {
rect.right = rect.left + _vm->getDisplayInfo().saveReminderWidth;
rect.bottom = rect.top + _vm->getDisplayInfo().saveReminderHeight;
- _vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_saveReminderSprites,
+ _vm->_sprite->draw(_vm->_sprite->_saveReminderSprites,
_vm->getDisplayInfo().saveReminderFirstSpriteNumber + _saveReminderState - 1,
rect, 256);
@@ -2117,7 +2118,7 @@ void Interface::drawInventory() {
if (ci < _inventoryCount) {
obj = _vm->_actor->getObj(_inventory[ci]);
- _vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_inventorySprites, obj->_spriteListResourceId, rect, 256);
+ _vm->_sprite->draw(_vm->_sprite->_inventorySprites, obj->_spriteListResourceId, rect, 256);
}
ci++;
@@ -2316,23 +2317,23 @@ void Interface::drawPanelButtonText(InterfacePanel *panel, PanelButton *panelBut
if (panel == &_optionPanel) {
texturePoint.x = _optionPanel.x + panelButton->xOffset - 1;
texturePoint.y = _optionPanel.y + panelButton->yOffset - 1;
- _vm->_sprite->draw(_vm->getDisplayClip(), _optionPanel.sprites, spritenum + 2 + litButton, texturePoint, 256);
+ _vm->_sprite->draw(_optionPanel.sprites, spritenum + 2 + litButton, texturePoint, 256);
} else if (panel == &_quitPanel) {
texturePoint.x = _quitPanel.x + panelButton->xOffset - 3;
texturePoint.y = _quitPanel.y + panelButton->yOffset - 3;
- _vm->_sprite->draw(_vm->getDisplayClip(), _quitPanel.sprites, litButton, texturePoint, 256);
+ _vm->_sprite->draw(_quitPanel.sprites, litButton, texturePoint, 256);
} else if (panel == &_savePanel) {
texturePoint.x = _savePanel.x + panelButton->xOffset - 3;
texturePoint.y = _savePanel.y + panelButton->yOffset - 3;
- _vm->_sprite->draw(_vm->getDisplayClip(), _savePanel.sprites, litButton, texturePoint, 256);
+ _vm->_sprite->draw(_savePanel.sprites, litButton, texturePoint, 256);
// Input text box sprite
texturePoint.x = _savePanel.x + _saveEdit->xOffset - 2;
texturePoint.y = _savePanel.y + _saveEdit->yOffset - 2;
- _vm->_sprite->draw(_vm->getDisplayClip(), _savePanel.sprites, 2, texturePoint, 256);
+ _vm->_sprite->draw(_savePanel.sprites, 2, texturePoint, 256);
} else if (panel == &_loadPanel) {
texturePoint.x = _loadPanel.x + panelButton->xOffset - 3;
texturePoint.y = _loadPanel.y + panelButton->yOffset - 3;
- _vm->_sprite->draw(_vm->getDisplayClip(), _loadPanel.sprites, litButton, texturePoint, 256);
+ _vm->_sprite->draw(_loadPanel.sprites, litButton, texturePoint, 256);
} else {
// revert to default behavior
drawButtonBox(rect, kButton, panelButton->state > 0);
@@ -2361,9 +2362,9 @@ void Interface::drawPanelButtonArrow(InterfacePanel *panel, PanelButton *panelBu
point.y = panel->y + panelButton->yOffset;
if (_vm->getGameType() == GType_ITE)
- _vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_mainSprites, spriteNumber, point, 256);
+ _vm->_sprite->draw(_vm->_sprite->_mainSprites, spriteNumber, point, 256);
else
- _vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_arrowSprites, spriteNumber, point, 256);
+ _vm->_sprite->draw(_vm->_sprite->_arrowSprites, spriteNumber, point, 256);
}
void Interface::drawVerbPanelText(PanelButton *panelButton, KnownColor textKnownColor, KnownColor textShadowKnownColor) {
@@ -2789,7 +2790,7 @@ void Interface::mapPanelDrawCrossHair() {
Rect screen(_vm->getDisplayWidth(), _vm->_scene->getHeight());
if (screen.contains(mapPosition)) {
- _vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_mainSprites,
+ _vm->_sprite->draw(_vm->_sprite->_mainSprites,
_mapPanelCrossHairState? RID_ITE_SPR_CROSSHAIR : RID_ITE_SPR_CROSSHAIR + 1,
mapPosition, 256);
}
diff --git a/engines/saga/isomap.cpp b/engines/saga/isomap.cpp
index 45202cc0ed..4619b52b7d 100644
--- a/engines/saga/isomap.cpp
+++ b/engines/saga/isomap.cpp
@@ -395,7 +395,6 @@ void IsoMap::drawSprite(SpriteList &spriteList, int spriteNumber, const Location
int yAlign;
const byte *spriteBuffer;
Point spritePointer;
- Rect clip(_vm->_scene->getSceneClip());
_vm->_sprite->getScaledSpriteBuffer(spriteList, spriteNumber, scale, width, height, xAlign, yAlign, spriteBuffer);
@@ -407,7 +406,7 @@ void IsoMap::drawSprite(SpriteList &spriteList, int spriteNumber, const Location
_tileClip.top = CLIP<int>(spritePointer.y, 0, _vm->_scene->getHeight());
_tileClip.bottom = CLIP<int>(spritePointer.y + height, 0, _vm->_scene->getHeight());
- _vm->_sprite->drawClip(clip, spritePointer, width, height, spriteBuffer);
+ _vm->_sprite->drawClip(spritePointer, width, height, spriteBuffer);
drawTiles(&location);
}
diff --git a/engines/saga/puzzle.cpp b/engines/saga/puzzle.cpp
index ccc395f322..b149112128 100644
--- a/engines/saga/puzzle.cpp
+++ b/engines/saga/puzzle.cpp
@@ -195,7 +195,7 @@ void Puzzle::showPieces(void) {
int num = _piecePriority[j];
if (_puzzlePiece != num) {
- _vm->_sprite->draw(_vm->getDisplayClip(), *spriteList, num, Point(_pieceInfo[num].curX, _pieceInfo[num].curY), 256);
+ _vm->_sprite->draw(*spriteList, num, Point(_pieceInfo[num].curX, _pieceInfo[num].curY), 256);
}
}
}
@@ -206,7 +206,7 @@ void Puzzle::drawCurrentPiece() {
SpriteList *spriteList;
_vm->_actor->getSpriteParams(puzzle, frameNumber, spriteList);
- _vm->_sprite->draw(_vm->_scene->getSceneClip(), *spriteList, _puzzlePiece,
+ _vm->_sprite->draw(*spriteList, _puzzlePiece,
Point(_pieceInfo[_puzzlePiece].curX, _pieceInfo[_puzzlePiece].curY), 256);
}
diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp
index 57cb1ca325..43dd83957f 100644
--- a/engines/saga/render.cpp
+++ b/engines/saga/render.cpp
@@ -83,9 +83,7 @@ void Render::drawScene() {
assert(_initialized);
// TODO: Remove this to use dirty rectangles
- // 2 known glitches exist:
- // - When a placard is up, the text is not shown correctly
- // - Sprite::drawClip() can draw sprites incorrectly in isometric scenes in ITE
+ // Still quite buggy
_fullRefresh = true;
#ifdef SAGA_DEBUG
@@ -95,7 +93,10 @@ void Render::drawScene() {
// Get mouse coordinates
mousePoint = _vm->mousePos();
- restoreChangedRects();
+ if (!_fullRefresh)
+ restoreChangedRects();
+ else
+ _dirtyRects.clear();
if (!(_flags & (RF_DEMO_SUBST | RF_MAP) || curMode == kPanelPlacard)) {
if (_vm->_interface->getFadeMode() != kFadeOut) {
@@ -126,8 +127,9 @@ void Render::drawScene() {
_vm->_actor->drawPathTest();
}
#endif
-
}
+ } else {
+ _fullRefresh = true;
}
if (_flags & RF_MAP)
@@ -207,6 +209,9 @@ void Render::drawScene() {
}
void Render::addDirtyRect(Common::Rect rect) {
+ if (_fullRefresh)
+ return;
+
// Clip rectangle
int x1 = MAX<int>(rect.left, 0);
int y1 = MAX<int>(rect.top, 0);
@@ -234,8 +239,8 @@ void Render::restoreChangedRects() {
Common::List<Common::Rect>::const_iterator it;
for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
//_backGroundSurface.frameRect(*it, 1); // DEBUG
- if (it->bottom <= _vm->_scene->getHeight())
- g_system->copyRectToScreen((byte *)_backGroundSurface.pixels, _backGroundSurface.w, it->left, it->top, it->width(), it->height());
+ if (_vm->_interface->getFadeMode() != kFadeOut)
+ g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _backGroundSurface.w, it->left, it->top, it->width(), it->height());
}
}
_dirtyRects.clear();
@@ -246,12 +251,15 @@ void Render::drawDirtyRects() {
Common::List<Common::Rect>::const_iterator it;
for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
//_backGroundSurface.frameRect(*it, 2); // DEBUG
- g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _backGroundSurface.w, it->left, it->top, it->width(), it->height());
+ if (_vm->_interface->getFadeMode() != kFadeOut)
+ g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _backGroundSurface.w, it->left, it->top, it->width(), it->height());
}
} else {
_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _vm->_gfx->getBackBufferWidth(), 0, 0,
_vm->_gfx->getBackBufferWidth(), _vm->_gfx->getBackBufferHeight());
}
+
+ _dirtyRects.clear();
}
#ifdef SAGA_DEBUG
diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp
index c2c3a7d350..c4d04c65e2 100644
--- a/engines/saga/scene.cpp
+++ b/engines/saga/scene.cpp
@@ -1153,7 +1153,10 @@ void Scene::draw() {
Rect rect;
_vm->_render->getBackGroundSurface()->getRect(rect);
rect.bottom = (_sceneClip.bottom < rect.bottom) ? getHeight() : rect.bottom;
- _vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels);
+ if (_vm->_render->isFullRefresh())
+ _vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels);
+ else
+ _vm->_gfx->drawBgRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels);
}
}
diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp
index 54cded5d25..39e3ee022d 100644
--- a/engines/saga/sfuncs.cpp
+++ b/engines/saga/sfuncs.cpp
@@ -1453,6 +1453,7 @@ void Script::sfEraseDelta(SCRIPTFUNC_PARAMS) {
BGInfo backGroundInfo;
_vm->_scene->getBGInfo(backGroundInfo);
_vm->_render->getBackGroundSurface()->blit(backGroundInfo.bounds, backGroundInfo.buffer);
+ _vm->_render->addDirtyRect(backGroundInfo.bounds);
}
// Script function #63 (0x3F)
diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp
index 7c5f13ef27..1808545c67 100644
--- a/engines/saga/sprite.cpp
+++ b/engines/saga/sprite.cpp
@@ -212,9 +212,10 @@ void Sprite::getScaledSpriteBuffer(SpriteList &spriteList, int spriteNumber, int
}
}
-void Sprite::drawClip(const Rect &clipRect, const Point &spritePointer, int width, int height, const byte *spriteBuffer) {
+void Sprite::drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer) {
int clipWidth;
int clipHeight;
+ Common::Rect clipRect(_vm->getDisplayClip());
int i, j, jo, io;
byte *bufRowPointer;
@@ -253,10 +254,16 @@ void Sprite::drawClip(const Rect &clipRect, const Point &spritePointer, int widt
srcRowPointer += width;
}
- _vm->_render->addDirtyRect(clipRect);
+ int x1 = MAX<int>(spritePointer.x, 0);
+ int y1 = MAX<int>(spritePointer.y, 0);
+ int x2 = MIN<int>(MAX<int>(spritePointer.x + clipWidth, 0), clipRect.right);
+ int y2 = MIN<int>(MAX<int>(spritePointer.y + clipHeight, 0), clipRect.bottom);
+
+ if (x2 > x1 && y2 > y1)
+ _vm->_render->addDirtyRect(Common::Rect(x1, y1, x2, y2));
}
-void Sprite::draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale) {
+void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale) {
const byte *spriteBuffer = NULL;
int width = 0;
int height = 0;
@@ -269,10 +276,10 @@ void Sprite::draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumb
spritePointer.x = screenCoord.x + xAlign;
spritePointer.y = screenCoord.y + yAlign;
- drawClip(clipRect, spritePointer, width, height, spriteBuffer);
+ drawClip(spritePointer, width, height, spriteBuffer);
}
-void Sprite::draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale) {
+void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale) {
const byte *spriteBuffer = NULL;
int width = 0;
int height = 0;
@@ -293,7 +300,7 @@ void Sprite::draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumb
}
spritePointer.x = screenRect.left + xAlign + spw;
spritePointer.y = screenRect.top + yAlign + sph;
- drawClip(clipRect, spritePointer, width, height, spriteBuffer);
+ drawClip(spritePointer, width, height, spriteBuffer);
}
bool Sprite::hitTest(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, const Point &testPoint) {
@@ -323,7 +330,7 @@ bool Sprite::hitTest(SpriteList &spriteList, int spriteNumber, const Point &scre
return *srcRowPointer != 0;
}
-void Sprite::drawOccluded(const Rect &clipRect, SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth) {
+void Sprite::drawOccluded(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth) {
const byte *spriteBuffer = NULL;
int x, y;
byte *destRowPointer;
@@ -347,7 +354,7 @@ void Sprite::drawOccluded(const Rect &clipRect, SpriteList &spriteList, int spri
int maskZ;
if (!_vm->_scene->isBGMaskPresent()) {
- draw(clipRect, spriteList, spriteNumber, screenCoord, scale);
+ draw(spriteList, spriteNumber, screenCoord, scale);
return;
}
@@ -363,7 +370,7 @@ void Sprite::drawOccluded(const Rect &clipRect, SpriteList &spriteList, int spri
clipData.sourceRect.right = width;
clipData.sourceRect.bottom = height;
- clipData.destRect = clipRect;
+ clipData.destRect = _vm->getDisplayClip();
if (!clipData.calcClip()) {
return;
@@ -395,7 +402,8 @@ void Sprite::drawOccluded(const Rect &clipRect, SpriteList &spriteList, int spri
sourceRowPointer += width;
}
- _vm->_render->addDirtyRect(clipRect);
+ _vm->_render->addDirtyRect(Common::Rect(clipData.drawSource.x, clipData.drawSource.y,
+ clipData.drawSource.x + width, clipData.drawSource.y + height));
}
void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t outLength) {
diff --git a/engines/saga/sprite.h b/engines/saga/sprite.h
index 0c31044be2..2f267f6cba 100644
--- a/engines/saga/sprite.h
+++ b/engines/saga/sprite.h
@@ -74,15 +74,15 @@ public:
~Sprite(void);
// draw scaled sprite using background scene mask
- void drawOccluded(const Rect &clipRect, SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth);
+ void drawOccluded(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth);
// draw scaled sprite using background scene mask
- void draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale);
+ void draw(SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale);
// main function
- void drawClip(const Rect &clipRect, const Point &spritePointer, int width, int height, const byte *spriteBuffer);
+ void drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer);
- void draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale);
+ void draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale);
void loadList(int resourceId, SpriteList &spriteList); // load or append spriteList
bool hitTest(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, const Point &testPoint);