From 9cb400e05c160ffcca643a6273769d55aefb26b3 Mon Sep 17 00:00:00 2001 From: stevenhoefel Date: Fri, 13 Jan 2017 22:39:58 +1100 Subject: DIRECTOR: Style fixes plus 1/8bpp corrections. --- engines/director/cast.cpp | 3 ++- engines/director/frame.cpp | 5 ----- engines/director/images.cpp | 11 ++++++++--- engines/director/score.h | 1 + 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp index f49d0b5f37..0db59cbd64 100644 --- a/engines/director/cast.cpp +++ b/engines/director/cast.cpp @@ -50,7 +50,8 @@ BitmapCast::BitmapCast(Common::ReadStreamEndian &stream, uint16 version) { regY = stream.readUint16(); bitsPerPixel = stream.readUint16(); - if (bitsPerPixel == 0) bitsPerPixel = 1; + if (bitsPerPixel == 0) + bitsPerPixel = 1; int tail = 0; diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index 0af63585cc..97252344cd 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -819,11 +819,6 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, uint1 textStream = _vm->getSharedSTXT()->getVal(spriteId + 1024); } - byte buf[1024]; - textStream->read(buf, textStream->size()); - textStream->seek(0); - Common::hexdump(buf, textStream->size()); - renderText(surface, spriteId, textStream, false); } diff --git a/engines/director/images.cpp b/engines/director/images.cpp index c2a3c4add8..7d5e08936e 100644 --- a/engines/director/images.cpp +++ b/engines/director/images.cpp @@ -300,19 +300,24 @@ bool BITDDecoderV4::loadStream(Common::SeekableReadStream &stream) { stream.readUint16BE(); } + int offset = 0; + if (_surface->w < (pixels.size() / _surface->h)) + offset = (pixels.size() / _surface->h) - _surface->w; + if (pixels.size() > 0) { for (y = 0; y < _surface->h; y++) { for (x = 0; x < _surface->w;) { switch (_bitsPerPixel) { case 1: { - for (int c = 0; c < 8; c++, x++) - *((byte *)_surface->getBasePtr(x, y)) = (pixels[(((y * _surface->w) + x) / 8) + y] & (1 << (7 - c))) ? 0 : 0xff; + for (int c = 0; c < 8; c++, x++) { + *((byte *)_surface->getBasePtr(x, y)) = (pixels[(((y * _surface->pitch) + x) / 8)] & (1 << (7 - c))) ? 0 : 0xff; + } break; } case 8: //this calculation is wrong.. need a demo with colours. - *((byte *)_surface->getBasePtr(x, y)) = 0xff - pixels[(y * _surface->w) + x]; + *((byte *)_surface->getBasePtr(x, y)) = 0xff - pixels[(y * _surface->w) + x + (y * offset)]; x++; break; diff --git a/engines/director/score.h b/engines/director/score.h index cc3289e946..9b92e48f93 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -75,6 +75,7 @@ public: Common::String getMacName() const { return _macName; } Sprite *getSpriteById(uint16 id); void setSpriteCasts(); + Graphics::ManagedSurface *getSurface() { return _surface; } private: void update(); -- cgit v1.2.3