aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKari Salminen2007-06-20 23:36:59 +0000
committerKari Salminen2007-06-20 23:36:59 +0000
commitdbac0054c19fa7f7ab63f508fcf02bd05f84f599 (patch)
tree668cf818ca52748dd08de9b710e7d0a0420fe32b
parentd5822afe9ebdd22cd97650a58b4afbf763f0842e (diff)
downloadscummvm-rg350-dbac0054c19fa7f7ab63f508fcf02bd05f84f599.tar.gz
scummvm-rg350-dbac0054c19fa7f7ab63f508fcf02bd05f84f599.tar.bz2
scummvm-rg350-dbac0054c19fa7f7ab63f508fcf02bd05f84f599.zip
Make drawing & blitting always use the correct screen
(Always 16 color screen for vector stuff, 256 color screen for everything else in AGI256 mode). svn-id: r27570
-rw-r--r--engines/agi/checks.cpp2
-rw-r--r--engines/agi/picture.cpp4
-rw-r--r--engines/agi/sprite.cpp18
3 files changed, 14 insertions, 10 deletions
diff --git a/engines/agi/checks.cpp b/engines/agi/checks.cpp
index c9fafbbbbf..5d71af10cf 100644
--- a/engines/agi/checks.cpp
+++ b/engines/agi/checks.cpp
@@ -117,7 +117,7 @@ int AgiEngine::checkPriority(VtEntry *v) {
water = 1;
- p0 = &_game.sbuf[v->xPos + v->yPos * _WIDTH];
+ p0 = &_game.sbuf16c[v->xPos + v->yPos * _WIDTH];
for (i = 0; i < v->xSize; i++, p0++) {
pri = *p0 >> 4;
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp
index 7a30d9c094..cd8ef83de0 100644
--- a/engines/agi/picture.cpp
+++ b/engines/agi/picture.cpp
@@ -86,7 +86,7 @@ void PictureMgr::putVirtPixel(int x, int y) {
if (x < 0 || y < 0 || x >= _WIDTH || y >= _HEIGHT)
return;
- p = &_vm->_game.sbuf[y * _WIDTH + x];
+ p = &_vm->_game.sbuf16c[y * _WIDTH + x];
if (priOn)
*p = (priColour << 4) | (*p & 0x0f);
@@ -281,7 +281,7 @@ INLINE int PictureMgr::isOkFillHere(int x, int y) {
if (!scrOn && !priOn)
return false;
- p = _vm->_game.sbuf[y * _WIDTH + x];
+ p = _vm->_game.sbuf16c[y * _WIDTH + x];
if (!priOn && scrOn && scrColour != 15)
return (p & 0x0f) == 15;
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index 2d8bb38741..7938d05052 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -117,7 +117,11 @@ void SpritesMgr::blitPixel(uint8 *p, uint8 *end, uint8 col, int spr, int width,
/* Keep control line information visible, but put our
* priority over water (0x30) surface
*/
- *p = (pr < 0x30 ? pr : spr) | col;
+ if (_vm->getFeatures() & (GF_AGI256 | GF_AGI256_2))
+ *(p + FROM_SBUF16_TO_SBUF256_OFFSET) = col; // Write to 256 color buffer
+ else
+ *p = (pr < 0x30 ? pr : spr) | col; // Write to 16 color (+control line/priority info) buffer
+
*hidden = false;
/* Except if our priority is 15, which should never happen
@@ -151,9 +155,9 @@ int SpritesMgr::blitCel(int x, int y, int spr, ViewCel *c) {
t = c->transparency;
m = c->mirror;
spr <<= 4;
- p0 = &_vm->_game.sbuf[x + y * _WIDTH + m * (c->width - 1)];
+ p0 = &_vm->_game.sbuf16c[x + y * _WIDTH + m * (c->width - 1)];
- end = _vm->_game.sbuf + _WIDTH * _HEIGHT;
+ end = _vm->_game.sbuf16c + _WIDTH * _HEIGHT;
for (i = 0; i < c->height; i++) {
p = p0;
@@ -629,8 +633,8 @@ void SpritesMgr::addToPic(int view, int loop, int cel, int x, int y, int pri, in
// don't let box extend below y.
if (y3 > y2) y3 = y2;
- p1 = &_vm->_game.sbuf[x1 + y3 * _WIDTH];
- p2 = &_vm->_game.sbuf[x2 + y3 * _WIDTH];
+ p1 = &_vm->_game.sbuf16c[x1 + y3 * _WIDTH];
+ p2 = &_vm->_game.sbuf16c[x2 + y3 * _WIDTH];
for (y = y3; y <= y2; y++) {
if ((*p1 >> 4) >= 4)
@@ -642,8 +646,8 @@ void SpritesMgr::addToPic(int view, int loop, int cel, int x, int y, int pri, in
}
debugC(4, kDebugLevelSprites, "pri box: %d %d %d %d (%d)", x1, y3, x2, y2, mar);
- p1 = &_vm->_game.sbuf[x1 + y3 * _WIDTH];
- p2 = &_vm->_game.sbuf[x1 + y2 * _WIDTH];
+ p1 = &_vm->_game.sbuf16c[x1 + y3 * _WIDTH];
+ p2 = &_vm->_game.sbuf16c[x1 + y2 * _WIDTH];
for (x = x1; x <= x2; x++) {
if ((*p1 >> 4) >= 4)
*p1 = (mar << 4) | (*p1 & 0x0f);