aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorEugene Sandulenko2010-06-15 10:32:25 +0000
committerEugene Sandulenko2010-06-15 10:32:25 +0000
commit88421532aa2fc34fda1a940a4ba994f96e324574 (patch)
tree5dba6a6a16f879f27ccdeafb7f110e157df2ec23 /engines/agi
parent462d1afed8ffbc9a018d07d0c0b280af448e7b52 (diff)
downloadscummvm-rg350-88421532aa2fc34fda1a940a4ba994f96e324574.tar.gz
scummvm-rg350-88421532aa2fc34fda1a940a4ba994f96e324574.tar.bz2
scummvm-rg350-88421532aa2fc34fda1a940a4ba994f96e324574.zip
AGI: Implemented immediate update for most of gfx to match original.
This fixes many subtle effects as in many cases there were no special pausing and engine relied only on the slowliness of the machine. svn-id: r49745
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/op_cmd.cpp7
-rw-r--r--engines/agi/sprite.cpp19
-rw-r--r--engines/agi/sprite.h4
-rw-r--r--engines/agi/view.cpp2
4 files changed, 20 insertions, 12 deletions
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index bb0799d92c..ab7e5010e7 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -741,6 +741,7 @@ cmd(draw_pic) {
g_sprites->eraseBoth();
g_picture->decodePicture(_v[p0], true);
g_sprites->blitBoth();
+ g_sprites->commitBoth();
game.pictureShown = 0;
debugC(6, kDebugLevelScripts, "--- end of draw pic %d ---", _v[p0]);
@@ -778,6 +779,7 @@ cmd(load_pic) {
g_sprites->eraseBoth();
g_agi->agiLoadResource(rPICTURE, _v[p0]);
g_sprites->blitBoth();
+ g_sprites->commitBoth();
}
cmd(discard_pic) {
@@ -869,7 +871,7 @@ cmd(draw) {
g_sprites->blitUpdSprites();
vt.flags &= ~DONTUPDATE;
- g_sprites->commitBlock(vt.xPos, vt.yPos - vt.ySize + 1, vt.xPos + vt.xSize - 1, vt.yPos);
+ g_sprites->commitBlock(vt.xPos, vt.yPos - vt.ySize + 1, vt.xPos + vt.xSize - 1, vt.yPos, true);
debugC(4, kDebugLevelScripts, "vt entry #%d flags = %02x", p0, vt.flags);
}
@@ -896,7 +898,7 @@ cmd(erase) {
y1 = MIN((int)MIN(vt.yPos, vt.yPos2), MIN(vt.yPos - vt.celData->height, vt.yPos2 - vt.celData2->height));
y2 = MAX((int)MAX(vt.yPos, vt.yPos2), MAX(vt.yPos - vt.celData->height, vt.yPos2 - vt.celData2->height));
- g_sprites->commitBlock(x1, y1, x2, y2);
+ g_sprites->commitBlock(x1, y1, x2, y2, true);
}
cmd(position) {
@@ -1804,6 +1806,7 @@ int AgiEngine::runLogic(int n) {
}
} else {
_sprites->blitBoth();
+ _sprites->commitBoth();
do {
mainCycle();
} while (!_debug.steps && _debug.enabled);
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index 611dd16478..d3bd1a6212 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -391,7 +391,7 @@ void SpritesMgr::freeList(SpriteList &l) {
* Copy sprites from the pic buffer to the screen buffer, and check if
* sprites of the given list have moved.
*/
-void SpritesMgr::commitSprites(SpriteList &l) {
+void SpritesMgr::commitSprites(SpriteList &l, bool immediate) {
SpriteList::iterator iter;
for (iter = l.begin(); iter != l.end(); ++iter) {
Sprite *s = *iter;
@@ -404,7 +404,7 @@ void SpritesMgr::commitSprites(SpriteList &l) {
s->v->celData2 = s->v->celData;
- commitBlock(x1, y1, x2, y2);
+ commitBlock(x1, y1, x2, y2, immediate);
if (s->v->stepTimeCount != s->v->stepTime)
continue;
@@ -458,11 +458,11 @@ void SpritesMgr::blitSprites(SpriteList& l) {
*/
void SpritesMgr::commitUpdSprites() {
- commitSprites(_sprUpd);
+ commitSprites(_sprUpd, true);
}
void SpritesMgr::commitNonupdSprites() {
- commitSprites(_sprNonupd);
+ commitSprites(_sprNonupd, true);
}
// check moves in both lists
@@ -651,7 +651,7 @@ void SpritesMgr::addToPic(int view, int loop, int cel, int x, int y, int pri, in
blitBoth();
- commitBlock(x1, y1, x2, y2);
+ commitBlock(x1, y1, x2, y2, true);
}
/**
@@ -682,15 +682,15 @@ void SpritesMgr::showObj(int n) {
objsSaveArea(&s);
blitCel(x1, y1, 15, c, _vm->_game.views[n].agi256_2);
- commitBlock(x1, y1, x2, y2);
+ commitBlock(x1, y1, x2, y2, true);
_vm->messageBox(_vm->_game.views[n].descr);
objsRestoreArea(&s);
- commitBlock(x1, y1, x2, y2);
+ commitBlock(x1, y1, x2, y2, true);
free(s.buffer);
}
-void SpritesMgr::commitBlock(int x1, int y1, int x2, int y2) {
+void SpritesMgr::commitBlock(int x1, int y1, int x2, int y2, bool immediate) {
int i, w, offset;
uint8 *q;
@@ -714,6 +714,9 @@ void SpritesMgr::commitBlock(int x1, int y1, int x2, int y2) {
}
_gfx->flushBlockA(x1, y1 + offset, x2, y2 + offset);
+
+ if (immediate)
+ _gfx->doUpdate();
}
SpritesMgr::SpritesMgr(AgiEngine *agi, GfxMgr *gfx) {
diff --git a/engines/agi/sprite.h b/engines/agi/sprite.h
index 7d6d7bb97e..57fd0dacf2 100644
--- a/engines/agi/sprite.h
+++ b/engines/agi/sprite.h
@@ -65,7 +65,7 @@ private:
void buildUpdBlitlist();
void buildNonupdBlitlist();
void freeList(SpriteList &l);
- void commitSprites(SpriteList &l);
+ void commitSprites(SpriteList &l, bool immediate = false);
void eraseSprites(SpriteList &l);
void blitSprites(SpriteList &l);
static bool testUpdating(VtEntry *v, AgiEngine *);
@@ -88,7 +88,7 @@ public:
void commitBoth();
void addToPic(int, int, int, int, int, int, int);
void showObj(int);
- void commitBlock(int, int, int, int);
+ void commitBlock(int x1, int y1, int x2, int y2, bool immediate = false);
};
} // End of namespace Agi
diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp
index b89ab3915c..cd3584dcae 100644
--- a/engines/agi/view.cpp
+++ b/engines/agi/view.cpp
@@ -311,6 +311,7 @@ void AgiEngine::startUpdate(VtEntry *v) {
v->flags |= UPDATE;
_sprites->blitBoth();
+ _sprites->commitBoth();
}
}
@@ -324,6 +325,7 @@ void AgiEngine::stopUpdate(VtEntry *v) {
v->flags &= ~UPDATE;
_sprites->blitBoth();
+ _sprites->commitBoth();
}
}