aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2007-05-05 23:54:29 +0000
committerFilippos Karapetis2007-05-05 23:54:29 +0000
commit0ab860d60dbbc4658e2030f9a3642d4b915046b6 (patch)
tree1769cf09ee7f7799bc7941aab4bd13514d0a911d
parentb82c68542cd8dc6ae7555ef9e3850389ba525a90 (diff)
downloadscummvm-rg350-0ab860d60dbbc4658e2030f9a3642d4b915046b6.tar.gz
scummvm-rg350-0ab860d60dbbc4658e2030f9a3642d4b915046b6.tar.bz2
scummvm-rg350-0ab860d60dbbc4658e2030f9a3642d4b915046b6.zip
Fixed bug #1658643: AGI: SQ1 (2.2 DOS ENG) Graphic error, ego leaves behind copy
Also, removed one of the two workarounds for the KQ4 intro, as it's not needed svn-id: r26754
-rw-r--r--engines/agi/view.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp
index 655e76ea85..d87d115cbd 100644
--- a/engines/agi/view.cpp
+++ b/engines/agi/view.cpp
@@ -50,7 +50,6 @@ void AgiEngine::lSetCel(VtEntry *v, int n) {
// in the KQ4 introduction
// It seems there's either a bug with KQ4's logic script 120 (the intro script)
// or flag 64 is not set correctly, which causes the erroneous behavior from the actors
- // Check below in lSetLoop for the second part of this workaround
if (getFeatures() & GF_KQ4 && !(v->flags & UPDATE) && (v->currentView == 172))
return;
@@ -77,12 +76,6 @@ void AgiEngine::lSetLoop(VtEntry *v, int n) {
if (v->currentCel >= v->numCels)
v->currentCel = 0;
- // WORKAROUND: This is the second part of the hack to fix the KQ4 introduction.
- // Refer above to function lSetCel for the first part and an explanation
- // FIXME: Remove this workaround
- if (getFeatures() & GF_KQ4 && !(v->flags & UPDATE) && (v->currentView == 172))
- return;
-
v->loopData = &_game.views[v->currentView].loop[n];
}
@@ -282,6 +275,30 @@ void AgiEngine::setLoop(VtEntry *v, int n) {
* @param n number of AGI view resource
*/
void AgiEngine::setView(VtEntry *v, int n) {
+
+ uint16 viewFlags = 0;
+
+ // 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
+ if (v->viewData != NULL) {
+ if (v->currentView != n && 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;