aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/sprite.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2010-06-15 10:31:18 +0000
committerEugene Sandulenko2010-06-15 10:31:18 +0000
commitffc390e64c1adc8bd863ecd0bfe72ff7ecba6832 (patch)
treed20e4de81a37f6a9b02e9934435906e2e3e31233 /engines/agi/sprite.cpp
parent7034d071b6f44fb77f3379535f146a095357c5be (diff)
downloadscummvm-rg350-ffc390e64c1adc8bd863ecd0bfe72ff7ecba6832.tar.gz
scummvm-rg350-ffc390e64c1adc8bd863ecd0bfe72ff7ecba6832.tar.bz2
scummvm-rg350-ffc390e64c1adc8bd863ecd0bfe72ff7ecba6832.zip
AGI: Fix bug #1945716.
Bug #1945716: "AGI: Fan(Kings Quest 2 1/4) - Sprite not erased". Added a workaround, since it is design flaw of our rendering system. svn-id: r49742
Diffstat (limited to 'engines/agi/sprite.cpp')
-rw-r--r--engines/agi/sprite.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index 10184fcaa4..611dd16478 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -241,6 +241,14 @@ void SpritesMgr::objsRestoreArea(Sprite *s) {
q += xSize;
pos0 += _WIDTH;
}
+
+ // WORKAROUND
+ // When set.view command is called, current code cannot detect this situation while updating
+ // Thus we force removal of the old sprite
+ if (s->v->viewReplaced) {
+ commitBlock(xPos, yPos, xPos + xSize, yPos + ySize);
+ s->v->viewReplaced = false;
+ }
}
@@ -387,29 +395,15 @@ void SpritesMgr::commitSprites(SpriteList &l) {
SpriteList::iterator iter;
for (iter = l.begin(); iter != l.end(); ++iter) {
Sprite *s = *iter;
- int x1, y1, x2, y2, w, h;
+ int x1, y1, x2, y2;
- w = MAX(s->v->celData->width, s->v->celData2->width);
- h = MAX(s->v->celData->height, s->v->celData2->height);
+ x1 = MIN((int)MIN(s->v->xPos, s->v->xPos2), MIN(s->v->xPos + s->v->celData->width, s->v->xPos2 + s->v->celData2->width));
+ x2 = MAX((int)MAX(s->v->xPos, s->v->xPos2), MAX(s->v->xPos + s->v->celData->width, s->v->xPos2 + s->v->celData2->width));
+ y1 = MIN((int)MIN(s->v->yPos, s->v->yPos2), MIN(s->v->yPos - s->v->celData->height, s->v->yPos2 - s->v->celData2->height));
+ y2 = MAX((int)MAX(s->v->yPos, s->v->yPos2), MAX(s->v->yPos - s->v->celData->height, s->v->yPos2 - s->v->celData2->height));
s->v->celData2 = s->v->celData;
- if (s->v->xPos < s->v->xPos2) {
- x1 = s->v->xPos;
- x2 = s->v->xPos2 + w - 1;
- } else {
- x1 = s->v->xPos2;
- x2 = s->v->xPos + w - 1;
- }
-
- if (s->v->yPos < s->v->yPos2) {
- y1 = s->v->yPos - h + 1;
- y2 = s->v->yPos2;
- } else {
- y1 = s->v->yPos2 - h + 1;
- y2 = s->v->yPos;
- }
-
commitBlock(x1, y1, x2, y2);
if (s->v->stepTimeCount != s->v->stepTime)