diff options
-rw-r--r-- | engines/access/access.cpp | 1 | ||||
-rw-r--r-- | engines/access/asurface.cpp | 44 | ||||
-rw-r--r-- | engines/access/asurface.h | 5 | ||||
-rw-r--r-- | engines/access/screen.cpp | 1 | ||||
-rw-r--r-- | engines/access/screen.h | 1 |
5 files changed, 47 insertions, 5 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 27300f86a2..f625fa096a 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -148,6 +148,7 @@ void AccessEngine::initialize() { } // Create sub-objects of the engine + ASurface::init(); _animation = new AnimationManager(this); _debugger = new Debugger(this); _events = new EventsManager(this); diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index 0fb8f7d43a..438bfbf852 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -38,6 +38,17 @@ int ASurface::_lastBoundsX; int ASurface::_lastBoundsY; int ASurface::_lastBoundsW; int ASurface::_lastBoundsH; +int ASurface::_scrollX; +int ASurface::_scrollY; + +void ASurface::init() { + _leftSkip = _rightSkip = 0; + _topSkip = _bottomSkip = 0; + _clipWidth = _clipHeight = 0; + _lastBoundsX = _lastBoundsY = 0; + _lastBoundsW = _lastBoundsH = 0; + _scrollX = _scrollY = 0; +} void ASurface::clearBuffer() { byte *pSrc = (byte *)getPixels(); @@ -98,12 +109,41 @@ void ASurface::plotImage(SpriteResource *sprite, int frameNum, const Common::Poi _lastBoundsW = r.width(); _lastBoundsH = r.height(); -// plotImage(frame, , ) + plotFrame(frame, pt); } } -void ASurface::plotF(SpriteFrame *frame, const Common::Point &pt) { +void ASurface::plotFrame(SpriteFrame *frame, const Common::Point &pt) { + byte *destP = (byte *)getBasePtr(pt.x, _scrollY + pt.y); + byte *srcP = frame->_data; + + int8 leftVal1 = 18; + int8 leftVal2 = -8; + if (_leftSkip) { + ++leftVal2; + leftVal1 = -12; + } + int8 rightVal = (_rightSkip) ? -7 : -8; + // Skip over any lines of the frame + for (int yp = 0; yp < _topSkip; ++yp) { + srcP += *(srcP + 1) + 2; + } + + byte *srcLineP = srcP; + byte *destLineP = destP; + for (int yp = 0; yp < frame->h; ++yp, srcP = srcLineP, destP = destLineP) { + // Get length of line + int v = *srcP++; + int len = *srcP++; + srcLineP = srcP + len; + destLineP = destP + this->pitch; + + // Draw the line of the frame + if (v != 0 || len != 0) { + warning("TODO: Line draw"); + } + } } } // End of namespace Access diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 7d1ee6c57a..d1e6b64a9e 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -38,8 +38,11 @@ public: static int _clipWidth, _clipHeight; static int _lastBoundsX, _lastBoundsY; static int _lastBoundsW, _lastBoundsH; + static int _scrollX, _scrollY; + + static void init(); protected: - virtual void ASurface::plotF(SpriteFrame *frame, const Common::Point &pt); + virtual void ASurface::plotFrame(SpriteFrame *frame, const Common::Point &pt); public: void clearBuffer(); diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index c1a4d9143c..63fd98b566 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -46,7 +46,6 @@ Screen::Screen(AccessEngine *vm) : _vm(vm) { _scrollFlag = false; _scrollThreshold = 0; _startColor = _numColors = 0; - _scrollX = _scrollY = 0; _scrollCol = _scrollRow = 0; _windowXAdd = _windowYAdd = 0; _screenYOff = 0; diff --git a/engines/access/screen.h b/engines/access/screen.h index 8dc56d273c..f32761347b 100644 --- a/engines/access/screen.h +++ b/engines/access/screen.h @@ -68,7 +68,6 @@ public: int _startColor, _numColors; Common::Point _vWindowSize; Common::Point _bufferStart; - int _scrollX, _scrollY; int _scrollCol, _scrollRow; int _windowXAdd, _windowYAdd; int _screenYOff; |