diff options
author | David Corrales | 2007-06-23 18:51:33 +0000 |
---|---|---|
committer | David Corrales | 2007-06-23 18:51:33 +0000 |
commit | cacd7a28fd51d960947de88abbf30c487e66529d (patch) | |
tree | f3baa59853bfb307e452b86b9d93c4737b1fa6ab /engines/agi/picture.cpp | |
parent | 0ac96302fe9c04df79cb01a77d19535b45fe2db0 (diff) | |
parent | 90c2210dae8c91fa8babc6b05564e15c9d445d18 (diff) | |
download | scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.gz scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.bz2 scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.zip |
Merged the FSNode branch with trunk r27031:27680
svn-id: r27681
Diffstat (limited to 'engines/agi/picture.cpp')
-rw-r--r-- | engines/agi/picture.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp index 9a16d4ab20..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; @@ -619,8 +619,9 @@ uint8 *PictureMgr::convertV3Pic(uint8 *src, uint32 len) { * drawing. * @param n AGI picture resource number * @param clear clear AGI screen before drawing + * @param agi256 load an AGI256 picture resource */ -int PictureMgr::decodePicture(int n, int clear) { +int PictureMgr::decodePicture(int n, int clear, bool agi256) { debugC(8, kDebugLevelResources, "(%d)", n); patCode = 0; @@ -633,10 +634,21 @@ int PictureMgr::decodePicture(int n, int clear) { flen = _vm->_game.dirPic[n].len; foffs = 0; - if (clear) - memset(_vm->_game.sbuf, 0x4f, _WIDTH * _HEIGHT); + if (clear && !agi256) // 256 color pictures should always fill the whole screen, so no clearing for them. + memset(_vm->_game.sbuf16c, 0x4f, _WIDTH * _HEIGHT); // Clear 16 color AGI screen (Priority 4, color white). - drawPicture(); + if (!agi256) { + drawPicture(); // Draw 16 color picture. + } else { + const uint32 maxFlen = _WIDTH * _HEIGHT; + memcpy(_vm->_game.sbuf256c, data, MIN(flen, maxFlen)); // Draw 256 color picture. + + if (flen < maxFlen) { + warning("Undersized AGI256 picture resource %d, using it anyway. Filling rest with white.", n); + memset(_vm->_game.sbuf256c + flen, 0x0f, maxFlen - flen); // Fill missing area with white. + } else if (flen > maxFlen) + warning("Oversized AGI256 picture resource %d, decoding only %ux%u part of it", n, _WIDTH, _HEIGHT); + } if (clear) _vm->clearImageStack(); |