aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-25 01:15:28 +0200
committerEugene Sandulenko2016-08-25 01:16:03 +0200
commit3f1f3c5c1ec3dd8d8507530b3a85b89464389632 (patch)
tree49e73682dbd4a3fa1861b77d420f6a879b5d0078 /engines
parente733f8113f69f37b14e8a2447f5e7dce89a1670d (diff)
downloadscummvm-rg350-3f1f3c5c1ec3dd8d8507530b3a85b89464389632.tar.gz
scummvm-rg350-3f1f3c5c1ec3dd8d8507530b3a85b89464389632.tar.bz2
scummvm-rg350-3f1f3c5c1ec3dd8d8507530b3a85b89464389632.zip
DIRECTOR: More heuristics for 1bpp image decoding. Courtesy of wjp.
Diffstat (limited to 'engines')
-rw-r--r--engines/director/frame.cpp13
-rw-r--r--engines/director/images.cpp2
2 files changed, 10 insertions, 5 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 4bae61f9aa..5313103399 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -527,7 +527,7 @@ static const int corrections[] = {
1039, 50, 50,
1041, 110, 110, // descr
1042, 120, 121, // descr 2
- 1065, 27, 27, // car
+ 1065, 27, 19, // car
1109, 104, 112, // taxi
1110, 90, 96, // taxi
1111, 74, 80, // taxi
@@ -563,7 +563,7 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
bool c = false;
for (int i = 0; corrections[i]; i += 3)
if (corrections[i] == imgId) {
- w = corrections[i + 2];
+ //w = corrections[i + 2];
c = true;
break;
}
@@ -571,11 +571,16 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
if (!c)
debugC(4, kDebugImages, "%d, %d, %d", imgId, w, h);
- if (bc->flags & 0x20) {
+ if (true || bc->flags & 0x20) {
int w1 = w + 8 - w % 8 + 8;
debugC(3, kDebugImages, "Disabling compression for %d: %d x %d", imgId, w1, h);
- img = new BITDDecoder(w1, h, false);
+ if (pic->size() * 8 == w1 * h)
+ img = new BITDDecoder(w1, h, false);
+ else if (pic->size() * 8 == (w1 + 8) * h)
+ img = new BITDDecoder(w1 + 8, h, false);
+ else
+ img = new BITDDecoder(w /*+ 8*/, h, true);
} else {
img = new BITDDecoder(w, h, true);
}
diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index b763603a4a..cd4487dd74 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -140,7 +140,7 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
if (!_comp) {
debugC(3, kDebugImages, "Skipping compression");
for (y = 0; y < _surface->h; y++) {
- for (x = 0; x < _surface->w; x++) {
+ for (x = 0; x < _surface->w;) {
byte color = stream.readByte();
for (int c = 0; c < 8; c++)
*((byte *)_surface->getBasePtr(x++, y)) = (color & (1 << (7 - c))) ? 0 : 0xff;