aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorKari Salminen2007-06-25 14:40:40 +0000
committerKari Salminen2007-06-25 14:40:40 +0000
commita741f3c0100127d009272689f6507b57ed2ca419 (patch)
tree71551b7361637cd519938f6738088818fea7a564 /engines
parentbf4e75b678b3a81829b60b56a112aa670ac5dac4 (diff)
downloadscummvm-rg350-a741f3c0100127d009272689f6507b57ed2ca419.tar.gz
scummvm-rg350-a741f3c0100127d009272689f6507b57ed2ca419.tar.bz2
scummvm-rg350-a741f3c0100127d009272689f6507b57ed2ca419.zip
Fix priority screen showing when using AGI256 or AGI256-2.
svn-id: r27707
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/graphics.cpp9
-rw-r--r--engines/agi/picture.cpp2
-rw-r--r--engines/agi/sprite.cpp13
3 files changed, 15 insertions, 9 deletions
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 2d64a4352e..193485ebe3 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -804,9 +804,14 @@ int GfxMgr::deinitMachine() {
* @param x x coordinate of the row start (AGI coord.)
* @param y y coordinate of the row start (AGI coord.)
* @param n number of pixels in the row
- * @param p pointer to the row start in the AGI screen
+ * @param p pointer to the row start in the AGI screen (Always use sbuf16c as base, not sbuf256c)
+ * FIXME: CGA rendering doesn't work correctly with AGI256 or AGI256-2.
*/
void GfxMgr::putPixelsA(int x, int y, int n, uint8 *p) {
+ // Choose the correct screen to read from. If AGI256 or AGI256-2 is used and we're not trying to show the priority information,
+ // then choose the 256 color screen, otherwise choose the 16 color screen (Which also has the priority information).
+ p += _vm->getFeatures() & (GF_AGI256 | GF_AGI256_2) && !_vm->_debug.priority ? FROM_SBUF16_TO_SBUF256_OFFSET : 0;
+
if (_vm->_renderMode == Common::kRenderCGA) {
for (x *= 2; n--; p++, x += 2) {
register uint16 q = (cgaMap[(*p & 0xf0) >> 4] << 4) | cgaMap[*p & 0x0f];
@@ -815,7 +820,7 @@ void GfxMgr::putPixelsA(int x, int y, int n, uint8 *p) {
*(uint16 *)&_agiScreen[x + y * GFX_WIDTH] = q & 0x0f0f;
}
} else {
- const uint16 mask = _vm->getFeatures() & (GF_AGI256 | GF_AGI256_2) ? 0xffff : 0x0f0f;
+ const uint16 mask = _vm->getFeatures() & (GF_AGI256 | GF_AGI256_2) && !_vm->_debug.priority ? 0xffff : 0x0f0f;
for (x *= 2; n--; p++, x += 2) {
register uint16 q = ((uint16) * p << 8) | *p;
if (_vm->_debug.priority)
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp
index cd8ef83de0..e3fd2277d0 100644
--- a/engines/agi/picture.cpp
+++ b/engines/agi/picture.cpp
@@ -686,7 +686,7 @@ void PictureMgr::showPic() {
i = 0;
offset = _vm->_game.lineMinPrint * CHAR_LINES;
for (y = 0; y < _HEIGHT; y++) {
- _gfx->putPixelsA(0, y + offset, _WIDTH, &_vm->_game.sbuf[i]);
+ _gfx->putPixelsA(0, y + offset, _WIDTH, &_vm->_game.sbuf16c[i]);
i += _WIDTH;
}
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index 3d69968075..006e3dddee 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -215,7 +215,8 @@ void SpritesMgr::objsRestoreArea(Sprite *s) {
int y, offset;
int16 xPos = s->xPos, yPos = s->yPos;
int16 xSize = s->xSize, ySize = s->ySize;
- uint8 *p0, *q;
+ uint8 *q;
+ uint32 pos0;
if (xPos + xSize > _WIDTH)
xSize = _WIDTH - xPos;
@@ -236,14 +237,14 @@ void SpritesMgr::objsRestoreArea(Sprite *s) {
if (xSize <= 0 || ySize <= 0)
return;
- p0 = &_vm->_game.sbuf[xPos + yPos * _WIDTH];
+ pos0 = xPos + yPos * _WIDTH;
q = s->buffer;
offset = _vm->_game.lineMinPrint * CHAR_LINES;
for (y = 0; y < ySize; y++) {
- memcpy(p0, q, xSize);
- _gfx->putPixelsA(xPos, yPos + y + offset, xSize, p0);
+ memcpy(&_vm->_game.sbuf[pos0], q, xSize);
+ _gfx->putPixelsA(xPos, yPos + y + offset, xSize, &_vm->_game.sbuf16c[pos0]);
q += xSize;
- p0 += _WIDTH;
+ pos0 += _WIDTH;
}
}
@@ -728,7 +729,7 @@ void SpritesMgr::commitBlock(int x1, int y1, int x2, int y2) {
debugC(7, kDebugLevelSprites, "%d, %d, %d, %d", x1, y1, x2, y2);
w = x2 - x1 + 1;
- q = &_vm->_game.sbuf[x1 + _WIDTH * y1];
+ q = &_vm->_game.sbuf16c[x1 + _WIDTH * y1];
offset = _vm->_game.lineMinPrint * CHAR_LINES;
for (i = y1; i <= y2; i++) {
_gfx->putPixelsA(x1, i + offset, w, q);