aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorEugene Sandulenko2010-06-15 10:30:54 +0000
committerEugene Sandulenko2010-06-15 10:30:54 +0000
commit7034d071b6f44fb77f3379535f146a095357c5be (patch)
treebc810f51aee852827024c75628cbdabbd54bc0aa /engines/agi
parent295edafdc4b266a7283ba494e685dfb22f132c6a (diff)
downloadscummvm-rg350-7034d071b6f44fb77f3379535f146a095357c5be.tar.gz
scummvm-rg350-7034d071b6f44fb77f3379535f146a095357c5be.tar.bz2
scummvm-rg350-7034d071b6f44fb77f3379535f146a095357c5be.zip
AGI: proper fix for sprite leftover-related bugs. Removed workarounds.
svn-id: r49741
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/op_cmd.cpp23
-rw-r--r--engines/agi/sprite.cpp8
-rw-r--r--engines/agi/view.cpp31
3 files changed, 24 insertions, 38 deletions
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index f31e1d156d..fb95c1cee1 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -889,7 +889,28 @@ cmd(erase) {
}
g_sprites->blitUpdSprites();
- g_sprites->commitBlock(vt.xPos, vt.yPos - vt.ySize + 1, vt.xPos + vt.xSize - 1, vt.yPos);
+ int x1, y1, x2, y2, w, h;
+
+ w = MAX(vt.celData->width, vt.celData2->width);
+ h = MAX(vt.celData->height, vt.celData2->height);
+
+ if (vt.xPos < vt.xPos2) {
+ x1 = vt.xPos;
+ x2 = vt.xPos2 + w - 1;
+ } else {
+ x1 = vt.xPos2;
+ x2 = vt.xPos + w - 1;
+ }
+
+ if (vt.yPos < vt.yPos2) {
+ y1 = vt.yPos - h + 1;
+ y2 = vt.yPos2;
+ } else {
+ y1 = vt.yPos2 - h + 1;
+ y2 = vt.yPos;
+ }
+
+ g_sprites->commitBlock(x1, y1, x2, y2);
}
cmd(position) {
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index 70cc279420..10184fcaa4 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -389,12 +389,8 @@ void SpritesMgr::commitSprites(SpriteList &l) {
Sprite *s = *iter;
int x1, y1, x2, y2, w, h;
- w = (s->v->celData->width > s->v->celData2->width) ?
- s->v->celData->width : s->v->celData2->width;
-
- h = (s->v->celData->height >
- s->v->celData2->height) ? s->v->celData->
- height : s->v->celData2->height;
+ w = MAX(s->v->celData->width, s->v->celData2->width);
+ h = MAX(s->v->celData->height, s->v->celData2->height);
s->v->celData2 = s->v->celData;
diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp
index b506c1ecab..a775b5f78b 100644
--- a/engines/agi/view.cpp
+++ b/engines/agi/view.cpp
@@ -294,37 +294,6 @@ void AgiEngine::setLoop(VtEntry *v, int n) {
* @param n number of AGI view resource
*/
void AgiEngine::setView(VtEntry *v, int n) {
-
- uint16 viewFlags = 0;
-
- // WORKAROUND
- // When setting a view to the view table, if there's already another view set in that
- // view table entry and it's still drawn, erase the existing view before setting the new one
- // Fixes bug #1658643: AGI: SQ1 (2.2 DOS ENG) Graphic error, ego leaves behind copy
- // Update: Apparently, this makes ego dissapear at times, e.g. when textboxes are shown
- // Therefore, it's limited to view 118 in SQ1 (Roger climbing the ladder)
- // Fixes bug #1715284: Roger sometimes disappears
- // Update: Added case fot bug #2960557: AGI: (Fan) SQ0 - Sprite (Ego) not erased
- if (v->viewData != NULL) {
- if (((v->currentView == 118 && getGameID() == GID_SQ1) ||
- (v->currentView == 2 & (n == 254 || n == 255) && getGameID() == GID_SQ0)) && v->flags & DRAWN) {
- viewFlags = v->flags; // Store the flags for the view
- _sprites->eraseUpdSprites();
-
- if (v->flags & UPDATE) {
- v->flags &= ~DRAWN;
- } else {
- _sprites->eraseNonupdSprites();
- v->flags &= ~DRAWN;
- _sprites->blitNonupdSprites();
- }
- _sprites->blitUpdSprites();
-
- _sprites->commitBlock(v->xPos, v->yPos - v->ySize + 1, v->xPos + v->xSize - 1, v->yPos);
- v->flags = viewFlags; // Restore the view's flags
- }
- }
-
v->viewData = &_game.views[n];
v->currentView = n;
v->numLoops = v->viewData->numLoops;