diff options
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/access.cpp | 6 | ||||
-rw-r--r-- | engines/access/asurface.cpp | 24 | ||||
-rw-r--r-- | engines/access/asurface.h | 14 | ||||
-rw-r--r-- | engines/access/screen.cpp | 2 |
4 files changed, 37 insertions, 9 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 7d12ba5b35..ab58f8effc 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -153,8 +153,8 @@ void AccessEngine::initialize() { _screen = new Screen(this); _sound = new SoundManager(this, _mixer); - _buffer1.create(g_system->getWidth() + TILE_WIDTH, g_system->getHeight(), Graphics::PixelFormat::createFormatCLUT8()); - _buffer2.create(g_system->getWidth(), g_system->getHeight(), Graphics::PixelFormat::createFormatCLUT8()); + _buffer1.create(g_system->getWidth() + TILE_WIDTH, g_system->getHeight()); + _buffer2.create(g_system->getWidth(), g_system->getHeight()); } Common::Error AccessEngine::run() { @@ -272,7 +272,7 @@ void AccessEngine::plotList1() { bounds.setWidth(bounds.width() / _scale); if (ie._flags & 2) { - _buffer2.sPlotB(frame, Common::Point(bounds.left, bounds.top)); + _buffer2.sPlotB(frame, destBounds); } else { _buffer2.sPlotF(frame, destBounds); } diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index 99292278f3..746e8d0f5a 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -59,7 +59,7 @@ SpriteResource::~SpriteResource() { SpriteFrame::SpriteFrame(AccessEngine *vm, Common::MemoryReadStream &stream, int frameSize) { int xSize = stream.readUint16LE(); int ySize = stream.readUint16LE(); - create(xSize, ySize, Graphics::PixelFormat::createFormatCLUT8()); + create(xSize, ySize); // Empty surface byte *data = (byte *)getPixels(); @@ -138,6 +138,10 @@ ASurface::~ASurface() { _savedBlock.free(); } +void ASurface::create(uint16 width, uint16 height) { + Graphics::Surface::create(width, height, Graphics::PixelFormat::createFormatCLUT8()); +} + void ASurface::clearBuffer() { byte *pSrc = (byte *)getPixels(); Common::fill(pSrc, pSrc + w * h, 0); @@ -301,8 +305,10 @@ void ASurface::copyTo(ASurface *dest, const Common::Rect &bounds) { } } -void ASurface::sPlotB(SpriteFrame *frame, const Common::Point &pt) { - frame->copyTo(this, pt); +void ASurface::sPlotB(SpriteFrame *frame, const Common::Rect &bounds) { + ASurface flippedFrame; + frame->flipHorizontal(flippedFrame); + flippedFrame.copyTo(this, bounds); } void ASurface::sPlotF(SpriteFrame *frame, const Common::Rect &bounds) { @@ -341,4 +347,16 @@ void ASurface::drawRect() { Graphics::Surface::fillRect(Common::Rect(_orgX1, _orgY1, _orgX2, _orgY2), _lColor); } +void ASurface::flipHorizontal(ASurface &dest) { + dest.create(this->w, this->h); + for (int y = 0; y < h; ++y) { + const byte *pSrc = (const byte *)getBasePtr(this->w - 1, y); + byte *pDest = (byte *)dest.getBasePtr(0, y); + + for (int x = 0; x < w; ++x, --pSrc, ++pDest) + *pDest = *pSrc; + } +} + + } // End of namespace Access diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 400dd07b4d..460f73d2c0 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -39,6 +39,8 @@ class ASurface : public Graphics::Surface { private: Graphics::Surface _savedBlock; Common::Rect _savedBounds; + + void flipHorizontal(ASurface &dest); public: static int _leftSkip, _rightSkip; static int _topSkip, _bottomSkip; @@ -56,6 +58,8 @@ public: public: virtual ~ASurface(); + void create(uint16 width, uint16 height); + void clearBuffer(); void copyBuffer(Graphics::Surface *src) { copyFrom(*src); } @@ -64,10 +68,16 @@ public: void plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt); - void sPlotB(SpriteFrame *frame, const Common::Point &pt); - + /** + * Scaled draw frame + */ void sPlotF(SpriteFrame *frame, const Common::Rect &bounds); + /** + * Scaled flipped horizontal draw frame + */ + void sPlotB(SpriteFrame *frame, const Common::Rect &bounds); + void plotB(SpriteFrame *frame, const Common::Point &pt); void copyBlock(ASurface *src, const Common::Rect &bounds); diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index 8e9b08234f..3092d7e152 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -35,7 +35,7 @@ namespace Access { #define VGA_COLOR_TRANS(x) ((x) * 255 / 63) Screen::Screen(AccessEngine *vm) : _vm(vm) { - create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); + create(320, 200); Common::fill(&_tempPalette[0], &_tempPalette[PALETTE_SIZE], 0); Common::fill(&_manPal[0], &_manPal[0x60], 0); Common::fill(&_scaleTable1[0], &_scaleTable1[256], 0); |