aboutsummaryrefslogtreecommitdiff
path: root/engines/access/asurface.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2014-08-10 15:50:22 -0400
committerPaul Gilbert2014-08-10 15:50:22 -0400
commit47d75ae128d2b29ace73925373901cf7bbc6325d (patch)
tree1c7345f1830a521a0085751be49abe927dce226b /engines/access/asurface.cpp
parent0e3f9e983d51759e0d6373e95c71b2130e7f181c (diff)
downloadscummvm-rg350-47d75ae128d2b29ace73925373901cf7bbc6325d.tar.gz
scummvm-rg350-47d75ae128d2b29ace73925373901cf7bbc6325d.tar.bz2
scummvm-rg350-47d75ae128d2b29ace73925373901cf7bbc6325d.zip
ACCESS: Beginnings of logic for drawing sprite frames
Diffstat (limited to 'engines/access/asurface.cpp')
-rw-r--r--engines/access/asurface.cpp44
1 files changed, 42 insertions, 2 deletions
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