aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-24 22:39:44 +0200
committerEugene Sandulenko2016-08-24 22:40:35 +0200
commit35243a235a62230e80f3df982a78ca523ff61abb (patch)
tree4026831aeb3e6310d7478f728d2231b9b468b17d /engines
parent71294a8a988f86d0d0fa91e058d2ca6faaa42815 (diff)
downloadscummvm-rg350-35243a235a62230e80f3df982a78ca523ff61abb.tar.gz
scummvm-rg350-35243a235a62230e80f3df982a78ca523ff61abb.tar.bz2
scummvm-rg350-35243a235a62230e80f3df982a78ca523ff61abb.zip
DIRECTOR: Implemented uncompressed 1bpp pictures. Works sometimes
Diffstat (limited to 'engines')
-rw-r--r--engines/director/director.cpp1
-rw-r--r--engines/director/director.h3
-rw-r--r--engines/director/frame.cpp28
-rw-r--r--engines/director/frame.h2
-rw-r--r--engines/director/images.cpp23
-rw-r--r--engines/director/images.h3
-rw-r--r--engines/director/score.cpp9
-rw-r--r--engines/director/score.h2
8 files changed, 53 insertions, 18 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 9aeba7150b..4e2973b163 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -41,6 +41,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
DebugMan.addDebugChannel(kDebugLingoExec, "lingoexec", "Lingo Execution");
DebugMan.addDebugChannel(kDebugLingoCompile, "lingocompile", "Lingo Compilation");
DebugMan.addDebugChannel(kDebugLoading, "loading", "Loading");
+ DebugMan.addDebugChannel(kDebugImages, "images", "Image drawing");
if (!_mixer->isReady())
error("Sound initialization failed");
diff --git a/engines/director/director.h b/engines/director/director.h
index 23519f135e..97f8a7097d 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -54,7 +54,8 @@ struct Cast;
enum {
kDebugLingoExec = 1 << 0,
kDebugLingoCompile = 1 << 1,
- kDebugLoading = 1 << 2
+ kDebugLoading = 1 << 2,
+ kDebugImages = 1 << 3
};
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 018cb7983c..4bae61f9aa 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -435,7 +435,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
continue;
}
- Image::ImageDecoder *img = getImageFrom(_sprites[i]->_castId, _sprites[i]->_width, _sprites[i]->_height);
+ Image::ImageDecoder *img = getImageFrom(_sprites[i]->_castId);
if (!img) {
warning("Image with id %d not found", _sprites[i]->_castId);
@@ -534,7 +534,7 @@ static const int corrections[] = {
0, 0, 0
};
-Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId, int w, int h) {
+Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
uint16 imgId = spriteId + 1024;
Image::ImageDecoder *img = NULL;
@@ -551,7 +551,15 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId, int w, int h) {
}
if (_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
+ Common::SeekableReadStream *pic = _vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);
+
if (_vm->getVersion() < 4) {
+ BitmapCast *bc = static_cast<BitmapCast *>(_vm->_currentScore->_casts[spriteId]);
+ int w = bc->initialRect.width(), h = bc->initialRect.height();
+
+ debugC(2, kDebugImages, "id: %d, w: %d, h: %d, flags: %x, some: %x, unk1: %d, unk2: %d",
+ imgId, w, h, bc->flags, bc->someFlaggyThing, bc->unk1, bc->unk2);
+
bool c = false;
for (int i = 0; corrections[i]; i += 3)
if (corrections[i] == imgId) {
@@ -561,20 +569,28 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId, int w, int h) {
}
if (!c)
- warning("%d, %d, %d,", imgId, w, w);
- img = new BITDDecoder(w, h);
+ debugC(4, kDebugImages, "%d, %d, %d", imgId, w, h);
+
+ if (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);
+ } else {
+ img = new BITDDecoder(w, h, true);
+ }
} else {
img = new Image::BitmapDecoder();
}
if (debugChannelSet(8, kDebugLoading)) {
- Common::SeekableReadStream *s = _vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);
+ Common::SeekableReadStream *s = pic;
byte buf[1024];
int n = s->read(buf, 1024);
Common::hexdump(buf, n);
}
- img->loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId));
+ img->loadStream(*pic);
return img;
}
diff --git a/engines/director/frame.h b/engines/director/frame.h
index c06157c2cc..8c6f82f493 100644
--- a/engines/director/frame.h
+++ b/engines/director/frame.h
@@ -118,7 +118,7 @@ private:
void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream);
void readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
- Image::ImageDecoder *getImageFrom(uint16 spriteID, int w, int h);
+ Image::ImageDecoder *getImageFrom(uint16 spriteID);
void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
void drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index db429af7e9..2c2553f3ea 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -21,8 +21,10 @@
*/
#include "common/substream.h"
+#include "common/debug.h"
#include "common/textconsole.h"
+#include "director/director.h"
#include "director/images.h"
namespace Director {
@@ -102,11 +104,7 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
* BITD
****************************/
-BITDDecoder::BITDDecoder(int w, int h) {
- int oldw = w;
- //w += 8 - (w + 7) % 8;
-
- //warning("W: %d -> %d, %d", oldw, w, h);
+BITDDecoder::BITDDecoder(int w, int h, bool comp) {
_surface = new Graphics::Surface();
_surface->create(w, h, Graphics::PixelFormat::createFormatCLUT8());
@@ -116,6 +114,8 @@ BITDDecoder::BITDDecoder(int w, int h) {
_palette[255 * 3 + 0] = _palette[255 * 3 + 1] = _palette[255 * 3 + 2] = 0xff;
_paletteColorCount = 2;
+
+ _comp = comp;
}
BITDDecoder::~BITDDecoder() {
@@ -137,6 +137,19 @@ void BITDDecoder::loadPalette(Common::SeekableReadStream &stream) {
bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
int x = 0, y = 0;
+ if (!_comp) {
+ debugC(3, kDebugImages, "Skipping compression");
+ for (y = 0; y < _surface->h; y++) {
+ for (x = 0; x < _surface->w; x++) {
+ byte color = stream.readByte();
+ for (int c = 0; c < 8; c++, x++)
+ *((byte *)_surface->getBasePtr(x, y)) = (color & (1 << (7 - c))) ? 0 : 0xff;
+ }
+ }
+
+ return true;
+ }
+
while (y < _surface->h) {
int n = stream.readSByte();
int count;
diff --git a/engines/director/images.h b/engines/director/images.h
index 54e824588f..4c2bfc85d3 100644
--- a/engines/director/images.h
+++ b/engines/director/images.h
@@ -64,7 +64,7 @@ private:
class BITDDecoder : public Image::ImageDecoder {
public:
- BITDDecoder(int w, int h);
+ BITDDecoder(int w, int h, bool comp);
virtual ~BITDDecoder();
// ImageDecoder API
@@ -79,6 +79,7 @@ private:
Graphics::Surface *_surface;
byte *_palette;
uint8 _paletteColorCount;
+ bool _comp;
};
} // End of namespace Director
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9b4f57245d..2448ab08a8 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -642,16 +642,17 @@ void Score::loadFontMap(Common::SeekableSubReadStreamEndian &stream) {
}
BitmapCast::BitmapCast(Common::SeekableSubReadStreamEndian &stream) {
- /*byte flags = */ stream.readByte();
- uint16 someFlaggyThing = stream.readUint16();
+ flags = stream.readByte();
+ someFlaggyThing = stream.readUint16();
initialRect = Score::readRect(stream);
boundingRect = Score::readRect(stream);
regY = stream.readUint16();
regX = stream.readUint16();
+ unk1 = unk2 = 0;
if (someFlaggyThing & 0x8000) {
- /*uint16 unk1 =*/ stream.readUint16();
- /*uint16 unk2 =*/ stream.readUint16();
+ unk1 = stream.readUint16();
+ unk2 = stream.readUint16();
}
modified = 0;
}
diff --git a/engines/director/score.h b/engines/director/score.h
index dc6a62b971..11f885d492 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -74,6 +74,8 @@ struct BitmapCast : Cast {
uint16 regX;
uint16 regY;
uint8 flags;
+ uint16 someFlaggyThing;
+ uint16 unk1, unk2;
};
enum ShapeType {