diff options
author | Paul Gilbert | 2014-08-10 11:47:15 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-10 11:47:15 -0400 |
commit | cce0c2ff97878b2b0b8a87e25395c3ef98bc584e (patch) | |
tree | 5a63d87c97114e834d90bb0d43adbea8cb0f2176 /engines/access/asurface.cpp | |
parent | 00901b200bffcbff69694ff6b54d55908fd74180 (diff) | |
download | scummvm-rg350-cce0c2ff97878b2b0b8a87e25395c3ef98bc584e.tar.gz scummvm-rg350-cce0c2ff97878b2b0b8a87e25395c3ef98bc584e.tar.bz2 scummvm-rg350-cce0c2ff97878b2b0b8a87e25395c3ef98bc584e.zip |
ACCESS: Adding sprite resources and screen saving
Diffstat (limited to 'engines/access/asurface.cpp')
-rw-r--r-- | engines/access/asurface.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index a0a790dbdc..0fb8f7d43a 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -25,9 +25,85 @@ namespace Access { + +/*------------------------------------------------------------------------*/ + +int ASurface::_leftSkip; +int ASurface::_rightSkip; +int ASurface::_topSkip; +int ASurface::_bottomSkip; +int ASurface::_clipWidth; +int ASurface::_clipHeight; +int ASurface::_lastBoundsX; +int ASurface::_lastBoundsY; +int ASurface::_lastBoundsW; +int ASurface::_lastBoundsH; + void ASurface::clearBuffer() { byte *pSrc = (byte *)getPixels(); Common::fill(pSrc, pSrc + w * h, 0); } +bool ASurface::clip(Common::Rect &r) { + int skip; + _leftSkip = _rightSkip = 0; + _topSkip = _bottomSkip = 0; + + if (r.left > _clipWidth) { + skip = -r.left; + r.setWidth(r.width() - skip); + _leftSkip = skip; + r.moveTo(0, r.top); + } + else if (r.left >= 0) + return true; + + int right = r.right - 1; + if (right < 0) + return true; + else if (right > _clipWidth) { + skip = right - _clipWidth; + r.setWidth(r.width() - skip); + _rightSkip = skip; + } + + if (r.top > _clipHeight) { + skip = -r.top; + r.setHeight(r.height() - skip); + _topSkip = skip; + r.moveTo(r.left, 0); + } + else if (r.top >= 0) + return true; + + int bottom = r.bottom - 1; + if (bottom < 0) + return true; + else if (bottom > _clipHeight) { + skip = bottom - _clipHeight; + _bottomSkip = skip; + r.setHeight(r.height() - skip); + } + + return false; +} + +void ASurface::plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt) { + SpriteFrame *frame = sprite->getFrame(frameNum); + Common::Rect r(pt.x, pt.y, pt.x + frame->w, pt.y + frame->h); + + if (!clip(r)) { + _lastBoundsX = r.left; + _lastBoundsY = r.top; + _lastBoundsW = r.width(); + _lastBoundsH = r.height(); + +// plotImage(frame, , ) + } +} + +void ASurface::plotF(SpriteFrame *frame, const Common::Point &pt) { + +} + } // End of namespace Access |