AGI: proper fix for sprite leftover-related bugs. Removed workarounds.

svn-id: r49741
This commit is contained in:
Eugene Sandulenko 2010-06-15 10:30:54 +00:00
parent 295edafdc4
commit 7034d071b6
3 changed files with 24 additions and 38 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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;